@deck.gl/geo-layers 9.0.0-beta.2 → 9.0.0-beta.3
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/dist/dist.dev.js +2796 -7199
- package/dist/geo-cell-layer/GeoCellLayer.js +51 -0
- package/dist/geohash-layer/geohash-layer.js +19 -0
- package/dist/geohash-layer/geohash-utils.js +50 -0
- package/dist/great-circle-layer/great-circle-layer.js +12 -0
- package/dist/h3-layers/h3-cluster-layer.js +47 -0
- package/dist/h3-layers/h3-hexagon-layer.js +204 -0
- package/dist/h3-layers/h3-utils.js +56 -0
- package/dist/index.cjs +3199 -0
- package/dist/index.cjs.map +7 -0
- package/{typed → dist}/index.d.ts +5 -5
- package/{typed → dist}/index.d.ts.map +1 -1
- package/dist/index.js +36 -0
- package/dist/{esm/mesh-layer → mesh-layer}/mesh-layer-fragment.glsl.js +0 -1
- package/dist/{esm/mesh-layer → mesh-layer}/mesh-layer-vertex.glsl.js +0 -1
- package/dist/mesh-layer/mesh-layer.js +129 -0
- package/{typed → dist}/mvt-layer/coordinate-transform.d.ts +1 -1
- package/{typed → dist}/mvt-layer/coordinate-transform.d.ts.map +1 -1
- package/dist/mvt-layer/coordinate-transform.js +41 -0
- package/dist/mvt-layer/find-index-binary.d.ts +11 -0
- package/dist/mvt-layer/find-index-binary.d.ts.map +1 -0
- package/dist/mvt-layer/find-index-binary.js +96 -0
- package/{typed → dist}/mvt-layer/mvt-layer.d.ts +6 -5
- package/dist/mvt-layer/mvt-layer.d.ts.map +1 -0
- package/dist/mvt-layer/mvt-layer.js +305 -0
- package/dist/quadkey-layer/quadkey-layer.js +22 -0
- package/dist/quadkey-layer/quadkey-utils.js +26 -0
- package/dist/s2-layer/s2-geometry.js +123 -0
- package/dist/s2-layer/s2-layer.js +38 -0
- package/dist/s2-layer/s2-utils.js +87 -0
- package/{typed → dist}/terrain-layer/terrain-layer.d.ts +3 -3
- package/dist/terrain-layer/terrain-layer.d.ts.map +1 -0
- package/dist/terrain-layer/terrain-layer.js +233 -0
- package/dist/tile-3d-layer/tile-3d-layer.js +302 -0
- package/{typed → dist}/tile-layer/tile-layer.d.ts +3 -3
- package/dist/tile-layer/tile-layer.d.ts.map +1 -0
- package/dist/tile-layer/tile-layer.js +204 -0
- package/dist/tileset-2d/index.js +4 -0
- package/dist/tileset-2d/memoize.js +41 -0
- package/{typed → dist}/tileset-2d/tile-2d-header.d.ts +2 -1
- package/dist/tileset-2d/tile-2d-header.d.ts.map +1 -0
- package/dist/tileset-2d/tile-2d-header.js +135 -0
- package/{typed → dist}/tileset-2d/tile-2d-traversal.d.ts +1 -1
- package/{typed → dist}/tileset-2d/tile-2d-traversal.d.ts.map +1 -1
- package/dist/tileset-2d/tile-2d-traversal.js +182 -0
- package/{typed → dist}/tileset-2d/tileset-2d.d.ts +4 -4
- package/{typed → dist}/tileset-2d/tileset-2d.d.ts.map +1 -1
- package/dist/tileset-2d/tileset-2d.js +456 -0
- package/dist/tileset-2d/types.js +1 -0
- package/{typed → dist}/tileset-2d/utils.d.ts +2 -2
- package/dist/tileset-2d/utils.d.ts.map +1 -0
- package/dist/tileset-2d/utils.js +234 -0
- package/dist/trips-layer/trips-layer.js +93 -0
- package/dist/wms-layer/utils.js +13 -0
- package/dist/wms-layer/wms-layer.js +192 -0
- package/dist.min.js +27 -162
- package/package.json +32 -18
- package/src/index.ts +5 -5
- package/src/mvt-layer/coordinate-transform.ts +1 -1
- package/src/mvt-layer/find-index-binary.ts +5 -9
- package/src/mvt-layer/mvt-layer.ts +19 -15
- package/src/terrain-layer/terrain-layer.ts +13 -3
- package/src/tile-layer/tile-layer.ts +8 -9
- package/src/tileset-2d/tile-2d-header.ts +2 -1
- package/src/tileset-2d/tile-2d-traversal.ts +1 -1
- package/src/tileset-2d/tileset-2d.ts +7 -3
- package/src/tileset-2d/utils.ts +2 -2
- package/src/wms-layer/wms-layer.ts +1 -1
- package/dist/es5/geo-cell-layer/GeoCellLayer.js +0 -118
- package/dist/es5/geo-cell-layer/GeoCellLayer.js.map +0 -1
- package/dist/es5/geohash-layer/geohash-layer.js +0 -67
- package/dist/es5/geohash-layer/geohash-layer.js.map +0 -1
- package/dist/es5/geohash-layer/geohash-utils.js +0 -77
- package/dist/es5/geohash-layer/geohash-utils.js.map +0 -1
- package/dist/es5/great-circle-layer/great-circle-layer.js +0 -48
- package/dist/es5/great-circle-layer/great-circle-layer.js.map +0 -1
- package/dist/es5/h3-layers/h3-cluster-layer.js +0 -162
- package/dist/es5/h3-layers/h3-cluster-layer.js.map +0 -1
- package/dist/es5/h3-layers/h3-hexagon-layer.js +0 -351
- package/dist/es5/h3-layers/h3-hexagon-layer.js.map +0 -1
- package/dist/es5/h3-layers/h3-utils.js +0 -111
- package/dist/es5/h3-layers/h3-utils.js.map +0 -1
- package/dist/es5/index.js +0 -132
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/mesh-layer/mesh-layer-fragment.glsl.js +0 -9
- package/dist/es5/mesh-layer/mesh-layer-fragment.glsl.js.map +0 -1
- package/dist/es5/mesh-layer/mesh-layer-vertex.glsl.js +0 -9
- package/dist/es5/mesh-layer/mesh-layer-vertex.glsl.js.map +0 -1
- package/dist/es5/mesh-layer/mesh-layer.js +0 -217
- package/dist/es5/mesh-layer/mesh-layer.js.map +0 -1
- package/dist/es5/mvt-layer/coordinate-transform.js +0 -83
- package/dist/es5/mvt-layer/coordinate-transform.js.map +0 -1
- package/dist/es5/mvt-layer/find-index-binary.js +0 -127
- package/dist/es5/mvt-layer/find-index-binary.js.map +0 -1
- package/dist/es5/mvt-layer/mvt-layer.js +0 -533
- package/dist/es5/mvt-layer/mvt-layer.js.map +0 -1
- package/dist/es5/quadkey-layer/quadkey-layer.js +0 -72
- package/dist/es5/quadkey-layer/quadkey-layer.js.map +0 -1
- package/dist/es5/quadkey-layer/quadkey-utils.js +0 -53
- package/dist/es5/quadkey-layer/quadkey-utils.js.map +0 -1
- package/dist/es5/s2-layer/s2-geometry.js +0 -158
- package/dist/es5/s2-layer/s2-geometry.js.map +0 -1
- package/dist/es5/s2-layer/s2-layer.js +0 -67
- package/dist/es5/s2-layer/s2-layer.js.map +0 -1
- package/dist/es5/s2-layer/s2-utils.js +0 -80
- package/dist/es5/s2-layer/s2-utils.js.map +0 -1
- package/dist/es5/terrain-layer/terrain-layer.js +0 -347
- package/dist/es5/terrain-layer/terrain-layer.js.map +0 -1
- package/dist/es5/tile-3d-layer/tile-3d-layer.js +0 -511
- package/dist/es5/tile-3d-layer/tile-3d-layer.js.map +0 -1
- package/dist/es5/tile-layer/tile-layer.js +0 -363
- package/dist/es5/tile-layer/tile-layer.js.map +0 -1
- package/dist/es5/tileset-2d/index.js +0 -66
- package/dist/es5/tileset-2d/index.js.map +0 -1
- package/dist/es5/tileset-2d/memoize.js +0 -47
- package/dist/es5/tileset-2d/memoize.js.map +0 -1
- package/dist/es5/tileset-2d/tile-2d-header.js +0 -250
- package/dist/es5/tileset-2d/tile-2d-header.js.map +0 -1
- package/dist/es5/tileset-2d/tile-2d-traversal.js +0 -256
- package/dist/es5/tileset-2d/tile-2d-traversal.js.map +0 -1
- package/dist/es5/tileset-2d/tileset-2d.js +0 -757
- package/dist/es5/tileset-2d/tileset-2d.js.map +0 -1
- package/dist/es5/tileset-2d/types.js +0 -2
- package/dist/es5/tileset-2d/types.js.map +0 -1
- package/dist/es5/tileset-2d/utils.js +0 -302
- package/dist/es5/tileset-2d/utils.js.map +0 -1
- package/dist/es5/trips-layer/trips-layer.js +0 -114
- package/dist/es5/trips-layer/trips-layer.js.map +0 -1
- package/dist/es5/wms-layer/utils.js +0 -18
- package/dist/es5/wms-layer/utils.js.map +0 -1
- package/dist/es5/wms-layer/wms-layer.js +0 -376
- package/dist/es5/wms-layer/wms-layer.js.map +0 -1
- package/dist/esm/geo-cell-layer/GeoCellLayer.js +0 -72
- package/dist/esm/geo-cell-layer/GeoCellLayer.js.map +0 -1
- package/dist/esm/geohash-layer/geohash-layer.js +0 -26
- package/dist/esm/geohash-layer/geohash-layer.js.map +0 -1
- package/dist/esm/geohash-layer/geohash-utils.js +0 -56
- package/dist/esm/geohash-layer/geohash-utils.js.map +0 -1
- package/dist/esm/great-circle-layer/great-circle-layer.js +0 -12
- package/dist/esm/great-circle-layer/great-circle-layer.js.map +0 -1
- package/dist/esm/h3-layers/h3-cluster-layer.js +0 -79
- package/dist/esm/h3-layers/h3-cluster-layer.js.map +0 -1
- package/dist/esm/h3-layers/h3-hexagon-layer.js +0 -280
- package/dist/esm/h3-layers/h3-hexagon-layer.js.map +0 -1
- package/dist/esm/h3-layers/h3-utils.js +0 -54
- package/dist/esm/h3-layers/h3-utils.js.map +0 -1
- package/dist/esm/index.js +0 -17
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/mesh-layer/mesh-layer-fragment.glsl.js.map +0 -1
- package/dist/esm/mesh-layer/mesh-layer-vertex.glsl.js.map +0 -1
- package/dist/esm/mesh-layer/mesh-layer.js +0 -178
- package/dist/esm/mesh-layer/mesh-layer.js.map +0 -1
- package/dist/esm/mvt-layer/coordinate-transform.js +0 -49
- package/dist/esm/mvt-layer/coordinate-transform.js.map +0 -1
- package/dist/esm/mvt-layer/find-index-binary.js +0 -99
- package/dist/esm/mvt-layer/find-index-binary.js.map +0 -1
- package/dist/esm/mvt-layer/mvt-layer.js +0 -427
- package/dist/esm/mvt-layer/mvt-layer.js.map +0 -1
- package/dist/esm/quadkey-layer/quadkey-layer.js +0 -31
- package/dist/esm/quadkey-layer/quadkey-layer.js.map +0 -1
- package/dist/esm/quadkey-layer/quadkey-utils.js +0 -24
- package/dist/esm/quadkey-layer/quadkey-utils.js.map +0 -1
- package/dist/esm/s2-layer/s2-geometry.js +0 -126
- package/dist/esm/s2-layer/s2-geometry.js.map +0 -1
- package/dist/esm/s2-layer/s2-layer.js +0 -26
- package/dist/esm/s2-layer/s2-layer.js.map +0 -1
- package/dist/esm/s2-layer/s2-utils.js +0 -69
- package/dist/esm/s2-layer/s2-utils.js.map +0 -1
- package/dist/esm/terrain-layer/terrain-layer.js +0 -292
- package/dist/esm/terrain-layer/terrain-layer.js.map +0 -1
- package/dist/esm/tile-3d-layer/tile-3d-layer.js +0 -438
- package/dist/esm/tile-3d-layer/tile-3d-layer.js.map +0 -1
- package/dist/esm/tile-layer/tile-layer.js +0 -299
- package/dist/esm/tile-layer/tile-layer.js.map +0 -1
- package/dist/esm/tileset-2d/index.js +0 -4
- package/dist/esm/tileset-2d/index.js.map +0 -1
- package/dist/esm/tileset-2d/memoize.js +0 -40
- package/dist/esm/tileset-2d/memoize.js.map +0 -1
- package/dist/esm/tileset-2d/tile-2d-header.js +0 -179
- package/dist/esm/tileset-2d/tile-2d-header.js.map +0 -1
- package/dist/esm/tileset-2d/tile-2d-traversal.js +0 -184
- package/dist/esm/tileset-2d/tile-2d-traversal.js.map +0 -1
- package/dist/esm/tileset-2d/tileset-2d.js +0 -509
- package/dist/esm/tileset-2d/tileset-2d.js.map +0 -1
- package/dist/esm/tileset-2d/types.js +0 -2
- package/dist/esm/tileset-2d/types.js.map +0 -1
- package/dist/esm/tileset-2d/utils.js +0 -233
- package/dist/esm/tileset-2d/utils.js.map +0 -1
- package/dist/esm/trips-layer/trips-layer.js +0 -88
- package/dist/esm/trips-layer/trips-layer.js.map +0 -1
- package/dist/esm/wms-layer/utils.js +0 -9
- package/dist/esm/wms-layer/utils.js.map +0 -1
- package/dist/esm/wms-layer/wms-layer.js +0 -231
- package/dist/esm/wms-layer/wms-layer.js.map +0 -1
- package/typed/mvt-layer/find-index-binary.d.ts +0 -12
- package/typed/mvt-layer/find-index-binary.d.ts.map +0 -1
- package/typed/mvt-layer/mvt-layer.d.ts.map +0 -1
- package/typed/terrain-layer/terrain-layer.d.ts.map +0 -1
- package/typed/tile-layer/tile-layer.d.ts.map +0 -1
- package/typed/tileset-2d/tile-2d-header.d.ts.map +0 -1
- package/typed/tileset-2d/utils.d.ts.map +0 -1
- /package/{typed → dist}/geo-cell-layer/GeoCellLayer.d.ts +0 -0
- /package/{typed → dist}/geo-cell-layer/GeoCellLayer.d.ts.map +0 -0
- /package/{typed → dist}/geohash-layer/geohash-layer.d.ts +0 -0
- /package/{typed → dist}/geohash-layer/geohash-layer.d.ts.map +0 -0
- /package/{typed → dist}/geohash-layer/geohash-utils.d.ts +0 -0
- /package/{typed → dist}/geohash-layer/geohash-utils.d.ts.map +0 -0
- /package/{typed → dist}/great-circle-layer/great-circle-layer.d.ts +0 -0
- /package/{typed → dist}/great-circle-layer/great-circle-layer.d.ts.map +0 -0
- /package/{typed → dist}/h3-layers/h3-cluster-layer.d.ts +0 -0
- /package/{typed → dist}/h3-layers/h3-cluster-layer.d.ts.map +0 -0
- /package/{typed → dist}/h3-layers/h3-hexagon-layer.d.ts +0 -0
- /package/{typed → dist}/h3-layers/h3-hexagon-layer.d.ts.map +0 -0
- /package/{typed → dist}/h3-layers/h3-utils.d.ts +0 -0
- /package/{typed → dist}/h3-layers/h3-utils.d.ts.map +0 -0
- /package/{typed → dist}/mesh-layer/mesh-layer-fragment.glsl.d.ts +0 -0
- /package/{typed → dist}/mesh-layer/mesh-layer-fragment.glsl.d.ts.map +0 -0
- /package/{typed → dist}/mesh-layer/mesh-layer-vertex.glsl.d.ts +0 -0
- /package/{typed → dist}/mesh-layer/mesh-layer-vertex.glsl.d.ts.map +0 -0
- /package/{typed → dist}/mesh-layer/mesh-layer.d.ts +0 -0
- /package/{typed → dist}/mesh-layer/mesh-layer.d.ts.map +0 -0
- /package/{typed → dist}/quadkey-layer/quadkey-layer.d.ts +0 -0
- /package/{typed → dist}/quadkey-layer/quadkey-layer.d.ts.map +0 -0
- /package/{typed → dist}/quadkey-layer/quadkey-utils.d.ts +0 -0
- /package/{typed → dist}/quadkey-layer/quadkey-utils.d.ts.map +0 -0
- /package/{typed → dist}/s2-layer/s2-geometry.d.ts +0 -0
- /package/{typed → dist}/s2-layer/s2-geometry.d.ts.map +0 -0
- /package/{typed → dist}/s2-layer/s2-layer.d.ts +0 -0
- /package/{typed → dist}/s2-layer/s2-layer.d.ts.map +0 -0
- /package/{typed → dist}/s2-layer/s2-utils.d.ts +0 -0
- /package/{typed → dist}/s2-layer/s2-utils.d.ts.map +0 -0
- /package/{typed → dist}/tile-3d-layer/tile-3d-layer.d.ts +0 -0
- /package/{typed → dist}/tile-3d-layer/tile-3d-layer.d.ts.map +0 -0
- /package/{typed → dist}/tileset-2d/index.d.ts +0 -0
- /package/{typed → dist}/tileset-2d/index.d.ts.map +0 -0
- /package/{typed → dist}/tileset-2d/memoize.d.ts +0 -0
- /package/{typed → dist}/tileset-2d/memoize.d.ts.map +0 -0
- /package/{typed → dist}/tileset-2d/types.d.ts +0 -0
- /package/{typed → dist}/tileset-2d/types.d.ts.map +0 -0
- /package/{typed → dist}/trips-layer/trips-layer.d.ts +0 -0
- /package/{typed → dist}/trips-layer/trips-layer.d.ts.map +0 -0
- /package/{typed → dist}/wms-layer/utils.d.ts +0 -0
- /package/{typed → dist}/wms-layer/utils.d.ts.map +0 -0
- /package/{typed → dist}/wms-layer/wms-layer.d.ts +0 -0
- /package/{typed → dist}/wms-layer/wms-layer.d.ts.map +0 -0
package/dist.min.js
CHANGED
|
@@ -4,23 +4,13 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['deck'] = factory();
|
|
6
6
|
else root['deck'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var
|
|
8
|
-
`&&t[i]!=="\r";i++)c+=t[i];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),i--),!
|
|
9
|
-
`||t==="\r"}function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
`;function H1(t,e){var r="";return e.format&&e.indentBy.length>0&&(r=k1),Jh(t,e,"",r)}function Jh(t,e,r,n){for(var s="",i=!1,o=0;o<t.length;o++){var a=t[o],c=V1(a),u="";if(r.length===0?u=c:u="".concat(r,".").concat(c),c===e.textNodeName){var l=a[c];z1(u,e)||(l=e.tagValueProcessor(c,l),l=Wh(l,e)),i&&(s+=n),s+=l,i=!1;continue}else if(c===e.cdataPropName){i&&(s+=n),s+="<![CDATA[".concat(a[c][0][e.textNodeName],"]]>"),i=!1;continue}else if(c===e.commentPropName){s+=n+"<!--".concat(a[c][0][e.textNodeName],"-->"),i=!0;continue}else if(c[0]==="?"){var f=qh(a[":@"],e),h=c==="?xml"?"":n,d=a[c][0][e.textNodeName];d=d.length!==0?" "+d:"",s+=h+"<".concat(c).concat(d).concat(f,"?>"),i=!0;continue}var p=n;p!==""&&(p+=e.indentBy);var g=qh(a[":@"],e),m=n+"<".concat(c).concat(g),A=Jh(a[c],e,u,p);e.unpairedTags.indexOf(c)!==-1?e.suppressUnpairedNode?s+=m+">":s+=m+"/>":(!A||A.length===0)&&e.suppressEmptyNode?s+=m+"/>":A&&A.endsWith(">")?s+=m+">".concat(A).concat(n,"</").concat(c,">"):(s+=m+">",A&&n!==""&&(A.includes("/>")||A.includes("</"))?s+=n+e.indentBy+A+n:s+=A,s+="</".concat(c,">")),i=!0}return s}function V1(t){for(var e=Object.keys(t),r=0;r<e.length;r++){var n=e[r];if(n!==":@")return n}}function qh(t,e){var r="";if(t&&!e.ignoreAttributes)for(var n in t){var s=e.attributeValueProcessor(n,t[n]);s=Wh(s,e),s===!0&&e.suppressBooleanAttributes?r+=" ".concat(n.substr(e.attributeNamePrefix.length)):r+=" ".concat(n.substr(e.attributeNamePrefix.length),'="').concat(s,'"')}return r}function z1(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);var r=t.substr(t.lastIndexOf(".")+1);for(var n in e.stopNodes)if(e.stopNodes[n]===t||e.stopNodes[n]==="*."+r)return!0;return!1}function Wh(t,e){if(t&&t.length>0&&e.processEntities)for(var r=0;r<e.entities.length;r++){var n=e.entities[r];t=t.replace(n.regex,n.val)}return t}Xh.exports=H1});var Zh=ce((EL,Yh)=>{"use strict";function kn(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?kn=function(r){return typeof r}:kn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},kn(t)}function j1(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var q1=Kh(),J1={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,r){return r},attributeValueProcessor:function(e,r){return r},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Ut(t){this.options=Object.assign({},J1,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=K1),this.processTextOrObjNode=W1,this.options.format?(this.indentate=X1,this.tagEndChar=`>
|
|
7
|
+
"use strict";var __exports__=(()=>{var c0=Object.create;var ss=Object.defineProperty;var l0=Object.getOwnPropertyDescriptor;var h0=Object.getOwnPropertyNames;var f0=Object.getPrototypeOf,u0=Object.prototype.hasOwnProperty;var Ml=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var et=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ht=(t,e)=>{for(var r in e)ss(t,r,{get:e[r],enumerable:!0})},ns=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of h0(e))!u0.call(t,s)&&s!==r&&ss(t,s,{get:()=>e[s],enumerable:!(n=l0(e,s))||n.enumerable});return t},pe=(t,e,r)=>(ns(t,e,"default"),r&&ns(r,e,"default")),v=(t,e,r)=>(r=t!=null?c0(f0(t)):{},ns(e||!t||!t.__esModule?ss(r,"default",{value:t,enumerable:!0}):r,t)),d0=t=>ns(ss({},"__esModule",{value:!0}),t);var Ut=et((oM,yl)=>{yl.exports=globalThis.deck});var Lt=et((cM,Fl)=>{Fl.exports=globalThis.deck});var os=et(ie=>{"use strict";var Nl=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",g0=Nl+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Ol="["+Nl+"]["+g0+"]*",A0=new RegExp("^"+Ol+"$"),_0=function(t,e){let r=[],n=e.exec(t);for(;n;){let s=[];s.startIndex=e.lastIndex-n[0].length;let i=n.length;for(let o=0;o<i;o++)s.push(n[o]);r.push(s),n=e.exec(t)}return r},m0=function(t){let e=A0.exec(t);return!(e===null||typeof e>"u")};ie.isExist=function(t){return typeof t<"u"};ie.isEmptyObject=function(t){return Object.keys(t).length===0};ie.merge=function(t,e,r){if(e){let n=Object.keys(e),s=n.length;for(let i=0;i<s;i++)r==="strict"?t[n[i]]=[e[n[i]]]:t[n[i]]=e[n[i]]}};ie.getValue=function(t){return ie.isExist(t)?t:""};ie.isName=m0;ie.getAllMatches=_0;ie.nameRegexp=Ol});var ho=et(vl=>{"use strict";var lo=os(),T0={allowBooleanAttributes:!1,unpairedTags:[]};vl.validate=function(t,e){e=Object.assign({},T0,e);let r=[],n=!1,s=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let i=0;i<t.length;i++)if(t[i]==="<"&&t[i+1]==="?"){if(i+=2,i=Pl(t,i),i.err)return i}else if(t[i]==="<"){let o=i;if(i++,t[i]==="!"){i=Dl(t,i);continue}else{let a=!1;t[i]==="/"&&(a=!0,i++);let c="";for(;i<t.length&&t[i]!==">"&&t[i]!==" "&&t[i]!==" "&&t[i]!==`
|
|
8
|
+
`&&t[i]!=="\r";i++)c+=t[i];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),i--),!y0(c)){let f;return c.trim().length===0?f="Invalid space after '<'.":f="Tag '"+c+"' is an invalid name.",it("InvalidTag",f,Tt(t,i))}let l=x0(t,i);if(l===!1)return it("InvalidAttr","Attributes for '"+c+"' have open quote.",Tt(t,i));let h=l.value;if(i=l.index,h[h.length-1]==="/"){let f=i-h.length;h=h.substring(0,h.length-1);let u=wl(h,e);if(u===!0)n=!0;else return it(u.err.code,u.err.msg,Tt(t,f+u.err.line))}else if(a)if(l.tagClosed){if(h.trim().length>0)return it("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",Tt(t,o));{let f=r.pop();if(c!==f.tagName){let u=Tt(t,f.tagStartPos);return it("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+u.line+", col "+u.col+") instead of closing tag '"+c+"'.",Tt(t,o))}r.length==0&&(s=!0)}}else return it("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",Tt(t,i));else{let f=wl(h,e);if(f!==!0)return it(f.err.code,f.err.msg,Tt(t,i-h.length+f.err.line));if(s===!0)return it("InvalidXml","Multiple possible root nodes found.",Tt(t,i));e.unpairedTags.indexOf(c)!==-1||r.push({tagName:c,tagStartPos:o}),n=!0}for(i++;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="!"){i++,i=Dl(t,i);continue}else if(t[i+1]==="?"){if(i=Pl(t,++i),i.err)return i}else break;else if(t[i]==="&"){let f=B0(t,i);if(f==-1)return it("InvalidChar","char '&' is not expected.",Tt(t,i));i=f}else if(s===!0&&!bl(t[i]))return it("InvalidXml","Extra text at the end",Tt(t,i));t[i]==="<"&&i--}}else{if(bl(t[i]))continue;return it("InvalidChar","char '"+t[i]+"' is not expected.",Tt(t,i))}if(n){if(r.length==1)return it("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",Tt(t,r[0].tagStartPos));if(r.length>0)return it("InvalidXml","Invalid '"+JSON.stringify(r.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return it("InvalidXml","Start tag expected.",1);return!0};function bl(t){return t===" "||t===" "||t===`
|
|
9
|
+
`||t==="\r"}function Pl(t,e){let r=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){let n=t.substr(r,e-r);if(e>5&&n==="xml")return it("InvalidXml","XML declaration allowed only at the start of the document.",Tt(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function Dl(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let r=1;for(e+=8;e<t.length;e++)if(t[e]==="<")r++;else if(t[e]===">"&&(r--,r===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}var E0='"',R0="'";function x0(t,e){let r="",n="",s=!1;for(;e<t.length;e++){if(t[e]===E0||t[e]===R0)n===""?n=t[e]:n!==t[e]||(n="");else if(t[e]===">"&&n===""){s=!0;break}r+=t[e]}return n!==""?!1:{value:r,index:e,tagClosed:s}}var S0=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function wl(t,e){let r=lo.getAllMatches(t,S0),n={};for(let s=0;s<r.length;s++){if(r[s][1].length===0)return it("InvalidAttr","Attribute '"+r[s][2]+"' has no space in starting.",Jr(r[s]));if(r[s][3]!==void 0&&r[s][4]===void 0)return it("InvalidAttr","Attribute '"+r[s][2]+"' is without value.",Jr(r[s]));if(r[s][3]===void 0&&!e.allowBooleanAttributes)return it("InvalidAttr","boolean attribute '"+r[s][2]+"' is not allowed.",Jr(r[s]));let i=r[s][2];if(!M0(i))return it("InvalidAttr","Attribute '"+i+"' is an invalid name.",Jr(r[s]));if(!n.hasOwnProperty(i))n[i]=1;else return it("InvalidAttr","Attribute '"+i+"' is repeated.",Jr(r[s]))}return!0}function C0(t,e){let r=/\d/;for(t[e]==="x"&&(e++,r=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(r))break}return-1}function B0(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,C0(t,e);let r=0;for(;e<t.length;e++,r++)if(!(t[e].match(/\w/)&&r<20)){if(t[e]===";")break;return-1}return e}function it(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function M0(t){return lo.isName(t)}function y0(t){return lo.isName(t)}function Tt(t,e){let r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function Jr(t){return t.startIndex+t[1].length}});var Ll=et(fo=>{var Ul={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t}},I0=function(t){return Object.assign({},Ul,t)};fo.buildOptions=I0;fo.defaultOptions=Ul});var Vl=et((dM,Hl)=>{"use strict";var uo=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,r){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:r})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,[":@"]:e[":@"]}):this.child.push({[e.tagname]:e.child})}};Hl.exports=uo});var Wl=et((pM,Xl)=>{var F0=os();function N0(t,e){let r={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let n=1,s=!1,i=!1,o="";for(;e<t.length;e++)if(t[e]==="<"&&!i){if(s&&P0(t,e))e+=7,[entityName,val,e]=O0(t,e+1),val.indexOf("&")===-1&&(r[U0(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(s&&D0(t,e))e+=8;else if(s&&w0(t,e))e+=8;else if(s&&v0(t,e))e+=9;else if(b0)i=!0;else throw new Error("Invalid DOCTYPE");n++,o=""}else if(t[e]===">"){if(i?t[e-1]==="-"&&t[e-2]==="-"&&(i=!1,n--):n--,n===0)break}else t[e]==="["?s=!0:o+=t[e];if(n!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:e}}function O0(t,e){let r="";for(;e<t.length&&t[e]!=="'"&&t[e]!=='"';e++)r+=t[e];if(r=r.trim(),r.indexOf(" ")!==-1)throw new Error("External entites are not supported");let n=t[e++],s="";for(;e<t.length&&t[e]!==n;e++)s+=t[e];return[r,s,e]}function b0(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function P0(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="N"&&t[e+4]==="T"&&t[e+5]==="I"&&t[e+6]==="T"&&t[e+7]==="Y"}function D0(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="L"&&t[e+4]==="E"&&t[e+5]==="M"&&t[e+6]==="E"&&t[e+7]==="N"&&t[e+8]==="T"}function w0(t,e){return t[e+1]==="!"&&t[e+2]==="A"&&t[e+3]==="T"&&t[e+4]==="T"&&t[e+5]==="L"&&t[e+6]==="I"&&t[e+7]==="S"&&t[e+8]==="T"}function v0(t,e){return t[e+1]==="!"&&t[e+2]==="N"&&t[e+3]==="O"&&t[e+4]==="T"&&t[e+5]==="A"&&t[e+6]==="T"&&t[e+7]==="I"&&t[e+8]==="O"&&t[e+9]==="N"}function U0(t){if(F0.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}Xl.exports=N0});var kl=et((gM,zl)=>{var L0=/^[-+]?0x[a-fA-F0-9]+$/,H0=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);var V0={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function X0(t,e={}){if(e=Object.assign({},V0,e),!t||typeof t!="string")return t;let r=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(r))return t;if(e.hex&&L0.test(r))return Number.parseInt(r,16);{let n=H0.exec(r);if(n){let s=n[1],i=n[2],o=W0(n[3]),a=n[4]||n[6];if(!e.leadingZeros&&i.length>0&&s&&r[2]!==".")return t;if(!e.leadingZeros&&i.length>0&&!s&&r[1]!==".")return t;{let c=Number(r),l=""+c;return l.search(/[eE]/)!==-1||a?e.eNotation?c:t:r.indexOf(".")!==-1?l==="0"&&o===""||l===o||s&&l==="-"+o?c:t:i?o===l||s+o===l?c:t:r===l||r===s+l?c:t}}else return t}}function W0(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}zl.exports=X0});var Kl=et((_M,Gl)=>{"use strict";var _o=os(),Yr=Vl(),z0=Wl(),k0=kl(),AM="<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g,_o.nameRegexp),po=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"}},this.addExternalEntities=G0,this.parseXml=j0,this.parseTextData=K0,this.resolveNameSpace=J0,this.buildAttributesMap=q0,this.isItStopNode=tA,this.replaceEntitiesValue=Q0,this.readStopNodeData=rA,this.saveTextToParentTag=$0,this.addChild=Z0}};function G0(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];this.lastEntities[n]={regex:new RegExp("&"+n+";","g"),val:t[n]}}}function K0(t,e,r,n,s,i,o){if(t!==void 0&&(this.options.trimValues&&!n&&(t=t.trim()),t.length>0)){o||(t=this.replaceEntitiesValue(t));let a=this.options.tagValueProcessor(e,t,r,s,i);return a==null?t:typeof a!=typeof t||a!==t?a:this.options.trimValues?Ao(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?Ao(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function J0(t){if(this.options.removeNSPrefix){let e=t.split(":"),r=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=r+e[1])}return t}var Y0=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function q0(t,e,r){if(!this.options.ignoreAttributes&&typeof t=="string"){let n=_o.getAllMatches(t,Y0),s=n.length,i={};for(let o=0;o<s;o++){let a=this.resolveNameSpace(n[o][1]),c=n[o][4],l=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c);let h=this.options.attributeValueProcessor(a,c,e);h==null?i[l]=c:typeof h!=typeof c||h!==c?i[l]=h:i[l]=Ao(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[l]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){let o={};return o[this.options.attributesGroupName]=i,o}return i}}var j0=function(t){t=t.replace(/\r\n?/g,`
|
|
10
|
+
`);let e=new Yr("!xml"),r=e,n="",s="";for(let i=0;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){let a=Pe(t,">",i,"Closing Tag is not closed."),c=t.substring(i+2,a).trim();if(this.options.removeNSPrefix){let f=c.indexOf(":");f!==-1&&(c=c.substr(f+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),r&&(n=this.saveTextToParentTag(n,r,s));let l=s.substring(s.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);let h=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(h=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):h=s.lastIndexOf("."),s=s.substring(0,h),r=this.tagsNodeStack.pop(),n="",i=a}else if(t[i+1]==="?"){let a=go(t,i,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,r,s),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){let c=new Yr(a.tagName);c.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(c[":@"]=this.buildAttributesMap(a.tagExp,s,a.tagName)),this.addChild(r,c,s)}i=a.closeIndex+1}else if(t.substr(i+1,3)==="!--"){let a=Pe(t,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){let c=t.substring(i+4,a-2);n=this.saveTextToParentTag(n,r,s),r.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}i=a}else if(t.substr(i+1,2)==="!D"){let a=z0(t,i);this.docTypeEntities=a.entities,i=a.i}else if(t.substr(i+1,2)==="!["){let a=Pe(t,"]]>",i,"CDATA is not closed.")-2,c=t.substring(i+9,a);if(n=this.saveTextToParentTag(n,r,s),this.options.cdataPropName)r.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]);else{let l=this.parseTextData(c,r.tagname,s,!0,!1,!0);l==null&&(l=""),r.add(this.options.textNodeName,l)}i=a+2}else{let a=go(t,i,this.options.removeNSPrefix),c=a.tagName,l=a.tagExp,h=a.attrExpPresent,f=a.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,s,!1));let u=r;if(u&&this.options.unpairedTags.indexOf(u.tagname)!==-1&&(r=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),c!==e.tagname&&(s+=s?"."+c:c),this.isItStopNode(this.options.stopNodes,s,c)){let d="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)i=a.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)i=a.closeIndex;else{let _=this.readStopNodeData(t,c,f+1);if(!_)throw new Error(`Unexpected end of ${c}`);i=_.i,d=_.tagContent}let p=new Yr(c);c!==l&&h&&(p[":@"]=this.buildAttributesMap(l,s,c)),d&&(d=this.parseTextData(d,c,s,!0,h,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),p.add(this.options.textNodeName,d),this.addChild(r,p,s)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){c[c.length-1]==="/"?(c=c.substr(0,c.length-1),s=s.substr(0,s.length-1),l=c):l=l.substr(0,l.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));let d=new Yr(c);c!==l&&h&&(d[":@"]=this.buildAttributesMap(l,s,c)),this.addChild(r,d,s),s=s.substr(0,s.lastIndexOf("."))}else{let d=new Yr(c);this.tagsNodeStack.push(r),c!==l&&h&&(d[":@"]=this.buildAttributesMap(l,s,c)),this.addChild(r,d,s),r=d}n="",i=f}}else n+=t[i];return e.child};function Z0(t,e,r){let n=this.options.updateTag(e.tagname,r,e[":@"]);n===!1||(typeof n=="string"&&(e.tagname=n),t.addChild(e))}var Q0=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){let r=this.docTypeEntities[e];t=t.replace(r.regx,r.val)}for(let e in this.lastEntities){let r=this.lastEntities[e];t=t.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){let r=this.htmlEntities[e];t=t.replace(r.regex,r.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function $0(t,e,r,n){return t&&(n===void 0&&(n=Object.keys(e.child).length===0),t=this.parseTextData(t,e.tagname,r,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,n),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function tA(t,e,r){let n="*."+r;for(let s in t){let i=t[s];if(n===i||e===i)return!0}return!1}function eA(t,e,r=">"){let n,s="";for(let i=e;i<t.length;i++){let o=t[i];if(n)o===n&&(n="");else if(o==='"'||o==="'")n=o;else if(o===r[0])if(r[1]){if(t[i+1]===r[1])return{data:s,index:i}}else return{data:s,index:i};else o===" "&&(o=" ");s+=o}}function Pe(t,e,r,n){let s=t.indexOf(e,r);if(s===-1)throw new Error(n);return s+e.length-1}function go(t,e,r,n=">"){let s=eA(t,e+1,n);if(!s)return;let i=s.data,o=s.index,a=i.search(/\s/),c=i,l=!0;if(a!==-1&&(c=i.substr(0,a).replace(/\s\s*$/,""),i=i.substr(a+1)),r){let h=c.indexOf(":");h!==-1&&(c=c.substr(h+1),l=c!==s.data.substr(h+1))}return{tagName:c,tagExp:i,closeIndex:o,attrExpPresent:l}}function rA(t,e,r){let n=r,s=1;for(;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="/"){let i=Pe(t,">",r,`${e} is not closed`);if(t.substring(r+2,i).trim()===e&&(s--,s===0))return{tagContent:t.substring(n,r),i};r=i}else if(t[r+1]==="?")r=Pe(t,"?>",r+1,"StopNode is not closed.");else if(t.substr(r+1,3)==="!--")r=Pe(t,"-->",r+3,"StopNode is not closed.");else if(t.substr(r+1,2)==="![")r=Pe(t,"]]>",r,"StopNode is not closed.")-2;else{let i=go(t,r,">");i&&((i&&i.tagName)===e&&i.tagExp[i.tagExp.length-1]!=="/"&&s++,r=i.closeIndex)}}function Ao(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:k0(t,r)}else return _o.isExist(t)?t:""}Gl.exports=po});var ql=et(Yl=>{"use strict";function nA(t,e){return Jl(t,e)}function Jl(t,e,r){let n,s={};for(let i=0;i<t.length;i++){let o=t[i],a=sA(o),c="";if(r===void 0?c=a:c=r+"."+a,a===e.textNodeName)n===void 0?n=o[a]:n+=""+o[a];else{if(a===void 0)continue;if(o[a]){let l=Jl(o[a],e,c),h=oA(l,e);o[":@"]?iA(l,o[":@"],c,e):Object.keys(l).length===1&&l[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?l=l[e.textNodeName]:Object.keys(l).length===0&&(e.alwaysCreateTextNode?l[e.textNodeName]="":l=""),s[a]!==void 0&&s.hasOwnProperty(a)?(Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(l)):e.isArray(a,c,h)?s[a]=[l]:s[a]=l}}}return typeof n=="string"?n.length>0&&(s[e.textNodeName]=n):n!==void 0&&(s[e.textNodeName]=n),s}function sA(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function iA(t,e,r,n){if(e){let s=Object.keys(e),i=s.length;for(let o=0;o<i;o++){let a=s[o];n.isArray(a,r+"."+a,!0,!0)?t[a]=[e[a]]:t[a]=e[a]}}}function oA(t,e){let{textNodeName:r}=e,n=Object.keys(t).length;return!!(n===0||n===1&&(t[r]||typeof t[r]=="boolean"||t[r]===0))}Yl.prettify=nA});var Zl=et((TM,jl)=>{var{buildOptions:aA}=Ll(),cA=Kl(),{prettify:lA}=ql(),hA=ho(),mo=class{constructor(e){this.externalEntities={},this.options=aA(e)}parse(e,r){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let i=hA.validate(e,r);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let n=new cA(this.options);n.addExternalEntities(this.externalEntities);let s=n.parseXml(e);return this.options.preserveOrder||s===void 0?s:lA(s,this.options)}addEntity(e,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}};jl.exports=mo});var rh=et((EM,eh)=>{var fA=`
|
|
11
|
+
`;function uA(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=fA),$l(t,e,"",r)}function $l(t,e,r,n){let s="",i=!1;for(let o=0;o<t.length;o++){let a=t[o],c=dA(a),l="";if(r.length===0?l=c:l=`${r}.${c}`,c===e.textNodeName){let p=a[c];pA(l,e)||(p=e.tagValueProcessor(c,p),p=th(p,e)),i&&(s+=n),s+=p,i=!1;continue}else if(c===e.cdataPropName){i&&(s+=n),s+=`<![CDATA[${a[c][0][e.textNodeName]}]]>`,i=!1;continue}else if(c===e.commentPropName){s+=n+`<!--${a[c][0][e.textNodeName]}-->`,i=!0;continue}else if(c[0]==="?"){let p=Ql(a[":@"],e),_=c==="?xml"?"":n,A=a[c][0][e.textNodeName];A=A.length!==0?" "+A:"",s+=_+`<${c}${A}${p}?>`,i=!0;continue}let h=n;h!==""&&(h+=e.indentBy);let f=Ql(a[":@"],e),u=n+`<${c}${f}`,d=$l(a[c],e,l,h);e.unpairedTags.indexOf(c)!==-1?e.suppressUnpairedNode?s+=u+">":s+=u+"/>":(!d||d.length===0)&&e.suppressEmptyNode?s+=u+"/>":d&&d.endsWith(">")?s+=u+`>${d}${n}</${c}>`:(s+=u+">",d&&n!==""&&(d.includes("/>")||d.includes("</"))?s+=n+e.indentBy+d+n:s+=d,s+=`</${c}>`),i=!0}return s}function dA(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function Ql(t,e){let r="";if(t&&!e.ignoreAttributes)for(let n in t){let s=e.attributeValueProcessor(n,t[n]);s=th(s,e),s===!0&&e.suppressBooleanAttributes?r+=` ${n.substr(e.attributeNamePrefix.length)}`:r+=` ${n.substr(e.attributeNamePrefix.length)}="${s}"`}return r}function pA(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);let r=t.substr(t.lastIndexOf(".")+1);for(let n in e.stopNodes)if(e.stopNodes[n]===t||e.stopNodes[n]==="*."+r)return!0;return!1}function th(t,e){if(t&&t.length>0&&e.processEntities)for(let r=0;r<e.entities.length;r++){let n=e.entities[r];t=t.replace(n.regex,n.val)}return t}eh.exports=uA});var sh=et((RM,nh)=>{"use strict";var gA=rh(),AA={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function ge(t){this.options=Object.assign({},AA,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=TA),this.processTextOrObjNode=_A,this.options.format?(this.indentate=mA,this.tagEndChar=`>
|
|
13
12
|
`,this.newLine=`
|
|
14
|
-
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Ut.prototype.build=function(t){return this.options.preserveOrder?q1(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t=j1({},this.options.arrayNodeName,t)),this.j2x(t,0).val)};Ut.prototype.j2x=function(t,e){var r="",n="";for(var s in t)if(typeof t[s]>"u")this.isAttribute(s)&&(n+="");else if(t[s]===null)this.isAttribute(s)?n+="":s[0]==="?"?n+=this.indentate(e)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+s+"/"+this.tagEndChar;else if(t[s]instanceof Date)n+=this.buildTextValNode(t[s],s,"",e);else if(kn(t[s])!=="object"){var i=this.isAttribute(s);if(i)r+=this.buildAttrPairStr(i,""+t[s]);else if(s===this.options.textNodeName){var o=this.options.tagValueProcessor(s,""+t[s]);n+=this.replaceEntitiesValue(o)}else n+=this.buildTextValNode(t[s],s,"",e)}else if(Array.isArray(t[s])){for(var a=t[s].length,c="",u=0;u<a;u++){var l=t[s][u];typeof l>"u"||(l===null?s[0]==="?"?n+=this.indentate(e)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+s+"/"+this.tagEndChar:kn(l)==="object"?this.options.oneListGroup?c+=this.j2x(l,e+1).val:c+=this.processTextOrObjNode(l,s,e):c+=this.buildTextValNode(l,s,"",e))}this.options.oneListGroup&&(c=this.buildObjectNode(c,s,"",e)),n+=c}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName)for(var f=Object.keys(t[s]),h=f.length,d=0;d<h;d++)r+=this.buildAttrPairStr(f[d],""+t[s][f[d]]);else n+=this.processTextOrObjNode(t[s],s,e);return{attrStr:r,val:n}};Ut.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function W1(t,e,r){var n=this.j2x(t,r+1);return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,n.attrStr,r):this.buildObjectNode(n.val,e,n.attrStr,r)}Ut.prototype.buildObjectNode=function(t,e,r,n){if(t==="")return e[0]==="?"?this.indentate(n)+"<"+e+r+"?"+this.tagEndChar:this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar;var s="</"+e+this.tagEndChar,i="";return e[0]==="?"&&(i="?",s=""),(r||r==="")&&t.indexOf("<")===-1?this.indentate(n)+"<"+e+r+i+">"+t+s:this.options.commentPropName!==!1&&e===this.options.commentPropName&&i.length===0?this.indentate(n)+"<!--".concat(t,"-->")+this.newLine:this.indentate(n)+"<"+e+r+i+this.tagEndChar+t+this.indentate(n)+s};Ut.prototype.closeTag=function(t){var e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e="></".concat(t),e};Ut.prototype.buildTextValNode=function(t,e,r,n){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(n)+"<![CDATA[".concat(t,"]]>")+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(n)+"<!--".concat(t,"-->")+this.newLine;if(e[0]==="?")return this.indentate(n)+"<"+e+r+"?"+this.tagEndChar;var s=this.options.tagValueProcessor(e,t);return s=this.replaceEntitiesValue(s),s===""?this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+r+">"+s+"</"+e+this.tagEndChar};Ut.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(var e=0;e<this.options.entities.length;e++){var r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t};function X1(t){return this.options.indentBy.repeat(t)}function K1(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}Yh.exports=Ut});var $h=ce((wL,Qh)=>{"use strict";var Y1=Za(),Z1=jh(),Q1=Zh();Qh.exports={XMLParser:Z1,XMLValidator:Y1,XMLBuilder:Q1}});var uu=ce((Up,rs)=>{(function(t,e){typeof define=="function"&&define.amd?define([],e):typeof yh=="function"&&typeof rs=="object"&&rs&&rs.exports?rs.exports=e():(t.dcodeIO=t.dcodeIO||{}).Long=e()})(Up,function(){"use strict";function t(S,y,R){this.low=S|0,this.high=y|0,this.unsigned=!!R}t.prototype.__isLong__,Object.defineProperty(t.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function e(S){return(S&&S.__isLong__)===!0}t.isLong=e;var r={},n={};function s(S,y){var R,P,F;return y?(S>>>=0,(F=0<=S&&S<256)&&(P=n[S],P)?P:(R=o(S,(S|0)<0?-1:0,!0),F&&(n[S]=R),R)):(S|=0,(F=-128<=S&&S<128)&&(P=r[S],P)?P:(R=o(S,S<0?-1:0,!1),F&&(r[S]=R),R))}t.fromInt=s;function i(S,y){if(isNaN(S)||!isFinite(S))return y?A:m;if(y){if(S<0)return A;if(S>=d)return C}else{if(S<=-p)return I;if(S+1>=p)return M}return S<0?i(-S,y).neg():o(S%h|0,S/h|0,y)}t.fromNumber=i;function o(S,y,R){return new t(S,y,R)}t.fromBits=o;var a=Math.pow;function c(S,y,R){if(S.length===0)throw Error("empty string");if(S==="NaN"||S==="Infinity"||S==="+Infinity"||S==="-Infinity")return m;if(typeof y=="number"?(R=y,y=!1):y=!!y,R=R||10,R<2||36<R)throw RangeError("radix");var P;if((P=S.indexOf("-"))>0)throw Error("interior hyphen");if(P===0)return c(S.substring(1),y,R).neg();for(var F=i(a(R,8)),N=m,G=0;G<S.length;G+=8){var Q=Math.min(8,S.length-G),J=parseInt(S.substring(G,G+Q),R);if(Q<8){var ne=i(a(R,Q));N=N.mul(ne).add(i(J))}else N=N.mul(F),N=N.add(i(J))}return N.unsigned=y,N}t.fromString=c;function u(S){return S instanceof t?S:typeof S=="number"?i(S):typeof S=="string"?c(S):o(S.low,S.high,S.unsigned)}t.fromValue=u;var l=1<<16,f=1<<24,h=l*l,d=h*h,p=d/2,g=s(f),m=s(0);t.ZERO=m;var A=s(0,!0);t.UZERO=A;var v=s(1);t.ONE=v;var x=s(1,!0);t.UONE=x;var b=s(-1);t.NEG_ONE=b;var M=o(-1,2147483647,!1);t.MAX_VALUE=M;var C=o(-1,-1,!0);t.MAX_UNSIGNED_VALUE=C;var I=o(0,-2147483648,!1);t.MIN_VALUE=I;var B=t.prototype;return B.toInt=function(){return this.unsigned?this.low>>>0:this.low},B.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},B.toString=function(y){if(y=y||10,y<2||36<y)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(I)){var R=i(y),P=this.div(R),F=P.mul(R).sub(this);return P.toString(y)+F.toInt().toString(y)}else return"-"+this.neg().toString(y);for(var N=i(a(y,6),this.unsigned),G=this,Q="";;){var J=G.div(N),ne=G.sub(J.mul(N)).toInt()>>>0,Z=ne.toString(y);if(G=J,G.isZero())return Z+Q;for(;Z.length<6;)Z="0"+Z;Q=""+Z+Q}},B.getHighBits=function(){return this.high},B.getHighBitsUnsigned=function(){return this.high>>>0},B.getLowBits=function(){return this.low},B.getLowBitsUnsigned=function(){return this.low>>>0},B.getNumBitsAbs=function(){if(this.isNegative())return this.eq(I)?64:this.neg().getNumBitsAbs();for(var y=this.high!=0?this.high:this.low,R=31;R>0&&!(y&1<<R);R--);return this.high!=0?R+33:R+1},B.isZero=function(){return this.high===0&&this.low===0},B.isNegative=function(){return!this.unsigned&&this.high<0},B.isPositive=function(){return this.unsigned||this.high>=0},B.isOdd=function(){return(this.low&1)===1},B.isEven=function(){return(this.low&1)===0},B.equals=function(y){return e(y)||(y=u(y)),this.unsigned!==y.unsigned&&this.high>>>31===1&&y.high>>>31===1?!1:this.high===y.high&&this.low===y.low},B.eq=B.equals,B.notEquals=function(y){return!this.eq(y)},B.neq=B.notEquals,B.lessThan=function(y){return this.comp(y)<0},B.lt=B.lessThan,B.lessThanOrEqual=function(y){return this.comp(y)<=0},B.lte=B.lessThanOrEqual,B.greaterThan=function(y){return this.comp(y)>0},B.gt=B.greaterThan,B.greaterThanOrEqual=function(y){return this.comp(y)>=0},B.gte=B.greaterThanOrEqual,B.compare=function(y){if(e(y)||(y=u(y)),this.eq(y))return 0;var R=this.isNegative(),P=y.isNegative();return R&&!P?-1:!R&&P?1:this.unsigned?y.high>>>0>this.high>>>0||y.high===this.high&&y.low>>>0>this.low>>>0?-1:1:this.sub(y).isNegative()?-1:1},B.comp=B.compare,B.negate=function(){return!this.unsigned&&this.eq(I)?I:this.not().add(v)},B.neg=B.negate,B.add=function(y){e(y)||(y=u(y));var R=this.high>>>16,P=this.high&65535,F=this.low>>>16,N=this.low&65535,G=y.high>>>16,Q=y.high&65535,J=y.low>>>16,ne=y.low&65535,Z=0,$=0,oe=0,Be=0;return Be+=N+ne,oe+=Be>>>16,Be&=65535,oe+=F+J,$+=oe>>>16,oe&=65535,$+=P+Q,Z+=$>>>16,$&=65535,Z+=R+G,Z&=65535,o(oe<<16|Be,Z<<16|$,this.unsigned)},B.subtract=function(y){return e(y)||(y=u(y)),this.add(y.neg())},B.sub=B.subtract,B.multiply=function(y){if(this.isZero()||(e(y)||(y=u(y)),y.isZero()))return m;if(this.eq(I))return y.isOdd()?I:m;if(y.eq(I))return this.isOdd()?I:m;if(this.isNegative())return y.isNegative()?this.neg().mul(y.neg()):this.neg().mul(y).neg();if(y.isNegative())return this.mul(y.neg()).neg();if(this.lt(g)&&y.lt(g))return i(this.toNumber()*y.toNumber(),this.unsigned);var R=this.high>>>16,P=this.high&65535,F=this.low>>>16,N=this.low&65535,G=y.high>>>16,Q=y.high&65535,J=y.low>>>16,ne=y.low&65535,Z=0,$=0,oe=0,Be=0;return Be+=N*ne,oe+=Be>>>16,Be&=65535,oe+=F*ne,$+=oe>>>16,oe&=65535,oe+=N*J,$+=oe>>>16,oe&=65535,$+=P*ne,Z+=$>>>16,$&=65535,$+=F*J,Z+=$>>>16,$&=65535,$+=N*Q,Z+=$>>>16,$&=65535,Z+=R*ne+P*J+F*Q+N*G,Z&=65535,o(oe<<16|Be,Z<<16|$,this.unsigned)},B.mul=B.multiply,B.divide=function(y){if(e(y)||(y=u(y)),y.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?A:m;var R,P,F;if(this.unsigned){if(y.unsigned||(y=y.toUnsigned()),y.gt(this))return A;if(y.gt(this.shru(1)))return x;F=A}else{if(this.eq(I)){if(y.eq(v)||y.eq(b))return I;if(y.eq(I))return v;var N=this.shr(1);return R=N.div(y).shl(1),R.eq(m)?y.isNegative()?v:b:(P=this.sub(y.mul(R)),F=R.add(P.div(y)),F)}else if(y.eq(I))return this.unsigned?A:m;if(this.isNegative())return y.isNegative()?this.neg().div(y.neg()):this.neg().div(y).neg();if(y.isNegative())return this.div(y.neg()).neg();F=m}for(P=this;P.gte(y);){R=Math.max(1,Math.floor(P.toNumber()/y.toNumber()));for(var G=Math.ceil(Math.log(R)/Math.LN2),Q=G<=48?1:a(2,G-48),J=i(R),ne=J.mul(y);ne.isNegative()||ne.gt(P);)R-=Q,J=i(R,this.unsigned),ne=J.mul(y);J.isZero()&&(J=v),F=F.add(J),P=P.sub(ne)}return F},B.div=B.divide,B.modulo=function(y){return e(y)||(y=u(y)),this.sub(this.div(y).mul(y))},B.mod=B.modulo,B.not=function(){return o(~this.low,~this.high,this.unsigned)},B.and=function(y){return e(y)||(y=u(y)),o(this.low&y.low,this.high&y.high,this.unsigned)},B.or=function(y){return e(y)||(y=u(y)),o(this.low|y.low,this.high|y.high,this.unsigned)},B.xor=function(y){return e(y)||(y=u(y)),o(this.low^y.low,this.high^y.high,this.unsigned)},B.shiftLeft=function(y){return e(y)&&(y=y.toInt()),(y&=63)===0?this:y<32?o(this.low<<y,this.high<<y|this.low>>>32-y,this.unsigned):o(0,this.low<<y-32,this.unsigned)},B.shl=B.shiftLeft,B.shiftRight=function(y){return e(y)&&(y=y.toInt()),(y&=63)===0?this:y<32?o(this.low>>>y|this.high<<32-y,this.high>>y,this.unsigned):o(this.high>>y-32,this.high>=0?0:-1,this.unsigned)},B.shr=B.shiftRight,B.shiftRightUnsigned=function(y){if(e(y)&&(y=y.toInt()),y&=63,y===0)return this;var R=this.high;if(y<32){var P=this.low;return o(P>>>y|R<<32-y,R>>>y,this.unsigned)}else return y===32?o(R,0,this.unsigned):o(R>>>y-32,0,this.unsigned)},B.shru=B.shiftRightUnsigned,B.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},B.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},B.toBytes=function(S){return S?this.toBytesLE():this.toBytesBE()},B.toBytesLE=function(){var S=this.high,y=this.low;return[y&255,y>>>8&255,y>>>16&255,y>>>24&255,S&255,S>>>8&255,S>>>16&255,S>>>24&255]},B.toBytesBE=function(){var S=this.high,y=this.low;return[S>>>24&255,S>>>16&255,S>>>8&255,S&255,y>>>24&255,y>>>16&255,y>>>8&255,y&255]},t})});var $i=ce((IG,Nm)=>{Nm.exports=globalThis.h3||{}});var Ct=ce((GG,Ym)=>{Ym.exports=globalThis.luma});var Mo=ce((r4,Lg)=>{Lg.exports=globalThis.deck});var dn=ce((K4,e0)=>{e0.exports=globalThis.loaders});var I_=ce((gq,M_)=>{M_.exports=globalThis.deck});var k_=ce(rh=>{rh.read=function(t,e,r,n,s){var i,o,a=s*8-n-1,c=(1<<a)-1,u=c>>1,l=-7,f=r?s-1:0,h=r?-1:1,d=t[e+f];for(f+=h,i=d&(1<<-l)-1,d>>=-l,l+=a;l>0;i=i*256+t[e+f],f+=h,l-=8);for(o=i&(1<<-l)-1,i>>=-l,l+=n;l>0;o=o*256+t[e+f],f+=h,l-=8);if(i===0)i=1-u;else{if(i===c)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,n),i=i-u}return(d?-1:1)*o*Math.pow(2,i-n)};rh.write=function(t,e,r,n,s,i){var o,a,c,u=i*8-s-1,l=(1<<u)-1,f=l>>1,h=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=l):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+f>=1?e+=h/c:e+=h*Math.pow(2,1-f),e*c>=2&&(o++,c/=2),o+f>=l?(a=0,o=l):o+f>=1?(a=(e*c-1)*Math.pow(2,s),o=o+f):(a=e*Math.pow(2,f-1)*Math.pow(2,s),o=0));s>=8;t[r+d]=a&255,d+=p,a/=256,s-=8);for(o=o<<s|a,u+=s;u>0;t[r+d]=o&255,d+=p,o/=256,u-=8);t[r+d-p]|=g*128}});var J_=ce((i5,q_)=>{"use strict";q_.exports=X;var Ga=k_();function X(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}X.Varint=0;X.Fixed64=1;X.Bytes=2;X.Fixed32=5;var nh=(1<<16)*(1<<16),H_=1/nh,LO=12,j_=typeof TextDecoder>"u"?null:new TextDecoder("utf8");X.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),s=n>>3,i=this.pos;this.type=n&7,t(s,e,this),this.pos===i&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=ka(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=z_(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=ka(this.buf,this.pos)+ka(this.buf,this.pos+4)*nh;return this.pos+=8,t},readSFixed64:function(){var t=ka(this.buf,this.pos)+z_(this.buf,this.pos+4)*nh;return this.pos+=8,t},readFloat:function(){var t=Ga.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Ga.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e=this.buf,r,n;return n=e[this.pos++],r=n&127,n<128||(n=e[this.pos++],r|=(n&127)<<7,n<128)||(n=e[this.pos++],r|=(n&127)<<14,n<128)||(n=e[this.pos++],r|=(n&127)<<21,n<128)?r:(n=e[this.pos],r|=(n&15)<<28,PO(r,t,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=LO&&j_?XO(this.buf,e,t):WO(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==X.Bytes)return t.push(this.readVarint(e));var r=Nt(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==X.Bytes)return t.push(this.readSVarint());var e=Nt(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==X.Bytes)return t.push(this.readBoolean());var e=Nt(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==X.Bytes)return t.push(this.readFloat());var e=Nt(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==X.Bytes)return t.push(this.readDouble());var e=Nt(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==X.Bytes)return t.push(this.readFixed32());var e=Nt(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==X.Bytes)return t.push(this.readSFixed32());var e=Nt(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==X.Bytes)return t.push(this.readFixed64());var e=Nt(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==X.Bytes)return t.push(this.readSFixed64());var e=Nt(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===X.Varint)for(;this.buf[this.pos++]>127;);else if(e===X.Bytes)this.pos=this.readVarint()+this.pos;else if(e===X.Fixed32)this.pos+=4;else if(e===X.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Dn(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Dn(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Dn(this.buf,t&-1,this.pos),Dn(this.buf,Math.floor(t*H_),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Dn(this.buf,t&-1,this.pos),Dn(this.buf,Math.floor(t*H_),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){FO(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?-t*2-1:t*2)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(t.length*4),this.pos++;var e=this.pos;this.pos=KO(this.buf,t,this.pos);var r=this.pos-e;r>=128&&V_(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Ga.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Ga.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&V_(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,X.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,UO,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,GO,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,VO,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,kO,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,HO,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,zO,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,jO,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,qO,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,JO,e)},writeBytesField:function(t,e){this.writeTag(t,X.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,X.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,X.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,X.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,X.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,X.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,X.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,X.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,X.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,X.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};function PO(t,e,r){var n=r.buf,s,i;if(i=n[r.pos++],s=(i&112)>>4,i<128||(i=n[r.pos++],s|=(i&127)<<3,i<128)||(i=n[r.pos++],s|=(i&127)<<10,i<128)||(i=n[r.pos++],s|=(i&127)<<17,i<128)||(i=n[r.pos++],s|=(i&127)<<24,i<128)||(i=n[r.pos++],s|=(i&1)<<31,i<128))return Nn(t,s,e);throw new Error("Expected varint not more than 10 bytes")}function Nt(t){return t.type===X.Bytes?t.readVarint()+t.pos:t.pos+1}function Nn(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function FO(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(r=~(-t%4294967296),n=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),NO(r,n,e),DO(n,e)}function NO(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function DO(t,e){var r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function V_(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(n);for(var s=r.pos-1;s>=t;s--)r.buf[s+n]=r.buf[s]}function UO(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function GO(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function kO(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function HO(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function VO(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function zO(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function jO(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function qO(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function JO(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function ka(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function Dn(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function z_(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function WO(t,e,r){for(var n="",s=e;s<r;){var i=t[s],o=null,a=i>239?4:i>223?3:i>191?2:1;if(s+a>r)break;var c,u,l;a===1?i<128&&(o=i):a===2?(c=t[s+1],(c&192)===128&&(o=(i&31)<<6|c&63,o<=127&&(o=null))):a===3?(c=t[s+1],u=t[s+2],(c&192)===128&&(u&192)===128&&(o=(i&15)<<12|(c&63)<<6|u&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):a===4&&(c=t[s+1],u=t[s+2],l=t[s+3],(c&192)===128&&(u&192)===128&&(l&192)===128&&(o=(i&15)<<18|(c&63)<<12|(u&63)<<6|l&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,a=1):o>65535&&(o-=65536,n+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),n+=String.fromCharCode(o),s+=a}return n}function XO(t,e,r){return j_.decode(t.subarray(e,r))}function KO(t,e,r){for(var n=0,s,i;n<e.length;n++){if(s=e.charCodeAt(n),s>55295&&s<57344)if(i)if(s<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=s;continue}else s=i-55296<<10|s-56320|65536,i=null;else{s>56319||n+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=s;continue}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);s<128?t[r++]=s:(s<2048?t[r++]=s>>6|192:(s<65536?t[r++]=s>>12|224:(t[r++]=s>>18|240,t[r++]=s>>12&63|128),t[r++]=s>>6&63|128),t[r++]=s&63|128)}return r}});var Ks={};Ae(Ks,{GeohashLayer:()=>Ka,GreatCircleLayer:()=>Mi,H3ClusterLayer:()=>oo,H3HexagonLayer:()=>Er,MVTLayer:()=>Ja,QuadkeyLayer:()=>Ui,S2Layer:()=>Fi,TerrainLayer:()=>Ra,Tile3DLayer:()=>Ea,TileLayer:()=>Bt,TripsLayer:()=>Qi,_GeoCellLayer:()=>Ge,_Tile2DHeader:()=>ns,_Tileset2D:()=>us,_WMSLayer:()=>Si,_getURLFromTemplate:()=>pt});var at={},Ah=U(Ye());Dt(at,U(Ye()));if(!Ah.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");Dt(Ks,at);var Tr=U(Ze()),Pp=U(Ye());function IA(t){return typeof t=="string"?t.charAt(0).toLowerCase()+t.slice(1):t}function Qs(t){if(Array.isArray(t))return t.map(e=>Qs(e));if(t&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[IA(r)]=Qs(n);return e}return t}var ed=U($h(),1);function rc(t,e){if(e!=null&&e._parser&&e._parser!=="fast-xml-parser")throw new Error(e?._parser);let r={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:e?.removeNSPrefix,textNodeName:e?.textNodeName,isArray:(s,i,o,a)=>{var c;return Boolean(e==null||(c=e.arrayPaths)===null||c===void 0?void 0:c.some(l=>i===l))},...e?._fastXML},n=$1(t,r);return e!=null&&e.uncapitalizeKeys?Qs(n):n}function $1(t,e){return new ed.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...e}).parse(t)}var ev="4.1.0-alpha.9",Ee={name:"XML",id:"xml",module:"xml",version:ev,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:tv,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(t,e)=>rc(new TextDecoder().decode(t),{...Ee.options.xml,...e?.xml}),parseTextSync:(t,e)=>rc(t,{...Ee.options.xml,...e?.xml})};function tv(t){return t.startsWith("<?xml")}async function Le(t,e,r,n){return n._parse(t,e,r,n)}function j(t,e){if(!t)throw new Error(e||"loader assertion failed.")}var ct={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},rv=ct.self||ct.window||ct.global||{},nv=ct.window||ct.self||ct.global||{},sv=ct.global||ct.self||ct.window||{},iv=ct.document||{};var Hn=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var td=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),ov=td&&parseFloat(td[1])||0;function nc(t,e){return rd(t||{},e)}function rd(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(r>3)return e;let n={...t};for(let[s,i]of Object.entries(e))i&&typeof i=="object"&&!Array.isArray(i)?n[s]=rd(n[s]||{},e[s],r+1):n[s]=e[s];return n}function av(){var t;return(t=globalThis._loadersgl_)!==null&&t!==void 0&&t.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.1.0-alpha.9"),globalThis._loadersgl_.version}var nd=av();function sd(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var ut={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},NL=ut.self||ut.window||ut.global||{},DL=ut.window||ut.self||ut.global||{},UL=ut.global||ut.self||ut.window||{},kL=ut.document||{};var Jr=typeof process!="object"||String(process)!=="[object process]"||process.browser,ti=typeof importScripts=="function",HL=typeof window<"u"&&typeof window.orientation<"u",id=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),VL=id&&parseFloat(id[1])||0;var sc={};async function lt(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return e&&(t=od(t,e,r,n)),sc[t]=sc[t]||cv(t),await sc[t]}function od(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(!r.useLocalLibraries&&t.startsWith("http"))return t;n=n||t;let s=r.modules||{};return s[n]?s[n]:Jr?r.CDN?(sd(r.CDN.startsWith("http")),`${r.CDN}/${e}@${nd}/dist/libs/${n}`):ti?`../src/libs/${n}`:`modules/${e}/src/libs/${n}`:`modules/${e}/dist/libs/${n}`}async function cv(t){if(t.endsWith("wasm"))return await lv(t);if(!Jr)try{return Pe&&Pe.requireFromFile&&await Pe.requireFromFile(t)}catch(r){return console.error(r),null}if(ti)return importScripts(t);let e=await fv(t);return uv(e,t)}function uv(t,e){if(!Jr)return Pe.requireFromString&&Pe.requireFromString(t,e);if(ti)return eval.call(globalThis,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}async function lv(t){return Jr||!Pe.readFileAsArrayBuffer||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await Pe.readFileAsArrayBuffer(t)}async function fv(t){return Jr||!Pe.readFileAsText||t.startsWith("http")?await(await fetch(t)).text():await Pe.readFileAsText(t)}function cd(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:5;return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?ad(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?ad(t,0,e):""}function ad(t,e,r){if(t.byteLength<=e+r)return"";let n=new DataView(t),s="";for(let i=0;i<r;i++)s+=String.fromCharCode(n.getUint8(e+i));return s}function ic(t){try{return JSON.parse(t)}catch{throw new Error(`Failed to parse JSON from data starting with "${cd(t)}"`)}}function Vn(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];let n=e,s=n&&n.length>1&&n[0].constructor||null;if(!s)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let i=n.reduce((c,u)=>c+u.length,0),o=new s(i),a=0;for(let c of n)o.set(c,a),a+=c.length;return o}function pr(t,e,r){let n=r!==void 0?new Uint8Array(t).subarray(e,e+r):new Uint8Array(t).subarray(e);return new Uint8Array(n).buffer}function Gt(t,e){return j(t>=0),j(e>0),t+(e-1)&~(e-1)}function oc(t,e,r){let n;if(t instanceof ArrayBuffer)n=new Uint8Array(t);else{let s=t.byteOffset,i=t.byteLength;n=new Uint8Array(t.buffer||t.arrayBuffer,s,i)}return e.set(n,r),r+Gt(n.byteLength,4)}function zn(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var mr=class{constructor(e,r){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=zn(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(zn()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var kt=class{constructor(e){this.id=void 0,this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:e,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let r of Object.values(this.stats))e(r)}getTable(){let e={};return this.forEach(r=>{e[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),e}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(e){let{name:r,type:n}=e,s=this.stats[r];return s||(e instanceof mr?s=e:s=new mr(r,n),this.stats[r]=s),s}};var hv="Queued Requests",dv="Active Requests",pv="Cancelled Requests",mv="Queued Requests Ever",gv="Active Requests Ever",yv={id:"request-scheduler",throttleRequests:!0,maxRequests:6},Ht=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.props=void 0,this.stats=void 0,this.activeRequestCount=0,this.requestQueue=[],this.requestMap=new Map,this.deferredUpdate=null,this.props={...yv,...e},this.stats=new kt({id:this.props.id}),this.stats.get(hv),this.stats.get(dv),this.stats.get(pv),this.stats.get(mv),this.stats.get(gv)}scheduleRequest(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:()=>0;if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);let n={handle:e,priority:0,getPriority:r},s=new Promise(i=>(n.resolve=i,n));return this.requestQueue.push(n),this.requestMap.set(e,s),this._issueNewRequests(),s}_issueRequest(e){let{handle:r,resolve:n}=e,s=!1,i=()=>{s||(s=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,n?n({done:i}):Promise.resolve({done:i})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequestsAsync(){this.deferredUpdate=null;let e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(e!==0){this._updateAllRequests();for(let r=0;r<e;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let e=this.requestQueue;for(let r=0;r<e.length;++r){let n=e[r];this._updateRequest(n)||(e.splice(r,1),this.requestMap.delete(n.handle),r--)}e.sort((r,n)=>r.priority-n.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),e.priority<0?(e.resolve(null),!1):!0}};var Vt={};Ae(Vt,{dirname:()=>Av,filename:()=>_v,join:()=>vv,resolve:()=>xv});function ud(){var t;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=(t=window.location)===null||t===void 0?void 0:t.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function _v(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function Av(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}function vv(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];let n="/";return e=e.map((s,i)=>(i&&(s=s.replace(new RegExp(`^${n}`),"")),i!==e.length-1&&(s=s.replace(new RegExp(`${n}$`),"")),s)),e.join(n)}function xv(){let t=[];for(let s=0;s<arguments.length;s++)t[s]=s<0||arguments.length<=s?void 0:arguments[s];let e="",r=!1,n;for(let s=t.length-1;s>=-1&&!r;s--){let i;s>=0?i=t[s]:(n===void 0&&(n=ud()),i=n),i.length!==0&&(e=`${i}/${e}`,r=i.charCodeAt(0)===jn)}return e=bv(e,!r),r?`/${e}`:e.length>0?e:"."}var jn=47,ac=46;function bv(t,e){let r="",n=-1,s=0,i,o=!1;for(let a=0;a<=t.length;++a){if(a<t.length)i=t.charCodeAt(a);else{if(i===jn)break;i=jn}if(i===jn){if(!(n===a-1||s===1))if(n!==a-1&&s===2){if(r.length<2||!o||r.charCodeAt(r.length-1)!==ac||r.charCodeAt(r.length-2)!==ac){if(r.length>2){let c=r.length-1,u=c;for(;u>=0&&r.charCodeAt(u)!==jn;--u);if(u!==c){r=u===-1?"":r.slice(0,u),n=a,s=0,o=!1;continue}}else if(r.length===2||r.length===1){r="",n=a,s=0,o=!1;continue}}e&&(r.length>0?r+="/..":r="..",o=!0)}else{let c=t.slice(n+1,a);r.length>0?r+=`/${c}`:r=c,o=!1}n=a,s=0}else i===ac&&s!==-1?++s:s=-1}return r}var ri=class{constructor(e){this.data=void 0,this.fetch=void 0,this.loadOptions=void 0,this._needsRefresh=!0,this.props=void 0,this.props={...e},this.loadOptions={...e.loadOptions},this.fetch=Tv(this.loadOptions)}setProps(e){this.props=Object.assign(this.props,e),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,r=this._needsRefresh;return e&&(this._needsRefresh=!1),r}};function Tv(t){let e=t?.fetch;if(e&&typeof e=="function")return(n,s)=>e(n,s);let r=t?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var Ue=class extends ri{};Ue.type="template";Ue.testURL=t=>!1;function ld(t,e){var r,n,s;let i=(r=Ee.parseTextSync)===null||r===void 0?void 0:r.call(Ee,t,e),o=(i==null||(n=i.ServiceExceptionReport)===null||n===void 0?void 0:n.ServiceException)||(i==null||(s=i["ogc:ServiceExceptionReport"])===null||s===void 0?void 0:s["ogc:ServiceException"]);return typeof o=="string"?o:o.value||o.code||"Unknown error"}var Ev="4.1.0-alpha.9",gr={id:"wms-error",name:"WMS Error",module:"wms",version:Ev,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:wv,options:{wms:{throwOnError:!1}},parse:async(t,e)=>cc(new TextDecoder().decode(t),e),parseSync:(t,e)=>cc(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>cc(t,e)};function wv(t){return t.startsWith("<?xml")}function cc(t,e){let r={...gr.options.wms,...e?.wms},n=ld(t,r),s=r.minimalErrors?n:`WMS Service error: ${n}`;if(r.throwOnError)throw new Error(s);return s}function yr(t){return Array.isArray(t)?t:t?[t]:[]}function qn(t){let e=yr(t);return e.length>0&&e.every(r=>typeof r=="string")?e:[]}function Jn(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;switch(typeof t){case"number":return t;case"string":return parseFloat(t);default:return}}function ni(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;switch(typeof t){case"number":return t;case"string":return parseInt(t,10);default:return}}function _r(t){switch(t){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function uc(t,e){var r;let n=(r=Ee.parseTextSync)===null||r===void 0?void 0:r.call(Ee,t,e),s=n.WMT_MS_Capabilities||n.WMS_Capabilities||n,i=Sv(s);if(e!=null&&e.inheritedLayerProps)for(let o of i.layers)hd(o,null);return e!=null&&e.includeRawJSON&&(i.json=s),e!=null&&e.includeXMLText&&(i.xml=t),i}function Sv(t){var e,r,n,s,i,o,a,c,u,l,f,h,d,p,g,m;let A={version:String(t.version||""),name:String(((e=t.Service)===null||e===void 0?void 0:e.Name)||"unnamed"),title:(r=t.Service)!==null&&r!==void 0&&r.Title?String((n=t.Service)===null||n===void 0?void 0:n.Title):void 0,abstract:(s=t.Service)!==null&&s!==void 0&&s.Abstract?String((i=t.Service)===null||i===void 0?void 0:i.Abstract):void 0,keywords:qn((o=t.Service)===null||o===void 0||(a=o.KeywordList)===null||a===void 0?void 0:a.Keyword),fees:(c=t.Service)!==null&&c!==void 0&&c.Fees?JSON.stringify((u=t.Service)===null||u===void 0?void 0:u.Fees):void 0,accessConstraints:(l=t.Service)!==null&&l!==void 0&&l.AccessConstraints?JSON.stringify((f=t.Service)===null||f===void 0?void 0:f.AccessConstraints):void 0,layerLimit:ni((h=t.Service)===null||h===void 0?void 0:h.LayerLimit),maxWidth:ni((d=t.Service)===null||d===void 0?void 0:d.maxWidth),maxHeight:ni((p=t.Service)===null||p===void 0?void 0:p.maxHeight),layers:[],requests:Bv((g=t.Capability)===null||g===void 0?void 0:g.Request),exceptions:Cv(t.Exception)},v=yr((m=t.Capability)===null||m===void 0?void 0:m.Layer);for(let x of v)A.layers.push(fd(x));for(let[x,b]of Object.entries(A))b===void 0&&delete A[x];return A}function Bv(t){let e={};for(let[r,n]of Object.entries(t||{})){let s=qn(n?.Format);e[r]={mimeTypes:s}}return e}function Cv(t){if(yr(t?.Format).length>0)return{mimeTypes:qn(t)}}function fd(t){var e;let r={title:String(t?.Title||""),name:t?.Name&&String(t?.Name),abstract:t?.Name&&String(t?.Abstract),keywords:qn((e=t.KeywordList)===null||e===void 0?void 0:e.Keyword)},n=t?.CRS||t?.SRS;n&&Array.isArray(n)&&n.every(l=>typeof l=="string")&&(r.crs=n);let s=t?.EX_GeographicBoundingBox&&Mv(t?.EX_GeographicBoundingBox);s&&(r.geographicBoundingBox=s),s=t?.LatLonBoundingBox&&Iv(t?.LatLonBoundingBox),s&&(r.geographicBoundingBox=s);let i=t?.BoundingBox&&Ov(t?.BoundingBox);i&&i.length>0&&(r.boundingBoxes=i);let a=yr(t?.Dimension).map(l=>Lv(l));a.length&&(r.dimensions=a),t!=null&&t.opaque&&(r.opaque=_r(t?.opaque)),t!=null&&t.cascaded&&(r.cascaded=_r(t?.cascaded)),t!=null&&t.queryable&&(r.queryable=_r(t?.queryable));let c=yr(t?.Layer),u=[];for(let l of c)u.push(fd(l));u.length>0&&(r.layers=u);for(let[l,f]of Object.entries(r))f===void 0&&delete r[l];return r}function Mv(t){let{westBoundLongitude:e,northBoundLatitude:r,eastBoundLongitude:n,southBoundLatitude:s}=t;return[[e,s],[n,r]]}function Iv(t){let{minx:e,miny:r,maxx:n,maxy:s}=t;return[[e,r],[n,s]]}function Ov(t){return yr(t).map(r=>Rv(r))}function Rv(t){let{CRS:e,SRS:r,minx:n,miny:s,maxx:i,maxy:o,resx:a,resy:c}=t,u={crs:e||r,boundingBox:[[Jn(n),Jn(s)],[Jn(i),Jn(o)]]};return a&&(u.xResolution=a),c&&(u.yResolution=c),u}function Lv(t){let{name:e,units:r,value:n}=t,s={name:e,units:r,extent:n};return t.unitSymbol&&(s.unitSymbol=t.unitSymbol),t.default&&(s.defaultValue=t.default),t.multipleValues&&(s.multipleValues=_r(t.multipleValues)),t.nearestValue&&(s.nearestValue=_r(t.nearestValue)),t.current&&(s.current=_r(t.current)),s}function hd(t,e){e!=null&&e.geographicBoundingBox&&!t.geographicBoundingBox&&(t.geographicBoundingBox=[...e.geographicBoundingBox]),e!=null&&e.crs&&!t.crs&&(t.crs=[...e.crs]),e!=null&&e.boundingBoxes&&!t.boundingBoxes&&(t.boundingBoxes=[...e.boundingBoxes]),e!=null&&e.dimensions&&!t.dimensions&&(t.dimensions=[...e.dimensions]);for(let r of t.layers||[])hd(r,t)}var Pv="4.1.0-alpha.9",Wr={id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:Pv,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:Fv,options:{wms:{}},parse:async(t,e)=>uc(new TextDecoder().decode(t),e?.wms),parseTextSync:(t,e)=>uc(t,e?.wms)};function Fv(t){return t.startsWith("<?xml")}function lc(t,e){var r,n;let i=((n=((r=Ee.parseTextSync)===null||r===void 0?void 0:r.call(Ee,t,e)).FeatureInfoResponse)===null||n===void 0?void 0:n.FIELDS)||[];return{features:(Array.isArray(i)?i:[i]).map(a=>Nv(a))}}function Nv(t){return{attributes:t||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var dd={...Wr,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(t,e)=>lc(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>lc(t,e)};function fc(t,e){var r;return(r=Ee.parseTextSync)===null||r===void 0?void 0:r.call(Ee,t,e)}var pd={...Wr,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(t,e)=>fc(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>fc(t,e)};function md(t,e){let{type:r="auto"}=t,n=r==="auto"?Uv(t.url,e):Dv(r,e);if(!n)throw new Error("Not a valid image source type");return n.create(t)}function Dv(t,e){for(let r of e)if(r.type===t)return r;return null}function Uv(t,e){for(let r of e)if(r.testURL&&r.testURL(t))return r;return null}var gd="4.1.0-alpha.9";var hc,Gv=(hc=globalThis.loaders)===null||hc===void 0?void 0:hc.parseImageNode,dc=typeof Image<"u",pc=typeof ImageBitmap<"u",kv=Boolean(Gv),mc=Hn?!0:kv;function yd(t){switch(t){case"auto":return pc||dc||mc;case"imagebitmap":return pc;case"image":return dc;case"data":return mc;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function _d(){if(pc)return"imagebitmap";if(dc)return"image";if(mc)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Ad(t){let e=Hv(t);if(!e)throw new Error("Not an image");return e}function Wn(t){switch(Ad(t)){case"data":return t;case"image":case"imagebitmap":let e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function Hv(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}var Vv=/^data:image\/svg\+xml/,zv=/\.svg((\?|#).*)?$/;function si(t){return t&&(Vv.test(t)||zv.test(t))}function vd(t,e){if(si(e)){let n=new TextDecoder().decode(t);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return gc(t,e)}function gc(t,e){if(si(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function ii(t,e,r){let n=vd(t,r),s=self.URL||self.webkitURL,i=typeof n!="string"&&s.createObjectURL(n);try{return await jv(i||n,e)}finally{i&&s.revokeObjectURL(i)}}async function jv(t,e){let r=new Image;return r.src=t,e.image&&e.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,s)=>{try{r.onload=()=>n(r),r.onerror=i=>{let o=i instanceof Error?i.message:"error";s(new Error(o))}}catch(i){s(i)}})}var qv={},xd=!0;async function bd(t,e,r){let n;si(r)?n=await ii(t,e,r):n=gc(t,r);let s=e&&e.imagebitmap;return await Jv(n,s)}async function Jv(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if((Wv(e)||!xd)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(r){console.warn(r),xd=!1}return await createImageBitmap(t)}function Wv(t){for(let e in t||qv)return!1;return!0}function Td(t){return!Zv(t,"ftyp",4)||!(t[8]&96)?null:Xv(t)}function Xv(t){switch(Kv(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Kv(t,e,r){return String.fromCharCode(...t.slice(e,r))}function Yv(t){return[...t].map(e=>e.charCodeAt(0))}function Zv(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=Yv(e);for(let s=0;s<n.length;++s)if(n[s]!==t[s+r])return!1;return!0}var ft=!1,Xn=!0;function Ar(t){let e=Kn(t);return $v(e)||rx(e)||ex(e)||tx(e)||Qv(e)}function Qv(t){let e=new Uint8Array(t instanceof DataView?t.buffer:t),r=Td(e);return r?{mimeType:r.mimeType,width:0,height:0}:null}function $v(t){let e=Kn(t);return e.byteLength>=24&&e.getUint32(0,ft)===2303741511?{mimeType:"image/png",width:e.getUint32(16,ft),height:e.getUint32(20,ft)}:null}function ex(t){let e=Kn(t);return e.byteLength>=10&&e.getUint32(0,ft)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,Xn),height:e.getUint16(8,Xn)}:null}function tx(t){let e=Kn(t);return e.byteLength>=14&&e.getUint16(0,ft)===16973&&e.getUint32(2,Xn)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,Xn),height:e.getUint32(22,Xn)}:null}function rx(t){let e=Kn(t);if(!(e.byteLength>=3&&e.getUint16(0,ft)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:s}=nx(),i=2;for(;i+9<e.byteLength;){let o=e.getUint16(i,ft);if(s.has(o))return{mimeType:"image/jpeg",height:e.getUint16(i+5,ft),width:e.getUint16(i+7,ft)};if(!n.has(o))return null;i+=2,i+=e.getUint16(i,ft)}return null}function nx(){let t=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)t.add(r);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Kn(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}async function Ed(t,e){var r;let{mimeType:n}=Ar(t)||{},s=(r=globalThis.loaders)===null||r===void 0?void 0:r.parseImageNode;return j(s),await s(t,n)}async function wd(t,e,r){e=e||{};let s=(e.image||{}).type||"auto",{url:i}=r||{},o=sx(s),a;switch(o){case"imagebitmap":a=await bd(t,e,i);break;case"image":a=await ii(t,e,i);break;case"data":a=await Ed(t,e);break;default:j(!1)}return s==="data"&&(a=Wn(a)),a}function sx(t){switch(t){case"auto":case"data":return _d();default:return yd(t),t}}var ix=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],ox=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],ax={image:{type:"auto",decode:!0}},zt={id:"image",module:"images",name:"Images",version:gd,mimeTypes:ox,extensions:ix,parse:wd,tests:[t=>Boolean(Ar(new DataView(t)))],options:ax};var yc={};function _c(t){if(yc[t]===void 0){let e=Hn?ux(t):cx(t);yc[t]=e}return yc[t]}function cx(t){var e,r;let n=["image/png","image/jpeg","image/gif"],s=((e=globalThis.loaders)===null||e===void 0?void 0:e.imageFormatsNode)||n,i=(r=globalThis.loaders)===null||r===void 0?void 0:r.parseImageNode;return Boolean(i)&&s.includes(t)}function ux(t){switch(t){case"image/avif":case"image/webp":return lx(t);default:return!0}}function lx(t){try{return document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)===0}catch{return!1}}var Sd={type:"wms",testURL:t=>t.toLowerCase().includes("wms"),create:t=>new Ac(t)},Ac=class extends Ue{constructor(e){var r;super(e),this.url=void 0,this.data=void 0,this.substituteCRS84=void 0,this.flipCRS=void 0,this.wmsParameters=void 0,this.vendorParameters=void 0,this.capabilities=null,this.url=e.url,this.data=e.url,this.substituteCRS84=(r=e.substituteCRS84)!==null&&r!==void 0?r:!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...e.wmsParameters},this.vendorParameters=e.vendorParameters||{}}async getMetadata(){let e=await this.getCapabilities();return this.normalizeMetadata(e)}async getImage(e){let{boundingBox:r,bbox:n,...s}=e,i={bbox:r?[...r[0],...r[1]]:n,...s};return await this.getMap(i)}normalizeMetadata(e){return e}async getCapabilities(e,r){let n=this.getCapabilitiesURL(e,r),s=await this.fetch(n),i=await s.arrayBuffer();this._checkResponse(s,i);let o=await Wr.parse(i,this.loadOptions);return this.capabilities=o,o}async getMap(e,r){let n=this.getMapURL(e,r),s=await this.fetch(n),i=await s.arrayBuffer();this._checkResponse(s,i);try{return await zt.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}async getFeatureInfo(e,r){let n=this.getFeatureInfoURL(e,r),s=await this.fetch(n),i=await s.arrayBuffer();return this._checkResponse(s,i),await dd.parse(i,this.loadOptions)}async getFeatureInfoText(e,r){let n=this.getFeatureInfoURL(e,r),s=await this.fetch(n),i=await s.arrayBuffer();return this._checkResponse(s,i),new TextDecoder().decode(i)}async describeLayer(e,r){let n=this.describeLayerURL(e,r),s=await this.fetch(n),i=await s.arrayBuffer();return this._checkResponse(s,i),await pd.parse(i,this.loadOptions)}async getLegendGraphic(e,r){let n=this.getLegendGraphicURL(e,r),s=await this.fetch(n),i=await s.arrayBuffer();this._checkResponse(s,i);try{return await zt.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}getCapabilitiesURL(e,r){let n={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetCapabilities",n,r)}getMapURL(e,r){e=this._getWMS130Parameters(e);let n={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...e};return this._getWMSUrl("GetMap",n,r)}getFeatureInfoURL(e,r){e=this._getWMS130Parameters(e);let n={version:this.wmsParameters.version,info_format:this.wmsParameters.info_format,layers:this.wmsParameters.layers,query_layers:this.wmsParameters.query_layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...e};return this._getWMSUrl("GetFeatureInfo",n,r)}describeLayerURL(e,r){let n={version:this.wmsParameters.version,...e};return this._getWMSUrl("DescribeLayer",n,r)}getLegendGraphicURL(e,r){let n={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetLegendGraphic",n,r)}_parseWMSUrl(e){let[r,n]=e.split("?"),s=n.split("&"),i={};for(let o of s){let[a,c]=o.split("=");i[a]=c}return{url:r,parameters:i}}_getWMSUrl(e,r,n){let s=this.url,i=!0,o={service:"WMS",version:r.version,request:e,...r,...this.vendorParameters,...n},a=["transparent","time","elevation"];for(let[c,u]of Object.entries(o))(!a.includes(c)||u)&&(s+=i?"?":"&",i=!1,s+=this._getURLParameter(c,u,r));return encodeURI(s)}_getWMS130Parameters(e){let r={...e};return r.srs&&(r.crs=r.crs||r.srs,delete r.srs),r}_getURLParameter(e,r,n){switch(e){case"crs":n.version!=="1.3.0"?e="srs":this.substituteCRS84&&r==="EPSG:4326"&&(r="CRS:84");break;case"srs":n.version==="1.3.0"&&(e="crs");break;case"bbox":let s=this._flipBoundingBox(r,n);s&&(r=s);break;default:}return e=e.toUpperCase(),Array.isArray(r)?`${e}=${r.join(",")}`:`${e}=${r?String(r):""}`}_flipBoundingBox(e,r){if(!Array.isArray(e)||e.length!==4)return null;let n=r.version==="1.3.0"&&this.flipCRS.includes(r.crs||"")&&!(this.substituteCRS84&&r.crs==="EPSG:4326"),s=e;return n?[s[1],s[0],s[3],s[2]]:s}async _fetchArrayBuffer(e){let r=await this.fetch(e),n=await r.arrayBuffer();return this._checkResponse(r,n),n}_checkResponse(e,r){let n=e.headers["content-type"];if(!e.ok||gr.mimeTypes.includes(n)){var s;let i=nc(this.loadOptions,{wms:{throwOnError:!0}}),o=(s=gr.parseSync)===null||s===void 0?void 0:s.call(gr,r,i);throw new Error(o)}}_parseError(e){var r;let n=(r=gr.parseSync)===null||r===void 0?void 0:r.call(gr,e,this.loadOptions);return new Error(n)}};var Xr=class extends Ue{constructor(e){super(e)}async getMetadata(){throw new Error("ImageSource.getMetadata not implemented")}async getImage(e){let r=this.getGranularParameters(e),n=this.getURLFromTemplate(r),i=await(await this.fetch(n)).arrayBuffer();return await zt.parse(i)}getGranularParameters(e){let[[r,n],[s,i]]=e.boundingBox;return{...e,east:r,north:n,south:i,west:s}}getURLFromTemplate(e){let r=this.props.url;for(let[n,s]of Object.entries(e))r=r.replace(`\${${n}}`,String(s)),r=r.replace(`{${n}}`,String(s));return r}};Xr.type="template";Xr.testURL=t=>t.toLowerCase().includes("{");var vc=class extends Xr{constructor(e){super(e),this.data=void 0,this.data=e.url}async getMetadata(){return await this.metadata()}async getImage(e){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(e){throw new Error("not implemented")}metadataURL(e){return`${this.props.url}?f=pjson`}exportImageURL(e){let r=`bbox=${e.bbox[0]},${e.bbox[1]},${e.bbox[2]},${e.bbox[3]}`,n=`size=${e.width},${e.height}`,s={...e,bbox:r,size:n};return delete s.width,delete s.height,this.getUrl("exportImage",s)}getUrl(e,r,n){let s=`${this.props.url}/${e}`,i=!0;for(let[o,a]of Object.entries(r))s+=i?"?":"&",i=!1,Array.isArray(a)?s+=`${o.toUpperCase()}=${a.join(",")}`:s+=`${o.toUpperCase()}=${a?String(a):""}`;return s}async checkResponse(e){if(!e.ok)throw new Error("error")}},Bd={type:"arcgis-image-server",testURL:t=>t.toLowerCase().includes("ImageServer"),create:t=>new vc(t)};var fx=[Sd,Bd];function xc(t){return md(t,fx)}function D(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var hx=1/Math.PI*180,dx=1/180*Math.PI,px={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...px}};var ee=globalThis.mathgl.config;function bc(t,{precision:e=ee.precision}={}){return t=mx(t),"".concat(parseFloat(t.toPrecision(e)))}function Fe(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Tc(t){return Cd(t)}function Ec(t){return Ne(t)}function Cd(t,e){return wc(t,r=>r*dx,e)}function Ne(t,e){return wc(t,r=>r*hx,e)}function oi(t,e,r){return wc(t,n=>Math.max(e,Math.min(r,n)))}function jt(t,e,r){return Fe(t)?t.map((n,s)=>jt(n,e[s],r)):r*e+(1-r)*t}function we(t,e,r){let n=ee.EPSILON;r&&(ee.EPSILON=r);try{if(t===e)return!0;if(Fe(t)&&Fe(e)){if(t.length!==e.length)return!1;for(let s=0;s<t.length;++s)if(!we(t[s],e[s]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):typeof t=="number"&&typeof e=="number"?Math.abs(t-e)<=ee.EPSILON*Math.max(1,Math.abs(t),Math.abs(e)):!1}finally{ee.EPSILON=n}}function mx(t){return Math.round(t/ee.EPSILON)*ee.EPSILON}function gx(t){return t.clone?t.clone():new Array(t.length)}function wc(t,e,r){if(Fe(t)){let n=t;r=r||gx(n);for(let s=0;s<r.length&&s<n.length;++s){let i=typeof t=="number"?t:t[s];r[s]=e(i,s,r)}return r}return e(t)}function yx(t){function e(){var r=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(r,Object.getPrototypeOf(this)),r}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var qt=class extends yx(Array){clone(){return new this.constructor().copy(this)}fromArray(e,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=e[n+r];return this.check()}toArray(e=[],r=0){for(let n=0;n<this.ELEMENTS;++n)e[r+n]=this[n];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:Fe(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(ee)}formatString(e){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+bc(this[n],e);return"".concat(e.printTypes?this.constructor.name:"","[").concat(r,"]")}equals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!we(this[r],e[r]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==e[r])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,r,n){if(n===void 0)return this.lerp(this,e,r);for(let s=0;s<this.ELEMENTS;++s){let i=e[s],o=typeof r=="number"?r:r[s];this[s]=i+n*(o-i)}return this.check()}min(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(e[r],this[r]);return this.check()}max(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(e[r],this[r]);return this.check()}clamp(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e[n]),r[n]);return this.check()}add(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(e){if(typeof e=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;else for(let r=0;r<this.ELEMENTS&&r<e.length;++r)this[r]*=e[r];return this.check()}multiplyByScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}check(){if(ee.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let e=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)e=e&&Number.isFinite(this[r]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=e;return this.check()}addScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e),r);return this.check()}get elements(){return this}};function _x(t,e){if(t.length!==e)return!1;for(let r=0;r<t.length;++r)if(!Number.isFinite(t[r]))return!1;return!0}function z(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(JSON.stringify(t)));return t}function Jt(t,e,r=""){if(ee.debug&&!_x(t,e))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return t}function me(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}var Wt=class extends qt{get x(){return this[0]}set x(e){this[0]=z(e)}get y(){return this[1]}set y(e){this[1]=z(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*this[r];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let r=0;for(let n=0;n<this.ELEMENTS;++n){let s=this[n]-e[n];r+=s*s}return z(r)}dot(e){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*e[n];return z(r)}normalize(){let e=this.magnitude();if(e!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=e;return this.check()}multiply(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return me(e>=0&&e<this.ELEMENTS,"index is out of range"),z(this[e])}setComponent(e,r){return me(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=r,this.check()}addVectors(e,r){return this.copy(e).add(r)}subVectors(e,r){return this.copy(e).subtract(r)}multiplyVectors(e,r){return this.copy(e).multiply(r)}addScaledVector(e,r){return this.add(new this.constructor(e).multiplyScalar(r))}};var se=typeof Float32Array<"u"?Float32Array:Array,Yn=Math.random;function Kr(t){return t>=0?Math.round(t):t%.5===0?Math.floor(t):Math.round(t)}var g3=Math.PI/180;function Ax(){let t=new se(2);return se!=Float32Array&&(t[0]=0,t[1]=0),t}function Md(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s,t[1]=r[1]*n+r[3]*s,t}function Id(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s+r[4],t[1]=r[1]*n+r[3]*s+r[5],t}function ai(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[3]*s+r[6],t[1]=r[1]*n+r[4]*s+r[7],t}function ci(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[4]*s+r[12],t[1]=r[1]*n+r[5]*s+r[13],t}var y3=function(){let t=Ax();return function(e,r,n,s,i,o){let a,c;for(r||(r=2),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],i(t,t,o),e[a]=t[0],e[a+1]=t[1];return e}}();function ui(t,e,r){let n=e[0],s=e[1],i=r[3]*n+r[7]*s||1;return t[0]=(r[0]*n+r[4]*s)/i,t[1]=(r[1]*n+r[5]*s)/i,t}function li(t,e,r){let n=e[0],s=e[1],i=e[2],o=r[3]*n+r[7]*s+r[11]*i||1;return t[0]=(r[0]*n+r[4]*s+r[8]*i)/o,t[1]=(r[1]*n+r[5]*s+r[9]*i)/o,t[2]=(r[2]*n+r[6]*s+r[10]*i)/o,t}function Od(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s,t[1]=r[1]*n+r[3]*s,t[2]=e[2],t}function Rd(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s,t[1]=r[1]*n+r[3]*s,t[2]=e[2],t[3]=e[3],t}function fi(t,e,r){let n=e[0],s=e[1],i=e[2];return t[0]=r[0]*n+r[3]*s+r[6]*i,t[1]=r[1]*n+r[4]*s+r[7]*i,t[2]=r[2]*n+r[5]*s+r[8]*i,t[3]=e[3],t}var vr=class extends Wt{constructor(e=0,r=0){super(2),Fe(e)&&arguments.length===1?this.copy(e):(ee.debug&&(z(e),z(r)),this[0]=e,this[1]=r)}set(e,r){return this[0]=e,this[1]=r,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this.check()}fromObject(e){return ee.debug&&(z(e.x),z(e.y)),this[0]=e.x,this[1]=e.y,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return ci(this,this,e),this.check()}transformAsVector(e){return ui(this,this,e),this.check()}transformByMatrix3(e){return ai(this,this,e),this.check()}transformByMatrix2x3(e){return Id(this,this,e),this.check()}transformByMatrix2(e){return Md(this,this,e),this.check()}};var Zr={};Ae(Zr,{add:()=>Tx,angle:()=>Ic,bezier:()=>Nx,ceil:()=>Ex,clone:()=>vx,copy:()=>xx,create:()=>hi,cross:()=>xr,dist:()=>qx,distance:()=>Dd,div:()=>jx,divide:()=>Nd,dot:()=>Zn,equals:()=>Hx,exactEquals:()=>kx,floor:()=>wx,forEach:()=>Xx,fromValues:()=>di,hermite:()=>Fx,inverse:()=>Rx,len:()=>Oc,length:()=>Ld,lerp:()=>Lx,max:()=>Bx,min:()=>Sx,mul:()=>zx,multiply:()=>Fd,negate:()=>Ox,normalize:()=>Sc,random:()=>Dx,rotateX:()=>Bc,rotateY:()=>Cc,rotateZ:()=>Mc,round:()=>Cx,scale:()=>Mx,scaleAndAdd:()=>Ix,set:()=>bx,slerp:()=>Px,sqrDist:()=>Jx,sqrLen:()=>Wx,squaredDistance:()=>Ud,squaredLength:()=>Gd,str:()=>Gx,sub:()=>Vx,subtract:()=>Pd,transformMat3:()=>Qn,transformMat4:()=>br,transformQuat:()=>$n,zero:()=>Ux});function hi(){let t=new se(3);return se!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function vx(t){let e=new se(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Ld(t){let e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function di(t,e,r){let n=new se(3);return n[0]=t,n[1]=e,n[2]=r,n}function xx(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function bx(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function Tx(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function Pd(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function Fd(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function Nd(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}function Ex(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function wx(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function Sx(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t}function Bx(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t}function Cx(t,e){return t[0]=Kr(e[0]),t[1]=Kr(e[1]),t[2]=Kr(e[2]),t}function Mx(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function Ix(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}function Dd(t,e){let r=e[0]-t[0],n=e[1]-t[1],s=e[2]-t[2];return Math.sqrt(r*r+n*n+s*s)}function Ud(t,e){let r=e[0]-t[0],n=e[1]-t[1],s=e[2]-t[2];return r*r+n*n+s*s}function Gd(t){let e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}function Ox(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function Rx(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function Sc(t,e){let r=e[0],n=e[1],s=e[2],i=r*r+n*n+s*s;return i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function Zn(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xr(t,e,r){let n=e[0],s=e[1],i=e[2],o=r[0],a=r[1],c=r[2];return t[0]=s*c-i*a,t[1]=i*o-n*c,t[2]=n*a-s*o,t}function Lx(t,e,r,n){let s=e[0],i=e[1],o=e[2];return t[0]=s+n*(r[0]-s),t[1]=i+n*(r[1]-i),t[2]=o+n*(r[2]-o),t}function Px(t,e,r,n){let s=Math.acos(Math.min(Math.max(Zn(e,r),-1),1)),i=Math.sin(s),o=Math.sin((1-n)*s)/i,a=Math.sin(n*s)/i;return t[0]=o*e[0]+a*r[0],t[1]=o*e[1]+a*r[1],t[2]=o*e[2]+a*r[2],t}function Fx(t,e,r,n,s,i){let o=i*i,a=o*(2*i-3)+1,c=o*(i-2)+i,u=o*(i-1),l=o*(3-2*i);return t[0]=e[0]*a+r[0]*c+n[0]*u+s[0]*l,t[1]=e[1]*a+r[1]*c+n[1]*u+s[1]*l,t[2]=e[2]*a+r[2]*c+n[2]*u+s[2]*l,t}function Nx(t,e,r,n,s,i){let o=1-i,a=o*o,c=i*i,u=a*o,l=3*i*a,f=3*c*o,h=c*i;return t[0]=e[0]*u+r[0]*l+n[0]*f+s[0]*h,t[1]=e[1]*u+r[1]*l+n[1]*f+s[1]*h,t[2]=e[2]*u+r[2]*l+n[2]*f+s[2]*h,t}function Dx(t,e){e=e===void 0?1:e;let r=Yn()*2*Math.PI,n=Yn()*2-1,s=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(r)*s,t[1]=Math.sin(r)*s,t[2]=n*e,t}function br(t,e,r){let n=e[0],s=e[1],i=e[2],o=r[3]*n+r[7]*s+r[11]*i+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*s+r[8]*i+r[12])/o,t[1]=(r[1]*n+r[5]*s+r[9]*i+r[13])/o,t[2]=(r[2]*n+r[6]*s+r[10]*i+r[14])/o,t}function Qn(t,e,r){let n=e[0],s=e[1],i=e[2];return t[0]=n*r[0]+s*r[3]+i*r[6],t[1]=n*r[1]+s*r[4]+i*r[7],t[2]=n*r[2]+s*r[5]+i*r[8],t}function $n(t,e,r){let n=r[0],s=r[1],i=r[2],o=r[3],a=e[0],c=e[1],u=e[2],l=s*u-i*c,f=i*a-n*u,h=n*c-s*a,d=s*h-i*f,p=i*l-n*h,g=n*f-s*l,m=o*2;return l*=m,f*=m,h*=m,d*=2,p*=2,g*=2,t[0]=a+l+d,t[1]=c+f+p,t[2]=u+h+g,t}function Bc(t,e,r,n){let s=[],i=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],i[0]=s[0],i[1]=s[1]*Math.cos(n)-s[2]*Math.sin(n),i[2]=s[1]*Math.sin(n)+s[2]*Math.cos(n),t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function Cc(t,e,r,n){let s=[],i=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],i[0]=s[2]*Math.sin(n)+s[0]*Math.cos(n),i[1]=s[1],i[2]=s[2]*Math.cos(n)-s[0]*Math.sin(n),t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function Mc(t,e,r,n){let s=[],i=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],i[0]=s[0]*Math.cos(n)-s[1]*Math.sin(n),i[1]=s[0]*Math.sin(n)+s[1]*Math.cos(n),i[2]=s[2],t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function Ic(t,e){let r=t[0],n=t[1],s=t[2],i=e[0],o=e[1],a=e[2],c=Math.sqrt((r*r+n*n+s*s)*(i*i+o*o+a*a)),u=c&&Zn(t,e)/c;return Math.acos(Math.min(Math.max(u,-1),1))}function Ux(t){return t[0]=0,t[1]=0,t[2]=0,t}function Gx(t){return"vec3(".concat(t[0],", ").concat(t[1],", ").concat(t[2],")")}function kx(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function Hx(t,e){let r=t[0],n=t[1],s=t[2],i=e[0],o=e[1],a=e[2];return Math.abs(r-i)<=1e-6*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-o)<=1e-6*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}var Vx=Pd,zx=Fd,jx=Nd,qx=Dd,Jx=Ud,Oc=Ld,Wx=Gd,Xx=function(){let t=hi();return function(e,r,n,s,i,o){let a,c;for(r||(r=3),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],i(t,t,o),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2];return e}}();var Rc=[0,0,0],pi,w=class extends Wt{static get ZERO(){return pi||(pi=new w(0,0,0),Object.freeze(pi)),pi}constructor(e=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&Fe(e)?this.copy(e):(ee.debug&&(z(e),z(r),z(n)),this[0]=e,this[1]=r,this[2]=n)}set(e,r,n){return this[0]=e,this[1]=r,this[2]=n,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return ee.debug&&(z(e.x),z(e.y),z(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=z(e)}angle(e){return Ic(this,e)}cross(e){return xr(this,this,e),this.check()}rotateX({radians:e,origin:r=Rc}){return Bc(this,this,r,e),this.check()}rotateY({radians:e,origin:r=Rc}){return Cc(this,this,r,e),this.check()}rotateZ({radians:e,origin:r=Rc}){return Mc(this,this,r,e),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return br(this,this,e),this.check()}transformAsVector(e){return li(this,this,e),this.check()}transformByMatrix3(e){return Qn(this,this,e),this.check()}transformByMatrix2(e){return Od(this,this,e),this.check()}transformByQuaternion(e){return $n(this,this,e),this.check()}};var mi,Qr=class extends Wt{static get ZERO(){return mi||(mi=new Qr(0,0,0,0),Object.freeze(mi)),mi}constructor(e=0,r=0,n=0,s=0){super(-0,-0,-0,-0),Fe(e)&&arguments.length===1?this.copy(e):(ee.debug&&(z(e),z(r),z(n),z(s)),this[0]=e,this[1]=r,this[2]=n,this[3]=s)}set(e,r,n,s){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}fromObject(e){return ee.debug&&(z(e.x),z(e.y),z(e.z),z(e.w)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e.w=this[3],e}get ELEMENTS(){return 4}get z(){return this[2]}set z(e){this[2]=z(e)}get w(){return this[3]}set w(e){this[3]=z(e)}transform(e){return br(this,this,e),this.check()}transformByMatrix3(e){return fi(this,this,e),this.check()}transformByMatrix2(e){return Rd(this,this,e),this.check()}transformByQuaternion(e){return $n(this,this,e),this.check()}applyMatrix4(e){return e.transform(this,this),this}};var $r=class extends qt{toString(){let e="[";if(ee.printRowMajor){e+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)e+=" ".concat(this[n*this.RANK+r])}else{e+="column-major:";for(let r=0;r<this.ELEMENTS;++r)e+=" ".concat(this[r])}return e+="]",e}getElementIndex(e,r){return r*this.RANK+e}getElement(e,r){return this[r*this.RANK+e]}setElement(e,r,n){return this[r*this.RANK+e]=z(n),this}getColumn(e,r=new Array(this.RANK).fill(-0)){let n=e*this.RANK;for(let s=0;s<this.RANK;++s)r[s]=this[n+s];return r}setColumn(e,r){let n=e*this.RANK;for(let s=0;s<this.RANK;++s)this[n+s]=r[s];return this}};function kd(){let t=new se(9);return se!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function Hd(t,e){if(t===e){let r=e[1],n=e[2],s=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=s}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function Vd(t,e){let r=e[0],n=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],u=e[7],l=e[8],f=l*o-a*u,h=-l*i+a*c,d=u*i-o*c,p=r*f+n*h+s*d;return p?(p=1/p,t[0]=f*p,t[1]=(-l*n+s*u)*p,t[2]=(a*n-s*o)*p,t[3]=h*p,t[4]=(l*r-s*c)*p,t[5]=(-a*r+s*i)*p,t[6]=d*p,t[7]=(-u*r+n*c)*p,t[8]=(o*r-n*i)*p,t):null}function zd(t){let e=t[0],r=t[1],n=t[2],s=t[3],i=t[4],o=t[5],a=t[6],c=t[7],u=t[8];return e*(u*i-o*c)+r*(-u*s+o*a)+n*(c*s-i*a)}function Lc(t,e,r){let n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=e[8],h=r[0],d=r[1],p=r[2],g=r[3],m=r[4],A=r[5],v=r[6],x=r[7],b=r[8];return t[0]=h*n+d*o+p*u,t[1]=h*s+d*a+p*l,t[2]=h*i+d*c+p*f,t[3]=g*n+m*o+A*u,t[4]=g*s+m*a+A*l,t[5]=g*i+m*c+A*f,t[6]=v*n+x*o+b*u,t[7]=v*s+x*a+b*l,t[8]=v*i+x*c+b*f,t}function jd(t,e,r){let n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=e[8],h=r[0],d=r[1];return t[0]=n,t[1]=s,t[2]=i,t[3]=o,t[4]=a,t[5]=c,t[6]=h*n+d*o+u,t[7]=h*s+d*a+l,t[8]=h*i+d*c+f,t}function qd(t,e,r){let n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=e[8],h=Math.sin(r),d=Math.cos(r);return t[0]=d*n+h*o,t[1]=d*s+h*a,t[2]=d*i+h*c,t[3]=d*o-h*n,t[4]=d*a-h*s,t[5]=d*c-h*i,t[6]=u,t[7]=l,t[8]=f,t}function Pc(t,e,r){let n=r[0],s=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=s*e[3],t[4]=s*e[4],t[5]=s*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function Jd(t,e){let r=e[0],n=e[1],s=e[2],i=e[3],o=r+r,a=n+n,c=s+s,u=r*o,l=n*o,f=n*a,h=s*o,d=s*a,p=s*c,g=i*o,m=i*a,A=i*c;return t[0]=1-f-p,t[3]=l-A,t[6]=h+m,t[1]=l+A,t[4]=1-u-p,t[7]=d-g,t[2]=h-m,t[5]=d+g,t[8]=1-u-f,t}var Fc;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL1ROW0=3]="COL1ROW0",t[t.COL1ROW1=4]="COL1ROW1",t[t.COL1ROW2=5]="COL1ROW2",t[t.COL2ROW0=6]="COL2ROW0",t[t.COL2ROW1=7]="COL2ROW1",t[t.COL2ROW2=8]="COL2ROW2"})(Fc||(Fc={}));var Yx=Object.freeze([1,0,0,0,1,0,0,0,1]),W=class extends $r{static get IDENTITY(){return Qx()}static get ZERO(){return Zx()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Fc}constructor(e,...r){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):r.length>0?this.copy([e,...r]):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}identity(){return this.copy(Yx)}fromObject(e){return this.check()}fromQuaternion(e){return Jd(this,e),this.check()}set(e,r,n,s,i,o,a,c,u){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=u,this.check()}setRowMajor(e,r,n,s,i,o,a,c,u){return this[0]=e,this[1]=s,this[2]=a,this[3]=r,this[4]=i,this[5]=c,this[6]=n,this[7]=o,this[8]=u,this.check()}determinant(){return zd(this)}transpose(){return Hd(this,this),this.check()}invert(){return Vd(this,this),this.check()}multiplyLeft(e){return Lc(this,e,this),this.check()}multiplyRight(e){return Lc(this,this,e),this.check()}rotate(e){return qd(this,this,e),this.check()}scale(e){return Array.isArray(e)?Pc(this,this,e):Pc(this,this,[e,e]),this.check()}translate(e){return jd(this,this,e),this.check()}transform(e,r){let n;switch(e.length){case 2:n=ai(r||[-0,-0],e,this);break;case 3:n=Qn(r||[-0,-0,-0],e,this);break;case 4:n=fi(r||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Jt(n,e.length),n}transformVector(e,r){return this.transform(e,r)}transformVector2(e,r){return this.transform(e,r)}transformVector3(e,r){return this.transform(e,r)}},gi,yi=null;function Zx(){return gi||(gi=new W([0,0,0,0,0,0,0,0,0]),Object.freeze(gi)),gi}function Qx(){return yi||(yi=new W,Object.freeze(yi)),yi}var _i={};Ae(_i,{add:()=>Tb,adjoint:()=>sb,clone:()=>eb,copy:()=>tb,create:()=>$x,decompose:()=>pb,determinant:()=>Uc,equals:()=>Bb,exactEquals:()=>Sb,frob:()=>bb,fromQuat:()=>qc,fromQuat2:()=>fb,fromRotation:()=>ab,fromRotationTranslation:()=>Xd,fromRotationTranslationScale:()=>mb,fromRotationTranslationScaleOrigin:()=>gb,fromScaling:()=>ob,fromTranslation:()=>ib,fromValues:()=>rb,fromXRotation:()=>cb,fromYRotation:()=>ub,fromZRotation:()=>lb,frustum:()=>Jc,getRotation:()=>db,getScaling:()=>Kd,getTranslation:()=>hb,identity:()=>Wd,invert:()=>Dc,lookAt:()=>Kc,mul:()=>Cb,multiply:()=>es,multiplyScalar:()=>Eb,multiplyScalarAndAdd:()=>wb,ortho:()=>Xc,orthoNO:()=>Zd,orthoZO:()=>Ab,perspective:()=>Wc,perspectiveFromFieldOfView:()=>_b,perspectiveNO:()=>Yd,perspectiveZO:()=>yb,rotate:()=>Hc,rotateX:()=>Vc,rotateY:()=>zc,rotateZ:()=>jc,scale:()=>kc,set:()=>nb,str:()=>xb,sub:()=>Mb,subtract:()=>Qd,targetTo:()=>vb,translate:()=>Gc,transpose:()=>Nc});function $x(){let t=new se(16);return se!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function eb(t){let e=new se(16);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 tb(t,e){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 rb(t,e,r,n,s,i,o,a,c,u,l,f,h,d,p,g){let m=new se(16);return m[0]=t,m[1]=e,m[2]=r,m[3]=n,m[4]=s,m[5]=i,m[6]=o,m[7]=a,m[8]=c,m[9]=u,m[10]=l,m[11]=f,m[12]=h,m[13]=d,m[14]=p,m[15]=g,m}function nb(t,e,r,n,s,i,o,a,c,u,l,f,h,d,p,g,m){return t[0]=e,t[1]=r,t[2]=n,t[3]=s,t[4]=i,t[5]=o,t[6]=a,t[7]=c,t[8]=u,t[9]=l,t[10]=f,t[11]=h,t[12]=d,t[13]=p,t[14]=g,t[15]=m,t}function Wd(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Nc(t,e){if(t===e){let r=e[1],n=e[2],s=e[3],i=e[6],o=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=i,t[11]=e[14],t[12]=s,t[13]=o,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function Dc(t,e){let r=e[0],n=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],u=e[7],l=e[8],f=e[9],h=e[10],d=e[11],p=e[12],g=e[13],m=e[14],A=e[15],v=r*a-n*o,x=r*c-s*o,b=r*u-i*o,M=n*c-s*a,C=n*u-i*a,I=s*u-i*c,B=l*g-f*p,S=l*m-h*p,y=l*A-d*p,R=f*m-h*g,P=f*A-d*g,F=h*A-d*m,N=v*F-x*P+b*R+M*y-C*S+I*B;return N?(N=1/N,t[0]=(a*F-c*P+u*R)*N,t[1]=(s*P-n*F-i*R)*N,t[2]=(g*I-m*C+A*M)*N,t[3]=(h*C-f*I-d*M)*N,t[4]=(c*y-o*F-u*S)*N,t[5]=(r*F-s*y+i*S)*N,t[6]=(m*b-p*I-A*x)*N,t[7]=(l*I-h*b+d*x)*N,t[8]=(o*P-a*y+u*B)*N,t[9]=(n*y-r*P-i*B)*N,t[10]=(p*C-g*b+A*v)*N,t[11]=(f*b-l*C-d*v)*N,t[12]=(a*S-o*R-c*B)*N,t[13]=(r*R-n*S+s*B)*N,t[14]=(g*x-p*M-m*v)*N,t[15]=(l*M-f*x+h*v)*N,t):null}function sb(t,e){let r=e[0],n=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],u=e[7],l=e[8],f=e[9],h=e[10],d=e[11],p=e[12],g=e[13],m=e[14],A=e[15],v=r*a-n*o,x=r*c-s*o,b=r*u-i*o,M=n*c-s*a,C=n*u-i*a,I=s*u-i*c,B=l*g-f*p,S=l*m-h*p,y=l*A-d*p,R=f*m-h*g,P=f*A-d*g,F=h*A-d*m;return t[0]=a*F-c*P+u*R,t[1]=s*P-n*F-i*R,t[2]=g*I-m*C+A*M,t[3]=h*C-f*I-d*M,t[4]=c*y-o*F-u*S,t[5]=r*F-s*y+i*S,t[6]=m*b-p*I-A*x,t[7]=l*I-h*b+d*x,t[8]=o*P-a*y+u*B,t[9]=n*y-r*P-i*B,t[10]=p*C-g*b+A*v,t[11]=f*b-l*C-d*v,t[12]=a*S-o*R-c*B,t[13]=r*R-n*S+s*B,t[14]=g*x-p*M-m*v,t[15]=l*M-f*x+h*v,t}function Uc(t){let e=t[0],r=t[1],n=t[2],s=t[3],i=t[4],o=t[5],a=t[6],c=t[7],u=t[8],l=t[9],f=t[10],h=t[11],d=t[12],p=t[13],g=t[14],m=t[15],A=e*o-r*i,v=e*a-n*i,x=r*a-n*o,b=u*p-l*d,M=u*g-f*d,C=l*g-f*p,I=e*C-r*M+n*b,B=i*C-o*M+a*b,S=u*x-l*v+f*A,y=d*x-p*v+g*A;return c*I-s*B+m*S-h*y}function es(t,e,r){let n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=e[8],h=e[9],d=e[10],p=e[11],g=e[12],m=e[13],A=e[14],v=e[15],x=r[0],b=r[1],M=r[2],C=r[3];return t[0]=x*n+b*a+M*f+C*g,t[1]=x*s+b*c+M*h+C*m,t[2]=x*i+b*u+M*d+C*A,t[3]=x*o+b*l+M*p+C*v,x=r[4],b=r[5],M=r[6],C=r[7],t[4]=x*n+b*a+M*f+C*g,t[5]=x*s+b*c+M*h+C*m,t[6]=x*i+b*u+M*d+C*A,t[7]=x*o+b*l+M*p+C*v,x=r[8],b=r[9],M=r[10],C=r[11],t[8]=x*n+b*a+M*f+C*g,t[9]=x*s+b*c+M*h+C*m,t[10]=x*i+b*u+M*d+C*A,t[11]=x*o+b*l+M*p+C*v,x=r[12],b=r[13],M=r[14],C=r[15],t[12]=x*n+b*a+M*f+C*g,t[13]=x*s+b*c+M*h+C*m,t[14]=x*i+b*u+M*d+C*A,t[15]=x*o+b*l+M*p+C*v,t}function Gc(t,e,r){let n=r[0],s=r[1],i=r[2],o,a,c,u,l,f,h,d,p,g,m,A;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*i+e[12],t[13]=e[1]*n+e[5]*s+e[9]*i+e[13],t[14]=e[2]*n+e[6]*s+e[10]*i+e[14],t[15]=e[3]*n+e[7]*s+e[11]*i+e[15]):(o=e[0],a=e[1],c=e[2],u=e[3],l=e[4],f=e[5],h=e[6],d=e[7],p=e[8],g=e[9],m=e[10],A=e[11],t[0]=o,t[1]=a,t[2]=c,t[3]=u,t[4]=l,t[5]=f,t[6]=h,t[7]=d,t[8]=p,t[9]=g,t[10]=m,t[11]=A,t[12]=o*n+l*s+p*i+e[12],t[13]=a*n+f*s+g*i+e[13],t[14]=c*n+h*s+m*i+e[14],t[15]=u*n+d*s+A*i+e[15]),t}function kc(t,e,r){let n=r[0],s=r[1],i=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Hc(t,e,r,n){let s=n[0],i=n[1],o=n[2],a=Math.sqrt(s*s+i*i+o*o),c,u,l,f,h,d,p,g,m,A,v,x,b,M,C,I,B,S,y,R,P,F,N,G;return a<1e-6?null:(a=1/a,s*=a,i*=a,o*=a,u=Math.sin(r),c=Math.cos(r),l=1-c,f=e[0],h=e[1],d=e[2],p=e[3],g=e[4],m=e[5],A=e[6],v=e[7],x=e[8],b=e[9],M=e[10],C=e[11],I=s*s*l+c,B=i*s*l+o*u,S=o*s*l-i*u,y=s*i*l-o*u,R=i*i*l+c,P=o*i*l+s*u,F=s*o*l+i*u,N=i*o*l-s*u,G=o*o*l+c,t[0]=f*I+g*B+x*S,t[1]=h*I+m*B+b*S,t[2]=d*I+A*B+M*S,t[3]=p*I+v*B+C*S,t[4]=f*y+g*R+x*P,t[5]=h*y+m*R+b*P,t[6]=d*y+A*R+M*P,t[7]=p*y+v*R+C*P,t[8]=f*F+g*N+x*G,t[9]=h*F+m*N+b*G,t[10]=d*F+A*N+M*G,t[11]=p*F+v*N+C*G,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function Vc(t,e,r){let n=Math.sin(r),s=Math.cos(r),i=e[4],o=e[5],a=e[6],c=e[7],u=e[8],l=e[9],f=e[10],h=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=i*s+u*n,t[5]=o*s+l*n,t[6]=a*s+f*n,t[7]=c*s+h*n,t[8]=u*s-i*n,t[9]=l*s-o*n,t[10]=f*s-a*n,t[11]=h*s-c*n,t}function zc(t,e,r){let n=Math.sin(r),s=Math.cos(r),i=e[0],o=e[1],a=e[2],c=e[3],u=e[8],l=e[9],f=e[10],h=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=i*s-u*n,t[1]=o*s-l*n,t[2]=a*s-f*n,t[3]=c*s-h*n,t[8]=i*n+u*s,t[9]=o*n+l*s,t[10]=a*n+f*s,t[11]=c*n+h*s,t}function jc(t,e,r){let n=Math.sin(r),s=Math.cos(r),i=e[0],o=e[1],a=e[2],c=e[3],u=e[4],l=e[5],f=e[6],h=e[7];return e!==t&&(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[0]=i*s+u*n,t[1]=o*s+l*n,t[2]=a*s+f*n,t[3]=c*s+h*n,t[4]=u*s-i*n,t[5]=l*s-o*n,t[6]=f*s-a*n,t[7]=h*s-c*n,t}function ib(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function ob(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ab(t,e,r){let n=r[0],s=r[1],i=r[2],o=Math.sqrt(n*n+s*s+i*i),a,c,u;return o<1e-6?null:(o=1/o,n*=o,s*=o,i*=o,c=Math.sin(e),a=Math.cos(e),u=1-a,t[0]=n*n*u+a,t[1]=s*n*u+i*c,t[2]=i*n*u-s*c,t[3]=0,t[4]=n*s*u-i*c,t[5]=s*s*u+a,t[6]=i*s*u+n*c,t[7]=0,t[8]=n*i*u+s*c,t[9]=s*i*u-n*c,t[10]=i*i*u+a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function cb(t,e){let r=Math.sin(e),n=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ub(t,e){let r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function lb(t,e){let r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=n,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Xd(t,e,r){let n=e[0],s=e[1],i=e[2],o=e[3],a=n+n,c=s+s,u=i+i,l=n*a,f=n*c,h=n*u,d=s*c,p=s*u,g=i*u,m=o*a,A=o*c,v=o*u;return t[0]=1-(d+g),t[1]=f+v,t[2]=h-A,t[3]=0,t[4]=f-v,t[5]=1-(l+g),t[6]=p+m,t[7]=0,t[8]=h+A,t[9]=p-m,t[10]=1-(l+d),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function fb(t,e){let r=new se(3),n=-e[0],s=-e[1],i=-e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=n*n+s*s+i*i+o*o;return f>0?(r[0]=(a*o+l*n+c*i-u*s)*2/f,r[1]=(c*o+l*s+u*n-a*i)*2/f,r[2]=(u*o+l*i+a*s-c*n)*2/f):(r[0]=(a*o+l*n+c*i-u*s)*2,r[1]=(c*o+l*s+u*n-a*i)*2,r[2]=(u*o+l*i+a*s-c*n)*2),Xd(t,e,r),t}function hb(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function Kd(t,e){let r=e[0],n=e[1],s=e[2],i=e[4],o=e[5],a=e[6],c=e[8],u=e[9],l=e[10];return t[0]=Math.sqrt(r*r+n*n+s*s),t[1]=Math.sqrt(i*i+o*o+a*a),t[2]=Math.sqrt(c*c+u*u+l*l),t}function db(t,e){let r=new se(3);Kd(r,e);let n=1/r[0],s=1/r[1],i=1/r[2],o=e[0]*n,a=e[1]*s,c=e[2]*i,u=e[4]*n,l=e[5]*s,f=e[6]*i,h=e[8]*n,d=e[9]*s,p=e[10]*i,g=o+l+p,m=0;return g>0?(m=Math.sqrt(g+1)*2,t[3]=.25*m,t[0]=(f-d)/m,t[1]=(h-c)/m,t[2]=(a-u)/m):o>l&&o>p?(m=Math.sqrt(1+o-l-p)*2,t[3]=(f-d)/m,t[0]=.25*m,t[1]=(a+u)/m,t[2]=(h+c)/m):l>p?(m=Math.sqrt(1+l-o-p)*2,t[3]=(h-c)/m,t[0]=(a+u)/m,t[1]=.25*m,t[2]=(f+d)/m):(m=Math.sqrt(1+p-o-l)*2,t[3]=(a-u)/m,t[0]=(h+c)/m,t[1]=(f+d)/m,t[2]=.25*m),t}function pb(t,e,r,n){e[0]=n[12],e[1]=n[13],e[2]=n[14];let s=n[0],i=n[1],o=n[2],a=n[4],c=n[5],u=n[6],l=n[8],f=n[9],h=n[10];r[0]=Math.sqrt(s*s+i*i+o*o),r[1]=Math.sqrt(a*a+c*c+u*u),r[2]=Math.sqrt(l*l+f*f+h*h);let d=1/r[0],p=1/r[1],g=1/r[2],m=s*d,A=i*p,v=o*g,x=a*d,b=c*p,M=u*g,C=l*d,I=f*p,B=h*g,S=m+b+B,y=0;return S>0?(y=Math.sqrt(S+1)*2,t[3]=.25*y,t[0]=(M-I)/y,t[1]=(C-v)/y,t[2]=(A-x)/y):m>b&&m>B?(y=Math.sqrt(1+m-b-B)*2,t[3]=(M-I)/y,t[0]=.25*y,t[1]=(A+x)/y,t[2]=(C+v)/y):b>B?(y=Math.sqrt(1+b-m-B)*2,t[3]=(C-v)/y,t[0]=(A+x)/y,t[1]=.25*y,t[2]=(M+I)/y):(y=Math.sqrt(1+B-m-b)*2,t[3]=(A-x)/y,t[0]=(C+v)/y,t[1]=(M+I)/y,t[2]=.25*y),t}function mb(t,e,r,n){let s=e[0],i=e[1],o=e[2],a=e[3],c=s+s,u=i+i,l=o+o,f=s*c,h=s*u,d=s*l,p=i*u,g=i*l,m=o*l,A=a*c,v=a*u,x=a*l,b=n[0],M=n[1],C=n[2];return t[0]=(1-(p+m))*b,t[1]=(h+x)*b,t[2]=(d-v)*b,t[3]=0,t[4]=(h-x)*M,t[5]=(1-(f+m))*M,t[6]=(g+A)*M,t[7]=0,t[8]=(d+v)*C,t[9]=(g-A)*C,t[10]=(1-(f+p))*C,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function gb(t,e,r,n,s){let i=e[0],o=e[1],a=e[2],c=e[3],u=i+i,l=o+o,f=a+a,h=i*u,d=i*l,p=i*f,g=o*l,m=o*f,A=a*f,v=c*u,x=c*l,b=c*f,M=n[0],C=n[1],I=n[2],B=s[0],S=s[1],y=s[2],R=(1-(g+A))*M,P=(d+b)*M,F=(p-x)*M,N=(d-b)*C,G=(1-(h+A))*C,Q=(m+v)*C,J=(p+x)*I,ne=(m-v)*I,Z=(1-(h+g))*I;return t[0]=R,t[1]=P,t[2]=F,t[3]=0,t[4]=N,t[5]=G,t[6]=Q,t[7]=0,t[8]=J,t[9]=ne,t[10]=Z,t[11]=0,t[12]=r[0]+B-(R*B+N*S+J*y),t[13]=r[1]+S-(P*B+G*S+ne*y),t[14]=r[2]+y-(F*B+Q*S+Z*y),t[15]=1,t}function qc(t,e){let r=e[0],n=e[1],s=e[2],i=e[3],o=r+r,a=n+n,c=s+s,u=r*o,l=n*o,f=n*a,h=s*o,d=s*a,p=s*c,g=i*o,m=i*a,A=i*c;return t[0]=1-f-p,t[1]=l+A,t[2]=h-m,t[3]=0,t[4]=l-A,t[5]=1-u-p,t[6]=d+g,t[7]=0,t[8]=h+m,t[9]=d-g,t[10]=1-u-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Jc(t,e,r,n,s,i,o){let a=1/(r-e),c=1/(s-n),u=1/(i-o);return t[0]=i*2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i*2*c,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(s+n)*c,t[10]=(o+i)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*i*2*u,t[15]=0,t}function Yd(t,e,r,n,s){let i=1/Math.tan(e/2);if(t[0]=i/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,s!=null&&s!==1/0){let o=1/(n-s);t[10]=(s+n)*o,t[14]=2*s*n*o}else t[10]=-1,t[14]=-2*n;return t}var Wc=Yd;function yb(t,e,r,n,s){let i=1/Math.tan(e/2);if(t[0]=i/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,s!=null&&s!==1/0){let o=1/(n-s);t[10]=s*o,t[14]=s*n*o}else t[10]=-1,t[14]=-n;return t}function _b(t,e,r,n){let s=Math.tan(e.upDegrees*Math.PI/180),i=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),a=Math.tan(e.rightDegrees*Math.PI/180),c=2/(o+a),u=2/(s+i);return t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-((o-a)*c*.5),t[9]=(s-i)*u*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t}function Zd(t,e,r,n,s,i,o){let a=1/(e-r),c=1/(n-s),u=1/(i-o);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*a,t[13]=(s+n)*c,t[14]=(o+i)*u,t[15]=1,t}var Xc=Zd;function Ab(t,e,r,n,s,i,o){let a=1/(e-r),c=1/(n-s),u=1/(i-o);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=u,t[11]=0,t[12]=(e+r)*a,t[13]=(s+n)*c,t[14]=i*u,t[15]=1,t}function Kc(t,e,r,n){let s,i,o,a,c,u,l,f,h,d,p=e[0],g=e[1],m=e[2],A=n[0],v=n[1],x=n[2],b=r[0],M=r[1],C=r[2];return Math.abs(p-b)<1e-6&&Math.abs(g-M)<1e-6&&Math.abs(m-C)<1e-6?Wd(t):(f=p-b,h=g-M,d=m-C,s=1/Math.sqrt(f*f+h*h+d*d),f*=s,h*=s,d*=s,i=v*d-x*h,o=x*f-A*d,a=A*h-v*f,s=Math.sqrt(i*i+o*o+a*a),s?(s=1/s,i*=s,o*=s,a*=s):(i=0,o=0,a=0),c=h*a-d*o,u=d*i-f*a,l=f*o-h*i,s=Math.sqrt(c*c+u*u+l*l),s?(s=1/s,c*=s,u*=s,l*=s):(c=0,u=0,l=0),t[0]=i,t[1]=c,t[2]=f,t[3]=0,t[4]=o,t[5]=u,t[6]=h,t[7]=0,t[8]=a,t[9]=l,t[10]=d,t[11]=0,t[12]=-(i*p+o*g+a*m),t[13]=-(c*p+u*g+l*m),t[14]=-(f*p+h*g+d*m),t[15]=1,t)}function vb(t,e,r,n){let s=e[0],i=e[1],o=e[2],a=n[0],c=n[1],u=n[2],l=s-r[0],f=i-r[1],h=o-r[2],d=l*l+f*f+h*h;d>0&&(d=1/Math.sqrt(d),l*=d,f*=d,h*=d);let p=c*h-u*f,g=u*l-a*h,m=a*f-c*l;return d=p*p+g*g+m*m,d>0&&(d=1/Math.sqrt(d),p*=d,g*=d,m*=d),t[0]=p,t[1]=g,t[2]=m,t[3]=0,t[4]=f*m-h*g,t[5]=h*p-l*m,t[6]=l*g-f*p,t[7]=0,t[8]=l,t[9]=f,t[10]=h,t[11]=0,t[12]=s,t[13]=i,t[14]=o,t[15]=1,t}function xb(t){return"mat4(".concat(t[0],", ").concat(t[1],", ").concat(t[2],", ").concat(t[3],", ").concat(t[4],", ").concat(t[5],", ").concat(t[6],", ").concat(t[7],", ").concat(t[8],", ").concat(t[9],", ").concat(t[10],", ").concat(t[11],", ").concat(t[12],", ").concat(t[13],", ").concat(t[14],", ").concat(t[15],")")}function bb(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+t[6]*t[6]+t[7]*t[7]+t[8]*t[8]+t[9]*t[9]+t[10]*t[10]+t[11]*t[11]+t[12]*t[12]+t[13]*t[13]+t[14]*t[14]+t[15]*t[15])}function Tb(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t}function Qd(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}function Eb(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t}function wb(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t}function Sb(t,e){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]}function Bb(t,e){let r=t[0],n=t[1],s=t[2],i=t[3],o=t[4],a=t[5],c=t[6],u=t[7],l=t[8],f=t[9],h=t[10],d=t[11],p=t[12],g=t[13],m=t[14],A=t[15],v=e[0],x=e[1],b=e[2],M=e[3],C=e[4],I=e[5],B=e[6],S=e[7],y=e[8],R=e[9],P=e[10],F=e[11],N=e[12],G=e[13],Q=e[14],J=e[15];return Math.abs(r-v)<=1e-6*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(n-x)<=1e-6*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(s-b)<=1e-6*Math.max(1,Math.abs(s),Math.abs(b))&&Math.abs(i-M)<=1e-6*Math.max(1,Math.abs(i),Math.abs(M))&&Math.abs(o-C)<=1e-6*Math.max(1,Math.abs(o),Math.abs(C))&&Math.abs(a-I)<=1e-6*Math.max(1,Math.abs(a),Math.abs(I))&&Math.abs(c-B)<=1e-6*Math.max(1,Math.abs(c),Math.abs(B))&&Math.abs(u-S)<=1e-6*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(l-y)<=1e-6*Math.max(1,Math.abs(l),Math.abs(y))&&Math.abs(f-R)<=1e-6*Math.max(1,Math.abs(f),Math.abs(R))&&Math.abs(h-P)<=1e-6*Math.max(1,Math.abs(h),Math.abs(P))&&Math.abs(d-F)<=1e-6*Math.max(1,Math.abs(d),Math.abs(F))&&Math.abs(p-N)<=1e-6*Math.max(1,Math.abs(p),Math.abs(N))&&Math.abs(g-G)<=1e-6*Math.max(1,Math.abs(g),Math.abs(G))&&Math.abs(m-Q)<=1e-6*Math.max(1,Math.abs(m),Math.abs(Q))&&Math.abs(A-J)<=1e-6*Math.max(1,Math.abs(A),Math.abs(J))}var Cb=es,Mb=Qd;function Ib(){let t=new se(4);return se!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function $d(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function ep(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function tp(t){let e=t[0],r=t[1],n=t[2],s=t[3];return Math.sqrt(e*e+r*r+n*n+s*s)}function rp(t){let e=t[0],r=t[1],n=t[2],s=t[3];return e*e+r*r+n*n+s*s}function np(t,e){let r=e[0],n=e[1],s=e[2],i=e[3],o=r*r+n*n+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=r*o,t[1]=n*o,t[2]=s*o,t[3]=i*o,t}function sp(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function ip(t,e,r,n){let s=e[0],i=e[1],o=e[2],a=e[3];return t[0]=s+n*(r[0]-s),t[1]=i+n*(r[1]-i),t[2]=o+n*(r[2]-o),t[3]=a+n*(r[3]-a),t}function op(t,e,r){let n=e[0],s=e[1],i=e[2],o=e[3];return t[0]=r[0]*n+r[4]*s+r[8]*i+r[12]*o,t[1]=r[1]*n+r[5]*s+r[9]*i+r[13]*o,t[2]=r[2]*n+r[6]*s+r[10]*i+r[14]*o,t[3]=r[3]*n+r[7]*s+r[11]*i+r[15]*o,t}function ap(t,e,r){let n=e[0],s=e[1],i=e[2],o=r[0],a=r[1],c=r[2],u=r[3],l=u*n+a*i-c*s,f=u*s+c*n-o*i,h=u*i+o*s-a*n,d=-o*n-a*s-c*i;return t[0]=l*u+d*-o+f*-c-h*-a,t[1]=f*u+d*-a+h*-o-l*-c,t[2]=h*u+d*-c+l*-a-f*-o,t[3]=e[3],t}var K3=function(){let t=Ib();return function(e,r,n,s,i,o){let a,c;for(r||(r=4),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],t[3]=e[a+3],i(t,t,o),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2],e[a+3]=t[3];return e}}();var Qc;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"})(Qc||(Qc={}));var Rb=45*Math.PI/180,Lb=1,Yc=.1,Zc=500,Pb=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),k=class extends $r{static get IDENTITY(){return Nb()}static get ZERO(){return Fb()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Qc}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,r,n,s,i,o,a,c,u,l,f,h,d,p,g,m){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=u,this[9]=l,this[10]=f,this[11]=h,this[12]=d,this[13]=p,this[14]=g,this[15]=m,this.check()}setRowMajor(e,r,n,s,i,o,a,c,u,l,f,h,d,p,g,m){return this[0]=e,this[1]=i,this[2]=u,this[3]=d,this[4]=r,this[5]=o,this[6]=l,this[7]=p,this[8]=n,this[9]=a,this[10]=f,this[11]=g,this[12]=s,this[13]=c,this[14]=h,this[15]=m,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(Pb)}fromObject(e){return this.check()}fromQuaternion(e){return qc(this,e),this.check()}frustum(e){let{left:r,right:n,bottom:s,top:i,near:o=Yc,far:a=Zc}=e;return a===1/0?Db(this,r,n,s,i,o):Jc(this,r,n,s,i,o,a),this.check()}lookAt(e){let{eye:r,center:n=[0,0,0],up:s=[0,1,0]}=e;return Kc(this,r,n,s),this.check()}ortho(e){let{left:r,right:n,bottom:s,top:i,near:o=Yc,far:a=Zc}=e;return Xc(this,r,n,s,i,o,a),this.check()}orthographic(e){let{fovy:r=Rb,aspect:n=Lb,focalDistance:s=1,near:i=Yc,far:o=Zc}=e;cp(r);let a=r/2,c=s*Math.tan(a),u=c*n;return this.ortho({left:-u,right:u,bottom:-c,top:c,near:i,far:o})}perspective(e){let{fovy:r=45*Math.PI/180,aspect:n=1,near:s=.1,far:i=500}=e;return cp(r),Wc(this,r,n,s,i),this.check()}determinant(){return Uc(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],i=1/n[1],o=1/n[2];return e[0]=this[0]*s,e[1]=this[1]*i,e[2]=this[2]*o,e[3]=0,e[4]=this[4]*s,e[5]=this[5]*i,e[6]=this[6]*o,e[7]=0,e[8]=this[8]*s,e[9]=this[9]*i,e[10]=this[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],i=1/n[1],o=1/n[2];return e[0]=this[0]*s,e[1]=this[1]*i,e[2]=this[2]*o,e[3]=this[4]*s,e[4]=this[5]*i,e[5]=this[6]*o,e[6]=this[8]*s,e[7]=this[9]*i,e[8]=this[10]*o,e}transpose(){return Nc(this,this),this.check()}invert(){return Dc(this,this),this.check()}multiplyLeft(e){return es(this,e,this),this.check()}multiplyRight(e){return es(this,this,e),this.check()}rotateX(e){return Vc(this,this,e),this.check()}rotateY(e){return zc(this,this,e),this.check()}rotateZ(e){return jc(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,r){return Hc(this,this,e,r),this.check()}scale(e){return kc(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return Gc(this,this,e),this.check()}transform(e,r){return e.length===4?(r=op(r||[-0,-0,-0,-0],e,this),Jt(r,4),r):this.transformAsPoint(e,r)}transformAsPoint(e,r){let{length:n}=e,s;switch(n){case 2:s=ci(r||[-0,-0],e,this);break;case 3:s=br(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Jt(s,e.length),s}transformAsVector(e,r){let n;switch(e.length){case 2:n=ui(r||[-0,-0],e,this);break;case 3:n=li(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Jt(n,e.length),n}transformPoint(e,r){return this.transformAsPoint(e,r)}transformVector(e,r){return this.transformAsPoint(e,r)}transformDirection(e,r){return this.transformAsVector(e,r)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,r,n){return this.identity().translate([e,r,n])}},Ai,vi;function Fb(){return Ai||(Ai=new k([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Ai)),Ai}function Nb(){return vi||(vi=new k,Object.freeze(vi)),vi}function cp(t){if(t>Math.PI*2)throw Error("expected radians")}function Db(t,e,r,n,s,i){let o=2*i/(r-e),a=2*i/(s-n),c=(r+e)/(r-e),u=(s+n)/(s-n),l=-1,f=-1,h=-2*i;return t[0]=o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=c,t[9]=u,t[10]=l,t[11]=f,t[12]=0,t[13]=0,t[14]=h,t[15]=0,t}function up(){let t=new se(4);return se!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function lp(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function $c(t,e,r){r=r*.5;let n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t}function eu(t,e,r){let n=e[0],s=e[1],i=e[2],o=e[3],a=r[0],c=r[1],u=r[2],l=r[3];return t[0]=n*l+o*a+s*u-i*c,t[1]=s*l+o*c+i*a-n*u,t[2]=i*l+o*u+n*c-s*a,t[3]=o*l-n*a-s*c-i*u,t}function fp(t,e,r){r*=.5;let n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c+o*a,t[1]=s*c+i*a,t[2]=i*c-s*a,t[3]=o*c-n*a,t}function hp(t,e,r){r*=.5;let n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c-i*a,t[1]=s*c+o*a,t[2]=i*c+n*a,t[3]=o*c-s*a,t}function dp(t,e,r){r*=.5;let n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c+s*a,t[1]=s*c-n*a,t[2]=i*c+o*a,t[3]=o*c-i*a,t}function pp(t,e){let r=e[0],n=e[1],s=e[2];return t[0]=r,t[1]=n,t[2]=s,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-s*s)),t}function ts(t,e,r,n){let s=e[0],i=e[1],o=e[2],a=e[3],c=r[0],u=r[1],l=r[2],f=r[3],h,d,p,g,m;return h=s*c+i*u+o*l+a*f,h<0&&(h=-h,c=-c,u=-u,l=-l,f=-f),1-h>1e-6?(d=Math.acos(h),m=Math.sin(d),p=Math.sin((1-n)*d)/m,g=Math.sin(n*d)/m):(p=1-n,g=n),t[0]=p*s+g*c,t[1]=p*i+g*u,t[2]=p*o+g*l,t[3]=p*a+g*f,t}function mp(t,e){let r=e[0],n=e[1],s=e[2],i=e[3],o=r*r+n*n+s*s+i*i,a=o?1/o:0;return t[0]=-r*a,t[1]=-n*a,t[2]=-s*a,t[3]=i*a,t}function gp(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function tu(t,e){let r=e[0]+e[4]+e[8],n;if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{let s=0;e[4]>e[0]&&(s=1),e[8]>e[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;n=Math.sqrt(e[s*3+s]-e[i*3+i]-e[o*3+o]+1),t[s]=.5*n,n=.5/n,t[3]=(e[i*3+o]-e[o*3+i])*n,t[i]=(e[i*3+s]+e[s*3+i])*n,t[o]=(e[o*3+s]+e[s*3+o])*n}return t}var yp=$d;var _p=ep,Ap=sp,vp=ip,xp=tp;var bp=rp;var Tp=np;var Ep=function(){let t=hi(),e=di(1,0,0),r=di(0,1,0);return function(n,s,i){let o=Zn(s,i);return o<-.999999?(xr(t,e,s),Oc(t)<1e-6&&xr(t,r,s),Sc(t,t),$c(n,t,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(xr(t,s,i),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+o,Tp(n,n))}}(),uN=function(){let t=up(),e=up();return function(r,n,s,i,o,a){return ts(t,n,o,a),ts(e,s,i,a),ts(r,t,e,2*a*(1-a)),r}}(),lN=function(){let t=kd();return function(e,r,n,s){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=s[0],t[4]=s[1],t[7]=s[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],Tp(e,tu(e,t))}}();var Ub=[0,0,0,1],ht=class extends qt{constructor(e=0,r=0,n=0,s=1){super(-0,-0,-0,-0),Array.isArray(e)&&arguments.length===1?this.copy(e):this.set(e,r,n,s)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,r,n,s){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this.check()}fromObject(e){return this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this.check()}fromMatrix3(e){return tu(this,e),this.check()}fromAxisRotation(e,r){return $c(this,e,r),this.check()}identity(){return lp(this),this.check()}setAxisAngle(e,r){return this.fromAxisRotation(e,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=z(e)}get y(){return this[1]}set y(e){this[1]=z(e)}get z(){return this[2]}set z(e){this[2]=z(e)}get w(){return this[3]}set w(e){this[3]=z(e)}len(){return xp(this)}lengthSquared(){return bp(this)}dot(e){return Ap(this,e)}rotationTo(e,r){return Ep(this,e,r),this.check()}add(e){return yp(this,this,e),this.check()}calculateW(){return pp(this,this),this.check()}conjugate(){return gp(this,this),this.check()}invert(){return mp(this,this),this.check()}lerp(e,r,n){return n===void 0?this.lerp(this,e,r):(vp(this,e,r,n),this.check())}multiplyRight(e){return eu(this,this,e),this.check()}multiplyLeft(e){return eu(this,e,this),this.check()}normalize(){let e=this.len(),r=e>0?1/e:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,e===0&&(this[3]=1),this.check()}rotateX(e){return fp(this,this,e),this.check()}rotateY(e){return hp(this,this,e),this.check()}rotateZ(e){return dp(this,this,e),this.check()}scale(e){return _p(this,this,e),this.check()}slerp(e,r,n){let s,i,o;switch(arguments.length){case 1:({start:s=Ub,target:i,ratio:o}=e);break;case 2:s=this,i=e,o=r;break;default:s=e,i=r,o=n}return ts(this,s,i,o),this.check()}transformVector4(e,r=new Qr){return ap(r,e,this),Jt(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,r){return this.setAxisAngle(e,r)}premultiply(e){return this.multiplyLeft(e)}multiply(e){return this.multiplyRight(e)}};var Qe={};Ae(Qe,{EPSILON1:()=>Gb,EPSILON10:()=>Xb,EPSILON11:()=>Kb,EPSILON12:()=>Yb,EPSILON13:()=>Zb,EPSILON14:()=>Qb,EPSILON15:()=>$b,EPSILON16:()=>eT,EPSILON17:()=>tT,EPSILON18:()=>rT,EPSILON19:()=>nT,EPSILON2:()=>kb,EPSILON20:()=>sT,EPSILON3:()=>Hb,EPSILON4:()=>Vb,EPSILON5:()=>zb,EPSILON6:()=>jb,EPSILON7:()=>qb,EPSILON8:()=>Jb,EPSILON9:()=>Wb,PI_OVER_FOUR:()=>oT,PI_OVER_SIX:()=>aT,PI_OVER_TWO:()=>iT,TWO_PI:()=>cT});var Gb=.1,kb=.01,Hb=.001,Vb=1e-4,zb=1e-5,jb=1e-6,qb=1e-7,Jb=1e-8,Wb=1e-9,Xb=1e-10,Kb=1e-11,Yb=1e-12,Zb=1e-13,Qb=1e-14,$b=1e-15,eT=1e-16,tT=1e-17,rT=1e-18,nT=1e-19,sT=1e-20,iT=Math.PI/2,oT=Math.PI/4,aT=Math.PI/6,cT=Math.PI*2;function xi(t,e){if(!t)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}var $e=Math.PI,Cp=$e/4,wp=$e/180,Sp=180/$e,bi=512;function Tt(t){let[e,r]=t;xi(Number.isFinite(e)),xi(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let n=e*wp,s=r*wp,i=bi*(n+$e)/(2*$e),o=bi*($e+Math.log(Math.tan(Cp+s*.5)))/(2*$e);return[i,o]}function Et(t){let[e,r]=t,n=e/bi*(2*$e)-$e,s=2*(Math.atan(Math.exp(r/bi*(2*$e)-$e))-Cp);return[n*Sp,s*Sp]}var WN=Math.PI/180;var Ip=6378137*Math.PI;function ru(t){var e=Tt(t);return e[0]=(e[0]/256-1)*Ip,e[1]=(e[1]/256-1)*Ip,e}function Ei(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ei=function(r){return typeof r}:Ei=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ei(t)}function Op(t,e,r,n,s,i,o){try{var a=t[i](o),c=a.value}catch(u){r(u);return}a.done?e(c):Promise.resolve(c).then(n,s)}function nu(t){return function(){var e=this,r=arguments;return new Promise(function(n,s){var i=t.apply(e,r);function o(c){Op(i,n,s,o,a,"next",c)}function a(c){Op(i,n,s,o,a,"throw",c)}o(void 0)})}}function Rp(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Ti(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Rp(Object(r),!0).forEach(function(n){ET(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Rp(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ET(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wT(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Lp(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ST(t,e,r){return e&&Lp(t.prototype,e),r&&Lp(t,r),t}function wi(t,e,r){return typeof Reflect<"u"&&Reflect.get?wi=Reflect.get:wi=function(s,i,o){var a=BT(s,i);if(a){var c=Object.getOwnPropertyDescriptor(a,i);return c.get?c.get.call(o):c.value}},wi(t,e,r||t)}function BT(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&(t=en(t),t!==null););return t}function CT(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&su(t,e)}function su(t,e){return su=Object.setPrototypeOf||function(n,s){return n.__proto__=s,n},su(t,e)}function MT(t){var e=RT();return function(){var n=en(t),s;if(e){var i=en(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return IT(this,s)}}function IT(t,e){if(e&&(Ei(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return OT(t)}function OT(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function RT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function en(t){return en=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},en(t)}var LT={id:"imagery-layer",data:"",serviceType:"auto",srs:"auto",layers:{type:"array",compare:!0,value:[]},onMetadataLoad:{type:"function",value:function(){}},onMetadataLoadError:{type:"function",value:console.error},onImageLoadStart:{type:"function",value:function(){}},onImageLoad:{type:"function",value:function(){}},onImageLoadError:{type:"function",compare:!1,value:function(e,r){return console.error(r,e)}}},Si=function(t){CT(r,t);var e=MT(r);function r(){var s;wT(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return s=e.call.apply(e,[this].concat(o)),s.state=void 0,s}var n=r.prototype;return n.shouldUpdateState=function(){return!0},n.initializeState=function(){this.state._nextRequestId=0,this.state.lastRequestId=-1,this.state.loadCounter=0},n.updateState=function(i){var o=this,a=i.changeFlags,c=i.props,u=i.oldProps,l=this.context.viewport;a.dataChanged||c.serviceType!==u.serviceType?(this.state.imageSource=this._createImageSource(c),this._loadMetadata(),this.debounce(function(){return o.loadImage(l,"image source changed")},0)):(0,Tr._deepEqual)(c.layers,u.layers,1)?a.viewportChanged&&this.debounce(function(){return o.loadImage(l,"viewport changed")}):this.debounce(function(){return o.loadImage(l,"layers changed")},0)},n.finalizeState=function(){},n.renderLayers=function(){var i=this.state,o=i.bounds,a=i.image,c=i.lastRequestParameters;return a&&new Pp.BitmapLayer(Ti(Ti({},this.getSubLayerProps({id:"bitmap"})),{},{_imageCoordinateSystem:c.srs==="EPSG:4326"?Tr.COORDINATE_SYSTEM.LNGLAT:Tr.COORDINATE_SYSTEM.CARTESIAN,bounds:o,image:a}))},n.getFeatureInfoText=function(){var s=nu(regeneratorRuntime.mark(function o(a,c){var u,l,f,h;return regeneratorRuntime.wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(u=this.state.lastRequestParameters,!u){p.next=6;break}return p.next=4,(l=(f=this.state.imageSource).getFeatureInfoText)===null||l===void 0?void 0:l.call(f,Ti(Ti({},u),{},{query_layers:u.layers,x:a,y:c,info_format:"application/vnd.ogc.gml"}));case 4:return h=p.sent,p.abrupt("return",h);case 6:return p.abrupt("return","");case 7:case"end":return p.stop()}},o,this)}));function i(o,a){return s.apply(this,arguments)}return i}(),n._createImageSource=function(i){if(i.data instanceof Ue)return i.data;if(typeof i.data=="string")return xc({url:i.data,loadOptions:i.loadOptions,type:i.serviceType});throw new Error("invalid image source in props.data")},n._loadMetadata=function(){var s=nu(regeneratorRuntime.mark(function o(){var a,c,u,l;return regeneratorRuntime.wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return a=this.state.imageSource,h.prev=1,this.state.loadCounter++,h.next=5,a.getMetadata();case 5:c=h.sent,this.state.imageSource===a&&((u=this.getCurrentLayer())===null||u===void 0||u.props.onMetadataLoad(c)),h.next=12;break;case 9:h.prev=9,h.t0=h.catch(1),(l=this.getCurrentLayer())===null||l===void 0||l.props.onMetadataLoadError(h.t0);case 12:return h.prev=12,this.state.loadCounter--,h.finish(12);case 15:case"end":return h.stop()}},o,this,[[1,9,12,15]])}));function i(){return s.apply(this,arguments)}return i}(),n.loadImage=function(){var s=nu(regeneratorRuntime.mark(function o(a,c){var u,l,f,h,d,p,g,m,A,v,x,b,M,C;return regeneratorRuntime.wrap(function(B){for(;;)switch(B.prev=B.next){case 0:if(u=this.props,l=u.layers,f=u.serviceType,!(f==="wms"&&l.length===0)){B.next=3;break}return B.abrupt("return");case 3:return h=a.getBounds(),d=a.width,p=a.height,g=this.getRequestId(),m=this.props.srs,m==="auto"&&(m=a.resolution?"EPSG:4326":"EPSG:3857"),A={width:d,height:p,boundingBox:[[h[0],h[1]],[h[2],h[3]]],layers:l,crs:m},m==="EPSG:3857"&&(v=ru([h[0],h[1]]),x=ru([h[2],h[3]]),A.boundingBox=[v,x]),B.prev=10,this.state.loadCounter++,this.props.onImageLoadStart(g),B.next=15,this.state.imageSource.getImage(A);case 15:b=B.sent,this.state.lastRequestId<g&&((M=this.getCurrentLayer())===null||M===void 0||M.props.onImageLoad(g),this.setState({image:b,bounds:h,lastRequestParameters:A,lastRequestId:g})),B.next=23;break;case 19:B.prev=19,B.t0=B.catch(10),this.raiseError(B.t0,"Load image"),(C=this.getCurrentLayer())===null||C===void 0||C.props.onImageLoadError(g,B.t0);case 23:return B.prev=23,this.state.loadCounter--,B.finish(23);case 26:case"end":return B.stop()}},o,this,[[10,19,23,26]])}));function i(o,a){return s.apply(this,arguments)}return i}(),n.getRequestId=function(){return this.state._nextRequestId++},n.debounce=function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:500;clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(function(){return i()},o)},ST(r,[{key:"isLoaded",get:function(){return Boolean(this.state)&&this.state.loadCounter===0&&wi(en(r.prototype),"isLoaded",this)}}]),r}(Tr.CompositeLayer);Si.layerName="WMSLayer";Si.defaultProps=LT;var Fp=U(Ye());function Bi(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Bi=function(r){return typeof r}:Bi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Bi(t)}function PT(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function FT(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&iu(t,e)}function iu(t,e){return iu=Object.setPrototypeOf||function(n,s){return n.__proto__=s,n},iu(t,e)}function NT(t){var e=GT();return function(){var n=Ci(t),s;if(e){var i=Ci(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return DT(this,s)}}function DT(t,e){if(e&&(Bi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return UT(t)}function UT(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function GT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ci(t){return Ci=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ci(t)}var kT={getHeight:{type:"accessor",value:0},greatCircle:!0},Mi=function(t){FT(r,t);var e=NT(r);function r(){return PT(this,r),e.apply(this,arguments)}return r}(Fp.ArcLayer);Mi.layerName="GreatCircleLayer";Mi.defaultProps=kT;var Dp=U(Ze()),cu=U(Ye());function Ii(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ii=function(r){return typeof r}:Ii=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ii(t)}var HT=["updateTriggers"];function VT(t,e){if(t==null)return{};var r=zT(t,e),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)n=i[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function zT(t,e){if(t==null)return{};var r={},n=Object.keys(t),s,i;for(i=0;i<n.length;i++)s=n[i],!(e.indexOf(s)>=0)&&(r[s]=t[s]);return r}function jT(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qT(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ou(t,e)}function ou(t,e){return ou=Object.setPrototypeOf||function(n,s){return n.__proto__=s,n},ou(t,e)}function JT(t){var e=KT();return function(){var n=Oi(t),s;if(e){var i=Oi(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return WT(this,s)}}function WT(t,e){if(e&&(Ii(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return XT(t)}function XT(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function KT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Oi(t){return Oi=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Oi(t)}function Np(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function au(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Np(Object(r),!0).forEach(function(n){YT(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Np(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function YT(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var ZT=au({},cu.PolygonLayer.defaultProps),Ge=function(t){qT(r,t);var e=JT(r);function r(){return jT(this,r),e.apply(this,arguments)}var n=r.prototype;return n.indexToBounds=function(){return null},n.renderLayers=function(){var i=this.props,o=i.elevationScale,a=i.extruded,c=i.wireframe,u=i.filled,l=i.stroked,f=i.lineWidthUnits,h=i.lineWidthScale,d=i.lineWidthMinPixels,p=i.lineWidthMaxPixels,g=i.lineJointRounded,m=i.lineMiterLimit,A=i.lineDashJustified,v=i.getElevation,x=i.getFillColor,b=i.getLineColor,M=i.getLineWidth,C=this.props,I=C.updateTriggers,B=C.material,S=C.transitions,y=this.getSubLayerClass("cell",cu.PolygonLayer),R=this.indexToBounds()||{},P=R.updateTriggers,F=VT(R,HT);return new y({filled:u,wireframe:c,extruded:a,elevationScale:o,stroked:l,lineWidthUnits:f,lineWidthScale:h,lineWidthMinPixels:d,lineWidthMaxPixels:p,lineJointRounded:g,lineMiterLimit:m,lineDashJustified:A,material:B,transitions:S,getElevation:v,getFillColor:x,getLineColor:b,getLineWidth:M},this.getSubLayerProps({id:"cell",updateTriggers:I&&au(au({},P),{},{getElevation:I.getElevation,getFillColor:I.getFillColor,getLineColor:I.getLineColor,getLineWidth:I.getLineWidth})}),F)},r}(Dp.CompositeLayer);Ge.layerName="GeoCellLayer";Ge.defaultProps=ZT;var Ri=U(uu());function Vp(t,e){return tE(t)||eE(t,e)||$T(t,e)||QT()}function QT(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
15
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $T(t,e){if(t){if(typeof t=="string")return Gp(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Gp(t,e)}}function Gp(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function eE(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(t);!(s=(o=r.next()).done)&&(n.push(o.value),!(e&&n.length===e));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function tE(t){if(Array.isArray(t))return t}var rE=3,nE=30,sE=2*nE+1,kp=180/Math.PI;function zp(t,e,r){var n=1<<e;return[(t[0]+r[0])/n,(t[1]+r[1])/n]}function Hp(t){return t>=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function jp(t){return[Hp(t[0]),Hp(t[1])]}function qp(t,e){var r=Vp(e,2),n=r[0],s=r[1];switch(t){case 0:return[1,n,s];case 1:return[-n,1,s];case 2:return[-n,-s,1];case 3:return[-1,-s,-n];case 4:return[s,-1,-n];case 5:return[s,n,-1];default:throw new Error("Invalid face")}}function Jp(t){var e=Vp(t,3),r=e[0],n=e[1],s=e[2],i=Math.atan2(s,Math.sqrt(r*r+n*n)),o=Math.atan2(n,r);return[o*kp,i*kp]}function Wp(t){for(var e=Ri.default.fromString(t,!0,10).toString(2);e.length<rE+sE;)e="0"+e;for(var r=e.lastIndexOf("1"),n=e.substring(0,3),s=e.substring(3,r),i=s.length/2,o=Ri.default.fromString(n,!0,2).toString(10),a=Ri.default.fromString(s,!0,2).toString(4);a.length<i;)a="0"+a;return"".concat(o,"/").concat(a)}function iE(t,e,r,n){if(n===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);var s=e[0];e[0]=e[1],e[1]=s}}function Xp(t){for(var e=t.split("/"),r=parseInt(e[0],10),n=e[1],s=n.length,i=[0,0],o,a=s-1;a>=0;a--){o=s-a;var c=n[a],u=0,l=0;c==="1"?l=1:c==="2"?(u=1,l=1):c==="3"&&(u=1);var f=Math.pow(2,o-1);iE(f,i,u,l),i[0]+=f*u,i[1]+=f*l}if(r%2===1){var h=i[0];i[0]=i[1],i[1]=h}return{face:r,ij:i,level:o}}var Kp=U(uu());function oE(t){var e=t.padEnd(16,"0");return Kp.default.fromString(e,16)}var aE=100;function cE(t){for(var e=t.face,r=t.ij,n=t.level,s=[[0,0],[0,1],[1,1],[1,0],[0,0]],i=Math.max(1,Math.ceil(aE*Math.pow(2,-n))),o=new Float64Array(4*i*2+2),a=0,c=0,u=0;u<4;u++)for(var l=s[u].slice(0),f=s[u+1],h=(f[0]-l[0])/i,d=(f[1]-l[1])/i,p=0;p<i;p++){l[0]+=h,l[1]+=d;var g=zp(r,n,l),m=jp(g),A=qp(e,m),v=Jp(A);Math.abs(v[1])>89.999&&(v[0]=c);var x=v[0]-c;v[0]+=x>180?-360:x<-180?360:0,o[a++]=v[0],o[a++]=v[1],c=v[0]}return o[a++]=o[0],o[a++]=o[1],o}function uE(t){if(typeof t=="string"){if(t.indexOf("/")>0)return t;t=oE(t)}return Wp(t.toString())}function Yp(t){var e=uE(t),r=Xp(e);return cE(r)}function Li(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Li=function(r){return typeof r}:Li=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Li(t)}function lE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function fE(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&lu(t,e)}function lu(t,e){return lu=Object.setPrototypeOf||function(n,s){return n.__proto__=s,n},lu(t,e)}function hE(t){var e=mE();return function(){var n=Pi(t),s;if(e){var i=Pi(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return dE(this,s)}}function dE(t,e){if(e&&(Li(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return pE(t)}function pE(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function mE(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Pi(t){return Pi=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Pi(t)}var gE={getS2Token:{type:"accessor",value:function(e){return e.token}}},Fi=function(t){fE(r,t);var e=hE(r);function r(){return lE(this,r),e.apply(this,arguments)}var n=r.prototype;return n.indexToBounds=function(){var i=this.props,o=i.data,a=i.getS2Token;return{data:o,_normalize:!1,positionFormat:"XY",getPolygon:function(u,l){return Yp(a(u,l))}}},r}(Ge);Fi.layerName="S2Layer";Fi.defaultProps=gE;function fu(t,e){return vE(t)||AE(t,e)||_E(t,e)||yE()}function yE(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
16
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _E(t,e){if(t){if(typeof t=="string")return Zp(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Zp(t,e)}}function Zp(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function AE(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(t);!(s=(o=r.next()).done)&&(n.push(o.value),!(e&&n.length===e));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function vE(t){if(Array.isArray(t))return t}var hu=512;function xE(t,e){for(var r=0,n=0,s=1<<t.length,i=s/hu,o=0;o<t.length;o++){s>>=1;var a=parseInt(t[o]);a%2&&(r|=s),a>1&&(n|=s)}return[[r/i,hu-n/i],[(r+e)/i,hu-(n+e)/i]]}function Qp(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,r=xE(t,e),n=fu(r,2),s=n[0],i=n[1],o=Et(s),a=fu(o,2),c=a[0],u=a[1],l=Et(i),f=fu(l,2),h=f[0],d=f[1];return[h,u,h,d,c,d,c,u,h,u]}function Ni(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ni=function(r){return typeof r}:Ni=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ni(t)}function bE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function TE(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&du(t,e)}function du(t,e){return du=Object.setPrototypeOf||function(n,s){return n.__proto__=s,n},du(t,e)}function EE(t){var e=BE();return function(){var n=Di(t),s;if(e){var i=Di(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return wE(this,s)}}function wE(t,e){if(e&&(Ni(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return SE(t)}function SE(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function BE(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Di(t){return Di=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Di(t)}var CE={getQuadkey:{type:"accessor",value:function(e){return e.quadkey}}},Ui=function(t){TE(r,t);var e=EE(r);function r(){return bE(this,r),e.apply(this,arguments)}var n=r.prototype;return n.indexToBounds=function(){var i=this.props,o=i.data,a=i.extruded,c=i.getQuadkey,u=a?.99:1;return{data:o,_normalize:!1,positionFormat:"XY",getPolygon:function(f,h){return Qp(c(f,h),u)},updateTriggers:{getPolygon:u}}},r}(Ge);Ui.layerName="QuadkeyLayer";Ui.defaultProps=CE;var Yi=U(Ze()),Rm=U(Ye());function $p(t,e,r,n,s,i,o){try{var a=t[i](o),c=a.value}catch(u){r(u);return}a.done?e(c):Promise.resolve(c).then(n,s)}function ME(t){return function(){var e=this,r=arguments;return new Promise(function(n,s){var i=t.apply(e,r);function o(c){$p(i,n,s,o,a,"next",c)}function a(c){$p(i,n,s,o,a,"throw",c)}o(void 0)})}}function IE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function em(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function OE(t,e,r){return e&&em(t.prototype,e),r&&em(t,r),t}var ns=function(){function t(r){IE(this,t),this.index=void 0,this.isVisible=void 0,this.isSelected=void 0,this.parent=void 0,this.children=void 0,this.content=void 0,this.state=void 0,this.layers=void 0,this.id=void 0,this.zoom=void 0,this.userData=void 0,this.boundingBox=void 0,this._abortController=void 0,this._loader=void 0,this._loaderId=void 0,this._isLoaded=void 0,this._isCancelled=void 0,this._needsReload=void 0,this._bbox=void 0,this.index=r,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}var e=t.prototype;return e._loadData=function(){var r=ME(regeneratorRuntime.mark(function s(i){var o,a,c,u,l,f,h,d,p,g,m,A,v,x;return regeneratorRuntime.wrap(function(M){for(;;)switch(M.prev=M.next){case 0:return o=i.getData,a=i.requestScheduler,c=i.onLoad,u=i.onError,l=this.index,f=this.id,h=this.bbox,d=this.userData,p=this.zoom,g=this._loaderId,this._abortController=new AbortController,m=this._abortController.signal,M.next=7,a.scheduleRequest(this,function(C){return C.isSelected?1:-1});case 7:if(A=M.sent,A){M.next=11;break}return this._isCancelled=!0,M.abrupt("return");case 11:if(!this._isCancelled){M.next=14;break}return A.done(),M.abrupt("return");case 14:return v=null,M.prev=15,M.next=18,o({index:l,id:f,bbox:h,userData:d,zoom:p,signal:m});case 18:v=M.sent,M.next=24;break;case 21:M.prev=21,M.t0=M.catch(15),x=M.t0||!0;case 24:return M.prev=24,A.done(),M.finish(24);case 27:if(g===this._loaderId){M.next=29;break}return M.abrupt("return");case 29:if(this._loader=void 0,this.content=v,!(this._isCancelled&&!v)){M.next=34;break}return this._isLoaded=!1,M.abrupt("return");case 34:this._isLoaded=!0,this._isCancelled=!1,x?u(x,this):c(this);case 37:case"end":return M.stop()}},s,this,[[15,21,24,27]])}));function n(s){return r.apply(this,arguments)}return n}(),e.loadData=function(n){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(n),this._loader},e.setNeedsReload=function(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0},e.abort=function(){var n;this.isLoaded||(this._isCancelled=!0,(n=this._abortController)===null||n===void 0||n.abort())},OE(t,[{key:"bbox",get:function(){return this._bbox},set:function(n){this._bbox||(this._bbox=n,"west"in n?this.boundingBox=[[n.west,n.south],[n.east,n.north]]:this.boundingBox=[[n.left,n.top],[n.right,n.bottom]])}},{key:"data",get:function(){var n=this;return this.isLoading&&this._loader?this._loader.then(function(){return n.data}):this.content}},{key:"isLoaded",get:function(){return this._isLoaded&&!this._needsReload}},{key:"isLoading",get:function(){return Boolean(this._loader)&&!this._isCancelled}},{key:"needsReload",get:function(){return this._needsReload||this._isCancelled}},{key:"byteLength",get:function(){var n=this.content?this.content.byteLength:0;return Number.isFinite(n)||console.error("byteLength not defined in tile data"),n}}]),t}();var os=U(Ze());var le={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var tm=new w,RE=new w,Xt=class{constructor(e=[0,0,0],r=[0,0,0],n){D(this,"center",void 0),D(this,"halfDiagonal",void 0),D(this,"minimum",void 0),D(this,"maximum",void 0),n=n||tm.copy(e).add(r).scale(.5),this.center=new w(n),this.halfDiagonal=new w(r).subtract(this.center),this.minimum=new w(e),this.maximum=new w(r)}clone(){return new Xt(this.minimum,this.maximum,this.center)}equals(e){return this===e||Boolean(e)&&this.minimum.equals(e.minimum)&&this.maximum.equals(e.maximum)}transform(e){return this.center.transformAsPoint(e),this.halfDiagonal.transform(e),this.minimum.transform(e),this.maximum.transform(e),this}intersectPlane(e){let{halfDiagonal:r}=this,n=RE.from(e.normal),s=r.x*Math.abs(n.x)+r.y*Math.abs(n.y)+r.z*Math.abs(n.z),i=this.center.dot(n)+e.distance;return i-s>0?le.INSIDE:i+s<0?le.OUTSIDE:le.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=tm.from(e).subtract(this.center),{halfDiagonal:n}=this,s=0,i;return i=Math.abs(r.x)-n.x,i>0&&(s+=i*i),i=Math.abs(r.y)-n.y,i>0&&(s+=i*i),i=Math.abs(r.z)-n.z,i>0&&(s+=i*i),s}};var ss=new w,rm=new w,ke=class{constructor(e=[0,0,0],r=0){D(this,"center",void 0),D(this,"radius",void 0),this.radius=-0,this.center=new w,this.fromCenterRadius(e,r)}fromCenterRadius(e,r){return this.center.from(e),this.radius=r,this}fromCornerPoints(e,r){return r=ss.from(r),this.center=new w().from(e).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new ke(this.center,this.radius)}union(e){let r=this.center,n=this.radius,s=e.center,i=e.radius,o=ss.copy(s).subtract(r),a=o.magnitude();if(n>=a+i)return this.clone();if(i>=a+n)return e.clone();let c=(n+a+i)*.5;return rm.copy(o).scale((-n+c)/a).add(r),this.center.copy(rm),this.radius=c,this}expand(e){let n=ss.from(e).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(e){this.center.transform(e);let r=_i.getScaling(ss,e);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(e){let r=this.distanceTo(e);return r*r}distanceTo(e){let n=ss.from(e).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(e){let r=this.center,n=this.radius,i=e.normal.dot(r)+e.distance;return i<-n?le.OUTSIDE:i<n?le.INTERSECTING:le.INSIDE}};var LE=new w,PE=new w,Gi=new w,ki=new w,Hi=new w,FE=new w,NE=new w,wt={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},et=class{constructor(e=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){D(this,"center",void 0),D(this,"halfAxes",void 0),this.center=new w().from(e),this.halfAxes=new W(r)}get halfSize(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new w(e).len(),new w(r).len(),new w(n).len()]}get quaternion(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),s=new w(e).normalize(),i=new w(r).normalize(),o=new w(n).normalize();return new ht().fromMatrix3(new W([...s,...i,...o]))}fromCenterHalfSizeQuaternion(e,r,n){let s=new ht(n),i=new W().fromQuaternion(s);return i[0]=i[0]*r[0],i[1]=i[1]*r[0],i[2]=i[2]*r[0],i[3]=i[3]*r[1],i[4]=i[4]*r[1],i[5]=i[5]*r[1],i[6]=i[6]*r[2],i[7]=i[7]*r[2],i[8]=i[8]*r[2],this.center=new w().from(e),this.halfAxes=i,this}clone(){return new et(this.center,this.halfAxes)}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new ke){let r=this.halfAxes,n=r.getColumn(0,Gi),s=r.getColumn(1,ki),i=r.getColumn(2,Hi),o=LE.copy(n).add(s).add(i);return e.center.copy(this.center),e.radius=o.magnitude(),e}intersectPlane(e){let r=this.center,n=e.normal,s=this.halfAxes,i=n.x,o=n.y,a=n.z,c=Math.abs(i*s[wt.COLUMN0ROW0]+o*s[wt.COLUMN0ROW1]+a*s[wt.COLUMN0ROW2])+Math.abs(i*s[wt.COLUMN1ROW0]+o*s[wt.COLUMN1ROW1]+a*s[wt.COLUMN1ROW2])+Math.abs(i*s[wt.COLUMN2ROW0]+o*s[wt.COLUMN2ROW1]+a*s[wt.COLUMN2ROW2]),u=n.dot(r)+e.distance;return u<=-c?le.OUTSIDE:u>=c?le.INSIDE:le.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=PE.from(e).subtract(this.center),n=this.halfAxes,s=n.getColumn(0,Gi),i=n.getColumn(1,ki),o=n.getColumn(2,Hi),a=s.magnitude(),c=i.magnitude(),u=o.magnitude();s.normalize(),i.normalize(),o.normalize();let l=0,f;return f=Math.abs(r.dot(s))-a,f>0&&(l+=f*f),f=Math.abs(r.dot(i))-c,f>0&&(l+=f*f),f=Math.abs(r.dot(o))-u,f>0&&(l+=f*f),l}computePlaneDistances(e,r,n=[-0,-0]){let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=this.center,a=this.halfAxes,c=a.getColumn(0,Gi),u=a.getColumn(1,ki),l=a.getColumn(2,Hi),f=FE.copy(c).add(u).add(l).add(o),h=NE.copy(f).subtract(e),d=r.dot(h);return s=Math.min(d,s),i=Math.max(d,i),f.copy(o).add(c).add(u).subtract(l),h.copy(f).subtract(e),d=r.dot(h),s=Math.min(d,s),i=Math.max(d,i),f.copy(o).add(c).subtract(u).add(l),h.copy(f).subtract(e),d=r.dot(h),s=Math.min(d,s),i=Math.max(d,i),f.copy(o).add(c).subtract(u).subtract(l),h.copy(f).subtract(e),d=r.dot(h),s=Math.min(d,s),i=Math.max(d,i),o.copy(f).subtract(c).add(u).add(l),h.copy(f).subtract(e),d=r.dot(h),s=Math.min(d,s),i=Math.max(d,i),o.copy(f).subtract(c).add(u).subtract(l),h.copy(f).subtract(e),d=r.dot(h),s=Math.min(d,s),i=Math.max(d,i),o.copy(f).subtract(c).subtract(u).add(l),h.copy(f).subtract(e),d=r.dot(h),s=Math.min(d,s),i=Math.max(d,i),o.copy(f).subtract(c).subtract(u).subtract(l),h.copy(f).subtract(e),d=r.dot(h),s=Math.min(d,s),i=Math.max(d,i),n[0]=s,n[1]=i,n}transform(e){this.center.transformAsPoint(e);let r=this.halfAxes.getColumn(0,Gi);r.transformAsPoint(e);let n=this.halfAxes.getColumn(1,ki);n.transformAsPoint(e);let s=this.halfAxes.getColumn(2,Hi);return s.transformAsPoint(e),this.halfAxes=new W([...r,...n,...s]),this}getTransform(){throw new Error("not implemented")}};var nm=new w,sm=new w,ge=class{constructor(e=[0,0,1],r=0){D(this,"normal",void 0),D(this,"distance",void 0),this.normal=new w,this.distance=-0,this.fromNormalDistance(e,r)}fromNormalDistance(e,r){return me(Number.isFinite(r)),this.normal.from(e).normalize(),this.distance=r,this}fromPointNormal(e,r){e=nm.from(e),this.normal.from(r).normalize();let n=-this.normal.dot(e);return this.distance=n,this}fromCoefficients(e,r,n,s){return this.normal.set(e,r,n),me(we(this.normal.len(),1)),this.distance=s,this}clone(){return new ge(this.normal,this.distance)}equals(e){return we(this.distance,e.distance)&&we(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){let r=sm.copy(this.normal).transformAsVector(e).normalize(),n=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(n,r)}projectPointOntoPlane(e,r=[0,0,0]){let n=nm.from(e),s=this.getPointDistance(n),i=sm.copy(this.normal).scale(s);return n.subtract(i).to(r)}};var im=[new w([1,0,0]),new w([0,1,0]),new w([0,0,1])],om=new w,DE=new w,de=class{constructor(e=[]){D(this,"planes",void 0),this.planes=e}fromBoundingSphere(e){this.planes.length=2*im.length;let r=e.center,n=e.radius,s=0;for(let i of im){let o=this.planes[s],a=this.planes[s+1];o||(o=this.planes[s]=new ge),a||(a=this.planes[s+1]=new ge);let c=om.copy(i).scale(-n).add(r);o.fromPointNormal(c,i);let u=om.copy(i).scale(n).add(r),l=DE.copy(i).negate();a.fromPointNormal(u,l),s+=2}return this}computeVisibility(e){let r=le.INSIDE;for(let n of this.planes)switch(e.intersectPlane(n)){case le.OUTSIDE:return le.OUTSIDE;case le.INTERSECTING:r=le.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(e,r){if(me(Number.isFinite(r),"parentPlaneMask is required."),r===de.MASK_OUTSIDE||r===de.MASK_INSIDE)return r;let n=de.MASK_INSIDE,s=this.planes;for(let i=0;i<this.planes.length;++i){let o=i<31?1<<i:0;if(i<31&&!(r&o))continue;let a=s[i],c=e.intersectPlane(a);if(c===le.OUTSIDE)return de.MASK_OUTSIDE;c===le.INTERSECTING&&(n|=o)}return n}};D(de,"MASK_OUTSIDE",4294967295);D(de,"MASK_INSIDE",0);D(de,"MASK_INDETERMINATE",2147483647);var yU=new w,_U=new w,AU=new w,vU=new w,xU=new w;var CU=new w,MU=new w,IU=new w,OU=new w,RU=new w,LU=new w,PU=new w,FU=new w,NU=new w,DU=new w,UU=new w,GU=new w;var dt=new W,GE=new W,kE=new W,Vi=new W,am=new W;function gu(t,e={}){let r=Qe.EPSILON20,n=10,s=0,i=0,o=GE,a=kE;o.identity(),a.copy(t);let c=r*HE(a);for(;i<n&&VE(a)>c;)zE(a,Vi),am.copy(Vi).transpose(),a.multiplyRight(Vi),a.multiplyLeft(am),o.multiplyRight(Vi),++s>2&&(++i,s=0);return e.unitary=o.toTarget(e.unitary),e.diagonal=a.toTarget(e.diagonal),e}function HE(t){let e=0;for(let r=0;r<9;++r){let n=t[r];e+=n*n}return Math.sqrt(e)}var pu=[1,0,0],mu=[2,2,1];function VE(t){let e=0;for(let r=0;r<3;++r){let n=t[dt.getElementIndex(mu[r],pu[r])];e+=2*n*n}return Math.sqrt(e)}function zE(t,e){let r=Qe.EPSILON15,n=0,s=1;for(let u=0;u<3;++u){let l=Math.abs(t[dt.getElementIndex(mu[u],pu[u])]);l>n&&(s=u,n=l)}let i=pu[s],o=mu[s],a=1,c=0;if(Math.abs(t[dt.getElementIndex(o,i)])>r){let u=t[dt.getElementIndex(o,o)],l=t[dt.getElementIndex(i,i)],f=t[dt.getElementIndex(o,i)],h=(u-l)/2/f,d;h<0?d=-1/(-h+Math.sqrt(1+h*h)):d=1/(h+Math.sqrt(1+h*h)),a=1/Math.sqrt(1+d*d),c=d*a}return W.IDENTITY.to(e),e[dt.getElementIndex(i,i)]=e[dt.getElementIndex(o,o)]=a,e[dt.getElementIndex(o,i)]=c,e[dt.getElementIndex(i,o)]=-c,e}var Kt=new w,jE=new w,qE=new w,JE=new w,WE=new w,XE=new W,KE={diagonal:new W,unitary:new W};function is(t,e=new et){if(!t||t.length===0)return e.halfAxes=new W([0,0,0,0,0,0,0,0,0]),e.center=new w,e;let r=t.length,n=new w(0,0,0);for(let S of t)n.add(S);let s=1/r;n.multiplyByScalar(s);let i=0,o=0,a=0,c=0,u=0,l=0;for(let S of t){let y=Kt.copy(S).subtract(n);i+=y.x*y.x,o+=y.x*y.y,a+=y.x*y.z,c+=y.y*y.y,u+=y.y*y.z,l+=y.z*y.z}i*=s,o*=s,a*=s,c*=s,u*=s,l*=s;let f=XE;f[0]=i,f[1]=o,f[2]=a,f[3]=o,f[4]=c,f[5]=u,f[6]=a,f[7]=u,f[8]=l;let{unitary:h}=gu(f,KE),d=e.halfAxes.copy(h),p=d.getColumn(0,qE),g=d.getColumn(1,JE),m=d.getColumn(2,WE),A=-Number.MAX_VALUE,v=-Number.MAX_VALUE,x=-Number.MAX_VALUE,b=Number.MAX_VALUE,M=Number.MAX_VALUE,C=Number.MAX_VALUE;for(let S of t)Kt.copy(S),A=Math.max(Kt.dot(p),A),v=Math.max(Kt.dot(g),v),x=Math.max(Kt.dot(m),x),b=Math.min(Kt.dot(p),b),M=Math.min(Kt.dot(g),M),C=Math.min(Kt.dot(m),C);p=p.multiplyByScalar(.5*(b+A)),g=g.multiplyByScalar(.5*(M+v)),m=m.multiplyByScalar(.5*(C+x)),e.center.copy(p).add(g).add(m);let I=jE.set(A-b,v-M,x-C).multiplyByScalar(.5),B=new W([I[0],0,0,0,I[1],0,0,0,I[2]]);return e.halfAxes.multiplyRight(B),e}function fm(t,e){return QE(t)||ZE(t,e)||hm(t,e)||YE()}function YE(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
17
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZE(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(t);!(s=(o=r.next()).done)&&(n.push(o.value),!(e&&n.length===e));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function QE(t){if(Array.isArray(t))return t}function yu(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=hm(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,s=function(){};return{s,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
18
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return i=u.done,u},e:function(u){o=!0,a=u},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function hm(t,e){if(t){if(typeof t=="string")return cm(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return cm(t,e)}}function cm(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function $E(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function um(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ew(t,e,r){return e&&um(t.prototype,e),r&&um(t,r),t}var tn=512,lm=3,dm=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],pm=dm.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),tw=pm.concat([[.25,.5],[.75,.5]]),rw=function(){function t(r,n,s){$E(this,t),this.x=void 0,this.y=void 0,this.z=void 0,this.childVisible=void 0,this.selected=void 0,this._children=void 0,this.x=r,this.y=n,this.z=s}var e=t.prototype;return e.update=function(n){var s=n.viewport,i=n.cullingVolume,o=n.elevationBounds,a=n.minZ,c=n.maxZ,u=n.bounds,l=n.offset,f=n.project,h=this.getBoundingVolume(o,l,f);if(u&&!this.insideBounds(u))return!1;var d=i.computeVisibility(h);if(d<0)return!1;if(!this.childVisible){var p=this.z;if(p<c&&p>=a){var g=h.distanceTo(s.cameraPosition)*s.scale/s.height;p+=Math.floor(Math.log2(g))}if(p>=c)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;var m=yu(this.children),A;try{for(m.s();!(A=m.n()).done;){var v=A.value;v.update(n)}}catch(x){m.e(x)}finally{m.f()}return!0},e.getSelected=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];if(this.selected&&n.push(this),this._children){var s=yu(this._children),i;try{for(s.s();!(i=s.n()).done;){var o=i.value;o.getSelected(n)}}catch(a){s.e(a)}finally{s.f()}}return n},e.insideBounds=function(n){var s=fm(n,4),i=s[0],o=s[1],a=s[2],c=s[3],u=Math.pow(2,this.z),l=tn/u;return this.x*l<a&&this.y*l<c&&(this.x+1)*l>i&&(this.y+1)*l>o},e.getBoundingVolume=function(n,s,i){if(i){var o=this.z<1?tw:this.z<2?pm:dm,a=[],c=yu(o),u;try{for(c.s();!(u=c.n()).done;){var l=u.value,f=zi(this.x+l[0],this.y+l[1],this.z);f[2]=n[0],a.push(i(f)),n[0]!==n[1]&&(f[2]=n[1],a.push(i(f)))}}catch(m){c.e(m)}finally{c.f()}return is(a)}var h=Math.pow(2,this.z),d=tn/h,p=this.x*d+s*tn,g=tn-(this.y+1)*d;return new Xt([p,g,n[0]],[p+d,g+d,n[1]])},ew(t,[{key:"children",get:function(){if(!this._children){var n=this.x*2,s=this.y*2,i=this.z+1;this._children=[new t(n,s,i),new t(n,s+1,i),new t(n+1,s,i),new t(n+1,s+1,i)]}return this._children}}]),t}();function mm(t,e,r,n){var s=t instanceof os._GlobeViewport&&t.resolution?t.projectPosition:null,i=Object.values(t.getFrustumPlanes()).map(function(M){var C=M.normal,I=M.distance;return new ge(C.clone().negate(),I)}),o=new de(i),a=t.distanceScales.unitsPerMeter[2],c=r&&r[0]*a||0,u=r&&r[1]*a||0,l=t instanceof os.WebMercatorViewport&&t.pitch<=60?e:0;if(n){var f=n,h=fm(f,4),d=h[0],p=h[1],g=h[2],m=h[3],A=Tt([d,m]),v=Tt([g,p]);n=[A[0],tn-A[1],v[0],tn-v[1]]}var x=new rw(0,0,0),b={viewport:t,project:s,cullingVolume:o,elevationBounds:[c,u],minZ:l,maxZ:e,bounds:n,offset:0};if(x.update(b),t instanceof os.WebMercatorViewport&&t.subViewports&&t.subViewports.length>1){for(b.offset=-1;x.update(b)&&!(--b.offset<-lm););for(b.offset=1;x.update(b)&&!(++b.offset>lm););}return x.getSelected()}function rn(t,e){return iw(t)||sw(t,e)||ym(t,e)||nw()}function nw(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
19
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sw(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(t);!(s=(o=r.next()).done)&&(n.push(o.value),!(e&&n.length===e));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function iw(t){if(Array.isArray(t))return t}function ji(t){return cw(t)||aw(t)||ym(t)||ow()}function ow(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
20
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ym(t,e){if(t){if(typeof t=="string")return _u(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _u(t,e)}}function aw(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function cw(t){if(Array.isArray(t))return _u(t)}function _u(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var St=512,uw=[-1/0,-1/0,1/0,1/0],Yt={type:"object",value:null,validate:function(e,r){return r.optional&&e===null||typeof e=="string"||Array.isArray(e)&&e.every(function(n){return typeof n=="string"})},equal:function(e,r){if(e===r)return!0;if(!Array.isArray(e)||!Array.isArray(r))return!1;var n=e.length;if(n!==r.length)return!1;for(var s=0;s<n;s++)if(e[s]!==r[s])return!1;return!0}};function _m(t,e){var r=[e.transformAsPoint([t[0],t[1]]),e.transformAsPoint([t[2],t[1]]),e.transformAsPoint([t[0],t[3]]),e.transformAsPoint([t[2],t[3]])],n=[Math.min.apply(Math,ji(r.map(function(s){return s[0]}))),Math.min.apply(Math,ji(r.map(function(s){return s[1]}))),Math.max.apply(Math,ji(r.map(function(s){return s[0]}))),Math.max.apply(Math,ji(r.map(function(s){return s[1]})))];return n}function lw(t){return Math.abs(t.split("").reduce(function(e,r){return(e<<5)-e+r.charCodeAt(0)|0},0))}function pt(t,e){if(!t||!t.length)return null;var r=e.index,n=e.id;if(Array.isArray(t)){var s=lw(n)%t.length;t=t[s]}for(var i=t,o=0,a=Object.keys(r);o<a.length;o++){var c=a[o],u=new RegExp("{".concat(c,"}"),"g");i=i.replace(u,String(r[c]))}return Number.isInteger(r.y)&&Number.isInteger(r.z)&&(i=i.replace(/\{-y\}/g,String(Math.pow(2,r.z)-r.y-1))),i}function fw(t,e,r){var n;if(e&&e.length===2){var s=rn(e,2),i=s[0],o=s[1],a=t.getBounds({z:i}),c=t.getBounds({z:o});n=[Math.min(a[0],c[0]),Math.min(a[1],c[1]),Math.max(a[2],c[2]),Math.max(a[3],c[3])]}else n=t.getBounds();return t.isGeospatial?[Math.max(n[0],r[0]),Math.max(n[1],r[1]),Math.min(n[2],r[2]),Math.min(n[3],r[3])]:[Math.max(Math.min(n[0],r[2]),r[0]),Math.max(Math.min(n[1],r[3]),r[1]),Math.min(Math.max(n[2],r[0]),r[2]),Math.min(Math.max(n[3],r[1]),r[3])]}function Am(t){var e=t.viewport,r=t.z,n=t.cullRect,s=e.subViewports||[e];return s.map(function(i){return Au(i,r||0,n)})}function Au(t,e,r){if(!Array.isArray(e)){var n=r.x-t.x,s=r.y-t.y,i=r.width,o=r.height,a={targetZ:e},c=t.unproject([n,s],a),u=t.unproject([n+i,s],a),l=t.unproject([n,s+o],a),f=t.unproject([n+i,s+o],a);return[Math.min(c[0],u[0],l[0],f[0]),Math.min(c[1],u[1],l[1],f[1]),Math.max(c[0],u[0],l[0],f[0]),Math.max(c[1],u[1],l[1],f[1])]}var h=Au(t,e[0],r),d=Au(t,e[1],r);return[Math.min(h[0],d[0]),Math.min(h[1],d[1]),Math.max(h[2],d[2]),Math.max(h[3],d[3])]}function hw(t,e,r){if(r){var n=_m(t,r).map(function(s){return s*e/St});return n}return t.map(function(s){return s*e/St})}function vu(t,e){return Math.pow(2,t)*St/e}function zi(t,e,r){var n=vu(r,St),s=t/n*360-180,i=Math.PI-2*Math.PI*e/n,o=180/Math.PI*Math.atan(.5*(Math.exp(i)-Math.exp(-i)));return[s,o]}function gm(t,e,r,n){var s=vu(r,n);return[t/s*St,e/s*St]}function xu(t,e,r,n){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:St;if(t.isGeospatial){var i=zi(e,r,n),o=rn(i,2),a=o[0],c=o[1],u=zi(e+1,r+1,n),l=rn(u,2),f=l[0],h=l[1];return{west:a,north:c,east:f,south:h}}var d=gm(e,r,n,s),p=rn(d,2),g=p[0],m=p[1],A=gm(e+1,r+1,n,s),v=rn(A,2),x=v[0],b=v[1];return{left:g,top:m,right:x,bottom:b}}function dw(t,e,r,n,s){for(var i=fw(t,null,n),o=vu(e,r),a=hw(i,o,s),c=rn(a,4),u=c[0],l=c[1],f=c[2],h=c[3],d=[],p=Math.floor(u);p<f;p++)for(var g=Math.floor(l);g<h;g++)d.push({x:p,y:g,z:e});return d}function bu(t){var e=t.viewport,r=t.maxZoom,n=t.minZoom,s=t.zRange,i=t.extent,o=t.tileSize,a=o===void 0?St:o,c=t.modelMatrix,u=t.modelMatrixInverse,l=t.zoomOffset,f=l===void 0?0:l,h=e.isGeospatial?Math.round(e.zoom+Math.log2(St/a))+f:Math.ceil(e.zoom)+f;if(typeof n=="number"&&Number.isFinite(n)&&h<n){if(!i)return[];h=n}typeof r=="number"&&Number.isFinite(r)&&h>r&&(h=r);var d=i;return c&&u&&i&&!e.isGeospatial&&(d=_m(i,c)),e.isGeospatial?mm(e,h,s,i):dw(e,h,a,d||uw,u)}function Tu(t){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(t)}function Eu(t){return Number.isFinite(t.west)&&Number.isFinite(t.north)&&Number.isFinite(t.east)&&Number.isFinite(t.south)}function vm(t){var e={},r;return function(n){for(var s in n)if(!pw(n[s],e[s])){r=t(n),e=n;break}return r}}function pw(t,e){if(t===e)return!0;if(Array.isArray(t)){var r=t.length;if(!e||e.length!==r)return!1;for(var n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}return!1}var as;function xm(t,e){return yw(t)||gw(t,e)||Bm(t,e)||mw()}function mw(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
21
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gw(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(t);!(s=(o=r.next()).done)&&(n.push(o.value),!(e&&n.length===e));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function yw(t){if(Array.isArray(t))return t}function ye(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Bm(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,s=function(){};return{s,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
22
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return i=u.done,u},e:function(u){o=!0,a=u},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function Bm(t,e){if(t){if(typeof t=="string")return bm(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return bm(t,e)}}function bm(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Tm(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Em(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Tm(Object(r),!0).forEach(function(n){qi(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Tm(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function _w(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function wm(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Aw(t,e,r){return e&&wm(t.prototype,e),r&&wm(t,r),t}function qi(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Sm=1,Ji=2,vw="never",xw="no-overlap",cs="best-available",bw=5,Tw=(as={},qi(as,cs,ww),qi(as,xw,Sw),qi(as,vw,function(){}),as),Ew={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,zoomOffset:0,onTileLoad:function(){},onTileUnload:function(){},onTileError:function(){}},us=function(){function t(r){var n=this;_w(this,t),this.opts=void 0,this._requestScheduler=void 0,this._cache=void 0,this._dirty=void 0,this._tiles=void 0,this._cacheByteSize=void 0,this._viewport=void 0,this._zRange=void 0,this._selectedTiles=void 0,this._frameNumber=void 0,this._modelMatrix=void 0,this._modelMatrixInverse=void 0,this._maxZoom=void 0,this._minZoom=void 0,this.onTileLoad=void 0,this._getCullBounds=vm(Am),this.opts=Em(Em({},Ew),r),this.onTileLoad=function(s){var i,o;(i=(o=n.opts).onTileLoad)===null||i===void 0||i.call(o,s),n.opts.maxCacheByteSize&&(n._cacheByteSize+=s.byteLength,n._resizeCache())},this._requestScheduler=new Ht({maxRequests:r.maxRequests,throttleRequests:Boolean(r.maxRequests&&r.maxRequests>0)}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new k,this._modelMatrixInverse=new k,this.setOptions(r)}var e=t.prototype;return e.setOptions=function(n){Object.assign(this.opts,n),Number.isFinite(n.maxZoom)&&(this._maxZoom=Math.floor(n.maxZoom)),Number.isFinite(n.minZoom)&&(this._minZoom=Math.ceil(n.minZoom))},e.finalize=function(){var n=ye(this._cache.values()),s;try{for(n.s();!(s=n.n()).done;){var i=s.value;i.isLoading&&i.abort()}}catch(o){n.e(o)}finally{n.f()}this._cache.clear(),this._tiles=[],this._selectedTiles=null},e.reloadAll=function(){var n=ye(this._cache.keys()),s;try{for(n.s();!(s=n.n()).done;){var i=s.value,o=this._cache.get(i);!this._selectedTiles||!this._selectedTiles.includes(o)?this._cache.delete(i):o.setNeedsReload()}}catch(a){n.e(a)}finally{n.f()}},e.update=function(n){var s=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.zRange,a=i.modelMatrix,c=a?new k(a):new k,u=!c.equals(this._modelMatrix);if(!this._viewport||!n.equals(this._viewport)||!we(this._zRange,o)||u){u&&(this._modelMatrixInverse=c.clone().invert(),this._modelMatrix=c),this._viewport=n,this._zRange=o;var l=this.getTileIndices({viewport:n,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:o,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=l.map(function(h){return s._getTile(h,!0)}),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(function(h){return s._getTile(h.index,!0)}));var f=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),f&&this._frameNumber++,this._frameNumber},e.isTileVisible=function(n,s){if(!n.isVisible)return!1;if(s&&this._viewport){var i=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:s}),o=n.bbox,a=ye(i),c;try{for(a.s();!(c=a.n()).done;){var u=xm(c.value,4),l=u[0],f=u[1],h=u[2],d=u[3],p=void 0;if("west"in o)p=o.west<h&&o.east>l&&o.south<d&&o.north>f;else{var g=Math.min(o.top,o.bottom),m=Math.max(o.top,o.bottom);p=o.left<h&&o.right>l&&g<d&&m>f}if(p)return!0}}catch(A){a.e(A)}finally{a.f()}return!1}return!0},e.getTileIndices=function(n){var s=n.viewport,i=n.maxZoom,o=n.minZoom,a=n.zRange,c=n.modelMatrix,u=n.modelMatrixInverse,l=this.opts,f=l.tileSize,h=l.extent,d=l.zoomOffset;return bu({viewport:s,maxZoom:i,minZoom:o,zRange:a,tileSize:f,extent:h,modelMatrix:c,modelMatrixInverse:u,zoomOffset:d})},e.getTileId=function(n){return"".concat(n.x,"-").concat(n.y,"-").concat(n.z)},e.getTileZoom=function(n){return n.z},e.getTileMetadata=function(n){var s=this.opts.tileSize;return{bbox:xu(this._viewport,n.x,n.y,n.z,s)}},e.getParentIndex=function(n){var s=Math.floor(n.x/2),i=Math.floor(n.y/2),o=n.z-1;return{x:s,y:i,z:o}},e.updateTileStates=function(){var n=this.opts.refinementStrategy||cs,s=new Array(this._cache.size),i=0,o=ye(this._cache.values()),a;try{for(o.s();!(a=o.n()).done;){var c=a.value;s[i++]=c.isVisible,c.isSelected=!1,c.isVisible=!1}}catch(g){o.e(g)}finally{o.f()}var u=ye(this._selectedTiles),l;try{for(u.s();!(l=u.n()).done;){var f=l.value;f.isSelected=!0,f.isVisible=!0}}catch(g){u.e(g)}finally{u.f()}(typeof n=="function"?n:Tw[n])(Array.from(this._cache.values())),i=0;var h=ye(this._cache.values()),d;try{for(h.s();!(d=h.n()).done;){var p=d.value;if(s[i++]!==p.isVisible)return!0}}catch(g){h.e(g)}finally{h.f()}return!1},e._pruneRequests=function(){var n=this.opts.maxRequests,s=n===void 0?0:n,i=[],o=0,a=ye(this._cache.values()),c;try{for(a.s();!(c=a.n()).done;){var u=c.value;u.isLoading&&(o++,!u.isSelected&&!u.isVisible&&i.push(u))}}catch(f){a.e(f)}finally{a.f()}for(;s>0&&o>s&&i.length>0;){var l=i.shift();l.abort(),o--}},e._rebuildTree=function(){var n=this._cache,s=ye(n.values()),i;try{for(s.s();!(i=s.n()).done;){var o=i.value;o.parent=null,o.children&&(o.children.length=0)}}catch(f){s.e(f)}finally{s.f()}var a=ye(n.values()),c;try{for(a.s();!(c=a.n()).done;){var u=c.value,l=this._getNearestAncestor(u);u.parent=l,l!=null&&l.children&&l.children.push(u)}}catch(f){a.e(f)}finally{a.f()}},e._resizeCache=function(){var n=this._cache,s=this.opts,i=s.maxCacheSize||(s.maxCacheByteSize?1/0:bw*this.selectedTiles.length),o=s.maxCacheByteSize||1/0,a=n.size>i||this._cacheByteSize>o;if(a){var c=ye(n),u;try{for(c.s();!(u=c.n()).done;){var l=xm(u.value,2),f=l[0],h=l[1];if(!h.isVisible&&!h.isSelected){var d,p;this._cacheByteSize-=s.maxCacheByteSize?h.byteLength:0,n.delete(f),(d=(p=this.opts).onTileUnload)===null||d===void 0||d.call(p,h)}if(n.size<=i&&this._cacheByteSize<=o)break}}catch(g){c.e(g)}finally{c.f()}this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort(function(g,m){return g.zoom-m.zoom}),this._dirty=!1)},e._getTile=function(n,s){var i=this.getTileId(n),o=this._cache.get(i),a=!1;return!o&&s?(o=new ns(n),Object.assign(o,this.getTileMetadata(o.index)),Object.assign(o,{id:i,zoom:this.getTileZoom(o.index)}),a=!0,this._cache.set(i,o),this._dirty=!0):o&&o.needsReload&&(a=!0),o&&a&&o.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),o},e._getNearestAncestor=function(n){for(var s=this._minZoom,i=s===void 0?0:s,o=n.index;this.getTileZoom(o)>i;){o=this.getParentIndex(o);var a=this._getTile(o);if(a)return a}return null},Aw(t,[{key:"tiles",get:function(){return this._tiles}},{key:"selectedTiles",get:function(){return this._selectedTiles}},{key:"isLoaded",get:function(){return this._selectedTiles!==null&&this._selectedTiles.every(function(n){return n.isLoaded})}},{key:"needsReload",get:function(){return this._selectedTiles!==null&&this._selectedTiles.some(function(n){return n.needsReload})}}]),t}();function ww(t){var e=ye(t),r;try{for(e.s();!(r=e.n()).done;){var n=r.value;n.state=0}}catch(l){e.e(l)}finally{e.f()}var s=ye(t),i;try{for(s.s();!(i=s.n()).done;){var o=i.value;o.isSelected&&!Cm(o)&&wu(o)}}catch(l){s.e(l)}finally{s.f()}var a=ye(t),c;try{for(a.s();!(c=a.n()).done;){var u=c.value;u.isVisible=Boolean(u.state&Ji)}}catch(l){a.e(l)}finally{a.f()}}function Sw(t){var e=ye(t),r;try{for(e.s();!(r=e.n()).done;){var n=r.value;n.state=0}}catch(p){e.e(p)}finally{e.f()}var s=ye(t),i;try{for(s.s();!(i=s.n()).done;){var o=i.value;o.isSelected&&Cm(o)}}catch(p){s.e(p)}finally{s.f()}var a=Array.from(t).sort(function(p,g){return p.zoom-g.zoom}),c=ye(a),u;try{for(c.s();!(u=c.n()).done;){var l=u.value;if(l.isVisible=Boolean(l.state&Ji),l.children&&(l.isVisible||l.state&Sm)){var f=ye(l.children),h;try{for(f.s();!(h=f.n()).done;){var d=h.value;d.state=Sm}}catch(p){f.e(p)}finally{f.f()}}else l.isSelected&&wu(l)}}catch(p){c.e(p)}finally{c.f()}}function Cm(t){for(var e=t;e;){if(e.isLoaded||e.content)return e.state|=Ji,!0;e=e.parent}return!1}function wu(t){var e=ye(t.children),r;try{for(e.s();!(r=e.n()).done;){var n=r.value;n.isLoaded||n.content?n.state|=Ji:wu(n)}}catch(s){e.e(s)}finally{e.f()}}function Xi(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Xi=function(r){return typeof r}:Xi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Xi(t)}function Mm(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Wi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Mm(Object(r),!0).forEach(function(n){Bw(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Mm(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Bw(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Cw(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Mw(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,s=function(){};return{s,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
23
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return i=u.done,u},e:function(u){o=!0,a=u},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function Mw(t,e){if(t){if(typeof t=="string")return Im(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Im(t,e)}}function Im(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Iw(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Om(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Ow(t,e,r){return e&&Om(t.prototype,e),r&&Om(t,r),t}function Rw(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Su(t,e)}function Su(t,e){return Su=Object.setPrototypeOf||function(n,s){return n.__proto__=s,n},Su(t,e)}function Lw(t){var e=Nw();return function(){var n=Ki(t),s;if(e){var i=Ki(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return Pw(this,s)}}function Pw(t,e){if(e&&(Xi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Fw(t)}function Fw(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Nw(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ki(t){return Ki=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ki(t)}var Dw={TilesetClass:us,data:{type:"data",value:[]},dataComparator:Yt.equal,renderSubLayers:{type:"function",value:function(e){return new Rm.GeoJsonLayer(e)}},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:function(e){}},onTileUnload:{type:"function",value:function(e){}},onTileError:{type:"function",value:function(e){return console.error(e)}},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:cs,zRange:null,maxRequests:6,zoomOffset:0},Bt=function(t){Rw(r,t);var e=Lw(r);function r(){var s;Iw(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return s=e.call.apply(e,[this].concat(o)),s.state=void 0,s}var n=r.prototype;return n.initializeState=function(){this.state={tileset:null,isLoaded:!1}},n.finalizeState=function(){var i,o;(i=this.state)===null||i===void 0||(o=i.tileset)===null||o===void 0||o.finalize()},n.shouldUpdateState=function(i){var o=i.changeFlags;return o.somethingChanged},n.updateState=function(i){var o=i.changeFlags,a=this.state.tileset,c=o.propsOrDataChanged||o.updateTriggersChanged,u=o.dataChanged||o.updateTriggersChanged&&(o.updateTriggersChanged.all||o.updateTriggersChanged.getTileData);a?c&&(a.setOptions(this._getTilesetOptions()),u?a.reloadAll():a.tiles.forEach(function(l){l.layers=null})):(a=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:a})),this._updateTileset()},n._getTilesetOptions=function(){var i=this.props,o=i.tileSize,a=i.maxCacheSize,c=i.maxCacheByteSize,u=i.refinementStrategy,l=i.extent,f=i.maxZoom,h=i.minZoom,d=i.maxRequests,p=i.zoomOffset;return{maxCacheSize:a,maxCacheByteSize:c,maxZoom:f,minZoom:h,tileSize:o,refinementStrategy:u,extent:l,maxRequests:d,zoomOffset:p,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}},n._updateTileset=function(){var i=this.state.tileset,o=this.props,a=o.zRange,c=o.modelMatrix,u=i.update(this.context.viewport,{zRange:a,modelMatrix:c}),l=i.isLoaded,f=this.state.isLoaded!==l,h=this.state.frameNumber!==u;l&&(f||h)&&this._onViewportLoad(),h&&this.setState({frameNumber:u}),this.state.isLoaded=l},n._onViewportLoad=function(){var i=this.state.tileset,o=this.props.onViewportLoad;o&&o(i.selectedTiles)},n._onTileLoad=function(i){this.props.onTileLoad(i),i.layers=null,this.setNeedsUpdate()},n._onTileError=function(i,o){this.props.onTileError(i),o.layers=null,this.setNeedsUpdate()},n._onTileUnload=function(i){this.props.onTileUnload(i)},n.getTileData=function(i){var o=this.props,a=o.data,c=o.getTileData,u=o.fetch,l=i.signal;return i.url=typeof a=="string"||Array.isArray(a)?pt(a,i):null,c?c(i):u&&i.url?u(i.url,{propName:"data",layer:this,signal:l}):null},n.renderSubLayers=function(i){return this.props.renderSubLayers(i)},n.getSubLayerPropsByTile=function(i){return null},n.getPickingInfo=function(i){var o=i.info,a=i.sourceLayer,c=a.props.tile;return o.picked&&(o.tile=c),o.sourceTile=c,o},n._updateAutoHighlight=function(i){var o=i.sourceTile;if(o&&o.layers){var a=Cw(o.layers),c;try{for(a.s();!(c=a.n()).done;){var u=c.value;u.updateAutoHighlight(i)}}catch(l){a.e(l)}finally{a.f()}}},n.renderLayers=function(){var i=this;return this.state.tileset.tiles.map(function(o){var a=i.getSubLayerPropsByTile(o);if(!(!o.isLoaded&&!o.content))if(o.layers)a&&o.layers[0]&&Object.keys(a).some(function(u){return o.layers[0].props[u]!==a[u]})&&(o.layers=o.layers.map(function(u){return u.clone(a)}));else{var c=i.renderSubLayers(Wi(Wi(Wi({},i.props),i.getSubLayerProps({id:o.id,updateTriggers:i.props.updateTriggers})),{},{data:o.content,_offset:0,tile:o}));o.layers=(0,Yi._flatten)(c,Boolean).map(function(u){return u.clone(Wi({tile:o},a))})}return o.layers})},n.filterSubLayer=function(i){var o=i.layer,a=i.cullRect,c=o.props.tile;return this.state.tileset.isTileVisible(c,a)},Ow(r,[{key:"isLoaded",get:function(){var i,o,a=(i=this.state)===null||i===void 0||(o=i.tileset)===null||o===void 0?void 0:o.selectedTiles;return a?a.every(function(c){return c.isLoaded&&c.layers&&c.layers.every(function(u){return u.isLoaded})}):!1}}]),r}(Yi.CompositeLayer);Bt.defaultProps=Dw;Bt.layerName="TileLayer";var Fm=U(Ye());function Zi(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Zi=function(r){return typeof r}:Zi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Zi(t)}function Lm(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Pm(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Lm(Object(r),!0).forEach(function(n){Uw(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Lm(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Uw(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Gw(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nn(t,e,r){return typeof Reflect<"u"&&Reflect.get?nn=Reflect.get:nn=function(s,i,o){var a=kw(s,i);if(a){var c=Object.getOwnPropertyDescriptor(a,i);return c.get?c.get.call(o):c.value}},nn(t,e,r||t)}function kw(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&(t=Zt(t),t!==null););return t}function Hw(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Bu(t,e)}function Bu(t,e){return Bu=Object.setPrototypeOf||function(n,s){return n.__proto__=s,n},Bu(t,e)}function Vw(t){var e=qw();return function(){var n=Zt(t),s;if(e){var i=Zt(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return zw(this,s)}}function zw(t,e){if(e&&(Zi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jw(t)}function jw(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function qw(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Zt(t){return Zt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Zt(t)}var Jw={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:function(e){return e.timestamps}}},Qi=function(t){Hw(r,t);var e=Vw(r);function r(){return Gw(this,r),e.apply(this,arguments)}var n=r.prototype;return n.getShaders=function(){var i=nn(Zt(r.prototype),"getShaders",this).call(this);return i.inject={"vs:#decl":`uniform float trailLength;
|
|
13
|
+
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}ge.prototype.build=function(t){return this.options.preserveOrder?gA(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)};ge.prototype.j2x=function(t,e){let r="",n="";for(let s in t)if(typeof t[s]>"u")this.isAttribute(s)&&(n+="");else if(t[s]===null)this.isAttribute(s)?n+="":s[0]==="?"?n+=this.indentate(e)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+s+"/"+this.tagEndChar;else if(t[s]instanceof Date)n+=this.buildTextValNode(t[s],s,"",e);else if(typeof t[s]!="object"){let i=this.isAttribute(s);if(i)r+=this.buildAttrPairStr(i,""+t[s]);else if(s===this.options.textNodeName){let o=this.options.tagValueProcessor(s,""+t[s]);n+=this.replaceEntitiesValue(o)}else n+=this.buildTextValNode(t[s],s,"",e)}else if(Array.isArray(t[s])){let i=t[s].length,o="";for(let a=0;a<i;a++){let c=t[s][a];typeof c>"u"||(c===null?s[0]==="?"?n+=this.indentate(e)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+s+"/"+this.tagEndChar:typeof c=="object"?this.options.oneListGroup?o+=this.j2x(c,e+1).val:o+=this.processTextOrObjNode(c,s,e):o+=this.buildTextValNode(c,s,"",e))}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,"",e)),n+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){let i=Object.keys(t[s]),o=i.length;for(let a=0;a<o;a++)r+=this.buildAttrPairStr(i[a],""+t[s][i[a]])}else n+=this.processTextOrObjNode(t[s],s,e);return{attrStr:r,val:n}};ge.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function _A(t,e,r){let n=this.j2x(t,r+1);return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,n.attrStr,r):this.buildObjectNode(n.val,e,n.attrStr,r)}ge.prototype.buildObjectNode=function(t,e,r,n){if(t==="")return e[0]==="?"?this.indentate(n)+"<"+e+r+"?"+this.tagEndChar:this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar;{let s="</"+e+this.tagEndChar,i="";return e[0]==="?"&&(i="?",s=""),(r||r==="")&&t.indexOf("<")===-1?this.indentate(n)+"<"+e+r+i+">"+t+s:this.options.commentPropName!==!1&&e===this.options.commentPropName&&i.length===0?this.indentate(n)+`<!--${t}-->`+this.newLine:this.indentate(n)+"<"+e+r+i+this.tagEndChar+t+this.indentate(n)+s}};ge.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};ge.prototype.buildTextValNode=function(t,e,r,n){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(n)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(n)+"<"+e+r+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(e,t);return s=this.replaceEntitiesValue(s),s===""?this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+r+">"+s+"</"+e+this.tagEndChar}};ge.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){let r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t};function mA(t){return this.options.indentBy.repeat(t)}function TA(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}nh.exports=ge});var oh=et((xM,ih)=>{"use strict";var EA=ho(),RA=Zl(),xA=sh();ih.exports={XMLParser:RA,XMLValidator:EA,XMLBuilder:xA}});var Ra=et((Wf,un)=>{(function(t,e){typeof define=="function"&&define.amd?define([],e):typeof Ml=="function"&&typeof un=="object"&&un&&un.exports?un.exports=e():(t.dcodeIO=t.dcodeIO||{}).Long=e()})(Wf,function(){"use strict";function t(E,g,y){this.low=E|0,this.high=g|0,this.unsigned=!!y}t.prototype.__isLong__,Object.defineProperty(t.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function e(E){return(E&&E.__isLong__)===!0}t.isLong=e;var r={},n={};function s(E,g){var y,O,b;return g?(E>>>=0,(b=0<=E&&E<256)&&(O=n[E],O)?O:(y=o(E,(E|0)<0?-1:0,!0),b&&(n[E]=y),y)):(E|=0,(b=-128<=E&&E<128)&&(O=r[E],O)?O:(y=o(E,E<0?-1:0,!1),b&&(r[E]=y),y))}t.fromInt=s;function i(E,g){if(isNaN(E)||!isFinite(E))return g?T:A;if(g){if(E<0)return T;if(E>=d)return M}else{if(E<=-p)return F;if(E+1>=p)return B}return E<0?i(-E,g).neg():o(E%u|0,E/u|0,g)}t.fromNumber=i;function o(E,g,y){return new t(E,g,y)}t.fromBits=o;var a=Math.pow;function c(E,g,y){if(E.length===0)throw Error("empty string");if(E==="NaN"||E==="Infinity"||E==="+Infinity"||E==="-Infinity")return A;if(typeof g=="number"?(y=g,g=!1):g=!!g,y=y||10,y<2||36<y)throw RangeError("radix");var O;if((O=E.indexOf("-"))>0)throw Error("interior hyphen");if(O===0)return c(E.substring(1),g,y).neg();for(var b=i(a(y,8)),N=A,U=0;U<E.length;U+=8){var Y=Math.min(8,E.length-U),W=parseInt(E.substring(U,U+Y),y);if(Y<8){var Q=i(a(y,Y));N=N.mul(Q).add(i(W))}else N=N.mul(b),N=N.add(i(W))}return N.unsigned=g,N}t.fromString=c;function l(E){return E instanceof t?E:typeof E=="number"?i(E):typeof E=="string"?c(E):o(E.low,E.high,E.unsigned)}t.fromValue=l;var h=1<<16,f=1<<24,u=h*h,d=u*u,p=d/2,_=s(f),A=s(0);t.ZERO=A;var T=s(0,!0);t.UZERO=T;var x=s(1);t.ONE=x;var R=s(1,!0);t.UONE=R;var S=s(-1);t.NEG_ONE=S;var B=o(-1,2147483647,!1);t.MAX_VALUE=B;var M=o(-1,-1,!0);t.MAX_UNSIGNED_VALUE=M;var F=o(0,-2147483648,!1);t.MIN_VALUE=F;var C=t.prototype;return C.toInt=function(){return this.unsigned?this.low>>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*u+(this.low>>>0):this.high*u+(this.low>>>0)},C.toString=function(g){if(g=g||10,g<2||36<g)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(F)){var y=i(g),O=this.div(y),b=O.mul(y).sub(this);return O.toString(g)+b.toInt().toString(g)}else return"-"+this.neg().toString(g);for(var N=i(a(g,6),this.unsigned),U=this,Y="";;){var W=U.div(N),Q=U.sub(W.mul(N)).toInt()>>>0,J=Q.toString(g);if(U=W,U.isZero())return J+Y;for(;J.length<6;)J="0"+J;Y=""+J+Y}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){if(this.isNegative())return this.eq(F)?64:this.neg().getNumBitsAbs();for(var g=this.high!=0?this.high:this.low,y=31;y>0&&!(g&1<<y);y--);return this.high!=0?y+33:y+1},C.isZero=function(){return this.high===0&&this.low===0},C.isNegative=function(){return!this.unsigned&&this.high<0},C.isPositive=function(){return this.unsigned||this.high>=0},C.isOdd=function(){return(this.low&1)===1},C.isEven=function(){return(this.low&1)===0},C.equals=function(g){return e(g)||(g=l(g)),this.unsigned!==g.unsigned&&this.high>>>31===1&&g.high>>>31===1?!1:this.high===g.high&&this.low===g.low},C.eq=C.equals,C.notEquals=function(g){return!this.eq(g)},C.neq=C.notEquals,C.lessThan=function(g){return this.comp(g)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(g){return this.comp(g)<=0},C.lte=C.lessThanOrEqual,C.greaterThan=function(g){return this.comp(g)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(g){return this.comp(g)>=0},C.gte=C.greaterThanOrEqual,C.compare=function(g){if(e(g)||(g=l(g)),this.eq(g))return 0;var y=this.isNegative(),O=g.isNegative();return y&&!O?-1:!y&&O?1:this.unsigned?g.high>>>0>this.high>>>0||g.high===this.high&&g.low>>>0>this.low>>>0?-1:1:this.sub(g).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(F)?F:this.not().add(x)},C.neg=C.negate,C.add=function(g){e(g)||(g=l(g));var y=this.high>>>16,O=this.high&65535,b=this.low>>>16,N=this.low&65535,U=g.high>>>16,Y=g.high&65535,W=g.low>>>16,Q=g.low&65535,J=0,q=0,tt=0,mt=0;return mt+=N+Q,tt+=mt>>>16,mt&=65535,tt+=b+W,q+=tt>>>16,tt&=65535,q+=O+Y,J+=q>>>16,q&=65535,J+=y+U,J&=65535,o(tt<<16|mt,J<<16|q,this.unsigned)},C.subtract=function(g){return e(g)||(g=l(g)),this.add(g.neg())},C.sub=C.subtract,C.multiply=function(g){if(this.isZero()||(e(g)||(g=l(g)),g.isZero()))return A;if(this.eq(F))return g.isOdd()?F:A;if(g.eq(F))return this.isOdd()?F:A;if(this.isNegative())return g.isNegative()?this.neg().mul(g.neg()):this.neg().mul(g).neg();if(g.isNegative())return this.mul(g.neg()).neg();if(this.lt(_)&&g.lt(_))return i(this.toNumber()*g.toNumber(),this.unsigned);var y=this.high>>>16,O=this.high&65535,b=this.low>>>16,N=this.low&65535,U=g.high>>>16,Y=g.high&65535,W=g.low>>>16,Q=g.low&65535,J=0,q=0,tt=0,mt=0;return mt+=N*Q,tt+=mt>>>16,mt&=65535,tt+=b*Q,q+=tt>>>16,tt&=65535,tt+=N*W,q+=tt>>>16,tt&=65535,q+=O*Q,J+=q>>>16,q&=65535,q+=b*W,J+=q>>>16,q&=65535,q+=N*Y,J+=q>>>16,q&=65535,J+=y*Q+O*W+b*Y+N*U,J&=65535,o(tt<<16|mt,J<<16|q,this.unsigned)},C.mul=C.multiply,C.divide=function(g){if(e(g)||(g=l(g)),g.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?T:A;var y,O,b;if(this.unsigned){if(g.unsigned||(g=g.toUnsigned()),g.gt(this))return T;if(g.gt(this.shru(1)))return R;b=T}else{if(this.eq(F)){if(g.eq(x)||g.eq(S))return F;if(g.eq(F))return x;var N=this.shr(1);return y=N.div(g).shl(1),y.eq(A)?g.isNegative()?x:S:(O=this.sub(g.mul(y)),b=y.add(O.div(g)),b)}else if(g.eq(F))return this.unsigned?T:A;if(this.isNegative())return g.isNegative()?this.neg().div(g.neg()):this.neg().div(g).neg();if(g.isNegative())return this.div(g.neg()).neg();b=A}for(O=this;O.gte(g);){y=Math.max(1,Math.floor(O.toNumber()/g.toNumber()));for(var U=Math.ceil(Math.log(y)/Math.LN2),Y=U<=48?1:a(2,U-48),W=i(y),Q=W.mul(g);Q.isNegative()||Q.gt(O);)y-=Y,W=i(y,this.unsigned),Q=W.mul(g);W.isZero()&&(W=x),b=b.add(W),O=O.sub(Q)}return b},C.div=C.divide,C.modulo=function(g){return e(g)||(g=l(g)),this.sub(this.div(g).mul(g))},C.mod=C.modulo,C.not=function(){return o(~this.low,~this.high,this.unsigned)},C.and=function(g){return e(g)||(g=l(g)),o(this.low&g.low,this.high&g.high,this.unsigned)},C.or=function(g){return e(g)||(g=l(g)),o(this.low|g.low,this.high|g.high,this.unsigned)},C.xor=function(g){return e(g)||(g=l(g)),o(this.low^g.low,this.high^g.high,this.unsigned)},C.shiftLeft=function(g){return e(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?o(this.low<<g,this.high<<g|this.low>>>32-g,this.unsigned):o(0,this.low<<g-32,this.unsigned)},C.shl=C.shiftLeft,C.shiftRight=function(g){return e(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?o(this.low>>>g|this.high<<32-g,this.high>>g,this.unsigned):o(this.high>>g-32,this.high>=0?0:-1,this.unsigned)},C.shr=C.shiftRight,C.shiftRightUnsigned=function(g){if(e(g)&&(g=g.toInt()),g&=63,g===0)return this;var y=this.high;if(g<32){var O=this.low;return o(O>>>g|y<<32-g,y>>>g,this.unsigned)}else return g===32?o(y,0,this.unsigned):o(y>>>g-32,0,this.unsigned)},C.shru=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},C.toBytes=function(E){return E?this.toBytesLE():this.toBytesBE()},C.toBytesLE=function(){var E=this.high,g=this.low;return[g&255,g>>>8&255,g>>>16&255,g>>>24&255,E&255,E>>>8&255,E>>>16&255,E>>>24&255]},C.toBytesBE=function(){var E=this.high,g=this.low;return[E>>>24&255,E>>>16&255,E>>>8&255,E&255,g>>>24&255,g>>>16&255,g>>>8&255,g&255]},t})});var Gs=et((yO,Tu)=>{Tu.exports=globalThis.h3||{}});var Da=et((vO,Cu)=>{Cu.exports=globalThis.luma});var qs=et((UO,Bu)=>{Bu.exports=globalThis.deck});var yu=et((LO,Mu)=>{Mu.exports=globalThis.luma});var Cr=et((qb,Qu)=>{Qu.exports=globalThis.loaders});var Cg=et((A4,Sg)=>{Sg.exports=globalThis.deck});var Dg=et(pl=>{pl.read=function(t,e,r,n,s){var i,o,a=s*8-n-1,c=(1<<a)-1,l=c>>1,h=-7,f=r?s-1:0,u=r?-1:1,d=t[e+f];for(f+=u,i=d&(1<<-h)-1,d>>=-h,h+=a;h>0;i=i*256+t[e+f],f+=u,h-=8);for(o=i&(1<<-h)-1,i>>=-h,h+=n;h>0;o=o*256+t[e+f],f+=u,h-=8);if(i===0)i=1-l;else{if(i===c)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,n),i=i-l}return(d?-1:1)*o*Math.pow(2,i-n)};pl.write=function(t,e,r,n,s,i){var o,a,c,l=i*8-s-1,h=(1<<l)-1,f=h>>1,u=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,_=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=h):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+f>=1?e+=u/c:e+=u*Math.pow(2,1-f),e*c>=2&&(o++,c/=2),o+f>=h?(a=0,o=h):o+f>=1?(a=(e*c-1)*Math.pow(2,s),o=o+f):(a=e*Math.pow(2,f-1)*Math.pow(2,s),o=0));s>=8;t[r+d]=a&255,d+=p,a/=256,s-=8);for(o=o<<s|a,l+=s;l>0;t[r+d]=o&255,d+=p,o/=256,l-=8);t[r+d-p]|=_*128}});var Vg=et((i6,Hg)=>{"use strict";Hg.exports=k;var eo=Dg();function k(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}k.Varint=0;k.Fixed64=1;k.Bytes=2;k.Fixed32=5;var gl=(1<<16)*(1<<16),wg=1/gl,lB=12,Lg=typeof TextDecoder>"u"?null:new TextDecoder("utf8");k.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),s=n>>3,i=this.pos;this.type=n&7,t(s,e,this),this.pos===i&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=ro(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Ug(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=ro(this.buf,this.pos)+ro(this.buf,this.pos+4)*gl;return this.pos+=8,t},readSFixed64:function(){var t=ro(this.buf,this.pos)+Ug(this.buf,this.pos+4)*gl;return this.pos+=8,t},readFloat:function(){var t=eo.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=eo.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e=this.buf,r,n;return n=e[this.pos++],r=n&127,n<128||(n=e[this.pos++],r|=(n&127)<<7,n<128)||(n=e[this.pos++],r|=(n&127)<<14,n<128)||(n=e[this.pos++],r|=(n&127)<<21,n<128)?r:(n=e[this.pos],r|=(n&15)<<28,hB(r,t,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=lB&&Lg?CB(this.buf,e,t):SB(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==k.Bytes)return t.push(this.readVarint(e));var r=de(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==k.Bytes)return t.push(this.readSVarint());var e=de(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==k.Bytes)return t.push(this.readBoolean());var e=de(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==k.Bytes)return t.push(this.readFloat());var e=de(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==k.Bytes)return t.push(this.readDouble());var e=de(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==k.Bytes)return t.push(this.readFixed32());var e=de(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==k.Bytes)return t.push(this.readSFixed32());var e=de(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==k.Bytes)return t.push(this.readFixed64());var e=de(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==k.Bytes)return t.push(this.readSFixed64());var e=de(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===k.Varint)for(;this.buf[this.pos++]>127;);else if(e===k.Bytes)this.pos=this.readVarint()+this.pos;else if(e===k.Fixed32)this.pos+=4;else if(e===k.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Kr(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Kr(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Kr(this.buf,t&-1,this.pos),Kr(this.buf,Math.floor(t*wg),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Kr(this.buf,t&-1,this.pos),Kr(this.buf,Math.floor(t*wg),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){fB(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?-t*2-1:t*2)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(t.length*4),this.pos++;var e=this.pos;this.pos=BB(this.buf,t,this.pos);var r=this.pos-e;r>=128&&vg(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),eo.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),eo.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&vg(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,k.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,pB,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,gB,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,mB,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,AB,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,_B,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,TB,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,EB,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,RB,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,xB,e)},writeBytesField:function(t,e){this.writeTag(t,k.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,k.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,k.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,k.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,k.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,k.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,k.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,k.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,k.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,k.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};function hB(t,e,r){var n=r.buf,s,i;if(i=n[r.pos++],s=(i&112)>>4,i<128||(i=n[r.pos++],s|=(i&127)<<3,i<128)||(i=n[r.pos++],s|=(i&127)<<10,i<128)||(i=n[r.pos++],s|=(i&127)<<17,i<128)||(i=n[r.pos++],s|=(i&127)<<24,i<128)||(i=n[r.pos++],s|=(i&1)<<31,i<128))return Gr(t,s,e);throw new Error("Expected varint not more than 10 bytes")}function de(t){return t.type===k.Bytes?t.readVarint()+t.pos:t.pos+1}function Gr(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function fB(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(r=~(-t%4294967296),n=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),uB(r,n,e),dB(n,e)}function uB(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function dB(t,e){var r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function vg(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(n);for(var s=r.pos-1;s>=t;s--)r.buf[s+n]=r.buf[s]}function pB(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function gB(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function AB(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function _B(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function mB(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function TB(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function EB(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function RB(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function xB(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function ro(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function Kr(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function Ug(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function SB(t,e,r){for(var n="",s=e;s<r;){var i=t[s],o=null,a=i>239?4:i>223?3:i>191?2:1;if(s+a>r)break;var c,l,h;a===1?i<128&&(o=i):a===2?(c=t[s+1],(c&192)===128&&(o=(i&31)<<6|c&63,o<=127&&(o=null))):a===3?(c=t[s+1],l=t[s+2],(c&192)===128&&(l&192)===128&&(o=(i&15)<<12|(c&63)<<6|l&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):a===4&&(c=t[s+1],l=t[s+2],h=t[s+3],(c&192)===128&&(l&192)===128&&(h&192)===128&&(o=(i&15)<<18|(c&63)<<12|(l&63)<<6|h&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,a=1):o>65535&&(o-=65536,n+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),n+=String.fromCharCode(o),s+=a}return n}function CB(t,e,r){return Lg.decode(t.subarray(e,r))}function BB(t,e,r){for(var n=0,s,i;n<e.length;n++){if(s=e.charCodeAt(n),s>55295&&s<57344)if(i)if(s<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=s;continue}else s=i-55296<<10|s-56320|65536,i=null;else{s>56319||n+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=s;continue}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);s<128?t[r++]=s:(s<2048?t[r++]=s>>6|192:(s<65536?t[r++]=s>>12|224:(t[r++]=s>>18|240,t[r++]=s>>12&63|128),t[r++]=s>>6&63|128),t[r++]=s&63|128)}return r}});var rs={};ht(rs,{GeohashLayer:()=>es,GreatCircleLayer:()=>fn,H3ClusterLayer:()=>xn,H3HexagonLayer:()=>Ke,MVTLayer:()=>ts,QuadkeyLayer:()=>pn,S2Layer:()=>dn,TerrainLayer:()=>Wn,Tile3DLayer:()=>Ln,TileLayer:()=>te,TripsLayer:()=>Tn,_GeoCellLayer:()=>It,_Tile2DHeader:()=>ke,_Tileset2D:()=>Ge,_WMSLayer:()=>Fs,_getURLFromTemplate:()=>$t});var Kt={},Il=v(Ut(),1);pe(Kt,v(Ut(),1));if(!Il.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");pe(rs,Kt);var ze=v(Lt(),1),Hf=v(Ut(),1);function p0(t){return typeof t=="string"?t.charAt(0).toLowerCase()+t.slice(1):t}function is(t){if(Array.isArray(t))return t.map(e=>is(e));if(t&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[p0(r)]=is(n);return e}return t}var ah=v(oh(),1);function To(t,e){if(e!=null&&e._parser&&e._parser!=="fast-xml-parser")throw new Error(e?._parser);let r={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:e?.removeNSPrefix,textNodeName:e?.textNodeName,isArray:(s,i,o,a)=>{var c;return Boolean(e==null||(c=e.arrayPaths)===null||c===void 0?void 0:c.some(h=>i===h))},...e?._fastXML},n=SA(t,r);return e!=null&&e.uncapitalizeKeys?is(n):n}function SA(t,e){return new ah.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...e}).parse(t)}var CA="4.1.0",gt={name:"XML",id:"xml",module:"xml",version:CA,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:BA,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(t,e)=>To(new TextDecoder().decode(t),{...gt.options.xml,...e?.xml}),parseTextSync:(t,e)=>To(t,{...gt.options.xml,...e?.xml})};function BA(t){return t.startsWith("<?xml")}async function Ct(t,e,r,n){return n._parse(t,e,r,n)}function V(t,e){if(!t)throw new Error(e||"loader assertion failed.")}var Jt={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},MA=Jt.self||Jt.window||Jt.global||{},yA=Jt.window||Jt.self||Jt.global||{},IA=Jt.global||Jt.self||Jt.window||{},FA=Jt.document||{};var qr=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var ch=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),NA=ch&&parseFloat(ch[1])||0;function Eo(t,e){return lh(t||{},e)}function lh(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(r>3)return e;let n={...t};for(let[s,i]of Object.entries(e))i&&typeof i=="object"&&!Array.isArray(i)?n[s]=lh(n[s]||{},e[s],r+1):n[s]=e[s];return n}function OA(){var t;return(t=globalThis._loadersgl_)!==null&&t!==void 0&&t.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.1.0"),globalThis._loadersgl_.version}var hh=OA();function fh(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var Yt={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},PM=Yt.self||Yt.window||Yt.global||{},DM=Yt.window||Yt.self||Yt.global||{},wM=Yt.global||Yt.self||Yt.window||{},vM=Yt.document||{};var ur=typeof process!="object"||String(process)!=="[object process]"||process.browser,as=typeof importScripts=="function",UM=typeof window<"u"&&typeof window.orientation<"u",uh=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),LM=uh&&parseFloat(uh[1])||0;var Ro={};async function qt(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return e&&(t=dh(t,e,r,n)),Ro[t]=Ro[t]||bA(t),await Ro[t]}function dh(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(!r.useLocalLibraries&&t.startsWith("http"))return t;n=n||t;let s=r.modules||{};return s[n]?s[n]:ur?r.CDN?(fh(r.CDN.startsWith("http")),`${r.CDN}/${e}@${hh}/dist/libs/${n}`):as?`../src/libs/${n}`:`modules/${e}/src/libs/${n}`:`modules/${e}/dist/libs/${n}`}async function bA(t){if(t.endsWith("wasm"))return await DA(t);if(!ur)try{return Bt&&Bt.requireFromFile&&await Bt.requireFromFile(t)}catch(r){return console.error(r),null}if(as)return importScripts(t);let e=await wA(t);return PA(e,t)}function PA(t,e){if(!ur)return Bt.requireFromString&&Bt.requireFromString(t,e);if(as)return eval.call(globalThis,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}async function DA(t){return ur||!Bt.readFileAsArrayBuffer||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await Bt.readFileAsArrayBuffer(t)}async function wA(t){return ur||!Bt.readFileAsText||t.startsWith("http")?await(await fetch(t)).text():await Bt.readFileAsText(t)}function gh(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:5;return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?ph(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?ph(t,0,e):""}function ph(t,e,r){if(t.byteLength<=e+r)return"";let n=new DataView(t),s="";for(let i=0;i<r;i++)s+=String.fromCharCode(n.getUint8(e+i));return s}function xo(t){try{return JSON.parse(t)}catch{throw new Error(`Failed to parse JSON from data starting with "${gh(t)}"`)}}function jr(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];let n=e,s=n&&n.length>1&&n[0].constructor||null;if(!s)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let i=n.reduce((c,l)=>c+l.length,0),o=new s(i),a=0;for(let c of n)o.set(c,a),a+=c.length;return o}function De(t,e,r){let n=r!==void 0?new Uint8Array(t).subarray(e,e+r):new Uint8Array(t).subarray(e);return new Uint8Array(n).buffer}function Ae(t,e){return V(t>=0),V(e>0),t+(e-1)&~(e-1)}function So(t,e,r){let n;if(t instanceof ArrayBuffer)n=new Uint8Array(t);else{let s=t.byteOffset,i=t.byteLength;n=new Uint8Array(t.buffer||t.arrayBuffer,s,i)}return e.set(n,r),r+Ae(n.byteLength,4)}function Zr(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var we=class{constructor(e,r){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Zr(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Zr()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var _e=class{constructor(e){this.id=void 0,this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:e,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let r of Object.values(this.stats))e(r)}getTable(){let e={};return this.forEach(r=>{e[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),e}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(e){let{name:r,type:n}=e,s=this.stats[r];return s||(e instanceof we?s=e:s=new we(r,n),this.stats[r]=s),s}};var vA="Queued Requests",UA="Active Requests",LA="Cancelled Requests",HA="Queued Requests Ever",VA="Active Requests Ever",XA={id:"request-scheduler",throttleRequests:!0,maxRequests:6},me=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.props=void 0,this.stats=void 0,this.activeRequestCount=0,this.requestQueue=[],this.requestMap=new Map,this.deferredUpdate=null,this.props={...XA,...e},this.stats=new _e({id:this.props.id}),this.stats.get(vA),this.stats.get(UA),this.stats.get(LA),this.stats.get(HA),this.stats.get(VA)}scheduleRequest(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:()=>0;if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);let n={handle:e,priority:0,getPriority:r},s=new Promise(i=>(n.resolve=i,n));return this.requestQueue.push(n),this.requestMap.set(e,s),this._issueNewRequests(),s}_issueRequest(e){let{handle:r,resolve:n}=e,s=!1,i=()=>{s||(s=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,n?n({done:i}):Promise.resolve({done:i})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequestsAsync(){this.deferredUpdate=null;let e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(e!==0){this._updateAllRequests();for(let r=0;r<e;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let e=this.requestQueue;for(let r=0;r<e.length;++r){let n=e[r];this._updateRequest(n)||(e.splice(r,1),this.requestMap.delete(n.handle),r--)}e.sort((r,n)=>r.priority-n.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),e.priority<0?(e.resolve(null),!1):!0}};var Te={};ht(Te,{dirname:()=>zA,filename:()=>WA,join:()=>kA,resolve:()=>GA});function Ah(){var t;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=(t=window.location)===null||t===void 0?void 0:t.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function WA(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function zA(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}function kA(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];let n="/";return e=e.map((s,i)=>(i&&(s=s.replace(new RegExp(`^${n}`),"")),i!==e.length-1&&(s=s.replace(new RegExp(`${n}$`),"")),s)),e.join(n)}function GA(){let t=[];for(let s=0;s<arguments.length;s++)t[s]=s<0||arguments.length<=s?void 0:arguments[s];let e="",r=!1,n;for(let s=t.length-1;s>=-1&&!r;s--){let i;s>=0?i=t[s]:(n===void 0&&(n=Ah()),i=n),i.length!==0&&(e=`${i}/${e}`,r=i.charCodeAt(0)===Qr)}return e=KA(e,!r),r?`/${e}`:e.length>0?e:"."}var Qr=47,Co=46;function KA(t,e){let r="",n=-1,s=0,i,o=!1;for(let a=0;a<=t.length;++a){if(a<t.length)i=t.charCodeAt(a);else{if(i===Qr)break;i=Qr}if(i===Qr){if(!(n===a-1||s===1))if(n!==a-1&&s===2){if(r.length<2||!o||r.charCodeAt(r.length-1)!==Co||r.charCodeAt(r.length-2)!==Co){if(r.length>2){let c=r.length-1,l=c;for(;l>=0&&r.charCodeAt(l)!==Qr;--l);if(l!==c){r=l===-1?"":r.slice(0,l),n=a,s=0,o=!1;continue}}else if(r.length===2||r.length===1){r="",n=a,s=0,o=!1;continue}}e&&(r.length>0?r+="/..":r="..",o=!0)}else{let c=t.slice(n+1,a);r.length>0?r+=`/${c}`:r=c,o=!1}n=a,s=0}else i===Co&&s!==-1?++s:s=-1}return r}var cs=class{constructor(e){this.data=void 0,this.fetch=void 0,this.loadOptions=void 0,this._needsRefresh=!0,this.props=void 0,this.props={...e},this.loadOptions={...e.loadOptions},this.fetch=JA(this.loadOptions)}setProps(e){this.props=Object.assign(this.props,e),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,r=this._needsRefresh;return e&&(this._needsRefresh=!1),r}};function JA(t){let e=t?.fetch;if(e&&typeof e=="function")return(n,s)=>e(n,s);let r=t?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var Nt=class extends cs{};Nt.type="template";Nt.testURL=t=>!1;function _h(t,e){var r,n,s;let i=(r=gt.parseTextSync)===null||r===void 0?void 0:r.call(gt,t,e),o=(i==null||(n=i.ServiceExceptionReport)===null||n===void 0?void 0:n.ServiceException)||(i==null||(s=i["ogc:ServiceExceptionReport"])===null||s===void 0?void 0:s["ogc:ServiceException"]);return typeof o=="string"?o:o.value||o.code||"Unknown error"}var YA="4.1.0",ve={id:"wms-error",name:"WMS Error",module:"wms",version:YA,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:qA,options:{wms:{throwOnError:!1}},parse:async(t,e)=>Bo(new TextDecoder().decode(t),e),parseSync:(t,e)=>Bo(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>Bo(t,e)};function qA(t){return t.startsWith("<?xml")}function Bo(t,e){let r={...ve.options.wms,...e?.wms},n=_h(t,r),s=r.minimalErrors?n:`WMS Service error: ${n}`;if(r.throwOnError)throw new Error(s);return s}function Ue(t){return Array.isArray(t)?t:t?[t]:[]}function $r(t){let e=Ue(t);return e.length>0&&e.every(r=>typeof r=="string")?e:[]}function tn(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;switch(typeof t){case"number":return t;case"string":return parseFloat(t);default:return}}function ls(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;switch(typeof t){case"number":return t;case"string":return parseInt(t,10);default:return}}function Le(t){switch(t){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function Mo(t,e){var r;let n=(r=gt.parseTextSync)===null||r===void 0?void 0:r.call(gt,t,e),s=n.WMT_MS_Capabilities||n.WMS_Capabilities||n,i=jA(s);if(e!=null&&e.inheritedLayerProps)for(let o of i.layers)Th(o,null);return e!=null&&e.includeRawJSON&&(i.json=s),e!=null&&e.includeXMLText&&(i.xml=t),i}function jA(t){var e,r,n,s,i,o,a,c,l,h,f,u,d,p,_,A;let T={version:String(t.version||""),name:String(((e=t.Service)===null||e===void 0?void 0:e.Name)||"unnamed"),title:(r=t.Service)!==null&&r!==void 0&&r.Title?String((n=t.Service)===null||n===void 0?void 0:n.Title):void 0,abstract:(s=t.Service)!==null&&s!==void 0&&s.Abstract?String((i=t.Service)===null||i===void 0?void 0:i.Abstract):void 0,keywords:$r((o=t.Service)===null||o===void 0||(a=o.KeywordList)===null||a===void 0?void 0:a.Keyword),fees:(c=t.Service)!==null&&c!==void 0&&c.Fees?JSON.stringify((l=t.Service)===null||l===void 0?void 0:l.Fees):void 0,accessConstraints:(h=t.Service)!==null&&h!==void 0&&h.AccessConstraints?JSON.stringify((f=t.Service)===null||f===void 0?void 0:f.AccessConstraints):void 0,layerLimit:ls((u=t.Service)===null||u===void 0?void 0:u.LayerLimit),maxWidth:ls((d=t.Service)===null||d===void 0?void 0:d.maxWidth),maxHeight:ls((p=t.Service)===null||p===void 0?void 0:p.maxHeight),layers:[],requests:ZA((_=t.Capability)===null||_===void 0?void 0:_.Request),exceptions:QA(t.Exception)},x=Ue((A=t.Capability)===null||A===void 0?void 0:A.Layer);for(let R of x)T.layers.push(mh(R));for(let[R,S]of Object.entries(T))S===void 0&&delete T[R];return T}function ZA(t){let e={};for(let[r,n]of Object.entries(t||{})){let s=$r(n?.Format);e[r]={mimeTypes:s}}return e}function QA(t){if(Ue(t?.Format).length>0)return{mimeTypes:$r(t)}}function mh(t){var e;let r={title:String(t?.Title||""),name:t?.Name&&String(t?.Name),abstract:t?.Name&&String(t?.Abstract),keywords:$r((e=t.KeywordList)===null||e===void 0?void 0:e.Keyword)},n=t?.CRS||t?.SRS;n&&Array.isArray(n)&&n.every(h=>typeof h=="string")&&(r.crs=n);let s=t?.EX_GeographicBoundingBox&&$A(t?.EX_GeographicBoundingBox);s&&(r.geographicBoundingBox=s),s=t?.LatLonBoundingBox&&t_(t?.LatLonBoundingBox),s&&(r.geographicBoundingBox=s);let i=t?.BoundingBox&&e_(t?.BoundingBox);i&&i.length>0&&(r.boundingBoxes=i);let a=Ue(t?.Dimension).map(h=>n_(h));a.length&&(r.dimensions=a),t!=null&&t.opaque&&(r.opaque=Le(t?.opaque)),t!=null&&t.cascaded&&(r.cascaded=Le(t?.cascaded)),t!=null&&t.queryable&&(r.queryable=Le(t?.queryable));let c=Ue(t?.Layer),l=[];for(let h of c)l.push(mh(h));l.length>0&&(r.layers=l);for(let[h,f]of Object.entries(r))f===void 0&&delete r[h];return r}function $A(t){let{westBoundLongitude:e,northBoundLatitude:r,eastBoundLongitude:n,southBoundLatitude:s}=t;return[[e,s],[n,r]]}function t_(t){let{minx:e,miny:r,maxx:n,maxy:s}=t;return[[e,r],[n,s]]}function e_(t){return Ue(t).map(r=>r_(r))}function r_(t){let{CRS:e,SRS:r,minx:n,miny:s,maxx:i,maxy:o,resx:a,resy:c}=t,l={crs:e||r,boundingBox:[[tn(n),tn(s)],[tn(i),tn(o)]]};return a&&(l.xResolution=a),c&&(l.yResolution=c),l}function n_(t){let{name:e,units:r,value:n}=t,s={name:e,units:r,extent:n};return t.unitSymbol&&(s.unitSymbol=t.unitSymbol),t.default&&(s.defaultValue=t.default),t.multipleValues&&(s.multipleValues=Le(t.multipleValues)),t.nearestValue&&(s.nearestValue=Le(t.nearestValue)),t.current&&(s.current=Le(t.current)),s}function Th(t,e){e!=null&&e.geographicBoundingBox&&!t.geographicBoundingBox&&(t.geographicBoundingBox=[...e.geographicBoundingBox]),e!=null&&e.crs&&!t.crs&&(t.crs=[...e.crs]),e!=null&&e.boundingBoxes&&!t.boundingBoxes&&(t.boundingBoxes=[...e.boundingBoxes]),e!=null&&e.dimensions&&!t.dimensions&&(t.dimensions=[...e.dimensions]);for(let r of t.layers||[])Th(r,t)}var s_="4.1.0",dr={id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:s_,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:i_,options:{wms:{}},parse:async(t,e)=>Mo(new TextDecoder().decode(t),e?.wms),parseTextSync:(t,e)=>Mo(t,e?.wms)};function i_(t){return t.startsWith("<?xml")}function yo(t,e){var r,n;let i=((n=((r=gt.parseTextSync)===null||r===void 0?void 0:r.call(gt,t,e)).FeatureInfoResponse)===null||n===void 0?void 0:n.FIELDS)||[];return{features:(Array.isArray(i)?i:[i]).map(a=>o_(a))}}function o_(t){return{attributes:t||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var Eh={...dr,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(t,e)=>yo(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>yo(t,e)};function Io(t,e){var r;return(r=gt.parseTextSync)===null||r===void 0?void 0:r.call(gt,t,e)}var Rh={...dr,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(t,e)=>Io(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>Io(t,e)};function xh(t,e){let{type:r="auto"}=t,n=r==="auto"?c_(t.url,e):a_(r,e);if(!n)throw new Error("Not a valid image source type");return n.create(t)}function a_(t,e){for(let r of e)if(r.type===t)return r;return null}function c_(t,e){for(let r of e)if(r.testURL&&r.testURL(t))return r;return null}var Sh="4.1.0";var Fo,l_=(Fo=globalThis.loaders)===null||Fo===void 0?void 0:Fo.parseImageNode,No=typeof Image<"u",Oo=typeof ImageBitmap<"u",h_=Boolean(l_),bo=qr?!0:h_;function Ch(t){switch(t){case"auto":return Oo||No||bo;case"imagebitmap":return Oo;case"image":return No;case"data":return bo;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function Bh(){if(Oo)return"imagebitmap";if(No)return"image";if(bo)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Mh(t){let e=f_(t);if(!e)throw new Error("Not an image");return e}function en(t){switch(Mh(t)){case"data":return t;case"image":case"imagebitmap":let e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function f_(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}var u_=/^data:image\/svg\+xml/,d_=/\.svg((\?|#).*)?$/;function hs(t){return t&&(u_.test(t)||d_.test(t))}function yh(t,e){if(hs(e)){let n=new TextDecoder().decode(t);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return Po(t,e)}function Po(t,e){if(hs(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function fs(t,e,r){let n=yh(t,r),s=self.URL||self.webkitURL,i=typeof n!="string"&&s.createObjectURL(n);try{return await p_(i||n,e)}finally{i&&s.revokeObjectURL(i)}}async function p_(t,e){let r=new Image;return r.src=t,e.image&&e.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,s)=>{try{r.onload=()=>n(r),r.onerror=i=>{let o=i instanceof Error?i.message:"error";s(new Error(o))}}catch(i){s(i)}})}var g_={},Ih=!0;async function Fh(t,e,r){let n;hs(r)?n=await fs(t,e,r):n=Po(t,r);let s=e&&e.imagebitmap;return await A_(n,s)}async function A_(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if((__(e)||!Ih)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(r){console.warn(r),Ih=!1}return await createImageBitmap(t)}function __(t){for(let e in t||g_)return!1;return!0}function Nh(t){return!R_(t,"ftyp",4)||!(t[8]&96)?null:m_(t)}function m_(t){switch(T_(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function T_(t,e,r){return String.fromCharCode(...t.slice(e,r))}function E_(t){return[...t].map(e=>e.charCodeAt(0))}function R_(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=E_(e);for(let s=0;s<n.length;++s)if(n[s]!==t[s+r])return!1;return!0}var jt=!1,rn=!0;function He(t){let e=nn(t);return S_(e)||M_(e)||C_(e)||B_(e)||x_(e)}function x_(t){let e=new Uint8Array(t instanceof DataView?t.buffer:t),r=Nh(e);return r?{mimeType:r.mimeType,width:0,height:0}:null}function S_(t){let e=nn(t);return e.byteLength>=24&&e.getUint32(0,jt)===2303741511?{mimeType:"image/png",width:e.getUint32(16,jt),height:e.getUint32(20,jt)}:null}function C_(t){let e=nn(t);return e.byteLength>=10&&e.getUint32(0,jt)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,rn),height:e.getUint16(8,rn)}:null}function B_(t){let e=nn(t);return e.byteLength>=14&&e.getUint16(0,jt)===16973&&e.getUint32(2,rn)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,rn),height:e.getUint32(22,rn)}:null}function M_(t){let e=nn(t);if(!(e.byteLength>=3&&e.getUint16(0,jt)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:s}=y_(),i=2;for(;i+9<e.byteLength;){let o=e.getUint16(i,jt);if(s.has(o))return{mimeType:"image/jpeg",height:e.getUint16(i+5,jt),width:e.getUint16(i+7,jt)};if(!n.has(o))return null;i+=2,i+=e.getUint16(i,jt)}return null}function y_(){let t=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)t.add(r);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function nn(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}async function Oh(t,e){var r;let{mimeType:n}=He(t)||{},s=(r=globalThis.loaders)===null||r===void 0?void 0:r.parseImageNode;return V(s),await s(t,n)}async function bh(t,e,r){e=e||{};let s=(e.image||{}).type||"auto",{url:i}=r||{},o=I_(s),a;switch(o){case"imagebitmap":a=await Fh(t,e,i);break;case"image":a=await fs(t,e,i);break;case"data":a=await Oh(t,e);break;default:V(!1)}return s==="data"&&(a=en(a)),a}function I_(t){switch(t){case"auto":case"data":return Bh();default:return Ch(t),t}}var F_=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],N_=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],O_={image:{type:"auto",decode:!0}},Ee={id:"image",module:"images",name:"Images",version:Sh,mimeTypes:N_,extensions:F_,parse:bh,tests:[t=>Boolean(He(new DataView(t)))],options:O_};var Do={};function wo(t){if(Do[t]===void 0){let e=qr?P_(t):b_(t);Do[t]=e}return Do[t]}function b_(t){var e,r;let n=["image/png","image/jpeg","image/gif"],s=((e=globalThis.loaders)===null||e===void 0?void 0:e.imageFormatsNode)||n,i=(r=globalThis.loaders)===null||r===void 0?void 0:r.parseImageNode;return Boolean(i)&&s.includes(t)}function P_(t){switch(t){case"image/avif":case"image/webp":return D_(t);default:return!0}}function D_(t){try{return document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)===0}catch{return!1}}var Ph={type:"wms",testURL:t=>t.toLowerCase().includes("wms"),create:t=>new vo(t)},vo=class extends Nt{constructor(e){var r;super(e),this.url=void 0,this.data=void 0,this.substituteCRS84=void 0,this.flipCRS=void 0,this.wmsParameters=void 0,this.vendorParameters=void 0,this.capabilities=null,this.url=e.url,this.data=e.url,this.substituteCRS84=(r=e.substituteCRS84)!==null&&r!==void 0?r:!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...e.wmsParameters},this.vendorParameters=e.vendorParameters||{}}async getMetadata(){let e=await this.getCapabilities();return this.normalizeMetadata(e)}async getImage(e){let{boundingBox:r,bbox:n,...s}=e,i={bbox:r?[...r[0],...r[1]]:n,...s};return await this.getMap(i)}normalizeMetadata(e){return e}async getCapabilities(e,r){let n=this.getCapabilitiesURL(e,r),s=await this.fetch(n),i=await s.arrayBuffer();this._checkResponse(s,i);let o=await dr.parse(i,this.loadOptions);return this.capabilities=o,o}async getMap(e,r){let n=this.getMapURL(e,r),s=await this.fetch(n),i=await s.arrayBuffer();this._checkResponse(s,i);try{return await Ee.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}async getFeatureInfo(e,r){let n=this.getFeatureInfoURL(e,r),s=await this.fetch(n),i=await s.arrayBuffer();return this._checkResponse(s,i),await Eh.parse(i,this.loadOptions)}async getFeatureInfoText(e,r){let n=this.getFeatureInfoURL(e,r),s=await this.fetch(n),i=await s.arrayBuffer();return this._checkResponse(s,i),new TextDecoder().decode(i)}async describeLayer(e,r){let n=this.describeLayerURL(e,r),s=await this.fetch(n),i=await s.arrayBuffer();return this._checkResponse(s,i),await Rh.parse(i,this.loadOptions)}async getLegendGraphic(e,r){let n=this.getLegendGraphicURL(e,r),s=await this.fetch(n),i=await s.arrayBuffer();this._checkResponse(s,i);try{return await Ee.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}getCapabilitiesURL(e,r){let n={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetCapabilities",n,r)}getMapURL(e,r){e=this._getWMS130Parameters(e);let n={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...e};return this._getWMSUrl("GetMap",n,r)}getFeatureInfoURL(e,r){e=this._getWMS130Parameters(e);let n={version:this.wmsParameters.version,info_format:this.wmsParameters.info_format,layers:this.wmsParameters.layers,query_layers:this.wmsParameters.query_layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...e};return this._getWMSUrl("GetFeatureInfo",n,r)}describeLayerURL(e,r){let n={version:this.wmsParameters.version,...e};return this._getWMSUrl("DescribeLayer",n,r)}getLegendGraphicURL(e,r){let n={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetLegendGraphic",n,r)}_parseWMSUrl(e){let[r,n]=e.split("?"),s=n.split("&"),i={};for(let o of s){let[a,c]=o.split("=");i[a]=c}return{url:r,parameters:i}}_getWMSUrl(e,r,n){let s=this.url,i=!0,o={service:"WMS",version:r.version,request:e,...r,...this.vendorParameters,...n},a=["transparent","time","elevation"];for(let[c,l]of Object.entries(o))(!a.includes(c)||l)&&(s+=i?"?":"&",i=!1,s+=this._getURLParameter(c,l,r));return encodeURI(s)}_getWMS130Parameters(e){let r={...e};return r.srs&&(r.crs=r.crs||r.srs,delete r.srs),r}_getURLParameter(e,r,n){switch(e){case"crs":n.version!=="1.3.0"?e="srs":this.substituteCRS84&&r==="EPSG:4326"&&(r="CRS:84");break;case"srs":n.version==="1.3.0"&&(e="crs");break;case"bbox":let s=this._flipBoundingBox(r,n);s&&(r=s);break;default:}return e=e.toUpperCase(),Array.isArray(r)?`${e}=${r.join(",")}`:`${e}=${r?String(r):""}`}_flipBoundingBox(e,r){if(!Array.isArray(e)||e.length!==4)return null;let n=r.version==="1.3.0"&&this.flipCRS.includes(r.crs||"")&&!(this.substituteCRS84&&r.crs==="EPSG:4326"),s=e;return n?[s[1],s[0],s[3],s[2]]:s}async _fetchArrayBuffer(e){let r=await this.fetch(e),n=await r.arrayBuffer();return this._checkResponse(r,n),n}_checkResponse(e,r){let n=e.headers["content-type"];if(!e.ok||ve.mimeTypes.includes(n)){var s;let i=Eo(this.loadOptions,{wms:{throwOnError:!0}}),o=(s=ve.parseSync)===null||s===void 0?void 0:s.call(ve,r,i);throw new Error(o)}}_parseError(e){var r;let n=(r=ve.parseSync)===null||r===void 0?void 0:r.call(ve,e,this.loadOptions);return new Error(n)}};var pr=class extends Nt{constructor(e){super(e)}async getMetadata(){throw new Error("ImageSource.getMetadata not implemented")}async getImage(e){let r=this.getGranularParameters(e),n=this.getURLFromTemplate(r),i=await(await this.fetch(n)).arrayBuffer();return await Ee.parse(i)}getGranularParameters(e){let[[r,n],[s,i]]=e.boundingBox;return{...e,east:r,north:n,south:i,west:s}}getURLFromTemplate(e){let r=this.props.url;for(let[n,s]of Object.entries(e))r=r.replace(`\${${n}}`,String(s)),r=r.replace(`{${n}}`,String(s));return r}};pr.type="template";pr.testURL=t=>t.toLowerCase().includes("{");var Uo=class extends pr{constructor(e){super(e),this.data=void 0,this.data=e.url}async getMetadata(){return await this.metadata()}async getImage(e){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(e){throw new Error("not implemented")}metadataURL(e){return`${this.props.url}?f=pjson`}exportImageURL(e){let r=`bbox=${e.bbox[0]},${e.bbox[1]},${e.bbox[2]},${e.bbox[3]}`,n=`size=${e.width},${e.height}`,s={...e,bbox:r,size:n};return delete s.width,delete s.height,this.getUrl("exportImage",s)}getUrl(e,r,n){let s=`${this.props.url}/${e}`,i=!0;for(let[o,a]of Object.entries(r))s+=i?"?":"&",i=!1,Array.isArray(a)?s+=`${o.toUpperCase()}=${a.join(",")}`:s+=`${o.toUpperCase()}=${a?String(a):""}`;return s}async checkResponse(e){if(!e.ok)throw new Error("error")}},Dh={type:"arcgis-image-server",testURL:t=>t.toLowerCase().includes("ImageServer"),create:t=>new Uo(t)};var w_=[Ph,Dh];function Lo(t){return xh(t,w_)}function P(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var v_=1/Math.PI*180,U_=1/180*Math.PI,L_={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...L_}};var j=globalThis.mathgl.config;function Ho(t,{precision:e=j.precision}={}){return t=H_(t),"".concat(parseFloat(t.toPrecision(e)))}function Mt(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Vo(t){return wh(t)}function Xo(t){return yt(t)}function wh(t,e){return Wo(t,r=>r*U_,e)}function yt(t,e){return Wo(t,r=>r*v_,e)}function us(t,e,r){return Wo(t,n=>Math.max(e,Math.min(r,n)))}function Re(t,e,r){return Mt(t)?t.map((n,s)=>Re(n,e[s],r)):r*e+(1-r)*t}function At(t,e,r){let n=j.EPSILON;r&&(j.EPSILON=r);try{if(t===e)return!0;if(Mt(t)&&Mt(e)){if(t.length!==e.length)return!1;for(let s=0;s<t.length;++s)if(!At(t[s],e[s]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):typeof t=="number"&&typeof e=="number"?Math.abs(t-e)<=j.EPSILON*Math.max(1,Math.abs(t),Math.abs(e)):!1}finally{j.EPSILON=n}}function H_(t){return Math.round(t/j.EPSILON)*j.EPSILON}function V_(t){return t.clone?t.clone():new Array(t.length)}function Wo(t,e,r){if(Mt(t)){let n=t;r=r||V_(n);for(let s=0;s<r.length&&s<n.length;++s){let i=typeof t=="number"?t:t[s];r[s]=e(i,s,r)}return r}return e(t)}function X_(t){function e(){var r=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(r,Object.getPrototypeOf(this)),r}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var xe=class extends X_(Array){clone(){return new this.constructor().copy(this)}fromArray(e,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=e[n+r];return this.check()}toArray(e=[],r=0){for(let n=0;n<this.ELEMENTS;++n)e[r+n]=this[n];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:Mt(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(j)}formatString(e){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+Ho(this[n],e);return"".concat(e.printTypes?this.constructor.name:"","[").concat(r,"]")}equals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!At(this[r],e[r]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==e[r])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,r,n){if(n===void 0)return this.lerp(this,e,r);for(let s=0;s<this.ELEMENTS;++s){let i=e[s],o=typeof r=="number"?r:r[s];this[s]=i+n*(o-i)}return this.check()}min(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(e[r],this[r]);return this.check()}max(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(e[r],this[r]);return this.check()}clamp(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e[n]),r[n]);return this.check()}add(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(e){if(typeof e=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;else for(let r=0;r<this.ELEMENTS&&r<e.length;++r)this[r]*=e[r];return this.check()}multiplyByScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}check(){if(j.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let e=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)e=e&&Number.isFinite(this[r]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=e;return this.check()}addScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e),r);return this.check()}get elements(){return this}};function W_(t,e){if(t.length!==e)return!1;for(let r=0;r<t.length;++r)if(!Number.isFinite(t[r]))return!1;return!0}function H(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(JSON.stringify(t)));return t}function Se(t,e,r=""){if(j.debug&&!W_(t,e))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return t}function ct(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}var Ce=class extends xe{get x(){return this[0]}set x(e){this[0]=H(e)}get y(){return this[1]}set y(e){this[1]=H(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*this[r];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let r=0;for(let n=0;n<this.ELEMENTS;++n){let s=this[n]-e[n];r+=s*s}return H(r)}dot(e){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*e[n];return H(r)}normalize(){let e=this.magnitude();if(e!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=e;return this.check()}multiply(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return ct(e>=0&&e<this.ELEMENTS,"index is out of range"),H(this[e])}setComponent(e,r){return ct(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=r,this.check()}addVectors(e,r){return this.copy(e).add(r)}subVectors(e,r){return this.copy(e).subtract(r)}multiplyVectors(e,r){return this.copy(e).multiply(r)}addScaledVector(e,r){return this.add(new this.constructor(e).multiplyScalar(r))}};var $=typeof Float32Array<"u"?Float32Array:Array,sn=Math.random;function gr(t){return t>=0?Math.round(t):t%.5===0?Math.floor(t):Math.round(t)}var dF=Math.PI/180;function z_(){let t=new $(2);return $!=Float32Array&&(t[0]=0,t[1]=0),t}function vh(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s,t[1]=r[1]*n+r[3]*s,t}function Uh(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s+r[4],t[1]=r[1]*n+r[3]*s+r[5],t}function ds(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[3]*s+r[6],t[1]=r[1]*n+r[4]*s+r[7],t}function ps(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[4]*s+r[12],t[1]=r[1]*n+r[5]*s+r[13],t}var pF=function(){let t=z_();return function(e,r,n,s,i,o){let a,c;for(r||(r=2),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],i(t,t,o),e[a]=t[0],e[a+1]=t[1];return e}}();function gs(t,e,r){let n=e[0],s=e[1],i=r[3]*n+r[7]*s||1;return t[0]=(r[0]*n+r[4]*s)/i,t[1]=(r[1]*n+r[5]*s)/i,t}function As(t,e,r){let n=e[0],s=e[1],i=e[2],o=r[3]*n+r[7]*s+r[11]*i||1;return t[0]=(r[0]*n+r[4]*s+r[8]*i)/o,t[1]=(r[1]*n+r[5]*s+r[9]*i)/o,t[2]=(r[2]*n+r[6]*s+r[10]*i)/o,t}function Lh(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s,t[1]=r[1]*n+r[3]*s,t[2]=e[2],t}function Hh(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s,t[1]=r[1]*n+r[3]*s,t[2]=e[2],t[3]=e[3],t}function _s(t,e,r){let n=e[0],s=e[1],i=e[2];return t[0]=r[0]*n+r[3]*s+r[6]*i,t[1]=r[1]*n+r[4]*s+r[7]*i,t[2]=r[2]*n+r[5]*s+r[8]*i,t[3]=e[3],t}var Ve=class extends Ce{constructor(e=0,r=0){super(2),Mt(e)&&arguments.length===1?this.copy(e):(j.debug&&(H(e),H(r)),this[0]=e,this[1]=r)}set(e,r){return this[0]=e,this[1]=r,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this.check()}fromObject(e){return j.debug&&(H(e.x),H(e.y)),this[0]=e.x,this[1]=e.y,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return ps(this,this,e),this.check()}transformAsVector(e){return gs(this,this,e),this.check()}transformByMatrix3(e){return ds(this,this,e),this.check()}transformByMatrix2x3(e){return Uh(this,this,e),this.check()}transformByMatrix2(e){return vh(this,this,e),this.check()}};var _r={};ht(_r,{add:()=>J_,angle:()=>Jo,bezier:()=>om,ceil:()=>Y_,clone:()=>k_,copy:()=>G_,create:()=>ms,cross:()=>Xe,dist:()=>gm,distance:()=>kh,div:()=>pm,divide:()=>zh,dot:()=>on,equals:()=>fm,exactEquals:()=>hm,floor:()=>q_,forEach:()=>mm,fromValues:()=>Ts,hermite:()=>im,inverse:()=>rm,len:()=>Yo,length:()=>Vh,lerp:()=>nm,max:()=>Z_,min:()=>j_,mul:()=>dm,multiply:()=>Wh,negate:()=>em,normalize:()=>zo,random:()=>am,rotateX:()=>ko,rotateY:()=>Go,rotateZ:()=>Ko,round:()=>Q_,scale:()=>$_,scaleAndAdd:()=>tm,set:()=>K_,slerp:()=>sm,sqrDist:()=>Am,sqrLen:()=>_m,squaredDistance:()=>Gh,squaredLength:()=>Kh,str:()=>lm,sub:()=>um,subtract:()=>Xh,transformMat3:()=>an,transformMat4:()=>We,transformQuat:()=>cn,zero:()=>cm});function ms(){let t=new $(3);return $!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function k_(t){let e=new $(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Vh(t){let e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function Ts(t,e,r){let n=new $(3);return n[0]=t,n[1]=e,n[2]=r,n}function G_(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function K_(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function J_(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function Xh(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function Wh(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function zh(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}function Y_(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function q_(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function j_(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t}function Z_(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t}function Q_(t,e){return t[0]=gr(e[0]),t[1]=gr(e[1]),t[2]=gr(e[2]),t}function $_(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function tm(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}function kh(t,e){let r=e[0]-t[0],n=e[1]-t[1],s=e[2]-t[2];return Math.sqrt(r*r+n*n+s*s)}function Gh(t,e){let r=e[0]-t[0],n=e[1]-t[1],s=e[2]-t[2];return r*r+n*n+s*s}function Kh(t){let e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}function em(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function rm(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function zo(t,e){let r=e[0],n=e[1],s=e[2],i=r*r+n*n+s*s;return i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function on(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Xe(t,e,r){let n=e[0],s=e[1],i=e[2],o=r[0],a=r[1],c=r[2];return t[0]=s*c-i*a,t[1]=i*o-n*c,t[2]=n*a-s*o,t}function nm(t,e,r,n){let s=e[0],i=e[1],o=e[2];return t[0]=s+n*(r[0]-s),t[1]=i+n*(r[1]-i),t[2]=o+n*(r[2]-o),t}function sm(t,e,r,n){let s=Math.acos(Math.min(Math.max(on(e,r),-1),1)),i=Math.sin(s),o=Math.sin((1-n)*s)/i,a=Math.sin(n*s)/i;return t[0]=o*e[0]+a*r[0],t[1]=o*e[1]+a*r[1],t[2]=o*e[2]+a*r[2],t}function im(t,e,r,n,s,i){let o=i*i,a=o*(2*i-3)+1,c=o*(i-2)+i,l=o*(i-1),h=o*(3-2*i);return t[0]=e[0]*a+r[0]*c+n[0]*l+s[0]*h,t[1]=e[1]*a+r[1]*c+n[1]*l+s[1]*h,t[2]=e[2]*a+r[2]*c+n[2]*l+s[2]*h,t}function om(t,e,r,n,s,i){let o=1-i,a=o*o,c=i*i,l=a*o,h=3*i*a,f=3*c*o,u=c*i;return t[0]=e[0]*l+r[0]*h+n[0]*f+s[0]*u,t[1]=e[1]*l+r[1]*h+n[1]*f+s[1]*u,t[2]=e[2]*l+r[2]*h+n[2]*f+s[2]*u,t}function am(t,e){e=e===void 0?1:e;let r=sn()*2*Math.PI,n=sn()*2-1,s=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(r)*s,t[1]=Math.sin(r)*s,t[2]=n*e,t}function We(t,e,r){let n=e[0],s=e[1],i=e[2],o=r[3]*n+r[7]*s+r[11]*i+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*s+r[8]*i+r[12])/o,t[1]=(r[1]*n+r[5]*s+r[9]*i+r[13])/o,t[2]=(r[2]*n+r[6]*s+r[10]*i+r[14])/o,t}function an(t,e,r){let n=e[0],s=e[1],i=e[2];return t[0]=n*r[0]+s*r[3]+i*r[6],t[1]=n*r[1]+s*r[4]+i*r[7],t[2]=n*r[2]+s*r[5]+i*r[8],t}function cn(t,e,r){let n=r[0],s=r[1],i=r[2],o=r[3],a=e[0],c=e[1],l=e[2],h=s*l-i*c,f=i*a-n*l,u=n*c-s*a,d=s*u-i*f,p=i*h-n*u,_=n*f-s*h,A=o*2;return h*=A,f*=A,u*=A,d*=2,p*=2,_*=2,t[0]=a+h+d,t[1]=c+f+p,t[2]=l+u+_,t}function ko(t,e,r,n){let s=[],i=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],i[0]=s[0],i[1]=s[1]*Math.cos(n)-s[2]*Math.sin(n),i[2]=s[1]*Math.sin(n)+s[2]*Math.cos(n),t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function Go(t,e,r,n){let s=[],i=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],i[0]=s[2]*Math.sin(n)+s[0]*Math.cos(n),i[1]=s[1],i[2]=s[2]*Math.cos(n)-s[0]*Math.sin(n),t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function Ko(t,e,r,n){let s=[],i=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],i[0]=s[0]*Math.cos(n)-s[1]*Math.sin(n),i[1]=s[0]*Math.sin(n)+s[1]*Math.cos(n),i[2]=s[2],t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function Jo(t,e){let r=t[0],n=t[1],s=t[2],i=e[0],o=e[1],a=e[2],c=Math.sqrt((r*r+n*n+s*s)*(i*i+o*o+a*a)),l=c&&on(t,e)/c;return Math.acos(Math.min(Math.max(l,-1),1))}function cm(t){return t[0]=0,t[1]=0,t[2]=0,t}function lm(t){return"vec3(".concat(t[0],", ").concat(t[1],", ").concat(t[2],")")}function hm(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function fm(t,e){let r=t[0],n=t[1],s=t[2],i=e[0],o=e[1],a=e[2];return Math.abs(r-i)<=1e-6*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-o)<=1e-6*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}var um=Xh,dm=Wh,pm=zh,gm=kh,Am=Gh,Yo=Vh,_m=Kh,mm=function(){let t=ms();return function(e,r,n,s,i,o){let a,c;for(r||(r=3),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],i(t,t,o),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2];return e}}();var qo=[0,0,0],Es,m=class extends Ce{static get ZERO(){return Es||(Es=new m(0,0,0),Object.freeze(Es)),Es}constructor(e=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&Mt(e)?this.copy(e):(j.debug&&(H(e),H(r),H(n)),this[0]=e,this[1]=r,this[2]=n)}set(e,r,n){return this[0]=e,this[1]=r,this[2]=n,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return j.debug&&(H(e.x),H(e.y),H(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=H(e)}angle(e){return Jo(this,e)}cross(e){return Xe(this,this,e),this.check()}rotateX({radians:e,origin:r=qo}){return ko(this,this,r,e),this.check()}rotateY({radians:e,origin:r=qo}){return Go(this,this,r,e),this.check()}rotateZ({radians:e,origin:r=qo}){return Ko(this,this,r,e),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return We(this,this,e),this.check()}transformAsVector(e){return As(this,this,e),this.check()}transformByMatrix3(e){return an(this,this,e),this.check()}transformByMatrix2(e){return Lh(this,this,e),this.check()}transformByQuaternion(e){return cn(this,this,e),this.check()}};var Rs,mr=class extends Ce{static get ZERO(){return Rs||(Rs=new mr(0,0,0,0),Object.freeze(Rs)),Rs}constructor(e=0,r=0,n=0,s=0){super(-0,-0,-0,-0),Mt(e)&&arguments.length===1?this.copy(e):(j.debug&&(H(e),H(r),H(n),H(s)),this[0]=e,this[1]=r,this[2]=n,this[3]=s)}set(e,r,n,s){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}fromObject(e){return j.debug&&(H(e.x),H(e.y),H(e.z),H(e.w)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e.w=this[3],e}get ELEMENTS(){return 4}get z(){return this[2]}set z(e){this[2]=H(e)}get w(){return this[3]}set w(e){this[3]=H(e)}transform(e){return We(this,this,e),this.check()}transformByMatrix3(e){return _s(this,this,e),this.check()}transformByMatrix2(e){return Hh(this,this,e),this.check()}transformByQuaternion(e){return cn(this,this,e),this.check()}applyMatrix4(e){return e.transform(this,this),this}};var Tr=class extends xe{toString(){let e="[";if(j.printRowMajor){e+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)e+=" ".concat(this[n*this.RANK+r])}else{e+="column-major:";for(let r=0;r<this.ELEMENTS;++r)e+=" ".concat(this[r])}return e+="]",e}getElementIndex(e,r){return r*this.RANK+e}getElement(e,r){return this[r*this.RANK+e]}setElement(e,r,n){return this[r*this.RANK+e]=H(n),this}getColumn(e,r=new Array(this.RANK).fill(-0)){let n=e*this.RANK;for(let s=0;s<this.RANK;++s)r[s]=this[n+s];return r}setColumn(e,r){let n=e*this.RANK;for(let s=0;s<this.RANK;++s)this[n+s]=r[s];return this}};function Jh(){let t=new $(9);return $!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function Yh(t,e){if(t===e){let r=e[1],n=e[2],s=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=s}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function qh(t,e){let r=e[0],n=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8],f=h*o-a*l,u=-h*i+a*c,d=l*i-o*c,p=r*f+n*u+s*d;return p?(p=1/p,t[0]=f*p,t[1]=(-h*n+s*l)*p,t[2]=(a*n-s*o)*p,t[3]=u*p,t[4]=(h*r-s*c)*p,t[5]=(-a*r+s*i)*p,t[6]=d*p,t[7]=(-l*r+n*c)*p,t[8]=(o*r-n*i)*p,t):null}function jh(t){let e=t[0],r=t[1],n=t[2],s=t[3],i=t[4],o=t[5],a=t[6],c=t[7],l=t[8];return e*(l*i-o*c)+r*(-l*s+o*a)+n*(c*s-i*a)}function jo(t,e,r){let n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],l=e[6],h=e[7],f=e[8],u=r[0],d=r[1],p=r[2],_=r[3],A=r[4],T=r[5],x=r[6],R=r[7],S=r[8];return t[0]=u*n+d*o+p*l,t[1]=u*s+d*a+p*h,t[2]=u*i+d*c+p*f,t[3]=_*n+A*o+T*l,t[4]=_*s+A*a+T*h,t[5]=_*i+A*c+T*f,t[6]=x*n+R*o+S*l,t[7]=x*s+R*a+S*h,t[8]=x*i+R*c+S*f,t}function Zh(t,e,r){let n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],l=e[6],h=e[7],f=e[8],u=r[0],d=r[1];return t[0]=n,t[1]=s,t[2]=i,t[3]=o,t[4]=a,t[5]=c,t[6]=u*n+d*o+l,t[7]=u*s+d*a+h,t[8]=u*i+d*c+f,t}function Qh(t,e,r){let n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],l=e[6],h=e[7],f=e[8],u=Math.sin(r),d=Math.cos(r);return t[0]=d*n+u*o,t[1]=d*s+u*a,t[2]=d*i+u*c,t[3]=d*o-u*n,t[4]=d*a-u*s,t[5]=d*c-u*i,t[6]=l,t[7]=h,t[8]=f,t}function Zo(t,e,r){let n=r[0],s=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=s*e[3],t[4]=s*e[4],t[5]=s*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function $h(t,e){let r=e[0],n=e[1],s=e[2],i=e[3],o=r+r,a=n+n,c=s+s,l=r*o,h=n*o,f=n*a,u=s*o,d=s*a,p=s*c,_=i*o,A=i*a,T=i*c;return t[0]=1-f-p,t[3]=h-T,t[6]=u+A,t[1]=h+T,t[4]=1-l-p,t[7]=d-_,t[2]=u-A,t[5]=d+_,t[8]=1-l-f,t}var Qo;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL1ROW0=3]="COL1ROW0",t[t.COL1ROW1=4]="COL1ROW1",t[t.COL1ROW2=5]="COL1ROW2",t[t.COL2ROW0=6]="COL2ROW0",t[t.COL2ROW1=7]="COL2ROW1",t[t.COL2ROW2=8]="COL2ROW2"})(Qo||(Qo={}));var Em=Object.freeze([1,0,0,0,1,0,0,0,1]),z=class extends Tr{static get IDENTITY(){return xm()}static get ZERO(){return Rm()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Qo}constructor(e,...r){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):r.length>0?this.copy([e,...r]):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}identity(){return this.copy(Em)}fromObject(e){return this.check()}fromQuaternion(e){return $h(this,e),this.check()}set(e,r,n,s,i,o,a,c,l){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=l,this.check()}setRowMajor(e,r,n,s,i,o,a,c,l){return this[0]=e,this[1]=s,this[2]=a,this[3]=r,this[4]=i,this[5]=c,this[6]=n,this[7]=o,this[8]=l,this.check()}determinant(){return jh(this)}transpose(){return Yh(this,this),this.check()}invert(){return qh(this,this),this.check()}multiplyLeft(e){return jo(this,e,this),this.check()}multiplyRight(e){return jo(this,this,e),this.check()}rotate(e){return Qh(this,this,e),this.check()}scale(e){return Array.isArray(e)?Zo(this,this,e):Zo(this,this,[e,e]),this.check()}translate(e){return Zh(this,this,e),this.check()}transform(e,r){let n;switch(e.length){case 2:n=ds(r||[-0,-0],e,this);break;case 3:n=an(r||[-0,-0,-0],e,this);break;case 4:n=_s(r||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Se(n,e.length),n}transformVector(e,r){return this.transform(e,r)}transformVector2(e,r){return this.transform(e,r)}transformVector3(e,r){return this.transform(e,r)}},xs,Ss=null;function Rm(){return xs||(xs=new z([0,0,0,0,0,0,0,0,0]),Object.freeze(xs)),xs}function xm(){return Ss||(Ss=new z,Object.freeze(Ss)),Ss}var Cs={};ht(Cs,{add:()=>Jm,adjoint:()=>Im,clone:()=>Cm,copy:()=>Bm,create:()=>Sm,decompose:()=>Lm,determinant:()=>ea,equals:()=>Zm,exactEquals:()=>jm,frob:()=>Km,fromQuat:()=>ca,fromQuat2:()=>wm,fromRotation:()=>Om,fromRotationTranslation:()=>ef,fromRotationTranslationScale:()=>Hm,fromRotationTranslationScaleOrigin:()=>Vm,fromScaling:()=>Nm,fromTranslation:()=>Fm,fromValues:()=>Mm,fromXRotation:()=>bm,fromYRotation:()=>Pm,fromZRotation:()=>Dm,frustum:()=>la,getRotation:()=>Um,getScaling:()=>rf,getTranslation:()=>vm,identity:()=>tf,invert:()=>ta,lookAt:()=>ua,mul:()=>Qm,multiply:()=>ln,multiplyScalar:()=>Ym,multiplyScalarAndAdd:()=>qm,ortho:()=>fa,orthoNO:()=>sf,orthoZO:()=>zm,perspective:()=>ha,perspectiveFromFieldOfView:()=>Wm,perspectiveNO:()=>nf,perspectiveZO:()=>Xm,rotate:()=>sa,rotateX:()=>ia,rotateY:()=>oa,rotateZ:()=>aa,scale:()=>na,set:()=>ym,str:()=>Gm,sub:()=>$m,subtract:()=>of,targetTo:()=>km,translate:()=>ra,transpose:()=>$o});function Sm(){let t=new $(16);return $!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function Cm(t){let e=new $(16);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 Bm(t,e){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 Mm(t,e,r,n,s,i,o,a,c,l,h,f,u,d,p,_){let A=new $(16);return A[0]=t,A[1]=e,A[2]=r,A[3]=n,A[4]=s,A[5]=i,A[6]=o,A[7]=a,A[8]=c,A[9]=l,A[10]=h,A[11]=f,A[12]=u,A[13]=d,A[14]=p,A[15]=_,A}function ym(t,e,r,n,s,i,o,a,c,l,h,f,u,d,p,_,A){return t[0]=e,t[1]=r,t[2]=n,t[3]=s,t[4]=i,t[5]=o,t[6]=a,t[7]=c,t[8]=l,t[9]=h,t[10]=f,t[11]=u,t[12]=d,t[13]=p,t[14]=_,t[15]=A,t}function tf(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function $o(t,e){if(t===e){let r=e[1],n=e[2],s=e[3],i=e[6],o=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=i,t[11]=e[14],t[12]=s,t[13]=o,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function ta(t,e){let r=e[0],n=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8],f=e[9],u=e[10],d=e[11],p=e[12],_=e[13],A=e[14],T=e[15],x=r*a-n*o,R=r*c-s*o,S=r*l-i*o,B=n*c-s*a,M=n*l-i*a,F=s*l-i*c,C=h*_-f*p,E=h*A-u*p,g=h*T-d*p,y=f*A-u*_,O=f*T-d*_,b=u*T-d*A,N=x*b-R*O+S*y+B*g-M*E+F*C;return N?(N=1/N,t[0]=(a*b-c*O+l*y)*N,t[1]=(s*O-n*b-i*y)*N,t[2]=(_*F-A*M+T*B)*N,t[3]=(u*M-f*F-d*B)*N,t[4]=(c*g-o*b-l*E)*N,t[5]=(r*b-s*g+i*E)*N,t[6]=(A*S-p*F-T*R)*N,t[7]=(h*F-u*S+d*R)*N,t[8]=(o*O-a*g+l*C)*N,t[9]=(n*g-r*O-i*C)*N,t[10]=(p*M-_*S+T*x)*N,t[11]=(f*S-h*M-d*x)*N,t[12]=(a*E-o*y-c*C)*N,t[13]=(r*y-n*E+s*C)*N,t[14]=(_*R-p*B-A*x)*N,t[15]=(h*B-f*R+u*x)*N,t):null}function Im(t,e){let r=e[0],n=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8],f=e[9],u=e[10],d=e[11],p=e[12],_=e[13],A=e[14],T=e[15],x=r*a-n*o,R=r*c-s*o,S=r*l-i*o,B=n*c-s*a,M=n*l-i*a,F=s*l-i*c,C=h*_-f*p,E=h*A-u*p,g=h*T-d*p,y=f*A-u*_,O=f*T-d*_,b=u*T-d*A;return t[0]=a*b-c*O+l*y,t[1]=s*O-n*b-i*y,t[2]=_*F-A*M+T*B,t[3]=u*M-f*F-d*B,t[4]=c*g-o*b-l*E,t[5]=r*b-s*g+i*E,t[6]=A*S-p*F-T*R,t[7]=h*F-u*S+d*R,t[8]=o*O-a*g+l*C,t[9]=n*g-r*O-i*C,t[10]=p*M-_*S+T*x,t[11]=f*S-h*M-d*x,t[12]=a*E-o*y-c*C,t[13]=r*y-n*E+s*C,t[14]=_*R-p*B-A*x,t[15]=h*B-f*R+u*x,t}function ea(t){let e=t[0],r=t[1],n=t[2],s=t[3],i=t[4],o=t[5],a=t[6],c=t[7],l=t[8],h=t[9],f=t[10],u=t[11],d=t[12],p=t[13],_=t[14],A=t[15],T=e*o-r*i,x=e*a-n*i,R=r*a-n*o,S=l*p-h*d,B=l*_-f*d,M=h*_-f*p,F=e*M-r*B+n*S,C=i*M-o*B+a*S,E=l*R-h*x+f*T,g=d*R-p*x+_*T;return c*F-s*C+A*E-u*g}function ln(t,e,r){let n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],l=e[6],h=e[7],f=e[8],u=e[9],d=e[10],p=e[11],_=e[12],A=e[13],T=e[14],x=e[15],R=r[0],S=r[1],B=r[2],M=r[3];return t[0]=R*n+S*a+B*f+M*_,t[1]=R*s+S*c+B*u+M*A,t[2]=R*i+S*l+B*d+M*T,t[3]=R*o+S*h+B*p+M*x,R=r[4],S=r[5],B=r[6],M=r[7],t[4]=R*n+S*a+B*f+M*_,t[5]=R*s+S*c+B*u+M*A,t[6]=R*i+S*l+B*d+M*T,t[7]=R*o+S*h+B*p+M*x,R=r[8],S=r[9],B=r[10],M=r[11],t[8]=R*n+S*a+B*f+M*_,t[9]=R*s+S*c+B*u+M*A,t[10]=R*i+S*l+B*d+M*T,t[11]=R*o+S*h+B*p+M*x,R=r[12],S=r[13],B=r[14],M=r[15],t[12]=R*n+S*a+B*f+M*_,t[13]=R*s+S*c+B*u+M*A,t[14]=R*i+S*l+B*d+M*T,t[15]=R*o+S*h+B*p+M*x,t}function ra(t,e,r){let n=r[0],s=r[1],i=r[2],o,a,c,l,h,f,u,d,p,_,A,T;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*i+e[12],t[13]=e[1]*n+e[5]*s+e[9]*i+e[13],t[14]=e[2]*n+e[6]*s+e[10]*i+e[14],t[15]=e[3]*n+e[7]*s+e[11]*i+e[15]):(o=e[0],a=e[1],c=e[2],l=e[3],h=e[4],f=e[5],u=e[6],d=e[7],p=e[8],_=e[9],A=e[10],T=e[11],t[0]=o,t[1]=a,t[2]=c,t[3]=l,t[4]=h,t[5]=f,t[6]=u,t[7]=d,t[8]=p,t[9]=_,t[10]=A,t[11]=T,t[12]=o*n+h*s+p*i+e[12],t[13]=a*n+f*s+_*i+e[13],t[14]=c*n+u*s+A*i+e[14],t[15]=l*n+d*s+T*i+e[15]),t}function na(t,e,r){let n=r[0],s=r[1],i=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function sa(t,e,r,n){let s=n[0],i=n[1],o=n[2],a=Math.sqrt(s*s+i*i+o*o),c,l,h,f,u,d,p,_,A,T,x,R,S,B,M,F,C,E,g,y,O,b,N,U;return a<1e-6?null:(a=1/a,s*=a,i*=a,o*=a,l=Math.sin(r),c=Math.cos(r),h=1-c,f=e[0],u=e[1],d=e[2],p=e[3],_=e[4],A=e[5],T=e[6],x=e[7],R=e[8],S=e[9],B=e[10],M=e[11],F=s*s*h+c,C=i*s*h+o*l,E=o*s*h-i*l,g=s*i*h-o*l,y=i*i*h+c,O=o*i*h+s*l,b=s*o*h+i*l,N=i*o*h-s*l,U=o*o*h+c,t[0]=f*F+_*C+R*E,t[1]=u*F+A*C+S*E,t[2]=d*F+T*C+B*E,t[3]=p*F+x*C+M*E,t[4]=f*g+_*y+R*O,t[5]=u*g+A*y+S*O,t[6]=d*g+T*y+B*O,t[7]=p*g+x*y+M*O,t[8]=f*b+_*N+R*U,t[9]=u*b+A*N+S*U,t[10]=d*b+T*N+B*U,t[11]=p*b+x*N+M*U,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function ia(t,e,r){let n=Math.sin(r),s=Math.cos(r),i=e[4],o=e[5],a=e[6],c=e[7],l=e[8],h=e[9],f=e[10],u=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=i*s+l*n,t[5]=o*s+h*n,t[6]=a*s+f*n,t[7]=c*s+u*n,t[8]=l*s-i*n,t[9]=h*s-o*n,t[10]=f*s-a*n,t[11]=u*s-c*n,t}function oa(t,e,r){let n=Math.sin(r),s=Math.cos(r),i=e[0],o=e[1],a=e[2],c=e[3],l=e[8],h=e[9],f=e[10],u=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=i*s-l*n,t[1]=o*s-h*n,t[2]=a*s-f*n,t[3]=c*s-u*n,t[8]=i*n+l*s,t[9]=o*n+h*s,t[10]=a*n+f*s,t[11]=c*n+u*s,t}function aa(t,e,r){let n=Math.sin(r),s=Math.cos(r),i=e[0],o=e[1],a=e[2],c=e[3],l=e[4],h=e[5],f=e[6],u=e[7];return e!==t&&(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[0]=i*s+l*n,t[1]=o*s+h*n,t[2]=a*s+f*n,t[3]=c*s+u*n,t[4]=l*s-i*n,t[5]=h*s-o*n,t[6]=f*s-a*n,t[7]=u*s-c*n,t}function Fm(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function Nm(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Om(t,e,r){let n=r[0],s=r[1],i=r[2],o=Math.sqrt(n*n+s*s+i*i),a,c,l;return o<1e-6?null:(o=1/o,n*=o,s*=o,i*=o,c=Math.sin(e),a=Math.cos(e),l=1-a,t[0]=n*n*l+a,t[1]=s*n*l+i*c,t[2]=i*n*l-s*c,t[3]=0,t[4]=n*s*l-i*c,t[5]=s*s*l+a,t[6]=i*s*l+n*c,t[7]=0,t[8]=n*i*l+s*c,t[9]=s*i*l-n*c,t[10]=i*i*l+a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function bm(t,e){let r=Math.sin(e),n=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Pm(t,e){let r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Dm(t,e){let r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=n,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ef(t,e,r){let n=e[0],s=e[1],i=e[2],o=e[3],a=n+n,c=s+s,l=i+i,h=n*a,f=n*c,u=n*l,d=s*c,p=s*l,_=i*l,A=o*a,T=o*c,x=o*l;return t[0]=1-(d+_),t[1]=f+x,t[2]=u-T,t[3]=0,t[4]=f-x,t[5]=1-(h+_),t[6]=p+A,t[7]=0,t[8]=u+T,t[9]=p-A,t[10]=1-(h+d),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function wm(t,e){let r=new $(3),n=-e[0],s=-e[1],i=-e[2],o=e[3],a=e[4],c=e[5],l=e[6],h=e[7],f=n*n+s*s+i*i+o*o;return f>0?(r[0]=(a*o+h*n+c*i-l*s)*2/f,r[1]=(c*o+h*s+l*n-a*i)*2/f,r[2]=(l*o+h*i+a*s-c*n)*2/f):(r[0]=(a*o+h*n+c*i-l*s)*2,r[1]=(c*o+h*s+l*n-a*i)*2,r[2]=(l*o+h*i+a*s-c*n)*2),ef(t,e,r),t}function vm(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function rf(t,e){let r=e[0],n=e[1],s=e[2],i=e[4],o=e[5],a=e[6],c=e[8],l=e[9],h=e[10];return t[0]=Math.sqrt(r*r+n*n+s*s),t[1]=Math.sqrt(i*i+o*o+a*a),t[2]=Math.sqrt(c*c+l*l+h*h),t}function Um(t,e){let r=new $(3);rf(r,e);let n=1/r[0],s=1/r[1],i=1/r[2],o=e[0]*n,a=e[1]*s,c=e[2]*i,l=e[4]*n,h=e[5]*s,f=e[6]*i,u=e[8]*n,d=e[9]*s,p=e[10]*i,_=o+h+p,A=0;return _>0?(A=Math.sqrt(_+1)*2,t[3]=.25*A,t[0]=(f-d)/A,t[1]=(u-c)/A,t[2]=(a-l)/A):o>h&&o>p?(A=Math.sqrt(1+o-h-p)*2,t[3]=(f-d)/A,t[0]=.25*A,t[1]=(a+l)/A,t[2]=(u+c)/A):h>p?(A=Math.sqrt(1+h-o-p)*2,t[3]=(u-c)/A,t[0]=(a+l)/A,t[1]=.25*A,t[2]=(f+d)/A):(A=Math.sqrt(1+p-o-h)*2,t[3]=(a-l)/A,t[0]=(u+c)/A,t[1]=(f+d)/A,t[2]=.25*A),t}function Lm(t,e,r,n){e[0]=n[12],e[1]=n[13],e[2]=n[14];let s=n[0],i=n[1],o=n[2],a=n[4],c=n[5],l=n[6],h=n[8],f=n[9],u=n[10];r[0]=Math.sqrt(s*s+i*i+o*o),r[1]=Math.sqrt(a*a+c*c+l*l),r[2]=Math.sqrt(h*h+f*f+u*u);let d=1/r[0],p=1/r[1],_=1/r[2],A=s*d,T=i*p,x=o*_,R=a*d,S=c*p,B=l*_,M=h*d,F=f*p,C=u*_,E=A+S+C,g=0;return E>0?(g=Math.sqrt(E+1)*2,t[3]=.25*g,t[0]=(B-F)/g,t[1]=(M-x)/g,t[2]=(T-R)/g):A>S&&A>C?(g=Math.sqrt(1+A-S-C)*2,t[3]=(B-F)/g,t[0]=.25*g,t[1]=(T+R)/g,t[2]=(M+x)/g):S>C?(g=Math.sqrt(1+S-A-C)*2,t[3]=(M-x)/g,t[0]=(T+R)/g,t[1]=.25*g,t[2]=(B+F)/g):(g=Math.sqrt(1+C-A-S)*2,t[3]=(T-R)/g,t[0]=(M+x)/g,t[1]=(B+F)/g,t[2]=.25*g),t}function Hm(t,e,r,n){let s=e[0],i=e[1],o=e[2],a=e[3],c=s+s,l=i+i,h=o+o,f=s*c,u=s*l,d=s*h,p=i*l,_=i*h,A=o*h,T=a*c,x=a*l,R=a*h,S=n[0],B=n[1],M=n[2];return t[0]=(1-(p+A))*S,t[1]=(u+R)*S,t[2]=(d-x)*S,t[3]=0,t[4]=(u-R)*B,t[5]=(1-(f+A))*B,t[6]=(_+T)*B,t[7]=0,t[8]=(d+x)*M,t[9]=(_-T)*M,t[10]=(1-(f+p))*M,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function Vm(t,e,r,n,s){let i=e[0],o=e[1],a=e[2],c=e[3],l=i+i,h=o+o,f=a+a,u=i*l,d=i*h,p=i*f,_=o*h,A=o*f,T=a*f,x=c*l,R=c*h,S=c*f,B=n[0],M=n[1],F=n[2],C=s[0],E=s[1],g=s[2],y=(1-(_+T))*B,O=(d+S)*B,b=(p-R)*B,N=(d-S)*M,U=(1-(u+T))*M,Y=(A+x)*M,W=(p+R)*F,Q=(A-x)*F,J=(1-(u+_))*F;return t[0]=y,t[1]=O,t[2]=b,t[3]=0,t[4]=N,t[5]=U,t[6]=Y,t[7]=0,t[8]=W,t[9]=Q,t[10]=J,t[11]=0,t[12]=r[0]+C-(y*C+N*E+W*g),t[13]=r[1]+E-(O*C+U*E+Q*g),t[14]=r[2]+g-(b*C+Y*E+J*g),t[15]=1,t}function ca(t,e){let r=e[0],n=e[1],s=e[2],i=e[3],o=r+r,a=n+n,c=s+s,l=r*o,h=n*o,f=n*a,u=s*o,d=s*a,p=s*c,_=i*o,A=i*a,T=i*c;return t[0]=1-f-p,t[1]=h+T,t[2]=u-A,t[3]=0,t[4]=h-T,t[5]=1-l-p,t[6]=d+_,t[7]=0,t[8]=u+A,t[9]=d-_,t[10]=1-l-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function la(t,e,r,n,s,i,o){let a=1/(r-e),c=1/(s-n),l=1/(i-o);return t[0]=i*2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i*2*c,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(s+n)*c,t[10]=(o+i)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*i*2*l,t[15]=0,t}function nf(t,e,r,n,s){let i=1/Math.tan(e/2);if(t[0]=i/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,s!=null&&s!==1/0){let o=1/(n-s);t[10]=(s+n)*o,t[14]=2*s*n*o}else t[10]=-1,t[14]=-2*n;return t}var ha=nf;function Xm(t,e,r,n,s){let i=1/Math.tan(e/2);if(t[0]=i/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,s!=null&&s!==1/0){let o=1/(n-s);t[10]=s*o,t[14]=s*n*o}else t[10]=-1,t[14]=-n;return t}function Wm(t,e,r,n){let s=Math.tan(e.upDegrees*Math.PI/180),i=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),a=Math.tan(e.rightDegrees*Math.PI/180),c=2/(o+a),l=2/(s+i);return t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=l,t[6]=0,t[7]=0,t[8]=-((o-a)*c*.5),t[9]=(s-i)*l*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t}function sf(t,e,r,n,s,i,o){let a=1/(e-r),c=1/(n-s),l=1/(i-o);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+r)*a,t[13]=(s+n)*c,t[14]=(o+i)*l,t[15]=1,t}var fa=sf;function zm(t,e,r,n,s,i,o){let a=1/(e-r),c=1/(n-s),l=1/(i-o);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=l,t[11]=0,t[12]=(e+r)*a,t[13]=(s+n)*c,t[14]=i*l,t[15]=1,t}function ua(t,e,r,n){let s,i,o,a,c,l,h,f,u,d,p=e[0],_=e[1],A=e[2],T=n[0],x=n[1],R=n[2],S=r[0],B=r[1],M=r[2];return Math.abs(p-S)<1e-6&&Math.abs(_-B)<1e-6&&Math.abs(A-M)<1e-6?tf(t):(f=p-S,u=_-B,d=A-M,s=1/Math.sqrt(f*f+u*u+d*d),f*=s,u*=s,d*=s,i=x*d-R*u,o=R*f-T*d,a=T*u-x*f,s=Math.sqrt(i*i+o*o+a*a),s?(s=1/s,i*=s,o*=s,a*=s):(i=0,o=0,a=0),c=u*a-d*o,l=d*i-f*a,h=f*o-u*i,s=Math.sqrt(c*c+l*l+h*h),s?(s=1/s,c*=s,l*=s,h*=s):(c=0,l=0,h=0),t[0]=i,t[1]=c,t[2]=f,t[3]=0,t[4]=o,t[5]=l,t[6]=u,t[7]=0,t[8]=a,t[9]=h,t[10]=d,t[11]=0,t[12]=-(i*p+o*_+a*A),t[13]=-(c*p+l*_+h*A),t[14]=-(f*p+u*_+d*A),t[15]=1,t)}function km(t,e,r,n){let s=e[0],i=e[1],o=e[2],a=n[0],c=n[1],l=n[2],h=s-r[0],f=i-r[1],u=o-r[2],d=h*h+f*f+u*u;d>0&&(d=1/Math.sqrt(d),h*=d,f*=d,u*=d);let p=c*u-l*f,_=l*h-a*u,A=a*f-c*h;return d=p*p+_*_+A*A,d>0&&(d=1/Math.sqrt(d),p*=d,_*=d,A*=d),t[0]=p,t[1]=_,t[2]=A,t[3]=0,t[4]=f*A-u*_,t[5]=u*p-h*A,t[6]=h*_-f*p,t[7]=0,t[8]=h,t[9]=f,t[10]=u,t[11]=0,t[12]=s,t[13]=i,t[14]=o,t[15]=1,t}function Gm(t){return"mat4(".concat(t[0],", ").concat(t[1],", ").concat(t[2],", ").concat(t[3],", ").concat(t[4],", ").concat(t[5],", ").concat(t[6],", ").concat(t[7],", ").concat(t[8],", ").concat(t[9],", ").concat(t[10],", ").concat(t[11],", ").concat(t[12],", ").concat(t[13],", ").concat(t[14],", ").concat(t[15],")")}function Km(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+t[6]*t[6]+t[7]*t[7]+t[8]*t[8]+t[9]*t[9]+t[10]*t[10]+t[11]*t[11]+t[12]*t[12]+t[13]*t[13]+t[14]*t[14]+t[15]*t[15])}function Jm(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t}function of(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}function Ym(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t}function qm(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t}function jm(t,e){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]}function Zm(t,e){let r=t[0],n=t[1],s=t[2],i=t[3],o=t[4],a=t[5],c=t[6],l=t[7],h=t[8],f=t[9],u=t[10],d=t[11],p=t[12],_=t[13],A=t[14],T=t[15],x=e[0],R=e[1],S=e[2],B=e[3],M=e[4],F=e[5],C=e[6],E=e[7],g=e[8],y=e[9],O=e[10],b=e[11],N=e[12],U=e[13],Y=e[14],W=e[15];return Math.abs(r-x)<=1e-6*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(n-R)<=1e-6*Math.max(1,Math.abs(n),Math.abs(R))&&Math.abs(s-S)<=1e-6*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(i-B)<=1e-6*Math.max(1,Math.abs(i),Math.abs(B))&&Math.abs(o-M)<=1e-6*Math.max(1,Math.abs(o),Math.abs(M))&&Math.abs(a-F)<=1e-6*Math.max(1,Math.abs(a),Math.abs(F))&&Math.abs(c-C)<=1e-6*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(l-E)<=1e-6*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(h-g)<=1e-6*Math.max(1,Math.abs(h),Math.abs(g))&&Math.abs(f-y)<=1e-6*Math.max(1,Math.abs(f),Math.abs(y))&&Math.abs(u-O)<=1e-6*Math.max(1,Math.abs(u),Math.abs(O))&&Math.abs(d-b)<=1e-6*Math.max(1,Math.abs(d),Math.abs(b))&&Math.abs(p-N)<=1e-6*Math.max(1,Math.abs(p),Math.abs(N))&&Math.abs(_-U)<=1e-6*Math.max(1,Math.abs(_),Math.abs(U))&&Math.abs(A-Y)<=1e-6*Math.max(1,Math.abs(A),Math.abs(Y))&&Math.abs(T-W)<=1e-6*Math.max(1,Math.abs(T),Math.abs(W))}var Qm=ln,$m=of;function tT(){let t=new $(4);return $!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function af(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function cf(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function lf(t){let e=t[0],r=t[1],n=t[2],s=t[3];return Math.sqrt(e*e+r*r+n*n+s*s)}function hf(t){let e=t[0],r=t[1],n=t[2],s=t[3];return e*e+r*r+n*n+s*s}function ff(t,e){let r=e[0],n=e[1],s=e[2],i=e[3],o=r*r+n*n+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=r*o,t[1]=n*o,t[2]=s*o,t[3]=i*o,t}function uf(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function df(t,e,r,n){let s=e[0],i=e[1],o=e[2],a=e[3];return t[0]=s+n*(r[0]-s),t[1]=i+n*(r[1]-i),t[2]=o+n*(r[2]-o),t[3]=a+n*(r[3]-a),t}function pf(t,e,r){let n=e[0],s=e[1],i=e[2],o=e[3];return t[0]=r[0]*n+r[4]*s+r[8]*i+r[12]*o,t[1]=r[1]*n+r[5]*s+r[9]*i+r[13]*o,t[2]=r[2]*n+r[6]*s+r[10]*i+r[14]*o,t[3]=r[3]*n+r[7]*s+r[11]*i+r[15]*o,t}function gf(t,e,r){let n=e[0],s=e[1],i=e[2],o=r[0],a=r[1],c=r[2],l=r[3],h=l*n+a*i-c*s,f=l*s+c*n-o*i,u=l*i+o*s-a*n,d=-o*n-a*s-c*i;return t[0]=h*l+d*-o+f*-c-u*-a,t[1]=f*l+d*-a+u*-o-h*-c,t[2]=u*l+d*-c+h*-a-f*-o,t[3]=e[3],t}var KF=function(){let t=tT();return function(e,r,n,s,i,o){let a,c;for(r||(r=4),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],t[3]=e[a+3],i(t,t,o),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2],e[a+3]=t[3];return e}}();var ga;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"})(ga||(ga={}));var rT=45*Math.PI/180,nT=1,da=.1,pa=500,sT=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),D=class extends Tr{static get IDENTITY(){return oT()}static get ZERO(){return iT()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return ga}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,r,n,s,i,o,a,c,l,h,f,u,d,p,_,A){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=l,this[9]=h,this[10]=f,this[11]=u,this[12]=d,this[13]=p,this[14]=_,this[15]=A,this.check()}setRowMajor(e,r,n,s,i,o,a,c,l,h,f,u,d,p,_,A){return this[0]=e,this[1]=i,this[2]=l,this[3]=d,this[4]=r,this[5]=o,this[6]=h,this[7]=p,this[8]=n,this[9]=a,this[10]=f,this[11]=_,this[12]=s,this[13]=c,this[14]=u,this[15]=A,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(sT)}fromObject(e){return this.check()}fromQuaternion(e){return ca(this,e),this.check()}frustum(e){let{left:r,right:n,bottom:s,top:i,near:o=da,far:a=pa}=e;return a===1/0?aT(this,r,n,s,i,o):la(this,r,n,s,i,o,a),this.check()}lookAt(e){let{eye:r,center:n=[0,0,0],up:s=[0,1,0]}=e;return ua(this,r,n,s),this.check()}ortho(e){let{left:r,right:n,bottom:s,top:i,near:o=da,far:a=pa}=e;return fa(this,r,n,s,i,o,a),this.check()}orthographic(e){let{fovy:r=rT,aspect:n=nT,focalDistance:s=1,near:i=da,far:o=pa}=e;Af(r);let a=r/2,c=s*Math.tan(a),l=c*n;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:i,far:o})}perspective(e){let{fovy:r=45*Math.PI/180,aspect:n=1,near:s=.1,far:i=500}=e;return Af(r),ha(this,r,n,s,i),this.check()}determinant(){return ea(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],i=1/n[1],o=1/n[2];return e[0]=this[0]*s,e[1]=this[1]*i,e[2]=this[2]*o,e[3]=0,e[4]=this[4]*s,e[5]=this[5]*i,e[6]=this[6]*o,e[7]=0,e[8]=this[8]*s,e[9]=this[9]*i,e[10]=this[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],i=1/n[1],o=1/n[2];return e[0]=this[0]*s,e[1]=this[1]*i,e[2]=this[2]*o,e[3]=this[4]*s,e[4]=this[5]*i,e[5]=this[6]*o,e[6]=this[8]*s,e[7]=this[9]*i,e[8]=this[10]*o,e}transpose(){return $o(this,this),this.check()}invert(){return ta(this,this),this.check()}multiplyLeft(e){return ln(this,e,this),this.check()}multiplyRight(e){return ln(this,this,e),this.check()}rotateX(e){return ia(this,this,e),this.check()}rotateY(e){return oa(this,this,e),this.check()}rotateZ(e){return aa(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,r){return sa(this,this,e,r),this.check()}scale(e){return na(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return ra(this,this,e),this.check()}transform(e,r){return e.length===4?(r=pf(r||[-0,-0,-0,-0],e,this),Se(r,4),r):this.transformAsPoint(e,r)}transformAsPoint(e,r){let{length:n}=e,s;switch(n){case 2:s=ps(r||[-0,-0],e,this);break;case 3:s=We(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Se(s,e.length),s}transformAsVector(e,r){let n;switch(e.length){case 2:n=gs(r||[-0,-0],e,this);break;case 3:n=As(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Se(n,e.length),n}transformPoint(e,r){return this.transformAsPoint(e,r)}transformVector(e,r){return this.transformAsPoint(e,r)}transformDirection(e,r){return this.transformAsVector(e,r)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,r,n){return this.identity().translate([e,r,n])}},Bs,Ms;function iT(){return Bs||(Bs=new D([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Bs)),Bs}function oT(){return Ms||(Ms=new D,Object.freeze(Ms)),Ms}function Af(t){if(t>Math.PI*2)throw Error("expected radians")}function aT(t,e,r,n,s,i){let o=2*i/(r-e),a=2*i/(s-n),c=(r+e)/(r-e),l=(s+n)/(s-n),h=-1,f=-1,u=-2*i;return t[0]=o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=c,t[9]=l,t[10]=h,t[11]=f,t[12]=0,t[13]=0,t[14]=u,t[15]=0,t}function _f(){let t=new $(4);return $!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function mf(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function Aa(t,e,r){r=r*.5;let n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t}function _a(t,e,r){let n=e[0],s=e[1],i=e[2],o=e[3],a=r[0],c=r[1],l=r[2],h=r[3];return t[0]=n*h+o*a+s*l-i*c,t[1]=s*h+o*c+i*a-n*l,t[2]=i*h+o*l+n*c-s*a,t[3]=o*h-n*a-s*c-i*l,t}function Tf(t,e,r){r*=.5;let n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c+o*a,t[1]=s*c+i*a,t[2]=i*c-s*a,t[3]=o*c-n*a,t}function Ef(t,e,r){r*=.5;let n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c-i*a,t[1]=s*c+o*a,t[2]=i*c+n*a,t[3]=o*c-s*a,t}function Rf(t,e,r){r*=.5;let n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c+s*a,t[1]=s*c-n*a,t[2]=i*c+o*a,t[3]=o*c-i*a,t}function xf(t,e){let r=e[0],n=e[1],s=e[2];return t[0]=r,t[1]=n,t[2]=s,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-s*s)),t}function hn(t,e,r,n){let s=e[0],i=e[1],o=e[2],a=e[3],c=r[0],l=r[1],h=r[2],f=r[3],u,d,p,_,A;return u=s*c+i*l+o*h+a*f,u<0&&(u=-u,c=-c,l=-l,h=-h,f=-f),1-u>1e-6?(d=Math.acos(u),A=Math.sin(d),p=Math.sin((1-n)*d)/A,_=Math.sin(n*d)/A):(p=1-n,_=n),t[0]=p*s+_*c,t[1]=p*i+_*l,t[2]=p*o+_*h,t[3]=p*a+_*f,t}function Sf(t,e){let r=e[0],n=e[1],s=e[2],i=e[3],o=r*r+n*n+s*s+i*i,a=o?1/o:0;return t[0]=-r*a,t[1]=-n*a,t[2]=-s*a,t[3]=i*a,t}function Cf(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function ma(t,e){let r=e[0]+e[4]+e[8],n;if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{let s=0;e[4]>e[0]&&(s=1),e[8]>e[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;n=Math.sqrt(e[s*3+s]-e[i*3+i]-e[o*3+o]+1),t[s]=.5*n,n=.5/n,t[3]=(e[i*3+o]-e[o*3+i])*n,t[i]=(e[i*3+s]+e[s*3+i])*n,t[o]=(e[o*3+s]+e[s*3+o])*n}return t}var Bf=af;var Mf=cf,yf=uf,If=df,Ff=lf;var Nf=hf;var Of=ff;var bf=function(){let t=ms(),e=Ts(1,0,0),r=Ts(0,1,0);return function(n,s,i){let o=on(s,i);return o<-.999999?(Xe(t,e,s),Yo(t)<1e-6&&Xe(t,r,s),zo(t,t),Aa(n,t,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Xe(t,s,i),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+o,Of(n,n))}}(),oN=function(){let t=_f(),e=_f();return function(r,n,s,i,o,a){return hn(t,n,o,a),hn(e,s,i,a),hn(r,t,e,2*a*(1-a)),r}}(),aN=function(){let t=Jh();return function(e,r,n,s){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=s[0],t[4]=s[1],t[7]=s[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],Of(e,ma(e,t))}}();var cT=[0,0,0,1],Zt=class extends xe{constructor(e=0,r=0,n=0,s=1){super(-0,-0,-0,-0),Array.isArray(e)&&arguments.length===1?this.copy(e):this.set(e,r,n,s)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,r,n,s){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this.check()}fromObject(e){return this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this.check()}fromMatrix3(e){return ma(this,e),this.check()}fromAxisRotation(e,r){return Aa(this,e,r),this.check()}identity(){return mf(this),this.check()}setAxisAngle(e,r){return this.fromAxisRotation(e,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=H(e)}get y(){return this[1]}set y(e){this[1]=H(e)}get z(){return this[2]}set z(e){this[2]=H(e)}get w(){return this[3]}set w(e){this[3]=H(e)}len(){return Ff(this)}lengthSquared(){return Nf(this)}dot(e){return yf(this,e)}rotationTo(e,r){return bf(this,e,r),this.check()}add(e){return Bf(this,this,e),this.check()}calculateW(){return xf(this,this),this.check()}conjugate(){return Cf(this,this),this.check()}invert(){return Sf(this,this),this.check()}lerp(e,r,n){return n===void 0?this.lerp(this,e,r):(If(this,e,r,n),this.check())}multiplyRight(e){return _a(this,this,e),this.check()}multiplyLeft(e){return _a(this,e,this),this.check()}normalize(){let e=this.len(),r=e>0?1/e:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,e===0&&(this[3]=1),this.check()}rotateX(e){return Tf(this,this,e),this.check()}rotateY(e){return Ef(this,this,e),this.check()}rotateZ(e){return Rf(this,this,e),this.check()}scale(e){return Mf(this,this,e),this.check()}slerp(e,r,n){let s,i,o;switch(arguments.length){case 1:({start:s=cT,target:i,ratio:o}=e);break;case 2:s=this,i=e,o=r;break;default:s=e,i=r,o=n}return hn(this,s,i,o),this.check()}transformVector4(e,r=new mr){return gf(r,e,this),Se(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,r){return this.setAxisAngle(e,r)}premultiply(e){return this.multiplyLeft(e)}multiply(e){return this.multiplyRight(e)}};var Ht={};ht(Ht,{EPSILON1:()=>lT,EPSILON10:()=>mT,EPSILON11:()=>TT,EPSILON12:()=>ET,EPSILON13:()=>RT,EPSILON14:()=>xT,EPSILON15:()=>ST,EPSILON16:()=>CT,EPSILON17:()=>BT,EPSILON18:()=>MT,EPSILON19:()=>yT,EPSILON2:()=>hT,EPSILON20:()=>IT,EPSILON3:()=>fT,EPSILON4:()=>uT,EPSILON5:()=>dT,EPSILON6:()=>pT,EPSILON7:()=>gT,EPSILON8:()=>AT,EPSILON9:()=>_T,PI_OVER_FOUR:()=>NT,PI_OVER_SIX:()=>OT,PI_OVER_TWO:()=>FT,TWO_PI:()=>bT});var lT=.1,hT=.01,fT=.001,uT=1e-4,dT=1e-5,pT=1e-6,gT=1e-7,AT=1e-8,_T=1e-9,mT=1e-10,TT=1e-11,ET=1e-12,RT=1e-13,xT=1e-14,ST=1e-15,CT=1e-16,BT=1e-17,MT=1e-18,yT=1e-19,IT=1e-20,FT=Math.PI/2,NT=Math.PI/4,OT=Math.PI/6,bT=Math.PI*2;function ys(t,e){if(!t)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}var Vt=Math.PI,vf=Vt/4,Pf=Vt/180,Df=180/Vt,Is=512;function oe(t){let[e,r]=t;ys(Number.isFinite(e)),ys(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let n=e*Pf,s=r*Pf,i=Is*(n+Vt)/(2*Vt),o=Is*(Vt+Math.log(Math.tan(vf+s*.5)))/(2*Vt);return[i,o]}function ae(t){let[e,r]=t,n=e/Is*(2*Vt)-Vt,s=2*(Math.atan(Math.exp(r/Is*(2*Vt)-Vt))-vf);return[n*Df,s*Df]}var kN=Math.PI/180;var Lf=6378137*Math.PI;function Ta(t){let e=oe(t);return e[0]=(e[0]/256-1)*Lf,e[1]=(e[1]/256-1)*Lf,e}var YT={id:"imagery-layer",data:"",serviceType:"auto",srs:"auto",layers:{type:"array",compare:!0,value:[]},onMetadataLoad:{type:"function",value:()=>{}},onMetadataLoadError:{type:"function",value:console.error},onImageLoadStart:{type:"function",value:()=>{}},onImageLoad:{type:"function",value:()=>{}},onImageLoadError:{type:"function",compare:!1,value:(t,e)=>console.error(e,t)}},Ns=class extends ze.CompositeLayer{get isLoaded(){return this.state?.loadCounter===0&&super.isLoaded}shouldUpdateState(){return!0}initializeState(){this.state._nextRequestId=0,this.state.lastRequestId=-1,this.state.loadCounter=0}updateState({changeFlags:e,props:r,oldProps:n}){let{viewport:s}=this.context;e.dataChanged||r.serviceType!==n.serviceType?(this.state.imageSource=this._createImageSource(r),this._loadMetadata(),this.debounce(()=>this.loadImage(s,"image source changed"),0)):(0,ze._deepEqual)(r.layers,n.layers,1)?e.viewportChanged&&this.debounce(()=>this.loadImage(s,"viewport changed")):this.debounce(()=>this.loadImage(s,"layers changed"),0)}finalizeState(){}renderLayers(){let{bounds:e,image:r,lastRequestParameters:n}=this.state;return r&&new Hf.BitmapLayer({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:n.srs==="EPSG:4326"?ze.COORDINATE_SYSTEM.LNGLAT:ze.COORDINATE_SYSTEM.CARTESIAN,bounds:e,image:r})}async getFeatureInfoText(e,r){let{lastRequestParameters:n}=this.state;return n?await this.state.imageSource.getFeatureInfoText?.({...n,query_layers:n.layers,x:e,y:r,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(e){if(e.data instanceof Nt)return e.data;if(typeof e.data=="string")return Lo({url:e.data,loadOptions:e.loadOptions,type:e.serviceType});throw new Error("invalid image source in props.data")}async _loadMetadata(){let{imageSource:e}=this.state;try{this.state.loadCounter++;let r=await e.getMetadata();this.state.imageSource===e&&this.getCurrentLayer()?.props.onMetadataLoad(r)}catch(r){this.getCurrentLayer()?.props.onMetadataLoadError(r)}finally{this.state.loadCounter--}}async loadImage(e,r){let{layers:n,serviceType:s}=this.props;if(s==="wms"&&n.length===0)return;let i=e.getBounds(),{width:o,height:a}=e,c=this.getRequestId(),{srs:l}=this.props;l==="auto"&&(l=e.resolution?"EPSG:4326":"EPSG:3857");let h={width:o,height:a,boundingBox:[[i[0],i[1]],[i[2],i[3]]],layers:n,crs:l};if(l==="EPSG:3857"){let f=Ta([i[0],i[1]]),u=Ta([i[2],i[3]]);h.boundingBox=[f,u]}try{this.state.loadCounter++,this.props.onImageLoadStart(c);let f=await this.state.imageSource.getImage(h);this.state.lastRequestId<c&&(this.getCurrentLayer()?.props.onImageLoad(c),this.setState({image:f,bounds:i,lastRequestParameters:h,lastRequestId:c}))}catch(f){this.raiseError(f,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(c,f)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(e,r=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>e(),r)}},Fs=Ns;(()=>{Ns.layerName="WMSLayer"})(),(()=>{Ns.defaultProps=YT})();var Vf=v(Ut(),1),qT={getHeight:{type:"accessor",value:0},greatCircle:!0},Os=class extends Vf.ArcLayer{},fn=Os;(()=>{Os.layerName="GreatCircleLayer"})(),(()=>{Os.defaultProps=qT})();var Xf=v(Lt(),1),Ea=v(Ut(),1),jT={...Ea.PolygonLayer.defaultProps},bs=class extends Xf.CompositeLayer{indexToBounds(){return null}renderLayers(){let{elevationScale:e,extruded:r,wireframe:n,filled:s,stroked:i,lineWidthUnits:o,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:h,lineMiterLimit:f,lineDashJustified:u,getElevation:d,getFillColor:p,getLineColor:_,getLineWidth:A}=this.props,{updateTriggers:T,material:x,transitions:R}=this.props,S=this.getSubLayerClass("cell",Ea.PolygonLayer),{updateTriggers:B,...M}=this.indexToBounds()||{};return new S({filled:s,wireframe:n,extruded:r,elevationScale:e,stroked:i,lineWidthUnits:o,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:h,lineMiterLimit:f,lineDashJustified:u,material:x,transitions:R,getElevation:d,getFillColor:p,getLineColor:_,getLineWidth:A},this.getSubLayerProps({id:"cell",updateTriggers:T&&{...B,getElevation:T.getElevation,getFillColor:T.getFillColor,getLineColor:T.getLineColor,getLineWidth:T.getLineWidth}}),M)}},It=bs;(()=>{bs.layerName="GeoCellLayer"})(),(()=>{bs.defaultProps=jT})();var Ps=v(Ra(),1),ZT=3,QT=30,$T=2*QT+1,zf=180/Math.PI;function Gf(t,e,r){let n=1<<e;return[(t[0]+r[0])/n,(t[1]+r[1])/n]}function kf(t){return t>=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function Kf(t){return[kf(t[0]),kf(t[1])]}function Jf(t,[e,r]){switch(t){case 0:return[1,e,r];case 1:return[-e,1,r];case 2:return[-e,-r,1];case 3:return[-1,-r,-e];case 4:return[r,-1,-e];case 5:return[r,e,-1];default:throw new Error("Invalid face")}}function Yf([t,e,r]){let n=Math.atan2(r,Math.sqrt(t*t+e*e));return[Math.atan2(e,t)*zf,n*zf]}function qf(t){let e=Ps.default.fromString(t,!0,10).toString(2);for(;e.length<ZT+$T;)e="0"+e;let r=e.lastIndexOf("1"),n=e.substring(0,3),s=e.substring(3,r),i=s.length/2,o=Ps.default.fromString(n,!0,2).toString(10),a=Ps.default.fromString(s,!0,2).toString(4);for(;a.length<i;)a="0"+a;return`${o}/${a}`}function t1(t,e,r,n){if(n===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);let s=e[0];e[0]=e[1],e[1]=s}}function jf(t){let e=t.split("/"),r=parseInt(e[0],10),n=e[1],s=n.length,i=[0,0],o;for(let a=s-1;a>=0;a--){o=s-a;let c=n[a],l=0,h=0;c==="1"?h=1:c==="2"?(l=1,h=1):c==="3"&&(l=1);let f=Math.pow(2,o-1);t1(f,i,l,h),i[0]+=f*l,i[1]+=f*h}if(r%2===1){let a=i[0];i[0]=i[1],i[1]=a}return{face:r,ij:i,level:o}}var Zf=v(Ra(),1);function e1(t){let e=t.padEnd(16,"0");return Zf.default.fromString(e,16)}var r1=100;function n1({face:t,ij:e,level:r}){let n=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(r1*Math.pow(2,-r))),i=new Float64Array(4*s*2+2),o=0,a=0;for(let c=0;c<4;c++){let l=n[c].slice(0),h=n[c+1],f=(h[0]-l[0])/s,u=(h[1]-l[1])/s;for(let d=0;d<s;d++){l[0]+=f,l[1]+=u;let p=Gf(e,r,l),_=Kf(p),A=Jf(t,_),T=Yf(A);Math.abs(T[1])>89.999&&(T[0]=a);let x=T[0]-a;T[0]+=x>180?-360:x<-180?360:0,i[o++]=T[0],i[o++]=T[1],a=T[0]}}return i[o++]=i[0],i[o++]=i[1],i}function s1(t){if(typeof t=="string"){if(t.indexOf("/")>0)return t;t=e1(t)}return qf(t.toString())}function Qf(t){let e=s1(t),r=jf(e);return n1(r)}var i1={getS2Token:{type:"accessor",value:t=>t.token}},Ds=class extends It{indexToBounds(){let{data:e,getS2Token:r}=this.props;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(n,s)=>Qf(r(n,s))}}},dn=Ds;(()=>{Ds.layerName="S2Layer"})(),(()=>{Ds.defaultProps=i1})();var xa=512;function o1(t,e){let r=0,n=0,s=1<<t.length,i=s/xa;for(let o=0;o<t.length;o++){s>>=1;let a=parseInt(t[o]);a%2&&(r|=s),a>1&&(n|=s)}return[[r/i,xa-n/i],[(r+e)/i,xa-(n+e)/i]]}function $f(t,e=1){let[r,n]=o1(t,e),[s,i]=ae(r),[o,a]=ae(n);return[o,i,o,a,s,a,s,i,o,i]}var a1={getQuadkey:{type:"accessor",value:t=>t.quadkey}},ws=class extends It{indexToBounds(){let{data:e,extruded:r,getQuadkey:n}=this.props,s=r?.99:1;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(i,o)=>$f(n(i,o),s),updateTriggers:{getPolygon:s}}}},pn=ws;(()=>{ws.layerName="QuadkeyLayer"})(),(()=>{ws.defaultProps=a1})();var zs=v(Lt(),1),_u=v(Ut(),1);var ke=class{constructor(e){this.index=e,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(e){this._bbox||(this._bbox=e,"west"in e?this.boundingBox=[[e.west,e.south],[e.east,e.north]]:this.boundingBox=[[e.left,e.top],[e.right,e.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let e=this.content?this.content.byteLength:0;return Number.isFinite(e)||console.error("byteLength not defined in tile data"),e}async _loadData({getData:e,requestScheduler:r,onLoad:n,onError:s}){let{index:i,id:o,bbox:a,userData:c,zoom:l}=this,h=this._loaderId;this._abortController=new AbortController;let{signal:f}=this._abortController,u=await r.scheduleRequest(this,_=>_.isSelected?1:-1);if(!u){this._isCancelled=!0;return}if(this._isCancelled){u.done();return}let d=null,p;try{d=await e({index:i,id:o,bbox:a,userData:c,zoom:l,signal:f})}catch(_){p=_||!0}finally{u.done()}if(h===this._loaderId){if(this._loader=void 0,this.content=d,this._isCancelled&&!d){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,p?s(p,this):n(this)}}loadData(e){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(e),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var _n=v(Lt(),1);var nt={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var tu=new m,c1=new m,Be=class{constructor(e=[0,0,0],r=[0,0,0],n){P(this,"center",void 0),P(this,"halfDiagonal",void 0),P(this,"minimum",void 0),P(this,"maximum",void 0),n=n||tu.copy(e).add(r).scale(.5),this.center=new m(n),this.halfDiagonal=new m(r).subtract(this.center),this.minimum=new m(e),this.maximum=new m(r)}clone(){return new Be(this.minimum,this.maximum,this.center)}equals(e){return this===e||Boolean(e)&&this.minimum.equals(e.minimum)&&this.maximum.equals(e.maximum)}transform(e){return this.center.transformAsPoint(e),this.halfDiagonal.transform(e),this.minimum.transform(e),this.maximum.transform(e),this}intersectPlane(e){let{halfDiagonal:r}=this,n=c1.from(e.normal),s=r.x*Math.abs(n.x)+r.y*Math.abs(n.y)+r.z*Math.abs(n.z),i=this.center.dot(n)+e.distance;return i-s>0?nt.INSIDE:i+s<0?nt.OUTSIDE:nt.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=tu.from(e).subtract(this.center),{halfDiagonal:n}=this,s=0,i;return i=Math.abs(r.x)-n.x,i>0&&(s+=i*i),i=Math.abs(r.y)-n.y,i>0&&(s+=i*i),i=Math.abs(r.z)-n.z,i>0&&(s+=i*i),s}};var gn=new m,eu=new m,Ot=class{constructor(e=[0,0,0],r=0){P(this,"center",void 0),P(this,"radius",void 0),this.radius=-0,this.center=new m,this.fromCenterRadius(e,r)}fromCenterRadius(e,r){return this.center.from(e),this.radius=r,this}fromCornerPoints(e,r){return r=gn.from(r),this.center=new m().from(e).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new Ot(this.center,this.radius)}union(e){let r=this.center,n=this.radius,s=e.center,i=e.radius,o=gn.copy(s).subtract(r),a=o.magnitude();if(n>=a+i)return this.clone();if(i>=a+n)return e.clone();let c=(n+a+i)*.5;return eu.copy(o).scale((-n+c)/a).add(r),this.center.copy(eu),this.radius=c,this}expand(e){let n=gn.from(e).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(e){this.center.transform(e);let r=Cs.getScaling(gn,e);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(e){let r=this.distanceTo(e);return r*r}distanceTo(e){let n=gn.from(e).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(e){let r=this.center,n=this.radius,i=e.normal.dot(r)+e.distance;return i<-n?nt.OUTSIDE:i<n?nt.INTERSECTING:nt.INSIDE}};var l1=new m,h1=new m,vs=new m,Us=new m,Ls=new m,f1=new m,u1=new m,ce={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Xt=class{constructor(e=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){P(this,"center",void 0),P(this,"halfAxes",void 0),this.center=new m().from(e),this.halfAxes=new z(r)}get halfSize(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new m(e).len(),new m(r).len(),new m(n).len()]}get quaternion(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),s=new m(e).normalize(),i=new m(r).normalize(),o=new m(n).normalize();return new Zt().fromMatrix3(new z([...s,...i,...o]))}fromCenterHalfSizeQuaternion(e,r,n){let s=new Zt(n),i=new z().fromQuaternion(s);return i[0]=i[0]*r[0],i[1]=i[1]*r[0],i[2]=i[2]*r[0],i[3]=i[3]*r[1],i[4]=i[4]*r[1],i[5]=i[5]*r[1],i[6]=i[6]*r[2],i[7]=i[7]*r[2],i[8]=i[8]*r[2],this.center=new m().from(e),this.halfAxes=i,this}clone(){return new Xt(this.center,this.halfAxes)}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new Ot){let r=this.halfAxes,n=r.getColumn(0,vs),s=r.getColumn(1,Us),i=r.getColumn(2,Ls),o=l1.copy(n).add(s).add(i);return e.center.copy(this.center),e.radius=o.magnitude(),e}intersectPlane(e){let r=this.center,n=e.normal,s=this.halfAxes,i=n.x,o=n.y,a=n.z,c=Math.abs(i*s[ce.COLUMN0ROW0]+o*s[ce.COLUMN0ROW1]+a*s[ce.COLUMN0ROW2])+Math.abs(i*s[ce.COLUMN1ROW0]+o*s[ce.COLUMN1ROW1]+a*s[ce.COLUMN1ROW2])+Math.abs(i*s[ce.COLUMN2ROW0]+o*s[ce.COLUMN2ROW1]+a*s[ce.COLUMN2ROW2]),l=n.dot(r)+e.distance;return l<=-c?nt.OUTSIDE:l>=c?nt.INSIDE:nt.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=h1.from(e).subtract(this.center),n=this.halfAxes,s=n.getColumn(0,vs),i=n.getColumn(1,Us),o=n.getColumn(2,Ls),a=s.magnitude(),c=i.magnitude(),l=o.magnitude();s.normalize(),i.normalize(),o.normalize();let h=0,f;return f=Math.abs(r.dot(s))-a,f>0&&(h+=f*f),f=Math.abs(r.dot(i))-c,f>0&&(h+=f*f),f=Math.abs(r.dot(o))-l,f>0&&(h+=f*f),h}computePlaneDistances(e,r,n=[-0,-0]){let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=this.center,a=this.halfAxes,c=a.getColumn(0,vs),l=a.getColumn(1,Us),h=a.getColumn(2,Ls),f=f1.copy(c).add(l).add(h).add(o),u=u1.copy(f).subtract(e),d=r.dot(u);return s=Math.min(d,s),i=Math.max(d,i),f.copy(o).add(c).add(l).subtract(h),u.copy(f).subtract(e),d=r.dot(u),s=Math.min(d,s),i=Math.max(d,i),f.copy(o).add(c).subtract(l).add(h),u.copy(f).subtract(e),d=r.dot(u),s=Math.min(d,s),i=Math.max(d,i),f.copy(o).add(c).subtract(l).subtract(h),u.copy(f).subtract(e),d=r.dot(u),s=Math.min(d,s),i=Math.max(d,i),o.copy(f).subtract(c).add(l).add(h),u.copy(f).subtract(e),d=r.dot(u),s=Math.min(d,s),i=Math.max(d,i),o.copy(f).subtract(c).add(l).subtract(h),u.copy(f).subtract(e),d=r.dot(u),s=Math.min(d,s),i=Math.max(d,i),o.copy(f).subtract(c).subtract(l).add(h),u.copy(f).subtract(e),d=r.dot(u),s=Math.min(d,s),i=Math.max(d,i),o.copy(f).subtract(c).subtract(l).subtract(h),u.copy(f).subtract(e),d=r.dot(u),s=Math.min(d,s),i=Math.max(d,i),n[0]=s,n[1]=i,n}transform(e){this.center.transformAsPoint(e);let r=this.halfAxes.getColumn(0,vs);r.transformAsPoint(e);let n=this.halfAxes.getColumn(1,Us);n.transformAsPoint(e);let s=this.halfAxes.getColumn(2,Ls);return s.transformAsPoint(e),this.halfAxes=new z([...r,...n,...s]),this}getTransform(){throw new Error("not implemented")}};var ru=new m,nu=new m,lt=class{constructor(e=[0,0,1],r=0){P(this,"normal",void 0),P(this,"distance",void 0),this.normal=new m,this.distance=-0,this.fromNormalDistance(e,r)}fromNormalDistance(e,r){return ct(Number.isFinite(r)),this.normal.from(e).normalize(),this.distance=r,this}fromPointNormal(e,r){e=ru.from(e),this.normal.from(r).normalize();let n=-this.normal.dot(e);return this.distance=n,this}fromCoefficients(e,r,n,s){return this.normal.set(e,r,n),ct(At(this.normal.len(),1)),this.distance=s,this}clone(){return new lt(this.normal,this.distance)}equals(e){return At(this.distance,e.distance)&&At(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){let r=nu.copy(this.normal).transformAsVector(e).normalize(),n=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(n,r)}projectPointOntoPlane(e,r=[0,0,0]){let n=ru.from(e),s=this.getPointDistance(n),i=nu.copy(this.normal).scale(s);return n.subtract(i).to(r)}};var su=[new m([1,0,0]),new m([0,1,0]),new m([0,0,1])],iu=new m,d1=new m,ot=class{constructor(e=[]){P(this,"planes",void 0),this.planes=e}fromBoundingSphere(e){this.planes.length=2*su.length;let r=e.center,n=e.radius,s=0;for(let i of su){let o=this.planes[s],a=this.planes[s+1];o||(o=this.planes[s]=new lt),a||(a=this.planes[s+1]=new lt);let c=iu.copy(i).scale(-n).add(r);o.fromPointNormal(c,i);let l=iu.copy(i).scale(n).add(r),h=d1.copy(i).negate();a.fromPointNormal(l,h),s+=2}return this}computeVisibility(e){let r=nt.INSIDE;for(let n of this.planes)switch(e.intersectPlane(n)){case nt.OUTSIDE:return nt.OUTSIDE;case nt.INTERSECTING:r=nt.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(e,r){if(ct(Number.isFinite(r),"parentPlaneMask is required."),r===ot.MASK_OUTSIDE||r===ot.MASK_INSIDE)return r;let n=ot.MASK_INSIDE,s=this.planes;for(let i=0;i<this.planes.length;++i){let o=i<31?1<<i:0;if(i<31&&!(r&o))continue;let a=s[i],c=e.intersectPlane(a);if(c===nt.OUTSIDE)return ot.MASK_OUTSIDE;c===nt.INTERSECTING&&(n|=o)}return n}};P(ot,"MASK_OUTSIDE",4294967295);P(ot,"MASK_INSIDE",0);P(ot,"MASK_INDETERMINATE",2147483647);var p2=new m,g2=new m,A2=new m,_2=new m,m2=new m;var B2=new m,M2=new m,y2=new m,I2=new m,F2=new m,N2=new m,O2=new m,b2=new m,P2=new m,D2=new m,w2=new m,v2=new m;var Qt=new z,g1=new z,A1=new z,Hs=new z,ou=new z;function Ba(t,e={}){let r=Ht.EPSILON20,n=10,s=0,i=0,o=g1,a=A1;o.identity(),a.copy(t);let c=r*_1(a);for(;i<n&&m1(a)>c;)T1(a,Hs),ou.copy(Hs).transpose(),a.multiplyRight(Hs),a.multiplyLeft(ou),o.multiplyRight(Hs),++s>2&&(++i,s=0);return e.unitary=o.toTarget(e.unitary),e.diagonal=a.toTarget(e.diagonal),e}function _1(t){let e=0;for(let r=0;r<9;++r){let n=t[r];e+=n*n}return Math.sqrt(e)}var Sa=[1,0,0],Ca=[2,2,1];function m1(t){let e=0;for(let r=0;r<3;++r){let n=t[Qt.getElementIndex(Ca[r],Sa[r])];e+=2*n*n}return Math.sqrt(e)}function T1(t,e){let r=Ht.EPSILON15,n=0,s=1;for(let l=0;l<3;++l){let h=Math.abs(t[Qt.getElementIndex(Ca[l],Sa[l])]);h>n&&(s=l,n=h)}let i=Sa[s],o=Ca[s],a=1,c=0;if(Math.abs(t[Qt.getElementIndex(o,i)])>r){let l=t[Qt.getElementIndex(o,o)],h=t[Qt.getElementIndex(i,i)],f=t[Qt.getElementIndex(o,i)],u=(l-h)/2/f,d;u<0?d=-1/(-u+Math.sqrt(1+u*u)):d=1/(u+Math.sqrt(1+u*u)),a=1/Math.sqrt(1+d*d),c=d*a}return z.IDENTITY.to(e),e[Qt.getElementIndex(i,i)]=e[Qt.getElementIndex(o,o)]=a,e[Qt.getElementIndex(o,i)]=c,e[Qt.getElementIndex(i,o)]=-c,e}var Me=new m,E1=new m,R1=new m,x1=new m,S1=new m,C1=new z,B1={diagonal:new z,unitary:new z};function An(t,e=new Xt){if(!t||t.length===0)return e.halfAxes=new z([0,0,0,0,0,0,0,0,0]),e.center=new m,e;let r=t.length,n=new m(0,0,0);for(let E of t)n.add(E);let s=1/r;n.multiplyByScalar(s);let i=0,o=0,a=0,c=0,l=0,h=0;for(let E of t){let g=Me.copy(E).subtract(n);i+=g.x*g.x,o+=g.x*g.y,a+=g.x*g.z,c+=g.y*g.y,l+=g.y*g.z,h+=g.z*g.z}i*=s,o*=s,a*=s,c*=s,l*=s,h*=s;let f=C1;f[0]=i,f[1]=o,f[2]=a,f[3]=o,f[4]=c,f[5]=l,f[6]=a,f[7]=l,f[8]=h;let{unitary:u}=Ba(f,B1),d=e.halfAxes.copy(u),p=d.getColumn(0,R1),_=d.getColumn(1,x1),A=d.getColumn(2,S1),T=-Number.MAX_VALUE,x=-Number.MAX_VALUE,R=-Number.MAX_VALUE,S=Number.MAX_VALUE,B=Number.MAX_VALUE,M=Number.MAX_VALUE;for(let E of t)Me.copy(E),T=Math.max(Me.dot(p),T),x=Math.max(Me.dot(_),x),R=Math.max(Me.dot(A),R),S=Math.min(Me.dot(p),S),B=Math.min(Me.dot(_),B),M=Math.min(Me.dot(A),M);p=p.multiplyByScalar(.5*(S+T)),_=_.multiplyByScalar(.5*(B+x)),A=A.multiplyByScalar(.5*(M+R)),e.center.copy(p).add(_).add(A);let F=E1.set(T-S,x-B,R-M).multiplyByScalar(.5),C=new z([F[0],0,0,0,F[1],0,0,0,F[2]]);return e.halfAxes.multiplyRight(C),e}var Er=512,au=3,cu=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],lu=cu.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),M1=lu.concat([[.25,.5],[.75,.5]]),ye=class{constructor(e,r,n){this.x=e,this.y=r,this.z=n}get children(){if(!this._children){let e=this.x*2,r=this.y*2,n=this.z+1;this._children=[new ye(e,r,n),new ye(e,r+1,n),new ye(e+1,r,n),new ye(e+1,r+1,n)]}return this._children}update(e){let{viewport:r,cullingVolume:n,elevationBounds:s,minZ:i,maxZ:o,bounds:a,offset:c,project:l}=e,h=this.getBoundingVolume(s,c,l);if(a&&!this.insideBounds(a)||n.computeVisibility(h)<0)return!1;if(!this.childVisible){let{z:u}=this;if(u<o&&u>=i){let d=h.distanceTo(r.cameraPosition)*r.scale/r.height;u+=Math.floor(Math.log2(d))}if(u>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let u of this.children)u.update(e);return!0}getSelected(e=[]){if(this.selected&&e.push(this),this._children)for(let r of this._children)r.getSelected(e);return e}insideBounds([e,r,n,s]){let i=Math.pow(2,this.z),o=Er/i;return this.x*o<n&&this.y*o<s&&(this.x+1)*o>e&&(this.y+1)*o>r}getBoundingVolume(e,r,n){if(n){let c=this.z<1?M1:this.z<2?lu:cu,l=[];for(let h of c){let f=Vs(this.x+h[0],this.y+h[1],this.z);f[2]=e[0],l.push(n(f)),e[0]!==e[1]&&(f[2]=e[1],l.push(n(f)))}return An(l)}let s=Math.pow(2,this.z),i=Er/s,o=this.x*i+r*Er,a=Er-(this.y+1)*i;return new Be([o,a,e[0]],[o+i,a+i,e[1]])}};function hu(t,e,r,n){let s=t instanceof _n._GlobeViewport&&t.resolution?t.projectPosition:null,i=Object.values(t.getFrustumPlanes()).map(({normal:d,distance:p})=>new lt(d.clone().negate(),p)),o=new ot(i),a=t.distanceScales.unitsPerMeter[2],c=r&&r[0]*a||0,l=r&&r[1]*a||0,h=t instanceof _n.WebMercatorViewport&&t.pitch<=60?e:0;if(n){let[d,p,_,A]=n,T=oe([d,A]),x=oe([_,p]);n=[T[0],Er-T[1],x[0],Er-x[1]]}let f=new ye(0,0,0),u={viewport:t,project:s,cullingVolume:o,elevationBounds:[c,l],minZ:h,maxZ:e,bounds:n,offset:0};if(f.update(u),t instanceof _n.WebMercatorViewport&&t.subViewports&&t.subViewports.length>1){for(u.offset=-1;f.update(u)&&!(--u.offset<-au););for(u.offset=1;f.update(u)&&!(++u.offset>au););}return f.getSelected()}var le=512,y1=[-1/0,-1/0,1/0,1/0],Ie={type:"object",value:null,validate:(t,e)=>e.optional&&t===null||typeof t=="string"||Array.isArray(t)&&t.every(r=>typeof r=="string"),equal:(t,e)=>{if(t===e)return!0;if(!Array.isArray(t)||!Array.isArray(e))return!1;let r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}};function uu(t,e){let r=[e.transformAsPoint([t[0],t[1]]),e.transformAsPoint([t[2],t[1]]),e.transformAsPoint([t[0],t[3]]),e.transformAsPoint([t[2],t[3]])];return[Math.min(...r.map(s=>s[0])),Math.min(...r.map(s=>s[1])),Math.max(...r.map(s=>s[0])),Math.max(...r.map(s=>s[1]))]}function I1(t){return Math.abs(t.split("").reduce((e,r)=>(e<<5)-e+r.charCodeAt(0)|0,0))}function $t(t,e){if(!t||!t.length)return null;let{index:r,id:n}=e;if(Array.isArray(t)){let i=I1(n)%t.length;t=t[i]}let s=t;for(let i of Object.keys(r)){let o=new RegExp(`{${i}}`,"g");s=s.replace(o,String(r[i]))}return Number.isInteger(r.y)&&Number.isInteger(r.z)&&(s=s.replace(/\{-y\}/g,String(Math.pow(2,r.z)-r.y-1))),s}function F1(t,e,r){let n;if(e&&e.length===2){let[s,i]=e,o=t.getBounds({z:s}),a=t.getBounds({z:i});n=[Math.min(o[0],a[0]),Math.min(o[1],a[1]),Math.max(o[2],a[2]),Math.max(o[3],a[3])]}else n=t.getBounds();return t.isGeospatial?[Math.max(n[0],r[0]),Math.max(n[1],r[1]),Math.min(n[2],r[2]),Math.min(n[3],r[3])]:[Math.max(Math.min(n[0],r[2]),r[0]),Math.max(Math.min(n[1],r[3]),r[1]),Math.min(Math.max(n[2],r[0]),r[2]),Math.min(Math.max(n[3],r[1]),r[3])]}function du({viewport:t,z:e,cullRect:r}){return(t.subViewports||[t]).map(s=>Ma(s,e||0,r))}function Ma(t,e,r){if(!Array.isArray(e)){let i=r.x-t.x,o=r.y-t.y,{width:a,height:c}=r,l={targetZ:e},h=t.unproject([i,o],l),f=t.unproject([i+a,o],l),u=t.unproject([i,o+c],l),d=t.unproject([i+a,o+c],l);return[Math.min(h[0],f[0],u[0],d[0]),Math.min(h[1],f[1],u[1],d[1]),Math.max(h[0],f[0],u[0],d[0]),Math.max(h[1],f[1],u[1],d[1])]}let n=Ma(t,e[0],r),s=Ma(t,e[1],r);return[Math.min(n[0],s[0]),Math.min(n[1],s[1]),Math.max(n[2],s[2]),Math.max(n[3],s[3])]}function N1(t,e,r){return r?uu(t,r).map(s=>s*e/le):t.map(n=>n*e/le)}function ya(t,e){return Math.pow(2,t)*le/e}function Vs(t,e,r){let n=ya(r,le),s=t/n*360-180,i=Math.PI-2*Math.PI*e/n,o=180/Math.PI*Math.atan(.5*(Math.exp(i)-Math.exp(-i)));return[s,o]}function fu(t,e,r,n){let s=ya(r,n);return[t/s*le,e/s*le]}function Ia(t,e,r,n,s=le){if(t.isGeospatial){let[l,h]=Vs(e,r,n),[f,u]=Vs(e+1,r+1,n);return{west:l,north:h,east:f,south:u}}let[i,o]=fu(e,r,n,s),[a,c]=fu(e+1,r+1,n,s);return{left:i,top:o,right:a,bottom:c}}function O1(t,e,r,n,s){let i=F1(t,null,n),o=ya(e,r),[a,c,l,h]=N1(i,o,s),f=[];for(let u=Math.floor(a);u<l;u++)for(let d=Math.floor(c);d<h;d++)f.push({x:u,y:d,z:e});return f}function Fa({viewport:t,maxZoom:e,minZoom:r,zRange:n,extent:s,tileSize:i=le,modelMatrix:o,modelMatrixInverse:a,zoomOffset:c=0}){let l=t.isGeospatial?Math.round(t.zoom+Math.log2(le/i))+c:Math.ceil(t.zoom)+c;if(typeof r=="number"&&Number.isFinite(r)&&l<r){if(!s)return[];l=r}typeof e=="number"&&Number.isFinite(e)&&l>e&&(l=e);let h=s;return o&&a&&s&&!t.isGeospatial&&(h=uu(s,o)),t.isGeospatial?hu(t,l,n,s):O1(t,l,i,h||y1,a)}function Na(t){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(t)}function Oa(t){return Number.isFinite(t.west)&&Number.isFinite(t.north)&&Number.isFinite(t.east)&&Number.isFinite(t.south)}function pu(t){let e={},r;return n=>{for(let s in n)if(!b1(n[s],e[s])){r=t(n),e=n;break}return r}}function b1(t,e){if(t===e)return!0;if(Array.isArray(t)){let r=t.length;if(!e||e.length!==r)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}return!1}var gu=1,Xs=2,P1="never",D1="no-overlap",mn="best-available",w1=5,v1={[mn]:L1,[D1]:H1,[P1]:()=>{}},U1={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},Ge=class{constructor(e){this._getCullBounds=pu(du),this.opts={...U1,...e},this.onTileLoad=r=>{this.opts.onTileLoad?.(r),this.opts.maxCacheByteSize&&(this._cacheByteSize+=r.byteLength,this._resizeCache())},this._requestScheduler=new me({maxRequests:e.maxRequests,throttleRequests:Boolean(e.maxRequests&&e.maxRequests>0)}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new D,this._modelMatrixInverse=new D,this.setOptions(e)}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(e=>e.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(e=>e.needsReload)}setOptions(e){Object.assign(this.opts,e),Number.isFinite(e.maxZoom)&&(this._maxZoom=Math.floor(e.maxZoom)),Number.isFinite(e.minZoom)&&(this._minZoom=Math.ceil(e.minZoom))}finalize(){for(let e of this._cache.values())e.isLoading&&e.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let e of this._cache.keys()){let r=this._cache.get(e);!this._selectedTiles||!this._selectedTiles.includes(r)?this._cache.delete(e):r.setNeedsReload()}}update(e,{zRange:r,modelMatrix:n}={zRange:null,modelMatrix:null}){let s=n?new D(n):new D,i=!s.equals(this._modelMatrix);if(!this._viewport||!e.equals(this._viewport)||!At(this._zRange,r)||i){i&&(this._modelMatrixInverse=s.clone().invert(),this._modelMatrix=s),this._viewport=e,this._zRange=r;let a=this.getTileIndices({viewport:e,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:r,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=a.map(c=>this._getTile(c,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(a=>this._getTile(a.index,!0)));let o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(e,r){if(!e.isVisible)return!1;if(r&&this._viewport){let n=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:r}),{bbox:s}=e;for(let[i,o,a,c]of n){let l;if("west"in s)l=s.west<a&&s.east>i&&s.south<c&&s.north>o;else{let h=Math.min(s.top,s.bottom),f=Math.max(s.top,s.bottom);l=s.left<a&&s.right>i&&h<c&&f>o}if(l)return!0}return!1}return!0}getTileIndices({viewport:e,maxZoom:r,minZoom:n,zRange:s,modelMatrix:i,modelMatrixInverse:o}){let{tileSize:a,extent:c,zoomOffset:l}=this.opts;return Fa({viewport:e,maxZoom:r,minZoom:n,zRange:s,tileSize:a,extent:c,modelMatrix:i,modelMatrixInverse:o,zoomOffset:l})}getTileId(e){return`${e.x}-${e.y}-${e.z}`}getTileZoom(e){return e.z}getTileMetadata(e){let{tileSize:r}=this.opts;return{bbox:Ia(this._viewport,e.x,e.y,e.z,r)}}getParentIndex(e){let r=Math.floor(e.x/2),n=Math.floor(e.y/2),s=e.z-1;return{x:r,y:n,z:s}}updateTileStates(){let e=this.opts.refinementStrategy||mn,r=new Array(this._cache.size),n=0;for(let s of this._cache.values())r[n++]=s.isVisible,s.isSelected=!1,s.isVisible=!1;for(let s of this._selectedTiles)s.isSelected=!0,s.isVisible=!0;(typeof e=="function"?e:v1[e])(Array.from(this._cache.values())),n=0;for(let s of this._cache.values())if(r[n++]!==s.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:e=0}=this.opts,r=[],n=0;for(let s of this._cache.values())s.isLoading&&(n++,!s.isSelected&&!s.isVisible&&r.push(s));for(;e>0&&n>e&&r.length>0;)r.shift().abort(),n--}_rebuildTree(){let{_cache:e}=this;for(let r of e.values())r.parent=null,r.children&&(r.children.length=0);for(let r of e.values()){let n=this._getNearestAncestor(r);r.parent=n,n?.children&&n.children.push(r)}}_resizeCache(){let{_cache:e,opts:r}=this,n=r.maxCacheSize||(r.maxCacheByteSize?1/0:w1*this.selectedTiles.length),s=r.maxCacheByteSize||1/0;if(e.size>n||this._cacheByteSize>s){for(let[o,a]of e)if(!a.isVisible&&!a.isSelected&&(this._cacheByteSize-=r.maxCacheByteSize?a.byteLength:0,e.delete(o),this.opts.onTileUnload?.(a)),e.size<=n&&this._cacheByteSize<=s)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((o,a)=>o.zoom-a.zoom),this._dirty=!1)}_getTile(e,r){let n=this.getTileId(e),s=this._cache.get(n),i=!1;return!s&&r?(s=new ke(e),Object.assign(s,this.getTileMetadata(s.index)),Object.assign(s,{id:n,zoom:this.getTileZoom(s.index)}),i=!0,this._cache.set(n,s),this._dirty=!0):s&&s.needsReload&&(i=!0),s&&i&&s.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),s}_getNearestAncestor(e){let{_minZoom:r=0}=this,n=e.index;for(;this.getTileZoom(n)>r;){n=this.getParentIndex(n);let s=this._getTile(n);if(s)return s}return null}};function L1(t){for(let e of t)e.state=0;for(let e of t)e.isSelected&&!Au(e)&&ba(e);for(let e of t)e.isVisible=Boolean(e.state&Xs)}function H1(t){for(let r of t)r.state=0;for(let r of t)r.isSelected&&Au(r);let e=Array.from(t).sort((r,n)=>r.zoom-n.zoom);for(let r of e)if(r.isVisible=Boolean(r.state&Xs),r.children&&(r.isVisible||r.state&gu))for(let n of r.children)n.state=gu;else r.isSelected&&ba(r)}function Au(t){let e=t;for(;e;){if(e.isLoaded||e.content)return e.state|=Xs,!0;e=e.parent}return!1}function ba(t){for(let e of t.children)e.isLoaded||e.content?e.state|=Xs:ba(e)}var V1={TilesetClass:Ge,data:{type:"data",value:[]},dataComparator:Ie.equal,renderSubLayers:{type:"function",value:t=>new _u.GeoJsonLayer(t)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:t=>console.error(t)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:mn,zRange:null,maxRequests:6,zoomOffset:0},Ws=class extends zs.CompositeLayer{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every(e=>e.isLoaded&&e.layers&&e.layers.every(r=>r.isLoaded)))}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({changeFlags:e}){let{tileset:r}=this.state,n=e.propsOrDataChanged||e.updateTriggersChanged,s=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getTileData);r?n&&(r.setOptions(this._getTilesetOptions()),s?r.reloadAll():r.tiles.forEach(i=>{i.layers=null})):(r=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:r})),this._updateTileset()}_getTilesetOptions(){let{tileSize:e,maxCacheSize:r,maxCacheByteSize:n,refinementStrategy:s,extent:i,maxZoom:o,minZoom:a,maxRequests:c,zoomOffset:l}=this.props;return{maxCacheSize:r,maxCacheByteSize:n,maxZoom:o,minZoom:a,tileSize:e,refinementStrategy:s,extent:i,maxRequests:c,zoomOffset:l,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let e=this.state.tileset,{zRange:r,modelMatrix:n}=this.props,s=e.update(this.context.viewport,{zRange:r,modelMatrix:n}),{isLoaded:i}=e,o=this.state.isLoaded!==i,a=this.state.frameNumber!==s;i&&(o||a)&&this._onViewportLoad(),a&&this.setState({frameNumber:s}),this.state.isLoaded=i}_onViewportLoad(){let{tileset:e}=this.state,{onViewportLoad:r}=this.props;r&&r(e.selectedTiles)}_onTileLoad(e){this.props.onTileLoad(e),e.layers=null,this.setNeedsUpdate()}_onTileError(e,r){this.props.onTileError(e),r.layers=null,this.setNeedsUpdate()}_onTileUnload(e){this.props.onTileUnload(e)}getTileData(e){let{data:r,getTileData:n,fetch:s}=this.props,{signal:i}=e;return e.url=typeof r=="string"||Array.isArray(r)?$t(r,e):null,n?n(e):s&&e.url?s(e.url,{propName:"data",layer:this,signal:i}):null}renderSubLayers(e){return this.props.renderSubLayers(e)}getSubLayerPropsByTile(e){return null}getPickingInfo({info:e,sourceLayer:r}){let n=r.props.tile;return e.picked&&(e.tile=n),e.sourceTile=n,e}_updateAutoHighlight(e){let r=e.sourceTile;if(r&&r.layers)for(let n of r.layers)n.updateAutoHighlight(e)}renderLayers(){return this.state.tileset.tiles.map(e=>{let r=this.getSubLayerPropsByTile(e);if(!(!e.isLoaded&&!e.content))if(e.layers)r&&e.layers[0]&&Object.keys(r).some(n=>e.layers[0].props[n]!==r[n])&&(e.layers=e.layers.map(n=>n.clone(r)));else{let n=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:e.id,updateTriggers:this.props.updateTriggers}),data:e.content,_offset:0,tile:e});e.layers=(0,zs._flatten)(n,Boolean).map(s=>s.clone({tile:e,...r}))}return e.layers})}filterSubLayer({layer:e,cullRect:r}){let{tile:n}=e.props;return this.state.tileset.isTileVisible(n,r)}},te=Ws;(()=>{Ws.defaultProps=V1})(),(()=>{Ws.layerName="TileLayer"})();var mu=v(Ut(),1),X1={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:t=>t.timestamps}},ks=class extends mu.PathLayer{getShaders(){let e=super.getShaders();return e.inject={"vs:#decl":`uniform float trailLength;
|
|
24
14
|
in float instanceTimestamps;
|
|
25
15
|
in float instanceNextTimestamps;
|
|
26
16
|
out float vTime;
|
|
@@ -35,140 +25,7 @@ in float vTime;
|
|
|
35
25
|
`,"fs:DECKGL_FILTER_COLOR":`if(fadeTrail) {
|
|
36
26
|
color.a *= 1.0 - (currentTime - vTime) / trailLength;
|
|
37
27
|
}
|
|
38
|
-
`},i},n.initializeState=function(){nn(Zt(r.prototype),"initializeState",this).call(this);var i=this.getAttributeManager();i.addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})},n.draw=function(i){var o=this.props,a=o.fadeTrail,c=o.trailLength,u=o.currentTime;i.uniforms=Pm(Pm({},i.uniforms),{},{fadeTrail:a,trailLength:c,currentTime:u}),nn(Zt(r.prototype),"draw",this).call(this,i)},r}(Fm.PathLayer);Qi.layerName="TripsLayer";Qi.defaultProps=Jw;var Xm=U($i()),Km=U(Ze());var He=U($i()),no=U(Ze()),hs=U(Ye());var ls=U($i());function Um(t,e){return Kw(t)||Xw(t,e)||km(t,e)||Ww()}function Ww(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
39
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xw(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(t);!(s=(o=r.next()).done)&&(n.push(o.value),!(e&&n.length===e));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function Kw(t){if(Array.isArray(t))return t}function Gm(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=km(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,s=function(){};return{s,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
40
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return i=u.done,u},e:function(u){o=!0,a=u},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function km(t,e){if(t){if(typeof t=="string")return Dm(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Dm(t,e)}}function Dm(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function eo(t,e){e=e===void 0?t[0][0]:e;var r=Gm(t),n;try{for(r.s();!(n=r.n()).done;){var s=n.value,i=s[0]-e;i>180?s[0]-=360:i<-180&&(s[0]+=360)}}catch(o){r.e(o)}finally{r.f()}}function Yw(t,e,r){var n=(0,ls.cellToLatLng)(t),s=Um(n,2),i=s[0],o=s[1],a=e.length;eo(e,o);for(var c=e[0]===e[a-1]?a-1:a,u=0;u<c;u++)e[u][0]=jt(o,e[u][0],r),e[u][1]=jt(i,e[u][1],r)}function Hm(t,e,r){var n=t(e,r),s=(0,ls.cellToLatLng)(n),i=Um(s,2),o=i[0],a=i[1];return[a,o]}function Cu(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,r=(0,ls.cellToBoundary)(t,!0);return e!==1?Yw(t,r,e):eo(r),r}function Vm(t){var e=new Float64Array(t.length*2),r=0,n=Gm(t),s;try{for(n.s();!(s=n.n()).done;){var i=s.value;e[r++]=i[0],e[r++]=i[1]}}catch(o){n.e(o)}finally{n.f()}return e}function zm(t,e){return $w(t)||Qw(t,e)||Jm(t,e)||Zw()}function Zw(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
41
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qw(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(t);!(s=(o=r.next()).done)&&(n.push(o.value),!(e&&n.length===e));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function $w(t){if(Array.isArray(t))return t}function eS(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Jm(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,s=function(){};return{s,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
42
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return i=u.done,u},e:function(u){o=!0,a=u},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function Jm(t,e){if(t){if(typeof t=="string")return jm(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return jm(t,e)}}function jm(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function tS(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rS(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Mu(t,e)}function Mu(t,e){return Mu=Object.setPrototypeOf||function(n,s){return n.__proto__=s,n},Mu(t,e)}function nS(t){var e=oS();return function(){var n=to(t),s;if(e){var i=to(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return sS(this,s)}}function sS(t,e){if(e&&(fs(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return iS(t)}function iS(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function oS(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function to(t){return to=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},to(t)}function qm(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function ro(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?qm(Object(r),!0).forEach(function(n){aS(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qm(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function aS(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fs(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?fs=function(r){return typeof r}:fs=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},fs(t)}var cS=10;function uS(t,e){var r;return t==null?r=e:fs(t)==="object"?r=ro(ro({},t),{},{coverage:e}):r={getHexagon:t,coverage:e},r}var lS=ro(ro({},hs.PolygonLayer.defaultProps),{},{highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:function(e){return e.hexagon}},extruded:!0}),Er=function(t){rS(r,t);var e=nS(r);function r(){var s;tS(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return s=e.call.apply(e,[this].concat(o)),s.state=void 0,s}var n=r.prototype;return n.initializeState=function(){r._checkH3Lib(),this.state={edgeLengthKM:0,resolution:-1}},n.shouldUpdateState=function(i){var o=i.changeFlags;return this._shouldUseHighPrecision()?o.propsOrDataChanged:o.somethingChanged},n.updateState=function(i){var o=i.props,a=i.changeFlags;if(o.highPrecision!==!0&&(a.dataChanged||a.updateTriggersChanged&&a.updateTriggersChanged.getHexagon)){var c=this._calculateH3DataProps();this.setState(c)}this._updateVertices(this.context.viewport)},n._calculateH3DataProps=function(){var i=-1,o=!1,a=!1,c=(0,no.createIterable)(this.props.data),u=c.iterable,l=c.objectInfo,f=eS(u),h;try{for(f.s();!(h=f.n()).done;){var d=h.value;l.index++;var p=this.props.getHexagon(d,l),g=(0,He.getResolution)(p);if(i<0){if(i=g,!this.props.highPrecision)break}else if(i!==g){a=!0;break}if((0,He.isPentagon)(p)){o=!0;break}}}catch(m){f.e(m)}finally{f.f()}return{resolution:i,edgeLengthKM:i>=0?(0,He.getHexagonEdgeLengthAvg)(i,"km"):0,hasMultipleRes:a,hasPentagon:o}},n._shouldUseHighPrecision=function(){if(this.props.highPrecision==="auto"){var i=this.state,o=i.resolution,a=i.hasPentagon,c=i.hasMultipleRes,u=this.context.viewport;return Boolean(u?.resolution)||c||a||o>=0&&o<=5}return this.props.highPrecision},n._updateVertices=function(i){if(!this._shouldUseHighPrecision()){var o=this.state,a=o.resolution,c=o.edgeLengthKM,u=o.centerHex;if(!(a<0)){var l=this.props.centerHexagon||(0,He.latLngToCell)(i.latitude,i.longitude,a);if(u!==l){if(u)try{var f=(0,He.gridDistance)(u,l);if(f*c<cS)return}catch{}var h=i.distanceScales.unitsPerMeter,d=Cu(l),p=(0,He.cellToLatLng)(l),g=zm(p,2),m=g[0],A=g[1],v=i.projectFlat([A,m]),x=zm(v,2),b=x[0],M=x[1];d=d.map(function(C){var I=i.projectFlat(C);return[(I[0]-b)/h[0],(I[1]-M)/h[1]]}),this.setState({centerHex:l,vertices:d})}}}},n.renderLayers=function(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()},n._getForwardProps=function(){var i=this.props,o=i.elevationScale,a=i.material,c=i.coverage,u=i.extruded,l=i.wireframe,f=i.stroked,h=i.filled,d=i.lineWidthUnits,p=i.lineWidthScale,g=i.lineWidthMinPixels,m=i.lineWidthMaxPixels,A=i.getFillColor,v=i.getElevation,x=i.getLineColor,b=i.getLineWidth,M=i.transitions,C=i.updateTriggers;return{elevationScale:o,extruded:u,coverage:c,wireframe:l,stroked:f,filled:h,lineWidthUnits:d,lineWidthScale:p,lineWidthMinPixels:g,lineWidthMaxPixels:m,material:a,getElevation:v,getFillColor:A,getLineColor:x,getLineWidth:b,transitions:M,updateTriggers:{getFillColor:C.getFillColor,getElevation:C.getElevation,getLineColor:C.getLineColor,getLineWidth:C.getLineWidth}}},n._renderPolygonLayer=function(){var i=this.props,o=i.data,a=i.getHexagon,c=i.updateTriggers,u=i.coverage,l=this.getSubLayerClass("hexagon-cell-hifi",hs.PolygonLayer),f=this._getForwardProps();return f.updateTriggers.getPolygon=uS(c.getHexagon,u),new l(f,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:f.updateTriggers}),{data:o,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:function(d,p){var g=a(d,p);return Vm(Cu(g,u))}})},n._renderColumnLayer=function(){var i=this.props,o=i.data,a=i.getHexagon,c=i.updateTriggers,u=this.getSubLayerClass("hexagon-cell",hs.ColumnLayer),l=this._getForwardProps();return l.updateTriggers.getPosition=c.getHexagon,new u(l,this.getSubLayerProps({id:"hexagon-cell",flatShading:!0,updateTriggers:l.updateTriggers}),{data:o,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:Hm.bind(null,a)})},r}(no.CompositeLayer);Er.defaultProps=lS;Er.layerName="H3HexagonLayer";Er._checkH3Lib=function(){};function so(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?so=function(r){return typeof r}:so=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},so(t)}function Iu(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=fS(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,s=function(){};return{s,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
43
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return i=u.done,u},e:function(u){o=!0,a=u},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function fS(t,e){if(t){if(typeof t=="string")return Wm(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Wm(t,e)}}function Wm(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function hS(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function dS(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ou(t,e)}function Ou(t,e){return Ou=Object.setPrototypeOf||function(n,s){return n.__proto__=s,n},Ou(t,e)}function pS(t){var e=yS();return function(){var n=io(t),s;if(e){var i=io(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return mS(this,s)}}function mS(t,e){if(e&&(so(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gS(t)}function gS(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function yS(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function io(t){return io=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},io(t)}var _S={getHexagons:{type:"accessor",value:function(e){return e.hexagons}}},oo=function(t){dS(r,t);var e=pS(r);function r(){var s;hS(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return s=e.call.apply(e,[this].concat(o)),s.state=void 0,s}var n=r.prototype;return n.initializeState=function(){Er._checkH3Lib()},n.updateState=function(i){var o=i.props,a=i.changeFlags;if(a.dataChanged||a.updateTriggersChanged&&a.updateTriggersChanged.getHexagons){var c=o.data,u=o.getHexagons,l=[],f=(0,Km.createIterable)(c),h=f.iterable,d=f.objectInfo,p=Iu(h),g;try{for(p.s();!(g=p.n()).done;){var m=g.value;d.index++;var A=u(m,d),v=(0,Xm.cellsToMultiPolygon)(A,!0),x=Iu(v),b;try{for(x.s();!(b=x.n()).done;){var M=b.value,C=Iu(M),I;try{for(C.s();!(I=C.n()).done;){var B=I.value;eo(B)}}catch(S){C.e(S)}finally{C.f()}l.push(this.getSubLayerRow({polygon:M},m,d.index))}}catch(S){x.e(S)}finally{x.f()}}}catch(S){p.e(S)}finally{p.f()}this.setState({polygons:l})}},n.indexToBounds=function(){var i=this.props,o=i.getElevation,a=i.getFillColor,c=i.getLineColor,u=i.getLineWidth;return{data:this.state.polygons,getPolygon:function(f){return f.polygon},getElevation:this.getSubLayerAccessor(o),getFillColor:this.getSubLayerAccessor(a),getLineColor:this.getSubLayerAccessor(c),getLineWidth:this.getSubLayerAccessor(u)}},r}(Ge);oo.layerName="H3ClusterLayer";oo.defaultProps=_S;var nr=U(Ct(),1),te=U(Ct(),1),Rg=U(Ct(),1);var ue=t=>`${t}`;function mt(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}var Ru={number:{type:"number",validate(t,e){return Number.isFinite(t)&&typeof e=="object"&&(e.max===void 0||t<=e.max)&&(e.min===void 0||t>=e.min)}},array:{type:"array",validate(t,e){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function Qm(t){let e={};for(let[r,n]of Object.entries(t))e[r]=AS(n);return e}function $m(t,e,r){let n={};for(let[s,i]of Object.entries(e))t&&s in t&&!i.private?(i.validate&&mt(i.validate(t[s],i),`${r}: invalid ${s}`),n[s]=t[s]):n[s]=i.value;return n}function AS(t){let e=Zm(t);if(e!=="object")return{value:t,...Ru[e],type:e};if(typeof t=="object")return t?t.type!==void 0?{...t,...Ru[t.type],type:t.type}:t.value===void 0?{type:"object",value:t}:(e=Zm(t.value),{...t,...Ru[e],type:e}):{type:"object",value:null};throw new Error("props")}function Zm(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}var eg=ue`\
|
|
44
|
-
#ifdef MODULE_LOGDEPTH
|
|
45
|
-
logdepth_adjustPosition(gl_Position);
|
|
46
|
-
#endif
|
|
47
|
-
`,tg=ue`\
|
|
48
|
-
#ifdef MODULE_MATERIAL
|
|
49
|
-
gl_FragColor = material_filterColor(gl_FragColor);
|
|
50
|
-
#endif
|
|
51
|
-
|
|
52
|
-
#ifdef MODULE_LIGHTING
|
|
53
|
-
gl_FragColor = lighting_filterColor(gl_FragColor);
|
|
54
|
-
#endif
|
|
55
|
-
|
|
56
|
-
#ifdef MODULE_FOG
|
|
57
|
-
gl_FragColor = fog_filterColor(gl_FragColor);
|
|
58
|
-
#endif
|
|
59
|
-
|
|
60
|
-
#ifdef MODULE_PICKING
|
|
61
|
-
gl_FragColor = picking_filterHighlightColor(gl_FragColor);
|
|
62
|
-
gl_FragColor = picking_filterPickingColor(gl_FragColor);
|
|
63
|
-
#endif
|
|
64
|
-
|
|
65
|
-
#ifdef MODULE_LOGDEPTH
|
|
66
|
-
logdepth_setFragDepth();
|
|
67
|
-
#endif
|
|
68
|
-
`;var vS={vertex:eg,fragment:tg},rg=/void\s+main\s*\([^)]*\)\s*\{\n?/,ng=/}\n?[^{}]*$/,Lu=[],ds="__LUMA_INJECT_DECLARATIONS__";function sg(t){let e={vertex:{},fragment:{}};for(let r in t){let n=t[r],s=xS(r);typeof n=="string"&&(n={order:0,injection:n}),e[s][r]=n}return e}function xS(t){let e=t.slice(0,2);switch(e){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(e)}}function ps(t,e,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=e==="vertex";for(let i in r){let o=r[i];o.sort((c,u)=>c.order-u.order),Lu.length=o.length;for(let c=0,u=o.length;c<u;++c)Lu[c]=o[c].injection;let a=`${Lu.join(`
|
|
69
|
-
`)}
|
|
70
|
-
`;switch(i){case"vs:#decl":s&&(t=t.replace(ds,a));break;case"vs:#main-start":s&&(t=t.replace(rg,c=>c+a));break;case"vs:#main-end":s&&(t=t.replace(ng,c=>a+c));break;case"fs:#decl":s||(t=t.replace(ds,a));break;case"fs:#main-start":s||(t=t.replace(rg,c=>c+a));break;case"fs:#main-end":s||(t=t.replace(ng,c=>a+c));break;default:t=t.replace(i,c=>c+a)}}return t=t.replace(ds,""),n&&(t=t.replace(/\}\s*$/,i=>i+vS[e])),t}var bS=1,tt=class{static instantiateModules(e){return e.map(r=>{if(r instanceof tt)return r;mt(typeof r!="string",`Shader module use by name is deprecated. Import shader module '${JSON.stringify(r)}' and use it directly.`),r.name||(console.warn("shader module has no name"),r.name=`shader-module-${bS++}`);let n=new tt(r);return n.dependencies=tt.instantiateModules(r.dependencies||[]),n})}constructor(e){this.name=void 0,this.vs=void 0,this.fs=void 0,this.getModuleUniforms=void 0,this.dependencies=void 0,this.deprecations=void 0,this.defines=void 0,this.injections=void 0,this.uniforms={},this.uniformTypes={};let{name:r,vs:n,fs:s,dependencies:i=[],uniformPropTypes:o={},getUniforms:a,deprecations:c=[],defines:u={},inject:l={}}=e;mt(typeof r=="string"),this.name=r,this.vs=n,this.fs=s,this.getModuleUniforms=a,this.dependencies=tt.instantiateModules(i),this.deprecations=this._parseDeprecationDefinitions(c),this.defines=u,this.injections=sg(l),o&&(this.uniforms=Qm(o))}getModuleSource(e){let r;switch(e){case"vertex":r=this.vs||"";break;case"fragment":r=this.fs||"";break;default:mt(!1)}let n=this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");return`// ----- MODULE ${this.name} ---------------
|
|
71
|
-
|
|
72
|
-
#define MODULE_${n}
|
|
73
|
-
${r}
|
|
74
|
-
|
|
75
|
-
`}getUniforms(e,r){return this.getModuleUniforms?this.getModuleUniforms(e,r):$m(e,this.uniforms,this.name)}getDefines(){return this.defines}checkDeprecations(e,r){this.deprecations.forEach(n=>{var s;(s=n.regex)!==null&&s!==void 0&&s.test(e)&&(n.deprecated?r.deprecated(n.old,n.new)():r.removed(n.old,n.new)())})}_parseDeprecationDefinitions(e){return e.forEach(r=>{switch(r.type){case"function":r.regex=new RegExp(`\\b${r.old}\\(`);break;default:r.regex=new RegExp(`${r.type} ${r.old};`)}}),e}_defaultGetUniforms(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={},n=this.uniforms;for(let s in n){let i=n[s];s in e&&!i.private?(i.validate&&mt(i.validate(e[s],i),`${this.name}: invalid ${s}`),r[s]=e[s]):r[s]=i.value}return r}};function ms(t){let e=tt.instantiateModules(t);return TS(e)}function TS(t){let e={},r={};return ig({modules:t,level:0,moduleMap:e,moduleDepth:r}),Object.keys(r).sort((n,s)=>r[s]-r[n]).map(n=>e[n])}function ig(t){let{modules:e,level:r,moduleMap:n,moduleDepth:s}=t;if(r>=5)throw new Error("Possible loop in shader dependency graph");for(let i of e)n[i.name]=i,(s[i.name]===void 0||s[i.name]<r)&&(s[i.name]=r);for(let i of e)i.dependencies&&ig({modules:i.dependencies,level:r+1,moduleMap:n,moduleDepth:s})}function og(t){switch(t?.gpu.toLowerCase()){case"apple":return ue`\
|
|
76
|
-
#define APPLE_GPU
|
|
77
|
-
// Apple optimizes away the calculation necessary for emulated fp64
|
|
78
|
-
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
79
|
-
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
|
|
80
|
-
// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
|
|
81
|
-
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
|
|
82
|
-
`;case"nvidia":return ue`\
|
|
83
|
-
#define NVIDIA_GPU
|
|
84
|
-
// Nvidia optimizes away the calculation necessary for emulated fp64
|
|
85
|
-
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
86
|
-
`;case"intel":return ue`\
|
|
87
|
-
#define INTEL_GPU
|
|
88
|
-
// Intel optimizes away the calculation necessary for emulated fp64
|
|
89
|
-
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
90
|
-
// Intel's built-in 'tan' function doesn't have acceptable precision
|
|
91
|
-
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
|
|
92
|
-
// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
|
|
93
|
-
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
|
|
94
|
-
`;case"amd":return ue`\
|
|
95
|
-
#define AMD_GPU
|
|
96
|
-
`;default:return ue`\
|
|
97
|
-
#define DEFAULT_GPU
|
|
98
|
-
// Prevent driver from optimizing away the calculation necessary for emulated fp64
|
|
99
|
-
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
100
|
-
// Headless Chrome's software shader 'tan' function doesn't have acceptable precision
|
|
101
|
-
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
|
|
102
|
-
// If the GPU doesn't have full 32 bits precision, will causes overflow
|
|
103
|
-
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
|
|
104
|
-
`}}function ag(t){let e="";return t.features.has("webgl2")&&(e+=ue`\
|
|
105
|
-
# define FEATURE_GLSL_DERIVATIVES
|
|
106
|
-
# define FEATURE_GLSL_DRAW_BUFFERS
|
|
107
|
-
# define FEATURE_GLSL_FRAG_DEPTH
|
|
108
|
-
# define FEATURE_GLSL_TEXTURE_LOD
|
|
109
|
-
`),t.features.has("webgl2")||(t.features.has("glsl-frag-depth")&&(e+=ue`\
|
|
110
|
-
|
|
111
|
-
// FEATURE_GLSL_FRAG_DEPTH => gl_FragDepth is available
|
|
112
|
-
#ifdef GL_EXT_frag_depth
|
|
113
|
-
# extension GL_EXT_frag_depth : enable
|
|
114
|
-
# define FEATURE_GLSL_FRAG_DEPTH
|
|
115
|
-
# define FRAG_DEPTH
|
|
116
|
-
# define gl_FragDepth gl_FragDepthEXT
|
|
117
|
-
#endif
|
|
118
|
-
`),t!=null&&t.features.has("glsl-derivatives")&&(e+=ue`\
|
|
119
|
-
|
|
120
|
-
// FEATURE_GLSL_DERIVATIVES => dxdF, dxdY and fwidth are available
|
|
121
|
-
#if defined(GL_OES_standard_derivatives) || defined(FEATURE_GLSL_DERIVATIVES)
|
|
122
|
-
# extension GL_OES_standard_derivatives : enable
|
|
123
|
-
# define FEATURE_GLSL_DERIVATIVES
|
|
124
|
-
#endif
|
|
125
|
-
`),t!=null&&t.features.has("glsl-frag-data")&&(e+=ue`\
|
|
126
|
-
|
|
127
|
-
// FEATURE_GLSL_DRAW_BUFFERS => gl_FragData[] is available
|
|
128
|
-
#ifdef GL_EXT_draw_buffers
|
|
129
|
-
# extension GL_EXT_draw_buffers : require
|
|
130
|
-
# define FEATURE_GLSL_DRAW_BUFFERS
|
|
131
|
-
#endif
|
|
132
|
-
`),t!=null&&t.features.has("glsl-texture-lod")&&(e+=ue`\
|
|
133
|
-
// TEXTURE_LOD => texture2DLod etc are available
|
|
134
|
-
#ifdef GL_EXT_shader_texture_lod
|
|
135
|
-
# extension GL_EXT_shader_texture_lod : enable
|
|
136
|
-
# define FEATURE_GLSL_TEXTURE_LOD
|
|
137
|
-
# define TEXTURE_LOD
|
|
138
|
-
#endif
|
|
139
|
-
`)),e}function ug(t,e,r){var n;if(Number(((n=t.match(/^#version[ \t]+(\d+)/m))===null||n===void 0?void 0:n[1])||100)!==300)throw new Error("luma.gl v9 only supports GLSL 3.00 shader sources");switch(e){case 300:switch(r){case"vertex":return t=gs(t,ES),t;case"fragment":return t=gs(t,wS),t;default:throw new Error(r)}case 100:switch(r){case"vertex":return t=gs(t,SS),t;case"fragment":return t=gs(t,hg),t=CS(t),t;default:throw new Error(r)}default:throw new Error(String(e))}}var lg=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,`#version 300 es
|
|
140
|
-
`],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],ES=[...lg,[sn("attribute"),"in $1"],[sn("varying"),"out $1"]],wS=[...lg,[sn("varying"),"in $1"]],fg=[[/^#version[ \t]+300[ \t]+es/,"#version 100"],[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]],SS=[...fg,[sn("in"),"attribute $1"],[sn("out"),"varying $1"]],hg=[...fg,[sn("in"),"varying $1"]],BS="gl_FragColor",cg=/\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/;function gs(t,e){for(let[r,n]of e)t=t.replace(r,n);return t}function CS(t){t=gs(t,hg);let e=cg.exec(t);if(e){let r=e[1];t=t.replace(cg,"").replace(new RegExp(`\\b${r}\\b`,"g"),BS)}return t}function sn(t){return new RegExp(`\\b${t}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function Pu(t,e){let r="";for(let n in t){let s=t[n];if(r+=`void ${s.signature} {
|
|
141
|
-
`,s.header&&(r+=` ${s.header}`),e[n]){let i=e[n];i.sort((o,a)=>o.order-a.order);for(let o of i)r+=` ${o.injection}
|
|
142
|
-
`}s.footer&&(r+=` ${s.footer}`),r+=`}
|
|
143
|
-
`}return r}function Fu(t){let e={vertex:{},fragment:{}};for(let r of t){let n,s;typeof r!="string"?(n=r,s=n.hook):(n={},s=r),s=s.trim();let[i,o]=s.split(":"),a=s.replace(/\(.+/,""),c=Object.assign(n,{signature:o});switch(i){case"vs":e.vertex[a]=c;break;case"fs":e.fragment[a]=c;break;default:throw new Error(i)}}return e}function dg(t,e){return{name:MS(t,e),language:"glsl",version:IS(t)}}function MS(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"unnamed",n=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/.exec(t);return n?n[1]:e}function IS(t){let e=100,r=t.match(/[^\s]+/g);if(r&&r.length>=2&&r[0]==="#version"){let n=parseInt(r[1],10);Number.isFinite(n)&&(e=n)}if(e!==100&&e!==300)throw new Error(`Invalid GLSL version ${e}`);return e}var yg=`
|
|
144
|
-
|
|
145
|
-
${ds}
|
|
146
|
-
`,OS=ue`\
|
|
147
|
-
precision highp float;
|
|
148
|
-
`;function _g(t){let{vs:e,fs:r}=t,n=ms(t.modules||[]);switch(t.platformInfo.shaderLanguage){case"glsl":return{vs:mg(t.platformInfo,{...t,source:e,stage:"vertex",modules:n}),fs:mg(t.platformInfo,{...t,source:r,stage:"fragment",modules:n}),getUniforms:gg(n)};case"wgsl":return{vs:pg(t.platformInfo,{...t,source:e,stage:"vertex",modules:n}),fs:pg(t.platformInfo,{...t,source:r,stage:"fragment",modules:n}),getUniforms:gg(n)}}}function pg(t,e){let{source:r,stage:n,modules:s,defines:i={},hookFunctions:o=[],inject:a={},log:c}=e;mt(typeof r=="string","shader source must be a string");let u=r,l={};s.forEach(m=>{Object.assign(l,m.getDefines())}),Object.assign(l,i);let f="",h=Fu(o),d={},p={},g={};for(let m in a){let A=typeof a[m]=="string"?{injection:a[m],order:0}:a[m],v=/^(v|f)s:(#)?([\w-]+)$/.exec(m);if(v){let x=v[2],b=v[3];x?b==="decl"?p[m]=[A]:g[m]=[A]:d[m]=[A]}else g[m]=[A]}for(let m of s){c&&m.checkDeprecations(u,c);let A=m.getModuleSource(n,"wgsl");f+=A;let v=m.injections[n];for(let x in v){let b=/^(v|f)s:#([\w-]+)$/.exec(x);if(b){let C=b[2]==="decl"?p:g;C[x]=C[x]||[],C[x].push(v[x])}else d[x]=d[x]||[],d[x].push(v[x])}}return f+=yg,f=ps(f,n,p),f+=Pu(h[n],d),f+=u,f=ps(f,n,g),f}function mg(t,e){let{id:r,source:n,stage:s,language:i="glsl",modules:o,defines:a={},hookFunctions:c=[],inject:u={},prologue:l=!0,log:f}=e;mt(typeof n=="string","shader source must be a string");let h=i==="glsl"?dg(n).version:-1,d=t.shaderLanguageVersion,p=h===100?"#version 100":"#version 300 es",m=n.split(`
|
|
149
|
-
`).slice(1).join(`
|
|
150
|
-
`),A={};o.forEach(I=>{Object.assign(A,I.getDefines())}),Object.assign(A,a);let v="";switch(i){case"wgsl":break;case"glsl":v=l?`${p}
|
|
151
|
-
|
|
152
|
-
// ----- PROLOGUE -------------------------
|
|
153
|
-
${RS({id:r,source:n,stage:s})}
|
|
154
|
-
${`#define SHADER_TYPE_${s.toUpperCase()}`}
|
|
155
|
-
${og(t)}
|
|
156
|
-
${ag(t)}
|
|
157
|
-
${s==="fragment"?OS:""}
|
|
158
|
-
|
|
159
|
-
// ----- APPLICATION DEFINES -------------------------
|
|
160
|
-
|
|
161
|
-
${LS(A)}
|
|
162
|
-
|
|
163
|
-
`:`${p}
|
|
164
|
-
`;break}let x=Fu(c),b={},M={},C={};for(let I in u){let B=typeof u[I]=="string"?{injection:u[I],order:0}:u[I],S=/^(v|f)s:(#)?([\w-]+)$/.exec(I);if(S){let y=S[2],R=S[3];y?R==="decl"?M[I]=[B]:C[I]=[B]:b[I]=[B]}else C[I]=[B]}for(let I of o){f&&I.checkDeprecations(m,f);let B=I.getModuleSource(s);v+=B;let S=I.injections[s];for(let y in S){let R=/^(v|f)s:#([\w-]+)$/.exec(y);if(R){let F=R[2]==="decl"?M:C;F[y]=F[y]||[],F[y].push(S[y])}else b[y]=b[y]||[],b[y].push(S[y])}}return v+="// ----- MAIN SHADER SOURCE -------------------------",v+=yg,v=ps(v,s,M),v+=Pu(x[s],b),v+=m,v=ps(v,s,C),i==="glsl"&&h!==d&&(v=ug(v,d,s)),v.trim()}function gg(t){return function(r){let n={};for(let s of t){let i=s.getUniforms(r,n);Object.assign(n,i)}return n}}function RS(t){let{id:e,source:r,stage:n}=t;return e&&r.indexOf("SHADER_NAME")===-1?`
|
|
165
|
-
#define SHADER_NAME ${e}_${n}
|
|
166
|
-
|
|
167
|
-
`:""}function LS(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e="";for(let r in t){let n=t[r];(n||Number.isFinite(n))&&(e+=`#define ${r.toUpperCase()} ${t[r]}
|
|
168
|
-
`)}return e}function vg(t){if(!t.vs)throw new Error("no vertex shader");let e=Ag(t.platformInfo,t.vs),r;return t.fs&&(r=Ag(t.platformInfo,t.fs)),{...t,vs:e,fs:r}}function Ag(t,e){if(typeof e=="string")return e;switch(t.type){case"webgpu":if(e!=null&&e.wgsl)return e.wgsl;throw new Error("WebGPU does not support GLSL shaders");default:if(e!=null&&e.glsl)return e.glsl;throw new Error("WebGL does not support WGSL shaders")}}var rt=class{constructor(){this._hookFunctions=[],this._defaultModules=[]}static getDefaultShaderAssembler(){return rt.defaultShaderAssembler=rt.defaultShaderAssembler||new rt,rt.defaultShaderAssembler}addDefaultModule(e){this._defaultModules.find(r=>r.name===(typeof e=="string"?e:e.name))||this._defaultModules.push(e)}removeDefaultModule(e){let r=typeof e=="string"?e:e.name;this._defaultModules=this._defaultModules.filter(n=>n.name!==r)}addShaderHook(e,r){r&&(e=Object.assign(r,{hook:e})),this._hookFunctions.push(e)}assembleShaders(e){let r=this._getModuleList(e.modules),n=this._hookFunctions,s=vg(e);return{..._g({platformInfo:e.platformInfo,...s,modules:r,hookFunctions:n}),modules:r}}_getModuleList(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=new Array(this._defaultModules.length+e.length),n={},s=0;for(let i=0,o=this._defaultModules.length;i<o;++i){let a=this._defaultModules[i],c=a.name;r[s++]=a,n[c]=!0}for(let i=0,o=e.length;i<o;++i){let a=e[i],c=a.name;n[c]||(r[s++]=a,n[c]=!0)}return r.length=s,tt.instantiateModules(r)}};rt.defaultShaderAssembler=void 0;var Nu=class{constructor(){this.constants=new Map,this.aliases=new Map,this.structs=new Map}},It=class{constructor(){}get isAstNode(){return!0}get astNodeType(){return""}evaluate(e){throw new Error("Cannot evaluate node")}evaluateString(e){return this.evaluate(e).toString()}},ie=class extends It{constructor(){super()}},ao=class extends ie{constructor(e,r,n,s){super(),this.name=e,this.args=r,this.returnType=n,this.body=s}get astNodeType(){return"function"}},Du=class extends ie{constructor(e){super(),this.expression=e}get astNodeType(){return"staticAssert"}},Uu=class extends ie{constructor(e,r){super(),this.condition=e,this.body=r}get astNodeType(){return"while"}},Gu=class extends ie{constructor(e){super(),this.body=e}get astNodeType(){return"continuing"}},ku=class extends ie{constructor(e,r,n,s){super(),this.init=e,this.condition=r,this.increment=n,this.body=s}get astNodeType(){return"for"}},$t=class extends ie{constructor(e,r,n,s,i){super(),this.name=e,this.type=r,this.storage=n,this.access=s,this.value=i}get astNodeType(){return"var"}},co=class extends ie{constructor(e,r,n){super(),this.name=e,this.type=r,this.value=n}get astNodeType(){return"override"}},uo=class extends ie{constructor(e,r,n,s,i){super(),this.name=e,this.type=r,this.storage=n,this.access=s,this.value=i}get astNodeType(){return"let"}},lo=class extends ie{constructor(e,r,n,s,i){super(),this.name=e,this.type=r,this.storage=n,this.access=s,this.value=i}get astNodeType(){return"const"}evaluate(e){return this.value.evaluate(e)}},un;(function(t){t.increment="++",t.decrement="--"})(un||(un={}));(function(t){function e(r){let n=r;if(n=="parse")throw new Error("Invalid value for IncrementOperator");return t[n]}t.parse=e})(un||(un={}));var Hu=class extends ie{constructor(e,r){super(),this.operator=e,this.variable=r}get astNodeType(){return"increment"}},_s;(function(t){t.assign="=",t.addAssign="+=",t.subtractAssin="-=",t.multiplyAssign="*=",t.divideAssign="/=",t.moduloAssign="%=",t.andAssign="&=",t.orAssign="|=",t.xorAssign="^=",t.shiftLeftAssign="<<=",t.shiftRightAssign=">>="})(_s||(_s={}));(function(t){function e(r){let n=r;if(n=="parse")throw new Error("Invalid value for AssignOperator");return t[n]}t.parse=e})(_s||(_s={}));var Vu=class extends ie{constructor(e,r,n){super(),this.operator=e,this.variable=r,this.value=n}get astNodeType(){return"assign"}},zu=class extends ie{constructor(e,r){super(),this.name=e,this.args=r}get astNodeType(){return"call"}},ju=class extends ie{constructor(e,r){super(),this.body=e,this.continuing=r}get astNodeType(){return"loop"}},qu=class extends ie{constructor(e,r){super(),this.condition=e,this.body=r}get astNodeType(){return"body"}},Ju=class extends ie{constructor(e,r,n,s){super(),this.condition=e,this.body=r,this.elseif=n,this.else=s}get astNodeType(){return"if"}},Wu=class extends ie{constructor(e){super(),this.value=e}get astNodeType(){return"return"}},Xu=class extends ie{constructor(e){super(),this.name=e}get astNodeType(){return"enable"}},fo=class extends ie{constructor(e,r){super(),this.name=e,this.type=r}get astNodeType(){return"alias"}},Ku=class extends ie{constructor(){super()}get astNodeType(){return"discard"}},Yu=class extends ie{constructor(){super()}get astNodeType(){return"break"}},Zu=class extends ie{constructor(){super()}get astNodeType(){return"continue"}},Ot=class extends ie{constructor(e){super(),this.name=e}get astNodeType(){return"type"}get isStruct(){return!1}get isArray(){return!1}},Mt=class extends Ot{constructor(e,r){super(e),this.members=r}get astNodeType(){return"struct"}get isStruct(){return!0}getMemberIndex(e){for(let r=0;r<this.members.length;r++)if(this.members[r].name==e)return r;return-1}},ho=class extends Ot{constructor(e,r,n){super(e),this.format=r,this.access=n}get astNodeType(){return"template"}},Qu=class extends Ot{constructor(e,r,n,s){super(e),this.storage=r,this.type=n,this.access=s}get astNodeType(){return"pointer"}},po=class extends Ot{constructor(e,r,n,s){super(e),this.attributes=r,this.format=n,this.count=s}get astNodeType(){return"array"}get isArray(){return!0}},wr=class extends Ot{constructor(e,r,n){super(e),this.format=r,this.access=n}get astNodeType(){return"sampler"}},je=class extends It{constructor(){super()}},mo=class extends je{constructor(e){super(),this.value=e}get astNodeType(){return"stringExpr"}toString(){return this.value}evaluateString(){return this.value}},Sr=class extends je{constructor(e,r){super(),this.type=e,this.args=r}get astNodeType(){return"createExpr"}},$u=class extends je{constructor(e,r){super(),this.name=e,this.args=r}get astNodeType(){return"callExpr"}evaluate(e){switch(this.name){case"abs":return Math.abs(this.args[0].evaluate(e));case"acos":return Math.acos(this.args[0].evaluate(e));case"acosh":return Math.acosh(this.args[0].evaluate(e));case"asin":return Math.asin(this.args[0].evaluate(e));case"asinh":return Math.asinh(this.args[0].evaluate(e));case"atan":return Math.atan(this.args[0].evaluate(e));case"atan2":return Math.atan2(this.args[0].evaluate(e),this.args[1].evaluate(e));case"atanh":return Math.atanh(this.args[0].evaluate(e));case"ceil":return Math.ceil(this.args[0].evaluate(e));case"clamp":return Math.min(Math.max(this.args[0].evaluate(e),this.args[1].evaluate(e)),this.args[2].evaluate(e));case"cos":return Math.cos(this.args[0].evaluate(e));case"degrees":return this.args[0].evaluate(e)*180/Math.PI;case"distance":return Math.sqrt(Math.pow(this.args[0].evaluate(e)-this.args[1].evaluate(e),2));case"dot":case"exp":return Math.exp(this.args[0].evaluate(e));case"exp2":return Math.pow(2,this.args[0].evaluate(e));case"floor":return Math.floor(this.args[0].evaluate(e));case"fma":return this.args[0].evaluate(e)*this.args[1].evaluate(e)+this.args[2].evaluate(e);case"fract":return this.args[0].evaluate(e)-Math.floor(this.args[0].evaluate(e));case"inverseSqrt":return 1/Math.sqrt(this.args[0].evaluate(e));case"log":return Math.log(this.args[0].evaluate(e));case"log2":return Math.log2(this.args[0].evaluate(e));case"max":return Math.max(this.args[0].evaluate(e),this.args[1].evaluate(e));case"min":return Math.min(this.args[0].evaluate(e),this.args[1].evaluate(e));case"mix":return this.args[0].evaluate(e)*(1-this.args[2].evaluate(e))+this.args[1].evaluate(e)*this.args[2].evaluate(e);case"modf":return this.args[0].evaluate(e)-Math.floor(this.args[0].evaluate(e));case"pow":return Math.pow(this.args[0].evaluate(e),this.args[1].evaluate(e));case"radians":return this.args[0].evaluate(e)*Math.PI/180;case"round":return Math.round(this.args[0].evaluate(e));case"sign":return Math.sign(this.args[0].evaluate(e));case"sin":return Math.sin(this.args[0].evaluate(e));case"sinh":return Math.sinh(this.args[0].evaluate(e));case"saturate":return Math.min(Math.max(this.args[0].evaluate(e),0),1);case"smoothstep":return this.args[0].evaluate(e)*this.args[0].evaluate(e)*(3-2*this.args[0].evaluate(e));case"sqrt":return Math.sqrt(this.args[0].evaluate(e));case"step":return this.args[0].evaluate(e)<this.args[1].evaluate(e)?0:1;case"tan":return Math.tan(this.args[0].evaluate(e));case"tanh":return Math.tanh(this.args[0].evaluate(e));case"trunc":return Math.trunc(this.args[0].evaluate(e));default:throw new Error("Non const function: "+this.name)}}},el=class extends je{constructor(e){super(),this.name=e}get astNodeType(){return"varExpr"}},go=class extends je{constructor(e,r){super(),this.name=e,this.initializer=r}get astNodeType(){return"constExpr"}evaluate(e){var r,n;if(this.initializer instanceof Sr){let s=(r=this.postfix)===null||r===void 0?void 0:r.evaluateString(e),i=(n=this.initializer.type)===null||n===void 0?void 0:n.name,o=e.structs.get(i),a=o?.getMemberIndex(s);if(a!=-1)return this.initializer.args[a].evaluate(e);console.log(a)}return this.initializer.evaluate(e)}},yo=class extends je{constructor(e){super(),this.value=e}get astNodeType(){return"literalExpr"}evaluate(){return this.value}},tl=class extends je{constructor(e,r){super(),this.type=e,this.value=r}get astNodeType(){return"bitcastExpr"}},rl=class extends je{constructor(e,r){super(),this.type=e,this.args=r}get astNodeType(){return"typecastExpr"}evaluate(e){return this.args[0].evaluate(e)}},_o=class extends je{constructor(e){super(),this.contents=e}get astNodeType(){return"groupExpr"}evaluate(e){return this.contents[0].evaluate(e)}},Ao=class extends je{constructor(){super()}},nl=class extends Ao{constructor(e,r){super(),this.operator=e,this.right=r}get astNodeType(){return"unaryOp"}evaluate(e){switch(this.operator){case"+":return this.right.evaluate(e);case"-":return-this.right.evaluate(e);case"!":return this.right.evaluate(e)?0:1;case"~":return~this.right.evaluate(e);default:throw new Error("Unknown unary operator: "+this.operator)}}},Ve=class extends Ao{constructor(e,r,n){super(),this.operator=e,this.left=r,this.right=n}get astNodeType(){return"binaryOp"}evaluate(e){switch(this.operator){case"+":return this.left.evaluate(e)+this.right.evaluate(e);case"-":return this.left.evaluate(e)-this.right.evaluate(e);case"*":return this.left.evaluate(e)*this.right.evaluate(e);case"/":return this.left.evaluate(e)/this.right.evaluate(e);case"%":return this.left.evaluate(e)%this.right.evaluate(e);case"==":return this.left.evaluate(e)==this.right.evaluate(e)?1:0;case"!=":return this.left.evaluate(e)!=this.right.evaluate(e)?1:0;case"<":return this.left.evaluate(e)<this.right.evaluate(e)?1:0;case">":return this.left.evaluate(e)>this.right.evaluate(e)?1:0;case"<=":return this.left.evaluate(e)<=this.right.evaluate(e)?1:0;case">=":return this.left.evaluate(e)>=this.right.evaluate(e)?1:0;case"&&":return this.left.evaluate(e)&&this.right.evaluate(e)?1:0;case"||":return this.left.evaluate(e)||this.right.evaluate(e)?1:0;default:throw new Error(`Unknown operator ${this.operator}`)}}},vo=class extends It{constructor(){super()}},sl=class extends vo{constructor(e,r){super(),this.selector=e,this.body=r}get astNodeType(){return"case"}},il=class extends vo{constructor(e){super(),this.body=e}get astNodeType(){return"default"}},ol=class extends It{constructor(e,r,n){super(),this.name=e,this.type=r,this.attributes=n}get astNodeType(){return"argument"}},al=class extends It{constructor(e,r){super(),this.condition=e,this.body=r}get astNodeType(){return"elseif"}},cl=class extends It{constructor(e,r,n){super(),this.name=e,this.type=r,this.attributes=n}get astNodeType(){return"member"}},xo=class extends It{constructor(e,r){super(),this.name=e,this.value=r}get astNodeType(){return"attribute"}},O,E;(function(t){t[t.token=0]="token",t[t.keyword=1]="keyword",t[t.reserved=2]="reserved"})(E||(E={}));var T=class{constructor(e,r,n){this.name=e,this.type=r,this.rule=n}toString(){return this.name}},_=class{};O=_;_.none=new T("",E.reserved,"");_.eof=new T("EOF",E.token,"");_.reserved={asm:new T("asm",E.reserved,"asm"),bf16:new T("bf16",E.reserved,"bf16"),do:new T("do",E.reserved,"do"),enum:new T("enum",E.reserved,"enum"),f16:new T("f16",E.reserved,"f16"),f64:new T("f64",E.reserved,"f64"),handle:new T("handle",E.reserved,"handle"),i8:new T("i8",E.reserved,"i8"),i16:new T("i16",E.reserved,"i16"),i64:new T("i64",E.reserved,"i64"),mat:new T("mat",E.reserved,"mat"),premerge:new T("premerge",E.reserved,"premerge"),regardless:new T("regardless",E.reserved,"regardless"),typedef:new T("typedef",E.reserved,"typedef"),u8:new T("u8",E.reserved,"u8"),u16:new T("u16",E.reserved,"u16"),u64:new T("u64",E.reserved,"u64"),unless:new T("unless",E.reserved,"unless"),using:new T("using",E.reserved,"using"),vec:new T("vec",E.reserved,"vec"),void:new T("void",E.reserved,"void")};_.keywords={array:new T("array",E.keyword,"array"),atomic:new T("atomic",E.keyword,"atomic"),bool:new T("bool",E.keyword,"bool"),f32:new T("f32",E.keyword,"f32"),i32:new T("i32",E.keyword,"i32"),mat2x2:new T("mat2x2",E.keyword,"mat2x2"),mat2x3:new T("mat2x3",E.keyword,"mat2x3"),mat2x4:new T("mat2x4",E.keyword,"mat2x4"),mat3x2:new T("mat3x2",E.keyword,"mat3x2"),mat3x3:new T("mat3x3",E.keyword,"mat3x3"),mat3x4:new T("mat3x4",E.keyword,"mat3x4"),mat4x2:new T("mat4x2",E.keyword,"mat4x2"),mat4x3:new T("mat4x3",E.keyword,"mat4x3"),mat4x4:new T("mat4x4",E.keyword,"mat4x4"),ptr:new T("ptr",E.keyword,"ptr"),sampler:new T("sampler",E.keyword,"sampler"),sampler_comparison:new T("sampler_comparison",E.keyword,"sampler_comparison"),struct:new T("struct",E.keyword,"struct"),texture_1d:new T("texture_1d",E.keyword,"texture_1d"),texture_2d:new T("texture_2d",E.keyword,"texture_2d"),texture_2d_array:new T("texture_2d_array",E.keyword,"texture_2d_array"),texture_3d:new T("texture_3d",E.keyword,"texture_3d"),texture_cube:new T("texture_cube",E.keyword,"texture_cube"),texture_cube_array:new T("texture_cube_array",E.keyword,"texture_cube_array"),texture_multisampled_2d:new T("texture_multisampled_2d",E.keyword,"texture_multisampled_2d"),texture_storage_1d:new T("texture_storage_1d",E.keyword,"texture_storage_1d"),texture_storage_2d:new T("texture_storage_2d",E.keyword,"texture_storage_2d"),texture_storage_2d_array:new T("texture_storage_2d_array",E.keyword,"texture_storage_2d_array"),texture_storage_3d:new T("texture_storage_3d",E.keyword,"texture_storage_3d"),texture_depth_2d:new T("texture_depth_2d",E.keyword,"texture_depth_2d"),texture_depth_2d_array:new T("texture_depth_2d_array",E.keyword,"texture_depth_2d_array"),texture_depth_cube:new T("texture_depth_cube",E.keyword,"texture_depth_cube"),texture_depth_cube_array:new T("texture_depth_cube_array",E.keyword,"texture_depth_cube_array"),texture_depth_multisampled_2d:new T("texture_depth_multisampled_2d",E.keyword,"texture_depth_multisampled_2d"),texture_external:new T("texture_external",E.keyword,"texture_external"),u32:new T("u32",E.keyword,"u32"),vec2:new T("vec2",E.keyword,"vec2"),vec3:new T("vec3",E.keyword,"vec3"),vec4:new T("vec4",E.keyword,"vec4"),bitcast:new T("bitcast",E.keyword,"bitcast"),block:new T("block",E.keyword,"block"),break:new T("break",E.keyword,"break"),case:new T("case",E.keyword,"case"),continue:new T("continue",E.keyword,"continue"),continuing:new T("continuing",E.keyword,"continuing"),default:new T("default",E.keyword,"default"),discard:new T("discard",E.keyword,"discard"),else:new T("else",E.keyword,"else"),enable:new T("enable",E.keyword,"enable"),fallthrough:new T("fallthrough",E.keyword,"fallthrough"),false:new T("false",E.keyword,"false"),fn:new T("fn",E.keyword,"fn"),for:new T("for",E.keyword,"for"),function:new T("function",E.keyword,"function"),if:new T("if",E.keyword,"if"),let:new T("let",E.keyword,"let"),const:new T("const",E.keyword,"const"),loop:new T("loop",E.keyword,"loop"),while:new T("while",E.keyword,"while"),private:new T("private",E.keyword,"private"),read:new T("read",E.keyword,"read"),read_write:new T("read_write",E.keyword,"read_write"),return:new T("return",E.keyword,"return"),storage:new T("storage",E.keyword,"storage"),switch:new T("switch",E.keyword,"switch"),true:new T("true",E.keyword,"true"),alias:new T("alias",E.keyword,"alias"),type:new T("type",E.keyword,"type"),uniform:new T("uniform",E.keyword,"uniform"),var:new T("var",E.keyword,"var"),override:new T("override",E.keyword,"override"),workgroup:new T("workgroup",E.keyword,"workgroup"),write:new T("write",E.keyword,"write"),r8unorm:new T("r8unorm",E.keyword,"r8unorm"),r8snorm:new T("r8snorm",E.keyword,"r8snorm"),r8uint:new T("r8uint",E.keyword,"r8uint"),r8sint:new T("r8sint",E.keyword,"r8sint"),r16uint:new T("r16uint",E.keyword,"r16uint"),r16sint:new T("r16sint",E.keyword,"r16sint"),r16float:new T("r16float",E.keyword,"r16float"),rg8unorm:new T("rg8unorm",E.keyword,"rg8unorm"),rg8snorm:new T("rg8snorm",E.keyword,"rg8snorm"),rg8uint:new T("rg8uint",E.keyword,"rg8uint"),rg8sint:new T("rg8sint",E.keyword,"rg8sint"),r32uint:new T("r32uint",E.keyword,"r32uint"),r32sint:new T("r32sint",E.keyword,"r32sint"),r32float:new T("r32float",E.keyword,"r32float"),rg16uint:new T("rg16uint",E.keyword,"rg16uint"),rg16sint:new T("rg16sint",E.keyword,"rg16sint"),rg16float:new T("rg16float",E.keyword,"rg16float"),rgba8unorm:new T("rgba8unorm",E.keyword,"rgba8unorm"),rgba8unorm_srgb:new T("rgba8unorm_srgb",E.keyword,"rgba8unorm_srgb"),rgba8snorm:new T("rgba8snorm",E.keyword,"rgba8snorm"),rgba8uint:new T("rgba8uint",E.keyword,"rgba8uint"),rgba8sint:new T("rgba8sint",E.keyword,"rgba8sint"),bgra8unorm:new T("bgra8unorm",E.keyword,"bgra8unorm"),bgra8unorm_srgb:new T("bgra8unorm_srgb",E.keyword,"bgra8unorm_srgb"),rgb10a2unorm:new T("rgb10a2unorm",E.keyword,"rgb10a2unorm"),rg11b10float:new T("rg11b10float",E.keyword,"rg11b10float"),rg32uint:new T("rg32uint",E.keyword,"rg32uint"),rg32sint:new T("rg32sint",E.keyword,"rg32sint"),rg32float:new T("rg32float",E.keyword,"rg32float"),rgba16uint:new T("rgba16uint",E.keyword,"rgba16uint"),rgba16sint:new T("rgba16sint",E.keyword,"rgba16sint"),rgba16float:new T("rgba16float",E.keyword,"rgba16float"),rgba32uint:new T("rgba32uint",E.keyword,"rgba32uint"),rgba32sint:new T("rgba32sint",E.keyword,"rgba32sint"),rgba32float:new T("rgba32float",E.keyword,"rgba32float"),static_assert:new T("static_assert",E.keyword,"static_assert")};_.tokens={decimal_float_literal:new T("decimal_float_literal",E.token,/((-?[0-9]*\.[0-9]+|-?[0-9]+\.[0-9]*)((e|E)(\+|-)?[0-9]+)?f?)|(-?[0-9]+(e|E)(\+|-)?[0-9]+f?)|([0-9]+f)/),hex_float_literal:new T("hex_float_literal",E.token,/-?0x((([0-9a-fA-F]*\.[0-9a-fA-F]+|[0-9a-fA-F]+\.[0-9a-fA-F]*)((p|P)(\+|-)?[0-9]+f?)?)|([0-9a-fA-F]+(p|P)(\+|-)?[0-9]+f?))/),int_literal:new T("int_literal",E.token,/-?0x[0-9a-fA-F]+|0i?|-?[1-9][0-9]*i?/),uint_literal:new T("uint_literal",E.token,/0x[0-9a-fA-F]+u|0u|[1-9][0-9]*u/),ident:new T("ident",E.token,/[a-zA-Z][0-9a-zA-Z_]*/),and:new T("and",E.token,"&"),and_and:new T("and_and",E.token,"&&"),arrow:new T("arrow ",E.token,"->"),attr:new T("attr",E.token,"@"),attr_left:new T("attr_left",E.token,"[["),attr_right:new T("attr_right",E.token,"]]"),forward_slash:new T("forward_slash",E.token,"/"),bang:new T("bang",E.token,"!"),bracket_left:new T("bracket_left",E.token,"["),bracket_right:new T("bracket_right",E.token,"]"),brace_left:new T("brace_left",E.token,"{"),brace_right:new T("brace_right",E.token,"}"),colon:new T("colon",E.token,":"),comma:new T("comma",E.token,","),equal:new T("equal",E.token,"="),equal_equal:new T("equal_equal",E.token,"=="),not_equal:new T("not_equal",E.token,"!="),greater_than:new T("greater_than",E.token,">"),greater_than_equal:new T("greater_than_equal",E.token,">="),shift_right:new T("shift_right",E.token,">>"),less_than:new T("less_than",E.token,"<"),less_than_equal:new T("less_than_equal",E.token,"<="),shift_left:new T("shift_left",E.token,"<<"),modulo:new T("modulo",E.token,"%"),minus:new T("minus",E.token,"-"),minus_minus:new T("minus_minus",E.token,"--"),period:new T("period",E.token,"."),plus:new T("plus",E.token,"+"),plus_plus:new T("plus_plus",E.token,"++"),or:new T("or",E.token,"|"),or_or:new T("or_or",E.token,"||"),paren_left:new T("paren_left",E.token,"("),paren_right:new T("paren_right",E.token,")"),semicolon:new T("semicolon",E.token,";"),star:new T("star",E.token,"*"),tilde:new T("tilde",E.token,"~"),underscore:new T("underscore",E.token,"_"),xor:new T("xor",E.token,"^"),plus_equal:new T("plus_equal",E.token,"+="),minus_equal:new T("minus_equal",E.token,"-="),times_equal:new T("times_equal",E.token,"*="),division_equal:new T("division_equal",E.token,"/="),modulo_equal:new T("modulo_equal",E.token,"%="),and_equal:new T("and_equal",E.token,"&="),or_equal:new T("or_equal",E.token,"|="),xor_equal:new T("xor_equal",E.token,"^="),shift_right_equal:new T("shift_right_equal",E.token,">>="),shift_left_equal:new T("shift_left_equal",E.token,"<<=")};_.storage_class=[O.keywords.function,O.keywords.private,O.keywords.workgroup,O.keywords.uniform,O.keywords.storage];_.access_mode=[O.keywords.read,O.keywords.write,O.keywords.read_write];_.sampler_type=[O.keywords.sampler,O.keywords.sampler_comparison];_.sampled_texture_type=[O.keywords.texture_1d,O.keywords.texture_2d,O.keywords.texture_2d_array,O.keywords.texture_3d,O.keywords.texture_cube,O.keywords.texture_cube_array];_.multisampled_texture_type=[O.keywords.texture_multisampled_2d];_.storage_texture_type=[O.keywords.texture_storage_1d,O.keywords.texture_storage_2d,O.keywords.texture_storage_2d_array,O.keywords.texture_storage_3d];_.depth_texture_type=[O.keywords.texture_depth_2d,O.keywords.texture_depth_2d_array,O.keywords.texture_depth_cube,O.keywords.texture_depth_cube_array,O.keywords.texture_depth_multisampled_2d];_.texture_external_type=[O.keywords.texture_external];_.any_texture_type=[...O.sampled_texture_type,...O.multisampled_texture_type,...O.storage_texture_type,...O.depth_texture_type,...O.texture_external_type];_.texel_format=[O.keywords.r8unorm,O.keywords.r8snorm,O.keywords.r8uint,O.keywords.r8sint,O.keywords.r16uint,O.keywords.r16sint,O.keywords.r16float,O.keywords.rg8unorm,O.keywords.rg8snorm,O.keywords.rg8uint,O.keywords.rg8sint,O.keywords.r32uint,O.keywords.r32sint,O.keywords.r32float,O.keywords.rg16uint,O.keywords.rg16sint,O.keywords.rg16float,O.keywords.rgba8unorm,O.keywords.rgba8unorm_srgb,O.keywords.rgba8snorm,O.keywords.rgba8uint,O.keywords.rgba8sint,O.keywords.bgra8unorm,O.keywords.bgra8unorm_srgb,O.keywords.rgb10a2unorm,O.keywords.rg11b10float,O.keywords.rg32uint,O.keywords.rg32sint,O.keywords.rg32float,O.keywords.rgba16uint,O.keywords.rgba16sint,O.keywords.rgba16float,O.keywords.rgba32uint,O.keywords.rgba32sint,O.keywords.rgba32float];_.const_literal=[O.tokens.int_literal,O.tokens.uint_literal,O.tokens.decimal_float_literal,O.tokens.hex_float_literal,O.keywords.true,O.keywords.false];_.literal_or_ident=[O.tokens.ident,O.tokens.int_literal,O.tokens.uint_literal,O.tokens.decimal_float_literal,O.tokens.hex_float_literal];_.element_count_expression=[O.tokens.int_literal,O.tokens.uint_literal,O.tokens.ident];_.template_types=[O.keywords.vec2,O.keywords.vec3,O.keywords.vec4,O.keywords.mat2x2,O.keywords.mat2x3,O.keywords.mat2x4,O.keywords.mat3x2,O.keywords.mat3x3,O.keywords.mat3x4,O.keywords.mat4x2,O.keywords.mat4x3,O.keywords.mat4x4,O.keywords.atomic,O.keywords.bitcast,...O.any_texture_type];_.attribute_name=[O.tokens.ident,O.keywords.block];_.assignment_operators=[O.tokens.equal,O.tokens.plus_equal,O.tokens.minus_equal,O.tokens.times_equal,O.tokens.division_equal,O.tokens.modulo_equal,O.tokens.and_equal,O.tokens.or_equal,O.tokens.xor_equal,O.tokens.shift_right_equal,O.tokens.shift_left_equal];_.increment_operators=[O.tokens.plus_plus,O.tokens.minus_minus];var bo=class{constructor(e,r,n){this.type=e,this.lexeme=r,this.line=n}toString(){return this.lexeme}isTemplateType(){return _.template_types.indexOf(this.type)!=-1}isArrayType(){return this.type==_.keywords.array}isArrayOrTemplateType(){return this.isArrayType()||this.isTemplateType()}},ul=class{constructor(e){this._tokens=[],this._start=0,this._current=0,this._line=1,this._source=e??""}scanTokens(){for(;!this._isAtEnd();)if(this._start=this._current,!this.scanToken())throw`Invalid syntax at line ${this._line}`;return this._tokens.push(new bo(_.eof,"",this._line)),this._tokens}scanToken(){let e=this._advance();if(e==`
|
|
169
|
-
`)return this._line++,!0;if(this._isWhitespace(e))return!0;if(e=="/"){if(this._peekAhead()=="/"){for(;e!=`
|
|
170
|
-
`;){if(this._isAtEnd())return!0;e=this._advance()}return this._line++,!0}else if(this._peekAhead()=="*"){this._advance();let n=1;for(;n>0;){if(this._isAtEnd())return!0;if(e=this._advance(),e==`
|
|
171
|
-
`)this._line++;else if(e=="*"){if(this._peekAhead()=="/"&&(this._advance(),n--,n==0))return!0}else e=="/"&&this._peekAhead()=="*"&&(this._advance(),n++)}return!0}}let r=_.none;for(;;){let n=this._findType(e),s=this._peekAhead();if(e==">"&&(s==">"||s=="=")){let i=!1,o=this._tokens.length-1;for(let a=0;a<5&&o>=0;++a,--o)if(this._tokens[o].type===_.tokens.less_than){o>0&&this._tokens[o-1].isArrayOrTemplateType()&&(i=!0);break}if(i)return this._addToken(n),!0}if(n===_.none){let i=e,o=0,a=2;for(let c=0;c<a;++c)if(i+=this._peekAhead(c),n=this._findType(i),n!==_.none){o=c;break}if(n===_.none)return r===_.none?!1:(this._current--,this._addToken(r),!0);e=i,this._current+=o+1}if(r=n,this._isAtEnd())break;e+=this._advance()}return r===_.none?!1:(this._addToken(r),!0)}_findType(e){for(let r in _.keywords){let n=_.keywords[r];if(this._match(e,n.rule))return n}for(let r in _.tokens){let n=_.tokens[r];if(this._match(e,n.rule))return n}return _.none}_match(e,r){if(typeof r=="string"){if(r==e)return!0}else{let n=r.exec(e);if(n&&n.index==0&&n[0]==e)return!0}return!1}_isAtEnd(){return this._current>=this._source.length}_isWhitespace(e){return e==" "||e==" "||e=="\r"}_advance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=this._source[this._current];return e=e||0,e++,this._current+=e,r}_peekAhead(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e=e||0,this._current+e>=this._source.length?"\0":this._source[this._current+e]}_addToken(e){let r=this._source.substring(this._start,this._current);this._tokens.push(new bo(e,r,this._line))}},ll=class{constructor(){this._tokens=[],this._current=0,this._context=new Nu}parse(e){this._initialize(e);let r=[];for(;!this._isAtEnd();){let n=this._global_decl_or_directive();if(!n)break;r.push(n)}return r}_initialize(e){if(e)if(typeof e=="string"){let r=new ul(e);this._tokens=r.scanTokens()}else this._tokens=e;else this._tokens=[];this._current=0}_error(e,r){return console.error(e,r),{token:e,message:r,toString:function(){return`${r}`}}}_isAtEnd(){return this._current>=this._tokens.length||this._peek().type==_.eof}_match(e){if(e instanceof T)return this._check(e)?(this._advance(),!0):!1;for(let r=0,n=e.length;r<n;++r){let s=e[r];if(this._check(s))return this._advance(),!0}return!1}_consume(e,r){if(this._check(e))return this._advance();throw this._error(this._peek(),r)}_check(e){if(this._isAtEnd())return!1;let r=this._peek();if(e instanceof Array){let n=r.type;return e.indexOf(n)!=-1}return r.type==e}_advance(){return this._isAtEnd()||this._current++,this._previous()}_peek(){return this._tokens[this._current]}_previous(){return this._tokens[this._current-1]}_global_decl_or_directive(){for(;this._match(_.tokens.semicolon)&&!this._isAtEnd(););if(this._match(_.keywords.alias)){let r=this._type_alias();return this._consume(_.tokens.semicolon,"Expected ';'"),r}if(this._match(_.keywords.enable)){let r=this._enable_directive();return this._consume(_.tokens.semicolon,"Expected ';'"),r}let e=this._attribute();if(this._check(_.keywords.var)){let r=this._global_variable_decl();return r!=null&&(r.attributes=e),this._consume(_.tokens.semicolon,"Expected ';'."),r}if(this._check(_.keywords.override)){let r=this._override_variable_decl();return r!=null&&(r.attributes=e),this._consume(_.tokens.semicolon,"Expected ';'."),r}if(this._check(_.keywords.let)){let r=this._global_let_decl();return r!=null&&(r.attributes=e),this._consume(_.tokens.semicolon,"Expected ';'."),r}if(this._check(_.keywords.const)){let r=this._global_const_decl();return r!=null&&(r.attributes=e),this._consume(_.tokens.semicolon,"Expected ';'."),r}if(this._check(_.keywords.struct)){let r=this._struct_decl();return r!=null&&(r.attributes=e),r}if(this._check(_.keywords.fn)){let r=this._function_decl();return r!=null&&(r.attributes=e),r}return null}_function_decl(){if(!this._match(_.keywords.fn))return null;let e=this._consume(_.tokens.ident,"Expected function name.").toString();this._consume(_.tokens.paren_left,"Expected '(' for function arguments.");let r=[];if(!this._check(_.tokens.paren_right))do{if(this._check(_.tokens.paren_right))break;let i=this._attribute(),o=this._consume(_.tokens.ident,"Expected argument name.").toString();this._consume(_.tokens.colon,"Expected ':' for argument type.");let a=this._attribute(),c=this._type_decl();c!=null&&(c.attributes=a,r.push(new ol(o,c,i)))}while(this._match(_.tokens.comma));this._consume(_.tokens.paren_right,"Expected ')' after function arguments.");let n=null;if(this._match(_.tokens.arrow)){let i=this._attribute();n=this._type_decl(),n!=null&&(n.attributes=i)}let s=this._compound_statement();return new ao(e,r,n,s)}_compound_statement(){let e=[];for(this._consume(_.tokens.brace_left,"Expected '{' for block.");!this._check(_.tokens.brace_right);){let r=this._statement();r!==null&&e.push(r)}return this._consume(_.tokens.brace_right,"Expected '}' for block."),e}_statement(){for(;this._match(_.tokens.semicolon)&&!this._isAtEnd(););if(this._check(_.keywords.if))return this._if_statement();if(this._check(_.keywords.switch))return this._switch_statement();if(this._check(_.keywords.loop))return this._loop_statement();if(this._check(_.keywords.for))return this._for_statement();if(this._check(_.keywords.while))return this._while_statement();if(this._check(_.keywords.continuing))return this._continuing_statement();if(this._check(_.keywords.static_assert))return this._static_assert_statement();if(this._check(_.tokens.brace_left))return this._compound_statement();let e=null;return this._check(_.keywords.return)?e=this._return_statement():this._check([_.keywords.var,_.keywords.let,_.keywords.const])?e=this._variable_statement():this._match(_.keywords.discard)?e=new Ku:this._match(_.keywords.break)?e=new Yu:this._match(_.keywords.continue)?e=new Zu:e=this._increment_decrement_statement()||this._func_call_statement()||this._assignment_statement(),e!=null&&this._consume(_.tokens.semicolon,"Expected ';' after statement."),e}_static_assert_statement(){if(!this._match(_.keywords.static_assert))return null;let e=this._optional_paren_expression();return new Du(e)}_while_statement(){if(!this._match(_.keywords.while))return null;let e=this._optional_paren_expression(),r=this._compound_statement();return new Uu(e,r)}_continuing_statement(){if(!this._match(_.keywords.continuing))return null;let e=this._compound_statement();return new Gu(e)}_for_statement(){if(!this._match(_.keywords.for))return null;this._consume(_.tokens.paren_left,"Expected '('.");let e=this._check(_.tokens.semicolon)?null:this._for_init();this._consume(_.tokens.semicolon,"Expected ';'.");let r=this._check(_.tokens.semicolon)?null:this._short_circuit_or_expression();this._consume(_.tokens.semicolon,"Expected ';'.");let n=this._check(_.tokens.paren_right)?null:this._for_increment();this._consume(_.tokens.paren_right,"Expected ')'.");let s=this._compound_statement();return new ku(e,r,n,s)}_for_init(){return this._variable_statement()||this._func_call_statement()||this._assignment_statement()}_for_increment(){return this._func_call_statement()||this._increment_decrement_statement()||this._assignment_statement()}_variable_statement(){if(this._check(_.keywords.var)){let e=this._variable_decl();if(e===null)throw this._error(this._peek(),"Variable declaration expected.");let r=null;return this._match(_.tokens.equal)&&(r=this._short_circuit_or_expression()),new $t(e.name,e.type,e.storage,e.access,r)}if(this._match(_.keywords.let)){let e=this._consume(_.tokens.ident,"Expected name for let.").toString(),r=null;if(this._match(_.tokens.colon)){let s=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=s)}this._consume(_.tokens.equal,"Expected '=' for let.");let n=this._short_circuit_or_expression();return new uo(e,r,null,null,n)}if(this._match(_.keywords.const)){let e=this._consume(_.tokens.ident,"Expected name for const.").toString(),r=null;if(this._match(_.tokens.colon)){let s=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=s)}this._consume(_.tokens.equal,"Expected '=' for const.");let n=this._short_circuit_or_expression();return new lo(e,r,null,null,n)}return null}_increment_decrement_statement(){let e=this._current,r=this._unary_expression();if(r==null)return null;if(!this._check(_.increment_operators))return this._current=e,null;let n=this._consume(_.increment_operators,"Expected increment operator");return new Hu(n.type===_.tokens.plus_plus?un.increment:un.decrement,r)}_assignment_statement(){let e=null;if(this._check(_.tokens.brace_right))return null;let r=this._match(_.tokens.underscore);if(r||(e=this._unary_expression()),!r&&e==null)return null;let n=this._consume(_.assignment_operators,"Expected assignment operator."),s=this._short_circuit_or_expression();return new Vu(_s.parse(n.lexeme),e,s)}_func_call_statement(){if(!this._check(_.tokens.ident))return null;let e=this._current,r=this._consume(_.tokens.ident,"Expected function name."),n=this._argument_expression_list();return n===null?(this._current=e,null):new zu(r.lexeme,n)}_loop_statement(){if(!this._match(_.keywords.loop))return null;this._consume(_.tokens.brace_left,"Expected '{' for loop.");let e=[],r=this._statement();for(;r!==null;){if(Array.isArray(r))for(let s of r)e.push(s);else e.push(r);r=this._statement()}let n=null;return this._match(_.keywords.continuing)&&(n=this._compound_statement()),this._consume(_.tokens.brace_right,"Expected '}' for loop."),new ju(e,n)}_switch_statement(){if(!this._match(_.keywords.switch))return null;let e=this._optional_paren_expression();this._consume(_.tokens.brace_left,"Expected '{' for switch.");let r=this._switch_body();if(r==null||r.length==0)throw this._error(this._previous(),"Expected 'case' or 'default'.");return this._consume(_.tokens.brace_right,"Expected '}' for switch."),new qu(e,r)}_switch_body(){let e=[];if(this._match(_.keywords.case)){let r=this._case_selectors();this._match(_.tokens.colon),this._consume(_.tokens.brace_left,"Exected '{' for switch case.");let n=this._case_body();this._consume(_.tokens.brace_right,"Exected '}' for switch case."),e.push(new sl(r,n))}if(this._match(_.keywords.default)){this._match(_.tokens.colon),this._consume(_.tokens.brace_left,"Exected '{' for switch default.");let r=this._case_body();this._consume(_.tokens.brace_right,"Exected '}' for switch default."),e.push(new il(r))}if(this._check([_.keywords.default,_.keywords.case])){let r=this._switch_body();e.push(r[0])}return e}_case_selectors(){var e,r,n,s;let i=[(r=(e=this._shift_expression())===null||e===void 0?void 0:e.evaluate(this._context).toString())!==null&&r!==void 0?r:""];for(;this._match(_.tokens.comma);)i.push((s=(n=this._shift_expression())===null||n===void 0?void 0:n.evaluate(this._context).toString())!==null&&s!==void 0?s:"");return i}_case_body(){if(this._match(_.keywords.fallthrough))return this._consume(_.tokens.semicolon,"Expected ';'"),[];let e=this._statement();if(e==null)return[];e instanceof Array||(e=[e]);let r=this._case_body();return r.length==0?e:[...e,r[0]]}_if_statement(){if(!this._match(_.keywords.if))return null;let e=this._optional_paren_expression(),r=this._compound_statement(),n=[];this._match_elseif()&&(n=this._elseif_statement(n));let s=null;return this._match(_.keywords.else)&&(s=this._compound_statement()),new Ju(e,r,n,s)}_match_elseif(){return this._tokens[this._current].type===_.keywords.else&&this._tokens[this._current+1].type===_.keywords.if?(this._advance(),this._advance(),!0):!1}_elseif_statement(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=this._optional_paren_expression(),n=this._compound_statement();return e.push(new al(r,n)),this._match_elseif()&&this._elseif_statement(e),e}_return_statement(){if(!this._match(_.keywords.return))return null;let e=this._short_circuit_or_expression();return new Wu(e)}_short_circuit_or_expression(){let e=this._short_circuit_and_expr();for(;this._match(_.tokens.or_or);)e=new Ve(this._previous().toString(),e,this._short_circuit_and_expr());return e}_short_circuit_and_expr(){let e=this._inclusive_or_expression();for(;this._match(_.tokens.and_and);)e=new Ve(this._previous().toString(),e,this._inclusive_or_expression());return e}_inclusive_or_expression(){let e=this._exclusive_or_expression();for(;this._match(_.tokens.or);)e=new Ve(this._previous().toString(),e,this._exclusive_or_expression());return e}_exclusive_or_expression(){let e=this._and_expression();for(;this._match(_.tokens.xor);)e=new Ve(this._previous().toString(),e,this._and_expression());return e}_and_expression(){let e=this._equality_expression();for(;this._match(_.tokens.and);)e=new Ve(this._previous().toString(),e,this._equality_expression());return e}_equality_expression(){let e=this._relational_expression();return this._match([_.tokens.equal_equal,_.tokens.not_equal])?new Ve(this._previous().toString(),e,this._relational_expression()):e}_relational_expression(){let e=this._shift_expression();for(;this._match([_.tokens.less_than,_.tokens.greater_than,_.tokens.less_than_equal,_.tokens.greater_than_equal]);)e=new Ve(this._previous().toString(),e,this._shift_expression());return e}_shift_expression(){let e=this._additive_expression();for(;this._match([_.tokens.shift_left,_.tokens.shift_right]);)e=new Ve(this._previous().toString(),e,this._additive_expression());return e}_additive_expression(){let e=this._multiplicative_expression();for(;this._match([_.tokens.plus,_.tokens.minus]);)e=new Ve(this._previous().toString(),e,this._multiplicative_expression());return e}_multiplicative_expression(){let e=this._unary_expression();for(;this._match([_.tokens.star,_.tokens.forward_slash,_.tokens.modulo]);)e=new Ve(this._previous().toString(),e,this._unary_expression());return e}_unary_expression(){return this._match([_.tokens.minus,_.tokens.bang,_.tokens.tilde,_.tokens.star,_.tokens.and])?new nl(this._previous().toString(),this._unary_expression()):this._singular_expression()}_singular_expression(){let e=this._primary_expression(),r=this._postfix_expression();return r&&(e.postfix=r),e}_postfix_expression(){if(this._match(_.tokens.bracket_left)){let e=this._short_circuit_or_expression();this._consume(_.tokens.bracket_right,"Expected ']'.");let r=this._postfix_expression();return r&&(e.postfix=r),e}if(this._match(_.tokens.period)){let e=this._consume(_.tokens.ident,"Expected member name."),r=this._postfix_expression(),n=new mo(e.lexeme);return r&&(n.postfix=r),n}return null}_getStruct(e){return this._context.aliases.has(e)?this._context.aliases.get(e).type:this._context.structs.has(e)?this._context.structs.get(e):null}_primary_expression(){if(this._match(_.tokens.ident)){let n=this._previous().toString();if(this._check(_.tokens.paren_left)){let s=this._argument_expression_list(),i=this._getStruct(n);return i!=null?new Sr(i,s):new $u(n,s)}if(this._context.constants.has(n)){let s=this._context.constants.get(n);return new go(n,s.value)}return new el(n)}if(this._match(_.const_literal))return new yo(parseFloat(this._previous().toString()));if(this._check(_.tokens.paren_left))return this._paren_expression();if(this._match(_.keywords.bitcast)){this._consume(_.tokens.less_than,"Expected '<'.");let n=this._type_decl();this._consume(_.tokens.greater_than,"Expected '>'.");let s=this._paren_expression();return new tl(n,s)}let e=this._type_decl(),r=this._argument_expression_list();return new rl(e,r)}_argument_expression_list(){if(!this._match(_.tokens.paren_left))return null;let e=[];do{if(this._check(_.tokens.paren_right))break;let r=this._short_circuit_or_expression();e.push(r)}while(this._match(_.tokens.comma));return this._consume(_.tokens.paren_right,"Expected ')' for agument list"),e}_optional_paren_expression(){this._match(_.tokens.paren_left);let e=this._short_circuit_or_expression();return this._match(_.tokens.paren_right),new _o([e])}_paren_expression(){this._consume(_.tokens.paren_left,"Expected '('.");let e=this._short_circuit_or_expression();return this._consume(_.tokens.paren_right,"Expected ')'."),new _o([e])}_struct_decl(){if(!this._match(_.keywords.struct))return null;let e=this._consume(_.tokens.ident,"Expected name for struct.").toString();this._consume(_.tokens.brace_left,"Expected '{' for struct body.");let r=[];for(;!this._check(_.tokens.brace_right);){let s=this._attribute(),i=this._consume(_.tokens.ident,"Expected variable name.").toString();this._consume(_.tokens.colon,"Expected ':' for struct member type.");let o=this._attribute(),a=this._type_decl();a!=null&&(a.attributes=o),this._check(_.tokens.brace_right)?this._match(_.tokens.comma):this._consume(_.tokens.comma,"Expected ',' for struct member."),r.push(new cl(i,a,s))}this._consume(_.tokens.brace_right,"Expected '}' after struct body.");let n=new Mt(e,r);return this._context.structs.set(e,n),n}_global_variable_decl(){let e=this._variable_decl();return e&&this._match(_.tokens.equal)&&(e.value=this._const_expression()),e}_override_variable_decl(){let e=this._override_decl();return e&&this._match(_.tokens.equal)&&(e.value=this._const_expression()),e}_global_const_decl(){if(!this._match(_.keywords.const))return null;let e=this._consume(_.tokens.ident,"Expected variable name"),r=null;if(this._match(_.tokens.colon)){let i=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=i)}let n=null;if(this._match(_.tokens.equal)){let i=this._short_circuit_or_expression();if(i instanceof Sr)n=i;else if(i instanceof go&&i.initializer instanceof Sr)n=i.initializer;else try{let o=i.evaluate(this._context);n=new yo(o)}catch{n=i}}let s=new lo(e.toString(),r,"","",n);return this._context.constants.set(s.name,s),s}_global_let_decl(){if(!this._match(_.keywords.let))return null;let e=this._consume(_.tokens.ident,"Expected variable name"),r=null;if(this._match(_.tokens.colon)){let s=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=s)}let n=null;return this._match(_.tokens.equal)&&(n=this._const_expression()),new uo(e.toString(),r,"","",n)}_const_expression(){if(this._match(_.const_literal))return new mo(this._previous().toString());let e=this._type_decl();this._consume(_.tokens.paren_left,"Expected '('.");let r=[];for(;!this._check(_.tokens.paren_right)&&(r.push(this._const_expression()),!!this._check(_.tokens.comma));)this._advance();return this._consume(_.tokens.paren_right,"Expected ')'."),new Sr(e,r)}_variable_decl(){if(!this._match(_.keywords.var))return null;let e="",r="";this._match(_.tokens.less_than)&&(e=this._consume(_.storage_class,"Expected storage_class.").toString(),this._match(_.tokens.comma)&&(r=this._consume(_.access_mode,"Expected access_mode.").toString()),this._consume(_.tokens.greater_than,"Expected '>'."));let n=this._consume(_.tokens.ident,"Expected variable name"),s=null;if(this._match(_.tokens.colon)){let i=this._attribute();s=this._type_decl(),s!=null&&(s.attributes=i)}return new $t(n.toString(),s,e,r,null)}_override_decl(){if(!this._match(_.keywords.override))return null;let e=this._consume(_.tokens.ident,"Expected variable name"),r=null;if(this._match(_.tokens.colon)){let n=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=n)}return new co(e.toString(),r,null)}_enable_directive(){let e=this._consume(_.tokens.ident,"identity expected.");return new Xu(e.toString())}_type_alias(){let e=this._consume(_.tokens.ident,"identity expected.");this._consume(_.tokens.equal,"Expected '=' for type alias.");let r=this._type_decl();if(r===null)throw this._error(this._peek(),"Expected Type for Alias.");this._context.aliases.has(r.name)&&(r=this._context.aliases.get(r.name).type);let n=new fo(e.toString(),r);return this._context.aliases.set(n.name,n),n}_type_decl(){if(this._check([_.tokens.ident,..._.texel_format,_.keywords.bool,_.keywords.f32,_.keywords.i32,_.keywords.u32])){let n=this._advance(),s=n.toString();return this._context.structs.has(s)?this._context.structs.get(s):this._context.aliases.has(s)?this._context.aliases.get(s).type:new Ot(n.toString())}let e=this._texture_sampler_types();if(e)return e;if(this._check(_.template_types)){let n=this._advance().toString(),s=null,i=null;return this._match(_.tokens.less_than)&&(s=this._type_decl(),i=null,this._match(_.tokens.comma)&&(i=this._consume(_.access_mode,"Expected access_mode for pointer").toString()),this._consume(_.tokens.greater_than,"Expected '>' for type.")),new ho(n,s,i)}if(this._match(_.keywords.ptr)){let n=this._previous().toString();this._consume(_.tokens.less_than,"Expected '<' for pointer.");let s=this._consume(_.storage_class,"Expected storage_class for pointer");this._consume(_.tokens.comma,"Expected ',' for pointer.");let i=this._type_decl(),o=null;return this._match(_.tokens.comma)&&(o=this._consume(_.access_mode,"Expected access_mode for pointer").toString()),this._consume(_.tokens.greater_than,"Expected '>' for pointer."),new Qu(n,s.toString(),i,o)}let r=this._attribute();if(this._match(_.keywords.array)){let n=null,s=-1,i=this._previous();if(this._match(_.tokens.less_than)){n=this._type_decl(),this._context.aliases.has(n.name)&&(n=this._context.aliases.get(n.name).type);let o="";this._match(_.tokens.comma)&&(o=this._shift_expression().evaluate(this._context).toString()),this._consume(_.tokens.greater_than,"Expected '>' for array."),s=o?parseInt(o):0}return new po(i.toString(),r,n,s)}return null}_texture_sampler_types(){if(this._match(_.sampler_type))return new wr(this._previous().toString(),null,null);if(this._match(_.depth_texture_type))return new wr(this._previous().toString(),null,null);if(this._match(_.sampled_texture_type)||this._match(_.multisampled_texture_type)){let e=this._previous();this._consume(_.tokens.less_than,"Expected '<' for sampler type.");let r=this._type_decl();return this._consume(_.tokens.greater_than,"Expected '>' for sampler type."),new wr(e.toString(),r,null)}if(this._match(_.storage_texture_type)){let e=this._previous();this._consume(_.tokens.less_than,"Expected '<' for sampler type.");let r=this._consume(_.texel_format,"Invalid texel format.").toString();this._consume(_.tokens.comma,"Expected ',' after texel format.");let n=this._consume(_.access_mode,"Expected access mode for storage texture type.").toString();return this._consume(_.tokens.greater_than,"Expected '>' for sampler type."),new wr(e.toString(),r,n)}return null}_attribute(){let e=[];for(;this._match(_.tokens.attr);){let r=this._consume(_.attribute_name,"Expected attribute name"),n=new xo(r.toString(),null);if(this._match(_.tokens.paren_left)){if(n.value=this._consume(_.literal_or_ident,"Expected attribute value").toString(),this._check(_.tokens.comma)){this._advance();do{let s=this._consume(_.literal_or_ident,"Expected attribute value").toString();n.value instanceof Array||(n.value=[n.value]),n.value.push(s)}while(this._match(_.tokens.comma))}this._consume(_.tokens.paren_right,"Expected ')'")}e.push(n)}for(;this._match(_.tokens.attr_left);){if(!this._check(_.tokens.attr_right))do{let r=this._consume(_.attribute_name,"Expected attribute name"),n=new xo(r.toString(),null);if(this._match(_.tokens.paren_left)){if(n.value=[this._consume(_.literal_or_ident,"Expected attribute value").toString()],this._check(_.tokens.comma)){this._advance();do{let s=this._consume(_.literal_or_ident,"Expected attribute value").toString();n.value.push(s)}while(this._match(_.tokens.comma))}this._consume(_.tokens.paren_right,"Expected ')'")}e.push(n)}while(this._match(_.tokens.comma));this._consume(_.tokens.attr_right,"Expected ']]' after attribute declarations")}return e.length==0?null:e}},er=class{constructor(e,r){this.name=e,this.attributes=r,this.size=0}get isArray(){return!1}get isStruct(){return!1}get isTemplate(){return!1}},To=class{constructor(e,r,n){this.name=e,this.type=r,this.attributes=n,this.offset=0,this.size=0}get isArray(){return this.type.isArray}get isStruct(){return this.type.isStruct}get isTemplate(){return this.type.isTemplate}get align(){return this.type.isStruct?this.type.align:0}get members(){return this.type.isStruct?this.type.members:null}get format(){return this.type.isArray?this.type.format:this.type.isTemplate?this.type.format:null}get count(){return this.type.isArray?this.type.count:0}get stride(){return this.type.isArray?this.type.stride:this.size}},on=class extends er{constructor(e,r){super(e,r),this.members=[],this.align=0}get isStruct(){return!0}},ys=class extends er{constructor(e,r){super(e,r),this.count=0,this.stride=0}get isArray(){return!0}},Eo=class extends er{constructor(e,r,n,s){super(e,n),this.format=r,this.access=s}get isTemplate(){return!0}},Qt;(function(t){t[t.Uniform=0]="Uniform",t[t.Storage=1]="Storage",t[t.Texture=2]="Texture",t[t.Sampler=3]="Sampler",t[t.StorageTexture=4]="StorageTexture"})(Qt||(Qt={}));var an=class{constructor(e,r,n,s,i,o,a){this.name=e,this.type=r,this.group=n,this.binding=s,this.attributes=i,this.resourceType=o,this.access=a}get isArray(){return this.type.isArray}get isStruct(){return this.type.isStruct}get isTemplate(){return this.type.isTemplate}get size(){return this.type.size}get align(){return this.type.isStruct?this.type.align:0}get members(){return this.type.isStruct?this.type.members:null}get format(){return this.type.isArray?this.type.format:this.type.isTemplate?this.type.format:null}get count(){return this.type.isArray?this.type.count:0}get stride(){return this.type.isArray?this.type.stride:this.size}},fl=class{constructor(e,r){this.name=e,this.type=r}},cn=class{constructor(e,r){this.align=e,this.size=r}},hl=class{constructor(e,r,n,s){this.name=e,this.type=r,this.locationType=n,this.location=s,this.interpolation=null}},wo=class{constructor(e,r,n,s){this.name=e,this.type=r,this.locationType=n,this.location=s}},dl=class{constructor(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;this.stage=null,this.inputs=[],this.outputs=[],this.name=e,this.stage=r}},pl=class{constructor(){this.vertex=[],this.fragment=[],this.compute=[]}},ml=class{constructor(e,r,n,s){this.name=e,this.type=r,this.attributes=n,this.id=s}},ze=class{constructor(e){this.uniforms=[],this.storage=[],this.textures=[],this.samplers=[],this.aliases=[],this.overrides=[],this.structs=[],this.entry=new pl,this._types=new Map,e&&this.update(e)}_isStorageTexture(e){return e.name=="texture_storage_1d"||e.name=="texture_storage_2d"||e.name=="texture_storage_2d_array"||e.name=="texture_storage_3d"}update(e){let n=new ll().parse(e);for(let s of n){if(s instanceof Mt){let i=this._getTypeInfo(s,null);i instanceof on&&this.structs.push(i);continue}if(s instanceof fo){this.aliases.push(this._getAliasInfo(s));continue}if(s instanceof co){let i=s,o=this._getAttributeNum(i.attributes,"id",0),a=i.type!=null?this._getTypeInfo(i.type,i.attributes):null;this.overrides.push(new ml(i.name,a,i.attributes,o));continue}if(this._isUniformVar(s)){let i=s,o=this._getAttributeNum(i.attributes,"group",0),a=this._getAttributeNum(i.attributes,"binding",0),c=this._getTypeInfo(i.type,i.attributes),u=new an(i.name,c,o,a,i.attributes,Qt.Uniform,i.access);this.uniforms.push(u);continue}if(this._isStorageVar(s)){let i=s,o=this._getAttributeNum(i.attributes,"group",0),a=this._getAttributeNum(i.attributes,"binding",0),c=this._getTypeInfo(i.type,i.attributes),u=this._isStorageTexture(c),l=new an(i.name,c,o,a,i.attributes,u?Qt.StorageTexture:Qt.Storage,i.access);this.storage.push(l);continue}if(this._isTextureVar(s)){let i=s,o=this._getAttributeNum(i.attributes,"group",0),a=this._getAttributeNum(i.attributes,"binding",0),c=this._getTypeInfo(i.type,i.attributes),u=this._isStorageTexture(c),l=new an(i.name,c,o,a,i.attributes,u?Qt.StorageTexture:Qt.Texture,i.access);u?this.storage.push(l):this.textures.push(l);continue}if(this._isSamplerVar(s)){let i=s,o=this._getAttributeNum(i.attributes,"group",0),a=this._getAttributeNum(i.attributes,"binding",0),c=this._getTypeInfo(i.type,i.attributes),u=new an(i.name,c,o,a,i.attributes,Qt.Sampler,i.access);this.samplers.push(u);continue}if(s instanceof ao){let i=this._getAttribute(s,"vertex"),o=this._getAttribute(s,"fragment"),a=this._getAttribute(s,"compute"),c=i||o||a;if(c){let u=new dl(s.name,c.name);u.inputs=this._getInputs(s.args),u.outputs=this._getOutputs(s.returnType),this.entry[c.name].push(u)}continue}}}getBindGroups(){let e=[];function r(n,s){n>=e.length&&(e.length=n+1),e[n]===void 0&&(e[n]=[]),s>=e[n].length&&(e[n].length=s+1)}for(let n of this.uniforms){r(n.group,n.binding);let s=e[n.group];s[n.binding]=n}for(let n of this.storage){r(n.group,n.binding);let s=e[n.group];s[n.binding]=n}for(let n of this.textures){r(n.group,n.binding);let s=e[n.group];s[n.binding]=n}for(let n of this.samplers){r(n.group,n.binding);let s=e[n.group];s[n.binding]=n}return e}_getOutputs(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;if(r===void 0&&(r=[]),e instanceof Mt)this._getStructOutputs(e,r);else{let n=this._getOutputInfo(e);n!==null&&r.push(n)}return r}_getStructOutputs(e,r){for(let n of e.members)if(n.type instanceof Mt)this._getStructOutputs(n.type,r);else{let s=this._getAttribute(n,"location")||this._getAttribute(n,"builtin");if(s!==null){let i=this._getTypeInfo(n.type,n.type.attributes),o=this._parseInt(s.value),a=new wo(n.name,i,s.name,o);r.push(a)}}}_getOutputInfo(e){let r=this._getAttribute(e,"location")||this._getAttribute(e,"builtin");if(r!==null){let n=this._getTypeInfo(e,e.attributes),s=this._parseInt(r.value);return new wo("",n,r.name,s)}return null}_getInputs(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;r===void 0&&(r=[]);for(let n of e)if(n.type instanceof Mt)this._getStructInputs(n.type,r);else{let s=this._getInputInfo(n);s!==null&&r.push(s)}return r}_getStructInputs(e,r){for(let n of e.members)if(n.type instanceof Mt)this._getStructInputs(n.type,r);else{let s=this._getInputInfo(n);s!==null&&r.push(s)}}_getInputInfo(e){let r=this._getAttribute(e,"location")||this._getAttribute(e,"builtin");if(r!==null){let n=this._getAttribute(e,"interpolation"),s=this._getTypeInfo(e.type,e.attributes),i=this._parseInt(r.value),o=new hl(e.name,s,r.name,i);return n!==null&&(o.interpolation=this._parseString(n.value)),o}return null}_parseString(e){return e instanceof Array&&(e=e[0]),e}_parseInt(e){e instanceof Array&&(e=e[0]);let r=parseInt(e);return isNaN(r)?e:r}_getAlias(e){for(let r of this.aliases)if(r.name==e)return r.type;return null}_getAliasInfo(e){return new fl(e.name,this._getTypeInfo(e.type,null))}_getTypeInfo(e,r){if(this._types.has(e))return this._types.get(e);if(e instanceof po){let s=e,i=this._getTypeInfo(s.format,s.attributes),o=new ys(s.name,r);return o.format=i,o.count=s.count,this._types.set(e,o),this._updateTypeInfo(o),o}if(e instanceof Mt){let s=e,i=new on(s.name,r);for(let o of s.members){let a=this._getTypeInfo(o.type,o.attributes);i.members.push(new To(o.name,a,o.attributes))}return this._types.set(e,i),this._updateTypeInfo(i),i}if(e instanceof wr){let s=e,i=s.format instanceof Ot,o=s.format?i?this._getTypeInfo(s.format,null):new er(s.format,null):null,a=new Eo(s.name,o,r,s.access);return this._types.set(e,a),this._updateTypeInfo(a),a}if(e instanceof ho){let s=e,i=s.format?this._getTypeInfo(s.format,null):null,o=new Eo(s.name,i,r,s.access);return this._types.set(e,o),this._updateTypeInfo(o),o}let n=new er(e.name,r);return this._types.set(e,n),this._updateTypeInfo(n),n}_updateTypeInfo(e){var r,n;let s=this._getTypeSize(e);if(e.size=(r=s?.size)!==null&&r!==void 0?r:0,e instanceof ys){let i=this._getTypeSize(e.format);e.stride=(n=i?.size)!==null&&n!==void 0?n:0,this._updateTypeInfo(e.format)}e instanceof on&&this._updateStructInfo(e)}_updateStructInfo(e){var r;let n=0,s=0,i=0,o=0;for(let a=0,c=e.members.length;a<c;++a){let u=e.members[a],l=this._getTypeSize(u);if(!l)continue;(r=this._getAlias(u.type.name))!==null&&r!==void 0||u.type;let f=l.align,h=l.size;n=this._roundUp(f,n+s),s=h,i=n,o=Math.max(o,f),u.offset=n,u.size=h,this._updateTypeInfo(u.type)}e.size=this._roundUp(o,i+s),e.align=o}_getTypeSize(e){var r;if(e==null)return null;let n=this._getAttributeNum(e.attributes,"size",0),s=this._getAttributeNum(e.attributes,"align",0);if(e instanceof To&&(e=e.type),e instanceof er){let i=this._getAlias(e.name);i!==null&&(e=i)}{let i=ze._typeInfo[e.name];if(i!==void 0){let o=e.format==="f16"?2:1;return new cn(Math.max(s,i.align/o),Math.max(n,i.size/o))}}{let i=ze._typeInfo[e.name.substring(0,e.name.length-1)];if(i){let o=e.name[e.name.length-1]==="h"?2:1;return new cn(Math.max(s,i.align/o),Math.max(n,i.size/o))}}if(e instanceof ys){let i=e,o=8,a=8,c=this._getTypeSize(i.format);c!==null&&(a=c.size,o=c.align);let u=i.count,l=this._getAttributeNum((r=e?.attributes)!==null&&r!==void 0?r:null,"stride",this._roundUp(o,a));return a=u*l,n&&(a=n),new cn(Math.max(s,o),Math.max(n,a))}if(e instanceof on){let i=0,o=0,a=0,c=0,u=0;for(let l of e.members){let f=this._getTypeSize(l.type);f!==null&&(i=Math.max(f.align,i),a=this._roundUp(f.align,a+c),c=f.size,u=a)}return o=this._roundUp(i,u+c),new cn(Math.max(s,i),Math.max(n,o))}return null}_isUniformVar(e){return e instanceof $t&&e.storage=="uniform"}_isStorageVar(e){return e instanceof $t&&e.storage=="storage"}_isTextureVar(e){return e instanceof $t&&e.type!==null&&ze._textureTypes.indexOf(e.type.name)!=-1}_isSamplerVar(e){return e instanceof $t&&e.type!==null&&ze._samplerTypes.indexOf(e.type.name)!=-1}_getAttribute(e,r){let n=e;if(!n||!n.attributes)return null;let s=n.attributes;for(let i of s)if(i.name==r)return i;return null}_getAttributeNum(e,r,n){if(e===null)return n;for(let s of e)if(s.name==r){let i=s!==null&&s.value!==null?s.value:n;return i instanceof Array&&(i=i[0]),typeof i=="number"?i:typeof i=="string"?parseInt(i):n}return n}_roundUp(e,r){return Math.ceil(r/e)*e}};ze._typeInfo={f16:{align:2,size:2},i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},atomic:{align:4,size:4},vec2:{align:8,size:8},vec3:{align:16,size:12},vec4:{align:16,size:16},mat2x2:{align:8,size:16},mat3x2:{align:8,size:24},mat4x2:{align:8,size:32},mat2x3:{align:16,size:32},mat3x3:{align:16,size:48},mat4x3:{align:16,size:64},mat2x4:{align:16,size:32},mat3x4:{align:16,size:48},mat4x4:{align:16,size:64}};ze._textureTypes=_.any_texture_type.map(t=>t.name);ze._samplerTypes=_.sampler_type.map(t=>t.name);function So(t){let e={attributes:[],bindings:[]},r=PS(t);for(let i of r.uniforms){let o=[];for(let a of i.type.members)o.push({name:a.name,type:xg(a.type)});e.bindings.push({type:"uniform",name:i.name,location:i.binding,group:i.group,members:o})}let n=r.entry.vertex[0],s=n.inputs.length;for(let i=0;i<s;i++){let o=n.inputs[i];if(o.locationType==="location"){let a=xg(o.type);e.attributes.push({name:o.name,location:o.location,type:a})}}return e}function xg(t){return t.format?`${t.name}<${t.format.name}>`:t.name}function PS(t){try{return new ze(t)}catch(e){if(e instanceof Error)throw e;let r="WGSL parse error";throw typeof e=="object"&&e!==null&&e!==void 0&&e.message&&(r+=`: ${e.message} `),typeof e=="object"&&e!==null&&e!==void 0&&e.token&&(r+=e.token.line||""),new Error(r,{cause:e})}}var gl=ue`\
|
|
28
|
+
`},e}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})}draw(e){let{fadeTrail:r,trailLength:n,currentTime:s}=this.props;e.uniforms={...e.uniforms,fadeTrail:r,trailLength:n,currentTime:s},super.draw(e)}},Tn=ks;(()=>{ks.layerName="TripsLayer"})(),(()=>{ks.defaultProps=X1})();var xu=v(Gs(),1),Su=v(Lt(),1);var bt=v(Gs(),1),Js=v(Lt(),1),Rn=v(Ut(),1);var En=v(Gs(),1);function Ks(t,e){e=e===void 0?t[0][0]:e;for(let r of t){let n=r[0]-e;n>180?r[0]-=360:n<-180&&(r[0]+=360)}}function W1(t,e,r){let[n,s]=(0,En.cellToLatLng)(t),i=e.length;Ks(e,s);let o=e[0]===e[i-1]?i-1:i;for(let a=0;a<o;a++)e[a][0]=Re(s,e[a][0],r),e[a][1]=Re(n,e[a][1],r)}function Eu(t,e,r){let n=t(e,r),[s,i]=(0,En.cellToLatLng)(n);return[i,s]}function Pa(t,e=1){let r=(0,En.cellToBoundary)(t,!0);return e!==1?W1(t,r,e):Ks(r),r}function Ru(t){let e=new Float64Array(t.length*2),r=0;for(let n of t)e[r++]=n[0],e[r++]=n[1];return e}var z1=10;function k1(t,e){let r;return t==null?r=e:typeof t=="object"?r={...t,coverage:e}:r={getHexagon:t,coverage:e},r}var G1={...Rn.PolygonLayer.defaultProps,highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:t=>t.hexagon},extruded:!0},Rr=class extends Js.CompositeLayer{initializeState(){Rr._checkH3Lib(),this.state={edgeLengthKM:0,resolution:-1}}shouldUpdateState({changeFlags:e}){return this._shouldUseHighPrecision()?e.propsOrDataChanged:e.somethingChanged}updateState({props:e,changeFlags:r}){if(e.highPrecision!==!0&&(r.dataChanged||r.updateTriggersChanged&&r.updateTriggersChanged.getHexagon)){let n=this._calculateH3DataProps();this.setState(n)}this._updateVertices(this.context.viewport)}_calculateH3DataProps(){let e=-1,r=!1,n=!1,{iterable:s,objectInfo:i}=(0,Js.createIterable)(this.props.data);for(let o of s){i.index++;let a=this.props.getHexagon(o,i),c=(0,bt.getResolution)(a);if(e<0){if(e=c,!this.props.highPrecision)break}else if(e!==c){n=!0;break}if((0,bt.isPentagon)(a)){r=!0;break}}return{resolution:e,edgeLengthKM:e>=0?(0,bt.getHexagonEdgeLengthAvg)(e,"km"):0,hasMultipleRes:n,hasPentagon:r}}_shouldUseHighPrecision(){if(this.props.highPrecision==="auto"){let{resolution:e,hasPentagon:r,hasMultipleRes:n}=this.state,{viewport:s}=this.context;return Boolean(s?.resolution)||n||r||e>=0&&e<=5}return this.props.highPrecision}_updateVertices(e){if(this._shouldUseHighPrecision())return;let{resolution:r,edgeLengthKM:n,centerHex:s}=this.state;if(r<0)return;let i=this.props.centerHexagon||(0,bt.latLngToCell)(e.latitude,e.longitude,r);if(s===i)return;if(s)try{if((0,bt.gridDistance)(s,i)*n<z1)return}catch{}let{unitsPerMeter:o}=e.distanceScales,a=Pa(i),[c,l]=(0,bt.cellToLatLng)(i),[h,f]=e.projectFlat([l,c]);a=a.map(u=>{let d=e.projectFlat(u);return[(d[0]-h)/o[0],(d[1]-f)/o[1]]}),this.setState({centerHex:i,vertices:a})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){let{elevationScale:e,material:r,coverage:n,extruded:s,wireframe:i,stroked:o,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:h,lineWidthMaxPixels:f,getFillColor:u,getElevation:d,getLineColor:p,getLineWidth:_,transitions:A,updateTriggers:T}=this.props;return{elevationScale:e,extruded:s,coverage:n,wireframe:i,stroked:o,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:h,lineWidthMaxPixels:f,material:r,getElevation:d,getFillColor:u,getLineColor:p,getLineWidth:_,transitions:A,updateTriggers:{getFillColor:T.getFillColor,getElevation:T.getElevation,getLineColor:T.getLineColor,getLineWidth:T.getLineWidth}}}_renderPolygonLayer(){let{data:e,getHexagon:r,updateTriggers:n,coverage:s}=this.props,i=this.getSubLayerClass("hexagon-cell-hifi",Rn.PolygonLayer),o=this._getForwardProps();return o.updateTriggers.getPolygon=k1(n.getHexagon,s),new i(o,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:o.updateTriggers}),{data:e,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(a,c)=>{let l=r(a,c);return Ru(Pa(l,s))}})}_renderColumnLayer(){let{data:e,getHexagon:r,updateTriggers:n}=this.props,s=this.getSubLayerClass("hexagon-cell",Rn.ColumnLayer),i=this._getForwardProps();return i.updateTriggers.getPosition=n.getHexagon,new s(i,this.getSubLayerProps({id:"hexagon-cell",flatShading:!0,updateTriggers:i.updateTriggers}),{data:e,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:Eu.bind(null,r)})}},Ke=Rr;(()=>{Rr.defaultProps=G1})(),(()=>{Rr.layerName="H3HexagonLayer"})(),(()=>{Rr._checkH3Lib=()=>{}})();var K1={getHexagons:{type:"accessor",value:t=>t.hexagons}},Ys=class extends It{initializeState(){Ke._checkH3Lib()}updateState({props:e,changeFlags:r}){if(r.dataChanged||r.updateTriggersChanged&&r.updateTriggersChanged.getHexagons){let{data:n,getHexagons:s}=e,i=[],{iterable:o,objectInfo:a}=(0,Su.createIterable)(n);for(let c of o){a.index++;let l=s(c,a),h=(0,xu.cellsToMultiPolygon)(l,!0);for(let f of h){for(let u of f)Ks(u);i.push(this.getSubLayerRow({polygon:f},c,a.index))}}this.setState({polygons:i})}}indexToBounds(){let{getElevation:e,getFillColor:r,getLineColor:n,getLineWidth:s}=this.props;return{data:this.state.polygons,getPolygon:i=>i.polygon,getElevation:this.getSubLayerAccessor(e),getFillColor:this.getSubLayerAccessor(r),getLineColor:this.getSubLayerAccessor(n),getLineWidth:this.getSubLayerAccessor(s)}}},xn=Ys;(()=>{Ys.layerName="H3ClusterLayer"})(),(()=>{Ys.defaultProps=K1})();var ug=v(Da(),1),be=v(Lt(),1),dg=v(Ut(),1),pg=v(qs(),1);var Iu=v(yu(),1),ee=function(t){return t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.ONE=1]="ONE",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.LINEAR=9729]="LINEAR",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t}(ee||{});function wa(t,e,r,n){let s={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{u_Camera:[0,0,0],u_MetallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};t.features.has("glsl-texture-lod")&&(s.defines.USE_TEX_LOD=1);let{imageBasedLightingEnvironment:i}=n;return i&&(s.bindings.u_DiffuseEnvSampler=i.diffuseEnvSampler,s.bindings.u_SpecularEnvSampler=i.specularEnvSampler,s.bindings.u_brdfLUT=i.brdfLutTexture,s.uniforms.u_ScaleIBLAmbient=[1,1]),n!=null&&n.pbrDebug&&(s.defines.PBR_DEBUG=1,s.uniforms.u_ScaleDiffBaseMR=[0,0,0,0],s.uniforms.u_ScaleFGDSpec=[0,0,0,0]),r.NORMAL&&(s.defines.HAS_NORMALS=1),r.TANGENT&&n!==null&&n!==void 0&&n.useTangents&&(s.defines.HAS_TANGENTS=1),r.TEXCOORD_0&&(s.defines.HAS_UV=1),n!=null&&n.imageBasedLightingEnvironment&&(s.defines.USE_IBL=1),n!=null&&n.lights&&(s.defines.USE_LIGHTS=1),e&&J1(t,e,s),s}function J1(t,e,r){if(r.uniforms.pbr_uUnlit=Boolean(e.unlit),e.pbrMetallicRoughness&&Y1(t,e.pbrMetallicRoughness,r),e.normalTexture){Sn(t,e.normalTexture,"u_NormalSampler","HAS_NORMALMAP",r);let{scale:n=1}=e.normalTexture;r.uniforms.u_NormalScale=n}if(e.occlusionTexture){Sn(t,e.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP",r);let{strength:n=1}=e.occlusionTexture;r.uniforms.u_OcclusionStrength=n}switch(e.emissiveTexture&&(Sn(t,e.emissiveTexture,"u_EmissiveSampler","HAS_EMISSIVEMAP",r),r.uniforms.u_EmissiveFactor=e.emissiveFactor||[0,0,0]),e.alphaMode){case"MASK":let{alphaCutoff:n=.5}=e;r.defines.ALPHA_CUTOFF=1,r.uniforms.u_AlphaCutoff=n;break;case"BLEND":Iu.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),r.parameters.blendColorOperation="add",r.parameters.blendColorSrcFactor="src-alpha",r.parameters.blendColorDstFactor="one-minus-src-alpha",r.parameters.blendAlphaOperation="add",r.parameters.blendAlphaSrcFactor="one",r.parameters.blendAlphaDstFactor="one-minus-src-alpha",r.glParameters.blend=!0,r.glParameters.blendEquation=ee.FUNC_ADD,r.glParameters.blendFunc=[ee.SRC_ALPHA,ee.ONE_MINUS_SRC_ALPHA,ee.ONE,ee.ONE_MINUS_SRC_ALPHA];break}}function Y1(t,e,r){e.baseColorTexture&&Sn(t,e.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP",r),r.uniforms.u_BaseColorFactor=e.baseColorFactor||[1,1,1,1],e.metallicRoughnessTexture&&Sn(t,e.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP",r);let{metallicFactor:n=1,roughnessFactor:s=1}=e;r.uniforms.u_MetallicRoughnessValues=[n,s]}function Sn(t,e,r){var n;let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,i=arguments.length>4?arguments[4]:void 0,o=(e==null||(n=e.texture)===null||n===void 0||(n=n.sampler)===null||n===void 0?void 0:n.parameters)||{},a=e.texture.source.image,c,l={};a.compressed?(c=a,l={[ee.TEXTURE_MIN_FILTER]:a.data.length>1?ee.LINEAR_MIPMAP_NEAREST:ee.LINEAR}):c={data:a};let h=t.createTexture({id:e.uniformName||e.id,parameters:{...o,...l},pixelStore:{[ee.UNPACK_FLIP_Y_WEBGL]:!1},...c});i.bindings[r]=h,s&&(i.defines[s]=1),i.generatedTextures.push(h)}var Fu="4.1.0";var js={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},va;async function La(t){let e=t.modules||{};return e.basis?e.basis:(va=va||q1(t),await va)}async function q1(t){let e=null,r=null;return[e,r]=await Promise.all([await qt(js.TRANSCODER,"textures",t),await qt(js.TRANSCODER_WASM,"textures",t)]),e=e||globalThis.BASIS,await j1(e,r)}function j1(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(n=>{t(r).then(s=>{let{BasisFile:i,initializeBasis:o}=s;o(),n({BasisFile:i})})})}var Ua;async function Ha(t){let e=t.modules||{};return e.basisEncoder?e.basisEncoder:(Ua=Ua||Z1(t),await Ua)}async function Z1(t){let e=null,r=null;return[e,r]=await Promise.all([await qt(js.ENCODER,"textures",t),await qt(js.ENCODER_WASM,"textures",t)]),e=e||globalThis.BASIS,await Q1(e,r)}function Q1(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(n=>{t(r).then(s=>{let{BasisFile:i,KTX2File:o,initializeBasis:a,BasisEncoder:c}=s;a(),n({BasisFile:i,KTX2File:o,BasisEncoder:c})})})}var Je={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919};var $1=["","WEBKIT_","MOZ_"],Nu={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"},Zs=null;function Ou(t){if(!Zs){t=t||tE()||void 0,Zs=new Set;for(let e of $1)for(let r in Nu)if(t&&t.getExtension(`${e}${r}`)){let n=Nu[r];Zs.add(n)}}return Zs}function tE(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var GO=new Uint8Array([0]);var bu,Pu,Du,wu,vu,Uu,Lu,Hu;(function(t){t[t.NONE=0]="NONE",t[t.BASISLZ=1]="BASISLZ",t[t.ZSTD=2]="ZSTD",t[t.ZLIB=3]="ZLIB"})(bu||(bu={})),function(t){t[t.BASICFORMAT=0]="BASICFORMAT"}(Pu||(Pu={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC"}(Du||(Du={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB"}(wu||(wu={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LINEAR=1]="LINEAR",t[t.SRGB=2]="SRGB",t[t.ITU=3]="ITU",t[t.NTSC=4]="NTSC",t[t.SLOG=5]="SLOG",t[t.SLOG2=6]="SLOG2"}(vu||(vu={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(Uu||(Uu={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA"}(Lu||(Lu={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG"}(Hu||(Hu={}));var Ft=[171,75,84,88,32,50,48,187,13,10,26,10];function Vu(t){let e=new Uint8Array(t);return!(e.byteLength<Ft.length||e[0]!==Ft[0]||e[1]!==Ft[1]||e[2]!==Ft[2]||e[3]!==Ft[3]||e[4]!==Ft[4]||e[5]!==Ft[5]||e[6]!==Ft[6]||e[7]!==Ft[7]||e[8]!==Ft[8]||e[9]!==Ft[9]||e[10]!==Ft[10]||e[11]!==Ft[11])}var eE={etc1:{basisFormat:0,compressed:!0,format:Je.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Je.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:Je.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:Je.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Je.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:Je.COMPRESSED_RGBA_ASTC_4X4_KHR},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};async function Xa(t,e){if(e.basis.containerFormat==="auto"){if(Vu(t)){let n=await Ha(e);return Xu(n.KTX2File,t,e)}let{BasisFile:r}=await La(e);return Va(r,t,e)}switch(e.basis.module){case"encoder":let r=await Ha(e);switch(e.basis.containerFormat){case"ktx2":return Xu(r.KTX2File,t,e);case"basis":default:return Va(r.BasisFile,t,e)}case"transcoder":default:let{BasisFile:n}=await La(e);return Va(n,t,e)}}function Va(t,e,r){let n=new t(new Uint8Array(e));try{if(!n.startTranscoding())throw new Error("Failed to start basis transcoding");let s=n.getNumImages(),i=[];for(let o=0;o<s;o++){let a=n.getNumLevels(o),c=[];for(let l=0;l<a;l++)c.push(rE(n,o,l,r));i.push(c)}return i}finally{n.close(),n.delete()}}function rE(t,e,r,n){let s=t.getImageWidth(e,r),i=t.getImageHeight(e,r),o=t.getHasAlpha(),{compressed:a,format:c,basisFormat:l}=Wu(n,o),h=t.getImageTranscodedSizeInBytes(e,r,l),f=new Uint8Array(h);if(!t.transcodeImage(f,e,r,l,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:i,data:f,compressed:a,format:c,hasAlpha:o}}function Xu(t,e,r){let n=new t(new Uint8Array(e));try{if(!n.startTranscoding())throw new Error("failed to start KTX2 transcoding");let s=n.getLevels(),i=[];for(let o=0;o<s;o++){i.push(nE(n,o,r));break}return[i]}finally{n.close(),n.delete()}}function nE(t,e,r){let{alphaFlag:n,height:s,width:i}=t.getImageLevelInfo(e,0,0),{compressed:o,format:a,basisFormat:c}=Wu(r,n),l=t.getImageTranscodedSizeInBytes(e,0,0,c),h=new Uint8Array(l);if(!t.transcodeImage(h,e,0,0,c,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:i,height:s,data:h,compressed:o,levelSize:l,hasAlpha:n,format:a}}function Wu(t,e){let r=t&&t.basis&&t.basis.format;return r==="auto"&&(r=Qs()),typeof r=="object"&&(r=e?r.alpha:r.noAlpha),r=r.toLowerCase(),eE[r]}function Qs(){let t=Ou();return t.has("astc")?"astc-4x4":t.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:t.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:t.has("etc1")?"etc1":t.has("etc2")?"etc2":"rgb565"}var zu={name:"Basis",id:"basis",module:"textures",version:Fu,worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},Wa={...zu,parse:Xa};function za(t){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let e=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=t||e;return!!(r&&r.indexOf("Electron")>=0)}function Wt(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||za()}var sE=globalThis.self||globalThis.window||globalThis.global,xr=globalThis.window||globalThis.self||globalThis.global,iE=globalThis.document||{},Ye=globalThis.process||{},oE=globalThis.console,hb=globalThis.navigator||{};var $s=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",db=Wt();var ti=function(t){return t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",t[t.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",t[t.BLEND_EQUATION=32777]="BLEND_EQUATION",t[t.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",t[t.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",t[t.BLEND_DST_RGB=32968]="BLEND_DST_RGB",t[t.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",t[t.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",t[t.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",t[t.BLEND_COLOR=32773]="BLEND_COLOR",t[t.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",t[t.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",t[t.LINE_WIDTH=2849]="LINE_WIDTH",t[t.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",t[t.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",t[t.CULL_FACE_MODE=2885]="CULL_FACE_MODE",t[t.FRONT_FACE=2886]="FRONT_FACE",t[t.DEPTH_RANGE=2928]="DEPTH_RANGE",t[t.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",t[t.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",t[t.DEPTH_FUNC=2932]="DEPTH_FUNC",t[t.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",t[t.STENCIL_FUNC=2962]="STENCIL_FUNC",t[t.STENCIL_FAIL=2964]="STENCIL_FAIL",t[t.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",t[t.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",t[t.STENCIL_REF=2967]="STENCIL_REF",t[t.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",t[t.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",t[t.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",t[t.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",t[t.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",t[t.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",t[t.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",t[t.VIEWPORT=2978]="VIEWPORT",t[t.SCISSOR_BOX=3088]="SCISSOR_BOX",t[t.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",t[t.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",t[t.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",t[t.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",t[t.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",t[t.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",t[t.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",t[t.RED_BITS=3410]="RED_BITS",t[t.GREEN_BITS=3411]="GREEN_BITS",t[t.BLUE_BITS=3412]="BLUE_BITS",t[t.ALPHA_BITS=3413]="ALPHA_BITS",t[t.DEPTH_BITS=3414]="DEPTH_BITS",t[t.STENCIL_BITS=3415]="STENCIL_BITS",t[t.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",t[t.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",t[t.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",t[t.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",t[t.SAMPLES=32937]="SAMPLES",t[t.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",t[t.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",t[t.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",t[t.VENDOR=7936]="VENDOR",t[t.RENDERER=7937]="RENDERER",t[t.VERSION=7938]="VERSION",t[t.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",t[t.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",t[t.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.BUFFER_SIZE=34660]="BUFFER_SIZE",t[t.BUFFER_USAGE=34661]="BUFFER_USAGE",t[t.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",t[t.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",t[t.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",t[t.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",t[t.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",t[t.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",t[t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",t[t.CULL_FACE=2884]="CULL_FACE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK",t[t.BLEND=3042]="BLEND",t[t.DEPTH_TEST=2929]="DEPTH_TEST",t[t.DITHER=3024]="DITHER",t[t.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",t[t.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",t[t.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",t[t.SCISSOR_TEST=3089]="SCISSOR_TEST",t[t.STENCIL_TEST=2960]="STENCIL_TEST",t[t.NO_ERROR=0]="NO_ERROR",t[t.INVALID_ENUM=1280]="INVALID_ENUM",t[t.INVALID_VALUE=1281]="INVALID_VALUE",t[t.INVALID_OPERATION=1282]="INVALID_OPERATION",t[t.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",t[t.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",t[t.CW=2304]="CW",t[t.CCW=2305]="CCW",t[t.DONT_CARE=4352]="DONT_CARE",t[t.FASTEST=4353]="FASTEST",t[t.NICEST=4354]="NICEST",t[t.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.DOUBLE=5130]="DOUBLE",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER",t[t.COMPILE_STATUS=35713]="COMPILE_STATUS",t[t.DELETE_STATUS=35712]="DELETE_STATUS",t[t.LINK_STATUS=35714]="LINK_STATUS",t[t.VALIDATE_STATUS=35715]="VALIDATE_STATUS",t[t.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",t[t.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",t[t.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",t[t.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",t[t.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",t[t.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",t[t.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",t[t.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",t[t.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",t[t.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",t[t.SHADER_TYPE=35663]="SHADER_TYPE",t[t.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",t[t.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP",t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE=5890]="TEXTURE",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",t[t.TEXTURE0=33984]="TEXTURE0",t[t.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",t[t.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.LOW_FLOAT=36336]="LOW_FLOAT",t[t.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",t[t.HIGH_FLOAT=36338]="HIGH_FLOAT",t[t.LOW_INT=36339]="LOW_INT",t[t.MEDIUM_INT=36340]="MEDIUM_INT",t[t.HIGH_INT=36341]="HIGH_INT",t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.RENDERBUFFER=36161]="RENDERBUFFER",t[t.RGBA4=32854]="RGBA4",t[t.RGB5_A1=32855]="RGB5_A1",t[t.RGB565=36194]="RGB565",t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX=6401]="STENCIL_INDEX",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",t[t.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",t[t.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",t[t.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",t[t.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",t[t.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",t[t.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",t[t.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",t[t.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",t[t.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",t[t.NONE=0]="NONE",t[t.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",t[t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",t[t.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",t[t.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",t[t.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",t[t.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",t[t.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",t[t.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t[t.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",t[t.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",t[t.READ_BUFFER=3074]="READ_BUFFER",t[t.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",t[t.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",t[t.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",t[t.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",t[t.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",t[t.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",t[t.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",t[t.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",t[t.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",t[t.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",t[t.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",t[t.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",t[t.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",t[t.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",t[t.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",t[t.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",t[t.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",t[t.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",t[t.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",t[t.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",t[t.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",t[t.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",t[t.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",t[t.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",t[t.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",t[t.RED=6403]="RED",t[t.RGB8=32849]="RGB8",t[t.RGBA8=32856]="RGBA8",t[t.RGB10_A2=32857]="RGB10_A2",t[t.TEXTURE_3D=32879]="TEXTURE_3D",t[t.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",t[t.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",t[t.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",t[t.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",t[t.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",t[t.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",t[t.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",t[t.SRGB=35904]="SRGB",t[t.SRGB8=35905]="SRGB8",t[t.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",t[t.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",t[t.RGBA32F=34836]="RGBA32F",t[t.RGB32F=34837]="RGB32F",t[t.RGBA16F=34842]="RGBA16F",t[t.RGB16F=34843]="RGB16F",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",t[t.R11F_G11F_B10F=35898]="R11F_G11F_B10F",t[t.RGB9_E5=35901]="RGB9_E5",t[t.RGBA32UI=36208]="RGBA32UI",t[t.RGB32UI=36209]="RGB32UI",t[t.RGBA16UI=36214]="RGBA16UI",t[t.RGB16UI=36215]="RGB16UI",t[t.RGBA8UI=36220]="RGBA8UI",t[t.RGB8UI=36221]="RGB8UI",t[t.RGBA32I=36226]="RGBA32I",t[t.RGB32I=36227]="RGB32I",t[t.RGBA16I=36232]="RGBA16I",t[t.RGB16I=36233]="RGB16I",t[t.RGBA8I=36238]="RGBA8I",t[t.RGB8I=36239]="RGB8I",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.R8=33321]="R8",t[t.RG8=33323]="RG8",t[t.R16F=33325]="R16F",t[t.R32F=33326]="R32F",t[t.RG16F=33327]="RG16F",t[t.RG32F=33328]="RG32F",t[t.R8I=33329]="R8I",t[t.R8UI=33330]="R8UI",t[t.R16I=33331]="R16I",t[t.R16UI=33332]="R16UI",t[t.R32I=33333]="R32I",t[t.R32UI=33334]="R32UI",t[t.RG8I=33335]="RG8I",t[t.RG8UI=33336]="RG8UI",t[t.RG16I=33337]="RG16I",t[t.RG16UI=33338]="RG16UI",t[t.RG32I=33339]="RG32I",t[t.RG32UI=33340]="RG32UI",t[t.R8_SNORM=36756]="R8_SNORM",t[t.RG8_SNORM=36757]="RG8_SNORM",t[t.RGB8_SNORM=36758]="RGB8_SNORM",t[t.RGBA8_SNORM=36759]="RGBA8_SNORM",t[t.RGB10_A2UI=36975]="RGB10_A2UI",t[t.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",t[t.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.HALF_FLOAT=5131]="HALF_FLOAT",t[t.RG=33319]="RG",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",t[t.CURRENT_QUERY=34917]="CURRENT_QUERY",t[t.QUERY_RESULT=34918]="QUERY_RESULT",t[t.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",t[t.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",t[t.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",t[t.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",t[t.DRAW_BUFFER0=34853]="DRAW_BUFFER0",t[t.DRAW_BUFFER1=34854]="DRAW_BUFFER1",t[t.DRAW_BUFFER2=34855]="DRAW_BUFFER2",t[t.DRAW_BUFFER3=34856]="DRAW_BUFFER3",t[t.DRAW_BUFFER4=34857]="DRAW_BUFFER4",t[t.DRAW_BUFFER5=34858]="DRAW_BUFFER5",t[t.DRAW_BUFFER6=34859]="DRAW_BUFFER6",t[t.DRAW_BUFFER7=34860]="DRAW_BUFFER7",t[t.DRAW_BUFFER8=34861]="DRAW_BUFFER8",t[t.DRAW_BUFFER9=34862]="DRAW_BUFFER9",t[t.DRAW_BUFFER10=34863]="DRAW_BUFFER10",t[t.DRAW_BUFFER11=34864]="DRAW_BUFFER11",t[t.DRAW_BUFFER12=34865]="DRAW_BUFFER12",t[t.DRAW_BUFFER13=34866]="DRAW_BUFFER13",t[t.DRAW_BUFFER14=34867]="DRAW_BUFFER14",t[t.DRAW_BUFFER15=34868]="DRAW_BUFFER15",t[t.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",t[t.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",t[t.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",t[t.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",t[t.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",t[t.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",t[t.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",t[t.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",t[t.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",t[t.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",t[t.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",t[t.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",t[t.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",t[t.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",t[t.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",t[t.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",t[t.SAMPLER_3D=35679]="SAMPLER_3D",t[t.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",t[t.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",t[t.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",t[t.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",t[t.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",t[t.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",t[t.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",t[t.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",t[t.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",t[t.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",t[t.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",t[t.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",t[t.MAX_SAMPLES=36183]="MAX_SAMPLES",t[t.SAMPLER_BINDING=35097]="SAMPLER_BINDING",t[t.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",t[t.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",t[t.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",t[t.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",t[t.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",t[t.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",t[t.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",t[t.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",t[t.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",t[t.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",t[t.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",t[t.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",t[t.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",t[t.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",t[t.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",t[t.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",t[t.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",t[t.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",t[t.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",t[t.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",t[t.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",t[t.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",t[t.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",t[t.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",t[t.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",t[t.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",t[t.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",t[t.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",t[t.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",t[t.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",t[t.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",t[t.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",t[t.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",t[t.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",t[t.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",t[t.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",t[t.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",t[t.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",t[t.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",t[t.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",t[t.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t[t.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",t[t.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",t[t.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",t[t.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",t[t.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",t[t.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",t[t.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",t[t.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",t[t.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",t[t.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",t[t.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",t[t.UNIFORM_TYPE=35383]="UNIFORM_TYPE",t[t.UNIFORM_SIZE=35384]="UNIFORM_SIZE",t[t.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",t[t.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",t[t.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",t[t.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",t[t.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",t[t.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",t[t.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",t[t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",t[t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",t[t.OBJECT_TYPE=37138]="OBJECT_TYPE",t[t.SYNC_CONDITION=37139]="SYNC_CONDITION",t[t.SYNC_STATUS=37140]="SYNC_STATUS",t[t.SYNC_FLAGS=37141]="SYNC_FLAGS",t[t.SYNC_FENCE=37142]="SYNC_FENCE",t[t.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",t[t.UNSIGNALED=37144]="UNSIGNALED",t[t.SIGNALED=37145]="SIGNALED",t[t.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",t[t.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",t[t.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",t[t.WAIT_FAILED=37149]="WAIT_FAILED",t[t.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",t[t.COLOR=6144]="COLOR",t[t.DEPTH=6145]="DEPTH",t[t.STENCIL=6146]="STENCIL",t[t.MIN=32775]="MIN",t[t.MAX=32776]="MAX",t[t.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",t[t.STREAM_READ=35041]="STREAM_READ",t[t.STREAM_COPY=35042]="STREAM_COPY",t[t.STATIC_READ=35045]="STATIC_READ",t[t.STATIC_COPY=35046]="STATIC_COPY",t[t.DYNAMIC_READ=35049]="DYNAMIC_READ",t[t.DYNAMIC_COPY=35050]="DYNAMIC_COPY",t[t.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",t[t.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",t[t.INVALID_INDEX=4294967295]="INVALID_INDEX",t[t.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",t[t.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",t[t.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE",t[t.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",t[t.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",t[t.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",t[t.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",t[t.SRGB_EXT=35904]="SRGB_EXT",t[t.SRGB_ALPHA_EXT=35906]="SRGB_ALPHA_EXT",t[t.SRGB8_ALPHA8_EXT=35907]="SRGB8_ALPHA8_EXT",t[t.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT",t[t.R16_EXT=33322]="R16_EXT",t[t.RG16_EXT=33324]="RG16_EXT",t[t.RGB16_EXT=32852]="RGB16_EXT",t[t.RGBA16_EXT=32859]="RGBA16_EXT",t[t.R16_SNORM_EXT=36760]="R16_SNORM_EXT",t[t.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",t[t.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",t[t.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",t[t.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",t[t.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",t[t.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",t[t.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",t[t.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",t[t.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",t[t.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",t[t.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",t[t.UNSIGNED_INT_24_8_WEBGL=34042]="UNSIGNED_INT_24_8_WEBGL",t[t.HALF_FLOAT_OES=36193]="HALF_FLOAT_OES",t[t.RGBA32F_EXT=34836]="RGBA32F_EXT",t[t.RGB32F_EXT=34837]="RGB32F_EXT",t[t.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT",t[t.UNSIGNED_NORMALIZED_EXT=35863]="UNSIGNED_NORMALIZED_EXT",t[t.MIN_EXT=32775]="MIN_EXT",t[t.MAX_EXT=32776]="MAX_EXT",t[t.FRAGMENT_SHADER_DERIVATIVE_HINT_OES=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT_OES",t[t.COLOR_ATTACHMENT0_WEBGL=36064]="COLOR_ATTACHMENT0_WEBGL",t[t.COLOR_ATTACHMENT1_WEBGL=36065]="COLOR_ATTACHMENT1_WEBGL",t[t.COLOR_ATTACHMENT2_WEBGL=36066]="COLOR_ATTACHMENT2_WEBGL",t[t.COLOR_ATTACHMENT3_WEBGL=36067]="COLOR_ATTACHMENT3_WEBGL",t[t.COLOR_ATTACHMENT4_WEBGL=36068]="COLOR_ATTACHMENT4_WEBGL",t[t.COLOR_ATTACHMENT5_WEBGL=36069]="COLOR_ATTACHMENT5_WEBGL",t[t.COLOR_ATTACHMENT6_WEBGL=36070]="COLOR_ATTACHMENT6_WEBGL",t[t.COLOR_ATTACHMENT7_WEBGL=36071]="COLOR_ATTACHMENT7_WEBGL",t[t.COLOR_ATTACHMENT8_WEBGL=36072]="COLOR_ATTACHMENT8_WEBGL",t[t.COLOR_ATTACHMENT9_WEBGL=36073]="COLOR_ATTACHMENT9_WEBGL",t[t.COLOR_ATTACHMENT10_WEBGL=36074]="COLOR_ATTACHMENT10_WEBGL",t[t.COLOR_ATTACHMENT11_WEBGL=36075]="COLOR_ATTACHMENT11_WEBGL",t[t.COLOR_ATTACHMENT12_WEBGL=36076]="COLOR_ATTACHMENT12_WEBGL",t[t.COLOR_ATTACHMENT13_WEBGL=36077]="COLOR_ATTACHMENT13_WEBGL",t[t.COLOR_ATTACHMENT14_WEBGL=36078]="COLOR_ATTACHMENT14_WEBGL",t[t.COLOR_ATTACHMENT15_WEBGL=36079]="COLOR_ATTACHMENT15_WEBGL",t[t.DRAW_BUFFER0_WEBGL=34853]="DRAW_BUFFER0_WEBGL",t[t.DRAW_BUFFER1_WEBGL=34854]="DRAW_BUFFER1_WEBGL",t[t.DRAW_BUFFER2_WEBGL=34855]="DRAW_BUFFER2_WEBGL",t[t.DRAW_BUFFER3_WEBGL=34856]="DRAW_BUFFER3_WEBGL",t[t.DRAW_BUFFER4_WEBGL=34857]="DRAW_BUFFER4_WEBGL",t[t.DRAW_BUFFER5_WEBGL=34858]="DRAW_BUFFER5_WEBGL",t[t.DRAW_BUFFER6_WEBGL=34859]="DRAW_BUFFER6_WEBGL",t[t.DRAW_BUFFER7_WEBGL=34860]="DRAW_BUFFER7_WEBGL",t[t.DRAW_BUFFER8_WEBGL=34861]="DRAW_BUFFER8_WEBGL",t[t.DRAW_BUFFER9_WEBGL=34862]="DRAW_BUFFER9_WEBGL",t[t.DRAW_BUFFER10_WEBGL=34863]="DRAW_BUFFER10_WEBGL",t[t.DRAW_BUFFER11_WEBGL=34864]="DRAW_BUFFER11_WEBGL",t[t.DRAW_BUFFER12_WEBGL=34865]="DRAW_BUFFER12_WEBGL",t[t.DRAW_BUFFER13_WEBGL=34866]="DRAW_BUFFER13_WEBGL",t[t.DRAW_BUFFER14_WEBGL=34867]="DRAW_BUFFER14_WEBGL",t[t.DRAW_BUFFER15_WEBGL=34868]="DRAW_BUFFER15_WEBGL",t[t.MAX_COLOR_ATTACHMENTS_WEBGL=36063]="MAX_COLOR_ATTACHMENTS_WEBGL",t[t.MAX_DRAW_BUFFERS_WEBGL=34852]="MAX_DRAW_BUFFERS_WEBGL",t[t.VERTEX_ARRAY_BINDING_OES=34229]="VERTEX_ARRAY_BINDING_OES",t[t.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",t[t.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",t[t.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",t[t.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",t[t.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",t[t.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",t[t.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",t}(ti||{});var Sr=t=>`${t}`;var ka=Sr`\
|
|
172
29
|
#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
|
|
173
30
|
|
|
174
31
|
struct AmbientLight {
|
|
@@ -203,7 +60,7 @@ float getPointLightAttenuation(PointLight pointLight, float distance) {
|
|
|
203
60
|
}
|
|
204
61
|
|
|
205
62
|
#endif
|
|
206
|
-
`;var
|
|
63
|
+
`;var aE={lightSources:{}};function Ga(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{color:e=[0,0,0],intensity:r=1}=t;return e.map(n=>n*r/255)}function cE(t){let{ambientLight:e,pointLights:r=[],directionalLights:n=[]}=t,s={};return e?s["lighting_uAmbientLight.color"]=Ga(e):s["lighting_uAmbientLight.color"]=[0,0,0],r.forEach((i,o)=>{s[`lighting_uPointLight[${o}].color`]=Ga(i),s[`lighting_uPointLight[${o}].position`]=i.position,s[`lighting_uPointLight[${o}].attenuation`]=i.attenuation||[1,0,0]}),s.lighting_uPointLightCount=r.length,n.forEach((i,o)=>{s[`lighting_uDirectionalLight[${o}].color`]=Ga(i),s[`lighting_uDirectionalLight[${o}].direction`]=i.direction}),s.lighting_uDirectionalLightCount=n.length,s}function ku(){var t,e;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:aE;if("lightSources"in r){let{ambientLight:n,pointLights:s,directionalLights:i}=r.lightSources||{};return n||s&&s.length>0||i&&i.length>0?Object.assign({},cE({ambientLight:n,pointLights:s,directionalLights:i}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in r){let n={pointLights:[],directionalLights:[]};for(let s of r.lights||[])switch(s.type){case"ambient":n.ambientLight=s;break;case"directional":(t=n.directionalLights)===null||t===void 0||t.push(s);break;case"point":(e=n.pointLights)===null||e===void 0||e.push(s);break;default:}return ku({lightSources:n})}return{}}var Gu={name:"lights",vs:ka,fs:ka,getUniforms:ku,defines:{MAX_LIGHTS:3}};var Ku=Sr`\
|
|
207
64
|
uniform mat4 u_MVPMatrix;
|
|
208
65
|
uniform mat4 u_ModelMatrix;
|
|
209
66
|
uniform mat4 u_NormalMatrix;
|
|
@@ -241,7 +98,7 @@ void pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, ve
|
|
|
241
98
|
pbr_vUV = vec2(0.,0.);
|
|
242
99
|
#endif
|
|
243
100
|
}
|
|
244
|
-
`;var
|
|
101
|
+
`;var Ju=Sr`\
|
|
245
102
|
#if defined(USE_TEX_LOD) && !defined(FEATURE_GLSL_TEXTURE_LOD)
|
|
246
103
|
# error PBR fragment shader: Texture LOD is not available
|
|
247
104
|
#endif
|
|
@@ -640,22 +497,30 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
640
497
|
|
|
641
498
|
return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
|
|
642
499
|
}
|
|
643
|
-
`;var _l={name:"pbr",vs:Eg,fs:wg,defines:{LIGHTING_FRAGMENT:1},dependencies:[Tg]};var Al=U(Ct(),1);var Bo=class{constructor(e){this.modules=void 0,this.moduleUniforms=void 0,this.moduleBindings=void 0,this.moduleUniformsChanged=void 0;let r=ms(Object.values(e));Al.log.log(1,"Creating ShaderInputs with modules",r.map(n=>n.name))(),this.modules=e,this.moduleUniforms={},this.moduleBindings={};for(let[n,s]of Object.entries(e)){let i=n;this.moduleUniforms[i]=s.defaultUniforms||{},this.moduleBindings[i]={}}}destroy(){}setProps(e){for(let n of Object.keys(e)){var r;let s=n,i=e[s],o=this.modules[s];if(!o){Al.log.warn(`Module ${n} not found`)();continue}let a=this.moduleUniforms[s],c=((r=o.getUniforms)===null||r===void 0?void 0:r.call(o,i,this.moduleUniforms[s]))||i;this.moduleUniforms[s]={...a,...c}}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindings(){let e={};for(let r of Object.values(this.moduleBindings))Object.assign(e,r);return e}getDebugTable(){let e={};for(let[n,s]of Object.entries(this.moduleUniforms))for(let[i,o]of Object.entries(s)){var r;e[`${n}.${i}`]={type:(r=this.modules[n].uniformTypes)===null||r===void 0?void 0:r[i],value:String(o)}}return e}};var Rt=U(Ct(),1),Co=class{constructor(e){this.id=void 0,this.userData={},this.topology=void 0,this.bufferLayout=[],this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.id=e.id||(0,Rt.uid)("geometry"),this.topology=e.topology,this.indices=e.indices||null,this.attributes=e.attributes,this.vertexCount=e.vertexCount,this.bufferLayout=e.bufferLayout||[],this.indices&&(0,Rt.assert)(this.indices.usage===Rt.Buffer.INDEX)}destroy(){var e;this.indices.destroy(),this.attributes.positions.destroy(),this.attributes.normals.destroy(),this.attributes.texCoords.destroy(),(e=this.attributes.colors)===null||e===void 0||e.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices}_calculateVertexCount(e){return e.byteLength/12}};function Sg(t,e){if(e instanceof Co)return e;let r=DS(t,e),{attributes:n,bufferLayout:s}=US(t,e);return new Co({topology:e.topology||"triangle-list",bufferLayout:s,vertexCount:e.vertexCount,indices:r,attributes:n})}function DS(t,e){if(!e.indices)return;let r=e.indices.value;return t.createBuffer({usage:Rt.Buffer.INDEX,data:r})}function US(t,e){let r=[],n={};for(let[i,o]of Object.entries(e.attributes)){let a=i;switch(i){case"POSITION":a="positions";break;case"NORMAL":a="normals";break;case"TEXCOORD_0":a="texCoords";break;case"COLOR_0":a="colors";break}n[a]=t.createBuffer({data:o.value,id:`${i}-buffer`});let{value:c,size:u,normalized:l}=o;r.push({name:a,format:(0,Rt.getVertexFormatFromAttribute)(c,u,l)})}let s=e._calculateVertexCount(e.attributes,e.indices);return{attributes:n,bufferLayout:r,vertexCount:s}}var Bg=U(Ct(),1),tr=class{static getDefaultPipelineFactory(e){return e._lumaData.defaultPipelineFactory=e._lumaData.defaultPipelineFactory||new tr(e),e._lumaData.defaultPipelineFactory}constructor(e){this.device=void 0,this._hashCounter=0,this._hashes={},this._useCounts={},this._pipelineCache={},this.device=e}createRenderPipeline(e){let r={...tr.defaultProps,...e},n=this._hashRenderPipeline({...r});if(!this._pipelineCache[n]){let s=this.device.createRenderPipeline({...r,vs:this.device.createShader({stage:"vertex",source:r.vs}),fs:r.fs?this.device.createShader({stage:"fragment",source:r.fs}):null});s.hash=n,this._pipelineCache[n]=s,this._useCounts[n]=0}return this._useCounts[n]++,this._pipelineCache[n]}release(e){let r=e.hash;this._useCounts[r]--,this._useCounts[r]===0&&(this._pipelineCache[r].destroy(),delete this._pipelineCache[r],delete this._useCounts[r])}_createRenderPipeline(e){if(!e.fs)throw new Error("fs");return this.device.createRenderPipeline({...e,vs:this.device.createShader({stage:"vertex",source:e.vs}),fs:e.fs?this.device.createShader({stage:"fragment",source:e.fs}):null})}_hashRenderPipeline(e){let r=this._getHash(e.vs),n=e.fs?this._getHash(e.fs):0,s="-";switch(this.device.info.type){case"webgpu":let i=this._getHash(JSON.stringify(e.parameters)),o=this._getHash(JSON.stringify(e.bufferLayout));return`${r}/${n}V${s}T${e.topology}P${i}BL${o}}`;default:return`${r}/${n}V${s}`}}_getHash(e){return this._hashes[e]===void 0&&(this._hashes[e]=this._hashCounter++),this._hashes[e]}};tr.defaultProps={...Bg.RenderPipeline.defaultProps,vs:void 0,fs:void 0};function Cg(t,e){var r;let n={},s="Values";if(t.attributes.length===0&&!((r=t.varyings)!==null&&r!==void 0&&r.length))return{"No attributes or varyings":{[s]:"N/A"}};for(let i of t.attributes)if(i){let o=`${i.location} ${i.name}: ${i.type}`;n[`in ${o}`]={[s]:i.stepMode||"vertex"}}for(let i of t.varyings||[]){let o=`${i.location} ${i.name}`;n[`out ${o}`]={[s]:JSON.stringify(i.accessor)}}return n}var _e=null,vl=null;function Mg(t,e){let{id:r,minimap:n,opaque:s,top:i="0",left:o="0",rgbaScale:a=1}=e;_e||(_e=document.createElement("canvas"),_e.id=r,_e.title=r,_e.style.zIndex="100",_e.style.position="absolute",_e.style.top=i,_e.style.left=o,_e.style.border="blue 1px solid",_e.style.transform="scaleY(-1)",document.body.appendChild(_e),vl=_e.getContext("2d")),(_e.width!==t.width||_e.height!==t.height)&&(_e.width=t.width/2,_e.height=t.height/2,_e.style.width="400px",_e.style.height="400px");let c=t.device.readPixelsToArrayWebGL(t),u=vl.createImageData(t.width,t.height),l=0;for(let f=0;f<c.length;f+=4)u.data[l+f+0]=c[f+0]*a,u.data[l+f+1]=c[f+1]*a,u.data[l+f+2]=c[f+2]*a,u.data[l+f+3]=s?255:c[f+3]*a;vl.putImageData(u,0,0)}var ln=2,GS=1e4,rr=class{constructor(e,r){var n,s,i;this.device=void 0,this.id=void 0,this.vs=void 0,this.fs=void 0,this.pipelineFactory=void 0,this.userData={},this.parameters=void 0,this.topology=void 0,this.bufferLayout=void 0,this.vertexCount=void 0,this.instanceCount=0,this.indexBuffer=null,this.bufferAttributes={},this.constantAttributes={},this.bindings={},this.uniforms={},this.vertexArray=void 0,this.transformFeedback=null,this.pipeline=void 0,this.shaderInputs=void 0,this._uniformStore=void 0,this._pipelineNeedsUpdate="newly created",this._attributeInfos={},this._gpuGeometry=null,this._getModuleUniforms=void 0,this.props=void 0,this._lastLogTime=0,this._logOpen=!1,this._drawCount=0,this.props={...rr.defaultProps,...r},r=this.props,this.id=r.id||(0,te.uid)("model"),this.device=e,Object.assign(this.userData,r.userData);let o=Object.fromEntries(((n=this.props.modules)===null||n===void 0?void 0:n.map(g=>[g.name,g]))||[]);this.setShaderInputs(r.shaderInputs||new Bo(o));let a=this.device.info.type==="webgpu";if(this.props.source){if(a){var c;(c=this.props).shaderLayout||(c.shaderLayout=So(this.props.source))}this.props.fs=this.props.source,this.props.vs=this.props.source}if(a&&typeof this.props.vs!="string"){var u;(u=this.props).shaderLayout||(u.shaderLayout=So(this.props.vs.wgsl))}let l=kS(e),f=(((s=this.props.modules)===null||s===void 0?void 0:s.length)>0?this.props.modules:(i=this.shaderInputs)===null||i===void 0?void 0:i.getModules())||[],{vs:h,fs:d,getUniforms:p}=this.props.shaderAssembler.assembleShaders({platformInfo:l,...this.props,modules:f});if(this.vs=h,this.fs=d,this._getModuleUniforms=p,this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,r.geometry&&(this._gpuGeometry=this.setGeometry(r.geometry)),this.pipelineFactory=r.pipelineFactory||tr.getDefaultPipelineFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=e.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),r.vertexCount&&this.setVertexCount(r.vertexCount),r.instanceCount&&this.setInstanceCount(r.instanceCount),r.indices)throw new Error("Model.props.indices removed. Use props.indexBuffer");r.indexBuffer&&this.setIndexBuffer(r.indexBuffer),r.attributes&&this.setAttributes(r.attributes),r.constantAttributes&&this.setConstantAttributes(r.constantAttributes),r.bindings&&this.setBindings(r.bindings),r.uniforms&&this.setUniforms(r.uniforms),r.moduleSettings&&(te.log.warn("Model.props.moduleSettings is deprecated. Use Model.shaderInputs.setProps()")(),this.updateModuleSettings(r.moduleSettings)),r.transformFeedback&&(this.transformFeedback=r.transformFeedback),Object.seal(this)}destroy(){this.pipelineFactory.release(this.pipeline),this._uniformStore.destroy()}predraw(){this.updateShaderInputs()}draw(e){this.predraw();try{this._logDrawCallStart(),this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings),this.pipeline.setUniforms(this.uniforms),this.pipeline.draw({renderPass:e,vertexArray:this.vertexArray,vertexCount:this.vertexCount,instanceCount:this.instanceCount,transformFeedback:this.transformFeedback})}finally{this._logDrawCallEnd()}this._logFramebuffer(e)}setGeometry(e){let r=e&&Sg(this.device,e);return this.setTopology(r.topology||"triangle-list"),this.bufferLayout=Ig(this.bufferLayout,r.bufferLayout),this.vertexArray&&this._setGeometryAttributes(r),r}_setGeometryAttributes(e){let r={...e.attributes};for(let[n]of Object.entries(r))!this.pipeline.shaderLayout.attributes.find(s=>s.name===n)&&n!=="positions"&&delete r[n];this.vertexCount=e.vertexCount,this.setIndexBuffer(e.indices),this.setAttributes(e.attributes,"ignore-unknown"),this.setAttributes(r)}setTopology(e){e!==this.topology&&(this.topology=e,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(e){this.bufferLayout=this._gpuGeometry?Ig(e,this._gpuGeometry.bufferLayout):e,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(e){(0,te.deepEqual)(e,this.parameters,2)||(this.parameters=e,this._setPipelineNeedsUpdate("parameters"))}setVertexCount(e){this.vertexCount=e}setInstanceCount(e){this.instanceCount=e}setShaderInputs(e){this.shaderInputs=e,this._uniformStore=new nr.UniformStore(this.shaderInputs.modules);for(let r of Object.keys(this.shaderInputs.modules)){let n=this._uniformStore.getManagedUniformBuffer(this.device,r);this.bindings[`${r}Uniforms`]=n}}setShaderModuleProps(e){let r=this._getModuleUniforms(e),n=Object.keys(r).filter(i=>{let o=r[i];return!(0,te.isNumberArray)(o)&&typeof o!="number"&&typeof o!="boolean"}),s={};for(let i of n)s[i]=r[i],delete r[i]}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues())}updateModuleSettings(e){te.log.warn("Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()")();let{bindings:r,uniforms:n}=(0,te.splitUniformsAndBindings)(this._getModuleUniforms(e));Object.assign(this.bindings,r),Object.assign(this.uniforms,n)}setBindings(e){Object.assign(this.bindings,e)}setUniforms(e){this.pipeline.setUniforms(e),Object.assign(this.uniforms,e)}setIndexBuffer(e){this.vertexArray.setIndexBuffer(e)}setTransformFeedback(e){this.transformFeedback=e}setAttributes(e,r){e.indices&&te.log.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)();for(let[n,s]of Object.entries(e)){let i=this.bufferLayout.find(c=>Og(c).includes(n));if(!i){te.log.warn(`Model(${this.id}): Missing layout for buffer "${n}".`)();continue}let o=Og(i),a=!1;for(let c of o){let u=this._attributeInfos[c];u&&(this.vertexArray.setBuffer(u.location,s),a=!0)}!a&&r!=="ignore-unknown"&&te.log.warn(`Model(${this.id}): Ignoring buffer "${s.id}" for unknown attribute "${n}"`)()}}setConstantAttributes(e){for(let[r,n]of Object.entries(e)){let s=this._attributeInfos[r];s?this.vertexArray.setConstant(s.location,n):te.log.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${r}"`)()}}_setPipelineNeedsUpdate(e){this._pipelineNeedsUpdate=this._pipelineNeedsUpdate||e}_updatePipeline(){if(this._pipelineNeedsUpdate){this.pipeline&&te.log.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),this._pipelineNeedsUpdate=!1;let e=this.device.createShader({id:`${this.id}-vertex`,stage:"vertex",source:this.vs}),r=this.fs?this.device.createShader({id:`${this.id}-fragment`,stage:"fragment",source:this.fs}):null;this.pipeline=this.device.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:e,fs:r}),this._attributeInfos=(0,Rg.getAttributeInfosFromLayouts)(this.pipeline.shaderLayout,this.bufferLayout)}return this.pipeline}_logDrawCallStart(){let e=te.log.level>3?0:GS;te.log.level<2||Date.now()-this._lastLogTime<e||(this._lastLogTime=Date.now(),this._logOpen=!0,te.log.group(ln,`>>> DRAWING MODEL ${this.id}`,{collapsed:te.log.level<=2})())}_logDrawCallEnd(){if(this._logOpen){let e=Cg(this.pipeline.shaderLayout,this.id);te.log.table(ln,e)();let r=this.shaderInputs.getDebugTable();for(let[s,i]of Object.entries(this.uniforms))r[s]={value:i};te.log.table(ln,r)();let n=this._getAttributeDebugTable();te.log.table(ln,this._attributeInfos)(),te.log.table(ln,n)(),te.log.groupEnd(ln)(),this._logOpen=!1}}_logFramebuffer(e){let r=te.log.get("framebuffer");if(this._drawCount++,!r||this._drawCount++>3&&this._drawCount%60)return;let n=e.props.framebuffer;n&&Mg(n,{id:n.id,minimap:!0})}_getAttributeDebugTable(){let e={};for(let[r,n]of Object.entries(this._attributeInfos))e[n.location]={name:r,type:n.shaderType,values:this._getBufferOrConstantValues(this.vertexArray.attributes[n.location],n.bufferDataType)};if(this.vertexArray.indexBuffer){let{indexBuffer:r}=this.vertexArray,n=r.indexType==="uint32"?new Uint32Array(r.debugData):new Uint16Array(r.debugData);e.indices={name:"indices",type:r.indexType,values:n.toString()}}return e}_getBufferOrConstantValues(e,r){let n=(0,nr.getTypedArrayFromDataType)(r);return(e instanceof nr.Buffer?new n(e.debugData):e).toString()}};rr.defaultProps={...nr.RenderPipeline.defaultProps,source:null,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:void 0,geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},varyings:[],shaderInputs:void 0,pipelineFactory:void 0,transformFeedback:void 0,shaderAssembler:rt.getDefaultShaderAssembler()};function Ig(t,e){let r=[...t];for(let n of e){let s=r.findIndex(i=>i.name===n.name);s<0?r.push(n):r[s]=n}return r}function kS(t){return{type:t.info.type,shaderLanguage:t.info.shadingLanguage,shaderLanguageVersion:t.info.shadingLanguageVersion,gpu:t.info.gpu,features:t.features}}function Og(t){var e;return t.attributes?(e=t.attributes)===null||e===void 0?void 0:e.map(r=>r.attribute):[t.name]}var fn=U(Ct(),1),As=class{constructor(e){this.id=void 0,this.topology=void 0,this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.userData={};let{attributes:r={},indices:n=null,vertexCount:s=null}=e;this.id=e.id||(0,fn.uid)("geometry"),this.topology=e.topology,n&&(this.indices=ArrayBuffer.isView(n)?{value:n,size:1}:n),this.attributes={};for(let[i,o]of Object.entries(r)){let a=ArrayBuffer.isView(o)?{value:o}:o;(0,fn.assert)(ArrayBuffer.isView(a.value),`${this._print(i)}: must be typed array or object with value as typed array`),(i==="POSITION"||i==="positions")&&!a.size&&(a.size=3),i==="indices"?((0,fn.assert)(!this.indices),this.indices=a):this.attributes[i]=a}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=s||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(e){return`Geometry ${this.id} attribute ${e}`}_setAttributes(e,r){return this}_calculateVertexCount(e,r){if(r)return r.value.length;let n=1/0;for(let s of Object.values(e)){let{value:i,size:o,constant:a}=s;!a&&i&&o>=1&&(n=Math.min(n,i.length/o))}return(0,fn.assert)(Number.isFinite(n)),n}};var ur=U(Ze()),g_=U(Ye()),y_=U(Mo());var Pg=U(Ct(),1),gt=function(t){return t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.ONE=1]="ONE",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.LINEAR=9729]="LINEAR",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t}(gt||{});function xl(t,e,r,n){let s={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{u_Camera:[0,0,0],u_MetallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};t.features.has("glsl-texture-lod")&&(s.defines.USE_TEX_LOD=1);let{imageBasedLightingEnvironment:i}=n;return i&&(s.bindings.u_DiffuseEnvSampler=i.diffuseEnvSampler,s.bindings.u_SpecularEnvSampler=i.specularEnvSampler,s.bindings.u_brdfLUT=i.brdfLutTexture,s.uniforms.u_ScaleIBLAmbient=[1,1]),n!=null&&n.pbrDebug&&(s.defines.PBR_DEBUG=1,s.uniforms.u_ScaleDiffBaseMR=[0,0,0,0],s.uniforms.u_ScaleFGDSpec=[0,0,0,0]),r.NORMAL&&(s.defines.HAS_NORMALS=1),r.TANGENT&&n!==null&&n!==void 0&&n.useTangents&&(s.defines.HAS_TANGENTS=1),r.TEXCOORD_0&&(s.defines.HAS_UV=1),n!=null&&n.imageBasedLightingEnvironment&&(s.defines.USE_IBL=1),n!=null&&n.lights&&(s.defines.USE_LIGHTS=1),e&&HS(t,e,s),s}function HS(t,e,r){if(r.uniforms.pbr_uUnlit=Boolean(e.unlit),e.pbrMetallicRoughness&&VS(t,e.pbrMetallicRoughness,r),e.normalTexture){vs(t,e.normalTexture,"u_NormalSampler","HAS_NORMALMAP",r);let{scale:n=1}=e.normalTexture;r.uniforms.u_NormalScale=n}if(e.occlusionTexture){vs(t,e.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP",r);let{strength:n=1}=e.occlusionTexture;r.uniforms.u_OcclusionStrength=n}switch(e.emissiveTexture&&(vs(t,e.emissiveTexture,"u_EmissiveSampler","HAS_EMISSIVEMAP",r),r.uniforms.u_EmissiveFactor=e.emissiveFactor||[0,0,0]),e.alphaMode){case"MASK":let{alphaCutoff:n=.5}=e;r.defines.ALPHA_CUTOFF=1,r.uniforms.u_AlphaCutoff=n;break;case"BLEND":Pg.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),r.parameters.blendColorOperation="add",r.parameters.blendColorSrcFactor="src-alpha",r.parameters.blendColorDstFactor="one-minus-src-alpha",r.parameters.blendAlphaOperation="add",r.parameters.blendAlphaSrcFactor="one",r.parameters.blendAlphaDstFactor="one-minus-src-alpha",r.glParameters.blend=!0,r.glParameters.blendEquation=gt.FUNC_ADD,r.glParameters.blendFunc=[gt.SRC_ALPHA,gt.ONE_MINUS_SRC_ALPHA,gt.ONE,gt.ONE_MINUS_SRC_ALPHA];break}}function VS(t,e,r){e.baseColorTexture&&vs(t,e.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP",r),r.uniforms.u_BaseColorFactor=e.baseColorFactor||[1,1,1,1],e.metallicRoughnessTexture&&vs(t,e.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP",r);let{metallicFactor:n=1,roughnessFactor:s=1}=e;r.uniforms.u_MetallicRoughnessValues=[n,s]}function vs(t,e,r){var n;let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,i=arguments.length>4?arguments[4]:void 0,o=(e==null||(n=e.texture)===null||n===void 0||(n=n.sampler)===null||n===void 0?void 0:n.parameters)||{},a=e.texture.source.image,c,u={};a.compressed?(c=a,u={[gt.TEXTURE_MIN_FILTER]:a.data.length>1?gt.LINEAR_MIPMAP_NEAREST:gt.LINEAR}):c={data:a};let l=t.createTexture({id:e.uniformName||e.id,parameters:{...o,...u},pixelStore:{[gt.UNPACK_FLIP_Y_WEBGL]:!1},...c});i.bindings[r]=l,s&&(i.defines[s]=1),i.generatedTextures.push(l)}var Fg="4.1.0-alpha.9";var Io={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},bl;async function El(t){let e=t.modules||{};return e.basis?e.basis:(bl=bl||zS(t),await bl)}async function zS(t){let e=null,r=null;return[e,r]=await Promise.all([await lt(Io.TRANSCODER,"textures",t),await lt(Io.TRANSCODER_WASM,"textures",t)]),e=e||globalThis.BASIS,await jS(e,r)}function jS(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(n=>{t(r).then(s=>{let{BasisFile:i,initializeBasis:o}=s;o(),n({BasisFile:i})})})}var Tl;async function wl(t){let e=t.modules||{};return e.basisEncoder?e.basisEncoder:(Tl=Tl||qS(t),await Tl)}async function qS(t){let e=null,r=null;return[e,r]=await Promise.all([await lt(Io.ENCODER,"textures",t),await lt(Io.ENCODER_WASM,"textures",t)]),e=e||globalThis.BASIS,await JS(e,r)}function JS(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(n=>{t(r).then(s=>{let{BasisFile:i,KTX2File:o,initializeBasis:a,BasisEncoder:c}=s;a(),n({BasisFile:i,KTX2File:o,BasisEncoder:c})})})}var Br={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919};var WS=["","WEBKIT_","MOZ_"],Ng={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"},Oo=null;function Dg(t){if(!Oo){t=t||XS()||void 0,Oo=new Set;for(let e of WS)for(let r in Ng)if(t&&t.getExtension(`${e}${r}`)){let n=Ng[r];Oo.add(n)}}return Oo}function XS(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var u4=new Uint8Array([0]);var Ug,Gg,kg,Hg,Vg,zg,jg,qg;(function(t){t[t.NONE=0]="NONE",t[t.BASISLZ=1]="BASISLZ",t[t.ZSTD=2]="ZSTD",t[t.ZLIB=3]="ZLIB"})(Ug||(Ug={})),function(t){t[t.BASICFORMAT=0]="BASICFORMAT"}(Gg||(Gg={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC"}(kg||(kg={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB"}(Hg||(Hg={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LINEAR=1]="LINEAR",t[t.SRGB=2]="SRGB",t[t.ITU=3]="ITU",t[t.NTSC=4]="NTSC",t[t.SLOG=5]="SLOG",t[t.SLOG2=6]="SLOG2"}(Vg||(Vg={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(zg||(zg={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA"}(jg||(jg={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG"}(qg||(qg={}));var De=[171,75,84,88,32,50,48,187,13,10,26,10];function Jg(t){let e=new Uint8Array(t);return!(e.byteLength<De.length||e[0]!==De[0]||e[1]!==De[1]||e[2]!==De[2]||e[3]!==De[3]||e[4]!==De[4]||e[5]!==De[5]||e[6]!==De[6]||e[7]!==De[7]||e[8]!==De[8]||e[9]!==De[9]||e[10]!==De[10]||e[11]!==De[11])}var KS={etc1:{basisFormat:0,compressed:!0,format:Br.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Br.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:Br.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:Br.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Br.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:Br.COMPRESSED_RGBA_ASTC_4X4_KHR},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};async function Bl(t,e){if(e.basis.containerFormat==="auto"){if(Jg(t)){let n=await wl(e);return Wg(n.KTX2File,t,e)}let{BasisFile:r}=await El(e);return Sl(r,t,e)}switch(e.basis.module){case"encoder":let r=await wl(e);switch(e.basis.containerFormat){case"ktx2":return Wg(r.KTX2File,t,e);case"basis":default:return Sl(r.BasisFile,t,e)}case"transcoder":default:let{BasisFile:n}=await El(e);return Sl(n,t,e)}}function Sl(t,e,r){let n=new t(new Uint8Array(e));try{if(!n.startTranscoding())throw new Error("Failed to start basis transcoding");let s=n.getNumImages(),i=[];for(let o=0;o<s;o++){let a=n.getNumLevels(o),c=[];for(let u=0;u<a;u++)c.push(YS(n,o,u,r));i.push(c)}return i}finally{n.close(),n.delete()}}function YS(t,e,r,n){let s=t.getImageWidth(e,r),i=t.getImageHeight(e,r),o=t.getHasAlpha(),{compressed:a,format:c,basisFormat:u}=Xg(n,o),l=t.getImageTranscodedSizeInBytes(e,r,u),f=new Uint8Array(l);if(!t.transcodeImage(f,e,r,u,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:i,data:f,compressed:a,format:c,hasAlpha:o}}function Wg(t,e,r){let n=new t(new Uint8Array(e));try{if(!n.startTranscoding())throw new Error("failed to start KTX2 transcoding");let s=n.getLevels(),i=[];for(let o=0;o<s;o++){i.push(ZS(n,o,r));break}return[i]}finally{n.close(),n.delete()}}function ZS(t,e,r){let{alphaFlag:n,height:s,width:i}=t.getImageLevelInfo(e,0,0),{compressed:o,format:a,basisFormat:c}=Xg(r,n),u=t.getImageTranscodedSizeInBytes(e,0,0,c),l=new Uint8Array(u);if(!t.transcodeImage(l,e,0,0,c,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:i,height:s,data:l,compressed:o,levelSize:u,hasAlpha:n,format:a}}function Xg(t,e){let r=t&&t.basis&&t.basis.format;return r==="auto"&&(r=Ro()),typeof r=="object"&&(r=e?r.alpha:r.noAlpha),r=r.toLowerCase(),KS[r]}function Ro(){let t=Dg();return t.has("astc")?"astc-4x4":t.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:t.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:t.has("etc1")?"etc1":t.has("etc2")?"etc2":"rgb565"}var Kg={name:"Basis",id:"basis",module:"textures",version:Fg,worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},Cl={...Kg,parse:Bl};function Ml(t){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let e=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=t||e;return!!(r&&r.indexOf("Electron")>=0)}function nt(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||Ml()}var QS=globalThis.self||globalThis.window||globalThis.global,hn=globalThis.window||globalThis.self||globalThis.global,$S=globalThis.document||{},Cr=globalThis.process||{},eB=globalThis.console,C4=globalThis.navigator||{};var Lo=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",O4=nt();var $g=U(Mo());var Yg=`#version 300 es
|
|
500
|
+
`;var Ka={name:"pbr",vs:Ku,fs:Ju,defines:{LIGHTING_FRAGMENT:1},dependencies:[Gu]};var ju=v(Da(),1);var Zu=v(qs(),1);var Yu=`#version 300 es
|
|
644
501
|
#define SHADER_NAME simple-mesh-layer-vs
|
|
502
|
+
|
|
503
|
+
// Scale the model
|
|
645
504
|
uniform float sizeScale;
|
|
646
505
|
uniform bool composeModelMatrix;
|
|
647
506
|
uniform bool pickFeatureIds;
|
|
507
|
+
|
|
508
|
+
// Primitive attributes
|
|
648
509
|
in vec3 positions;
|
|
649
510
|
in vec3 normals;
|
|
650
511
|
in vec3 colors;
|
|
651
512
|
in vec2 texCoords;
|
|
652
513
|
in vec4 uvRegions;
|
|
653
514
|
in vec3 featureIdsPickingColors;
|
|
515
|
+
|
|
516
|
+
// Instance attributes
|
|
654
517
|
in vec4 instanceColors;
|
|
655
518
|
in vec3 instancePickingColors;
|
|
656
519
|
in vec3 instanceModelMatrixCol0;
|
|
657
520
|
in vec3 instanceModelMatrixCol1;
|
|
658
521
|
in vec3 instanceModelMatrixCol2;
|
|
522
|
+
|
|
523
|
+
// Outputs to fragment shader
|
|
659
524
|
out vec2 vTexCoord;
|
|
660
525
|
out vec3 cameraPosition;
|
|
661
526
|
out vec3 normals_commonspace;
|
|
@@ -664,6 +529,7 @@ out vec4 vColor;
|
|
|
664
529
|
|
|
665
530
|
vec2 applyUVRegion(vec2 uv) {
|
|
666
531
|
#ifdef HAS_UV_REGIONS
|
|
532
|
+
// https://github.com/Esri/i3s-spec/blob/master/docs/1.7/geometryUVRegion.cmn.md
|
|
667
533
|
return fract(uv) * (uvRegions.zw - uvRegions.xy) + uvRegions.xy;
|
|
668
534
|
#else
|
|
669
535
|
return uv;
|
|
@@ -698,6 +564,7 @@ void main(void) {
|
|
|
698
564
|
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
699
565
|
|
|
700
566
|
#ifdef MODULE_PBR
|
|
567
|
+
// set PBR data
|
|
701
568
|
pbr_vPosition = geometry.position.xyz;
|
|
702
569
|
#ifdef HAS_NORMALS
|
|
703
570
|
pbr_vNormal = geometry.normal;
|
|
@@ -713,7 +580,7 @@ void main(void) {
|
|
|
713
580
|
|
|
714
581
|
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
715
582
|
}
|
|
716
|
-
`;var
|
|
583
|
+
`;var qu=`#version 300 es
|
|
717
584
|
#define SHADER_NAME simple-mesh-layer-fs
|
|
718
585
|
|
|
719
586
|
precision highp float;
|
|
@@ -745,6 +612,11 @@ void main(void) {
|
|
|
745
612
|
|
|
746
613
|
vec3 normal;
|
|
747
614
|
if (flatShading) {
|
|
615
|
+
|
|
616
|
+
// NOTE(Tarek): This is necessary because
|
|
617
|
+
// headless.gl reports the extension as
|
|
618
|
+
// available but does not support it in
|
|
619
|
+
// the shader.
|
|
748
620
|
#ifdef DERIVATIVES_AVAILABLE
|
|
749
621
|
normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
|
|
750
622
|
#else
|
|
@@ -762,13 +634,6 @@ void main(void) {
|
|
|
762
634
|
|
|
763
635
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
764
636
|
}
|
|
765
|
-
`;function Po(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Po=function(r){return typeof r}:Po=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Po(t)}function Qg(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function sr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Qg(Object(r),!0).forEach(function(n){tB(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Qg(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function tB(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function rB(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ir(t,e,r){return typeof Reflect<"u"&&Reflect.get?ir=Reflect.get:ir=function(s,i,o){var a=nB(s,i);if(a){var c=Object.getOwnPropertyDescriptor(a,i);return c.get?c.get.call(o):c.value}},ir(t,e,r||t)}function nB(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&(t=yt(t),t!==null););return t}function sB(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Il(t,e)}function Il(t,e){return Il=Object.setPrototypeOf||function(n,s){return n.__proto__=s,n},Il(t,e)}function iB(t){var e=cB();return function(){var n=yt(t),s;if(e){var i=yt(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return oB(this,s)}}function oB(t,e){if(e&&(Po(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return aB(t)}function aB(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function cB(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function yt(t){return yt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},yt(t)}function uB(t){var e=t.positions||t.POSITION,r=e.value.length/e.size,n=t.COLOR_0||t.colors;n||(t.colors={size:4,value:new Uint8Array(r*4).fill(255),normalized:!0})}var lB={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},Fo=function(t){sB(r,t);var e=iB(r);function r(){return rB(this,r),e.apply(this,arguments)}var n=r.prototype;return n.getShaders=function(){var i=ir(yt(r.prototype),"getShaders",this).call(this),o=i.modules;return o.push(_l),sr(sr({},i),{},{vs:Yg,fs:Zg})},n.initializeState=function(){var i=this.props.featureIds;ir(yt(r.prototype),"initializeState",this).call(this);var o=this.getAttributeManager();i&&o.add({featureIdsPickingColors:{type:5121,size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})},n.updateState=function(i){ir(yt(r.prototype),"updateState",this).call(this,i);var o=i.props,a=i.oldProps;o.pbrMaterial!==a.pbrMaterial&&this.updatePbrMaterialUniforms(o.pbrMaterial)},n.draw=function(i){var o=this.props.featureIds;this.state.model&&(this.state.model.setUniforms({u_Camera:this.state.model.uniforms.project_uCameraPosition,pickFeatureIds:Boolean(o)}),ir(yt(r.prototype),"draw",this).call(this,i))},n.getModel=function(i){var o=this.props,a=o.id,c=o.pbrMaterial,u=this.parseMaterial(c,i);this.setState({parsedPBRMaterial:u});var l=this.getShaders();uB(i.attributes);var f=new rr(this.context.device,sr(sr({},this.getShaders()),{},{id:a,geometry:i,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:sr(sr(sr({},l.defines),u?.defines),{},{HAS_UV_REGIONS:i.attributes.uvRegions?1:0}),parameters:u?.parameters,isInstanced:!0}));return f},n.updatePbrMaterialUniforms=function(i){var o=this.state.model;if(o){var a=this.props.mesh,c=this.parseMaterial(i,a);this.setState({parsedPBRMaterial:c}),o.setBindings(c.bindings),o.setUniforms(c.uniforms)}},n.parseMaterial=function(i,o){var a=Boolean(i.pbrMetallicRoughness&&i.pbrMetallicRoughness.baseColorTexture);return xl(this.context.device,sr({unlit:a},i),{NORMAL:o.attributes.normals,TEXCOORD_0:o.attributes.texCoords},{pbrDebug:!1,lights:!0,useTangents:!1})},n.calculateFeatureIdsPickingColors=function(i){for(var o=this.props.featureIds,a=new Uint8ClampedArray(o.length*i.size),c=[],u=0;u<o.length;u++)this.encodePickingColor(o[u],c),a[u*3]=c[0],a[u*3+1]=c[1],a[u*3+2]=c[2];i.value=a},n.finalizeState=function(i){var o;ir(yt(r.prototype),"finalizeState",this).call(this,i),(o=this.state.parsedPBRMaterial)===null||o===void 0||o.generatedTextures.forEach(function(a){return a.destroy()}),this.setState({parsedPBRMaterial:null})},r}($g.SimpleMeshLayer);Fo.layerName="MeshLayer";Fo.defaultProps=lB;var __=U(dn());var Lt=6356752314245179e-9,fB={radii:[6378137,6378137,Lt],radiiSquared:[6378137*6378137,6378137*6378137,Lt*Lt],oneOverRadii:[1/6378137,1/6378137,1/Lt],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(Lt*Lt)],maximumRadius:Math.max(6378137,6378137,Lt),centerToleranceSquared:.1};function No(t){return t}var $4=new w;function hB(t,e=[],r=No){return"longitude"in t?(e[0]=r(t.longitude),e[1]=r(t.latitude),e[2]=t.height):"x"in t?(e[0]=r(t.x),e[1]=r(t.y),e[2]=t.z):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}function t0(t,e=[]){return hB(t,e,ee._cartographicRadians?No:Tc)}function dB(t,e,r=No){return"longitude"in e?(e.longitude=r(t[0]),e.latitude=r(t[1]),e.height=t[2]):"x"in e?(e.x=r(t[0]),e.y=r(t[1]),e.z=t[2]):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}function r0(t,e){return dB(t,e,ee._cartographicRadians?No:Ec)}var n0=1e-14,pB=new w,s0={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},Ol={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},xs={east:new w,north:new w,up:new w,west:new w,south:new w,down:new w},mB=new w,gB=new w,yB=new w;function Rl(t,e,r,n,s,i){let o=s0[e]&&s0[e][r];me(o&&(!n||n===o));let a,c,u,l=pB.copy(s);if(we(l.x,0,n0)&&we(l.y,0,n0)){let h=Math.sign(l.z);a=mB.fromArray(Ol[e]),e!=="east"&&e!=="west"&&a.scale(h),c=gB.fromArray(Ol[r]),r!=="east"&&r!=="west"&&c.scale(h),u=yB.fromArray(Ol[n]),n!=="east"&&n!=="west"&&u.scale(h)}else{let{up:h,east:d,north:p}=xs;d.set(-l.y,l.x,0).normalize(),t.geodeticSurfaceNormal(l,h),p.copy(h).cross(d);let{down:g,west:m,south:A}=xs;g.copy(h).scale(-1),m.copy(d).scale(-1),A.copy(p).scale(-1),a=xs[e],c=xs[r],u=xs[n]}return i[0]=a.x,i[1]=a.y,i[2]=a.z,i[3]=0,i[4]=c.x,i[5]=c.y,i[6]=c.z,i[7]=0,i[8]=u.x,i[9]=u.y,i[10]=u.z,i[11]=0,i[12]=l.x,i[13]=l.y,i[14]=l.z,i[15]=1,i}var pn=new w,_B=new w,AB=new w;function i0(t,e,r=[]){let{oneOverRadii:n,oneOverRadiiSquared:s,centerToleranceSquared:i}=e;pn.from(t);let o=pn.x,a=pn.y,c=pn.z,u=n.x,l=n.y,f=n.z,h=o*o*u*u,d=a*a*l*l,p=c*c*f*f,g=h+d+p,m=Math.sqrt(1/g);if(!Number.isFinite(m))return;let A=_B;if(A.copy(t).scale(m),g<i)return A.to(r);let v=s.x,x=s.y,b=s.z,M=AB;M.set(A.x*v*2,A.y*x*2,A.z*b*2);let C=(1-m)*pn.len()/(.5*M.len()),I=0,B,S,y,R;do{C-=I,B=1/(1+C*v),S=1/(1+C*x),y=1/(1+C*b);let P=B*B,F=S*S,N=y*y,G=P*B,Q=F*S,J=N*y;R=h*P+d*F+p*N-1;let Z=-2*(h*G*v+d*Q*x+p*J*b);I=R/Z}while(Math.abs(R)>Qe.EPSILON12);return pn.scale([B,S,y]).to(r)}var Do=new w,o0=new w,bB=new w,st=new w,TB=new w,Uo=new w,V=class{constructor(e=0,r=0,n=0){D(this,"radii",void 0),D(this,"radiiSquared",void 0),D(this,"radiiToTheFourth",void 0),D(this,"oneOverRadii",void 0),D(this,"oneOverRadiiSquared",void 0),D(this,"minimumRadius",void 0),D(this,"maximumRadius",void 0),D(this,"centerToleranceSquared",Qe.EPSILON1),D(this,"squaredXOverSquaredZ",void 0),me(e>=0),me(r>=0),me(n>=0),this.radii=new w(e,r,n),this.radiiSquared=new w(e*e,r*r,n*n),this.radiiToTheFourth=new w(e*e*e*e,r*r*r*r,n*n*n*n),this.oneOverRadii=new w(e===0?0:1/e,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new w(e===0?0:1/(e*e),r===0?0:1/(r*r),n===0?0:1/(n*n)),this.minimumRadius=Math.min(e,r,n),this.maximumRadius=Math.max(e,r,n),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(e){return this===e||Boolean(e&&this.radii.equals(e.radii))}toString(){return this.radii.toString()}cartographicToCartesian(e,r=[0,0,0]){let n=o0,s=bB,[,,i]=e;this.geodeticSurfaceNormalCartographic(e,n),s.copy(this.radiiSquared).scale(n);let o=Math.sqrt(n.dot(s));return s.scale(1/o),n.scale(i),s.add(n),s.to(r)}cartesianToCartographic(e,r=[0,0,0]){Uo.from(e);let n=this.scaleToGeodeticSurface(Uo,st);if(!n)return;let s=this.geodeticSurfaceNormal(n,o0),i=TB;i.copy(Uo).subtract(n);let o=Math.atan2(s.y,s.x),a=Math.asin(s.z),c=Math.sign(Zr.dot(i,Uo))*Zr.length(i);return r0([o,a,c],r)}eastNorthUpToFixedFrame(e,r=new k){return Rl(this,"east","north","up",e,r)}localFrameToFixedFrame(e,r,n,s,i=new k){return Rl(this,e,r,n,s,i)}geocentricSurfaceNormal(e,r=[0,0,0]){return Do.from(e).normalize().to(r)}geodeticSurfaceNormalCartographic(e,r=[0,0,0]){let n=t0(e),s=n[0],i=n[1],o=Math.cos(i);return Do.set(o*Math.cos(s),o*Math.sin(s),Math.sin(i)).normalize(),Do.to(r)}geodeticSurfaceNormal(e,r=[0,0,0]){return Do.from(e).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(e,r){return i0(e,this,r)}scaleToGeocentricSurface(e,r=[0,0,0]){st.from(e);let n=st.x,s=st.y,i=st.z,o=this.oneOverRadiiSquared,a=1/Math.sqrt(n*n*o.x+s*s*o.y+i*i*o.z);return st.multiplyScalar(a).to(r)}transformPositionToScaledSpace(e,r=[0,0,0]){return st.from(e).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(e,r=[0,0,0]){return st.from(e).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(e,r=0,n=[0,0,0]){me(we(this.radii.x,this.radii.y,Qe.EPSILON15)),me(this.radii.z>0),st.from(e);let s=st.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(s)>=this.radii.z-r))return st.set(0,0,s).to(n)}};D(V,"WGS84",new V(6378137,6378137,Lt));var Go=class{constructor(e,r,n){this.item=void 0,this.previous=void 0,this.next=void 0,this.item=e,this.previous=r,this.next=n}};var ko=class{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(e){let r=new Go(e,this.tail,null);return this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),++this._length,r}remove(e){e&&(e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,--this._length)}splice(e,r){e!==r&&(this.remove(r),this._insert(e,r))}_insert(e,r){let n=e.next;e.next=r,this.tail===e?this.tail=r:n.previous=r,r.next=n,r.previous=e,++this._length}};var Ho=class{constructor(){this._list=void 0,this._sentinel=void 0,this._trimTiles=void 0,this._list=new ko,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(e){let r=e._cacheNode;r&&this._list.splice(this._sentinel,r)}add(e,r,n){r._cacheNode||(r._cacheNode=this._list.add(r),n&&n(e,r))}unloadTile(e,r,n){let s=r._cacheNode;s&&(this._list.remove(s),r._cacheNode=null,n&&n(e,r))}unloadTiles(e,r){let n=this._trimTiles;this._trimTiles=!1;let s=this._list,i=e.maximumMemoryUsage*1024*1024,o=this._sentinel,a=s.head;for(;a!==o&&(e.gpuMemoryUsageInBytes>i||n);){let c=a.item;a=a.next,this.unloadTile(e,c,r)}}trim(){this._trimTiles=!0}};function a0(t,e){j(t),j(e);let{rtcCenter:r,gltfUpAxis:n}=e,{computedTransform:s,boundingVolume:{center:i}}=t,o=new k(s);switch(r&&o.translate(r),n){case"Z":break;case"Y":let f=new k().rotateX(Math.PI/2);o=o.multiplyRight(f);break;case"X":let h=new k().rotateY(-Math.PI/2);o=o.multiplyRight(h);break;default:break}e.isQuantized&&o.translate(e.quantizedVolumeOffset).scale(e.quantizedVolumeScale);let a=new w(i);e.cartesianModelMatrix=o,e.cartesianOrigin=a;let c=V.WGS84.cartesianToCartographic(a,new w),l=V.WGS84.eastNorthUpToFixedFrame(a).invert();e.cartographicModelMatrix=l.multiplyRight(o),e.cartographicOrigin=c,e.coordinateSystem||(e.modelMatrix=e.cartographicModelMatrix)}var c0=new w,Ll=new w,Pl=new de([new ge,new ge,new ge,new ge,new ge,new ge]);function l0(t,e){let{cameraDirection:r,cameraUp:n,height:s}=t,{metersPerUnit:i}=t.distanceScales,o=Vo(t,t.center),a=V.WGS84.eastNorthUpToFixedFrame(o),c=t.unprojectPosition(t.cameraPosition),u=V.WGS84.cartographicToCartesian(c,new w),l=new w(a.transformAsVector(new w(r).scale(i))).normalize(),f=new w(a.transformAsVector(new w(n).scale(i))).normalize();EB(t);let h=t.constructor,{longitude:d,latitude:p,width:g,bearing:m,zoom:A}=t,v=new h({longitude:d,latitude:p,height:s,width:g,bearing:m,zoom:A,pitch:0});return{camera:{position:u,direction:l,up:f},viewport:t,topDownViewport:v,height:s,cullingVolume:Pl,frameNumber:e,sseDenominator:1.15}}function f0(t,e,r){if(r===0||t.length<=r)return[t,[]];let n=[],{longitude:s,latitude:i}=e.viewport;for(let[u,l]of t.entries()){let[f,h]=l.header.mbs,d=Math.abs(s-f),p=Math.abs(i-h),g=Math.sqrt(p*p+d*d);n.push([u,g])}let o=n.sort((u,l)=>u[1]-l[1]),a=[];for(let u=0;u<r;u++)a.push(t[o[u][0]]);let c=[];for(let u=r;u<o.length;u++)c.push(t[o[u][0]]);return[a,c]}function EB(t){let e=t.getFrustumPlanes(),r=u0(e.near,t.cameraPosition),n=Vo(t,r),s=Vo(t,t.cameraPosition,Ll),i=0;Pl.planes[i++].fromPointNormal(n,c0.copy(n).subtract(s));for(let o in e){if(o==="near")continue;let a=e[o],c=u0(a,r,Ll),u=Vo(t,c,Ll);Pl.planes[i++].fromPointNormal(u,c0.copy(n).subtract(u))}}function u0(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new w,n=t.normal.dot(e);return r.copy(t.normal).scale(t.distance-n).add(e),r}function Vo(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new w,n=t.unprojectPosition(e);return V.WGS84.cartographicToCartesian(n,r)}var wB=6378137,SB=6378137,Fl=6356752314245179e-9,mn=new w;function h0(t,e){if(t instanceof et){let{halfAxes:r}=t,n=BB(r);return Math.log2(Fl/(n+e[2]))}else if(t instanceof ke){let{radius:r}=t;return Math.log2(Fl/(r+e[2]))}else if(t.width&&t.height){let{width:r,height:n}=t,s=Math.log2(wB/r),i=Math.log2(SB/n);return(s+i)/2}return 1}function Nl(t,e,r){V.WGS84.cartographicToCartesian([t.xmax,t.ymax,t.zmax],mn);let n=Math.sqrt(Math.pow(mn[0]-r[0],2)+Math.pow(mn[1]-r[1],2)+Math.pow(mn[2]-r[2],2));return Math.log2(Fl/(n+e[2]))}function d0(t,e,r){let[n,s,i,o]=t;return Nl({xmin:n,xmax:i,ymin:s,ymax:o,zmin:0,zmax:0},e,r)}function BB(t){t.getColumn(0,mn);let e=t.getColumn(1),r=t.getColumn(2);return mn.add(e).add(r).len()}var I0=U(dn(),1);var Se={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Me=function(t){return t[t.ADD=1]="ADD",t[t.REPLACE=2]="REPLACE",t}({}),_t=function(t){return t.EMPTY="empty",t.SCENEGRAPH="scenegraph",t.POINTCLOUD="pointcloud",t.MESH="mesh",t}({}),ve=function(t){return t.I3S="I3S",t.TILES3D="TILES3D",t}({}),Mr=function(t){return t.GEOMETRIC_ERROR="geometricError",t.MAX_SCREEN_THRESHOLD="maxScreenThreshold",t}({}),p0={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function _0(t){return t!=null}var xe=new w,zo=new w,CB=new w,MB=new w,Ir=new w,m0=new w,g0=new w,y0=new w;function jo(t,e,r){if(j(t,"3D Tile: boundingVolume must be defined"),t.box)return v0(t.box,e,r);if(t.region)return OB(t.region);if(t.sphere)return IB(t.sphere,e,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function A0(t,e){if(t.box)return RB(e);if(t.region){let[r,n,s,i,o,a]=t.region;return[[Ne(r),Ne(n),o],[Ne(s),Ne(i),a]]}if(t.sphere)return LB(e);throw new Error("Unkown boundingVolume type")}function v0(t,e,r){let n=new w(t[0],t[1],t[2]);e.transform(n,n);let s=[];if(t.length===10){let u=t.slice(3,6),l=new ht;l.fromArray(t,6);let f=new w([1,0,0]),h=new w([0,1,0]),d=new w([0,0,1]);f.transformByQuaternion(l),f.scale(u[0]),h.transformByQuaternion(l),h.scale(u[1]),d.transformByQuaternion(l),d.scale(u[2]),s=[...f.toArray(),...h.toArray(),...d.toArray()]}else s=[...t.slice(3,6),...t.slice(6,9),...t.slice(9,12)];let i=e.transformAsVector(s.slice(0,3)),o=e.transformAsVector(s.slice(3,6)),a=e.transformAsVector(s.slice(6,9)),c=new W([i[0],i[1],i[2],o[0],o[1],o[2],a[0],a[1],a[2]]);return _0(r)?(r.center=n,r.halfAxes=c,r):new et(n,c)}function IB(t,e,r){let n=new w(t[0],t[1],t[2]);e.transform(n,n);let s=e.getScale(zo),i=Math.max(Math.max(s[0],s[1]),s[2]),o=t[3]*i;return _0(r)?(r.center=n,r.radius=o,r):new ke(n,o)}function OB(t){let[e,r,n,s,i,o]=t,a=V.WGS84.cartographicToCartesian([Ne(e),Ne(s),i],CB),c=V.WGS84.cartographicToCartesian([Ne(n),Ne(r),o],MB),u=new w().addVectors(a,c).multiplyByScalar(.5);return V.WGS84.cartesianToCartographic(u,Ir),V.WGS84.cartographicToCartesian([Ne(n),Ir[1],Ir[2]],m0),V.WGS84.cartographicToCartesian([Ir[0],Ne(s),Ir[2]],g0),V.WGS84.cartographicToCartesian([Ir[0],Ir[1],o],y0),v0([...u,...m0.subtract(u),...g0.subtract(u),...y0.subtract(u)],new k)}function RB(t){let e=x0(),{halfAxes:r}=t,n=new w(r.getColumn(0)),s=new w(r.getColumn(1)),i=new w(r.getColumn(2));for(let o=0;o<2;o++){for(let a=0;a<2;a++){for(let c=0;c<2;c++)xe.copy(t.center),xe.add(n),xe.add(s),xe.add(i),b0(e,xe),i.negate();s.negate()}n.negate()}return e}function LB(t){let e=x0(),{center:r,radius:n}=t,s=V.WGS84.scaleToGeodeticSurface(r,xe),i;s?i=V.WGS84.geodeticSurfaceNormal(s):i=new w(0,0,1);let o=new w(i[2],-i[1],0);o.len()>0?o.normalize():o=new w(0,1,0);let a=o.clone().cross(i);for(let c of[o,a,i]){zo.copy(c).scale(n);for(let u=0;u<2;u++)xe.copy(r),xe.add(zo),b0(e,xe),zo.negate()}return e}function x0(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function b0(t,e){V.WGS84.cartesianToCartographic(e,xe),t[0][0]=Math.min(t[0][0],xe[0]),t[0][1]=Math.min(t[0][1],xe[1]),t[0][2]=Math.min(t[0][2],xe[2]),t[1][0]=Math.max(t[1][0],xe[0]),t[1][1]=Math.max(t[1][1],xe[1]),t[1][2]=Math.max(t[1][2],xe[2])}var k8=new w,H8=new w,V8=new k,z8=new w,j8=new w,q8=new w;function PB(t,e){let r=t*e;return 1-Math.exp(-(r*r))}function FB(t,e){if(t.dynamicScreenSpaceError&&t.dynamicScreenSpaceErrorComputedDensity){let r=t.dynamicScreenSpaceErrorComputedDensity,n=t.dynamicScreenSpaceErrorFactor;return PB(e,r)*n}return 0}function T0(t,e,r){let n=t.tileset,s=t.parent&&t.parent.lodMetricValue||t.lodMetricValue,i=r?s:t.lodMetricValue;if(i===0)return 0;let o=Math.max(t._distanceToCamera,1e-7),{height:a,sseDenominator:c}=e,{viewDistanceScale:u}=n.options,l=i*a*(u||1)/(o*c);return l-=FB(n,o),l}var Dl=new w,E0=new w,or=new w,w0=new w,NB=new w,Ul=new k,S0=new k;function B0(t,e){if(t.lodMetricValue===0||isNaN(t.lodMetricValue))return"DIG";let r=2*Gl(t,e);return r<2?"OUT":!t.header.children||r<=t.lodMetricValue?"DRAW":t.header.children?"DIG":"OUT"}function Gl(t,e){let{topDownViewport:r}=e,n=t.header.mbs[1],s=t.header.mbs[0],i=t.header.mbs[2],o=t.header.mbs[3],a=[...t.boundingVolume.center],c=r.unprojectPosition(r.cameraPosition);V.WGS84.cartographicToCartesian(c,Dl),E0.copy(Dl).subtract(a).normalize(),V.WGS84.eastNorthUpToFixedFrame(a,Ul),S0.copy(Ul).invert(),or.copy(Dl).transform(S0);let u=Math.sqrt(or[0]*or[0]+or[1]*or[1]),l=u*u/or[2];w0.copy([or[0],or[1],l]);let h=w0.transform(Ul).subtract(a).normalize(),p=E0.cross(h).normalize().scale(o).add(a),g=V.WGS84.cartesianToCartographic(p),m=r.project([s,n,i]),A=r.project(g);return NB.copy(m).subtract(A).magnitude()}function C0(t){return{assetGltfUpAxis:t.asset&&t.asset.gltfUpAxis||"Y"}}var bs=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;this._map=new Map,this._array=void 0,this._length=void 0,this._array=new Array(e),this._length=e}get length(){return this._length}set length(e){this._length=e,e>this._array.length&&(this._array.length=e)}get values(){return this._array}get(e){return j(e<this._array.length),this._array[e]}set(e,r){j(e>=0),e>=this.length&&(this.length=e+1),this._map.has(this._array[e])&&this._map.delete(this._array[e]),this._array[e]=r,this._map.set(r,e)}delete(e){let r=this._map.get(e);r>=0&&(this._array.splice(r,1),this._map.delete(e),this.length--)}peek(){return this._array[this._length-1]}push(e){if(!this._map.has(e)){let r=this.length++;this._array[r]=e,this._map.set(e,r)}}pop(){let e=this._array[--this.length];return this._map.delete(e),e}reserve(e){j(e>=0),e>this._array.length&&(this._array.length=e)}resize(e){j(e>=0),this.length=e}trim(e){e==null&&(e=this.length),this._array.length=e}reset(){this._array=[],this._map=new Map,this._length=0}find(e){return this._map.has(e)}};var DB={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},At=class{traversalFinished(e){return!0}constructor(e){this.options=void 0,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={},this.lastUpdate=new Date().getTime(),this.updateDebounceTime=1e3,this._traversalStack=new bs,this._emptyTraversalStack=new bs,this._frameNumber=null,this.options={...DB,...e}}traverse(e,r,n){this.root=e,this.options={...this.options,...n},this.reset(),this.updateTile(e,r),this._frameNumber=r.frameNumber,this.executeTraversal(e,r)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(e,r){let n=this._traversalStack;for(e._selectionDepth=1,n.push(e);n.length>0;){let i=n.pop(),o=!1;this.canTraverse(i,r)&&(this.updateChildTiles(i,r),o=this.updateAndPushChildren(i,r,n,i.hasRenderContent?i._selectionDepth+1:i._selectionDepth));let a=i.parent,c=Boolean(!a||a._shouldRefine),u=!o;i.hasRenderContent?i.refine===Me.ADD?(this.loadTile(i,r),this.selectTile(i,r)):i.refine===Me.REPLACE&&(this.loadTile(i,r),u&&this.selectTile(i,r)):(this.emptyTiles[i.id]=i,this.loadTile(i,r),u&&this.selectTile(i,r)),this.touchTile(i,r),i._shouldRefine=o&&c}let s=new Date().getTime();(this.traversalFinished(r)||s-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=s,this.options.onTraversalEnd(r))}updateChildTiles(e,r){let n=e.children;for(let s of n)this.updateTile(s,r)}updateAndPushChildren(e,r,n,s){let{loadSiblings:i,skipLevelOfDetail:o}=this.options,a=e.children;a.sort(this.compareDistanceToCamera.bind(this));let c=e.refine===Me.REPLACE&&e.hasRenderContent&&!o,u=!1,l=!0;for(let f of a)if(f._selectionDepth=s,f.isVisibleAndInRequestVolume?(n.find(f)&&n.delete(f),n.push(f),u=!0):(c||i)&&(this.loadTile(f,r),this.touchTile(f,r)),c){let h;if(f._inRequestVolume?f.hasRenderContent?h=f.contentAvailable:h=this.executeEmptyTraversal(f,r):h=!1,l=l&&h,!l)return!1}return u||(l=!1),l}updateTile(e,r){this.updateTileVisibility(e,r)}selectTile(e,r){this.shouldSelectTile(e)&&(e._selectedFrame=r.frameNumber,this.selectedTiles[e.id]=e)}loadTile(e,r){this.shouldLoadTile(e)&&(e._requestedFrame=r.frameNumber,e._priority=e._getPriority(),this.requestedTiles[e.id]=e)}touchTile(e,r){e.tileset._cache.touch(e),e._touchedFrame=r.frameNumber}canTraverse(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return e.hasChildren?e.hasTilesetContent?!e.contentExpired:!s&&!e.isVisibleAndInRequestVolume?!1:this.shouldRefine(e,r,n):!1}shouldLoadTile(e){return e.hasUnloadedContent||e.contentExpired}shouldSelectTile(e){return e.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=e._screenSpaceError;return n&&(s=e.getScreenSpaceError(r,!0)),s>this.options.maximumScreenSpaceError}updateTileVisibility(e,r){let n=[];if(this.options.viewportTraversersMap)for(let s in this.options.viewportTraversersMap)this.options.viewportTraversersMap[s]===r.viewport.id&&n.push(s);else n.push(r.viewport.id);e.updateVisibility(r,n)}compareDistanceToCamera(e,r){return e._distanceToCamera-r._distanceToCamera}anyChildrenVisible(e,r){let n=!1;for(let s of e.children)s.updateVisibility(r),n=n||s.isVisibleAndInRequestVolume;return n}executeEmptyTraversal(e,r){let n=!0,s=this._emptyTraversalStack;for(s.push(e);s.length>0;){let i=s.pop(),o=!i.hasRenderContent&&this.canTraverse(i,r,!1,!1),a=!i.hasRenderContent&&i.children.length===0;if(!o&&!i.contentAvailable&&!a&&(n=!1),this.updateTile(i,r),i.isVisibleAndInRequestVolume||(this.loadTile(i,r),this.touchTile(i,r)),o){let c=i.children;for(let u of c)s.push(u)}}return n}};var M0=new w;function UB(t){return t!=null}var Or=class{constructor(e,r,n){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"";this.tileset=void 0,this.header=void 0,this.id=void 0,this.url=void 0,this.parent=void 0,this.refine=void 0,this.type=void 0,this.contentUrl=void 0,this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=Se.UNLOADED,this.gpuMemoryUsageInBytes=0,this.children=[],this.depth=0,this.viewportIds=[],this.transform=new k,this.extensions=null,this.implicitTiling=null,this.userData={},this.computedTransform=void 0,this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.traverser=new At({}),this._cacheNode=null,this._frameNumber=null,this._expireDate=null,this._expiredContent=null,this._boundingBox=void 0,this._distanceToCamera=0,this._screenSpaceError=0,this._visibilityPlaneMask=void 0,this._visible=void 0,this._contentBoundingVolume=void 0,this._viewerRequestVolume=void 0,this._initialTransform=new k,this._priority=0,this._selectedFrame=0,this._requestedFrame=0,this._selectionDepth=0,this._touchedFrame=0,this._centerZDepth=0,this._shouldRefine=!1,this._stackLength=0,this._visitedFrame=0,this._inRequestVolume=!1,this._lodJudge=null,this.header=r,this.tileset=e,this.id=s||r.id,this.url=r.url,this.parent=n,this.refine=this._getRefine(r.refine),this.type=r.type,this.contentUrl=r.contentUrl,this._initializeLodMetric(r),this._initializeTransforms(r),this._initializeBoundingVolumes(r),this._initializeContent(r),this._initializeRenderingState(r),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===Se.READY||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===Se.UNLOADED}get contentExpired(){return this.contentState===Se.EXPIRED}get contentFailed(){return this.contentState===Se.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=A0(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(e,r){switch(this.tileset.type){case ve.I3S:return Gl(this,e);case ve.TILES3D:return T0(this,e,r);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){let e=this.tileset._traverser,{skipLevelOfDetail:r}=e.options,n=this.refine===Me.ADD||r;if(n&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===Se.UNLOADED)return-1;let s=this.parent,o=s&&(!n||this._screenSpaceError===0||s.hasTilesetContent)?s._screenSpaceError:this._screenSpaceError,a=e.root?e.root._screenSpaceError:0;return Math.max(a-o,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=Se.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=Se.UNLOADED,!1;try{let n=this.tileset.getTileUrl(this.contentUrl),s=this.tileset.loader,i={...this.tileset.loadOptions,[s.id]:{...this.tileset.loadOptions[s.id],isTileset:this.type==="json",...this._getLoaderSpecificOptions(s.id)}};return this.content=await(0,I0.load)(n,s,i),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=Se.READY,this._onContentLoaded(),!0}catch(n){throw this.contentState=Se.FAILED,n}finally{r.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=Se.UNLOADED,!0}updateVisibility(e,r){if(this._frameNumber===e.frameNumber)return;let n=this.parent,s=n?n._visibilityPlaneMask:de.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let i=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(i)}this._distanceToCamera=this.distanceToTile(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._visibilityPlaneMask=this.visibility(e,s),this._visible=this._visibilityPlaneMask!==de.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._frameNumber=e.frameNumber,this.viewportIds=r}visibility(e,r){let{cullingVolume:n}=e,{boundingVolume:s}=this;return n.computeVisibilityWithPlaneMask(s,r)}contentVisibility(){return!0}distanceToTile(e){let r=this.boundingVolume;return Math.sqrt(Math.max(r.distanceSquaredTo(e.camera.position),0))}cameraSpaceZDepth(e){let{camera:r}=e,n=this.boundingVolume;return M0.subVectors(n.center,r.position),r.direction.dot(M0)}insideViewerRequestVolume(e){let r=this._viewerRequestVolume;return!r||r.distanceSquaredTo(e.camera.position)<=0}updateExpiration(){if(UB(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let e=Date.now();Date.lessThan(this._expireDate,e)&&(this.contentState=Se.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(e){"lodMetricType"in e?this.lodMetricType=e.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in e?this.lodMetricValue=e.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(e){this.transform=e.transform?new k(e.transform):new k;let r=this.parent,n=this.tileset,s=r&&r.computedTransform?r.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new k(s).multiplyRight(this.transform);let i=r&&r._initialTransform?r._initialTransform.clone():new k;this._initialTransform=new k(i).multiplyRight(this.transform)}_initializeBoundingVolumes(e){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(e)}_initializeContent(e){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=Se.UNLOADED,this.hasTilesetContent=!1,e.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(e){this.depth=e.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=de.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(e){return e||this.parent&&this.parent.refine||Me.REPLACE}_isTileset(){return this.contentUrl.indexOf(".json")!==-1}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(e){this.boundingVolume=jo(e.boundingVolume,this.computedTransform,this.boundingVolume);let r=e.content;r&&(r.boundingVolume&&(this._contentBoundingVolume=jo(r.boundingVolume,this.computedTransform,this._contentBoundingVolume)),e.viewerRequestVolume&&(this._viewerRequestVolume=jo(e.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(){let r=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:new k).clone().multiplyRight(this.transform);r.equals(this.computedTransform)||(this.computedTransform=r,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(e){switch(e){case"i3s":return{...this.tileset.options.i3s,_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1};case"3d-tiles":case"cesium-ion":default:return C0(this.tileset.tileset)}}};var qo=class extends At{compareDistanceToCamera(e,r){return r._distanceToCamera===0&&e._distanceToCamera===0?r._centerZDepth-e._centerZDepth:r._distanceToCamera-e._distanceToCamera}updateTileVisibility(e,r){if(super.updateTileVisibility(e,r),!e.isVisibleAndInRequestVolume)return;let n=e.children.length>0;if(e.hasTilesetContent&&n){let o=e.children[0];this.updateTileVisibility(o,r),e._visible=o._visible;return}if(this.meetsScreenSpaceErrorEarly(e,r)){e._visible=!1;return}let s=e.refine===Me.REPLACE,i=e._optimChildrenWithinParent===p0.USE_OPTIMIZATION;if(s&&i&&n&&!this.anyChildrenVisible(e,r)){e._visible=!1;return}}meetsScreenSpaceErrorEarly(e,r){let{parent:n}=e;return!n||n.hasTilesetContent||n.refine!==Me.ADD?!1:!this.shouldRefine(e,r,!0)}};var O0=U(dn(),1);var Jo=class{constructor(){this.frameNumberMap=new Map}register(e,r){let n=this.frameNumberMap.get(e)||new Map,s=n.get(r)||0;n.set(r,s+1),this.frameNumberMap.set(e,n)}deregister(e,r){let n=this.frameNumberMap.get(e);if(!n)return;let s=n.get(r)||1;n.set(r,s-1)}isZero(e,r){var n;return(((n=this.frameNumberMap.get(e))===null||n===void 0?void 0:n.get(r))||0)===0}};var kl={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},Wo=class{constructor(){this._statusMap=void 0,this.pendingTilesRegister=new Jo,this._statusMap={}}add(e,r,n,s){if(!this._statusMap[r]){let{frameNumber:i,viewport:{id:o}}=s;this._statusMap[r]={request:e,callback:n,key:r,frameState:s,status:kl.REQUESTED},this.pendingTilesRegister.register(o,i),e().then(a=>{this._statusMap[r].status=kl.COMPLETED;let{frameNumber:c,viewport:{id:u}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(u,c),this._statusMap[r].callback(a,s)}).catch(a=>{this._statusMap[r].status=kl.ERROR;let{frameNumber:c,viewport:{id:u}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(u,c),n(a)})}}update(e,r){if(this._statusMap[e]){let{frameNumber:n,viewport:{id:s}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(s,n);let{frameNumber:i,viewport:{id:o}}=r;this.pendingTilesRegister.register(o,i),this._statusMap[e].frameState=r}}find(e){return this._statusMap[e]}hasPendingTiles(e,r){return!this.pendingTilesRegister.isZero(e,r)}};var Xo=class extends At{constructor(e){super(e),this._tileManager=void 0,this._tileManager=new Wo}traversalFinished(e){return!this._tileManager.hasPendingTiles(e.viewport.id,this._frameNumber||0)}shouldRefine(e,r){return e._lodJudge=B0(e,r),e._lodJudge==="DIG"}updateChildTiles(e,r){let n=e.header.children||[],s=e.children,i=e.tileset;for(let o of n){let a=`${o.id}-${r.viewport.id}`,c=s&&s.find(u=>u.id===a);if(c)c&&this.updateTile(c,r);else{let u=()=>this._loadTile(o.id,i);this._tileManager.find(a)?this._tileManager.update(a,r):(i.tileset.nodePages&&(u=()=>i.tileset.nodePagesTile.formTileFromNodePages(o.id)),this._tileManager.add(u,a,f=>this._onTileLoad(f,e,a),r))}}return!1}async _loadTile(e,r){let{loader:n}=r,s=r.getTileUrl(`${r.url}/nodes/${e}`),i={...r.loadOptions,i3s:{...r.loadOptions.i3s,isTileHeader:!0}};return await(0,O0.load)(s,n,i)}_onTileLoad(e,r,n){let s=new Or(r.tileset,e,r,n);r.children.push(s);let i=this._tileManager.find(s.id).frameState;this.updateTile(s,i),this._frameNumber===i.frameNumber&&(this.traversalFinished(i)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(s,i)}};var GB={description:"",ellipsoid:V.WGS84,modelMatrix:new k,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:t=>t,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},Ko="Tiles In Tileset(s)",Hl="Tiles In Memory",R0="Tiles In View",L0="Tiles To Render",P0="Tiles Loaded",Vl="Tiles Loading",F0="Tiles Unloaded",N0="Failed Tile Loads",D0="Points/Vertices",zl="Tile Memory Use",Ts=class{constructor(e,r){this.options=void 0,this.loadOptions=void 0,this.type=void 0,this.tileset=void 0,this.loader=void 0,this.url=void 0,this.basePath=void 0,this.modelMatrix=void 0,this.ellipsoid=void 0,this.lodMetricType=void 0,this.lodMetricValue=void 0,this.refine=void 0,this.root=null,this.roots={},this.asset={},this.description="",this.properties=void 0,this.extras=null,this.attributions={},this.credits={},this.stats=void 0,this.contentFormats={draco:!1,meshopt:!1,dds:!1,ktx2:!1},this.cartographicCenter=null,this.cartesianCenter=null,this.zoom=1,this.boundingVolume=null,this.dynamicScreenSpaceErrorComputedDensity=0,this.maximumMemoryUsage=32,this.gpuMemoryUsageInBytes=0,this._frameNumber=0,this._queryParams={},this._extensionsUsed=[],this._tiles={},this._pendingCount=0,this.selectedTiles=[],this.traverseCounter=0,this.geometricError=0,this.lastUpdatedVieports=null,this._requestedTiles=[],this._emptyTiles=[],this.frameStateData={},this._traverser=void 0,this._cache=new Ho,this._requestScheduler=void 0,this.updatePromise=null,this.tilesetInitializationPromise=void 0,this.options={...GB,...r},this.tileset=e,this.loader=e.loader,this.type=e.type,this.url=e.url,this.basePath=e.basePath||Vt.dirname(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=e.lodMetricType,this.lodMetricValue=e.lodMetricValue,this.refine=e.root.refine,this.loadOptions=this.options.loadOptions||{},this._traverser=this._initializeTraverser(),this._requestScheduler=new Ht({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.stats=new kt({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(e)}destroy(){this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(e){this.options={...this.options,...e}}getTileUrl(e){if(e.startsWith("data:"))return e;let n=e;return this.queryParams.length&&(n=`${e}${e.includes("?")?"&":"?"}${this.queryParams}`),n}hasExtension(e){return Boolean(this._extensionsUsed.indexOf(e)>-1)}update(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;this.tilesetInitializationPromise.then(()=>{!e&&this.lastUpdatedVieports?e=this.lastUpdatedVieports:this.lastUpdatedVieports=e,e&&this.doUpdate(e)})}async selectTiles(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return await this.tilesetInitializationPromise,e&&(this.lastUpdatedVieports=e),this.updatePromise||(this.updatePromise=new Promise(r=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),r(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}doUpdate(e){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let r=e instanceof Array?e:[e];this._cache.reset(),this._frameNumber++,this.traverseCounter=r.length;let n=[];for(let s of r){let i=s.id;this._needTraverse(i)?n.push(i):this.traverseCounter--}for(let s of r){let i=s.id;if(this.roots[i]||(this.roots[i]=this._initializeTileHeaders(this.tileset,null)),!n.includes(i))continue;let o=l0(s,this._frameNumber);this._traverser.traverse(this.roots[i],o,this.options)}}_needTraverse(e){let r=e;return this.options.viewportTraversersMap&&(r=this.options.viewportTraversersMap[e]),r===e}_onTraversalEnd(e){let r=e.viewport.id;this.frameStateData[r]||(this.frameStateData[r]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let n=this.frameStateData[r],s=Object.values(this._traverser.selectedTiles),[i,o]=f0(s,e,this.options.maximumTilesSelected);n.selectedTiles=i;for(let a of o)a.unselect();n._requestedTiles=Object.values(this._traverser.requestedTiles),n._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let e in this.frameStateData){let r=this.frameStateData[e];this.selectedTiles=this.selectedTiles.concat(r.selectedTiles),this._requestedTiles=this._requestedTiles.concat(r._requestedTiles),this._emptyTiles=this._emptyTiles.concat(r._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(let e of this.selectedTiles)this._tiles[e.id]=e;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(e,r){if(e.length!==r.length)return!0;let n=new Set(e.map(o=>o.id)),s=new Set(r.map(o=>o.id)),i=e.filter(o=>!s.has(o.id)).length>0;return i=i||r.filter(o=>!n.has(o.id)).length>0,i}_loadTiles(){for(let e of this._requestedTiles)e.contentUnloaded&&this._loadTile(e)}_unloadTiles(){this._cache.unloadTiles(this,(e,r)=>e._unloadTile(r))}_updateStats(){let e=0,r=0;for(let n of this.selectedTiles)n.contentAvailable&&n.content&&(e++,n.content.pointCount?r+=n.content.pointCount:r+=n.content.vertexCount);this.stats.get(R0).count=this.selectedTiles.length,this.stats.get(L0).count=e,this.stats.get(D0).count=r}async _initializeTileSet(e){this.type===ve.I3S&&(this.calculateViewPropsI3S(),e.root=await e.root),this.root=this._initializeTileHeaders(e,null),this.type===ve.TILES3D&&(this._initializeTiles3DTileset(e),this.calculateViewPropsTiles3D()),this.type===ve.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){var e;let r=this.tileset.fullExtent;if(r){let{xmin:s,xmax:i,ymin:o,ymax:a,zmin:c,zmax:u}=r;this.cartographicCenter=new w(s+(i-s)/2,o+(a-o)/2,c+(u-c)/2),this.cartesianCenter=new w,V.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=Nl(r,this.cartographicCenter,this.cartesianCenter);return}let n=(e=this.tileset.store)===null||e===void 0?void 0:e.extent;if(n){let[s,i,o,a]=n;this.cartographicCenter=new w(s+(o-s)/2,i+(a-i)/2,0),this.cartesianCenter=new w,V.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=d0(n,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new w,this.zoom=1}calculateViewPropsTiles3D(){let e=this.root,{center:r}=e.boundingVolume;if(!r){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new w,this.zoom=1;return}r[0]!==0||r[1]!==0||r[2]!==0?(this.cartographicCenter=new w,V.WGS84.cartesianToCartographic(r,this.cartographicCenter)):this.cartographicCenter=new w(0,0,-V.WGS84.radii[0]),this.cartesianCenter=r,this.zoom=h0(e.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(Ko),this.stats.get(Vl),this.stats.get(Hl),this.stats.get(R0),this.stats.get(L0),this.stats.get(P0),this.stats.get(F0),this.stats.get(N0),this.stats.get(D0),this.stats.get(zl,"memory")}_initializeTileHeaders(e,r){let n=new Or(this,e.root,r);if(r&&(r.children.push(n),n.depth=r.depth+1),this.type===ve.TILES3D){let i=[];for(i.push(n);i.length>0;){let o=i.pop();this.stats.get(Ko).incrementCount();let a=o.header.children||[];for(let c of a){var s;let u=new Or(this,c,o);if((s=u.contentUrl)!==null&&s!==void 0&&s.includes("?session=")){let f=new URL(u.contentUrl).searchParams.get("session");f&&(this._queryParams.session=f)}o.children.push(u),u.depth=o.depth+1,i.push(u)}}}return n}_initializeTraverser(){let e;switch(this.type){case ve.TILES3D:e=qo;break;case ve.I3S:e=Xo;break;default:e=At}return new e({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(e){this._destroySubtree(e)}async _loadTile(e){let r;try{this._onStartTileLoading(),r=await e.loadContent()}catch(n){this._onTileLoadError(e,n instanceof Error?n:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(e,r)}}_onTileLoadError(e,r){this.stats.get(N0).incrementCount();let n=r.message||r.toString(),s=e.url;console.error(`A 3D tile failed to load: ${e.url} ${n}`),this.options.onTileError(e,n,s)}_onTileLoad(e,r){if(r){if(this.type===ve.I3S){var n,s;let i=((n=this.tileset)===null||n===void 0||(s=n.nodePagesTile)===null||s===void 0?void 0:s.nodesInNodePages)||0;this.stats.get(Ko).reset(),this.stats.get(Ko).addCount(i)}e&&e.content&&a0(e,e.content),this.updateContentTypes(e),this._addTileToCache(e),this.options.onTileLoad(e)}}updateContentTypes(e){if(this.type===ve.I3S)switch(e.header.isDracoGeometry&&(this.contentFormats.draco=!0),e.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}else if(this.type===ve.TILES3D){var r;let{extensionsRemoved:n=[]}=((r=e.content)===null||r===void 0?void 0:r.gltf)||{};n.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),n.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),n.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(Vl).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(Vl).decrementCount()}_addTileToCache(e){this._cache.add(this,e,r=>r._updateCacheStats(e))}_updateCacheStats(e){this.stats.get(P0).incrementCount(),this.stats.get(Hl).incrementCount(),this.gpuMemoryUsageInBytes+=e.gpuMemoryUsageInBytes||0,this.stats.get(zl).count=this.gpuMemoryUsageInBytes}_unloadTile(e){this.gpuMemoryUsageInBytes-=e.gpuMemoryUsageInBytes||0,this.stats.get(Hl).decrementCount(),this.stats.get(F0).incrementCount(),this.stats.get(zl).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(e),e.unloadContent()}_destroy(){let e=[];for(this.root&&e.push(this.root);e.length>0;){let r=e.pop();for(let n of r.children)e.push(n);this._destroyTile(r)}this.root=null}_destroySubtree(e){let r=e,n=[];for(n.push(r);n.length>0;){e=n.pop();for(let s of e.children)n.push(s);e!==r&&this._destroyTile(e)}r.children=[]}_destroyTile(e){this._cache.unloadTile(this,e),this._unloadTile(e),e.destroy()}_initializeTiles3DTileset(e){if(e.queryString){let r=new URLSearchParams(e.queryString),n=Object.fromEntries(r.entries());this._queryParams={...this._queryParams,...n}}if(this.asset=e.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=e.properties,this.geometricError=e.geometricError,this._extensionsUsed=e.extensionsUsed||[],this.extras=e.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}};var Yo="4.1.0-alpha.9";var Rr={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},k9=Object.keys(Rr);function jl(t,e,r){j(t instanceof ArrayBuffer);let n=new TextDecoder("utf8"),s=new Uint8Array(t,e,r);return n.decode(s)}function U0(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=new DataView(t);return`${String.fromCharCode(r.getUint8(e+0))}${String.fromCharCode(r.getUint8(e+1))}${String.fromCharCode(r.getUint8(e+2))}${String.fromCharCode(r.getUint8(e+3))}`}var G0="4.1.0-alpha.9";var k0={name:"Draco",id:"draco",module:"draco",version:G0,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function H0(t){switch(t.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function Lr(t){let e=1/0,r=1/0,n=1/0,s=-1/0,i=-1/0,o=-1/0,a=t.POSITION?t.POSITION.value:[],c=a&&a.length;for(let u=0;u<c;u+=3){let l=a[u],f=a[u+1],h=a[u+2];e=l<e?l:e,r=f<r?f:r,n=h<n?h:n,s=l>s?l:s,i=f>i?f:i,o=h>o?h:o}return[[e,r,n],[s,i,o]]}function ql(t,e,r){let n=H0(e.value),s=r||V0(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:n}]},nullable:!1,metadata:s}}function V0(t){let e={};return"byteOffset"in t&&(e.byteOffset=t.byteOffset.toString(10)),"byteStride"in t&&(e.byteStride=t.byteStride.toString(10)),"normalized"in t&&(e.normalized=t.normalized.toString()),e}function j0(t,e,r){let n=q0(e.metadata),s=[],i=kB(e.attributes);for(let o in t){let a=t[o],c=z0(o,a,i[o]);s.push(c)}if(r){let o=z0("indices",r);s.push(o)}return{fields:s,metadata:n}}function kB(t){let e={};for(let r in t){let n=t[r];e[n.name||"undefined"]=n}return e}function z0(t,e,r){let n=r?q0(r.metadata):void 0;return ql(t,e,n)}function q0(t){Object.entries(t);let e={};for(let r in t)e[`${r}.string`]=JSON.stringify(t[r]);return e}var J0={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},HB={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},VB=4,Es=class{constructor(e){this.draco=void 0,this.decoder=void 0,this.metadataQuerier=void 0,this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=new this.draco.DecoderBuffer;n.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(r);let s=this.decoder.GetEncodedGeometryType(n),i=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(s){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(n,i);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(n,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!i.ptr){let h=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(h)}let a=this._getDracoLoaderData(i,s,r),c=this._getMeshData(i,a,r),u=Lr(c.attributes),l=j0(c.attributes,a,c.indices);return{loader:"draco",loaderData:a,header:{vertexCount:i.num_points(),boundingBox:u},...c,schema:l}}finally{this.draco.destroy(n),i&&this.draco.destroy(i)}}_getDracoLoaderData(e,r,n){let s=this._getTopLevelMetadata(e),i=this._getDracoAttributes(e,n);return{geometry_type:r,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:s,attributes:i}}_getDracoAttributes(e,r){let n={};for(let s=0;s<e.num_attributes();s++){let i=this.decoder.GetAttribute(e,s),o=this._getAttributeMetadata(e,s);n[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:s,metadata:o};let a=this._getQuantizationTransform(i,r);a&&(n[i.unique_id()].quantization_transform=a);let c=this._getOctahedronTransform(i,r);c&&(n[i.unique_id()].octahedron_transform=c)}return n}_getMeshData(e,r,n){let s=this._getMeshAttributes(r,e,n);if(!s.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(n.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:s,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:s,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:s}}_getMeshAttributes(e,r,n){let s={};for(let i of Object.values(e.attributes)){let o=this._deduceAttributeName(i,n);i.name=o;let{value:a,size:c}=this._getAttributeValues(r,i);s[o]={value:a,size:c,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}return s}_getTriangleListIndices(e){let n=e.num_faces()*3,s=n*VB,i=this.draco._malloc(s);try{return this.decoder.GetTrianglesUInt32Array(e,s,i),new Uint32Array(this.draco.HEAPF32.buffer,i,n).slice()}finally{this.draco._free(i)}}_getTriangleStripIndices(e){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,r),qB(r)}finally{this.draco.destroy(r)}}_getAttributeValues(e,r){let n=HB[r.data_type],s=r.num_components,o=e.num_points()*s,a=o*n.BYTES_PER_ELEMENT,c=zB(this.draco,n),u,l=this.draco._malloc(a);try{let f=this.decoder.GetAttribute(e,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,f,c,a,l),u=new n(this.draco.HEAPF32.buffer,l,o).slice()}finally{this.draco._free(l)}return{value:u,size:s}}_deduceAttributeName(e,r){let n=e.unique_id;for(let[o,a]of Object.entries(r.extraAttributes||{}))if(a===n)return o;let s=e.attribute_type;for(let o in J0)if(this.draco[o]===s)return J0[o];let i=r.attributeNameEntry||"name";return e.metadata[i]?e.metadata[i].string:`CUSTOM_ATTRIBUTE_${n}`}_getTopLevelMetadata(e){let r=this.decoder.GetMetadata(e);return this._getDracoMetadata(r)}_getAttributeMetadata(e,r){let n=this.decoder.GetAttributeMetadata(e,r);return this._getDracoMetadata(n)}_getDracoMetadata(e){if(!e||!e.ptr)return{};let r={},n=this.metadataQuerier.NumEntries(e);for(let s=0;s<n;s++){let i=this.metadataQuerier.GetEntryName(e,s);r[i]=this._getDracoMetadataField(e,i)}return r}_getDracoMetadataField(e,r){let n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,r,n);let s=jB(n);return{int:this.metadataQuerier.GetIntEntry(e,r),string:this.metadataQuerier.GetStringEntry(e,r),double:this.metadataQuerier.GetDoubleEntry(e,r),intArray:s}}finally{this.draco.destroy(n)}}_disableAttributeTransforms(e){let{quantizedAttributes:r=[],octahedronAttributes:n=[]}=e,s=[...r,...n];for(let i of s)this.decoder.SkipAttributeTransform(this.draco[i])}_getQuantizationTransform(e,r){let{quantizedAttributes:n=[]}=r,s=e.attribute_type();if(n.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(e))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:new Float32Array([1,2,3]).map(a=>o.min_value(a))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(e,r){let{octahedronAttributes:n=[]}=r,s=e.attribute_type();if(n.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(e))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function zB(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32;default:return t.DT_INVALID}}function jB(t){let e=t.size(),r=new Int32Array(e);for(let n=0;n<e;n++)r[n]=t.GetValue(n);return r}function qB(t){let e=t.size(),r=new Int32Array(e);for(let n=0;n<e;n++)r[n]=t.GetValue(n);return r}var JB="1.5.6",WB="1.4.1",Jl=`https://www.gstatic.com/draco/versioned/decoders/${JB}`,Ie={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},Wl={[Ie.DECODER]:`${Jl}/${Ie.DECODER}`,[Ie.DECODER_WASM]:`${Jl}/${Ie.DECODER_WASM}`,[Ie.FALLBACK_DECODER]:`${Jl}/${Ie.FALLBACK_DECODER}`,[Ie.ENCODER]:`https://raw.githubusercontent.com/google/draco/${WB}/javascript/${Ie.ENCODER}`},ws;async function W0(t){let e=t.modules||{};return e.draco3d?ws=ws||e.draco3d.createDecoderModule({}).then(r=>({draco:r})):ws=ws||XB(t),await ws}async function XB(t){let e,r;switch(t.draco&&t.draco.decoderType){case"js":e=await lt(Wl[Ie.FALLBACK_DECODER],"draco",t,Ie.FALLBACK_DECODER);break;case"wasm":default:[e,r]=await Promise.all([await lt(Wl[Ie.DECODER],"draco",t,Ie.DECODER),await lt(Wl[Ie.DECODER_WASM],"draco",t,Ie.DECODER_WASM)])}return e=e||globalThis.DracoDecoderModule,await KB(e,r)}function KB(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(n=>{t({...r,onModuleLoaded:s=>n({draco:s})})})}var Zo={...k0,parse:YB};async function YB(t,e){let{draco:r}=await W0(e),n=new Es(r);try{return n.parseSync(t,e?.draco)}finally{n.destroy()}}var ZB={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},fe={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},H={...ZB,...fe};var Xl={[fe.DOUBLE]:Float64Array,[fe.FLOAT]:Float32Array,[fe.UNSIGNED_SHORT]:Uint16Array,[fe.UNSIGNED_INT]:Uint32Array,[fe.UNSIGNED_BYTE]:Uint8Array,[fe.BYTE]:Int8Array,[fe.SHORT]:Int16Array,[fe.INT]:Int32Array},QB={DOUBLE:fe.DOUBLE,FLOAT:fe.FLOAT,UNSIGNED_SHORT:fe.UNSIGNED_SHORT,UNSIGNED_INT:fe.UNSIGNED_INT,UNSIGNED_BYTE:fe.UNSIGNED_BYTE,BYTE:fe.BYTE,SHORT:fe.SHORT,INT:fe.INT},Kl="Failed to convert GL type",be=class{static fromTypedArray(e){e=ArrayBuffer.isView(e)?e.constructor:e;for(let r in Xl)if(Xl[r]===e)return r;throw new Error(Kl)}static fromName(e){let r=QB[e];if(!r)throw new Error(Kl);return r}static getArrayType(e){switch(e){case fe.UNSIGNED_SHORT_5_6_5:case fe.UNSIGNED_SHORT_4_4_4_4:case fe.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let r=Xl[e];if(!r)throw new Error(Kl);return r}}static getByteSize(e){return be.getArrayType(e).BYTES_PER_ELEMENT}static validate(e){return Boolean(be.getArrayType(e))}static createTypedArray(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;s===void 0&&(s=(r.byteLength-n)/be.getByteSize(e));let i=be.getArrayType(e);return new i(r,n,s)}};function X0(t,e){if(!t)throw new Error(`math.gl assertion failed. ${e}`)}function Yl(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0],r=t>>11&31,n=t>>5&63,s=t&31;return e[0]=r<<3,e[1]=n<<2,e[2]=s<<3,e}var vH=1/256;var xH=new vr,bH=new w,TH=new vr,EH=new vr,wH=new Uint8Array(1);function K0(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:255;return oi(t,0,e)/e*2-1}function Y0(t){return t<0?-1:1}function Z0(t,e,r,n){if(X0(n),t<0||t>r||e<0||e>r)throw new Error(`x and y must be unsigned normalized integers between 0 and ${r}`);if(n.x=K0(t,r),n.y=K0(e,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){let s=n.x;n.x=(1-Math.abs(n.y))*Y0(s),n.y=(1-Math.abs(s))*Y0(n.y)}return n.normalize()}function Zl(t,e,r){return Z0(t,e,255,r)}var Pt=class{constructor(e,r){this.json=void 0,this.buffer=void 0,this.featuresLength=0,this._cachedTypedArrays={},this.json=e,this.buffer=r}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return Boolean(this.json[e])}getGlobalProperty(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:H.UNSIGNED_INT,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,s=this.json[e];return s&&Number.isFinite(s.byteOffset)?this._getTypedArrayFromBinary(e,r,n,1,s.byteOffset):s}getPropertyArray(e,r,n){let s=this.json[e];return s&&Number.isFinite(s.byteOffset)?("componentType"in s&&(r=be.fromName(s.componentType)),this._getTypedArrayFromBinary(e,r,n,this.featuresLength,s.byteOffset)):this._getTypedArrayFromArray(e,r,s)}getProperty(e,r,n,s,i){let o=this.json[e];if(!o)return o;let a=this.getPropertyArray(e,r,n);if(n===1)return a[s];for(let c=0;c<n;++c)i[c]=a[n*s+c];return i}_getTypedArrayFromBinary(e,r,n,s,i){let o=this._cachedTypedArrays,a=o[e];return a||(a=be.createTypedArray(r,this.buffer.buffer,this.buffer.byteOffset+i,s*n),o[e]=a),a}_getTypedArrayFromArray(e,r,n){let s=this._cachedTypedArrays,i=s[e];return i||(i=be.createTypedArray(r,n),s[e]=i),i}};var $B={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},eC={SCALAR:(t,e)=>t[e],VEC2:(t,e)=>[t[2*e+0],t[2*e+1]],VEC3:(t,e)=>[t[3*e+0],t[3*e+1],t[3*e+2]],VEC4:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT2:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT3:(t,e)=>[t[9*e+0],t[9*e+1],t[9*e+2],t[9*e+3],t[9*e+4],t[9*e+5],t[9*e+6],t[9*e+7],t[9*e+8]],MAT4:(t,e)=>[t[16*e+0],t[16*e+1],t[16*e+2],t[16*e+3],t[16*e+4],t[16*e+5],t[16*e+6],t[16*e+7],t[16*e+8],t[16*e+9],t[16*e+10],t[16*e+11],t[16*e+12],t[16*e+13],t[16*e+14],t[16*e+15]]},tC={SCALAR:(t,e,r)=>{e[r]=t},VEC2:(t,e,r)=>{e[2*r+0]=t[0],e[2*r+1]=t[1]},VEC3:(t,e,r)=>{e[3*r+0]=t[0],e[3*r+1]=t[1],e[3*r+2]=t[2]},VEC4:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT2:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT3:(t,e,r)=>{e[9*r+0]=t[0],e[9*r+1]=t[1],e[9*r+2]=t[2],e[9*r+3]=t[3],e[9*r+4]=t[4],e[9*r+5]=t[5],e[9*r+6]=t[6],e[9*r+7]=t[7],e[9*r+8]=t[8],e[9*r+9]=t[9]},MAT4:(t,e,r)=>{e[16*r+0]=t[0],e[16*r+1]=t[1],e[16*r+2]=t[2],e[16*r+3]=t[3],e[16*r+4]=t[4],e[16*r+5]=t[5],e[16*r+6]=t[6],e[16*r+7]=t[7],e[16*r+8]=t[8],e[16*r+9]=t[9],e[16*r+10]=t[10],e[16*r+11]=t[11],e[16*r+12]=t[12],e[16*r+13]=t[13],e[16*r+14]=t[14],e[16*r+15]=t[15]}};function Q0(t,e,r,n){let{componentType:s}=t;j(t.componentType);let i=typeof s=="string"?be.fromName(s):s,o=$B[t.type],a=eC[t.type],c=tC[t.type];return r+=t.byteOffset,{values:be.createTypedArray(i,e,r,o*n),type:i,size:o,unpacker:a,packer:c}}var vt=t=>t!==void 0;function $0(t,e,r){if(!e)return null;let n=t.getExtension("3DTILES_batch_table_hierarchy"),s=e.HIERARCHY;return s&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),e.extensions=e.extensions||{},e.extensions["3DTILES_batch_table_hierarchy"]=s,n=s),n?rC(n,r):null}function rC(t,e){let r,n,s,i=t.instancesLength,o=t.classes,a=t.classIds,c=t.parentCounts,u=t.parentIds,l=i;vt(a.byteOffset)&&(a.componentType=defaultValue(a.componentType,GL.UNSIGNED_SHORT),a.type=AttributeType.SCALAR,s=getBinaryAccessor(a),a=s.createArrayBufferView(e.buffer,e.byteOffset+a.byteOffset,i));let f;if(vt(c))for(vt(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,s=getBinaryAccessor(c),c=s.createArrayBufferView(e.buffer,e.byteOffset+c.byteOffset,i)),f=new Uint16Array(i),l=0,r=0;r<i;++r)f[r]=l,l+=c[r];vt(u)&&vt(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,GL.UNSIGNED_SHORT),u.type=AttributeType.SCALAR,s=getBinaryAccessor(u),u=s.createArrayBufferView(e.buffer,e.byteOffset+u.byteOffset,l));let h=o.length;for(r=0;r<h;++r){let m=o[r].length,A=o[r].instances,v=getBinaryProperties(m,A,e);o[r].instances=combine(v,A)}let d=new Array(h).fill(0),p=new Uint16Array(i);for(r=0;r<i;++r)n=a[r],p[r]=d[n],++d[n];let g={classes:o,classIds:a,classIndexes:p,parentCounts:c,parentIndexes:f,parentIds:u};return iC(g),g}function gn(t,e,r){if(!t)return;let n=t.parentCounts;return t.parentIds?r(t,e):n>0?nC(t,e,r):sC(t,e,r)}function nC(t,e,r){let n=t.classIds,s=t.parentCounts,i=t.parentIds,o=t.parentIndexes,a=n.length,c=scratchVisited;c.length=Math.max(c.length,a);let u=++marker,l=scratchStack;for(l.length=0,l.push(e);l.length>0;){if(e=l.pop(),c[e]===u)continue;c[e]=u;let f=r(t,e);if(vt(f))return f;let h=s[e],d=o[e];for(let p=0;p<h;++p){let g=i[d+p];g!==e&&l.push(g)}}return null}function sC(t,e,r){let n=!0;for(;n;){let s=r(t,e);if(vt(s))return s;let i=t.parentIds[e];n=i!==e,e=i}throw new Error("traverseHierarchySingleParent")}function iC(t){let e=[],n=t.classIds.length;for(let s=0;s<n;++s)ey(t,s,stack)}function ey(t,e,r){let n=t.parentCounts,s=t.parentIds,i=t.parentIndexes,a=t.classIds.length;if(!vt(s))return;assert(e<a,`Parent index ${e} exceeds the total number of instances: ${a}`),assert(r.indexOf(e)===-1,"Circular dependency detected in the batch table hierarchy."),r.push(e);let c=vt(n)?n[e]:1,u=vt(n)?i[e]:e;for(let l=0;l<c;++l){let f=s[u+l];f!==e&&ey(t,f,r)}r.pop(e)}function Oe(t){return t!=null}var Qo=(t,e)=>t,oC={HIERARCHY:!0,extensions:!0,extras:!0},Pr=class{constructor(e,r,n){var s;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};this.json=void 0,this.binary=void 0,this.featureCount=void 0,this._extensions=void 0,this._properties=void 0,this._binaryProperties=void 0,this._hierarchy=void 0,j(n>=0),this.json=e||{},this.binary=r,this.featureCount=n,this._extensions=((s=this.json)===null||s===void 0?void 0:s.extensions)||{},this._properties={};for(let o in this.json)oC[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),i["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=$0(this,this.json,this.binary))}getExtension(e){return this.json&&this.json.extensions&&this.json.extensions[e]}memorySizeInBytes(){return 0}isClass(e,r){if(this._checkBatchId(e),j(typeof r=="string",r),this._hierarchy){let n=gn(this._hierarchy,e,(s,i)=>{let o=s.classIds[i];return s.classes[o].name===r});return Oe(n)}return!1}isExactClass(e,r){return j(typeof r=="string",r),this.getExactClassName(e)===r}getExactClassName(e){if(this._checkBatchId(e),this._hierarchy){let r=this._hierarchy.classIds[e];return this._hierarchy.classes[r].name}}hasProperty(e,r){return this._checkBatchId(e),j(typeof r=="string",r),Oe(this._properties[r])||this._hasPropertyInHierarchy(e,r)}getPropertyNames(e,r){this._checkBatchId(e),r=Oe(r)?r:[],r.length=0;let n=Object.keys(this._properties);return r.push(...n),this._hierarchy&&this._getPropertyNamesInHierarchy(e,r),r}getProperty(e,r){if(this._checkBatchId(e),j(typeof r=="string",r),this._binaryProperties){let s=this._binaryProperties[r];if(Oe(s))return this._getBinaryProperty(s,e)}let n=this._properties[r];if(Oe(n))return Qo(n[e],!0);if(this._hierarchy){let s=this._getHierarchyProperty(e,r);if(Oe(s))return s}}setProperty(e,r,n){let s=this.featureCount;if(this._checkBatchId(e),j(typeof r=="string",r),this._binaryProperties){let o=this._binaryProperties[r];if(o){this._setBinaryProperty(o,e,n);return}}if(this._hierarchy&&this._setHierarchyProperty(this,e,r,n))return;let i=this._properties[r];Oe(i)||(this._properties[r]=new Array(s),i=this._properties[r]),i[e]=Qo(n,!0)}_checkBatchId(e){if(!(e>=0&&e<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(e,r){return e.unpack(e.typedArray,r)}_setBinaryProperty(e,r,n){e.pack(n,e.typedArray,r)}_initializeBinaryProperties(){let e=null;for(let r in this._properties){let n=this._properties[r],s=this._initializeBinaryProperty(r,n);s&&(e=e||{},e[r]=s)}return e}_initializeBinaryProperty(e,r){if("byteOffset"in r){let n=r;j(this.binary,`Property ${e} requires a batch table binary.`),j(n.type,`Property ${e} requires a type.`);let s=Q0(n,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:s.values,componentCount:s.size,unpack:s.unpacker,pack:s.packer}}return null}_hasPropertyInHierarchy(e,r){if(!this._hierarchy)return!1;let n=gn(this._hierarchy,e,(s,i)=>{let o=s.classIds[i],a=s.classes[o].instances;return Oe(a[r])});return Oe(n)}_getPropertyNamesInHierarchy(e,r){gn(this._hierarchy,e,(n,s)=>{let i=n.classIds[s],o=n.classes[i].instances;for(let a in o)o.hasOwnProperty(a)&&r.indexOf(a)===-1&&r.push(a)})}_getHierarchyProperty(e,r){return gn(this._hierarchy,e,(n,s)=>{let i=n.classIds[s],o=n.classes[i],a=n.classIndexes[s],c=o.instances[r];return Oe(c)?Oe(c.typedArray)?this._getBinaryProperty(c,a):Qo(c[a],!0):null})}_setHierarchyProperty(e,r,n,s){let i=gn(this._hierarchy,r,(o,a)=>{let c=o.classIds[a],u=o.classes[c],l=o.classIndexes[a],f=u.instances[n];return Oe(f)?(j(a===r,`Inherited property "${n}" is read-only.`),Oe(f.typedArray)?this._setBinaryProperty(f,l,s):f[l]=Qo(s,!0),!0):!1});return Oe(i)}};function ar(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=new DataView(e);if(t.magic=n.getUint32(r,!0),r+=4,t.version=n.getUint32(r,!0),r+=4,t.byteLength=n.getUint32(r,!0),r+=4,t.version!==1)throw new Error(`3D Tile Version ${t.version} not supported`);return r}var yn=4,ty="b3dm tile in legacy format.";function _n(t,e,r){let n=new DataView(e),s;t.header=t.header||{};let i=n.getUint32(r,!0);r+=yn;let o=n.getUint32(r,!0);r+=yn;let a=n.getUint32(r,!0);r+=yn;let c=n.getUint32(r,!0);return r+=yn,a>=570425344?(r-=yn*2,s=i,a=o,c=0,i=0,o=0,console.warn(ty)):c>=570425344&&(r-=yn,s=a,a=i,c=o,i=0,o=0,console.warn(ty)),t.header.featureTableJsonByteLength=i,t.header.featureTableBinaryByteLength=o,t.header.batchTableJsonByteLength=a,t.header.batchTableBinaryByteLength=c,t.header.batchLength=s,r}function An(t,e,r,n){return r=aC(t,e,r,n),r=cC(t,e,r,n),r}function aC(t,e,r,n){let{featureTableJsonByteLength:s,featureTableBinaryByteLength:i,batchLength:o}=t.header||{};if(t.featureTableJson={BATCH_LENGTH:o||0},s&&s>0){let a=jl(e,r,s);t.featureTableJson=JSON.parse(a)}return r+=s||0,t.featureTableBinary=new Uint8Array(e,r,i),r+=i||0,r}function cC(t,e,r,n){let{batchTableJsonByteLength:s,batchTableBinaryByteLength:i}=t.header||{};if(s&&s>0){let o=jl(e,r,s);t.batchTableJson=JSON.parse(o),r+=s,i&&i>0&&(t.batchTableBinary=new Uint8Array(e,r,i),t.batchTableBinary=new Uint8Array(t.batchTableBinary),r+=i)}return r}function Ql(t,e,r){if(!e&&(!t||!t.batchIds||!r))return null;let{batchIds:n,isRGB565:s,pointCount:i=0}=t;if(n&&r){let o=new Uint8ClampedArray(i*3);for(let a=0;a<i;a++){let c=n[a],l=r.getProperty(c,"dimensions").map(f=>f*255);o[a*3]=l[0],o[a*3+1]=l[1],o[a*3+2]=l[2]}return{type:H.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}if(e&&s){let o=new Uint8ClampedArray(i*3);for(let a=0;a<i;a++){let c=Yl(e[a]);o[a*3]=c[0],o[a*3+1]=c[1],o[a*3+2]=c[2]}return{type:H.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}return e&&e.length===i*3?{type:H.UNSIGNED_BYTE,value:e,size:3,normalized:!0}:{type:H.UNSIGNED_BYTE,value:e||new Uint8ClampedArray,size:4,normalized:!0}}var ry=new w;function ny(t,e){if(!e)return null;if(t.isOctEncoded16P){let r=new Float32Array((t.pointsLength||0)*3);for(let n=0;n<(t.pointsLength||0);n++)Zl(e[n*2],e[n*2+1],ry),ry.toArray(r,n*3);return{type:H.FLOAT,size:2,value:r}}return{type:H.FLOAT,size:2,value:e}}function sy(t,e,r){return t.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(t.isQuantized=!1,uC(t,e)):{type:H.UNSIGNED_SHORT,value:e,size:3,normalized:!0}:e}function uC(t,e){let r=new w,n=new Float32Array(t.pointCount*3);for(let s=0;s<t.pointCount;s++)r.set(e[s*3],e[s*3+1],e[s*3+2]).scale(1/t.quantizedRange).multiply(t.quantizedVolumeScale).add(t.quantizedVolumeOffset).toArray(n,s*3);return n}async function iy(t,e,r,n,s){r=ar(t,e,r),r=_n(t,e,r),r=An(t,e,r,n),lC(t);let{featureTable:i,batchTable:o}=fC(t);return await gC(t,i,o,n,s),hC(t,i,n),dC(t,i,o),pC(t,i),r}function lC(t){t.attributes={positions:null,colors:null,normals:null,batchIds:null},t.isQuantized=!1,t.isTranslucent=!1,t.isRGB565=!1,t.isOctEncoded16P=!1}function fC(t){let e=new Pt(t.featureTableJson,t.featureTableBinary),r=e.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(r))throw new Error("POINTS_LENGTH must be defined");e.featuresLength=r,t.featuresLength=r,t.pointsLength=r,t.pointCount=r,t.rtcCenter=e.getGlobalProperty("RTC_CENTER",H.FLOAT,3);let n=mC(t,e);return{featureTable:e,batchTable:n}}function hC(t,e,r){if(t.attributes=t.attributes||{positions:null,colors:null,normals:null,batchIds:null},!t.attributes.positions){if(e.hasProperty("POSITION"))t.attributes.positions=e.getPropertyArray("POSITION",H.FLOAT,3);else if(e.hasProperty("POSITION_QUANTIZED")){let n=e.getPropertyArray("POSITION_QUANTIZED",H.UNSIGNED_SHORT,3);if(t.isQuantized=!0,t.quantizedRange=(1<<16)-1,t.quantizedVolumeScale=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",H.FLOAT,3),!t.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(t.quantizedVolumeOffset=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",H.FLOAT,3),!t.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");t.attributes.positions=sy(t,n,r)}}if(!t.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function dC(t,e,r){if(t.attributes=t.attributes||{positions:null,colors:null,normals:null,batchIds:null},!t.attributes.colors){let n=null;e.hasProperty("RGBA")?(n=e.getPropertyArray("RGBA",H.UNSIGNED_BYTE,4),t.isTranslucent=!0):e.hasProperty("RGB")?n=e.getPropertyArray("RGB",H.UNSIGNED_BYTE,3):e.hasProperty("RGB565")&&(n=e.getPropertyArray("RGB565",H.UNSIGNED_SHORT,1),t.isRGB565=!0),t.attributes.colors=Ql(t,n,r)}e.hasProperty("CONSTANT_RGBA")&&(t.constantRGBA=e.getGlobalProperty("CONSTANT_RGBA",H.UNSIGNED_BYTE,4))}function pC(t,e){if(t.attributes=t.attributes||{positions:null,colors:null,normals:null,batchIds:null},!t.attributes.normals){let r=null;e.hasProperty("NORMAL")?r=e.getPropertyArray("NORMAL",H.FLOAT,3):e.hasProperty("NORMAL_OCT16P")&&(r=e.getPropertyArray("NORMAL_OCT16P",H.UNSIGNED_BYTE,2),t.isOctEncoded16P=!0),t.attributes.normals=ny(t,r)}}function mC(t,e){let r=null;if(!t.batchIds&&e.hasProperty("BATCH_ID")&&(t.batchIds=e.getPropertyArray("BATCH_ID",H.UNSIGNED_SHORT,1),t.batchIds)){let n=e.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:s,batchTableBinary:i}=t;r=new Pr(s,i,n)}return r}async function gC(t,e,r,n,s){let i,o,a,c=t.batchTableJson&&t.batchTableJson.extensions&&t.batchTableJson.extensions["3DTILES_draco_point_compression"];c&&(a=c.properties);let u=e.getExtension("3DTILES_draco_point_compression");if(u){o=u.properties;let f=u.byteOffset,h=u.byteLength;if(!o||!Number.isFinite(f)||!h)throw new Error("Draco properties, byteOffset, and byteLength must be defined");i=(t.featureTableBinary||[]).slice(f,f+h),t.hasPositions=Number.isFinite(o.POSITION),t.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),t.hasNormals=Number.isFinite(o.NORMAL),t.hasBatchIds=Number.isFinite(o.BATCH_ID),t.isTranslucent=Number.isFinite(o.RGBA)}if(!i)return!0;let l={buffer:i,properties:{...o,...a},featureTableProperties:o,batchTableProperties:a,dequantizeInShader:!1};return await yC(t,l,n,s)}async function yC(t,e,r,n){if(!n)return;let s={...r,draco:{...r?.draco,extraAttributes:e.batchTableProperties||{}}};delete s["3d-tiles"];let i=await Le(e.buffer,Zo,s,n),o=i.attributes.POSITION&&i.attributes.POSITION.value,a=i.attributes.COLOR_0&&i.attributes.COLOR_0.value,c=i.attributes.NORMAL&&i.attributes.NORMAL.value,u=i.attributes.BATCH_ID&&i.attributes.BATCH_ID.value,l=o&&i.attributes.POSITION.value.quantization,f=c&&i.attributes.NORMAL.value.quantization;if(l){let d=i.POSITION.data.quantization,p=d.range;t.quantizedVolumeScale=new w(p,p,p),t.quantizedVolumeOffset=new w(d.minValues),t.quantizedRange=(1<<d.quantizationBits)-1,t.isQuantizedDraco=!0}f&&(t.octEncodedRange=(1<<i.NORMAL.data.quantization.quantizationBits)-1,t.isOctEncodedDraco=!0);let h={};if(e.batchTableProperties)for(let d of Object.keys(e.batchTableProperties))i.attributes[d]&&i.attributes[d].value&&(h[d.toLowerCase()]=i.attributes[d].value);t.attributes={positions:o,colors:Ql(t,a,void 0),normals:c,batchIds:u,...h}}var $l={};Ae($l,{decode:()=>MC,name:()=>CC});function pe(t,e){if(!t)throw new Error(e||"assert failed: gltf")}var $o={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ea={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var _C=1.33,oy=["SCALAR","VEC2","VEC3","VEC4"],AC=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],vC=new Map(AC),xC={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},bC={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},TC={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function ta(t){return oy[t-1]||oy[0]}function vn(t){let e=vC.get(t.constructor);if(!e)throw new Error("Illegal typed array");return e}function xn(t,e){let r=TC[t.componentType],n=xC[t.type],s=bC[t.componentType],i=t.count*n,o=t.count*n*s;pe(o>=0&&o<=e.byteLength);let a=ea[t.componentType],c=$o[t.type];return{ArrayType:r,length:i,byteLength:o,componentByteSize:a,numberOfComponentsInElement:c}}function Ss(t){let{images:e,bufferViews:r}=t;e=e||[],r=r||[];let n=e.map(o=>o.bufferView);r=r.filter(o=>!n.includes(o));let s=r.reduce((o,a)=>o+a.byteLength,0),i=e.reduce((o,a)=>{let{width:c,height:u}=a.image;return o+c*u},0);return s+Math.ceil(4*i*_C)}function ay(t,e,r){let n=t.bufferViews[r];pe(n);let s=n.buffer,i=e[s];pe(i);let o=(n.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,o,n.byteLength)}function cy(t,e,r){var n,s;let i=typeof r=="number"?(n=t.accessors)===null||n===void 0?void 0:n[r]:r;if(!i)throw new Error(`No gltf accessor ${JSON.stringify(r)}`);let o=(s=t.bufferViews)===null||s===void 0?void 0:s[i.bufferView||0];if(!o)throw new Error(`No gltf buffer view for accessor ${o}`);let{arrayBuffer:a,byteOffset:c}=e[o.buffer],u=(c||0)+(i.byteOffset||0)+(o.byteOffset||0),{ArrayType:l,length:f,componentByteSize:h,numberOfComponentsInElement:d}=xn(i,o),p=h*d,g=o.byteStride||p;if(typeof o.byteStride>"u"||o.byteStride===p)return new l(a,u,f);let m=new l(f);for(let A=0;A<i.count;A++){let v=new l(a,u+A*g,d);m.set(v,A*d)}return m}function EC(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var Y=class{constructor(e){this.gltf=void 0,this.sourceBuffers=void 0,this.byteLength=void 0,this.gltf={json:e?.json||EC(),buffers:e?.buffers||[],images:e?.images||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}hasExtension(e){let r=this.getUsedExtensions().find(s=>s===e),n=this.getRequiredExtensions().find(s=>s===e);return typeof r=="string"||typeof n=="string"}getExtension(e){let r=this.getUsedExtensions().find(s=>s===e),n=this.json.extensions||{};return r?n[e]:null}getRequiredExtension(e){return this.getRequiredExtensions().find(n=>n===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(e,r){return(e.extensions||{})[r]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,r){if(typeof r=="object")return r;let n=this.json[e]&&this.json[e][r];if(!n)throw new Error(`glTF file error: Could not find ${e}[${r}]`);return n}getTypedArrayForBufferView(e){e=this.getBufferView(e);let r=e.buffer,n=this.gltf.buffers[r];pe(n);let s=(e.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,s,e.byteLength)}getTypedArrayForAccessor(e){let r=this.getAccessor(e);return cy(this.gltf.json,this.gltf.buffers,r)}getTypedArrayForImageData(e){e=this.getAccessor(e);let r=this.getBufferView(e.bufferView),s=this.getBuffer(r.buffer).data,i=r.byteOffset||0;return new Uint8Array(s,i,r.byteLength)}addApplicationData(e,r){return this.json[e]=r,this}addExtraData(e,r){return this.json.extras=this.json.extras||{},this.json.extras[e]=r,this}addObjectExtension(e,r,n){return e.extensions=e.extensions||{},e.extensions[r]=n,this.registerUsedExtension(r),this}setObjectExtension(e,r,n){let s=e.extensions||{};s[r]=n}removeObjectExtension(e,r){let n=e?.extensions||{};if(n[r]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(r)||s.push(r)}delete n[r]}addExtension(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return pe(r),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=r,this.registerUsedExtension(e),r}addRequiredExtension(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return pe(r),this.addExtension(e,r),this.registerRequiredExtension(e),r}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(r=>r===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(r=>r===e)||this.json.extensionsRequired.push(e)}removeExtension(e){var r;if((r=this.json.extensions)!==null&&r!==void 0&&r[e]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let n=this.json.extensionsRemoved;n.includes(e)||n.push(e)}this.json.extensions&&delete this.json.extensions[e],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e)}setDefaultScene(e){this.json.scene=e}addScene(e){let{nodeIndices:r}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:r}),this.json.scenes.length-1}addNode(e){let{meshIndex:r,matrix:n}=e;this.json.nodes=this.json.nodes||[];let s={mesh:r};return n&&(s.matrix=n),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(e){let{attributes:r,indices:n,material:s,mode:i=4}=e,a={primitives:[{attributes:this._addAttributes(r),mode:i}]};if(n){let c=this._addIndices(n);a.primitives[0].indices=c}return Number.isFinite(s)&&(a.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(e){let n={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(n),this.json.meshes.length-1}addImage(e,r){let n=Ar(e),s=r||n?.mimeType,o={bufferView:this.addBufferView(e),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.byteLength,s=e.byteLength;pe(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);let i={buffer:r,byteOffset:n,byteLength:s};return this.byteLength+=Gt(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(e,r){let n={bufferView:e,type:ta(r.size),componentType:r.componentType,count:r.count,max:r.max,min:r.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{size:3},n=this.addBufferView(e),s={min:r.min,max:r.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(e,r.size));let i={size:r.size,componentType:vn(e),count:Math.round(e.length/r.size),min:s.min,max:s.max};return this.addAccessor(n,Object.assign(i,r))}addTexture(e){let{imageIndex:r}=e,n={source:r};return this.json.textures=this.json.textures||[],this.json.textures.push(n),this.json.textures.length-1}addMaterial(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}createBinaryChunk(){var e,r;this.gltf.buffers=[];let n=this.byteLength,s=new ArrayBuffer(n),i=new Uint8Array(s),o=0;for(let a of this.sourceBuffers||[])o=oc(a,i,o);(e=this.json)!==null&&e!==void 0&&(r=e.buffers)!==null&&r!==void 0&&r[0]?this.json.buffers[0].byteLength=n:this.json.buffers=[{byteLength:n}],this.gltf.binary=s,this.sourceBuffers=[s]}_removeStringFromArray(e,r){let n=!0;for(;n;){let s=e.indexOf(r);s>-1?e.splice(s,1):n=!1}}_addAttributes(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={};for(let n in e){let s=e[n],i=this._getGltfAttributeName(n),o=this.addBinaryBuffer(s.value,s);r[i]=o}return r}_addIndices(e){return this.addBinaryBuffer(e,{size:1})}_getGltfAttributeName(e){switch(e.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return e}}_getAccessorMinMax(e,r){let n={min:null,max:null};if(e.length<r)return n;n.min=[],n.max=[];let s=e.subarray(0,r);for(let i of s)n.min.push(i),n.max.push(i);for(let i=r;i<e.length;i+=r)for(let o=0;o<r;o++)n.min[0+o]=Math.min(n.min[0+o],e[i+o]),n.max[0+o]=Math.max(n.max[0+o],e[i+o]);return n}};function uy(t){return(t%1+1)%1}var ly={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},wC={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},fy={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function Bs(t,e){return fy[e]*ly[t]}function bn(t,e,r,n){if(r!=="UINT8"&&r!=="UINT16"&&r!=="UINT32"&&r!=="UINT64")return null;let s=t.getTypedArrayForBufferView(e),i=Tn(s,"SCALAR",r,n+1);return i instanceof BigInt64Array||i instanceof BigUint64Array?null:i}function Tn(t,e,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,s=ly[e],i=wC[r],o=fy[r],a=n*s,c=a*o,u=t.buffer,l=t.byteOffset;return l%o!==0&&(u=new Uint8Array(u).slice(l,l+c).buffer,l=0),new i(u,l,a)}function En(t,e,r){var n,s;let i=`TEXCOORD_${e.texCoord||0}`,o=r.attributes[i],a=t.getTypedArrayForAccessor(o),c=t.gltf.json,u=e.index,l=(n=c.textures)===null||n===void 0||(s=n[u])===null||s===void 0?void 0:s.source;if(typeof l<"u"){var f,h,d;let p=(f=c.images)===null||f===void 0||(h=f[l])===null||h===void 0?void 0:h.mimeType,g=(d=t.gltf.images)===null||d===void 0?void 0:d[l];if(g&&typeof g.width<"u"){let m=[];for(let A=0;A<a.length;A+=2){let v=SC(g,p,a,A,e.channels);m.push(v)}return m}}return[]}function ra(t,e,r,n,s){if(!(r!=null&&r.length))return;let i=[];for(let l of r){let f=n.findIndex(h=>h===l);f===-1&&(f=n.push(l)-1),i.push(f)}let o=new Uint32Array(i),a=t.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,c=t.addBufferView(o,a,0),u=t.addAccessor(c,{size:1,componentType:vn(o),count:o.length});s.attributes[e]=u}function SC(t,e,r,n){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[0],i={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=r[n],a=r[n+1],c=1;e&&(e.indexOf("image/jpeg")!==-1||e.indexOf("image/png")!==-1)&&(c=4);let u=BC(o,a,t,c),l=0;for(let f of s){let h=typeof f=="number"?Object.values(i)[f]:i[f],d=u+h.offset,p=Wn(t);if(p.data.length<=d)throw new Error(`${p.data.length} <= ${d}`);let g=p.data[d];l|=g<<h.shift}return l}function BC(t,e,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,s=r.width,i=uy(t)*(s-1),o=Math.round(i),a=r.height,c=uy(e)*(a-1),u=Math.round(c),l=r.components?r.components:n;return(u*s+o)*l}function na(t,e,r,n,s){let i=[];for(let o=0;o<e;o++){let a=r[o],c=r[o+1]-r[o];if(c+a>n)break;let u=a/s,l=c/s;i.push(t.slice(u,u+l))}return i}function sa(t,e,r){let n=[];for(let s=0;s<e;s++){let i=s*r;n.push(t.slice(i,i+r))}return n}function ia(t,e,r,n){if(r)throw new Error("Not implemented - arrayOffsets for strings is specified");if(n){let s=[],i=new TextDecoder("utf8"),o=0;for(let a=0;a<t;a++){let c=n[a+1]-n[a];if(c+o<=e.length){let u=e.subarray(o,c+o),l=i.decode(u);s.push(l),o+=c}}return s}return[]}var hy="EXT_mesh_features",CC=hy;async function MC(t,e){let r=new Y(t);IC(r,e)}function IC(t,e){let r=t.gltf.json;if(r.meshes)for(let n of r.meshes)for(let s of n.primitives)OC(t,s,e)}function OC(t,e,r){var n,s;if(!(r!=null&&(n=r.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let i=(s=e.extensions)===null||s===void 0?void 0:s[hy],o=i?.featureIds;if(o)for(let c of o){var a;let u;if(typeof c.attribute<"u"){let l=`_FEATURE_ID_${c.attribute}`,f=e.attributes[l];u=t.getTypedArrayForAccessor(f)}else typeof c.texture<"u"&&r!==null&&r!==void 0&&(a=r.gltf)!==null&&a!==void 0&&a.loadImages?u=En(t,c.texture,e):u=[];c.data=u}}var rf={};Ae(rf,{decode:()=>LC,name:()=>RC});var ef="EXT_structural_metadata",RC=ef;async function LC(t,e){let r=new Y(t);PC(r,e)}function PC(t,e){var r,n;if(!((r=e.gltf)!==null&&r!==void 0&&r.loadBuffers))return;let s=t.getExtension(ef);s&&((n=e.gltf)!==null&&n!==void 0&&n.loadImages&&FC(t,s),NC(t,s))}function FC(t,e){let r=e.propertyTextures,n=t.gltf.json;if(r&&n.meshes)for(let s of n.meshes)for(let i of s.primitives)UC(t,r,i,e)}function NC(t,e){let r=e.schema;if(!r)return;let n=r.classes,s=e.propertyTables;if(n&&s)for(let i in n){let o=DC(s,i);o&&kC(t,r,o)}}function DC(t,e){for(let r of t)if(r.class===e)return r;return null}function UC(t,e,r,n){var s;if(!e)return;let i=(s=r.extensions)===null||s===void 0?void 0:s[ef],o=i?.propertyTextures;if(o)for(let a of o){let c=e[a];GC(t,c,r,n)}}function GC(t,e,r,n){if(!e.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);let s=e.class;for(let o in e.properties){var i;let a=`${s}_${o}`,c=(i=e.properties)===null||i===void 0?void 0:i[o];if(!c)continue;c.data||(c.data=[]);let u=c.data,l=En(t,c,r);l!==null&&(ra(t,a,l,u,r),c.data=u,n.dataAttributeNames.push(a))}}function kC(t,e,r){var n;let s=(n=e.classes)===null||n===void 0?void 0:n[r.class];if(!s)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let i=r.count;for(let a in s.properties){var o;let c=s.properties[a],u=(o=r.properties)===null||o===void 0?void 0:o[a];if(u){let l=HC(t,e,c,i,u);u.data=l}}}function HC(t,e,r,n,s){let i=[],o=s.values,a=t.getTypedArrayForBufferView(o),c=VC(t,r,s,n),u=zC(t,s,n);switch(r.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{i=jC(r,n,a,c);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${r.type}`);case"STRING":{i=ia(n,a,c,u);break}case"ENUM":{i=qC(e,r,n,a,c);break}default:throw new Error(`Unknown classProperty type ${r.type}`)}return i}function VC(t,e,r,n){return e.array&&typeof e.count>"u"&&typeof r.arrayOffsets<"u"?bn(t,r.arrayOffsets,r.arrayOffsetType||"UINT32",n):null}function zC(t,e,r){return typeof e.stringOffsets<"u"?bn(t,e.stringOffsets,e.stringOffsetType||"UINT32",r):null}function jC(t,e,r,n){let s=t.array,i=t.count,o=Bs(t.type,t.componentType),a=r.byteLength/o,c;return t.componentType?c=Tn(r,t.type,t.componentType,a):c=r,s?n?na(c,e,n,r.length,o):i?sa(c,e,i):[]:c}function qC(t,e,r,n,s){var i;let o=e.enumType;if(!o)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let a=(i=t.enums)===null||i===void 0?void 0:i[o];if(!a)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`);let c=a.valueType||"UINT16",u=Bs(e.type,c),l=n.byteLength/u,f=Tn(n,e.type,c,l);if(f||(f=n),e.array){if(s)return JC({valuesData:f,numberOfElements:r,arrayOffsets:s,valuesDataBytesLength:n.length,elementSize:u,enumEntry:a});let h=e.count;return h?WC(f,r,h,a):[]}return tf(f,0,r,a)}function JC(t){let{valuesData:e,numberOfElements:r,arrayOffsets:n,valuesDataBytesLength:s,elementSize:i,enumEntry:o}=t,a=[];for(let c=0;c<r;c++){let u=n[c],l=n[c+1]-n[c];if(l+u>s)break;let f=u/i,h=l/i,d=tf(e,f,h,o);a.push(d)}return a}function WC(t,e,r,n){let s=[];for(let i=0;i<e;i++){let o=r*i,a=tf(t,o,r,n);s.push(a)}return s}function tf(t,e,r,n){let s=[];for(let i=0;i<r;i++)if(t instanceof BigInt64Array||t instanceof BigUint64Array)s.push("");else{let o=t[e+i],a=XC(n,o);a?s.push(a.name):s.push("")}return s}function XC(t,e){for(let r of t.values)if(r.value===e)return r;return null}var nf={};Ae(nf,{decode:()=>YC,name:()=>KC});var dy="EXT_feature_metadata",KC=dy;async function YC(t,e){let r=new Y(t);ZC(r,e)}function ZC(t,e){var r,n;if(!((r=e.gltf)!==null&&r!==void 0&&r.loadBuffers))return;let s=t.getExtension(dy);s&&((n=e.gltf)!==null&&n!==void 0&&n.loadImages&&QC(t,s),$C(t,s))}function QC(t,e){let r=e.schema;if(!r)return;let n=r.classes,{featureTextures:s}=e;if(n&&s)for(let i in n){let o=n[i],a=tM(s,i);a&&nM(t,a,o)}}function $C(t,e){let r=e.schema;if(!r)return;let n=r.classes,s=e.featureTables;if(n&&s)for(let i in n){let o=eM(s,i);o&&rM(t,r,o)}}function eM(t,e){for(let r in t){let n=t[r];if(n.class===e)return n}return null}function tM(t,e){for(let r in t){let n=t[r];if(n.class===e)return n}return null}function rM(t,e,r){var n;if(!r.class)return;let s=(n=e.classes)===null||n===void 0?void 0:n[r.class];if(!s)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let i=r.count;for(let a in s.properties){var o;let c=s.properties[a],u=(o=r.properties)===null||o===void 0?void 0:o[a];if(u){let l=sM(t,e,c,i,u);u.data=l}}}function nM(t,e,r){let n=e.class;for(let i in r.properties){var s;let o=e==null||(s=e.properties)===null||s===void 0?void 0:s[i];if(o){let a=uM(t,o,n);o.data=a}}}function sM(t,e,r,n,s){let i=[],o=s.bufferView,a=t.getTypedArrayForBufferView(o),c=iM(t,r,s,n),u=oM(t,r,s,n);return r.type==="STRING"||r.componentType==="STRING"?i=ia(n,a,c,u):aM(r)&&(i=cM(r,n,a,c)),i}function iM(t,e,r,n){return e.type==="ARRAY"&&typeof e.componentCount>"u"&&typeof r.arrayOffsetBufferView<"u"?bn(t,r.arrayOffsetBufferView,r.offsetType||"UINT32",n):null}function oM(t,e,r,n){return typeof r.stringOffsetBufferView<"u"?bn(t,r.stringOffsetBufferView,r.offsetType||"UINT32",n):null}function aM(t){let e=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return e.includes(t.type)||typeof t.componentType<"u"&&e.includes(t.componentType)}function cM(t,e,r,n){let s=t.type==="ARRAY",i=t.componentCount,o="SCALAR",a=t.componentType||t.type,c=Bs(o,a),u=r.byteLength/c,l=Tn(r,o,a,u);return s?n?na(l,e,n,r.length,c):i?sa(l,e,i):[]:l}function uM(t,e,r){let n=t.gltf.json;if(!n.meshes)return[];let s=[];for(let i of n.meshes)for(let o of i.primitives)lM(t,r,e,s,o);return s}function lM(t,e,r,n,s){let i={channels:r.channels,...r.texture},o=En(t,i,s);o&&ra(t,e,o,n,s)}var py="4.1.0-alpha.9";var wn=!0,my=1735152710,af=12,oa=8,fM=1313821514,hM=5130562,dM=0,pM=0,mM=1;function gM(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return`${String.fromCharCode(t.getUint8(e+0))}${String.fromCharCode(t.getUint8(e+1))}${String.fromCharCode(t.getUint8(e+2))}${String.fromCharCode(t.getUint8(e+3))}`}function gy(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=new DataView(t),{magic:s=my}=r,i=n.getUint32(e,!1);return i===s||i===my}function yy(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},s=new DataView(e),i=gM(s,r+0),o=s.getUint32(r+4,wn),a=s.getUint32(r+8,wn);switch(Object.assign(t,{header:{byteOffset:r,byteLength:a,hasBinChunk:!1},type:i,version:o,json:{},binChunks:[]}),r+=af,t.version){case 1:return yM(t,s,r);case 2:return _M(t,s,r,n={});default:throw new Error(`Invalid GLB version ${t.version}. Only supports version 1 and 2.`)}}function yM(t,e,r){j(t.header.byteLength>af+oa);let n=e.getUint32(r+0,wn),s=e.getUint32(r+4,wn);return r+=oa,j(s===dM),sf(t,e,r,n),r+=n,r+=of(t,e,r,t.header.byteLength),r}function _M(t,e,r,n){return j(t.header.byteLength>af+oa),AM(t,e,r,n),r+t.header.byteLength}function AM(t,e,r,n){for(;r+8<=t.header.byteLength;){let s=e.getUint32(r+0,wn),i=e.getUint32(r+4,wn);switch(r+=oa,i){case fM:sf(t,e,r,s);break;case hM:of(t,e,r,s);break;case pM:n.strict||sf(t,e,r,s);break;case mM:n.strict||of(t,e,r,s);break;default:break}r+=Gt(s,4)}return r}function sf(t,e,r,n){let s=new Uint8Array(e.buffer,r,n),o=new TextDecoder("utf8").decode(s);return t.json=JSON.parse(o),Gt(n,4)}function of(t,e,r,n){return t.header.hasBinChunk=!0,t.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:e.buffer}),Gt(n,4)}function cf(t,e){if(t.startsWith("data:")||t.startsWith("http:")||t.startsWith("https:"))return t;let n=e.baseUri||e.uri;if(!n)throw new Error(`'baseUri' must be provided to resolve relative url ${t}`);return n.substr(0,n.lastIndexOf("/")+1)+t}var lf={};Ae(lf,{decode:()=>OM,name:()=>IM});var vM="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",xM="B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",bM=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),TM=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),EM={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},wM={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function _y(t,e,r,n,s){let i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"NONE",o=await SM();MM(o,o.exports[wM[s]],t,e,r,n,o.exports[EM[i||"NONE"]])}var uf;async function SM(){return uf||(uf=BM()),uf}async function BM(){let t=vM;WebAssembly.validate(bM)&&(t=xM,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let e=await WebAssembly.instantiate(CM(t),{});return await e.instance.exports.__wasm_call_ctors(),e.instance}function CM(t){let e=new Uint8Array(t.length);for(let n=0;n<t.length;++n){let s=t.charCodeAt(n);e[n]=s>96?s-71:s>64?s-65:s>47?s+4:s>46?63:62}let r=0;for(let n=0;n<t.length;++n)e[r++]=e[n]<60?TM[e[n]]:(e[n]-60)*64+e[++n];return e.buffer.slice(0,r)}function MM(t,e,r,n,s,i,o){let a=t.exports.sbrk,c=n+3&-4,u=a(c*s),l=a(i.length),f=new Uint8Array(t.exports.memory.buffer);f.set(i,l);let h=e(u,n,s,l,i.length);if(h===0&&o&&o(u,c,s),r.set(f.subarray(u,u+n*s)),a(u-a(0)),h!==0)throw new Error(`Malformed buffer data: ${h}`)}var aa="EXT_meshopt_compression",IM=aa;async function OM(t,e){var r,n;let s=new Y(t);if(!(e!=null&&(r=e.gltf)!==null&&r!==void 0&&r.decompressMeshes)||!((n=e.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let i=[];for(let o of t.json.bufferViews||[])i.push(RM(s,o));await Promise.all(i),s.removeExtension(aa)}async function RM(t,e){let r=t.getObjectExtension(e,aa);if(r){let{byteOffset:n=0,byteLength:s=0,byteStride:i,count:o,mode:a,filter:c="NONE",buffer:u}=r,l=t.gltf.buffers[u],f=new Uint8Array(l.arrayBuffer,l.byteOffset+n,s),h=new Uint8Array(t.gltf.buffers[e.buffer].arrayBuffer,e.byteOffset,e.byteLength);await _y(h,o,i,f,a,c),t.removeObjectExtension(e,aa)}}var ff={};Ae(ff,{name:()=>LM,preprocess:()=>PM});var Sn="EXT_texture_webp",LM=Sn;function PM(t,e){let r=new Y(t);if(!_c("image/webp")){if(r.getRequiredExtensions().includes(Sn))throw new Error(`gltf: Required extension ${Sn} not supported by browser`);return}let{json:n}=r;for(let s of n.textures||[]){let i=r.getObjectExtension(s,Sn);i&&(s.source=i.source),r.removeObjectExtension(s,Sn)}r.removeExtension(Sn)}var hf={};Ae(hf,{name:()=>FM,preprocess:()=>NM});var ca="KHR_texture_basisu",FM=ca;function NM(t,e){let r=new Y(t),{json:n}=r;for(let s of n.textures||[]){let i=r.getObjectExtension(s,ca);i&&(s.source=i.source,r.removeObjectExtension(s,ca))}r.removeExtension(ca)}var pf={};Ae(pf,{decode:()=>HM,encode:()=>VM,name:()=>GM,preprocess:()=>kM});function Ay(t){let e={};for(let r in t){let n=t[r];if(r!=="indices"){let s=df(n);e[r]=s}}return e}function df(t){let{buffer:e,size:r,count:n}=DM(t);return{value:e,size:r,byteOffset:0,count:n,type:ta(r),componentType:vn(e)}}function DM(t){let e=t,r=1,n=0;return t&&t.value&&(e=t.value,r=t.size||1),e&&(ArrayBuffer.isView(e)||(e=UM(e,Float32Array)),n=e.length/r),{buffer:e,size:r,count:n}}function UM(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?Array.isArray(t)?new e(t):r&&!(t instanceof e)?new e(t):t:null}var cr="KHR_draco_mesh_compression",GM=cr;function kM(t,e,r){let n=new Y(t);for(let s of vy(n))n.getObjectExtension(s,cr)}async function HM(t,e,r){var n;if(!(e!=null&&(n=e.gltf)!==null&&n!==void 0&&n.decompressMeshes))return;let s=new Y(t),i=[];for(let o of vy(s))s.getObjectExtension(o,cr)&&i.push(zM(s,o,e,r));await Promise.all(i),s.removeExtension(cr)}function VM(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=new Y(t);for(let n of r.json.meshes||[])jM(n,e),r.addRequiredExtension(cr)}async function zM(t,e,r,n){let s=t.getObjectExtension(e,cr);if(!s)return;let i=t.getTypedArrayForBufferView(s.bufferView),o=pr(i.buffer,i.byteOffset),a={...r};delete a["3d-tiles"];let c=await Le(o,Zo,a,n),u=Ay(c.attributes);for(let[l,f]of Object.entries(u))if(l in e.attributes){let h=e.attributes[l],d=t.getAccessor(h);d!=null&&d.min&&d!==null&&d!==void 0&&d.max&&(f.min=d.min,f.max=d.max)}e.attributes=u,c.indices&&(e.indices=df(c.indices)),t.removeObjectExtension(e,cr),qM(e)}function jM(t,e){var r;let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:4,s=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(!s.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let o=s.DracoWriter.encodeSync({attributes:t}),a=i==null||(r=i.parseSync)===null||r===void 0?void 0:r.call(i,{attributes:t}),c=s._addFauxAttributes(a.attributes),u=s.addBufferView(o);return{primitives:[{attributes:c,mode:n,extensions:{[cr]:{bufferView:u,attributes:c}}}]}}function qM(t){if(!t.attributes&&Object.keys(t.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*vy(t){for(let e of t.json.meshes||[])for(let r of e.primitives)yield r}var gf={};Ae(gf,{decode:()=>KM,name:()=>JM});var mf="KHR_texture_transform",JM=mf,ua=new w,WM=new W,XM=new W;async function KM(t,e){var r;if(!new Y(t).hasExtension(mf)||!((r=e.gltf)!==null&&r!==void 0&&r.loadBuffers))return;let i=t.json.materials||[];for(let o=0;o<i.length;o++)YM(o,t)}function YM(t,e){var r,n,s;let i=[],o=(r=e.json.materials)===null||r===void 0?void 0:r[t],a=o==null||(n=o.pbrMetallicRoughness)===null||n===void 0?void 0:n.baseColorTexture;a&&Cs(e,t,a,i);let c=o?.emissiveTexture;c&&Cs(e,t,c,i);let u=o?.normalTexture;u&&Cs(e,t,u,i);let l=o?.occlusionTexture;l&&Cs(e,t,l,i);let f=o==null||(s=o.pbrMetallicRoughness)===null||s===void 0?void 0:s.metallicRoughnessTexture;f&&Cs(e,t,f,i)}function Cs(t,e,r,n){let s=ZM(r,n);if(!s)return;let i=t.json.meshes||[];for(let o of i)for(let a of o.primitives){let c=a.material;Number.isFinite(c)&&e===c&&QM(t,a,s)}}function ZM(t,e){var r;let n=(r=t.extensions)===null||r===void 0?void 0:r[mf],{texCoord:s=0}=t,{texCoord:i=s}=n;if(!(e.findIndex(a=>{let[c,u]=a;return c===s&&u===i})!==-1)){let a=tI(n);return s!==i&&(t.texCoord=i),e.push([s,i]),{originalTexCoord:s,texCoord:i,matrix:a}}return null}function QM(t,e,r){let{originalTexCoord:n,texCoord:s,matrix:i}=r,o=e.attributes[`TEXCOORD_${n}`];if(Number.isFinite(o)){var a;let u=(a=t.json.accessors)===null||a===void 0?void 0:a[o];if(u&&u.bufferView){var c;let l=(c=t.json.bufferViews)===null||c===void 0?void 0:c[u.bufferView];if(l){let{arrayBuffer:f,byteOffset:h}=t.buffers[l.buffer],d=(h||0)+(u.byteOffset||0)+(l.byteOffset||0),{ArrayType:p,length:g}=xn(u,l),m=ea[u.componentType],A=$o[u.type],v=l.byteStride||m*A,x=new Float32Array(g);for(let b=0;b<u.count;b++){let M=new p(f,d+b*v,2);ua.set(M[0],M[1],1),ua.transformByMatrix3(i),x.set([ua[0],ua[1]],b*A)}n===s?$M(u,l,t.buffers,x):eI(s,u,e,t,x)}}}}function $M(t,e,r,n){t.componentType=5126,r.push({arrayBuffer:n.buffer,byteOffset:0,byteLength:n.buffer.byteLength}),e.buffer=r.length-1,e.byteLength=n.buffer.byteLength,e.byteOffset=0,delete e.byteStride}function eI(t,e,r,n,s){n.buffers.push({arrayBuffer:s.buffer,byteOffset:0,byteLength:s.buffer.byteLength});let i=n.json.bufferViews;if(!i)return;i.push({buffer:n.buffers.length-1,byteLength:s.buffer.byteLength,byteOffset:0});let o=n.json.accessors;o&&(o.push({bufferView:i?.length-1,byteOffset:0,componentType:5126,count:e.count,type:"VEC2"}),r.attributes[`TEXCOORD_${t}`]=o.length-1)}function tI(t){let{offset:e=[0,0],rotation:r=0,scale:n=[1,1]}=t,s=new W().set(1,0,0,0,1,0,e[0],e[1],1),i=WM.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),o=XM.set(n[0],0,0,0,n[1],0,0,0,1);return s.multiplyRight(i).multiplyRight(o)}var yf={};Ae(yf,{decode:()=>nI,encode:()=>sI,name:()=>rI});var Fr="KHR_lights_punctual",rI=Fr;async function nI(t){let e=new Y(t),{json:r}=e,n=e.getExtension(Fr);n&&(e.json.lights=n.lights,e.removeExtension(Fr));for(let s of r.nodes||[]){let i=e.getObjectExtension(s,Fr);i&&(s.light=i.light),e.removeObjectExtension(s,Fr)}}async function sI(t){let e=new Y(t),{json:r}=e;if(r.lights){let n=e.addExtension(Fr);pe(!n.lights),n.lights=r.lights,delete r.lights}if(e.json.lights){for(let n of e.json.lights){let s=n.node;e.addObjectExtension(s,Fr,n)}delete e.json.lights}}var _f={};Ae(_f,{decode:()=>oI,encode:()=>aI,name:()=>iI});var Ms="KHR_materials_unlit",iI=Ms;async function oI(t){let e=new Y(t),{json:r}=e;for(let n of r.materials||[])n.extensions&&n.extensions.KHR_materials_unlit&&(n.unlit=!0),e.removeObjectExtension(n,Ms);e.removeExtension(Ms)}function aI(t){let e=new Y(t),{json:r}=e;if(e.materials)for(let n of r.materials||[])n.unlit&&(delete n.unlit,e.addObjectExtension(n,Ms,{}),e.addExtension(Ms))}var Af={};Ae(Af,{decode:()=>uI,encode:()=>lI,name:()=>cI});var Is="KHR_techniques_webgl",cI=Is;async function uI(t){let e=new Y(t),{json:r}=e,n=e.getExtension(Is);if(n){let s=fI(n,e);for(let i of r.materials||[]){let o=e.getObjectExtension(i,Is);o&&(i.technique=Object.assign({},o,s[o.technique]),i.technique.values=hI(i.technique,e)),e.removeObjectExtension(i,Is)}e.removeExtension(Is)}}async function lI(t,e){}function fI(t,e){let{programs:r=[],shaders:n=[],techniques:s=[]}=t,i=new TextDecoder;return n.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=i.decode(e.getTypedArrayForBufferView(o.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),r.forEach(o=>{o.fragmentShader=n[o.fragmentShader],o.vertexShader=n[o.vertexShader]}),s.forEach(o=>{o.program=r[o.program]}),s}function hI(t,e){let r=Object.assign({},t.values);return Object.keys(t.uniforms||{}).forEach(n=>{t.uniforms[n].value&&!(n in r)&&(r[n]=t.uniforms[n].value)}),Object.keys(r).forEach(n=>{typeof r[n]=="object"&&r[n].index!==void 0&&(r[n].texture=e.getTexture(r[n].index))}),r}var xy=[rf,$l,lf,ff,hf,pf,yf,_f,Af,gf,nf];function by(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=xy.filter(i=>Ey(i.name,e));for(let i of n){var s;(s=i.preprocess)===null||s===void 0||s.call(i,t,e,r)}}async function Ty(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=xy.filter(i=>Ey(i.name,e));for(let i of n){var s;await((s=i.decode)===null||s===void 0?void 0:s.call(i,t,e,r))}}function Ey(t,e){var r;let n=(e==null||(r=e.gltf)===null||r===void 0?void 0:r.excludeExtensions)||{};return!(t in n&&!n[t])}var vf="KHR_binary_glTF";function wy(t){let e=new Y(t),{json:r}=e;for(let n of r.images||[]){let s=e.getObjectExtension(n,vf);s&&Object.assign(n,s),e.removeObjectExtension(n,vf)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,e.removeExtension(vf)}var Sy={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},pI={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},xf=class{constructor(){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}},this.json=void 0}normalize(e,r){this.json=e.json;let n=e.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${n.asset.version}`);return}if(!r.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(n),this._convertTopLevelObjectsToArrays(n),wy(e),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_addAsset(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(e){for(let r in Sy)this._convertTopLevelObjectToArray(e,r)}_convertTopLevelObjectToArray(e,r){let n=e[r];if(!(!n||Array.isArray(n))){e[r]=[];for(let s in n){let i=n[s];i.id=i.id||s;let o=e[r].length;e[r].push(i),this.idToIndexMap[r][s]=o}}}_convertObjectIdsToArrayIndices(e){for(let r in Sy)this._convertIdsToIndices(e,r);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(let r of e.textures)this._convertTextureIds(r);for(let r of e.meshes)this._convertMeshIds(r);for(let r of e.nodes)this._convertNodeIds(r);for(let r of e.scenes)this._convertSceneIds(r)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(let r of e.primitives){let{attributes:n,indices:s,material:i}=r;for(let o in n)n[o]=this._convertIdToIndex(n[o],"accessor");s&&(r.indices=this._convertIdToIndex(s,"accessor")),i&&(r.material=this._convertIdToIndex(i,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map(r=>this._convertIdToIndex(r,"node"))),e.meshes&&(e.meshes=e.meshes.map(r=>this._convertIdToIndex(r,"mesh")))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map(r=>this._convertIdToIndex(r,"node")))}_convertIdsToIndices(e,r){e[r]||(console.warn(`gltf v1: json doesn't contain attribute ${r}`),e[r]=[]);for(let n of e[r])for(let s in n){let i=n[s],o=this._convertIdToIndex(i,s);n[s]=o}}_convertIdToIndex(e,r){let n=pI[r];if(n in this.idToIndexMap){let s=this.idToIndexMap[n][e];if(!Number.isFinite(s))throw new Error(`gltf v1: failed to resolve ${r} with id ${e}`);return s}return e}_updateObjects(e){for(let r of this.json.buffers)delete r.type}_updateMaterial(e){for(let i of e.materials){var r,n,s;i.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let o=((r=i.values)===null||r===void 0?void 0:r.tex)||((n=i.values)===null||n===void 0?void 0:n.texture2d_0)||((s=i.values)===null||s===void 0?void 0:s.diffuseTex),a=e.textures.findIndex(c=>c.id===o);a!==-1&&(i.pbrMetallicRoughness.baseColorTexture={index:a})}}};function By(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new xf().normalize(t,e)}async function Cy(t,e){var r,n,s;let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return mI(t,e,i,o),By(t,{normalize:o==null||(r=o.gltf)===null||r===void 0?void 0:r.normalize}),by(t,o,a),o!=null&&(n=o.gltf)!==null&&n!==void 0&&n.loadBuffers&&t.json.buffers&&await gI(t,o,a),o!=null&&(s=o.gltf)!==null&&s!==void 0&&s.loadImages&&await yI(t,o,a),await Ty(t,o,a),t}function mI(t,e,r,n){if(n.uri&&(t.baseUri=n.uri),e instanceof ArrayBuffer&&!gy(e,r,n)&&(e=new TextDecoder().decode(e)),typeof e=="string")t.json=ic(e);else if(e instanceof ArrayBuffer){let o={};r=yy(o,e,r,n.glb),pe(o.type==="glTF",`Invalid GLB magic string ${o.type}`),t._glb=o,t.json=o.json}else pe(!1,"GLTF: must be ArrayBuffer or string");let s=t.json.buffers||[];if(t.buffers=new Array(s.length).fill(null),t._glb&&t._glb.header.hasBinChunk){let{binChunks:o}=t._glb;t.buffers[0]={arrayBuffer:o[0].arrayBuffer,byteOffset:o[0].byteOffset,byteLength:o[0].byteLength}}let i=t.json.images||[];t.images=new Array(i.length).fill({})}async function gI(t,e,r){let n=t.json.buffers||[];for(let o=0;o<n.length;++o){let a=n[o];if(a.uri){var s,i;let{fetch:c}=r;pe(c);let u=cf(a.uri,e),l=await(r==null||(s=r.fetch)===null||s===void 0?void 0:s.call(r,u)),f=await(l==null||(i=l.arrayBuffer)===null||i===void 0?void 0:i.call(l));t.buffers[o]={arrayBuffer:f,byteOffset:0,byteLength:f.byteLength},delete a.uri}else t.buffers[o]===null&&(t.buffers[o]={arrayBuffer:new ArrayBuffer(a.byteLength),byteOffset:0,byteLength:a.byteLength})}}async function yI(t,e,r){let n=_I(t),s=t.json.images||[],i=[];for(let o of n)i.push(AI(t,s[o],o,e,r));return await Promise.all(i)}function _I(t){let e=new Set,r=t.json.textures||[];for(let n of r)n.source!==void 0&&e.add(n.source);return Array.from(e).sort()}async function AI(t,e,r,n,s){let i;if(e.uri&&!e.hasOwnProperty("bufferView")){let a=cf(e.uri,n),{fetch:c}=s;i=await(await c(a)).arrayBuffer(),e.bufferView={data:i}}if(Number.isFinite(e.bufferView)){let a=ay(t.json,t.buffers,e.bufferView);i=pr(a.buffer,a.byteOffset,a.byteLength)}pe(i,"glTF image has no data");let o=await Le(i,[zt,Cl],{...n,mimeType:e.mimeType,basis:n.basis||{format:Ro()}},s);o&&o[0]&&(o={compressed:!0,mipmaps:!1,width:o[0].width,height:o[0].height,data:o[0]}),t.images=t.images||[],t.images[r]=o}var Nr={name:"glTF",id:"gltf",module:"gltf",version:py,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:vI,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function vI(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;e={...Nr.options,...e},e.gltf={...Nr.options.gltf,...e.gltf};let{byteOffset:n=0}=e;return await Cy({},t,n,e,r)}var xI={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},bI={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},qe={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},TI={magFilter:qe.TEXTURE_MAG_FILTER,minFilter:qe.TEXTURE_MIN_FILTER,wrapS:qe.TEXTURE_WRAP_S,wrapT:qe.TEXTURE_WRAP_T},EI={[qe.TEXTURE_MAG_FILTER]:qe.LINEAR,[qe.TEXTURE_MIN_FILTER]:qe.NEAREST_MIPMAP_LINEAR,[qe.TEXTURE_WRAP_S]:qe.REPEAT,[qe.TEXTURE_WRAP_T]:qe.REPEAT};function wI(){return{id:"default-sampler",parameters:EI}}function SI(t){return bI[t]}function BI(t){return xI[t]}var bf=class{constructor(){this.baseUri="",this.jsonUnprocessed=void 0,this.json=void 0,this.buffers=[],this.images=[]}postProcess(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{json:n,buffers:s=[],images:i=[]}=e,{baseUri:o=""}=e;return pe(n),this.baseUri=o,this.buffers=s,this.images=i,this.jsonUnprocessed=n,this.json=this._resolveTree(e.json,r),this.json}_resolveTree(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n={...e};return this.json=n,e.bufferViews&&(n.bufferViews=e.bufferViews.map((s,i)=>this._resolveBufferView(s,i))),e.images&&(n.images=e.images.map((s,i)=>this._resolveImage(s,i))),e.samplers&&(n.samplers=e.samplers.map((s,i)=>this._resolveSampler(s,i))),e.textures&&(n.textures=e.textures.map((s,i)=>this._resolveTexture(s,i))),e.accessors&&(n.accessors=e.accessors.map((s,i)=>this._resolveAccessor(s,i))),e.materials&&(n.materials=e.materials.map((s,i)=>this._resolveMaterial(s,i))),e.meshes&&(n.meshes=e.meshes.map((s,i)=>this._resolveMesh(s,i))),e.nodes&&(n.nodes=e.nodes.map((s,i)=>this._resolveNode(s,i)),n.nodes=n.nodes.map((s,i)=>this._resolveNodeChildren(s))),e.skins&&(n.skins=e.skins.map((s,i)=>this._resolveSkin(s,i))),e.scenes&&(n.scenes=e.scenes.map((s,i)=>this._resolveScene(s,i))),typeof this.json.scene=="number"&&n.scenes&&(n.scene=n.scenes[this.json.scene]),n}getScene(e){return this._get(this.json.scenes,e)}getNode(e){return this._get(this.json.nodes,e)}getSkin(e){return this._get(this.json.skins,e)}getMesh(e){return this._get(this.json.meshes,e)}getMaterial(e){return this._get(this.json.materials,e)}getAccessor(e){return this._get(this.json.accessors,e)}getCamera(e){return this._get(this.json.cameras,e)}getTexture(e){return this._get(this.json.textures,e)}getSampler(e){return this._get(this.json.samplers,e)}getImage(e){return this._get(this.json.images,e)}getBufferView(e){return this._get(this.json.bufferViews,e)}getBuffer(e){return this._get(this.json.buffers,e)}_get(e,r){if(typeof r=="object")return r;let n=e&&e[r];return n||console.warn(`glTF file error: Could not find ${e}[${r}]`),n}_resolveScene(e,r){return{...e,id:e.id||`scene-${r}`,nodes:(e.nodes||[]).map(n=>this.getNode(n))}}_resolveNode(e,r){let n={...e,id:e?.id||`node-${r}`};return e.mesh!==void 0&&(n.mesh=this.getMesh(e.mesh)),e.camera!==void 0&&(n.camera=this.getCamera(e.camera)),e.skin!==void 0&&(n.skin=this.getSkin(e.skin)),e.meshes!==void 0&&e.meshes.length&&(n.mesh=e.meshes.reduce((s,i)=>{let o=this.getMesh(i);return s.id=o.id,s.primitives=s.primitives.concat(o.primitives),s},{primitives:[]})),n}_resolveNodeChildren(e){return e.children&&(e.children=e.children.map(r=>this.getNode(r))),e}_resolveSkin(e,r){let n=typeof e.inverseBindMatrices=="number"?this.getAccessor(e.inverseBindMatrices):void 0;return{...e,id:e.id||`skin-${r}`,inverseBindMatrices:n}}_resolveMesh(e,r){let n={...e,id:e.id||`mesh-${r}`,primitives:[]};return e.primitives&&(n.primitives=e.primitives.map(s=>{let i={...s,attributes:{},indices:void 0,material:void 0},o=s.attributes;for(let a in o)i.attributes[a]=this.getAccessor(o[a]);return s.indices!==void 0&&(i.indices=this.getAccessor(s.indices)),s.material!==void 0&&(i.material=this.getMaterial(s.material)),i})),n}_resolveMaterial(e,r){let n={...e,id:e.id||`material-${r}`};if(n.normalTexture&&(n.normalTexture={...n.normalTexture},n.normalTexture.texture=this.getTexture(n.normalTexture.index)),n.occlusionTexture&&(n.occlusionTexture={...n.occlusionTexture},n.occlusionTexture.texture=this.getTexture(n.occlusionTexture.index)),n.emissiveTexture&&(n.emissiveTexture={...n.emissiveTexture},n.emissiveTexture.texture=this.getTexture(n.emissiveTexture.index)),n.emissiveFactor||(n.emissiveFactor=n.emissiveTexture?[1,1,1]:[0,0,0]),n.pbrMetallicRoughness){n.pbrMetallicRoughness={...n.pbrMetallicRoughness};let s=n.pbrMetallicRoughness;s.baseColorTexture&&(s.baseColorTexture={...s.baseColorTexture},s.baseColorTexture.texture=this.getTexture(s.baseColorTexture.index)),s.metallicRoughnessTexture&&(s.metallicRoughnessTexture={...s.metallicRoughnessTexture},s.metallicRoughnessTexture.texture=this.getTexture(s.metallicRoughnessTexture.index))}return n}_resolveAccessor(e,r){let n=SI(e.componentType),s=BI(e.type),i=n*s,o={...e,id:e.id||`accessor-${r}`,bytesPerComponent:n,components:s,bytesPerElement:i,value:void 0,bufferView:void 0,sparse:void 0};if(e.bufferView!==void 0&&(o.bufferView=this.getBufferView(e.bufferView)),o.bufferView){let a=o.bufferView.buffer,{ArrayType:c,byteLength:u}=xn(o,o.bufferView),l=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+a.byteOffset,f=a.arrayBuffer.slice(l,l+u);o.bufferView.byteStride&&(f=this._getValueFromInterleavedBuffer(a,l,o.bufferView.byteStride,o.bytesPerElement,o.count)),o.value=new c(f)}return o}_getValueFromInterleavedBuffer(e,r,n,s,i){let o=new Uint8Array(i*s);for(let a=0;a<i;a++){let c=r+a*n;o.set(new Uint8Array(e.arrayBuffer.slice(c,c+s)),a*s)}return o.buffer}_resolveTexture(e,r){return{...e,id:e.id||`texture-${r}`,sampler:typeof e.sampler=="number"?this.getSampler(e.sampler):wI(),source:typeof e.source=="number"?this.getImage(e.source):void 0}}_resolveSampler(e,r){let n={id:e.id||`sampler-${r}`,...e,parameters:{}};for(let s in n){let i=this._enumSamplerParameter(s);i!==void 0&&(n.parameters[i]=n[s])}return n}_enumSamplerParameter(e){return TI[e]}_resolveImage(e,r){let n={...e,id:e.id||`image-${r}`,image:null,bufferView:e.bufferView!==void 0?this.getBufferView(e.bufferView):void 0},s=this.images[r];return s&&(n.image=s),n}_resolveBufferView(e,r){let n=e.buffer,s=this.buffers[n].arrayBuffer,i=this.buffers[n].byteOffset||0;return e.byteOffset&&(i+=e.byteOffset),{id:`bufferView-${r}`,...e,buffer:this.buffers[n],data:new Uint8Array(s,i,e.byteLength)}}_resolveCamera(e,r){let n={...e,id:e.id||`camera-${r}`};return n.perspective,n.orthographic,n}};function Os(t,e){return new bf().postProcess(t,e)}var la={URI:0,EMBEDDED:1};function fa(t,e,r,n){t.rotateYtoZ=!0;let s=(t.byteOffset||0)+(t.byteLength||0)-r;if(s===0)throw new Error("glTF byte length must be greater than 0.");return t.gltfUpAxis=n!=null&&n["3d-tiles"]&&n["3d-tiles"].assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",t.gltfArrayBuffer=pr(e,r,s),t.gltfByteOffset=0,t.gltfByteLength=s,r%4===0||console.warn(`${t.type}: embedded glb is not aligned to a 4-byte boundary.`),(t.byteOffset||0)+(t.byteLength||0)}async function ha(t,e,r,n){let s=r?.["3d-tiles"]||{};if(CI(t,e,r),s.loadGLTF){if(!n)return;if(t.gltfUrl){let{fetch:i}=n,o=await i(t.gltfUrl,r);t.gltfArrayBuffer=await o.arrayBuffer(),t.gltfByteOffset=0}if(t.gltfArrayBuffer){let i=await Le(t.gltfArrayBuffer,Nr,r,n);t.gltf=Os(i),t.gpuMemoryUsageInBytes=Ss(t.gltf),delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength}}}function CI(t,e,r){switch(e){case la.URI:if(t.gltfArrayBuffer){let n=new Uint8Array(t.gltfArrayBuffer,t.gltfByteOffset),i=new TextDecoder().decode(n);t.gltfUrl=i.replace(/[\s\0]+$/,"")}delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength;break;case la.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function My(t,e,r,n,s){var i;r=MI(t,e,r,n,s),await ha(t,la.EMBEDDED,n,s);let o=t==null||(i=t.gltf)===null||i===void 0?void 0:i.extensions;return o&&o.CESIUM_RTC&&(t.rtcCenter=o.CESIUM_RTC.center),r}function MI(t,e,r,n,s){r=ar(t,e,r),r=_n(t,e,r),r=An(t,e,r,n),r=fa(t,e,r,n);let i=new Pt(t.featureTableJson,t.featureTableBinary);return t.rtcCenter=i.getGlobalProperty("RTC_CENTER",H.FLOAT,3),r}async function Iy(t,e,r,n,s){return r=II(t,e,r,n,s),await ha(t,t.gltfFormat||0,n,s),r}function II(t,e,r,n,s){var i;if(r=ar(t,e,r),t.version!==1)throw new Error(`Instanced 3D Model version ${t.version} is not supported`);r=_n(t,e,r);let o=new DataView(e);if(t.gltfFormat=o.getUint32(r,!0),r+=4,r=An(t,e,r,n),r=fa(t,e,r,n),!(t!=null&&(i=t.header)!==null&&i!==void 0&&i.featureTableJsonByteLength)||t.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let a=new Pt(t.featureTableJson,t.featureTableBinary),c=a.getGlobalProperty("INSTANCES_LENGTH");if(a.featuresLength=c,!Number.isFinite(c))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");t.eastNorthUp=a.getGlobalProperty("EAST_NORTH_UP"),t.rtcCenter=a.getGlobalProperty("RTC_CENTER",H.FLOAT,3);let u=new Pr(t.batchTableJson,t.batchTableBinary,c);return OI(t,a,u,c),r}function OI(t,e,r,n){let s=new Array(n),i=new w,o=new w,a=new w,c=new w,u=new W,l=new ht,f=new w,h={},d=new k,p=[],g=[],m=[],A=[];for(let v=0;v<n;v++){let x;if(e.hasProperty("POSITION"))x=e.getProperty("POSITION",H.FLOAT,3,v,i);else if(e.hasProperty("POSITION_QUANTIZED")){x=e.getProperty("POSITION_QUANTIZED",H.UNSIGNED_SHORT,3,v,i);let y=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",H.FLOAT,3);if(!y)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let R=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",H.FLOAT,3);if(!R)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let P=65535;for(let F=0;F<3;F++)x[F]=x[F]/P*R[F]+y[F]}if(!x)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");i.copy(x),h.translation=i,t.normalUp=e.getProperty("NORMAL_UP",H.FLOAT,3,v,p),t.normalRight=e.getProperty("NORMAL_RIGHT",H.FLOAT,3,v,g);let b=!1;if(t.normalUp){if(!t.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");t.hasCustomOrientation=!0}else{if(t.octNormalUp=e.getProperty("NORMAL_UP_OCT32P",H.UNSIGNED_SHORT,2,v,p),t.octNormalRight=e.getProperty("NORMAL_RIGHT_OCT32P",H.UNSIGNED_SHORT,2,v,g),t.octNormalUp)throw t.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");t.eastNorthUp?(V.WGS84.eastNorthUpToFixedFrame(i,d),d.getRotationMatrix3(u)):u.identity()}b&&(c.copy(o).cross(a).normalize(),u.setColumn(0,o),u.setColumn(1,a),u.setColumn(2,c)),l.fromMatrix3(u),h.rotation=l,f.set(1,1,1);let M=e.getProperty("SCALE",H.FLOAT,1,v,m);Number.isFinite(M)&&f.multiplyByScalar(M);let C=e.getProperty("SCALE_NON_UNIFORM",H.FLOAT,3,v,p);C&&f.scale(C),h.scale=f;let I=e.getProperty("BATCH_ID",H.UNSIGNED_SHORT,1,v,A);I===void 0&&(I=v);let B=new k().fromQuaternion(h.rotation);d.identity(),d.translate(h.translation),d.multiplyRight(B),d.scale(h.scale);let S=d.clone();s[v]={modelMatrix:S,batchId:I}}t.instances=s}async function Oy(t,e,r,n,s,i){r=ar(t,e,r);let o=new DataView(e);for(t.tilesLength=o.getUint32(r,!0),r+=4,t.tiles=[];t.tiles.length<t.tilesLength&&(t.byteLength||0)-r>12;){let a={shape:"tile3d"};t.tiles.push(a),r=await i(e,r,n,s,a)}return r}async function Ry(t,e,r,n){var s,i;if(t.rotateYtoZ=!0,t.gltfUpAxis=r!=null&&(s=r["3d-tiles"])!==null&&s!==void 0&&s.assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",r!=null&&(i=r["3d-tiles"])!==null&&i!==void 0&&i.loadGLTF){if(!n)return e.byteLength;let o=await Le(e,Nr,r,n);t.gltf=Os(o),t.gpuMemoryUsageInBytes=Ss(t.gltf)}else t.gltfArrayBuffer=e;return e.byteLength}async function Tf(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{shape:"tile3d"};switch(s.byteOffset=e,s.type=U0(t,e),s.type){case Rr.COMPOSITE:return await Oy(s,t,e,r,n,Tf);case Rr.BATCHED_3D_MODEL:return await My(s,t,e,r,n);case Rr.GLTF:return await Ry(s,t,r,n);case Rr.INSTANCED_3D_MODEL:return await Iy(s,t,e,r,n);case Rr.POINT_CLOUD:return await iy(s,t,e,r,n);default:throw new Error(`3DTileLoader: unknown type ${s.type}`)}}async function Ef(t,e,r){if(new Uint32Array(t.slice(0,4))[0]!==1952609651)throw new Error("Wrong subtree file magic number");if(new Uint32Array(t.slice(4,8))[0]!==1)throw new Error("Wrong subtree file verson, must be 1");let i=Ly(t.slice(8,16)),o=new Uint8Array(t,24,i),c=new TextDecoder("utf8").decode(o),u=JSON.parse(c),l=Ly(t.slice(16,24)),f=new ArrayBuffer(0);if(l&&(f=t.slice(24+i)),await da(u,u.tileAvailability,f,r),Array.isArray(u.contentAvailability))for(let h of u.contentAvailability)await da(u,h,f,r);else await da(u,u.contentAvailability,f,r);return await da(u,u.childSubtreeAvailability,f,r),u}async function da(t,e,r,n){let s=Number.isFinite(e.bitstream)?e.bitstream:e.bufferView;if(typeof s!="number")return;let i=t.bufferViews[s],o=t.buffers[i.buffer];if(!(n!=null&&n.baseUrl))throw new Error("Url is not provided");if(!n.fetch)throw new Error("fetch is not provided");if(o.uri){let c=`${n?.baseUrl||""}/${o.uri}`,l=await(await n.fetch(c)).arrayBuffer();e.explicitBitstream=new Uint8Array(l,i.byteOffset,i.byteLength);return}let a=t.buffers.slice(0,i.buffer).reduce((c,u)=>c+u.byteLength,0);e.explicitBitstream=new Uint8Array(r.slice(a,a+o.byteLength),i.byteOffset,i.byteLength)}function Ly(t){let e=new DataView(t),r=e.getUint32(0,!0),n=e.getUint32(4,!0);return r+2**32*n}var pa={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Yo,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:Ef,options:{}};var l_=U(dn(),1);var o_=U(dn(),1);function RI(t){try{let e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch{return null}}var ma=class{constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=RI(n),this.id=e,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let e={};if(this.storage){let r=this.storage.getItem(this.id);e=r?JSON.parse(r):{}}return Object.assign(this.config,e),this}};function Py(t){let e;return t<10?e="".concat(t.toFixed(2),"ms"):t<100?e="".concat(t.toFixed(1),"ms"):t<1e3?e="".concat(t.toFixed(0),"ms"):e="".concat((t/1e3).toFixed(2),"s"),e}function Fy(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(e-t.length,0);return"".concat(" ".repeat(r)).concat(t)}function ga(t,e,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,s=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>n&&(r=Math.min(r,n/t.width));let i=t.width*r,o=t.height*r,a=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(i/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(s,");"),"background-size:".concat(i,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(e," %c+"),a]}var ya;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(ya||(ya={}));var LI=10;function Ny(t){return typeof t!="string"?t:(t=t.toUpperCase(),ya[t]||ya.WHITE)}function Dy(t,e,r){if(!nt&&typeof t=="string"){if(e){let n=Ny(e);t="\x1B[".concat(n,"m").concat(t,"\x1B[39m")}if(r){let n=Ny(r);t="\x1B[".concat(n+LI,"m").concat(t,"\x1B[49m")}}return t}function Uy(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(t),n=Object.getOwnPropertyNames(r),s=t;for(let i of n){let o=s[i];typeof o=="function"&&(e.find(a=>i===a)||(s[i]=o.bind(t)))}}function Bn(t,e){if(!t)throw new Error(e||"Assertion failed")}function Dr(){let t;if(nt()&&hn.performance){var e,r;t=hn===null||hn===void 0||(e=hn.performance)===null||e===void 0||(r=e.now)===null||r===void 0?void 0:r.call(e)}else if("hrtime"in Cr){var n;let s=Cr===null||Cr===void 0||(n=Cr.hrtime)===null||n===void 0?void 0:n.call(Cr);t=s[0]*1e3+s[1]/1e6}else t=Date.now();return t}var Cn={debug:nt()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},PI={enabled:!0,level:0};function Je(){}var Gy={},ky={once:!0},Rs=class{constructor(){let{id:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=Lo,this._startTs=Dr(),this._deltaTs=Dr(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new ma("__probe-".concat(this.id,"__"),PI),this.timeStamp("".concat(this.id," started")),Uy(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Dr()-this._startTs).toPrecision(10))}getDelta(){return Number((Dr()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,r){this._storage.setConfiguration({[e]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,r){Bn(e,r)}warn(e){return this._getLogFunction(0,e,Cn.warn,arguments,ky)}error(e){return this._getLogFunction(0,e,Cn.error,arguments)}deprecated(e,r){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(e,r){return this.error("`".concat(e,"` has been removed. Use `").concat(r,"` instead"))}probe(e,r){return this._getLogFunction(e,r,Cn.log,arguments,{time:!0,once:!0})}log(e,r){return this._getLogFunction(e,r,Cn.debug,arguments)}info(e,r){return this._getLogFunction(e,r,console.info,arguments)}once(e,r){return this._getLogFunction(e,r,Cn.debug||Cn.info,arguments,ky)}table(e,r,n){return r?this._getLogFunction(e,r,console.table||Je,n&&[n],{tag:UI(r)}):Je}image(e){let{logLevel:r,priority:n,image:s,message:i="",scale:o=1}=e;return this._shouldLog(r||n)?nt()?DI({image:s,message:i,scale:o}):NI({image:s,message:i,scale:o}):Je}time(e,r){return this._getLogFunction(e,r,console.time?console.time:console.info)}timeEnd(e,r){return this._getLogFunction(e,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,r){return this._getLogFunction(e,r,console.timeStamp||Je)}group(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},s=Hy({logLevel:e,message:r,opts:n}),{collapsed:i}=n;return s.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(e,r,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Je)}withGroup(e,r,n){this.group(e,r)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=Vy(e)}_getLogFunction(e,r,n,s,i){if(this._shouldLog(e)){i=Hy({logLevel:e,message:r,args:s,opts:i}),n=n||i.method,Bn(n),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=Dr();let o=i.tag||i.message;if(i.once&&o)if(!Gy[o])Gy[o]=Dr();else return Je;return r=FI(this.id,i.message,i),n.bind(console,r,...i.args)}return Je}};Rs.VERSION=Lo;function Vy(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return Bn(Number.isFinite(e)&&e>=0),e}function Hy(t){let{logLevel:e,message:r}=t;t.logLevel=Vy(e);let n=t.args?Array.from(t.args):[];for(;n.length&&n.shift()!==r;);switch(typeof e){case"string":case"function":r!==void 0&&n.unshift(r),t.message=e;break;case"object":Object.assign(t,e);break;default:}typeof t.message=="function"&&(t.message=t.message());let s=typeof t.message;return Bn(s==="string"||s==="object"),Object.assign(t,{args:n},t.opts)}function FI(t,e,r){if(typeof e=="string"){let n=r.time?Fy(Py(r.total)):"";e=r.time?"".concat(t,": ").concat(n," ").concat(e):"".concat(t,": ").concat(e),e=Dy(e,r.color,r.background)}return e}function NI(t){let{image:e,message:r="",scale:n=1}=t;return console.warn("removed"),Je}function DI(t){let{image:e,message:r="",scale:n=1}=t;if(typeof e=="string"){let i=new Image;return i.onload=()=>{let o=ga(i,r,n);console.log(...o)},i.src=e,Je}let s=e.nodeName||"";if(s.toLowerCase()==="img")return console.log(...ga(e,r,n)),Je;if(s.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(...ga(i,r,n)),i.src=e.toDataURL(),Je}return Je}function UI(t){for(let e in t)for(let r in t[e])return r||"untitled";return"empty"}var wf=new Rs({id:"@probe.gl/log"});var We=null;try{We=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function re(t,e,r){this.low=t|0,this.high=e|0,this.unsigned=!!r}re.prototype.__isLong__;Object.defineProperty(re.prototype,"__isLong__",{value:!0});function Te(t){return(t&&t.__isLong__)===!0}function zy(t){var e=Math.clz32(t&-t);return t?31-e:e}re.isLong=Te;var jy={},qy={};function Ur(t,e){var r,n,s;return e?(t>>>=0,(s=0<=t&&t<256)&&(n=qy[t],n)?n:(r=q(t,0,!0),s&&(qy[t]=r),r)):(t|=0,(s=-128<=t&&t<128)&&(n=jy[t],n)?n:(r=q(t,t<0?-1:0,!1),s&&(jy[t]=r),r))}re.fromInt=Ur;function Xe(t,e){if(isNaN(t))return e?Ft:it;if(e){if(t<0)return Ft;if(t>=Ky)return Qy}else{if(t<=-Wy)return Re;if(t+1>=Wy)return Zy}return t<0?Xe(-t,e).neg():q(t%In|0,t/In|0,e)}re.fromNumber=Xe;function q(t,e,r){return new re(t,e,r)}re.fromBits=q;var _a=Math.pow;function Bf(t,e,r){if(t.length===0)throw Error("empty string");if(typeof e=="number"?(r=e,e=!1):e=!!e,t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return e?Ft:it;if(r=r||10,r<2||36<r)throw RangeError("radix");var n;if((n=t.indexOf("-"))>0)throw Error("interior hyphen");if(n===0)return Bf(t.substring(1),e,r).neg();for(var s=Xe(_a(r,8)),i=it,o=0;o<t.length;o+=8){var a=Math.min(8,t.length-o),c=parseInt(t.substring(o,o+a),r);if(a<8){var u=Xe(_a(r,a));i=i.mul(u).add(Xe(c))}else i=i.mul(s),i=i.add(Xe(c))}return i.unsigned=e,i}re.fromString=Bf;function ot(t,e){return typeof t=="number"?Xe(t,e):typeof t=="string"?Bf(t,e):q(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}re.fromValue=ot;var Jy=1<<16,GI=1<<24,In=Jy*Jy,Ky=In*In,Wy=Ky/2,Xy=Ur(GI),it=Ur(0);re.ZERO=it;var Ft=Ur(0,!0);re.UZERO=Ft;var Mn=Ur(1);re.ONE=Mn;var Yy=Ur(1,!0);re.UONE=Yy;var Sf=Ur(-1);re.NEG_ONE=Sf;var Zy=q(-1,2147483647,!1);re.MAX_VALUE=Zy;var Qy=q(-1,-1,!0);re.MAX_UNSIGNED_VALUE=Qy;var Re=q(0,-2147483648,!1);re.MIN_VALUE=Re;var L=re.prototype;L.toInt=function(){return this.unsigned?this.low>>>0:this.low};L.toNumber=function(){return this.unsigned?(this.high>>>0)*In+(this.low>>>0):this.high*In+(this.low>>>0)};L.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Re)){var r=Xe(e),n=this.div(r),s=n.mul(r).sub(this);return n.toString(e)+s.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var i=Xe(_a(e,6),this.unsigned),o=this,a="";;){var c=o.div(i),u=o.sub(c.mul(i)).toInt()>>>0,l=u.toString(e);if(o=c,o.isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}};L.getHighBits=function(){return this.high};L.getHighBitsUnsigned=function(){return this.high>>>0};L.getLowBits=function(){return this.low};L.getLowBitsUnsigned=function(){return this.low>>>0};L.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Re)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,r=31;r>0&&!(e&1<<r);r--);return this.high!=0?r+33:r+1};L.isZero=function(){return this.high===0&&this.low===0};L.eqz=L.isZero;L.isNegative=function(){return!this.unsigned&&this.high<0};L.isPositive=function(){return this.unsigned||this.high>=0};L.isOdd=function(){return(this.low&1)===1};L.isEven=function(){return(this.low&1)===0};L.equals=function(e){return Te(e)||(e=ot(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};L.eq=L.equals;L.notEquals=function(e){return!this.eq(e)};L.neq=L.notEquals;L.ne=L.notEquals;L.lessThan=function(e){return this.comp(e)<0};L.lt=L.lessThan;L.lessThanOrEqual=function(e){return this.comp(e)<=0};L.lte=L.lessThanOrEqual;L.le=L.lessThanOrEqual;L.greaterThan=function(e){return this.comp(e)>0};L.gt=L.greaterThan;L.greaterThanOrEqual=function(e){return this.comp(e)>=0};L.gte=L.greaterThanOrEqual;L.ge=L.greaterThanOrEqual;L.compare=function(e){if(Te(e)||(e=ot(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1};L.comp=L.compare;L.negate=function(){return!this.unsigned&&this.eq(Re)?Re:this.not().add(Mn)};L.neg=L.negate;L.add=function(e){Te(e)||(e=ot(e));var r=this.high>>>16,n=this.high&65535,s=this.low>>>16,i=this.low&65535,o=e.high>>>16,a=e.high&65535,c=e.low>>>16,u=e.low&65535,l=0,f=0,h=0,d=0;return d+=i+u,h+=d>>>16,d&=65535,h+=s+c,f+=h>>>16,h&=65535,f+=n+a,l+=f>>>16,f&=65535,l+=r+o,l&=65535,q(h<<16|d,l<<16|f,this.unsigned)};L.subtract=function(e){return Te(e)||(e=ot(e)),this.add(e.neg())};L.sub=L.subtract;L.multiply=function(e){if(this.isZero())return this;if(Te(e)||(e=ot(e)),We){var r=We.mul(this.low,this.high,e.low,e.high);return q(r,We.get_high(),this.unsigned)}if(e.isZero())return this.unsigned?Ft:it;if(this.eq(Re))return e.isOdd()?Re:it;if(e.eq(Re))return this.isOdd()?Re:it;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(Xy)&&e.lt(Xy))return Xe(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,s=this.high&65535,i=this.low>>>16,o=this.low&65535,a=e.high>>>16,c=e.high&65535,u=e.low>>>16,l=e.low&65535,f=0,h=0,d=0,p=0;return p+=o*l,d+=p>>>16,p&=65535,d+=i*l,h+=d>>>16,d&=65535,d+=o*u,h+=d>>>16,d&=65535,h+=s*l,f+=h>>>16,h&=65535,h+=i*u,f+=h>>>16,h&=65535,h+=o*c,f+=h>>>16,h&=65535,f+=n*l+s*u+i*c+o*a,f&=65535,q(d<<16|p,f<<16|h,this.unsigned)};L.mul=L.multiply;L.divide=function(e){if(Te(e)||(e=ot(e)),e.isZero())throw Error("division by zero");if(We){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?We.div_u:We.div_s)(this.low,this.high,e.low,e.high);return q(r,We.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Ft:it;var n,s,i;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return Ft;if(e.gt(this.shru(1)))return Yy;i=Ft}else{if(this.eq(Re)){if(e.eq(Mn)||e.eq(Sf))return Re;if(e.eq(Re))return Mn;var o=this.shr(1);return n=o.div(e).shl(1),n.eq(it)?e.isNegative()?Mn:Sf:(s=this.sub(e.mul(n)),i=n.add(s.div(e)),i)}else if(e.eq(Re))return this.unsigned?Ft:it;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=it}for(s=this;s.gte(e);){n=Math.max(1,Math.floor(s.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),c=a<=48?1:_a(2,a-48),u=Xe(n),l=u.mul(e);l.isNegative()||l.gt(s);)n-=c,u=Xe(n,this.unsigned),l=u.mul(e);u.isZero()&&(u=Mn),i=i.add(u),s=s.sub(l)}return i};L.div=L.divide;L.modulo=function(e){if(Te(e)||(e=ot(e)),We){var r=(this.unsigned?We.rem_u:We.rem_s)(this.low,this.high,e.low,e.high);return q(r,We.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};L.mod=L.modulo;L.rem=L.modulo;L.not=function(){return q(~this.low,~this.high,this.unsigned)};L.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};L.clz=L.countLeadingZeros;L.countTrailingZeros=function(){return this.low?zy(this.low):zy(this.high)+32};L.ctz=L.countTrailingZeros;L.and=function(e){return Te(e)||(e=ot(e)),q(this.low&e.low,this.high&e.high,this.unsigned)};L.or=function(e){return Te(e)||(e=ot(e)),q(this.low|e.low,this.high|e.high,this.unsigned)};L.xor=function(e){return Te(e)||(e=ot(e)),q(this.low^e.low,this.high^e.high,this.unsigned)};L.shiftLeft=function(e){return Te(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?q(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):q(0,this.low<<e-32,this.unsigned)};L.shl=L.shiftLeft;L.shiftRight=function(e){return Te(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?q(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):q(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};L.shr=L.shiftRight;L.shiftRightUnsigned=function(e){return Te(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?q(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):e===32?q(this.high,0,this.unsigned):q(this.high>>>e-32,0,this.unsigned)};L.shru=L.shiftRightUnsigned;L.shr_u=L.shiftRightUnsigned;L.rotateLeft=function(e){var r;return Te(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?q(this.high,this.low,this.unsigned):e<32?(r=32-e,q(this.low<<e|this.high>>>r,this.high<<e|this.low>>>r,this.unsigned)):(e-=32,r=32-e,q(this.high<<e|this.low>>>r,this.low<<e|this.high>>>r,this.unsigned))};L.rotl=L.rotateLeft;L.rotateRight=function(e){var r;return Te(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?q(this.high,this.low,this.unsigned):e<32?(r=32-e,q(this.high<<r|this.low>>>e,this.low<<r|this.high>>>e,this.unsigned)):(e-=32,r=32-e,q(this.low<<r|this.high>>>e,this.high<<r|this.low>>>e,this.unsigned))};L.rotr=L.rotateRight;L.toSigned=function(){return this.unsigned?q(this.low,this.high,!1):this};L.toUnsigned=function(){return this.unsigned?this:q(this.low,this.high,!0)};L.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};L.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]};L.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]};re.fromBytes=function(e,r,n){return n?re.fromBytesLE(e,r):re.fromBytesBE(e,r)};re.fromBytesLE=function(e,r){return new re(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)};re.fromBytesBE=function(e,r){return new re(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)};var On=re;var kI=16;function Ls(t){t==="X"&&(t="");let e=t.padEnd(kI,"0");return On.fromString(e,!0,16)}function Cf(t){if(t.isZero())return"X";let e=t.countTrailingZeros(),r=e%4;e=(e-r)/4;let n=e;e*=4;let i=t.shiftRightUnsigned(e).toString(16).replace(/0+$/,"");return Array(17-n-i.length).join("0")+i}function Mf(t,e){let r=HI(t).shiftRightUnsigned(2);return t.add(On.fromNumber(2*e+1-4).multiply(r))}function HI(t){return t.and(t.not().add(1))}var VI=3,zI=30,jI=2*zI+1,$y=180/Math.PI;function t_(t){if(t.length===0)throw new Error(`Invalid Hilbert quad key ${t}`);let e=t.split("/"),r=parseInt(e[0],10),n=e[1],s=n.length,i=0,o=[0,0];for(let a=s-1;a>=0;a--){i=s-a;let c=n[a],u=0,l=0;c==="1"?l=1:c==="2"?(u=1,l=1):c==="3"&&(u=1);let f=Math.pow(2,i-1);qI(f,o,u,l),o[0]+=f*u,o[1]+=f*l}if(r%2===1){let a=o[0];o[0]=o[1],o[1]=a}return{face:r,ij:o,level:i}}function r_(t){if(t.isZero())return"";let e=t.toString(2);for(;e.length<VI+jI;)e="0"+e;let r=e.lastIndexOf("1"),n=e.substring(0,3),s=e.substring(3,r),i=s.length/2,o=On.fromString(n,!0,2).toString(10),a="";if(i!==0)for(a=On.fromString(s,!0,2).toString(4);a.length<i;)a="0"+a;return`${o}/${a}`}function If(t,e,r){let n=1<<e;return[(t[0]+r[0])/n,(t[1]+r[1])/n]}function e_(t){return t>=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function Of(t){return[e_(t[0]),e_(t[1])]}function Rf(t,e){let[r,n]=e;switch(t){case 0:return[1,r,n];case 1:return[-r,1,n];case 2:return[-r,-n,1];case 3:return[-1,-n,-r];case 4:return[n,-1,-r];case 5:return[n,r,-1];default:throw new Error("Invalid face")}}function Lf(t){let[e,r,n]=t,s=Math.atan2(n,Math.sqrt(e*e+r*r));return[Math.atan2(r,e)*$y,s*$y]}function qI(t,e,r,n){if(n===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);let s=e[0];e[0]=e[1],e[1]=s}}function n_(t){let e=If(t.ij,t.level,[.5,.5]),r=Of(e),n=Rf(t.face,r);return Lf(n)}var JI=100;function Pf(t){let{face:e,ij:r,level:n}=t,s=[[0,0],[0,1],[1,1],[1,0],[0,0]],i=Math.max(1,Math.ceil(JI*Math.pow(2,-n))),o=new Float64Array(4*i*2+2),a=0,c=0;for(let u=0;u<4;u++){let l=s[u].slice(0),f=s[u+1],h=(f[0]-l[0])/i,d=(f[1]-l[1])/i;for(let p=0;p<i;p++){l[0]+=h,l[1]+=d;let g=If(r,n,l),m=Of(g),A=Rf(e,m),v=Lf(A);Math.abs(v[1])>89.999&&(v[0]=c);let x=v[0]-c;v[0]+=x>180?-360:x<-180?360:0,o[a++]=v[0],o[a++]=v[1],c=v[0]}}return o[a++]=o[0],o[a++]=o[1],o}function Rn(t){let e=WI(t);return t_(e)}function WI(t){if(t.indexOf("/")>0)return t;let e=Ls(t);return r_(e)}function Ff(t){let e=Rn(t);return n_(e)}function i_(t){let e;if(t.face===2||t.face===5){let r=null,n=0;for(let s=0;s<4;s++){let i=`${t.face}/${s}`,o=Rn(i),a=Pf(o);(typeof r>"u"||r===null)&&(r=new Float64Array(4*a.length)),r.set(a,n),n+=a.length}e=s_(r)}else{let r=Pf(t);e=s_(r)}return e}function s_(t){if(t.length%2!==0)throw new Error("Invalid corners");let e=[],r=[];for(let n=0;n<t.length;n+=2)e.push(t[n]),r.push(t[n+1]);return e.sort((n,s)=>n-s),r.sort((n,s)=>n-s),{west:e[0],east:e[e.length-1],north:r[r.length-1],south:r[0]}}function Nf(t,e){let r=e?.minimumHeight||0,n=e?.maximumHeight||0,s=Rn(t),i=i_(s),o=i.west,a=i.south,c=i.east,u=i.north,l=[];return l.push(new w(o,u,r)),l.push(new w(c,u,r)),l.push(new w(c,a,r)),l.push(new w(o,a,r)),l.push(new w(o,u,n)),l.push(new w(c,u,n)),l.push(new w(c,a,n)),l.push(new w(o,a,n)),l}function Aa(t){let e=t.token,r={minimumHeight:t.minimumHeight,maximumHeight:t.maximumHeight},n=Nf(e,r),s=Ff(e),i=s[0],o=s[1],a=V.WGS84.cartographicToCartesian([i,o,r.maximumHeight]),c=new w(a[0],a[1],a[2]);n.push(c);let u=is(n);return[...u.center,...u.halfAxes]}var XI=4,KI=8,YI={QUADTREE:XI,OCTREE:KI};function ZI(t,e,r){if(t!=null&&t.box){let n=Ls(t.s2VolumeInfo.token),s=Mf(n,e),i=Cf(s),o={...t.s2VolumeInfo};switch(o.token=i,r){case"OCTREE":let u=t.s2VolumeInfo,l=u.maximumHeight-u.minimumHeight,f=l/2,h=u.minimumHeight+l/2;u.minimumHeight=h-f,u.maximumHeight=h+f;break;default:break}return{box:Aa(o),s2VolumeInfo:o}}}async function Uf(t){let{implicitOptions:e,parentData:r={mortonIndex:0,x:0,y:0,z:0},childIndex:n=0,s2VolumeBox:s,loaderOptions:i}=t,{subtree:o,level:a=0,globalData:c={level:0,mortonIndex:0,x:0,y:0,z:0}}=t,{subdivisionScheme:u,subtreeLevels:l,maximumLevel:f,contentUrlTemplate:h,subtreesUriTemplate:d,basePath:p}=e,g={children:[],lodMetricValue:0,contentUrl:""};if(!f)return wf.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${h} won't be loaded...`),g;let m=a+c.level;if(m>f)return g;let A=YI[u],v=Math.log2(A),x=n&1,b=n>>1&1,M=n>>2&1,C=(A**a-1)/(A-1),I=Gr(r.mortonIndex,n,v),B=C+I,S=Gr(r.x,x,1),y=Gr(r.y,b,1),R=Gr(r.z,M,1),P=!1;a>=l&&(P=Df(o.childSubtreeAvailability,I));let F=Gr(c.x,S,a),N=Gr(c.y,y,a),G=Gr(c.z,R,a);if(P){let $=`${p}/${d}`,oe=va($,m,F,N,G);o=await(0,o_.load)(oe,pa,i),c={mortonIndex:I,x:S,y,z:R,level:a},I=0,B=0,S=0,y=0,R=0,a=0}if(!Df(o.tileAvailability,B))return g;Df(o.contentAvailability,B)&&(g.contentUrl=va(h,m,F,N,G));let ne=a+1,Z={mortonIndex:I,x:S,y,z:R};for(let $=0;$<A;$++){let oe=ZI(s,$,u),Be=await Uf({subtree:o,implicitOptions:e,loaderOptions:i,parentData:Z,childIndex:$,level:ne,globalData:{...c},s2VolumeBox:oe});if(Be.contentUrl||Be.children.length){let bA=m+1,TA=QI(Be,bA,{childTileX:S,childTileY:y,childTileZ:R},e,s);g.children.push(TA)}}return g}function Df(t,e){let r;return Array.isArray(t)?(r=t[0],t.length>1&&wf.once('Not supported extension "3DTILES_multiple_contents" has been detected')):r=t,"constant"in r?Boolean(r.constant):r.explicitBitstream?t2(e,r.explicitBitstream):!1}function QI(t,e,r,n,s){let{basePath:i,refine:o,getRefine:a,lodMetricType:c,getTileType:u,rootLodMetricValue:l,rootBoundingVolume:f}=n,h=t.contentUrl&&t.contentUrl.replace(`${i}/`,""),d=l/2**e,p=s!=null&&s.box?{box:s.box}:f,g=$I(e,p,r);return{children:t.children,contentUrl:t.contentUrl,content:{uri:h},id:t.contentUrl,refine:a(o),type:u(t),lodMetricType:c,lodMetricValue:d,geometricError:d,transform:t.transform,boundingVolume:g}}function $I(t,e,r){if(e.region){let{childTileX:n,childTileY:s,childTileZ:i}=r,[o,a,c,u,l,f]=e.region,h=2**t,d=(c-o)/h,p=(u-a)/h,g=(f-l)/h,[m,A]=[o+d*n,o+d*(n+1)],[v,x]=[a+p*s,a+p*(s+1)],[b,M]=[l+g*i,l+g*(i+1)];return{region:[m,v,A,x,b,M]}}if(e.box)return e;throw new Error(`Unsupported bounding volume type ${e}`)}function Gr(t,e,r){return(t<<r)+e}function va(t,e,r,n,s){let i=e2({level:e,x:r,y:n,z:s});return t.replace(/{level}|{x}|{y}|{z}/gi,o=>i[o])}function e2(t){let e={};for(let r in t)e[`{${r}}`]=t[r];return e}function t2(t,e){let r=Math.floor(t/8),n=t%8;return(e[r]>>n&1)===1}function kf(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(!e)return _t.EMPTY;let n=e.split("?")[0].split(".").pop();switch(n){case"pnts":return _t.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return _t.SCENEGRAPH;default:return n||_t.EMPTY}}function Hf(t){switch(t){case"REPLACE":case"replace":return Me.REPLACE;case"ADD":case"add":return Me.ADD;default:return t}}function Gf(t,e){if(/^[a-z][0-9a-z+.-]*:/i.test(e)){let n=new URL(t,`${e}/`);return decodeURI(n.toString())}else if(t.startsWith("/"))return t;return Vt.resolve(e,t)}function a_(t,e){if(!t)return null;let r;if(t.content){var n;let i=t.content.uri||((n=t.content)===null||n===void 0?void 0:n.url);typeof i<"u"&&(r=Gf(i,e))}return{...t,id:r,contentUrl:r,lodMetricType:Mr.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:kf(t,r),refine:Hf(t.refine)}}async function f_(t,e,r){let n=null,s=u_(t.root);s&&t.root?n=await c_(t.root,t,e,s,r):n=a_(t.root,e);let i=[];for(i.push(n);i.length>0;){let o=i.pop()||{},a=o.children||[],c=[];for(let u of a){let l=u_(u),f;l?f=await c_(u,t,e,l,r):f=a_(u,e),f&&(c.push(f),i.push(f))}o.children=c}return n}async function c_(t,e,r,n,s){var i,o,a;let{subdivisionScheme:c,maximumLevel:u,availableLevels:l,subtreeLevels:f,subtrees:{uri:h}}=n,d=va(h,0,0,0,0),p=Gf(d,r),g=await(0,l_.load)(p,pa,s),m=(i=t.content)===null||i===void 0?void 0:i.uri,A=m?Gf(m,r):"",v=e==null||(o=e.root)===null||o===void 0?void 0:o.refine,x=t.geometricError,b=(a=t.boundingVolume.extensions)===null||a===void 0?void 0:a["3DTILES_bounding_volume_S2"];if(b){let B={box:Aa(b),s2VolumeInfo:b};t.boundingVolume=B}let M=t.boundingVolume,C={contentUrlTemplate:A,subtreesUriTemplate:h,subdivisionScheme:c,subtreeLevels:f,maximumLevel:Number.isFinite(l)?l-1:u,refine:v,basePath:r,lodMetricType:Mr.GEOMETRIC_ERROR,rootLodMetricValue:x,rootBoundingVolume:M,getTileType:kf,getRefine:Hf};return await r2(t,r,g,C,s)}async function r2(t,e,r,n,s){if(!t)return null;let{children:i,contentUrl:o}=await Uf({subtree:r,implicitOptions:n,loaderOptions:s}),a,c=null;return o&&(a=o,c={uri:o.replace(`${e}/`,"")}),{...t,id:a,contentUrl:a,lodMetricType:Mr.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:kf(t,a),refine:Hf(t.refine),content:c||t.content,children:i}}function u_(t){var e;return(t==null||(e=t.extensions)===null||e===void 0?void 0:e["3DTILES_implicit_tiling"])||t?.implicitTiling}var xa={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Yo,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:n2,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function n2(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=e["3d-tiles"]||{},s;return n.isTileset==="auto"?s=r?.url&&r.url.indexOf(".json")!==-1:s=n.isTileset,s?s2(t,e,r):i2(t,e,r)}async function s2(t,e,r){var n;let s=JSON.parse(new TextDecoder().decode(t)),i=r?.url||"",o=o2(i),a=await f_(s,o,e||{});return{...s,shape:"tileset3d",loader:xa,url:i,queryString:r?.queryString||"",basePath:o,root:a||s.root,type:ve.TILES3D,lodMetricType:Mr.GEOMETRIC_ERROR,lodMetricValue:((n=s.root)===null||n===void 0?void 0:n.geometricError)||0}}async function i2(t,e,r){let n={content:{shape:"tile3d",featureIds:null}};return await Tf(t,0,e,r,n.content),n.content}function o2(t){return Vt.dirname(t)}function ba(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ba=function(r){return typeof r}:ba=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ba(t)}function h_(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Ln(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?h_(Object(r),!0).forEach(function(n){a2(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):h_(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function a2(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d_(t,e,r,n,s,i,o){try{var a=t[i](o),c=a.value}catch(u){r(u);return}a.done?e(c):Promise.resolve(c).then(n,s)}function c2(t){return function(){var e=this,r=arguments;return new Promise(function(n,s){var i=t.apply(e,r);function o(c){d_(i,n,s,o,a,"next",c)}function a(c){d_(i,n,s,o,a,"throw",c)}o(void 0)})}}function u2(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function p_(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function l2(t,e,r){return e&&p_(t.prototype,e),r&&p_(t,r),t}function Ta(t,e,r){return typeof Reflect<"u"&&Reflect.get?Ta=Reflect.get:Ta=function(s,i,o){var a=f2(s,i);if(a){var c=Object.getOwnPropertyDescriptor(a,i);return c.get?c.get.call(o):c.value}},Ta(t,e,r||t)}function f2(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&(t=Pn(t),t!==null););return t}function h2(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Vf(t,e)}function Vf(t,e){return Vf=Object.setPrototypeOf||function(n,s){return n.__proto__=s,n},Vf(t,e)}function d2(t){var e=g2();return function(){var n=Pn(t),s;if(e){var i=Pn(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return p2(this,s)}}function p2(t,e){if(e&&(ba(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return m2(t)}function m2(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g2(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Pn(t){return Pn=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Pn(t)}var m_=[0],y2={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:xa,onTilesetLoad:{type:"function",value:function(e){}},onTileLoad:{type:"function",value:function(e){}},onTileUnload:{type:"function",value:function(e){}},onTileError:{type:"function",value:function(e,r,n){}},_getMeshColor:{type:"function",value:function(e){return[255,255,255]}}},Ea=function(t){h2(r,t);var e=d2(r);function r(){var s;u2(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return s=e.call.apply(e,[this].concat(o)),s.state=void 0,s}var n=r.prototype;return n.initializeState=function(){"onTileLoadFail"in this.props&&ur.log.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}},n.shouldUpdateState=function(i){var o=i.changeFlags;return o.somethingChanged},n.updateState=function(i){var o=i.props,a=i.oldProps,c=i.changeFlags;if(o.data&&o.data!==a.data&&this._loadTileset(o.data),c.viewportChanged){var u=this.state.activeViewports,l=Object.keys(u).length;l&&(this._updateTileset(u),this.state.lastUpdatedViewports=u,this.state.activeViewports={})}if(c.propsChanged){var f=this.state.layerMap;for(var h in f)f[h].needsUpdate=!0}},n.activateViewport=function(i){var o=this.state,a=o.activeViewports,c=o.lastUpdatedViewports;this.internalState.viewport=i,a[i.id]=i;var u=c?.[i.id];(!u||!i.equals(u))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())},n.getPickingInfo=function(i){var o=i.info,a=i.sourceLayer,c=a&&a.props.tile;return o.picked&&(o.object=c),o.sourceTile=c,o},n.filterSubLayer=function(i){var o=i.layer,a=i.viewport,c=o.props,u=c.tile,l=a.id;return u.selected&&u.viewportIds.includes(l)},n._updateAutoHighlight=function(i){var o=i.sourceTile,a=this.state.layerMap[o?.id];a&&a.layer&&a.layer.updateAutoHighlight(i)},n._loadTileset=function(){var s=c2(regeneratorRuntime.mark(function o(a){var c,u,l,f,h,d,p,g,m;return regeneratorRuntime.wrap(function(v){for(;;)switch(v.prev=v.next){case 0:if(c=this.props.loadOptions,u=c===void 0?{}:c,l=this.props.loader||this.props.loaders,f=Array.isArray(l)?l[0]:l,h={loadOptions:Ln({},u)},d=a,!f.preload){v.next=12;break}return v.next=8,f.preload(a,u);case 8:p=v.sent,p.url&&(d=p.url),p.headers&&(h.loadOptions.fetch=Ln(Ln({},h.loadOptions.fetch),{},{headers:p.headers})),Object.assign(h,p);case 12:return v.next=14,(0,__.load)(d,f,h.loadOptions);case 14:g=v.sent,m=new Ts(g,Ln({onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError},h)),this.setState({tileset3d:m,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(m);case 19:case"end":return v.stop()}},o,this)}));function i(o){return s.apply(this,arguments)}return i}(),n._onTileLoad=function(i){var o=this.state.lastUpdatedViewports;this.props.onTileLoad(i),this._updateTileset(o),this.setNeedsUpdate()},n._onTileUnload=function(i){delete this.state.layerMap[i.id],this.props.onTileUnload(i)},n._updateTileset=function(i){var o=this;if(i){var a=this.state.tileset3d,c=this.context.timeline,u=Object.keys(i).length;!c||!u||!a||a.selectTiles(Object.values(i)).then(function(l){var f=o.state.frameNumber!==l;f&&o.setState({frameNumber:l})})}},n._getSubLayer=function(i,o){if(!i.content)return null;switch(i.type){case _t.POINTCLOUD:return this._makePointCloudLayer(i,o);case _t.SCENEGRAPH:return this._make3DModelLayer(i);case _t.MESH:return this._makeSimpleMeshLayer(i,o);default:throw new Error("Tile3DLayer: Failed to render layer of type ".concat(i.content.type))}},n._makePointCloudLayer=function(i,o){var a=i.content,c=a.attributes,u=a.pointCount,l=a.constantRGBA,f=a.cartographicOrigin,h=a.modelMatrix,d=c.positions,p=c.normals,g=c.colors;if(!d)return null;var m=o&&o.props.data||{header:{vertexCount:u},attributes:{POSITION:d,NORMAL:p,COLOR_0:g}},A=this.props,v=A.pointSize,x=A.getPointColor,b=this.getSubLayerClass("pointcloud",g_.PointCloudLayer);return new b({pointSize:v},this.getSubLayerProps({id:"pointcloud"}),{id:"".concat(this.id,"-pointcloud-").concat(i.id),tile:i,data:m,coordinateSystem:ur.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:f,modelMatrix:h,getColor:l||x,_offset:0})},n._make3DModelLayer=function(i){var o=i.content,a=o.gltf,c=o.instances,u=o.cartographicOrigin,l=o.modelMatrix,f=this.getSubLayerClass("scenegraph",y_.ScenegraphLayer);return new f({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:"".concat(this.id,"-scenegraph-").concat(i.id),tile:i,data:c||m_,scenegraph:a,coordinateSystem:ur.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:u,modelMatrix:l,getTransformMatrix:function(d){return d.modelMatrix},getPosition:[0,0,0],_offset:0})},n._makeSimpleMeshLayer=function(i,o){var a=i.content,c=a.attributes,u=a.indices,l=a.modelMatrix,f=a.cartographicOrigin,h=a.coordinateSystem,d=h===void 0?ur.COORDINATE_SYSTEM.METER_OFFSETS:h,p=a.material,g=a.featureIds,m=this.props._getMeshColor,A=o&&o.props.mesh||new As({topology:"triangle-list",attributes:_2(c),indices:u}),v=this.getSubLayerClass("mesh",Fo);return new v(this.getSubLayerProps({id:"mesh"}),{id:"".concat(this.id,"-mesh-").concat(i.id),tile:i,mesh:A,data:m_,getColor:m(i),pbrMaterial:p,modelMatrix:l,coordinateOrigin:f,coordinateSystem:d,featureIds:g,_offset:0})},n.renderLayers=function(){var i=this,o=this.state,a=o.tileset3d,c=o.layerMap;return a?a.tiles.map(function(u){var l=c[u.id]=c[u.id]||{tile:u},f=l.layer;return u.selected&&(f?l.needsUpdate&&(f=i._getSubLayer(u,f),l.needsUpdate=!1):f=i._getSubLayer(u)),l.layer=f,f}).filter(Boolean):null},l2(r,[{key:"isLoaded",get:function(){var i,o;return Boolean(((i=this.state)===null||i===void 0||(o=i.tileset3d)===null||o===void 0?void 0:o.isLoaded())&&Ta(Pn(r.prototype),"isLoaded",this))}}]),r}(ur.CompositeLayer);Ea.defaultProps=y2;Ea.layerName="Tile3DLayer";function _2(t){var e={};return e.positions=Ln(Ln({},t.positions),{},{value:new Float32Array(t.positions.value)}),t.normals&&(e.normals=t.normals),t.texCoords&&(e.texCoords=t.texCoords),t.colors&&(e.colors=t.colors),t.uvRegions&&(e.uvRegions=t.uvRegions),e}var Oa=U(Ze()),Kf=U(Mo()),C_=U(Ze());var A2=new Map([["centerX",Float64Array.BYTES_PER_ELEMENT],["centerY",Float64Array.BYTES_PER_ELEMENT],["centerZ",Float64Array.BYTES_PER_ELEMENT],["minHeight",Float32Array.BYTES_PER_ELEMENT],["maxHeight",Float32Array.BYTES_PER_ELEMENT],["boundingSphereCenterX",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterY",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterZ",Float64Array.BYTES_PER_ELEMENT],["boundingSphereRadius",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointX",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointY",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointZ",Float64Array.BYTES_PER_ELEMENT]]);function zf(t){return t>>1^-(t&1)}function v2(t){let e=0,r={};for(let[n,s]of A2){let i=s===8?t.getFloat64:t.getFloat32;r[n]=i.call(t,e,!0),e+=s}return{header:r,headerEndPosition:e}}function x2(t,e){let r=e,n=3,s=t.getUint32(r,!0),i=new Uint16Array(s*n);r+=Uint32Array.BYTES_PER_ELEMENT;let o=Uint16Array.BYTES_PER_ELEMENT,a=s*o,c=r,u=c+a,l=u+a,f=0,h=0,d=0;for(let p=0;p<s;p++)f+=zf(t.getUint16(c+o*p,!0)),h+=zf(t.getUint16(u+o*p,!0)),d+=zf(t.getUint16(l+o*p,!0)),i[p]=f,i[p+s]=h,i[p+s*2]=d;return r+=a*3,{vertexData:i,vertexDataEndPosition:r}}function Ps(t,e,r,n){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i;if(n===2?i=new Uint16Array(t,e,r):i=new Uint32Array(t,e,r),!s)return i;let o=0;for(let a=0;a<i.length;++a){let c=i[a];i[a]=o-c,c===0&&++o}return i}function b2(t,e,r){let n=r,s=3,o=e.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;n%o!==0&&(n+=o-n%o);let a=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let c=a*3,u=Ps(t.buffer,n,c,o);return n+=c*o,{triangleIndicesEndPosition:n,triangleIndices:u}}function T2(t,e,r){let n=r,s=3,o=e.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,a=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let c=Ps(t.buffer,n,a,o,!1);n+=a*o;let u=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let l=Ps(t.buffer,n,u,o,!1);n+=u*o;let f=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let h=Ps(t.buffer,n,f,o,!1);n+=f*o;let d=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let p=Ps(t.buffer,n,d,o,!1);return n+=d*o,{edgeIndicesEndPosition:n,westIndices:c,southIndices:l,eastIndices:h,northIndices:p}}function E2(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function w2(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}function S2(t,e){let r={};if(t.byteLength<=e)return{extensions:r,extensionsEndPosition:e};let n=e;for(;n<t.byteLength;){let s=t.getUint8(n,!0);n+=Uint8Array.BYTES_PER_ELEMENT;let i=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let o=new DataView(t.buffer,n,i);switch(s){case 1:{r.vertexNormals=E2(o);break}case 2:{r.waterMask=w2(o);break}default:}n+=i}return{extensions:r,extensionsEndPosition:n}}var kr={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},B2={maxDecodingStep:kr.extensions};function jf(t,e){let r=Object.assign({},B2,e),n=new DataView(t),{header:s,headerEndPosition:i}=v2(n);if(r.maxDecodingStep<kr.vertices)return{header:s};let{vertexData:o,vertexDataEndPosition:a}=x2(n,i);if(r.maxDecodingStep<kr.triangleIndices)return{header:s,vertexData:o};let{triangleIndices:c,triangleIndicesEndPosition:u}=b2(n,o,a);if(r.maxDecodingStep<kr.edgeIndices)return{header:s,vertexData:o,triangleIndices:c};let{westIndices:l,southIndices:f,eastIndices:h,northIndices:d,edgeIndicesEndPosition:p}=T2(n,o,u);if(r.maxDecodingStep<kr.extensions)return{header:s,vertexData:o,triangleIndices:c,westIndices:l,northIndices:d,eastIndices:h,southIndices:f};let{extensions:g}=S2(n,p);return{header:s,vertexData:o,triangleIndices:c,westIndices:l,northIndices:d,eastIndices:h,southIndices:f,extensions:g}}function wa(t,e,r,n){let s=n?M2(n,t.POSITION.value):C2(e),i=new t.POSITION.value.constructor(s.length*6),o=new t.TEXCOORD_0.value.constructor(s.length*4),a=new e.constructor(s.length*6);for(let u=0;u<s.length;u++){let l=s[u];I2({edge:l,edgeIndex:u,attributes:t,skirtHeight:r,newPosition:i,newTexcoord0:o,newTriangles:a})}t.POSITION.value=Vn(t.POSITION.value,i),t.TEXCOORD_0.value=Vn(t.TEXCOORD_0.value,o);let c=e instanceof Array?e.concat(a):Vn(e,a);return{attributes:t,triangles:c}}function C2(t){let e=[];for(let o=0;o<t.length;o+=3)e.push([t[o],t[o+1]]),e.push([t[o+1],t[o+2]]),e.push([t[o+2],t[o]]);e.sort((o,a)=>Math.min(...o)-Math.min(...a)||Math.max(...o)-Math.max(...a));let r=[],n=0;for(;n<e.length;){var s,i;e[n][0]===((s=e[n+1])===null||s===void 0?void 0:s[1])&&e[n][1]===((i=e[n+1])===null||i===void 0?void 0:i[0])?n+=2:(r.push(e[n]),n++)}return r}function M2(t,e){t.westIndices.sort((n,s)=>e[3*n+1]-e[3*s+1]),t.eastIndices.sort((n,s)=>e[3*s+1]-e[3*n+1]),t.southIndices.sort((n,s)=>e[3*s]-e[3*n]),t.northIndices.sort((n,s)=>e[3*n]-e[3*s]);let r=[];for(let n in t){let s=t[n];for(let i=0;i<s.length-1;i++)r.push([s[i],s[i+1]])}return r}function I2(t){let{edge:e,edgeIndex:r,attributes:n,skirtHeight:s,newPosition:i,newTexcoord0:o,newTriangles:a}=t,c=n.POSITION.value.length,u=r*2,l=r*2+1;i.set(n.POSITION.value.subarray(e[0]*3,e[0]*3+3),u*3),i[u*3+2]=i[u*3+2]-s,i.set(n.POSITION.value.subarray(e[1]*3,e[1]*3+3),l*3),i[l*3+2]=i[l*3+2]-s,o.set(n.TEXCOORD_0.value.subarray(e[0]*2,e[0]*2+2),u*2),o.set(n.TEXCOORD_0.value.subarray(e[1]*2,e[1]*2+2),l*2);let f=r*2*3;a[f]=e[0],a[f+1]=c/3+l,a[f+2]=e[1],a[f+3]=c/3+l,a[f+4]=e[0],a[f+5]=c/3+u}function qf(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{bounds:r}=e,{header:n,vertexData:s,triangleIndices:i,westIndices:o,northIndices:a,eastIndices:c,southIndices:u}=jf(t,kr.triangleIndices),l=i,f=O2(s,n,r),h=Lr(f);if(e!=null&&e.skirtHeight){let{attributes:d,triangles:p}=wa(f,l,e.skirtHeight,{westIndices:o,northIndices:a,eastIndices:c,southIndices:u});f=d,l=p}return{loaderData:{header:{}},header:{vertexCount:l.length,boundingBox:h},schema:void 0,topology:"triangle-list",mode:4,indices:{value:l,size:1},attributes:f}}function O2(t,e,r){let{minHeight:n,maxHeight:s}=e,[i,o,a,c]=r||[0,0,1,1],u=a-i,l=c-o,f=s-n,h=t.length/3,d=new Float32Array(h*3),p=new Float32Array(h*2);for(let g=0;g<h;g++){let m=t[g]/32767,A=t[g+h]/32767,v=t[g+h*2]/32767;d[3*g+0]=m*u+i,d[3*g+1]=A*l+o,d[3*g+2]=v*f+n,p[2*g+0]=m,p[2*g+1]=A}return{POSITION:{value:d,size:3},TEXCOORD_0:{value:p,size:2}}}var Fs=class{constructor(e=257){this.gridSize=e;let r=e-1;if(r&r-1)throw new Error(`Expected grid size to be 2^n+1, got ${e}.`);this.numTriangles=r*r*2-2,this.numParentTriangles=this.numTriangles-r*r,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let n=0;n<this.numTriangles;n++){let s=n+2,i=0,o=0,a=0,c=0,u=0,l=0;for(s&1?a=c=u=r:i=o=l=r;(s>>=1)>1;){let h=i+a>>1,d=o+c>>1;s&1?(a=i,c=o,i=u,o=l):(i=a,o=c,a=u,c=l),u=h,l=d}let f=n*4;this.coords[f+0]=i,this.coords[f+1]=o,this.coords[f+2]=a,this.coords[f+3]=c}}createTile(e){return new Jf(e,this)}},Jf=class{constructor(e,r){let n=r.gridSize;if(e.length!==n*n)throw new Error(`Expected terrain data of length ${n*n} (${n} x ${n}), got ${e.length}.`);this.terrain=e,this.martini=r,this.errors=new Float32Array(e.length),this.update()}update(){let{numTriangles:e,numParentTriangles:r,coords:n,gridSize:s}=this.martini,{terrain:i,errors:o}=this;for(let a=e-1;a>=0;a--){let c=a*4,u=n[c+0],l=n[c+1],f=n[c+2],h=n[c+3],d=u+f>>1,p=l+h>>1,g=d+p-l,m=p+u-d,A=(i[l*s+u]+i[h*s+f])/2,v=p*s+d,x=Math.abs(A-i[v]);if(o[v]=Math.max(o[v],x),a<r){let b=(l+m>>1)*s+(u+g>>1),M=(h+m>>1)*s+(f+g>>1);o[v]=Math.max(o[v],o[b],o[M])}}}getMesh(e=0){let{gridSize:r,indices:n}=this.martini,{errors:s}=this,i=0,o=0,a=r-1;n.fill(0);function c(d,p,g,m,A,v){let x=d+g>>1,b=p+m>>1;Math.abs(d-A)+Math.abs(p-v)>1&&s[b*r+x]>e?(c(A,v,d,p,x,b),c(g,m,A,v,x,b)):(n[p*r+d]=n[p*r+d]||++i,n[m*r+g]=n[m*r+g]||++i,n[v*r+A]=n[v*r+A]||++i,o++)}c(0,0,a,a,a,0),c(a,a,0,0,0,a);let u=new Uint16Array(i*2),l=new Uint32Array(o*3),f=0;function h(d,p,g,m,A,v){let x=d+g>>1,b=p+m>>1;if(Math.abs(d-A)+Math.abs(p-v)>1&&s[b*r+x]>e)h(A,v,d,p,x,b),h(g,m,A,v,x,b);else{let M=n[p*r+d]-1,C=n[m*r+g]-1,I=n[v*r+A]-1;u[2*M]=d,u[2*M+1]=p,u[2*C]=g,u[2*C+1]=m,u[2*I]=A,u[2*I+1]=v,l[f++]=M,l[f++]=C,l[f++]=I}}return h(0,0,a,a,a,0),h(a,a,0,0,0,a),{vertices:u,triangles:l}}};var Ns=class{constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r;this.data=e,this.width=r,this.height=n,this.coords=[],this.triangles=[],this._halfedges=[],this._candidates=[],this._queueIndices=[],this._queue=[],this._errors=[],this._rms=[],this._pending=[],this._pendingLen=0,this._rmsSum=0;let s=r-1,i=n-1,o=this._addPoint(0,0),a=this._addPoint(s,0),c=this._addPoint(0,i),u=this._addPoint(s,i),l=this._addTriangle(u,o,c,-1,-1,-1);this._addTriangle(o,u,a,l,-1,-1),this._flush()}run(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;for(;this.getMaxError()>e;)this.refine()}refine(){this._step(),this._flush()}getMaxError(){return this._errors[0]}getRMSD(){return this._rmsSum>0?Math.sqrt(this._rmsSum/(this.width*this.height)):0}heightAt(e,r){return this.data[this.width*r+e]}_flush(){let e=this.coords;for(let r=0;r<this._pendingLen;r++){let n=this._pending[r],s=2*this.triangles[n*3+0],i=2*this.triangles[n*3+1],o=2*this.triangles[n*3+2];this._findCandidate(e[s],e[s+1],e[i],e[i+1],e[o],e[o+1],n)}this._pendingLen=0}_findCandidate(e,r,n,s,i,o,a){let c=Math.min(e,n,i),u=Math.min(r,s,o),l=Math.max(e,n,i),f=Math.max(r,s,o),h=Hr(n,s,i,o,c,u),d=Hr(i,o,e,r,c,u),p=Hr(e,r,n,s,c,u),g=s-r,m=e-n,A=o-s,v=n-i,x=r-o,b=i-e,M=Hr(e,r,n,s,i,o),C=this.heightAt(e,r)/M,I=this.heightAt(n,s)/M,B=this.heightAt(i,o)/M,S=0,y=0,R=0,P=0;for(let F=u;F<=f;F++){let N=0;h<0&&A!==0&&(N=Math.max(N,Math.floor(-h/A))),d<0&&x!==0&&(N=Math.max(N,Math.floor(-d/x))),p<0&&g!==0&&(N=Math.max(N,Math.floor(-p/g)));let G=h+A*N,Q=d+x*N,J=p+g*N,ne=!1;for(let Z=c+N;Z<=l;Z++){if(G>=0&&Q>=0&&J>=0){ne=!0;let $=C*G+I*Q+B*J,oe=Math.abs($-this.heightAt(Z,F));P+=oe*oe,oe>S&&(S=oe,y=Z,R=F)}else if(ne)break;G+=A,Q+=x,J+=g}h+=v,d+=b,p+=m}(y===e&&R===r||y===n&&R===s||y===i&&R===o)&&(S=0),this._candidates[2*a]=y,this._candidates[2*a+1]=R,this._rms[a]=P,this._queuePush(a,S,P)}_step(){let e=this._queuePop(),r=e*3+0,n=e*3+1,s=e*3+2,i=this.triangles[r],o=this.triangles[n],a=this.triangles[s],c=this.coords[2*i],u=this.coords[2*i+1],l=this.coords[2*o],f=this.coords[2*o+1],h=this.coords[2*a],d=this.coords[2*a+1],p=this._candidates[2*e],g=this._candidates[2*e+1],m=this._addPoint(p,g);if(Hr(c,u,l,f,p,g)===0)this._handleCollinear(m,r);else if(Hr(l,f,h,d,p,g)===0)this._handleCollinear(m,n);else if(Hr(h,d,c,u,p,g)===0)this._handleCollinear(m,s);else{let A=this._halfedges[r],v=this._halfedges[n],x=this._halfedges[s],b=this._addTriangle(i,o,m,A,-1,-1,r),M=this._addTriangle(o,a,m,v,-1,b+1),C=this._addTriangle(a,i,m,x,b+2,M+1);this._legalize(b),this._legalize(M),this._legalize(C)}}_addPoint(e,r){let n=this.coords.length>>1;return this.coords.push(e,r),n}_addTriangle(e,r,n,s,i,o){let a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this.triangles.length,c=a/3;return this.triangles[a+0]=e,this.triangles[a+1]=r,this.triangles[a+2]=n,this._halfedges[a+0]=s,this._halfedges[a+1]=i,this._halfedges[a+2]=o,s>=0&&(this._halfedges[s]=a+0),i>=0&&(this._halfedges[i]=a+1),o>=0&&(this._halfedges[o]=a+2),this._candidates[2*c+0]=0,this._candidates[2*c+1]=0,this._queueIndices[c]=-1,this._rms[c]=0,this._pending[this._pendingLen++]=c,a}_legalize(e){let r=this._halfedges[e];if(r<0)return;let n=e-e%3,s=r-r%3,i=n+(e+1)%3,o=n+(e+2)%3,a=s+(r+2)%3,c=s+(r+1)%3,u=this.triangles[o],l=this.triangles[e],f=this.triangles[i],h=this.triangles[a],d=this.coords;if(!R2(d[2*u],d[2*u+1],d[2*l],d[2*l+1],d[2*f],d[2*f+1],d[2*h],d[2*h+1]))return;let p=this._halfedges[i],g=this._halfedges[o],m=this._halfedges[a],A=this._halfedges[c];this._queueRemove(n/3),this._queueRemove(s/3);let v=this._addTriangle(u,h,f,-1,m,p,n),x=this._addTriangle(h,u,l,v,g,A,s);this._legalize(v+1),this._legalize(x+2)}_handleCollinear(e,r){let n=r-r%3,s=n+(r+1)%3,i=n+(r+2)%3,o=this.triangles[i],a=this.triangles[r],c=this.triangles[s],u=this._halfedges[s],l=this._halfedges[i],f=this._halfedges[r];if(f<0){let C=this._addTriangle(e,o,a,-1,l,-1,n),I=this._addTriangle(o,e,c,C,-1,u);this._legalize(C+1),this._legalize(I+2);return}let h=f-f%3,d=h+(f+2)%3,p=h+(f+1)%3,g=this.triangles[d],m=this._halfedges[d],A=this._halfedges[p];this._queueRemove(h/3);let v=this._addTriangle(o,a,e,l,-1,-1,n),x=this._addTriangle(a,g,e,A,-1,v+1,h),b=this._addTriangle(g,c,e,m,-1,x+1),M=this._addTriangle(c,o,e,u,v+2,b+1);this._legalize(v),this._legalize(x),this._legalize(b),this._legalize(M)}_queuePush(e,r,n){let s=this._queue.length;this._queueIndices[e]=s,this._queue.push(e),this._errors.push(r),this._rmsSum+=n,this._queueUp(s)}_queuePop(){let e=this._queue.length-1;return this._queueSwap(0,e),this._queueDown(0,e),this._queuePopBack()}_queuePopBack(){let e=this._queue.pop();return this._errors.pop(),this._rmsSum-=this._rms[e],this._queueIndices[e]=-1,e}_queueRemove(e){let r=this._queueIndices[e];if(r<0){let s=this._pending.indexOf(e);if(s!==-1)this._pending[s]=this._pending[--this._pendingLen];else throw new Error("Broken triangulation (something went wrong).");return}let n=this._queue.length-1;n!==r&&(this._queueSwap(r,n),this._queueDown(r,n)||this._queueUp(r)),this._queuePopBack()}_queueLess(e,r){return this._errors[e]>this._errors[r]}_queueSwap(e,r){let n=this._queue[e],s=this._queue[r];this._queue[e]=s,this._queue[r]=n,this._queueIndices[n]=r,this._queueIndices[s]=e;let i=this._errors[e];this._errors[e]=this._errors[r],this._errors[r]=i}_queueUp(e){let r=e;for(;;){let n=r-1>>1;if(n===r||!this._queueLess(r,n))break;this._queueSwap(n,r),r=n}}_queueDown(e,r){let n=e;for(;;){let s=2*n+1;if(s>=r||s<0)break;let i=s+1,o=s;if(i<r&&this._queueLess(i,s)&&(o=i),!this._queueLess(o,n))break;this._queueSwap(n,o),n=o}return n>e}};function Hr(t,e,r,n,s,i){return(r-s)*(e-i)-(n-i)*(t-s)}function R2(t,e,r,n,s,i,o,a){let c=t-o,u=e-a,l=r-o,f=n-a,h=s-o,d=i-a,p=c*c+u*u,g=l*l+f*f,m=h*h+d*d;return c*(f*m-g*d)-u*(l*m-g*h)+p*(l*d-f*h)<0}function x_(t,e){let{meshMaxError:r,bounds:n,elevationDecoder:s}=e,{data:i,width:o,height:a}=t,c,u;switch(e.tesselator){case"martini":c=Sa(i,o,a,s,e.tesselator),u=A_(r,o,c);break;case"delatin":c=Sa(i,o,a,s,e.tesselator),u=v_(r,o,a,c);break;default:o===a&&!(a&o-1)?(c=Sa(i,o,a,s,"martini"),u=A_(r,o,c)):(c=Sa(i,o,a,s,"delatin"),u=v_(r,o,a,c));break}let{vertices:l}=u,{triangles:f}=u,h=L2(l,c,o,a,n),d=Lr(h);if(e.skirtHeight){let{attributes:p,triangles:g}=wa(h,f,e.skirtHeight);h=p,f=g}return{loaderData:{header:{}},header:{vertexCount:f.length,boundingBox:d},mode:4,indices:{value:Uint32Array.from(f),size:1},attributes:h}}function A_(t,e,r){let n=e+1,i=new Fs(n).createTile(r),{vertices:o,triangles:a}=i.getMesh(t);return{vertices:o,triangles:a}}function v_(t,e,r,n){let s=new Ns(n,e+1,r+1);s.run(t);let{coords:i,triangles:o}=s;return{vertices:i,triangles:o}}function Sa(t,e,r,n,s){let{rScaler:i,bScaler:o,gScaler:a,offset:c}=n,u=new Float32Array((e+1)*(r+1));for(let l=0,f=0;f<r;f++)for(let h=0;h<e;h++,l++){let d=l*4,p=t[d+0],g=t[d+1],m=t[d+2];u[l+f]=p*i+g*a+m*o+c}if(s==="martini"){for(let l=(e+1)*e,f=0;f<e;f++,l++)u[l]=u[l-e-1];for(let l=r,f=0;f<r+1;f++,l+=r+1)u[l]=u[l-1]}return u}function L2(t,e,r,n,s){let i=r+1,o=t.length/2,a=new Float32Array(o*3),c=new Float32Array(o*2),[u,l,f,h]=s||[0,0,r,n],d=(f-u)/r,p=(h-l)/n;for(let g=0;g<o;g++){let m=t[g*2],A=t[g*2+1],v=A*i+m;a[3*g+0]=m*d+u,a[3*g+1]=-A*p+h,a[3*g+2]=e[v],c[2*g+0]=m/r,c[2*g+1]=A/n}return{POSITION:{value:a,size:3},TEXCOORD_0:{value:c,size:2}}}var Ba="4.1.0-alpha.9";var Ca={name:"Terrain",id:"terrain",module:"terrain",version:Ba,worker:!0,extensions:["png","pngraw","jpg","jpeg","gif","webp","bmp"],mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp"],options:{terrain:{tesselator:"auto",bounds:void 0,meshMaxError:10,elevationDecoder:{rScaler:1,gScaler:0,bScaler:0,offset:0},skirtHeight:void 0}}};var b_={name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:Ba,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var P2={...Ca,parse:F2};async function F2(t,e,r){let n={...e,mimeType:"application/x.image",image:{...e?.image,type:"data"}},s=await Le(t,[],n,r),i={...P2.options.terrain,...e?.terrain};return x_(s,i)}var lq={...b_,parseSync:(t,e)=>qf(t,e?.["quantized-mesh"]),parse:async(t,e)=>qf(t,e?.["quantized-mesh"])};function Ma(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ma=function(r){return typeof r}:Ma=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ma(t)}function T_(t){return U2(t)||D2(t)||B_(t)||N2()}function N2(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
766
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D2(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function U2(t){if(Array.isArray(t))return Wf(t)}function G2(t,e){return V2(t)||H2(t,e)||B_(t,e)||k2()}function k2(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
767
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function B_(t,e){if(t){if(typeof t=="string")return Wf(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Wf(t,e)}}function Wf(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function H2(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(t);!(s=(o=r.next()).done)&&(n.push(o.value),!(e&&n.length===e));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function V2(t){if(Array.isArray(t))return t}function z2(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function j2(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Xf(t,e)}function Xf(t,e){return Xf=Object.setPrototypeOf||function(n,s){return n.__proto__=s,n},Xf(t,e)}function q2(t){var e=X2();return function(){var n=Ia(t),s;if(e){var i=Ia(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return J2(this,s)}}function J2(t,e){if(e&&(Ma(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return W2(t)}function W2(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function X2(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ia(t){return Ia=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ia(t)}function E_(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function lr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?E_(Object(r),!0).forEach(function(n){K2(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):E_(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function K2(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var w_=[1],Y2=lr(lr({},Bt.defaultProps),{},{elevationData:Yt,texture:lr(lr({},Yt),{},{optional:!0}),meshMaxError:{type:"number",value:4},bounds:{type:"array",value:null,optional:!0,compare:!0},color:{type:"color",value:[255,255,255]},elevationDecoder:{type:"object",value:{rScaler:1,gScaler:0,bScaler:0,offset:0}},workerUrl:"",wireframe:!1,material:!0,loaders:[Ca]});function S_(t){return Array.isArray(t)?t.join(";"):t||""}var Ra=function(t){j2(r,t);var e=q2(r);function r(){var s;z2(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return s=e.call.apply(e,[this].concat(o)),s.state=void 0,s}var n=r.prototype;return n.updateState=function(i){var o=i.props,a=i.oldProps,c=o.elevationData!==a.elevationData;if(c){var u=o.elevationData,l=u&&(Array.isArray(u)||u.includes("{x}")&&u.includes("{y}"));this.setState({isTiled:l})}var f=c||o.meshMaxError!==a.meshMaxError||o.elevationDecoder!==a.elevationDecoder||o.bounds!==a.bounds;if(!this.state.isTiled&&f){var h=this.loadTerrain(o);this.setState({terrain:h})}o.workerUrl&&Oa.log.removed("workerUrl","loadOptions.terrain.workerUrl")()},n.loadTerrain=function(i){var o,a=i.elevationData,c=i.bounds,u=i.elevationDecoder,l=i.meshMaxError,f=i.signal;if(!a)return null;var h=this.getLoadOptions();h=lr(lr({},h),{},{terrain:lr(lr({skirtHeight:this.state.isTiled?l*2:0},(o=h)===null||o===void 0?void 0:o.terrain),{},{bounds:c,meshMaxError:l,elevationDecoder:u})});var d=this.props.fetch;return d(a,{propName:"elevationData",layer:this,loadOptions:h,signal:f})},n.getTiledTerrainData=function(i){var o=this.props,a=o.elevationData,c=o.fetch,u=o.texture,l=o.elevationDecoder,f=o.meshMaxError,h=this.context.viewport,d=pt(a,i),p=u&&pt(u,i),g=i.signal,m=[0,0],A=[0,0];if(h.isGeospatial){var v=i.bbox;m=h.projectFlat([v.west,v.south]),A=h.projectFlat([v.east,v.north])}else{var x=i.bbox;m=[x.left,x.bottom],A=[x.right,x.top]}var b=[m[0],m[1],A[0],A[1]],M=this.loadTerrain({elevationData:d,bounds:b,elevationDecoder:l,meshMaxError:f,signal:g}),C=p?c(p,{propName:"texture",layer:this,loaders:[],signal:g}).catch(function(I){return null}):Promise.resolve(null);return Promise.all([M,C])},n.renderSubLayers=function(i){var o=this.getSubLayerClass("mesh",Kf.SimpleMeshLayer),a=this.props,c=a.color,u=a.wireframe,l=a.material,f=i.data;if(!f)return null;var h=G2(f,2),d=h[0],p=h[1];return new o(i,{data:w_,mesh:d,texture:p,_instanced:!1,coordinateSystem:C_.COORDINATE_SYSTEM.CARTESIAN,getPosition:function(m){return[0,0,0]},getColor:c,wireframe:u,material:l})},n.onViewportLoad=function(i){if(i){var o=this.state.zRange,a=i.map(function(l){return l.content}).filter(Boolean).map(function(l){var f=l[0].header.boundingBox;return f.map(function(h){return h[2]})});if(a.length!==0){var c=Math.min.apply(Math,T_(a.map(function(l){return l[0]}))),u=Math.max.apply(Math,T_(a.map(function(l){return l[1]})));(!o||c<o[0]||u>o[1])&&this.setState({zRange:[c,u]})}}},n.renderLayers=function(){var i=this.props,o=i.color,a=i.material,c=i.elevationData,u=i.texture,l=i.wireframe,f=i.meshMaxError,h=i.elevationDecoder,d=i.tileSize,p=i.maxZoom,g=i.minZoom,m=i.extent,A=i.maxRequests,v=i.onTileLoad,x=i.onTileUnload,b=i.onTileError,M=i.maxCacheSize,C=i.maxCacheByteSize,I=i.refinementStrategy;if(this.state.isTiled)return new Bt(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:S_(c),texture:S_(u),meshMaxError:f,elevationDecoder:h}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:d,maxZoom:p,minZoom:g,extent:m,maxRequests:A,onTileLoad:v,onTileUnload:x,onTileError:b,maxCacheSize:M,maxCacheByteSize:C,refinementStrategy:I});var B=this.getSubLayerClass("mesh",Kf.SimpleMeshLayer);return new B(this.getSubLayerProps({id:"mesh"}),{data:w_,mesh:this.state.terrain,texture:u,_instanced:!1,getPosition:function(y){return[0,0,0]},getColor:o,material:a,wireframe:l})},r}(Oa.CompositeLayer);Ra.defaultProps=Y2;Ra.layerName="TerrainLayer";var qa=U(Ze()),mh=U(Ye()),yA=U(I_());var Ds={x:0,y:1,z:2};function Vr(t,e={}){let{start:r=0,end:n=t.length,plane:s="xy"}=e,i=e.size||2,o=0,a=Ds[s[0]],c=Ds[s[1]];for(let u=r,l=n-i;u<n;u+=i)o+=(t[u+a]-t[l+a])*(t[u+c]+t[l+c]),l=u;return o/2}function Zf(t,e,r=2,n,s="xy"){let i=e&&e.length,o=i?e[0]*r:t.length,a=R_(t,0,o,r,!0,n&&n[0],s),c=[];if(!a||a.next===a.prev)return c;let u,l,f,h,d,p,g;if(i&&(a=nO(t,e,a,r,n,s)),t.length>80*r){h=l=t[0],d=f=t[1];for(let m=r;m<o;m+=r)p=t[m],g=t[m+1],p<h&&(h=p),g<d&&(d=g),p>l&&(l=p),g>f&&(f=g);u=Math.max(l-h,f-d),u=u!==0?32767/u:0}return Us(a,c,r,h,d,u,0),c}function R_(t,e,r,n,s,i,o){let a,c;i===void 0&&(i=Vr(t,{start:e,end:r,size:n,plane:o}));let u=Ds[o[0]],l=Ds[o[1]];if(s===i<0)for(a=e;a<r;a+=n)c=O_(a,t[a+u],t[a+l],c);else for(a=r-n;a>=e;a-=n)c=O_(a,t[a+u],t[a+l],c);return c&&Fa(c,c.next)&&(ks(c),c=c.next),c}function zr(t,e){if(!t)return t;e||(e=t);let r=t,n;do if(n=!1,!r.steiner&&(Fa(r,r.next)||ae(r.prev,r,r.next)===0)){if(ks(r),r=e=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==e);return e}function Us(t,e,r,n,s,i,o){if(!t)return;!o&&i&&cO(t,n,s,i);let a=t,c,u;for(;t.prev!==t.next;){if(c=t.prev,u=t.next,i?eO(t,n,s,i):$2(t)){e.push(c.i/r|0),e.push(t.i/r|0),e.push(u.i/r|0),ks(t),t=u.next,a=u.next;continue}if(t=u,t===a){o?o===1?(t=tO(zr(t),e,r),Us(t,e,r,n,s,i,2)):o===2&&rO(t,e,r,n,s,i):Us(zr(t),e,r,n,s,i,1);break}}}function $2(t){let e=t.prev,r=t,n=t.next;if(ae(e,r,n)>=0)return!1;let s=e.x,i=r.x,o=n.x,a=e.y,c=r.y,u=n.y,l=s<i?s<o?s:o:i<o?i:o,f=a<c?a<u?a:u:c<u?c:u,h=s>i?s>o?s:o:i>o?i:o,d=a>c?a>u?a:u:c>u?c:u,p=n.next;for(;p!==e;){if(p.x>=l&&p.x<=h&&p.y>=f&&p.y<=d&&Fn(s,a,i,c,o,u,p.x,p.y)&&ae(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function eO(t,e,r,n){let s=t.prev,i=t,o=t.next;if(ae(s,i,o)>=0)return!1;let a=s.x,c=i.x,u=o.x,l=s.y,f=i.y,h=o.y,d=a<c?a<u?a:u:c<u?c:u,p=l<f?l<h?l:h:f<h?f:h,g=a>c?a>u?a:u:c>u?c:u,m=l>f?l>h?l:h:f>h?f:h,A=Yf(d,p,e,r,n),v=Yf(g,m,e,r,n),x=t.prevZ,b=t.nextZ;for(;x&&x.z>=A&&b&&b.z<=v;){if(x.x>=d&&x.x<=g&&x.y>=p&&x.y<=m&&x!==s&&x!==o&&Fn(a,l,c,f,u,h,x.x,x.y)&&ae(x.prev,x,x.next)>=0||(x=x.prevZ,b.x>=d&&b.x<=g&&b.y>=p&&b.y<=m&&b!==s&&b!==o&&Fn(a,l,c,f,u,h,b.x,b.y)&&ae(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;x&&x.z>=A;){if(x.x>=d&&x.x<=g&&x.y>=p&&x.y<=m&&x!==s&&x!==o&&Fn(a,l,c,f,u,h,x.x,x.y)&&ae(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=v;){if(b.x>=d&&b.x<=g&&b.y>=p&&b.y<=m&&b!==s&&b!==o&&Fn(a,l,c,f,u,h,b.x,b.y)&&ae(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function tO(t,e,r){let n=t;do{let s=n.prev,i=n.next.next;!Fa(s,i)&&L_(s,n,n.next,i)&&Gs(s,i)&&Gs(i,s)&&(e.push(s.i/r|0),e.push(n.i/r|0),e.push(i.i/r|0),ks(n),ks(n.next),n=t=i),n=n.next}while(n!==t);return zr(n)}function rO(t,e,r,n,s,i){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&fO(o,a)){let c=P_(o,a);o=zr(o,o.next),c=zr(c,c.next),Us(o,e,r,n,s,i,0),Us(c,e,r,n,s,i,0);return}a=a.next}o=o.next}while(o!==t)}function nO(t,e,r,n,s,i){let o=[],a,c,u,l,f;for(a=0,c=e.length;a<c;a++)u=e[a]*n,l=a<c-1?e[a+1]*n:t.length,f=R_(t,u,l,n,!1,s&&s[a+1],i),f===f.next&&(f.steiner=!0),o.push(lO(f));for(o.sort(sO),a=0;a<o.length;a++)r=iO(o[a],r);return r}function sO(t,e){return t.x-e.x}function iO(t,e){let r=oO(t,e);if(!r)return e;let n=P_(r,t);return zr(n,n.next),zr(r,r.next)}function oO(t,e){let r=e,n=t.x,s=t.y,i=-1/0,o;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){let h=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(h<=n&&h>i&&(i=h,o=r.x<r.next.x?r:r.next,h===n))return o}r=r.next}while(r!==e);if(!o)return null;let a=o,c=o.x,u=o.y,l=1/0,f;r=o;do n>=r.x&&r.x>=c&&n!==r.x&&Fn(s<u?n:i,s,c,u,s<u?i:n,s,r.x,r.y)&&(f=Math.abs(s-r.y)/(n-r.x),Gs(r,t)&&(f<l||f===l&&(r.x>o.x||r.x===o.x&&aO(o,r)))&&(o=r,l=f)),r=r.next;while(r!==a);return o}function aO(t,e){return ae(t.prev,t,e.prev)<0&&ae(e.next,t,t.next)<0}function cO(t,e,r,n){let s=t;do s.z===0&&(s.z=Yf(s.x,s.y,e,r,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,uO(s)}function uO(t){let e,r,n=1,s,i,o,a,c,u;do{for(i=t,t=null,u=null,s=0;i;){for(s++,a=i,o=0,r=0;r<n&&(o++,a=a.nextZ,!!a);r++);for(c=n;o>0||c>0&&a;)o!==0&&(c===0||!a||i.z<=a.z)?(e=i,i=i.nextZ,o--):(e=a,a=a.nextZ,c--),u?u.nextZ=e:t=e,e.prevZ=u,u=e;i=a}u.nextZ=null,n*=2}while(s>1);return t}function Yf(t,e,r,n,s){return t=(t-r)*s|0,e=(e-n)*s|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function lO(t){let e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function Fn(t,e,r,n,s,i,o,a){return(s-o)*(e-a)>=(t-o)*(i-a)&&(t-o)*(n-a)>=(r-o)*(e-a)&&(r-o)*(i-a)>=(s-o)*(n-a)}function fO(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!hO(t,e)&&(Gs(t,e)&&Gs(e,t)&&dO(t,e)&&(ae(t.prev,t,e.prev)||ae(t,e.prev,e))||Fa(t,e)&&ae(t.prev,t,t.next)>0&&ae(e.prev,e,e.next)>0)}function ae(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Fa(t,e){return t.x===e.x&&t.y===e.y}function L_(t,e,r,n){let s=Pa(ae(t,e,r)),i=Pa(ae(t,e,n)),o=Pa(ae(r,n,t)),a=Pa(ae(r,n,e));return!!(s!==i&&o!==a||s===0&&La(t,r,e)||i===0&&La(t,n,e)||o===0&&La(r,t,n)||a===0&&La(r,e,n))}function La(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Pa(t){return t>0?1:t<0?-1:0}function hO(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&L_(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function Gs(t,e){return ae(t.prev,t,t.next)<0?ae(t,e,t.next)>=0&&ae(t,t.prev,e)>=0:ae(t,e,t.prev)<0||ae(t,t.next,e)<0}function dO(t,e){let r=t,n=!1,s=(t.x+e.x)/2,i=(t.y+e.y)/2;do r.y>i!=r.next.y>i&&r.next.y!==r.y&&s<(r.next.x-r.x)*(i-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==t);return n}function P_(t,e){let r=new Hs(t.i,t.x,t.y),n=new Hs(e.i,e.x,e.y),s=t.next,i=e.prev;return t.next=e,e.prev=t,r.next=s,s.prev=r,n.next=r,r.prev=n,i.next=n,n.prev=i,n}function O_(t,e,r,n){let s=new Hs(t,e,r);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function ks(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}var Hs=class{constructor(e,r,n){D(this,"i",void 0),D(this,"x",void 0),D(this,"y",void 0),D(this,"prev",null),D(this,"next",null),D(this,"z",0),D(this,"prevZ",null),D(this,"nextZ",null),D(this,"steiner",!1),this.i=e,this.x=r,this.y=n}};function eh(t,e,r){let n=_O(t),s=Object.keys(n).filter(i=>n[i]!==Array);return AO(t,{propArrayTypes:n,...e},{numericPropKeys:r&&r.numericPropKeys||s,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function _O(t){let e={};for(let r of t)if(r.properties)for(let n in r.properties){let s=r.properties[n];e[n]=wO(s,e[n])}return e}function AO(t,e,r){let{pointPositionsCount:n,pointFeaturesCount:s,linePositionsCount:i,linePathsCount:o,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:u,polygonRingsCount:l,polygonFeaturesCount:f,propArrayTypes:h,coordLength:d}=e,{numericPropKeys:p=[],PositionDataType:g=Float32Array,triangulate:m=!0}=r,A=t[0]&&"id"in t[0],v=t.length>65535?Uint32Array:Uint16Array,x={type:"Point",positions:new g(n*d),globalFeatureIds:new v(n),featureIds:s>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},b={type:"LineString",pathIndices:i>65535?new Uint32Array(o+1):new Uint16Array(o+1),positions:new g(i*d),globalFeatureIds:new v(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},M={type:"Polygon",polygonIndices:c>65535?new Uint32Array(u+1):new Uint16Array(u+1),primitivePolygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),positions:new g(c*d),globalFeatureIds:new v(c),featureIds:f>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};m&&(M.triangles=[]);for(let I of[x,b,M])for(let B of p){let S=h[B];I.numericProps[B]=new S(I.positions.length/d)}b.pathIndices[o]=i,M.polygonIndices[u]=c,M.primitivePolygonIndices[l]=c;let C={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let I of t){let B=I.geometry,S=I.properties||{};switch(B.type){case"Point":vO(B,x,C,d,S),x.properties.push($f(S,p)),A&&x.fields.push({id:I.id}),C.pointFeature++;break;case"LineString":xO(B,b,C,d,S),b.properties.push($f(S,p)),A&&b.fields.push({id:I.id}),C.lineFeature++;break;case"Polygon":bO(B,M,C,d,S),M.properties.push($f(S,p)),A&&M.fields.push({id:I.id}),C.polygonFeature++;break;default:throw new Error("Invalid geometry type")}C.feature++}return EO(x,b,M,d)}function vO(t,e,r,n,s){e.positions.set(t.data,r.pointPosition*n);let i=t.data.length/n;th(e,s,r.pointPosition,i),e.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+i),e.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+i),r.pointPosition+=i}function xO(t,e,r,n,s){e.positions.set(t.data,r.linePosition*n);let i=t.data.length/n;th(e,s,r.linePosition,i),e.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+i),e.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+i);for(let o=0,a=t.indices.length;o<a;++o){let c=t.indices[o],u=o===a-1?t.data.length:t.indices[o+1];e.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(u-c)/n}}function bO(t,e,r,n,s){e.positions.set(t.data,r.polygonPosition*n);let i=t.data.length/n;th(e,s,r.polygonPosition,i),e.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+i),e.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+i);for(let o=0,a=t.indices.length;o<a;++o){let c=r.polygonPosition;e.polygonIndices[r.polygonObject++]=c;let u=t.areas[o],l=t.indices[o],f=t.indices[o+1];for(let d=0,p=l.length;d<p;++d){let g=l[d],m=d===p-1?f===void 0?t.data.length:f[0]:l[d+1];e.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(m-g)/n}let h=r.polygonPosition;TO(e,u,l,{startPosition:c,endPosition:h,coordLength:n})}}function TO(t,e,r,n){let{startPosition:s,endPosition:i,coordLength:o}=n;if(!t.triangles)return;let a=s*o,c=i*o,u=t.positions.subarray(a,c),l=r[0],f=r.slice(1).map(d=>(d-l)/o),h=Zf(u,f,o,e);for(let d=0,p=h.length;d<p;++d)t.triangles.push(s+h[d])}function Qf(t,e){let r={};for(let n in t)r[n]={value:t[n],size:e};return r}function EO(t,e,r,n){let s={shape:"binary-feature-collection",points:{...t,positions:{value:t.positions,size:n},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Qf(t.numericProps,1)},lines:{...e,positions:{value:e.positions,size:n},pathIndices:{value:e.pathIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Qf(e.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:n},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:Qf(r.numericProps,1)}};return s.polygons&&r.triangles&&(s.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),s}function th(t,e,r,n){for(let s in t.numericProps)if(s in e){let i=e[s];t.numericProps[s].fill(i,r,r+n)}}function $f(t,e){let r={};for(let n in t)e.includes(n)||(r[n]=t[n]);return r}function wO(t,e){return e===Array||!Number.isFinite(t)?Array:e===Float64Array||Math.fround(t)!==t?Float64Array:Float32Array}function Ua(t,e){let r=e?.globalFeatureId;return r!==void 0?SO(t,r):BO(t,e?.type)}function SO(t,e){let r=U_(t);for(let n of r){let s=0,i=n.featureIds.value[0];for(let o=0;o<n.featureIds.value.length;o++){let a=n.featureIds.value[o];if(a!==i){if(e===n.globalFeatureIds.value[s])return Na(n,s,o);s=o,i=a}}if(e===n.globalFeatureIds.value[s])return Na(n,s,n.featureIds.value.length)}throw new Error(`featureId:${e} not found`)}function BO(t,e){let r=U_(t,e);return CO(r)}function D_(t,e,r){switch(t.type){case"Point":return RO(t,e,r);case"LineString":return OO(t,e,r);case"Polygon":return G_(t,e,r);default:let n=t;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function U_(t,e){let r=[];return t.points&&(t.points.type="Point",r.push(t.points)),t.lines&&(t.lines.type="LineString",r.push(t.lines)),t.polygons&&(t.polygons.type="Polygon",r.push(t.polygons)),r}function CO(t){let e=[];for(let r of t){if(r.featureIds.value.length===0)continue;let n=0,s=r.featureIds.value[0];for(let i=0;i<r.featureIds.value.length;i++){let o=r.featureIds.value[i];o!==s&&(e.push(Na(r,n,i)),n=i,s=o)}e.push(Na(r,n,r.featureIds.value.length))}return e}function Na(t,e,r){let n=D_(t,e,r),s=IO(t,e,r),i=MO(t,e,r);return{type:"Feature",geometry:n,properties:s,...i}}function MO(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;return t.fields&&t.fields[t.featureIds.value[e]]}function IO(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0,n=Object.assign({},t.properties[t.featureIds.value[e]]);for(let s in t.numericProps)n[s]=t.numericProps[s].value[e];return n}function G_(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1/0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1/0,{positions:n}=t,s=t.polygonIndices.value.filter(c=>c>=e&&c<=r),i=t.primitivePolygonIndices.value.filter(c=>c>=e&&c<=r);if(!(s.length>2)){let c=[];for(let u=0;u<i.length-1;u++){let l=i[u],f=i[u+1],h=Da(n,l,f);c.push(h)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<s.length-1;c++){let u=s[c],l=s[c+1],f=G_(t,u,l).coordinates;a.push(f)}return{type:"MultiPolygon",coordinates:a}}function OO(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1/0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1/0,{positions:n}=t,s=t.pathIndices.value.filter(a=>a>=e&&a<=r);if(!(s.length>2))return{type:"LineString",coordinates:Da(n,s[0],s[1])};let o=[];for(let a=0;a<s.length-1;a++){let c=Da(n,s[a],s[a+1]);o.push(c)}return{type:"MultiLineString",coordinates:o}}function RO(t,e,r){let{positions:n}=t,s=Da(n,e,r);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function Da(t,e,r){e=e||0,r=r||t.value.length/t.size;let n=[];for(let s=e;s<r;s++){let i=Array();for(let o=s*t.size;o<(s+1)*t.size;o++)i.push(Number(t.value[o]));n.push(i)}return n}var ch=U(J_(),1);function W_(t){let e=t.length;if(e<=1)return[t];let r=[],n,s;for(let i=0;i<e;i++){let o=YO(t[i]);o!==0&&(s===void 0&&(s=o<0),s===o<0?(n&&r.push(n),n=[t[i]]):n&&n.push(t[i]))}return n&&r.push(n),r}function YO(t){let e=0;for(let r=0,n=t.length-1,s,i;r<t.length;n=r++)s=t[r],i=t[n],e+=(i[0]-s[0])*(s[1]+i[1]);return e}function X_(t,e,r){e&&r&&(t===1?e.id=r.readVarint():t===2?ZO(r,e):t===3?e.type=r.readVarint():t===4&&(e._geometry=r.pos))}function ZO(t,e){let r=t.readVarint()+t.pos;for(;t.pos<r;){let n=e._keys[t.readVarint()],s=e._values[t.readVarint()];e.properties[n]=s}}var jr=class{static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(e,r,n,s,i){this.properties=void 0,this.extent=void 0,this.type=void 0,this.id=void 0,this._pbf=void 0,this._geometry=void 0,this._keys=void 0,this._values=void 0,this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=s,this._values=i,e.readFields(X_,this,r)}loadGeometry(){let e=this._pbf;e.pos=this._geometry;let r=e.readVarint()+e.pos,n=1,s=0,i=0,o=0,a=[],c;for(;e.pos<r;){if(s<=0){let u=e.readVarint();n=u&7,s=u>>3}if(s--,n===1||n===2)i+=e.readSVarint(),o+=e.readSVarint(),n===1&&(c&&a.push(c),c=[]),c&&c.push([i,o]);else if(n===7)c&&c.push(c[0].slice());else throw new Error(`unknown command ${n}`)}return c&&a.push(c),a}bbox(){let e=this._pbf;e.pos=this._geometry;let r=e.readVarint()+e.pos,n=1,s=0,i=0,o=0,a=1/0,c=-1/0,u=1/0,l=-1/0;for(;e.pos<r;){if(s<=0){let f=e.readVarint();n=f&7,s=f>>3}if(s--,n===1||n===2)i+=e.readSVarint(),o+=e.readSVarint(),i<a&&(a=i),i>c&&(c=i),o<u&&(u=o),o>l&&(l=o);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,u,c,l]}_toGeoJSON(e){let r=this.loadGeometry(),n=jr.types[this.type],s,i;switch(this.type){case 1:let a=[];for(s=0;s<r.length;s++)a[s]=r[s][0];r=a,e(r,this);break;case 2:for(s=0;s<r.length;s++)e(r[s],this);break;case 3:for(r=W_(r),s=0;s<r.length;s++)for(i=0;i<r[s].length;i++)e(r[s][i],this);break}r.length===1?r=r[0]:n=`Multi${n}`;let o={type:"Feature",geometry:{type:n,coordinates:r},properties:this.properties};return this.id!==null&&(o.id=this.id),o}toGeoJSON(e){if(typeof e=="function")return this._toGeoJSON(e);let{x:r,y:n,z:s}=e,i=this.extent*Math.pow(2,s),o=this.extent*r,a=this.extent*n;function c(u){for(let l=0;l<u.length;l++){let f=u[l];f[0]=(f[0]+o)*360/i-180;let h=180-(f[1]+a)*360/i;f[1]=360/Math.PI*Math.atan(Math.exp(h*Math.PI/180))-90}}return this._toGeoJSON(c)}};var Vs=class{constructor(e,r){this.version=void 0,this.name=void 0,this.extent=void 0,this.length=void 0,this._pbf=void 0,this._keys=void 0,this._values=void 0,this._features=void 0,this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(QO,this,r),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let r=this._pbf.readVarint()+this._pbf.pos;return new jr(this._pbf,r,this.extent,this._keys,this._values)}};function QO(t,e,r){e&&r&&(t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push($O(r)))}function $O(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let n=t.readVarint()>>3;e=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null}return e}var zs=class{constructor(e,r){this.layers=void 0,this.layers=e.readFields(eR,{},r)}};function eR(t,e,r){if(t===3&&r){let n=new Vs(r,r.readVarint()+r.pos);n.length&&e&&(e[n.name]=n)}}function K_(t){let e=t.indices.length,r="Polygon";if(e<=1)return{type:r,data:t.data,areas:[[Vr(t.data)]],indices:[t.indices]};let n=[],s=[],i=[],o=[],a,c=0;for(let u,l=0,f;l<e;l++){f=t.indices[l]-c,u=t.indices[l+1]-c||t.data.length;let h=t.data.slice(f,u),d=Vr(h);if(d===0){let p=t.data.slice(0,f),g=t.data.slice(u);t.data=p.concat(g),c+=u-f;continue}a===void 0&&(a=d<0),a===d<0?(o.length&&(n.push(i),s.push(o)),o=[f],i=[d]):(i.push(d),o.push(f))}return i&&n.push(i),o.length&&s.push(o),{type:r,areas:n,indices:s,data:t.data}}function Y_(t,e,r,n){for(let s=0,i=t.length;s<i;s+=2){t[s]=(t[s]+e)*360/n-180;let o=180-(t[s+1]+r)*360/n;t[s+1]=360/Math.PI*Math.atan(Math.exp(o*Math.PI/180))-90}}function Z_(t,e,r){e&&r&&(t===1?e.id=r.readVarint():t===2?tR(r,e):t===3?e.type=r.readVarint():t===4&&(e._geometry=r.pos))}function tR(t,e){let r=t.readVarint()+t.pos;for(;t.pos<r;){let n=e._keys[t.readVarint()],s=e._values[t.readVarint()];e.properties[n]=s}}var Q_,qr,sh,Ha,ih,oh,js;var qs=class{constructor(e,r,n,s,i,o){this.properties=void 0,this.extent=void 0,this.type=void 0,this.id=void 0,this._pbf=void 0,this._geometry=void 0,this._keys=void 0,this._values=void 0,this._geometryInfo=void 0,this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=s,this._values=i,this._geometryInfo=o,e.readFields(Z_,this,r)}loadGeometry(){let e=this._pbf;e.pos=this._geometry,Q_=e.readVarint()+e.pos,qr=1,Ha=0,ih=0,oh=0,js=0;let r=[],n=[];for(;e.pos<Q_;)if(Ha<=0&&(sh=e.readVarint(),qr=sh&7,Ha=sh>>3),Ha--,qr===1||qr===2)ih+=e.readSVarint(),oh+=e.readSVarint(),qr===1&&r.push(js),n.push(ih,oh),js+=2;else if(qr===7){if(js>0){let s=r[r.length-1];n.push(n[s],n[s+1]),js+=2}}else throw new Error(`unknown command ${qr}`);return{data:n,indices:r}}_toBinaryCoordinates(e){let r=this.loadGeometry(),n;e(r.data,this);let s=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=r.indices.length,n={type:"Point",...r};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=r.indices.length,this._geometryInfo.linePositionsCount+=r.data.length/s,n={type:"LineString",...r};break;case 3:n=K_(r),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=n.indices.length;for(let o of n.indices)this._geometryInfo.polygonRingsCount+=o.length;this._geometryInfo.polygonPositionsCount+=n.data.length/s;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:n,properties:this.properties};return this.id!==null&&(i.id=this.id),i}toBinaryCoordinates(e){if(typeof e=="function")return this._toBinaryCoordinates(e);let{x:r,y:n,z:s}=e,i=this.extent*Math.pow(2,s),o=this.extent*r,a=this.extent*n;return this._toBinaryCoordinates(c=>Y_(c,o,a,i))}};var Js=class{constructor(e,r){this.version=void 0,this.name=void 0,this.extent=void 0,this.length=void 0,this._pbf=void 0,this._keys=void 0,this._values=void 0,this._features=void 0,this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(rR,this,r),this.length=this._features.length}feature(e,r){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let n=this._pbf.readVarint()+this._pbf.pos;return new qs(this._pbf,n,this.extent,this._keys,this._values,r)}};function rR(t,e,r){e&&r&&(t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(nR(r)))}function nR(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let n=t.readVarint()>>3;e=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null}return e}var Ws=class{constructor(e,r){this.layers=void 0,this.layers=e.readFields(sR,{},r)}};function sR(t,e,r){if(t===3&&r){let n=new Js(r,r.readVarint()+r.pos);n.length&&e&&(e[n.name]=n)}}function Va(t,e){var r,n;let s=oR(e),i=(e==null||(r=e.gis)===null||r===void 0?void 0:r.format)||(e==null||(n=e.mvt)===null||n===void 0?void 0:n.shape)||e?.shape;switch(i){case"columnar-table":return{shape:"columnar-table",data:ah(t,s)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:$_(t,s)};case"geojson":return $_(t,s);case"binary-geometry":return ah(t,s);case"binary":return ah(t,s);default:throw new Error(i||"undefined shape")}}function ah(t,e){let[r,n]=iR(t,e),s=eh(r,n);return s.byteLength=t.byteLength,s}function iR(t,e){let r=[],n={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(t.byteLength<=0)return[r,n];let s=new Ws(new ch.default(t));return(e&&Array.isArray(e.layers)?e.layers:Object.keys(s.layers)).forEach(o=>{let a=s.layers[o];if(a)for(let c=0;c<a.length;c++){let u=a.feature(c,n),l=cR(u,e,o);r.push(l)}}),[r,n]}function $_(t,e){if(t.byteLength<=0)return[];let r=[],n=new zs(new ch.default(t));return(Array.isArray(e.layers)?e.layers:Object.keys(n.layers)).forEach(i=>{let o=n.layers[i];if(o)for(let a=0;a<o.length;a++){let c=o.feature(a),u=aR(c,e,i);r.push(u)}}),r}function oR(t){var e;if(!(t!=null&&t.mvt))throw new Error("mvt options required");let r=((e=t.mvt)===null||e===void 0?void 0:e.coordinates)==="wgs84",{tileIndex:n}=t.mvt,s=n&&Number.isFinite(n.x)&&Number.isFinite(n.y)&&Number.isFinite(n.z);if(r&&!s)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return t.mvt}function aR(t,e,r){let n=t.toGeoJSON(e.coordinates==="wgs84"?e.tileIndex:uR);return e.layerProperty&&(n.properties[e.layerProperty]=r),n}function cR(t,e,r){let n=t.toBinaryCoordinates(e.coordinates==="wgs84"?e.tileIndex:lR);return e.layerProperty&&n.properties&&(n.properties[e.layerProperty]=r),n}function uR(t,e){let{extent:r}=e;for(let n=0;n<t.length;n++){let s=t[n];s[0]/=r,s[1]/=r}}function lR(t,e){let{extent:r}=e;for(let n=0,s=t.length;n<s;++n)t[n]/=r}var fR="4.1.0-alpha.9",za={name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:fR,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:null}}},hR={...za,parse:async(t,e)=>Va(t,e),parseSync:Va,binary:!0};function eA(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function tA(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?eA(Object(r),!0).forEach(function(n){dR(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):eA(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function dR(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function rA(t,e){return yR(t)||gR(t,e)||mR(t,e)||pR()}function pR(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
768
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mR(t,e){if(t){if(typeof t=="string")return nA(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nA(t,e)}}function nA(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function gR(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(t);!(s=(o=r.next()).done)&&(n.push(o.value),!(e&&n.length===e));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function yR(t){if(Array.isArray(t))return t}var _R={Point:sA,MultiPoint:AR,LineString:iA,MultiLineString:vR,Polygon:oA,MultiPolygon:xR};function sA(t,e,r){var n=rA(t,2),s=n[0],i=n[1],o=rA(e,2),a=o[0],c=o[1],u=jt(a[0],c[0],s),l=jt(a[1],c[1],i);return r.unprojectFlat([u,l])}function uh(t,e,r){return t.map(function(n){return sA(n,e,r)})}function AR(t,e,r){return uh(t,e,r)}function iA(t,e,r){return uh(t,e,r)}function vR(t,e,r){return t.map(function(n){return iA(n,e,r)})}function oA(t,e,r){return t.map(function(n){return uh(n,e,r)})}function xR(t,e,r){return t.map(function(n){return oA(n,e,r)})}function aA(t,e,r){var n=r.projectFlat([e.west,e.north]),s=r.projectFlat([e.east,e.south]),i=[n,s];return tA(tA({},t),{},{coordinates:_R[t.type](t.coordinates,i,r)})}function bR(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=TR(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,s=function(){};return{s,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
769
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return i=u.done,u},e:function(u){o=!0,a=u},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function TR(t,e){if(t){if(typeof t=="string")return cA(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return cA(t,e)}}function cA(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var ER=["points","lines","polygons"];function lh(t,e,r,n){var s=bR(ER),i;try{for(s.s();!(i=s.n()).done;){var o=i.value,a=t[o]&&wR(t[o],e,r,n);if(a>=0)return a}}catch(c){s.e(c)}finally{s.f()}return-1}function wR(t,e,r,n){var s=t.featureIds.value;if(!s.length)return-1;var i=0,o=s[s.length-1]+1;if(n){var a=SR(t,n);if(a)i=a[0],o=a[1]+1;else return-1}var c=-1;if(e in t.numericProps){var u=t.numericProps[e].value.findIndex(function(l,f){return l===r&&s[f]>=i&&s[f]<o});return u>=0?t.globalFeatureIds.value[u]:-1}else e?c=uA(t.properties,function(l){return l[e]===r},i,o):t.fields&&(c=uA(t.fields,function(l){return l.id===r},i,o));return c>=0?BR(t,c):-1}function SR(t,e){if(!t.__layers){for(var r={},n=t.properties,s=0;s<n.length;s++){var i=n[s],o=i.layerName;o&&(r[o]?r[o][1]=s:r[o]=[s,s])}t.__layers=r}return t.__layers[e]}function BR(t,e){if(!t.__ids){for(var r=[],n=t.featureIds.value,s=t.globalFeatureIds.value,i=0;i<n.length;i++)r[n[i]]=s[i];t.__ids=r}return t.__ids[e]}function uA(t,e,r,n){for(var s=r;s<n;s++)if(e(t[s],s))return s;return-1}function ja(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ja=function(r){return typeof r}:ja=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ja(t)}function CR(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=gA(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,s=function(){};return{s,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
770
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return i=u.done,u},e:function(u){o=!0,a=u},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function MR(t){return RR(t)||OR(t)||gA(t)||IR()}function IR(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
771
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gA(t,e){if(t){if(typeof t=="string")return dh(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return dh(t,e)}}function OR(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function RR(t){if(Array.isArray(t))return dh(t)}function dh(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function lA(t,e,r,n,s,i,o){try{var a=t[i](o),c=a.value}catch(u){r(u);return}a.done?e(c):Promise.resolve(c).then(n,s)}function LR(t){return function(){var e=this,r=arguments;return new Promise(function(n,s){var i=t.apply(e,r);function o(c){lA(i,n,s,o,a,"next",c)}function a(c){lA(i,n,s,o,a,"throw",c)}o(void 0)})}}function PR(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function fA(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function FR(t,e,r){return e&&fA(t.prototype,e),r&&fA(t,r),t}function xt(t,e,r){return typeof Reflect<"u"&&Reflect.get?xt=Reflect.get:xt=function(s,i,o){var a=NR(s,i);if(a){var c=Object.getOwnPropertyDescriptor(a,i);return c.get?c.get.call(o):c.value}},xt(t,e,r||t)}function NR(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&(t=Ke(t),t!==null););return t}function DR(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ph(t,e)}function ph(t,e){return ph=Object.setPrototypeOf||function(n,s){return n.__proto__=s,n},ph(t,e)}function UR(t){var e=HR();return function(){var n=Ke(t),s;if(e){var i=Ke(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return GR(this,s)}}function GR(t,e){if(e&&(ja(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kR(t)}function kR(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function HR(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ke(t){return Ke=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ke(t)}function hA(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function fr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?hA(Object(r),!0).forEach(function(n){VR(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):hA(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function VR(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var fh=512,zR=fr(fr({},mh.GeoJsonLayer.defaultProps),{},{data:Yt,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[za],binary:!0}),Ja=function(t){DR(r,t);var e=UR(r);function r(){var s;PR(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return s=e.call.apply(e,[this].concat(o)),s.state=void 0,s}var n=r.prototype;return n.initializeState=function(){xt(Ke(r.prototype),"initializeState",this).call(this);var i=this.context.viewport.resolution!==void 0?!1:this.props.binary;this.setState({binary:i,data:null,tileJSON:null})},n.updateState=function(i){var o,a=i.props,c=i.oldProps,u=i.context,l=i.changeFlags;l.dataChanged&&this._updateTileData(),(o=this.state)!==null&&o!==void 0&&o.data&&(xt(Ke(r.prototype),"updateState",this).call(this,{props:a,oldProps:c,context:u,changeFlags:l}),this._setWGS84PropertyForTiles());var f=a.highlightColor;f!==c.highlightColor&&Array.isArray(f)&&this.setState({highlightColor:f})},n._updateTileData=function(){var s=LR(regeneratorRuntime.mark(function o(){var a,c,u,l,f;return regeneratorRuntime.wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(a=this.props.data,c=null,!(typeof a=="string"&&!Tu(a))){d.next=18;break}return u=this.props,l=u.onDataLoad,f=u.fetch,this.setState({data:null,tileJSON:null}),d.prev=5,d.next=8,f(a,{propName:"data",layer:this,loaders:[]});case 8:c=d.sent,d.next=15;break;case 11:d.prev=11,d.t0=d.catch(5),this.raiseError(d.t0,"loading TileJSON"),a=null;case 15:l&&l(c,{propName:"data",layer:this}),d.next=19;break;case 18:a.tilejson&&(c=a);case 19:c&&(a=c.tiles),this.setState({data:a,tileJSON:c});case 21:case"end":return d.stop()}},o,this,[[5,11]])}));function i(){return s.apply(this,arguments)}return i}(),n._getTilesetOptions=function(){var i=xt(Ke(r.prototype),"_getTilesetOptions",this).call(this),o=this.state.tileJSON,a=this.props,c=a.minZoom,u=a.maxZoom;return o&&(Number.isFinite(o.minzoom)&&o.minzoom>c&&(i.minZoom=o.minzoom),Number.isFinite(o.maxzoom)&&(!Number.isFinite(u)||o.maxzoom<u)&&(i.maxZoom=o.maxzoom)),i},n.renderLayers=function(){var i;return(i=this.state)!==null&&i!==void 0&&i.data?xt(Ke(r.prototype),"renderLayers",this).call(this):null},n.getTileData=function(i){var o,a=this.state,c=a.data,u=a.binary,l=i.index,f=i.signal,h=pt(c,i);if(!h)return Promise.reject("Invalid URL");var d=this.getLoadOptions(),p=this.props.fetch;return d=fr(fr({},d),{},{mimeType:"application/x-protobuf",mvt:fr(fr({},(o=d)===null||o===void 0?void 0:o.mvt),{},{coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:l}),gis:u?{format:"binary"}:{}}),p(h,{propName:"data",layer:this,loadOptions:d,signal:f})},n.renderSubLayers=function(i){var o=i.tile.index,a=o.x,c=o.y,u=o.z,l=Math.pow(2,u),f=fh/l,h=-f,d=fh*a/l,p=fh*(1-c/l),g=new k().scale([f,h,1]);i.autoHighlight=!1,this.context.viewport.resolution||(i.modelMatrix=g,i.coordinateOrigin=[d,p,0],i.coordinateSystem=qa.COORDINATE_SYSTEM.CARTESIAN,i.extensions=[].concat(MR(i.extensions||[]),[new yA.ClipExtension]));var m=xt(Ke(r.prototype),"renderSubLayers",this).call(this,i);return this.state.binary&&!(m instanceof mh.GeoJsonLayer)&&qa.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),m},n._updateAutoHighlight=function(i){var o=this.props.uniqueIdProperty,a=this.state,c=a.hoveredFeatureId,u=a.hoveredFeatureLayerName,l=i.object,f,h;l&&(f=hh(l,o),h=dA(l));var d=this.props.highlightColor;typeof d=="function"&&(d=d(i)),(c!==f||u!==h)&&this.setState({highlightColor:d,hoveredFeatureId:f,hoveredFeatureLayerName:h})},n.getPickingInfo=function(i){var o=xt(Ke(r.prototype),"getPickingInfo",this).call(this,i),a=Boolean(this.context.viewport.resolution);if(this.state.binary&&o.index!==-1){var c=i.sourceLayer.props.data;o.object=Ua(c,{globalFeatureId:o.index})}return o.object&&!a&&(o.object=mA(o.object,o.tile.bbox,this.context.viewport)),o},n.getSubLayerPropsByTile=function(i){return{highlightedObjectIndex:this.getHighlightedObjectIndex(i),highlightColor:this.state.highlightColor}},n.getHighlightedObjectIndex=function(i){var o=this.state,a=o.hoveredFeatureId,c=o.hoveredFeatureLayerName,u=o.binary,l=this.props,f=l.uniqueIdProperty,h=l.highlightedFeatureId,d=i.content,p=pA(h),g=pA(a)||p;if(!g)return-1;var m=p?h:a;return Array.isArray(d)?d.findIndex(function(A){var v=hh(A,f)===m,x=p||dA(A)===c;return v&&x}):d&&u?lh(d,f,m,p?"":c):-1},n._pickObjects=function(i){var o=this.context,a=o.deck,c=o.viewport,u=c.width,l=c.height,f=c.x,h=c.y,d=[this.id];return a.pickObjects({x:f,y:h,width:u,height:l,layerIds:d,maxObjects:i})},n.getRenderedFeatures=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,o=this._pickObjects(i),a=new Set,c=[],u=CR(o),l;try{for(u.s();!(l=u.n()).done;){var f=l.value,h=hh(f.object,this.props.uniqueIdProperty);h===void 0?c.push(f.object):a.has(h)||(a.add(h),c.push(f.object))}}catch(d){u.e(d)}finally{u.f()}return c},n._setWGS84PropertyForTiles=function(){var i=this,o="dataInWGS84",a=this.state.tileset;a.selectedTiles.forEach(function(c){c.hasOwnProperty(o)||Object.defineProperty(c,o,{get:function(){if(!c.content)return null;if(i.state.binary&&Array.isArray(c.content)&&!c.content.length)return[];var l=c.bbox;if(c._contentWGS84===void 0&&Eu(l)){var f=i.state.binary?Ua(c.content):c.content;c._contentWGS84=f.map(function(h){return mA(h,l,i.context.viewport)})}return c._contentWGS84}})})},FR(r,[{key:"isLoaded",get:function(){return Boolean(this.state&&this.state.data&&this.state.tileset&&xt(Ke(r.prototype),"isLoaded",this))}}]),r}(Bt);Ja.layerName="MVTLayer";Ja.defaultProps=zR;function hh(t,e){if(t.properties&&e)return t.properties[e];if("id"in t)return t.id}function dA(t){var e;return((e=t.properties)===null||e===void 0?void 0:e.layerName)||null}function pA(t){return t!=null&&t!==""}function mA(t,e,r){var n=fr(fr({},t),{},{geometry:{type:t.geometry.type}});return Object.defineProperty(n.geometry,"coordinates",{get:function(){var i=aA(t.geometry,e,r);return i.coordinates}}),n}function jR(t,e){return XR(t)||WR(t,e)||JR(t,e)||qR()}function qR(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
772
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function JR(t,e){if(t){if(typeof t=="string")return _A(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _A(t,e)}}function _A(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function WR(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(t);!(s=(o=r.next()).done)&&(n.push(o.value),!(e&&n.length===e));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function XR(t){if(Array.isArray(t))return t}var AA="0123456789bcdefghjkmnpqrstuvwxyz",vA={};for(Xs=0;Xs<AA.length;Xs++)vA[AA.charAt(Xs)]=Xs;var Xs,KR=-90,YR=90,ZR=-180,QR=180;function $R(t){for(var e=!0,r=YR,n=KR,s=QR,i=ZR,o,a=0,c=0,u=t.length;c<u;c++){var l=t[c].toLowerCase();a=vA[l];for(var f=4;f>=0;f--){var h=a>>f&1;e?(o=(s+i)/2,h===1?i=o:s=o):(o=(r+n)/2,h===1?n=o:r=o),e=!e}}return[n,i,r,s]}function xA(t){var e=$R(t),r=jR(e,4),n=r[0],s=r[1],i=r[2],o=r[3];return[o,i,o,n,s,n,s,i,o,i]}function Wa(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Wa=function(r){return typeof r}:Wa=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Wa(t)}function eL(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tL(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&gh(t,e)}function gh(t,e){return gh=Object.setPrototypeOf||function(n,s){return n.__proto__=s,n},gh(t,e)}function rL(t){var e=iL();return function(){var n=Xa(t),s;if(e){var i=Xa(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return nL(this,s)}}function nL(t,e){if(e&&(Wa(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return sL(t)}function sL(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function iL(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Xa(t){return Xa=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Xa(t)}var oL={getGeohash:{type:"accessor",value:function(e){return e.geohash}}},Ka=function(t){tL(r,t);var e=rL(r);function r(){return eL(this,r),e.apply(this,arguments)}var n=r.prototype;return n.indexToBounds=function(){var i=this.props,o=i.data,a=i.getGeohash;return{data:o,_normalize:!1,positionFormat:"XY",getPolygon:function(u,l){return xA(a(u,l))}}},r}(Ge);Ka.layerName="GeohashLayer";Ka.defaultProps=oL;return MA(Ks);})();
|
|
637
|
+
`;function lE(t){let e=t.positions||t.POSITION,r=e.value.length/e.size;t.COLOR_0||t.colors||(t.colors={size:4,value:new Uint8Array(r*4).fill(255),normalized:!0})}var hE={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},ei=class extends Zu.SimpleMeshLayer{getShaders(){let e=super.getShaders();return e.modules.push(Ka),{...e,vs:Yu,fs:qu}}initializeState(){let{featureIds:e}=this.props;super.initializeState();let r=this.getAttributeManager();e&&r.add({featureIdsPickingColors:{type:ti.UNSIGNED_BYTE,size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})}updateState(e){super.updateState(e);let{props:r,oldProps:n}=e;r.pbrMaterial!==n.pbrMaterial&&this.updatePbrMaterialUniforms(r.pbrMaterial)}draw(e){let{featureIds:r}=this.props;this.state.model&&(this.state.model.setUniforms({u_Camera:this.state.model.uniforms.project_uCameraPosition,pickFeatureIds:Boolean(r)}),super.draw(e))}getModel(e){let{id:r,pbrMaterial:n}=this.props,s=this.parseMaterial(n,e);this.setState({parsedPBRMaterial:s});let i=this.getShaders();return lE(e.attributes),new ju.Model(this.context.device,{...this.getShaders(),id:r,geometry:e,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:{...i.defines,...s?.defines,HAS_UV_REGIONS:e.attributes.uvRegions?1:0},parameters:s?.parameters,isInstanced:!0})}updatePbrMaterialUniforms(e){let{model:r}=this.state;if(r){let{mesh:n}=this.props,s=this.parseMaterial(e,n);this.setState({parsedPBRMaterial:s}),r.setBindings(s.bindings),r.setUniforms(s.uniforms)}}parseMaterial(e,r){let n=Boolean(e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture);return wa(this.context.device,{unlit:n,...e},{NORMAL:r.attributes.normals,TEXCOORD_0:r.attributes.texCoords},{pbrDebug:!1,lights:!0,useTangents:!1})}calculateFeatureIdsPickingColors(e){let r=this.props.featureIds,n=new Uint8ClampedArray(r.length*e.size),s=[];for(let i=0;i<r.length;i++)this.encodePickingColor(r[i],s),n[i*3]=s[0],n[i*3+1]=s[1],n[i*3+2]=s[2];e.value=n}finalizeState(e){super.finalizeState(e),this.state.parsedPBRMaterial?.generatedTextures.forEach(r=>r.destroy()),this.setState({parsedPBRMaterial:null})}},Cn=ei;(()=>{ei.layerName="MeshLayer"})(),(()=>{ei.defaultProps=hE})();var gg=v(Cr(),1);var he=6356752314245179e-9,fE={radii:[6378137,6378137,he],radiiSquared:[6378137*6378137,6378137*6378137,he*he],oneOverRadii:[1/6378137,1/6378137,1/he],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(he*he)],maximumRadius:Math.max(6378137,6378137,he),centerToleranceSquared:.1};function ri(t){return t}var $b=new m;function uE(t,e=[],r=ri){return"longitude"in t?(e[0]=r(t.longitude),e[1]=r(t.latitude),e[2]=t.height):"x"in t?(e[0]=r(t.x),e[1]=r(t.y),e[2]=t.z):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}function $u(t,e=[]){return uE(t,e,j._cartographicRadians?ri:Vo)}function dE(t,e,r=ri){return"longitude"in e?(e.longitude=r(t[0]),e.latitude=r(t[1]),e.height=t[2]):"x"in e?(e.x=r(t[0]),e.y=r(t[1]),e.z=t[2]):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}function td(t,e){return dE(t,e,j._cartographicRadians?ri:Xo)}var ed=1e-14,pE=new m,rd={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},Ja={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Bn={east:new m,north:new m,up:new m,west:new m,south:new m,down:new m},gE=new m,AE=new m,_E=new m;function Ya(t,e,r,n,s,i){let o=rd[e]&&rd[e][r];ct(o&&(!n||n===o));let a,c,l,h=pE.copy(s);if(At(h.x,0,ed)&&At(h.y,0,ed)){let u=Math.sign(h.z);a=gE.fromArray(Ja[e]),e!=="east"&&e!=="west"&&a.scale(u),c=AE.fromArray(Ja[r]),r!=="east"&&r!=="west"&&c.scale(u),l=_E.fromArray(Ja[n]),n!=="east"&&n!=="west"&&l.scale(u)}else{let{up:u,east:d,north:p}=Bn;d.set(-h.y,h.x,0).normalize(),t.geodeticSurfaceNormal(h,u),p.copy(u).cross(d);let{down:_,west:A,south:T}=Bn;_.copy(u).scale(-1),A.copy(d).scale(-1),T.copy(p).scale(-1),a=Bn[e],c=Bn[r],l=Bn[n]}return i[0]=a.x,i[1]=a.y,i[2]=a.z,i[3]=0,i[4]=c.x,i[5]=c.y,i[6]=c.z,i[7]=0,i[8]=l.x,i[9]=l.y,i[10]=l.z,i[11]=0,i[12]=h.x,i[13]=h.y,i[14]=h.z,i[15]=1,i}var Br=new m,mE=new m,TE=new m;function nd(t,e,r=[]){let{oneOverRadii:n,oneOverRadiiSquared:s,centerToleranceSquared:i}=e;Br.from(t);let o=Br.x,a=Br.y,c=Br.z,l=n.x,h=n.y,f=n.z,u=o*o*l*l,d=a*a*h*h,p=c*c*f*f,_=u+d+p,A=Math.sqrt(1/_);if(!Number.isFinite(A))return;let T=mE;if(T.copy(t).scale(A),_<i)return T.to(r);let x=s.x,R=s.y,S=s.z,B=TE;B.set(T.x*x*2,T.y*R*2,T.z*S*2);let M=(1-A)*Br.len()/(.5*B.len()),F=0,C,E,g,y;do{M-=F,C=1/(1+M*x),E=1/(1+M*R),g=1/(1+M*S);let O=C*C,b=E*E,N=g*g,U=O*C,Y=b*E,W=N*g;y=u*O+d*b+p*N-1;let J=-2*(u*U*x+d*Y*R+p*W*S);F=y/J}while(Math.abs(y)>Ht.EPSILON12);return Br.scale([C,E,g]).to(r)}var ni=new m,sd=new m,xE=new m,zt=new m,SE=new m,si=new m,L=class{constructor(e=0,r=0,n=0){P(this,"radii",void 0),P(this,"radiiSquared",void 0),P(this,"radiiToTheFourth",void 0),P(this,"oneOverRadii",void 0),P(this,"oneOverRadiiSquared",void 0),P(this,"minimumRadius",void 0),P(this,"maximumRadius",void 0),P(this,"centerToleranceSquared",Ht.EPSILON1),P(this,"squaredXOverSquaredZ",void 0),ct(e>=0),ct(r>=0),ct(n>=0),this.radii=new m(e,r,n),this.radiiSquared=new m(e*e,r*r,n*n),this.radiiToTheFourth=new m(e*e*e*e,r*r*r*r,n*n*n*n),this.oneOverRadii=new m(e===0?0:1/e,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new m(e===0?0:1/(e*e),r===0?0:1/(r*r),n===0?0:1/(n*n)),this.minimumRadius=Math.min(e,r,n),this.maximumRadius=Math.max(e,r,n),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(e){return this===e||Boolean(e&&this.radii.equals(e.radii))}toString(){return this.radii.toString()}cartographicToCartesian(e,r=[0,0,0]){let n=sd,s=xE,[,,i]=e;this.geodeticSurfaceNormalCartographic(e,n),s.copy(this.radiiSquared).scale(n);let o=Math.sqrt(n.dot(s));return s.scale(1/o),n.scale(i),s.add(n),s.to(r)}cartesianToCartographic(e,r=[0,0,0]){si.from(e);let n=this.scaleToGeodeticSurface(si,zt);if(!n)return;let s=this.geodeticSurfaceNormal(n,sd),i=SE;i.copy(si).subtract(n);let o=Math.atan2(s.y,s.x),a=Math.asin(s.z),c=Math.sign(_r.dot(i,si))*_r.length(i);return td([o,a,c],r)}eastNorthUpToFixedFrame(e,r=new D){return Ya(this,"east","north","up",e,r)}localFrameToFixedFrame(e,r,n,s,i=new D){return Ya(this,e,r,n,s,i)}geocentricSurfaceNormal(e,r=[0,0,0]){return ni.from(e).normalize().to(r)}geodeticSurfaceNormalCartographic(e,r=[0,0,0]){let n=$u(e),s=n[0],i=n[1],o=Math.cos(i);return ni.set(o*Math.cos(s),o*Math.sin(s),Math.sin(i)).normalize(),ni.to(r)}geodeticSurfaceNormal(e,r=[0,0,0]){return ni.from(e).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(e,r){return nd(e,this,r)}scaleToGeocentricSurface(e,r=[0,0,0]){zt.from(e);let n=zt.x,s=zt.y,i=zt.z,o=this.oneOverRadiiSquared,a=1/Math.sqrt(n*n*o.x+s*s*o.y+i*i*o.z);return zt.multiplyScalar(a).to(r)}transformPositionToScaledSpace(e,r=[0,0,0]){return zt.from(e).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(e,r=[0,0,0]){return zt.from(e).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(e,r=0,n=[0,0,0]){ct(At(this.radii.x,this.radii.y,Ht.EPSILON15)),ct(this.radii.z>0),zt.from(e);let s=zt.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(s)>=this.radii.z-r))return zt.set(0,0,s).to(n)}};P(L,"WGS84",new L(6378137,6378137,he));var ii=class{constructor(e,r,n){this.item=void 0,this.previous=void 0,this.next=void 0,this.item=e,this.previous=r,this.next=n}};var oi=class{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(e){let r=new ii(e,this.tail,null);return this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),++this._length,r}remove(e){e&&(e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,--this._length)}splice(e,r){e!==r&&(this.remove(r),this._insert(e,r))}_insert(e,r){let n=e.next;e.next=r,this.tail===e?this.tail=r:n.previous=r,r.next=n,r.previous=e,++this._length}};var ai=class{constructor(){this._list=void 0,this._sentinel=void 0,this._trimTiles=void 0,this._list=new oi,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(e){let r=e._cacheNode;r&&this._list.splice(this._sentinel,r)}add(e,r,n){r._cacheNode||(r._cacheNode=this._list.add(r),n&&n(e,r))}unloadTile(e,r,n){let s=r._cacheNode;s&&(this._list.remove(s),r._cacheNode=null,n&&n(e,r))}unloadTiles(e,r){let n=this._trimTiles;this._trimTiles=!1;let s=this._list,i=e.maximumMemoryUsage*1024*1024,o=this._sentinel,a=s.head;for(;a!==o&&(e.gpuMemoryUsageInBytes>i||n);){let c=a.item;a=a.next,this.unloadTile(e,c,r)}}trim(){this._trimTiles=!0}};function id(t,e){V(t),V(e);let{rtcCenter:r,gltfUpAxis:n}=e,{computedTransform:s,boundingVolume:{center:i}}=t,o=new D(s);switch(r&&o.translate(r),n){case"Z":break;case"Y":let f=new D().rotateX(Math.PI/2);o=o.multiplyRight(f);break;case"X":let u=new D().rotateY(-Math.PI/2);o=o.multiplyRight(u);break;default:break}e.isQuantized&&o.translate(e.quantizedVolumeOffset).scale(e.quantizedVolumeScale);let a=new m(i);e.cartesianModelMatrix=o,e.cartesianOrigin=a;let c=L.WGS84.cartesianToCartographic(a,new m),h=L.WGS84.eastNorthUpToFixedFrame(a).invert();e.cartographicModelMatrix=h.multiplyRight(o),e.cartographicOrigin=c,e.coordinateSystem||(e.modelMatrix=e.cartographicModelMatrix)}var od=new m,qa=new m,ja=new ot([new lt,new lt,new lt,new lt,new lt,new lt]);function cd(t,e){let{cameraDirection:r,cameraUp:n,height:s}=t,{metersPerUnit:i}=t.distanceScales,o=ci(t,t.center),a=L.WGS84.eastNorthUpToFixedFrame(o),c=t.unprojectPosition(t.cameraPosition),l=L.WGS84.cartographicToCartesian(c,new m),h=new m(a.transformAsVector(new m(r).scale(i))).normalize(),f=new m(a.transformAsVector(new m(n).scale(i))).normalize();CE(t);let u=t.constructor,{longitude:d,latitude:p,width:_,bearing:A,zoom:T}=t,x=new u({longitude:d,latitude:p,height:s,width:_,bearing:A,zoom:T,pitch:0});return{camera:{position:l,direction:h,up:f},viewport:t,topDownViewport:x,height:s,cullingVolume:ja,frameNumber:e,sseDenominator:1.15}}function ld(t,e,r){if(r===0||t.length<=r)return[t,[]];let n=[],{longitude:s,latitude:i}=e.viewport;for(let[l,h]of t.entries()){let[f,u]=h.header.mbs,d=Math.abs(s-f),p=Math.abs(i-u),_=Math.sqrt(p*p+d*d);n.push([l,_])}let o=n.sort((l,h)=>l[1]-h[1]),a=[];for(let l=0;l<r;l++)a.push(t[o[l][0]]);let c=[];for(let l=r;l<o.length;l++)c.push(t[o[l][0]]);return[a,c]}function CE(t){let e=t.getFrustumPlanes(),r=ad(e.near,t.cameraPosition),n=ci(t,r),s=ci(t,t.cameraPosition,qa),i=0;ja.planes[i++].fromPointNormal(n,od.copy(n).subtract(s));for(let o in e){if(o==="near")continue;let a=e[o],c=ad(a,r,qa),l=ci(t,c,qa);ja.planes[i++].fromPointNormal(l,od.copy(n).subtract(l))}}function ad(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new m,n=t.normal.dot(e);return r.copy(t.normal).scale(t.distance-n).add(e),r}function ci(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new m,n=t.unprojectPosition(e);return L.WGS84.cartographicToCartesian(n,r)}var BE=6378137,ME=6378137,Za=6356752314245179e-9,Mr=new m;function hd(t,e){if(t instanceof Xt){let{halfAxes:r}=t,n=yE(r);return Math.log2(Za/(n+e[2]))}else if(t instanceof Ot){let{radius:r}=t;return Math.log2(Za/(r+e[2]))}else if(t.width&&t.height){let{width:r,height:n}=t,s=Math.log2(BE/r),i=Math.log2(ME/n);return(s+i)/2}return 1}function Qa(t,e,r){L.WGS84.cartographicToCartesian([t.xmax,t.ymax,t.zmax],Mr);let n=Math.sqrt(Math.pow(Mr[0]-r[0],2)+Math.pow(Mr[1]-r[1],2)+Math.pow(Mr[2]-r[2],2));return Math.log2(Za/(n+e[2]))}function fd(t,e,r){let[n,s,i,o]=t;return Qa({xmin:n,xmax:i,ymin:s,ymax:o,zmin:0,zmax:0},e,r)}function yE(t){t.getColumn(0,Mr);let e=t.getColumn(1),r=t.getColumn(2);return Mr.add(e).add(r).len()}var Id=v(Cr(),1);var _t={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Et=function(t){return t[t.ADD=1]="ADD",t[t.REPLACE=2]="REPLACE",t}({}),re=function(t){return t.EMPTY="empty",t.SCENEGRAPH="scenegraph",t.POINTCLOUD="pointcloud",t.MESH="mesh",t}({}),ft=function(t){return t.I3S="I3S",t.TILES3D="TILES3D",t}({}),qe=function(t){return t.GEOMETRIC_ERROR="geometricError",t.MAX_SCREEN_THRESHOLD="maxScreenThreshold",t}({}),ud={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function Ad(t){return t!=null}var ut=new m,li=new m,IE=new m,FE=new m,je=new m,dd=new m,pd=new m,gd=new m;function hi(t,e,r){if(V(t,"3D Tile: boundingVolume must be defined"),t.box)return md(t.box,e,r);if(t.region)return OE(t.region);if(t.sphere)return NE(t.sphere,e,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function _d(t,e){if(t.box)return bE(e);if(t.region){let[r,n,s,i,o,a]=t.region;return[[yt(r),yt(n),o],[yt(s),yt(i),a]]}if(t.sphere)return PE(e);throw new Error("Unkown boundingVolume type")}function md(t,e,r){let n=new m(t[0],t[1],t[2]);e.transform(n,n);let s=[];if(t.length===10){let l=t.slice(3,6),h=new Zt;h.fromArray(t,6);let f=new m([1,0,0]),u=new m([0,1,0]),d=new m([0,0,1]);f.transformByQuaternion(h),f.scale(l[0]),u.transformByQuaternion(h),u.scale(l[1]),d.transformByQuaternion(h),d.scale(l[2]),s=[...f.toArray(),...u.toArray(),...d.toArray()]}else s=[...t.slice(3,6),...t.slice(6,9),...t.slice(9,12)];let i=e.transformAsVector(s.slice(0,3)),o=e.transformAsVector(s.slice(3,6)),a=e.transformAsVector(s.slice(6,9)),c=new z([i[0],i[1],i[2],o[0],o[1],o[2],a[0],a[1],a[2]]);return Ad(r)?(r.center=n,r.halfAxes=c,r):new Xt(n,c)}function NE(t,e,r){let n=new m(t[0],t[1],t[2]);e.transform(n,n);let s=e.getScale(li),i=Math.max(Math.max(s[0],s[1]),s[2]),o=t[3]*i;return Ad(r)?(r.center=n,r.radius=o,r):new Ot(n,o)}function OE(t){let[e,r,n,s,i,o]=t,a=L.WGS84.cartographicToCartesian([yt(e),yt(s),i],IE),c=L.WGS84.cartographicToCartesian([yt(n),yt(r),o],FE),l=new m().addVectors(a,c).multiplyByScalar(.5);return L.WGS84.cartesianToCartographic(l,je),L.WGS84.cartographicToCartesian([yt(n),je[1],je[2]],dd),L.WGS84.cartographicToCartesian([je[0],yt(s),je[2]],pd),L.WGS84.cartographicToCartesian([je[0],je[1],o],gd),md([...l,...dd.subtract(l),...pd.subtract(l),...gd.subtract(l)],new D)}function bE(t){let e=Td(),{halfAxes:r}=t,n=new m(r.getColumn(0)),s=new m(r.getColumn(1)),i=new m(r.getColumn(2));for(let o=0;o<2;o++){for(let a=0;a<2;a++){for(let c=0;c<2;c++)ut.copy(t.center),ut.add(n),ut.add(s),ut.add(i),Ed(e,ut),i.negate();s.negate()}n.negate()}return e}function PE(t){let e=Td(),{center:r,radius:n}=t,s=L.WGS84.scaleToGeodeticSurface(r,ut),i;s?i=L.WGS84.geodeticSurfaceNormal(s):i=new m(0,0,1);let o=new m(i[2],-i[1],0);o.len()>0?o.normalize():o=new m(0,1,0);let a=o.clone().cross(i);for(let c of[o,a,i]){li.copy(c).scale(n);for(let l=0;l<2;l++)ut.copy(r),ut.add(li),Ed(e,ut),li.negate()}return e}function Td(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function Ed(t,e){L.WGS84.cartesianToCartographic(e,ut),t[0][0]=Math.min(t[0][0],ut[0]),t[0][1]=Math.min(t[0][1],ut[1]),t[0][2]=Math.min(t[0][2],ut[2]),t[1][0]=Math.max(t[1][0],ut[0]),t[1][1]=Math.max(t[1][1],ut[1]),t[1][2]=Math.max(t[1][2],ut[2])}var VP=new m,XP=new m,WP=new D,zP=new m,kP=new m,GP=new m;function DE(t,e){let r=t*e;return 1-Math.exp(-(r*r))}function wE(t,e){if(t.dynamicScreenSpaceError&&t.dynamicScreenSpaceErrorComputedDensity){let r=t.dynamicScreenSpaceErrorComputedDensity,n=t.dynamicScreenSpaceErrorFactor;return DE(e,r)*n}return 0}function Rd(t,e,r){let n=t.tileset,s=t.parent&&t.parent.lodMetricValue||t.lodMetricValue,i=r?s:t.lodMetricValue;if(i===0)return 0;let o=Math.max(t._distanceToCamera,1e-7),{height:a,sseDenominator:c}=e,{viewDistanceScale:l}=n.options,h=i*a*(l||1)/(o*c);return h-=wE(n,o),h}var $a=new m,xd=new m,Fe=new m,Sd=new m,vE=new m,tc=new D,Cd=new D;function Bd(t,e){if(t.lodMetricValue===0||isNaN(t.lodMetricValue))return"DIG";let r=2*ec(t,e);return r<2?"OUT":!t.header.children||r<=t.lodMetricValue?"DRAW":t.header.children?"DIG":"OUT"}function ec(t,e){let{topDownViewport:r}=e,n=t.header.mbs[1],s=t.header.mbs[0],i=t.header.mbs[2],o=t.header.mbs[3],a=[...t.boundingVolume.center],c=r.unprojectPosition(r.cameraPosition);L.WGS84.cartographicToCartesian(c,$a),xd.copy($a).subtract(a).normalize(),L.WGS84.eastNorthUpToFixedFrame(a,tc),Cd.copy(tc).invert(),Fe.copy($a).transform(Cd);let l=Math.sqrt(Fe[0]*Fe[0]+Fe[1]*Fe[1]),h=l*l/Fe[2];Sd.copy([Fe[0],Fe[1],h]);let u=Sd.transform(tc).subtract(a).normalize(),p=xd.cross(u).normalize().scale(o).add(a),_=L.WGS84.cartesianToCartographic(p),A=r.project([s,n,i]),T=r.project(_);return vE.copy(A).subtract(T).magnitude()}function Md(t){return{assetGltfUpAxis:t.asset&&t.asset.gltfUpAxis||"Y"}}var Mn=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;this._map=new Map,this._array=void 0,this._length=void 0,this._array=new Array(e),this._length=e}get length(){return this._length}set length(e){this._length=e,e>this._array.length&&(this._array.length=e)}get values(){return this._array}get(e){return V(e<this._array.length),this._array[e]}set(e,r){V(e>=0),e>=this.length&&(this.length=e+1),this._map.has(this._array[e])&&this._map.delete(this._array[e]),this._array[e]=r,this._map.set(r,e)}delete(e){let r=this._map.get(e);r>=0&&(this._array.splice(r,1),this._map.delete(e),this.length--)}peek(){return this._array[this._length-1]}push(e){if(!this._map.has(e)){let r=this.length++;this._array[r]=e,this._map.set(e,r)}}pop(){let e=this._array[--this.length];return this._map.delete(e),e}reserve(e){V(e>=0),e>this._array.length&&(this._array.length=e)}resize(e){V(e>=0),this.length=e}trim(e){e==null&&(e=this.length),this._array.length=e}reset(){this._array=[],this._map=new Map,this._length=0}find(e){return this._map.has(e)}};var UE={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},ne=class{traversalFinished(e){return!0}constructor(e){this.options=void 0,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={},this.lastUpdate=new Date().getTime(),this.updateDebounceTime=1e3,this._traversalStack=new Mn,this._emptyTraversalStack=new Mn,this._frameNumber=null,this.options={...UE,...e}}traverse(e,r,n){this.root=e,this.options={...this.options,...n},this.reset(),this.updateTile(e,r),this._frameNumber=r.frameNumber,this.executeTraversal(e,r)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(e,r){let n=this._traversalStack;for(e._selectionDepth=1,n.push(e);n.length>0;){let i=n.pop(),o=!1;this.canTraverse(i,r)&&(this.updateChildTiles(i,r),o=this.updateAndPushChildren(i,r,n,i.hasRenderContent?i._selectionDepth+1:i._selectionDepth));let a=i.parent,c=Boolean(!a||a._shouldRefine),l=!o;i.hasRenderContent?i.refine===Et.ADD?(this.loadTile(i,r),this.selectTile(i,r)):i.refine===Et.REPLACE&&(this.loadTile(i,r),l&&this.selectTile(i,r)):(this.emptyTiles[i.id]=i,this.loadTile(i,r),l&&this.selectTile(i,r)),this.touchTile(i,r),i._shouldRefine=o&&c}let s=new Date().getTime();(this.traversalFinished(r)||s-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=s,this.options.onTraversalEnd(r))}updateChildTiles(e,r){let n=e.children;for(let s of n)this.updateTile(s,r)}updateAndPushChildren(e,r,n,s){let{loadSiblings:i,skipLevelOfDetail:o}=this.options,a=e.children;a.sort(this.compareDistanceToCamera.bind(this));let c=e.refine===Et.REPLACE&&e.hasRenderContent&&!o,l=!1,h=!0;for(let f of a)if(f._selectionDepth=s,f.isVisibleAndInRequestVolume?(n.find(f)&&n.delete(f),n.push(f),l=!0):(c||i)&&(this.loadTile(f,r),this.touchTile(f,r)),c){let u;if(f._inRequestVolume?f.hasRenderContent?u=f.contentAvailable:u=this.executeEmptyTraversal(f,r):u=!1,h=h&&u,!h)return!1}return l||(h=!1),h}updateTile(e,r){this.updateTileVisibility(e,r)}selectTile(e,r){this.shouldSelectTile(e)&&(e._selectedFrame=r.frameNumber,this.selectedTiles[e.id]=e)}loadTile(e,r){this.shouldLoadTile(e)&&(e._requestedFrame=r.frameNumber,e._priority=e._getPriority(),this.requestedTiles[e.id]=e)}touchTile(e,r){e.tileset._cache.touch(e),e._touchedFrame=r.frameNumber}canTraverse(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return e.hasChildren?e.hasTilesetContent?!e.contentExpired:!s&&!e.isVisibleAndInRequestVolume?!1:this.shouldRefine(e,r,n):!1}shouldLoadTile(e){return e.hasUnloadedContent||e.contentExpired}shouldSelectTile(e){return e.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=e._screenSpaceError;return n&&(s=e.getScreenSpaceError(r,!0)),s>e.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(e,r){let n=[];if(this.options.viewportTraversersMap)for(let s in this.options.viewportTraversersMap)this.options.viewportTraversersMap[s]===r.viewport.id&&n.push(s);else n.push(r.viewport.id);e.updateVisibility(r,n)}compareDistanceToCamera(e,r){return e._distanceToCamera-r._distanceToCamera}anyChildrenVisible(e,r){let n=!1;for(let s of e.children)s.updateVisibility(r),n=n||s.isVisibleAndInRequestVolume;return n}executeEmptyTraversal(e,r){let n=!0,s=this._emptyTraversalStack;for(s.push(e);s.length>0;){let i=s.pop(),o=!i.hasRenderContent&&this.canTraverse(i,r,!1,!1),a=!i.hasRenderContent&&i.children.length===0;if(!o&&!i.contentAvailable&&!a&&(n=!1),this.updateTile(i,r),i.isVisibleAndInRequestVolume||(this.loadTile(i,r),this.touchTile(i,r)),o){let c=i.children;for(let l of c)s.push(l)}}return n}};var yd=new m;function LE(t){return t!=null}var Ze=class{constructor(e,r,n){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"";this.tileset=void 0,this.header=void 0,this.id=void 0,this.url=void 0,this.parent=void 0,this.refine=void 0,this.type=void 0,this.contentUrl=void 0,this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=_t.UNLOADED,this.gpuMemoryUsageInBytes=0,this.children=[],this.depth=0,this.viewportIds=[],this.transform=new D,this.extensions=null,this.implicitTiling=null,this.userData={},this.computedTransform=void 0,this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.traverser=new ne({}),this._cacheNode=null,this._frameNumber=null,this._expireDate=null,this._expiredContent=null,this._boundingBox=void 0,this._distanceToCamera=0,this._screenSpaceError=0,this._visibilityPlaneMask=void 0,this._visible=void 0,this._contentBoundingVolume=void 0,this._viewerRequestVolume=void 0,this._initialTransform=new D,this._priority=0,this._selectedFrame=0,this._requestedFrame=0,this._selectionDepth=0,this._touchedFrame=0,this._centerZDepth=0,this._shouldRefine=!1,this._stackLength=0,this._visitedFrame=0,this._inRequestVolume=!1,this._lodJudge=null,this.header=r,this.tileset=e,this.id=s||r.id,this.url=r.url,this.parent=n,this.refine=this._getRefine(r.refine),this.type=r.type,this.contentUrl=r.contentUrl,this._initializeLodMetric(r),this._initializeTransforms(r),this._initializeBoundingVolumes(r),this._initializeContent(r),this._initializeRenderingState(r),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===_t.READY||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===_t.UNLOADED}get contentExpired(){return this.contentState===_t.EXPIRED}get contentFailed(){return this.contentState===_t.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=_d(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(e,r){switch(this.tileset.type){case ft.I3S:return ec(this,e);case ft.TILES3D:return Rd(this,e,r);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){let e=this.tileset._traverser,{skipLevelOfDetail:r}=e.options,n=this.refine===Et.ADD||r;if(n&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===_t.UNLOADED)return-1;let s=this.parent,o=s&&(!n||this._screenSpaceError===0||s.hasTilesetContent)?s._screenSpaceError:this._screenSpaceError,a=e.root?e.root._screenSpaceError:0;return Math.max(a-o,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=_t.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=_t.UNLOADED,!1;try{let n=this.tileset.getTileUrl(this.contentUrl),s=this.tileset.loader,i={...this.tileset.loadOptions,[s.id]:{...this.tileset.loadOptions[s.id],isTileset:this.type==="json",...this._getLoaderSpecificOptions(s.id)}};return this.content=await(0,Id.load)(n,s,i),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=_t.READY,this._onContentLoaded(),!0}catch(n){throw this.contentState=_t.FAILED,n}finally{r.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=_t.UNLOADED,!0}updateVisibility(e,r){if(this._frameNumber===e.frameNumber)return;let n=this.parent,s=n?n._visibilityPlaneMask:ot.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let i=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(i)}this._distanceToCamera=this.distanceToTile(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._visibilityPlaneMask=this.visibility(e,s),this._visible=this._visibilityPlaneMask!==ot.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._frameNumber=e.frameNumber,this.viewportIds=r}visibility(e,r){let{cullingVolume:n}=e,{boundingVolume:s}=this;return n.computeVisibilityWithPlaneMask(s,r)}contentVisibility(){return!0}distanceToTile(e){let r=this.boundingVolume;return Math.sqrt(Math.max(r.distanceSquaredTo(e.camera.position),0))}cameraSpaceZDepth(e){let{camera:r}=e,n=this.boundingVolume;return yd.subVectors(n.center,r.position),r.direction.dot(yd)}insideViewerRequestVolume(e){let r=this._viewerRequestVolume;return!r||r.distanceSquaredTo(e.camera.position)<=0}updateExpiration(){if(LE(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let e=Date.now();Date.lessThan(this._expireDate,e)&&(this.contentState=_t.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(e){"lodMetricType"in e?this.lodMetricType=e.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in e?this.lodMetricValue=e.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(e){this.transform=e.transform?new D(e.transform):new D;let r=this.parent,n=this.tileset,s=r&&r.computedTransform?r.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new D(s).multiplyRight(this.transform);let i=r&&r._initialTransform?r._initialTransform.clone():new D;this._initialTransform=new D(i).multiplyRight(this.transform)}_initializeBoundingVolumes(e){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(e)}_initializeContent(e){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=_t.UNLOADED,this.hasTilesetContent=!1,e.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(e){this.depth=e.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=ot.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(e){return e||this.parent&&this.parent.refine||Et.REPLACE}_isTileset(){return this.contentUrl.indexOf(".json")!==-1}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(e){this.boundingVolume=hi(e.boundingVolume,this.computedTransform,this.boundingVolume);let r=e.content;r&&(r.boundingVolume&&(this._contentBoundingVolume=hi(r.boundingVolume,this.computedTransform,this._contentBoundingVolume)),e.viewerRequestVolume&&(this._viewerRequestVolume=hi(e.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(){let r=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:new D).clone().multiplyRight(this.transform);r.equals(this.computedTransform)||(this.computedTransform=r,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(e){switch(e){case"i3s":return{...this.tileset.options.i3s,_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1};case"3d-tiles":case"cesium-ion":default:return Md(this.tileset.tileset)}}};var fi=class extends ne{compareDistanceToCamera(e,r){return r._distanceToCamera===0&&e._distanceToCamera===0?r._centerZDepth-e._centerZDepth:r._distanceToCamera-e._distanceToCamera}updateTileVisibility(e,r){if(super.updateTileVisibility(e,r),!e.isVisibleAndInRequestVolume)return;let n=e.children.length>0;if(e.hasTilesetContent&&n){let o=e.children[0];this.updateTileVisibility(o,r),e._visible=o._visible;return}if(this.meetsScreenSpaceErrorEarly(e,r)){e._visible=!1;return}let s=e.refine===Et.REPLACE,i=e._optimChildrenWithinParent===ud.USE_OPTIMIZATION;if(s&&i&&n&&!this.anyChildrenVisible(e,r)){e._visible=!1;return}}meetsScreenSpaceErrorEarly(e,r){let{parent:n}=e;return!n||n.hasTilesetContent||n.refine!==Et.ADD?!1:!this.shouldRefine(e,r,!0)}};var Fd=v(Cr(),1);var ui=class{constructor(){this.frameNumberMap=new Map}register(e,r){let n=this.frameNumberMap.get(e)||new Map,s=n.get(r)||0;n.set(r,s+1),this.frameNumberMap.set(e,n)}deregister(e,r){let n=this.frameNumberMap.get(e);if(!n)return;let s=n.get(r)||1;n.set(r,s-1)}isZero(e,r){var n;return(((n=this.frameNumberMap.get(e))===null||n===void 0?void 0:n.get(r))||0)===0}};var rc={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},di=class{constructor(){this._statusMap=void 0,this.pendingTilesRegister=new ui,this._statusMap={}}add(e,r,n,s){if(!this._statusMap[r]){let{frameNumber:i,viewport:{id:o}}=s;this._statusMap[r]={request:e,callback:n,key:r,frameState:s,status:rc.REQUESTED},this.pendingTilesRegister.register(o,i),e().then(a=>{this._statusMap[r].status=rc.COMPLETED;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),this._statusMap[r].callback(a,s)}).catch(a=>{this._statusMap[r].status=rc.ERROR;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),n(a)})}}update(e,r){if(this._statusMap[e]){let{frameNumber:n,viewport:{id:s}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(s,n);let{frameNumber:i,viewport:{id:o}}=r;this.pendingTilesRegister.register(o,i),this._statusMap[e].frameState=r}}find(e){return this._statusMap[e]}hasPendingTiles(e,r){return!this.pendingTilesRegister.isZero(e,r)}};var pi=class extends ne{constructor(e){super(e),this._tileManager=void 0,this._tileManager=new di}traversalFinished(e){return!this._tileManager.hasPendingTiles(e.viewport.id,this._frameNumber||0)}shouldRefine(e,r){return e._lodJudge=Bd(e,r),e._lodJudge==="DIG"}updateChildTiles(e,r){let n=e.header.children||[],s=e.children,i=e.tileset;for(let o of n){let a=`${o.id}-${r.viewport.id}`,c=s&&s.find(l=>l.id===a);if(c)c&&this.updateTile(c,r);else{let l=()=>this._loadTile(o.id,i);this._tileManager.find(a)?this._tileManager.update(a,r):(i.tileset.nodePages&&(l=()=>i.tileset.nodePagesTile.formTileFromNodePages(o.id)),this._tileManager.add(l,a,f=>this._onTileLoad(f,e,a),r))}}return!1}async _loadTile(e,r){let{loader:n}=r,s=r.getTileUrl(`${r.url}/nodes/${e}`),i={...r.loadOptions,i3s:{...r.loadOptions.i3s,isTileHeader:!0}};return await(0,Fd.load)(s,n,i)}_onTileLoad(e,r,n){let s=new Ze(r.tileset,e,r,n);r.children.push(s);let i=this._tileManager.find(s.id).frameState;this.updateTile(s,i),this._frameNumber===i.frameNumber&&(this.traversalFinished(i)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(s,i)}};var HE={description:"",ellipsoid:L.WGS84,modelMatrix:new D,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,memoryCacheOverflow:1,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:t=>t,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,memoryAdjustedScreenSpaceError:!1,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},gi="Tiles In Tileset(s)",nc="Tiles In Memory",Nd="Tiles In View",Od="Tiles To Render",bd="Tiles Loaded",sc="Tiles Loading",Pd="Tiles Unloaded",Dd="Failed Tile Loads",wd="Points/Vertices",ic="Tile Memory Use",vd="Maximum Screen Space Error",yn=class{constructor(e,r){this.options=void 0,this.loadOptions=void 0,this.type=void 0,this.tileset=void 0,this.loader=void 0,this.url=void 0,this.basePath=void 0,this.modelMatrix=void 0,this.ellipsoid=void 0,this.lodMetricType=void 0,this.lodMetricValue=void 0,this.refine=void 0,this.root=null,this.roots={},this.asset={},this.description="",this.properties=void 0,this.extras=null,this.attributions={},this.credits={},this.stats=void 0,this.contentFormats={draco:!1,meshopt:!1,dds:!1,ktx2:!1},this.cartographicCenter=null,this.cartesianCenter=null,this.zoom=1,this.boundingVolume=null,this.dynamicScreenSpaceErrorComputedDensity=0,this.maximumMemoryUsage=32,this.gpuMemoryUsageInBytes=0,this.memoryAdjustedScreenSpaceError=0,this._cacheBytes=0,this._cacheOverflowBytes=0,this._frameNumber=0,this._queryParams={},this._extensionsUsed=[],this._tiles={},this._pendingCount=0,this.selectedTiles=[],this.traverseCounter=0,this.geometricError=0,this.lastUpdatedVieports=null,this._requestedTiles=[],this._emptyTiles=[],this.frameStateData={},this._traverser=void 0,this._cache=new ai,this._requestScheduler=void 0,this.updatePromise=null,this.tilesetInitializationPromise=void 0,this.options={...HE,...r},this.tileset=e,this.loader=e.loader,this.type=e.type,this.url=e.url,this.basePath=e.basePath||Te.dirname(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=e.lodMetricType,this.lodMetricValue=e.lodMetricValue,this.refine=e.root.refine,this.loadOptions=this.options.loadOptions||{},this._traverser=this._initializeTraverser(),this._requestScheduler=new me({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.memoryAdjustedScreenSpaceError=this.options.maximumScreenSpaceError,this._cacheBytes=this.options.maximumMemoryUsage*1024*1024,this._cacheOverflowBytes=this.options.memoryCacheOverflow*1024*1024,this.stats=new _e({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(e)}destroy(){this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(e){this.options={...this.options,...e}}getTileUrl(e){if(e.startsWith("data:"))return e;let n=e;return this.queryParams.length&&(n=`${e}${e.includes("?")?"&":"?"}${this.queryParams}`),n}hasExtension(e){return Boolean(this._extensionsUsed.indexOf(e)>-1)}update(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;this.tilesetInitializationPromise.then(()=>{!e&&this.lastUpdatedVieports?e=this.lastUpdatedVieports:this.lastUpdatedVieports=e,e&&this.doUpdate(e)})}async selectTiles(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return await this.tilesetInitializationPromise,e&&(this.lastUpdatedVieports=e),this.updatePromise||(this.updatePromise=new Promise(r=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),r(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytes<this._cacheBytes?this.memoryAdjustedScreenSpaceError=Math.max(this.memoryAdjustedScreenSpaceError/1.02,this.options.maximumScreenSpaceError):this.gpuMemoryUsageInBytes>this._cacheBytes+this._cacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(e){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let r=e instanceof Array?e:[e];this._cache.reset(),this._frameNumber++,this.traverseCounter=r.length;let n=[];for(let s of r){let i=s.id;this._needTraverse(i)?n.push(i):this.traverseCounter--}for(let s of r){let i=s.id;if(this.roots[i]||(this.roots[i]=this._initializeTileHeaders(this.tileset,null)),!n.includes(i))continue;let o=cd(s,this._frameNumber);this._traverser.traverse(this.roots[i],o,this.options)}}_needTraverse(e){let r=e;return this.options.viewportTraversersMap&&(r=this.options.viewportTraversersMap[e]),r===e}_onTraversalEnd(e){let r=e.viewport.id;this.frameStateData[r]||(this.frameStateData[r]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let n=this.frameStateData[r],s=Object.values(this._traverser.selectedTiles),[i,o]=ld(s,e,this.options.maximumTilesSelected);n.selectedTiles=i;for(let a of o)a.unselect();n._requestedTiles=Object.values(this._traverser.requestedTiles),n._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let e in this.frameStateData){let r=this.frameStateData[e];this.selectedTiles=this.selectedTiles.concat(r.selectedTiles),this._requestedTiles=this._requestedTiles.concat(r._requestedTiles),this._emptyTiles=this._emptyTiles.concat(r._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(let e of this.selectedTiles)this._tiles[e.id]=e;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(e,r){if(e.length!==r.length)return!0;let n=new Set(e.map(o=>o.id)),s=new Set(r.map(o=>o.id)),i=e.filter(o=>!s.has(o.id)).length>0;return i=i||r.filter(o=>!n.has(o.id)).length>0,i}_loadTiles(){for(let e of this._requestedTiles)e.contentUnloaded&&this._loadTile(e)}_unloadTiles(){this._cache.unloadTiles(this,(e,r)=>e._unloadTile(r))}_updateStats(){let e=0,r=0;for(let n of this.selectedTiles)n.contentAvailable&&n.content&&(e++,n.content.pointCount?r+=n.content.pointCount:r+=n.content.vertexCount);this.stats.get(Nd).count=this.selectedTiles.length,this.stats.get(Od).count=e,this.stats.get(wd).count=r,this.stats.get(vd).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(e){this.type===ft.I3S&&(this.calculateViewPropsI3S(),e.root=await e.root),this.root=this._initializeTileHeaders(e,null),this.type===ft.TILES3D&&(this._initializeTiles3DTileset(e),this.calculateViewPropsTiles3D()),this.type===ft.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){var e;let r=this.tileset.fullExtent;if(r){let{xmin:s,xmax:i,ymin:o,ymax:a,zmin:c,zmax:l}=r;this.cartographicCenter=new m(s+(i-s)/2,o+(a-o)/2,c+(l-c)/2),this.cartesianCenter=new m,L.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=Qa(r,this.cartographicCenter,this.cartesianCenter);return}let n=(e=this.tileset.store)===null||e===void 0?void 0:e.extent;if(n){let[s,i,o,a]=n;this.cartographicCenter=new m(s+(o-s)/2,i+(a-i)/2,0),this.cartesianCenter=new m,L.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=fd(n,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new m,this.zoom=1}calculateViewPropsTiles3D(){let e=this.root,{center:r}=e.boundingVolume;if(!r){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new m,this.zoom=1;return}r[0]!==0||r[1]!==0||r[2]!==0?(this.cartographicCenter=new m,L.WGS84.cartesianToCartographic(r,this.cartographicCenter)):this.cartographicCenter=new m(0,0,-L.WGS84.radii[0]),this.cartesianCenter=r,this.zoom=hd(e.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(gi),this.stats.get(sc),this.stats.get(nc),this.stats.get(Nd),this.stats.get(Od),this.stats.get(bd),this.stats.get(Pd),this.stats.get(Dd),this.stats.get(wd),this.stats.get(ic,"memory"),this.stats.get(vd)}_initializeTileHeaders(e,r){let n=new Ze(this,e.root,r);if(r&&(r.children.push(n),n.depth=r.depth+1),this.type===ft.TILES3D){let i=[];for(i.push(n);i.length>0;){let o=i.pop();this.stats.get(gi).incrementCount();let a=o.header.children||[];for(let c of a){var s;let l=new Ze(this,c,o);if((s=l.contentUrl)!==null&&s!==void 0&&s.includes("?session=")){let f=new URL(l.contentUrl).searchParams.get("session");f&&(this._queryParams.session=f)}o.children.push(l),l.depth=o.depth+1,i.push(l)}}}return n}_initializeTraverser(){let e;switch(this.type){case ft.TILES3D:e=fi;break;case ft.I3S:e=pi;break;default:e=ne}return new e({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(e){this._destroySubtree(e)}async _loadTile(e){let r;try{this._onStartTileLoading(),r=await e.loadContent()}catch(n){this._onTileLoadError(e,n instanceof Error?n:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(e,r)}}_onTileLoadError(e,r){this.stats.get(Dd).incrementCount();let n=r.message||r.toString(),s=e.url;console.error(`A 3D tile failed to load: ${e.url} ${n}`),this.options.onTileError(e,n,s)}_onTileLoad(e,r){if(r){if(this.type===ft.I3S){var n,s;let i=((n=this.tileset)===null||n===void 0||(s=n.nodePagesTile)===null||s===void 0?void 0:s.nodesInNodePages)||0;this.stats.get(gi).reset(),this.stats.get(gi).addCount(i)}e&&e.content&&id(e,e.content),this.updateContentTypes(e),this._addTileToCache(e),this.options.onTileLoad(e)}}updateContentTypes(e){if(this.type===ft.I3S)switch(e.header.isDracoGeometry&&(this.contentFormats.draco=!0),e.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}else if(this.type===ft.TILES3D){var r;let{extensionsRemoved:n=[]}=((r=e.content)===null||r===void 0?void 0:r.gltf)||{};n.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),n.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),n.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(sc).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(sc).decrementCount()}_addTileToCache(e){this._cache.add(this,e,r=>r._updateCacheStats(e))}_updateCacheStats(e){this.stats.get(bd).incrementCount(),this.stats.get(nc).incrementCount(),this.gpuMemoryUsageInBytes+=e.gpuMemoryUsageInBytes||0,this.stats.get(ic).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(e){this.gpuMemoryUsageInBytes-=e.gpuMemoryUsageInBytes||0,this.stats.get(nc).decrementCount(),this.stats.get(Pd).incrementCount(),this.stats.get(ic).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(e),e.unloadContent()}_destroy(){let e=[];for(this.root&&e.push(this.root);e.length>0;){let r=e.pop();for(let n of r.children)e.push(n);this._destroyTile(r)}this.root=null}_destroySubtree(e){let r=e,n=[];for(n.push(r);n.length>0;){e=n.pop();for(let s of e.children)n.push(s);e!==r&&this._destroyTile(e)}r.children=[]}_destroyTile(e){this._cache.unloadTile(this,e),this._unloadTile(e),e.destroy()}_initializeTiles3DTileset(e){if(e.queryString){let r=new URLSearchParams(e.queryString),n=Object.fromEntries(r.entries());this._queryParams={...this._queryParams,...n}}if(this.asset=e.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=e.properties,this.geometricError=e.geometricError,this._extensionsUsed=e.extensionsUsed||[],this.extras=e.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}};var Ai="4.1.0";var Qe={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},VD=Object.keys(Qe);function oc(t,e,r){V(t instanceof ArrayBuffer);let n=new TextDecoder("utf8"),s=new Uint8Array(t,e,r);return n.decode(s)}function Ud(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=new DataView(t);return`${String.fromCharCode(r.getUint8(e+0))}${String.fromCharCode(r.getUint8(e+1))}${String.fromCharCode(r.getUint8(e+2))}${String.fromCharCode(r.getUint8(e+3))}`}var Ld="4.1.0";var Hd={name:"Draco",id:"draco",module:"draco",version:Ld,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function Vd(t){switch(t.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function $e(t){let e=1/0,r=1/0,n=1/0,s=-1/0,i=-1/0,o=-1/0,a=t.POSITION?t.POSITION.value:[],c=a&&a.length;for(let l=0;l<c;l+=3){let h=a[l],f=a[l+1],u=a[l+2];e=h<e?h:e,r=f<r?f:r,n=u<n?u:n,s=h>s?h:s,i=f>i?f:i,o=u>o?u:o}return[[e,r,n],[s,i,o]]}function ac(t,e,r){let n=Vd(e.value),s=r||Xd(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:n}]},nullable:!1,metadata:s}}function Xd(t){let e={};return"byteOffset"in t&&(e.byteOffset=t.byteOffset.toString(10)),"byteStride"in t&&(e.byteStride=t.byteStride.toString(10)),"normalized"in t&&(e.normalized=t.normalized.toString()),e}function zd(t,e,r){let n=kd(e.metadata),s=[],i=VE(e.attributes);for(let o in t){let a=t[o],c=Wd(o,a,i[o]);s.push(c)}if(r){let o=Wd("indices",r);s.push(o)}return{fields:s,metadata:n}}function VE(t){let e={};for(let r in t){let n=t[r];e[n.name||"undefined"]=n}return e}function Wd(t,e,r){let n=r?kd(r.metadata):void 0;return ac(t,e,n)}function kd(t){Object.entries(t);let e={};for(let r in t)e[`${r}.string`]=JSON.stringify(t[r]);return e}var Gd={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},XE={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},WE=4,In=class{constructor(e){this.draco=void 0,this.decoder=void 0,this.metadataQuerier=void 0,this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=new this.draco.DecoderBuffer;n.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(r);let s=this.decoder.GetEncodedGeometryType(n),i=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(s){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(n,i);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(n,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!i.ptr){let u=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(u)}let a=this._getDracoLoaderData(i,s,r),c=this._getMeshData(i,a,r),l=$e(c.attributes),h=zd(c.attributes,a,c.indices);return{loader:"draco",loaderData:a,header:{vertexCount:i.num_points(),boundingBox:l},...c,schema:h}}finally{this.draco.destroy(n),i&&this.draco.destroy(i)}}_getDracoLoaderData(e,r,n){let s=this._getTopLevelMetadata(e),i=this._getDracoAttributes(e,n);return{geometry_type:r,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:s,attributes:i}}_getDracoAttributes(e,r){let n={};for(let s=0;s<e.num_attributes();s++){let i=this.decoder.GetAttribute(e,s),o=this._getAttributeMetadata(e,s);n[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:s,metadata:o};let a=this._getQuantizationTransform(i,r);a&&(n[i.unique_id()].quantization_transform=a);let c=this._getOctahedronTransform(i,r);c&&(n[i.unique_id()].octahedron_transform=c)}return n}_getMeshData(e,r,n){let s=this._getMeshAttributes(r,e,n);if(!s.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(n.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:s,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:s,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:s}}_getMeshAttributes(e,r,n){let s={};for(let i of Object.values(e.attributes)){let o=this._deduceAttributeName(i,n);i.name=o;let{value:a,size:c}=this._getAttributeValues(r,i);s[o]={value:a,size:c,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}return s}_getTriangleListIndices(e){let n=e.num_faces()*3,s=n*WE,i=this.draco._malloc(s);try{return this.decoder.GetTrianglesUInt32Array(e,s,i),new Uint32Array(this.draco.HEAPF32.buffer,i,n).slice()}finally{this.draco._free(i)}}_getTriangleStripIndices(e){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,r),GE(r)}finally{this.draco.destroy(r)}}_getAttributeValues(e,r){let n=XE[r.data_type],s=r.num_components,o=e.num_points()*s,a=o*n.BYTES_PER_ELEMENT,c=zE(this.draco,n),l,h=this.draco._malloc(a);try{let f=this.decoder.GetAttribute(e,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,f,c,a,h),l=new n(this.draco.HEAPF32.buffer,h,o).slice()}finally{this.draco._free(h)}return{value:l,size:s}}_deduceAttributeName(e,r){let n=e.unique_id;for(let[o,a]of Object.entries(r.extraAttributes||{}))if(a===n)return o;let s=e.attribute_type;for(let o in Gd)if(this.draco[o]===s)return Gd[o];let i=r.attributeNameEntry||"name";return e.metadata[i]?e.metadata[i].string:`CUSTOM_ATTRIBUTE_${n}`}_getTopLevelMetadata(e){let r=this.decoder.GetMetadata(e);return this._getDracoMetadata(r)}_getAttributeMetadata(e,r){let n=this.decoder.GetAttributeMetadata(e,r);return this._getDracoMetadata(n)}_getDracoMetadata(e){if(!e||!e.ptr)return{};let r={},n=this.metadataQuerier.NumEntries(e);for(let s=0;s<n;s++){let i=this.metadataQuerier.GetEntryName(e,s);r[i]=this._getDracoMetadataField(e,i)}return r}_getDracoMetadataField(e,r){let n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,r,n);let s=kE(n);return{int:this.metadataQuerier.GetIntEntry(e,r),string:this.metadataQuerier.GetStringEntry(e,r),double:this.metadataQuerier.GetDoubleEntry(e,r),intArray:s}}finally{this.draco.destroy(n)}}_disableAttributeTransforms(e){let{quantizedAttributes:r=[],octahedronAttributes:n=[]}=e,s=[...r,...n];for(let i of s)this.decoder.SkipAttributeTransform(this.draco[i])}_getQuantizationTransform(e,r){let{quantizedAttributes:n=[]}=r,s=e.attribute_type();if(n.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(e))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:new Float32Array([1,2,3]).map(a=>o.min_value(a))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(e,r){let{octahedronAttributes:n=[]}=r,s=e.attribute_type();if(n.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(e))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function zE(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32;default:return t.DT_INVALID}}function kE(t){let e=t.size(),r=new Int32Array(e);for(let n=0;n<e;n++)r[n]=t.GetValue(n);return r}function GE(t){let e=t.size(),r=new Int32Array(e);for(let n=0;n<e;n++)r[n]=t.GetValue(n);return r}var KE="1.5.6",JE="1.4.1",cc=`https://www.gstatic.com/draco/versioned/decoders/${KE}`,Rt={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},lc={[Rt.DECODER]:`${cc}/${Rt.DECODER}`,[Rt.DECODER_WASM]:`${cc}/${Rt.DECODER_WASM}`,[Rt.FALLBACK_DECODER]:`${cc}/${Rt.FALLBACK_DECODER}`,[Rt.ENCODER]:`https://raw.githubusercontent.com/google/draco/${JE}/javascript/${Rt.ENCODER}`},Fn;async function Kd(t){let e=t.modules||{};return e.draco3d?Fn=Fn||e.draco3d.createDecoderModule({}).then(r=>({draco:r})):Fn=Fn||YE(t),await Fn}async function YE(t){let e,r;switch(t.draco&&t.draco.decoderType){case"js":e=await qt(lc[Rt.FALLBACK_DECODER],"draco",t,Rt.FALLBACK_DECODER);break;case"wasm":default:[e,r]=await Promise.all([await qt(lc[Rt.DECODER],"draco",t,Rt.DECODER),await qt(lc[Rt.DECODER_WASM],"draco",t,Rt.DECODER_WASM)])}return e=e||globalThis.DracoDecoderModule,await qE(e,r)}function qE(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(n=>{t({...r,onModuleLoaded:s=>n({draco:s})})})}var _i={...Hd,parse:jE};async function jE(t,e){let{draco:r}=await Kd(e),n=new In(r);try{return n.parseSync(t,e?.draco)}finally{n.destroy()}}var ZE={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},st={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},w={...ZE,...st};var hc={[st.DOUBLE]:Float64Array,[st.FLOAT]:Float32Array,[st.UNSIGNED_SHORT]:Uint16Array,[st.UNSIGNED_INT]:Uint32Array,[st.UNSIGNED_BYTE]:Uint8Array,[st.BYTE]:Int8Array,[st.SHORT]:Int16Array,[st.INT]:Int32Array},QE={DOUBLE:st.DOUBLE,FLOAT:st.FLOAT,UNSIGNED_SHORT:st.UNSIGNED_SHORT,UNSIGNED_INT:st.UNSIGNED_INT,UNSIGNED_BYTE:st.UNSIGNED_BYTE,BYTE:st.BYTE,SHORT:st.SHORT,INT:st.INT},fc="Failed to convert GL type",dt=class{static fromTypedArray(e){e=ArrayBuffer.isView(e)?e.constructor:e;for(let r in hc)if(hc[r]===e)return r;throw new Error(fc)}static fromName(e){let r=QE[e];if(!r)throw new Error(fc);return r}static getArrayType(e){switch(e){case st.UNSIGNED_SHORT_5_6_5:case st.UNSIGNED_SHORT_4_4_4_4:case st.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let r=hc[e];if(!r)throw new Error(fc);return r}}static getByteSize(e){return dt.getArrayType(e).BYTES_PER_ELEMENT}static validate(e){return Boolean(dt.getArrayType(e))}static createTypedArray(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;s===void 0&&(s=(r.byteLength-n)/dt.getByteSize(e));let i=dt.getArrayType(e);return new i(r,n,s)}};function Jd(t,e){if(!t)throw new Error(`math.gl assertion failed. ${e}`)}function uc(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0],r=t>>11&31,n=t>>5&63,s=t&31;return e[0]=r<<3,e[1]=n<<2,e[2]=s<<3,e}var Ew=1/256;var Rw=new Ve,xw=new m,Sw=new Ve,Cw=new Ve,Bw=new Uint8Array(1);function Yd(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:255;return us(t,0,e)/e*2-1}function qd(t){return t<0?-1:1}function jd(t,e,r,n){if(Jd(n),t<0||t>r||e<0||e>r)throw new Error(`x and y must be unsigned normalized integers between 0 and ${r}`);if(n.x=Yd(t,r),n.y=Yd(e,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){let s=n.x;n.x=(1-Math.abs(n.y))*qd(s),n.y=(1-Math.abs(s))*qd(n.y)}return n.normalize()}function dc(t,e,r){return jd(t,e,255,r)}var fe=class{constructor(e,r){this.json=void 0,this.buffer=void 0,this.featuresLength=0,this._cachedTypedArrays={},this.json=e,this.buffer=r}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return Boolean(this.json[e])}getGlobalProperty(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:w.UNSIGNED_INT,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,s=this.json[e];return s&&Number.isFinite(s.byteOffset)?this._getTypedArrayFromBinary(e,r,n,1,s.byteOffset):s}getPropertyArray(e,r,n){let s=this.json[e];return s&&Number.isFinite(s.byteOffset)?("componentType"in s&&(r=dt.fromName(s.componentType)),this._getTypedArrayFromBinary(e,r,n,this.featuresLength,s.byteOffset)):this._getTypedArrayFromArray(e,r,s)}getProperty(e,r,n,s,i){let o=this.json[e];if(!o)return o;let a=this.getPropertyArray(e,r,n);if(n===1)return a[s];for(let c=0;c<n;++c)i[c]=a[n*s+c];return i}_getTypedArrayFromBinary(e,r,n,s,i){let o=this._cachedTypedArrays,a=o[e];return a||(a=dt.createTypedArray(r,this.buffer.buffer,this.buffer.byteOffset+i,s*n),o[e]=a),a}_getTypedArrayFromArray(e,r,n){let s=this._cachedTypedArrays,i=s[e];return i||(i=dt.createTypedArray(r,n),s[e]=i),i}};var $E={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},tR={SCALAR:(t,e)=>t[e],VEC2:(t,e)=>[t[2*e+0],t[2*e+1]],VEC3:(t,e)=>[t[3*e+0],t[3*e+1],t[3*e+2]],VEC4:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT2:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT3:(t,e)=>[t[9*e+0],t[9*e+1],t[9*e+2],t[9*e+3],t[9*e+4],t[9*e+5],t[9*e+6],t[9*e+7],t[9*e+8]],MAT4:(t,e)=>[t[16*e+0],t[16*e+1],t[16*e+2],t[16*e+3],t[16*e+4],t[16*e+5],t[16*e+6],t[16*e+7],t[16*e+8],t[16*e+9],t[16*e+10],t[16*e+11],t[16*e+12],t[16*e+13],t[16*e+14],t[16*e+15]]},eR={SCALAR:(t,e,r)=>{e[r]=t},VEC2:(t,e,r)=>{e[2*r+0]=t[0],e[2*r+1]=t[1]},VEC3:(t,e,r)=>{e[3*r+0]=t[0],e[3*r+1]=t[1],e[3*r+2]=t[2]},VEC4:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT2:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT3:(t,e,r)=>{e[9*r+0]=t[0],e[9*r+1]=t[1],e[9*r+2]=t[2],e[9*r+3]=t[3],e[9*r+4]=t[4],e[9*r+5]=t[5],e[9*r+6]=t[6],e[9*r+7]=t[7],e[9*r+8]=t[8],e[9*r+9]=t[9]},MAT4:(t,e,r)=>{e[16*r+0]=t[0],e[16*r+1]=t[1],e[16*r+2]=t[2],e[16*r+3]=t[3],e[16*r+4]=t[4],e[16*r+5]=t[5],e[16*r+6]=t[6],e[16*r+7]=t[7],e[16*r+8]=t[8],e[16*r+9]=t[9],e[16*r+10]=t[10],e[16*r+11]=t[11],e[16*r+12]=t[12],e[16*r+13]=t[13],e[16*r+14]=t[14],e[16*r+15]=t[15]}};function Zd(t,e,r,n){let{componentType:s}=t;V(t.componentType);let i=typeof s=="string"?dt.fromName(s):s,o=$E[t.type],a=tR[t.type],c=eR[t.type];return r+=t.byteOffset,{values:dt.createTypedArray(i,e,r,o*n),type:i,size:o,unpacker:a,packer:c}}var se=t=>t!==void 0;function Qd(t,e,r){if(!e)return null;let n=t.getExtension("3DTILES_batch_table_hierarchy"),s=e.HIERARCHY;return s&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),e.extensions=e.extensions||{},e.extensions["3DTILES_batch_table_hierarchy"]=s,n=s),n?rR(n,r):null}function rR(t,e){let r,n,s,i=t.instancesLength,o=t.classes,a=t.classIds,c=t.parentCounts,l=t.parentIds,h=i;se(a.byteOffset)&&(a.componentType=defaultValue(a.componentType,GL.UNSIGNED_SHORT),a.type=AttributeType.SCALAR,s=getBinaryAccessor(a),a=s.createArrayBufferView(e.buffer,e.byteOffset+a.byteOffset,i));let f;if(se(c))for(se(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,s=getBinaryAccessor(c),c=s.createArrayBufferView(e.buffer,e.byteOffset+c.byteOffset,i)),f=new Uint16Array(i),h=0,r=0;r<i;++r)f[r]=h,h+=c[r];se(l)&&se(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,s=getBinaryAccessor(l),l=s.createArrayBufferView(e.buffer,e.byteOffset+l.byteOffset,h));let u=o.length;for(r=0;r<u;++r){let A=o[r].length,T=o[r].instances,x=getBinaryProperties(A,T,e);o[r].instances=combine(x,T)}let d=new Array(u).fill(0),p=new Uint16Array(i);for(r=0;r<i;++r)n=a[r],p[r]=d[n],++d[n];let _={classes:o,classIds:a,classIndexes:p,parentCounts:c,parentIndexes:f,parentIds:l};return iR(_),_}function yr(t,e,r){if(!t)return;let n=t.parentCounts;return t.parentIds?r(t,e):n>0?nR(t,e,r):sR(t,e,r)}function nR(t,e,r){let n=t.classIds,s=t.parentCounts,i=t.parentIds,o=t.parentIndexes,a=n.length,c=scratchVisited;c.length=Math.max(c.length,a);let l=++marker,h=scratchStack;for(h.length=0,h.push(e);h.length>0;){if(e=h.pop(),c[e]===l)continue;c[e]=l;let f=r(t,e);if(se(f))return f;let u=s[e],d=o[e];for(let p=0;p<u;++p){let _=i[d+p];_!==e&&h.push(_)}}return null}function sR(t,e,r){let n=!0;for(;n;){let s=r(t,e);if(se(s))return s;let i=t.parentIds[e];n=i!==e,e=i}throw new Error("traverseHierarchySingleParent")}function iR(t){let e=[],n=t.classIds.length;for(let s=0;s<n;++s)$d(t,s,stack)}function $d(t,e,r){let n=t.parentCounts,s=t.parentIds,i=t.parentIndexes,a=t.classIds.length;if(!se(s))return;assert(e<a,`Parent index ${e} exceeds the total number of instances: ${a}`),assert(r.indexOf(e)===-1,"Circular dependency detected in the batch table hierarchy."),r.push(e);let c=se(n)?n[e]:1,l=se(n)?i[e]:e;for(let h=0;h<c;++h){let f=s[l+h];f!==e&&$d(t,f,r)}r.pop(e)}function xt(t){return t!=null}var mi=(t,e)=>t,oR={HIERARCHY:!0,extensions:!0,extras:!0},tr=class{constructor(e,r,n){var s;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};this.json=void 0,this.binary=void 0,this.featureCount=void 0,this._extensions=void 0,this._properties=void 0,this._binaryProperties=void 0,this._hierarchy=void 0,V(n>=0),this.json=e||{},this.binary=r,this.featureCount=n,this._extensions=((s=this.json)===null||s===void 0?void 0:s.extensions)||{},this._properties={};for(let o in this.json)oR[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),i["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=Qd(this,this.json,this.binary))}getExtension(e){return this.json&&this.json.extensions&&this.json.extensions[e]}memorySizeInBytes(){return 0}isClass(e,r){if(this._checkBatchId(e),V(typeof r=="string",r),this._hierarchy){let n=yr(this._hierarchy,e,(s,i)=>{let o=s.classIds[i];return s.classes[o].name===r});return xt(n)}return!1}isExactClass(e,r){return V(typeof r=="string",r),this.getExactClassName(e)===r}getExactClassName(e){if(this._checkBatchId(e),this._hierarchy){let r=this._hierarchy.classIds[e];return this._hierarchy.classes[r].name}}hasProperty(e,r){return this._checkBatchId(e),V(typeof r=="string",r),xt(this._properties[r])||this._hasPropertyInHierarchy(e,r)}getPropertyNames(e,r){this._checkBatchId(e),r=xt(r)?r:[],r.length=0;let n=Object.keys(this._properties);return r.push(...n),this._hierarchy&&this._getPropertyNamesInHierarchy(e,r),r}getProperty(e,r){if(this._checkBatchId(e),V(typeof r=="string",r),this._binaryProperties){let s=this._binaryProperties[r];if(xt(s))return this._getBinaryProperty(s,e)}let n=this._properties[r];if(xt(n))return mi(n[e],!0);if(this._hierarchy){let s=this._getHierarchyProperty(e,r);if(xt(s))return s}}setProperty(e,r,n){let s=this.featureCount;if(this._checkBatchId(e),V(typeof r=="string",r),this._binaryProperties){let o=this._binaryProperties[r];if(o){this._setBinaryProperty(o,e,n);return}}if(this._hierarchy&&this._setHierarchyProperty(this,e,r,n))return;let i=this._properties[r];xt(i)||(this._properties[r]=new Array(s),i=this._properties[r]),i[e]=mi(n,!0)}_checkBatchId(e){if(!(e>=0&&e<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(e,r){return e.unpack(e.typedArray,r)}_setBinaryProperty(e,r,n){e.pack(n,e.typedArray,r)}_initializeBinaryProperties(){let e=null;for(let r in this._properties){let n=this._properties[r],s=this._initializeBinaryProperty(r,n);s&&(e=e||{},e[r]=s)}return e}_initializeBinaryProperty(e,r){if("byteOffset"in r){let n=r;V(this.binary,`Property ${e} requires a batch table binary.`),V(n.type,`Property ${e} requires a type.`);let s=Zd(n,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:s.values,componentCount:s.size,unpack:s.unpacker,pack:s.packer}}return null}_hasPropertyInHierarchy(e,r){if(!this._hierarchy)return!1;let n=yr(this._hierarchy,e,(s,i)=>{let o=s.classIds[i],a=s.classes[o].instances;return xt(a[r])});return xt(n)}_getPropertyNamesInHierarchy(e,r){yr(this._hierarchy,e,(n,s)=>{let i=n.classIds[s],o=n.classes[i].instances;for(let a in o)o.hasOwnProperty(a)&&r.indexOf(a)===-1&&r.push(a)})}_getHierarchyProperty(e,r){return yr(this._hierarchy,e,(n,s)=>{let i=n.classIds[s],o=n.classes[i],a=n.classIndexes[s],c=o.instances[r];return xt(c)?xt(c.typedArray)?this._getBinaryProperty(c,a):mi(c[a],!0):null})}_setHierarchyProperty(e,r,n,s){let i=yr(this._hierarchy,r,(o,a)=>{let c=o.classIds[a],l=o.classes[c],h=o.classIndexes[a],f=l.instances[n];return xt(f)?(V(a===r,`Inherited property "${n}" is read-only.`),xt(f.typedArray)?this._setBinaryProperty(f,h,s):f[h]=mi(s,!0),!0):!1});return xt(i)}};function Ne(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=new DataView(e);if(t.magic=n.getUint32(r,!0),r+=4,t.version=n.getUint32(r,!0),r+=4,t.byteLength=n.getUint32(r,!0),r+=4,t.version!==1)throw new Error(`3D Tile Version ${t.version} not supported`);return r}var Ir=4,tp="b3dm tile in legacy format.";function Fr(t,e,r){let n=new DataView(e),s;t.header=t.header||{};let i=n.getUint32(r,!0);r+=Ir;let o=n.getUint32(r,!0);r+=Ir;let a=n.getUint32(r,!0);r+=Ir;let c=n.getUint32(r,!0);return r+=Ir,a>=570425344?(r-=Ir*2,s=i,a=o,c=0,i=0,o=0,console.warn(tp)):c>=570425344&&(r-=Ir,s=a,a=i,c=o,i=0,o=0,console.warn(tp)),t.header.featureTableJsonByteLength=i,t.header.featureTableBinaryByteLength=o,t.header.batchTableJsonByteLength=a,t.header.batchTableBinaryByteLength=c,t.header.batchLength=s,r}function Nr(t,e,r,n){return r=aR(t,e,r,n),r=cR(t,e,r,n),r}function aR(t,e,r,n){let{featureTableJsonByteLength:s,featureTableBinaryByteLength:i,batchLength:o}=t.header||{};if(t.featureTableJson={BATCH_LENGTH:o||0},s&&s>0){let a=oc(e,r,s);t.featureTableJson=JSON.parse(a)}return r+=s||0,t.featureTableBinary=new Uint8Array(e,r,i),r+=i||0,r}function cR(t,e,r,n){let{batchTableJsonByteLength:s,batchTableBinaryByteLength:i}=t.header||{};if(s&&s>0){let o=oc(e,r,s);t.batchTableJson=JSON.parse(o),r+=s,i&&i>0&&(t.batchTableBinary=new Uint8Array(e,r,i),t.batchTableBinary=new Uint8Array(t.batchTableBinary),r+=i)}return r}function pc(t,e,r){if(!e&&(!t||!t.batchIds||!r))return null;let{batchIds:n,isRGB565:s,pointCount:i=0}=t;if(n&&r){let o=new Uint8ClampedArray(i*3);for(let a=0;a<i;a++){let c=n[a],h=r.getProperty(c,"dimensions").map(f=>f*255);o[a*3]=h[0],o[a*3+1]=h[1],o[a*3+2]=h[2]}return{type:w.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}if(e&&s){let o=new Uint8ClampedArray(i*3);for(let a=0;a<i;a++){let c=uc(e[a]);o[a*3]=c[0],o[a*3+1]=c[1],o[a*3+2]=c[2]}return{type:w.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}return e&&e.length===i*3?{type:w.UNSIGNED_BYTE,value:e,size:3,normalized:!0}:{type:w.UNSIGNED_BYTE,value:e||new Uint8ClampedArray,size:4,normalized:!0}}var ep=new m;function rp(t,e){if(!e)return null;if(t.isOctEncoded16P){let r=new Float32Array((t.pointsLength||0)*3);for(let n=0;n<(t.pointsLength||0);n++)dc(e[n*2],e[n*2+1],ep),ep.toArray(r,n*3);return{type:w.FLOAT,size:2,value:r}}return{type:w.FLOAT,size:2,value:e}}function np(t,e,r){return t.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(t.isQuantized=!1,lR(t,e)):{type:w.UNSIGNED_SHORT,value:e,size:3,normalized:!0}:e}function lR(t,e){let r=new m,n=new Float32Array(t.pointCount*3);for(let s=0;s<t.pointCount;s++)r.set(e[s*3],e[s*3+1],e[s*3+2]).scale(1/t.quantizedRange).multiply(t.quantizedVolumeScale).add(t.quantizedVolumeOffset).toArray(n,s*3);return n}async function sp(t,e,r,n,s){r=Ne(t,e,r),r=Fr(t,e,r),r=Nr(t,e,r,n),hR(t);let{featureTable:i,batchTable:o}=fR(t);return await AR(t,i,o,n,s),uR(t,i,n),dR(t,i,o),pR(t,i),r}function hR(t){t.attributes={positions:null,colors:null,normals:null,batchIds:null},t.isQuantized=!1,t.isTranslucent=!1,t.isRGB565=!1,t.isOctEncoded16P=!1}function fR(t){let e=new fe(t.featureTableJson,t.featureTableBinary),r=e.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(r))throw new Error("POINTS_LENGTH must be defined");e.featuresLength=r,t.featuresLength=r,t.pointsLength=r,t.pointCount=r,t.rtcCenter=e.getGlobalProperty("RTC_CENTER",w.FLOAT,3);let n=gR(t,e);return{featureTable:e,batchTable:n}}function uR(t,e,r){if(t.attributes=t.attributes||{positions:null,colors:null,normals:null,batchIds:null},!t.attributes.positions){if(e.hasProperty("POSITION"))t.attributes.positions=e.getPropertyArray("POSITION",w.FLOAT,3);else if(e.hasProperty("POSITION_QUANTIZED")){let n=e.getPropertyArray("POSITION_QUANTIZED",w.UNSIGNED_SHORT,3);if(t.isQuantized=!0,t.quantizedRange=(1<<16)-1,t.quantizedVolumeScale=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",w.FLOAT,3),!t.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(t.quantizedVolumeOffset=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",w.FLOAT,3),!t.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");t.attributes.positions=np(t,n,r)}}if(!t.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function dR(t,e,r){if(t.attributes=t.attributes||{positions:null,colors:null,normals:null,batchIds:null},!t.attributes.colors){let n=null;e.hasProperty("RGBA")?(n=e.getPropertyArray("RGBA",w.UNSIGNED_BYTE,4),t.isTranslucent=!0):e.hasProperty("RGB")?n=e.getPropertyArray("RGB",w.UNSIGNED_BYTE,3):e.hasProperty("RGB565")&&(n=e.getPropertyArray("RGB565",w.UNSIGNED_SHORT,1),t.isRGB565=!0),t.attributes.colors=pc(t,n,r)}e.hasProperty("CONSTANT_RGBA")&&(t.constantRGBA=e.getGlobalProperty("CONSTANT_RGBA",w.UNSIGNED_BYTE,4))}function pR(t,e){if(t.attributes=t.attributes||{positions:null,colors:null,normals:null,batchIds:null},!t.attributes.normals){let r=null;e.hasProperty("NORMAL")?r=e.getPropertyArray("NORMAL",w.FLOAT,3):e.hasProperty("NORMAL_OCT16P")&&(r=e.getPropertyArray("NORMAL_OCT16P",w.UNSIGNED_BYTE,2),t.isOctEncoded16P=!0),t.attributes.normals=rp(t,r)}}function gR(t,e){let r=null;if(!t.batchIds&&e.hasProperty("BATCH_ID")&&(t.batchIds=e.getPropertyArray("BATCH_ID",w.UNSIGNED_SHORT,1),t.batchIds)){let n=e.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:s,batchTableBinary:i}=t;r=new tr(s,i,n)}return r}async function AR(t,e,r,n,s){let i,o,a,c=t.batchTableJson&&t.batchTableJson.extensions&&t.batchTableJson.extensions["3DTILES_draco_point_compression"];c&&(a=c.properties);let l=e.getExtension("3DTILES_draco_point_compression");if(l){o=l.properties;let f=l.byteOffset,u=l.byteLength;if(!o||!Number.isFinite(f)||!u)throw new Error("Draco properties, byteOffset, and byteLength must be defined");i=(t.featureTableBinary||[]).slice(f,f+u),t.hasPositions=Number.isFinite(o.POSITION),t.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),t.hasNormals=Number.isFinite(o.NORMAL),t.hasBatchIds=Number.isFinite(o.BATCH_ID),t.isTranslucent=Number.isFinite(o.RGBA)}if(!i)return!0;let h={buffer:i,properties:{...o,...a},featureTableProperties:o,batchTableProperties:a,dequantizeInShader:!1};return await _R(t,h,n,s)}async function _R(t,e,r,n){if(!n)return;let s={...r,draco:{...r?.draco,extraAttributes:e.batchTableProperties||{}}};delete s["3d-tiles"];let i=await Ct(e.buffer,_i,s,n),o=i.attributes.POSITION&&i.attributes.POSITION.value,a=i.attributes.COLOR_0&&i.attributes.COLOR_0.value,c=i.attributes.NORMAL&&i.attributes.NORMAL.value,l=i.attributes.BATCH_ID&&i.attributes.BATCH_ID.value,h=o&&i.attributes.POSITION.value.quantization,f=c&&i.attributes.NORMAL.value.quantization;if(h){let d=i.POSITION.data.quantization,p=d.range;t.quantizedVolumeScale=new m(p,p,p),t.quantizedVolumeOffset=new m(d.minValues),t.quantizedRange=(1<<d.quantizationBits)-1,t.isQuantizedDraco=!0}f&&(t.octEncodedRange=(1<<i.NORMAL.data.quantization.quantizationBits)-1,t.isOctEncodedDraco=!0);let u={};if(e.batchTableProperties)for(let d of Object.keys(e.batchTableProperties))i.attributes[d]&&i.attributes[d].value&&(u[d.toLowerCase()]=i.attributes[d].value);t.attributes={positions:o,colors:pc(t,a,void 0),normals:c,batchIds:l,...u}}var gc={};ht(gc,{decode:()=>FR,name:()=>IR});function at(t,e){if(!t)throw new Error(e||"assert failed: gltf")}var Ti={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ei={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var mR=1.33,ip=["SCALAR","VEC2","VEC3","VEC4"],TR=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],ER=new Map(TR),RR={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},xR={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},SR={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function Ri(t){return ip[t-1]||ip[0]}function Or(t){let e=ER.get(t.constructor);if(!e)throw new Error("Illegal typed array");return e}function br(t,e){let r=SR[t.componentType],n=RR[t.type],s=xR[t.componentType],i=t.count*n,o=t.count*n*s;at(o>=0&&o<=e.byteLength);let a=Ei[t.componentType],c=Ti[t.type];return{ArrayType:r,length:i,byteLength:o,componentByteSize:a,numberOfComponentsInElement:c}}function Nn(t){let{images:e,bufferViews:r}=t;e=e||[],r=r||[];let n=e.map(o=>o.bufferView);r=r.filter(o=>!n.includes(o));let s=r.reduce((o,a)=>o+a.byteLength,0),i=e.reduce((o,a)=>{let{width:c,height:l}=a.image;return o+c*l},0);return s+Math.ceil(4*i*mR)}function op(t,e,r){let n=t.bufferViews[r];at(n);let s=n.buffer,i=e[s];at(i);let o=(n.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,o,n.byteLength)}function ap(t,e,r){var n,s;let i=typeof r=="number"?(n=t.accessors)===null||n===void 0?void 0:n[r]:r;if(!i)throw new Error(`No gltf accessor ${JSON.stringify(r)}`);let o=(s=t.bufferViews)===null||s===void 0?void 0:s[i.bufferView||0];if(!o)throw new Error(`No gltf buffer view for accessor ${o}`);let{arrayBuffer:a,byteOffset:c}=e[o.buffer],l=(c||0)+(i.byteOffset||0)+(o.byteOffset||0),{ArrayType:h,length:f,componentByteSize:u,numberOfComponentsInElement:d}=br(i,o),p=u*d,_=o.byteStride||p;if(typeof o.byteStride>"u"||o.byteStride===p)return new h(a,l,f);let A=new h(f);for(let T=0;T<i.count;T++){let x=new h(a,l+T*_,d);A.set(x,T*d)}return A}function CR(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var K=class{constructor(e){this.gltf=void 0,this.sourceBuffers=void 0,this.byteLength=void 0,this.gltf={json:e?.json||CR(),buffers:e?.buffers||[],images:e?.images||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}hasExtension(e){let r=this.getUsedExtensions().find(s=>s===e),n=this.getRequiredExtensions().find(s=>s===e);return typeof r=="string"||typeof n=="string"}getExtension(e){let r=this.getUsedExtensions().find(s=>s===e),n=this.json.extensions||{};return r?n[e]:null}getRequiredExtension(e){return this.getRequiredExtensions().find(n=>n===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(e,r){return(e.extensions||{})[r]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,r){if(typeof r=="object")return r;let n=this.json[e]&&this.json[e][r];if(!n)throw new Error(`glTF file error: Could not find ${e}[${r}]`);return n}getTypedArrayForBufferView(e){e=this.getBufferView(e);let r=e.buffer,n=this.gltf.buffers[r];at(n);let s=(e.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,s,e.byteLength)}getTypedArrayForAccessor(e){let r=this.getAccessor(e);return ap(this.gltf.json,this.gltf.buffers,r)}getTypedArrayForImageData(e){e=this.getAccessor(e);let r=this.getBufferView(e.bufferView),s=this.getBuffer(r.buffer).data,i=r.byteOffset||0;return new Uint8Array(s,i,r.byteLength)}addApplicationData(e,r){return this.json[e]=r,this}addExtraData(e,r){return this.json.extras=this.json.extras||{},this.json.extras[e]=r,this}addObjectExtension(e,r,n){return e.extensions=e.extensions||{},e.extensions[r]=n,this.registerUsedExtension(r),this}setObjectExtension(e,r,n){let s=e.extensions||{};s[r]=n}removeObjectExtension(e,r){let n=e?.extensions||{};if(n[r]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(r)||s.push(r)}delete n[r]}addExtension(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return at(r),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=r,this.registerUsedExtension(e),r}addRequiredExtension(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return at(r),this.addExtension(e,r),this.registerRequiredExtension(e),r}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(r=>r===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(r=>r===e)||this.json.extensionsRequired.push(e)}removeExtension(e){var r;if((r=this.json.extensions)!==null&&r!==void 0&&r[e]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let n=this.json.extensionsRemoved;n.includes(e)||n.push(e)}this.json.extensions&&delete this.json.extensions[e],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e)}setDefaultScene(e){this.json.scene=e}addScene(e){let{nodeIndices:r}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:r}),this.json.scenes.length-1}addNode(e){let{meshIndex:r,matrix:n}=e;this.json.nodes=this.json.nodes||[];let s={mesh:r};return n&&(s.matrix=n),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(e){let{attributes:r,indices:n,material:s,mode:i=4}=e,a={primitives:[{attributes:this._addAttributes(r),mode:i}]};if(n){let c=this._addIndices(n);a.primitives[0].indices=c}return Number.isFinite(s)&&(a.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(e){let n={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(n),this.json.meshes.length-1}addImage(e,r){let n=He(e),s=r||n?.mimeType,o={bufferView:this.addBufferView(e),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.byteLength,s=e.byteLength;at(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);let i={buffer:r,byteOffset:n,byteLength:s};return this.byteLength+=Ae(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(e,r){let n={bufferView:e,type:Ri(r.size),componentType:r.componentType,count:r.count,max:r.max,min:r.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{size:3},n=this.addBufferView(e),s={min:r.min,max:r.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(e,r.size));let i={size:r.size,componentType:Or(e),count:Math.round(e.length/r.size),min:s.min,max:s.max};return this.addAccessor(n,Object.assign(i,r))}addTexture(e){let{imageIndex:r}=e,n={source:r};return this.json.textures=this.json.textures||[],this.json.textures.push(n),this.json.textures.length-1}addMaterial(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}createBinaryChunk(){var e,r;this.gltf.buffers=[];let n=this.byteLength,s=new ArrayBuffer(n),i=new Uint8Array(s),o=0;for(let a of this.sourceBuffers||[])o=So(a,i,o);(e=this.json)!==null&&e!==void 0&&(r=e.buffers)!==null&&r!==void 0&&r[0]?this.json.buffers[0].byteLength=n:this.json.buffers=[{byteLength:n}],this.gltf.binary=s,this.sourceBuffers=[s]}_removeStringFromArray(e,r){let n=!0;for(;n;){let s=e.indexOf(r);s>-1?e.splice(s,1):n=!1}}_addAttributes(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={};for(let n in e){let s=e[n],i=this._getGltfAttributeName(n),o=this.addBinaryBuffer(s.value,s);r[i]=o}return r}_addIndices(e){return this.addBinaryBuffer(e,{size:1})}_getGltfAttributeName(e){switch(e.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return e}}_getAccessorMinMax(e,r){let n={min:null,max:null};if(e.length<r)return n;n.min=[],n.max=[];let s=e.subarray(0,r);for(let i of s)n.min.push(i),n.max.push(i);for(let i=r;i<e.length;i+=r)for(let o=0;o<r;o++)n.min[0+o]=Math.min(n.min[0+o],e[i+o]),n.max[0+o]=Math.max(n.max[0+o],e[i+o]);return n}};function cp(t){return(t%1+1)%1}var lp={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},BR={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},hp={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function On(t,e){return hp[e]*lp[t]}function Pr(t,e,r,n){if(r!=="UINT8"&&r!=="UINT16"&&r!=="UINT32"&&r!=="UINT64")return null;let s=t.getTypedArrayForBufferView(e),i=Dr(s,"SCALAR",r,n+1);return i instanceof BigInt64Array||i instanceof BigUint64Array?null:i}function Dr(t,e,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,s=lp[e],i=BR[r],o=hp[r],a=n*s,c=a*o,l=t.buffer,h=t.byteOffset;return h%o!==0&&(l=new Uint8Array(l).slice(h,h+c).buffer,h=0),new i(l,h,a)}function wr(t,e,r){var n,s;let i=`TEXCOORD_${e.texCoord||0}`,o=r.attributes[i],a=t.getTypedArrayForAccessor(o),c=t.gltf.json,l=e.index,h=(n=c.textures)===null||n===void 0||(s=n[l])===null||s===void 0?void 0:s.source;if(typeof h<"u"){var f,u,d;let p=(f=c.images)===null||f===void 0||(u=f[h])===null||u===void 0?void 0:u.mimeType,_=(d=t.gltf.images)===null||d===void 0?void 0:d[h];if(_&&typeof _.width<"u"){let A=[];for(let T=0;T<a.length;T+=2){let x=MR(_,p,a,T,e.channels);A.push(x)}return A}}return[]}function xi(t,e,r,n,s){if(!(r!=null&&r.length))return;let i=[];for(let h of r){let f=n.findIndex(u=>u===h);f===-1&&(f=n.push(h)-1),i.push(f)}let o=new Uint32Array(i),a=t.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,c=t.addBufferView(o,a,0),l=t.addAccessor(c,{size:1,componentType:Or(o),count:o.length});s.attributes[e]=l}function MR(t,e,r,n){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[0],i={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=r[n],a=r[n+1],c=1;e&&(e.indexOf("image/jpeg")!==-1||e.indexOf("image/png")!==-1)&&(c=4);let l=yR(o,a,t,c),h=0;for(let f of s){let u=typeof f=="number"?Object.values(i)[f]:i[f],d=l+u.offset,p=en(t);if(p.data.length<=d)throw new Error(`${p.data.length} <= ${d}`);let _=p.data[d];h|=_<<u.shift}return h}function yR(t,e,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,s=r.width,i=cp(t)*(s-1),o=Math.round(i),a=r.height,c=cp(e)*(a-1),l=Math.round(c),h=r.components?r.components:n;return(l*s+o)*h}function Si(t,e,r,n,s){let i=[];for(let o=0;o<e;o++){let a=r[o],c=r[o+1]-r[o];if(c+a>n)break;let l=a/s,h=c/s;i.push(t.slice(l,l+h))}return i}function Ci(t,e,r){let n=[];for(let s=0;s<e;s++){let i=s*r;n.push(t.slice(i,i+r))}return n}function Bi(t,e,r,n){if(r)throw new Error("Not implemented - arrayOffsets for strings is specified");if(n){let s=[],i=new TextDecoder("utf8"),o=0;for(let a=0;a<t;a++){let c=n[a+1]-n[a];if(c+o<=e.length){let l=e.subarray(o,c+o),h=i.decode(l);s.push(h),o+=c}}return s}return[]}var fp="EXT_mesh_features",IR=fp;async function FR(t,e){let r=new K(t);NR(r,e)}function NR(t,e){let r=t.gltf.json;if(r.meshes)for(let n of r.meshes)for(let s of n.primitives)OR(t,s,e)}function OR(t,e,r){var n,s;if(!(r!=null&&(n=r.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let i=(s=e.extensions)===null||s===void 0?void 0:s[fp],o=i?.featureIds;if(o)for(let c of o){var a;let l;if(typeof c.attribute<"u"){let h=`_FEATURE_ID_${c.attribute}`,f=e.attributes[h];l=t.getTypedArrayForAccessor(f)}else typeof c.texture<"u"&&r!==null&&r!==void 0&&(a=r.gltf)!==null&&a!==void 0&&a.loadImages?l=wr(t,c.texture,e):l=[];c.data=l}}var mc={};ht(mc,{decode:()=>PR,name:()=>bR});var Ac="EXT_structural_metadata",bR=Ac;async function PR(t,e){let r=new K(t);DR(r,e)}function DR(t,e){var r,n;if(!((r=e.gltf)!==null&&r!==void 0&&r.loadBuffers))return;let s=t.getExtension(Ac);s&&((n=e.gltf)!==null&&n!==void 0&&n.loadImages&&wR(t,s),vR(t,s))}function wR(t,e){let r=e.propertyTextures,n=t.gltf.json;if(r&&n.meshes)for(let s of n.meshes)for(let i of s.primitives)LR(t,r,i,e)}function vR(t,e){let r=e.schema;if(!r)return;let n=r.classes,s=e.propertyTables;if(n&&s)for(let i in n){let o=UR(s,i);o&&VR(t,r,o)}}function UR(t,e){for(let r of t)if(r.class===e)return r;return null}function LR(t,e,r,n){var s;if(!e)return;let i=(s=r.extensions)===null||s===void 0?void 0:s[Ac],o=i?.propertyTextures;if(o)for(let a of o){let c=e[a];HR(t,c,r,n)}}function HR(t,e,r,n){if(!e.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);let s=e.class;for(let o in e.properties){var i;let a=`${s}_${o}`,c=(i=e.properties)===null||i===void 0?void 0:i[o];if(!c)continue;c.data||(c.data=[]);let l=c.data,h=wr(t,c,r);h!==null&&(xi(t,a,h,l,r),c.data=l,n.dataAttributeNames.push(a))}}function VR(t,e,r){var n;let s=(n=e.classes)===null||n===void 0?void 0:n[r.class];if(!s)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let i=r.count;for(let a in s.properties){var o;let c=s.properties[a],l=(o=r.properties)===null||o===void 0?void 0:o[a];if(l){let h=XR(t,e,c,i,l);l.data=h}}}function XR(t,e,r,n,s){let i=[],o=s.values,a=t.getTypedArrayForBufferView(o),c=WR(t,r,s,n),l=zR(t,s,n);switch(r.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{i=kR(r,n,a,c);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${r.type}`);case"STRING":{i=Bi(n,a,c,l);break}case"ENUM":{i=GR(e,r,n,a,c);break}default:throw new Error(`Unknown classProperty type ${r.type}`)}return i}function WR(t,e,r,n){return e.array&&typeof e.count>"u"&&typeof r.arrayOffsets<"u"?Pr(t,r.arrayOffsets,r.arrayOffsetType||"UINT32",n):null}function zR(t,e,r){return typeof e.stringOffsets<"u"?Pr(t,e.stringOffsets,e.stringOffsetType||"UINT32",r):null}function kR(t,e,r,n){let s=t.array,i=t.count,o=On(t.type,t.componentType),a=r.byteLength/o,c;return t.componentType?c=Dr(r,t.type,t.componentType,a):c=r,s?n?Si(c,e,n,r.length,o):i?Ci(c,e,i):[]:c}function GR(t,e,r,n,s){var i;let o=e.enumType;if(!o)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let a=(i=t.enums)===null||i===void 0?void 0:i[o];if(!a)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`);let c=a.valueType||"UINT16",l=On(e.type,c),h=n.byteLength/l,f=Dr(n,e.type,c,h);if(f||(f=n),e.array){if(s)return KR({valuesData:f,numberOfElements:r,arrayOffsets:s,valuesDataBytesLength:n.length,elementSize:l,enumEntry:a});let u=e.count;return u?JR(f,r,u,a):[]}return _c(f,0,r,a)}function KR(t){let{valuesData:e,numberOfElements:r,arrayOffsets:n,valuesDataBytesLength:s,elementSize:i,enumEntry:o}=t,a=[];for(let c=0;c<r;c++){let l=n[c],h=n[c+1]-n[c];if(h+l>s)break;let f=l/i,u=h/i,d=_c(e,f,u,o);a.push(d)}return a}function JR(t,e,r,n){let s=[];for(let i=0;i<e;i++){let o=r*i,a=_c(t,o,r,n);s.push(a)}return s}function _c(t,e,r,n){let s=[];for(let i=0;i<r;i++)if(t instanceof BigInt64Array||t instanceof BigUint64Array)s.push("");else{let o=t[e+i],a=YR(n,o);a?s.push(a.name):s.push("")}return s}function YR(t,e){for(let r of t.values)if(r.value===e)return r;return null}var Tc={};ht(Tc,{decode:()=>jR,name:()=>qR});var up="EXT_feature_metadata",qR=up;async function jR(t,e){let r=new K(t);ZR(r,e)}function ZR(t,e){var r,n;if(!((r=e.gltf)!==null&&r!==void 0&&r.loadBuffers))return;let s=t.getExtension(up);s&&((n=e.gltf)!==null&&n!==void 0&&n.loadImages&&QR(t,s),$R(t,s))}function QR(t,e){let r=e.schema;if(!r)return;let n=r.classes,{featureTextures:s}=e;if(n&&s)for(let i in n){let o=n[i],a=ex(s,i);a&&nx(t,a,o)}}function $R(t,e){let r=e.schema;if(!r)return;let n=r.classes,s=e.featureTables;if(n&&s)for(let i in n){let o=tx(s,i);o&&rx(t,r,o)}}function tx(t,e){for(let r in t){let n=t[r];if(n.class===e)return n}return null}function ex(t,e){for(let r in t){let n=t[r];if(n.class===e)return n}return null}function rx(t,e,r){var n;if(!r.class)return;let s=(n=e.classes)===null||n===void 0?void 0:n[r.class];if(!s)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let i=r.count;for(let a in s.properties){var o;let c=s.properties[a],l=(o=r.properties)===null||o===void 0?void 0:o[a];if(l){let h=sx(t,e,c,i,l);l.data=h}}}function nx(t,e,r){let n=e.class;for(let i in r.properties){var s;let o=e==null||(s=e.properties)===null||s===void 0?void 0:s[i];if(o){let a=lx(t,o,n);o.data=a}}}function sx(t,e,r,n,s){let i=[],o=s.bufferView,a=t.getTypedArrayForBufferView(o),c=ix(t,r,s,n),l=ox(t,r,s,n);return r.type==="STRING"||r.componentType==="STRING"?i=Bi(n,a,c,l):ax(r)&&(i=cx(r,n,a,c)),i}function ix(t,e,r,n){return e.type==="ARRAY"&&typeof e.componentCount>"u"&&typeof r.arrayOffsetBufferView<"u"?Pr(t,r.arrayOffsetBufferView,r.offsetType||"UINT32",n):null}function ox(t,e,r,n){return typeof r.stringOffsetBufferView<"u"?Pr(t,r.stringOffsetBufferView,r.offsetType||"UINT32",n):null}function ax(t){let e=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return e.includes(t.type)||typeof t.componentType<"u"&&e.includes(t.componentType)}function cx(t,e,r,n){let s=t.type==="ARRAY",i=t.componentCount,o="SCALAR",a=t.componentType||t.type,c=On(o,a),l=r.byteLength/c,h=Dr(r,o,a,l);return s?n?Si(h,e,n,r.length,c):i?Ci(h,e,i):[]:h}function lx(t,e,r){let n=t.gltf.json;if(!n.meshes)return[];let s=[];for(let i of n.meshes)for(let o of i.primitives)hx(t,r,e,s,o);return s}function hx(t,e,r,n,s){let i={channels:r.channels,...r.texture},o=wr(t,i,s);o&&xi(t,e,o,n,s)}var dp="4.1.0";var vr=!0,pp=1735152710,xc=12,Mi=8,fx=1313821514,ux=5130562,dx=0,px=0,gx=1;function Ax(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return`${String.fromCharCode(t.getUint8(e+0))}${String.fromCharCode(t.getUint8(e+1))}${String.fromCharCode(t.getUint8(e+2))}${String.fromCharCode(t.getUint8(e+3))}`}function gp(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=new DataView(t),{magic:s=pp}=r,i=n.getUint32(e,!1);return i===s||i===pp}function Ap(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},s=new DataView(e),i=Ax(s,r+0),o=s.getUint32(r+4,vr),a=s.getUint32(r+8,vr);switch(Object.assign(t,{header:{byteOffset:r,byteLength:a,hasBinChunk:!1},type:i,version:o,json:{},binChunks:[]}),r+=xc,t.version){case 1:return _x(t,s,r);case 2:return mx(t,s,r,n={});default:throw new Error(`Invalid GLB version ${t.version}. Only supports version 1 and 2.`)}}function _x(t,e,r){V(t.header.byteLength>xc+Mi);let n=e.getUint32(r+0,vr),s=e.getUint32(r+4,vr);return r+=Mi,V(s===dx),Ec(t,e,r,n),r+=n,r+=Rc(t,e,r,t.header.byteLength),r}function mx(t,e,r,n){return V(t.header.byteLength>xc+Mi),Tx(t,e,r,n),r+t.header.byteLength}function Tx(t,e,r,n){for(;r+8<=t.header.byteLength;){let s=e.getUint32(r+0,vr),i=e.getUint32(r+4,vr);switch(r+=Mi,i){case fx:Ec(t,e,r,s);break;case ux:Rc(t,e,r,s);break;case px:n.strict||Ec(t,e,r,s);break;case gx:n.strict||Rc(t,e,r,s);break;default:break}r+=Ae(s,4)}return r}function Ec(t,e,r,n){let s=new Uint8Array(e.buffer,r,n),o=new TextDecoder("utf8").decode(s);return t.json=JSON.parse(o),Ae(n,4)}function Rc(t,e,r,n){return t.header.hasBinChunk=!0,t.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:e.buffer}),Ae(n,4)}function Sc(t,e){if(t.startsWith("data:")||t.startsWith("http:")||t.startsWith("https:"))return t;let n=e.baseUri||e.uri;if(!n)throw new Error(`'baseUri' must be provided to resolve relative url ${t}`);return n.substr(0,n.lastIndexOf("/")+1)+t}var Bc={};ht(Bc,{decode:()=>Ox,name:()=>Nx});var Ex="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",Rx="B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",xx=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),Sx=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),Cx={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Bx={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function _p(t,e,r,n,s){let i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"NONE",o=await Mx();Fx(o,o.exports[Bx[s]],t,e,r,n,o.exports[Cx[i||"NONE"]])}var Cc;async function Mx(){return Cc||(Cc=yx()),Cc}async function yx(){let t=Ex;WebAssembly.validate(xx)&&(t=Rx,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let e=await WebAssembly.instantiate(Ix(t),{});return await e.instance.exports.__wasm_call_ctors(),e.instance}function Ix(t){let e=new Uint8Array(t.length);for(let n=0;n<t.length;++n){let s=t.charCodeAt(n);e[n]=s>96?s-71:s>64?s-65:s>47?s+4:s>46?63:62}let r=0;for(let n=0;n<t.length;++n)e[r++]=e[n]<60?Sx[e[n]]:(e[n]-60)*64+e[++n];return e.buffer.slice(0,r)}function Fx(t,e,r,n,s,i,o){let a=t.exports.sbrk,c=n+3&-4,l=a(c*s),h=a(i.length),f=new Uint8Array(t.exports.memory.buffer);f.set(i,h);let u=e(l,n,s,h,i.length);if(u===0&&o&&o(l,c,s),r.set(f.subarray(l,l+n*s)),a(l-a(0)),u!==0)throw new Error(`Malformed buffer data: ${u}`)}var yi="EXT_meshopt_compression",Nx=yi;async function Ox(t,e){var r,n;let s=new K(t);if(!(e!=null&&(r=e.gltf)!==null&&r!==void 0&&r.decompressMeshes)||!((n=e.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let i=[];for(let o of t.json.bufferViews||[])i.push(bx(s,o));await Promise.all(i),s.removeExtension(yi)}async function bx(t,e){let r=t.getObjectExtension(e,yi);if(r){let{byteOffset:n=0,byteLength:s=0,byteStride:i,count:o,mode:a,filter:c="NONE",buffer:l}=r,h=t.gltf.buffers[l],f=new Uint8Array(h.arrayBuffer,h.byteOffset+n,s),u=new Uint8Array(t.gltf.buffers[e.buffer].arrayBuffer,e.byteOffset,e.byteLength);await _p(u,o,i,f,a,c),t.removeObjectExtension(e,yi)}}var Mc={};ht(Mc,{name:()=>Px,preprocess:()=>Dx});var Ur="EXT_texture_webp",Px=Ur;function Dx(t,e){let r=new K(t);if(!wo("image/webp")){if(r.getRequiredExtensions().includes(Ur))throw new Error(`gltf: Required extension ${Ur} not supported by browser`);return}let{json:n}=r;for(let s of n.textures||[]){let i=r.getObjectExtension(s,Ur);i&&(s.source=i.source),r.removeObjectExtension(s,Ur)}r.removeExtension(Ur)}var yc={};ht(yc,{name:()=>wx,preprocess:()=>vx});var Ii="KHR_texture_basisu",wx=Ii;function vx(t,e){let r=new K(t),{json:n}=r;for(let s of n.textures||[]){let i=r.getObjectExtension(s,Ii);i&&(s.source=i.source,r.removeObjectExtension(s,Ii))}r.removeExtension(Ii)}var Fc={};ht(Fc,{decode:()=>Xx,encode:()=>Wx,name:()=>Hx,preprocess:()=>Vx});function mp(t){let e={};for(let r in t){let n=t[r];if(r!=="indices"){let s=Ic(n);e[r]=s}}return e}function Ic(t){let{buffer:e,size:r,count:n}=Ux(t);return{value:e,size:r,byteOffset:0,count:n,type:Ri(r),componentType:Or(e)}}function Ux(t){let e=t,r=1,n=0;return t&&t.value&&(e=t.value,r=t.size||1),e&&(ArrayBuffer.isView(e)||(e=Lx(e,Float32Array)),n=e.length/r),{buffer:e,size:r,count:n}}function Lx(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?Array.isArray(t)?new e(t):r&&!(t instanceof e)?new e(t):t:null}var Oe="KHR_draco_mesh_compression",Hx=Oe;function Vx(t,e,r){let n=new K(t);for(let s of Tp(n))n.getObjectExtension(s,Oe)}async function Xx(t,e,r){var n;if(!(e!=null&&(n=e.gltf)!==null&&n!==void 0&&n.decompressMeshes))return;let s=new K(t),i=[];for(let o of Tp(s))s.getObjectExtension(o,Oe)&&i.push(zx(s,o,e,r));await Promise.all(i),s.removeExtension(Oe)}function Wx(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=new K(t);for(let n of r.json.meshes||[])kx(n,e),r.addRequiredExtension(Oe)}async function zx(t,e,r,n){let s=t.getObjectExtension(e,Oe);if(!s)return;let i=t.getTypedArrayForBufferView(s.bufferView),o=De(i.buffer,i.byteOffset),a={...r};delete a["3d-tiles"];let c=await Ct(o,_i,a,n),l=mp(c.attributes);for(let[h,f]of Object.entries(l))if(h in e.attributes){let u=e.attributes[h],d=t.getAccessor(u);d!=null&&d.min&&d!==null&&d!==void 0&&d.max&&(f.min=d.min,f.max=d.max)}e.attributes=l,c.indices&&(e.indices=Ic(c.indices)),t.removeObjectExtension(e,Oe),Gx(e)}function kx(t,e){var r;let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:4,s=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(!s.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let o=s.DracoWriter.encodeSync({attributes:t}),a=i==null||(r=i.parseSync)===null||r===void 0?void 0:r.call(i,{attributes:t}),c=s._addFauxAttributes(a.attributes),l=s.addBufferView(o);return{primitives:[{attributes:c,mode:n,extensions:{[Oe]:{bufferView:l,attributes:c}}}]}}function Gx(t){if(!t.attributes&&Object.keys(t.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*Tp(t){for(let e of t.json.meshes||[])for(let r of e.primitives)yield r}var Oc={};ht(Oc,{decode:()=>qx,name:()=>Kx});var Nc="KHR_texture_transform",Kx=Nc,Fi=new m,Jx=new z,Yx=new z;async function qx(t,e){var r;if(!new K(t).hasExtension(Nc)||!((r=e.gltf)!==null&&r!==void 0&&r.loadBuffers))return;let i=t.json.materials||[];for(let o=0;o<i.length;o++)jx(o,t)}function jx(t,e){var r,n,s;let i=[],o=(r=e.json.materials)===null||r===void 0?void 0:r[t],a=o==null||(n=o.pbrMetallicRoughness)===null||n===void 0?void 0:n.baseColorTexture;a&&bn(e,t,a,i);let c=o?.emissiveTexture;c&&bn(e,t,c,i);let l=o?.normalTexture;l&&bn(e,t,l,i);let h=o?.occlusionTexture;h&&bn(e,t,h,i);let f=o==null||(s=o.pbrMetallicRoughness)===null||s===void 0?void 0:s.metallicRoughnessTexture;f&&bn(e,t,f,i)}function bn(t,e,r,n){let s=Zx(r,n);if(!s)return;let i=t.json.meshes||[];for(let o of i)for(let a of o.primitives){let c=a.material;Number.isFinite(c)&&e===c&&Qx(t,a,s)}}function Zx(t,e){var r;let n=(r=t.extensions)===null||r===void 0?void 0:r[Nc],{texCoord:s=0}=t,{texCoord:i=s}=n;if(!(e.findIndex(a=>{let[c,l]=a;return c===s&&l===i})!==-1)){let a=eS(n);return s!==i&&(t.texCoord=i),e.push([s,i]),{originalTexCoord:s,texCoord:i,matrix:a}}return null}function Qx(t,e,r){let{originalTexCoord:n,texCoord:s,matrix:i}=r,o=e.attributes[`TEXCOORD_${n}`];if(Number.isFinite(o)){var a;let l=(a=t.json.accessors)===null||a===void 0?void 0:a[o];if(l&&l.bufferView){var c;let h=(c=t.json.bufferViews)===null||c===void 0?void 0:c[l.bufferView];if(h){let{arrayBuffer:f,byteOffset:u}=t.buffers[h.buffer],d=(u||0)+(l.byteOffset||0)+(h.byteOffset||0),{ArrayType:p,length:_}=br(l,h),A=Ei[l.componentType],T=Ti[l.type],x=h.byteStride||A*T,R=new Float32Array(_);for(let S=0;S<l.count;S++){let B=new p(f,d+S*x,2);Fi.set(B[0],B[1],1),Fi.transformByMatrix3(i),R.set([Fi[0],Fi[1]],S*T)}n===s?$x(l,h,t.buffers,R):tS(s,l,e,t,R)}}}}function $x(t,e,r,n){t.componentType=5126,r.push({arrayBuffer:n.buffer,byteOffset:0,byteLength:n.buffer.byteLength}),e.buffer=r.length-1,e.byteLength=n.buffer.byteLength,e.byteOffset=0,delete e.byteStride}function tS(t,e,r,n,s){n.buffers.push({arrayBuffer:s.buffer,byteOffset:0,byteLength:s.buffer.byteLength});let i=n.json.bufferViews;if(!i)return;i.push({buffer:n.buffers.length-1,byteLength:s.buffer.byteLength,byteOffset:0});let o=n.json.accessors;o&&(o.push({bufferView:i?.length-1,byteOffset:0,componentType:5126,count:e.count,type:"VEC2"}),r.attributes[`TEXCOORD_${t}`]=o.length-1)}function eS(t){let{offset:e=[0,0],rotation:r=0,scale:n=[1,1]}=t,s=new z().set(1,0,0,0,1,0,e[0],e[1],1),i=Jx.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),o=Yx.set(n[0],0,0,0,n[1],0,0,0,1);return s.multiplyRight(i).multiplyRight(o)}var bc={};ht(bc,{decode:()=>nS,encode:()=>sS,name:()=>rS});var er="KHR_lights_punctual",rS=er;async function nS(t){let e=new K(t),{json:r}=e,n=e.getExtension(er);n&&(e.json.lights=n.lights,e.removeExtension(er));for(let s of r.nodes||[]){let i=e.getObjectExtension(s,er);i&&(s.light=i.light),e.removeObjectExtension(s,er)}}async function sS(t){let e=new K(t),{json:r}=e;if(r.lights){let n=e.addExtension(er);at(!n.lights),n.lights=r.lights,delete r.lights}if(e.json.lights){for(let n of e.json.lights){let s=n.node;e.addObjectExtension(s,er,n)}delete e.json.lights}}var Pc={};ht(Pc,{decode:()=>oS,encode:()=>aS,name:()=>iS});var Pn="KHR_materials_unlit",iS=Pn;async function oS(t){let e=new K(t),{json:r}=e;for(let n of r.materials||[])n.extensions&&n.extensions.KHR_materials_unlit&&(n.unlit=!0),e.removeObjectExtension(n,Pn);e.removeExtension(Pn)}function aS(t){let e=new K(t),{json:r}=e;if(e.materials)for(let n of r.materials||[])n.unlit&&(delete n.unlit,e.addObjectExtension(n,Pn,{}),e.addExtension(Pn))}var Dc={};ht(Dc,{decode:()=>lS,encode:()=>hS,name:()=>cS});var Dn="KHR_techniques_webgl",cS=Dn;async function lS(t){let e=new K(t),{json:r}=e,n=e.getExtension(Dn);if(n){let s=fS(n,e);for(let i of r.materials||[]){let o=e.getObjectExtension(i,Dn);o&&(i.technique=Object.assign({},o,s[o.technique]),i.technique.values=uS(i.technique,e)),e.removeObjectExtension(i,Dn)}e.removeExtension(Dn)}}async function hS(t,e){}function fS(t,e){let{programs:r=[],shaders:n=[],techniques:s=[]}=t,i=new TextDecoder;return n.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=i.decode(e.getTypedArrayForBufferView(o.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),r.forEach(o=>{o.fragmentShader=n[o.fragmentShader],o.vertexShader=n[o.vertexShader]}),s.forEach(o=>{o.program=r[o.program]}),s}function uS(t,e){let r=Object.assign({},t.values);return Object.keys(t.uniforms||{}).forEach(n=>{t.uniforms[n].value&&!(n in r)&&(r[n]=t.uniforms[n].value)}),Object.keys(r).forEach(n=>{typeof r[n]=="object"&&r[n].index!==void 0&&(r[n].texture=e.getTexture(r[n].index))}),r}var Ep=[mc,gc,Bc,Mc,yc,Fc,bc,Pc,Dc,Oc,Tc];function Rp(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=Ep.filter(i=>Sp(i.name,e));for(let i of n){var s;(s=i.preprocess)===null||s===void 0||s.call(i,t,e,r)}}async function xp(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=Ep.filter(i=>Sp(i.name,e));for(let i of n){var s;await((s=i.decode)===null||s===void 0?void 0:s.call(i,t,e,r))}}function Sp(t,e){var r;let n=(e==null||(r=e.gltf)===null||r===void 0?void 0:r.excludeExtensions)||{};return!(t in n&&!n[t])}var wc="KHR_binary_glTF";function Cp(t){let e=new K(t),{json:r}=e;for(let n of r.images||[]){let s=e.getObjectExtension(n,wc);s&&Object.assign(n,s),e.removeObjectExtension(n,wc)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,e.removeExtension(wc)}var Bp={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},pS={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},vc=class{constructor(){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}},this.json=void 0}normalize(e,r){this.json=e.json;let n=e.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${n.asset.version}`);return}if(!r.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(n),this._convertTopLevelObjectsToArrays(n),Cp(e),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_addAsset(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(e){for(let r in Bp)this._convertTopLevelObjectToArray(e,r)}_convertTopLevelObjectToArray(e,r){let n=e[r];if(!(!n||Array.isArray(n))){e[r]=[];for(let s in n){let i=n[s];i.id=i.id||s;let o=e[r].length;e[r].push(i),this.idToIndexMap[r][s]=o}}}_convertObjectIdsToArrayIndices(e){for(let r in Bp)this._convertIdsToIndices(e,r);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(let r of e.textures)this._convertTextureIds(r);for(let r of e.meshes)this._convertMeshIds(r);for(let r of e.nodes)this._convertNodeIds(r);for(let r of e.scenes)this._convertSceneIds(r)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(let r of e.primitives){let{attributes:n,indices:s,material:i}=r;for(let o in n)n[o]=this._convertIdToIndex(n[o],"accessor");s&&(r.indices=this._convertIdToIndex(s,"accessor")),i&&(r.material=this._convertIdToIndex(i,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map(r=>this._convertIdToIndex(r,"node"))),e.meshes&&(e.meshes=e.meshes.map(r=>this._convertIdToIndex(r,"mesh")))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map(r=>this._convertIdToIndex(r,"node")))}_convertIdsToIndices(e,r){e[r]||(console.warn(`gltf v1: json doesn't contain attribute ${r}`),e[r]=[]);for(let n of e[r])for(let s in n){let i=n[s],o=this._convertIdToIndex(i,s);n[s]=o}}_convertIdToIndex(e,r){let n=pS[r];if(n in this.idToIndexMap){let s=this.idToIndexMap[n][e];if(!Number.isFinite(s))throw new Error(`gltf v1: failed to resolve ${r} with id ${e}`);return s}return e}_updateObjects(e){for(let r of this.json.buffers)delete r.type}_updateMaterial(e){for(let i of e.materials){var r,n,s;i.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let o=((r=i.values)===null||r===void 0?void 0:r.tex)||((n=i.values)===null||n===void 0?void 0:n.texture2d_0)||((s=i.values)===null||s===void 0?void 0:s.diffuseTex),a=e.textures.findIndex(c=>c.id===o);a!==-1&&(i.pbrMetallicRoughness.baseColorTexture={index:a})}}};function Mp(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new vc().normalize(t,e)}async function yp(t,e){var r,n,s;let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return gS(t,e,i,o),Mp(t,{normalize:o==null||(r=o.gltf)===null||r===void 0?void 0:r.normalize}),Rp(t,o,a),o!=null&&(n=o.gltf)!==null&&n!==void 0&&n.loadBuffers&&t.json.buffers&&await AS(t,o,a),o!=null&&(s=o.gltf)!==null&&s!==void 0&&s.loadImages&&await _S(t,o,a),await xp(t,o,a),t}function gS(t,e,r,n){if(n.uri&&(t.baseUri=n.uri),e instanceof ArrayBuffer&&!gp(e,r,n)&&(e=new TextDecoder().decode(e)),typeof e=="string")t.json=xo(e);else if(e instanceof ArrayBuffer){let o={};r=Ap(o,e,r,n.glb),at(o.type==="glTF",`Invalid GLB magic string ${o.type}`),t._glb=o,t.json=o.json}else at(!1,"GLTF: must be ArrayBuffer or string");let s=t.json.buffers||[];if(t.buffers=new Array(s.length).fill(null),t._glb&&t._glb.header.hasBinChunk){let{binChunks:o}=t._glb;t.buffers[0]={arrayBuffer:o[0].arrayBuffer,byteOffset:o[0].byteOffset,byteLength:o[0].byteLength}}let i=t.json.images||[];t.images=new Array(i.length).fill({})}async function AS(t,e,r){let n=t.json.buffers||[];for(let o=0;o<n.length;++o){let a=n[o];if(a.uri){var s,i;let{fetch:c}=r;at(c);let l=Sc(a.uri,e),h=await(r==null||(s=r.fetch)===null||s===void 0?void 0:s.call(r,l)),f=await(h==null||(i=h.arrayBuffer)===null||i===void 0?void 0:i.call(h));t.buffers[o]={arrayBuffer:f,byteOffset:0,byteLength:f.byteLength},delete a.uri}else t.buffers[o]===null&&(t.buffers[o]={arrayBuffer:new ArrayBuffer(a.byteLength),byteOffset:0,byteLength:a.byteLength})}}async function _S(t,e,r){let n=mS(t),s=t.json.images||[],i=[];for(let o of n)i.push(TS(t,s[o],o,e,r));return await Promise.all(i)}function mS(t){let e=new Set,r=t.json.textures||[];for(let n of r)n.source!==void 0&&e.add(n.source);return Array.from(e).sort()}async function TS(t,e,r,n,s){let i;if(e.uri&&!e.hasOwnProperty("bufferView")){let a=Sc(e.uri,n),{fetch:c}=s;i=await(await c(a)).arrayBuffer(),e.bufferView={data:i}}if(Number.isFinite(e.bufferView)){let a=op(t.json,t.buffers,e.bufferView);i=De(a.buffer,a.byteOffset,a.byteLength)}at(i,"glTF image has no data");let o=await Ct(i,[Ee,Wa],{...n,mimeType:e.mimeType,basis:n.basis||{format:Qs()}},s);o&&o[0]&&(o={compressed:!0,mipmaps:!1,width:o[0].width,height:o[0].height,data:o[0]}),t.images=t.images||[],t.images[r]=o}var rr={name:"glTF",id:"gltf",module:"gltf",version:dp,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:ES,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function ES(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;e={...rr.options,...e},e.gltf={...rr.options.gltf,...e.gltf};let{byteOffset:n=0}=e;return await yp({},t,n,e,r)}var RS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},xS={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Pt={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},SS={magFilter:Pt.TEXTURE_MAG_FILTER,minFilter:Pt.TEXTURE_MIN_FILTER,wrapS:Pt.TEXTURE_WRAP_S,wrapT:Pt.TEXTURE_WRAP_T},CS={[Pt.TEXTURE_MAG_FILTER]:Pt.LINEAR,[Pt.TEXTURE_MIN_FILTER]:Pt.NEAREST_MIPMAP_LINEAR,[Pt.TEXTURE_WRAP_S]:Pt.REPEAT,[Pt.TEXTURE_WRAP_T]:Pt.REPEAT};function BS(){return{id:"default-sampler",parameters:CS}}function MS(t){return xS[t]}function yS(t){return RS[t]}var Uc=class{constructor(){this.baseUri="",this.jsonUnprocessed=void 0,this.json=void 0,this.buffers=[],this.images=[]}postProcess(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{json:n,buffers:s=[],images:i=[]}=e,{baseUri:o=""}=e;return at(n),this.baseUri=o,this.buffers=s,this.images=i,this.jsonUnprocessed=n,this.json=this._resolveTree(e.json,r),this.json}_resolveTree(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n={...e};return this.json=n,e.bufferViews&&(n.bufferViews=e.bufferViews.map((s,i)=>this._resolveBufferView(s,i))),e.images&&(n.images=e.images.map((s,i)=>this._resolveImage(s,i))),e.samplers&&(n.samplers=e.samplers.map((s,i)=>this._resolveSampler(s,i))),e.textures&&(n.textures=e.textures.map((s,i)=>this._resolveTexture(s,i))),e.accessors&&(n.accessors=e.accessors.map((s,i)=>this._resolveAccessor(s,i))),e.materials&&(n.materials=e.materials.map((s,i)=>this._resolveMaterial(s,i))),e.meshes&&(n.meshes=e.meshes.map((s,i)=>this._resolveMesh(s,i))),e.nodes&&(n.nodes=e.nodes.map((s,i)=>this._resolveNode(s,i)),n.nodes=n.nodes.map((s,i)=>this._resolveNodeChildren(s))),e.skins&&(n.skins=e.skins.map((s,i)=>this._resolveSkin(s,i))),e.scenes&&(n.scenes=e.scenes.map((s,i)=>this._resolveScene(s,i))),typeof this.json.scene=="number"&&n.scenes&&(n.scene=n.scenes[this.json.scene]),n}getScene(e){return this._get(this.json.scenes,e)}getNode(e){return this._get(this.json.nodes,e)}getSkin(e){return this._get(this.json.skins,e)}getMesh(e){return this._get(this.json.meshes,e)}getMaterial(e){return this._get(this.json.materials,e)}getAccessor(e){return this._get(this.json.accessors,e)}getCamera(e){return this._get(this.json.cameras,e)}getTexture(e){return this._get(this.json.textures,e)}getSampler(e){return this._get(this.json.samplers,e)}getImage(e){return this._get(this.json.images,e)}getBufferView(e){return this._get(this.json.bufferViews,e)}getBuffer(e){return this._get(this.json.buffers,e)}_get(e,r){if(typeof r=="object")return r;let n=e&&e[r];return n||console.warn(`glTF file error: Could not find ${e}[${r}]`),n}_resolveScene(e,r){return{...e,id:e.id||`scene-${r}`,nodes:(e.nodes||[]).map(n=>this.getNode(n))}}_resolveNode(e,r){let n={...e,id:e?.id||`node-${r}`};return e.mesh!==void 0&&(n.mesh=this.getMesh(e.mesh)),e.camera!==void 0&&(n.camera=this.getCamera(e.camera)),e.skin!==void 0&&(n.skin=this.getSkin(e.skin)),e.meshes!==void 0&&e.meshes.length&&(n.mesh=e.meshes.reduce((s,i)=>{let o=this.getMesh(i);return s.id=o.id,s.primitives=s.primitives.concat(o.primitives),s},{primitives:[]})),n}_resolveNodeChildren(e){return e.children&&(e.children=e.children.map(r=>this.getNode(r))),e}_resolveSkin(e,r){let n=typeof e.inverseBindMatrices=="number"?this.getAccessor(e.inverseBindMatrices):void 0;return{...e,id:e.id||`skin-${r}`,inverseBindMatrices:n}}_resolveMesh(e,r){let n={...e,id:e.id||`mesh-${r}`,primitives:[]};return e.primitives&&(n.primitives=e.primitives.map(s=>{let i={...s,attributes:{},indices:void 0,material:void 0},o=s.attributes;for(let a in o)i.attributes[a]=this.getAccessor(o[a]);return s.indices!==void 0&&(i.indices=this.getAccessor(s.indices)),s.material!==void 0&&(i.material=this.getMaterial(s.material)),i})),n}_resolveMaterial(e,r){let n={...e,id:e.id||`material-${r}`};if(n.normalTexture&&(n.normalTexture={...n.normalTexture},n.normalTexture.texture=this.getTexture(n.normalTexture.index)),n.occlusionTexture&&(n.occlusionTexture={...n.occlusionTexture},n.occlusionTexture.texture=this.getTexture(n.occlusionTexture.index)),n.emissiveTexture&&(n.emissiveTexture={...n.emissiveTexture},n.emissiveTexture.texture=this.getTexture(n.emissiveTexture.index)),n.emissiveFactor||(n.emissiveFactor=n.emissiveTexture?[1,1,1]:[0,0,0]),n.pbrMetallicRoughness){n.pbrMetallicRoughness={...n.pbrMetallicRoughness};let s=n.pbrMetallicRoughness;s.baseColorTexture&&(s.baseColorTexture={...s.baseColorTexture},s.baseColorTexture.texture=this.getTexture(s.baseColorTexture.index)),s.metallicRoughnessTexture&&(s.metallicRoughnessTexture={...s.metallicRoughnessTexture},s.metallicRoughnessTexture.texture=this.getTexture(s.metallicRoughnessTexture.index))}return n}_resolveAccessor(e,r){let n=MS(e.componentType),s=yS(e.type),i=n*s,o={...e,id:e.id||`accessor-${r}`,bytesPerComponent:n,components:s,bytesPerElement:i,value:void 0,bufferView:void 0,sparse:void 0};if(e.bufferView!==void 0&&(o.bufferView=this.getBufferView(e.bufferView)),o.bufferView){let a=o.bufferView.buffer,{ArrayType:c,byteLength:l}=br(o,o.bufferView),h=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+a.byteOffset,f=a.arrayBuffer.slice(h,h+l);o.bufferView.byteStride&&(f=this._getValueFromInterleavedBuffer(a,h,o.bufferView.byteStride,o.bytesPerElement,o.count)),o.value=new c(f)}return o}_getValueFromInterleavedBuffer(e,r,n,s,i){let o=new Uint8Array(i*s);for(let a=0;a<i;a++){let c=r+a*n;o.set(new Uint8Array(e.arrayBuffer.slice(c,c+s)),a*s)}return o.buffer}_resolveTexture(e,r){return{...e,id:e.id||`texture-${r}`,sampler:typeof e.sampler=="number"?this.getSampler(e.sampler):BS(),source:typeof e.source=="number"?this.getImage(e.source):void 0}}_resolveSampler(e,r){let n={id:e.id||`sampler-${r}`,...e,parameters:{}};for(let s in n){let i=this._enumSamplerParameter(s);i!==void 0&&(n.parameters[i]=n[s])}return n}_enumSamplerParameter(e){return SS[e]}_resolveImage(e,r){let n={...e,id:e.id||`image-${r}`,image:null,bufferView:e.bufferView!==void 0?this.getBufferView(e.bufferView):void 0},s=this.images[r];return s&&(n.image=s),n}_resolveBufferView(e,r){let n=e.buffer,s=this.buffers[n].arrayBuffer,i=this.buffers[n].byteOffset||0;return e.byteOffset&&(i+=e.byteOffset),{id:`bufferView-${r}`,...e,buffer:this.buffers[n],data:new Uint8Array(s,i,e.byteLength)}}_resolveCamera(e,r){let n={...e,id:e.id||`camera-${r}`};return n.perspective,n.orthographic,n}};function wn(t,e){return new Uc().postProcess(t,e)}var Ni={URI:0,EMBEDDED:1};function Oi(t,e,r,n){t.rotateYtoZ=!0;let s=(t.byteOffset||0)+(t.byteLength||0)-r;if(s===0)throw new Error("glTF byte length must be greater than 0.");return t.gltfUpAxis=n!=null&&n["3d-tiles"]&&n["3d-tiles"].assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",t.gltfArrayBuffer=De(e,r,s),t.gltfByteOffset=0,t.gltfByteLength=s,r%4===0||console.warn(`${t.type}: embedded glb is not aligned to a 4-byte boundary.`),(t.byteOffset||0)+(t.byteLength||0)}async function bi(t,e,r,n){let s=r?.["3d-tiles"]||{};if(IS(t,e,r),s.loadGLTF){if(!n)return;if(t.gltfUrl){let{fetch:i}=n,o=await i(t.gltfUrl,r);t.gltfArrayBuffer=await o.arrayBuffer(),t.gltfByteOffset=0}if(t.gltfArrayBuffer){let i=await Ct(t.gltfArrayBuffer,rr,r,n);t.gltf=wn(i),t.gpuMemoryUsageInBytes=Nn(t.gltf),delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength}}}function IS(t,e,r){switch(e){case Ni.URI:if(t.gltfArrayBuffer){let n=new Uint8Array(t.gltfArrayBuffer,t.gltfByteOffset),i=new TextDecoder().decode(n);t.gltfUrl=i.replace(/[\s\0]+$/,"")}delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength;break;case Ni.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function Ip(t,e,r,n,s){var i;r=FS(t,e,r,n,s),await bi(t,Ni.EMBEDDED,n,s);let o=t==null||(i=t.gltf)===null||i===void 0?void 0:i.extensions;return o&&o.CESIUM_RTC&&(t.rtcCenter=o.CESIUM_RTC.center),r}function FS(t,e,r,n,s){r=Ne(t,e,r),r=Fr(t,e,r),r=Nr(t,e,r,n),r=Oi(t,e,r,n);let i=new fe(t.featureTableJson,t.featureTableBinary);return t.rtcCenter=i.getGlobalProperty("RTC_CENTER",w.FLOAT,3),r}async function Fp(t,e,r,n,s){return r=NS(t,e,r,n,s),await bi(t,t.gltfFormat||0,n,s),r}function NS(t,e,r,n,s){var i;if(r=Ne(t,e,r),t.version!==1)throw new Error(`Instanced 3D Model version ${t.version} is not supported`);r=Fr(t,e,r);let o=new DataView(e);if(t.gltfFormat=o.getUint32(r,!0),r+=4,r=Nr(t,e,r,n),r=Oi(t,e,r,n),!(t!=null&&(i=t.header)!==null&&i!==void 0&&i.featureTableJsonByteLength)||t.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let a=new fe(t.featureTableJson,t.featureTableBinary),c=a.getGlobalProperty("INSTANCES_LENGTH");if(a.featuresLength=c,!Number.isFinite(c))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");t.eastNorthUp=a.getGlobalProperty("EAST_NORTH_UP"),t.rtcCenter=a.getGlobalProperty("RTC_CENTER",w.FLOAT,3);let l=new tr(t.batchTableJson,t.batchTableBinary,c);return OS(t,a,l,c),r}function OS(t,e,r,n){let s=new Array(n),i=new m,o=new m,a=new m,c=new m,l=new z,h=new Zt,f=new m,u={},d=new D,p=[],_=[],A=[],T=[];for(let x=0;x<n;x++){let R;if(e.hasProperty("POSITION"))R=e.getProperty("POSITION",w.FLOAT,3,x,i);else if(e.hasProperty("POSITION_QUANTIZED")){R=e.getProperty("POSITION_QUANTIZED",w.UNSIGNED_SHORT,3,x,i);let g=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",w.FLOAT,3);if(!g)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let y=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",w.FLOAT,3);if(!y)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let O=65535;for(let b=0;b<3;b++)R[b]=R[b]/O*y[b]+g[b]}if(!R)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");i.copy(R),u.translation=i,t.normalUp=e.getProperty("NORMAL_UP",w.FLOAT,3,x,p),t.normalRight=e.getProperty("NORMAL_RIGHT",w.FLOAT,3,x,_);let S=!1;if(t.normalUp){if(!t.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");t.hasCustomOrientation=!0}else{if(t.octNormalUp=e.getProperty("NORMAL_UP_OCT32P",w.UNSIGNED_SHORT,2,x,p),t.octNormalRight=e.getProperty("NORMAL_RIGHT_OCT32P",w.UNSIGNED_SHORT,2,x,_),t.octNormalUp)throw t.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");t.eastNorthUp?(L.WGS84.eastNorthUpToFixedFrame(i,d),d.getRotationMatrix3(l)):l.identity()}S&&(c.copy(o).cross(a).normalize(),l.setColumn(0,o),l.setColumn(1,a),l.setColumn(2,c)),h.fromMatrix3(l),u.rotation=h,f.set(1,1,1);let B=e.getProperty("SCALE",w.FLOAT,1,x,A);Number.isFinite(B)&&f.multiplyByScalar(B);let M=e.getProperty("SCALE_NON_UNIFORM",w.FLOAT,3,x,p);M&&f.scale(M),u.scale=f;let F=e.getProperty("BATCH_ID",w.UNSIGNED_SHORT,1,x,T);F===void 0&&(F=x);let C=new D().fromQuaternion(u.rotation);d.identity(),d.translate(u.translation),d.multiplyRight(C),d.scale(u.scale);let E=d.clone();s[x]={modelMatrix:E,batchId:F}}t.instances=s}async function Np(t,e,r,n,s,i){r=Ne(t,e,r);let o=new DataView(e);for(t.tilesLength=o.getUint32(r,!0),r+=4,t.tiles=[];t.tiles.length<t.tilesLength&&(t.byteLength||0)-r>12;){let a={shape:"tile3d"};t.tiles.push(a),r=await i(e,r,n,s,a)}return r}async function Op(t,e,r,n){var s,i;if(t.rotateYtoZ=!0,t.gltfUpAxis=r!=null&&(s=r["3d-tiles"])!==null&&s!==void 0&&s.assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",r!=null&&(i=r["3d-tiles"])!==null&&i!==void 0&&i.loadGLTF){if(!n)return e.byteLength;let o=await Ct(e,rr,r,n);t.gltf=wn(o),t.gpuMemoryUsageInBytes=Nn(t.gltf)}else t.gltfArrayBuffer=e;return e.byteLength}async function Lc(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{shape:"tile3d"};switch(s.byteOffset=e,s.type=Ud(t,e),s.type){case Qe.COMPOSITE:return await Np(s,t,e,r,n,Lc);case Qe.BATCHED_3D_MODEL:return await Ip(s,t,e,r,n);case Qe.GLTF:return await Op(s,t,r,n);case Qe.INSTANCED_3D_MODEL:return await Fp(s,t,e,r,n);case Qe.POINT_CLOUD:return await sp(s,t,e,r,n);default:throw new Error(`3DTileLoader: unknown type ${s.type}`)}}async function Hc(t,e,r){if(new Uint32Array(t.slice(0,4))[0]!==1952609651)throw new Error("Wrong subtree file magic number");if(new Uint32Array(t.slice(4,8))[0]!==1)throw new Error("Wrong subtree file verson, must be 1");let i=bp(t.slice(8,16)),o=new Uint8Array(t,24,i),c=new TextDecoder("utf8").decode(o),l=JSON.parse(c),h=bp(t.slice(16,24)),f=new ArrayBuffer(0);if(h&&(f=t.slice(24+i)),await Pi(l,l.tileAvailability,f,r),Array.isArray(l.contentAvailability))for(let u of l.contentAvailability)await Pi(l,u,f,r);else await Pi(l,l.contentAvailability,f,r);return await Pi(l,l.childSubtreeAvailability,f,r),l}async function Pi(t,e,r,n){let s=Number.isFinite(e.bitstream)?e.bitstream:e.bufferView;if(typeof s!="number")return;let i=t.bufferViews[s],o=t.buffers[i.buffer];if(!(n!=null&&n.baseUrl))throw new Error("Url is not provided");if(!n.fetch)throw new Error("fetch is not provided");if(o.uri){let c=`${n?.baseUrl||""}/${o.uri}`,h=await(await n.fetch(c)).arrayBuffer();e.explicitBitstream=new Uint8Array(h,i.byteOffset,i.byteLength);return}let a=t.buffers.slice(0,i.buffer).reduce((c,l)=>c+l.byteLength,0);e.explicitBitstream=new Uint8Array(r.slice(a,a+o.byteLength),i.byteOffset,i.byteLength)}function bp(t){let e=new DataView(t),r=e.getUint32(0,!0),n=e.getUint32(4,!0);return r+2**32*n}var Di={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Ai,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:Hc,options:{}};var lg=v(Cr(),1);var ig=v(Cr(),1);function bS(t){try{let e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch{return null}}var wi=class{constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=bS(n),this.id=e,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let e={};if(this.storage){let r=this.storage.getItem(this.id);e=r?JSON.parse(r):{}}return Object.assign(this.config,e),this}};function Pp(t){let e;return t<10?e="".concat(t.toFixed(2),"ms"):t<100?e="".concat(t.toFixed(1),"ms"):t<1e3?e="".concat(t.toFixed(0),"ms"):e="".concat((t/1e3).toFixed(2),"s"),e}function Dp(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(e-t.length,0);return"".concat(" ".repeat(r)).concat(t)}function vi(t,e,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,s=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>n&&(r=Math.min(r,n/t.width));let i=t.width*r,o=t.height*r,a=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(i/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(s,");"),"background-size:".concat(i,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(e," %c+"),a]}var Ui;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Ui||(Ui={}));var PS=10;function wp(t){return typeof t!="string"?t:(t=t.toUpperCase(),Ui[t]||Ui.WHITE)}function vp(t,e,r){if(!Wt&&typeof t=="string"){if(e){let n=wp(e);t="\x1B[".concat(n,"m").concat(t,"\x1B[39m")}if(r){let n=wp(r);t="\x1B[".concat(n+PS,"m").concat(t,"\x1B[49m")}}return t}function Up(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(t),n=Object.getOwnPropertyNames(r),s=t;for(let i of n){let o=s[i];typeof o=="function"&&(e.find(a=>i===a)||(s[i]=o.bind(t)))}}function Lr(t,e){if(!t)throw new Error(e||"Assertion failed")}function nr(){let t;if(Wt()&&xr.performance){var e,r;t=xr===null||xr===void 0||(e=xr.performance)===null||e===void 0||(r=e.now)===null||r===void 0?void 0:r.call(e)}else if("hrtime"in Ye){var n;let s=Ye===null||Ye===void 0||(n=Ye.hrtime)===null||n===void 0?void 0:n.call(Ye);t=s[0]*1e3+s[1]/1e6}else t=Date.now();return t}var Hr={debug:Wt()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},DS={enabled:!0,level:0};function Dt(){}var Lp={},Hp={once:!0},vn=class{constructor(){let{id:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=$s,this._startTs=nr(),this._deltaTs=nr(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new wi("__probe-".concat(this.id,"__"),DS),this.timeStamp("".concat(this.id," started")),Up(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((nr()-this._startTs).toPrecision(10))}getDelta(){return Number((nr()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,r){this._storage.setConfiguration({[e]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,r){Lr(e,r)}warn(e){return this._getLogFunction(0,e,Hr.warn,arguments,Hp)}error(e){return this._getLogFunction(0,e,Hr.error,arguments)}deprecated(e,r){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(e,r){return this.error("`".concat(e,"` has been removed. Use `").concat(r,"` instead"))}probe(e,r){return this._getLogFunction(e,r,Hr.log,arguments,{time:!0,once:!0})}log(e,r){return this._getLogFunction(e,r,Hr.debug,arguments)}info(e,r){return this._getLogFunction(e,r,console.info,arguments)}once(e,r){return this._getLogFunction(e,r,Hr.debug||Hr.info,arguments,Hp)}table(e,r,n){return r?this._getLogFunction(e,r,console.table||Dt,n&&[n],{tag:LS(r)}):Dt}image(e){let{logLevel:r,priority:n,image:s,message:i="",scale:o=1}=e;return this._shouldLog(r||n)?Wt()?US({image:s,message:i,scale:o}):vS({image:s,message:i,scale:o}):Dt}time(e,r){return this._getLogFunction(e,r,console.time?console.time:console.info)}timeEnd(e,r){return this._getLogFunction(e,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,r){return this._getLogFunction(e,r,console.timeStamp||Dt)}group(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},s=Vp({logLevel:e,message:r,opts:n}),{collapsed:i}=n;return s.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(e,r,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Dt)}withGroup(e,r,n){this.group(e,r)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=Xp(e)}_getLogFunction(e,r,n,s,i){if(this._shouldLog(e)){i=Vp({logLevel:e,message:r,args:s,opts:i}),n=n||i.method,Lr(n),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=nr();let o=i.tag||i.message;if(i.once&&o)if(!Lp[o])Lp[o]=nr();else return Dt;return r=wS(this.id,i.message,i),n.bind(console,r,...i.args)}return Dt}};vn.VERSION=$s;function Xp(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return Lr(Number.isFinite(e)&&e>=0),e}function Vp(t){let{logLevel:e,message:r}=t;t.logLevel=Xp(e);let n=t.args?Array.from(t.args):[];for(;n.length&&n.shift()!==r;);switch(typeof e){case"string":case"function":r!==void 0&&n.unshift(r),t.message=e;break;case"object":Object.assign(t,e);break;default:}typeof t.message=="function"&&(t.message=t.message());let s=typeof t.message;return Lr(s==="string"||s==="object"),Object.assign(t,{args:n},t.opts)}function wS(t,e,r){if(typeof e=="string"){let n=r.time?Dp(Pp(r.total)):"";e=r.time?"".concat(t,": ").concat(n," ").concat(e):"".concat(t,": ").concat(e),e=vp(e,r.color,r.background)}return e}function vS(t){let{image:e,message:r="",scale:n=1}=t;return console.warn("removed"),Dt}function US(t){let{image:e,message:r="",scale:n=1}=t;if(typeof e=="string"){let i=new Image;return i.onload=()=>{let o=vi(i,r,n);console.log(...o)},i.src=e,Dt}let s=e.nodeName||"";if(s.toLowerCase()==="img")return console.log(...vi(e,r,n)),Dt;if(s.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(...vi(i,r,n)),i.src=e.toDataURL(),Dt}return Dt}function LS(t){for(let e in t)for(let r in t[e])return r||"untitled";return"empty"}var Vc=new vn({id:"@probe.gl/log"});var wt=null;try{wt=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Z(t,e,r){this.low=t|0,this.high=e|0,this.unsigned=!!r}Z.prototype.__isLong__;Object.defineProperty(Z.prototype,"__isLong__",{value:!0});function pt(t){return(t&&t.__isLong__)===!0}function Wp(t){var e=Math.clz32(t&-t);return t?31-e:e}Z.isLong=pt;var zp={},kp={};function sr(t,e){var r,n,s;return e?(t>>>=0,(s=0<=t&&t<256)&&(n=kp[t],n)?n:(r=X(t,0,!0),s&&(kp[t]=r),r)):(t|=0,(s=-128<=t&&t<128)&&(n=zp[t],n)?n:(r=X(t,t<0?-1:0,!1),s&&(zp[t]=r),r))}Z.fromInt=sr;function vt(t,e){if(isNaN(t))return e?ue:kt;if(e){if(t<0)return ue;if(t>=Yp)return Zp}else{if(t<=-Kp)return St;if(t+1>=Kp)return jp}return t<0?vt(-t,e).neg():X(t%Xr|0,t/Xr|0,e)}Z.fromNumber=vt;function X(t,e,r){return new Z(t,e,r)}Z.fromBits=X;var Li=Math.pow;function Wc(t,e,r){if(t.length===0)throw Error("empty string");if(typeof e=="number"?(r=e,e=!1):e=!!e,t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return e?ue:kt;if(r=r||10,r<2||36<r)throw RangeError("radix");var n;if((n=t.indexOf("-"))>0)throw Error("interior hyphen");if(n===0)return Wc(t.substring(1),e,r).neg();for(var s=vt(Li(r,8)),i=kt,o=0;o<t.length;o+=8){var a=Math.min(8,t.length-o),c=parseInt(t.substring(o,o+a),r);if(a<8){var l=vt(Li(r,a));i=i.mul(l).add(vt(c))}else i=i.mul(s),i=i.add(vt(c))}return i.unsigned=e,i}Z.fromString=Wc;function Gt(t,e){return typeof t=="number"?vt(t,e):typeof t=="string"?Wc(t,e):X(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}Z.fromValue=Gt;var Gp=1<<16,HS=1<<24,Xr=Gp*Gp,Yp=Xr*Xr,Kp=Yp/2,Jp=sr(HS),kt=sr(0);Z.ZERO=kt;var ue=sr(0,!0);Z.UZERO=ue;var Vr=sr(1);Z.ONE=Vr;var qp=sr(1,!0);Z.UONE=qp;var Xc=sr(-1);Z.NEG_ONE=Xc;var jp=X(-1,2147483647,!1);Z.MAX_VALUE=jp;var Zp=X(-1,-1,!0);Z.MAX_UNSIGNED_VALUE=Zp;var St=X(0,-2147483648,!1);Z.MIN_VALUE=St;var I=Z.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low};I.toNumber=function(){return this.unsigned?(this.high>>>0)*Xr+(this.low>>>0):this.high*Xr+(this.low>>>0)};I.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(St)){var r=vt(e),n=this.div(r),s=n.mul(r).sub(this);return n.toString(e)+s.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var i=vt(Li(e,6),this.unsigned),o=this,a="";;){var c=o.div(i),l=o.sub(c.mul(i)).toInt()>>>0,h=l.toString(e);if(o=c,o.isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}};I.getHighBits=function(){return this.high};I.getHighBitsUnsigned=function(){return this.high>>>0};I.getLowBits=function(){return this.low};I.getLowBitsUnsigned=function(){return this.low>>>0};I.getNumBitsAbs=function(){if(this.isNegative())return this.eq(St)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,r=31;r>0&&!(e&1<<r);r--);return this.high!=0?r+33:r+1};I.isZero=function(){return this.high===0&&this.low===0};I.eqz=I.isZero;I.isNegative=function(){return!this.unsigned&&this.high<0};I.isPositive=function(){return this.unsigned||this.high>=0};I.isOdd=function(){return(this.low&1)===1};I.isEven=function(){return(this.low&1)===0};I.equals=function(e){return pt(e)||(e=Gt(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};I.eq=I.equals;I.notEquals=function(e){return!this.eq(e)};I.neq=I.notEquals;I.ne=I.notEquals;I.lessThan=function(e){return this.comp(e)<0};I.lt=I.lessThan;I.lessThanOrEqual=function(e){return this.comp(e)<=0};I.lte=I.lessThanOrEqual;I.le=I.lessThanOrEqual;I.greaterThan=function(e){return this.comp(e)>0};I.gt=I.greaterThan;I.greaterThanOrEqual=function(e){return this.comp(e)>=0};I.gte=I.greaterThanOrEqual;I.ge=I.greaterThanOrEqual;I.compare=function(e){if(pt(e)||(e=Gt(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1};I.comp=I.compare;I.negate=function(){return!this.unsigned&&this.eq(St)?St:this.not().add(Vr)};I.neg=I.negate;I.add=function(e){pt(e)||(e=Gt(e));var r=this.high>>>16,n=this.high&65535,s=this.low>>>16,i=this.low&65535,o=e.high>>>16,a=e.high&65535,c=e.low>>>16,l=e.low&65535,h=0,f=0,u=0,d=0;return d+=i+l,u+=d>>>16,d&=65535,u+=s+c,f+=u>>>16,u&=65535,f+=n+a,h+=f>>>16,f&=65535,h+=r+o,h&=65535,X(u<<16|d,h<<16|f,this.unsigned)};I.subtract=function(e){return pt(e)||(e=Gt(e)),this.add(e.neg())};I.sub=I.subtract;I.multiply=function(e){if(this.isZero())return this;if(pt(e)||(e=Gt(e)),wt){var r=wt.mul(this.low,this.high,e.low,e.high);return X(r,wt.get_high(),this.unsigned)}if(e.isZero())return this.unsigned?ue:kt;if(this.eq(St))return e.isOdd()?St:kt;if(e.eq(St))return this.isOdd()?St:kt;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(Jp)&&e.lt(Jp))return vt(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,s=this.high&65535,i=this.low>>>16,o=this.low&65535,a=e.high>>>16,c=e.high&65535,l=e.low>>>16,h=e.low&65535,f=0,u=0,d=0,p=0;return p+=o*h,d+=p>>>16,p&=65535,d+=i*h,u+=d>>>16,d&=65535,d+=o*l,u+=d>>>16,d&=65535,u+=s*h,f+=u>>>16,u&=65535,u+=i*l,f+=u>>>16,u&=65535,u+=o*c,f+=u>>>16,u&=65535,f+=n*h+s*l+i*c+o*a,f&=65535,X(d<<16|p,f<<16|u,this.unsigned)};I.mul=I.multiply;I.divide=function(e){if(pt(e)||(e=Gt(e)),e.isZero())throw Error("division by zero");if(wt){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?wt.div_u:wt.div_s)(this.low,this.high,e.low,e.high);return X(r,wt.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?ue:kt;var n,s,i;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return ue;if(e.gt(this.shru(1)))return qp;i=ue}else{if(this.eq(St)){if(e.eq(Vr)||e.eq(Xc))return St;if(e.eq(St))return Vr;var o=this.shr(1);return n=o.div(e).shl(1),n.eq(kt)?e.isNegative()?Vr:Xc:(s=this.sub(e.mul(n)),i=n.add(s.div(e)),i)}else if(e.eq(St))return this.unsigned?ue:kt;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=kt}for(s=this;s.gte(e);){n=Math.max(1,Math.floor(s.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),c=a<=48?1:Li(2,a-48),l=vt(n),h=l.mul(e);h.isNegative()||h.gt(s);)n-=c,l=vt(n,this.unsigned),h=l.mul(e);l.isZero()&&(l=Vr),i=i.add(l),s=s.sub(h)}return i};I.div=I.divide;I.modulo=function(e){if(pt(e)||(e=Gt(e)),wt){var r=(this.unsigned?wt.rem_u:wt.rem_s)(this.low,this.high,e.low,e.high);return X(r,wt.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};I.mod=I.modulo;I.rem=I.modulo;I.not=function(){return X(~this.low,~this.high,this.unsigned)};I.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};I.clz=I.countLeadingZeros;I.countTrailingZeros=function(){return this.low?Wp(this.low):Wp(this.high)+32};I.ctz=I.countTrailingZeros;I.and=function(e){return pt(e)||(e=Gt(e)),X(this.low&e.low,this.high&e.high,this.unsigned)};I.or=function(e){return pt(e)||(e=Gt(e)),X(this.low|e.low,this.high|e.high,this.unsigned)};I.xor=function(e){return pt(e)||(e=Gt(e)),X(this.low^e.low,this.high^e.high,this.unsigned)};I.shiftLeft=function(e){return pt(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?X(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):X(0,this.low<<e-32,this.unsigned)};I.shl=I.shiftLeft;I.shiftRight=function(e){return pt(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?X(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):X(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};I.shr=I.shiftRight;I.shiftRightUnsigned=function(e){return pt(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?X(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):e===32?X(this.high,0,this.unsigned):X(this.high>>>e-32,0,this.unsigned)};I.shru=I.shiftRightUnsigned;I.shr_u=I.shiftRightUnsigned;I.rotateLeft=function(e){var r;return pt(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?X(this.high,this.low,this.unsigned):e<32?(r=32-e,X(this.low<<e|this.high>>>r,this.high<<e|this.low>>>r,this.unsigned)):(e-=32,r=32-e,X(this.high<<e|this.low>>>r,this.low<<e|this.high>>>r,this.unsigned))};I.rotl=I.rotateLeft;I.rotateRight=function(e){var r;return pt(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?X(this.high,this.low,this.unsigned):e<32?(r=32-e,X(this.high<<r|this.low>>>e,this.low<<r|this.high>>>e,this.unsigned)):(e-=32,r=32-e,X(this.low<<r|this.high>>>e,this.high<<r|this.low>>>e,this.unsigned))};I.rotr=I.rotateRight;I.toSigned=function(){return this.unsigned?X(this.low,this.high,!1):this};I.toUnsigned=function(){return this.unsigned?this:X(this.low,this.high,!0)};I.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};I.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]};I.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]};Z.fromBytes=function(e,r,n){return n?Z.fromBytesLE(e,r):Z.fromBytesBE(e,r)};Z.fromBytesLE=function(e,r){return new Z(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)};Z.fromBytesBE=function(e,r){return new Z(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)};var Wr=Z;var VS=16;function Un(t){t==="X"&&(t="");let e=t.padEnd(VS,"0");return Wr.fromString(e,!0,16)}function zc(t){if(t.isZero())return"X";let e=t.countTrailingZeros(),r=e%4;e=(e-r)/4;let n=e;e*=4;let i=t.shiftRightUnsigned(e).toString(16).replace(/0+$/,"");return Array(17-n-i.length).join("0")+i}function kc(t,e){let r=XS(t).shiftRightUnsigned(2);return t.add(Wr.fromNumber(2*e+1-4).multiply(r))}function XS(t){return t.and(t.not().add(1))}var WS=3,zS=30,kS=2*zS+1,Qp=180/Math.PI;function tg(t){if(t.length===0)throw new Error(`Invalid Hilbert quad key ${t}`);let e=t.split("/"),r=parseInt(e[0],10),n=e[1],s=n.length,i=0,o=[0,0];for(let a=s-1;a>=0;a--){i=s-a;let c=n[a],l=0,h=0;c==="1"?h=1:c==="2"?(l=1,h=1):c==="3"&&(l=1);let f=Math.pow(2,i-1);GS(f,o,l,h),o[0]+=f*l,o[1]+=f*h}if(r%2===1){let a=o[0];o[0]=o[1],o[1]=a}return{face:r,ij:o,level:i}}function eg(t){if(t.isZero())return"";let e=t.toString(2);for(;e.length<WS+kS;)e="0"+e;let r=e.lastIndexOf("1"),n=e.substring(0,3),s=e.substring(3,r),i=s.length/2,o=Wr.fromString(n,!0,2).toString(10),a="";if(i!==0)for(a=Wr.fromString(s,!0,2).toString(4);a.length<i;)a="0"+a;return`${o}/${a}`}function Gc(t,e,r){let n=1<<e;return[(t[0]+r[0])/n,(t[1]+r[1])/n]}function $p(t){return t>=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function Kc(t){return[$p(t[0]),$p(t[1])]}function Jc(t,e){let[r,n]=e;switch(t){case 0:return[1,r,n];case 1:return[-r,1,n];case 2:return[-r,-n,1];case 3:return[-1,-n,-r];case 4:return[n,-1,-r];case 5:return[n,r,-1];default:throw new Error("Invalid face")}}function Yc(t){let[e,r,n]=t,s=Math.atan2(n,Math.sqrt(e*e+r*r));return[Math.atan2(r,e)*Qp,s*Qp]}function GS(t,e,r,n){if(n===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);let s=e[0];e[0]=e[1],e[1]=s}}function rg(t){let e=Gc(t.ij,t.level,[.5,.5]),r=Kc(e),n=Jc(t.face,r);return Yc(n)}var KS=100;function qc(t){let{face:e,ij:r,level:n}=t,s=[[0,0],[0,1],[1,1],[1,0],[0,0]],i=Math.max(1,Math.ceil(KS*Math.pow(2,-n))),o=new Float64Array(4*i*2+2),a=0,c=0;for(let l=0;l<4;l++){let h=s[l].slice(0),f=s[l+1],u=(f[0]-h[0])/i,d=(f[1]-h[1])/i;for(let p=0;p<i;p++){h[0]+=u,h[1]+=d;let _=Gc(r,n,h),A=Kc(_),T=Jc(e,A),x=Yc(T);Math.abs(x[1])>89.999&&(x[0]=c);let R=x[0]-c;x[0]+=R>180?-360:R<-180?360:0,o[a++]=x[0],o[a++]=x[1],c=x[0]}}return o[a++]=o[0],o[a++]=o[1],o}function zr(t){let e=JS(t);return tg(e)}function JS(t){if(t.indexOf("/")>0)return t;let e=Un(t);return eg(e)}function jc(t){let e=zr(t);return rg(e)}function sg(t){let e;if(t.face===2||t.face===5){let r=null,n=0;for(let s=0;s<4;s++){let i=`${t.face}/${s}`,o=zr(i),a=qc(o);(typeof r>"u"||r===null)&&(r=new Float64Array(4*a.length)),r.set(a,n),n+=a.length}e=ng(r)}else{let r=qc(t);e=ng(r)}return e}function ng(t){if(t.length%2!==0)throw new Error("Invalid corners");let e=[],r=[];for(let n=0;n<t.length;n+=2)e.push(t[n]),r.push(t[n+1]);return e.sort((n,s)=>n-s),r.sort((n,s)=>n-s),{west:e[0],east:e[e.length-1],north:r[r.length-1],south:r[0]}}function Zc(t,e){let r=e?.minimumHeight||0,n=e?.maximumHeight||0,s=zr(t),i=sg(s),o=i.west,a=i.south,c=i.east,l=i.north,h=[];return h.push(new m(o,l,r)),h.push(new m(c,l,r)),h.push(new m(c,a,r)),h.push(new m(o,a,r)),h.push(new m(o,l,n)),h.push(new m(c,l,n)),h.push(new m(c,a,n)),h.push(new m(o,a,n)),h}function Hi(t){let e=t.token,r={minimumHeight:t.minimumHeight,maximumHeight:t.maximumHeight},n=Zc(e,r),s=jc(e),i=s[0],o=s[1],a=L.WGS84.cartographicToCartesian([i,o,r.maximumHeight]),c=new m(a[0],a[1],a[2]);n.push(c);let l=An(n);return[...l.center,...l.halfAxes]}var YS=4,qS=8,jS={QUADTREE:YS,OCTREE:qS};function ZS(t,e,r){if(t!=null&&t.box){let n=Un(t.s2VolumeInfo.token),s=kc(n,e),i=zc(s),o={...t.s2VolumeInfo};switch(o.token=i,r){case"OCTREE":let l=t.s2VolumeInfo,h=l.maximumHeight-l.minimumHeight,f=h/2,u=l.minimumHeight+h/2;l.minimumHeight=u-f,l.maximumHeight=u+f;break;default:break}return{box:Hi(o),s2VolumeInfo:o}}}async function $c(t){let{implicitOptions:e,parentData:r={mortonIndex:0,x:0,y:0,z:0},childIndex:n=0,s2VolumeBox:s,loaderOptions:i}=t,{subtree:o,level:a=0,globalData:c={level:0,mortonIndex:0,x:0,y:0,z:0}}=t,{subdivisionScheme:l,subtreeLevels:h,maximumLevel:f,contentUrlTemplate:u,subtreesUriTemplate:d,basePath:p}=e,_={children:[],lodMetricValue:0,contentUrl:""};if(!f)return Vc.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${u} won't be loaded...`),_;let A=a+c.level;if(A>f)return _;let T=jS[l],x=Math.log2(T),R=n&1,S=n>>1&1,B=n>>2&1,M=(T**a-1)/(T-1),F=ir(r.mortonIndex,n,x),C=M+F,E=ir(r.x,R,1),g=ir(r.y,S,1),y=ir(r.z,B,1),O=!1;a>=h&&(O=Qc(o.childSubtreeAvailability,F));let b=ir(c.x,E,a),N=ir(c.y,g,a),U=ir(c.z,y,a);if(O){let q=`${p}/${d}`,tt=Vi(q,A,b,N,U);o=await(0,ig.load)(tt,Di,i),c={mortonIndex:F,x:E,y:g,z:y,level:a},F=0,C=0,E=0,g=0,y=0,a=0}if(!Qc(o.tileAvailability,C))return _;Qc(o.contentAvailability,C)&&(_.contentUrl=Vi(u,A,b,N,U));let Q=a+1,J={mortonIndex:F,x:E,y:g,z:y};for(let q=0;q<T;q++){let tt=ZS(s,q,l),mt=await $c({subtree:o,implicitOptions:e,loaderOptions:i,parentData:J,childIndex:q,level:Q,globalData:{...c},s2VolumeBox:tt});if(mt.contentUrl||mt.children.length){let o0=A+1,a0=QS(mt,o0,{childTileX:E,childTileY:g,childTileZ:y},e,s);_.children.push(a0)}}return _}function Qc(t,e){let r;return Array.isArray(t)?(r=t[0],t.length>1&&Vc.once('Not supported extension "3DTILES_multiple_contents" has been detected')):r=t,"constant"in r?Boolean(r.constant):r.explicitBitstream?eC(e,r.explicitBitstream):!1}function QS(t,e,r,n,s){let{basePath:i,refine:o,getRefine:a,lodMetricType:c,getTileType:l,rootLodMetricValue:h,rootBoundingVolume:f}=n,u=t.contentUrl&&t.contentUrl.replace(`${i}/`,""),d=h/2**e,p=s!=null&&s.box?{box:s.box}:f,_=$S(e,p,r);return{children:t.children,contentUrl:t.contentUrl,content:{uri:u},id:t.contentUrl,refine:a(o),type:l(t),lodMetricType:c,lodMetricValue:d,geometricError:d,transform:t.transform,boundingVolume:_}}function $S(t,e,r){if(e.region){let{childTileX:n,childTileY:s,childTileZ:i}=r,[o,a,c,l,h,f]=e.region,u=2**t,d=(c-o)/u,p=(l-a)/u,_=(f-h)/u,[A,T]=[o+d*n,o+d*(n+1)],[x,R]=[a+p*s,a+p*(s+1)],[S,B]=[h+_*i,h+_*(i+1)];return{region:[A,x,T,R,S,B]}}if(e.box)return e;throw new Error(`Unsupported bounding volume type ${e}`)}function ir(t,e,r){return(t<<r)+e}function Vi(t,e,r,n,s){let i=tC({level:e,x:r,y:n,z:s});return t.replace(/{level}|{x}|{y}|{z}/gi,o=>i[o])}function tC(t){let e={};for(let r in t)e[`{${r}}`]=t[r];return e}function eC(t,e){let r=Math.floor(t/8),n=t%8;return(e[r]>>n&1)===1}function el(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(!e)return re.EMPTY;let n=e.split("?")[0].split(".").pop();switch(n){case"pnts":return re.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return re.SCENEGRAPH;default:return n||re.EMPTY}}function rl(t){switch(t){case"REPLACE":case"replace":return Et.REPLACE;case"ADD":case"add":return Et.ADD;default:return t}}function tl(t,e){if(/^[a-z][0-9a-z+.-]*:/i.test(e)){let n=new URL(t,`${e}/`);return decodeURI(n.toString())}else if(t.startsWith("/"))return t;return Te.resolve(e,t)}function og(t,e){if(!t)return null;let r;if(t.content){var n;let i=t.content.uri||((n=t.content)===null||n===void 0?void 0:n.url);typeof i<"u"&&(r=tl(i,e))}return{...t,id:r,contentUrl:r,lodMetricType:qe.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:el(t,r),refine:rl(t.refine)}}async function hg(t,e,r){let n=null,s=cg(t.root);s&&t.root?n=await ag(t.root,t,e,s,r):n=og(t.root,e);let i=[];for(i.push(n);i.length>0;){let o=i.pop()||{},a=o.children||[],c=[];for(let l of a){let h=cg(l),f;h?f=await ag(l,t,e,h,r):f=og(l,e),f&&(c.push(f),i.push(f))}o.children=c}return n}async function ag(t,e,r,n,s){var i,o,a;let{subdivisionScheme:c,maximumLevel:l,availableLevels:h,subtreeLevels:f,subtrees:{uri:u}}=n,d=Vi(u,0,0,0,0),p=tl(d,r),_=await(0,lg.load)(p,Di,s),A=(i=t.content)===null||i===void 0?void 0:i.uri,T=A?tl(A,r):"",x=e==null||(o=e.root)===null||o===void 0?void 0:o.refine,R=t.geometricError,S=(a=t.boundingVolume.extensions)===null||a===void 0?void 0:a["3DTILES_bounding_volume_S2"];if(S){let C={box:Hi(S),s2VolumeInfo:S};t.boundingVolume=C}let B=t.boundingVolume,M={contentUrlTemplate:T,subtreesUriTemplate:u,subdivisionScheme:c,subtreeLevels:f,maximumLevel:Number.isFinite(h)?h-1:l,refine:x,basePath:r,lodMetricType:qe.GEOMETRIC_ERROR,rootLodMetricValue:R,rootBoundingVolume:B,getTileType:el,getRefine:rl};return await rC(t,r,_,M,s)}async function rC(t,e,r,n,s){if(!t)return null;let{children:i,contentUrl:o}=await $c({subtree:r,implicitOptions:n,loaderOptions:s}),a,c=null;return o&&(a=o,c={uri:o.replace(`${e}/`,"")}),{...t,id:a,contentUrl:a,lodMetricType:qe.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:el(t,a),refine:rl(t.refine),content:c||t.content,children:i}}function cg(t){var e;return(t==null||(e=t.extensions)===null||e===void 0?void 0:e["3DTILES_implicit_tiling"])||t?.implicitTiling}var Xi={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Ai,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:nC,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function nC(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=e["3d-tiles"]||{},s;return n.isTileset==="auto"?s=r?.url&&r.url.indexOf(".json")!==-1:s=n.isTileset,s?sC(t,e,r):iC(t,e,r)}async function sC(t,e,r){var n;let s=JSON.parse(new TextDecoder().decode(t)),i=r?.url||"",o=oC(i),a=await hg(s,o,e||{});return{...s,shape:"tileset3d",loader:Xi,url:i,queryString:r?.queryString||"",basePath:o,root:a||s.root,type:ft.TILES3D,lodMetricType:qe.GEOMETRIC_ERROR,lodMetricValue:((n=s.root)===null||n===void 0?void 0:n.geometricError)||0}}async function iC(t,e,r){let n={content:{shape:"tile3d",featureIds:null}};return await Lc(t,0,e,r,n.content),n.content}function oC(t){return Te.dirname(t)}var fg=[0],aC={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:Xi,onTilesetLoad:{type:"function",value:t=>{}},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:(t,e,r)=>{}},_getMeshColor:{type:"function",value:t=>[255,255,255]}},Wi=class extends be.CompositeLayer{initializeState(){"onTileLoadFail"in this.props&&be.log.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}}get isLoaded(){return Boolean(this.state?.tileset3d?.isLoaded()&&super.isLoaded)}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({props:e,oldProps:r,changeFlags:n}){if(e.data&&e.data!==r.data&&this._loadTileset(e.data),n.viewportChanged){let{activeViewports:s}=this.state;Object.keys(s).length&&(this._updateTileset(s),this.state.lastUpdatedViewports=s,this.state.activeViewports={})}if(n.propsChanged){let{layerMap:s}=this.state;for(let i in s)s[i].needsUpdate=!0}}activateViewport(e){let{activeViewports:r,lastUpdatedViewports:n}=this.state;this.internalState.viewport=e,r[e.id]=e;let s=n?.[e.id];(!s||!e.equals(s))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:e,sourceLayer:r}){let n=r&&r.props.tile;return e.picked&&(e.object=n),e.sourceTile=n,e}filterSubLayer({layer:e,viewport:r}){let{tile:n}=e.props,{id:s}=r;return n.selected&&n.viewportIds.includes(s)}_updateAutoHighlight(e){let r=e.sourceTile,n=this.state.layerMap[r?.id];n&&n.layer&&n.layer.updateAutoHighlight(e)}async _loadTileset(e){let{loadOptions:r={}}=this.props,n=this.props.loader||this.props.loaders,s=Array.isArray(n)?n[0]:n,i={loadOptions:{...r}},o=e;if(s.preload){let l=await s.preload(e,r);l.url&&(o=l.url),l.headers&&(i.loadOptions.fetch={...i.loadOptions.fetch,headers:l.headers}),Object.assign(i,l)}let a=await(0,gg.load)(o,s,i.loadOptions),c=new yn(a,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,...i});this.setState({tileset3d:c,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(c)}_onTileLoad(e){let{lastUpdatedViewports:r}=this.state;this.props.onTileLoad(e),this._updateTileset(r),this.setNeedsUpdate()}_onTileUnload(e){delete this.state.layerMap[e.id],this.props.onTileUnload(e)}_updateTileset(e){if(!e)return;let{tileset3d:r}=this.state,{timeline:n}=this.context,s=Object.keys(e).length;!n||!s||!r||r.selectTiles(Object.values(e)).then(i=>{this.state.frameNumber!==i&&this.setState({frameNumber:i})})}_getSubLayer(e,r){if(!e.content)return null;switch(e.type){case re.POINTCLOUD:return this._makePointCloudLayer(e,r);case re.SCENEGRAPH:return this._make3DModelLayer(e);case re.MESH:return this._makeSimpleMeshLayer(e,r);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${e.content.type}`)}}_makePointCloudLayer(e,r){let{attributes:n,pointCount:s,constantRGBA:i,cartographicOrigin:o,modelMatrix:a}=e.content,{positions:c,normals:l,colors:h}=n;if(!c)return null;let f=r&&r.props.data||{header:{vertexCount:s},attributes:{POSITION:c,NORMAL:l,COLOR_0:h}},{pointSize:u,getPointColor:d}=this.props,p=this.getSubLayerClass("pointcloud",dg.PointCloudLayer);return new p({pointSize:u},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${e.id}`,tile:e,data:f,coordinateSystem:be.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:o,modelMatrix:a,getColor:i||d,_offset:0})}_make3DModelLayer(e){let{gltf:r,instances:n,cartographicOrigin:s,modelMatrix:i}=e.content,o=this.getSubLayerClass("scenegraph",pg.ScenegraphLayer);return new o({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${e.id}`,tile:e,data:n||fg,scenegraph:r,coordinateSystem:be.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:s,modelMatrix:i,getTransformMatrix:a=>a.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(e,r){let n=e.content,{attributes:s,indices:i,modelMatrix:o,cartographicOrigin:a,coordinateSystem:c=be.COORDINATE_SYSTEM.METER_OFFSETS,material:l,featureIds:h}=n,{_getMeshColor:f}=this.props,u=r&&r.props.mesh||new ug.Geometry({topology:"triangle-list",attributes:cC(s),indices:i}),d=this.getSubLayerClass("mesh",Cn);return new d(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${e.id}`,tile:e,mesh:u,data:fg,getColor:f(e),pbrMaterial:l,modelMatrix:o,coordinateOrigin:a,coordinateSystem:c,featureIds:h,_offset:0})}renderLayers(){let{tileset3d:e,layerMap:r}=this.state;return e?e.tiles.map(n=>{let s=r[n.id]=r[n.id]||{tile:n},{layer:i}=s;return n.selected&&(i?s.needsUpdate&&(i=this._getSubLayer(n,i),s.needsUpdate=!1):i=this._getSubLayer(n)),s.layer=i,i}).filter(Boolean):null}},Ln=Wi;(()=>{Wi.defaultProps=aC})(),(()=>{Wi.layerName="Tile3DLayer"})();function cC(t){let e={};return e.positions={...t.positions,value:new Float32Array(t.positions.value)},t.normals&&(e.normals=t.normals),t.texCoords&&(e.texCoords=t.texCoords),t.colors&&(e.colors=t.colors),t.uvRegions&&(e.uvRegions=t.uvRegions),e}var Yi=v(Lt(),1),al=v(qs(),1),xg=v(Lt(),1);var lC=new Map([["centerX",Float64Array.BYTES_PER_ELEMENT],["centerY",Float64Array.BYTES_PER_ELEMENT],["centerZ",Float64Array.BYTES_PER_ELEMENT],["minHeight",Float32Array.BYTES_PER_ELEMENT],["maxHeight",Float32Array.BYTES_PER_ELEMENT],["boundingSphereCenterX",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterY",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterZ",Float64Array.BYTES_PER_ELEMENT],["boundingSphereRadius",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointX",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointY",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointZ",Float64Array.BYTES_PER_ELEMENT]]);function nl(t){return t>>1^-(t&1)}function hC(t){let e=0,r={};for(let[n,s]of lC){let i=s===8?t.getFloat64:t.getFloat32;r[n]=i.call(t,e,!0),e+=s}return{header:r,headerEndPosition:e}}function fC(t,e){let r=e,n=3,s=t.getUint32(r,!0),i=new Uint16Array(s*n);r+=Uint32Array.BYTES_PER_ELEMENT;let o=Uint16Array.BYTES_PER_ELEMENT,a=s*o,c=r,l=c+a,h=l+a,f=0,u=0,d=0;for(let p=0;p<s;p++)f+=nl(t.getUint16(c+o*p,!0)),u+=nl(t.getUint16(l+o*p,!0)),d+=nl(t.getUint16(h+o*p,!0)),i[p]=f,i[p+s]=u,i[p+s*2]=d;return r+=a*3,{vertexData:i,vertexDataEndPosition:r}}function Hn(t,e,r,n){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i;if(n===2?i=new Uint16Array(t,e,r):i=new Uint32Array(t,e,r),!s)return i;let o=0;for(let a=0;a<i.length;++a){let c=i[a];i[a]=o-c,c===0&&++o}return i}function uC(t,e,r){let n=r,s=3,o=e.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;n%o!==0&&(n+=o-n%o);let a=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let c=a*3,l=Hn(t.buffer,n,c,o);return n+=c*o,{triangleIndicesEndPosition:n,triangleIndices:l}}function dC(t,e,r){let n=r,s=3,o=e.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,a=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let c=Hn(t.buffer,n,a,o,!1);n+=a*o;let l=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let h=Hn(t.buffer,n,l,o,!1);n+=l*o;let f=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let u=Hn(t.buffer,n,f,o,!1);n+=f*o;let d=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let p=Hn(t.buffer,n,d,o,!1);return n+=d*o,{edgeIndicesEndPosition:n,westIndices:c,southIndices:h,eastIndices:u,northIndices:p}}function pC(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function gC(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}function AC(t,e){let r={};if(t.byteLength<=e)return{extensions:r,extensionsEndPosition:e};let n=e;for(;n<t.byteLength;){let s=t.getUint8(n,!0);n+=Uint8Array.BYTES_PER_ELEMENT;let i=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let o=new DataView(t.buffer,n,i);switch(s){case 1:{r.vertexNormals=pC(o);break}case 2:{r.waterMask=gC(o);break}default:}n+=i}return{extensions:r,extensionsEndPosition:n}}var or={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},_C={maxDecodingStep:or.extensions};function sl(t,e){let r=Object.assign({},_C,e),n=new DataView(t),{header:s,headerEndPosition:i}=hC(n);if(r.maxDecodingStep<or.vertices)return{header:s};let{vertexData:o,vertexDataEndPosition:a}=fC(n,i);if(r.maxDecodingStep<or.triangleIndices)return{header:s,vertexData:o};let{triangleIndices:c,triangleIndicesEndPosition:l}=uC(n,o,a);if(r.maxDecodingStep<or.edgeIndices)return{header:s,vertexData:o,triangleIndices:c};let{westIndices:h,southIndices:f,eastIndices:u,northIndices:d,edgeIndicesEndPosition:p}=dC(n,o,l);if(r.maxDecodingStep<or.extensions)return{header:s,vertexData:o,triangleIndices:c,westIndices:h,northIndices:d,eastIndices:u,southIndices:f};let{extensions:_}=AC(n,p);return{header:s,vertexData:o,triangleIndices:c,westIndices:h,northIndices:d,eastIndices:u,southIndices:f,extensions:_}}function zi(t,e,r,n){let s=n?TC(n,t.POSITION.value):mC(e),i=new t.POSITION.value.constructor(s.length*6),o=new t.TEXCOORD_0.value.constructor(s.length*4),a=new e.constructor(s.length*6);for(let l=0;l<s.length;l++){let h=s[l];EC({edge:h,edgeIndex:l,attributes:t,skirtHeight:r,newPosition:i,newTexcoord0:o,newTriangles:a})}t.POSITION.value=jr(t.POSITION.value,i),t.TEXCOORD_0.value=jr(t.TEXCOORD_0.value,o);let c=e instanceof Array?e.concat(a):jr(e,a);return{attributes:t,triangles:c}}function mC(t){let e=[];for(let o=0;o<t.length;o+=3)e.push([t[o],t[o+1]]),e.push([t[o+1],t[o+2]]),e.push([t[o+2],t[o]]);e.sort((o,a)=>Math.min(...o)-Math.min(...a)||Math.max(...o)-Math.max(...a));let r=[],n=0;for(;n<e.length;){var s,i;e[n][0]===((s=e[n+1])===null||s===void 0?void 0:s[1])&&e[n][1]===((i=e[n+1])===null||i===void 0?void 0:i[0])?n+=2:(r.push(e[n]),n++)}return r}function TC(t,e){t.westIndices.sort((n,s)=>e[3*n+1]-e[3*s+1]),t.eastIndices.sort((n,s)=>e[3*s+1]-e[3*n+1]),t.southIndices.sort((n,s)=>e[3*s]-e[3*n]),t.northIndices.sort((n,s)=>e[3*n]-e[3*s]);let r=[];for(let n in t){let s=t[n];for(let i=0;i<s.length-1;i++)r.push([s[i],s[i+1]])}return r}function EC(t){let{edge:e,edgeIndex:r,attributes:n,skirtHeight:s,newPosition:i,newTexcoord0:o,newTriangles:a}=t,c=n.POSITION.value.length,l=r*2,h=r*2+1;i.set(n.POSITION.value.subarray(e[0]*3,e[0]*3+3),l*3),i[l*3+2]=i[l*3+2]-s,i.set(n.POSITION.value.subarray(e[1]*3,e[1]*3+3),h*3),i[h*3+2]=i[h*3+2]-s,o.set(n.TEXCOORD_0.value.subarray(e[0]*2,e[0]*2+2),l*2),o.set(n.TEXCOORD_0.value.subarray(e[1]*2,e[1]*2+2),h*2);let f=r*2*3;a[f]=e[0],a[f+1]=c/3+h,a[f+2]=e[1],a[f+3]=c/3+h,a[f+4]=e[0],a[f+5]=c/3+l}function il(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{bounds:r}=e,{header:n,vertexData:s,triangleIndices:i,westIndices:o,northIndices:a,eastIndices:c,southIndices:l}=sl(t,or.triangleIndices),h=i,f=RC(s,n,r),u=$e(f);if(e!=null&&e.skirtHeight){let{attributes:d,triangles:p}=zi(f,h,e.skirtHeight,{westIndices:o,northIndices:a,eastIndices:c,southIndices:l});f=d,h=p}return{loaderData:{header:{}},header:{vertexCount:h.length,boundingBox:u},schema:void 0,topology:"triangle-list",mode:4,indices:{value:h,size:1},attributes:f}}function RC(t,e,r){let{minHeight:n,maxHeight:s}=e,[i,o,a,c]=r||[0,0,1,1],l=a-i,h=c-o,f=s-n,u=t.length/3,d=new Float32Array(u*3),p=new Float32Array(u*2);for(let _=0;_<u;_++){let A=t[_]/32767,T=t[_+u]/32767,x=t[_+u*2]/32767;d[3*_+0]=A*l+i,d[3*_+1]=T*h+o,d[3*_+2]=x*f+n,p[2*_+0]=A,p[2*_+1]=T}return{POSITION:{value:d,size:3},TEXCOORD_0:{value:p,size:2}}}var Vn=class{constructor(e=257){this.gridSize=e;let r=e-1;if(r&r-1)throw new Error(`Expected grid size to be 2^n+1, got ${e}.`);this.numTriangles=r*r*2-2,this.numParentTriangles=this.numTriangles-r*r,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let n=0;n<this.numTriangles;n++){let s=n+2,i=0,o=0,a=0,c=0,l=0,h=0;for(s&1?a=c=l=r:i=o=h=r;(s>>=1)>1;){let u=i+a>>1,d=o+c>>1;s&1?(a=i,c=o,i=l,o=h):(i=a,o=c,a=l,c=h),l=u,h=d}let f=n*4;this.coords[f+0]=i,this.coords[f+1]=o,this.coords[f+2]=a,this.coords[f+3]=c}}createTile(e){return new ol(e,this)}},ol=class{constructor(e,r){let n=r.gridSize;if(e.length!==n*n)throw new Error(`Expected terrain data of length ${n*n} (${n} x ${n}), got ${e.length}.`);this.terrain=e,this.martini=r,this.errors=new Float32Array(e.length),this.update()}update(){let{numTriangles:e,numParentTriangles:r,coords:n,gridSize:s}=this.martini,{terrain:i,errors:o}=this;for(let a=e-1;a>=0;a--){let c=a*4,l=n[c+0],h=n[c+1],f=n[c+2],u=n[c+3],d=l+f>>1,p=h+u>>1,_=d+p-h,A=p+l-d,T=(i[h*s+l]+i[u*s+f])/2,x=p*s+d,R=Math.abs(T-i[x]);if(o[x]=Math.max(o[x],R),a<r){let S=(h+A>>1)*s+(l+_>>1),B=(u+A>>1)*s+(f+_>>1);o[x]=Math.max(o[x],o[S],o[B])}}}getMesh(e=0){let{gridSize:r,indices:n}=this.martini,{errors:s}=this,i=0,o=0,a=r-1;n.fill(0);function c(d,p,_,A,T,x){let R=d+_>>1,S=p+A>>1;Math.abs(d-T)+Math.abs(p-x)>1&&s[S*r+R]>e?(c(T,x,d,p,R,S),c(_,A,T,x,R,S)):(n[p*r+d]=n[p*r+d]||++i,n[A*r+_]=n[A*r+_]||++i,n[x*r+T]=n[x*r+T]||++i,o++)}c(0,0,a,a,a,0),c(a,a,0,0,0,a);let l=new Uint16Array(i*2),h=new Uint32Array(o*3),f=0;function u(d,p,_,A,T,x){let R=d+_>>1,S=p+A>>1;if(Math.abs(d-T)+Math.abs(p-x)>1&&s[S*r+R]>e)u(T,x,d,p,R,S),u(_,A,T,x,R,S);else{let B=n[p*r+d]-1,M=n[A*r+_]-1,F=n[x*r+T]-1;l[2*B]=d,l[2*B+1]=p,l[2*M]=_,l[2*M+1]=A,l[2*F]=T,l[2*F+1]=x,h[f++]=B,h[f++]=M,h[f++]=F}}return u(0,0,a,a,a,0),u(a,a,0,0,0,a),{vertices:l,triangles:h}}};var Xn=class{constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r;this.data=e,this.width=r,this.height=n,this.coords=[],this.triangles=[],this._halfedges=[],this._candidates=[],this._queueIndices=[],this._queue=[],this._errors=[],this._rms=[],this._pending=[],this._pendingLen=0,this._rmsSum=0;let s=r-1,i=n-1,o=this._addPoint(0,0),a=this._addPoint(s,0),c=this._addPoint(0,i),l=this._addPoint(s,i),h=this._addTriangle(l,o,c,-1,-1,-1);this._addTriangle(o,l,a,h,-1,-1),this._flush()}run(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;for(;this.getMaxError()>e;)this.refine()}refine(){this._step(),this._flush()}getMaxError(){return this._errors[0]}getRMSD(){return this._rmsSum>0?Math.sqrt(this._rmsSum/(this.width*this.height)):0}heightAt(e,r){return this.data[this.width*r+e]}_flush(){let e=this.coords;for(let r=0;r<this._pendingLen;r++){let n=this._pending[r],s=2*this.triangles[n*3+0],i=2*this.triangles[n*3+1],o=2*this.triangles[n*3+2];this._findCandidate(e[s],e[s+1],e[i],e[i+1],e[o],e[o+1],n)}this._pendingLen=0}_findCandidate(e,r,n,s,i,o,a){let c=Math.min(e,n,i),l=Math.min(r,s,o),h=Math.max(e,n,i),f=Math.max(r,s,o),u=ar(n,s,i,o,c,l),d=ar(i,o,e,r,c,l),p=ar(e,r,n,s,c,l),_=s-r,A=e-n,T=o-s,x=n-i,R=r-o,S=i-e,B=ar(e,r,n,s,i,o),M=this.heightAt(e,r)/B,F=this.heightAt(n,s)/B,C=this.heightAt(i,o)/B,E=0,g=0,y=0,O=0;for(let b=l;b<=f;b++){let N=0;u<0&&T!==0&&(N=Math.max(N,Math.floor(-u/T))),d<0&&R!==0&&(N=Math.max(N,Math.floor(-d/R))),p<0&&_!==0&&(N=Math.max(N,Math.floor(-p/_)));let U=u+T*N,Y=d+R*N,W=p+_*N,Q=!1;for(let J=c+N;J<=h;J++){if(U>=0&&Y>=0&&W>=0){Q=!0;let q=M*U+F*Y+C*W,tt=Math.abs(q-this.heightAt(J,b));O+=tt*tt,tt>E&&(E=tt,g=J,y=b)}else if(Q)break;U+=T,Y+=R,W+=_}u+=x,d+=S,p+=A}(g===e&&y===r||g===n&&y===s||g===i&&y===o)&&(E=0),this._candidates[2*a]=g,this._candidates[2*a+1]=y,this._rms[a]=O,this._queuePush(a,E,O)}_step(){let e=this._queuePop(),r=e*3+0,n=e*3+1,s=e*3+2,i=this.triangles[r],o=this.triangles[n],a=this.triangles[s],c=this.coords[2*i],l=this.coords[2*i+1],h=this.coords[2*o],f=this.coords[2*o+1],u=this.coords[2*a],d=this.coords[2*a+1],p=this._candidates[2*e],_=this._candidates[2*e+1],A=this._addPoint(p,_);if(ar(c,l,h,f,p,_)===0)this._handleCollinear(A,r);else if(ar(h,f,u,d,p,_)===0)this._handleCollinear(A,n);else if(ar(u,d,c,l,p,_)===0)this._handleCollinear(A,s);else{let T=this._halfedges[r],x=this._halfedges[n],R=this._halfedges[s],S=this._addTriangle(i,o,A,T,-1,-1,r),B=this._addTriangle(o,a,A,x,-1,S+1),M=this._addTriangle(a,i,A,R,S+2,B+1);this._legalize(S),this._legalize(B),this._legalize(M)}}_addPoint(e,r){let n=this.coords.length>>1;return this.coords.push(e,r),n}_addTriangle(e,r,n,s,i,o){let a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this.triangles.length,c=a/3;return this.triangles[a+0]=e,this.triangles[a+1]=r,this.triangles[a+2]=n,this._halfedges[a+0]=s,this._halfedges[a+1]=i,this._halfedges[a+2]=o,s>=0&&(this._halfedges[s]=a+0),i>=0&&(this._halfedges[i]=a+1),o>=0&&(this._halfedges[o]=a+2),this._candidates[2*c+0]=0,this._candidates[2*c+1]=0,this._queueIndices[c]=-1,this._rms[c]=0,this._pending[this._pendingLen++]=c,a}_legalize(e){let r=this._halfedges[e];if(r<0)return;let n=e-e%3,s=r-r%3,i=n+(e+1)%3,o=n+(e+2)%3,a=s+(r+2)%3,c=s+(r+1)%3,l=this.triangles[o],h=this.triangles[e],f=this.triangles[i],u=this.triangles[a],d=this.coords;if(!xC(d[2*l],d[2*l+1],d[2*h],d[2*h+1],d[2*f],d[2*f+1],d[2*u],d[2*u+1]))return;let p=this._halfedges[i],_=this._halfedges[o],A=this._halfedges[a],T=this._halfedges[c];this._queueRemove(n/3),this._queueRemove(s/3);let x=this._addTriangle(l,u,f,-1,A,p,n),R=this._addTriangle(u,l,h,x,_,T,s);this._legalize(x+1),this._legalize(R+2)}_handleCollinear(e,r){let n=r-r%3,s=n+(r+1)%3,i=n+(r+2)%3,o=this.triangles[i],a=this.triangles[r],c=this.triangles[s],l=this._halfedges[s],h=this._halfedges[i],f=this._halfedges[r];if(f<0){let M=this._addTriangle(e,o,a,-1,h,-1,n),F=this._addTriangle(o,e,c,M,-1,l);this._legalize(M+1),this._legalize(F+2);return}let u=f-f%3,d=u+(f+2)%3,p=u+(f+1)%3,_=this.triangles[d],A=this._halfedges[d],T=this._halfedges[p];this._queueRemove(u/3);let x=this._addTriangle(o,a,e,h,-1,-1,n),R=this._addTriangle(a,_,e,T,-1,x+1,u),S=this._addTriangle(_,c,e,A,-1,R+1),B=this._addTriangle(c,o,e,l,x+2,S+1);this._legalize(x),this._legalize(R),this._legalize(S),this._legalize(B)}_queuePush(e,r,n){let s=this._queue.length;this._queueIndices[e]=s,this._queue.push(e),this._errors.push(r),this._rmsSum+=n,this._queueUp(s)}_queuePop(){let e=this._queue.length-1;return this._queueSwap(0,e),this._queueDown(0,e),this._queuePopBack()}_queuePopBack(){let e=this._queue.pop();return this._errors.pop(),this._rmsSum-=this._rms[e],this._queueIndices[e]=-1,e}_queueRemove(e){let r=this._queueIndices[e];if(r<0){let s=this._pending.indexOf(e);if(s!==-1)this._pending[s]=this._pending[--this._pendingLen];else throw new Error("Broken triangulation (something went wrong).");return}let n=this._queue.length-1;n!==r&&(this._queueSwap(r,n),this._queueDown(r,n)||this._queueUp(r)),this._queuePopBack()}_queueLess(e,r){return this._errors[e]>this._errors[r]}_queueSwap(e,r){let n=this._queue[e],s=this._queue[r];this._queue[e]=s,this._queue[r]=n,this._queueIndices[n]=r,this._queueIndices[s]=e;let i=this._errors[e];this._errors[e]=this._errors[r],this._errors[r]=i}_queueUp(e){let r=e;for(;;){let n=r-1>>1;if(n===r||!this._queueLess(r,n))break;this._queueSwap(n,r),r=n}}_queueDown(e,r){let n=e;for(;;){let s=2*n+1;if(s>=r||s<0)break;let i=s+1,o=s;if(i<r&&this._queueLess(i,s)&&(o=i),!this._queueLess(o,n))break;this._queueSwap(n,o),n=o}return n>e}};function ar(t,e,r,n,s,i){return(r-s)*(e-i)-(n-i)*(t-s)}function xC(t,e,r,n,s,i,o,a){let c=t-o,l=e-a,h=r-o,f=n-a,u=s-o,d=i-a,p=c*c+l*l,_=h*h+f*f,A=u*u+d*d;return c*(f*A-_*d)-l*(h*A-_*u)+p*(h*d-f*u)<0}function mg(t,e){let{meshMaxError:r,bounds:n,elevationDecoder:s}=e,{data:i,width:o,height:a}=t,c,l;switch(e.tesselator){case"martini":c=ki(i,o,a,s,e.tesselator),l=Ag(r,o,c);break;case"delatin":c=ki(i,o,a,s,e.tesselator),l=_g(r,o,a,c);break;default:o===a&&!(a&o-1)?(c=ki(i,o,a,s,"martini"),l=Ag(r,o,c)):(c=ki(i,o,a,s,"delatin"),l=_g(r,o,a,c));break}let{vertices:h}=l,{triangles:f}=l,u=SC(h,c,o,a,n),d=$e(u);if(e.skirtHeight){let{attributes:p,triangles:_}=zi(u,f,e.skirtHeight);u=p,f=_}return{loaderData:{header:{}},header:{vertexCount:f.length,boundingBox:d},mode:4,indices:{value:Uint32Array.from(f),size:1},attributes:u}}function Ag(t,e,r){let n=e+1,i=new Vn(n).createTile(r),{vertices:o,triangles:a}=i.getMesh(t);return{vertices:o,triangles:a}}function _g(t,e,r,n){let s=new Xn(n,e+1,r+1);s.run(t);let{coords:i,triangles:o}=s;return{vertices:i,triangles:o}}function ki(t,e,r,n,s){let{rScaler:i,bScaler:o,gScaler:a,offset:c}=n,l=new Float32Array((e+1)*(r+1));for(let h=0,f=0;f<r;f++)for(let u=0;u<e;u++,h++){let d=h*4,p=t[d+0],_=t[d+1],A=t[d+2];l[h+f]=p*i+_*a+A*o+c}if(s==="martini"){for(let h=(e+1)*e,f=0;f<e;f++,h++)l[h]=l[h-e-1];for(let h=r,f=0;f<r+1;f++,h+=r+1)l[h]=l[h-1]}return l}function SC(t,e,r,n,s){let i=r+1,o=t.length/2,a=new Float32Array(o*3),c=new Float32Array(o*2),[l,h,f,u]=s||[0,0,r,n],d=(f-l)/r,p=(u-h)/n;for(let _=0;_<o;_++){let A=t[_*2],T=t[_*2+1],x=T*i+A;a[3*_+0]=A*d+l,a[3*_+1]=-T*p+u,a[3*_+2]=e[x],c[2*_+0]=A/r,c[2*_+1]=T/n}return{POSITION:{value:a,size:3},TEXCOORD_0:{value:c,size:2}}}var Gi="4.1.0";var Ki={name:"Terrain",id:"terrain",module:"terrain",version:Gi,worker:!0,extensions:["png","pngraw","jpg","jpeg","gif","webp","bmp"],mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp"],options:{terrain:{tesselator:"auto",bounds:void 0,meshMaxError:10,elevationDecoder:{rScaler:1,gScaler:0,bScaler:0,offset:0},skirtHeight:void 0}}};var Tg={name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:Gi,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var CC={...Ki,parse:BC};async function BC(t,e,r){let n={...e,mimeType:"application/x.image",image:{...e?.image,type:"data"}},s=await Ct(t,[],n,r),i={...CC.options.terrain,...e?.terrain};return mg(s,i)}var h4={...Tg,parseSync:(t,e)=>il(t,e?.["quantized-mesh"]),parse:async(t,e)=>il(t,e?.["quantized-mesh"])};var Eg=[1],MC={...te.defaultProps,elevationData:Ie,texture:{...Ie,optional:!0},meshMaxError:{type:"number",value:4},bounds:{type:"array",value:null,optional:!0,compare:!0},color:{type:"color",value:[255,255,255]},elevationDecoder:{type:"object",value:{rScaler:1,gScaler:0,bScaler:0,offset:0}},workerUrl:"",wireframe:!1,material:!0,loaders:[Ki]};function Rg(t){return Array.isArray(t)?t.join(";"):t||""}var Ji=class extends Yi.CompositeLayer{updateState({props:e,oldProps:r}){let n=e.elevationData!==r.elevationData;if(n){let{elevationData:i}=e,o=i&&(Array.isArray(i)||i.includes("{x}")&&i.includes("{y}"));this.setState({isTiled:o})}let s=n||e.meshMaxError!==r.meshMaxError||e.elevationDecoder!==r.elevationDecoder||e.bounds!==r.bounds;if(!this.state.isTiled&&s){let i=this.loadTerrain(e);this.setState({terrain:i})}e.workerUrl&&Yi.log.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain({elevationData:e,bounds:r,elevationDecoder:n,meshMaxError:s,signal:i}){if(!e)return null;let o=this.getLoadOptions();o={...o,terrain:{skirtHeight:this.state.isTiled?s*2:0,...o?.terrain,bounds:r,meshMaxError:s,elevationDecoder:n}};let{fetch:a}=this.props;return a(e,{propName:"elevationData",layer:this,loadOptions:o,signal:i})}getTiledTerrainData(e){let{elevationData:r,fetch:n,texture:s,elevationDecoder:i,meshMaxError:o}=this.props,{viewport:a}=this.context,c=$t(r,e),l=s&&$t(s,e),{signal:h}=e,f=[0,0],u=[0,0];if(a.isGeospatial){let A=e.bbox;f=a.projectFlat([A.west,A.south]),u=a.projectFlat([A.east,A.north])}else{let A=e.bbox;f=[A.left,A.bottom],u=[A.right,A.top]}let d=[f[0],f[1],u[0],u[1]],p=this.loadTerrain({elevationData:c,bounds:d,elevationDecoder:i,meshMaxError:o,signal:h}),_=l?n(l,{propName:"texture",layer:this,loaders:[],signal:h}).catch(A=>null):Promise.resolve(null);return Promise.all([p,_])}renderSubLayers(e){let r=this.getSubLayerClass("mesh",al.SimpleMeshLayer),{color:n,wireframe:s,material:i}=this.props,{data:o}=e;if(!o)return null;let[a,c]=o;return new r(e,{data:Eg,mesh:a,texture:c,_instanced:!1,coordinateSystem:xg.COORDINATE_SYSTEM.CARTESIAN,getPosition:l=>[0,0,0],getColor:n,wireframe:s,material:i})}onViewportLoad(e){if(!e)return;let{zRange:r}=this.state,n=e.map(o=>o.content).filter(Boolean).map(o=>o[0].header.boundingBox.map(c=>c[2]));if(n.length===0)return;let s=Math.min(...n.map(o=>o[0])),i=Math.max(...n.map(o=>o[1]));(!r||s<r[0]||i>r[1])&&this.setState({zRange:[s,i]})}renderLayers(){let{color:e,material:r,elevationData:n,texture:s,wireframe:i,meshMaxError:o,elevationDecoder:a,tileSize:c,maxZoom:l,minZoom:h,extent:f,maxRequests:u,onTileLoad:d,onTileUnload:p,onTileError:_,maxCacheSize:A,maxCacheByteSize:T,refinementStrategy:x}=this.props;if(this.state.isTiled)return new te(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:Rg(n),texture:Rg(s),meshMaxError:o,elevationDecoder:a}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:c,maxZoom:l,minZoom:h,extent:f,maxRequests:u,onTileLoad:d,onTileUnload:p,onTileError:_,maxCacheSize:A,maxCacheByteSize:T,refinementStrategy:x});if(!n)return null;let R=this.getSubLayerClass("mesh",al.SimpleMeshLayer);return new R(this.getSubLayerProps({id:"mesh"}),{data:Eg,mesh:this.state.terrain,texture:s,_instanced:!1,getPosition:S=>[0,0,0],getColor:e,material:r,wireframe:i})}},Wn=Ji;(()=>{Ji.defaultProps=MC})(),(()=>{Ji.layerName="TerrainLayer"})();var ao=v(Lt(),1),Bl=v(Ut(),1),r0=v(Cg(),1);var zn={x:0,y:1,z:2};function cr(t,e={}){let{start:r=0,end:n=t.length,plane:s="xy"}=e,i=e.size||2,o=0,a=zn[s[0]],c=zn[s[1]];for(let l=r,h=n-i;l<n;l+=i)o+=(t[l+a]-t[h+a])*(t[l+c]+t[h+c]),h=l;return o/2}function ll(t,e,r=2,n,s="xy"){let i=e&&e.length,o=i?e[0]*r:t.length,a=Mg(t,0,o,r,!0,n&&n[0],s),c=[];if(!a||a.next===a.prev)return c;let l,h,f,u,d,p,_;if(i&&(a=PC(t,e,a,r,n,s)),t.length>80*r){u=h=t[0],d=f=t[1];for(let A=r;A<o;A+=r)p=t[A],_=t[A+1],p<u&&(u=p),_<d&&(d=_),p>h&&(h=p),_>f&&(f=_);l=Math.max(h-u,f-d),l=l!==0?32767/l:0}return kn(a,c,r,u,d,l,0),c}function Mg(t,e,r,n,s,i,o){let a,c;i===void 0&&(i=cr(t,{start:e,end:r,size:n,plane:o}));let l=zn[o[0]],h=zn[o[1]];if(s===i<0)for(a=e;a<r;a+=n)c=Bg(a,t[a+l],t[a+h],c);else for(a=r-n;a>=e;a-=n)c=Bg(a,t[a+l],t[a+h],c);return c&&Zi(c,c.next)&&(Kn(c),c=c.next),c}function lr(t,e){if(!t)return t;e||(e=t);let r=t,n;do if(n=!1,!r.steiner&&(Zi(r,r.next)||rt(r.prev,r,r.next)===0)){if(Kn(r),r=e=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==e);return e}function kn(t,e,r,n,s,i,o){if(!t)return;!o&&i&&LC(t,n,s,i);let a=t,c,l;for(;t.prev!==t.next;){if(c=t.prev,l=t.next,i?NC(t,n,s,i):FC(t)){e.push(c.i/r|0),e.push(t.i/r|0),e.push(l.i/r|0),Kn(t),t=l.next,a=l.next;continue}if(t=l,t===a){o?o===1?(t=OC(lr(t),e,r),kn(t,e,r,n,s,i,2)):o===2&&bC(t,e,r,n,s,i):kn(lr(t),e,r,n,s,i,1);break}}}function FC(t){let e=t.prev,r=t,n=t.next;if(rt(e,r,n)>=0)return!1;let s=e.x,i=r.x,o=n.x,a=e.y,c=r.y,l=n.y,h=s<i?s<o?s:o:i<o?i:o,f=a<c?a<l?a:l:c<l?c:l,u=s>i?s>o?s:o:i>o?i:o,d=a>c?a>l?a:l:c>l?c:l,p=n.next;for(;p!==e;){if(p.x>=h&&p.x<=u&&p.y>=f&&p.y<=d&&kr(s,a,i,c,o,l,p.x,p.y)&&rt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function NC(t,e,r,n){let s=t.prev,i=t,o=t.next;if(rt(s,i,o)>=0)return!1;let a=s.x,c=i.x,l=o.x,h=s.y,f=i.y,u=o.y,d=a<c?a<l?a:l:c<l?c:l,p=h<f?h<u?h:u:f<u?f:u,_=a>c?a>l?a:l:c>l?c:l,A=h>f?h>u?h:u:f>u?f:u,T=cl(d,p,e,r,n),x=cl(_,A,e,r,n),R=t.prevZ,S=t.nextZ;for(;R&&R.z>=T&&S&&S.z<=x;){if(R.x>=d&&R.x<=_&&R.y>=p&&R.y<=A&&R!==s&&R!==o&&kr(a,h,c,f,l,u,R.x,R.y)&&rt(R.prev,R,R.next)>=0||(R=R.prevZ,S.x>=d&&S.x<=_&&S.y>=p&&S.y<=A&&S!==s&&S!==o&&kr(a,h,c,f,l,u,S.x,S.y)&&rt(S.prev,S,S.next)>=0))return!1;S=S.nextZ}for(;R&&R.z>=T;){if(R.x>=d&&R.x<=_&&R.y>=p&&R.y<=A&&R!==s&&R!==o&&kr(a,h,c,f,l,u,R.x,R.y)&&rt(R.prev,R,R.next)>=0)return!1;R=R.prevZ}for(;S&&S.z<=x;){if(S.x>=d&&S.x<=_&&S.y>=p&&S.y<=A&&S!==s&&S!==o&&kr(a,h,c,f,l,u,S.x,S.y)&&rt(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}function OC(t,e,r){let n=t;do{let s=n.prev,i=n.next.next;!Zi(s,i)&&yg(s,n,n.next,i)&&Gn(s,i)&&Gn(i,s)&&(e.push(s.i/r|0),e.push(n.i/r|0),e.push(i.i/r|0),Kn(n),Kn(n.next),n=t=i),n=n.next}while(n!==t);return lr(n)}function bC(t,e,r,n,s,i){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&XC(o,a)){let c=Ig(o,a);o=lr(o,o.next),c=lr(c,c.next),kn(o,e,r,n,s,i,0),kn(c,e,r,n,s,i,0);return}a=a.next}o=o.next}while(o!==t)}function PC(t,e,r,n,s,i){let o=[],a,c,l,h,f;for(a=0,c=e.length;a<c;a++)l=e[a]*n,h=a<c-1?e[a+1]*n:t.length,f=Mg(t,l,h,n,!1,s&&s[a+1],i),f===f.next&&(f.steiner=!0),o.push(VC(f));for(o.sort(DC),a=0;a<o.length;a++)r=wC(o[a],r);return r}function DC(t,e){return t.x-e.x}function wC(t,e){let r=vC(t,e);if(!r)return e;let n=Ig(r,t);return lr(n,n.next),lr(r,r.next)}function vC(t,e){let r=e,n=t.x,s=t.y,i=-1/0,o;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){let u=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(u<=n&&u>i&&(i=u,o=r.x<r.next.x?r:r.next,u===n))return o}r=r.next}while(r!==e);if(!o)return null;let a=o,c=o.x,l=o.y,h=1/0,f;r=o;do n>=r.x&&r.x>=c&&n!==r.x&&kr(s<l?n:i,s,c,l,s<l?i:n,s,r.x,r.y)&&(f=Math.abs(s-r.y)/(n-r.x),Gn(r,t)&&(f<h||f===h&&(r.x>o.x||r.x===o.x&&UC(o,r)))&&(o=r,h=f)),r=r.next;while(r!==a);return o}function UC(t,e){return rt(t.prev,t,e.prev)<0&&rt(e.next,t,t.next)<0}function LC(t,e,r,n){let s=t;do s.z===0&&(s.z=cl(s.x,s.y,e,r,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,HC(s)}function HC(t){let e,r,n=1,s,i,o,a,c,l;do{for(i=t,t=null,l=null,s=0;i;){for(s++,a=i,o=0,r=0;r<n&&(o++,a=a.nextZ,!!a);r++);for(c=n;o>0||c>0&&a;)o!==0&&(c===0||!a||i.z<=a.z)?(e=i,i=i.nextZ,o--):(e=a,a=a.nextZ,c--),l?l.nextZ=e:t=e,e.prevZ=l,l=e;i=a}l.nextZ=null,n*=2}while(s>1);return t}function cl(t,e,r,n,s){return t=(t-r)*s|0,e=(e-n)*s|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function VC(t){let e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function kr(t,e,r,n,s,i,o,a){return(s-o)*(e-a)>=(t-o)*(i-a)&&(t-o)*(n-a)>=(r-o)*(e-a)&&(r-o)*(i-a)>=(s-o)*(n-a)}function XC(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!WC(t,e)&&(Gn(t,e)&&Gn(e,t)&&zC(t,e)&&(rt(t.prev,t,e.prev)||rt(t,e.prev,e))||Zi(t,e)&&rt(t.prev,t,t.next)>0&&rt(e.prev,e,e.next)>0)}function rt(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Zi(t,e){return t.x===e.x&&t.y===e.y}function yg(t,e,r,n){let s=ji(rt(t,e,r)),i=ji(rt(t,e,n)),o=ji(rt(r,n,t)),a=ji(rt(r,n,e));return!!(s!==i&&o!==a||s===0&&qi(t,r,e)||i===0&&qi(t,n,e)||o===0&&qi(r,t,n)||a===0&&qi(r,e,n))}function qi(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function ji(t){return t>0?1:t<0?-1:0}function WC(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&yg(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function Gn(t,e){return rt(t.prev,t,t.next)<0?rt(t,e,t.next)>=0&&rt(t,t.prev,e)>=0:rt(t,e,t.prev)<0||rt(t,t.next,e)<0}function zC(t,e){let r=t,n=!1,s=(t.x+e.x)/2,i=(t.y+e.y)/2;do r.y>i!=r.next.y>i&&r.next.y!==r.y&&s<(r.next.x-r.x)*(i-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==t);return n}function Ig(t,e){let r=new Jn(t.i,t.x,t.y),n=new Jn(e.i,e.x,e.y),s=t.next,i=e.prev;return t.next=e,e.prev=t,r.next=s,s.prev=r,n.next=r,r.prev=n,i.next=n,n.prev=i,n}function Bg(t,e,r,n){let s=new Jn(t,e,r);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function Kn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}var Jn=class{constructor(e,r,n){P(this,"i",void 0),P(this,"x",void 0),P(this,"y",void 0),P(this,"prev",null),P(this,"next",null),P(this,"z",0),P(this,"prevZ",null),P(this,"nextZ",null),P(this,"steiner",!1),this.i=e,this.x=r,this.y=n}};function ul(t,e,r){let n=YC(t),s=Object.keys(n).filter(i=>n[i]!==Array);return qC(t,{propArrayTypes:n,...e},{numericPropKeys:r&&r.numericPropKeys||s,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function YC(t){let e={};for(let r of t)if(r.properties)for(let n in r.properties){let s=r.properties[n];e[n]=eB(s,e[n])}return e}function qC(t,e,r){let{pointPositionsCount:n,pointFeaturesCount:s,linePositionsCount:i,linePathsCount:o,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:h,polygonFeaturesCount:f,propArrayTypes:u,coordLength:d}=e,{numericPropKeys:p=[],PositionDataType:_=Float32Array,triangulate:A=!0}=r,T=t[0]&&"id"in t[0],x=t.length>65535?Uint32Array:Uint16Array,R={type:"Point",positions:new _(n*d),globalFeatureIds:new x(n),featureIds:s>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},S={type:"LineString",pathIndices:i>65535?new Uint32Array(o+1):new Uint16Array(o+1),positions:new _(i*d),globalFeatureIds:new x(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},B={type:"Polygon",polygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),primitivePolygonIndices:c>65535?new Uint32Array(h+1):new Uint16Array(h+1),positions:new _(c*d),globalFeatureIds:new x(c),featureIds:f>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};A&&(B.triangles=[]);for(let F of[R,S,B])for(let C of p){let E=u[C];F.numericProps[C]=new E(F.positions.length/d)}S.pathIndices[o]=i,B.polygonIndices[l]=c,B.primitivePolygonIndices[h]=c;let M={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let F of t){let C=F.geometry,E=F.properties||{};switch(C.type){case"Point":jC(C,R,M,d,E),R.properties.push(fl(E,p)),T&&R.fields.push({id:F.id}),M.pointFeature++;break;case"LineString":ZC(C,S,M,d,E),S.properties.push(fl(E,p)),T&&S.fields.push({id:F.id}),M.lineFeature++;break;case"Polygon":QC(C,B,M,d,E),B.properties.push(fl(E,p)),T&&B.fields.push({id:F.id}),M.polygonFeature++;break;default:throw new Error("Invalid geometry type")}M.feature++}return tB(R,S,B,d)}function jC(t,e,r,n,s){e.positions.set(t.data,r.pointPosition*n);let i=t.data.length/n;dl(e,s,r.pointPosition,i),e.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+i),e.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+i),r.pointPosition+=i}function ZC(t,e,r,n,s){e.positions.set(t.data,r.linePosition*n);let i=t.data.length/n;dl(e,s,r.linePosition,i),e.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+i),e.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+i);for(let o=0,a=t.indices.length;o<a;++o){let c=t.indices[o],l=o===a-1?t.data.length:t.indices[o+1];e.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(l-c)/n}}function QC(t,e,r,n,s){e.positions.set(t.data,r.polygonPosition*n);let i=t.data.length/n;dl(e,s,r.polygonPosition,i),e.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+i),e.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+i);for(let o=0,a=t.indices.length;o<a;++o){let c=r.polygonPosition;e.polygonIndices[r.polygonObject++]=c;let l=t.areas[o],h=t.indices[o],f=t.indices[o+1];for(let d=0,p=h.length;d<p;++d){let _=h[d],A=d===p-1?f===void 0?t.data.length:f[0]:h[d+1];e.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(A-_)/n}let u=r.polygonPosition;$C(e,l,h,{startPosition:c,endPosition:u,coordLength:n})}}function $C(t,e,r,n){let{startPosition:s,endPosition:i,coordLength:o}=n;if(!t.triangles)return;let a=s*o,c=i*o,l=t.positions.subarray(a,c),h=r[0],f=r.slice(1).map(d=>(d-h)/o),u=ll(l,f,o,e);for(let d=0,p=u.length;d<p;++d)t.triangles.push(s+u[d])}function hl(t,e){let r={};for(let n in t)r[n]={value:t[n],size:e};return r}function tB(t,e,r,n){let s={shape:"binary-feature-collection",points:{...t,positions:{value:t.positions,size:n},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:hl(t.numericProps,1)},lines:{...e,positions:{value:e.positions,size:n},pathIndices:{value:e.pathIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:hl(e.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:n},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:hl(r.numericProps,1)}};return s.polygons&&r.triangles&&(s.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),s}function dl(t,e,r,n){for(let s in t.numericProps)if(s in e){let i=e[s];t.numericProps[s].fill(i,r,r+n)}}function fl(t,e){let r={};for(let n in t)e.includes(n)||(r[n]=t[n]);return r}function eB(t,e){return e===Array||!Number.isFinite(t)?Array:e===Float64Array||Math.fround(t)!==t?Float64Array:Float32Array}function to(t,e){let r=e?.globalFeatureId;return r!==void 0?rB(t,r):nB(t,e?.type)}function rB(t,e){let r=bg(t);for(let n of r){let s=0,i=n.featureIds.value[0];for(let o=0;o<n.featureIds.value.length;o++){let a=n.featureIds.value[o];if(a!==i){if(e===n.globalFeatureIds.value[s])return Qi(n,s,o);s=o,i=a}}if(e===n.globalFeatureIds.value[s])return Qi(n,s,n.featureIds.value.length)}throw new Error(`featureId:${e} not found`)}function nB(t,e){let r=bg(t,e);return sB(r)}function Og(t,e,r){switch(t.type){case"Point":return cB(t,e,r);case"LineString":return aB(t,e,r);case"Polygon":return Pg(t,e,r);default:let n=t;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function bg(t,e){let r=[];return t.points&&(t.points.type="Point",r.push(t.points)),t.lines&&(t.lines.type="LineString",r.push(t.lines)),t.polygons&&(t.polygons.type="Polygon",r.push(t.polygons)),r}function sB(t){let e=[];for(let r of t){if(r.featureIds.value.length===0)continue;let n=0,s=r.featureIds.value[0];for(let i=0;i<r.featureIds.value.length;i++){let o=r.featureIds.value[i];o!==s&&(e.push(Qi(r,n,i)),n=i,s=o)}e.push(Qi(r,n,r.featureIds.value.length))}return e}function Qi(t,e,r){let n=Og(t,e,r),s=oB(t,e,r),i=iB(t,e,r);return{type:"Feature",geometry:n,properties:s,...i}}function iB(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;return t.fields&&t.fields[t.featureIds.value[e]]}function oB(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0,n=Object.assign({},t.properties[t.featureIds.value[e]]);for(let s in t.numericProps)n[s]=t.numericProps[s].value[e];return n}function Pg(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1/0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1/0,{positions:n}=t,s=t.polygonIndices.value.filter(c=>c>=e&&c<=r),i=t.primitivePolygonIndices.value.filter(c=>c>=e&&c<=r);if(!(s.length>2)){let c=[];for(let l=0;l<i.length-1;l++){let h=i[l],f=i[l+1],u=$i(n,h,f);c.push(u)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<s.length-1;c++){let l=s[c],h=s[c+1],f=Pg(t,l,h).coordinates;a.push(f)}return{type:"MultiPolygon",coordinates:a}}function aB(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1/0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1/0,{positions:n}=t,s=t.pathIndices.value.filter(a=>a>=e&&a<=r);if(!(s.length>2))return{type:"LineString",coordinates:$i(n,s[0],s[1])};let o=[];for(let a=0;a<s.length-1;a++){let c=$i(n,s[a],s[a+1]);o.push(c)}return{type:"MultiLineString",coordinates:o}}function cB(t,e,r){let{positions:n}=t,s=$i(n,e,r);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function $i(t,e,r){e=e||0,r=r||t.value.length/t.size;let n=[];for(let s=e;s<r;s++){let i=Array();for(let o=s*t.size;o<(s+1)*t.size;o++)i.push(Number(t.value[o]));n.push(i)}return n}var El=v(Vg(),1);function Xg(t){let e=t.length;if(e<=1)return[t];let r=[],n,s;for(let i=0;i<e;i++){let o=MB(t[i]);o!==0&&(s===void 0&&(s=o<0),s===o<0?(n&&r.push(n),n=[t[i]]):n&&n.push(t[i]))}return n&&r.push(n),r}function MB(t){let e=0;for(let r=0,n=t.length-1,s,i;r<t.length;n=r++)s=t[r],i=t[n],e+=(i[0]-s[0])*(s[1]+i[1]);return e}function Wg(t,e,r){e&&r&&(t===1?e.id=r.readVarint():t===2?yB(r,e):t===3?e.type=r.readVarint():t===4&&(e._geometry=r.pos))}function yB(t,e){let r=t.readVarint()+t.pos;for(;t.pos<r;){let n=e._keys[t.readVarint()],s=e._values[t.readVarint()];e.properties[n]=s}}var hr=class{static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(e,r,n,s,i){this.properties=void 0,this.extent=void 0,this.type=void 0,this.id=void 0,this._pbf=void 0,this._geometry=void 0,this._keys=void 0,this._values=void 0,this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=s,this._values=i,e.readFields(Wg,this,r)}loadGeometry(){let e=this._pbf;e.pos=this._geometry;let r=e.readVarint()+e.pos,n=1,s=0,i=0,o=0,a=[],c;for(;e.pos<r;){if(s<=0){let l=e.readVarint();n=l&7,s=l>>3}if(s--,n===1||n===2)i+=e.readSVarint(),o+=e.readSVarint(),n===1&&(c&&a.push(c),c=[]),c&&c.push([i,o]);else if(n===7)c&&c.push(c[0].slice());else throw new Error(`unknown command ${n}`)}return c&&a.push(c),a}bbox(){let e=this._pbf;e.pos=this._geometry;let r=e.readVarint()+e.pos,n=1,s=0,i=0,o=0,a=1/0,c=-1/0,l=1/0,h=-1/0;for(;e.pos<r;){if(s<=0){let f=e.readVarint();n=f&7,s=f>>3}if(s--,n===1||n===2)i+=e.readSVarint(),o+=e.readSVarint(),i<a&&(a=i),i>c&&(c=i),o<l&&(l=o),o>h&&(h=o);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,l,c,h]}_toGeoJSON(e){let r=this.loadGeometry(),n=hr.types[this.type],s,i;switch(this.type){case 1:let a=[];for(s=0;s<r.length;s++)a[s]=r[s][0];r=a,e(r,this);break;case 2:for(s=0;s<r.length;s++)e(r[s],this);break;case 3:for(r=Xg(r),s=0;s<r.length;s++)for(i=0;i<r[s].length;i++)e(r[s][i],this);break}r.length===1?r=r[0]:n=`Multi${n}`;let o={type:"Feature",geometry:{type:n,coordinates:r},properties:this.properties};return this.id!==null&&(o.id=this.id),o}toGeoJSON(e){if(typeof e=="function")return this._toGeoJSON(e);let{x:r,y:n,z:s}=e,i=this.extent*Math.pow(2,s),o=this.extent*r,a=this.extent*n;function c(l){for(let h=0;h<l.length;h++){let f=l[h];f[0]=(f[0]+o)*360/i-180;let u=180-(f[1]+a)*360/i;f[1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}return this._toGeoJSON(c)}};var Yn=class{constructor(e,r){this.version=void 0,this.name=void 0,this.extent=void 0,this.length=void 0,this._pbf=void 0,this._keys=void 0,this._values=void 0,this._features=void 0,this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(IB,this,r),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let r=this._pbf.readVarint()+this._pbf.pos;return new hr(this._pbf,r,this.extent,this._keys,this._values)}};function IB(t,e,r){e&&r&&(t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(FB(r)))}function FB(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let n=t.readVarint()>>3;e=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null}return e}var qn=class{constructor(e,r){this.layers=void 0,this.layers=e.readFields(NB,{},r)}};function NB(t,e,r){if(t===3&&r){let n=new Yn(r,r.readVarint()+r.pos);n.length&&e&&(e[n.name]=n)}}function zg(t){let e=t.indices.length,r="Polygon";if(e<=1)return{type:r,data:t.data,areas:[[cr(t.data)]],indices:[t.indices]};let n=[],s=[],i=[],o=[],a,c=0;for(let l,h=0,f;h<e;h++){f=t.indices[h]-c,l=t.indices[h+1]-c||t.data.length;let u=t.data.slice(f,l),d=cr(u);if(d===0){let p=t.data.slice(0,f),_=t.data.slice(l);t.data=p.concat(_),c+=l-f;continue}a===void 0&&(a=d<0),a===d<0?(o.length&&(n.push(i),s.push(o)),o=[f],i=[d]):(i.push(d),o.push(f))}return i&&n.push(i),o.length&&s.push(o),{type:r,areas:n,indices:s,data:t.data}}function kg(t,e,r,n){for(let s=0,i=t.length;s<i;s+=2){t[s]=(t[s]+e)*360/n-180;let o=180-(t[s+1]+r)*360/n;t[s+1]=360/Math.PI*Math.atan(Math.exp(o*Math.PI/180))-90}}function Gg(t,e,r){e&&r&&(t===1?e.id=r.readVarint():t===2?OB(r,e):t===3?e.type=r.readVarint():t===4&&(e._geometry=r.pos))}function OB(t,e){let r=t.readVarint()+t.pos;for(;t.pos<r;){let n=e._keys[t.readVarint()],s=e._values[t.readVarint()];e.properties[n]=s}}var Kg,fr,Al,no,_l,ml,jn;var Zn=class{constructor(e,r,n,s,i,o){this.properties=void 0,this.extent=void 0,this.type=void 0,this.id=void 0,this._pbf=void 0,this._geometry=void 0,this._keys=void 0,this._values=void 0,this._geometryInfo=void 0,this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=s,this._values=i,this._geometryInfo=o,e.readFields(Gg,this,r)}loadGeometry(){let e=this._pbf;e.pos=this._geometry,Kg=e.readVarint()+e.pos,fr=1,no=0,_l=0,ml=0,jn=0;let r=[],n=[];for(;e.pos<Kg;)if(no<=0&&(Al=e.readVarint(),fr=Al&7,no=Al>>3),no--,fr===1||fr===2)_l+=e.readSVarint(),ml+=e.readSVarint(),fr===1&&r.push(jn),n.push(_l,ml),jn+=2;else if(fr===7){if(jn>0){let s=r[r.length-1];n.push(n[s],n[s+1]),jn+=2}}else throw new Error(`unknown command ${fr}`);return{data:n,indices:r}}_toBinaryCoordinates(e){let r=this.loadGeometry(),n;e(r.data,this);let s=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=r.indices.length,n={type:"Point",...r};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=r.indices.length,this._geometryInfo.linePositionsCount+=r.data.length/s,n={type:"LineString",...r};break;case 3:n=zg(r),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=n.indices.length;for(let o of n.indices)this._geometryInfo.polygonRingsCount+=o.length;this._geometryInfo.polygonPositionsCount+=n.data.length/s;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:n,properties:this.properties};return this.id!==null&&(i.id=this.id),i}toBinaryCoordinates(e){if(typeof e=="function")return this._toBinaryCoordinates(e);let{x:r,y:n,z:s}=e,i=this.extent*Math.pow(2,s),o=this.extent*r,a=this.extent*n;return this._toBinaryCoordinates(c=>kg(c,o,a,i))}};var Qn=class{constructor(e,r){this.version=void 0,this.name=void 0,this.extent=void 0,this.length=void 0,this._pbf=void 0,this._keys=void 0,this._values=void 0,this._features=void 0,this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(bB,this,r),this.length=this._features.length}feature(e,r){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let n=this._pbf.readVarint()+this._pbf.pos;return new Zn(this._pbf,n,this.extent,this._keys,this._values,r)}};function bB(t,e,r){e&&r&&(t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(PB(r)))}function PB(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let n=t.readVarint()>>3;e=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null}return e}var $n=class{constructor(e,r){this.layers=void 0,this.layers=e.readFields(DB,{},r)}};function DB(t,e,r){if(t===3&&r){let n=new Qn(r,r.readVarint()+r.pos);n.length&&e&&(e[n.name]=n)}}function so(t,e){var r,n;let s=vB(e),i=(e==null||(r=e.gis)===null||r===void 0?void 0:r.format)||(e==null||(n=e.mvt)===null||n===void 0?void 0:n.shape)||e?.shape;switch(i){case"columnar-table":return{shape:"columnar-table",data:Tl(t,s)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:Jg(t,s)};case"geojson":return Jg(t,s);case"binary-geometry":return Tl(t,s);case"binary":return Tl(t,s);default:throw new Error(i||"undefined shape")}}function Tl(t,e){let[r,n]=wB(t,e),s=ul(r,n);return s.byteLength=t.byteLength,s}function wB(t,e){let r=[],n={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(t.byteLength<=0)return[r,n];let s=new $n(new El.default(t));return(e&&Array.isArray(e.layers)?e.layers:Object.keys(s.layers)).forEach(o=>{let a=s.layers[o];if(a)for(let c=0;c<a.length;c++){let l=a.feature(c,n),h=LB(l,e,o);r.push(h)}}),[r,n]}function Jg(t,e){if(t.byteLength<=0)return[];let r=[],n=new qn(new El.default(t));return(Array.isArray(e.layers)?e.layers:Object.keys(n.layers)).forEach(i=>{let o=n.layers[i];if(o)for(let a=0;a<o.length;a++){let c=o.feature(a),l=UB(c,e,i);r.push(l)}}),r}function vB(t){var e;if(!(t!=null&&t.mvt))throw new Error("mvt options required");let r=((e=t.mvt)===null||e===void 0?void 0:e.coordinates)==="wgs84",{tileIndex:n}=t.mvt,s=n&&Number.isFinite(n.x)&&Number.isFinite(n.y)&&Number.isFinite(n.z);if(r&&!s)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return t.mvt}function UB(t,e,r){let n=t.toGeoJSON(e.coordinates==="wgs84"?e.tileIndex:HB);return e.layerProperty&&(n.properties[e.layerProperty]=r),n}function LB(t,e,r){let n=t.toBinaryCoordinates(e.coordinates==="wgs84"?e.tileIndex:VB);return e.layerProperty&&n.properties&&(n.properties[e.layerProperty]=r),n}function HB(t,e){let{extent:r}=e;for(let n=0;n<t.length;n++){let s=t[n];s[0]/=r,s[1]/=r}}function VB(t,e){let{extent:r}=e;for(let n=0,s=t.length;n<s;++n)t[n]/=r}var XB="4.1.0",io={name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:XB,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:null}}},WB={...io,parse:async(t,e)=>so(t,e),parseSync:so,binary:!0};var zB={Point:Yg,MultiPoint:kB,LineString:qg,MultiLineString:GB,Polygon:jg,MultiPolygon:KB};function Yg([t,e],[r,n],s){let i=Re(r[0],n[0],t),o=Re(r[1],n[1],e);return s.unprojectFlat([i,o])}function Rl(t,e,r){return t.map(n=>Yg(n,e,r))}function kB(t,e,r){return Rl(t,e,r)}function qg(t,e,r){return Rl(t,e,r)}function GB(t,e,r){return t.map(n=>qg(n,e,r))}function jg(t,e,r){return t.map(n=>Rl(n,e,r))}function KB(t,e,r){return t.map(n=>jg(n,e,r))}function Zg(t,e,r){let n=r.projectFlat([e.west,e.north]),s=r.projectFlat([e.east,e.south]),i=[n,s];return{...t,coordinates:zB[t.type](t.coordinates,i,r)}}var JB=["points","lines","polygons"];function xl(t,e,r,n){for(let s of JB){let i=t[s]&&YB(t[s],e,r,n);if(i>=0)return i}return-1}function YB(t,e,r,n){let s=t.featureIds.value;if(!s.length)return-1;let i=0,o=s[s.length-1]+1;if(n){let c=qB(t,n);if(c)i=c[0],o=c[1]+1;else return-1}let a=-1;if(e in t.numericProps){let c=t.numericProps[e].value.findIndex((l,h)=>l===r&&s[h]>=i&&s[h]<o);return c>=0?t.globalFeatureIds.value[c]:-1}else e?a=Qg(t.properties,c=>c[e]===r,i,o):t.fields&&(a=Qg(t.fields,c=>c.id===r,i,o));return a>=0?jB(t,a):-1}function qB(t,e){if(!t.__layers){let r={},{properties:n}=t;for(let s=0;s<n.length;s++){let{layerName:i}=n[s];i&&(r[i]?r[i][1]=s:r[i]=[s,s])}t.__layers=r}return t.__layers[e]}function jB(t,e){if(!t.__ids){let r=[],n=t.featureIds.value,s=t.globalFeatureIds.value;for(let i=0;i<n.length;i++)r[n[i]]=s[i];t.__ids=r}return t.__ids[e]}function Qg(t,e,r,n){for(let s=r;s<n;s++)if(e(t[s],s))return s;return-1}var Sl=512,ZB={...Bl.GeoJsonLayer.defaultProps,data:Ie,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[io],binary:!0},oo=class extends te{initializeState(){super.initializeState();let e=this.context.viewport.resolution!==void 0?!1:this.props.binary;this.setState({binary:e,data:null,tileJSON:null,hoveredFeatureId:null,hoveredFeatureLayerName:null})}get isLoaded(){return Boolean(this.state?.data&&super.isLoaded)}updateState({props:e,oldProps:r,context:n,changeFlags:s}){s.dataChanged&&this._updateTileData(),this.state?.data&&(super.updateState({props:e,oldProps:r,context:n,changeFlags:s}),this._setWGS84PropertyForTiles());let{highlightColor:i}=e;i!==r.highlightColor&&Array.isArray(i)&&this.setState({highlightColor:i})}async _updateTileData(){let e=this.props.data,r=null;if(typeof e=="string"&&!Na(e)){let{onDataLoad:n,fetch:s}=this.props;this.setState({data:null,tileJSON:null});try{r=await s(e,{propName:"data",layer:this,loaders:[]})}catch(i){this.raiseError(i,"loading TileJSON"),e=null}n&&n(r,{propName:"data",layer:this})}else e&&typeof e=="object"&&"tilejson"in e&&(r=e);r&&(e=r.tiles),this.setState({data:e,tileJSON:r})}_getTilesetOptions(){let e=super._getTilesetOptions(),r=this.state.tileJSON,{minZoom:n,maxZoom:s}=this.props;return r&&(Number.isFinite(r.minzoom)&&r.minzoom>n&&(e.minZoom=r.minzoom),Number.isFinite(r.maxzoom)&&(!Number.isFinite(s)||r.maxzoom<s)&&(e.maxZoom=r.maxzoom)),e}renderLayers(){return this.state?.data?super.renderLayers():null}getTileData(e){let{data:r,binary:n}=this.state,{index:s,signal:i}=e,o=$t(r,e);if(!o)return Promise.reject("Invalid URL");let a=this.getLoadOptions(),{fetch:c}=this.props;return a={...a,mimeType:"application/x-protobuf",mvt:{...a?.mvt,coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:s},gis:n?{format:"binary"}:{}},c(o,{propName:"data",layer:this,loadOptions:a,signal:i})}renderSubLayers(e){let{x:r,y:n,z:s}=e.tile.index,i=Math.pow(2,s),o=Sl/i,a=-o,c=Sl*r/i,l=Sl*(1-n/i),h=new D().scale([o,a,1]);e.autoHighlight=!1,this.context.viewport.resolution||(e.modelMatrix=h,e.coordinateOrigin=[c,l,0],e.coordinateSystem=ao.COORDINATE_SYSTEM.CARTESIAN,e.extensions=[...e.extensions||[],new r0.ClipExtension]);let f=super.renderSubLayers(e);return this.state.binary&&!(f instanceof Bl.GeoJsonLayer)&&ao.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),f}_updateAutoHighlight(e){let{uniqueIdProperty:r}=this.props,{hoveredFeatureId:n,hoveredFeatureLayerName:s}=this.state,i=e.object,o=null,a=null;i&&(o=Cl(i,r),a=$g(i));let{highlightColor:c}=this.props;typeof c=="function"&&(c=c(e)),(n!==o||s!==a)&&this.setState({highlightColor:c,hoveredFeatureId:o,hoveredFeatureLayerName:a})}getPickingInfo(e){let r=super.getPickingInfo(e),n=Boolean(this.context.viewport.resolution);if(this.state.binary&&r.index!==-1){let{data:s}=e.sourceLayer.props;r.object=to(s,{globalFeatureId:r.index})}return r.object&&!n&&(r.object=e0(r.object,r.tile.bbox,this.context.viewport)),r}getSubLayerPropsByTile(e){return{highlightedObjectIndex:this.getHighlightedObjectIndex(e),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(e){let{hoveredFeatureId:r,hoveredFeatureLayerName:n,binary:s}=this.state,{uniqueIdProperty:i,highlightedFeatureId:o}=this.props,a=e.content,c=t0(o);if(!(t0(r)||c))return-1;let h=c?o:r;return Array.isArray(a)?a.findIndex(f=>{let u=Cl(f,i)===h,d=c||$g(f)===n;return u&&d}):a&&s?xl(a,i,h,c?"":n):-1}_pickObjects(e){let{deck:r,viewport:n}=this.context,s=n.width,i=n.height,o=n.x,a=n.y,c=[this.id];return r.pickObjects({x:o,y:a,width:s,height:i,layerIds:c,maxObjects:e})}getRenderedFeatures(e=null){let r=this._pickObjects(e),n=new Set,s=[];for(let i of r){let o=Cl(i.object,this.props.uniqueIdProperty);o===void 0?s.push(i.object):n.has(o)||(n.add(o),s.push(i.object))}return s}_setWGS84PropertyForTiles(){let e="dataInWGS84";this.state.tileset.selectedTiles.forEach(n=>{n.hasOwnProperty(e)||Object.defineProperty(n,e,{get:()=>{if(!n.content)return null;if(this.state.binary&&Array.isArray(n.content)&&!n.content.length)return[];let{bbox:s}=n;if(n._contentWGS84===void 0&&Oa(s)){let i=this.state.binary?to(n.content):n.content;n._contentWGS84=i.map(o=>e0(o,s,this.context.viewport))}return n._contentWGS84}})})}},ts=oo;(()=>{oo.layerName="MVTLayer"})(),(()=>{oo.defaultProps=ZB})();function Cl(t,e){if(t.properties&&e)return t.properties[e];if("id"in t)return t.id}function $g(t){return t.properties?.layerName||null}function t0(t){return t!=null&&t!==""}function e0(t,e,r){let n={...t,geometry:{type:t.geometry.type}};return Object.defineProperty(n.geometry,"coordinates",{get:()=>Zg(t.geometry,e,r).coordinates}),n}var n0="0123456789bcdefghjkmnpqrstuvwxyz",s0={};for(let t=0;t<n0.length;t++)s0[n0.charAt(t)]=t;var QB=-90,$B=90,tM=-180,eM=180;function rM(t){let e=!0,r=$B,n=QB,s=eM,i=tM,o,a=0;for(let c=0,l=t.length;c<l;c++){let h=t[c].toLowerCase();a=s0[h];for(let f=4;f>=0;f--){let u=a>>f&1;e?(o=(s+i)/2,u===1?i=o:s=o):(o=(r+n)/2,u===1?n=o:r=o),e=!e}}return[n,i,r,s]}function i0(t){let[e,r,n,s]=rM(t);return[s,n,s,e,r,e,r,n,s,n]}var nM={getGeohash:{type:"accessor",value:t=>t.geohash}},co=class extends It{indexToBounds(){let{data:e,getGeohash:r}=this.props;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(n,s)=>i0(r(n,s))}}},es=co;(()=>{co.layerName="GeohashLayer"})(),(()=>{co.defaultProps=nM})();return d0(rs);})();
|
|
773
638
|
return __exports__;
|
|
774
639
|
});
|