@loaders.gl/tile-converter 3.2.7 → 3.3.0-alpha.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/3d-tiles-attributes-worker.js +3 -3
- package/dist/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/converter-cli.js +30 -7
- package/dist/converter.min.js +1 -1
- package/dist/dist.min.js +1105 -621
- package/dist/es5/3d-tiles-attributes-worker.js +1 -1
- package/dist/es5/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/es5/converter-cli.js +42 -12
- package/dist/es5/converter-cli.js.map +1 -1
- package/dist/es5/i3s-attributes-worker.js +1 -1
- package/dist/es5/i3s-attributes-worker.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +146 -0
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/feature-attributes.js +60 -0
- package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +39 -7
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +177 -59
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +15 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +50 -51
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/lib/utils/write-queue.js +3 -5
- package/dist/es5/lib/utils/write-queue.js.map +1 -1
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/es5/pgm-loader.js.map +1 -1
- package/dist/esm/3d-tiles-attributes-worker.js +1 -1
- package/dist/esm/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/esm/converter-cli.js +37 -7
- package/dist/esm/converter-cli.js.map +1 -1
- package/dist/esm/i3s-attributes-worker.js +1 -1
- package/dist/esm/i3s-attributes-worker.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +128 -0
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/feature-attributes.js +34 -0
- package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js +23 -7
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +145 -38
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js +15 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +21 -27
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/lib/utils/write-queue.js +3 -5
- package/dist/esm/lib/utils/write-queue.js.map +1 -1
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/esm/pgm-loader.js.map +1 -1
- package/dist/i3s-attributes-worker.js +3 -3
- package/dist/i3s-attributes-worker.js.map +3 -3
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +12 -0
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +138 -0
- package/dist/i3s-converter/helpers/feature-attributes.d.ts +24 -0
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/feature-attributes.js +55 -0
- package/dist/i3s-converter/helpers/geometry-attributes.js +26 -7
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +9 -2
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +140 -44
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js +13 -0
- package/dist/i3s-converter/i3s-converter.d.ts +7 -14
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +44 -35
- package/dist/lib/utils/write-queue.d.ts.map +1 -1
- package/dist/lib/utils/write-queue.js +3 -4
- package/package.json +15 -15
- package/src/converter-cli.ts +33 -7
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +199 -0
- package/src/i3s-converter/helpers/feature-attributes.ts +65 -0
- package/src/i3s-converter/helpers/geometry-attributes.ts +30 -7
- package/src/i3s-converter/helpers/geometry-converter.ts +187 -48
- package/src/i3s-converter/helpers/gltf-attributes.ts +15 -0
- package/src/i3s-converter/i3s-converter.ts +38 -41
- package/src/lib/utils/write-queue.ts +7 -5
package/dist/converter.min.js
CHANGED
|
@@ -289,4 +289,4 @@ var n=r(14),i=r(510),a=r(62),o=function(e){if(!(this instanceof o))return new o(
|
|
|
289
289
|
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
|
|
290
290
|
* @copyright (c) 2012-2014 Chris Talkington, contributors.
|
|
291
291
|
*/
|
|
292
|
-
var n=r(0).inherits,i=r(209).Transform,a=r(231),o=r(62),s=function(e){if(!(this instanceof s))return new s(e);e=this.options=o.defaults(e,{}),i.call(this,e),this.supports={directory:!0,symlink:!0},this.files=[]};n(s,i),s.prototype._transform=function(e,t,r){r(null,e)},s.prototype._writeStringified=function(){var e=JSON.stringify(this.files);this.write(e)},s.prototype.append=function(e,t,r){var n=this;function i(e,i){e?r(e):(t.size=i.length||0,t.crc32=a.unsigned(i),n.files.push(t),r(null,t))}t.crc32=0,"buffer"===t.sourceType?i(null,e):"stream"===t.sourceType&&o.collectStream(e,i)},s.prototype.finalize=function(){this._writeStringified(),this.end()},e.exports=s},function(e,t,r){const n=r(78).get,i=r(78).set,a=r(78).has,o=r(78).isUndefined,s=(e,t,r)=>{const s=Object.keys(t).reduce((r,s)=>{const u=Array.isArray(t[s].path)?t[s].path.filter(t=>a(e,t))[0]:t[s].path,c=u?n(e,u):void 0;return((e,t,r,n,a)=>{const s=e[t].default,u=e[t].transform,c=e[t].omitValues||[];let l=u?u(r,n,a):r;return o(l)&&!o(s)&&(l=s),-1==c.indexOf(l)?i(Object.assign({},n),t,l):n})(t,s,c,r,e)},{});return r?r(s,e):s},u=(e,t,r)=>Array.isArray(e)?((e,t,r)=>e.map(e=>{const n=u(e,t);return r?r(n,e):n}))(e,t,r):s(e,t,r);e.exports=u},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t){function r(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}r.keys=function(){return[]},r.resolve=r,e.exports=r,r.id=532},function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"filename",(function(){return to})),r.d(n,"dirname",(function(){return ro})),r.d(n,"join",(function(){return no}));var i={};r.r(i),r.d(i,"readdir",(function(){return ao})),r.d(i,"stat",(function(){return oo})),r.d(i,"readFile",(function(){return so})),r.d(i,"readFileSync",(function(){return uo})),r.d(i,"writeFile",(function(){return co})),r.d(i,"writeFileSync",(function(){return lo})),r.d(i,"open",(function(){return ho})),r.d(i,"close",(function(){return po})),r.d(i,"read",(function(){return fo})),r.d(i,"fstat",(function(){return mo})),r.d(i,"isSupported",(function(){return go})),r.d(i,"_readToArrayBuffer",(function(){return yo}));var a={};r.r(a),r.d(a,"name",(function(){return Ng})),r.d(a,"decode",(function(){return zg}));var o={};r.r(o),r.d(o,"name",(function(){return Vg})),r.d(o,"preprocess",(function(){return Wg}));var s={};r.r(s),r.d(s,"name",(function(){return Kg})),r.d(s,"preprocess",(function(){return Jg}));var u={};r.r(u),r.d(u,"name",(function(){return Yg})),r.d(u,"preprocess",(function(){return $g})),r.d(u,"decode",(function(){return Xg})),r.d(u,"encode",(function(){return Zg}));var c={};r.r(c),r.d(c,"name",(function(){return ny})),r.d(c,"decode",(function(){return iy})),r.d(c,"encode",(function(){return ay}));var l={};r.r(l),r.d(l,"name",(function(){return oy})),r.d(l,"decode",(function(){return sy})),r.d(l,"encode",(function(){return uy}));var h={};r.r(h),r.d(h,"name",(function(){return cy})),r.d(h,"decode",(function(){return ly})),r.d(h,"encode",(function(){return hy}));var p=r(113);const f="object"!=typeof process||"[object process]"!==String(process)||process.browser,d={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global},m=d.global||d.self||d.window;function g(e,t,r){return t<=e&&e<=r}global["encoding-indexes"]={ibm866:[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1025,1105,1028,1108,1031,1111,1038,1118,176,8729,183,8730,8470,164,9632,160],"iso-8859-2":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,728,321,164,317,346,167,168,352,350,356,377,173,381,379,176,261,731,322,180,318,347,711,184,353,351,357,378,733,382,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],"iso-8859-3":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,294,728,163,164,null,292,167,168,304,350,286,308,173,null,379,176,295,178,179,180,181,293,183,184,305,351,287,309,189,null,380,192,193,194,null,196,266,264,199,200,201,202,203,204,205,206,207,null,209,210,211,212,288,214,215,284,217,218,219,220,364,348,223,224,225,226,null,228,267,265,231,232,233,234,235,236,237,238,239,null,241,242,243,244,289,246,247,285,249,250,251,252,365,349,729],"iso-8859-4":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,312,342,164,296,315,167,168,352,274,290,358,173,381,175,176,261,731,343,180,297,316,711,184,353,275,291,359,330,382,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,298,272,325,332,310,212,213,214,215,216,370,218,219,220,360,362,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,299,273,326,333,311,244,245,246,247,248,371,250,251,252,361,363,729],"iso-8859-5":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,173,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,8470,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,167,1118,1119],"iso-8859-6":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,null,null,164,null,null,null,null,null,null,null,1548,173,null,null,null,null,null,null,null,null,null,null,null,null,null,1563,null,null,null,1567,null,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,null,null,null,null,null,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,null,null,null,null,null,null,null,null,null,null,null,null,null],"iso-8859-7":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8216,8217,163,8364,8367,166,167,168,169,890,171,172,173,null,8213,176,177,178,179,900,901,902,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],"iso-8859-8":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,162,163,164,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,8215,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],"iso-8859-10":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,274,290,298,296,310,167,315,272,352,358,381,173,362,330,176,261,275,291,299,297,311,183,316,273,353,359,382,8213,363,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,207,208,325,332,211,212,213,214,360,216,370,218,219,220,221,222,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,239,240,326,333,243,244,245,246,361,248,371,250,251,252,253,254,312],"iso-8859-13":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8221,162,163,164,8222,166,167,216,169,342,171,172,173,174,198,176,177,178,179,8220,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,8217],"iso-8859-14":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,7682,7683,163,266,267,7690,167,7808,169,7810,7691,7922,173,174,376,7710,7711,288,289,7744,7745,182,7766,7809,7767,7811,7776,7923,7812,7813,7777,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,372,209,210,211,212,213,214,7786,216,217,218,219,220,221,374,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,373,241,242,243,244,245,246,7787,248,249,250,251,252,253,375,255],"iso-8859-15":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,8364,165,352,167,353,169,170,171,172,173,174,175,176,177,178,179,381,181,182,183,382,185,186,187,338,339,376,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],"iso-8859-16":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,261,321,8364,8222,352,167,353,169,536,171,377,173,378,379,176,177,268,322,381,8221,182,183,382,269,537,187,338,339,376,380,192,193,194,258,196,262,198,199,200,201,202,203,204,205,206,207,272,323,210,211,212,336,214,346,368,217,218,219,220,280,538,223,224,225,226,259,228,263,230,231,232,233,234,235,236,237,238,239,273,324,242,243,244,337,246,347,369,249,250,251,252,281,539,255],"koi8-r":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,1025,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],"koi8-u":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,1108,9556,1110,1111,9559,9560,9561,9562,9563,1169,1118,9566,9567,9568,9569,1025,1028,9571,1030,1031,9574,9575,9576,9577,9578,1168,1038,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],macintosh:[196,197,199,201,209,214,220,225,224,226,228,227,229,231,233,232,234,235,237,236,238,239,241,243,242,244,246,245,250,249,251,252,8224,176,162,163,167,8226,182,223,174,169,8482,180,168,8800,198,216,8734,177,8804,8805,165,181,8706,8721,8719,960,8747,170,186,937,230,248,191,161,172,8730,402,8776,8710,171,187,8230,160,192,195,213,338,339,8211,8212,8220,8221,8216,8217,247,9674,255,376,8260,8364,8249,8250,64257,64258,8225,183,8218,8222,8240,194,202,193,203,200,205,206,207,204,211,212,63743,210,218,219,217,305,710,732,175,728,729,730,184,733,731,711],"windows-874":[8364,129,130,131,132,8230,134,135,136,137,138,139,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,153,154,155,156,157,158,159,160,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631,3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,null,null,null,null,3647,3648,3649,3650,3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,null,null,null,null],"windows-1250":[8364,129,8218,131,8222,8230,8224,8225,136,8240,352,8249,346,356,381,377,144,8216,8217,8220,8221,8226,8211,8212,152,8482,353,8250,347,357,382,378,160,711,728,321,164,260,166,167,168,169,350,171,172,173,174,379,176,177,731,322,180,181,182,183,184,261,351,187,317,733,318,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],"windows-1251":[1026,1027,8218,1107,8222,8230,8224,8225,8364,8240,1033,8249,1034,1036,1035,1039,1106,8216,8217,8220,8221,8226,8211,8212,152,8482,1113,8250,1114,1116,1115,1119,160,1038,1118,1032,164,1168,166,167,1025,169,1028,171,172,173,174,1031,176,177,1030,1110,1169,181,182,183,1105,8470,1108,187,1112,1029,1109,1111,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103],"windows-1252":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],"windows-1253":[8364,129,8218,402,8222,8230,8224,8225,136,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,157,158,159,160,901,902,163,164,165,166,167,168,169,null,171,172,173,174,8213,176,177,178,179,900,181,182,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],"windows-1254":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,286,209,210,211,212,213,214,215,216,217,218,219,220,304,350,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,287,241,242,243,244,245,246,247,248,249,250,251,252,305,351,255],"windows-1255":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,156,157,158,159,160,161,162,163,8362,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,191,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1520,1521,1522,1523,1524,null,null,null,null,null,null,null,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],"windows-1256":[8364,1662,8218,402,8222,8230,8224,8225,710,8240,1657,8249,338,1670,1688,1672,1711,8216,8217,8220,8221,8226,8211,8212,1705,8482,1681,8250,339,8204,8205,1722,160,1548,162,163,164,165,166,167,168,169,1726,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,1563,187,188,189,190,1567,1729,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,215,1591,1592,1593,1594,1600,1601,1602,1603,224,1604,226,1605,1606,1607,1608,231,232,233,234,235,1609,1610,238,239,1611,1612,1613,1614,244,1615,1616,247,1617,249,1618,251,252,8206,8207,1746],"windows-1257":[8364,129,8218,131,8222,8230,8224,8225,136,8240,138,8249,140,168,711,184,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,175,731,159,160,null,162,163,164,null,166,167,216,169,342,171,172,173,174,198,176,177,178,179,180,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,729],"windows-1258":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,258,196,197,198,199,200,201,202,203,768,205,206,207,272,209,777,211,212,416,214,215,216,217,218,219,220,431,771,223,224,225,226,259,228,229,230,231,232,233,234,235,769,237,238,239,273,241,803,243,244,417,246,247,248,249,250,251,252,432,8363,255],"x-mac-cyrillic":[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,8224,176,1168,163,167,8226,182,1030,174,169,8482,1026,1106,8800,1027,1107,8734,177,8804,8805,1110,181,1169,1032,1028,1108,1031,1111,1033,1113,1034,1114,1112,1029,172,8730,402,8776,8710,171,187,8230,160,1035,1115,1036,1116,1109,8211,8212,8220,8221,8216,8217,247,8222,1038,1118,1039,1119,8470,1025,1105,1103,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,8364]}||{};var y=Math.floor;function b(e){if(void 0===e)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function v(e){return 0<=e&&e<=127}var w=v;function _(e){this.tokens=[].slice.call(e),this.tokens.reverse()}_.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():-1},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.pop());else this.tokens.push(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.shift());else this.tokens.unshift(e)}};function k(e,t){if(e)throw TypeError("Decoder error");return t||65533}function x(e){throw TypeError("The code point "+e+" could not be encoded.")}function E(e){return e=String(e).trim().toLowerCase(),Object.prototype.hasOwnProperty.call(S,e)?S[e]:null}var A=[{encodings:[{labels:["unicode-1-1-utf-8","utf-8","utf8"],name:"UTF-8"}],heading:"The Encoding"},{encodings:[{labels:["866","cp866","csibm866","ibm866"],name:"IBM866"},{labels:["csisolatin2","iso-8859-2","iso-ir-101","iso8859-2","iso88592","iso_8859-2","iso_8859-2:1987","l2","latin2"],name:"ISO-8859-2"},{labels:["csisolatin3","iso-8859-3","iso-ir-109","iso8859-3","iso88593","iso_8859-3","iso_8859-3:1988","l3","latin3"],name:"ISO-8859-3"},{labels:["csisolatin4","iso-8859-4","iso-ir-110","iso8859-4","iso88594","iso_8859-4","iso_8859-4:1988","l4","latin4"],name:"ISO-8859-4"},{labels:["csisolatincyrillic","cyrillic","iso-8859-5","iso-ir-144","iso8859-5","iso88595","iso_8859-5","iso_8859-5:1988"],name:"ISO-8859-5"},{labels:["arabic","asmo-708","csiso88596e","csiso88596i","csisolatinarabic","ecma-114","iso-8859-6","iso-8859-6-e","iso-8859-6-i","iso-ir-127","iso8859-6","iso88596","iso_8859-6","iso_8859-6:1987"],name:"ISO-8859-6"},{labels:["csisolatingreek","ecma-118","elot_928","greek","greek8","iso-8859-7","iso-ir-126","iso8859-7","iso88597","iso_8859-7","iso_8859-7:1987","sun_eu_greek"],name:"ISO-8859-7"},{labels:["csiso88598e","csisolatinhebrew","hebrew","iso-8859-8","iso-8859-8-e","iso-ir-138","iso8859-8","iso88598","iso_8859-8","iso_8859-8:1988","visual"],name:"ISO-8859-8"},{labels:["csiso88598i","iso-8859-8-i","logical"],name:"ISO-8859-8-I"},{labels:["csisolatin6","iso-8859-10","iso-ir-157","iso8859-10","iso885910","l6","latin6"],name:"ISO-8859-10"},{labels:["iso-8859-13","iso8859-13","iso885913"],name:"ISO-8859-13"},{labels:["iso-8859-14","iso8859-14","iso885914"],name:"ISO-8859-14"},{labels:["csisolatin9","iso-8859-15","iso8859-15","iso885915","iso_8859-15","l9"],name:"ISO-8859-15"},{labels:["iso-8859-16"],name:"ISO-8859-16"},{labels:["cskoi8r","koi","koi8","koi8-r","koi8_r"],name:"KOI8-R"},{labels:["koi8-ru","koi8-u"],name:"KOI8-U"},{labels:["csmacintosh","mac","macintosh","x-mac-roman"],name:"macintosh"},{labels:["dos-874","iso-8859-11","iso8859-11","iso885911","tis-620","windows-874"],name:"windows-874"},{labels:["cp1250","windows-1250","x-cp1250"],name:"windows-1250"},{labels:["cp1251","windows-1251","x-cp1251"],name:"windows-1251"},{labels:["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"],name:"windows-1252"},{labels:["cp1253","windows-1253","x-cp1253"],name:"windows-1253"},{labels:["cp1254","csisolatin5","iso-8859-9","iso-ir-148","iso8859-9","iso88599","iso_8859-9","iso_8859-9:1989","l5","latin5","windows-1254","x-cp1254"],name:"windows-1254"},{labels:["cp1255","windows-1255","x-cp1255"],name:"windows-1255"},{labels:["cp1256","windows-1256","x-cp1256"],name:"windows-1256"},{labels:["cp1257","windows-1257","x-cp1257"],name:"windows-1257"},{labels:["cp1258","windows-1258","x-cp1258"],name:"windows-1258"},{labels:["x-mac-cyrillic","x-mac-ukrainian"],name:"x-mac-cyrillic"}],heading:"Legacy single-byte encodings"},{encodings:[{labels:["chinese","csgb2312","csiso58gb231280","gb2312","gb_2312","gb_2312-80","gbk","iso-ir-58","x-gbk"],name:"GBK"},{labels:["gb18030"],name:"gb18030"}],heading:"Legacy multi-byte Chinese (simplified) encodings"},{encodings:[{labels:["big5","big5-hkscs","cn-big5","csbig5","x-x-big5"],name:"Big5"}],heading:"Legacy multi-byte Chinese (traditional) encodings"},{encodings:[{labels:["cseucpkdfmtjapanese","euc-jp","x-euc-jp"],name:"EUC-JP"},{labels:["csiso2022jp","iso-2022-jp"],name:"ISO-2022-JP"},{labels:["csshiftjis","ms932","ms_kanji","shift-jis","shift_jis","sjis","windows-31j","x-sjis"],name:"Shift_JIS"}],heading:"Legacy multi-byte Japanese encodings"},{encodings:[{labels:["cseuckr","csksc56011987","euc-kr","iso-ir-149","korean","ks_c_5601-1987","ks_c_5601-1989","ksc5601","ksc_5601","windows-949"],name:"EUC-KR"}],heading:"Legacy multi-byte Korean encodings"},{encodings:[{labels:["csiso2022kr","hz-gb-2312","iso-2022-cn","iso-2022-cn-ext","iso-2022-kr"],name:"replacement"},{labels:["utf-16be"],name:"UTF-16BE"},{labels:["utf-16","utf-16le"],name:"UTF-16LE"},{labels:["x-user-defined"],name:"x-user-defined"}],heading:"Legacy miscellaneous encodings"}],S={};A.forEach((function(e){e.encodings.forEach((function(e){e.labels.forEach((function(t){S[t]=e}))}))}));var j,T,C={},B={};function R(e,t){return t&&t[e]||null}function O(e,t){var r=t.indexOf(e);return-1===r?null:r}function I(e){if(!("encoding-indexes"in global))throw Error("Indexes missing. Did you forget to include encoding-indexes.js first?");return global["encoding-indexes"][e]}function P(e,t){if(!(this instanceof P))throw TypeError("Called as a function. Did you forget 'new'?");e=void 0!==e?String(e):"utf-8",t=b(t),this._encoding=null,this._decoder=null,this._ignoreBOM=!1,this._BOMseen=!1,this._error_mode="replacement",this._do_not_flush=!1;var r=E(e);if(null===r||"replacement"===r.name)throw RangeError("Unknown encoding: "+e);if(!B[r.name])throw Error("Decoder not present. Did you forget to include encoding-indexes.js first?");return this._encoding=r,Boolean(t.fatal)&&(this._error_mode="fatal"),Boolean(t.ignoreBOM)&&(this._ignoreBOM=!0),Object.defineProperty||(this.encoding=this._encoding.name.toLowerCase(),this.fatal="fatal"===this._error_mode,this.ignoreBOM=this._ignoreBOM),this}function D(e,t){if(!(this instanceof D))throw TypeError("Called as a function. Did you forget 'new'?");t=b(t),this._encoding=null,this._encoder=null,this._do_not_flush=!1,this._fatal=Boolean(t.fatal)?"fatal":"replacement";if(Boolean(t.NONSTANDARD_allowLegacyEncoding)){var r=E(e=void 0!==e?String(e):"utf-8");if(null===r||"replacement"===r.name)throw RangeError("Unknown encoding: "+e);if(!C[r.name])throw Error("Encoder not present. Did you forget to include encoding-indexes.js first?");this._encoding=r}else this._encoding=E("utf-8"),void 0!==e&&"console"in global&&console.warn("TextEncoder constructor called with encoding label, which is ignored.");return Object.defineProperty||(this.encoding=this._encoding.name.toLowerCase()),this}function M(e){var t=e.fatal,r=0,n=0,i=0,a=128,o=191;this.handler=function(e,s){if(-1===s&&0!==i)return i=0,k(t);if(-1===s)return-1;if(0===i){if(g(s,0,127))return s;if(g(s,194,223))i=1,r=31&s;else if(g(s,224,239))224===s&&(a=160),237===s&&(o=159),i=2,r=15&s;else{if(!g(s,240,244))return k(t);240===s&&(a=144),244===s&&(o=143),i=3,r=7&s}return null}if(!g(s,a,o))return r=i=n=0,a=128,o=191,e.prepend(s),k(t);if(a=128,o=191,r=r<<6|63&s,(n+=1)!==i)return null;var u=r;return r=i=n=0,u}}function F(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(w(t))return t;var r,n;g(t,128,2047)?(r=1,n=192):g(t,2048,65535)?(r=2,n=224):g(t,65536,1114111)&&(r=3,n=240);for(var i=[(t>>6*r)+n];r>0;){var a=t>>6*(r-1);i.push(128|63&a),r-=1}return i}}function L(e,t){var r=t.fatal;this.handler=function(t,n){if(-1===n)return-1;if(v(n))return n;var i=e[n-128];return null===i?k(r):i}}function N(e,t){t.fatal;this.handler=function(t,r){if(-1===r)return-1;if(w(r))return r;var n=O(r,e);return null===n&&x(r),n+128}}function z(e){var t=e.fatal,r=0,n=0,i=0;this.handler=function(e,a){if(-1===a&&0===r&&0===n&&0===i)return-1;var o;if(-1!==a||0===r&&0===n&&0===i||(r=0,n=0,i=0,k(t)),0!==i){o=null,g(a,48,57)&&(o=function(e){if(e>39419&&e<189e3||e>1237575)return null;if(7457===e)return 59335;var t,r=0,n=0,i=I("gb18030-ranges");for(t=0;t<i.length;++t){var a=i[t];if(!(a[0]<=e))break;r=a[0],n=a[1]}return n+e-r}(10*(126*(10*(r-129)+n-48)+i-129)+a-48));var s=[n,i,a];return r=0,n=0,i=0,null===o?(e.prepend(s),k(t)):o}if(0!==n)return g(a,129,254)?(i=a,null):(e.prepend([n,a]),r=0,n=0,k(t));if(0!==r){if(g(a,48,57))return n=a,null;var u=r,c=null;r=0;var l=a<127?64:65;return(g(a,64,126)||g(a,128,254))&&(c=190*(u-129)+(a-l)),null===(o=null===c?null:R(c,I("gb18030")))&&v(a)&&e.prepend(a),null===o?k(t):o}return v(a)?a:128===a?8364:g(a,129,254)?(r=a,null):k(t)}}function U(e,t){e.fatal;this.handler=function(e,r){if(-1===r)return-1;if(w(r))return r;if(58853===r)return x(r);if(t&&8364===r)return 128;var n=O(r,I("gb18030"));if(null!==n){var i=n%190;return[y(n/190)+129,i+(i<63?64:65)]}if(t)return x(r);n=function(e){if(59335===e)return 7457;var t,r=0,n=0,i=I("gb18030-ranges");for(t=0;t<i.length;++t){var a=i[t];if(!(a[1]<=e))break;r=a[1],n=a[0]}return n+e-r}(r);var a=y(n/10/126/10),o=y((n-=10*a*126*10)/10/126),s=y((n-=10*o*126)/10);return[a+129,o+48,s+129,n-10*s+48]}}function q(e){var t=e.fatal,r=0;this.handler=function(e,n){if(-1===n&&0!==r)return r=0,k(t);if(-1===n&&0===r)return-1;if(0!==r){var i=r,a=null;r=0;var o=n<127?64:98;switch((g(n,64,126)||g(n,161,254))&&(a=157*(i-129)+(n-o)),a){case 1133:return[202,772];case 1135:return[202,780];case 1164:return[234,772];case 1166:return[234,780]}var s=null===a?null:R(a,I("big5"));return null===s&&v(n)&&e.prepend(n),null===s?k(t):s}return v(n)?n:g(n,129,254)?(r=n,null):k(t)}}function H(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(w(t))return t;var r=function(e){var t=T=T||I("big5").map((function(e,t){return t<5024?null:e}));return 9552===e||9566===e||9569===e||9578===e||21313===e||21317===e?t.lastIndexOf(e):O(e,t)}(t);if(null===r)return x(t);var n=y(r/157)+129;if(n<161)return x(t);var i=r%157;return[n,i+(i<63?64:98)]}}function G(e){var t=e.fatal,r=!1,n=0;this.handler=function(e,i){if(-1===i&&0!==n)return n=0,k(t);if(-1===i&&0===n)return-1;if(142===n&&g(i,161,223))return n=0,65216+i;if(143===n&&g(i,161,254))return r=!0,n=i,null;if(0!==n){var a=n;n=0;var o=null;return g(a,161,254)&&g(i,161,254)&&(o=R(94*(a-161)+(i-161),I(r?"jis0212":"jis0208"))),r=!1,g(i,161,254)||e.prepend(i),null===o?k(t):o}return v(i)?i:142===i||143===i||g(i,161,254)?(n=i,null):k(t)}}function V(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(w(t))return t;if(165===t)return 92;if(8254===t)return 126;if(g(t,65377,65439))return[142,t-65377+161];8722===t&&(t=65293);var r=O(t,I("jis0208"));return null===r?x(t):[y(r/94)+161,r%94+161]}}function W(e){var t=e.fatal,r=0,n=1,i=2,a=3,o=4,s=5,u=6,c=r,l=r,h=0,p=!1;this.handler=function(e,f){switch(c){default:case r:return 27===f?(c=s,null):g(f,0,127)&&14!==f&&15!==f&&27!==f?(p=!1,f):-1===f?-1:(p=!1,k(t));case n:return 27===f?(c=s,null):92===f?(p=!1,165):126===f?(p=!1,8254):g(f,0,127)&&14!==f&&15!==f&&27!==f&&92!==f&&126!==f?(p=!1,f):-1===f?-1:(p=!1,k(t));case i:return 27===f?(c=s,null):g(f,33,95)?(p=!1,65344+f):-1===f?-1:(p=!1,k(t));case a:return 27===f?(c=s,null):g(f,33,126)?(p=!1,h=f,c=o,null):-1===f?-1:(p=!1,k(t));case o:if(27===f)return c=s,k(t);if(g(f,33,126)){c=a;var d=R(94*(h-33)+f-33,I("jis0208"));return null===d?k(t):d}return-1===f?(c=a,e.prepend(f),k(t)):(c=a,k(t));case s:return 36===f||40===f?(h=f,c=u,null):(e.prepend(f),p=!1,c=l,k(t));case u:var m=h;h=0;var y=null;if(40===m&&66===f&&(y=r),40===m&&74===f&&(y=n),40===m&&73===f&&(y=i),36!==m||64!==f&&66!==f||(y=a),null!==y){c=c=y;var b=p;return p=!0,b?k(t):null}return e.prepend([m,f]),p=!1,c=l,k(t)}}}function K(e){e.fatal;var t=0,r=1,n=2,i=t;this.handler=function(e,a){if(-1===a&&i!==t)return e.prepend(a),i=t,[27,40,66];if(-1===a&&i===t)return-1;if(!(i!==t&&i!==r||14!==a&&15!==a&&27!==a))return x(65533);if(i===t&&w(a))return a;if(i===r&&(w(a)&&92!==a&&126!==a||165==a||8254==a)){if(w(a))return a;if(165===a)return 92;if(8254===a)return 126}if(w(a)&&i!==t)return e.prepend(a),i=t,[27,40,66];if((165===a||8254===a)&&i!==r)return e.prepend(a),i=r,[27,40,74];8722===a&&(a=65293);var o=O(a,I("jis0208"));return null===o?x(a):i!==n?(e.prepend(a),i=n,[27,36,66]):[y(o/94)+33,o%94+33]}}function J(e){var t=e.fatal,r=0;this.handler=function(e,n){if(-1===n&&0!==r)return r=0,k(t);if(-1===n&&0===r)return-1;if(0!==r){var i=r,a=null;r=0;var o=n<127?64:65,s=i<160?129:193;if((g(n,64,126)||g(n,128,252))&&(a=188*(i-s)+n-o),g(a,8836,10715))return 48508+a;var u=null===a?null:R(a,I("jis0208"));return null===u&&v(n)&&e.prepend(n),null===u?k(t):u}return v(n)||128===n?n:g(n,161,223)?65216+n:g(n,129,159)||g(n,224,252)?(r=n,null):k(t)}}function Q(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(w(t)||128===t)return t;if(165===t)return 92;if(8254===t)return 126;if(g(t,65377,65439))return t-65377+161;8722===t&&(t=65293);var r=function(e){return(j=j||I("jis0208").map((function(e,t){return g(t,8272,8835)?null:e}))).indexOf(e)}(t);if(null===r)return x(t);var n=y(r/188),i=r%188;return[n+(n<31?129:193),i+(i<63?64:65)]}}function Y(e){var t=e.fatal,r=0;this.handler=function(e,n){if(-1===n&&0!==r)return r=0,k(t);if(-1===n&&0===r)return-1;if(0!==r){var i=r,a=null;r=0,g(n,65,254)&&(a=190*(i-129)+(n-65));var o=null===a?null:R(a,I("euc-kr"));return null===a&&v(n)&&e.prepend(n),null===o?k(t):o}return v(n)?n:g(n,129,254)?(r=n,null):k(t)}}function $(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(w(t))return t;var r=O(t,I("euc-kr"));return null===r?x(t):[y(r/190)+129,r%190+65]}}function X(e,t){var r=e>>8,n=255&e;return t?[r,n]:[n,r]}function Z(e,t){var r=t.fatal,n=null,i=null;this.handler=function(t,a){if(-1===a&&(null!==n||null!==i))return k(r);if(-1===a&&null===n&&null===i)return-1;if(null===n)return n=a,null;var o;if(o=e?(n<<8)+a:(a<<8)+n,n=null,null!==i){var s=i;return i=null,g(o,56320,57343)?65536+1024*(s-55296)+(o-56320):(t.prepend(X(o,e)),k(r))}return g(o,55296,56319)?(i=o,null):g(o,56320,57343)?k(r):o}}function ee(e,t){t.fatal;this.handler=function(t,r){if(-1===r)return-1;if(g(r,0,65535))return X(r,e);var n=X(55296+(r-65536>>10),e),i=X(56320+(r-65536&1023),e);return n.concat(i)}}function te(e){e.fatal;this.handler=function(e,t){return-1===t?-1:v(t)?t:63360+t-128}}function re(e){e.fatal;this.handler=function(e,t){return-1===t?-1:w(t)?t:g(t,63360,63487)?t-63360+128:x(t)}}Object.defineProperty&&(Object.defineProperty(P.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(P.prototype,"fatal",{get:function(){return"fatal"===this._error_mode}}),Object.defineProperty(P.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}})),P.prototype.decode=function(e,t){var r;r="object"==typeof e&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==typeof e&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),t=b(t),this._do_not_flush||(this._decoder=B[this._encoding.name]({fatal:"fatal"===this._error_mode}),this._BOMseen=!1),this._do_not_flush=Boolean(t.stream);for(var n,i=new _(r),a=[];;){var o=i.read();if(-1===o)break;if(-1===(n=this._decoder.handler(i,o)))break;null!==n&&(Array.isArray(n)?a.push.apply(a,n):a.push(n))}if(!this._do_not_flush){do{if(-1===(n=this._decoder.handler(i,i.read())))break;null!==n&&(Array.isArray(n)?a.push.apply(a,n):a.push(n))}while(!i.endOfStream());this._decoder=null}return function(e){var t,r;return t=["UTF-8","UTF-16LE","UTF-16BE"],r=this._encoding.name,-1===t.indexOf(r)||this._ignoreBOM||this._BOMseen||(e.length>0&&65279===e[0]?(this._BOMseen=!0,e.shift()):e.length>0&&(this._BOMseen=!0)),function(e){for(var t="",r=0;r<e.length;++r){var n=e[r];n<=65535?t+=String.fromCharCode(n):(n-=65536,t+=String.fromCharCode(55296+(n>>10),56320+(1023&n)))}return t}(e)}.call(this,a)},Object.defineProperty&&Object.defineProperty(D.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),D.prototype.encode=function(e,t){e=void 0===e?"":String(e),t=b(t),this._do_not_flush||(this._encoder=C[this._encoding.name]({fatal:"fatal"===this._fatal})),this._do_not_flush=Boolean(t.stream);for(var r,n=new _(function(e){for(var t=String(e),r=t.length,n=0,i=[];n<r;){var a=t.charCodeAt(n);if(a<55296||a>57343)i.push(a);else if(56320<=a&&a<=57343)i.push(65533);else if(55296<=a&&a<=56319)if(n===r-1)i.push(65533);else{var o=t.charCodeAt(n+1);if(56320<=o&&o<=57343){var s=1023&a,u=1023&o;i.push(65536+(s<<10)+u),n+=1}else i.push(65533)}n+=1}return i}(e)),i=[];;){var a=n.read();if(-1===a)break;if(-1===(r=this._encoder.handler(n,a)))break;Array.isArray(r)?i.push.apply(i,r):i.push(r)}if(!this._do_not_flush){for(;-1!==(r=this._encoder.handler(n,n.read()));)Array.isArray(r)?i.push.apply(i,r):i.push(r);this._encoder=null}return new Uint8Array(i)},C["UTF-8"]=function(e){return new F(e)},B["UTF-8"]=function(e){return new M(e)},"encoding-indexes"in global&&A.forEach((function(e){"Legacy single-byte encodings"===e.heading&&e.encodings.forEach((function(e){var t=e.name,r=I(t.toLowerCase());B[t]=function(e){return new L(r,e)},C[t]=function(e){return new N(r,e)}}))})),B.GBK=function(e){return new z(e)},C.GBK=function(e){return new U(e,!0)},C.gb18030=function(e){return new U(e)},B.gb18030=function(e){return new z(e)},C.Big5=function(e){return new H(e)},B.Big5=function(e){return new q(e)},C["EUC-JP"]=function(e){return new V(e)},B["EUC-JP"]=function(e){return new G(e)},C["ISO-2022-JP"]=function(e){return new K(e)},B["ISO-2022-JP"]=function(e){return new W(e)},C.Shift_JIS=function(e){return new Q(e)},B.Shift_JIS=function(e){return new J(e)},C["EUC-KR"]=function(e){return new $(e)},B["EUC-KR"]=function(e){return new Y(e)},C["UTF-16BE"]=function(e){return new ee(!0,e)},B["UTF-16BE"]=function(e){return new Z(!0,e)},C["UTF-16LE"]=function(e){return new ee(!1,e)},B["UTF-16LE"]=function(e){return new Z(!1,e)},C["x-user-defined"]=function(e){return new re(e)},B["x-user-defined"]=function(e){return new te(e)};function ne(e){return Buffer.from(e).toString("base64")}function ie(e){return Buffer.from(e,"base64").toString("ascii")}let ae;ae=Symbol.iterator;class oe{constructor(e){var t,r,n;n=void 0,(r="map")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,this.map={},e instanceof oe?e.forEach((e,t)=>this.append(t,e)):Array.isArray(e)?e.forEach(e=>this.append(e[0],e[1])):e&&Object.getOwnPropertyNames(e).forEach(t=>this.append(t,e[t]))}append(e,t){e=se(e),t=ue(t);const r=this.map[e];this.map[e]=r?`${r}, ${t}`:t}delete(e){delete this.map[se(e)]}get(e){return e=se(e),this.has(e)?this.map[e]:null}has(e){return this.map.hasOwnProperty(se(e))}set(e,t){this.map[se(e)]=ue(t)}forEach(e,t=null){for(const r in this.map)this.map.hasOwnProperty(r)&&(t?e.call(t,this.map[r],r,this):e(this.map[r],r,this))}keys(){const e=[];return this.forEach((function(t,r){e.push(r)})),ce(e)}values(){const e=[];return this.forEach((function(t){e.push(t)})),ce(e)}entries(){const e=[];return this.forEach((function(t,r){e.push([r,t])})),ce(e)}*[ae](){yield*this.entries()}}function se(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e)||""===e)throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function ue(e){return"string"!=typeof e&&(e=String(e)),e}function ce(e){const t={next(){const t=e.shift();return{done:void 0===t,value:t}}};return t[Symbol.iterator]=function(){return t},t}function le(e,t){if(!e)throw new Error("@loaders.gl/polyfills assertion "+t)}var he=r(2),pe=r.n(he),fe=r(39),de=r.n(fe),me=r(50),ge=r.n(me),ye=r(14),be=r.n(ye);function ve(e){if((t=e)&&t instanceof ArrayBuffer)return e;var t;if((e=>e&&e instanceof Buffer)(e)){return new Uint8Array(e).buffer}if(ArrayBuffer.isView(e))return e.buffer;if("string"==typeof e){const t=e;return(new TextEncoder).encode(t).buffer}if(e&&"object"==typeof e&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error(`toArrayBuffer(${JSON.stringify(e,null,2).slice(10)})`)}async function we(e,t){if(!function(e){return e.startsWith("http:")||e.startsWith("https:")}(e)){const t=e.split("?")[0];return await new Promise((e,r)=>{const n=pe.a.createReadStream(t,{encoding:null});n.once("readable",()=>e(n)),n.on("error",e=>r(e))})}return await new Promise((r,n)=>{const i=(e.startsWith("https:")?ge.a.request:de.a.request)(function(e,t){const r=(null==t?void 0:t.headers)||{},n={};for(const e of Object.keys(r))n[e.toLowerCase()]=r[e];n["accept-encoding"]=n["accept-encoding"]||"gzip,br,deflate";const i=new URL(e);return{hostname:i.hostname,path:i.pathname,method:"GET",...t,...null==t?void 0:t.fetch,headers:n,port:i.port}}(e,t),e=>r(e));i.on("error",e=>n(e)),i.end()})}async function _e(e){const t=[];return await new Promise((r,n)=>{e.on("error",e=>n(e)),e.on("readable",()=>e.read()),e.on("data",e=>{"string"==typeof e&&n(new Error("Read stream not binary")),t.push(ve(e))}),e.on("end",()=>{const e=function(e){const t=e.map(e=>e instanceof ArrayBuffer?new Uint8Array(e):e),r=t.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(r);let i=0;for(const e of t)n.set(e,i),i+=e.byteLength;return n.buffer}(t);r(e)})})}var ke=r(4);function xe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ee=e=>"function"==typeof e,Ae=e=>(e=>null!==e&&"object"==typeof e)(e)&&Ee(e.read)&&Ee(e.pipe)&&(e=>"boolean"==typeof e)(e.readable);class Se{constructor(e,t){xe(this,"ok",void 0),xe(this,"status",void 0),xe(this,"statusText",void 0),xe(this,"headers",void 0),xe(this,"url",void 0),xe(this,"bodyUsed",!1),xe(this,"_body",void 0);const{headers:r,status:n=200,statusText:i="OK",url:a}=t||{};this.url=a,this.ok=200===n,this.status=n,this.statusText=i,this.headers=new oe((null==t?void 0:t.headers)||{}),Ae(e)?this._body=function(e,t){switch(t.get("content-encoding")){case"br":return e.pipe(be.a.createBrotliDecompress());case"gzip":return e.pipe(be.a.createGunzip());case"deflate":return e.pipe(be.a.createDeflate());default:return e}}(e,r):this._body="string"==typeof e?ke.Readable.from([(new TextEncoder).encode(e)]):ke.Readable.from([e||new ArrayBuffer(0)])}get body(){return le(!this.bodyUsed),le(Ae(this._body)),this.bodyUsed=!0,this._body}async arrayBuffer(){if(!Ae(this._body))return this._body||new ArrayBuffer(0);return await _e(this._body)}async text(){const e=await this.arrayBuffer();return(new TextDecoder).decode(e)}async json(){const e=await this.text();return JSON.parse(e)}async blob(){if("undefined"==typeof Blob)throw new Error("Blob polyfill not installed");return new Blob([await this.arrayBuffer()])}}const je=e=>e.startsWith("data:");async function Te(e,t){try{if(je(e)){const{arrayBuffer:t,mimeType:r}=function(e){const t=e.indexOf(",");let r,n;return";base64"===e.slice(t-7,t)?(r=Buffer.from(e.slice(t+1),"base64"),n=e.slice(5,t-7).trim()):(r=Buffer.from(decodeURIComponent(e.slice(t+1))),n=e.slice(5,t).trim()),n?n.startsWith(";")&&(n="text/plain"+n):n="text/plain;charset=US-ASCII",{arrayBuffer:ve(r),mimeType:n}}(e);return new Se(t,{headers:{"content-type":r},url:e})}const r={},n=e;e.endsWith(".gz")&&(e=e.slice(0,-3),r["content-encoding"]="gzip");const i=await we(n,t),a=function(e,t,r={}){const n={};if(t&&t.headers){const e=t.headers;for(const t in e){const r=e[t];n[t.toLowerCase()]=String(r)}}if(!n["content-length"]){const t=function(e){if((e=>e.startsWith("http:")||e.startsWith("https:"))(e))return null;if(je(e))return e.length-"data:".length;try{const t=e.split("?")[0];return pe.a.statSync(t).size}catch(e){}return null}(e);Number.isFinite(t)&&(n["content-length"]=t)}return Object.assign(n,r),new oe(n)}(e,i,r),{status:o,statusText:s}=function(e){if(e.statusCode)return{status:e.statusCode,statusText:e.statusMessage||"NA"};return{status:200,statusText:"OK"}}(i),u=!t||t.followRedirect||void 0===t.followRedirect;if(o>=300&&o<400&&a.has("location")&&u){const r=function(e,t){if(t.startsWith("http"))return t;const r=new URL(e);return r.pathname=t,r.href}(e,a.get("location"));return await Te(r,t)}return new Se(i,{headers:a,status:o,statusText:s,url:e})}catch(t){return new Se(null,{status:400,statusText:String(t),url:e})}}var Ce=r(257),Be=r.n(Ce),Re=r(63),Oe=r.n(Re);function Ie(e,t){const r=function(e,t){const r=t.type?t.type.replace("image/",""):"jpeg",n=Oe()(e.data,[e.width,e.height,4],[4,4*e.width,1],0);return Be()(n,r,t)}(e,t);return new Promise(e=>{const t=[];r.on("data",e=>t.push(e)),r.on("end",()=>{const r=Buffer.concat(t);e(function(e){if(Buffer.isBuffer(e)){return new Uint8Array(e).buffer}return e}(r))})})}var Pe=r(258),De=r.n(Pe),Me=r(0),Fe=r.n(Me);async function Le(e,t){le(t,"MIMEType is required to parse image under Node.js");const r=Fe.a.promisify(De.a),n=e instanceof Buffer?e:Buffer.from(e),i=await r(n,t),a=[...i.shape],o=4===i.shape.length?i.shape.shift():1;return{shape:a,data:i.data,width:i.shape[0],height:i.shape[1],components:i.shape[2],layers:o}}var Ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol:function(e){return"Symbol("+e+")"};function ze(){}var Ue="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0;function qe(e){return"object"==typeof e&&null!==e||"function"==typeof e}var He=ze,Ge=Promise,Ve=Promise.prototype.then,We=Promise.resolve.bind(Ge),Ke=Promise.reject.bind(Ge);function Je(e){return new Ge(e)}function Qe(e){return We(e)}function Ye(e){return Ke(e)}function $e(e,t,r){return Ve.call(e,t,r)}function Xe(e,t,r){$e($e(e,t,r),void 0,He)}function Ze(e,t){Xe(e,t)}function et(e,t){Xe(e,void 0,t)}function tt(e,t,r){return $e(e,t,r)}function rt(e){$e(e,void 0,He)}var nt=function(){var e=Ue&&Ue.queueMicrotask;if("function"==typeof e)return e;var t=Qe(void 0);return function(e){return $e(t,e)}}();function it(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function at(e,t,r){try{return Qe(it(e,t,r))}catch(e){return Ye(e)}}var ot=function(){function e(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._size},enumerable:!1,configurable:!0}),e.prototype.push=function(e){var t=this._back,r=t;16383===t._elements.length&&(r={_elements:[],_next:void 0}),t._elements.push(e),r!==t&&(this._back=r,t._next=r),++this._size},e.prototype.shift=function(){var e=this._front,t=e,r=this._cursor,n=r+1,i=e._elements,a=i[r];return 16384===n&&(t=e._next,n=0),--this._size,this._cursor=n,e!==t&&(this._front=t),i[r]=void 0,a},e.prototype.forEach=function(e){for(var t=this._cursor,r=this._front,n=r._elements;!(t===n.length&&void 0===r._next||t===n.length&&(t=0,0===(n=(r=r._next)._elements).length));)e(n[t]),++t},e.prototype.peek=function(){var e=this._front,t=this._cursor;return e._elements[t]},e}();function st(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?ht(e):"closed"===t._state?function(e){ht(e),dt(e)}(e):pt(e,t._storedError)}function ut(e,t){return Jn(e._ownerReadableStream,t)}function ct(e){"readable"===e._ownerReadableStream._state?ft(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e,t){pt(e,t)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function lt(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function ht(e){e._closedPromise=Je((function(t,r){e._closedPromise_resolve=t,e._closedPromise_reject=r}))}function pt(e,t){ht(e),ft(e,t)}function ft(e,t){void 0!==e._closedPromise_reject&&(rt(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function dt(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}var mt=Ne("[[AbortSteps]]"),gt=Ne("[[ErrorSteps]]"),yt=Ne("[[CancelSteps]]"),bt=Ne("[[PullSteps]]"),vt=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},wt=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function _t(e,t){if(void 0!==e&&("object"!=typeof(r=e)&&"function"!=typeof r))throw new TypeError(t+" is not an object.");var r}function kt(e,t){if("function"!=typeof e)throw new TypeError(t+" is not a function.")}function xt(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(t+" is not an object.")}function Et(e,t,r){if(void 0===e)throw new TypeError("Parameter "+t+" is required in '"+r+"'.")}function At(e,t,r){if(void 0===e)throw new TypeError(t+" is required in '"+r+"'.")}function St(e){return Number(e)}function jt(e){return 0===e?0:e}function Tt(e,t){var r=Number.MAX_SAFE_INTEGER,n=Number(e);if(n=jt(n),!vt(n))throw new TypeError(t+" is not a finite number");if((n=function(e){return jt(wt(e))}(n))<0||n>r)throw new TypeError(t+" is outside the accepted range of 0 to "+r+", inclusive");return vt(n)&&0!==n?n:0}function Ct(e,t){if(!Wn(e))throw new TypeError(t+" is not a ReadableStream.")}function Bt(e){return new Ft(e)}function Rt(e,t){e._reader._readRequests.push(t)}function Ot(e,t,r){var n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function It(e){return e._reader._readRequests.length}function Pt(e){var t=e._reader;return void 0!==t&&!!Lt(t)}var Dt,Mt,Ft=function(){function e(e){if(Et(e,1,"ReadableStreamDefaultReader"),Ct(e,"First parameter"),Kn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");st(this,e),this._readRequests=new ot}return Object.defineProperty(e.prototype,"closed",{get:function(){return Lt(this)?this._closedPromise:Ye(zt("closed"))},enumerable:!1,configurable:!0}),e.prototype.cancel=function(e){return void 0===e&&(e=void 0),Lt(this)?void 0===this._ownerReadableStream?Ye(lt("cancel")):ut(this,e):Ye(zt("cancel"))},e.prototype.read=function(){if(!Lt(this))return Ye(zt("read"));if(void 0===this._ownerReadableStream)return Ye(lt("read from"));var e,t,r=Je((function(r,n){e=r,t=n}));return Nt(this,{_chunkSteps:function(t){return e({value:t,done:!1})},_closeSteps:function(){return e({value:void 0,done:!0})},_errorSteps:function(e){return t(e)}}),r},e.prototype.releaseLock=function(){if(!Lt(this))throw zt("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ct(this)}},e}();function Lt(e){return!!qe(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")}function Nt(e,t){var r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[bt](t)}function zt(e){return new TypeError("ReadableStreamDefaultReader.prototype."+e+" can only be used on a ReadableStreamDefaultReader")}Object.defineProperties(Ft.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),"symbol"==typeof Ne.toStringTag&&Object.defineProperty(Ft.prototype,Ne.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0}),"symbol"==typeof Ne.asyncIterator&&((Dt={})[Ne.asyncIterator]=function(){return this},Mt=Dt,Object.defineProperty(Mt,Ne.asyncIterator,{enumerable:!1}));var Ut=function(){function e(e,t){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=e,this._preventCancel=t}return e.prototype.next=function(){var e=this,t=function(){return e._nextSteps()};return this._ongoingPromise=this._ongoingPromise?tt(this._ongoingPromise,t,t):t(),this._ongoingPromise},e.prototype.return=function(e){var t=this,r=function(){return t._returnSteps(e)};return this._ongoingPromise?tt(this._ongoingPromise,r,r):r()},e.prototype._nextSteps=function(){var e=this;if(this._isFinished)return Promise.resolve({value:void 0,done:!0});var t,r,n=this._reader;if(void 0===n._ownerReadableStream)return Ye(lt("iterate"));var i=Je((function(e,n){t=e,r=n}));return Nt(n,{_chunkSteps:function(r){e._ongoingPromise=void 0,nt((function(){return t({value:r,done:!1})}))},_closeSteps:function(){e._ongoingPromise=void 0,e._isFinished=!0,ct(n),t({value:void 0,done:!0})},_errorSteps:function(t){e._ongoingPromise=void 0,e._isFinished=!0,ct(n),r(t)}}),i},e.prototype._returnSteps=function(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;var t=this._reader;if(void 0===t._ownerReadableStream)return Ye(lt("finish iterating"));if(!this._preventCancel){var r=ut(t,e);return ct(t),tt(r,(function(){return{value:e,done:!0}}))}return ct(t),Qe({value:e,done:!0})},e}(),qt={next:function(){return Ht(this)?this._asyncIteratorImpl.next():Ye(Gt("next"))},return:function(e){return Ht(this)?this._asyncIteratorImpl.return(e):Ye(Gt("return"))}};function Ht(e){return!!qe(e)&&!!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl")}function Gt(e){return new TypeError("ReadableStreamAsyncIterator."+e+" can only be used on a ReadableSteamAsyncIterator")}void 0!==Mt&&Object.setPrototypeOf(qt,Mt);var Vt=Number.isNaN||function(e){return e!=e};function Wt(e){return!!function(e){if("number"!=typeof e)return!1;if(Vt(e))return!1;if(e<0)return!1;return!0}(e)&&e!==1/0}function Kt(e){var t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function Jt(e,t,r){if(!Wt(r=Number(r)))throw new RangeError("Size must be a finite, non-NaN, non-negative number.");e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function Qt(e){e._queue=new ot,e._queueTotalSize=0}function Yt(e){return e.slice()}var $t=function(){function e(){throw new TypeError("Illegal constructor")}return Object.defineProperty(e.prototype,"view",{get:function(){if(!er(this))throw gr("view");return this._view},enumerable:!1,configurable:!0}),e.prototype.respond=function(e){if(!er(this))throw gr("respond");if(Et(e,1,"respond"),e=Tt(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");this._view.buffer,function(e,t){if(!Wt(t=Number(t)))throw new RangeError("bytesWritten must be a finite");lr(e,t)}(this._associatedReadableByteStreamController,e)},e.prototype.respondWithNewView=function(e){if(!er(this))throw gr("respondWithNewView");if(Et(e,1,"respondWithNewView"),!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");if(0===e.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===e.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");!function(e,t){var r=e._pendingPullIntos.peek();if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.byteLength!==t.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");r.buffer=t.buffer,lr(e,t.byteLength)}(this._associatedReadableByteStreamController,e)},e}();Object.defineProperties($t.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),"symbol"==typeof Ne.toStringTag&&Object.defineProperty($t.prototype,Ne.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});var Xt=function(){function e(){throw new TypeError("Illegal constructor")}return Object.defineProperty(e.prototype,"byobRequest",{get:function(){if(!Zt(this))throw yr("byobRequest");if(null===this._byobRequest&&this._pendingPullIntos.length>0){var e=this._pendingPullIntos.peek(),t=new Uint8Array(e.buffer,e.byteOffset+e.bytesFilled,e.byteLength-e.bytesFilled),r=Object.create($t.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(r,this,t),this._byobRequest=r}return this._byobRequest},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"desiredSize",{get:function(){if(!Zt(this))throw yr("desiredSize");return dr(this)},enumerable:!1,configurable:!0}),e.prototype.close=function(){if(!Zt(this))throw yr("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");var e=this._controlledReadableByteStream._state;if("readable"!==e)throw new TypeError("The stream (in "+e+" state) is not in the readable state and cannot be closed");!function(e){var t=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==t._state)return;if(e._queueTotalSize>0)return void(e._closeRequested=!0);if(e._pendingPullIntos.length>0){if(e._pendingPullIntos.peek().bytesFilled>0){var r=new TypeError("Insufficient bytes to fill elements in the given buffer");throw fr(e,r),r}}pr(e),Qn(t)}(this)},e.prototype.enqueue=function(e){if(!Zt(this))throw yr("enqueue");if(Et(e,1,"enqueue"),!ArrayBuffer.isView(e))throw new TypeError("chunk must be an array buffer view");if(0===e.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===e.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");var t=this._controlledReadableByteStream._state;if("readable"!==t)throw new TypeError("The stream (in "+t+" state) is not in the readable state and cannot be enqueued to");!function(e,t){var r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;var n=t.buffer,i=t.byteOffset,a=t.byteLength,o=n;if(Pt(r))if(0===It(r))ir(e,o,i,a);else{var s=new Uint8Array(o,i,a);Ot(r,s,!1)}else wr(r)?(ir(e,o,i,a),cr(e)):ir(e,o,i,a);tr(e)}(this,e)},e.prototype.error=function(e){if(void 0===e&&(e=void 0),!Zt(this))throw yr("error");fr(this,e)},e.prototype[yt]=function(e){this._pendingPullIntos.length>0&&(this._pendingPullIntos.peek().bytesFilled=0);Qt(this);var t=this._cancelAlgorithm(e);return pr(this),t},e.prototype[bt]=function(e){var t=this._controlledReadableByteStream;if(this._queueTotalSize>0){var r=this._queue.shift();this._queueTotalSize-=r.byteLength,sr(this);var n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);e._chunkSteps(n)}else{var i=this._autoAllocateChunkSize;if(void 0!==i){var a=void 0;try{a=new ArrayBuffer(i)}catch(t){return void e._errorSteps(t)}var o={buffer:a,byteOffset:0,byteLength:i,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(o)}Rt(t,e),tr(this)}},e}();function Zt(e){return!!qe(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")}function er(e){return!!qe(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")}function tr(e){(function(e){var t=e._controlledReadableByteStream;if("readable"!==t._state)return!1;if(e._closeRequested)return!1;if(!e._started)return!1;if(Pt(t)&&It(t)>0)return!0;if(wr(t)&&vr(t)>0)return!0;if(dr(e)>0)return!0;return!1})(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,Xe(e._pullAlgorithm(),(function(){e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,tr(e))}),(function(t){fr(e,t)}))))}function rr(e,t){var r=!1;"closed"===e._state&&(r=!0);var n=nr(t);"default"===t.readerType?Ot(e,n,r):function(e,t,r){var n=e._reader._readIntoRequests.shift();r?n._closeSteps(t):n._chunkSteps(t)}(e,n,r)}function nr(e){var t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function ir(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function ar(e,t){var r=t.elementSize,n=t.bytesFilled-t.bytesFilled%r,i=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),a=t.bytesFilled+i,o=a-a%r,s=i,u=!1;o>n&&(s=o-t.bytesFilled,u=!0);for(var c,l,h,p,f,d=e._queue;s>0;){var m=d.peek(),g=Math.min(s,m.byteLength),y=t.byteOffset+t.bytesFilled;c=t.buffer,l=y,h=m.buffer,p=m.byteOffset,f=g,new Uint8Array(c).set(new Uint8Array(h,p,f),l),m.byteLength===g?d.shift():(m.byteOffset+=g,m.byteLength-=g),e._queueTotalSize-=g,or(e,g,t),s-=g}return u}function or(e,t,r){ur(e),r.bytesFilled+=t}function sr(e){0===e._queueTotalSize&&e._closeRequested?(pr(e),Qn(e._controlledReadableByteStream)):tr(e)}function ur(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function cr(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;var t=e._pendingPullIntos.peek();ar(e,t)&&(hr(e),rr(e._controlledReadableByteStream,t))}}function lr(e,t){var r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream");!function(e,t){t.buffer=t.buffer;var r=e._controlledReadableByteStream;if(wr(r))for(;vr(r)>0;){rr(r,hr(e))}}(e,r)}else!function(e,t,r){if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range");if(or(e,t,r),!(r.bytesFilled<r.elementSize)){hr(e);var n=r.bytesFilled%r.elementSize;if(n>0){var i=r.byteOffset+r.bytesFilled,a=r.buffer.slice(i-n,i);ir(e,a,0,a.byteLength)}r.buffer=r.buffer,r.bytesFilled-=n,rr(e._controlledReadableByteStream,r),cr(e)}}(e,t,r);tr(e)}function hr(e){var t=e._pendingPullIntos.shift();return ur(e),t}function pr(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function fr(e,t){var r=e._controlledReadableByteStream;"readable"===r._state&&(!function(e){ur(e),e._pendingPullIntos=new ot}(e),Qt(e),pr(e),Yn(r,t))}function dr(e){var t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function mr(e,t,r){var n=Object.create(Xt.prototype),i=function(){},a=function(){return Qe(void 0)},o=function(){return Qe(void 0)};void 0!==t.start&&(i=function(){return t.start(n)}),void 0!==t.pull&&(a=function(){return t.pull(n)}),void 0!==t.cancel&&(o=function(e){return t.cancel(e)});var s=t.autoAllocateChunkSize;if(0===s)throw new TypeError("autoAllocateChunkSize must be greater than 0");!function(e,t,r,n,i,a,o){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,Qt(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=a,t._pullAlgorithm=n,t._cancelAlgorithm=i,t._autoAllocateChunkSize=o,t._pendingPullIntos=new ot,e._readableStreamController=t,Xe(Qe(r()),(function(){t._started=!0,tr(t)}),(function(e){fr(t,e)}))}(e,n,i,a,o,r,s)}function gr(e){return new TypeError("ReadableStreamBYOBRequest.prototype."+e+" can only be used on a ReadableStreamBYOBRequest")}function yr(e){return new TypeError("ReadableByteStreamController.prototype."+e+" can only be used on a ReadableByteStreamController")}function br(e,t){e._reader._readIntoRequests.push(t)}function vr(e){return e._reader._readIntoRequests.length}function wr(e){var t=e._reader;return void 0!==t&&!!kr(t)}Object.defineProperties(Xt.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),"symbol"==typeof Ne.toStringTag&&Object.defineProperty(Xt.prototype,Ne.toStringTag,{value:"ReadableByteStreamController",configurable:!0});var _r=function(){function e(e){if(Et(e,1,"ReadableStreamBYOBReader"),Ct(e,"First parameter"),Kn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Zt(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");st(this,e),this._readIntoRequests=new ot}return Object.defineProperty(e.prototype,"closed",{get:function(){return kr(this)?this._closedPromise:Ye(xr("closed"))},enumerable:!1,configurable:!0}),e.prototype.cancel=function(e){return void 0===e&&(e=void 0),kr(this)?void 0===this._ownerReadableStream?Ye(lt("cancel")):ut(this,e):Ye(xr("cancel"))},e.prototype.read=function(e){if(!kr(this))return Ye(xr("read"));if(!ArrayBuffer.isView(e))return Ye(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return Ye(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return Ye(new TypeError("view's buffer must have non-zero byteLength"));if(void 0===this._ownerReadableStream)return Ye(lt("read from"));var t,r,n=Je((function(e,n){t=e,r=n}));return function(e,t,r){var n=e._ownerReadableStream;n._disturbed=!0,"errored"===n._state?r._errorSteps(n._storedError):function(e,t,r){var n=e._controlledReadableByteStream,i=1;t.constructor!==DataView&&(i=t.constructor.BYTES_PER_ELEMENT);var a=t.constructor,o={buffer:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength,bytesFilled:0,elementSize:i,viewConstructor:a,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(o),void br(n,r);if("closed"!==n._state){if(e._queueTotalSize>0){if(ar(e,o)){var s=nr(o);return sr(e),void r._chunkSteps(s)}if(e._closeRequested){var u=new TypeError("Insufficient bytes to fill elements in the given buffer");return fr(e,u),void r._errorSteps(u)}}e._pendingPullIntos.push(o),br(n,r),tr(e)}else{var c=new a(o.buffer,o.byteOffset,0);r._closeSteps(c)}}(n._readableStreamController,t,r)}(this,e,{_chunkSteps:function(e){return t({value:e,done:!1})},_closeSteps:function(e){return t({value:e,done:!0})},_errorSteps:function(e){return r(e)}}),n},e.prototype.releaseLock=function(){if(!kr(this))throw xr("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ct(this)}},e}();function kr(e){return!!qe(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")}function xr(e){return new TypeError("ReadableStreamBYOBReader.prototype."+e+" can only be used on a ReadableStreamBYOBReader")}function Er(e,t){var r=e.highWaterMark;if(void 0===r)return t;if(Vt(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function Ar(e){var t=e.size;return t||function(){return 1}}function Sr(e,t){_t(e,t);var r=null==e?void 0:e.highWaterMark,n=null==e?void 0:e.size;return{highWaterMark:void 0===r?void 0:St(r),size:void 0===n?void 0:jr(n,t+" has member 'size' that")}}function jr(e,t){return kt(e,t),function(t){return St(e(t))}}function Tr(e,t,r){return kt(e,r),function(r){return at(e,t,[r])}}function Cr(e,t,r){return kt(e,r),function(){return at(e,t,[])}}function Br(e,t,r){return kt(e,r),function(r){return it(e,t,[r])}}function Rr(e,t,r){return kt(e,r),function(r,n){return at(e,t,[r,n])}}function Or(e,t){if(!Mr(e))throw new TypeError(t+" is not a WritableStream.")}Object.defineProperties(_r.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),"symbol"==typeof Ne.toStringTag&&Object.defineProperty(_r.prototype,Ne.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});var Ir=function(){function e(e,t){void 0===e&&(e={}),void 0===t&&(t={}),void 0===e?e=null:xt(e,"First parameter");var r=Sr(t,"Second parameter"),n=function(e,t){_t(e,t);var r=null==e?void 0:e.abort,n=null==e?void 0:e.close,i=null==e?void 0:e.start,a=null==e?void 0:e.type,o=null==e?void 0:e.write;return{abort:void 0===r?void 0:Tr(r,e,t+" has member 'abort' that"),close:void 0===n?void 0:Cr(n,e,t+" has member 'close' that"),start:void 0===i?void 0:Br(i,e,t+" has member 'start' that"),write:void 0===o?void 0:Rr(o,e,t+" has member 'write' that"),type:a}}(e,"First parameter");if(Dr(this),void 0!==n.type)throw new RangeError("Invalid type is specified");var i=Ar(r);!function(e,t,r,n){var i=Object.create(en.prototype),a=function(){},o=function(){return Qe(void 0)},s=function(){return Qe(void 0)},u=function(){return Qe(void 0)};void 0!==t.start&&(a=function(){return t.start(i)});void 0!==t.write&&(o=function(e){return t.write(e,i)});void 0!==t.close&&(s=function(){return t.close()});void 0!==t.abort&&(u=function(e){return t.abort(e)});tn(e,i,a,o,s,u,r,n)}(this,n,Er(r,1),i)}return Object.defineProperty(e.prototype,"locked",{get:function(){if(!Mr(this))throw cn("locked");return Fr(this)},enumerable:!1,configurable:!0}),e.prototype.abort=function(e){return void 0===e&&(e=void 0),Mr(this)?Fr(this)?Ye(new TypeError("Cannot abort a stream that already has a writer")):Lr(this,e):Ye(cn("abort"))},e.prototype.close=function(){return Mr(this)?Fr(this)?Ye(new TypeError("Cannot close a stream that already has a writer")):Hr(this)?Ye(new TypeError("Cannot close an already-closing stream")):Nr(this):Ye(cn("close"))},e.prototype.getWriter=function(){if(!Mr(this))throw cn("getWriter");return Pr(this)},e}();function Pr(e){return new Wr(e)}function Dr(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new ot,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function Mr(e){return!!qe(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")}function Fr(e){return void 0!==e._writer}function Lr(e,t){var r=e._state;if("closed"===r||"errored"===r)return Qe(void 0);if(void 0!==e._pendingAbortRequest)return e._pendingAbortRequest._promise;var n=!1;"erroring"===r&&(n=!0,t=void 0);var i=Je((function(r,i){e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:i,_reason:t,_wasAlreadyErroring:n}}));return e._pendingAbortRequest._promise=i,n||Ur(e,t),i}function Nr(e){var t=e._state;if("closed"===t||"errored"===t)return Ye(new TypeError("The stream (in "+t+" state) is not in the writable state and cannot be closed"));var r,n=Je((function(t,r){var n={_resolve:t,_reject:r};e._closeRequest=n})),i=e._writer;return void 0!==i&&e._backpressure&&"writable"===t&&wn(i),Jt(r=e._writableStreamController,Zr,0),an(r),n}function zr(e,t){"writable"!==e._state?qr(e):Ur(e,t)}function Ur(e,t){var r=e._writableStreamController;e._state="erroring",e._storedError=t;var n=e._writer;void 0!==n&&Yr(n,t),!function(e){if(void 0===e._inFlightWriteRequest&&void 0===e._inFlightCloseRequest)return!1;return!0}(e)&&r._started&&qr(e)}function qr(e){e._state="errored",e._writableStreamController[gt]();var t=e._storedError;if(e._writeRequests.forEach((function(e){e._reject(t)})),e._writeRequests=new ot,void 0!==e._pendingAbortRequest){var r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void Gr(e);Xe(e._writableStreamController[mt](r._reason),(function(){r._resolve(),Gr(e)}),(function(t){r._reject(t),Gr(e)}))}else Gr(e)}function Hr(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function Gr(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);var t=e._writer;void 0!==t&&dn(t,e._storedError)}function Vr(e,t){var r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){gn(e)}(r):wn(r)),e._backpressure=t}Object.defineProperties(Ir.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),"symbol"==typeof Ne.toStringTag&&Object.defineProperty(Ir.prototype,Ne.toStringTag,{value:"WritableStream",configurable:!0});var Wr=function(){function e(e){if(Et(e,1,"WritableStreamDefaultWriter"),Or(e,"First parameter"),Fr(e))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=e,e._writer=this;var t,r=e._state;if("writable"===r)!Hr(e)&&e._backpressure?gn(this):bn(this),pn(this);else if("erroring"===r)yn(this,e._storedError),pn(this);else if("closed"===r)bn(this),pn(t=this),mn(t);else{var n=e._storedError;yn(this,n),fn(this,n)}}return Object.defineProperty(e.prototype,"closed",{get:function(){return Kr(this)?this._closedPromise:Ye(ln("closed"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"desiredSize",{get:function(){if(!Kr(this))throw ln("desiredSize");if(void 0===this._ownerWritableStream)throw hn("desiredSize");return function(e){var t=e._ownerWritableStream,r=t._state;if("errored"===r||"erroring"===r)return null;if("closed"===r)return 0;return nn(t._writableStreamController)}(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ready",{get:function(){return Kr(this)?this._readyPromise:Ye(ln("ready"))},enumerable:!1,configurable:!0}),e.prototype.abort=function(e){return void 0===e&&(e=void 0),Kr(this)?void 0===this._ownerWritableStream?Ye(hn("abort")):function(e,t){return Lr(e._ownerWritableStream,t)}(this,e):Ye(ln("abort"))},e.prototype.close=function(){if(!Kr(this))return Ye(ln("close"));var e=this._ownerWritableStream;return void 0===e?Ye(hn("close")):Hr(e)?Ye(new TypeError("Cannot close an already-closing stream")):Jr(this)},e.prototype.releaseLock=function(){if(!Kr(this))throw ln("releaseLock");void 0!==this._ownerWritableStream&&$r(this)},e.prototype.write=function(e){return void 0===e&&(e=void 0),Kr(this)?void 0===this._ownerWritableStream?Ye(hn("write to")):Xr(this,e):Ye(ln("write"))},e}();function Kr(e){return!!qe(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")}function Jr(e){return Nr(e._ownerWritableStream)}function Qr(e,t){"pending"===e._closedPromiseState?dn(e,t):function(e,t){fn(e,t)}(e,t)}function Yr(e,t){"pending"===e._readyPromiseState?vn(e,t):function(e,t){yn(e,t)}(e,t)}function $r(e){var t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Yr(e,r),Qr(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function Xr(e,t){var r=e._ownerWritableStream,n=r._writableStreamController,i=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return on(e,t),1}}(n,t);if(r!==e._ownerWritableStream)return Ye(hn("write to"));var a=r._state;if("errored"===a)return Ye(r._storedError);if(Hr(r)||"closed"===a)return Ye(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===a)return Ye(r._storedError);var o=function(e){return Je((function(t,r){var n={_resolve:t,_reject:r};e._writeRequests.push(n)}))}(r);return function(e,t,r){try{Jt(e,t,r)}catch(t){return void on(e,t)}var n=e._controlledWritableStream;if(!Hr(n)&&"writable"===n._state){var i=sn(e);Vr(n,i)}an(e)}(n,t,i),o}Object.defineProperties(Wr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),"symbol"==typeof Ne.toStringTag&&Object.defineProperty(Wr.prototype,Ne.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});var Zr={},en=function(){function e(){throw new TypeError("Illegal constructor")}return e.prototype.error=function(e){if(void 0===e&&(e=void 0),!function(e){if(!qe(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream"))return!1;return!0}(this))throw new TypeError("WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController");"writable"===this._controlledWritableStream._state&&un(this,e)},e.prototype[mt]=function(e){var t=this._abortAlgorithm(e);return rn(this),t},e.prototype[gt]=function(){Qt(this)},e}();function tn(e,t,r,n,i,a,o,s){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,Qt(t),t._started=!1,t._strategySizeAlgorithm=s,t._strategyHWM=o,t._writeAlgorithm=n,t._closeAlgorithm=i,t._abortAlgorithm=a;var u=sn(t);Vr(e,u),Xe(Qe(r()),(function(){t._started=!0,an(t)}),(function(r){t._started=!0,zr(e,r)}))}function rn(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function nn(e){return e._strategyHWM-e._queueTotalSize}function an(e){var t=e._controlledWritableStream;if(e._started&&void 0===t._inFlightWriteRequest)if("erroring"!==t._state){if(0!==e._queue.length){var r=e._queue.peek().value;r===Zr?function(e){var t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),Kt(e);var r=e._closeAlgorithm();rn(e),Xe(r,(function(){!function(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,"erroring"===e._state&&(e._storedError=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";var t=e._writer;void 0!==t&&mn(t)}(t)}),(function(e){!function(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),zr(e,t)}(t,e)}))}(e):function(e,t){var r=e._controlledWritableStream;(function(e){e._inFlightWriteRequest=e._writeRequests.shift()})(r),Xe(e._writeAlgorithm(t),(function(){!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);var t=r._state;if(Kt(e),!Hr(r)&&"writable"===t){var n=sn(e);Vr(r,n)}an(e)}),(function(t){"writable"===r._state&&rn(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,zr(e,t)}(r,t)}))}(e,r)}}else qr(t)}function on(e,t){"writable"===e._controlledWritableStream._state&&un(e,t)}function sn(e){return nn(e)<=0}function un(e,t){var r=e._controlledWritableStream;rn(e),Ur(r,t)}function cn(e){return new TypeError("WritableStream.prototype."+e+" can only be used on a WritableStream")}function ln(e){return new TypeError("WritableStreamDefaultWriter.prototype."+e+" can only be used on a WritableStreamDefaultWriter")}function hn(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function pn(e){e._closedPromise=Je((function(t,r){e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"}))}function fn(e,t){pn(e),dn(e,t)}function dn(e,t){void 0!==e._closedPromise_reject&&(rt(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function mn(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function gn(e){e._readyPromise=Je((function(t,r){e._readyPromise_resolve=t,e._readyPromise_reject=r})),e._readyPromiseState="pending"}function yn(e,t){gn(e),vn(e,t)}function bn(e){gn(e),wn(e)}function vn(e,t){void 0!==e._readyPromise_reject&&(rt(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function wn(e){void 0!==e._readyPromise_resolve&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}Object.defineProperties(en.prototype,{error:{enumerable:!0}}),"symbol"==typeof Ne.toStringTag&&Object.defineProperty(en.prototype,Ne.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});var _n="undefined"!=typeof DOMException?DOMException:void 0;var kn,xn=function(e){if("function"!=typeof e&&"object"!=typeof e)return!1;try{return new e,!0}catch(e){return!1}}(_n)?_n:((kn=function(e,t){this.message=e||"",this.name=t||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}).prototype=Object.create(Error.prototype),Object.defineProperty(kn.prototype,"constructor",{value:kn,writable:!0,configurable:!0}),kn);function En(e,t,r,n,i,a){var o=Bt(e),s=Pr(t);e._disturbed=!0;var u=!1,c=Qe(void 0);return Je((function(l,h){var p,f,d,m;if(void 0!==a){if(p=function(){var r=new xn("Aborted","AbortError"),a=[];n||a.push((function(){return"writable"===t._state?Lr(t,r):Qe(void 0)})),i||a.push((function(){return"readable"===e._state?Jn(e,r):Qe(void 0)})),v((function(){return Promise.all(a.map((function(e){return e()})))}),!0,r)},a.aborted)return void p();a.addEventListener("abort",p)}if(b(e,o._closedPromise,(function(e){n?w(!0,e):v((function(){return Lr(t,e)}),!0,e)})),b(t,s._closedPromise,(function(t){i?w(!0,t):v((function(){return Jn(e,t)}),!0,t)})),f=e,d=o._closedPromise,m=function(){r?w():v((function(){return function(e){var t=e._ownerWritableStream,r=t._state;return Hr(t)||"closed"===r?Qe(void 0):"errored"===r?Ye(t._storedError):Jr(e)}(s)}))},"closed"===f._state?m():Ze(d,m),Hr(t)||"closed"===t._state){var g=new TypeError("the destination writable stream closed before all data could be piped to it");i?w(!0,g):v((function(){return Jn(e,g)}),!0,g)}function y(){var e=c;return $e(c,(function(){return e!==c?y():void 0}))}function b(e,t,r){"errored"===e._state?r(e._storedError):et(t,r)}function v(e,r,n){function i(){Xe(e(),(function(){return _(r,n)}),(function(e){return _(!0,e)}))}u||(u=!0,"writable"!==t._state||Hr(t)?i():Ze(y(),i))}function w(e,r){u||(u=!0,"writable"!==t._state||Hr(t)?_(e,r):Ze(y(),(function(){return _(e,r)})))}function _(e,t){$r(s),ct(o),void 0!==a&&a.removeEventListener("abort",p),e?h(t):l(void 0)}rt(Je((function(e,t){!function r(n){n?e():$e(u?Qe(!0):$e(s._readyPromise,(function(){return Je((function(e,t){Nt(o,{_chunkSteps:function(t){c=$e(Xr(s,t),void 0,ze),e(!1)},_closeSteps:function(){return e(!0)},_errorSteps:t})}))})),r,t)}(!1)})))}))}var An=function(){function e(){throw new TypeError("Illegal constructor")}return Object.defineProperty(e.prototype,"desiredSize",{get:function(){if(!Sn(this))throw Mn("desiredSize");return In(this)},enumerable:!1,configurable:!0}),e.prototype.close=function(){if(!Sn(this))throw Mn("close");if(!Pn(this))throw new TypeError("The stream is not in a state that permits close");Bn(this)},e.prototype.enqueue=function(e){if(void 0===e&&(e=void 0),!Sn(this))throw Mn("enqueue");if(!Pn(this))throw new TypeError("The stream is not in a state that permits enqueue");return Rn(this,e)},e.prototype.error=function(e){if(void 0===e&&(e=void 0),!Sn(this))throw Mn("error");On(this,e)},e.prototype[yt]=function(e){Qt(this);var t=this._cancelAlgorithm(e);return Cn(this),t},e.prototype[bt]=function(e){var t=this._controlledReadableStream;if(this._queue.length>0){var r=Kt(this);this._closeRequested&&0===this._queue.length?(Cn(this),Qn(t)):jn(this),e._chunkSteps(r)}else Rt(t,e),jn(this)},e}();function Sn(e){return!!qe(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")}function jn(e){Tn(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,Xe(e._pullAlgorithm(),(function(){e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,jn(e))}),(function(t){On(e,t)}))))}function Tn(e){var t=e._controlledReadableStream;return!!Pn(e)&&(!!e._started&&(!!(Kn(t)&&It(t)>0)||In(e)>0))}function Cn(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Bn(e){if(Pn(e)){var t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(Cn(e),Qn(t))}}function Rn(e,t){if(Pn(e)){var r=e._controlledReadableStream;if(Kn(r)&&It(r)>0)Ot(r,t,!1);else{var n=void 0;try{n=e._strategySizeAlgorithm(t)}catch(t){throw On(e,t),t}try{Jt(e,t,n)}catch(t){throw On(e,t),t}}jn(e)}}function On(e,t){var r=e._controlledReadableStream;"readable"===r._state&&(Qt(e),Cn(e),Yn(r,t))}function In(e){var t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Pn(e){var t=e._controlledReadableStream._state;return!e._closeRequested&&"readable"===t}function Dn(e,t,r,n,i,a,o){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,Qt(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=o,t._strategyHWM=a,t._pullAlgorithm=n,t._cancelAlgorithm=i,e._readableStreamController=t,Xe(Qe(r()),(function(){t._started=!0,jn(t)}),(function(e){On(t,e)}))}function Mn(e){return new TypeError("ReadableStreamDefaultController.prototype."+e+" can only be used on a ReadableStreamDefaultController")}function Fn(e,t,r){return kt(e,r),function(r){return at(e,t,[r])}}function Ln(e,t,r){return kt(e,r),function(r){return at(e,t,[r])}}function Nn(e,t,r){return kt(e,r),function(r){return it(e,t,[r])}}function zn(e,t){if("bytes"!==(e=""+e))throw new TypeError(t+" '"+e+"' is not a valid enumeration value for ReadableStreamType");return e}function Un(e,t){if("byob"!==(e=""+e))throw new TypeError(t+" '"+e+"' is not a valid enumeration value for ReadableStreamReaderMode");return e}function qn(e,t){_t(e,t);var r=null==e?void 0:e.preventAbort,n=null==e?void 0:e.preventCancel,i=null==e?void 0:e.preventClose,a=null==e?void 0:e.signal;return void 0!==a&&function(e,t){if(!function(e){if("object"!=typeof e||null===e)return!1;try{return"boolean"==typeof e.aborted}catch(e){return!1}}(e))throw new TypeError(t+" is not an AbortSignal.")}(a,t+" has member 'signal' that"),{preventAbort:Boolean(r),preventCancel:Boolean(n),preventClose:Boolean(i),signal:a}}Object.defineProperties(An.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),"symbol"==typeof Ne.toStringTag&&Object.defineProperty(An.prototype,Ne.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});var Hn=function(){function e(e,t){void 0===e&&(e={}),void 0===t&&(t={}),void 0===e?e=null:xt(e,"First parameter");var r=Sr(t,"Second parameter"),n=function(e,t){_t(e,t);var r=e,n=null==r?void 0:r.autoAllocateChunkSize,i=null==r?void 0:r.cancel,a=null==r?void 0:r.pull,o=null==r?void 0:r.start,s=null==r?void 0:r.type;return{autoAllocateChunkSize:void 0===n?void 0:Tt(n,t+" has member 'autoAllocateChunkSize' that"),cancel:void 0===i?void 0:Fn(i,r,t+" has member 'cancel' that"),pull:void 0===a?void 0:Ln(a,r,t+" has member 'pull' that"),start:void 0===o?void 0:Nn(o,r,t+" has member 'start' that"),type:void 0===s?void 0:zn(s,t+" has member 'type' that")}}(e,"First parameter");if(Vn(this),"bytes"===n.type){if(void 0!==r.size)throw new RangeError("The strategy for a byte stream cannot have a size function");mr(this,n,Er(r,0))}else{var i=Ar(r);!function(e,t,r,n){var i=Object.create(An.prototype),a=function(){},o=function(){return Qe(void 0)},s=function(){return Qe(void 0)};void 0!==t.start&&(a=function(){return t.start(i)}),void 0!==t.pull&&(o=function(){return t.pull(i)}),void 0!==t.cancel&&(s=function(e){return t.cancel(e)}),Dn(e,i,a,o,s,r,n)}(this,n,Er(r,1),i)}}return Object.defineProperty(e.prototype,"locked",{get:function(){if(!Wn(this))throw $n("locked");return Kn(this)},enumerable:!1,configurable:!0}),e.prototype.cancel=function(e){return void 0===e&&(e=void 0),Wn(this)?Kn(this)?Ye(new TypeError("Cannot cancel a stream that already has a reader")):Jn(this,e):Ye($n("cancel"))},e.prototype.getReader=function(e){if(void 0===e&&(e=void 0),!Wn(this))throw $n("getReader");return void 0===function(e,t){_t(e,t);var r=null==e?void 0:e.mode;return{mode:void 0===r?void 0:Un(r,t+" has member 'mode' that")}}(e,"First parameter").mode?Bt(this):new _r(this)},e.prototype.pipeThrough=function(e,t){if(void 0===t&&(t={}),!Wn(this))throw $n("pipeThrough");Et(e,1,"pipeThrough");var r=function(e,t){_t(e,t);var r=null==e?void 0:e.readable;At(r,"readable","ReadableWritablePair"),Ct(r,t+" has member 'readable' that");var n=null==e?void 0:e.writable;return At(n,"writable","ReadableWritablePair"),Or(n,t+" has member 'writable' that"),{readable:r,writable:n}}(e,"First parameter"),n=qn(t,"Second parameter");if(Kn(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Fr(r.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return rt(En(this,r.writable,n.preventClose,n.preventAbort,n.preventCancel,n.signal)),r.readable},e.prototype.pipeTo=function(e,t){if(void 0===t&&(t={}),!Wn(this))return Ye($n("pipeTo"));if(void 0===e)return Ye("Parameter 1 is required in 'pipeTo'.");if(!Mr(e))return Ye(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));var r;try{r=qn(t,"Second parameter")}catch(e){return Ye(e)}return Kn(this)?Ye(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Fr(e)?Ye(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):En(this,e,r.preventClose,r.preventAbort,r.preventCancel,r.signal)},e.prototype.tee=function(){if(!Wn(this))throw $n("tee");var e=function(e,t){var r,n,i,a,o,s=Bt(e),u=!1,c=!1,l=!1,h=Je((function(e){o=e}));function p(){return u||(u=!0,Nt(s,{_chunkSteps:function(e){nt((function(){u=!1;var t=e,r=e;c||Rn(i._readableStreamController,t),l||Rn(a._readableStreamController,r)}))},_closeSteps:function(){u=!1,c||Bn(i._readableStreamController),l||Bn(a._readableStreamController),c&&l||o(void 0)},_errorSteps:function(){u=!1}})),Qe(void 0)}function f(){}return i=Gn(f,p,(function(t){if(c=!0,r=t,l){var i=Yt([r,n]),a=Jn(e,i);o(a)}return h})),a=Gn(f,p,(function(t){if(l=!0,n=t,c){var i=Yt([r,n]),a=Jn(e,i);o(a)}return h})),et(s._closedPromise,(function(e){On(i._readableStreamController,e),On(a._readableStreamController,e),c&&l||o(void 0)})),[i,a]}(this);return Yt(e)},e.prototype.values=function(e){if(void 0===e&&(e=void 0),!Wn(this))throw $n("values");var t,r,n,i,a,o=function(e,t){_t(e,t);var r=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(r)}}(e,"First parameter");return t=this,r=o.preventCancel,n=Bt(t),i=new Ut(n,r),(a=Object.create(qt))._asyncIteratorImpl=i,a},e}();function Gn(e,t,r,n,i){void 0===n&&(n=1),void 0===i&&(i=function(){return 1});var a=Object.create(Hn.prototype);return Vn(a),Dn(a,Object.create(An.prototype),e,t,r,n,i),a}function Vn(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function Wn(e){return!!qe(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")}function Kn(e){return void 0!==e._reader}function Jn(e,t){return e._disturbed=!0,"closed"===e._state?Qe(void 0):"errored"===e._state?Ye(e._storedError):(Qn(e),tt(e._readableStreamController[yt](t),ze))}function Qn(e){e._state="closed";var t=e._reader;void 0!==t&&(dt(t),Lt(t)&&(t._readRequests.forEach((function(e){e._closeSteps()})),t._readRequests=new ot))}function Yn(e,t){e._state="errored",e._storedError=t;var r=e._reader;void 0!==r&&(ft(r,t),Lt(r)?(r._readRequests.forEach((function(e){e._errorSteps(t)})),r._readRequests=new ot):(r._readIntoRequests.forEach((function(e){e._errorSteps(t)})),r._readIntoRequests=new ot))}function $n(e){return new TypeError("ReadableStream.prototype."+e+" can only be used on a ReadableStream")}function Xn(e,t){_t(e,t);var r=null==e?void 0:e.highWaterMark;return At(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:St(r)}}Object.defineProperties(Hn.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),"symbol"==typeof Ne.toStringTag&&Object.defineProperty(Hn.prototype,Ne.toStringTag,{value:"ReadableStream",configurable:!0}),"symbol"==typeof Ne.asyncIterator&&Object.defineProperty(Hn.prototype,Ne.asyncIterator,{value:Hn.prototype.values,writable:!0,configurable:!0});var Zn=function(e){return e.byteLength},ei=function(){function e(e){Et(e,1,"ByteLengthQueuingStrategy"),e=Xn(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}return Object.defineProperty(e.prototype,"highWaterMark",{get:function(){if(!ri(this))throw ti("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){if(!ri(this))throw ti("size");return Zn},enumerable:!1,configurable:!0}),e}();function ti(e){return new TypeError("ByteLengthQueuingStrategy.prototype."+e+" can only be used on a ByteLengthQueuingStrategy")}function ri(e){return!!qe(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")}Object.defineProperties(ei.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Ne.toStringTag&&Object.defineProperty(ei.prototype,Ne.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});var ni=function(){return 1},ii=function(){function e(e){Et(e,1,"CountQueuingStrategy"),e=Xn(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}return Object.defineProperty(e.prototype,"highWaterMark",{get:function(){if(!oi(this))throw ai("highWaterMark");return this._countQueuingStrategyHighWaterMark},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){if(!oi(this))throw ai("size");return ni},enumerable:!1,configurable:!0}),e}();function ai(e){return new TypeError("CountQueuingStrategy.prototype."+e+" can only be used on a CountQueuingStrategy")}function oi(e){return!!qe(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")}function si(e,t,r){return kt(e,r),function(r){return at(e,t,[r])}}function ui(e,t,r){return kt(e,r),function(r){return it(e,t,[r])}}function ci(e,t,r){return kt(e,r),function(r,n){return at(e,t,[r,n])}}Object.defineProperties(ii.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Ne.toStringTag&&Object.defineProperty(ii.prototype,Ne.toStringTag,{value:"CountQueuingStrategy",configurable:!0});var li=function(){function e(e,t,r){void 0===e&&(e={}),void 0===t&&(t={}),void 0===r&&(r={}),void 0===e&&(e=null);var n=Sr(t,"Second parameter"),i=Sr(r,"Third parameter"),a=function(e,t){_t(e,t);var r=null==e?void 0:e.flush,n=null==e?void 0:e.readableType,i=null==e?void 0:e.start,a=null==e?void 0:e.transform,o=null==e?void 0:e.writableType;return{flush:void 0===r?void 0:si(r,e,t+" has member 'flush' that"),readableType:n,start:void 0===i?void 0:ui(i,e,t+" has member 'start' that"),transform:void 0===a?void 0:ci(a,e,t+" has member 'transform' that"),writableType:o}}(e,"First parameter");if(void 0!==a.readableType)throw new RangeError("Invalid readableType specified");if(void 0!==a.writableType)throw new RangeError("Invalid writableType specified");var o,s=Er(i,0),u=Ar(i),c=Er(n,1),l=Ar(n);!function(e,t,r,n,i,a){function o(){return t}e._writable=function(e,t,r,n,i,a){void 0===i&&(i=1),void 0===a&&(a=function(){return 1});var o=Object.create(Ir.prototype);return Dr(o),tn(o,Object.create(en.prototype),e,t,r,n,i,a),o}(o,(function(t){return function(e,t){var r=e._transformStreamController;if(e._backpressure){return tt(e._backpressureChangePromise,(function(){var n=e._writable;if("erroring"===n._state)throw n._storedError;return vi(r,t)}))}return vi(r,t)}(e,t)}),(function(){return function(e){var t=e._readable,r=e._transformStreamController,n=r._flushAlgorithm();return yi(r),tt(n,(function(){if("errored"===t._state)throw t._storedError;Bn(t._readableStreamController)}),(function(r){throw pi(e,r),t._storedError}))}(e)}),(function(t){return function(e,t){return pi(e,t),Qe(void 0)}(e,t)}),r,n),e._readable=Gn(o,(function(){return function(e){return di(e,!1),e._backpressureChangePromise}(e)}),(function(t){return fi(e,t),Qe(void 0)}),i,a),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,di(e,!0),e._transformStreamController=void 0}(this,Je((function(e){o=e})),c,l,s,u),function(e,t){var r=Object.create(mi.prototype),n=function(e){try{return bi(r,e),Qe(void 0)}catch(e){return Ye(e)}},i=function(){return Qe(void 0)};void 0!==t.transform&&(n=function(e){return t.transform(e,r)});void 0!==t.flush&&(i=function(){return t.flush(r)});!function(e,t,r,n){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=n}(e,r,n,i)}(this,a),void 0!==a.start?o(a.start(this._transformStreamController)):o(void 0)}return Object.defineProperty(e.prototype,"readable",{get:function(){if(!hi(this))throw _i("readable");return this._readable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"writable",{get:function(){if(!hi(this))throw _i("writable");return this._writable},enumerable:!1,configurable:!0}),e}();function hi(e){return!!qe(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")}function pi(e,t){On(e._readable._readableStreamController,t),fi(e,t)}function fi(e,t){yi(e._transformStreamController),on(e._writable._writableStreamController,t),e._backpressure&&di(e,!1)}function di(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=Je((function(t){e._backpressureChangePromise_resolve=t})),e._backpressure=t}Object.defineProperties(li.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),"symbol"==typeof Ne.toStringTag&&Object.defineProperty(li.prototype,Ne.toStringTag,{value:"TransformStream",configurable:!0});var mi=function(){function e(){throw new TypeError("Illegal constructor")}return Object.defineProperty(e.prototype,"desiredSize",{get:function(){if(!gi(this))throw wi("desiredSize");return In(this._controlledTransformStream._readable._readableStreamController)},enumerable:!1,configurable:!0}),e.prototype.enqueue=function(e){if(void 0===e&&(e=void 0),!gi(this))throw wi("enqueue");bi(this,e)},e.prototype.error=function(e){if(void 0===e&&(e=void 0),!gi(this))throw wi("error");var t;t=e,pi(this._controlledTransformStream,t)},e.prototype.terminate=function(){if(!gi(this))throw wi("terminate");!function(e){var t=e._controlledTransformStream;Bn(t._readable._readableStreamController);var r=new TypeError("TransformStream terminated");fi(t,r)}(this)},e}();function gi(e){return!!qe(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")}function yi(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0}function bi(e,t){var r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!Pn(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{Rn(n,t)}catch(e){throw fi(r,e),r._readable._storedError}(function(e){return!Tn(e)})(n)!==r._backpressure&&di(r,!0)}function vi(e,t){return tt(e._transformAlgorithm(t),void 0,(function(t){throw pi(e._controlledTransformStream,t),t}))}function wi(e){return new TypeError("TransformStreamDefaultController.prototype."+e+" can only be used on a TransformStreamDefaultController")}function _i(e){return new TypeError("TransformStream.prototype."+e+" can only be used on a TransformStream")}Object.defineProperties(mi.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),"symbol"==typeof Ne.toStringTag&&Object.defineProperty(mi.prototype,Ne.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});var ki={ReadableStream:Hn,ReadableStreamDefaultController:An,ReadableByteStreamController:Xt,ReadableStreamBYOBRequest:$t,ReadableStreamDefaultReader:Ft,ReadableStreamBYOBReader:_r,WritableStream:Ir,WritableStreamDefaultController:en,WritableStreamDefaultWriter:Wr,ByteLengthQueuingStrategy:ei,CountQueuingStrategy:ii,TransformStream:li,TransformStreamDefaultController:mi};if(void 0!==Ue)for(var xi in ki)Object.prototype.hasOwnProperty.call(ki,xi)&&Object.defineProperty(Ue,xi,{value:ki[xi],writable:!0,configurable:!0});delete global.ReadableStream;let Ei,Ai,Si;Ei=Symbol.asyncIterator;Ai=Symbol.toStringTag;Si=Symbol.toStringTag;(!f||!("TextEncoder"in m))&&(m.TextEncoder=D);(!f||!("TextDecoder"in m))&&(m.TextDecoder=P),f||"atob"in m||!ne||(m.atob=ne),f||"btoa"in m||!ie||(m.btoa=ie),f||"Headers"in m||!oe||(m.Headers=oe),f||"Response"in m||!Se||(m.Response=Se),f||"fetch"in m||!Te||(m.fetch=Te),f||"DOMParser"in m||!p.DOMParser||(m.DOMParser=p.DOMParser),f||"_encodeImageNode"in m||!Ie||(m._encodeImageNode=Ie),f||"_parseImageNode"in m||!Le||(m._parseImageNode=Le),"allSettled"in Promise||(Promise.allSettled=function(e){const t=e.map(e=>e.then(e=>({status:"fulfilled",value:e})).catch(e=>({status:"rejected",reason:e})));return Promise.all(t)});var ji=r(1),Ti=r(22),Ci=r.n(Ti),Bi=r(7),Ri=r.n(Bi);"undefined"!=typeof self&&self,"undefined"!=typeof window&&window,"undefined"!=typeof global&&global,"undefined"!=typeof document&&document;const Oi=Boolean("object"!=typeof process||"[object process]"!==String(process)||process.browser),Ii="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version),Pi=(Ii&&parseFloat(Ii[1]),e=>"boolean"==typeof e),Di=e=>"function"==typeof e,Mi=e=>null!==e&&"object"==typeof e,Fi=e=>Mi(e)&&e.constructor==={}.constructor,Li=e=>e&&"function"==typeof e[Symbol.iterator],Ni=e=>e&&"function"==typeof e[Symbol.asyncIterator],zi=e=>"undefined"!=typeof Response&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json,Ui=e=>"undefined"!=typeof Blob&&e instanceof Blob,qi=e=>(e=>"undefined"!=typeof ReadableStream&&e instanceof ReadableStream||Mi(e)&&Di(e.tee)&&Di(e.cancel)&&Di(e.getReader))(e)||(e=>Mi(e)&&Di(e.read)&&Di(e.pipe)&&Pi(e.readable))(e);function Hi(e,t){if(!e)throw new Error(t||"loader assertion failed.")}function Gi(e){var t;if(!e)return!1;Array.isArray(e)&&(e=e[0]);return Array.isArray(null===(t=e)||void 0===t?void 0:t.extensions)}function Vi(e){var t,r;let n;return Hi(e,"null loader"),Hi(Gi(e),"invalid loader"),Array.isArray(e)&&(n=e[1],e=e[0],e={...e,options:{...e.options,...n}}),(null!==(t=e)&&void 0!==t&&t.parseTextSync||null!==(r=e)&&void 0!==r&&r.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}let Wi="";const Ki={};function Ji(e){for(const t in Ki)if(e.startsWith(t)){const r=Ki[t];e=e.replace(t,r)}return e.startsWith("http://")||e.startsWith("https://")||(e=`${Wi}${e}`),e}const Qi=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,Yi=/^([-\w.]+\/[-\w.+]+)/;function $i(e){const t=Yi.exec(e);return t?t[1]:e}function Xi(e){const t=Qi.exec(e);return t?t[1]:""}const Zi=/\?.*/;function ea(e){if(zi(e)){const t=ta(e.url||"");return{url:t,type:$i(e.headers.get("content-type")||"")||Xi(t)}}return Ui(e)?{url:ta(e.name||""),type:e.type||""}:"string"==typeof e?{url:ta(e),type:Xi(e)}:{url:"",type:""}}function ta(e){return e.replace(Zi,"")}async function ra(e){if(zi(e))return e;const t={},r=function(e){return zi(e)?e.headers["content-length"]||-1:Ui(e)?e.size:"string"==typeof e?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}(e);r>=0&&(t["content-length"]=String(r));const{url:n,type:i}=ea(e);i&&(t["content-type"]=i);const a=await async function(e){if("string"==typeof e)return"data:,"+e.slice(0,5);if(e instanceof Blob){const t=e.slice(0,5);return await new Promise(e=>{const r=new FileReader;r.onload=t=>{var r;return e(null==t||null===(r=t.target)||void 0===r?void 0:r.result)},r.readAsDataURL(t)})}if(e instanceof ArrayBuffer){const t=e.slice(0,5);return"data:base64,"+function(e){let t="";const r=new Uint8Array(e);for(let e=0;e<r.byteLength;e++)t+=String.fromCharCode(r[e]);return btoa(t)}(t)}return null}(e);a&&(t["x-first-bytes"]=a),"string"==typeof e&&(e=(new TextEncoder).encode(e));const o=new Response(e,{headers:t});return Object.defineProperty(o,"url",{value:n}),o}async function na(e){if(!e.ok){const t=await async function(e){let t=`Failed to fetch resource ${e.url} (${e.status}): `;try{const r=e.headers.get("Content-Type");let n=e.statusText;r.includes("application/json")&&(n+=" "+await e.text()),t+=n,t=t.length>60?t.slice(0,60)+"...":t}catch(e){}return t}(e);throw new Error(t)}}async function ia(e,t){if("string"==typeof e){e=Ji(e);let r=t;return null!=t&&t.fetch&&"function"!=typeof(null==t?void 0:t.fetch)&&(r=t.fetch),await fetch(e,r)}return await ra(e)}const aa=new(r(544).a)({id:"loaders.gl"});class oa{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const sa={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){var e,t,r;r=void 0,(t="console")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}},CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Oi,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},ua={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function ca(){globalThis.loaders=globalThis.loaders||{};const{loaders:e}=globalThis;return e._state=e._state||{},e._state}const la=()=>{const e=ca();return e.globalOptions=e.globalOptions||{...sa},e.globalOptions};function ha(e,t,r,n){return r=r||[],function(e,t){fa(e,null,sa,ua,t);for(const r of t){const n=e&&e[r.id]||{},i=r.options&&r.options[r.id]||{},a=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};fa(n,r.id,i,a,t)}}(e,r=Array.isArray(r)?r:[r]),ma(t,e,n)}function pa(e,t){const r=la(),n=e||r;return"function"==typeof n.fetch?n.fetch:Mi(n.fetch)?e=>ia(e,n):null!=t&&t.fetch?null==t?void 0:t.fetch:ia}function fa(e,t,r,n,i){const a=t||"Top level",o=t?t+".":"";for(const s in e){const u=!t&&Mi(e[s]),c="baseUri"===s&&!t,l="workerUrl"===s&&t;if(!(s in r)&&!c&&!l)if(s in n)aa.warn(`${a} loader option '${o}${s}' no longer supported, use '${n[s]}'`)();else if(!u){const e=da(s,i);aa.warn(`${a} loader option '${o}${s}' not recognized. ${e}`)()}}}function da(e,t){const r=e.toLowerCase();let n="";for(const i of t)for(const t in i.options){if(e===t)return`Did you mean '${i.id}.${t}'?`;const a=t.toLowerCase();(r.startsWith(a)||a.startsWith(r))&&(n=n||`Did you mean '${i.id}.${t}'?`)}return n}function ma(e,t,r){const n={...e.options||{}};return function(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)}(n,r),null===n.log&&(n.log=new oa),ga(n,la()),ga(n,t),n}function ga(e,t){for(const r in t)if(r in t){const n=t[r];Fi(n)&&Fi(e[r])?e[r]={...e[r],...t[r]}:e[r]=t[r]}}function ya(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}const ba={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document},va=ba.global||ba.self||ba.window||{},wa="object"!=typeof process||"[object process]"!==String(process)||process.browser,_a="function"==typeof importScripts,ka="undefined"!=typeof window&&void 0!==window.orientation,xa="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version);xa&&parseFloat(xa[1]);var Ea=r(543);const Aa=new Map;function Sa(e){ya(e.source&&!e.url||!e.source&&e.url);let t=Aa.get(e.source||e.url);return t||(e.url&&(t=function(e){if(!e.startsWith("http"))return e;return ja((t=e,`try {\n importScripts('${t}');\n} catch (error) {\n console.error(error);\n throw error;\n}`));var t}(e.url),Aa.set(e.url,t)),e.source&&(t=ja(e.source),Aa.set(e.source,t))),ya(t),t}function ja(e){const t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function Ta(e){return!!e&&(e instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&e instanceof MessagePort||("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)))}function Ca(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ba=()=>{};class Ra{static isSupported(){return"undefined"!=typeof Worker&&wa||void 0!==typeof Ea.Worker}constructor(e){Ca(this,"name",void 0),Ca(this,"source",void 0),Ca(this,"url",void 0),Ca(this,"terminated",!1),Ca(this,"worker",void 0),Ca(this,"onMessage",void 0),Ca(this,"onError",void 0),Ca(this,"_loadableURL","");const{name:t,source:r,url:n}=e;ya(r||n),this.name=t,this.source=r,this.url=n,this.onMessage=Ba,this.onError=e=>console.log(e),this.worker=wa?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=Ba,this.onError=Ba,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,t){t=t||function e(t,r=!0,n){const i=n||new Set;if(t){if(Ta(t))i.add(t);else if(Ta(t.buffer))i.add(t.buffer);else if(ArrayBuffer.isView(t));else if(r&&"object"==typeof t)for(const n in t)e(t[n],r,i)}else;return void 0===n?Array.from(i):[]}(e),this.worker.postMessage(e,t)}_getErrorFromErrorEvent(e){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url}. `,e.message&&(t+=e.message+" in "),e.lineno&&(t+=`:${e.lineno}:${e.colno}`),new Error(t)}_createBrowserWorker(){this._loadableURL=Sa({source:this.source,url:this.url});const e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=e=>{e.data?this.onMessage(e.data):this.onError(new Error("No data received"))},e.onerror=e=>{this.onError(this._getErrorFromErrorEvent(e)),this.terminated=!0},e.onmessageerror=e=>console.error(e),e}_createNodeWorker(){let e;if(this.url){const t=this.url.includes(":/")||this.url.startsWith("/")?this.url:"./"+this.url;e=new Ea.Worker(t,{eval:!1})}else{if(!this.source)throw new Error("no worker");e=new Ea.Worker(this.source,{eval:!0})}return e.on("message",e=>{this.onMessage(e)}),e.on("error",e=>{this.onError(e)}),e.on("exit",e=>{}),e}}function Oa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ia{constructor(e,t){Oa(this,"name",void 0),Oa(this,"workerThread",void 0),Oa(this,"isRunning",!0),Oa(this,"result",void 0),Oa(this,"_resolve",()=>{}),Oa(this,"_reject",()=>{}),this.name=e,this.workerThread=t,this.result=new Promise((e,t)=>{this._resolve=e,this._reject=t})}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){ya(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){ya(this.isRunning),this.isRunning=!1,this._reject(e)}}function Pa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Da{static isSupported(){return Ra.isSupported()}constructor(e){Pa(this,"name","unnamed"),Pa(this,"source",void 0),Pa(this,"url",void 0),Pa(this,"maxConcurrency",1),Pa(this,"maxMobileConcurrency",1),Pa(this,"onDebug",()=>{}),Pa(this,"reuseWorkers",!0),Pa(this,"props",{}),Pa(this,"jobQueue",[]),Pa(this,"idleQueue",[]),Pa(this,"count",0),Pa(this,"isDestroyed",!1),this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},void 0!==e.name&&(this.name=e.name),void 0!==e.maxConcurrency&&(this.maxConcurrency=e.maxConcurrency),void 0!==e.maxMobileConcurrency&&(this.maxMobileConcurrency=e.maxMobileConcurrency),void 0!==e.reuseWorkers&&(this.reuseWorkers=e.reuseWorkers),void 0!==e.onDebug&&(this.onDebug=e.onDebug)}async startJob(e,t=((e,t,r)=>e.done(r)),r=((e,t)=>e.error(t))){const n=new Promise(n=>(this.jobQueue.push({name:e,onMessage:t,onError:r,onStart:n}),this));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;const e=this._getAvailableWorker();if(!e)return;const t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:e,backlog:this.jobQueue.length});const r=new Ia(t.name,e);e.onMessage=e=>t.onMessage(r,e.type,e.payload),e.onError=e=>t.onError(r,e),t.onStart(r);try{await r.result}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;const e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Ra({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return ka?this.maxMobileConcurrency:this.maxConcurrency}}function Ma(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Fa={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}};class La{static isSupported(){return Ra.isSupported()}static getWorkerFarm(e={}){return La._workerFarm=La._workerFarm||new La({}),La._workerFarm.setProps(e),La._workerFarm}constructor(e){Ma(this,"props",void 0),Ma(this,"workerPools",new Map),this.props={...Fa},this.setProps(e),this.workerPools=new Map}destroy(){for(const e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(const e of this.workerPools.values())e.setProps(this._getWorkerPoolProps())}getWorkerPool(e){const{name:t,source:r,url:n}=e;let i=this.workerPools.get(t);return i||(i=new Da({name:t,source:r,url:n}),i.setProps(this._getWorkerPoolProps()),this.workerPools.set(t,i)),i}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}Ma(La,"_workerFarm",void 0);function Na(e,t={}){const r=t[e.id]||{},n=e.id+"-worker.js";let i=r.workerUrl;if(i||"compression"!==e.id||(i=t.workerUrl),"test"===t._workerType&&(i=`modules/${e.module}/dist/${n}`),!i){let t=e.version;"latest"===t&&(t="latest");const r=t?"@"+t:"";i=`https://unpkg.com/@loaders.gl/${e.module}${r}/dist/${n}`}return ya(i),i}async function za(e,t,r,n,i){const a=e.id,o=Na(e,r),s=La.getWorkerFarm(r).getWorkerPool({name:a,url:o});r=JSON.parse(JSON.stringify(r)),n=JSON.parse(JSON.stringify(n||{}));const u=await s.startJob("process-on-worker",Ua.bind(null,i));u.postMessage("process",{input:t,options:r,context:n});const c=await u.result;return await c.result}async function Ua(e,t,r,n){switch(r){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":const{id:i,input:a,options:o}=n;try{const r=await e(a,o);t.postMessage("done",{id:i,result:r})}catch(e){const r=e instanceof Error?e.message:"unknown error";t.postMessage("error",{id:i,error:r})}break;default:console.warn("parse-with-worker unknown message "+r)}}function qa(e){if(ArrayBuffer.isView(e)&&(e=e.buffer),"undefined"!=typeof Buffer&&e instanceof ArrayBuffer){const t=new Buffer(e.byteLength),r=new Uint8Array(e);for(let e=0;e<t.length;++e)t[e]=r[e];return t}return Hi(!1)}function Ha(e){return e&&"object"==typeof e&&e.isBuffer}function Ga(e){return qa?qa(e):e}function Va(e){if(Ha(e))return function(e){if(Ha(e)){return new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer}return e}(e);if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return 0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if("string"==typeof e){const t=e;return(new TextEncoder).encode(t).buffer}if(e&&"object"==typeof e&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}function Wa(...e){const t=e.map(e=>e instanceof ArrayBuffer?new Uint8Array(e):e),r=t.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(r);let i=0;for(const e of t)n.set(e,i),i+=e.byteLength;return n.buffer}function Ka(...e){const t=e,r=t&&t.length>1&&t[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');const n=new r(t.reduce((e,t)=>e+t.length,0));let i=0;for(const e of t)n.set(e,i),i+=e.length;return n}function Ja(e,t,r){const n=void 0!==r?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}async function Qa(e){const t=[];for await(const r of e)t.push(r);return Wa(...t)}const Ya=262144;function $a(e,t){return Oi?async function*(e,t){const r=e.getReader();let n;try{for(;;){const e=n||r.read();null!=t&&t._streamReadAhead&&(n=r.read());const{done:i,value:a}=await e;if(i)return;yield Va(a)}}catch(e){r.releaseLock()}}(e,t):async function*(e,t){for await(const t of e)yield Va(t)}(e)}function Xa(e,t){if("string"==typeof e)return function*(e,t){const r=(null==t?void 0:t.chunkSize)||262144;let n=0;const i=new TextEncoder;for(;n<e.length;){const t=Math.min(e.length-n,r),a=e.slice(n,n+t);n+=t,yield i.encode(a)}}(e,t);if(e instanceof ArrayBuffer)return function*(e,t={}){const{chunkSize:r=Ya}=t;let n=0;for(;n<e.byteLength;){const t=Math.min(e.byteLength-n,r),i=new ArrayBuffer(t),a=new Uint8Array(e,n,t);new Uint8Array(i).set(a),n+=t,yield i}}(e,t);if(Ui(e))return async function*(e,t){const r=(null==t?void 0:t.chunkSize)||1048576;let n=0;for(;n<e.size;){const t=n+r,i=await e.slice(n,t).arrayBuffer();n=t,yield i}}(e,t);if(qi(e))return $a(e,t);if(zi(e)){return $a(e.body,t)}throw new Error("makeIterator")}const Za="Cannot convert supplied data type";async function eo(e,t,r){const n=e instanceof ArrayBuffer||ArrayBuffer.isView(e);if("string"==typeof e||n)return function(e,t,r){if(t.text&&"string"==typeof e)return e;var n;if((n=e)&&"object"==typeof n&&n.isBuffer&&(e=e.buffer),e instanceof ArrayBuffer){const r=e;if(t.text&&!t.binary){return new TextDecoder("utf8").decode(r)}return r}if(ArrayBuffer.isView(e)){if(t.text&&!t.binary){return new TextDecoder("utf8").decode(e)}let r=e.buffer;const n=e.byteLength||e.length;return 0===e.byteOffset&&n===r.byteLength||(r=r.slice(e.byteOffset,e.byteOffset+n)),r}throw new Error(Za)}(e,t);if(Ui(e)&&(e=await ra(e)),zi(e)){const r=e;return await na(r),t.binary?await r.arrayBuffer():await r.text()}if(qi(e)&&(e=Xa(e,r)),Li(e)||Ni(e))return Qa(e);throw new Error(Za)}function to(e){const t=e&&e.lastIndexOf("/");return t>=0?e.substr(t+1):""}function ro(e){const t=e&&e.lastIndexOf("/");return t>=0?e.substr(0,t):""}function no(...e){return(e=e.map((t,r)=>(r&&(t=t.replace(new RegExp("^/"),"")),r!==e.length-1&&(t=t.replace(new RegExp("/$"),"")),t))).join("/")}const io=Me.promisify;let ao,oo,so,uo,co,lo,ho,po,fo,mo,go=Boolean(pe.a);try{ao=io(pe.a.readdir),oo=io(pe.a.stat),so=io(pe.a.readFile),uo=pe.a.readFileSync,co=io(pe.a.writeFile),lo=pe.a.writeFileSync,ho=io(pe.a.open),po=io(pe.a.close),fo=io(pe.a.read),mo=io(pe.a.fstat),go=Boolean(pe.a)}catch{}async function yo(e,t,r){const n=Buffer.alloc(r),{bytesRead:i}=await fo(e,n,0,r,t);if(i!==r)throw new Error("fs.read failed");return function(e){if(Buffer.isBuffer(e)){return new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer}return e}(n)}function bo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vo(){return!("object"==typeof process&&"[object process]"===String(process)&&!process.browser)||function(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof process&&"object"==typeof process.versions&&Boolean(process.versions.electron))return!0;const t="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}()}const wo="undefined"!=typeof __VERSION__?__VERSION__:"untranspiled source";vo();class _o{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";bo(this,"storage",void 0),bo(this,"id",void 0),bo(this,"config",{}),this.storage=function(e){try{const t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch(e){return null}}(r),this.id=e,this.config={},Object.assign(this.config,t),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){return this.config={},this.updateConfiguration(e)}updateConfiguration(e){if(Object.assign(this.config,e),this.storage){const e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}return this}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function ko(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600;const i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));const a=e.width*r,o=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}let xo;function Eo(e){return"string"==typeof e?xo[e.toUpperCase()]||xo.WHITE:e}function Ao(e,t){if(!e)throw new Error(t||"Assertion failed")}!function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(xo||(xo={}));const So={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document,process:"object"==typeof process&&process},jo=(globalThis,So.window||So.self||So.global),To=So.process||{};console;function Co(){let e;var t,r;if(vo&&"performance"in jo)e=null==jo||null===(t=jo.performance)||void 0===t||null===(r=t.now)||void 0===r?void 0:r.call(t);else if("hrtime"in To){var n;const t=null==To||null===(n=To.hrtime)||void 0===n?void 0:n.call(To);e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}const Bo={debug:vo&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Ro={enabled:!0,level:0};function Oo(){}const Io={},Po={once:!0};class Do{constructor(){let{id:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""};bo(this,"id",void 0),bo(this,"VERSION",wo),bo(this,"_startTs",Co()),bo(this,"_deltaTs",Co()),bo(this,"_storage",void 0),bo(this,"userData",{}),bo(this,"LOG_THROTTLE_TIMEOUT",0),this.id=e,this._storage=new _o("__probe-".concat(this.id,"__"),Ro),this.userData={},this.timeStamp("".concat(this.id," started")),function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"];const r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r);for(const r of n)"function"==typeof e[r]&&(t.find(e=>r===e)||(e[r]=e[r].bind(e)))}(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((Co()-this._startTs).toPrecision(10))}getDelta(){return Number((Co()-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&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:e}),this}setLevel(e){return this._storage.updateConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.updateConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){Ao(e,t)}warn(e){return this._getLogFunction(0,e,Bo.warn,arguments,Po)}error(e){return this._getLogFunction(0,e,Bo.error,arguments)}deprecated(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}probe(e,t){return this._getLogFunction(e,t,Bo.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,Bo.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return this._getLogFunction(e,t,Bo.debug||Bo.info,arguments,Po)}table(e,t,r){return t?this._getLogFunction(e,t,console.table||Oo,r&&[r],{tag:Lo(t)}):Oo}image(e){let{logLevel:t,priority:n,image:i,message:a="",scale:o=1}=e;return this._shouldLog(t||n)?vo?function(e){let{image:t,message:r="",scale:n=1}=e;if("string"==typeof t){const e=new Image;return e.onload=()=>{const t=ko(e,r,n);console.log(...t)},e.src=t,Oo}const i=t.nodeName||"";if("img"===i.toLowerCase())return console.log(...ko(t,r,n)),Oo;if("canvas"===i.toLowerCase()){const e=new Image;return e.onload=()=>console.log(...ko(e,r,n)),e.src=t.toDataURL(),Oo}return Oo}({image:i,message:a,scale:o}):function(e){let{image:t,message:n="",scale:i=1}=e,a=null;try{a=r(!function(){var e=new Error("Cannot find module 'asciify-image'");throw e.code="MODULE_NOT_FOUND",e}())}catch(e){}if(a)return()=>a(t,{fit:"box",width:"".concat(Math.round(80*i),"%")}).then(e=>console.log(e));return Oo}({image:i,message:a,scale:o}):Oo}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||Oo)}group(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};const n=Fo({logLevel:e,message:t,opts:r}),{collapsed:i}=r;return n.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(e,t,Object.assign({},r,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Oo)}withGroup(e,t,r){this.group(e,t)();try{r()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=Mo(e)}_getLogFunction(e,t,r,n,i){if(this._shouldLog(e)){i=Fo({logLevel:e,message:t,args:n,opts:i}),Ao(r=r||i.method),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=Co();const a=i.tag||i.message;if(i.once){if(Io[a])return Oo;Io[a]=Co()}return t=function(e,t,r){if("string"==typeof t){const o=r.time?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;const r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}(function(e){let t;return t=e<10?"".concat(e.toFixed(2),"ms"):e<100?"".concat(e.toFixed(1),"ms"):e<1e3?"".concat(e.toFixed(0),"ms"):"".concat((e/1e3).toFixed(2),"s"),t}(r.total)):"";t=r.time?"".concat(e,": ").concat(o," ").concat(t):"".concat(e,": ").concat(t),n=t,i=r.color,a=r.background,vo||"string"!=typeof n||(i&&(i=Eo(i),n="[".concat(i,"m").concat(n,"[39m")),a&&(i=Eo(a),n="[".concat(a+10,"m").concat(n,"[49m"))),t=n}var n,i,a;return t}(this.id,i.message,i),r.bind(console,t,...i.args)}return Oo}}function Mo(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return Ao(Number.isFinite(t)&&t>=0),t}function Fo(e){const{logLevel:t,message:r}=e;e.logLevel=Mo(t);const n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":void 0!==r&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());const i=typeof e.message;return Ao("string"===i||"object"===i),Object.assign(e,{args:n},e.opts)}function Lo(e){for(const t in e)for(const r in e[t])return r||"untitled";return"empty"}bo(Do,"VERSION",wo);const No=new Do({id:"loaders.gl"}),zo=()=>{const e=ca();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};const Uo=/\.([^.]+)$/;function qo(e,t=[],r,n){if(!Ho(e))return null;if(t&&!Array.isArray(t))return Vi(t);let i=[];t&&(i=i.concat(t)),null!=r&&r.ignoreRegisteredLoaders||i.push(...zo()),function(e){for(const t of e)Vi(t)}(i);const a=function(e,t,r,n){const{url:i,type:a}=ea(e),o=i||(null==n?void 0:n.url);let s=null,u="";null!=r&&r.mimeType&&(s=Vo(t,null==r?void 0:r.mimeType),u="match forced by supplied MIME type "+(null==r?void 0:r.mimeType));var c;s=s||function(e,t){const r=t&&Uo.exec(t),n=r&&r[1];return n?function(e,t){t=t.toLowerCase();for(const r of e)for(const e of r.extensions)if(e.toLowerCase()===t)return r;return null}(e,n):null}(t,o),u=u||(s?"matched url "+o:""),s=s||Vo(t,a),u=u||(s?"matched MIME type "+a:""),s=s||function(e,t){if(!t)return null;for(const r of e)if("string"==typeof t){if(Wo(t,r))return r}else if(ArrayBuffer.isView(t)){if(Ko(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer){if(Ko(t,0,r))return r}return null}(t,e),u=u||(s?"matched initial data "+Jo(e):""),s=s||Vo(t,null==r?void 0:r.fallbackMimeType),u=u||(s?"matched fallback MIME type "+a:""),u&&No.log(1,`selectLoader selected ${null===(c=s)||void 0===c?void 0:c.name}: ${u}.`);return s}(e,i,r,n);if(!(a||null!=r&&r.nothrow))throw new Error(Go(e));return a}function Ho(e){return!(e instanceof Response&&204===e.status)}function Go(e){const{url:t,type:r}=ea(e);let i="No valid loader found (";i+=t?n.filename(t)+", ":"no url provided, ",i+=`MIME type: ${r?`"${r}"`:"not provided"}, `;const a=e?Jo(e):"";return i+=a?` first bytes: "${a}"`:"first bytes: not available",i+=")",i}function Vo(e,t){for(const r of e){if(r.mimeTypes&&r.mimeTypes.includes(t))return r;if(t==="application/x."+r.id)return r}return null}function Wo(e,t){if(t.testText)return t.testText(e);return(Array.isArray(t.tests)?t.tests:[t.tests]).some(t=>e.startsWith(t))}function Ko(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(n=>function(e,t,r,n){if(n instanceof ArrayBuffer)return function(e,t,r){if(r=r||e.byteLength,e.byteLength<r||t.byteLength<r)return!1;const n=new Uint8Array(e),i=new Uint8Array(t);for(let e=0;e<n.length;++e)if(n[e]!==i[e])return!1;return!0}(n,e,n.byteLength);switch(typeof n){case"function":return n(e,r);case"string":const i=Qo(e,t,n.length);return n===i;default:return!1}}(e,t,r,n))}function Jo(e,t=5){if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return Qo(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return Qo(e,0,t)}return""}function Qo(e,t,r){if(e.byteLength<t+r)return"";const n=new DataView(e);let i="";for(let e=0;e<r;e++)i+=String.fromCharCode(n.getUint8(t+e));return i}async function Yo(e,t,r,n){ya(!n||"object"==typeof n),!t||Array.isArray(t)||Gi(t)||(n=void 0,r=t,t=void 0),e=await e,r=r||{};const{url:i}=ea(e),a=function(e,t){if(!t&&e&&!Array.isArray(e))return e;let r;if(e&&(r=Array.isArray(e)?e:[e]),t&&t.loaders){const e=Array.isArray(t.loaders)?t.loaders:[t.loaders];r=r?[...r,...e]:e}return r&&r.length?r:null}(t,n),o=await async function(e,t=[],r,n){if(!Ho(e))return null;let i=qo(e,t,{...r,nothrow:!0},n);if(i)return i;if(Ui(e)&&(i=qo(e=await e.slice(0,10).arrayBuffer(),t,r,n)),!(i||null!=r&&r.nothrow))throw new Error(Go(e));return i}(e,a,r);return o?(n=function(e,t,r=null){if(r)return r;const n={fetch:pa(t,e),...e};return Array.isArray(n.loaders)||(n.loaders=null),n}({url:i,parse:Yo,loaders:a},r=ha(r,o,a,i),n),await async function(e,t,r,n){if(function(e,t="3.2.7"){ya(e,"no worker provided");const r=e.version}(e),zi(t)){const e=t,{ok:r,redirected:i,status:a,statusText:o,type:s,url:u}=e,c=Object.fromEntries(e.headers.entries());n.response={headers:c,ok:r,redirected:i,status:a,statusText:o,type:s,url:u}}if(t=await eo(t,e,r),e.parseTextSync&&"string"==typeof t)return r.dataType="text",e.parseTextSync(t,r,n,e);if(function(e,t){return!!La.isSupported()&&(!!(wa||null!=t&&t._nodeWorkers)&&(e.worker&&(null==t?void 0:t.worker)))}(e,r))return await za(e,t,r,n,Yo);if(e.parseText&&"string"==typeof t)return await e.parseText(t,r,n,e);if(e.parse)return await e.parse(t,r,n,e);throw ya(!e.parseSync),new Error(e.id+" loader - no parser found and worker is disabled")}(o,e,r,n)):null}async function $o(e,t,r,n){Array.isArray(t)||Gi(t)||(void 0,r=t,t=void 0);const i=pa(r);let a=e;return"string"==typeof e&&(a=await i(e)),Ui(e)&&(a=await i(e)),await Yo(a,t,r)}function Xo(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}const Zo=1/Math.PI*180,es=1/180*Math.PI,ts={};function rs(e,{precision:t=ts.precision||4}={}){return e=function(e){return Math.round(e/ts.EPSILON)*ts.EPSILON}(e),"".concat(parseFloat(e.toPrecision(t)))}function ns(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function is(e,t,r){if(ns(e)){r=r||((n=e).clone?n.clone():new Array(n.length));for(let n=0;n<r.length&&n<e.length;++n)r[n]=t(e[n],n,r);return r}var n;return t(e)}function as(e){return function(e,t){return is(e,e=>e*es,t)}(e)}function os(e){return ss(e)}function ss(e,t){return is(e,e=>e*Zo,t)}function us(e,t,r){return is(e,e=>Math.max(t,Math.min(r,e)))}function cs(e,t,r){const n=ts.EPSILON;r&&(ts.EPSILON=r);try{if(e===t)return!0;if(ns(e)&&ns(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!cs(e[r],t[r]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):!(!Number.isFinite(e)||!Number.isFinite(t))&&Math.abs(e-t)<=ts.EPSILON*Math.max(1,Math.abs(e),Math.abs(t))}finally{ts.EPSILON=n}}ts.EPSILON=1e-12,ts.debug=!1,ts.precision=4,ts.printTypes=!1,ts.printDegrees=!1,ts.printRowMajor=!0;class ls extends(function(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Array)){get ELEMENTS(){return Xo(!1),0}clone(){return(new this.constructor).copy(this)}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}fromArray(e,t=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=e[r+t];return this.check()}to(e){return e===this?this:ns(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toArray(e=[],t=0){for(let r=0;r<this.ELEMENTS;++r)e[t+r]=this[r];return e}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(ts)}formatString(e){let t="";for(let r=0;r<this.ELEMENTS;++r)t+=(r>0?", ":"")+rs(this[r],e);return"".concat(e.printTypes?this.constructor.name:"","[").concat(t,"]")}equals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!cs(this[t],e[t]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,t,r){void 0===r&&(r=t,t=e,e=this);for(let n=0;n<this.ELEMENTS;++n){const i=e[n];this[n]=i+r*(t[n]-i)}return this.check()}min(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}max(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}clamp(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e[r]),t[r]);return this.check()}add(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]+=t[e];return this.check()}subtract(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]-=t[e];return this.check()}scale(e){if(Array.isArray(e))return this.multiply(e);for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}sub(e){return this.subtract(e)}setScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=e;return this.check()}addScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}divideScalar(e){return this.scale(1/e)}clampScalar(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e),t);return this.check()}multiplyByScalar(e){return this.scale(e)}get elements(){return this}check(){if(ts.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 t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}}function hs(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(e));return e}function ps(e,t,r=""){if(ts.debug&&!function(e,t){if(e.length!==t)return!1;for(let t=0;t<e.length;++t)if(!Number.isFinite(e[t]))return!1;return!0}(e,t))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return e}const fs={};function ds(e,t){fs[e]||(fs[e]=!0,console.warn("".concat(e," has been removed in version ").concat(t,", see upgrade guide for more information")))}class ms extends ls{get ELEMENTS(){return Xo(!1),0}copy(e){return Xo(!1),this}get x(){return this[0]}set x(e){this[0]=hs(e)}get y(){return this[1]}set y(e){this[1]=hs(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let t=0;t<this.ELEMENTS;++t)e+=this[t]*this[t];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let t=0;for(let r=0;r<this.ELEMENTS;++r){const n=this[r]-e[r];t+=n*n}return hs(t)}dot(e){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*e[r];return hs(t)}normalize(){const e=this.magnitude();if(0!==e)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e;return this.check()}multiply(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]*=t[e];return this.check()}divide(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t[e];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return Xo(e>=0&&e<this.ELEMENTS,"index is out of range"),hs(this[e])}setComponent(e,t){return Xo(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=t,this.check()}addVectors(e,t){return this.copy(e).add(t)}subVectors(e,t){return this.copy(e).subtract(t)}multiplyVectors(e,t){return this.copy(e).multiply(t)}addScaledVector(e,t){return this.add(new this.constructor(e).multiplyScalar(t))}}var gs=1e-6,ys="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;Math.PI;function bs(){var e=new ys(3);return ys!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function vs(e){var t=e[0],r=e[1],n=e[2];return Math.hypot(t,r,n)}function ws(e,t,r){var n=new ys(3);return n[0]=e,n[1]=t,n[2]=r,n}function _s(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function ks(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2];return e[0]=i*u-a*s,e[1]=a*o-n*u,e[2]=n*s-i*o,e}function xs(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,e}function Es(e,t,r){var n=t[0],i=t[1],a=t[2];return e[0]=n*r[0]+i*r[3]+a*r[6],e[1]=n*r[1]+i*r[4]+a*r[7],e[2]=n*r[2]+i*r[5]+a*r[8],e}function As(e,t,r){var n=r[0],i=r[1],a=r[2],o=r[3],s=t[0],u=t[1],c=t[2],l=i*c-a*u,h=a*s-n*c,p=n*u-i*s,f=i*p-a*h,d=a*l-n*p,m=n*h-i*l,g=2*o;return l*=g,h*=g,p*=g,f*=2,d*=2,m*=2,e[0]=s+l+f,e[1]=u+h+d,e[2]=c+p+m,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Ss,js=vs;Ss=bs();function Ts(e,t,r){const n=t[0],i=t[1],a=r[3]*n+r[7]*i||1;return e[0]=(r[0]*n+r[4]*i)/a,e[1]=(r[1]*n+r[5]*i)/a,e}function Cs(e,t,r){const n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a||1;return e[0]=(r[0]*n+r[4]*i+r[8]*a)/o,e[1]=(r[1]*n+r[5]*i+r[9]*a)/o,e[2]=(r[2]*n+r[6]*i+r[10]*a)/o,e}function Bs(e,t,r){const n=t[0],i=t[1],a=t[2];return e[0]=r[0]*n+r[3]*i+r[6]*a,e[1]=r[1]*n+r[4]*i+r[7]*a,e[2]=r[2]*n+r[5]*i+r[8]*a,e[3]=t[3],e}const Rs=[0,0,0],Os={};class Is extends ms{static get ZERO(){return Os.ZERO=Os.ZERO||Object.freeze(new Is(0,0,0,0))}constructor(e=0,t=0,r=0){super(-0,-0,-0),1===arguments.length&&ns(e)?this.copy(e):(ts.debug&&(hs(e),hs(t),hs(r)),this[0]=e,this[1]=t,this[2]=r)}set(e,t,r){return this[0]=e,this[1]=t,this[2]=r,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return ts.debug&&(hs(e.x),hs(e.y),hs(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]=hs(e)}angle(e){return r=e,n=(t=this)[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],c=Math.sqrt(n*n+i*i+a*a)*Math.sqrt(o*o+s*s+u*u),l=c&&_s(t,r)/c,Math.acos(Math.min(Math.max(l,-1),1));var t,r,n,i,a,o,s,u,c,l}cross(e){return ks(this,this,e),this.check()}rotateX({radians:e,origin:t=Rs}){var r,n,i,a,o,s;return r=this,i=t,a=e,s=[],(o=[])[0]=(n=this)[0]-i[0],o[1]=n[1]-i[1],o[2]=n[2]-i[2],s[0]=o[0],s[1]=o[1]*Math.cos(a)-o[2]*Math.sin(a),s[2]=o[1]*Math.sin(a)+o[2]*Math.cos(a),r[0]=s[0]+i[0],r[1]=s[1]+i[1],r[2]=s[2]+i[2],this.check()}rotateY({radians:e,origin:t=Rs}){var r,n,i,a,o,s;return r=this,i=t,a=e,s=[],(o=[])[0]=(n=this)[0]-i[0],o[1]=n[1]-i[1],o[2]=n[2]-i[2],s[0]=o[2]*Math.sin(a)+o[0]*Math.cos(a),s[1]=o[1],s[2]=o[2]*Math.cos(a)-o[0]*Math.sin(a),r[0]=s[0]+i[0],r[1]=s[1]+i[1],r[2]=s[2]+i[2],this.check()}rotateZ({radians:e,origin:t=Rs}){var r,n,i,a,o,s;return r=this,i=t,a=e,s=[],(o=[])[0]=(n=this)[0]-i[0],o[1]=n[1]-i[1],o[2]=n[2]-i[2],s[0]=o[0]*Math.cos(a)-o[1]*Math.sin(a),s[1]=o[0]*Math.sin(a)+o[1]*Math.cos(a),s[2]=o[2],r[0]=s[0]+i[0],r[1]=s[1]+i[1],r[2]=s[2]+i[2],this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return xs(this,this,e),this.check()}transformAsVector(e){return Cs(this,this,e),this.check()}transformByMatrix3(e){return Es(this,this,e),this.check()}transformByMatrix2(e){return function(e,t,r){const n=t[0],i=t[1];e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2]}(this,this,e),this.check()}transformByQuaternion(e){return As(this,this,e),this.check()}}class Ps extends ls{get ELEMENTS(){return Xo(!1),0}get RANK(){return Xo(!1),0}toString(){let e="[";if(ts.printRowMajor){e+="row-major:";for(let t=0;t<this.RANK;++t)for(let r=0;r<this.RANK;++r)e+=" ".concat(this[r*this.RANK+t])}else{e+="column-major:";for(let t=0;t<this.ELEMENTS;++t)e+=" ".concat(this[t])}return e+="]",e}getElementIndex(e,t){return t*this.RANK+e}getElement(e,t){return this[t*this.RANK+e]}setElement(e,t,r){return this[t*this.RANK+e]=hs(r),this}getColumn(e,t=new Array(this.RANK).fill(-0)){const r=e*this.RANK;for(let e=0;e<this.RANK;++e)t[e]=this[r+e];return t}setColumn(e,t){const r=e*this.RANK;for(let e=0;e<this.RANK;++e)this[r+e]=t[e];return this}}function Ds(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],h=t[8],p=t[9],f=t[10],d=t[11],m=t[12],g=t[13],y=t[14],b=t[15],v=r[0],w=r[1],_=r[2],k=r[3];return e[0]=v*n+w*s+_*h+k*m,e[1]=v*i+w*u+_*p+k*g,e[2]=v*a+w*c+_*f+k*y,e[3]=v*o+w*l+_*d+k*b,v=r[4],w=r[5],_=r[6],k=r[7],e[4]=v*n+w*s+_*h+k*m,e[5]=v*i+w*u+_*p+k*g,e[6]=v*a+w*c+_*f+k*y,e[7]=v*o+w*l+_*d+k*b,v=r[8],w=r[9],_=r[10],k=r[11],e[8]=v*n+w*s+_*h+k*m,e[9]=v*i+w*u+_*p+k*g,e[10]=v*a+w*c+_*f+k*y,e[11]=v*o+w*l+_*d+k*b,v=r[12],w=r[13],_=r[14],k=r[15],e[12]=v*n+w*s+_*h+k*m,e[13]=v*i+w*u+_*p+k*g,e[14]=v*a+w*c+_*f+k*y,e[15]=v*o+w*l+_*d+k*b,e}function Ms(e,t,r){var n=r[0],i=r[1],a=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Fs(e,t){var r=t[0],n=t[1],i=t[2],a=t[4],o=t[5],s=t[6],u=t[8],c=t[9],l=t[10];return e[0]=Math.hypot(r,n,i),e[1]=Math.hypot(a,o,s),e[2]=Math.hypot(u,c,l),e}function Ls(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e}function Ns(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e}!function(){var e,t=(e=new ys(2),ys!=Float32Array&&(e[0]=0,e[1]=0),e)}();function zs(e){var t=e[0],r=e[1],n=e[2],i=e[3];return Math.hypot(t,r,n,i)}function Us(e){var t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}!function(){var e,t=(e=new ys(4),ys!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e)}();const qs=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Hs=Object.freeze([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Gs=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL0ROW3:3,COL1ROW0:4,COL1ROW1:5,COL1ROW2:6,COL1ROW3:7,COL2ROW0:8,COL2ROW1:9,COL2ROW2:10,COL2ROW3:11,COL3ROW0:12,COL3ROW1:13,COL3ROW2:14,COL3ROW3:15}),Vs={};class Ws extends Ps{static get IDENTITY(){return Vs.IDENTITY=Vs.IDENTITY||Object.freeze(new Ws(qs)),Vs.IDENTITY}static get ZERO(){return Vs.ZERO=Vs.ZERO||Object.freeze(new Ws(Hs)),Vs.ZERO}get INDICES(){return Gs}get ELEMENTS(){return 16}get RANK(){return 4}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&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,t,r,n,i,a,o,s,u,c,l,h,p,f,d,m){return this[0]=e,this[1]=t,this[2]=r,this[3]=n,this[4]=i,this[5]=a,this[6]=o,this[7]=s,this[8]=u,this[9]=c,this[10]=l,this[11]=h,this[12]=p,this[13]=f,this[14]=d,this[15]=m,this.check()}setRowMajor(e,t,r,n,i,a,o,s,u,c,l,h,p,f,d,m){return this[0]=e,this[1]=i,this[2]=u,this[3]=p,this[4]=t,this[5]=a,this[6]=c,this[7]=f,this[8]=r,this[9]=o,this[10]=l,this[11]=d,this[12]=n,this[13]=s,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(qs)}fromQuaternion(e){return function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,h=n*s,p=i*o,f=i*s,d=i*u,m=a*o,g=a*s,y=a*u;e[0]=1-h-d,e[1]=l+y,e[2]=p-g,e[3]=0,e[4]=l-y,e[5]=1-c-d,e[6]=f+m,e[7]=0,e[8]=p+g,e[9]=f-m,e[10]=1-c-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(this,e),this.check()}frustum({left:e,right:t,bottom:r,top:n,near:i,far:a}){return a===1/0?Ws._computeInfinitePerspectiveOffCenter(this,e,t,r,n,i):function(e,t,r,n,i,a,o){var s=1/(r-t),u=1/(i-n),c=1/(a-o);e[0]=2*a*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*a*u,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(i+n)*u,e[10]=(o+a)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*a*2*c,e[15]=0}(this,e,t,r,n,i,a),this.check()}static _computeInfinitePerspectiveOffCenter(e,t,r,n,i,a){const o=2*a/(r-t),s=2*a/(i-n),u=(r+t)/(r-t),c=(i+n)/(i-n),l=-2*a;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=u,e[9]=c,e[10]=-1,e[11]=-1,e[12]=0,e[13]=0,e[14]=l,e[15]=0,e}lookAt(e,t,r){return 1===arguments.length&&({eye:e,center:t,up:r}=e),function(e,t,r,n){var i,a,o,s,u,c,l,h,p,f,d=t[0],m=t[1],g=t[2],y=n[0],b=n[1],v=n[2],w=r[0],_=r[1],k=r[2];Math.abs(d-w)<gs&&Math.abs(m-_)<gs&&Math.abs(g-k)<gs?function(e){e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(e):(l=d-w,h=m-_,p=g-k,i=b*(p*=f=1/Math.hypot(l,h,p))-v*(h*=f),a=v*(l*=f)-y*p,o=y*h-b*l,(f=Math.hypot(i,a,o))?(i*=f=1/f,a*=f,o*=f):(i=0,a=0,o=0),s=h*o-p*a,u=p*i-l*o,c=l*a-h*i,(f=Math.hypot(s,u,c))?(s*=f=1/f,u*=f,c*=f):(s=0,u=0,c=0),e[0]=i,e[1]=s,e[2]=l,e[3]=0,e[4]=a,e[5]=u,e[6]=h,e[7]=0,e[8]=o,e[9]=c,e[10]=p,e[11]=0,e[12]=-(i*d+a*m+o*g),e[13]=-(s*d+u*m+c*g),e[14]=-(l*d+h*m+p*g),e[15]=1)}(this,e,t=t||[0,0,0],r=r||[0,1,0]),this.check()}ortho({left:e,right:t,bottom:r,top:n,near:i=.1,far:a=500}){return function(e,t,r,n,i,a,o){var s=1/(t-r),u=1/(n-i),c=1/(a-o);e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+r)*s,e[13]=(i+n)*u,e[14]=(o+a)*c,e[15]=1}(this,e,t,r,n,i,a),this.check()}orthographic({fovy:e=45*Math.PI/180,aspect:t=1,focalDistance:r=1,near:n=.1,far:i=500}){if(e>2*Math.PI)throw Error("radians");const a=e/2,o=r*Math.tan(a),s=o*t;return(new Ws).ortho({left:-s,right:s,bottom:-o,top:o,near:n,far:i})}perspective({fovy:e,fov:t=45*Math.PI/180,aspect:r=1,near:n=.1,far:i=500}={}){if((e=e||t)>2*Math.PI)throw Error("radians");return function(e,t,r,n,i){var a,o=1/Math.tan(t/2);e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=i&&i!==1/0?(a=1/(n-i),e[10]=(i+n)*a,e[14]=2*i*n*a):(e[10]=-1,e[14]=-2*n)}(this,e,r,n,i),this.check()}determinant(){return t=(e=this)[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8],l=e[9],h=e[10],p=e[11],f=e[12],d=e[13],m=e[14],g=e[15],(t*o-r*a)*(h*g-p*m)-(t*s-n*a)*(l*g-p*d)+(t*u-i*a)*(l*m-h*d)+(r*s-n*o)*(c*g-p*f)-(r*u-i*o)*(c*m-h*f)+(n*u-i*s)*(c*d-l*f);var e,t,r,n,i,a,o,s,u,c,l,h,p,f,d,m,g}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=[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=null){const r=this.getScale(t||[-0,-0,-0]),n=1/r[0],i=1/r[1],a=1/r[2];return e[0]=this[0]*n,e[1]=this[1]*i,e[2]=this[2]*a,e[3]=0,e[4]=this[4]*n,e[5]=this[5]*i,e[6]=this[6]*a,e[7]=0,e[8]=this[8]*n,e[9]=this[9]*i,e[10]=this[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e=[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=null){const r=this.getScale(t||[-0,-0,-0]),n=1/r[0],i=1/r[1],a=1/r[2];return e[0]=this[0]*n,e[1]=this[1]*i,e[2]=this[2]*a,e[3]=this[4]*n,e[4]=this[5]*i,e[5]=this[6]*a,e[6]=this[8]*n,e[7]=this[9]*i,e[8]=this[10]*a,e}transpose(){return function(e,t){if(e===t){var r=t[1],n=t[2],i=t[3],a=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=a,e[11]=t[14],e[12]=i,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15]}(this,this),this.check()}invert(){var e,t,r,n,i,a,o,s,u,c,l,h,p,f,d,m,g,y,b,v,w,_,k,x,E,A,S,j,T,C,B;return e=this,r=(t=this)[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],h=t[9],p=t[10],f=t[11],d=t[12],m=t[13],g=t[14],y=t[15],(B=(b=r*s-n*o)*(C=p*y-f*g)-(v=r*u-i*o)*(T=h*y-f*m)+(w=r*c-a*o)*(j=h*g-p*m)+(_=n*u-i*s)*(S=l*y-f*d)-(k=n*c-a*s)*(A=l*g-p*d)+(x=i*c-a*u)*(E=l*m-h*d))&&(B=1/B,e[0]=(s*C-u*T+c*j)*B,e[1]=(i*T-n*C-a*j)*B,e[2]=(m*x-g*k+y*_)*B,e[3]=(p*k-h*x-f*_)*B,e[4]=(u*S-o*C-c*A)*B,e[5]=(r*C-i*S+a*A)*B,e[6]=(g*w-d*x-y*v)*B,e[7]=(l*x-p*w+f*v)*B,e[8]=(o*T-s*S+c*E)*B,e[9]=(n*S-r*T-a*E)*B,e[10]=(d*k-m*w+y*b)*B,e[11]=(h*w-l*k-f*b)*B,e[12]=(s*A-o*j-u*E)*B,e[13]=(r*j-n*A+i*E)*B,e[14]=(m*v-d*_-g*b)*B,e[15]=(l*_-h*v+p*b)*B),this.check()}multiplyLeft(e){return Ds(this,e,this),this.check()}multiplyRight(e){return Ds(this,this,e),this.check()}rotateX(e){var t,r,n,i,a,o,s,u,c,l,h,p,f;return t=this,r=this,n=e,i=Math.sin(n),a=Math.cos(n),o=r[4],s=r[5],u=r[6],c=r[7],l=r[8],h=r[9],p=r[10],f=r[11],r!==t&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[4]=o*a+l*i,t[5]=s*a+h*i,t[6]=u*a+p*i,t[7]=c*a+f*i,t[8]=l*a-o*i,t[9]=h*a-s*i,t[10]=p*a-u*i,t[11]=f*a-c*i,this.check()}rotateY(e){var t,r,n,i,a,o,s,u,c,l,h,p,f;return t=this,r=this,n=e,i=Math.sin(n),a=Math.cos(n),o=r[0],s=r[1],u=r[2],c=r[3],l=r[8],h=r[9],p=r[10],f=r[11],r!==t&&(t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*a-l*i,t[1]=s*a-h*i,t[2]=u*a-p*i,t[3]=c*a-f*i,t[8]=o*i+l*a,t[9]=s*i+h*a,t[10]=u*i+p*a,t[11]=c*i+f*a,this.check()}rotateZ(e){var t,r,n,i,a,o,s,u,c,l,h,p,f;return t=this,r=this,n=e,i=Math.sin(n),a=Math.cos(n),o=r[0],s=r[1],u=r[2],c=r[3],l=r[4],h=r[5],p=r[6],f=r[7],r!==t&&(t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*a+l*i,t[1]=s*a+h*i,t[2]=u*a+p*i,t[3]=c*a+f*i,t[4]=l*a-o*i,t[5]=h*a-s*i,t[6]=p*a-u*i,t[7]=f*a-c*i,this.check()}rotateXYZ([e,t,r]){return this.rotateX(e).rotateY(t).rotateZ(r)}rotateAxis(e,t){return function(e,t,r,n){var i,a,o,s,u,c,l,h,p,f,d,m,g,y,b,v,w,_,k,x,E,A,S,j,T=n[0],C=n[1],B=n[2],R=Math.hypot(T,C,B);R<gs||(T*=R=1/R,C*=R,B*=R,i=Math.sin(r),o=1-(a=Math.cos(r)),s=t[0],u=t[1],c=t[2],l=t[3],h=t[4],p=t[5],f=t[6],d=t[7],m=t[8],g=t[9],y=t[10],b=t[11],v=T*T*o+a,w=C*T*o+B*i,_=B*T*o-C*i,k=T*C*o-B*i,x=C*C*o+a,E=B*C*o+T*i,A=T*B*o+C*i,S=C*B*o-T*i,j=B*B*o+a,e[0]=s*v+h*w+m*_,e[1]=u*v+p*w+g*_,e[2]=c*v+f*w+y*_,e[3]=l*v+d*w+b*_,e[4]=s*k+h*x+m*E,e[5]=u*k+p*x+g*E,e[6]=c*k+f*x+y*E,e[7]=l*k+d*x+b*E,e[8]=s*A+h*S+m*j,e[9]=u*A+p*S+g*j,e[10]=c*A+f*S+y*j,e[11]=l*A+d*S+b*j,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]))}(this,this,e,t),this.check()}scale(e){return Array.isArray(e)?Ms(this,this,e):Ms(this,this,[e,e,e]),this.check()}translate(e){var t,r,n,i,a,o,s,u,c,l,h,p,f,d,m,g,y,b;return t=this,r=this,g=(n=e)[0],y=n[1],b=n[2],r===t?(t[12]=r[0]*g+r[4]*y+r[8]*b+r[12],t[13]=r[1]*g+r[5]*y+r[9]*b+r[13],t[14]=r[2]*g+r[6]*y+r[10]*b+r[14],t[15]=r[3]*g+r[7]*y+r[11]*b+r[15]):(i=r[0],a=r[1],o=r[2],s=r[3],u=r[4],c=r[5],l=r[6],h=r[7],p=r[8],f=r[9],d=r[10],m=r[11],t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=u,t[5]=c,t[6]=l,t[7]=h,t[8]=p,t[9]=f,t[10]=d,t[11]=m,t[12]=i*g+u*y+p*b+r[12],t[13]=a*g+c*y+f*b+r[13],t[14]=o*g+l*y+d*b+r[14],t[15]=s*g+h*y+m*b+r[15]),this.check()}transform(e,t){return 4===e.length?(r=t||[-0,-0,-0,-0],i=this,a=(n=e)[0],o=n[1],s=n[2],u=n[3],r[0]=i[0]*a+i[4]*o+i[8]*s+i[12]*u,r[1]=i[1]*a+i[5]*o+i[9]*s+i[13]*u,r[2]=i[2]*a+i[6]*o+i[10]*s+i[14]*u,r[3]=i[3]*a+i[7]*o+i[11]*s+i[15]*u,ps(t=r,4),t):this.transformAsPoint(e,t);var r,n,i,a,o,s,u}transformAsPoint(e,t){const{length:r}=e;switch(r){case 2:t=Ns(t||[-0,-0],e,this);break;case 3:t=xs(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ps(t,e.length),t}transformAsVector(e,t){switch(e.length){case 2:t=Ts(t||[-0,-0],e,this);break;case 3:t=Cs(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ps(t,e.length),t}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,t,r){return this.identity().translate([e,t,r])}transformPoint(e,t){return ds("Matrix4.transformPoint","3.0"),this.transformAsPoint(e,t)}transformVector(e,t){return ds("Matrix4.transformVector","3.0"),this.transformAsPoint(e,t)}transformDirection(e,t){return ds("Matrix4.transformDirection","3.0"),this.transformAsVector(e,t)}}var Ks=.1,Js=1e-12,Qs=1e-15,Ys=1e-20;Math.PI,Math.PI,Math.PI,Math.PI;Math.max(6378137,6378137,6356752.314245179);const $s=e=>e,Xs=new Is;function Zs(e,t,r=$s){return ns(e)?(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]):"longitude"in e?(t[0]=r(e.longitude),t[1]=r(e.latitude),t[2]=e.height):(t[0]=r(e.x),t[1]=r(e.y),t[2]=e.z),t}function eu(e,t,r=$s){return ns(t)?(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]):"longitude"in t?(t.longitude=r(e[0]),t.latitude=r(e[1]),t.height=e[2]):(t.x=r(e[0]),t.y=r(e[1]),t.z=e[2]),t}const tu=new Is,ru=new Is,nu=new Is;const iu=new Is,au={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"}},ou={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},su={east:new Is,north:new Is,up:new Is,west:new Is,south:new Is,down:new Is},uu=new Is,cu=new Is,lu=new Is;function hu(e,t,r,n,i,a){const o=au[t]&&au[t][r];let s,u,c;Xo(o&&(!n||n===o));const l=iu.copy(i);if(cs(l.x,0,1e-14)&&cs(l.y,0,1e-14)){const e=Math.sign(l.z);s=uu.fromArray(ou[t]),"east"!==t&&"west"!==t&&s.scale(e),u=cu.fromArray(ou[r]),"east"!==r&&"west"!==r&&u.scale(e),c=lu.fromArray(ou[n]),"east"!==n&&"west"!==n&&c.scale(e)}else{const{up:i,east:a,north:o}=su;a.set(-l.y,l.x,0).normalize(),e.geodeticSurfaceNormal(l,i),o.copy(i).cross(a);const{down:h,west:p,south:f}=su;h.copy(i).scale(-1),p.copy(a).scale(-1),f.copy(o).scale(-1),s=su[t],u=su[r],c=su[n]}return a[0]=s.x,a[1]=s.y,a[2]=s.z,a[3]=0,a[4]=u.x,a[5]=u.y,a[6]=u.z,a[7]=0,a[8]=c.x,a[9]=c.y,a[10]=c.z,a[11]=0,a[12]=l.x,a[13]=l.y,a[14]=l.z,a[15]=1,a}const pu=new Is,fu=new Is,du=new Is,mu=new Is,gu=new Is,yu=new Is;let bu;class vu{static get WGS84(){return bu=bu||new vu(6378137,6378137,6356752.314245179),bu}constructor(e=0,t=0,r=0){Xo(e>=0),Xo(t>=0),Xo(r>=0),this.radii=new Is(e,t,r),this.radiiSquared=new Is(e*e,t*t,r*r),this.radiiToTheFourth=new Is(e*e*e*e,t*t*t*t,r*r*r*r),this.oneOverRadii=new Is(0===e?0:1/e,0===t?0:1/t,0===r?0:1/r),this.oneOverRadiiSquared=new Is(0===e?0:1/(e*e),0===t?0:1/(t*t),0===r?0:1/(r*r)),this.minimumRadius=Math.min(e,t,r),this.maximumRadius=Math.max(e,t,r),this.centerToleranceSquared=Ks,0!==this.radiiSquared.z&&(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,t=[0,0,0]){const r=fu,n=du,[,,i]=e;this.geodeticSurfaceNormalCartographic(e,r),n.copy(this.radiiSquared).scale(r);const a=Math.sqrt(r.dot(n));return n.scale(1/a),r.scale(i),n.add(r),n.to(t)}cartesianToCartographic(e,t=[0,0,0]){yu.from(e);const r=this.scaleToGeodeticSurface(yu,mu);if(!r)return;const n=this.geodeticSurfaceNormal(r,fu),i=gu;i.copy(yu).subtract(r);const a=Math.atan2(n.y,n.x),o=Math.asin(n.z),s=Math.sign(_s(i,yu))*vs(i);return eu([a,o,s],t,ts._cartographicRadians?$s:os)}eastNorthUpToFixedFrame(e,t=new Ws){return hu(this,"east","north","up",e,t)}localFrameToFixedFrame(e,t,r,n,i=new Ws){return hu(this,e,t,r,n,i)}geocentricSurfaceNormal(e,t=[0,0,0]){return pu.from(e).normalize().to(t)}geodeticSurfaceNormalCartographic(e,t=[0,0,0]){const r=function(e,t=Xs){return Zs(e,t,ts._cartographicRadians?$s:as)}(e),n=r[0],i=r[1],a=Math.cos(i);return pu.set(a*Math.cos(n),a*Math.sin(n),Math.sin(i)).normalize(),pu.to(t)}geodeticSurfaceNormal(e,t=[0,0,0]){return pu.from(e).scale(this.oneOverRadiiSquared).normalize().to(t)}scaleToGeodeticSurface(e,t){return function(e,t,r=new Is){const{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:a}=t;tu.from(e);const o=e.x,s=e.y,u=e.z,c=n.x,l=n.y,h=n.z,p=o*o*c*c,f=s*s*l*l,d=u*u*h*h,m=p+f+d,g=Math.sqrt(1/m);if(!Number.isFinite(g))return;const y=ru;if(y.copy(e).scale(g),m<a)return y.to(r);const b=i.x,v=i.y,w=i.z,_=nu;_.set(y.x*b*2,y.y*v*2,y.z*w*2);let k,x,E,A,S=(1-g)*e.len()/(.5*_.len()),j=0;do{S-=j,k=1/(1+S*b),x=1/(1+S*v),E=1/(1+S*w);const e=k*k,t=x*x,r=E*E;A=p*e+f*t+d*r-1;j=A/(-2*(p*(e*k)*b+f*(t*x)*v+d*(r*E)*w))}while(Math.abs(A)>Js);return tu.scale([k,x,E]).to(r)}(e,this,t)}scaleToGeocentricSurface(e,t=[0,0,0]){mu.from(e);const r=mu.x,n=mu.y,i=mu.z,a=this.oneOverRadiiSquared,o=1/Math.sqrt(r*r*a.x+n*n*a.y+i*i*a.z);return mu.multiplyScalar(o).to(t)}transformPositionToScaledSpace(e,t=[0,0,0]){return mu.from(e).scale(this.oneOverRadii).to(t)}transformPositionFromScaledSpace(e,t=[0,0,0]){return mu.from(e).scale(this.radii).to(t)}getSurfaceNormalIntersectionWithZAxis(e,t=0,r=[0,0,0]){Xo(cs(this.radii.x,this.radii.y,Qs)),Xo(this.radii.z>0),mu.from(e);const n=mu.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(n)>=this.radii.z-t))return mu.set(0,0,n).to(r)}}const{_parseImageNode:wu}=globalThis,_u="undefined"!=typeof Image,ku="undefined"!=typeof ImageBitmap,xu=Boolean(wu),Eu=!!Oi||xu;function Au(e){const t=ju(e);if(!t)throw new Error("Not an image");return t}function Su(e){switch(Au(e)){case"data":return e;case"image":case"imagebitmap":const t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function ju(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?"imagebitmap":"undefined"!=typeof Image&&e instanceof Image?"image":e&&"object"==typeof e&&e.data&&e.width&&e.height?"data":null}const Tu=/^data:image\/svg\+xml/,Cu=/\.svg((\?|#).*)?$/;function Bu(e){return e&&(Tu.test(e)||Cu.test(e))}function Ru(e,t){if(Bu(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Ou(e,t,r){const n=function(e,t){if(Bu(t)){let t=(new TextDecoder).decode(e);try{"function"==typeof unescape&&"function"==typeof encodeURIComponent&&(t=unescape(encodeURIComponent(t)))}catch(e){throw new Error(e.message)}return"data:image/svg+xml;base64,"+btoa(t)}return Ru(e,t)}(e,r),i=self.URL||self.webkitURL,a="string"!=typeof n&&i.createObjectURL(n);try{return await async function(e,t){const r=new Image;if(r.src=e,t.image&&t.image.decode&&r.decode)return await r.decode(),r;return await new Promise((t,n)=>{try{r.onload=()=>t(r),r.onerror=t=>n(new Error(`Could not load image ${e}: ${t}`))}catch(e){n(e)}})}(a||n,t)}finally{a&&i.revokeObjectURL(a)}}const Iu={};let Pu=!0;async function Du(e,t,r){let n;if(Bu(r)){n=await Ou(e,t,r)}else n=Ru(e,r);const i=t&&t.imagebitmap;return await async function(e,t=null){!function(e){for(const t in e||Iu)return!1;return!0}(t)&&Pu||(t=null);if(t)try{return await createImageBitmap(e,t)}catch(e){console.warn(e),Pu=!1}return await createImageBitmap(e)}(n,i)}function Mu(e){const t=Fu(e);return function(e){const t=Fu(e);if(!(t.byteLength>=24&&2303741511===t.getUint32(0,!1)))return null;return{mimeType:"image/png",width:t.getUint32(16,!1),height:t.getUint32(20,!1)}}(t)||function(e){const t=Fu(e);if(!(t.byteLength>=3&&65496===t.getUint16(0,!1)&&255===t.getUint8(2)))return null;const{tableMarkers:r,sofMarkers:n}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let i=2;for(;i+9<t.byteLength;){const e=t.getUint16(i,!1);if(n.has(e))return{mimeType:"image/jpeg",height:t.getUint16(i+5,!1),width:t.getUint16(i+7,!1)};if(!r.has(e))return null;i+=2,i+=t.getUint16(i,!1)}return null}(t)||function(e){const t=Fu(e);if(!(t.byteLength>=10&&1195984440===t.getUint32(0,!1)))return null;return{mimeType:"image/gif",width:t.getUint16(6,!0),height:t.getUint16(8,!0)}}(t)||function(e){const t=Fu(e);if(!(t.byteLength>=14&&16973===t.getUint16(0,!1)&&t.getUint32(2,!0)===t.byteLength))return null;return{mimeType:"image/bmp",width:t.getUint32(18,!0),height:t.getUint32(22,!0)}}(t)}function Fu(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}const Lu={id:"image",module:"images",name:"Images",version:"3.2.7",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:async function(e,t,r){const n=((t=t||{}).image||{}).type||"auto",{url:i}=r||{};let a;switch(function(e){switch(e){case"auto":case"data":return function(){if(ku)return"imagebitmap";if(_u)return"image";if(Eu)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(e){switch(e){case"auto":return ku||_u||Eu;case"imagebitmap":return ku;case"image":return _u;case"data":return Eu;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}(e),e}}(n)){case"imagebitmap":a=await Du(e,t,i);break;case"image":a=await Ou(e,t,i);break;case"data":a=await async function(e,t){const{mimeType:r}=Mu(e)||{},n=globalThis._parseImageNode;return Hi(n),await n(e,r)}(e);break;default:Hi(!1)}return"data"===n&&(a=Su(a)),a},tests:[e=>Boolean(Mu(new DataView(e)))],options:{image:{type:"auto",decode:!0}}},Nu={name:"Draco",id:"draco",module:"draco",shapes:["mesh"],version:"3.2.7",worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:"object"==typeof WebAssembly?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function zu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Uu{constructor(e,t){zu(this,"fields",void 0),zu(this,"metadata",void 0),function(e,t){if(!e)throw new Error(t||"loader assertion failed.")}(Array.isArray(e)),function(e){const t={};for(const r of e)t[r.name]&&console.warn("Schema: duplicated field name",r.name,r),t[r.name]=!0}(e),this.fields=e,this.metadata=t||new Map}compareTo(e){if(this.metadata!==e.metadata)return!1;if(this.fields.length!==e.fields.length)return!1;for(let t=0;t<this.fields.length;++t)if(!this.fields[t].compareTo(e.fields[t]))return!1;return!0}select(...e){const t=Object.create(null);for(const r of e)t[r]=!0;const r=this.fields.filter(e=>t[e.name]);return new Uu(r,this.metadata)}selectAt(...e){const t=e.map(e=>this.fields[e]).filter(Boolean);return new Uu(t,this.metadata)}assign(e){let t,r=this.metadata;if(e instanceof Uu){const n=e;t=n.fields,r=qu(qu(new Map,this.metadata),n.metadata)}else t=e;const n=Object.create(null);for(const e of this.fields)n[e.name]=e;for(const e of t)n[e.name]=e;const i=Object.values(n);return new Uu(i,r)}}function qu(e,t){return new Map([...e||new Map,...t||new Map])}function Hu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Gu{constructor(e,t,r=!1,n=new Map){Hu(this,"name",void 0),Hu(this,"type",void 0),Hu(this,"nullable",void 0),Hu(this,"metadata",void 0),this.name=e,this.type=t,this.nullable=r,this.metadata=n}get typeId(){return this.type&&this.type.typeId}clone(){return new Gu(this.name,this.type,this.nullable,this.metadata)}compareTo(e){return this.name===e.name&&this.type===e.type&&this.nullable===e.nullable&&this.metadata===e.metadata}toString(){return`${this.type}${this.nullable?", nullable":""}${this.metadata?", metadata: "+this.metadata:""}`}}let Vu,Wu,Ku,Ju,Qu,Yu,$u,Xu,Zu;function ec(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"}(Vu||(Vu={}));class tc{static isNull(e){return e&&e.typeId===Vu.Null}static isInt(e){return e&&e.typeId===Vu.Int}static isFloat(e){return e&&e.typeId===Vu.Float}static isBinary(e){return e&&e.typeId===Vu.Binary}static isUtf8(e){return e&&e.typeId===Vu.Utf8}static isBool(e){return e&&e.typeId===Vu.Bool}static isDecimal(e){return e&&e.typeId===Vu.Decimal}static isDate(e){return e&&e.typeId===Vu.Date}static isTime(e){return e&&e.typeId===Vu.Time}static isTimestamp(e){return e&&e.typeId===Vu.Timestamp}static isInterval(e){return e&&e.typeId===Vu.Interval}static isList(e){return e&&e.typeId===Vu.List}static isStruct(e){return e&&e.typeId===Vu.Struct}static isUnion(e){return e&&e.typeId===Vu.Union}static isFixedSizeBinary(e){return e&&e.typeId===Vu.FixedSizeBinary}static isFixedSizeList(e){return e&&e.typeId===Vu.FixedSizeList}static isMap(e){return e&&e.typeId===Vu.Map}static isDictionary(e){return e&&e.typeId===Vu.Dictionary}get typeId(){return Vu.NONE}compareTo(e){return this===e}}Symbol.toStringTag;Symbol.toStringTag;Wu=Symbol.toStringTag;class rc extends tc{constructor(e,t){super(),ec(this,"isSigned",void 0),ec(this,"bitWidth",void 0),this.isSigned=e,this.bitWidth=t}get typeId(){return Vu.Int}get[Wu](){return"Int"}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}class nc extends rc{constructor(){super(!0,8)}}class ic extends rc{constructor(){super(!0,16)}}class ac extends rc{constructor(){super(!0,32)}}class oc extends rc{constructor(){super(!1,8)}}class sc extends rc{constructor(){super(!1,16)}}class uc extends rc{constructor(){super(!1,32)}}const cc=32,lc=64;Ku=Symbol.toStringTag;class hc extends tc{constructor(e){super(),ec(this,"precision",void 0),this.precision=e}get typeId(){return Vu.Float}get[Ku](){return"Float"}toString(){return"Float"+this.precision}}class pc extends hc{constructor(){super(cc)}}class fc extends hc{constructor(){super(lc)}}Symbol.toStringTag;Symbol.toStringTag;Ju=Symbol.toStringTag;Qu=Symbol.toStringTag;Yu=Symbol.toStringTag;$u=Symbol.toStringTag;Xu=Symbol.toStringTag;class dc extends tc{constructor(e,t){super(),ec(this,"listSize",void 0),ec(this,"children",void 0),this.listSize=e,this.children=[t]}get typeId(){return Vu.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[Xu](){return"FixedSizeList"}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}Zu=Symbol.toStringTag;function mc(e,t,r){const n=function(e){switch(e.constructor){case Int8Array:return new nc;case Uint8Array:return new oc;case Int16Array:return new ic;case Uint16Array:return new sc;case Int32Array:return new ac;case Uint32Array:return new uc;case Float32Array:return new pc;case Float64Array:return new fc;default:throw new Error("array type not supported")}}(t.value),i=r||function(e){const t=new Map;"byteOffset"in e&&t.set("byteOffset",e.byteOffset.toString(10));"byteStride"in e&&t.set("byteStride",e.byteStride.toString(10));"normalized"in e&&t.set("normalized",e.normalized.toString());return t}(t);return new Gu(e,new dc(t.size,new Gu("value",n)),!1,i)}function gc(e,t,r){return mc(e,t,r?yc(r.metadata):void 0)}function yc(e){const t=new Map;for(const r in e)t.set(r+".string",JSON.stringify(e[r]));return t}function bc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const vc={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},wc={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class _c{constructor(e){bc(this,"draco",void 0),bc(this,"decoder",void 0),bc(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,t={}){const r=new this.draco.DecoderBuffer;r.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(t);const n=this.decoder.GetEncodedGeometryType(r),i=n===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let e;switch(n){case this.draco.TRIANGULAR_MESH:e=this.decoder.DecodeBufferToMesh(r,i);break;case this.draco.POINT_CLOUD:e=this.decoder.DecodeBufferToPointCloud(r,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!e.ok()||!i.ptr){const t="DRACO decompression failed: "+e.error_msg();throw new Error(t)}const a=this._getDracoLoaderData(i,n,t),o=this._getMeshData(i,a,t),s=function(e){let t=1/0,r=1/0,n=1/0,i=-1/0,a=-1/0,o=-1/0;const s=e.POSITION?e.POSITION.value:[],u=s&&s.length;for(let e=0;e<u;e+=3){const u=s[e],c=s[e+1],l=s[e+2];t=u<t?u:t,r=c<r?c:r,n=l<n?l:n,i=u>i?u:i,a=c>a?c:a,o=l>o?l:o}return[[t,r,n],[i,a,o]]}(o.attributes),u=function(e,t,r){const n=yc(t.metadata),i=[],a=function(e){const t={};for(const r in e){const n=e[r];t[n.name||"undefined"]=n}return t}(t.attributes);for(const t in e){const r=gc(t,e[t],a[t]);i.push(r)}if(r){const e=gc("indices",r);i.push(e)}return new Uu(i,n)}(o.attributes,a,o.indices);return{loader:"draco",loaderData:a,header:{vertexCount:i.num_points(),boundingBox:s},...o,schema:u}}finally{this.draco.destroy(r),i&&this.draco.destroy(i)}}_getDracoLoaderData(e,t,r){const n=this._getTopLevelMetadata(e),i=this._getDracoAttributes(e,r);return{geometry_type:t,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:n,attributes:i}}_getDracoAttributes(e,t){const r={};for(let n=0;n<e.num_attributes();n++){const i=this.decoder.GetAttribute(e,n),a=this._getAttributeMetadata(e,n);r[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:n,metadata:a};const o=this._getQuantizationTransform(i,t);o&&(r[i.unique_id()].quantization_transform=o);const s=this._getOctahedronTransform(i,t);s&&(r[i.unique_id()].octahedron_transform=s)}return r}_getMeshData(e,t,r){const n=this._getMeshAttributes(t,e,r);if(!n.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:n,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:n,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:n}}_getMeshAttributes(e,t,r){const n={};for(const i of Object.values(e.attributes)){const e=this._deduceAttributeName(i,r);i.name=e;const{value:a,size:o}=this._getAttributeValues(t,i);n[e]={value:a,size:o,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}return n}_getTriangleListIndices(e){const t=3*e.num_faces(),r=4*t,n=this.draco._malloc(r);try{return this.decoder.GetTrianglesUInt32Array(e,r,n),new Uint32Array(this.draco.HEAPF32.buffer,n,t).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(e){const t=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,t),function(e){const t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}(t)}finally{this.draco.destroy(t)}}_getAttributeValues(e,t){const r=wc[t.data_type],n=t.num_components,i=e.num_points()*n,a=i*r.BYTES_PER_ELEMENT,o=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32;default:return e.DT_INVALID}}(this.draco,r);let s;const u=this.draco._malloc(a);try{const n=this.decoder.GetAttribute(e,t.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,n,o,a,u),s=new r(this.draco.HEAPF32.buffer,u,i).slice()}finally{this.draco._free(u)}return{value:s,size:n}}_deduceAttributeName(e,t){const r=e.unique_id;for(const[e,n]of Object.entries(t.extraAttributes||{}))if(n===r)return e;const n=e.attribute_type;for(const e in vc){if(this.draco[e]===n)return vc[e]}const i=t.attributeNameEntry||"name";return e.metadata[i]?e.metadata[i].string:"CUSTOM_ATTRIBUTE_"+r}_getTopLevelMetadata(e){const t=this.decoder.GetMetadata(e);return this._getDracoMetadata(t)}_getAttributeMetadata(e,t){const r=this.decoder.GetAttributeMetadata(e,t);return this._getDracoMetadata(r)}_getDracoMetadata(e){if(!e||!e.ptr)return{};const t={},r=this.metadataQuerier.NumEntries(e);for(let n=0;n<r;n++){const r=this.metadataQuerier.GetEntryName(e,n);t[r]=this._getDracoMetadataField(e,r)}return t}_getDracoMetadataField(e,t){const r=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,t,r);const n=function(e){const t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}(r);return{int:this.metadataQuerier.GetIntEntry(e,t),string:this.metadataQuerier.GetStringEntry(e,t),double:this.metadataQuerier.GetDoubleEntry(e,t),intArray:n}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(e){const{quantizedAttributes:t=[],octahedronAttributes:r=[]}=e,n=[...t,...r];for(const e of n)this.decoder.SkipAttributeTransform(this.draco[e])}_getQuantizationTransform(e,t){const{quantizedAttributes:r=[]}=t,n=e.attribute_type();if(r.map(e=>this.decoder[e]).includes(n)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits(),range:t.range(),min_values:new Float32Array([1,2,3]).map(e=>t.min_value(e))}}finally{this.draco.destroy(t)}}return null}_getOctahedronTransform(e,t){const{octahedronAttributes:r=[]}=t,n=e.attribute_type();if(r.map(e=>this.decoder[e]).includes(n)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits()}}finally{this.draco.destroy(t)}}return null}}var kc=r(51);const xc={};async function Ec(e,t=null,r={}){return t&&(e=function(e,t,r){if(e.startsWith("http"))return e;const n=r.modules||{};if(n[e])return n[e];if(!wa)return`modules/${t}/dist/libs/${e}`;if(r.CDN)return ya(r.CDN.startsWith("http")),`${r.CDN}/${t}@3.2.7/dist/libs/${e}`;if(_a)return"../src/libs/"+e;return`modules/${t}/src/libs/${e}`}(e,t,r)),xc[e]=xc[e]||async function(e){if(e.endsWith("wasm")){const t=await fetch(e);return await t.arrayBuffer()}if(!wa)try{return kc&&kc.requireFromFile&&await kc.requireFromFile(e)}catch{return null}if(_a)return importScripts(e);const t=await fetch(e);return function(e,t){if(!wa)return kc.requireFromString&&kc.requireFromString(e,t);if(_a)return eval.call(va,e),null;const r=document.createElement("script");r.id=t;try{r.appendChild(document.createTextNode(e))}catch(t){r.text=e}return document.body.appendChild(r),null}(await t.text(),e)}(e),await xc[e]}let Ac;async function Sc(e){const t=e.modules||{};return Ac=t.draco3d?Ac||t.draco3d.createDecoderModule({}).then(e=>({draco:e})):Ac||async function(e){let t,r;switch(e.draco&&e.draco.decoderType){case"js":t=await Ec("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.js","draco",e);break;case"wasm":default:[t,r]=await Promise.all([await Ec("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_wasm_wrapper.js","draco",e),await Ec("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.wasm","draco",e)])}return t=t||globalThis.DracoDecoderModule,await function(e,t){const r={};t&&(r.wasmBinary=t);return new Promise(t=>{e({...r,onModuleLoaded:e=>t({draco:e})})})}(t,r)}(e),await Ac}const jc={id:wa?"draco-writer":"draco-writer-nodejs",name:"Draco compressed geometry writer",module:"draco",version:"3.2.7",worker:!0,options:{draco:{},source:null}},Tc={...Nu,parse:async function(e,t){const{draco:r}=await Sc(t),n=new _c(r);try{return n.parseSync(e,null==t?void 0:t.draco)}finally{n.destroy()}}};new Uint8Array([0]);const Cc=[171,75,84,88,32,50,48,187,13,10,26,10];var Bc,Rc,Oc,Ic,Pc,Dc,Mc,Fc,Lc;(Lc=Bc||(Bc={}))[Lc.NONE=0]="NONE",Lc[Lc.BASISLZ=1]="BASISLZ",Lc[Lc.ZSTD=2]="ZSTD",Lc[Lc.ZLIB=3]="ZLIB",function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(Rc||(Rc={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(Oc||(Oc={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(Ic||(Ic={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(Pc||(Pc={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(Dc||(Dc={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(Mc||(Mc={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(Fc||(Fc={}));class Nc{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=Bc.NONE,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:Rc.BASICFORMAT,versionNumber:2,descriptorBlockSize:40,colorModel:Oc.UNSPECIFIED,colorPrimaries:Ic.SRGB,transferFunction:Ic.SRGB,flags:Dc.ALPHA_STRAIGHT,texelBlockDimension:{x:4,y:4,z:1,w:1},bytesPlane:[],samples:[]}],this.keyValue={},this.globalData=null}}class zc{constructor(e,t,r,n){this._dataView=new DataView(e.buffer,e.byteOffset+t,r),this._littleEndian=n,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const r=this._offset;let n=0;for(;this._dataView.getUint8(this._offset)!==t&&n<e;)n++,this._offset++;return n<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,n)}}function Uc(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):Buffer.from(e).toString("utf8")}function qc(e,t){const r=new Array(t.mipMapLevels);let n=t.width,i=t.height,a=0;for(let o=0;o<t.mipMapLevels;++o){const s=Gc(t,n,i,e,o),u=Hc(e,o,a,s);r[o]={compressed:!0,format:t.internalFormat,data:u,width:n,height:i,levelSize:s},n=Math.max(1,n>>1),i=Math.max(1,i>>1),a+=s}return r}function Hc(e,t,r,n){return Array.isArray(e)?e[t].levelData:new Uint8Array(e.buffer,e.byteOffset+r,n)}function Gc(e,t,r,n,i){return Array.isArray(n)?e.sizeFunction(n[i]):e.sizeFunction(t,r)}const Vc={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},Wc={131:Vc.COMPRESSED_RGB_S3TC_DXT1_EXT,132:Vc.COMPRESSED_SRGB_S3TC_DXT1_EXT,133:Vc.COMPRESSED_RGBA_S3TC_DXT1_EXT,134:Vc.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,135:Vc.COMPRESSED_RGBA_S3TC_DXT3_EXT,136:Vc.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,137:Vc.COMPRESSED_RGBA_S3TC_DXT5_EXT,138:Vc.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,139:Vc.COMPRESSED_RED_RGTC1_EXT,140:Vc.COMPRESSED_SIGNED_RED_RGTC1_EXT,141:Vc.COMPRESSED_RED_GREEN_RGTC2_EXT,142:Vc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,147:Vc.COMPRESSED_RGB8_ETC2,148:Vc.COMPRESSED_SRGB8_ETC2,149:Vc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,150:Vc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,151:Vc.COMPRESSED_RGBA8_ETC2_EAC,152:Vc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,153:Vc.COMPRESSED_R11_EAC,154:Vc.COMPRESSED_SIGNED_R11_EAC,155:Vc.COMPRESSED_RG11_EAC,156:Vc.COMPRESSED_SIGNED_RG11_EAC,157:Vc.COMPRESSED_RGBA_ASTC_4x4_KHR,158:Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,159:Vc.COMPRESSED_RGBA_ASTC_5x4_KHR,160:Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,161:Vc.COMPRESSED_RGBA_ASTC_5x5_KHR,162:Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,163:Vc.COMPRESSED_RGBA_ASTC_6x5_KHR,164:Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,165:Vc.COMPRESSED_RGBA_ASTC_6x6_KHR,166:Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,167:Vc.COMPRESSED_RGBA_ASTC_8x5_KHR,168:Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,169:Vc.COMPRESSED_RGBA_ASTC_8x6_KHR,170:Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,171:Vc.COMPRESSED_RGBA_ASTC_8x8_KHR,172:Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,173:Vc.COMPRESSED_RGBA_ASTC_10x5_KHR,174:Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,175:Vc.COMPRESSED_RGBA_ASTC_10x6_KHR,176:Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,177:Vc.COMPRESSED_RGBA_ASTC_10x8_KHR,178:Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,179:Vc.COMPRESSED_RGBA_ASTC_10x10_KHR,180:Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,181:Vc.COMPRESSED_RGBA_ASTC_12x10_KHR,182:Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,183:Vc.COMPRESSED_RGBA_ASTC_12x12_KHR,184:Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,1000054e3:Vc.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,1000054001:Vc.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,1000066e3:Vc.COMPRESSED_RGBA_ASTC_4x4_KHR,1000066001:Vc.COMPRESSED_RGBA_ASTC_5x4_KHR,1000066002:Vc.COMPRESSED_RGBA_ASTC_5x5_KHR,1000066003:Vc.COMPRESSED_RGBA_ASTC_6x5_KHR,1000066004:Vc.COMPRESSED_RGBA_ASTC_6x6_KHR,1000066005:Vc.COMPRESSED_RGBA_ASTC_8x5_KHR,1000066006:Vc.COMPRESSED_RGBA_ASTC_8x6_KHR,1000066007:Vc.COMPRESSED_RGBA_ASTC_8x8_KHR,1000066008:Vc.COMPRESSED_RGBA_ASTC_10x5_KHR,1000066009:Vc.COMPRESSED_RGBA_ASTC_10x6_KHR,1000066010:Vc.COMPRESSED_RGBA_ASTC_10x8_KHR,1000066011:Vc.COMPRESSED_RGBA_ASTC_10x10_KHR,1000066012:Vc.COMPRESSED_RGBA_ASTC_12x10_KHR,1000066013:Vc.COMPRESSED_RGBA_ASTC_12x12_KHR};const Kc=[171,75,84,88,32,50,48,187,13,10,26,10];function Jc(e){const t=new Uint8Array(e);return!(t.byteLength<Kc.length||t[0]!==Kc[0]||t[1]!==Kc[1]||t[2]!==Kc[2]||t[3]!==Kc[3]||t[4]!==Kc[4]||t[5]!==Kc[5]||t[6]!==Kc[6]||t[7]!==Kc[7]||t[8]!==Kc[8]||t[9]!==Kc[9]||t[10]!==Kc[10]||t[11]!==Kc[11])}function Qc(e){const t=function(e){const t=new Uint8Array(e.buffer,e.byteOffset,Cc.length);if(t[0]!==Cc[0]||t[1]!==Cc[1]||t[2]!==Cc[2]||t[3]!==Cc[3]||t[4]!==Cc[4]||t[5]!==Cc[5]||t[6]!==Cc[6]||t[7]!==Cc[7]||t[8]!==Cc[8]||t[9]!==Cc[9]||t[10]!==Cc[10]||t[11]!==Cc[11])throw new Error("Missing KTX 2.0 identifier.");const r=new Nc,n=17*Uint32Array.BYTES_PER_ELEMENT,i=new zc(e,Cc.length,n,!0);r.vkFormat=i._nextUint32(),r.typeSize=i._nextUint32(),r.pixelWidth=i._nextUint32(),r.pixelHeight=i._nextUint32(),r.pixelDepth=i._nextUint32(),r.layerCount=i._nextUint32(),r.faceCount=i._nextUint32();const a=i._nextUint32();r.supercompressionScheme=i._nextUint32();const o=i._nextUint32(),s=i._nextUint32(),u=i._nextUint32(),c=i._nextUint32(),l=i._nextUint64(),h=i._nextUint64(),p=new zc(e,Cc.length+n,3*a*8,!0);for(let t=0;t<a;t++)r.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+p._nextUint64(),p._nextUint64()),uncompressedByteLength:p._nextUint64()});const f=new zc(e,o,s,!0),d={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:{x:f._nextUint8()+1,y:f._nextUint8()+1,z:f._nextUint8()+1,w:f._nextUint8()+1},bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},m=(d.descriptorBlockSize/4-6)/4;for(let e=0;e<m;e++)d.samples[e]={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelID:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:f._nextUint32(),sampleUpper:f._nextUint32()};r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(d);const g=new zc(e,u,c,!0);for(;g._offset<c;){const e=g._nextUint32(),t=g._scan(e),n=Uc(t),i=g._scan(e-t.byteLength);r.keyValue[n]=n.match(/^ktx/i)?Uc(i):i,e%4&&g._skip(4-e%4)}if(h<=0)return r;const y=new zc(e,l,h,!0),b=y._nextUint16(),v=y._nextUint16(),w=y._nextUint32(),_=y._nextUint32(),k=y._nextUint32(),x=y._nextUint32(),E=[];for(let e=0;e<a;e++)E.push({imageFlags:y._nextUint32(),rgbSliceByteOffset:y._nextUint32(),rgbSliceByteLength:y._nextUint32(),alphaSliceByteOffset:y._nextUint32(),alphaSliceByteLength:y._nextUint32()});const A=l+y._offset,S=A+w,j=S+_,T=j+k,C=new Uint8Array(e.buffer,e.byteOffset+A,w),B=new Uint8Array(e.buffer,e.byteOffset+S,_),R=new Uint8Array(e.buffer,e.byteOffset+j,k),O=new Uint8Array(e.buffer,e.byteOffset+T,x);return r.globalData={endpointCount:b,selectorCount:v,imageDescs:E,endpointsData:C,selectorsData:B,tablesData:R,extendedData:O},r}(new Uint8Array(e)),r=Math.max(1,t.levels.length),n=t.pixelWidth,i=t.pixelHeight,a=(o=t.vkFormat,Wc[o]);var o;return qc(t.levels,{mipMapLevels:r,width:n,height:i,sizeFunction:e=>e.uncompressedByteLength,internalFormat:a})}const Yc=542327876,$c=31,Xc=0,Zc=1,el=2,tl=3,rl=4,nl=7,il=20,al=21,ol=131072,sl=4,ul={DXT1:Vc.COMPRESSED_RGB_S3TC_DXT1_EXT,DXT3:Vc.COMPRESSED_RGBA_S3TC_DXT3_EXT,DXT5:Vc.COMPRESSED_RGBA_S3TC_DXT5_EXT,"ATC ":Vc.COMPRESSED_RGB_ATC_WEBGL,ATCA:Vc.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,ATCI:Vc.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL},cl={DXT1:hl,DXT3:pl,DXT5:pl,"ATC ":hl,ATCA:pl,ATCI:pl};function ll(e){const t=new Int32Array(e,0,$c),r=t[al];Hi(Boolean(t[il]&sl),"DDS: Unsupported format, must contain a FourCC code");const n=(i=r,String.fromCharCode(255&i,i>>8&255,i>>16&255,i>>24&255));var i;const a=ul[n],o=cl[n];Hi(a&&o,"DDS: Unknown pixel format "+r);let s=1;t[el]&ol&&(s=Math.max(1,t[nl]));const u=t[rl],c=t[tl],l=t[Zc]+4;return qc(new Uint8Array(e,l),{mipMapLevels:s,width:u,height:c,sizeFunction:o,internalFormat:a})}function hl(e,t){return(e+3>>2)*(t+3>>2)*8}function pl(e,t){return(e+3>>2)*(t+3>>2)*16}const fl=55727696,dl=1347834371,ml=13,gl=52,yl=0,bl=2,vl=4,wl=6,_l=7,kl=11,xl=12,El={0:[Vc.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],1:[Vc.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],2:[Vc.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],3:[Vc.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],6:[Vc.COMPRESSED_RGB_ETC1_WEBGL],7:[Vc.COMPRESSED_RGB_S3TC_DXT1_EXT],9:[Vc.COMPRESSED_RGBA_S3TC_DXT3_EXT],11:[Vc.COMPRESSED_RGBA_S3TC_DXT5_EXT],22:[Vc.COMPRESSED_RGB8_ETC2],23:[Vc.COMPRESSED_RGBA8_ETC2_EAC],24:[Vc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],25:[Vc.COMPRESSED_R11_EAC],26:[Vc.COMPRESSED_RG11_EAC],27:[Vc.COMPRESSED_RGBA_ASTC_4X4_KHR,Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR],28:[Vc.COMPRESSED_RGBA_ASTC_5X4_KHR,Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR],29:[Vc.COMPRESSED_RGBA_ASTC_5X5_KHR,Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR],30:[Vc.COMPRESSED_RGBA_ASTC_6X5_KHR,Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR],31:[Vc.COMPRESSED_RGBA_ASTC_6X6_KHR,Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR],32:[Vc.COMPRESSED_RGBA_ASTC_8X5_KHR,Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR],33:[Vc.COMPRESSED_RGBA_ASTC_8X6_KHR,Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR],34:[Vc.COMPRESSED_RGBA_ASTC_8X8_KHR,Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR],35:[Vc.COMPRESSED_RGBA_ASTC_10X5_KHR,Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR],36:[Vc.COMPRESSED_RGBA_ASTC_10X6_KHR,Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR],37:[Vc.COMPRESSED_RGBA_ASTC_10X8_KHR,Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR],38:[Vc.COMPRESSED_RGBA_ASTC_10X10_KHR,Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR],39:[Vc.COMPRESSED_RGBA_ASTC_12X10_KHR,Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR],40:[Vc.COMPRESSED_RGBA_ASTC_12X12_KHR,Vc.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR]},Al={0:Sl,1:Sl,2:jl,3:jl,6:Tl,7:Tl,9:Cl,11:Cl,22:Tl,23:Cl,24:Tl,25:Tl,26:Cl,27:Cl,28:function(e,t){return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16},29:function(e,t){return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16},30:function(e,t){return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16},31:function(e,t){return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16},32:function(e,t){return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16},33:function(e,t){return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16},34:function(e,t){return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16},35:function(e,t){return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16},36:function(e,t){return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16},37:function(e,t){return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16},38:function(e,t){return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16},39:function(e,t){return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16},40:function(e,t){return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16}};function Sl(e,t){return(e=Math.max(e,16))*(t=Math.max(t,8))/4}function jl(e,t){return(e=Math.max(e,8))*(t=Math.max(t,8))/2}function Tl(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8}function Cl(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16}function Bl(e){if(Jc(e))return Qc(e);if(function(e){return new Uint32Array(e,0,$c)[Xc]===Yc}(e))return ll(e);if(function(e){const t=new Uint32Array(e,0,ml)[yl];return t===fl||t===dl}(e))return function(e){const t=new Uint32Array(e,0,ml),r=t[bl],n=t[vl],i=El[r]||[],a=i.length>1&&n?i[1]:i[0],o=Al[r],s=t[kl],u=t[_l],c=t[wl],l=gl+t[xl];return qc(new Uint8Array(e,l),{mipMapLevels:s,width:u,height:c,sizeFunction:o,internalFormat:a})}(e);throw new Error("Texture container format not recognized")}let Rl,Ol;async function Il(e){const t=e.modules||{};return t.basis?t.basis:(Rl=Rl||async function(e){let t=null,r=null;return[t,r]=await Promise.all([await Ec("basis_transcoder.js","textures",e),await Ec("basis_transcoder.wasm","textures",e)]),t=t||globalThis.BASIS,await function(e,t){const r={};t&&(r.wasmBinary=t);return new Promise(t=>{e(r).then(e=>{const{BasisFile:r,initializeBasis:n}=e;n(),t({BasisFile:r})})})}(t,r)}(e),await Rl)}async function Pl(e){const t=e.modules||{};return t.basisEncoder?t.basisEncoder:(Ol=Ol||async function(e){let t=null,r=null;return[t,r]=await Promise.all([await Ec("https://unpkg.com/@loaders.gl/textures@3.2.7/dist/libs/basis_encoder.js","textures",e),await Ec("https://unpkg.com/@loaders.gl/textures@3.2.7/dist/libs/basis_encoder.wasm","textures",e)]),t=t||globalThis.BASIS,await function(e,t){const r={};t&&(r.wasmBinary=t);return new Promise(t=>{e(r).then(e=>{const{BasisFile:r,KTX2File:n,initializeBasis:i,BasisEncoder:a}=e;i(),t({BasisFile:r,KTX2File:n,BasisEncoder:a})})})}(t,r)}(e),await Ol)}const Dl=["","WEBKIT_","MOZ_"],Ml={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"};let Fl=null;function Ll(e){if(!Fl){e=e||function(){try{return document.createElement("canvas").getContext("webgl")}catch(e){return null}}()||void 0,Fl=new Set;for(const t of Dl)for(const r in Ml)if(e&&e.getExtension(`${t}${r}`)){const e=Ml[r];Fl.add(e)}}return Fl}const Nl={etc1:{basisFormat:0,compressed:!0,format:Vc.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Vc.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:Vc.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:Vc.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Vc.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:Vc.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 zl(e,t){if("auto"===t.basis.containerFormat){if(Jc(e)){return Hl((await Pl(t)).KTX2File,e,t)}const{BasisFile:r}=await Il(t);return Ul(r,e,t)}switch(t.basis.module){case"encoder":const r=await Pl(t);switch(t.basis.containerFormat){case"ktx2":return Hl(r.KTX2File,e,t);case"basis":default:return Ul(r.BasisFile,e,t)}case"transcoder":default:const{BasisFile:n}=await Il(t);return Ul(n,e,t)}}function Ul(e,t,r){const n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("Failed to start basis transcoding");const e=n.getNumImages(),t=[];for(let i=0;i<e;i++){const e=n.getNumLevels(i),a=[];for(let t=0;t<e;t++)a.push(ql(n,i,t,r));t.push(a)}return t}finally{n.close(),n.delete()}}function ql(e,t,r,n){const i=e.getImageWidth(t,r),a=e.getImageHeight(t,r),o=e.getHasAlpha(),{compressed:s,format:u,basisFormat:c}=Vl(n,o),l=e.getImageTranscodedSizeInBytes(t,r,c),h=new Uint8Array(l);if(!e.transcodeImage(h,t,r,c,0,0))throw new Error("failed to start Basis transcoding");return{width:i,height:a,data:h,compressed:s,format:u,hasAlpha:o}}function Hl(e,t,r){const n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("failed to start KTX2 transcoding");const e=n.getLevels(),t=[];for(let i=0;i<e;i++){t.push(Gl(n,i,r));break}return[t]}finally{n.close(),n.delete()}}function Gl(e,t,r){const{alphaFlag:n,height:i,width:a}=e.getImageLevelInfo(t,0,0),{compressed:o,format:s,basisFormat:u}=Vl(r,n),c=e.getImageTranscodedSizeInBytes(t,0,0,u),l=new Uint8Array(c);if(!e.transcodeImage(l,t,0,0,u,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:a,height:i,data:l,compressed:o,hasAlpha:n,format:s}}function Vl(e,t){let r=e&&e.basis&&e.basis.format;return"auto"===r&&(r=Wl()),"object"==typeof r&&(r=t?r.alpha:r.noAlpha),r=r.toLowerCase(),Nl[r]}function Wl(){const e=Ll();return e.has("astc")?"astc-4x4":e.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:e.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:e.has("etc1")?"etc1":e.has("etc2")?"etc2":"rgb565"}const Kl={name:"Texture Containers",id:"compressed-texture",module:"textures",version:"3.2.7",worker:!0,extensions:["ktx","ktx2","dds","pvr"],mimeTypes:["image/ktx2","image/ktx","image/vnd-ms.dds","image/x-dds","application/octet-stream"],binary:!0,options:{"compressed-texture":{libraryPath:"libs/",useBasis:!1}}},Jl={...Kl,parse:async(e,t)=>t["compressed-texture"].useBasis?(t.basis={format:{alpha:"BC3",noAlpha:"BC1"},...t.basis,containerFormat:"ktx2",module:"encoder"},(await zl(e,t))[0]):Bl(e)},Ql={name:"Basis",id:"basis",module:"textures",version:"3.2.7",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"}}},Yl={...Ql,parse:zl};let $l,Xl;function Zl(e,t=null){return t?`${e}?token=${t}`:e}!function(e){e.UInt8="UInt8",e.UInt16="UInt16",e.UInt32="UInt32",e.UInt64="UInt64",e.Int16="Int16",e.Int32="Int32",e.Int64="Int64",e.Float32="Float32",e.Float64="Float64"}($l||($l={})),function(e){e.vertexCount="vertexCount",e.featureCount="featureCount"}(Xl||(Xl={}));var eh=5121,th=5125,rh=5126,nh=5130;function ih(e){switch(e){case $l.UInt8:return Uint8Array;case $l.UInt16:return Uint16Array;case $l.UInt32:return Uint32Array;case $l.Float32:return Float32Array;case $l.UInt64:return Float64Array;default:throw new Error("parse i3s tile content: unknown type of data: "+e)}}const ah={UInt8:eh,UInt16:th,Float32:rh,UInt32:th,UInt64:nh};function oh(e){switch(e){case $l.UInt8:return 1;case $l.UInt16:case $l.Int16:return 2;case $l.UInt32:case $l.Int32:case $l.Float32:return 4;case $l.UInt64:case $l.Int64:case $l.Float64:return 8;default:throw new Error("parse i3s tile content: unknown size of data: "+e)}}let sh;!function(e){e[e.DEFAULT=-1]="DEFAULT",e[e.LNGLAT=1]="LNGLAT",e[e.METER_OFFSETS=2]="METER_OFFSETS",e[e.LNGLAT_OFFSETS=3]="LNGLAT_OFFSETS",e[e.CARTESIAN=0]="CARTESIAN"}(sh||(sh={}));const uh=new Is([0,0,0]);async function ch(e,t,r,n,i){if(t.content=t.content||{},t.content.featureIds=t.content.featureIds||null,t.content.attributes={},t.textureUrl){var a;const e=Zl(t.textureUrl,null==n||null===(a=n.i3s)||void 0===a?void 0:a.token),r=function(e){switch(e){case"ktx-etc2":case"dds":return Jl;case"ktx2":return Yl;case"jpg":case"png":default:return Lu}}(t.textureFormat),o=await fetch(e,null==n?void 0:n.fetch),s=await o.arrayBuffer();if(null!=n&&n.i3s.decodeTextures){if(r===Lu){const e={...t.textureLoaderOptions,image:{type:"data"}};try{t.content.texture=await i.parse(s,e)}catch(n){t.content.texture=await Yo(s,r,e)}}else if(r===Jl||r===Yl){let e=await $o(s,r,t.textureLoaderOptions);r===Yl&&(e=e[0]),t.content.texture={compressed:!0,mipmaps:!1,width:e[0].width,height:e[0].height,data:e}}}else t.content.texture=s}return t.content.material=function(e,t){let r;e?r={...e,pbrMetallicRoughness:e.pbrMetallicRoughness?{...e.pbrMetallicRoughness}:{baseColorFactor:[255,255,255,255]}}:(r={pbrMetallicRoughness:{}},t?r.pbrMetallicRoughness.baseColorTexture={texCoord:0}:r.pbrMetallicRoughness.baseColorFactor=[255,255,255,255]);r.alphaCutoff=r.alphaCutoff||.25,r.alphaMode&&(r.alphaMode=r.alphaMode.toUpperCase());r.emissiveFactor&&(r.emissiveFactor=fh(r.emissiveFactor));r.pbrMetallicRoughness&&r.pbrMetallicRoughness.baseColorFactor&&(r.pbrMetallicRoughness.baseColorFactor=fh(r.pbrMetallicRoughness.baseColorFactor));t&&function(e,t){const r={source:{image:t}};e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture?e.pbrMetallicRoughness.baseColorTexture={...e.pbrMetallicRoughness.baseColorTexture,texture:r}:e.emissiveTexture?e.emissiveTexture={...e.emissiveTexture,texture:r}:e.pbrMetallicRoughness&&e.pbrMetallicRoughness.metallicRoughnessTexture?e.pbrMetallicRoughness.metallicRoughnessTexture={...e.pbrMetallicRoughness.metallicRoughnessTexture,texture:r}:e.normalTexture?e.normalTexture={...e.normalTexture,texture:r}:e.occlusionTexture&&(e.occlusionTexture={...e.occlusionTexture,texture:r})}(r,t);return r}(t.materialDefinition,t.content.texture),t.content.material&&(t.content.texture=null),await async function(e,t,r,n){var i;if(!t.content)return t;const a=t.content,o=e.byteLength;let s,u,c,l=0,h=0;if(t.isDracoGeometry){var p;const t=await Yo(e,Tc,{draco:{attributeNameEntry:"i3s-attribute-type"}});u=t.header.vertexCount,c=null===(p=t.indices)||void 0===p?void 0:p.value;const{POSITION:r,NORMAL:n,COLOR_0:i,TEXCOORD_0:a,"feature-index":o,"uv-region":l}=t.attributes;s={position:r,normal:n,color:i,uv0:a,uvRegion:l,id:o},function(e,t){for(const r in t.loaderData.attributes){const n=t.loaderData.attributes[r];switch(n.name){case"POSITION":e.position.metadata=n.metadata;break;case"feature-index":e.id.metadata=n.metadata}}}(s,t);const h=function(e){var t,r;return null==e||null===(t=e.metadata)||void 0===t||null===(r=t["i3s-feature-ids"])||void 0===r?void 0:r.intArray}(o);h&&function(e,t){const r=e.id.value,n=new Float32Array(r.length);for(let e=0;e<r.length;e++)n[e]=t[r[e]];e.id.value=n}(s,h)}else{const{vertexAttributes:t,ordering:n,featureAttributes:i,featureAttributeOrder:a}=r.store.defaultGeometrySchema,o=function(e,t){let r=0,n=0,i=0;for(const{property:a,type:o}of e.store.defaultGeometrySchema.header){const e=ih(o);switch(a){case Xl.vertexCount:n=new e(t,0,4)[0],r+=oh(o);break;case Xl.featureCount:i=new e(t,4,4)[0],r+=oh(o)}}return{vertexCount:n,featureCount:i,byteOffset:r}}(r,e);l=o.byteOffset,u=o.vertexCount,h=o.featureCount;const{attributes:c,byteOffset:p}=hh(e,l,t,u,n),{attributes:f}=hh(e,p,i,h,a);!function(e){const{id:t,faceRange:r}=e;if(!t||!r)return;const n=t.value,i=r.value,a=i[i.length-1]+1,o=new Uint32Array(3*a);let s=0,u=0;for(let e=1;e<i.length;e+=2){const t=Number(n[s]),r=i[e],a=i[e-1],c=u+3*(r-a+1);o.fill(t,u,c),s++,u=c}e.id.value=o}(f),s=function(e,t){return{...e,...t}}(c,f)}if(null!=n&&null!==(i=n.i3s)&&void 0!==i&&i.coordinateSystem&&n.i3s.coordinateSystem!==sh.METER_OFFSETS)a.modelMatrix=function(e){var t,r;const n=e.metadata,i=(null==n||null===(t=n["i3s-scale_x"])||void 0===t?void 0:t.double)||1,a=(null==n||null===(r=n["i3s-scale_y"])||void 0===r?void 0:r.double)||1,o=new Ws;return o[0]=i,o[5]=a,o}(s.position),a.coordinateSystem=sh.LNGLAT_OFFSETS;else{const e=function(e,t){const r=t.mbs,n=e.value,i=e.metadata,a=new Ws,o=new Is(r[0],r[1],r[2]),s=new Is;return vu.WGS84.cartographicToCartesian(o,s),vu.WGS84.eastNorthUpToFixedFrame(s,a),e.value=function(e,t={},r){const n=new Float64Array(e.length),i=t["i3s-scale_x"]&&t["i3s-scale_x"].double||1,a=t["i3s-scale_y"]&&t["i3s-scale_y"].double||1;for(let t=0;t<n.length;t+=3)n[t]=e[t]*i+r.x,n[t+1]=e[t+1]*a+r.y,n[t+2]=e[t+2]+r.z;for(let e=0;e<n.length;e+=3)vu.WGS84.cartographicToCartesian(n.subarray(e,e+3),uh),n[e]=uh.x,n[e+1]=uh.y,n[e+2]=uh.z;return n}(n,i,o),a}(s.position,t);a.modelMatrix=e.invert(),a.coordinateSystem=sh.METER_OFFSETS}a.attributes={positions:s.position,normals:s.normal,colors:lh(s.color),texCoords:s.uv0,uvRegions:lh(s.uvRegion)},a.indices=c||null,s.id&&s.id.value&&(t.content.featureIds=s.id.value);for(const e in a.attributes)a.attributes[e]||delete a.attributes[e];return a.vertexCount=u,a.byteLength=o,t}(e,t,r,n)}function lh(e){return e?(e.normalized=!0,e):e}function hh(e,t,r,n,i){const a={};for(const o of i)if(r[o]){const{valueType:i,valuesPerElement:s}=r[o];if(t+n*s*oh(i)<=e.byteLength){const r=e.slice(t);let u;if("UInt64"===i)u=ph(r,n*s,oh(i));else{u=new(ih(i))(r,0,n*s)}switch(a[o]={value:u,type:ah[i],size:s},o){case"color":a.color.normalized=!0}t+=n*s*oh(i)}else if("uv0"!==o)break}return{attributes:a,byteOffset:t}}function ph(e,t,r){const n=[],i=new DataView(e);let a=0;for(let e=0;e<t;e++){const e=i.getUint32(a,!0)+2**32*i.getUint32(a+4,!0);n.push(e),a+=r}return new Uint32Array(n)}function fh(e){const t=[...e];for(let r=0;r<e.length;r++)t[r]=e[r]/255;return t}const dh={name:"I3S Content (Indexed Scene Layers)",id:"i3s-content",module:"i3s",worker:!0,version:"3.2.7",mimeTypes:["application/octet-stream"],parse:async function(e,t,r){const{tile:n,tileset:i}=(null==t?void 0:t.i3s)||{};return await ch(e,n,i,t,r),n.content},extensions:["bin"],options:{"i3s-content":{}}};const mh=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});new Is,new Is;const gh=new Is,yh=new Is;class bh{constructor(e=[0,0,0],t=0){this.radius=-0,this.center=new Is,this.fromCenterRadius(e,t)}fromCenterRadius(e,t){return this.center.from(e),this.radius=t,this}fromCornerPoints(e,t){return t=gh.from(t),this.center=(new Is).from(e).add(t).scale(.5),this.radius=this.center.distance(t),this}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new bh(this.center,this.radius)}union(e){const t=this.center,r=this.radius,n=e.center,i=e.radius,a=gh.copy(n).subtract(t),o=a.magnitude();if(r>=o+i)return this.clone();if(i>=o+r)return e.clone();const s=.5*(r+o+i);return yh.copy(a).scale((-r+s)/o).add(t),this.center.copy(yh),this.radius=s,this}expand(e){const t=(e=gh.from(e)).subtract(this.center).magnitude();return t>this.radius&&(this.radius=t),this}transform(e){this.center.transform(e);const t=Fs(gh,e);return this.radius=Math.max(t[0],Math.max(t[1],t[2]))*this.radius,this}distanceSquaredTo(e){return(e=gh.from(e)).subtract(this.center).lengthSquared()-this.radius*this.radius}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}intersectPlane(e){const t=this.center,r=this.radius,n=e.normal.dot(t)+e.distance;return n<-r?mh.OUTSIDE:n<r?mh.INTERSECTING:mh.INSIDE}}function vh(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],h=t[8],p=r[0],f=r[1],d=r[2],m=r[3],g=r[4],y=r[5],b=r[6],v=r[7],w=r[8];return e[0]=p*n+f*o+d*c,e[1]=p*i+f*s+d*l,e[2]=p*a+f*u+d*h,e[3]=m*n+g*o+y*c,e[4]=m*i+g*s+y*l,e[5]=m*a+g*u+y*h,e[6]=b*n+v*o+w*c,e[7]=b*i+v*s+w*l,e[8]=b*a+v*u+w*h,e}function wh(e,t,r){var n=r[0],i=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}const _h=Object.freeze([1,0,0,0,1,0,0,0,1]),kh=Object.freeze([0,0,0,0,0,0,0,0,0]),xh=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL1ROW0:3,COL1ROW1:4,COL1ROW2:5,COL2ROW0:6,COL2ROW1:7,COL2ROW2:8}),Eh={};class Ah extends Ps{static get IDENTITY(){return Eh.IDENTITY=Eh.IDENTITY||Object.freeze(new Ah(_h)),Eh.IDENTITY}static get ZERO(){return Eh.ZERO=Eh.ZERO||Object.freeze(new Ah(kh)),Eh.ZERO}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return xh}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&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.check()}set(e,t,r,n,i,a,o,s,u){return this[0]=e,this[1]=t,this[2]=r,this[3]=n,this[4]=i,this[5]=a,this[6]=o,this[7]=s,this[8]=u,this.check()}setRowMajor(e,t,r,n,i,a,o,s,u){return this[0]=e,this[1]=n,this[2]=o,this[3]=t,this[4]=i,this[5]=s,this[6]=r,this[7]=a,this[8]=u,this.check()}determinant(){return t=(e=this)[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8],t*(c*a-o*u)+r*(-c*i+o*s)+n*(u*i-a*s);var e,t,r,n,i,a,o,s,u,c}identity(){return this.copy(_h)}fromQuaternion(e){return function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,h=n*s,p=i*o,f=i*s,d=i*u,m=a*o,g=a*s,y=a*u;e[0]=1-h-d,e[3]=l-y,e[6]=p+g,e[1]=l+y,e[4]=1-c-d,e[7]=f-m,e[2]=p-g,e[5]=f+m,e[8]=1-c-h}(this,e),this.check()}transpose(){return function(e,t){if(e===t){var r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8]}(this,this),this.check()}invert(){var e,t,r,n,i,a,o,s,u,c,l,h,p,f,d;return e=this,r=(t=this)[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],(d=r*(h=l*o-s*c)+n*(p=-l*a+s*u)+i*(f=c*a-o*u))&&(d=1/d,e[0]=h*d,e[1]=(-l*n+i*c)*d,e[2]=(s*n-i*o)*d,e[3]=p*d,e[4]=(l*r-i*u)*d,e[5]=(-s*r+i*a)*d,e[6]=f*d,e[7]=(-c*r+n*u)*d,e[8]=(o*r-n*a)*d),this.check()}multiplyLeft(e){return vh(this,e,this),this.check()}multiplyRight(e){return vh(this,this,e),this.check()}rotate(e){var t,r,n,i,a,o,s,u,c,l,h,p,f,d;return t=this,n=e,i=(r=this)[0],a=r[1],o=r[2],s=r[3],u=r[4],c=r[5],l=r[6],h=r[7],p=r[8],f=Math.sin(n),d=Math.cos(n),t[0]=d*i+f*s,t[1]=d*a+f*u,t[2]=d*o+f*c,t[3]=d*s-f*i,t[4]=d*u-f*a,t[5]=d*c-f*o,t[6]=l,t[7]=h,t[8]=p,this.check()}scale(e){return Array.isArray(e)?wh(this,this,e):wh(this,this,[e,e,e]),this.check()}translate(e){var t,r,n,i,a,o,s,u,c,l,h,p,f,d;return t=this,n=e,i=(r=this)[0],a=r[1],o=r[2],s=r[3],u=r[4],c=r[5],l=r[6],h=r[7],p=r[8],f=n[0],d=n[1],t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=u,t[5]=c,t[6]=f*i+d*s+l,t[7]=f*a+d*u+h,t[8]=f*o+d*c+p,this.check()}transform(e,t){switch(e.length){case 2:t=Ls(t||[-0,-0],e,this);break;case 3:t=Es(t||[-0,-0,-0],e,this);break;case 4:t=Bs(t||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ps(t,e.length),t}transformVector(e,t){return ds("Matrix3.transformVector"),this.transform(e,t)}transformVector2(e,t){return ds("Matrix3.transformVector"),this.transform(e,t)}transformVector3(e,t){return ds("Matrix3.transformVector"),this.transform(e,t)}}function Sh(){var e=new ys(4);return ys!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function jh(e,t,r){r*=.5;var n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function Th(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],u=r[1],c=r[2],l=r[3];return e[0]=n*l+o*s+i*c-a*u,e[1]=i*l+o*u+a*s-n*c,e[2]=a*l+o*c+n*u-i*s,e[3]=o*l-n*s-i*u-a*c,e}function Ch(e,t,r,n){var i,a,o,s,u,c=t[0],l=t[1],h=t[2],p=t[3],f=r[0],d=r[1],m=r[2],g=r[3];return(a=c*f+l*d+h*m+p*g)<0&&(a=-a,f=-f,d=-d,m=-m,g=-g),1-a>gs?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,u=Math.sin(n*i)/o):(s=1-n,u=n),e[0]=s*c+u*f,e[1]=s*l+u*d,e[2]=s*h+u*m,e[3]=s*p+u*g,e}function Bh(e,t){var r,n=t[0]+t[4]+t[8];if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var i=0;t[4]>t[0]&&(i=1),t[8]>t[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;r=Math.sqrt(t[3*i+i]-t[3*a+a]-t[3*o+o]+1),e[i]=.5*r,r=.5/r,e[3]=(t[3*a+o]-t[3*o+a])*r,e[a]=(t[3*a+i]+t[3*i+a])*r,e[o]=(t[3*o+i]+t[3*i+o])*r}return e}var Rh,Oh,Ih,Ph,Dh,Mh,Fh,Lh=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e},Nh=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e},zh=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},Uh=function(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=t[3];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e[3]=s+n*(r[3]-s),e},qh=zs,Hh=Us,Gh=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=n*o,e[2]=i*o,e[3]=a*o,e},Vh=(Rh=bs(),Oh=ws(1,0,0),Ih=ws(0,1,0),function(e,t,r){var n=_s(t,r);return n<-.999999?(ks(Rh,Oh,t),js(Rh)<1e-6&&ks(Rh,Ih,t),function(e,t){var r=t[0],n=t[1],i=t[2],a=r*r+n*n+i*i;a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a}(Rh,Rh),jh(e,Rh,Math.PI),e):n>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(ks(Rh,t,r),e[0]=Rh[0],e[1]=Rh[1],e[2]=Rh[2],e[3]=1+n,Gh(e,e))});Ph=Sh(),Dh=Sh(),Mh=new ys(9),ys!=Float32Array&&(Mh[1]=0,Mh[2]=0,Mh[3]=0,Mh[5]=0,Mh[6]=0,Mh[7]=0),Mh[0]=1,Mh[4]=1,Mh[8]=1,Fh=Mh;const Wh=[0,0,0,1];class Kh extends ls{constructor(e=0,t=0,r=0,n=1){super(-0,-0,-0,-0),Array.isArray(e)&&1===arguments.length?this.copy(e):this.set(e,t,r,n)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,t,r,n){return this[0]=e,this[1]=t,this[2]=r,this[3]=n,this.check()}fromMatrix3(e){return Bh(this,e),this.check()}identity(){return function(e){e[0]=0,e[1]=0,e[2]=0,e[3]=1}(this),this.check()}fromAxisRotation(e,t){return jh(this,e,t),this.check()}setAxisAngle(e,t){return this.fromAxisRotation(e,t)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=hs(e)}get y(){return this[1]}set y(e){this[1]=hs(e)}get z(){return this[2]}set z(e){this[2]=hs(e)}get w(){return this[3]}set w(e){this[3]=hs(e)}len(){return qh(this)}lengthSquared(){return Hh(this)}dot(e,t){if(void 0!==t)throw new Error("Quaternion.dot only takes one argument");return zh(this,e)}rotationTo(e,t){return Vh(this,e,t),this.check()}add(e,t){if(void 0!==t)throw new Error("Quaternion.add only takes one argument");return Lh(this,this,e),this.check()}calculateW(){return function(e,t){var r=t[0],n=t[1],i=t[2];e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i))}(this,this),this.check()}conjugate(){return function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(this,this),this.check()}invert(){return function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;e[0]=-r*s,e[1]=-n*s,e[2]=-i*s,e[3]=a*s}(this,this),this.check()}lerp(e,t,r){return Uh(this,e,t,r),this.check()}multiplyRight(e,t){return Xo(!t),Th(this,this,e),this.check()}multiplyLeft(e,t){return Xo(!t),Th(this,e,this),this.check()}normalize(){const e=this.len(),t=e>0?1/e:0;return this[0]=this[0]*t,this[1]=this[1]*t,this[2]=this[2]*t,this[3]=this[3]*t,0===e&&(this[3]=1),this.check()}rotateX(e){return function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);e[0]=n*u+o*s,e[1]=i*u+a*s,e[2]=a*u-i*s,e[3]=o*u-n*s}(this,this,e),this.check()}rotateY(e){return function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);e[0]=n*u-a*s,e[1]=i*u+o*s,e[2]=a*u+n*s,e[3]=o*u-i*s}(this,this,e),this.check()}rotateZ(e){return function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);e[0]=n*u+i*s,e[1]=i*u-n*s,e[2]=a*u+o*s,e[3]=o*u-a*s}(this,this,e),this.check()}scale(e){return Nh(this,this,e),this.check()}slerp(e,t,r){switch(arguments.length){case 1:({start:e=Wh,target:t,ratio:r}=arguments[0]);break;case 2:[t,r]=arguments,e=this}return Ch(this,e,t,r),this.check()}transformVector4(e,t=e){return function(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],c=r[3],l=c*n+s*a-u*i,h=c*i+u*n-o*a,p=c*a+o*i-s*n,f=-o*n-s*i-u*a;e[0]=l*c+f*-o+h*-u-p*-s,e[1]=h*c+f*-s+p*-o-l*-u,e[2]=p*c+f*-u+l*-s-h*-o,e[3]=t[3]}(t,e,this),ps(t,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,t){return this.setAxisAngle(e,t)}premultiply(e,t){return this.multiplyLeft(e,t)}multiply(e,t){return this.multiplyRight(e,t)}}const Jh=new Is,Qh=new Is,Yh=new Is,$h=new Is,Xh=new Is,Zh=new Is,ep=new Is,tp=0,rp=1,np=2,ip=3,ap=4,op=5,sp=6,up=7,cp=8;class lp{constructor(e=[0,0,0],t=[0,0,0,0,0,0,0,0,0]){this.center=(new Is).from(e),this.halfAxes=new Ah(t)}get halfSize(){const e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new Is(e).len(),new Is(t).len(),new Is(r).len()]}get quaternion(){const e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),n=new Is(e).normalize(),i=new Is(t).normalize(),a=new Is(r).normalize();return(new Kh).fromMatrix3(new Ah([...n,...i,...a]))}fromCenterHalfSizeQuaternion(e,t,r){const n=new Kh(r),i=(new Ah).fromQuaternion(n);return i[0]=i[0]*t[0],i[1]=i[1]*t[0],i[2]=i[2]*t[0],i[3]=i[3]*t[1],i[4]=i[4]*t[1],i[5]=i[5]*t[1],i[6]=i[6]*t[2],i[7]=i[7]*t[2],i[8]=i[8]*t[2],this.center=(new Is).from(e),this.halfAxes=i,this}clone(){return new lp(this.center,this.halfAxes)}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new bh){const t=this.halfAxes,r=t.getColumn(0,Yh),n=t.getColumn(1,$h),i=t.getColumn(2,Xh),a=Jh.copy(r).add(n).add(i);return e.center.copy(this.center),e.radius=a.magnitude(),e}intersectPlane(e){const t=this.center,r=e.normal,n=this.halfAxes,i=r.x,a=r.y,o=r.z,s=Math.abs(i*n[tp]+a*n[rp]+o*n[np])+Math.abs(i*n[ip]+a*n[ap]+o*n[op])+Math.abs(i*n[sp]+a*n[up]+o*n[cp]),u=r.dot(t)+e.distance;return u<=-s?mh.OUTSIDE:u>=s?mh.INSIDE:mh.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){const t=Qh.from(e).subtract(this.center),r=this.halfAxes,n=r.getColumn(0,Yh),i=r.getColumn(1,$h),a=r.getColumn(2,Xh),o=n.magnitude(),s=i.magnitude(),u=a.magnitude();n.normalize(),i.normalize(),a.normalize();let c,l=0;return c=Math.abs(t.dot(n))-o,c>0&&(l+=c*c),c=Math.abs(t.dot(i))-s,c>0&&(l+=c*c),c=Math.abs(t.dot(a))-u,c>0&&(l+=c*c),l}computePlaneDistances(e,t,r=[-0,-0]){let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const a=this.center,o=this.halfAxes,s=o.getColumn(0,Yh),u=o.getColumn(1,$h),c=o.getColumn(2,Xh),l=Zh.copy(s).add(u).add(c).add(a),h=ep.copy(l).subtract(e);let p=t.dot(h);return n=Math.min(p,n),i=Math.max(p,i),l.copy(a).add(s).add(u).subtract(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),l.copy(a).add(s).subtract(u).add(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),l.copy(a).add(s).subtract(u).subtract(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),a.copy(l).subtract(s).add(u).add(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),a.copy(l).subtract(s).add(u).subtract(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),a.copy(l).subtract(s).subtract(u).add(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),a.copy(l).subtract(s).subtract(u).subtract(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),r[0]=n,r[1]=i,r}transform(e){this.center.transformAsPoint(e);const t=this.halfAxes.getColumn(0,Yh);t.transformAsPoint(e);const r=this.halfAxes.getColumn(1,$h);r.transformAsPoint(e);const n=this.halfAxes.getColumn(2,Xh);return n.transformAsPoint(e),this.halfAxes=new Ah([...t,...r,...n]),this}getTransform(){throw new Error("not implemented")}}const hp=new Is,pp=new Is;class fp{constructor(e=[0,0,1],t=0){this.normal=new Is,this.distance=-0,this.fromNormalDistance(e,t)}fromNormalDistance(e,t){return Xo(Number.isFinite(t)),this.normal.from(e).normalize(),this.distance=t,this}fromPointNormal(e,t){e=hp.from(e),this.normal.from(t).normalize();const r=-this.normal.dot(e);return this.distance=r,this}fromCoefficients(e,t,r,n){return this.normal.set(e,t,r),Xo(cs(this.normal.len(),1)),this.distance=n,this}clone(e){return new fp(this.normal,this.distance)}equals(e){return cs(this.distance,e.distance)&&cs(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){const t=pp.copy(this.normal).transformAsVector(e).normalize(),r=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(r,t)}projectPointOntoPlane(e,t=[0,0,0]){e=hp.from(e);const r=this.getPointDistance(e),n=pp.copy(this.normal).scale(r);return e.subtract(n).to(t)}}const dp=[new Is([1,0,0]),new Is([0,1,0]),new Is([0,0,1])],mp=new Is,gp=new Is;new fp(new Is(1,0,0),0);class yp{static get MASK_OUTSIDE(){return 4294967295}static get MASK_INSIDE(){return 0}static get MASK_INDETERMINATE(){return 2147483647}constructor(e=[]){this.planes=e,Xo(this.planes.every(e=>e instanceof fp))}fromBoundingSphere(e){this.planes.length=2*dp.length;const t=e.center,r=e.radius;let n=0;for(const e of dp){let i=this.planes[n],a=this.planes[n+1];i||(i=this.planes[n]=new fp),a||(a=this.planes[n+1]=new fp);const o=mp.copy(e).scale(-r).add(t);e.dot(o);i.fromPointNormal(o,e);const s=mp.copy(e).scale(r).add(t),u=gp.copy(e).negate();u.dot(s);a.fromPointNormal(s,u),n+=2}return this}computeVisibility(e){Xo(e);let t=mh.INSIDE;for(const r of this.planes){switch(e.intersectPlane(r)){case mh.OUTSIDE:return mh.OUTSIDE;case mh.INTERSECTING:t=mh.INTERSECTING}}return t}computeVisibilityWithPlaneMask(e,t){if(Xo(e,"boundingVolume is required."),Xo(Number.isFinite(t),"parentPlaneMask is required."),t===yp.MASK_OUTSIDE||t===yp.MASK_INSIDE)return t;let r=yp.MASK_INSIDE;const n=this.planes;for(let i=0;i<this.planes.length;++i){const a=i<31?1<<i:0;if(i<31&&0==(t&a))continue;const o=n[i],s=e.intersectPlane(o);if(s===mh.OUTSIDE)return yp.MASK_OUTSIDE;s===mh.INTERSECTING&&(r|=a)}return r}}new Is,new Is,new Is,new Is,new Is;const bp=new Is,vp=new Is,wp=new Is,_p=new Is,kp=new Is,xp=new Is,Ep=new Is,Ap=new Is,Sp=new Is,jp=new Is,Tp=new Is,Cp=new Is;Math.PI;const Bp=new Ah,Rp=new Ah,Op=new Ah,Ip=new Ah,Pp=new Ah;function Dp(e,t={}){const r=Ys;let n=0,i=0;const a=Rp,o=Op;a.identity(),o.copy(e);const s=r*function(e){let t=0;for(let r=0;r<9;++r){const n=e[r];t+=n*n}return Math.sqrt(t)}(o);for(;i<10&&Lp(o)>s;)Np(o,Ip),Pp.copy(Ip).transpose(),o.multiplyRight(Ip),o.multiplyLeft(Pp),a.multiplyRight(Ip),++n>2&&(++i,n=0);return t.unitary=a.toTarget(t.unitary),t.diagonal=o.toTarget(t.diagonal),t}const Mp=[1,0,0],Fp=[2,2,1];function Lp(e){let t=0;for(let r=0;r<3;++r){const n=e[Bp.getElementIndex(Fp[r],Mp[r])];t+=2*n*n}return Math.sqrt(t)}function Np(e,t){const r=Qs;let n=0,i=1;for(let t=0;t<3;++t){const r=Math.abs(e[Bp.getElementIndex(Fp[t],Mp[t])]);r>n&&(i=t,n=r)}const a=Mp[i],o=Fp[i];let s=1,u=0;if(Math.abs(e[Bp.getElementIndex(o,a)])>r){const t=(e[Bp.getElementIndex(o,o)]-e[Bp.getElementIndex(a,a)])/2/e[Bp.getElementIndex(o,a)];let r;r=t<0?-1/(-t+Math.sqrt(1+t*t)):1/(t+Math.sqrt(1+t*t)),s=1/Math.sqrt(1+r*r),u=r*s}return Ah.IDENTITY.to(t),t[Bp.getElementIndex(a,a)]=t[Bp.getElementIndex(o,o)]=s,t[Bp.getElementIndex(o,a)]=u,t[Bp.getElementIndex(a,o)]=-u,t}const zp=new Is,Up=new Is,qp=new Is,Hp=new Is,Gp=new Is,Vp=new Ah,Wp={diagonal:new Ah,unitary:new Ah};const Kp=0,Jp=1,Qp=3,Yp=4,$p=5,Xp=1,Zp=2,ef="empty",tf="scenegraph",rf="pointcloud",nf="mesh",af="I3S",of="TILES3D",sf="geometricError",uf=1;async function cf(e){return JSON.parse((new TextDecoder).decode(e))}const lf={name:"I3S Node Page",id:"i3s-node-page",module:"i3s",version:"3.2.7",mimeTypes:["application/json"],parse:async function(e){return e=cf(e)},extensions:["json"],options:{}};function hf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class pf{constructor(e,t){var r,n;hf(this,"tileset",void 0),hf(this,"nodePages",[]),hf(this,"pendingNodePages",[]),hf(this,"nodesPerPage",void 0),hf(this,"options",void 0),hf(this,"lodSelectionMetricType",void 0),hf(this,"textureDefinitionsSelectedFormats",[]),hf(this,"nodesInNodePages",void 0),hf(this,"textureLoaderOptions",{}),this.tileset={...e},this.nodesPerPage=(null===(r=e.nodePages)||void 0===r?void 0:r.nodesPerPage)||64,this.lodSelectionMetricType=null===(n=e.nodePages)||void 0===n?void 0:n.lodSelectionMetricType,this.options=t,this.nodesInNodePages=0,this.initSelectedFormatsForTextureDefinitions(e)}async getNodeById(e){const t=Math.floor(e/this.nodesPerPage);if(!this.nodePages[t]&&!this.pendingNodePages[t]){var r;const e=Zl(`${this.tileset.url}/nodepages/${t}`,null===(r=this.options.i3s)||void 0===r?void 0:r.token);this.pendingNodePages[t]={status:"Pending",promise:$o(e,lf,this.options)},this.nodePages[t]=await this.pendingNodePages[t].promise,this.nodesInNodePages+=this.nodePages[t].nodes.length,this.pendingNodePages[t].status="Done"}"Pending"===this.pendingNodePages[t].status&&(this.nodePages[t]=await this.pendingNodePages[t].promise);const n=e%this.nodesPerPage;return this.nodePages[t].nodes[n]}async formTileFromNodePages(e){const t=await this.getNodeById(e),r=[],n=[];for(const e of t.children||[])n.push(this.getNodeById(e));const i=await Promise.all(n);for(const e of i)r.push({id:e.index.toString(),obb:e.obb});let a,o,s,u="jpg",c=[],l=!1;if(t&&t.mesh){const{url:e,isDracoGeometry:r}=t.mesh.geometry&&this.getContentUrl(t.mesh.geometry)||{isDracoGeometry:!1};a=e,l=r;const{textureData:n,materialDefinition:i}=this.getInformationFromMaterial(t.mesh.material);s=i,u=n.format||u,n.name&&(o=`${this.tileset.url}/nodes/${t.mesh.material.resource}/textures/${n.name}`),this.tileset.attributeStorageInfo&&(c=function(e,t){const r=[],{attributeStorageInfo:n,url:i}=e;for(let e=0;e<n.length;e++){const a=n[e].key;r.push(`${i}/nodes/${t}/attributes/${a}/0`)}return r}(this.tileset,t.mesh.attribute.resource))}const h=this.getLodSelection(t);return ff({id:e.toString(),lodSelection:h,obb:t.obb,contentUrl:a,textureUrl:o,attributeUrls:c,materialDefinition:s,textureFormat:u,textureLoaderOptions:this.textureLoaderOptions,children:r,isDracoGeometry:l})}getContentUrl(e){let t=null;const r=this.tileset.geometryDefinitions[e.definition];let n=-1;if(this.options.i3s&&this.options.i3s.useDracoGeometry&&(n=r.geometryBuffers.findIndex(e=>e.compressedAttributes&&"draco"===e.compressedAttributes.encoding)),-1===n&&(n=r.geometryBuffers.findIndex(e=>!e.compressedAttributes)),-1!==n){const i=Boolean(r.geometryBuffers[n].compressedAttributes);t={url:`${this.tileset.url}/nodes/${e.resource}/geometries/${n}`,isDracoGeometry:i}}return t}getLodSelection(e){const t=[];return"maxScreenThresholdSQ"===this.lodSelectionMetricType&&t.push({metricType:"maxScreenThreshold",maxError:Math.sqrt(e.lodThreshold/(.25*Math.PI))}),t.push({metricType:this.lodSelectionMetricType,maxError:e.lodThreshold}),t}getInformationFromMaterial(e){const t={textureData:{name:null}};if(e){var r;const a=null===(r=this.tileset.materialDefinitions)||void 0===r?void 0:r[e.definition];if(a){var n,i;t.materialDefinition=a;const e=null==a||null===(n=a.pbrMetallicRoughness)||void 0===n||null===(i=n.baseColorTexture)||void 0===i?void 0:i.textureSetDefinitionId;"number"==typeof e&&(t.textureData=this.textureDefinitionsSelectedFormats[e]||t.textureData)}}return t}initSelectedFormatsForTextureDefinitions(e){this.textureDefinitionsSelectedFormats=[];const t=this.getSupportedTextureFormats(),r=e.textureSetDefinitions||[];for(const e of r){const r=e&&e.formats||[];let n=null;for(const e of t){const t=r.find(t=>t.format===e);if(t){n=t;break}}n&&"ktx2"===n.format&&(this.textureLoaderOptions.basis={format:Wl(),containerFormat:"ktx2",module:"encoder"}),this.textureDefinitionsSelectedFormats.push(n)}}getSupportedTextureFormats(){const e=[];if(!this.options.i3s||this.options.i3s.useCompressedTextures){const t=Ll();t.has("etc2")&&e.push("ktx-etc2"),t.has("dxt")&&e.push("dds"),e.push("ktx2")}return e.push("jpg"),e.push("png"),e}}function ff(e){var t,r;const n={};let i=[0,0,0,1];if(e.mbs)i=e.mbs,n.sphere=[...vu.WGS84.cartographicToCartesian(e.mbs.slice(0,3)),e.mbs[3]];else if(e.obb){n.box=[...vu.WGS84.cartographicToCartesian(e.obb.center),...e.obb.halfSize,...e.obb.quaternion];const t=(new lp).fromCenterHalfSizeQuaternion(n.box.slice(0,3),e.obb.halfSize,e.obb.quaternion).getBoundingSphere();n.sphere=[...t.center,t.radius],i=[...e.obb.center,t.radius]}const a=null===(t=e.lodSelection)||void 0===t?void 0:t[0].metricType,o=null===(r=e.lodSelection)||void 0===r?void 0:r[0].maxError,s=e.transform,u=nf,c=Zp;return{...e,mbs:i,boundingVolume:n,lodMetricType:a,lodMetricValue:o,transformMatrix:s,type:u,refine:c}}const df=/layers\/[0-9]+$/,mf=/nodes\/([0-9-]+|root)$/,gf={name:"I3S (Indexed Scene Layers)",id:"i3s",module:"i3s",version:"3.2.7",mimeTypes:["application/octet-stream"],parse:async function(e,t,r){const n=r.url;t.i3s=t.i3s||{};if("504b0304"===function(e){if(e instanceof ArrayBuffer)return[...new Uint8Array(e,0,4)].map(e=>e.toString(16).padStart(2,"0")).join("");return null}(e))throw new Error("Files with .slpk extention currently are not supported by I3SLoader");let i,a;i="auto"===t.i3s.isTileset?df.test(n):t.i3s.isTileset;a="auto"===t.isTileHeader?mf.test(n):t.i3s.isTileHeader;i?e=await async function(e,t,r){const n=JSON.parse((new TextDecoder).decode(e));return n.loader=gf,await async function(e,t,r){if(e.url=r.url,e.nodePages)e.nodePagesTile=new pf(e,t),e.root=e.nodePagesTile.formTileFromNodePages(0);else{var n;const r=Zl(e.url+"/nodes/root",null===(n=t.i3s)||void 0===n?void 0:n.token);e.root=await $o(r,e.loader,{...t,i3s:{...t.i3s,loadContent:!1,isTileHeader:!0,isTileset:!1}})}e.basePath=e.url,e.type=af,e.lodMetricType=e.root.lodMetricType,e.lodMetricValue=e.root.lodMetricValue}(n,t,r),n}(e,t,r):a?(e=await async function(e,t,r){return function(e,t,r){const n=r.url||"";let i,a,o;return e.geometryData&&(i=`${n}/${e.geometryData[0].href}`),e.textureData&&(a=`${n}/${e.textureData[0].href}`),e.attributeData&&(o=function(e,t){const{attributeData:r=[]}=t,n=[];for(let t=0;t<r.length;t++){const i=r[t].href.replace("./","");n.push(`${e}/${i}`)}return n}(n,e)),ff({...e,url:n,contentUrl:i,textureUrl:a,attributeUrls:o,isDracoGeometry:!1})}(e=JSON.parse((new TextDecoder).decode(e)),0,r)}(e,0,r),t.i3s.loadContent&&(t.i3s.tile=e,await $o(e.contentUrl,gf,t))):e=await async function(e,t){return await Yo(e,dh,t)}(e,t);return e},extensions:["bin"],options:{i3s:{loadContent:!0,token:null,isTileset:"auto",isTileHeader:"auto",tile:null,tileset:null,useDracoGeometry:!0,useCompressedTextures:!0,decodeTextures:!0,coordinateSystem:sh.METER_OFFSETS}}};async function yf(e,t){const{attributeName:r,attributeType:n}=t;return r?{[r]:n?bf(n,e):null}:{}}function bf(e,t){switch(e){case"String":return function(e){const t=[];try{const r=new DataView(e,0,4).getUint32(0,!0),n=new Uint32Array(e,8,r);let i=8+4*r;for(const r of n){const n=new TextDecoder("utf-8"),a=new Uint8Array(e,i,r);t.push(n.decode(a)),i+=r}}catch(e){console.error("Parse string attribute error: ",e.message)}return t}(t);case"Oid32":return vf(t);case"Float64":return function(e){return new Float64Array(e,8)}(t);case"Int16":return function(e){return new Int16Array(e,4)}(t);default:return vf(t)}}function vf(e){return new Uint32Array(e,4)}const wf={name:"I3S Attribute",id:"i3s-attribute",module:"i3s",version:"3.2.7",mimeTypes:["application/binary"],parse:async function(e,t){return e=yf(e,t)},extensions:["bin"],options:{},binary:!0};function _f(){let e;if("undefined"!=typeof window&&window.performance)e=window.performance.now();else if("undefined"!=typeof process&&process.hrtime){const t=process.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}class kf{constructor(e,t){bo(this,"name",void 0),bo(this,"type",void 0),bo(this,"sampleSize",1),bo(this,"time",void 0),bo(this,"count",void 0),bo(this,"samples",void 0),bo(this,"lastTiming",void 0),bo(this,"lastSampleTime",void 0),bo(this,"lastSampleCount",void 0),bo(this,"_count",0),bo(this,"_time",0),bo(this,"_samples",0),bo(this,"_startTime",0),bo(this,"_timerPending",!1),this.name=e,this.type=t,this.reset()}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=_f(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(_f()-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}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}_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)}}class xf{constructor(e){bo(this,"id",void 0),bo(this,"stats",{}),this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"count";return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(const e in this.stats)this.stats[e].reset();return this}forEach(e){for(const t in this.stats)e(this.stats[t])}getTable(){const e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach(e=>this._getOrCreate(e))}_getOrCreate(e){if(!e||!e.name)return null;const{name:t,type:r}=e;return this.stats[t]||(this.stats[t]=e instanceof kf?e:new kf(t,r)),this.stats[t]}}function Ef(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Af={id:"request-scheduler",throttleRequests:!0,maxRequests:6};class Sf{constructor(e={}){Ef(this,"props",void 0),Ef(this,"stats",void 0),Ef(this,"activeRequestCount",0),Ef(this,"requestQueue",[]),Ef(this,"requestMap",new Map),Ef(this,"deferredUpdate",null),this.props={...Af,...e},this.stats=new xf({id:this.props.id}),this.stats.get("Queued Requests"),this.stats.get("Active Requests"),this.stats.get("Cancelled Requests"),this.stats.get("Queued Requests Ever"),this.stats.get("Active Requests Ever")}scheduleRequest(e,t=(()=>0)){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);const r={handle:e,priority:0,getPriority:t},n=new Promise(e=>(r.resolve=e,r));return this.requestQueue.push(r),this.requestMap.set(e,n),this._issueNewRequests(),n}_issueRequest(e){const{handle:t,resolve:r}=e;let n=!1;const i=()=>{n||(n=!0,this.requestMap.delete(t),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:i}):Promise.resolve({done:i})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequestsAsync(){this.deferredUpdate=null;const e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==e){this._updateAllRequests();for(let t=0;t<e;++t){const e=this.requestQueue.shift();e&&this._issueRequest(e)}}}_updateAllRequests(){const e=this.requestQueue;for(let t=0;t<e.length;++t){const r=e[t];this._updateRequest(r)||(e.splice(t,1),this.requestMap.delete(r.handle),t--)}e.sort((e,t)=>e.priority-t.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),!(e.priority<0)||(e.resolve(null),!1)}}function jf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Tf{constructor(e,t,r){jf(this,"item",void 0),jf(this,"previous",void 0),jf(this,"next",void 0),this.item=e,this.previous=t,this.next=r}}function Cf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Bf{constructor(){Cf(this,"head",null),Cf(this,"tail",null),Cf(this,"_length",0)}get length(){return this._length}add(e){const t=new Tf(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),++this._length,t}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,t){e!==t&&(this.remove(t),this._insert(e,t))}_insert(e,t){const r=e.next;e.next=t,this.tail===e?this.tail=t:r.previous=t,t.next=r,t.previous=e,++this._length}}function Rf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Of(e){return null!=e}class If{constructor(){Rf(this,"_list",void 0),Rf(this,"_sentinel",void 0),Rf(this,"_trimTiles",void 0),this._list=new Bf,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(e){const t=e._cacheNode;Of(t)&&this._list.splice(this._sentinel,t)}add(e,t,r){Of(t._cacheNode)||(t._cacheNode=this._list.add(t),r&&r(e,t))}unloadTile(e,t,r){const n=t._cacheNode;Of(n)&&(this._list.remove(n),t._cacheNode=void 0,r&&r(e,t))}unloadTiles(e,t){const r=this._trimTiles;this._trimTiles=!1;const n=this._list,i=1024*e.maximumMemoryUsage*1024,a=this._sentinel;let o=n.head;for(;o!==a&&(e.gpuMemoryUsageInBytes>i||r);){const r=o.item;o=o.next,this.unloadTile(e,r,t)}}trim(){this._trimTiles=!0}}const Pf=new Is,Df=new Is,Mf=new yp([new fp,new fp,new fp,new fp,new fp,new fp]);function Ff(e,t){const{cameraDirection:r,cameraUp:n,height:i}=e,{metersPerUnit:a}=e.distanceScales,o=Nf(e,e.center),s=vu.WGS84.eastNorthUpToFixedFrame(o),u=e.unprojectPosition(e.cameraPosition),c=vu.WGS84.cartographicToCartesian(u,new Is),l=new Is(s.transformAsVector(new Is(r).scale(a))).normalize(),h=new Is(s.transformAsVector(new Is(n).scale(a))).normalize();!function(e){const t=e.getFrustumPlanes(),r=Lf(t.near,e.cameraPosition),n=Nf(e,r),i=Nf(e,e.cameraPosition,Df);let a=0;Mf.planes[a++].fromPointNormal(n,Pf.copy(n).subtract(i));for(const i in t){if("near"===i)continue;const o=Lf(t[i],r,Df),s=Nf(e,o,Df);Mf.planes[a++].fromPointNormal(s,Pf.copy(n).subtract(s))}}(e);const p=e.constructor,{longitude:f,latitude:d,width:m,bearing:g,zoom:y}=e;return{camera:{position:c,direction:l,up:h},viewport:e,topDownViewport:new p({longitude:f,latitude:d,height:i,width:m,bearing:g,zoom:y,pitch:0}),height:i,cullingVolume:Mf,frameNumber:t,sseDenominator:1.15}}function Lf(e,t,r=new Is){const n=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-n).add(t),r}function Nf(e,t,r=new Is){const n=e.unprojectPosition(t);return vu.WGS84.cartographicToCartesian(n,r)}const zf=new Is;function Uf(e,t){if(e instanceof lp){const{halfAxes:r}=e,n=function(e){e.getColumn(0,zf);const t=e.getColumn(1),r=e.getColumn(2),n=zf.add(t).add(r);return n.len()}(r);return Math.log2(6356752.314245179/(n+t[2]))}if(e instanceof bh){const{radius:r}=e;return Math.log2(6356752.314245179/(r+t[2]))}if(e.width&&e.height){const{width:t,height:r}=e;return(Math.log2(6378137/t)+Math.log2(6378137/r))/2}return 1}function qf(e,t,r){const n=vu.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],new Is),i=Math.sqrt(Math.pow(n[0]-r[0],2)+Math.pow(n[1]-r[1],2)+Math.pow(n[2]-r[2],2));return Math.log2(6356752.314245179/(i+t[2]))}function Hf(e){return null!=e}const Gf=new Is,Vf=new Is,Wf=new Is;function Kf(e,t,r){if(Hi(e,"3D Tile: boundingVolume must be defined"),e.box)return function(e,t,r){const n=new Is(e[0],e[1],e[2]);t.transform(n,n);let i=[];if(10===e.length){const t=e.slice(3,6),r=new Kh;r.fromArray(e,6);const n=new Is([1,0,0]),a=new Is([0,1,0]),o=new Is([0,0,1]);n.transformByQuaternion(r),n.scale(t[0]),a.transformByQuaternion(r),a.scale(t[1]),o.transformByQuaternion(r),o.scale(t[2]),i=[...n.toArray(),...a.toArray(),...o.toArray()]}else i=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];const a=t.transformAsVector(i.slice(0,3)),o=t.transformAsVector(i.slice(3,6)),s=t.transformAsVector(i.slice(6,9)),u=new Ah([a[0],a[1],a[2],o[0],o[1],o[2],s[0],s[1],s[2]]);if(Hf(r))return r.center=n,r.halfAxes=u,r;return new lp(n,u)}(e.box,t,r);if(e.region){const[t,r,n,i,a,o]=e.region,s=vu.WGS84.cartographicToCartesian([ss(t),ss(i),a],Vf),u=vu.WGS84.cartographicToCartesian([ss(n),ss(r),o],Wf),c=(new Is).addVectors(s,u).multiplyScalar(.5),l=(new Is).subVectors(s,u).len()/2;return Jf([c[0],c[1],c[2],l],new Ws)}if(e.sphere)return Jf(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function Jf(e,t,r){const n=new Is(e[0],e[1],e[2]);t.transform(n,n);const i=t.getScale(Gf),a=Math.max(Math.max(i[0],i[1]),i[2]),o=e[3]*a;return Hf(r)?(r.center=n,r.radius=o,r):new bh(n,o)}new Is,new Is,new Ws,new Is,new Is,new Is;function Qf(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){const r=e.dynamicScreenSpaceErrorComputedDensity,n=e.dynamicScreenSpaceErrorFactor;return function(e,t){const r=e*t;return 1-Math.exp(-r*r)}(t,r)*n}return 0}const Yf=new Is,$f=new Is,Xf=new Is,Zf=new Is,ed=new Is,td=new Ws,rd=new Ws;function nd(e,t){const{topDownViewport:r}=t,n=e.header.mbs[1],i=e.header.mbs[0],a=e.header.mbs[2],o=e.header.mbs[3],s=[...e.boundingVolume.center],u=r.unprojectPosition(r.cameraPosition);vu.WGS84.cartographicToCartesian(u,Yf),$f.copy(Yf).subtract(s).normalize(),vu.WGS84.eastNorthUpToFixedFrame(s,td),rd.copy(td).invert(),Xf.copy(Yf).transform(rd);const c=Math.sqrt(Xf[0]*Xf[0]+Xf[1]*Xf[1]),l=c*c/Xf[2];Zf.copy([Xf[0],Xf[1],l]);const h=Zf.transform(td).subtract(s).normalize(),p=$f.cross(h).normalize().scale(o).add(s),f=vu.WGS84.cartesianToCartographic(p),d=r.project([i,n,a]),m=r.project(f);return ed.copy(d).subtract(m).magnitude()}function id(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ad{constructor(e=0){id(this,"_map",new Map),id(this,"_array",void 0),id(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 Hi(e<this._array.length),this._array[e]}set(e,t){Hi(e>=0),e>=this.length&&(this.length=e+1),this._map.has(this._array[e])&&this._map.delete(this._array[e]),this._array[e]=t,this._map.set(t,e)}delete(e){const t=this._map.get(e);t>=0&&(this._array.splice(t,1),this._map.delete(e),this.length--)}peek(){return this._array[this._length-1]}push(e){if(!this._map.has(e)){const t=this.length++;this._array[t]=e,this._map.set(e,t)}}pop(){const e=this._array[--this.length];return this._map.delete(e),e}reserve(e){Hi(e>=0),e>this._array.length&&(this._array.length=e)}resize(e){Hi(e>=0),this.length=e}trim(e){null==e&&(e=this.length),this._array.length=e}reset(){this._array=[],this._map=new Map,this._length=0}find(e){return this._map.has(e)}}function od(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const sd={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""};class ud{traversalFinished(e){return!0}constructor(e){od(this,"options",void 0),od(this,"root",void 0),od(this,"requestedTiles",void 0),od(this,"selectedTiles",void 0),od(this,"emptyTiles",void 0),od(this,"lastUpdate",(new Date).getTime()),od(this,"updateDebounceTime",1e3),od(this,"_traversalStack",void 0),od(this,"_emptyTraversalStack",void 0),od(this,"_frameNumber",void 0),this.options={...sd,...e},this._traversalStack=new ad,this._emptyTraversalStack=new ad,this._frameNumber=null,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={}}traverse(e,t,r){this.root=e,this.options={...this.options,...r},this.reset(),this.updateTile(e,t),this._frameNumber=t.frameNumber,this.executeTraversal(e,t)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(e,t){const r=this._traversalStack;for(e._selectionDepth=1,r.push(e);r.length>0;){const e=r.pop();let n=!1;this.canTraverse(e,t)&&(this.updateChildTiles(e,t),n=this.updateAndPushChildren(e,t,r,e.hasRenderContent?e._selectionDepth+1:e._selectionDepth));const i=e.parent,a=Boolean(!i||i._shouldRefine),o=!n;e.hasRenderContent?e.refine===Xp?(this.loadTile(e,t),this.selectTile(e,t)):e.refine===Zp&&(this.loadTile(e,t),o&&this.selectTile(e,t)):(this.emptyTiles[e.id]=e,this.loadTile(e,t),o&&this.selectTile(e,t)),this.touchTile(e,t),e._shouldRefine=n&&a}const n=(new Date).getTime();(this.traversalFinished(t)||n-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=n,this.options.onTraversalEnd(t))}updateChildTiles(e,t){const r=e.children;for(const e of r)this.updateTile(e,t);return!0}updateAndPushChildren(e,t,r,n){const{loadSiblings:i,skipLevelOfDetail:a}=this.options,o=e.children;o.sort(this.compareDistanceToCamera.bind(this));const s=e.refine===Zp&&e.hasRenderContent&&!a;let u=!1,c=!0;for(const e of o)if(e._selectionDepth=n,e.isVisibleAndInRequestVolume?(r.find(e)&&r.delete(e),r.push(e),u=!0):(s||i)&&(this.loadTile(e,t),this.touchTile(e,t)),s){let r;if(r=!!e._inRequestVolume&&(e.hasRenderContent?e.contentAvailable:this.executeEmptyTraversal(e,t)),c=c&&r,!c)return!1}return u||(c=!1),c}updateTile(e,t){this.updateTileVisibility(e,t)}selectTile(e,t){this.shouldSelectTile(e)&&(e._selectedFrame=t.frameNumber,this.selectedTiles[e.id]=e)}loadTile(e,t){this.shouldLoadTile(e)&&(e._requestedFrame=t.frameNumber,e._priority=e._getPriority(),this.requestedTiles[e.id]=e)}touchTile(e,t){e.tileset._cache.touch(e),e._touchedFrame=t.frameNumber}canTraverse(e,t,r=!1,n=!1){return!!e.hasChildren&&(e.hasTilesetContent?!e.contentExpired:!(!n&&!e.isVisibleAndInRequestVolume)&&this.shouldRefine(e,t,r))}shouldLoadTile(e){return e.hasUnloadedContent||e.contentExpired}shouldSelectTile(e){return e.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(e,t,r){let n=e._screenSpaceError;return r&&(n=e.getScreenSpaceError(t,!0)),n>this.options.maximumScreenSpaceError}updateTileVisibility(e,t){const r=[];if(this.options.viewportTraversersMap)for(const e in this.options.viewportTraversersMap){this.options.viewportTraversersMap[e]===t.viewport.id&&r.push(e)}else r.push(t.viewport.id);e.updateVisibility(t,r)}compareDistanceToCamera(e,t){return e._distanceToCamera-t._distanceToCamera}anyChildrenVisible(e,t){let r=!1;for(const n of e.children)n.updateVisibility(t),r=r||n.isVisibleAndInRequestVolume;return r}executeEmptyTraversal(e,t){let r=!0;const n=this._emptyTraversalStack;for(n.push(e);n.length>0&&r;){const e=n.pop();this.updateTile(e,t),e.isVisibleAndInRequestVolume||this.loadTile(e,t),this.touchTile(e,t);if(!e.hasRenderContent&&this.canTraverse(e,t,!1,!0)){const t=e.children;for(const e of t)n.find(e)&&n.delete(e),n.push(e)}else e.contentAvailable||(r=!1)}return r}}function cd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ld=new Is;class hd{constructor(e,t,r,n=""){cd(this,"tileset",void 0),cd(this,"header",void 0),cd(this,"id",void 0),cd(this,"url",void 0),cd(this,"parent",void 0),cd(this,"refine",void 0),cd(this,"type",void 0),cd(this,"contentUrl",void 0),cd(this,"lodMetricType",void 0),cd(this,"lodMetricValue",void 0),cd(this,"boundingVolume",void 0),cd(this,"content",void 0),cd(this,"contentState",void 0),cd(this,"gpuMemoryUsageInBytes",void 0),cd(this,"children",void 0),cd(this,"depth",void 0),cd(this,"viewportIds",void 0),cd(this,"transform",void 0),cd(this,"extensions",void 0),cd(this,"userData",void 0),cd(this,"computedTransform",void 0),cd(this,"hasEmptyContent",void 0),cd(this,"hasTilesetContent",void 0),cd(this,"traverser",void 0),cd(this,"_cacheNode",void 0),cd(this,"_frameNumber",void 0),cd(this,"_lodJudge",void 0),cd(this,"_expireDate",void 0),cd(this,"_expiredContent",void 0),cd(this,"_shouldRefine",void 0),cd(this,"_distanceToCamera",void 0),cd(this,"_centerZDepth",void 0),cd(this,"_screenSpaceError",void 0),cd(this,"_visibilityPlaneMask",void 0),cd(this,"_visible",void 0),cd(this,"_inRequestVolume",void 0),cd(this,"_stackLength",void 0),cd(this,"_selectionDepth",void 0),cd(this,"_touchedFrame",void 0),cd(this,"_visitedFrame",void 0),cd(this,"_selectedFrame",void 0),cd(this,"_requestedFrame",void 0),cd(this,"_priority",void 0),cd(this,"_contentBoundingVolume",void 0),cd(this,"_viewerRequestVolume",void 0),cd(this,"_initialTransform",void 0),this.header=t,this.tileset=e,this.id=n||t.id,this.url=t.url,this.parent=r,this.refine=this._getRefine(t.refine),this.type=t.type,this.contentUrl=t.contentUrl,this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=Kp,this.gpuMemoryUsageInBytes=0,this.children=[],this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.depth=0,this.viewportIds=[],this.userData={},this.extensions=null,this._priority=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._screenSpaceError=0,this._cacheNode=null,this._frameNumber=null,this._cacheNode=null,this.traverser=new ud({}),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._initialTransform=new Ws,this.transform=new Ws,this._initializeLodMetric(t),this._initializeTransforms(t),this._initializeBoundingVolumes(t),this._initializeContent(t),this._initializeRenderingState(t),this._lodJudge=null,this._expireDate=null,this._expiredContent=null,Object.seal(this)}destroy(){this.header=null}isDestroyed(){return null===this.header}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===Qp||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===Kp}get contentExpired(){return this.contentState===Yp}get contentFailed(){return this.contentState===$p}getScreenSpaceError(e,t){switch(this.tileset.type){case af:return nd(this,e);case of:return function(e,t,r){const n=e.tileset,i=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,a=r?i:e.lodMetricValue;if(0===a)return 0;const o=Math.max(e._distanceToCamera,1e-7),{height:s,sseDenominator:u}=t,{viewDistanceScale:c}=n.options;let l=a*s*(c||1)/(o*u);return l-=Qf(n,o),l}(this,e,t);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getPriority(){const e=this.tileset._traverser,{skipLevelOfDetail:t}=e.options,r=this.refine===Xp||t;if(r&&!this.isVisible&&void 0!==this._visible)return-1;if(this.tileset._frameNumber-this._touchedFrame>=1)return-1;if(this.contentState===Kp)return-1;const n=this.parent,i=n&&(!r||0===this._screenSpaceError||n.hasTilesetContent)?n._screenSpaceError:this._screenSpaceError,a=e.root?e.root._screenSpaceError:0;return Math.max(a-i,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=Jp;const e=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!e)return this.contentState=Kp,!1;try{const t=this.tileset.getTileUrl(this.contentUrl),r=this.tileset.loader,n={...this.tileset.loadOptions,[r.id]:{...this.tileset.loadOptions[r.id],isTileset:"json"===this.type,...this._getLoaderSpecificOptions(r.id)}};return this.content=await $o(t,r,n),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=Qp,this._onContentLoaded(),!0}catch(e){throw this.contentState=$p,e}finally{e.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=Kp,!0}updateVisibility(e,t){if(this._frameNumber===e.frameNumber)return;const r=this.parent,n=r?r._visibilityPlaneMask:yp.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){const e=r?r.computedTransform:this.tileset.modelMatrix;this._updateTransform(e)}this._distanceToCamera=this.distanceToTile(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._visibilityPlaneMask=this.visibility(e,n),this._visible=this._visibilityPlaneMask!==yp.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._frameNumber=e.frameNumber,this.viewportIds=t}visibility(e,t){const{cullingVolume:r}=e,{boundingVolume:n}=this;return r.computeVisibilityWithPlaneMask(n,t)}contentVisibility(){return!0}distanceToTile(e){const t=this.boundingVolume;return Math.sqrt(Math.max(t.distanceSquaredTo(e.camera.position),0))}cameraSpaceZDepth({camera:e}){const t=this.boundingVolume;return ld.subVectors(t.center,e.position),e.direction.dot(ld)}insideViewerRequestVolume(e){const t=this._viewerRequestVolume;return!t||t.distanceSquaredTo(e.camera.position)<=0}updateExpiration(){if(null!=this._expireDate&&this.contentReady&&!this.hasEmptyContent){const e=Date.now();Date.lessThan(this._expireDate,e)&&(this.contentState=Yp,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 Ws(e.transform):new Ws;const t=this.parent,r=this.tileset,n=t&&t.computedTransform?t.computedTransform.clone():r.modelMatrix.clone();this.computedTransform=new Ws(n).multiplyRight(this.transform);const i=t&&t._initialTransform?t._initialTransform.clone():new Ws;this._initialTransform=new Ws(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=Kp,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=yp.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||Zp}_isTileset(){return-1!==this.contentUrl.indexOf(".json")}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0}this._isTileset()&&(this.hasTilesetContent=!0)}_updateBoundingVolume(e){this.boundingVolume=Kf(e.boundingVolume,this.computedTransform,this.boundingVolume);const t=e.content;t&&(t.boundingVolume&&(this._contentBoundingVolume=Kf(t.boundingVolume,this.computedTransform,this._contentBoundingVolume)),e.viewerRequestVolume&&(this._viewerRequestVolume=Kf(e.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(e=new Ws){const t=e.clone().multiplyRight(this.transform);!t.equals(this.computedTransform)&&(this.computedTransform=t,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(e){switch(e){case"i3s":return{...this.tileset.options.i3s,tile:this.header,tileset:this.tileset.tileset,isTileHeader:!1};case"3d-tiles":case"cesium-ion":default:return{assetGltfUpAxis:(t=this.tileset.tileset).asset&&t.asset.gltfUpAxis||"Y"}}var t}}class pd extends ud{compareDistanceToCamera(e,t){return 0===t._distanceToCamera&&0===e._distanceToCamera?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera}updateTileVisibility(e,t){if(super.updateTileVisibility(e,t),!e.isVisibleAndInRequestVolume)return;const r=e.children.length>0;if(e.hasTilesetContent&&r){const r=e.children[0];return this.updateTileVisibility(r,t),void(e._visible=r._visible)}if(this.meetsScreenSpaceErrorEarly(e,t))return void(e._visible=!1);const n=e.refine===Zp,i=e._optimChildrenWithinParent===uf;n&&i&&r&&!this.anyChildrenVisible(e,t)&&(e._visible=!1)}meetsScreenSpaceErrorEarly(e,t){const{parent:r}=e;return!(!r||r.hasTilesetContent||r.refine!==Xp)&&!this.shouldRefine(e,t,!0)}}class fd{constructor(){var e,t,r;e=this,t="frameNumberMap",r=new Map,t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}register(e,t){const r=this.frameNumberMap.get(e)||new Map,n=r.get(t)||0;r.set(t,n+1),this.frameNumberMap.set(e,r)}deregister(e,t){const r=this.frameNumberMap.get(e);if(!r)return;const n=r.get(t)||1;r.set(t,n-1)}isZero(e,t){var r;return 0===((null===(r=this.frameNumberMap.get(e))||void 0===r?void 0:r.get(t))||0)}}function dd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const md="REQUESTED",gd="COMPLETED",yd="ERROR";class bd{constructor(){dd(this,"_statusMap",void 0),dd(this,"pendingTilesRegister",new fd),this._statusMap={}}add(e,t,r,n){if(!this._statusMap[t]){const{frameNumber:i,viewport:{id:a}}=n;this._statusMap[t]={request:e,callback:r,key:t,frameState:n,status:md},this.pendingTilesRegister.register(a,i),e().then(e=>{this._statusMap[t].status=gd;const{frameNumber:r,viewport:{id:i}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(i,r),this._statusMap[t].callback(e,n)}).catch(e=>{this._statusMap[t].status=yd;const{frameNumber:n,viewport:{id:i}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(i,n),r(e)})}}update(e,t){if(this._statusMap[e]){const{frameNumber:r,viewport:{id:n}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(n,r);const{frameNumber:i,viewport:{id:a}}=t;this.pendingTilesRegister.register(a,i),this._statusMap[e].frameState=t}}find(e){return this._statusMap[e]}hasPendingTiles(e,t){return!this.pendingTilesRegister.isZero(e,t)}}class vd extends ud{traversalFinished(e){return!this._tileManager.hasPendingTiles(e.viewport.id,this._frameNumber||0)}constructor(e){var t,r,n;super(e),n=void 0,(r="_tileManager")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,this._tileManager=new bd}shouldRefine(e,t){return e._lodJudge=function(e,t){if(0===e.lodMetricValue||isNaN(e.lodMetricValue))return"DIG";const r=2*nd(e,t);return r<2?"OUT":!e.header.children||r<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}(e,t),"DIG"===e._lodJudge}updateChildTiles(e,t){const r=e.header.children||[],n=e.children,i=e.tileset;for(const a of r){const r=`${a.id}-${t.viewport.id}`,o=n&&n.find(e=>e.id===r);if(o)o&&this.updateTile(o,t);else{let n=()=>this._loadTile(a.id,i);this._tileManager.find(r)?this._tileManager.update(r,t):(i.tileset.nodePages&&(n=()=>i.tileset.nodePagesTile.formTileFromNodePages(a.id)),this._tileManager.add(n,r,t=>this._onTileLoad(t,e,r),t))}}return!1}async _loadTile(e,t){const{loader:r}=t,n=t.getTileUrl(`${t.url}/nodes/${e}`),i={...t.loadOptions,i3s:{...t.loadOptions.i3s,isTileHeader:!0,loadContent:!1}};return await $o(n,r,i)}_onTileLoad(e,t,r){const n=new hd(t.tileset,e,t,r);t.children.push(n);const i=this._tileManager.find(n.id).frameState;this.updateTile(n,i),this._frameNumber===i.frameNumber&&(this.traversalFinished(i)||(new Date).getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(n,i)}}function wd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const _d={description:"",ellipsoid:vu.WGS84,modelMatrix:new Ws,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},kd="Tiles In Tileset(s)";class xd{constructor(e,t){wd(this,"options",void 0),wd(this,"loadOptions",void 0),wd(this,"type",void 0),wd(this,"tileset",void 0),wd(this,"loader",void 0),wd(this,"url",void 0),wd(this,"basePath",void 0),wd(this,"modelMatrix",void 0),wd(this,"ellipsoid",void 0),wd(this,"lodMetricType",void 0),wd(this,"lodMetricValue",void 0),wd(this,"refine",void 0),wd(this,"root",void 0),wd(this,"roots",void 0),wd(this,"asset",void 0),wd(this,"description",void 0),wd(this,"properties",void 0),wd(this,"extras",void 0),wd(this,"attributions",void 0),wd(this,"credits",void 0),wd(this,"stats",void 0),wd(this,"traverseCounter",void 0),wd(this,"geometricError",void 0),wd(this,"selectedTiles",void 0),wd(this,"updatePromise",null),wd(this,"tilesetInitializationPromise",void 0),wd(this,"cartographicCenter",void 0),wd(this,"cartesianCenter",void 0),wd(this,"zoom",void 0),wd(this,"boundingVolume",void 0),wd(this,"gpuMemoryUsageInBytes",void 0),wd(this,"dynamicScreenSpaceErrorComputedDensity",void 0),wd(this,"_traverser",void 0),wd(this,"_cache",void 0),wd(this,"_requestScheduler",void 0),wd(this,"_frameNumber",void 0),wd(this,"_queryParamsString",void 0),wd(this,"_queryParams",void 0),wd(this,"_extensionsUsed",void 0),wd(this,"_tiles",void 0),wd(this,"_pendingCount",void 0),wd(this,"lastUpdatedVieports",void 0),wd(this,"_requestedTiles",void 0),wd(this,"_emptyTiles",void 0),wd(this,"frameStateData",void 0),wd(this,"maximumMemoryUsage",void 0),Hi(e),this.options={..._d,...t},this.tileset=e,this.loader=e.loader,this.type=e.type,this.url=e.url,this.basePath=e.basePath||n.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.root=null,this.roots={},this.cartographicCenter=null,this.cartesianCenter=null,this.zoom=1,this.boundingVolume=null,this.traverseCounter=0,this.geometricError=0,this._traverser=this._initializeTraverser(),this._cache=new If,this._requestScheduler=new Sf({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this._frameNumber=0,this._pendingCount=0,this._tiles={},this.selectedTiles=[],this._emptyTiles=[],this._requestedTiles=[],this.frameStateData={},this.lastUpdatedVieports=null,this._queryParams={},this._queryParamsString="",this.maximumMemoryUsage=this.options.maximumMemoryUsage||32,this.gpuMemoryUsageInBytes=0,this.stats=new xf({id:this.url}),this._initializeStats(),this._extensionsUsed=void 0,this.dynamicScreenSpaceErrorComputedDensity=0,this.extras=null,this.asset={},this.credits={},this.description=this.options.description||"",this.tilesetInitializationPromise=this._initializeTileSet(e)}destroy(){this._destroy()}isLoaded(){return 0===this._pendingCount&&0!==this._frameNumber&&0===this._requestedTiles.length}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return this._queryParamsString||(this._queryParamsString=function(e){const t=[];for(const r of Object.keys(e))t.push(`${r}=${e[r]}`);switch(t.length){case 0:return"";case 1:return"?"+t[0];default:return"?"+t.join("&")}}(this._queryParams)),this._queryParamsString}setProps(e){this.options={...this.options,...e}}setOptions(e){this.options={...this.options,...e}}getTileUrl(e){return e.startsWith("data:")?e:`${e}${this.queryParams}`}hasExtension(e){return Boolean(this._extensionsUsed&&this._extensionsUsed.indexOf(e)>-1)}update(e=null){this.tilesetInitializationPromise.then(()=>{!e&&this.lastUpdatedVieports?e=this.lastUpdatedVieports:this.lastUpdatedVieports=e,e&&this.doUpdate(e)})}async selectTiles(e=null){return await this.tilesetInitializationPromise,e&&(this.lastUpdatedVieports=e),this.updatePromise||(this.updatePromise=new Promise(e=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),e(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}doUpdate(e){if("loadTiles"in this.options&&!this.options.loadTiles)return;if(this.traverseCounter>0)return;const t=e instanceof Array?e:[e];this._cache.reset(),this._frameNumber++,this.traverseCounter=t.length;const r=[];for(const e of t){const t=e.id;this._needTraverse(t)?r.push(t):this.traverseCounter--}for(const e of t){const t=e.id;if(this.roots[t]||(this.roots[t]=this._initializeTileHeaders(this.tileset,null)),!r.includes(t))continue;const n=Ff(e,this._frameNumber);this._traverser.traverse(this.roots[t],n,this.options)}}_needTraverse(e){let t=e;return this.options.viewportTraversersMap&&(t=this.options.viewportTraversersMap[e]),t===e}_onTraversalEnd(e){const t=e.viewport.id;this.frameStateData[t]||(this.frameStateData[t]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});const r=this.frameStateData[t],n=Object.values(this._traverser.selectedTiles),[i,a]=function(e,t,r){if(0===r||e.length<=r)return[e,[]];const n=[],{longitude:i,latitude:a}=t.viewport;for(const[t,r]of e.entries()){const[e,o]=r.header.mbs,s=Math.abs(i-e),u=Math.abs(a-o),c=Math.sqrt(u*u+s*s);n.push([t,c])}const o=n.sort((e,t)=>e[1]-t[1]),s=[];for(let t=0;t<r;t++)s.push(e[o[t][0]]);const u=[];for(let t=r;t<o.length;t++)u.push(e[o[t][0]]);return[s,u]}(n,e,this.options.maximumTilesSelected);r.selectedTiles=i;for(const e of a)e.unselect();r._requestedTiles=Object.values(this._traverser.requestedTiles),r._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,this.traverseCounter>0||this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(const e in this.frameStateData){const t=this.frameStateData[e];this.selectedTiles=this.selectedTiles.concat(t.selectedTiles),this._requestedTiles=this._requestedTiles.concat(t._requestedTiles),this._emptyTiles=this._emptyTiles.concat(t._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(const e of this.selectedTiles)this._tiles[e.id]=e;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(e,t){if(e.length!==t.length)return!0;const r=new Set(e.map(e=>e.id)),n=new Set(t.map(e=>e.id));let i=e.filter(e=>!n.has(e.id)).length>0;return i=i||t.filter(e=>!r.has(e.id)).length>0,i}_loadTiles(){for(const e of this._requestedTiles)e.contentUnloaded&&this._loadTile(e)}_unloadTiles(){this._cache.unloadTiles(this,(e,t)=>e._unloadTile(t))}_updateStats(){let e=0,t=0;for(const r of this.selectedTiles)r.contentAvailable&&r.content&&(e++,r.content.pointCount?t+=r.content.pointCount:t+=r.content.vertexCount);this.stats.get("Tiles In View").count=this.selectedTiles.length,this.stats.get("Tiles To Render").count=e,this.stats.get("Points/Vertices").count=t}async _initializeTileSet(e){this.type===af&&(this.calculateViewPropsI3S(),e.root=await e.root),this.root=this._initializeTileHeaders(e,null),this.type===of&&(this._initializeTiles3DTileset(e),this.calculateViewPropsTiles3D()),this.type===af&&this._initializeI3STileset()}calculateViewPropsI3S(){var e;const t=this.tileset.fullExtent;if(t){const{xmin:e,xmax:r,ymin:n,ymax:i,zmin:a,zmax:o}=t;return this.cartographicCenter=new Is(e+(r-e)/2,n+(i-n)/2,a+(o-a)/2),this.cartesianCenter=vu.WGS84.cartographicToCartesian(this.cartographicCenter,new Is),void(this.zoom=qf(t,this.cartographicCenter,this.cartesianCenter))}const r=null===(e=this.tileset.store)||void 0===e?void 0:e.extent;if(r){const[e,t,n,i]=r;return this.cartographicCenter=new Is(e+(n-e)/2,t+(i-t)/2,0),this.cartesianCenter=vu.WGS84.cartographicToCartesian(this.cartographicCenter,new Is),void(this.zoom=function(e,t,r){const[n,i,a,o]=e;return qf({xmin:n,xmax:a,ymin:i,ymax:o,zmin:0,zmax:0},t,r)}(r,this.cartographicCenter,this.cartesianCenter))}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new Is,this.zoom=1}calculateViewPropsTiles3D(){const e=this.root;Hi(e);const{center:t}=e.boundingVolume;if(!t)return console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new Is,void(this.zoom=1);0!==t[0]||0!==t[1]||0!==t[2]?this.cartographicCenter=vu.WGS84.cartesianToCartographic(t,new Is):this.cartographicCenter=new Is(0,0,-vu.WGS84.radii[0]),this.cartesianCenter=t,this.zoom=Uf(e.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(kd),this.stats.get("Tiles Loading"),this.stats.get("Tiles In Memory"),this.stats.get("Tiles In View"),this.stats.get("Tiles To Render"),this.stats.get("Tiles Loaded"),this.stats.get("Tiles Unloaded"),this.stats.get("Failed Tile Loads"),this.stats.get("Points/Vertices","memory"),this.stats.get("Tile Memory Use","memory")}_initializeTileHeaders(e,t){const r=new hd(this,e.root,t);if(t&&(t.children.push(r),r.depth=t.depth+1),this.type===of){const e=[];for(e.push(r);e.length>0;){const t=e.pop();this.stats.get(kd).incrementCount();const r=t.header.children||[];for(const n of r){const r=new hd(this,n,t);t.children.push(r),r.depth=t.depth+1,e.push(r)}}}return r}_initializeTraverser(){let e;switch(this.type){case of:e=pd;break;case af:e=vd;break;default:e=ud}return new e({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(e){this._destroySubtree(e)}async _loadTile(e){let t;try{this._onStartTileLoading(),t=await e.loadContent()}catch(t){this._onTileLoadError(e,t)}finally{this._onEndTileLoading(),this._onTileLoad(e,t)}}_onTileLoadError(e,t){this.stats.get("Failed Tile Loads").incrementCount();const r=t.message||t.toString(),n=e.url;console.error(`A 3D tile failed to load: ${e.url} ${r}`),this.options.onTileError(e,r,n)}_onTileLoad(e,t){if(t){if(this.type===af){var r,n;const e=(null===(r=this.tileset)||void 0===r||null===(n=r.nodePagesTile)||void 0===n?void 0:n.nodesInNodePages)||0;this.stats.get(kd).reset(),this.stats.get(kd).addCount(e)}e&&e.content&&function(e,t){Hi(e),Hi(t);const{rtcCenter:r,gltfUpAxis:n}=t,{computedTransform:i,boundingVolume:{center:a}}=e;let o=new Ws(i);switch(r&&o.translate(r),n){case"Z":break;case"Y":const e=(new Ws).rotateX(Math.PI/2);o=o.multiplyRight(e);break;case"X":const t=(new Ws).rotateY(-Math.PI/2);o=o.multiplyRight(t)}t.isQuantized&&o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);const s=new Is(a);t.cartesianModelMatrix=o,t.cartesianOrigin=s;const u=vu.WGS84.cartesianToCartographic(s,new Is),c=vu.WGS84.eastNorthUpToFixedFrame(s).invert();t.cartographicModelMatrix=c.multiplyRight(o),t.cartographicOrigin=u,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}(e,e.content),this._addTileToCache(e),this.options.onTileLoad(e)}}_onStartTileLoading(){this._pendingCount++,this.stats.get("Tiles Loading").incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get("Tiles Loading").decrementCount()}_addTileToCache(e){this._cache.add(this,e,t=>t._updateCacheStats(e))}_updateCacheStats(e){this.stats.get("Tiles Loaded").incrementCount(),this.stats.get("Tiles In Memory").incrementCount(),this.gpuMemoryUsageInBytes+=e.content.byteLength||0,this.stats.get("Tile Memory Use").count=this.gpuMemoryUsageInBytes}_unloadTile(e){this.gpuMemoryUsageInBytes-=e.content&&e.content.byteLength||0,this.stats.get("Tiles In Memory").decrementCount(),this.stats.get("Tiles Unloaded").incrementCount(),this.stats.get("Tile Memory Use").count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(e),e.unloadContent()}_destroy(){const e=[];for(this.root&&e.push(this.root);e.length>0;){const t=e.pop();for(const r of t.children)e.push(r);this._destroyTile(t)}this.root=null}_destroySubtree(e){const t=e,r=[];for(r.push(t);r.length>0;){e=r.pop();for(const t of e.children)r.push(t);e!==t&&this._destroyTile(e)}t.children=[]}_destroyTile(e){this._cache.unloadTile(this,e),this._unloadTile(e),e.destroy()}_initializeTiles3DTileset(e){if(this.asset=e.asset,!this.asset)throw new Error("Tileset must have an asset property.");if("0.0"!==this.asset.version&&"1.0"!==this.asset.version)throw new Error("The tileset must be 3D Tiles version 0.0 or 1.0.");"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)}}const Ed=[9,-18,-88,0,96,90,0,0,-60,-20,-9,18,8,0,-96,30,0,0,60,-20,9,-88,-18,90,96,0,-20,-60,0,0,186,-42,-42,-150,-96,-150,60,60,60,60,54,162,-78,30,-24,-90,-60,60,-60,60,-9,-32,18,30,24,0,20,-60,0,0,-9,8,18,30,-96,0,-20,60,0,0,54,-78,162,-90,-24,30,60,-60,60,-60,-54,78,78,90,144,90,-60,-60,-60,-60,9,-8,-18,-30,-24,0,20,60,0,0,-9,18,-32,0,24,30,0,0,-60,20,9,-18,-8,0,-24,-30,0,0,60,20],Ad=[0,0,-131,0,138,144,0,0,-102,-31,0,0,7,0,-138,42,0,0,102,-31,62,0,-31,0,0,-62,0,0,0,31,124,0,-62,0,0,-124,0,0,0,62,124,0,-62,0,0,-124,0,0,0,62,62,0,-31,0,0,-62,0,0,0,31,0,0,45,0,-183,-9,0,93,18,0,0,0,216,0,33,87,0,-93,12,-93,0,0,156,0,153,99,0,-93,-12,-93,0,0,-45,0,-3,9,0,93,-18,0,0,0,-55,0,48,42,0,0,-84,31,0,0,-7,0,-48,-42,0,0,84,31],Sd=[18,-36,-122,0,120,135,0,0,-84,-31,-18,36,-2,0,-120,51,0,0,84,-31,36,-165,-27,93,147,-9,0,-93,18,0,210,45,-111,-93,-57,-192,0,93,12,93,162,141,-75,-93,-129,-180,0,93,-12,93,-36,-21,27,93,39,9,0,-93,-18,0,0,0,62,0,0,31,0,0,0,-31,0,0,124,0,0,62,0,0,0,-62,0,0,124,0,0,62,0,0,0,-62,0,0,62,0,0,31,0,0,0,-31,-18,36,-64,0,66,51,0,0,-102,31,18,-36,2,0,-66,-51,0,0,102,31];class jd{constructor(e){this.options=e,this._v00=0,this._v01=0,this._v10=0,this._v11=0,this._t=[],this._ix=this.options._width,this._iy=this.options._height}getHeight(e,t){if(e=Math.abs(e)>90?NaN:e,isNaN(e)||isNaN(t))return NaN;const r=function(e,t){t=Math.abs(t);let r=Td(e,t);2*Math.abs(r)===t?r-=Td(e,2*t)-r:2*Math.abs(r)>t&&(r+=r<0?t:-t);return r}(t,360);let n=(t=-180!==r?r:180)*this.options._rlonres,i=-e*this.options._rlatres,a=Math.floor(n),o=Math.min(Math.round((this.options._height-1)/2-1),Math.floor(i));n-=a,i-=o,o+=(this.options._height-1)/2,a+=a<0?this.options._width:a>=this.options._width?-this.options._width:0;let s=0,u=0,c=0,l=0,h=new Array(10);if(a!==this._ix||o!==this._iy)if(this.options.cubic){const e=[this._rawval(a,o-1),this._rawval(a+1,o-1),this._rawval(a-1,o),this._rawval(a,o),this._rawval(a+1,o),this._rawval(a+2,o),this._rawval(a-1,o+1),this._rawval(a,o+1),this._rawval(a+1,o+1),this._rawval(a+2,o+1),this._rawval(a,o+2),this._rawval(a+1,o+2)];let t=Ad;0!==o&&(t=o===this.options._height-2?Sd:Ed);let r=372;0!==o&&(r=o===this.options._height-2?372:240);for(let n=0;n<10;++n){h[n]=0;for(let r=0;r<12;++r)h[n]+=e[r]*t[10*r+n];h[n]/=r}}else s=this._rawval(a,o),u=this._rawval(a+1,o),c=this._rawval(a,o+1),l=this._rawval(a+1,o+1);else this.options.cubic?h=this._t:(s=this._v00,u=this._v01,c=this._v10,l=this._v11);if(!this.options.cubic){const e=(1-i)*((1-n)*s+n*u)+i*((1-n)*c+n*l),t=this.options._offset+this.options._scale*e;return this._ix=a,this._iy=o,this._v00=s,this._v01=u,this._v10=c,this._v11=l,t}let p=h[0]+n*(h[1]+n*(h[3]+n*h[6]))+i*(h[2]+n*(h[4]+n*h[7])+i*(h[5]+n*h[8]+i*h[9]));return p=this.options._offset+this.options._scale*p,this._ix=a,this._iy=o,this._t=h,p}_rawval(e,t){e<0?e+=this.options._width:e>=this.options._width&&(e-=this.options._width),(t<0||t>=this.options._height)&&(t=t<0?-t:2*(this.options._height-1)-t,e+=(e<this.options._width/2?1:-1)*this.options._width/2);const r=this.options._datastart+2*(t*this.options._swidth+e);return this.options.data[r]<<8|this.options.data[r+1]}}function Td(e,t){return e-Math.floor(e/t)*t}function Cd(e,t){const r=function*(e){let t=0;do{const r=e.indexOf(10,t);if(-1!==r){const n=e.subarray(t,r);t=r+1,yield{offset:t,line:Bd(n)}}else{const r=e.subarray(t,e.length);t=e.length,yield{offset:t,line:Bd(r)}}}while(t<e.length);return{offset:t,line:""}}(e);let n=r.next();if(n.done||"P5"!==n.value.line)throw new Error("Geoid model file: File not in PGM format");let i=Number.MAX_VALUE,a=0,o=-1,s=-1,u="NONE",c="UNKNOWN",l=0,h=0,p=null,f=null;do{n=r.next();const e=n.value.line;if(e.length){if("#"!==e[0]){let t=e.split(" ");if(t=t.filter(e=>""!==e),l=parseInt(t[0],10),h=parseInt(t[1],10),!l||!h)throw new Error("Geoid model file: Error reading raster size");break}{const r=e.split(" "),n=r[0],l=r[1];if("#"!==n||!l)continue;const h=r.length>2?r.slice(2):[];if("Description"===l)u=h.join(" ");else if("DateTime"===l)c=h.join(" ");else if("Offset"===l){if(!r[2])throw new Error("Geoid model file: Error reading offset");i=parseInt(r[2],10)}else if("Scale"===l){if(!r[2])throw new Error("Geoid model file: Error reading scale");a=parseFloat(r[2])}else l===(t.cubic?"MaxCubicError":"MaxBilinearError")?isFinite(parseFloat(r[2]))&&(o=parseFloat(r[2])):l===(t.cubic?"RMSCubicError":"RMSBilinearError")&&isFinite(parseFloat(r[2]))&&(s=parseFloat(r[2]))}}}while(!n.done);n=r.next();const d=parseInt(n.value.line,10);if(n.done)throw new Error("Geoid model file: Error reading maxval");if(65535!==d)throw new Error("Geoid model file: Incorrect value of maxval");if(p=n.value.offset,f=l,i===Number.MAX_VALUE)throw new Error("Geoid model file: Offset not set");if(0===a)throw new Error("Geoid model file: Scale not set");if(a<0)throw new Error("Geoid model file: Scale must be positive");if(h<2||l<2)throw new Error("Geoid model file: Raster size too small");if(1&l)throw new Error("Geoid model file: Raster width is odd");if(!(1&h))throw new Error("Geoid model file: Raster height is even");const m=l/360,g=(h-1)/180;return new jd({cubic:t.cubic,_width:l,_height:h,_rlonres:m,_rlatres:g,_offset:i,_scale:a,_swidth:f,_datastart:p,_maxerror:o,_rmserror:s,_description:u,_datetime:c,data:e})}function Bd(e){let t="";for(const r of e)t+=String.fromCharCode(r);return t}const Rd={name:"PGM - Netpbm grayscale image format",id:"pgm",module:"tile-converter",version:"3.2.7",mimeTypes:["image/x-portable-graymap"],parse:async(e,t)=>Cd(new Uint8Array(e),t),extensions:["pgm"],options:{cubic:!1}};function Od(e,t){const r=[e.center[0],e.center[1],e.center[2]+t.getHeight(e.center[1],e.center[0])],n=vu.WGS84.cartographicToCartesian(r,new Is),i=(new lp).fromCenterHalfSizeQuaternion(n,e.halfSize,e.quaternion);return[...i.center,...i.halfAxes.toArray()]}function Id(e,t){const r=[],n=e.boundingVolume,i=e.lodMetricValue||.1,a={metricType:"maxScreenThreshold",maxError:2*t.mbs[3]*16/i},o={metricType:"maxScreenThresholdSQ",maxError:.25*Math.PI*a.maxError*a.maxError};return"OrientedBoundingBox"===n.constructor.name?(r.push(o),r.push(a)):(r.push(a),r.push(o)),r}function Pd(e){let t=(e.header.lodSelection.maxScreenThreshold||{}).maxError;if(!t){const r=e.header.lodSelection.maxScreenThresholdSQ;r&&(t=Math.sqrt(r.maxError/(.25*Math.PI)))}return t||(t=16),2*e.header.mbs[3]*16/t}r(259);var Dd=r(80),Md=r.n(Dd);function Fd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ld={command:"",arguments:[],port:5e3,autoPort:!0,wait:2e3,onSuccess:e=>{console.log("Started "+e.props.command)}};class Nd{constructor({id:e="browser-driver"}={}){Fd(this,"id",void 0),Fd(this,"props",{...Ld}),Fd(this,"childProcess",null),Fd(this,"port",0),Fd(this,"successTimer",void 0),this.id=e}async start(e){e={...Ld,...e},this.props=e;const t=[...e.arguments];return this.port=Number(e.port),e.portArg&&(e.autoPort&&(this.port=await function(e=3e3){return new Promise(t=>{Md.a.exec("lsof -i -P -n | grep LISTEN",(r,n)=>{if(r)return void t(e);const i=[],a=/:(\d+) \(LISTEN\)/;n.split("\n").forEach(e=>{const t=a.exec(e);t&&i.push(Number(t[1]))});let o=e;for(;i.includes(o);)o++;t(o)})})}(e.port)),t.push(e.portArg,String(this.port))),await new Promise((r,n)=>{try{this._setTimeout(()=>{e.onSuccess&&e.onSuccess(this),r({})}),console.log(`Spawning ${e.command} ${e.arguments.join(" ")}`);const i=Dd.spawn(e.command,t,e.spawn);this.childProcess=i,i.stdout.on("data",e=>{console.log(e.toString())}),i.stderr.on("data",e=>{console.log(`Child process wrote to stderr: "${e}".`),this._clearTimeout(),n(new Error(e))}),i.on("error",e=>{console.log("Child process errored with "+e),this._clearTimeout(),n(e)}),i.on("close",e=>{console.log("Child process exited with "+e),this.childProcess=null,this._clearTimeout(),r({})})}catch(e){n(e)}})}async stop(){this.childProcess&&(this.childProcess.kill(),this.childProcess=null)}async exit(e=0){try{await this.stop(),process.exit(e)}catch(e){console.error(e.message||e),process.exit(1)}}_setTimeout(e){Number(this.props.wait)>0&&(this.successTimer=setTimeout(e,this.props.wait))}_clearTimeout(){this.successTimer&&clearTimeout(this.successTimer)}}var zd=r(79),Ud=r.n(zd);const qd="function"==typeof atob?atob:"function"==typeof Buffer?function(e){return Buffer.from(e,"base64").toString("binary")}:Vd,Hd=qd("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"),Gd=!(!WebAssembly||qd===Vd)&&function(e){var t,r,n,i=-1;t=e.length-1,r=new ArrayBuffer(e.length),n=new Uint8Array(r);for(;t>i++;)n[i]=e.charCodeAt(i);return n}(Hd).buffer;Math.floor(1048576.00032768);function Vd(e){return e}Gd||console.log("WebAssembly not available or WASM module could not be decoded; md5WASM will fall back to JavaScript");r(112);async function Wd(e,t,r,n,i){"win32"===process.platform?await async function(e,t,r=0,n=Object(ji.join)(".","*"),i){"@"===n[0]&&(n="*"+n.substr(1));const a=$d(t),o=["a","-tzip","-mx="+r,a,n],s=new Nd;await s.start({command:i,arguments:o,spawn:{cwd:""+e},wait:0})}(e,t,r,n,i):await async function(e,t,r=0,n="."){const i=$d(t),a=["-"+r,"-r",i,n],o=new Nd;await o.start({command:"zip",arguments:a,spawn:{cwd:e},wait:0})}(e,t,r,n)}async function Kd(e,t,r="index.json"){let n;n=t instanceof Promise?new Uint8Array(await t):t instanceof ArrayBuffer?new Uint8Array(t):t,await he.promises.mkdir(e,{recursive:!0});const i=Object(ji.join)(e,r);try{await he.promises.writeFile(i,n)}catch(e){throw e}return console.log(i+" saved."),i}async function Jd(e,t,r="index.json",n=!0){const i=await Kd(e,t,r);if(n){const e=await function(e){const t=e+".gz",r=Object(ye.createGzip)(),n=Object(he.createReadStream)(e),i=Object(he.createWriteStream)(t);return new Promise((e,a)=>{n.on("end",()=>{console.log(t+" compressed and saved."),e(t)}),n.on("error",e=>{console.log(t+": compression error!"),a(e)}),n.pipe(r).pipe(i)})}(i);return await Yd(i),e}return i}function Qd(e){return he.promises.rmdir(e,{recursive:!0})}function Yd(e){return he.promises.unlink(e)}function $d(e){return Object(ji.isAbsolute)(e)?e:Object(ji.join)(process.cwd(),e)}function Xd(e){let t=e[0];const r=Math.floor(t/3600);t-=3600*r;const n=Math.floor(t/60);t-=60*n;const i=Math.floor(t),a=e[1]/1e6;let o="";return r&&(o+=r+"h "),n&&(o+=n+"m "),i&&(o+=i+"s"),o||(o+=a+"ms"),o}async function Zd(e){const{slpk:t,outputPath:r,tilesetName:n}=e,i=$d(r);try{if(t){const e=Object(ji.join)(i,n+".slpk");return(await he.promises.stat(e)).size}const e=Object(ji.join)(i,n);return await async function e(t){let r=0;const n=await he.promises.readdir(t);for(const i of n){const n=await he.promises.stat(Object(ji.join)(t,i));n.isDirectory()?r+=await e(Object(ji.join)(t,i)):r+=n.size}return r}(e)}catch(e){return console.log("Calculate file sizes error: ",e),null}}const em=()=>({boundingVolume:{path:"boundingVolume"},geometricError:{path:"geometricError"},content:{path:"content"},children:{path:"children",transform:e=>e.map(e=>Ri()(e,em()))}});async function tm(e,t,r={},n={}){const i=function(e){const t="3.2.7"!==e.version?" (worker-utils@3.2.7)":"";return`${e.name}@${e.version}${t}`}(e),a=La.getWorkerFarm(r),{source:o}=r,s={name:i,source:o};o||(s.url=Na(e,r));const u=a.getWorkerPool(s),c=r.jobName||e.name,l=await u.startJob(c,rm.bind(null,n)),h=function e(t){if(null===t)return{};const r=Object.assign({},t);return Object.keys(r).forEach(n=>{"object"!=typeof t[n]||ArrayBuffer.isView(t[n])?"function"==typeof r[n]||r[n]instanceof RegExp?r[n]={}:r[n]=t[n]:r[n]=e(t[n])}),r}(r);l.postMessage("process",{input:t,options:h});return(await l.result).result}async function rm(e,t,r,n){switch(r){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":const{id:i,input:a,options:o}=n;try{if(!e.process)return void t.postMessage("error",{id:i,error:"Worker not set up to process on main thread"});const r=await e.process(a,o);t.postMessage("done",{id:i,result:r})}catch(e){const r=e instanceof Error?e.message:"unknown error";t.postMessage("error",{id:i,error:r})}break;default:console.warn("process-on-worker: unknown message "+r)}}async function nm(e,t,r){if(function(e,t){return!!La.isSupported()&&(!!(Oi||null!=t&&t._nodeWorkers)&&(e.worker&&(null==t?void 0:t.worker)))}(t,r={...la(),...r}))return await tm(t,e,r);if(t.encode)return await t.encode(e,r);if(t.encodeSync)return t.encodeSync(e,r);if(t.encodeText)return(new TextEncoder).encode(await t.encodeText(e,r));if(t.encodeInBatches){const n=function(e,t,r){if(t.encodeInBatches){const n=function(e){return[{table:e,start:0,end:e.length}]}(e);return t.encodeInBatches(n,r)}throw new Error("Writer could not encode data in batches")}(e,t,r),i=[];for await(const e of n)i.push(e);return Wa(...i)}if(!Oi&&t.encodeURLtoURL){const n=am("input");await async function(e,t,r){e=Ji(e),Oi||await i.writeFile(e,Ga(t),{flag:"w"}),Hi(!1)}(n,e);const a=am("output"),o=await async function(e,t,r,n){if(e=Ji(e),t=Ji(t),Oi||!r.encodeURLtoURL)throw new Error;return await r.encodeURLtoURL(e,t,n)}(n,a,t,r);return(await ia(o)).arrayBuffer()}throw new Error("Writer could not encode data")}function im(e,t,r){if(t.encodeSync)return t.encodeSync(e,r);throw new Error("Writer could not synchronously encode data")}function am(e){return"/tmp/"+e}function om(e,t){return Hi(e>=0),Hi(t>0),e+(t-1)&~(t-1)}function sm(e,t,r){let n;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else{const t=e.byteOffset,r=e.byteLength;n=new Uint8Array(e.buffer||e.arrayBuffer,t,r)}return t.set(n,r),r+om(n.byteLength,4)}function um(e,t){if(!e)throw new Error(t||"assert failed: gltf")}const cm=["SCALAR","VEC2","VEC3","VEC4"],lm=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],hm=new Map(lm),pm={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},fm={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},dm={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function mm(e){return cm[e-1]||cm[0]}function gm(e){const t=hm.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function ym(e,t){const r=dm[e.componentType],n=pm[e.type],i=fm[e.componentType],a=e.count*n,o=e.count*n*i;return um(o>=0&&o<=t.byteLength),{ArrayType:r,length:a,byteLength:o}}function bm(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const vm={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]};class wm{constructor(e){bm(this,"gltf",void 0),bm(this,"sourceBuffers",void 0),bm(this,"byteLength",void 0),this.gltf=e||{json:{...vm},buffers:[]},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]}getExtension(e){const t=this.getUsedExtensions().find(t=>t===e),r=this.json.extensions||{};return t?r[e]||!0:null}getRequiredExtension(e){return this.getRequiredExtensions().find(t=>t===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}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,t){if("object"==typeof t)return t;const r=this.json[e]&&this.json[e][t];if(!r)throw new Error(`glTF file error: Could not find ${e}[${t}]`);return r}getTypedArrayForBufferView(e){const t=(e=this.getBufferView(e)).buffer,r=this.gltf.buffers[t];um(r);const n=(e.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,n,e.byteLength)}getTypedArrayForAccessor(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),r=this.getBuffer(t.buffer).data,{ArrayType:n,length:i}=ym(e,t);return new n(r,t.byteOffset+e.byteOffset,i)}getTypedArrayForImageData(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),r=this.getBuffer(t.buffer).data,n=t.byteOffset||0;return new Uint8Array(r,n,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addObjectExtension(e,t,r){return e.extensions=e.extensions||{},e.extensions[t]=r,this.registerUsedExtension(t),this}setObjectExtension(e,t,r){(e.extensions||{})[t]=r}removeObjectExtension(e,t){const r=e.extensions||{},n=r[t];return delete r[t],n}addExtension(e,t={}){return um(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return um(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}removeExtension(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}setDefaultScene(e){this.json.scene=e}addScene(e){const{nodeIndices:t}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}addNode(e){const{meshIndex:t,matrix:r}=e;this.json.nodes=this.json.nodes||[];const n={mesh:t};return r&&(n.matrix=r),this.json.nodes.push(n),this.json.nodes.length-1}addMesh(e){const{attributes:t,indices:r,material:n,mode:i=4}=e,a={primitives:[{attributes:this._addAttributes(t),mode:i}]};if(r){const e=this._addIndices(r);a.primitives[0].indices=e}return Number.isFinite(n)&&(a.primitives[0].material=n),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(e){const t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}addImage(e,t){const r=Mu(e),n=t||(null==r?void 0:r.mimeType),i={bufferView:this.addBufferView(e),mimeType:n};return this.json.images=this.json.images||[],this.json.images.push(i),this.json.images.length-1}addBufferView(e){const t=e.byteLength;um(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const r={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=om(t,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(r),this.json.bufferViews.length-1}addAccessor(e,t){const r={bufferView:e,type:mm(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){const r=this.addBufferView(e);let n={min:t.min,max:t.max};n.min&&n.max||(n=this._getAccessorMinMax(e,t.size));const i={size:t.size,componentType:gm(e),count:Math.round(e.length/t.size),min:n.min,max:n.max};return this.addAccessor(r,Object.assign(i,t))}addTexture(e){const{imageIndex:t}=e,r={source:t};return this.json.textures=this.json.textures||[],this.json.textures.push(r),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,t;this.gltf.buffers=[];const r=this.byteLength,n=new ArrayBuffer(r),i=new Uint8Array(n);let a=0;for(const e of this.sourceBuffers||[])a=sm(e,i,a);null!==(e=this.json)&&void 0!==e&&null!==(t=e.buffers)&&void 0!==t&&t[0]?this.json.buffers[0].byteLength=r:this.json.buffers=[{byteLength:r}],this.gltf.binary=n,this.sourceBuffers=[n]}_removeStringFromArray(e,t){let r=!0;for(;r;){const n=e.indexOf(t);n>-1?e.splice(n,1):r=!1}}_addAttributes(e={}){const t={};for(const r in e){const n=e[r],i=this._getGltfAttributeName(r),a=this.addBinaryBuffer(n.value,n);t[i]=a}return t}_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,t){const r={min:null,max:null};if(e.length<t)return r;r.min=[],r.max=[];const n=e.subarray(0,t);for(const e of n)r.min.push(e),r.max.push(e);for(let n=t;n<e.length;n+=t)for(let i=0;i<t;i++)r.min[0+i]=Math.min(r.min[0+i],e[n+i]),r.max[0+i]=Math.max(r.max[0+i],e[n+i]);return r}}function _m(e,t,r,n){const i=om(r.byteLength,n),a=i-r.byteLength;if(e){const n=new Uint8Array(e.buffer,e.byteOffset+t,r.byteLength),i=new Uint8Array(r);n.set(i);for(let n=0;n<a;++n)e.setUint8(t+r.byteLength+n,32)}return t+=i}function km(e,t,r,n){return t=_m(e,t,(new TextEncoder).encode(r),n)}const xm=1179937895;function Em(e,t,r,n){return function(e,{firstBuffer:t=0}={}){if(e.buffers&&e.buffers.length>t)throw new Error("encodeGLTF: multiple buffers not yet implemented")}(e),function(e,t,r=0,n={}){const{magic:i=xm,version:a=2,json:o={},binary:s}=e,u=r;t&&(t.setUint32(r+0,i,!0),t.setUint32(r+4,a,!0),t.setUint32(r+8,0,!0));const c=r+8,l=r+=12;if(t&&(t.setUint32(r+0,0,!0),t.setUint32(r+4,1313821514,!0)),r=km(t,r+=8,JSON.stringify(o),4),t){const e=r-l-8;t.setUint32(l+0,e,!0)}if(s){const e=r;if(t&&(t.setUint32(r+0,0,!0),t.setUint32(r+4,5130562,!0)),r=_m(t,r+=8,s,4),t){const n=r-e-8;t.setUint32(e+0,n,!0)}}if(t){const e=r-u;t.setUint32(c,e,!0)}return r}(e,t,r,n)}const Am={name:"glTF",id:"gltf",module:"gltf",version:"3.2.7",extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,encodeSync:function(e,t={}){const{byteOffset:r=0}=t,n=Em(e,null,r,t),i=new ArrayBuffer(n),a=new DataView(i);return Em(e,a,r,t),i},options:{gltf:{}}};const Sm={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},jm=(Object.keys(Sm),{BATCHED_MODEL:[98,51,100,109],INSTANCED_MODEL:[105,51,100,109],POINT_CLOUD:[112,110,116,115],COMPOSITE:[99,109,112,116]});function Tm(e,t,r){if(!t)return r+12;const{magic:n,version:i=1,byteLength:a=12}=e;return Hi(Array.isArray(n)&&Number.isFinite(i)&&Number.isFinite(a)),t.setUint8(r+0,n[0]),t.setUint8(r+1,n[1]),t.setUint8(r+2,n[2]),t.setUint8(r+3,n[3]),t.setUint32(r+4,i,!0),t.setUint32(r+8,a,!0),r+=12}function Cm(e,t,r){e&&e.setUint32(t+8,r,!0)}function Bm(e,t,r,n){if(e)for(let i=0;i<n;i++)e.setUint8(t+i,r.charCodeAt(i));return t+n}function Rm(e,t,r,n){if(e)for(let i=0;i<n;i++)e.setUint8(t+i,r[i]);return t+n}const Om={POINTS_LENGTH:1,POSITIONS:{byteOffset:0}};function Im(e,t,r,n){const{featureTableJson:i=Om}=e;let a=JSON.stringify(i);a=function(e,t){const r=e.length,n=Math.ceil(r/t)*t-r;let i="";for(let e=0;e<n;++e)i+=" ";return e+i}(a,4);const{featureTableJsonByteLength:o=a.length}=e,s=new ArrayBuffer(12),u=s.byteLength,c=r;return r+=Tm(e={magic:jm.POINT_CLOUD,...e},t,0),t&&(t.setUint32(r+0,o,!0),t.setUint32(r+4,u,!0),t.setUint32(r+8,0,!0),t.setUint32(r+12,0,!0)),r+=16,r+=Bm(t,r,a,o),Cm(t,c,(r+=Rm(t,r,s,u))-c),r}function Pm(e,t,r,n){switch(Hi("string"==typeof e.type),e.type){case Sm.COMPOSITE:return function(e,t,r,n,i){const a=r;r+=Tm(e={magic:jm.COMPOSITE,tiles:[],...e},t,r),t&&t.setUint32(r,e.tiles.length,!0),r+=4;for(let a=0;a<e.tiles.length;++a)r+=i(e.tiles[a],t,r,n);return Cm(t,a,r-a),r}(e,t,r,n,Pm);case Sm.POINT_CLOUD:return Im(e,t,r);case Sm.BATCHED_3D_MODEL:return function(e,t,r,n){const{featuresLength:i=0,batchTable:a}=e,o={BATCH_LENGTH:i},s=JSON.stringify(o),u=a?JSON.stringify(a):"",c=om(s.length,8),l=u?om(u.length,8):0,h=r;r=Tm(e={magic:jm.BATCHED_MODEL,...e},t,r),t&&(t.setUint32(12,c,!0),t.setUint32(16,0,!0),t.setUint32(20,l,!0),t.setUint32(24,0,!0)),r=km(t,r+=16,s,8),a&&(r=km(t,r,u,8));const p=e.gltfEncoded;return p&&(r=Rm(t,r,p,p.byteLength)),Cm(t,h,r-h),r}(e,t,r);case Sm.INSTANCED_3D_MODEL:return function(e,t,r,n){const{featuresLength:i=1,gltfFormat:a=1,gltfUri:o=""}=e,s=o.length,u={INSTANCES_LENGTH:i,POSITION:new Array(3*i).fill(0)},c=JSON.stringify(u),l=c.length,h=r;return r=Tm(e={magic:jm.INSTANCED_MODEL,...e},t,0),t&&(t.setUint32(12,l,!0),t.setUint32(16,0,!0),t.setUint32(20,0,!0),t.setUint32(24,0,!0),t.setUint32(28,a,!0)),r+=20,r+=Bm(t,r,c,l),Cm(t,h,(r+=Bm(t,r,o,s))-h),r}(e,t,r);default:throw new Error("3D Tiles: unknown tile type")}}const Dm={name:"3D Tile",id:"3d-tiles",module:"3d-tiles",version:"3.2.7",extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],encodeSync:function(e,t){return function(e,t){const r=Pm(e,null,0,t),n=new ArrayBuffer(r);return Pm(e,new DataView(n),0,t),n}(e,t)},binary:!0,options:{"3d-tiles":{}}};function Mm(e){return[e[0]-Math.floor(e[0]),e[1]-Math.floor(e[1])]}function Fm(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Lm=new Ws([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),Nm=new Is;class zm{constructor(){Fm(this,"rtcCenter",void 0),Fm(this,"i3sTile",void 0)}async convert(e,t=null){const r=await this.buildGltf(e);return im({gltfEncoded:new Uint8Array(r),type:"b3dm",featuresLength:this._getFeaturesLength(t),batchTable:t},Dm)}async buildGltf(e){const{tileContent:t,textureFormat:r}=e,{material:n,attributes:i,indices:a,cartesianOrigin:o,cartographicOrigin:s,modelMatrix:u}=t,c=new wm,l=await this._addI3sTextureToGltf(t,r,c),h=this._convertI3sMaterialToGltfMaterial(n,l),p=c.addMaterial(h),f=i.positions,d=f.value;i.uvRegions&&i.texCoords&&(i.texCoords.value=function(e,t){const r=new Float32Array(e.length),n=function(e){const t=[];for(let r=0;r<e.length;r++)t[r]=e[r]/65535;return t}(t);for(let t=0;t<e.length;t+=2){const i=e.subarray(t,t+2),a=n.slice(2*t,2*t+4),o=Mm([i[0],i[1]]),s=[a[2]-a[0],a[3]-a[1]],u=[o[0]*s[0],o[1]*s[1]],c=[u[0]+a[0],u[1]+a[1]];r[t]=c[0],r[t+1]=c[1]}return r}(i.texCoords.value,i.uvRegions.value)),i.positions.value=this._normalizePositions(d,o,s,u),i.normals&&!this._checkNormals(i.normals.value)&&delete i.normals;const m=a||this._generateSynteticIndices(d.length/f.size),g=c.addMesh({attributes:i,indices:m,material:p,mode:4}),y=this._generateTransformMatrix(o),b=c.addNode({meshIndex:g,matrix:y}),v=c.addScene({nodeIndices:[b]});c.setDefaultScene(v),c.createBinaryChunk();return im(c.gltf,Am)}async _addI3sTextureToGltf(e,t,r){const{texture:n,material:i,attributes:a}=e;let o=null,s=n;if(!n&&i&&(s=i.pbrMetallicRoughness&&i.pbrMetallicRoughness.baseColorTexture&&i.pbrMetallicRoughness.baseColorTexture.texture.source.image),s){const e=this._deduceMimeTypeFromFormat(t),n=r.addImage(s,e);o=r.addTexture({imageIndex:n}),delete a.colors}return o}_normalizePositions(e,t,r,n){const i=new Float32Array(e.length);for(let a=0;a<e.length;a+=3){const o=e.subarray(a,a+3),s=new Is(t);let u=new Is(Array.from(o)).transform(n).add(r);vu.WGS84.cartographicToCartesian(u,Nm),u=Nm.subtract(s),i.set(u,a)}return i}_generateTransformMatrix(e){return(new Ws).translate(e).multiplyLeft(Lm)}_generateBatchId(e){const t=3*(e[e.length-1]+1),r=new Float32Array(t);let n=0,i=0;for(let t=0;t<e.length/2;t++){const t=3*e[n],a=3*(e[n+1]+1);r.fill(i,t,a),n+=2,i+=1}return r}_generateSynteticIndices(e){const t=new Uint32Array(e);for(let r=0;r<e;r++)t.set([r],r);return t}_deduceMimeTypeFromFormat(e){switch(e){case"jpg":return"image/jpeg";case"png":return"image/png";case"ktx2":return"image/ktx2";default:return console.warn("Unexpected texture format in I3S: "+e),"image/jpeg"}}_convertI3sMaterialToGltfMaterial(e,t){return e?(null!==t&&(e=this._setGltfTexture(e,t)),e):(e={alphaMode:"OPAQUE",doubleSided:!1,pbrMetallicRoughness:{metallicFactor:0,roughnessFactor:1}},null!==t?e.pbrMetallicRoughness.baseColorTexture={index:t,texCoord:0}:e.pbrMetallicRoughness.baseColorFactor=[1,1,1,1],e)}_setGltfTexture(e,t){const r={...e,pbrMetallicRoughness:{...e.pbrMetallicRoughness}};return e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture?r.pbrMetallicRoughness.baseColorTexture={index:t,texCoord:0}:e.emissiveTexture?r.emissiveTexture={index:t,texCoord:0}:e.pbrMetallicRoughness&&e.pbrMetallicRoughness.metallicRoughnessTexture?r.pbrMetallicRoughness.metallicRoughnessTexture={index:t,texCoord:0}:e.normalTexture?r.normalTexture={index:t,texCoord:0}:e.occlusionTexture&&(r.occlusionTexture={index:t,texCoord:0}),r}_getFeaturesLength(e){if(!e)return 0;const t=Object.keys(e)[0];return t?e[t].length:0}_checkNormals(e){return e.find(e=>e)}}function Um(e,t){let r,n,i;const a=e.boundingVolume,o=vu.WGS84.cartesianToCartographic(a.center,new Is);return o[2]=o[2]-t.getHeight(o[1],o[0]),a instanceof lp?(n=a.halfSize,r=new Is(n[0],n[1],n[2]).len(),i=a.quaternion):(r=e.boundingVolume.radius,n=[r,r,r],i=(new Kh).fromMatrix3(new Ah([n[0],0,0,0,n[1],0,0,0,n[2]])).normalize()),{mbs:[o[0],o[1],o[2],r],obb:{center:[o[0],o[1],o[2]],halfSize:n,quaternion:i}}}function qm(e,t){const r=function(e){const t=[];for(let r=0;r<e.length;r+=3){const n=new Is([e[r],e[r+1],e[r+2]]);t.push(n)}return t}(e),n=function(e,t=new lp){if(!e||0===e.length)return t.halfAxes=new Ah([0,0,0,0,0,0,0,0,0]),t.center=new Is,t;const r=e.length,n=new Is(0,0,0);for(const t of e)n.add(t);const i=1/r;n.multiplyByScalar(i);let a=0,o=0,s=0,u=0,c=0,l=0;for(const t of e){const e=zp.copy(t).subtract(n);a+=e.x*e.x,o+=e.x*e.y,s+=e.x*e.z,u+=e.y*e.y,c+=e.y*e.z,l+=e.z*e.z}a*=i,o*=i,s*=i,u*=i,c*=i,l*=i;const h=Vp;h[0]=a,h[1]=o,h[2]=s,h[3]=o,h[4]=u,h[5]=c,h[6]=s,h[7]=c,h[8]=l;const{unitary:p}=Dp(h,Wp),f=t.halfAxes.copy(p);let d=f.getColumn(0,qp),m=f.getColumn(1,Hp),g=f.getColumn(2,Gp),y=-Number.MAX_VALUE,b=-Number.MAX_VALUE,v=-Number.MAX_VALUE,w=Number.MAX_VALUE,_=Number.MAX_VALUE,k=Number.MAX_VALUE;for(const t of e)y=Math.max(t.dot(d),y),b=Math.max(t.dot(m),b),v=Math.max(t.dot(g),v),w=Math.min(t.dot(d),w),_=Math.min(t.dot(m),_),k=Math.min(t.dot(g),k);d=d.multiplyByScalar(.5*(w+y)),m=m.multiplyByScalar(.5*(_+b)),g=g.multiplyByScalar(.5*(k+v)),t.center.copy(d).add(m).add(g);const x=Up.set(y-w,b-_,v-k).multiplyByScalar(.5),E=new Ah([x[0],0,0,0,x[1],0,0,0,x[2]]);return t.halfAxes.multiplyRight(E),t}(r),i=function(e,t=new bh){if(!e||0===e.length)return t.fromCenterRadius([0,0,0],0);const r=Ep.copy(e[0]),n=bp.copy(r),i=vp.copy(r),a=wp.copy(r),o=_p.copy(r),s=kp.copy(r),u=xp.copy(r);for(const t of e){r.copy(t);const e=r.x,c=r.y,l=r.z;e<n.x&&r.copy(n),e>o.x&&r.copy(o),c<i.y&&r.copy(i),c>s.y&&r.copy(s),l<a.z&&r.copy(a),l>u.z&&r.copy(u)}const c=Ap.copy(o).subtract(n).magnitudeSquared(),l=Ap.copy(s).subtract(i).magnitudeSquared(),h=Ap.copy(u).subtract(a).magnitudeSquared();let p=n,f=o,d=c;l>d&&(d=l,p=i,f=s),h>d&&(d=h,p=a,f=u);const m=Sp;m.x=.5*(p.x+f.x),m.y=.5*(p.y+f.y),m.z=.5*(p.z+f.z);let g=Ap.copy(f).subtract(m).magnitudeSquared(),y=Math.sqrt(g);const b=jp;b.x=n.x,b.y=i.y,b.z=a.z;const v=Tp;v.x=o.x,v.y=s.y,v.z=u.z;const w=Cp.copy(b).add(v).multiplyByScalar(.5);let _=0;for(const t of e){r.copy(t);const e=Ap.copy(r).subtract(w).magnitude();e>_&&(_=e);const n=Ap.copy(r).subtract(m).magnitudeSquared();if(n>g){const e=Math.sqrt(n);y=.5*(y+e),g=y*y;const t=e-y;m.x=(y*m.x+t*r.x)/e,m.y=(y*m.y+t*r.y)/e,m.z=(y*m.z+t*r.z)/e}}return y<_?(m.to(t.center),t.radius=y):(w.to(t.center),t.radius=_),t}(r);let a=vu.WGS84.cartesianToCartographic(i.center,new Is),o=vu.WGS84.cartesianToCartographic(n.center,new Is);return a[2]=a[2]-t.getHeight(a[1],a[0]),o[2]=o[2]-t.getHeight(o[1],o[0]),{mbs:[a[0],a[1],a[2],i.radius],obb:{center:o,halfSize:n.halfSize,quaternion:n.quaternion}}}function Hm(e){const t=e[3],r=new Is(e[0],e[1],e[2]),n=new Ah([t,0,0,0,t,0,0,0,t]);return new lp(r,n)}const Gm={id:"3d-tiles-attributes",name:"3DTiles Attributes Worker",module:"tile-converter",version:"3.2.7",options:{attributes:null}};const Vm="Tile converter does not work in browser, only in node js environment";function Wm(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Km{constructor(){Wm(this,"options",void 0),Wm(this,"tilesetPath",void 0),Wm(this,"vertexCounter",void 0),Wm(this,"conversionStartTime",void 0),Wm(this,"geoidHeightModel",void 0),Wm(this,"sourceTileset",void 0),Wm(this,"attributeStorageInfo",void 0),Wm(this,"workerSource",{}),this.options={},this.tilesetPath="",this.vertexCounter=0,this.conversionStartTime=[0,0],this.geoidHeightModel=null,this.sourceTileset=null,this.attributeStorageInfo=null,this.workerSource={}}async convert(e){if(Oi)return console.log(Vm),Vm;const{inputUrl:t,outputPath:r,tilesetName:n,maxDepth:i,egmFilePath:a}=e;this.conversionStartTime=Ci.a.hrtime(),this.options={maxDepth:i},console.log("Loading egm file..."),this.geoidHeightModel=await $o(a,Rd),console.log("Loading egm file completed!"),await this.loadWorkers();const o=await $o(t,gf,{});this.sourceTileset=new xd(o,{loadOptions:{i3s:{coordinateSystem:sh.LNGLAT_OFFSETS,decodeTextures:!1}}}),await this.sourceTileset.tilesetInitializationPromise;const s=this.sourceTileset.root;s.header.obb||(s.header.obb=Hm(s.header.mbs)),this.tilesetPath=Object(ji.join)(""+r,""+n),this.attributeStorageInfo=o.attributeStorageInfo;try{await Qd(this.tilesetPath)}catch(e){}const u={boundingVolume:{box:Od(s.header.obb,this.geoidHeightModel)},geometricError:Pd(s),children:[]};await this._addChildren(s,u,1);const c=Ri()({root:u},{asset:{path:"asset",transform:e=>Ri()(e,{version:{path:"version",default:"1.0"}})},geometricError:{path:"root",transform:e=>e.geometricError},root:{path:"root",transform:e=>Ri()(e,em())}});await Kd(this.tilesetPath,JSON.stringify(c),"tileset.json"),this._finishConversion({slpk:!1,outputPath:r,tilesetName:n});La.getWorkerFarm({}).destroy()}async _addChildren(e,t,r){if(!(this.options.maxDepth&&r>this.options.maxDepth))for(const i of e.header.children||[]){const a=await this._loadChildNode(e,i);if(e.children.push(a),a.contentUrl){var n;await this.sourceTileset._loadTile(a),this.vertexCounter+=a.content.vertexCount;let e=null;this.attributeStorageInfo&&(e=await this._loadChildAttributes(a,this.attributeStorageInfo)),a.header.obb||(a.header.obb=Hm(a.header.mbs));const i={box:Od(a.header.obb,this.geoidHeightModel)},o={boundingVolume:i,geometricError:Pd(a),children:[]},s={tileContent:a.content,textureFormat:null==a||null===(n=a.header)||void 0===n?void 0:n.textureFormat},u=await(new zm).convert(s,e);o.content={uri:a.id+".b3dm",boundingVolume:i},await Kd(this.tilesetPath,new Uint8Array(u),a.id+".b3dm"),t.children.push(o),a.unloadContent(),await this._addChildren(a,o,r+1)}else await this._addChildren(a,t,r+1)}}async _loadChildNode(e,t){let r;if(this.sourceTileset.tileset.nodePages)console.log("Node conversion: "+t.id),r=await this.sourceTileset.tileset.nodePagesTile.formTileFromNodePages(t.id);else{const{loader:n}=this.sourceTileset,i=this._relativeUrlToFullUrl(e.url,t.href),a={i3s:{...this.sourceTileset.loadOptions,isTileHeader:!0,loadContent:!1}};console.log("Node conversion: "+i),r=await $o(i,n,a)}return new hd(this.sourceTileset,r,e)}_relativeUrlToFullUrl(e,t){let r=e.split("/");const n=t.split("/");for(const e of n)switch(e){case".":continue;case"..":r=r.slice(0,-1);break;default:r.push(e)}return r.join("/")}async _loadChildAttributes(e,t){const r=[],{attributeUrls:n}=e.header;for(let e=0;e<n.length;e++){const i=n[e],a=t[e],o={attributeName:a.name,attributeType:this._getAttributeType(a)};r.push($o(i,wf,o))}const i=await Promise.all(r);return this._replaceNestedArrays(i),Object.assign({},...i)}_getAttributeType(e){return e.attributeValues?e.attributeValues.valueType:e.objectIds?"Oid32":""}_replaceNestedArrays(e){for(let t=0;t<e.length;t++){const r=e[t];for(const e in r)r[e]=Array.from(r[e])}}async _finishConversion(e){const t=await Zd(e),r=Xd(Ci.a.hrtime(this.conversionStartTime));console.log("------------------------------------------------"),console.log("Finish conversion of I3S"),console.log("Total conversion time: "+r),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",t," bytes"),console.log("------------------------------------------------")}async loadWorkers(){console.log("Loading workers source...");const e=Na(Gm,{...la()}),t=await ia(e),r=await t.text();this.workerSource.tile3dWorkerSource=r,console.log("Loading workers source completed!")}}function Jm(e,t,r){Hi(e instanceof ArrayBuffer);const n=new TextDecoder("utf8"),i=new Uint8Array(e,t,r);return n.decode(i)}const Qm={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},Ym={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,...Qm},$m={[Qm.DOUBLE]:Float64Array,[Qm.FLOAT]:Float32Array,[Qm.UNSIGNED_SHORT]:Uint16Array,[Qm.UNSIGNED_INT]:Uint32Array,[Qm.UNSIGNED_BYTE]:Uint8Array,[Qm.BYTE]:Int8Array,[Qm.SHORT]:Int16Array,[Qm.INT]:Int32Array},Xm={DOUBLE:Qm.DOUBLE,FLOAT:Qm.FLOAT,UNSIGNED_SHORT:Qm.UNSIGNED_SHORT,UNSIGNED_INT:Qm.UNSIGNED_INT,UNSIGNED_BYTE:Qm.UNSIGNED_BYTE,BYTE:Qm.BYTE,SHORT:Qm.SHORT,INT:Qm.INT};class Zm{static fromTypedArray(e){e=ArrayBuffer.isView(e)?e.constructor:e;for(const t in $m){if($m[t]===e)return t}throw new Error("Failed to convert GL type")}static fromName(e){const t=Xm[e];if(!t)throw new Error("Failed to convert GL type");return t}static getArrayType(e){switch(e){case Qm.UNSIGNED_SHORT_5_6_5:case Qm.UNSIGNED_SHORT_4_4_4_4:case Qm.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:const t=$m[e];if(!t)throw new Error("Failed to convert GL type");return t}}static getByteSize(e){return Zm.getArrayType(e).BYTES_PER_ELEMENT}static validate(e){return Boolean(Zm.getArrayType(e))}static createTypedArray(e,t,r=0,n){void 0===n&&(n=(t.byteLength-r)/Zm.getByteSize(e));return new(Zm.getArrayType(e))(t,r,n)}}function eg(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class tg{constructor(e,t){eg(this,"json",void 0),eg(this,"buffer",void 0),eg(this,"featuresLength",0),eg(this,"_cachedTypedArrays",{}),this.json=e,this.buffer=t}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return Boolean(this.json[e])}getGlobalProperty(e,t=Ym.UNSIGNED_INT,r=1){const n=this.json[e];return n&&Number.isFinite(n.byteOffset)?this._getTypedArrayFromBinary(e,t,r,1,n.byteOffset):n}getPropertyArray(e,t,r){const n=this.json[e];return n&&Number.isFinite(n.byteOffset)?("componentType"in n&&(t=Zm.fromName(n.componentType)),this._getTypedArrayFromBinary(e,t,r,this.featuresLength,n.byteOffset)):this._getTypedArrayFromArray(e,t,n)}getProperty(e,t,r,n,i){const a=this.json[e];if(!a)return a;const o=this.getPropertyArray(e,t,r);if(1===r)return o[n];for(let e=0;e<r;++e)i[e]=o[r*n+e];return i}_getTypedArrayFromBinary(e,t,r,n,i){const a=this._cachedTypedArrays;let o=a[e];return o||(o=Zm.createTypedArray(t,this.buffer.buffer,this.buffer.byteOffset+i,n*r),a[e]=o),o}_getTypedArrayFromArray(e,t,r){const n=this._cachedTypedArrays;let i=n[e];return i||(i=Zm.createTypedArray(t,r),n[e]=i),i}}const rg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ng={SCALAR:(e,t)=>e[t],VEC2:(e,t)=>[e[2*t+0],e[2*t+1]],VEC3:(e,t)=>[e[3*t+0],e[3*t+1],e[3*t+2]],VEC4:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT2:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT3:(e,t)=>[e[9*t+0],e[9*t+1],e[9*t+2],e[9*t+3],e[9*t+4],e[9*t+5],e[9*t+6],e[9*t+7],e[9*t+8]],MAT4:(e,t)=>[e[16*t+0],e[16*t+1],e[16*t+2],e[16*t+3],e[16*t+4],e[16*t+5],e[16*t+6],e[16*t+7],e[16*t+8],e[16*t+9],e[16*t+10],e[16*t+11],e[16*t+12],e[16*t+13],e[16*t+14],e[16*t+15]]},ig={SCALAR:(e,t,r)=>{t[r]=e},VEC2:(e,t,r)=>{t[2*r+0]=e[0],t[2*r+1]=e[1]},VEC3:(e,t,r)=>{t[3*r+0]=e[0],t[3*r+1]=e[1],t[3*r+2]=e[2]},VEC4:(e,t,r)=>{t[4*r+0]=e[0],t[4*r+1]=e[1],t[4*r+2]=e[2],t[4*r+3]=e[3]},MAT2:(e,t,r)=>{t[4*r+0]=e[0],t[4*r+1]=e[1],t[4*r+2]=e[2],t[4*r+3]=e[3]},MAT3:(e,t,r)=>{t[9*r+0]=e[0],t[9*r+1]=e[1],t[9*r+2]=e[2],t[9*r+3]=e[3],t[9*r+4]=e[4],t[9*r+5]=e[5],t[9*r+6]=e[6],t[9*r+7]=e[7],t[9*r+8]=e[8],t[9*r+9]=e[9]},MAT4:(e,t,r)=>{t[16*r+0]=e[0],t[16*r+1]=e[1],t[16*r+2]=e[2],t[16*r+3]=e[3],t[16*r+4]=e[4],t[16*r+5]=e[5],t[16*r+6]=e[6],t[16*r+7]=e[7],t[16*r+8]=e[8],t[16*r+9]=e[9],t[16*r+10]=e[10],t[16*r+11]=e[11],t[16*r+12]=e[12],t[16*r+13]=e[13],t[16*r+14]=e[14],t[16*r+15]=e[15]}};const ag=e=>void 0!==e;function og(e,t,r){if(!t)return null;let n=e.getExtension("3DTILES_batch_table_hierarchy");const i=t.HIERARCHY;return i&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=i,n=i),n?function(e,t){let r,n,i;const a=e.instancesLength,o=e.classes;let s,u=e.classIds,c=e.parentCounts,l=e.parentIds,h=a;ag(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,GL.UNSIGNED_SHORT),u.type=AttributeType.SCALAR,i=getBinaryAccessor(u),u=i.createArrayBufferView(t.buffer,t.byteOffset+u.byteOffset,a));if(ag(c))for(ag(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,i=getBinaryAccessor(c),c=i.createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,a)),s=new Uint16Array(a),h=0,r=0;r<a;++r)s[r]=h,h+=c[r];ag(l)&&ag(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,i=getBinaryAccessor(l),l=i.createArrayBufferView(t.buffer,t.byteOffset+l.byteOffset,h));const p=o.length;for(r=0;r<p;++r){const e=o[r].length,n=o[r].instances,i=getBinaryProperties(e,n,t);o[r].instances=combine(i,n)}const f=new Array(p).fill(0),d=new Uint16Array(a);for(r=0;r<a;++r)n=u[r],d[r]=f[n],++f[n];const m={classes:o,classIds:u,classIndexes:d,parentCounts:c,parentIndexes:s,parentIds:l};return function(e){const t=e.classIds.length;for(let r=0;r<t;++r)ug(e,r,stack)}(m),m}(n,r):null}function sg(e,t,r){if(!e)return;const n=e.parentCounts;return e.parentIds?r(e,t):n>0?function(e,t,r){const n=e.classIds,i=e.parentCounts,a=e.parentIds,o=e.parentIndexes,s=n.length,u=scratchVisited;u.length=Math.max(u.length,s);const c=++marker,l=scratchStack;l.length=0,l.push(t);for(;l.length>0;){if(t=l.pop(),u[t]===c)continue;u[t]=c;const n=r(e,t);if(ag(n))return n;const s=i[t],h=o[t];for(let e=0;e<s;++e){const r=a[h+e];r!==t&&l.push(r)}}return null}(e,t,r):function(e,t,r){let n=!0;for(;n;){const i=r(e,t);if(ag(i))return i;const a=e.parentIds[t];n=a!==t,t=a}throw new Error("traverseHierarchySingleParent")}(e,t,r)}function ug(e,t,r){const n=e.parentCounts,i=e.parentIds,a=e.parentIndexes,o=e.classIds.length;if(!ag(i))return;assert(t<o,`Parent index ${t} exceeds the total number of instances: ${o}`),assert(-1===r.indexOf(t),"Circular dependency detected in the batch table hierarchy."),r.push(t);const s=ag(n)?n[t]:1,u=ag(n)?a[t]:t;for(let n=0;n<s;++n){const a=i[u+n];a!==t&&ug(e,a,r)}r.pop(t)}function cg(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lg(e){return null!=e}const hg=(e,t)=>e,pg={HIERARCHY:!0,extensions:!0,extras:!0};class fg{constructor(e,t,r,n={}){var i;cg(this,"json",void 0),cg(this,"binary",void 0),cg(this,"featureCount",void 0),cg(this,"_extensions",void 0),cg(this,"_properties",void 0),cg(this,"_binaryProperties",void 0),cg(this,"_hierarchy",void 0),Hi(r>=0),this.json=e||{},this.binary=t,this.featureCount=r,this._extensions=(null===(i=this.json)||void 0===i?void 0:i.extensions)||{},this._properties={};for(const e in this.json)pg[e]||(this._properties[e]=this.json[e]);this._binaryProperties=this._initializeBinaryProperties(),n["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=og(this,this.json,this.binary))}getExtension(e){return this.json&&this.json.extensions&&this.json.extensions[e]}memorySizeInBytes(){return 0}isClass(e,t){if(this._checkBatchId(e),Hi("string"==typeof t,t),this._hierarchy){return lg(sg(this._hierarchy,e,(e,r)=>{const n=e.classIds[r];return e.classes[n].name===t}))}return!1}isExactClass(e,t){return Hi("string"==typeof t,t),this.getExactClassName(e)===t}getExactClassName(e){if(this._checkBatchId(e),this._hierarchy){const t=this._hierarchy.classIds[e];return this._hierarchy.classes[t].name}}hasProperty(e,t){return this._checkBatchId(e),Hi("string"==typeof t,t),lg(this._properties[t])||this._hasPropertyInHierarchy(e,t)}getPropertyNames(e,t){this._checkBatchId(e),(t=lg(t)?t:[]).length=0;const r=Object.keys(this._properties);return t.push(...r),this._hierarchy&&this._getPropertyNamesInHierarchy(e,t),t}getProperty(e,t){if(this._checkBatchId(e),Hi("string"==typeof t,t),this._binaryProperties){const r=this._binaryProperties[t];if(lg(r))return this._getBinaryProperty(r,e)}const r=this._properties[t];if(lg(r))return hg(r[e]);if(this._hierarchy){const r=this._getHierarchyProperty(e,t);if(lg(r))return r}}setProperty(e,t,r){const n=this.featureCount;if(this._checkBatchId(e),Hi("string"==typeof t,t),this._binaryProperties){const n=this._binaryProperties[t];if(n)return void this._setBinaryProperty(n,e,r)}if(this._hierarchy&&this._setHierarchyProperty(this,e,t,r))return;let i=this._properties[t];lg(i)||(this._properties[t]=new Array(n),i=this._properties[t]),i[e]=hg(r)}_checkBatchId(e){if(!(e>=0&&e<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(e,t){return e.unpack(e.typedArray,t)}_setBinaryProperty(e,t,r){e.pack(r,e.typedArray,t)}_initializeBinaryProperties(){let e=null;for(const t in this._properties){const r=this._properties[t],n=this._initializeBinaryProperty(t,r);n&&(e=e||{},e[t]=n)}return e}_initializeBinaryProperty(e,t){if("byteOffset"in t){const r=t;Hi(this.binary,`Property ${e} requires a batch table binary.`),Hi(r.type,`Property ${e} requires a type.`);const n=function(e,t,r,n){const{componentType:i}=e;Hi(e.componentType);const a="string"==typeof i?Zm.fromName(i):i,o=rg[e.type],s=ng[e.type],u=ig[e.type];return r+=e.byteOffset,{values:Zm.createTypedArray(a,t,r,o*n),type:a,size:o,unpacker:s,packer:u}}(r,this.binary.buffer,0|this.binary.byteOffset,this.featureCount);return{typedArray:n.values,componentCount:n.size,unpack:n.unpacker,pack:n.packer}}return null}_hasPropertyInHierarchy(e,t){if(!this._hierarchy)return!1;const r=sg(this._hierarchy,e,(e,r)=>{const n=e.classIds[r];return lg(e.classes[n].instances[t])});return lg(r)}_getPropertyNamesInHierarchy(e,t){sg(this._hierarchy,e,(e,r)=>{const n=e.classIds[r],i=e.classes[n].instances;for(const e in i)i.hasOwnProperty(e)&&-1===t.indexOf(e)&&t.push(e)})}_getHierarchyProperty(e,t){return sg(this._hierarchy,e,(e,r)=>{const n=e.classIds[r],i=e.classes[n],a=e.classIndexes[r],o=i.instances[t];return lg(o)?lg(o.typedArray)?this._getBinaryProperty(o,a):hg(o[a]):null})}_setHierarchyProperty(e,t,r,n){const i=sg(this._hierarchy,t,(e,i)=>{const a=e.classIds[i],o=e.classes[a],s=e.classIndexes[i],u=o.instances[r];return!!lg(u)&&(Hi(i===t,`Inherited property "${r}" is read-only.`),lg(u.typedArray)?this._setBinaryProperty(u,s,n):u[s]=hg(n),!0)});return lg(i)}}function dg(e,t,r=0){const n=new DataView(t);if(e.magic=n.getUint32(r,!0),r+=4,e.version=n.getUint32(r,!0),r+=4,e.byteLength=n.getUint32(r,!0),r+=4,1!==e.version)throw new Error(`3D Tile Version ${e.version} not supported`);return r}function mg(e,t,r){const n=new DataView(t);let i;e.header=e.header||{};let a=n.getUint32(r,!0);r+=4;let o=n.getUint32(r,!0);r+=4;let s=n.getUint32(r,!0);r+=4;let u=n.getUint32(r,!0);return r+=4,s>=570425344?(r-=8,i=a,s=o,u=0,a=0,o=0,console.warn("b3dm tile in legacy format.")):u>=570425344&&(r-=4,i=s,s=a,u=o,a=0,o=0,console.warn("b3dm tile in legacy format.")),e.header.featureTableJsonByteLength=a,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=u,e.header.batchLength=i,r}function gg(e,t,r,n){return r=function(e,t,r,n){const{featureTableJsonByteLength:i,featureTableBinaryByteLength:a,batchLength:o}=e.header;if(e.featureTableJson={BATCH_LENGTH:o||0},i>0){const n=Jm(t,r,i);e.featureTableJson=JSON.parse(n)}return r+=i,e.featureTableBinary=new Uint8Array(t,r,a),r+=a}(e,t,r),r=function(e,t,r,n){const{batchTableJsonByteLength:i,batchTableBinaryByteLength:a}=e.header;if(i>0){const n=Jm(t,r,i);e.batchTableJson=JSON.parse(n),r+=i,a>0&&(e.batchTableBinary=new Uint8Array(t,r,a),e.batchTableBinary=new Uint8Array(e.batchTableBinary),r+=a)}return r}(e,t,r)}function yg(e,t=[0,0,0]){const r=e>>11&31,n=e>>5&63,i=31&e;return t[0]=r<<3,t[1]=n<<2,t[2]=i<<3,t}function bg(e,t,r){if(!(t||e&&e.batchIds&&r))return null;const{batchIds:n,isRGB565:i,pointCount:a}=e;if(n&&r){const e=new Uint8ClampedArray(3*a);for(let t=0;t<a;t++){const i=n[t],a=r.getProperty(i,"dimensions").map(e=>255*e);e[3*t]=a[0],e[3*t+1]=a[1],e[3*t+2]=a[2]}return{type:Ym.UNSIGNED_BYTE,value:e,size:3,normalized:!0}}if(i){const e=new Uint8ClampedArray(3*a);for(let r=0;r<a;r++){const n=yg(t[r]);e[3*r]=n[0],e[3*r+1]=n[1],e[3*r+2]=n[2]}return{type:Ym.UNSIGNED_BYTE,value:e,size:3,normalized:!0}}return t&&t.length===3*a?{type:Ym.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:Ym.UNSIGNED_BYTE,value:t,size:4,normalized:!0}}class vg extends ms{constructor(e=0,t=0){super(2),ns(e)&&1===arguments.length?this.copy(e):(ts.debug&&(hs(e),hs(t)),this[0]=e,this[1]=t)}set(e,t){return this[0]=e,this[1]=t,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this.check()}fromObject(e){return ts.debug&&(hs(e.x),hs(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 Ns(this,this,e),this.check()}transformAsVector(e){return Ts(this,this,e),this.check()}transformByMatrix3(e){return Ls(this,this,e),this.check()}transformByMatrix2x3(e){return function(e,t,r){var n=t[0],i=t[1];e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5]}(this,this,e),this.check()}transformByMatrix2(e){return function(e,t,r){var n=t[0],i=t[1];e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i}(this,this,e),this.check()}}function wg(e,t){if(!e)throw new Error("math.gl assertion failed. "+t)}new vg,new Is,new vg,new vg,new Uint8Array(1);function _g(e,t=255){return us(e,0,t)/t*2-1}function kg(e){return e<0?-1:1}function xg(e,t,r,n){if(wg(n),e<0||e>r||t<0||t>r)throw new Error("x and y must be unsigned normalized integers between 0 and "+r);if(n.x=_g(e,r),n.y=_g(t,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){const e=n.x;n.x=(1-Math.abs(n.y))*kg(e),n.y=(1-Math.abs(e))*kg(n.y)}return n.normalize()}function Eg(e,t,r){return xg(e,t,255,r)}const Ag=new Is;function Sg(e,t,r){return e.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,function(e,t){const r=new Is,n=new Float32Array(3*e.pointCount);for(let i=0;i<e.pointCount;i++)r.set(t[3*i],t[3*i+1],t[3*i+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(n,3*i);return n}(e,t)):{type:Ym.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}async function jg(e,t,r,n,i){r=gg(e,t,r=mg(e,t,r=dg(e,t,r))),function(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}(e);const{featureTable:a,batchTable:o}=function(e){const t=new tg(e.featureTableJson,e.featureTableBinary),r=t.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(r))throw new Error("POINTS_LENGTH must be defined");t.featuresLength=r,e.featuresLength=r,e.pointsLength=r,e.pointCount=r,e.rtcCenter=t.getGlobalProperty("RTC_CENTER",Ym.FLOAT,3);const n=function(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",Ym.UNSIGNED_SHORT,1),e.batchIds)){const n=t.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");const{batchTableJson:i,batchTableBinary:a}=e;r=new fg(i,a,n)}return r}(e,t);return{featureTable:t,batchTable:n}}(e);return await async function(e,t,r,n,i){let a,o,s;const u=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];u&&(s=u.properties);const c=t.getExtension("3DTILES_draco_point_compression");if(c){o=c.properties;const t=c.byteOffset,r=c.byteLength;if(!o||!Number.isFinite(t)||!r)throw new Error("Draco properties, byteOffset, and byteLength must be defined");a=e.featureTableBinary.slice(t,t+r),e.hasPositions=Number.isFinite(o.POSITION),e.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),e.hasNormals=Number.isFinite(o.NORMAL),e.hasBatchIds=Number.isFinite(o.BATCH_ID),e.isTranslucent=Number.isFinite(o.RGBA)}if(!a)return!0;const l={buffer:a,properties:{...o,...s},featureTableProperties:o,batchTableProperties:s,dequantizeInShader:!1};return await async function(e,t,r,n){const{parse:i}=n,a={...r,draco:{...r.draco,extraAttributes:t.batchTableProperties||{}}};delete a["3d-tiles"];const o=await i(t.buffer,Tc,a),s=o.attributes.POSITION&&o.attributes.POSITION.value,u=o.attributes.COLOR_0&&o.attributes.COLOR_0.value,c=o.attributes.NORMAL&&o.attributes.NORMAL.value,l=o.attributes.BATCH_ID&&o.attributes.BATCH_ID.value,h=s&&o.attributes.POSITION.value.quantization,p=c&&o.attributes.NORMAL.value.quantization;if(h){const t=o.POSITION.data.quantization,r=t.range;e.quantizedVolumeScale=new Is(r,r,r),e.quantizedVolumeOffset=new Is(t.minValues),e.quantizedRange=(1<<t.quantizationBits)-1,e.isQuantizedDraco=!0}p&&(e.octEncodedRange=(1<<o.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);const f={};if(t.batchTableProperties)for(const e of Object.keys(t.batchTableProperties))o.attributes[e]&&o.attributes[e].value&&(f[e.toLowerCase()]=o.attributes[e].value);e.attributes={positions:s,colors:bg(e,u,void 0),normals:c,batchIds:l,...f}}(e,l,n,i)}(e,a,0,n,i),function(e,t,r){if(!e.attributes.positions)if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",Ym.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){const n=t.getPropertyArray("POSITION_QUANTIZED",Ym.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=65535,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Ym.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Ym.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=Sg(e,n,r)}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}(e,a,n),function(e,t,r){if(!e.attributes.colors){let n=null;t.hasProperty("RGBA")?(n=t.getPropertyArray("RGBA",Ym.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?n=t.getPropertyArray("RGB",Ym.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(n=t.getPropertyArray("RGB565",Ym.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=bg(e,n,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",Ym.UNSIGNED_BYTE,4))}(e,a,o),function(e,t){if(!e.attributes.normals){let r=null;t.hasProperty("NORMAL")?r=t.getPropertyArray("NORMAL",Ym.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",Ym.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=function(e,t){if(!t)return null;if(e.isOctEncoded16P){const r=new Float32Array(3*e.pointsLength);for(let n=0;n<e.pointsLength;n++)Eg(t[2*n],t[2*n+1],Ag),Ag.toArray(r,3*n);return{type:Ym.FLOAT,size:2,value:r}}return{type:Ym.FLOAT,size:2,value:t}}(e,r)}}(e,a),r}function Tg(e,t,r){if(e.byteLength<=t+r)return"";const n=new DataView(e);let i="";for(let e=0;e<r;e++)i+=String.fromCharCode(n.getUint8(t+e));return i}function Cg(e){try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse JSON from data starting with "${function(e,t=5){if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return Tg(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return Tg(e,0,t)}return""}(e)}"`)}}function Bg(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;const r=t.baseUri||t.uri;if(!r)throw new Error("'baseUri' must be provided to resolve relative url "+e);return r.substr(0,r.lastIndexOf("/")+1)+e}function Rg(e,t,r){const n=e.bufferViews[r];um(n);const i=t[n.buffer];um(i);const a=(n.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,a,n.byteLength)}const Og=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]),Ig=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]),Pg={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Dg={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};let Mg;async function Fg(){return Mg||(Mg=async function(){let e="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";WebAssembly.validate(Og)&&(e="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",console.log("Warning: meshopt_decoder is using experimental SIMD support"));const t=await WebAssembly.instantiate(function(e){const t=new Uint8Array(e.length);for(let r=0;r<e.length;++r){const n=e.charCodeAt(r);t[r]=n>96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}let r=0;for(let n=0;n<e.length;++n)t[r++]=t[n]<60?Ig[t[n]]:64*(t[n]-60)+t[++n];return t.buffer.slice(0,r)}(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}()),Mg}function Lg(e,t,r,n,i,a,o){const s=e.exports.sbrk,u=n+3&-4,c=s(u*i),l=s(a.length),h=new Uint8Array(e.exports.memory.buffer);h.set(a,l);const p=t(c,n,i,l,a.length);if(0===p&&o&&o(c,u,i),r.set(h.subarray(c,c+n*i)),s(c-s(0)),0!==p)throw new Error("Malformed buffer data: "+p)}const Ng="EXT_meshopt_compression";async function zg(e,t){var r;const n=new wm(e);if(null==t||null===(r=t.gltf)||void 0===r||!r.decompressMeshes)return;const i=[];for(const t of e.json.bufferViews||[])i.push(Ug(n,t));await Promise.all(i),n.removeExtension("EXT_meshopt_compression")}async function Ug(e,t){const r=e.getObjectExtension(t,"EXT_meshopt_compression");if(r){const{byteOffset:n=0,byteLength:i=0,byteStride:a,count:o,mode:s,filter:u="NONE",buffer:c}=r,l=e.gltf.buffers[c],h=new Uint8Array(l.arrayBuffer,l.byteOffset+n,i),p=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);return await async function(e,t,r,n,i,a="NONE"){const o=await Fg();Lg(o,o.exports[Dg[i]],e,t,r,n,o.exports[Pg[a||"NONE"]])}(p,o,a,h,s,u),p}return null}const qg=["image/png","image/jpeg","image/gif"],Hg={};function Gg(e){return void 0===Hg[e]&&(Hg[e]=function(e){switch(e){case"image/webp":return function(){if(!Oi)return!1;try{return 0===document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")}catch{return!1}}();case"image/svg":return Oi;default:if(!Oi){const{_parseImageNode:t}=globalThis;return Boolean(t)&&qg.includes(e)}return!0}}(e)),Hg[e]}const Vg="EXT_texture_webp";function Wg(e,t){const r=new wm(e);if(!Gg("image/webp")){if(r.getRequiredExtensions().includes("EXT_texture_webp"))throw new Error("gltf: Required extension EXT_texture_webp not supported by browser");return}const{json:n}=r;for(const e of n.textures||[]){const t=r.getObjectExtension(e,"EXT_texture_webp");t&&(e.source=t.source),r.removeObjectExtension(e,"EXT_texture_webp")}r.removeExtension("EXT_texture_webp")}const Kg="KHR_texture_basisu";function Jg(e,t){const r=new wm(e),{json:n}=r;for(const e of n.textures||[]){const t=r.getObjectExtension(e,"KHR_texture_basisu");t&&(e.source=t.source),r.removeObjectExtension(e,"KHR_texture_basisu")}r.removeExtension("KHR_texture_basisu")}function Qg(e){const{buffer:t,size:r,count:n}=function(e){let t=e,r=1,n=0;e&&e.value&&(t=e.value,r=e.size||1);t&&(ArrayBuffer.isView(t)||(t=function(e,t,r=!1){if(!e)return null;if(Array.isArray(e))return new t(e);if(r&&!(e instanceof t))return new t(e);return e}(t,Float32Array)),n=t.length/r);return{buffer:t,size:r,count:n}}(e);return{value:t,size:r,byteOffset:0,count:n,type:mm(r),componentType:gm(t)}}const Yg="KHR_draco_mesh_compression";function $g(e,t,r){const n=new wm(e);for(const e of ry(n))n.getObjectExtension(e,"KHR_draco_mesh_compression")}async function Xg(e,t,r){var n;if(null==t||null===(n=t.gltf)||void 0===n||!n.decompressMeshes)return;const i=new wm(e),a=[];for(const e of ry(i))i.getObjectExtension(e,"KHR_draco_mesh_compression")&&a.push(ey(i,e,t,r));await Promise.all(a),i.removeExtension("KHR_draco_mesh_compression")}function Zg(e,t={}){const r=new wm(e);for(const e of r.json.meshes||[])ty(e,t),r.addRequiredExtension("KHR_draco_mesh_compression")}async function ey(e,t,r,n){const i=e.getObjectExtension(t,"KHR_draco_mesh_compression");if(!i)return;const a=e.getTypedArrayForBufferView(i.bufferView),o=Ja(a.buffer,a.byteOffset),{parse:s}=n,u={...r};delete u["3d-tiles"];const c=await s(o,Tc,u,n),l=function(e){const t={};for(const r in e){const n=e[r];if("indices"!==r){const e=Qg(n);t[r]=e}}return t}(c.attributes);for(const[r,n]of Object.entries(l))if(r in t.attributes){const i=t.attributes[r],a=e.getAccessor(i);null!=a&&a.min&&null!=a&&a.max&&(n.min=a.min,n.max=a.max)}t.attributes=l,c.indices&&(t.indices=Qg(c.indices)),function(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}(t)}function ty(e,t,r=4,n,i){var a;if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const o=n.DracoWriter.encodeSync({attributes:e}),s=null==i||null===(a=i.parseSync)||void 0===a?void 0:a.call(i,{attributes:e}),u=n._addFauxAttributes(s.attributes);return{primitives:[{attributes:u,mode:r,extensions:{KHR_draco_mesh_compression:{bufferView:n.addBufferView(o),attributes:u}}}]}}function*ry(e){for(const t of e.json.meshes||[])for(const e of t.primitives)yield e}const ny="KHR_lights_punctual";async function iy(e){const t=new wm(e),{json:r}=t,n=t.getExtension("KHR_lights_punctual");n&&(t.json.lights=n.lights,t.removeExtension("KHR_lights_punctual"));for(const e of r.nodes||[]){const r=t.getObjectExtension(e,"KHR_lights_punctual");r&&(e.light=r.light),t.removeObjectExtension(e,"KHR_lights_punctual")}}async function ay(e){const t=new wm(e),{json:r}=t;if(r.lights){const e=t.addExtension("KHR_lights_punctual");um(!e.lights),e.lights=r.lights,delete r.lights}if(t.json.lights){for(const e of t.json.lights){const r=e.node;t.addObjectExtension(r,"KHR_lights_punctual",e)}delete t.json.lights}}const oy="KHR_materials_unlit";async function sy(e){const t=new wm(e),{json:r}=t;t.removeExtension("KHR_materials_unlit");for(const e of r.materials||[]){e.extensions&&e.extensions.KHR_materials_unlit&&(e.unlit=!0),t.removeObjectExtension(e,"KHR_materials_unlit")}}function uy(e){const t=new wm(e),{json:r}=t;if(t.materials)for(const e of r.materials||[])e.unlit&&(delete e.unlit,t.addObjectExtension(e,"KHR_materials_unlit",{}),t.addExtension("KHR_materials_unlit"))}const cy="KHR_techniques_webgl";async function ly(e){const t=new wm(e),{json:r}=t,n=t.getExtension("KHR_techniques_webgl");if(n){const e=function(e,t){const{programs:r=[],shaders:n=[],techniques:i=[]}=e,a=new TextDecoder;return n.forEach(e=>{if(!Number.isFinite(e.bufferView))throw new Error("KHR_techniques_webgl: no shader code");e.code=a.decode(t.getTypedArrayForBufferView(e.bufferView))}),r.forEach(e=>{e.fragmentShader=n[e.fragmentShader],e.vertexShader=n[e.vertexShader]}),i.forEach(e=>{e.program=r[e.program]}),i}(n,t);for(const n of r.materials||[]){const r=t.getObjectExtension(n,"KHR_techniques_webgl");r&&(n.technique=Object.assign({},r,e[r.technique]),n.technique.values=py(n.technique,t)),t.removeObjectExtension(n,"KHR_techniques_webgl")}t.removeExtension("KHR_techniques_webgl")}}async function hy(e,t){}function py(e,t){const r=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(t=>{e.uniforms[t].value&&!(t in r)&&(r[t]=e.uniforms[t].value)}),Object.keys(r).forEach(e=>{"object"==typeof r[e]&&void 0!==r[e].index&&(r[e].texture=t.getTexture(r[e].index))}),r}const fy=[a,o,s,u,c,l,h];function dy(e,t){var r;const n=(null==t||null===(r=t.gltf)||void 0===r?void 0:r.excludeExtensions)||{};return!(e in n&&!n[e])}function my(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const gy={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},yy={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};class by{constructor(){my(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}),my(this,"json",void 0)}normalize(e,t){this.json=e.json;const r=e.json;switch(r.asset&&r.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn("glTF: Unknown version "+r.asset.version)}if(!t.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(r),this._convertTopLevelObjectsToArrays(r),function(e){const t=new wm(e),{json:r}=t;for(const e of r.images||[]){const r=t.getObjectExtension(e,"KHR_binary_glTF");r&&Object.assign(e,r),t.removeObjectExtension(e,"KHR_binary_glTF")}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,t.removeExtension("KHR_binary_glTF")}(e),this._convertObjectIdsToArrayIndices(r),this._updateObjects(r),this._updateMaterial(r)}_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(const t in gy)this._convertTopLevelObjectToArray(e,t)}_convertTopLevelObjectToArray(e,t){const r=e[t];if(r&&!Array.isArray(r)){e[t]=[];for(const n in r){const i=r[n];i.id=i.id||n;const a=e[t].length;e[t].push(i),this.idToIndexMap[t][n]=a}}}_convertObjectIdsToArrayIndices(e){for(const t in gy)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(const t of e.textures)this._convertTextureIds(t);for(const t of e.meshes)this._convertMeshIds(t);for(const t of e.nodes)this._convertNodeIds(t);for(const t of e.scenes)this._convertSceneIds(t)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(const t of e.primitives){const{attributes:e,indices:r,material:n}=t;for(const t in e)e[t]=this._convertIdToIndex(e[t],"accessor");r&&(t.indices=this._convertIdToIndex(r,"accessor")),n&&(t.material=this._convertIdToIndex(n,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map(e=>this._convertIdToIndex(e,"node"))),e.meshes&&(e.meshes=e.meshes.map(e=>this._convertIdToIndex(e,"mesh")))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map(e=>this._convertIdToIndex(e,"node")))}_convertIdsToIndices(e,t){e[t]||(console.warn("gltf v1: json doesn't contain attribute "+t),e[t]=[]);for(const r of e[t])for(const e in r){const t=r[e],n=this._convertIdToIndex(t,e);r[e]=n}}_convertIdToIndex(e,t){const r=yy[t];if(r in this.idToIndexMap){const n=this.idToIndexMap[r][e];if(!Number.isFinite(n))throw new Error(`gltf v1: failed to resolve ${t} with id ${e}`);return n}return e}_updateObjects(e){for(const e of this.json.buffers)delete e.type}_updateMaterial(e){for(const n of e.materials){var t,r;n.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const i=(null===(t=n.values)||void 0===t?void 0:t.tex)||(null===(r=n.values)||void 0===r?void 0:r.texture2d_0),a=e.textures.findIndex(e=>e.id===i);-1!==a&&(n.pbrMetallicRoughness.baseColorTexture={index:a})}}}function vy(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const wy={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},_y={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},ky=10240,xy=10241,Ey=10242,Ay=10243,Sy=10497,jy={magFilter:ky,minFilter:xy,wrapS:Ey,wrapT:Ay},Ty={[ky]:9729,[xy]:9986,[Ey]:Sy,[Ay]:Sy};class Cy{constructor(){vy(this,"baseUri",""),vy(this,"json",{}),vy(this,"buffers",[]),vy(this,"images",[])}postProcess(e,t={}){const{json:r,buffers:n=[],images:i=[],baseUri:a=""}=e;return um(r),this.baseUri=a,this.json=r,this.buffers=n,this.images=i,this._resolveTree(this.json,t),this.json}_resolveTree(e,t={}){e.bufferViews&&(e.bufferViews=e.bufferViews.map((e,t)=>this._resolveBufferView(e,t))),e.images&&(e.images=e.images.map((e,t)=>this._resolveImage(e,t))),e.samplers&&(e.samplers=e.samplers.map((e,t)=>this._resolveSampler(e,t))),e.textures&&(e.textures=e.textures.map((e,t)=>this._resolveTexture(e,t))),e.accessors&&(e.accessors=e.accessors.map((e,t)=>this._resolveAccessor(e,t))),e.materials&&(e.materials=e.materials.map((e,t)=>this._resolveMaterial(e,t))),e.meshes&&(e.meshes=e.meshes.map((e,t)=>this._resolveMesh(e,t))),e.nodes&&(e.nodes=e.nodes.map((e,t)=>this._resolveNode(e,t))),e.skins&&(e.skins=e.skins.map((e,t)=>this._resolveSkin(e,t))),e.scenes&&(e.scenes=e.scenes.map((e,t)=>this._resolveScene(e,t))),void 0!==e.scene&&(e.scene=e.scenes[this.json.scene])}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const r=this.json[e]&&this.json[e][t];return r||console.warn(`glTF file error: Could not find ${e}[${t}]`),r}_resolveScene(e,t){return e.id=e.id||"scene-"+t,e.nodes=(e.nodes||[]).map(e=>this.getNode(e)),e}_resolveNode(e,t){return e.id=e.id||"node-"+t,e.children&&(e.children=e.children.map(e=>this.getNode(e))),void 0!==e.mesh?e.mesh=this.getMesh(e.mesh):void 0!==e.meshes&&e.meshes.length&&(e.mesh=e.meshes.reduce((e,t)=>{const r=this.getMesh(t);return e.id=r.id,e.primitives=e.primitives.concat(r.primitives),e},{primitives:[]})),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin)),e}_resolveSkin(e,t){return e.id=e.id||"skin-"+t,e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices),e}_resolveMesh(e,t){return e.id=e.id||"mesh-"+t,e.primitives&&(e.primitives=e.primitives.map(e=>{const t=(e={...e}).attributes;e.attributes={};for(const r in t)e.attributes[r]=this.getAccessor(t[r]);return void 0!==e.indices&&(e.indices=this.getAccessor(e.indices)),void 0!==e.material&&(e.material=this.getMaterial(e.material)),e})),e}_resolveMaterial(e,t){if(e.id=e.id||"material-"+t,e.normalTexture&&(e.normalTexture={...e.normalTexture},e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlustionTexture={...e.occlustionTexture},e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emmisiveTexture={...e.emmisiveTexture},e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.emissiveFactor||(e.emissiveFactor=e.emmisiveTexture?[1,1,1]:[0,0,0]),e.pbrMetallicRoughness){e.pbrMetallicRoughness={...e.pbrMetallicRoughness};const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}return e}_resolveAccessor(e,t){var r,n;if(e.id=e.id||"accessor-"+t,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=(r=e.componentType,_y[r]),e.components=(n=e.type,wy[n]),e.bytesPerElement=e.bytesPerComponent*e.components,e.bufferView){const t=e.bufferView.buffer,{ArrayType:r,byteLength:n}=ym(e,e.bufferView),i=(e.bufferView.byteOffset||0)+(e.byteOffset||0)+t.byteOffset;let a=t.arrayBuffer.slice(i,i+n);e.bufferView.byteStride&&(a=this._getValueFromInterleavedBuffer(t,i,e.bufferView.byteStride,e.bytesPerElement,e.count)),e.value=new r(a)}return e}_getValueFromInterleavedBuffer(e,t,r,n,i){const a=new Uint8Array(i*n);for(let o=0;o<i;o++){const i=t+o*r;a.set(new Uint8Array(e.arrayBuffer.slice(i,i+n)),o*n)}return a.buffer}_resolveTexture(e,t){return e.id=e.id||"texture-"+t,e.sampler="sampler"in e?this.getSampler(e.sampler):Ty,e.source=this.getImage(e.source),e}_resolveSampler(e,t){e.id=e.id||"sampler-"+t,e.parameters={};for(const t in e){const r=this._enumSamplerParameter(t);void 0!==r&&(e.parameters[r]=e[t])}return e}_enumSamplerParameter(e){return jy[e]}_resolveImage(e,t){e.id=e.id||"image-"+t,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView));const r=this.images[t];return r&&(e.image=r),e}_resolveBufferView(e,t){const r=e.buffer,n={id:"bufferView-"+t,...e,buffer:this.buffers[r]},i=this.buffers[r].arrayBuffer;let a=this.buffers[r].byteOffset||0;return"byteOffset"in e&&(a+=e.byteOffset),n.data=new Uint8Array(i,a,e.byteLength),n}_resolveCamera(e,t){return e.id=e.id||"camera-"+t,e.perspective,e.orthographic,e}}const By=1735152710;function Ry(e,t=0,r={}){const n=new DataView(e),{magic:i=By}=r,a=n.getUint32(t,!1);return a===i||a===By}function Oy(e,t,r=0,n={}){const i=new DataView(t),a=function(e,t=0){return`${String.fromCharCode(e.getUint8(t+0))}${String.fromCharCode(e.getUint8(t+1))}${String.fromCharCode(e.getUint8(t+2))}${String.fromCharCode(e.getUint8(t+3))}`}(i,r+0),o=i.getUint32(r+4,!0),s=i.getUint32(r+8,!0);switch(Object.assign(e,{header:{byteOffset:r,byteLength:s,hasBinChunk:!1},type:a,version:o,json:{},binChunks:[]}),r+=12,e.version){case 1:return function(e,t,r){Hi(e.header.byteLength>20);const n=t.getUint32(r+0,!0),i=t.getUint32(r+4,!0);return r+=8,Hi(0===i),Iy(e,t,r,n),r+=n,r+=Py(e,t,r,e.header.byteLength)}(e,i,r);case 2:return function(e,t,r,n){return Hi(e.header.byteLength>20),function(e,t,r,n){for(;r+8<=e.header.byteLength;){const i=t.getUint32(r+0,!0),a=t.getUint32(r+4,!0);switch(r+=8,a){case 1313821514:Iy(e,t,r,i);break;case 5130562:Py(e,t,r,i);break;case 0:n.strict||Iy(e,t,r,i);break;case 1:n.strict||Py(e,t,r,i)}r+=om(i,4)}}(e,t,r,n),r+e.header.byteLength}(e,i,r,{});default:throw new Error(`Invalid GLB version ${e.version}. Only supports v1 and v2.`)}}function Iy(e,t,r,n){const i=new Uint8Array(t.buffer,r,n),a=new TextDecoder("utf8").decode(i);return e.json=JSON.parse(a),om(n,4)}function Py(e,t,r,n){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:t.buffer}),om(n,4)}async function Dy(e,t,r=0,n,i){var a,o,s,u;!function(e,t,r,n){n.uri&&(e.baseUri=n.uri);if(t instanceof ArrayBuffer&&!Ry(t,r,n)){const e=new TextDecoder;t=e.decode(t)}if("string"==typeof t)e.json=Cg(t);else if(t instanceof ArrayBuffer){const i={};r=Oy(i,t,r,n.glb),um("glTF"===i.type,"Invalid GLB magic string "+i.type),e._glb=i,e.json=i.json}else um(!1,"GLTF: must be ArrayBuffer or string");const i=e.json.buffers||[];if(e.buffers=new Array(i.length).fill(null),e._glb&&e._glb.header.hasBinChunk){const{binChunks:t}=e._glb;e.buffers[0]={arrayBuffer:t[0].arrayBuffer,byteOffset:t[0].byteOffset,byteLength:t[0].byteLength}}const a=e.json.images||[];e.images=new Array(a.length).fill({})}(e,t,r,n),function(e,t={}){(new by).normalize(e,t)}(e,{normalize:null==n||null===(a=n.gltf)||void 0===a?void 0:a.normalize}),function(e,t={},r){const n=fy.filter(e=>dy(e.name,t));for(const a of n){var i;null===(i=a.preprocess)||void 0===i||i.call(a,e,t,r)}}(e,n,i);const c=[];if(null!=n&&null!==(o=n.gltf)&&void 0!==o&&o.loadBuffers&&e.json.buffers&&await async function(e,t,r){const n=e.json.buffers||[];for(let o=0;o<n.length;++o){const s=n[o];if(s.uri){var i,a;const{fetch:n}=r;um(n);const u=Bg(s.uri,t),c=await(null==r||null===(i=r.fetch)||void 0===i?void 0:i.call(r,u)),l=await(null==c||null===(a=c.arrayBuffer)||void 0===a?void 0:a.call(c));e.buffers[o]={arrayBuffer:l,byteOffset:0,byteLength:l.byteLength},delete s.uri}else null===e.buffers[o]&&(e.buffers[o]={arrayBuffer:new ArrayBuffer(s.byteLength),byteOffset:0,byteLength:s.byteLength})}}(e,n,i),null!=n&&null!==(s=n.gltf)&&void 0!==s&&s.loadImages){const t=async function(e,t,r){const n=function(e){const t=new Set,r=e.json.textures||[];for(const e of r)void 0!==e.source&&t.add(e.source);return Array.from(t).sort()}(e),i=e.json.images||[],a=[];for(const o of n)a.push(My(e,i[o],o,t,r));return await Promise.all(a)}(e,n,i);c.push(t)}const l=async function(e,t={},r){const n=fy.filter(e=>dy(e.name,t));for(const a of n){var i;await(null===(i=a.decode)||void 0===i?void 0:i.call(a,e,t,r))}}(e,n,i);return c.push(l),await Promise.all(c),null!=n&&null!==(u=n.gltf)&&void 0!==u&&u.postProcess?function(e,t){return(new Cy).postProcess(e,t)}(e,n):e}async function My(e,t,r,n,i){const{fetch:a,parse:o}=i;let s;if(t.uri){const e=Bg(t.uri,n),r=await a(e);s=await r.arrayBuffer()}if(Number.isFinite(t.bufferView)){const r=Rg(e.json,e.buffers,t.bufferView);s=Ja(r.buffer,r.byteOffset,r.byteLength)}um(s,"glTF image has no data");let u=await o(s,[Lu,Yl],{mimeType:t.mimeType,basis:n.basis||{format:Wl()}},i);u&&u[0]&&(u={compressed:!0,mipmaps:!1,width:u[0].width,height:u[0].height,data:u[0]}),e.images=e.images||[],e.images[r]=u}const Fy={name:"glTF",id:"gltf",module:"gltf",version:"3.2.7",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:async function(e,t={},r){(t={...Fy.options,...t}).gltf={...Fy.options.gltf,...t.gltf};const{byteOffset:n=0}=t;return await Dy({},e,n,t,r)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0,postProcess:!0},log:console},deprecatedOptions:{fetchImages:"gltf.loadImages",createImages:"gltf.loadImages",decompress:"gltf.decompressMeshes",postProcess:"gltf.postProcess",gltf:{decompress:"gltf.decompressMeshes"}}};const Ly=0,Ny=1;function zy(e,t,r,n){e.rotateYtoZ=!0;const i=e.byteOffset+e.byteLength-r;if(0===i)throw new Error("glTF byte length must be greater than 0.");return e.gltfUpAxis=n["3d-tiles"]&&n["3d-tiles"].assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",e.gltfArrayBuffer=Ja(t,r,i),e.gltfByteOffset=0,e.gltfByteLength=i,r%4==0||console.warn(e.type+": embedded glb is not aligned to a 4-byte boundary."),e.byteOffset+e.byteLength}async function Uy(e,t,r,n){const i=r["3d-tiles"]||{};if(function(e,t,r){switch(t){case Ly:const t=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),r=(new TextDecoder).decode(t);e.gltfUrl=r.replace(/[\s\0]+$/,""),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case Ny:break;default:throw new Error("b3dm: Illegal glTF format field")}}(e,t),i.loadGLTF){const{parse:t,fetch:i}=n;e.gltfUrl&&(e.gltfArrayBuffer=await i(e.gltfUrl,r),e.gltfByteOffset=0),e.gltfArrayBuffer&&(e.gltf=await t(e.gltfArrayBuffer,Fy,r,n),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength)}}async function qy(e,t,r,n,i){var a;r=function(e,t,r,n,i){r=dg(e,t,r),r=mg(e,t,r),r=gg(e,t,r),r=zy(e,t,r,n);const a=new tg(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=a.getGlobalProperty("RTC_CENTER",Ym.FLOAT,3),r}(e,t,r,n),await Uy(e,Ny,n,i);const o=null==e||null===(a=e.gltf)||void 0===a?void 0:a.extensions;return o&&o.CESIUM_RTC&&(e.rtcCenter=o.CESIUM_RTC.center),r}async function Hy(e,t,r,n,i){return r=function(e,t,r,n,i){if(r=dg(e,t,r),1!==e.version)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);r=mg(e,t,r);const a=new DataView(t);if(e.gltfFormat=a.getUint32(r,!0),r=gg(e,t,r+=4),r=zy(e,t,r,n),0===e.featureTableJsonByteLength)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");const o=new tg(e.featureTableJson,e.featureTableBinary),s=o.getGlobalProperty("INSTANCES_LENGTH");if(o.featuresLength=s,!Number.isFinite(s))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=o.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=o.getGlobalProperty("RTC_CENTER",Ym.FLOAT,3);new fg(e.batchTableJson,e.batchTableBinary,s);return function(e,t,r,n){const i=[new Array(n),e._batchTable][0],a=new Is,o=new Is,s=new Is,u=new Is,c=new Ah,l=new Kh,h=new Is,p={},f=new Ws,d=[],m=[],g=new Is,y=new Is;for(let r=0;r<n;r++){let n;if(t.hasProperty("POSITION"))n=t.getProperty("POSITION",Ym.FLOAT,3,r,a);else if(t.hasProperty("POSITION_QUANTIZED")){n=t.getProperty("POSITION_QUANTIZED",Ym.UNSIGNED_SHORT,3,r,a);const e=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Ym.FLOAT,3,g);if(!e)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");const i=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Ym.FLOAT,3,y);if(!i)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const o=65535;for(let t=0;t<3;t++)n[t]=n[t]/o*i[t]+e[t]}if(!n)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");a.copy(n),p.translation=a,e.normalUp=t.getProperty("NORMAL_UP",Ym.FLOAT,3,r,d),e.normalRight=t.getProperty("NORMAL_RIGHT",Ym.FLOAT,3,r,m);const b=!1;if(e.normalUp){if(!e.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");e.hasCustomOrientation=!0}else{if(e.octNormalUp=t.getProperty("NORMAL_UP_OCT32P",Ym.UNSIGNED_SHORT,2,d),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",Ym.UNSIGNED_SHORT,2,m),e.octNormalUp){if(!e.octNormalRight)throw new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");throw new Error("i3dm: oct-encoded orientation not implemented")}e.eastNorthUp?(vu.WGS84.eastNorthUpToFixedFrame(a,f),f.getRotationMatrix3(c)):c.identity()}b&&(u.copy(o).cross(s).normalize(),c.setColumn(0,o),c.setColumn(1,s),c.setColumn(2,u)),l.fromMatrix3(c),p.rotation=l,h.set(1,1,1);const v=t.getProperty("SCALE",Ym.FLOAT,1,r);Number.isFinite(v)&&h.multiplyByScalar(v);const w=t.getProperty("SCALE_NON_UNIFORM",Ym.FLOAT,3,r,d);w&&h.scale(w),p.scale=h;let _=t.getProperty("BATCH_ID",Ym.UNSIGNED_SHORT,1,r);void 0===_&&(_=r);const k=(new Ws).fromQuaternion(p.rotation);f.identity(),f.translate(p.translation),f.multiplyRight(k),f.scale(p.scale);const x=f.clone();i[r]={modelMatrix:x,batchId:_}}e.instances=i}(e,o,0,s),r}(e,t,r,n),await Uy(e,e.gltfFormat,n,i),r}async function Gy(e,t=0,r,n,i={}){switch(i.byteOffset=t,i.type=function(e,t=0){const r=new DataView(e);return`${String.fromCharCode(r.getUint8(t+0))}${String.fromCharCode(r.getUint8(t+1))}${String.fromCharCode(r.getUint8(t+2))}${String.fromCharCode(r.getUint8(t+3))}`}(e,t),i.type){case Sm.COMPOSITE:return await async function(e,t,r,n,i,a){r=dg(e,t,r);const o=new DataView(t);for(e.tilesLength=o.getUint32(r,!0),r+=4,e.tiles=[];e.tiles.length<e.tilesLength&&e.byteLength-r>12;){const o={};e.tiles.push(o),r=await a(t,r,n,i,o)}return r}(i,e,t,r,n,Gy);case Sm.BATCHED_3D_MODEL:return await qy(i,e,t,r,n);case Sm.GLTF:return await async function(e,t,r,n){e.rotateYtoZ=!0,e.gltfUpAxis=r["3d-tiles"]&&r["3d-tiles"].assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y";const{parse:i}=n;e.gltf=await i(t,Fy,r,n)}(i,e,r,n);case Sm.INSTANCED_3D_MODEL:return await Hy(i,e,t,r,n);case Sm.POINT_CLOUD:return await jg(i,e,t,r,n);default:throw new Error("3DTileLoader: unknown type "+i.type)}}async function Vy(e,t,r){const n=e[t].bufferView,i=e.bufferViews[n],a=e.buffers[i.buffer];if(a.uri){const e=await ia(a.uri),t=await e.arrayBuffer();return new Uint8Array(t,i.byteOffset,i.byteLength)}return new Uint8Array(r,i.byteOffset,i.byteLength)}function Wy(e){const t=new DataView(e);return t.getUint32(0,!0)+2**32*t.getUint32(4,!0)}const Ky={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:"3.2.7",extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:async function(e){if(1952609651!==new Uint32Array(e.slice(0,4))[0])throw new Error("Wrong subtree file magic number");if(1!==new Uint32Array(e.slice(4,8))[0])throw new Error("Wrong subtree file verson, must be 1");const t=Wy(e.slice(8,16)),r=new Uint8Array(e,24,t),n=new TextDecoder("utf8").decode(r),i=JSON.parse(n),a=Wy(e.slice(16,24));let o=new ArrayBuffer(0);return a&&(o=e.slice(24+t)),"bufferView"in i.tileAvailability&&(i.tileAvailability.explicitBitstream=await Vy(i,"tileAvailability",o)),"bufferView"in i.contentAvailability&&(i.contentAvailability.explicitBitstream=await Vy(i,"contentAvailability",o)),"bufferView"in i.childSubtreeAvailability&&(i.childSubtreeAvailability.explicitBitstream=await Vy(i,"childSubtreeAvailability",o)),i},options:{}},Jy={QUADTREE:4,OCTREE:8};function Qy(e,t){return"constant"in e?Boolean(e.constant):!!e.explicitBitstream&&function(e,t){const r=Math.floor(e/8),n=e%8;return 1==(t[r]>>n&1)}(t,e.explicitBitstream)}function Yy(e,t,r,n){const{basePath:i,refine:a,getRefine:o,lodMetricType:s,getTileType:u,rootLodMetricValue:c,rootBoundingVolume:l}=n,h=e.contentUrl&&e.contentUrl.replace(i+"/",""),p=c/2**t,f=function(e,t,r){if(t.region){const{childTileX:n,childTileY:i,childTileZ:a}=r,[o,s,u,c,l,h]=t.region,p=2**e,f=(u-o)/p,d=(c-s)/p,m=(h-l)/p,[g,y]=[o+f*n,o+f*(n+1)],[b,v]=[s+d*i,s+d*(i+1)],[w,_]=[l+m*a,l+m*(a+1)];return{region:[g,b,y,v,w,_]}}return console.warn("Unsupported bounding volume type: ",t),null}(t,l,r);return{children:e.children,contentUrl:e.contentUrl,content:{uri:h},id:e.contentUrl,refine:o(a),type:u(e),lodMetricType:s,lodMetricValue:p,boundingVolume:f}}function $y(e,t){return parseInt(e.toString(2)+t.toString(2),2)}function Xy(e,t,r,n,i){const a=function(e){const t={};for(const r in e)t[`{${r}}`]=e[r];return t}({level:t,x:r,y:n,z:i});return e.replace(/{level}|{x}|{y}|{z}/gi,e=>a[e])}function Zy(e){if(!e.contentUrl)return ef;const t=e.contentUrl.split(".").pop();switch(t){case"pnts":return rf;case"i3dm":case"b3dm":case"glb":case"gltf":return tf;default:return t}}function eb(e){switch(e){case"REPLACE":case"replace":return Zp;case"ADD":case"add":return Xp;default:return e}}function tb(e,t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){const r=new URL(e,t+"/");return decodeURI(r.toString())}return e.startsWith("/")?e:`${t}/${e}`}function rb(e,t){if(!e)return null;if(e.content){const r=e.content.uri||e.content.url;e.contentUrl=tb(r,t.basePath)}return e.id=e.contentUrl,e.lodMetricType=sf,e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform,e.type=Zy(e),e.refine=eb(e.refine),e}async function nb(e){if(!e.root)return null;const t=e.basePath,r=e.root.extensions["3DTILES_implicit_tiling"],{subdivisionScheme:n,maximumLevel:i,subtreeLevels:a,subtrees:{uri:o}}=r,s=tb(Xy(o,0,0,0,0),t),u=await $o(s,Ky),c=tb(e.root.content.uri,t),l=e.root.refine,h=e.root.geometricError,p=e.root.boundingVolume,f={contentUrlTemplate:c,subtreesUriTemplate:o,subdivisionScheme:n,subtreeLevels:a,maximumLevel:i,refine:l,basePath:t,lodMetricType:sf,rootLodMetricValue:h,rootBoundingVolume:p,getTileType:Zy,getRefine:eb};return await async function(e,t,r){if(!e)return null;e.lodMetricType=sf,e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform;const{children:n,contentUrl:i}=await async function e(t){const{options:r,parentData:n={mortonIndex:0,x:0,y:0,z:0},childIndex:i=0,globalData:a={level:0,mortonIndex:0,x:0,y:0,z:0}}=t;let{subtree:o,level:s=0}=t;const{subdivisionScheme:u,subtreeLevels:c,maximumLevel:l,contentUrlTemplate:h,subtreesUriTemplate:p,basePath:f}=r,d={children:[],lodMetricValue:0,contentUrl:""},m=Jy[u],g=1&i,y=i>>1&1,b=i>>2&1,v=(m**s-1)/(m-1);let w=$y(n.mortonIndex,i),_=v+w,k=$y(n.x,g),x=$y(n.y,y),E=$y(n.z,b),A=!1;s+1>c&&(A=Qy(o.childSubtreeAvailability,w));const S=$y(a.x,k),j=$y(a.y,x),T=$y(a.z,E),C=s+a.level;if(A){const e=Xy(`${f}/${p}`,C,S,j,T);o=await $o(e,Ky),a.mortonIndex=w,a.x=k,a.y=x,a.z=E,a.level=s,w=0,_=0,k=0,x=0,E=0,s=0}if(!Qy(o.tileAvailability,_)||s>l)return d;Qy(o.contentAvailability,_)&&(d.contentUrl=Xy(h,C,S,j,T));const B=s+1,R={mortonIndex:w,x:k,y:x,z:E};for(let t=0;t<m;t++){const n=await e({subtree:o,options:r,parentData:R,childIndex:t,level:B,globalData:a});if(n.contentUrl||n.children.length){const e=Yy(n,C+1,{childTileX:k,childTileY:x,childTileZ:E},r);d.children.push(e)}}return d}({subtree:t,options:r});i&&(e.contentUrl=i,e.content={uri:i.replace(r.basePath+"/","")});return e.refine=eb(e.refine),e.type=Zy(e),e.children=n,e.id=e.contentUrl,e}(e.root,u,f)}const ib={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:"3.2.7",extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:async function(e,t,r){const i=t["3d-tiles"]||{};let a;a="auto"===i.isTileset?r.url&&-1!==r.url.indexOf(".json"):i.isTileset;e=a?await async function(e,t,r){var i;const a=JSON.parse((new TextDecoder).decode(e));return a.loader=t.loader||ib,a.url=r.url,a.basePath=function(e){return n.dirname(e.url)}(a),a.root=function(e){var t,r;return(null==e||null===(t=e.extensionsRequired)||void 0===t?void 0:t.includes("3DTILES_implicit_tiling"))&&(null==e||null===(r=e.extensionsUsed)||void 0===r?void 0:r.includes("3DTILES_implicit_tiling"))}(a)?await nb(a):function(e){const t=e.basePath,r=rb(e.root,e),n=[];for(n.push(r);n.length>0;){const e=(n.pop()||{}).children||[];for(const r of e)rb(r,{basePath:t}),n.push(r)}return r}(a),a.type=of,a.lodMetricType=sf,a.lodMetricValue=(null===(i=a.root)||void 0===i?void 0:i.lodMetricValue)||0,a}(e,t,r):await async function(e,t,r){const n={content:{featureIds:null}};return await Gy(e,0,t,r,n.content),n.content}(e,t,r);return e},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function ab(e,t){if(!t){const r=await async function(e){Hi(e);const t={Authorization:"Bearer "+e},r=await ia("https://api.cesium.com/v1/assets",{fetch:{headers:t}});if(!r.ok)throw new Error(r.statusText);return await r.json()}(e);for(const e of r.items)"3DTILES"===e.type&&(t=e.id)}const r=await async function(e,t){Hi(e,t);const r={Authorization:"Bearer "+e},n="https://api.cesium.com/v1/assets/"+t;let i=await ia(""+n,{fetch:{headers:r}});if(!i.ok)throw new Error(i.statusText);let a=await i.json();if(i=await ia(n+"/endpoint",{fetch:{headers:r}}),!i.ok)throw new Error(i.statusText);const o=await i.json();return a={...a,...o},a}(e,t),{type:n,url:i}=r;return Hi("3DTILES"===n&&i),r.headers={Authorization:"Bearer "+r.accessToken},r}const ob={...ib,id:"cesium-ion",name:"Cesium Ion",preload:async function(e,t={}){t=t["cesium-ion"]||{};const{accessToken:r}=t;let n=t.assetId;if(!Number.isFinite(n)){const t=e.match(/\/([0-9]+)\/tileset.json/);n=t&&t[1]}return ab(r,n)},parse:async(e,t,r)=>((t={...t})["3d-tiles"]=t["cesium-ion"],t.loader=ob,ib.parse(e,t,r)),options:{"cesium-ion":{...ib.options["3d-tiles"],accessToken:null}}};var sb=r(10),ub=r.n(sb);const cb=new Uint8Array(256);let lb=cb.length;function hb(){return lb>cb.length-16&&(ub.a.randomFillSync(cb),lb=0),cb.slice(lb,lb+=16)}var pb=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;var fb=function(e){return"string"==typeof e&&pb.test(e)};const db=[];for(let e=0;e<256;++e)db.push((e+256).toString(16).substr(1));var mb=function(e,t=0){const r=(db[e[t+0]]+db[e[t+1]]+db[e[t+2]]+db[e[t+3]]+"-"+db[e[t+4]]+db[e[t+5]]+"-"+db[e[t+6]]+db[e[t+7]]+"-"+db[e[t+8]]+db[e[t+9]]+"-"+db[e[t+10]]+db[e[t+11]]+db[e[t+12]]+db[e[t+13]]+db[e[t+14]]+db[e[t+15]]).toLowerCase();if(!fb(r))throw TypeError("Stringified UUID is invalid");return r};var gb=function(e,t,r){const n=(e=e||{}).random||(e.rng||hb)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return mb(n)},yb=r(81),bb=r.n(yb);function vb(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class wb{constructor(e,t){vb(this,"nodesPerPage",void 0),vb(this,"nodesCounter",void 0),vb(this,"writeFile",void 0),vb(this,"nodePages",void 0),this.nodesPerPage=t,this.nodesCounter=0,this.nodePages=[{}],this.nodePages[0].nodes=[],this.writeFile=e}useWriteFunction(e){this.writeFile=e}getNodeById(e){const t=Math.floor(e/this.nodesPerPage),r=e%this.nodesPerPage;return this.nodePages[t].nodes[r]}updateMaterialByNodeId(e,t){const r=this.getNodeById(e);r.mesh&&(r.mesh.material={definition:t,resource:r.index})}updateVertexCountByNodeId(e,t){const r=this.getNodeById(e);r.mesh&&(r.mesh.geometry.vertexCount=t)}updateNodeAttributeByNodeId(e){const t=this.getNodeById(e);t.mesh&&(t.mesh.attribute.resource=t.index)}updateFeatureCountByNodeId(e,t){const r=this.getNodeById(e);r.mesh&&(r.mesh.geometry.featureCount=t)}updateTexelCountHintByNodeId(e,t){const r=this.getNodeById(e);r.mesh&&r.mesh.material&&(r.mesh.material.texelCountHint=t)}addChildRelation(e,t){var r;if(null==e)return;null===(r=this.getNodeById(e).children)||void 0===r||r.push(t)}updateResourceInMesh(e){e.mesh&&(e.mesh.geometry.resource=e.index)}push(e,t){let r=this.nodePages[this.nodePages.length-1];return r.nodes.length===this.nodesPerPage&&(r={nodes:[]},this.nodePages.push(r)),e.index=this.nodesCounter++,r.nodes.push(e),this.addChildRelation(t,e.index),this.updateResourceInMesh(e),e.index}async save(e,t,r=!1){if(r){for(const[r,n]of this.nodePages.entries()){const i=JSON.stringify(n),a=Object(ji.join)(e,"nodepages");await t.enqueue({archiveKey:`nodePages/${r.toString()}.json.gz`,writePromise:this.writeFile(a,i,r.toString()+".json")})}const r=Ri()({nodeCount:this.nodesCounter},{folderPattern:{path:"folderPattern",default:"BASIC"},archiveCompressionType:{path:"archiveCompressionType",default:"STORE"},resourceCompressionType:{path:"resourceCompressionType",default:"GZIP"},I3SVersion:{path:"I3SVersion",default:"1.8"},nodeCount:{path:"nodeCount"}}),n=!1;await t.enqueue({archiveKey:"metadata.json",writePromise:this.writeFile(e,JSON.stringify(r),"metadata.json",n)})}else for(const[r,n]of this.nodePages.entries()){const i=JSON.stringify(n),a=Object(ji.join)(e,"nodepages",r.toString());await t.enqueue({writePromise:this.writeFile(a,i)})}}}const _b={};class kb extends ms{static get ZERO(){return _b.ZERO=_b.ZERO||Object.freeze(new kb(0,0,0,0))}constructor(e=0,t=0,r=0,n=0){super(-0,-0,-0,-0),ns(e)&&1===arguments.length?this.copy(e):(ts.debug&&(hs(e),hs(t),hs(r),hs(n)),this[0]=e,this[1]=t,this[2]=r,this[3]=n)}set(e,t,r,n){return this[0]=e,this[1]=t,this[2]=r,this[3]=n,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 ts.debug&&(hs(e.x),hs(e.y),hs(e.z),hs(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]=hs(e)}get w(){return this[3]}set w(e){this[3]=hs(e)}transform(e){return xs(this,this,e),this.check()}transformByMatrix3(e){return Bs(this,this,e),this.check()}transformByMatrix2(e){return function(e,t,r){const n=t[0],i=t[1];e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e[3]=t[3]}(this,this,e),this.check()}transformByQuaternion(e){return As(this,this,e),this.check()}applyMatrix4(e){return e.transform(this,this),this}}function xb(e){const{positions:t,normals:r,texCoords:n,colors:i,featureIndices:a}=e,o=t.length/9;if(!a.length)return{faceRange:new Uint32Array([0,o-1]),featureIds:[0],featureCount:1,positions:t,normals:r,texCoords:n,colors:i};const s=function(e){let t=1,r=1,n=e[0];const i=[],a=[],o=[n];i[0]=0,a[0]=n;for(let s=1;s<e.length;s++)n!==e[s]&&(i[t]=s/3-1,i[t+1]=s/3,a[r]=e[s],o.includes(e[s])||o.push(e[s]),t+=2,r+=1),n=e[s];i[t]=e.length/3-1;const s=new Uint32Array(i),u=o.length;return{faceRange:s,featureCount:u,featureIds:a}}(a);return function(e,t){const r=e[0],n=[r.featureId||0];let i=new Float32Array(r.positions),a=new Float32Array(r.normals),o=new Uint8Array(r.colors),s=new Float32Array(r.texCoords);const u=[0];let c=0,l=0;for(let t=1;t<e.length;t++){const r=e[t];n.push(r.featureId||0),i=Ka(i,r.positions),a=Ka(a,r.normals),o=Ka(o,r.colors),s=Ka(s,r.texCoords);const h=e[c];u.push(h.positions.length/9-1+l),u.push(h.positions.length/9+l),l+=h.positions.length/9,c+=1}u.push(i.length/9-1);return{faceRange:new Uint32Array(u),featureIds:n,positions:i,normals:a,colors:o,texCoords:s,featureCount:t}}(function(e){const t=[];for(let r=0;r<e.length;r++){const n=e[r],i=t.find(e=>e.featureId===n.featureId);i?(i.positions=Ka(i.positions,n.positions),i.normals=Ka(i.normals,n.normals),i.colors=Ka(i.colors,n.colors),i.texCoords=Ka(i.texCoords,n.texCoords)):t.push(n)}return t}(function(e){const{featureIds:t,positions:r,normals:n,colors:i,texCoords:a,faceRange:o=new Uint32Array(0)}=e,s=[];let u=new Float32Array(r),c=new Float32Array(n),l=new Uint8Array(i),h=new Float32Array(a),p=0;for(let e=0;e<t.length;e++){const r=o[e+p],n=o[e+p+1],i=Eb("positions",r,n),a=Eb("normals",r,n),f=Eb("colors",r,n),d=Eb("texCoords",r,n);s.push({featureId:t[e],positions:u.slice(0,i),normals:c.slice(0,a),colors:l.slice(0,f),texCoords:h.slice(0,d)}),u=u.slice(i),c=c.slice(a),l=l.slice(f),h=h.slice(d),p+=1}return s.sort((e,t)=>e.featureId-t.featureId)}({...s,...e})),s.featureCount)}function Eb(e,t,r){const n=r-t+1,i=3*n;switch(e){case"positions":case"normals":return 9*n;case"colors":return 4*i;case"texCoords":return 2*i;default:return 0}}function Ab(e){const t={};for(const r in e)t[r]={value:e[r].value};return t}const Sb=["CUSTOM_ATTRIBUTE_2","_BATCHID","BATCHID"];let jb=new Is;async function Tb(e,t,r,n,i,a,o,s){var u;const c=a,l=function(e=[]){const t=[];for(const r of e)t.push(Nb(r));return t}(null===(u=e.gltf)||void 0===u?void 0:u.materials),h=function(e){var t,r,n,i,a,o,s,u;return{gltfMaterials:null===(t=e.gltf)||void 0===t||null===(r=t.materials)||void 0===r?void 0:r.map(e=>({id:e.id})),nodes:((null===(n=e.gltf)||void 0===n||null===(i=n.scene)||void 0===i?void 0:i.nodes)||(null===(a=e.gltf)||void 0===a||null===(o=a.scenes)||void 0===o||null===(s=o[0])||void 0===s?void 0:s.nodes)||(null===(u=e.gltf)||void 0===u?void 0:u.nodes)||[]).map(e=>{var t;return e.mesh?{...e,mesh:{...e.mesh,primitives:null===(t=e.mesh)||void 0===t?void 0:t.primitives.map(e=>{var t,r;return{...e,indices:{value:null==e||null===(t=e.indices)||void 0===t?void 0:t.value},attributes:Ab(e.attributes),material:{id:null==e||null===(r=e.material)||void 0===r?void 0:r.id}}})}}:e}),cartographicOrigin:e.cartographicOrigin,cartesianModelMatrix:e.cartesianModelMatrix}}(e),p=await async function(e,t){const{gltfMaterials:r,nodes:n,cartographicOrigin:i,cartesianModelMatrix:a}=e,o=new Map;for(const e of r||[{id:"default"}])o.set(e.id,{positions:new Float32Array(0),normals:new Float32Array(0),texCoords:new Float32Array(0),colors:new Uint8Array(0),featureIndicesGroups:[],featureIndices:[],boundingVolumes:null});Bb(n,i,a,o,t);for(const e of o.keys()){const t=o.get(e);t&&(0!==t.positions.length?t.featureIndicesGroups&&(t.featureIndices=t.featureIndicesGroups.reduce((e,t)=>e.concat(t)),delete t.featureIndicesGroups):o.delete(e))}return o}(h,c);a&&function(e,t){for(const r of e.values()){const e=qm(r.positions,t);r.boundingVolumes=e;const n=e.obb.center;for(let e=0;e<r.positions.length;e+=3){const i=r.positions.subarray(e,e+3);vu.WGS84.cartesianToCartographic(Array.from(i),jb),jb[2]=jb[2]-t.getHeight(jb[1],jb[0]),jb=jb.subtract(n),r.positions.set(jb,e)}}}(p,o),p.has("default")&&l.push({material:{alphaMode:"opaque",pbrMetallicRoughness:{metallicFactor:1,roughnessFactor:1}}});const f=[];let d=t,{materials:m=[]}=e.gltf||{materials:[]};null!=m&&m.length||m.push({id:"default"});for(let t=0;t<m.length;t++){const a=m[t];if(!p.has(a.id))continue;const o=p.get(a.id);if(!o)continue;const{material:u,texture:c}=l[t];f.push(await Cb({convertedAttributes:o,material:u,texture:c,tileContent:e,nodeId:d,featuresHashArray:r,attributeStorageInfo:n,draco:i,workerSource:s})),d++}return f.length?f:null}async function Cb({convertedAttributes:e,material:t,texture:r,tileContent:n,nodeId:i,featuresHashArray:a,attributeStorageInfo:o,draco:s,workerSource:u}){var c;const l=e.boundingVolumes,h=e.positions.length/3,{faceRange:p,featureIds:f,positions:d,normals:m,colors:g,texCoords:y,featureCount:b}=xb(e);n.batchTableJson&&function(e,t,r,n){const i=function(e,t,r){const n={};for(let i=0;i<e.length;i++){const a=e[i],o=Vb(i,t,r);n[a.toString()]=o}return n}(e,n,r);Wb(t,i),Wb(e,i)}(f,e.featureIndices,a,n.batchTableJson);const v=new Uint32Array(2),w=function(e){const t=new BigUint64Array(e.length);for(let r=0;r<e.length;r++)t[r]=BigInt(e[r]);return t}(f);v.set([h,b],0);const _=new Uint8Array(Wa(v.buffer,d.buffer,m.buffer,r?y.buffer:new ArrayBuffer(0),g.buffer,w.buffer,p.buffer)),k=s?async function(e,t,r,n){const{positions:i,normals:a,texCoords:o,colors:s,featureIds:u,faceRange:c}=r,l=new Uint32Array(e);for(let e=0;e<l.length;e++)l.set([e],e);const h=function(e,t){const r=new Uint32Array(e.length);let n=0,i=0;for(let e=1;e<t.length;e+=2){const a=3*(t[e]+1);r.fill(n,i,a),n++,i=a+1}return r}(new Uint32Array(t.featureIndices.length?t.featureIndices:e),c),p={positions:i,normals:a,colors:s,"feature-index":h};o.length&&(p.texCoords=o);const f={"feature-index":{"i3s-attribute-type":"feature-index","i3s-feature-ids":new Int32Array(u)}};return nm({attributes:p,indices:l},jc,{...jc.options,source:n,reuseWorkers:!0,_nodeWorkers:!0,draco:{method:"MESH_SEQUENTIAL_ENCODING",attributesMetadata:f}})}(h,e,{positions:d,normals:m,texCoords:r?y:new Float32Array(0),colors:g,featureIds:f,faceRange:p},u.draco):null,x=function(e,t,r){const n=[];if(e){const i={OBJECTID:t,...e};for(const e in i){const t=Kb(e,r);let a=null;switch(t){case"Oid32":case"Int32":a=Jb(i[e]);break;case"Float64":a=Qb(i[e]);break;case"string":a=Yb(i[e]);break;default:a=Yb(i[e])}a&&n.push(a)}}return n}(n.batchTableJson,f,o);return{geometry:_,compressedGeometry:k,texture:r,sharedResources:Ub((null===(c=n.gltf)||void 0===c?void 0:c.materials)||[],i),meshMaterial:t,vertexCount:h,attributes:x,featureCount:b,boundingVolumes:l}}function Bb(e,t,r,n,i,a=new Ws([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){if(e)for(const o of e)Rb(o,t,r,n,i,a)}function Rb(e,t,r,n,i,a=new Ws([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){const o=function(e,t){let r=t;const{matrix:n,rotation:i,scale:a,translation:o}=e;return n&&(r=t.multiplyRight(n)),o&&(r=r.translate(o)),i&&(r=r.rotateXYZ(i)),a&&(r=r.scale(a)),r}(e,a),s=e.mesh;s&&function(e,t,r,n,i=!1,a=new Ws([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){for(const h of e.primitives){var o,s,u,c,l;let e=null;h.material?e=n.get(h.material.id):n.has("default")&&(e=n.get("default")),Hi(null!==e,"Primitive - material mapping failed");const p=h.attributes;e&&(e.positions=Ka(e.positions,Ob({vertices:p.POSITION.value,cartographicOrigin:t,cartesianModelMatrix:r,nodeMatrix:a,indices:null===(o=h.indices)||void 0===o?void 0:o.value,attributeSpecificTransformation:Ib,useCartesianPositions:i})),e.normals=Ka(e.normals,Ob({vertices:p.NORMAL&&p.NORMAL.value,cartographicOrigin:t,cartesianModelMatrix:r,nodeMatrix:a,indices:null===(s=h.indices)||void 0===s?void 0:s.value,attributeSpecificTransformation:Pb,useCartesianPositions:!1})),e.texCoords=Ka(e.texCoords,Db(p.TEXCOORD_0&&p.TEXCOORD_0.value,null===(u=h.indices)||void 0===u?void 0:u.value)),e.colors=Ka(e.colors,Mb(p.COLOR_0,null===(c=h.indices)||void 0===c?void 0:c.value)),e.featureIndicesGroups=e.featureIndicesGroups||[],e.featureIndicesGroups.push(Fb(Lb(p),null===(l=h.indices)||void 0===l?void 0:l.value)))}}(s,t,r,n,i,o),Bb(e.children||[],t,r,n,i,o)}function Ob(e){const{vertices:t,indices:r,attributeSpecificTransformation:n}=e,i=new Float32Array(3*r.length);if(!t)return i;for(let a=0;a<r.length;a++){const o=3*r[a],s=t.subarray(o,o+3);let u=new Is(Array.from(s));u=n(u,e),i[3*a]=u.x,i[3*a+1]=u.y,i[3*a+2]=u.z}return i}function Ib(e,t){const{cartesianModelMatrix:r,cartographicOrigin:n,nodeMatrix:i,useCartesianPositions:a}=t;return i&&(e=e.transform(i)),e=e.transform(r),a?e:(vu.WGS84.cartesianToCartographic([e[0],e[1],e[2]],e),e=e.subtract(n))}function Pb(e,t){const{cartesianModelMatrix:r,nodeMatrix:n}=t;return n&&(e=e.transformAsVector(n)),e=e.transformAsVector(r)}function Db(e,t){const r=new Float32Array(2*t.length);if(!e)return r.fill(1),r;for(let n=0;n<t.length;n++){const i=2*t[n],a=e.subarray(i,i+2);r[2*n]=a[0],r[2*n+1]=a[1]}return r}function Mb(e,t){const r=(null==e?void 0:e.components)||4,n=new Uint8Array(t.length*r);if(!e)return n.fill(255),n;const i=e.value;for(let e=0;e<t.length;e++){const a=t[e]*r,o=i.subarray(a,a+r),s=new Uint8Array(r);for(let e=0;e<o.length;e++)s[e]=255*o[e];n.set(s,e*r)}return n}function Fb(e,t){if(!e.length||!t.length)return[];const r=[];for(let n=0;n<t.length;n++){const i=t[n];r.push(e[i])}return r}function Lb(e){let t=[];for(let r=0;r<Sb.length;r++){const n=Sb[r];if(e[n]&&e[n].value){t=e[n].value;break}}return t}function Nb(e){var t,r,n,i;const a={doubleSided:e.doubleSided,emissiveFactor:null===(t=e.emissiveFactor)||void 0===t?void 0:t.map(e=>Math.round(255*e)),alphaMode:zb(e.alphaMode),pbrMetallicRoughness:{roughnessFactor:(null==e||null===(r=e.pbrMetallicRoughness)||void 0===r?void 0:r.roughnessFactor)||1,metallicFactor:(null==e||null===(n=e.pbrMetallicRoughness)||void 0===n?void 0:n.metallicFactor)||1}};let o;if(null!=e&&null!==(i=e.pbrMetallicRoughness)&&void 0!==i&&i.baseColorTexture?(o=e.pbrMetallicRoughness.baseColorTexture.texture.source,a.pbrMetallicRoughness.baseColorTexture={textureSetDefinitionId:0}):e.emissiveTexture&&(o=e.emissiveTexture.texture.source,a.pbrMetallicRoughness.baseColorTexture={textureSetDefinitionId:0}),!o){var s;const t=null==e||null===(s=e.pbrMetallicRoughness)||void 0===s?void 0:s.baseColorFactor;a.pbrMetallicRoughness.baseColorFactor=t&&t.map(e=>Math.round(255*e))||void 0}return{material:a,texture:o}}function zb(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend";default:return"opaque"}}function Ub(e,t){const r={};if(!e||!e.length)return r;r.materialDefinitionInfos=[];for(const n of e){const{materialDefinitionInfo:e,textureDefinitionInfo:i}=qb(n,t);r.materialDefinitionInfos.push(e),i&&(r.textureDefinitionInfos=r.textureDefinitionInfos||[],r.textureDefinitionInfos.push(i))}return r}function qb(e,t){var r;const n=(null==e||null===(r=e.pbrMetallicRoughness)||void 0===r?void 0:r.baseColorTexture)||e.emissiveTexture;let i=null;n&&(i=function(e,t){var r,n,i;return{encoding:null!=e&&null!==(r=e.source)&&void 0!==r&&r.mimeType?[e.source.mimeType]:void 0,images:[{id:Gb(e,t),size:null===(n=e.source)||void 0===n?void 0:n.image.width,length:[null===(i=e.source)||void 0===i?void 0:i.image.data.length]}]}}(n.texture,t));const{baseColorFactor:a,metallicFactor:o}=(null==e?void 0:e.pbrMetallicRoughness)||{};let s=a;return a&&0!==a[3]||!e.emissiveFactor||(s=e.emissiveFactor,s[3]=s[3]||1),{materialDefinitionInfo:Hb(s||[1,1,1,1],o),textureDefinitionInfo:i}}function Hb(e,t=1){const r=new kb(0,0,0,1),n=new kb(1,1,1,1),i=new kb(.04/255,.04/255,.04/255,0),a=new kb(e),o=n.subtract(i).multiply(a),s=o.lerp(o,r,t);i[3]=1;const u=i.lerp(i,a,t);return{params:{diffuse:s.toArray(),specular:u.toArray(),renderMode:"solid"}}}function Gb(e,t){var r;const{width:n,height:i}=null===(r=e.source)||void 0===r?void 0:r.image,a=t+1,o=32-a.toString(2).length,s="0".repeat(o).concat(a.toString(2));return BigInt(`0b${(268435456+(n-1<<12)+(i-1<<0)).toString(2)}${s}`).toString()}function Vb(e,t,r){const n=function(e,t){let r="";for(const n in e)r+=e[n][t];return r}(t,e),i=bb()(n);return r.includes(i)?r.indexOf(i):r.push(i)-1}function Wb(e,t){for(let r=0;r<e.length;r++)e[r]=t[e[r]]}function Kb(e,t){return t.find(t=>t.name===e).attributeValues.valueType}function Jb(e){const t=new Uint32Array([e.length]),r=new Uint32Array(e);return Wa(t.buffer,r.buffer)}function Qb(e){const t=new Uint32Array([e.length]),r=new Uint8Array(4),n=new Float64Array(e);return Wa(t.buffer,r.buffer,n.buffer)}function Yb(e){const t=new Uint32Array([e.length]);let r=0;const n=new Uint32Array(e.length),i=[];for(let t=0;t<e.length;t++){const a=String(e[t])+"\0",o=Buffer.from(a),s=o.length;r+=s,n[t]=s,i.push(o)}const a=new Uint32Array([r]);return Wa(t.buffer,a.buffer,n.buffer,...i)}const $b={id:{path:"id",transform:e=>e.toUpperCase()},profile:{path:"profile",default:"meshpyramids"},version:{path:"version",default:"1.8"},resourcePattern:{path:"resourcePattern",default:["3dNodeIndexDocument","Attributes","SharedResource","Geometry"]},rootNode:{path:"rootNode",default:"./nodes/root"},extent:{path:"extent"},indexCRS:{path:"indexCRS",default:"http://www.opengis.net/def/crs/EPSG/0/4326"},vertexCRS:{path:"vertexCRS",default:"http://www.opengis.net/def/crs/EPSG/0/4326"},normalReferenceFrame:{path:"normalReferenceFrame",default:"east-north-up"},attributeEncoding:{path:"attributeEncoding",default:"application/octet-stream; version=1.6"},textureEncoding:{path:"textureEncoding",default:["image/jpeg","image/ktx2"]},lodType:{path:"lodType",default:"MeshPyramid"},lodModel:{path:"lodModel",default:"node-switching"},defaultGeometrySchema:{path:"defaultGeometrySchema",default:{geometryType:"triangles",header:[{property:"vertexCount",type:"UInt32"},{property:"featureCount",type:"UInt32"}],topology:"PerAttributeArray",ordering:["position","normal","uv0","color"],vertexAttributes:{position:{valueType:"Float32",valuesPerElement:3},normal:{valueType:"Float32",valuesPerElement:3},uv0:{valueType:"Float32",valuesPerElement:2},color:{valueType:"UInt8",valuesPerElement:4}},featureAttributeOrder:["id","faceRange"],featureAttributes:{id:{valueType:"UInt64",valuesPerElement:1},faceRange:{valueType:"UInt32",valuesPerElement:2}}}}},Xb=()=>({version:{path:"version"},id:{path:"id"},path:{path:"path"},level:{path:"level"},mbs:{path:"mbs"},obb:{path:"obb"},lodSelection:{path:"lodSelection",default:[{metricType:"maxScreenThresholdSQ",maxError:196349.54374999998},{metricType:"maxScreenThreshold",maxError:999.9999999999999}]},children:{path:"children",default:null},neighbors:{path:"neighbors",default:null},parentNode:{path:"parentNode",transform:e=>Ri()(e,{id:{path:"id"},href:{path:"href"},mbs:{path:"mbs"},obb:{path:"obb"}}),default:null},sharedResource:{path:"sharedResource",default:null},featureData:{path:"featureData",default:null},geometryData:{path:"geometryData",default:null},textureData:{path:"textureData",default:null},attributeData:{path:"attributeData",default:null}});function Zb(e,t,r){const n={};for(const[t,i]of e.entries())n[`Mat${r.nodePath}${t}`]=Ri()(i,{name:{path:"name",default:"standard"},type:{path:"type",default:"standard"},params:{path:"params",transform:(e,t,r)=>Ri()(r,{renderMode:{path:"renderMode",default:"solid"},shininess:{path:"shininess",default:1},reflectivity:{path:"reflectivity",default:0},ambient:{path:"ambient",default:[1,1,1,1]},diffuse:{path:"diffuse",default:[1,1,1,1]},specular:{path:"specular",default:[0,0,0,0]},useVertexColorAlpha:{path:"useVertexColorAlpha",default:!1},vertexRegions:{path:"vertexRegions",default:!1},vertexColors:{path:"vertexColors",default:!0}})}});return n}function ev(e,t,r){if(!e)return null;const n={};for(const[t,i]of e.entries()){const e=`${r.nodePath}${t}`;i.imageIndex=e,n[e]=Ri()(i,{encoding:{path:"encoding"},wrap:{path:"wrap",default:["none"]},atlas:{path:"atlas",default:!1},uvSet:{path:"uvSet",default:"uv0"},channels:{path:"channels",default:"rgb"},images:{path:"images",transform:(e,t,r)=>e.map(e=>Ri()(e,{id:{path:"id"},size:{path:"size"},href:{path:"href",default:["../textures/0"]},length:{path:"length"}}))}})}return n}function tv(e,t){if(!e)throw new Error(t||"luma.gl: assertion failed.")}const rv={};function nv(e="id"){rv[e]=rv[e]||1;const t=rv[e]++;return"".concat(e,"-").concat(t)}const iv={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};const av=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),ov=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]),sv=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0]),uv=new Float32Array([0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1]),cv={POSITION:{size:3,value:new Float32Array(ov)},NORMAL:{size:3,value:new Float32Array(sv)},TEXCOORD_0:{size:2,value:new Float32Array(uv)}};class lv extends class{static get DRAW_MODE(){return iv}constructor(e={}){const{id:t=nv("geometry"),drawMode:r=iv.TRIANGLES,attributes:n={},indices:i=null,vertexCount:a=null}=e;this.id=t,this.drawMode=0|r,this.attributes={},this.userData={},this._setAttributes(n,i),this.vertexCount=a||this._calculateVertexCount(this.attributes,this.indices)}get mode(){return this.drawMode}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(e){return"Geometry ".concat(this.id," attribute ").concat(e)}_setAttributes(e,t){t&&(this.indices=ArrayBuffer.isView(t)?{value:t,size:1}:t);for(const t in e){let r=e[t];r=ArrayBuffer.isView(r)?{value:r}:r,tv(ArrayBuffer.isView(r.value),"".concat(this._print(t),": must be typed array or object with value as typed array")),"POSITION"!==t&&"positions"!==t||r.size||(r.size=3),"indices"===t?(tv(!this.indices),this.indices=r):this.attributes[t]=r}return this.indices&&void 0!==this.indices.isIndexed&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this}_calculateVertexCount(e,t){if(t)return t.value.length;let r=1/0;for(const t in e){const n=e[t],{value:i,size:a,constant:o}=n;!o&&i&&a>=1&&(r=Math.min(r,i.length/a))}return tv(Number.isFinite(r)),r}}{constructor(e={}){const{id:t=nv("cube-geometry")}=e;super({...e,id:t,indices:{size:1,value:new Uint16Array(av)},attributes:{...cv,...e.attributes}})}}function hv(e){var t,r;if(null==e||null===(t=e.parentNode)||void 0===t||!t.obb||null==e||null===(r=e.parentNode)||void 0===r||!r.mbs)return[];const n=[];return function(e,t){var r;const n=function(e){const{center:t,halfSize:r,quaternion:n}=e;return(new lp).fromCenterHalfSizeQuaternion(t,r,n)}(t.parentNode.obb),i=function(e){const t=new lv,r=e.obb.halfSize,n=t.getAttributes(),i=new Float32Array(n.POSITION.value),a=vu.WGS84.cartographicToCartesian(e.obb.center);let o=[];for(let t=0;t<i.length;t+=3){const n=new Is(i[t]*=r[0],i[t+1]*=r[1],i[t+2]*=r[2]).transformByQuaternion(e.obb.quaternion).add(a);o=o.concat(n)}return o}(t);if(function(e,t){let r=!0;for(let n=0;n<t.length/3;n+=3){const i=[t[n],t[n+1],t[n+2]],a=vu.WGS84.cartesianToCartographic(i);if(e.distanceTo(a)>0){r=!1;break}}return r}(n,i))return;const a=`OBB of Tile (${t.id}) doesn't fit into Parent (${null===(r=t.parentNode)||void 0===r?void 0:r.id}) tile OBB`;e.push(a)}(n,e),function(e,t){const r=pv(t.mbs),n=pv(t.parentNode.mbs);if(r.center.distanceTo(n.center)+r.radius>n.radius){var i;const r=`MBS of Tile (${t.id}) doesn't fit into Parent (${null===(i=t.parentNode)||void 0===i?void 0:i.id}) tile MBS`;e.push(r)}}(n,e),n}function pv(e){return new bh([e[0],e[1],e[2]],e[3])}const fv={name:"Basis Universal Supercompressed GPU Texture",id:Oi?"ktx2-basis-writer":"ktx2-basis-writer-nodejs",module:"textures",version:"3.2.7",extensions:["ktx2"],worker:!0,options:{useSRGB:!1,qualityLevel:10,encodeUASTC:!1,mipmaps:!1}},{_encodeImageNode:dv}=globalThis;let mv=!0;const gv={name:"Images",id:"image",module:"images",version:"3.2.7",extensions:["jpeg"],options:{image:{mimeType:"image/png",jpegQuality:null}},encode:async function(e,t){return(t=t||{}).image=t.image||{},dv?dv(e,{type:t.image.mimeType}):async function(e,t){const{mimeType:r,jpegQuality:n}=t.image,{width:i,height:a}=function(e){return Su(e)}(e),o=document.createElement("canvas");o.width=i,o.height=a,function(e,t,r=0,n=0){if(0===r&&0===n&&"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const r=t.getContext("bitmaprenderer");if(r)return r.transferFromImageBitmap(e),t}const i=t.getContext("2d");if(e.data){const r=new Uint8ClampedArray(e.data),n=new ImageData(r,e.width,e.height);return i.putImageData(n,0,0),t}i.drawImage(e,0,0)}(e,o);const s=await new Promise(e=>{if(n&&mv)try{return void o.toBlob(e,r,n)}catch(e){mv=!1}o.toBlob(e,r)});if(!s)throw new Error("image encoding failed");return await s.arrayBuffer()}(e,t)}};class yv extends Array{enqueue(e){this.push(e)}dequeue(){return this.shift()}peek(){return this[0]}isEmpty(){return 0===this.length}}function bv(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class vv extends yv{constructor(e=2e3,t=400){super(),bv(this,"intervalId",void 0),bv(this,"writePromise",null),bv(this,"fileMap",{}),bv(this,"listeningInterval",void 0),bv(this,"writeConcurrency",void 0),this.listeningInterval=e,this.writeConcurrency=t}async enqueue(e){super.enqueue(e),Ci.a.memoryUsage().rss>4294967296&&await this.startWrite()}startListening(){this.intervalId=setInterval(this.startWrite.bind(this),this.listeningInterval)}stopListening(){this.intervalId&&clearInterval(this.intervalId)}async startWrite(){if(this.writePromise)return await this.writePromise,void(this.writePromise=null);this.writePromise=this.doWrite(),await this.writePromise,this.writePromise=null}async finalize(){this.stopListening(),await this.startWrite()}async doWrite(){for(;this.length;){const e=[],t=[];for(let r=0;r<this.writeConcurrency;r++){const r=this.dequeue();if(!r)break;const{archiveKey:n,writePromise:i}=r;t.push(n),e.push(i)}const r=await Promise.all(e);this.updateFileMap(t,r)}this.writePromise=null}updateFileMap(e,t){for(let r=0;r<e.length;r++){const n=e[r];n&&(this.fileMap[n]=t[r])}}}const wv={id:"i3s-attributes",name:"I3S Attributes Worker",module:"tile-converter",version:"3.2.7",options:{useCartesianPositions:!1}};var _v;function kv(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const xv=(null===(_v=Ci.a.env)||void 0===_v?void 0:_v.IonToken)||"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ";class Ev{constructor(){kv(this,"nodePages",void 0),kv(this,"options",void 0),kv(this,"layers0Path",void 0),kv(this,"materialMap",void 0),kv(this,"materialDefinitions",void 0),kv(this,"vertexCounter",void 0),kv(this,"layers0",void 0),kv(this,"featuresHashArray",void 0),kv(this,"refinementCounter",void 0),kv(this,"validate",void 0),kv(this,"boundingVolumeWarnings",[]),kv(this,"conversionStartTime",[0,0]),kv(this,"refreshTokenTime",[0,0]),kv(this,"sourceTileset",null),kv(this,"geoidHeightModel",null),kv(this,"Loader",ib),kv(this,"generateTextures",void 0),kv(this,"generateBoundingVolumes",void 0),kv(this,"layersHasTexture",void 0),kv(this,"workerSource",{}),kv(this,"writeQueue",new vv),this.nodePages=new wb(Kd,64),this.options={},this.layers0Path="",this.materialMap=new Map,this.materialDefinitions=[],this.vertexCounter=0,this.layers0=null,this.featuresHashArray=[],this.refinementCounter={tilesCount:0,tilesWithAddRefineCount:0},this.validate=!1,this.generateTextures=!1,this.generateBoundingVolumes=!1,this.layersHasTexture=!1}async convert(e){if(Oi)return console.log(Vm),Vm;this.conversionStartTime=Ci.a.hrtime();const{tilesetName:t,slpk:r,egmFilePath:n,inputUrl:i,validate:a,outputPath:o,draco:s,sevenZipExe:u,maxDepth:c,token:l,generateTextures:h,generateBoundingVolumes:p}=e;this.options={maxDepth:c,slpk:r,sevenZipExe:u,egmFilePath:n,draco:s,token:l,inputUrl:i},this.validate=Boolean(a),this.Loader=-1!==i.indexOf("https://")?ob:ib,this.generateTextures=Boolean(h),this.generateBoundingVolumes=Boolean(p),this.writeQueue=new vv,this.writeQueue.startListening(),console.log("Loading egm file..."),this.geoidHeightModel=await $o(n,Rd),console.log("Loading egm file completed!"),r&&this.nodePages.useWriteFunction(Jd),await this.loadWorkers();try{const e=await this._fetchPreloadOptions(),n={loadOptions:{basis:{format:"rgba32"}}};e.headers&&(n.loadOptions.fetch={headers:e.headers}),Object.assign(n,e);const a=await $o(i,this.Loader,n.loadOptions);return this.sourceTileset=new xd(a,n),await this._createAndSaveTileset(o,t),await this._finishConversion({slpk:Boolean(r),outputPath:o,tilesetName:t}),a}catch(e){throw e}finally{La.getWorkerFarm({}).destroy()}}async _createAndSaveTileset(e,t){const r=Object(ji.join)(""+e,""+t);try{await Qd(r)}catch(e){}this.layers0Path=Object(ji.join)(r,"SceneServer","layers","0"),this._formLayers0(t),this.materialDefinitions=[],this.materialMap=new Map;const n=this.sourceTileset.root,i=Um(n,this.geoidHeightModel),a=this.nodePages.push({index:0,lodThreshold:0,obb:i.obb,children:[]}),o=this.options.slpk,s=this._formRootNodeIndexDocument(i);await this._convertNodesTree(s,n,a,i),this.layers0.materialDefinitions=this.materialDefinitions,!1===this.layersHasTexture&&(this.layers0.store.defaultGeometrySchema.ordering=this.layers0.store.defaultGeometrySchema.ordering.filter(e=>"uv0"!==e)),await this._writeLayers0(),async function(e,t,r){const n={serviceItemId:gb().replace(/-/gi,""),layerName:e,layers0:t},i=Ri()(n,{serviceItemId:{path:"serviceItemId"},serviceName:{path:"layerName"},name:{path:"layerName"},currentVersion:{path:"currentVersion",default:10.7},serviceVersion:{path:"serviceVersion",default:"1.8"},supportedBindings:{path:"supportedBindings",default:["REST"]},layers:{path:"layers0",transform:e=>[e]}}),a=Object(ji.join)(r,"SceneServer");await Kd(a,JSON.stringify(i))}(t,this.layers0,r),await this._writeNodeIndexDocument(s,"root",Object(ji.join)(this.layers0Path,"nodes","root")),await this.nodePages.save(this.layers0Path,this.writeQueue,o),await this.writeQueue.finalize(),await this._createSlpk(r)}_formLayers0(e){var t,r,n;const i=function(e){let t;t=e instanceof bh?e:e.getBoundingSphere();const r=t.center,n=t.radius,i=vu.WGS84.cartesianToCartographic(new Is(r[0]+n,r[1]+n,r[2]+n),new Is),a=vu.WGS84.cartesianToCartographic(new Is(r[0]-n,r[1]-n,r[2]-n),new Is);return{xmin:a[0],xmax:i[0],ymin:a[1],ymax:i[1],zmin:a[2],zmax:i[2]}}((null===(t=this.sourceTileset)||void 0===t?void 0:t.boundingVolume)||(null===(r=this.sourceTileset)||void 0===r||null===(n=r.root)||void 0===n?void 0:n.boundingVolume)),a=[i.xmin,i.ymin,i.xmax,i.ymax],o={version:`{${gb().toUpperCase()}}`,id:0,name:e,href:"./layers/0",store:{id:`{${gb().toUpperCase()}}`,extent:a},nodePages:{nodesPerPage:64},compressGeometry:this.options.draco,fullExtent:i};this.layers0=Ri()(o,{version:{path:"version",transform:e=>e.toUpperCase()},id:{path:"id",default:0},name:{path:"name"},href:{path:"href",default:"./layers/0"},layerType:{path:"layerType",default:"IntegratedMesh"},spatialReference:{path:"spatialReference",transform:e=>Ri()(e,{wkid:{path:"wkid",default:4326},latestWkid:{path:"latestWkid",default:4326},vcsWkid:{path:"vcsWkid",default:5773},latestVcsWkid:{path:"latestVcsWkid",default:5773}})},capabilities:{path:"capabilities",default:["View","Query"]},store:{path:"store",transform:e=>Ri()(e,$b)},fullExtent:{path:"fullExtent",transform:e=>Ri()(e,{xmin:{path:"xmin"},ymin:{path:"ymin"},xmax:{path:"xmax"},ymax:{path:"ymax"},zmin:{path:"zmin"},zmax:{path:"zmax"}})},heightModelInfo:{path:"heightModelInfo",transform:e=>Ri()(e,{heightModel:{path:"heightModel",default:"gravity_related_height"},vertCRS:{path:"vertCRS",default:"EGM96_Geoid"},heightUnit:{path:"heightUnit",default:"meter"}})},nodePages:{path:"nodePages",transform:e=>Ri()(e,{nodesPerPage:{path:"nodesPerPage"},lodSelectionMetricType:{path:"lodSelectionMetricType",default:"maxScreenThresholdSQ"}})},materialDefinitions:{path:"materialDefinitions",default:[]},textureSetDefinitions:{path:"textureSetDefinitions",default:[]},geometryDefinitions:{path:"compressGeometry",transform:e=>{const t=[{geometryBuffers:[]},{geometryBuffers:[]}];return t[0].geometryBuffers.push({offset:8,position:{type:"Float32",component:3},normal:{type:"Float32",component:3},uv0:{type:"Float32",component:2},color:{type:"UInt8",component:4},featureId:{binding:"per-feature",type:"UInt64",component:1},faceRange:{binding:"per-feature",type:"UInt32",component:2}}),t[1].geometryBuffers.push({offset:8,position:{type:"Float32",component:3},normal:{type:"Float32",component:3},color:{type:"UInt8",component:4},featureId:{binding:"per-feature",type:"UInt64",component:1},faceRange:{binding:"per-feature",type:"UInt32",component:2}}),e&&(t[0].geometryBuffers.push({compressedAttributes:{encoding:"draco",attributes:["position","normal","uv0","color","feature-index"]}}),t[1].geometryBuffers.push({compressedAttributes:{encoding:"draco",attributes:["position","normal","color","feature-index"]}})),t},default:[{geometryBuffers:[{offset:8,position:{type:"Float32",component:3},normal:{type:"Float32",component:3},uv0:{type:"Float32",component:2},color:{type:"UInt8",component:4},featureId:{binding:"per-feature",type:"UInt64",component:1},faceRange:{binding:"per-feature",type:"UInt32",component:2}},{offset:8,position:{type:"Float32",component:3},normal:{type:"Float32",component:3},color:{type:"UInt8",component:4},featureId:{binding:"per-feature",type:"UInt64",component:1},faceRange:{binding:"per-feature",type:"UInt32",component:2}}]}]},attributeStorageInfo:{path:"attributeStorageInfo",default:[]},fields:{path:"fields",default:[]},popupInfo:{path:"popupInfo",default:null}})}_formRootNodeIndexDocument(e){const t={version:`{${gb().toUpperCase()}}`,id:"root",level:0,lodSelection:[{metricType:"maxScreenThresholdSQ",maxError:0},{metricType:"maxScreenThreshold",maxError:0}],...e,children:[]};return Ri()(t,Xb())}async _convertNodesTree(e,t,r,n){if(await this.sourceTileset._loadTile(t),this.isContentSupported(t)){e.children=e.children||[],e.children.push({id:"1",href:"./1",...n});const[i]=await this._createNode(e,t,r,0),a=Object(ji.join)(this.layers0Path,"nodes",i.path);this.options.slpk?await this.writeQueue.enqueue({archiveKey:"nodes/1/3dNodeIndexDocument.json.gz",writePromise:Jd(a,JSON.stringify(i),"3dNodeIndexDocument.json")}):await this.writeQueue.enqueue({writePromise:Kd(a,JSON.stringify(i))})}else await this._addChildrenWithNeighborsAndWriteFile({parentNode:e,sourceTiles:t.children,parentId:r,level:1});await t.unloadContent()}async _writeLayers0(){this.options.slpk?await this.writeQueue.enqueue({archiveKey:"3dSceneLayer.json.gz",writePromise:Jd(this.layers0Path,JSON.stringify(this.layers0),"3dSceneLayer.json")}):await this.writeQueue.enqueue({writePromise:Kd(this.layers0Path,JSON.stringify(this.layers0))})}async _writeNodeIndexDocument(e,t,r){this.options.slpk?await this.writeQueue.enqueue({archiveKey:`nodes/${t}/3dNodeIndexDocument.json.gz`,writePromise:Jd(r,JSON.stringify(e),"3dNodeIndexDocument.json")}):await this.writeQueue.enqueue({writePromise:Kd(r,JSON.stringify(e))})}async _createSlpk(e){if(this.options.slpk){const t=Object(ji.join)(e,"SceneServer","layers","0"),r=e+".slpk";await Wd(t,r,0,".",this.options.sevenZipExe);try{await Qd(e)}catch(e){}}}async _addChildrenWithNeighborsAndWriteFile(e){const t=[];await this._addChildren({...e,childNodes:t}),await this._addNeighborsAndWriteFile(e.parentNode,t)}async _addChildren(e){const{childNodes:t,sourceTiles:r,parentNode:n,parentId:i,level:a}=e;if(!(this.options.maxDepth&&a>this.options.maxDepth))for(const e of r){if("json"===e.type)await this.sourceTileset._loadTile(e),await this._addChildren({parentNode:n,sourceTiles:e.children,childNodes:t,parentId:i,level:a+1}),await e.unloadContent();else{const r=await this._createNode(n,e,i,a);n.children=n.children||[];for(const e of r)n.children.push({id:e.id,href:"../"+e.path,obb:e.obb,mbs:e.mbs}),t.push(e)}e.id&&console.log(e.id)}}async _addNeighborsAndWriteFile(e,t){for(const n of t){var r;const t=Object(ji.join)(this.layers0Path,"nodes",n.path),i=n.path;if(delete n.path,Number(null==e||null===(r=e.children)||void 0===r?void 0:r.length)<1e3)for(const t of e.children||[])n.id!==t.id&&n.neighbors&&n.neighbors.push({...t});else console.warn(`Node ${n.id}: neighbors attribute is omited because of large number of neigbors`),delete n.neighbors;await this._writeNodeIndexDocument(n,i,t),n.neighbors=[]}}async _createNode(e,t,r,n){var i;this.validate&&this._checkAddRefinementTypeForTile(t),await this._updateTilesetOptions(),await this.sourceTileset._loadTile(t);let a=Um(t,this.geoidHeightModel);(null==t||null===(i=t.content)||void 0===i?void 0:i.batchTableJson)&&this._convertAttributeStorageInfo(t.content);const o=await this._convertResources(t),s=[],u=[],c={geometry:null,compressedGeometry:null,texture:null,sharedResources:null,meshMaterial:null,vertexCount:null,attributes:null,featureCount:null,boundingVolumes:null};for(const n of o||[c]){this.layersHasTexture=this.layersHasTexture||Boolean(n.texture),this.generateBoundingVolumes&&n.boundingVolumes&&(a=n.boundingVolumes);const i=Id(t,a),o=i.find(e=>"maxScreenThresholdSQ"===e.metricType)||{maxError:0},c=this._createNodeInNodePages(o,a,t,r,n),l=this._createNodeIndexDocument(e,a,i,c,n);c.mesh&&await this._writeResources(n,l.path),this.validate&&(this.boundingVolumeWarnings=hv(l),this.boundingVolumeWarnings&&this.boundingVolumeWarnings.length&&console.warn("Bounding Volume Warnings: ",...this.boundingVolumeWarnings)),s.push(l),u.push(c)}return t.unloadContent(),await this._addChildrenWithNeighborsAndWriteFile({parentNode:s[0],sourceTiles:t.children,parentId:u[0].index,level:n+1}),s}_convertAttributeStorageInfo(e){var t,r;const n=e&&e.batchTableJson;!n||null!==(t=this.layers0)&&void 0!==t&&null!==(r=t.attributeStorageInfo)&&void 0!==r&&r.length||this._convertBatchTableInfoToNodeAttributes(n)}async _convertResources(e){var t;if(!this.isContentSupported(e))return null;return await Tb(e.content,Number(this.nodePages.nodesCounter),this.featuresHashArray,null===(t=this.layers0)||void 0===t?void 0:t.attributeStorageInfo,this.options.draco,this.generateBoundingVolumes,this.geoidHeightModel,this.workerSource)}_createNodeInNodePages(e,t,r,n,i){const{meshMaterial:a,texture:o,vertexCount:s,featureCount:u,geometry:c}=i,l={index:0,lodThreshold:e.maxError,obb:t.obb,children:[]};c&&this.isContentSupported(r)&&(l.mesh={geometry:{definition:o?0:1,resource:0},attribute:{resource:0},material:{definition:0}});const h=this.nodePages.push(l,n);if(a&&this.nodePages.updateMaterialByNodeId(h,this._findOrCreateMaterial(a)),o){const e=o.image.height*o.image.width;this.nodePages.updateTexelCountHintByNodeId(h,e)}return s&&(this.vertexCounter+=s,this.nodePages.updateVertexCountByNodeId(h,s)),this.nodePages.updateNodeAttributeByNodeId(h),u&&this.nodePages.updateFeatureCountByNodeId(h,u),l}_createNodeIndexDocument(e,t,r,n,i){const{texture:a,attributes:o}=i,s=n.index,u={version:e.version,id:s.toString(),path:s.toString(),level:e.level+1,...t,lodSelection:r,parentNode:{id:e.id,href:"../"+e.id,mbs:e.mbs,obb:e.obb},children:[],neighbors:[]},c=Ri()(u,Xb());var l,h;if(n.mesh&&(c.geometryData=[{href:"./geometries/0"}],c.sharedResource={href:"./shared"},a&&(c.textureData=[{href:"./textures/0"},{href:"./textures/1"}]),o&&o.length&&null!==(l=this.layers0)&&void 0!==l&&null!==(h=l.attributeStorageInfo)&&void 0!==h&&h.length)){c.attributeData=[];for(let e=0;e<o.length;e++){const t=this.layers0.attributeStorageInfo[e].key;c.attributeData.push({href:`./attributes/${t}/0`})}}return c}async _writeResources(e,t){const{geometry:r,compressedGeometry:n,texture:i,sharedResources:a,attributes:o}=e,s=Object(ji.join)(this.layers0Path,"nodes",t),u=Object(ji.join)("nodes",t);await this._writeGeometries(r,n,s,u),await this._writeShared(a,s,u,t),await this._writeTexture(i,s,u),await this._writeAttributes(o,s,u)}async _writeGeometries(e,t,r,n){if(this.options.slpk){const t=Object(ji.join)(r,"geometries");await this.writeQueue.enqueue({archiveKey:n+"/geometries/0.bin.gz",writePromise:Jd(t,e,"0.bin")})}else{const t=Object(ji.join)(r,"geometries/0/");await this.writeQueue.enqueue({writePromise:Kd(t,e,"index.bin")})}if(this.options.draco)if(this.options.slpk){const e=Object(ji.join)(r,"geometries");await this.writeQueue.enqueue({archiveKey:n+"/geometries/1.bin.gz",writePromise:Jd(e,t,"1.bin")})}else{const e=Object(ji.join)(r,"geometries/1/");await this.writeQueue.enqueue({writePromise:Kd(e,t,"index.bin")})}}async _writeShared(e,t,r,n){if(!e)return;e.nodePath=n;const i=Ri()(e,{materialDefinitions:{path:"materialDefinitionInfos",transform:Zb},textureDefinitions:{path:"textureDefinitionInfos",transform:ev}}),a=JSON.stringify(i);if(this.options.slpk){const e=Object(ji.join)(t,"shared");await this.writeQueue.enqueue({archiveKey:r+"/shared/sharedResource.json.gz",writePromise:Jd(e,a,"sharedResource.json")})}else{const e=Object(ji.join)(t,"shared/");await this.writeQueue.enqueue({writePromise:Kd(e,a)})}}async _writeTexture(e,t,r){if(e){const n=this._getFormatByMimeType(null==e?void 0:e.mimeType),i=[],a=e.bufferView.data;switch(n){case"jpg":case"png":if(i.push({name:"0",format:n}),await this.writeTextureFile(a,"0",n,t,r),this.generateTextures){i.push({name:"1",format:"ktx2"});const n=nm(e.image,fv,{...fv.options,source:this.workerSource.ktx2,reuseWorkers:!0,_nodeWorkers:!0});await this.writeTextureFile(n,"1","ktx2",t,r)}break;case"ktx2":if(i.push({name:"1",format:n}),await this.writeTextureFile(a,"1",n,t,r),this.generateTextures){i.push({name:"0",format:"jpg"});const n=nm(e.image.data[0],gv);await this.writeTextureFile(n,"0","jpg",t,r)}}this.layers0.textureSetDefinitions.length||this.layers0.textureSetDefinitions.push({formats:i})}}async writeTextureFile(e,t,r,n,i){if(this.options.slpk){const a=Object(ji.join)(n,"textures"),o=!1;await this.writeQueue.enqueue({archiveKey:`${i}/textures/${t}.${r}`,writePromise:Jd(a,e,`${t}.${r}`,o)})}else{const i=Object(ji.join)(n,`textures/${t}/`);await this.writeQueue.enqueue({writePromise:Kd(i,e,"index."+r)})}}async _writeAttributes(e=[],t,r){var n,i;if(null!=e&&e.length&&null!==(n=this.layers0)&&void 0!==n&&null!==(i=n.attributeStorageInfo)&&void 0!==i&&i.length)for(let n=0;n<e.length;n++){const i=this.layers0.attributeStorageInfo[n].key,a=new Uint8Array(e[n]);if(this.options.slpk){const e=Object(ji.join)(t,"attributes",i);await this.writeQueue.enqueue({archiveKey:`${r}/attributes/${i}.bin.gz`,writePromise:Jd(e,a,"0.bin")})}else{const e=Object(ji.join)(t,`attributes/${i}/0`);await this.writeQueue.enqueue({writePromise:Kd(e,a,"index.bin")})}}}_getFormatByMimeType(e){switch(e){case"image/jpeg":return"jpg";case"image/png":return"png";case"image/ktx2":return"ktx2";default:return"jpg"}}_findOrCreateMaterial(e){const t=bb()(JSON.stringify(e));if(this.materialMap.has(t))return this.materialMap.get(t);const r=this.materialDefinitions.push(e)-1;return this.materialMap.set(t,r),r}_createdStorageAttribute(e,t,r){const n={key:"f_"+e,name:t,ordering:["attributeValues"],header:[{property:"count",valueType:"UInt32"}],attributeValues:{valueType:"Int32",valuesPerElement:1}};switch(r){case"OBJECTID":this._setupIdAttribute(n);break;case"string":this._setupStringAttribute(n);break;case"double":this._setupDoubleAttribute(n);break;case"Int32":break;default:this._setupStringAttribute(n)}return n}getAttributeType(e,t){return"OBJECTID"===e?"OBJECTID":"string"==typeof t?"string":"number"==typeof t?Number.isInteger(t)?"Int32":"double":"string"}_setupStringAttribute(e){e.ordering.unshift("attributeByteCounts"),e.header.push({property:"attributeValuesByteCount",valueType:"UInt32"}),e.attributeValues={valueType:"String",encoding:"UTF-8",valuesPerElement:1},e.attributeByteCounts={valueType:"UInt32",valuesPerElement:1}}_setupIdAttribute(e){e.attributeValues={valueType:"Oid32",valuesPerElement:1}}_setupDoubleAttribute(e){e.attributeValues={valueType:"Float64",valuesPerElement:1}}_createFieldAttribute(e,t){return{name:e,type:t,alias:e}}_convertBatchTableInfoToNodeAttributes(e){let t=0;const r={OBJECTID:[0],...e};for(const e in r){const n=r[e][0],i=this.getAttributeType(e,n),a=this._createdStorageAttribute(t,e,i),o=this._getFieldAttributeType(i),s=this._createFieldAttribute(e,o),u=this._createPopupInfo(r);this.layers0.attributeStorageInfo.push(a),this.layers0.fields.push(s),this.layers0.popupInfo=u,this.layers0.layerType="3DObject",t+=1}}_getFieldAttributeType(e){switch(e){case"OBJECTID":return"esriFieldTypeOID";case"string":return"esriFieldTypeString";case"Int32":return"esriFieldTypeInteger";case"double":return"esriFieldTypeDouble";default:return"esriFieldTypeString"}}_createPopupInfo(e){const t=[],r=[];for(const r in e)t.push({fieldName:r,visible:!0,isEditable:!1,label:r});return r.push({fieldInfos:t,type:"fields"}),{title:"{OBJECTID}",mediaInfos:[],popupElements:r,fieldInfos:t,expressionInfos:[]}}async _finishConversion(e){const{tilesCount:t,tilesWithAddRefineCount:r}=this.refinementCounter,n=r?r/t*100:0,i=await Zd(e),a=Xd(Ci.a.hrtime(this.conversionStartTime));console.log("------------------------------------------------"),console.log("Finishing conversion of 3DTILES"),console.log("Total conversion time: "+a),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",i," bytes"),console.log('Percentage of tiles with "ADD" refinement type:',n,"%"),console.log("------------------------------------------------")}async _fetchPreloadOptions(){if(!this.Loader.preload)return{};const e={"cesium-ion":{accessToken:this.options.token||xv}},t=await this.Loader.preload(this.options.inputUrl,e);return this.refreshTokenTime=Ci.a.hrtime(),{...e,...t}}async _updateTilesetOptions(){if(Ci.a.hrtime(this.refreshTokenTime)[0]<1800)return;this.refreshTokenTime=Ci.a.hrtime();const e=await this._fetchPreloadOptions();this.sourceTileset.options={...this.sourceTileset.options,...e},e.headers&&(this.sourceTileset.loadOptions.fetch={...this.sourceTileset.loadOptions.fetch,headers:e.headers},console.log("Authorization Bearer token has been updated"))}_checkAddRefinementTypeForTile(e){1===e.refine&&(this.refinementCounter.tilesWithAddRefineCount+=1,console.warn('This tile uses "ADD" type of refinement')),this.refinementCounter.tilesCount+=1}isContentSupported(e){var t;return["b3dm","glTF"].includes(null==e||null===(t=e.content)||void 0===t?void 0:t.type)}async loadWorkers(){if(console.log("Loading workers source..."),this.options.draco){const e=Na(jc,{...la()}),t=await ia(e),r=await t.text();this.workerSource.draco=r}if(this.generateTextures){const e=Na(fv,{...la()}),t=await ia(e),r=await t.text();this.workerSource.ktx2=r}const e=Na(wv,{...la()}),t=await ia(e),r=await t.text();this.workerSource.I3SAttributes=r,console.log("Loading workers source completed!")}}const Av={id:"zip",module:"zip",name:"Zip Archive",version:"3.2.7",extensions:["zip"],mimeTypes:["application/zip"],category:"archive",tests:["PK"],options:{},parse:async function(e,t={}){const r=[],n={};try{const i=new Ud.a;return(await i.loadAsync(e,t)).forEach((e,a)=>{const o=a.name,s=async function(e,t,r={}){try{return await e.file(t).async(r.dataType||"arraybuffer")}catch(e){return r.log.error(`Unable to read ${t} from zip archive: ${e}`),e}}(i,o,t).then(t=>{n[e]=t});r.push(s)}),await Promise.all(r),n}catch(e){throw t.log.error("Unable to read zip archive: "+e),e}}};class Sv{async install(e=""){console.log('Installing "EGM2008-5" model...');const t=await $o("https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip",Av,{});let r=process.cwd();e&&(r=Object(ji.join)(r,e)),await Kd(r,new Uint8Array(t["geoids/egm2008-5.pgm"]),"egm2008-5.pgm"),console.log("All dependencies were installed succesfully.")}}const jv={I3S:"I3S",_3DTILES:"3DTILES"};function Tv(){console.log("cli: converter 3dTiles to I3S or I3S to 3dTiles..."),console.log('--install-dependencies [Run the script for installing dependencies. Run this options separate from others. Now "*.pgm" file installation is implemented]'),console.log("--max-depth [Maximal depth of hierarchical tiles tree traversal, default: infinite]"),console.log("--name [Tileset name]"),console.log('--output [Output folder, default: "data" folder]'),console.log("--slpk [Generate slpk (Scene Layer Packages) I3S output file]"),console.log("--tileset [tileset.json file (3DTiles) / http://..../SceneServer/layers/0 resource (I3S)]"),console.log("--input-type [tileset input type: I3S or 3DTILES]"),console.log('--7zExe [location of 7z.exe archiver to create slpk on Windows, default: "C:\\Program Files\\7-Zip\\7z.exe"]'),console.log('--egm [location of Earth Gravity Model *.pgm file to convert heights from ellipsoidal to gravity-related format. A model file can be loaded from GeographicLib https://geographiclib.sourceforge.io/html/geoid.html], default: "./deps/egm2008-5.zip"'),console.log("--token [Token for Cesium ION tilesets authentication]"),console.log("--no-draco [Disable draco compression for geometry]"),console.log("--generate-textures [Enable KTX2 textures generation if only one of (JPG, PNG) texture is provided or generate JPG texture if only KTX2 is provided]"),console.log("--generate-bounding-volumes [Will generate obb and mbs bounding volumes from geometry]"),console.log("--validate [Enable validation]"),process.exit(0)}function Cv(e,t){if(e+1>=t.length)return"";const r=t[e+1];return 0===r.indexOf("--")?"":r}(async function(){const[,,...e]=process.argv;0===e.length&&Tv();const t=function(e){const t={output:"data",sevenZipExe:"C:\\Program Files\\7-Zip\\7z.exe",egm:Object(ji.join)(process.cwd(),"deps","egm2008-5.pgm"),draco:!0,installDependencies:!1,generateTextures:!1,generateBoundingVolumes:!1,validate:!1,slpk:!1};return e.forEach((r,n)=>{if(0===r.indexOf("--"))switch(r){case"--input-type":t.inputType=Cv(n,e);break;case"--tileset":t.tileset=Cv(n,e);break;case"--name":t.name=Cv(n,e);break;case"--output":t.output=Cv(n,e);break;case"--max-depth":t.maxDepth=function(e,t){const r=Cv(e,t),n=Number.parseInt(r);if(isFinite(n))return n;return NaN}(n,e);break;case"--slpk":t.slpk=!0;break;case"--7zExe":t.sevenZipExe=Cv(n,e);break;case"--egm":t.egm=Cv(n,e);break;case"--token":t.token=Cv(n,e);break;case"--no-draco":t.draco=!1;break;case"--validate":t.validate=!0;break;case"--install-dependencies":t.installDependencies=!0;break;case"--generate-textures":t.generateTextures=!0;break;case"--generate-bounding-volumes":t.generateBoundingVolumes=!0;break;case"--help":Tv();break;default:console.warn("Unknown option "+r),process.exit(0)}}),t}(e);if(t.installDependencies){return void(new Sv).install("deps")}const r=function(e){const t={name:()=>console.log("Missed: --name [Tileset name]"),output:()=>console.log("Missed: --output [Output path name]"),sevenZipExe:()=>console.log("Missed: --7zExe [7z archiver executable path]"),egm:()=>console.log("Missed: --egm [*.pgm earth gravity model file path]"),tileset:()=>console.log("Missed: --tileset [tileset.json file]"),inputType:()=>console.log("Missed/Incorrect: --input-type [tileset input type: I3S or 3DTILES]")},r=[];for(const n in t){const i=e[n],a=Boolean(i)&&"inputType"===n&&!Object.values(jv).includes(i.toUpperCase());i&&!a||r.push(t[n])}r.length&&(r.forEach(e=>e()),process.exit(0));return e}(t);await async function(e){console.log("------------------------------------------------"),console.log("Starting conversion of "+e.inputType),console.log("------------------------------------------------");switch(e.inputType.toUpperCase()){case jv.I3S:(new Km).convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,egmFilePath:e.egm});break;case jv._3DTILES:const t=new Ev;await t.convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,slpk:e.slpk,sevenZipExe:e.sevenZipExe,egmFilePath:e.egm,token:e.token,draco:e.draco,generateTextures:e.generateTextures,generateBoundingVolumes:e.generateBoundingVolumes,validate:e.validate});break;default:Tv()}}(r)})().catch(e=>{console.log(e),process.exit(1)})},,,,,,,,,,function(e,t){e.exports=require("worker_threads")},function(e,t,r){"use strict";function n(){return!("object"==typeof process&&"[object process]"===String(process)&&!process.browser)||function(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof process&&"object"==typeof process.versions&&Boolean(process.versions.electron))return!0;const t="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}()}r.d(t,"a",(function(){return _}));const i="undefined"!=typeof __VERSION__?__VERSION__:"untranspiled source",a=n();class o{constructor(e,t,r="sessionStorage"){this.storage=function(e){try{const t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch(e){return null}}(r),this.id=e,this.config={},Object.assign(this.config,t),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){return this.config={},this.updateConfiguration(e)}updateConfiguration(e){if(Object.assign(this.config,e),this.storage){const e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}return this}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function s(e,t,r,n=600){const i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));const a=e.width*r,o=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}const u={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function c(e){return"string"==typeof e?u[e.toUpperCase()]||u.WHITE:e}function l(e,t){if(!e)throw new Error(t||"Assertion failed")}const h={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document,process:"object"==typeof process&&process},p=h.window||h.self||h.global,f=h.process||{};console;function d(){let e;if(a&&p.performance)e=p.performance.now();else if(f.hrtime){const t=f.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}const m={debug:a&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},g={enabled:!0,level:0};function y(){}const b={},v={once:!0};function w(e){for(const t in e)for(const r in e[t])return r||"untitled";return"empty"}class _{constructor({id:e}={id:""}){this.id=e,this.VERSION=i,this._startTs=d(),this._deltaTs=d(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new o("__probe-".concat(this.id,"__"),g),this.userData={},this.timeStamp("".concat(this.id," started")),function(e,t=["constructor"]){const r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r);for(const r of n)"function"==typeof e[r]&&(t.find(e=>r===e)||(e[r]=e[r].bind(e)))}(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((d()-this._startTs).toPrecision(10))}getDelta(){return Number((d()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.updateConfiguration({enabled:e}),this}setLevel(e){return this._storage.updateConfiguration({level:e}),this}assert(e,t){l(e,t)}warn(e){return this._getLogFunction(0,e,m.warn,arguments,v)}error(e){return this._getLogFunction(0,e,m.error,arguments)}deprecated(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}probe(e,t){return this._getLogFunction(e,t,m.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,m.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,m.debug||m.info,arguments,v)}table(e,t,r){return t?this._getLogFunction(e,t,console.table||y,r&&[r],{tag:w(t)}):y}image({logLevel:e,priority:t,image:n,message:i="",scale:o=1}){return this._shouldLog(e||t)?a?function({image:e,message:t="",scale:r=1}){if("string"==typeof e){const n=new Image;return n.onload=()=>{const e=s(n,t,r);console.log(...e)},n.src=e,y}const n=e.nodeName||"";if("img"===n.toLowerCase())return console.log(...s(e,t,r)),y;if("canvas"===n.toLowerCase()){const n=new Image;return n.onload=()=>console.log(...s(n,t,r)),n.src=e.toDataURL(),y}return y}({image:n,message:i,scale:o}):function({image:e,message:t="",scale:n=1}){let i=null;try{i=r(!function(){var e=new Error("Cannot find module 'asciify-image'");throw e.code="MODULE_NOT_FOUND",e}())}catch(e){}if(i)return()=>i(e,{fit:"box",width:"".concat(Math.round(80*n),"%")}).then(e=>console.log(e));return y}({image:n,message:i,scale:o}):y}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}get(e){return this._storage.config[e]}set(e,t){this._storage.updateConfiguration({[e]:t})}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||y)}group(e,t,r={collapsed:!1}){r=x({logLevel:e,message:t,opts:r});const{collapsed:n}=r;return r.method=(n?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}groupCollapsed(e,t,r={}){return this.group(e,t,Object.assign({},r,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||y)}withGroup(e,t,r){this.group(e,t)();try{r()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=k(e)}_getLogFunction(e,t,r,n=[],i){if(this._shouldLog(e)){i=x({logLevel:e,message:t,args:n,opts:i}),l(r=r||i.method),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=d();const o=i.tag||i.message;if(i.once){if(b[o])return y;b[o]=d()}return t=function(e,t,r){if("string"==typeof t){const s=r.time?function(e,t=8){const r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}(function(e){let t;return t=e<10?"".concat(e.toFixed(2),"ms"):e<100?"".concat(e.toFixed(1),"ms"):e<1e3?"".concat(e.toFixed(0),"ms"):"".concat((e/1e3).toFixed(2),"s"),t}(r.total)):"";t=r.time?"".concat(e,": ").concat(s," ").concat(t):"".concat(e,": ").concat(t),n=t,i=r.color,o=r.background,a||"string"!=typeof n||(i&&(i=c(i),n="[".concat(i,"m").concat(n,"[39m")),o&&(i=c(o),n="[".concat(o+10,"m").concat(n,"[49m"))),t=n}var n,i,o;return t}(this.id,i.message,i),r.bind(console,t,...i.args)}return y}}function k(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return l(Number.isFinite(t)&&t>=0),t}function x(e){const{logLevel:t,message:r}=e;e.logLevel=k(t);const n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(e.args=n,typeof t){case"string":case"function":void 0!==r&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());const i=typeof e.message;return l("string"===i||"object"===i),Object.assign(e,e.opts)}_.VERSION=i}]);
|
|
292
|
+
var n=r(0).inherits,i=r(209).Transform,a=r(231),o=r(62),s=function(e){if(!(this instanceof s))return new s(e);e=this.options=o.defaults(e,{}),i.call(this,e),this.supports={directory:!0,symlink:!0},this.files=[]};n(s,i),s.prototype._transform=function(e,t,r){r(null,e)},s.prototype._writeStringified=function(){var e=JSON.stringify(this.files);this.write(e)},s.prototype.append=function(e,t,r){var n=this;function i(e,i){e?r(e):(t.size=i.length||0,t.crc32=a.unsigned(i),n.files.push(t),r(null,t))}t.crc32=0,"buffer"===t.sourceType?i(null,e):"stream"===t.sourceType&&o.collectStream(e,i)},s.prototype.finalize=function(){this._writeStringified(),this.end()},e.exports=s},function(e,t,r){const n=r(78).get,i=r(78).set,a=r(78).has,o=r(78).isUndefined,s=(e,t,r)=>{const s=Object.keys(t).reduce((r,s)=>{const u=Array.isArray(t[s].path)?t[s].path.filter(t=>a(e,t))[0]:t[s].path,c=u?n(e,u):void 0;return((e,t,r,n,a)=>{const s=e[t].default,u=e[t].transform,c=e[t].omitValues||[];let l=u?u(r,n,a):r;return o(l)&&!o(s)&&(l=s),-1==c.indexOf(l)?i(Object.assign({},n),t,l):n})(t,s,c,r,e)},{});return r?r(s,e):s},u=(e,t,r)=>Array.isArray(e)?((e,t,r)=>e.map(e=>{const n=u(e,t);return r?r(n,e):n}))(e,t,r):s(e,t,r);e.exports=u},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t){function r(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}r.keys=function(){return[]},r.resolve=r,e.exports=r,r.id=532},function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"filename",(function(){return no})),r.d(n,"dirname",(function(){return io})),r.d(n,"join",(function(){return ao}));var i={};r.r(i),r.d(i,"readdir",(function(){return so})),r.d(i,"stat",(function(){return uo})),r.d(i,"readFile",(function(){return co})),r.d(i,"readFileSync",(function(){return lo})),r.d(i,"writeFile",(function(){return ho})),r.d(i,"writeFileSync",(function(){return po})),r.d(i,"open",(function(){return fo})),r.d(i,"close",(function(){return mo})),r.d(i,"read",(function(){return go})),r.d(i,"fstat",(function(){return yo})),r.d(i,"isSupported",(function(){return bo})),r.d(i,"_readToArrayBuffer",(function(){return vo}));var a={};r.r(a),r.d(a,"name",(function(){return qg})),r.d(a,"decode",(function(){return Hg}));var o={};r.r(o),r.d(o,"name",(function(){return Jg})),r.d(o,"preprocess",(function(){return Qg}));var s={};r.r(s),r.d(s,"name",(function(){return Yg})),r.d(s,"preprocess",(function(){return $g}));var u={};r.r(u),r.d(u,"name",(function(){return Zg})),r.d(u,"preprocess",(function(){return ey})),r.d(u,"decode",(function(){return ty})),r.d(u,"encode",(function(){return ry}));var c={};r.r(c),r.d(c,"name",(function(){return uy})),r.d(c,"decode",(function(){return py}));var l={};r.r(l),r.d(l,"name",(function(){return gy})),r.d(l,"decode",(function(){return yy})),r.d(l,"encode",(function(){return by}));var h={};r.r(h),r.d(h,"name",(function(){return vy})),r.d(h,"decode",(function(){return wy})),r.d(h,"encode",(function(){return _y}));var p={};r.r(p),r.d(p,"name",(function(){return ky})),r.d(p,"decode",(function(){return xy})),r.d(p,"encode",(function(){return Ey}));var f={};r.r(f),r.d(f,"name",(function(){return Sy})),r.d(f,"decode",(function(){return jy}));var d=r(113);const m="object"!=typeof process||"[object process]"!==String(process)||process.browser,g={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global},y=g.global||g.self||g.window;function b(e,t,r){return t<=e&&e<=r}global["encoding-indexes"]={ibm866:[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1025,1105,1028,1108,1031,1111,1038,1118,176,8729,183,8730,8470,164,9632,160],"iso-8859-2":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,728,321,164,317,346,167,168,352,350,356,377,173,381,379,176,261,731,322,180,318,347,711,184,353,351,357,378,733,382,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],"iso-8859-3":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,294,728,163,164,null,292,167,168,304,350,286,308,173,null,379,176,295,178,179,180,181,293,183,184,305,351,287,309,189,null,380,192,193,194,null,196,266,264,199,200,201,202,203,204,205,206,207,null,209,210,211,212,288,214,215,284,217,218,219,220,364,348,223,224,225,226,null,228,267,265,231,232,233,234,235,236,237,238,239,null,241,242,243,244,289,246,247,285,249,250,251,252,365,349,729],"iso-8859-4":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,312,342,164,296,315,167,168,352,274,290,358,173,381,175,176,261,731,343,180,297,316,711,184,353,275,291,359,330,382,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,298,272,325,332,310,212,213,214,215,216,370,218,219,220,360,362,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,299,273,326,333,311,244,245,246,247,248,371,250,251,252,361,363,729],"iso-8859-5":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,173,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,8470,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,167,1118,1119],"iso-8859-6":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,null,null,164,null,null,null,null,null,null,null,1548,173,null,null,null,null,null,null,null,null,null,null,null,null,null,1563,null,null,null,1567,null,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,null,null,null,null,null,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,null,null,null,null,null,null,null,null,null,null,null,null,null],"iso-8859-7":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8216,8217,163,8364,8367,166,167,168,169,890,171,172,173,null,8213,176,177,178,179,900,901,902,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],"iso-8859-8":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,162,163,164,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,8215,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],"iso-8859-10":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,274,290,298,296,310,167,315,272,352,358,381,173,362,330,176,261,275,291,299,297,311,183,316,273,353,359,382,8213,363,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,207,208,325,332,211,212,213,214,360,216,370,218,219,220,221,222,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,239,240,326,333,243,244,245,246,361,248,371,250,251,252,253,254,312],"iso-8859-13":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8221,162,163,164,8222,166,167,216,169,342,171,172,173,174,198,176,177,178,179,8220,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,8217],"iso-8859-14":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,7682,7683,163,266,267,7690,167,7808,169,7810,7691,7922,173,174,376,7710,7711,288,289,7744,7745,182,7766,7809,7767,7811,7776,7923,7812,7813,7777,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,372,209,210,211,212,213,214,7786,216,217,218,219,220,221,374,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,373,241,242,243,244,245,246,7787,248,249,250,251,252,253,375,255],"iso-8859-15":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,8364,165,352,167,353,169,170,171,172,173,174,175,176,177,178,179,381,181,182,183,382,185,186,187,338,339,376,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],"iso-8859-16":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,261,321,8364,8222,352,167,353,169,536,171,377,173,378,379,176,177,268,322,381,8221,182,183,382,269,537,187,338,339,376,380,192,193,194,258,196,262,198,199,200,201,202,203,204,205,206,207,272,323,210,211,212,336,214,346,368,217,218,219,220,280,538,223,224,225,226,259,228,263,230,231,232,233,234,235,236,237,238,239,273,324,242,243,244,337,246,347,369,249,250,251,252,281,539,255],"koi8-r":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,1025,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],"koi8-u":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,1108,9556,1110,1111,9559,9560,9561,9562,9563,1169,1118,9566,9567,9568,9569,1025,1028,9571,1030,1031,9574,9575,9576,9577,9578,1168,1038,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],macintosh:[196,197,199,201,209,214,220,225,224,226,228,227,229,231,233,232,234,235,237,236,238,239,241,243,242,244,246,245,250,249,251,252,8224,176,162,163,167,8226,182,223,174,169,8482,180,168,8800,198,216,8734,177,8804,8805,165,181,8706,8721,8719,960,8747,170,186,937,230,248,191,161,172,8730,402,8776,8710,171,187,8230,160,192,195,213,338,339,8211,8212,8220,8221,8216,8217,247,9674,255,376,8260,8364,8249,8250,64257,64258,8225,183,8218,8222,8240,194,202,193,203,200,205,206,207,204,211,212,63743,210,218,219,217,305,710,732,175,728,729,730,184,733,731,711],"windows-874":[8364,129,130,131,132,8230,134,135,136,137,138,139,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,153,154,155,156,157,158,159,160,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631,3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,null,null,null,null,3647,3648,3649,3650,3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,null,null,null,null],"windows-1250":[8364,129,8218,131,8222,8230,8224,8225,136,8240,352,8249,346,356,381,377,144,8216,8217,8220,8221,8226,8211,8212,152,8482,353,8250,347,357,382,378,160,711,728,321,164,260,166,167,168,169,350,171,172,173,174,379,176,177,731,322,180,181,182,183,184,261,351,187,317,733,318,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],"windows-1251":[1026,1027,8218,1107,8222,8230,8224,8225,8364,8240,1033,8249,1034,1036,1035,1039,1106,8216,8217,8220,8221,8226,8211,8212,152,8482,1113,8250,1114,1116,1115,1119,160,1038,1118,1032,164,1168,166,167,1025,169,1028,171,172,173,174,1031,176,177,1030,1110,1169,181,182,183,1105,8470,1108,187,1112,1029,1109,1111,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103],"windows-1252":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],"windows-1253":[8364,129,8218,402,8222,8230,8224,8225,136,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,157,158,159,160,901,902,163,164,165,166,167,168,169,null,171,172,173,174,8213,176,177,178,179,900,181,182,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],"windows-1254":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,286,209,210,211,212,213,214,215,216,217,218,219,220,304,350,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,287,241,242,243,244,245,246,247,248,249,250,251,252,305,351,255],"windows-1255":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,156,157,158,159,160,161,162,163,8362,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,191,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1520,1521,1522,1523,1524,null,null,null,null,null,null,null,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],"windows-1256":[8364,1662,8218,402,8222,8230,8224,8225,710,8240,1657,8249,338,1670,1688,1672,1711,8216,8217,8220,8221,8226,8211,8212,1705,8482,1681,8250,339,8204,8205,1722,160,1548,162,163,164,165,166,167,168,169,1726,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,1563,187,188,189,190,1567,1729,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,215,1591,1592,1593,1594,1600,1601,1602,1603,224,1604,226,1605,1606,1607,1608,231,232,233,234,235,1609,1610,238,239,1611,1612,1613,1614,244,1615,1616,247,1617,249,1618,251,252,8206,8207,1746],"windows-1257":[8364,129,8218,131,8222,8230,8224,8225,136,8240,138,8249,140,168,711,184,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,175,731,159,160,null,162,163,164,null,166,167,216,169,342,171,172,173,174,198,176,177,178,179,180,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,729],"windows-1258":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,258,196,197,198,199,200,201,202,203,768,205,206,207,272,209,777,211,212,416,214,215,216,217,218,219,220,431,771,223,224,225,226,259,228,229,230,231,232,233,234,235,769,237,238,239,273,241,803,243,244,417,246,247,248,249,250,251,252,432,8363,255],"x-mac-cyrillic":[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,8224,176,1168,163,167,8226,182,1030,174,169,8482,1026,1106,8800,1027,1107,8734,177,8804,8805,1110,181,1169,1032,1028,1108,1031,1111,1033,1113,1034,1114,1112,1029,172,8730,402,8776,8710,171,187,8230,160,1035,1115,1036,1116,1109,8211,8212,8220,8221,8216,8217,247,8222,1038,1118,1039,1119,8470,1025,1105,1103,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,8364]}||{};var v=Math.floor;function w(e){if(void 0===e)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function _(e){return 0<=e&&e<=127}var k=_;function x(e){this.tokens=[].slice.call(e),this.tokens.reverse()}x.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():-1},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.pop());else this.tokens.push(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.shift());else this.tokens.unshift(e)}};function E(e,t){if(e)throw TypeError("Decoder error");return t||65533}function A(e){throw TypeError("The code point "+e+" could not be encoded.")}function S(e){return e=String(e).trim().toLowerCase(),Object.prototype.hasOwnProperty.call(T,e)?T[e]:null}var j=[{encodings:[{labels:["unicode-1-1-utf-8","utf-8","utf8"],name:"UTF-8"}],heading:"The Encoding"},{encodings:[{labels:["866","cp866","csibm866","ibm866"],name:"IBM866"},{labels:["csisolatin2","iso-8859-2","iso-ir-101","iso8859-2","iso88592","iso_8859-2","iso_8859-2:1987","l2","latin2"],name:"ISO-8859-2"},{labels:["csisolatin3","iso-8859-3","iso-ir-109","iso8859-3","iso88593","iso_8859-3","iso_8859-3:1988","l3","latin3"],name:"ISO-8859-3"},{labels:["csisolatin4","iso-8859-4","iso-ir-110","iso8859-4","iso88594","iso_8859-4","iso_8859-4:1988","l4","latin4"],name:"ISO-8859-4"},{labels:["csisolatincyrillic","cyrillic","iso-8859-5","iso-ir-144","iso8859-5","iso88595","iso_8859-5","iso_8859-5:1988"],name:"ISO-8859-5"},{labels:["arabic","asmo-708","csiso88596e","csiso88596i","csisolatinarabic","ecma-114","iso-8859-6","iso-8859-6-e","iso-8859-6-i","iso-ir-127","iso8859-6","iso88596","iso_8859-6","iso_8859-6:1987"],name:"ISO-8859-6"},{labels:["csisolatingreek","ecma-118","elot_928","greek","greek8","iso-8859-7","iso-ir-126","iso8859-7","iso88597","iso_8859-7","iso_8859-7:1987","sun_eu_greek"],name:"ISO-8859-7"},{labels:["csiso88598e","csisolatinhebrew","hebrew","iso-8859-8","iso-8859-8-e","iso-ir-138","iso8859-8","iso88598","iso_8859-8","iso_8859-8:1988","visual"],name:"ISO-8859-8"},{labels:["csiso88598i","iso-8859-8-i","logical"],name:"ISO-8859-8-I"},{labels:["csisolatin6","iso-8859-10","iso-ir-157","iso8859-10","iso885910","l6","latin6"],name:"ISO-8859-10"},{labels:["iso-8859-13","iso8859-13","iso885913"],name:"ISO-8859-13"},{labels:["iso-8859-14","iso8859-14","iso885914"],name:"ISO-8859-14"},{labels:["csisolatin9","iso-8859-15","iso8859-15","iso885915","iso_8859-15","l9"],name:"ISO-8859-15"},{labels:["iso-8859-16"],name:"ISO-8859-16"},{labels:["cskoi8r","koi","koi8","koi8-r","koi8_r"],name:"KOI8-R"},{labels:["koi8-ru","koi8-u"],name:"KOI8-U"},{labels:["csmacintosh","mac","macintosh","x-mac-roman"],name:"macintosh"},{labels:["dos-874","iso-8859-11","iso8859-11","iso885911","tis-620","windows-874"],name:"windows-874"},{labels:["cp1250","windows-1250","x-cp1250"],name:"windows-1250"},{labels:["cp1251","windows-1251","x-cp1251"],name:"windows-1251"},{labels:["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"],name:"windows-1252"},{labels:["cp1253","windows-1253","x-cp1253"],name:"windows-1253"},{labels:["cp1254","csisolatin5","iso-8859-9","iso-ir-148","iso8859-9","iso88599","iso_8859-9","iso_8859-9:1989","l5","latin5","windows-1254","x-cp1254"],name:"windows-1254"},{labels:["cp1255","windows-1255","x-cp1255"],name:"windows-1255"},{labels:["cp1256","windows-1256","x-cp1256"],name:"windows-1256"},{labels:["cp1257","windows-1257","x-cp1257"],name:"windows-1257"},{labels:["cp1258","windows-1258","x-cp1258"],name:"windows-1258"},{labels:["x-mac-cyrillic","x-mac-ukrainian"],name:"x-mac-cyrillic"}],heading:"Legacy single-byte encodings"},{encodings:[{labels:["chinese","csgb2312","csiso58gb231280","gb2312","gb_2312","gb_2312-80","gbk","iso-ir-58","x-gbk"],name:"GBK"},{labels:["gb18030"],name:"gb18030"}],heading:"Legacy multi-byte Chinese (simplified) encodings"},{encodings:[{labels:["big5","big5-hkscs","cn-big5","csbig5","x-x-big5"],name:"Big5"}],heading:"Legacy multi-byte Chinese (traditional) encodings"},{encodings:[{labels:["cseucpkdfmtjapanese","euc-jp","x-euc-jp"],name:"EUC-JP"},{labels:["csiso2022jp","iso-2022-jp"],name:"ISO-2022-JP"},{labels:["csshiftjis","ms932","ms_kanji","shift-jis","shift_jis","sjis","windows-31j","x-sjis"],name:"Shift_JIS"}],heading:"Legacy multi-byte Japanese encodings"},{encodings:[{labels:["cseuckr","csksc56011987","euc-kr","iso-ir-149","korean","ks_c_5601-1987","ks_c_5601-1989","ksc5601","ksc_5601","windows-949"],name:"EUC-KR"}],heading:"Legacy multi-byte Korean encodings"},{encodings:[{labels:["csiso2022kr","hz-gb-2312","iso-2022-cn","iso-2022-cn-ext","iso-2022-kr"],name:"replacement"},{labels:["utf-16be"],name:"UTF-16BE"},{labels:["utf-16","utf-16le"],name:"UTF-16LE"},{labels:["x-user-defined"],name:"x-user-defined"}],heading:"Legacy miscellaneous encodings"}],T={};j.forEach((function(e){e.encodings.forEach((function(e){e.labels.forEach((function(t){T[t]=e}))}))}));var C,B,R={},O={};function I(e,t){return t&&t[e]||null}function P(e,t){var r=t.indexOf(e);return-1===r?null:r}function D(e){if(!("encoding-indexes"in global))throw Error("Indexes missing. Did you forget to include encoding-indexes.js first?");return global["encoding-indexes"][e]}function M(e,t){if(!(this instanceof M))throw TypeError("Called as a function. Did you forget 'new'?");e=void 0!==e?String(e):"utf-8",t=w(t),this._encoding=null,this._decoder=null,this._ignoreBOM=!1,this._BOMseen=!1,this._error_mode="replacement",this._do_not_flush=!1;var r=S(e);if(null===r||"replacement"===r.name)throw RangeError("Unknown encoding: "+e);if(!O[r.name])throw Error("Decoder not present. Did you forget to include encoding-indexes.js first?");return this._encoding=r,Boolean(t.fatal)&&(this._error_mode="fatal"),Boolean(t.ignoreBOM)&&(this._ignoreBOM=!0),Object.defineProperty||(this.encoding=this._encoding.name.toLowerCase(),this.fatal="fatal"===this._error_mode,this.ignoreBOM=this._ignoreBOM),this}function F(e,t){if(!(this instanceof F))throw TypeError("Called as a function. Did you forget 'new'?");t=w(t),this._encoding=null,this._encoder=null,this._do_not_flush=!1,this._fatal=Boolean(t.fatal)?"fatal":"replacement";if(Boolean(t.NONSTANDARD_allowLegacyEncoding)){var r=S(e=void 0!==e?String(e):"utf-8");if(null===r||"replacement"===r.name)throw RangeError("Unknown encoding: "+e);if(!R[r.name])throw Error("Encoder not present. Did you forget to include encoding-indexes.js first?");this._encoding=r}else this._encoding=S("utf-8"),void 0!==e&&"console"in global&&console.warn("TextEncoder constructor called with encoding label, which is ignored.");return Object.defineProperty||(this.encoding=this._encoding.name.toLowerCase()),this}function L(e){var t=e.fatal,r=0,n=0,i=0,a=128,o=191;this.handler=function(e,s){if(-1===s&&0!==i)return i=0,E(t);if(-1===s)return-1;if(0===i){if(b(s,0,127))return s;if(b(s,194,223))i=1,r=31&s;else if(b(s,224,239))224===s&&(a=160),237===s&&(o=159),i=2,r=15&s;else{if(!b(s,240,244))return E(t);240===s&&(a=144),244===s&&(o=143),i=3,r=7&s}return null}if(!b(s,a,o))return r=i=n=0,a=128,o=191,e.prepend(s),E(t);if(a=128,o=191,r=r<<6|63&s,(n+=1)!==i)return null;var u=r;return r=i=n=0,u}}function N(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(k(t))return t;var r,n;b(t,128,2047)?(r=1,n=192):b(t,2048,65535)?(r=2,n=224):b(t,65536,1114111)&&(r=3,n=240);for(var i=[(t>>6*r)+n];r>0;){var a=t>>6*(r-1);i.push(128|63&a),r-=1}return i}}function z(e,t){var r=t.fatal;this.handler=function(t,n){if(-1===n)return-1;if(_(n))return n;var i=e[n-128];return null===i?E(r):i}}function U(e,t){t.fatal;this.handler=function(t,r){if(-1===r)return-1;if(k(r))return r;var n=P(r,e);return null===n&&A(r),n+128}}function q(e){var t=e.fatal,r=0,n=0,i=0;this.handler=function(e,a){if(-1===a&&0===r&&0===n&&0===i)return-1;var o;if(-1!==a||0===r&&0===n&&0===i||(r=0,n=0,i=0,E(t)),0!==i){o=null,b(a,48,57)&&(o=function(e){if(e>39419&&e<189e3||e>1237575)return null;if(7457===e)return 59335;var t,r=0,n=0,i=D("gb18030-ranges");for(t=0;t<i.length;++t){var a=i[t];if(!(a[0]<=e))break;r=a[0],n=a[1]}return n+e-r}(10*(126*(10*(r-129)+n-48)+i-129)+a-48));var s=[n,i,a];return r=0,n=0,i=0,null===o?(e.prepend(s),E(t)):o}if(0!==n)return b(a,129,254)?(i=a,null):(e.prepend([n,a]),r=0,n=0,E(t));if(0!==r){if(b(a,48,57))return n=a,null;var u=r,c=null;r=0;var l=a<127?64:65;return(b(a,64,126)||b(a,128,254))&&(c=190*(u-129)+(a-l)),null===(o=null===c?null:I(c,D("gb18030")))&&_(a)&&e.prepend(a),null===o?E(t):o}return _(a)?a:128===a?8364:b(a,129,254)?(r=a,null):E(t)}}function H(e,t){e.fatal;this.handler=function(e,r){if(-1===r)return-1;if(k(r))return r;if(58853===r)return A(r);if(t&&8364===r)return 128;var n=P(r,D("gb18030"));if(null!==n){var i=n%190;return[v(n/190)+129,i+(i<63?64:65)]}if(t)return A(r);n=function(e){if(59335===e)return 7457;var t,r=0,n=0,i=D("gb18030-ranges");for(t=0;t<i.length;++t){var a=i[t];if(!(a[1]<=e))break;r=a[1],n=a[0]}return n+e-r}(r);var a=v(n/10/126/10),o=v((n-=10*a*126*10)/10/126),s=v((n-=10*o*126)/10);return[a+129,o+48,s+129,n-10*s+48]}}function G(e){var t=e.fatal,r=0;this.handler=function(e,n){if(-1===n&&0!==r)return r=0,E(t);if(-1===n&&0===r)return-1;if(0!==r){var i=r,a=null;r=0;var o=n<127?64:98;switch((b(n,64,126)||b(n,161,254))&&(a=157*(i-129)+(n-o)),a){case 1133:return[202,772];case 1135:return[202,780];case 1164:return[234,772];case 1166:return[234,780]}var s=null===a?null:I(a,D("big5"));return null===s&&_(n)&&e.prepend(n),null===s?E(t):s}return _(n)?n:b(n,129,254)?(r=n,null):E(t)}}function V(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(k(t))return t;var r=function(e){var t=B=B||D("big5").map((function(e,t){return t<5024?null:e}));return 9552===e||9566===e||9569===e||9578===e||21313===e||21317===e?t.lastIndexOf(e):P(e,t)}(t);if(null===r)return A(t);var n=v(r/157)+129;if(n<161)return A(t);var i=r%157;return[n,i+(i<63?64:98)]}}function W(e){var t=e.fatal,r=!1,n=0;this.handler=function(e,i){if(-1===i&&0!==n)return n=0,E(t);if(-1===i&&0===n)return-1;if(142===n&&b(i,161,223))return n=0,65216+i;if(143===n&&b(i,161,254))return r=!0,n=i,null;if(0!==n){var a=n;n=0;var o=null;return b(a,161,254)&&b(i,161,254)&&(o=I(94*(a-161)+(i-161),D(r?"jis0212":"jis0208"))),r=!1,b(i,161,254)||e.prepend(i),null===o?E(t):o}return _(i)?i:142===i||143===i||b(i,161,254)?(n=i,null):E(t)}}function K(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(k(t))return t;if(165===t)return 92;if(8254===t)return 126;if(b(t,65377,65439))return[142,t-65377+161];8722===t&&(t=65293);var r=P(t,D("jis0208"));return null===r?A(t):[v(r/94)+161,r%94+161]}}function J(e){var t=e.fatal,r=0,n=1,i=2,a=3,o=4,s=5,u=6,c=r,l=r,h=0,p=!1;this.handler=function(e,f){switch(c){default:case r:return 27===f?(c=s,null):b(f,0,127)&&14!==f&&15!==f&&27!==f?(p=!1,f):-1===f?-1:(p=!1,E(t));case n:return 27===f?(c=s,null):92===f?(p=!1,165):126===f?(p=!1,8254):b(f,0,127)&&14!==f&&15!==f&&27!==f&&92!==f&&126!==f?(p=!1,f):-1===f?-1:(p=!1,E(t));case i:return 27===f?(c=s,null):b(f,33,95)?(p=!1,65344+f):-1===f?-1:(p=!1,E(t));case a:return 27===f?(c=s,null):b(f,33,126)?(p=!1,h=f,c=o,null):-1===f?-1:(p=!1,E(t));case o:if(27===f)return c=s,E(t);if(b(f,33,126)){c=a;var d=I(94*(h-33)+f-33,D("jis0208"));return null===d?E(t):d}return-1===f?(c=a,e.prepend(f),E(t)):(c=a,E(t));case s:return 36===f||40===f?(h=f,c=u,null):(e.prepend(f),p=!1,c=l,E(t));case u:var m=h;h=0;var g=null;if(40===m&&66===f&&(g=r),40===m&&74===f&&(g=n),40===m&&73===f&&(g=i),36!==m||64!==f&&66!==f||(g=a),null!==g){c=c=g;var y=p;return p=!0,y?E(t):null}return e.prepend([m,f]),p=!1,c=l,E(t)}}}function Q(e){e.fatal;var t=0,r=1,n=2,i=t;this.handler=function(e,a){if(-1===a&&i!==t)return e.prepend(a),i=t,[27,40,66];if(-1===a&&i===t)return-1;if(!(i!==t&&i!==r||14!==a&&15!==a&&27!==a))return A(65533);if(i===t&&k(a))return a;if(i===r&&(k(a)&&92!==a&&126!==a||165==a||8254==a)){if(k(a))return a;if(165===a)return 92;if(8254===a)return 126}if(k(a)&&i!==t)return e.prepend(a),i=t,[27,40,66];if((165===a||8254===a)&&i!==r)return e.prepend(a),i=r,[27,40,74];8722===a&&(a=65293);var o=P(a,D("jis0208"));return null===o?A(a):i!==n?(e.prepend(a),i=n,[27,36,66]):[v(o/94)+33,o%94+33]}}function Y(e){var t=e.fatal,r=0;this.handler=function(e,n){if(-1===n&&0!==r)return r=0,E(t);if(-1===n&&0===r)return-1;if(0!==r){var i=r,a=null;r=0;var o=n<127?64:65,s=i<160?129:193;if((b(n,64,126)||b(n,128,252))&&(a=188*(i-s)+n-o),b(a,8836,10715))return 48508+a;var u=null===a?null:I(a,D("jis0208"));return null===u&&_(n)&&e.prepend(n),null===u?E(t):u}return _(n)||128===n?n:b(n,161,223)?65216+n:b(n,129,159)||b(n,224,252)?(r=n,null):E(t)}}function $(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(k(t)||128===t)return t;if(165===t)return 92;if(8254===t)return 126;if(b(t,65377,65439))return t-65377+161;8722===t&&(t=65293);var r=function(e){return(C=C||D("jis0208").map((function(e,t){return b(t,8272,8835)?null:e}))).indexOf(e)}(t);if(null===r)return A(t);var n=v(r/188),i=r%188;return[n+(n<31?129:193),i+(i<63?64:65)]}}function X(e){var t=e.fatal,r=0;this.handler=function(e,n){if(-1===n&&0!==r)return r=0,E(t);if(-1===n&&0===r)return-1;if(0!==r){var i=r,a=null;r=0,b(n,65,254)&&(a=190*(i-129)+(n-65));var o=null===a?null:I(a,D("euc-kr"));return null===a&&_(n)&&e.prepend(n),null===o?E(t):o}return _(n)?n:b(n,129,254)?(r=n,null):E(t)}}function Z(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(k(t))return t;var r=P(t,D("euc-kr"));return null===r?A(t):[v(r/190)+129,r%190+65]}}function ee(e,t){var r=e>>8,n=255&e;return t?[r,n]:[n,r]}function te(e,t){var r=t.fatal,n=null,i=null;this.handler=function(t,a){if(-1===a&&(null!==n||null!==i))return E(r);if(-1===a&&null===n&&null===i)return-1;if(null===n)return n=a,null;var o;if(o=e?(n<<8)+a:(a<<8)+n,n=null,null!==i){var s=i;return i=null,b(o,56320,57343)?65536+1024*(s-55296)+(o-56320):(t.prepend(ee(o,e)),E(r))}return b(o,55296,56319)?(i=o,null):b(o,56320,57343)?E(r):o}}function re(e,t){t.fatal;this.handler=function(t,r){if(-1===r)return-1;if(b(r,0,65535))return ee(r,e);var n=ee(55296+(r-65536>>10),e),i=ee(56320+(r-65536&1023),e);return n.concat(i)}}function ne(e){e.fatal;this.handler=function(e,t){return-1===t?-1:_(t)?t:63360+t-128}}function ie(e){e.fatal;this.handler=function(e,t){return-1===t?-1:k(t)?t:b(t,63360,63487)?t-63360+128:A(t)}}Object.defineProperty&&(Object.defineProperty(M.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(M.prototype,"fatal",{get:function(){return"fatal"===this._error_mode}}),Object.defineProperty(M.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}})),M.prototype.decode=function(e,t){var r;r="object"==typeof e&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==typeof e&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),t=w(t),this._do_not_flush||(this._decoder=O[this._encoding.name]({fatal:"fatal"===this._error_mode}),this._BOMseen=!1),this._do_not_flush=Boolean(t.stream);for(var n,i=new x(r),a=[];;){var o=i.read();if(-1===o)break;if(-1===(n=this._decoder.handler(i,o)))break;null!==n&&(Array.isArray(n)?a.push.apply(a,n):a.push(n))}if(!this._do_not_flush){do{if(-1===(n=this._decoder.handler(i,i.read())))break;null!==n&&(Array.isArray(n)?a.push.apply(a,n):a.push(n))}while(!i.endOfStream());this._decoder=null}return function(e){var t,r;return t=["UTF-8","UTF-16LE","UTF-16BE"],r=this._encoding.name,-1===t.indexOf(r)||this._ignoreBOM||this._BOMseen||(e.length>0&&65279===e[0]?(this._BOMseen=!0,e.shift()):e.length>0&&(this._BOMseen=!0)),function(e){for(var t="",r=0;r<e.length;++r){var n=e[r];n<=65535?t+=String.fromCharCode(n):(n-=65536,t+=String.fromCharCode(55296+(n>>10),56320+(1023&n)))}return t}(e)}.call(this,a)},Object.defineProperty&&Object.defineProperty(F.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),F.prototype.encode=function(e,t){e=void 0===e?"":String(e),t=w(t),this._do_not_flush||(this._encoder=R[this._encoding.name]({fatal:"fatal"===this._fatal})),this._do_not_flush=Boolean(t.stream);for(var r,n=new x(function(e){for(var t=String(e),r=t.length,n=0,i=[];n<r;){var a=t.charCodeAt(n);if(a<55296||a>57343)i.push(a);else if(56320<=a&&a<=57343)i.push(65533);else if(55296<=a&&a<=56319)if(n===r-1)i.push(65533);else{var o=t.charCodeAt(n+1);if(56320<=o&&o<=57343){var s=1023&a,u=1023&o;i.push(65536+(s<<10)+u),n+=1}else i.push(65533)}n+=1}return i}(e)),i=[];;){var a=n.read();if(-1===a)break;if(-1===(r=this._encoder.handler(n,a)))break;Array.isArray(r)?i.push.apply(i,r):i.push(r)}if(!this._do_not_flush){for(;-1!==(r=this._encoder.handler(n,n.read()));)Array.isArray(r)?i.push.apply(i,r):i.push(r);this._encoder=null}return new Uint8Array(i)},R["UTF-8"]=function(e){return new N(e)},O["UTF-8"]=function(e){return new L(e)},"encoding-indexes"in global&&j.forEach((function(e){"Legacy single-byte encodings"===e.heading&&e.encodings.forEach((function(e){var t=e.name,r=D(t.toLowerCase());O[t]=function(e){return new z(r,e)},R[t]=function(e){return new U(r,e)}}))})),O.GBK=function(e){return new q(e)},R.GBK=function(e){return new H(e,!0)},R.gb18030=function(e){return new H(e)},O.gb18030=function(e){return new q(e)},R.Big5=function(e){return new V(e)},O.Big5=function(e){return new G(e)},R["EUC-JP"]=function(e){return new K(e)},O["EUC-JP"]=function(e){return new W(e)},R["ISO-2022-JP"]=function(e){return new Q(e)},O["ISO-2022-JP"]=function(e){return new J(e)},R.Shift_JIS=function(e){return new $(e)},O.Shift_JIS=function(e){return new Y(e)},R["EUC-KR"]=function(e){return new Z(e)},O["EUC-KR"]=function(e){return new X(e)},R["UTF-16BE"]=function(e){return new re(!0,e)},O["UTF-16BE"]=function(e){return new te(!0,e)},R["UTF-16LE"]=function(e){return new re(!1,e)},O["UTF-16LE"]=function(e){return new te(!1,e)},R["x-user-defined"]=function(e){return new ie(e)},O["x-user-defined"]=function(e){return new ne(e)};function ae(e){return Buffer.from(e).toString("base64")}function oe(e){return Buffer.from(e,"base64").toString("ascii")}let se;se=Symbol.iterator;class ue{constructor(e){var t,r,n;n=void 0,(r="map")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,this.map={},e instanceof ue?e.forEach((e,t)=>this.append(t,e)):Array.isArray(e)?e.forEach(e=>this.append(e[0],e[1])):e&&Object.getOwnPropertyNames(e).forEach(t=>this.append(t,e[t]))}append(e,t){e=ce(e),t=le(t);const r=this.map[e];this.map[e]=r?`${r}, ${t}`:t}delete(e){delete this.map[ce(e)]}get(e){return e=ce(e),this.has(e)?this.map[e]:null}has(e){return this.map.hasOwnProperty(ce(e))}set(e,t){this.map[ce(e)]=le(t)}forEach(e,t=null){for(const r in this.map)this.map.hasOwnProperty(r)&&(t?e.call(t,this.map[r],r,this):e(this.map[r],r,this))}keys(){const e=[];return this.forEach((function(t,r){e.push(r)})),he(e)}values(){const e=[];return this.forEach((function(t){e.push(t)})),he(e)}entries(){const e=[];return this.forEach((function(t,r){e.push([r,t])})),he(e)}*[se](){yield*this.entries()}}function ce(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e)||""===e)throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function le(e){return"string"!=typeof e&&(e=String(e)),e}function he(e){const t={next(){const t=e.shift();return{done:void 0===t,value:t}}};return t[Symbol.iterator]=function(){return t},t}function pe(e,t){if(!e)throw new Error("@loaders.gl/polyfills assertion "+t)}var fe=r(2),de=r.n(fe),me=r(39),ge=r.n(me),ye=r(50),be=r.n(ye),ve=r(14),we=r.n(ve);function _e(e){if((t=e)&&t instanceof ArrayBuffer)return e;var t;if((e=>e&&e instanceof Buffer)(e)){return new Uint8Array(e).buffer}if(ArrayBuffer.isView(e))return e.buffer;if("string"==typeof e){const t=e;return(new TextEncoder).encode(t).buffer}if(e&&"object"==typeof e&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error(`toArrayBuffer(${JSON.stringify(e,null,2).slice(10)})`)}async function ke(e,t){if(!function(e){return e.startsWith("http:")||e.startsWith("https:")}(e)){const t=e.split("?")[0];return await new Promise((e,r)=>{const n=de.a.createReadStream(t,{encoding:null});n.once("readable",()=>e(n)),n.on("error",e=>r(e))})}return await new Promise((r,n)=>{const i=(e.startsWith("https:")?be.a.request:ge.a.request)(function(e,t){const r=(null==t?void 0:t.headers)||{},n={};for(const e of Object.keys(r))n[e.toLowerCase()]=r[e];n["accept-encoding"]=n["accept-encoding"]||"gzip,br,deflate";const i=new URL(e);return{hostname:i.hostname,path:i.pathname,method:"GET",...t,...null==t?void 0:t.fetch,headers:n,port:i.port}}(e,t),e=>r(e));i.on("error",e=>n(e)),i.end()})}async function xe(e){const t=[];return await new Promise((r,n)=>{e.on("error",e=>n(e)),e.on("readable",()=>e.read()),e.on("data",e=>{"string"==typeof e&&n(new Error("Read stream not binary")),t.push(_e(e))}),e.on("end",()=>{const e=function(e){const t=e.map(e=>e instanceof ArrayBuffer?new Uint8Array(e):e),r=t.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(r);let i=0;for(const e of t)n.set(e,i),i+=e.byteLength;return n.buffer}(t);r(e)})})}var Ee=r(4);function Ae(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Se=e=>"function"==typeof e,je=e=>(e=>null!==e&&"object"==typeof e)(e)&&Se(e.read)&&Se(e.pipe)&&(e=>"boolean"==typeof e)(e.readable);class Te{constructor(e,t){Ae(this,"ok",void 0),Ae(this,"status",void 0),Ae(this,"statusText",void 0),Ae(this,"headers",void 0),Ae(this,"url",void 0),Ae(this,"bodyUsed",!1),Ae(this,"_body",void 0);const{headers:r,status:n=200,statusText:i="OK",url:a}=t||{};this.url=a,this.ok=200===n,this.status=n,this.statusText=i,this.headers=new ue((null==t?void 0:t.headers)||{}),je(e)?this._body=function(e,t){switch(t.get("content-encoding")){case"br":return e.pipe(we.a.createBrotliDecompress());case"gzip":return e.pipe(we.a.createGunzip());case"deflate":return e.pipe(we.a.createDeflate());default:return e}}(e,r):this._body="string"==typeof e?Ee.Readable.from([(new TextEncoder).encode(e)]):Ee.Readable.from([e||new ArrayBuffer(0)])}get body(){return pe(!this.bodyUsed),pe(je(this._body)),this.bodyUsed=!0,this._body}async arrayBuffer(){if(!je(this._body))return this._body||new ArrayBuffer(0);return await xe(this._body)}async text(){const e=await this.arrayBuffer();return(new TextDecoder).decode(e)}async json(){const e=await this.text();return JSON.parse(e)}async blob(){if("undefined"==typeof Blob)throw new Error("Blob polyfill not installed");return new Blob([await this.arrayBuffer()])}}const Ce=e=>e.startsWith("data:");async function Be(e,t){try{if(Ce(e)){const{arrayBuffer:t,mimeType:r}=function(e){const t=e.indexOf(",");let r,n;return";base64"===e.slice(t-7,t)?(r=Buffer.from(e.slice(t+1),"base64"),n=e.slice(5,t-7).trim()):(r=Buffer.from(decodeURIComponent(e.slice(t+1))),n=e.slice(5,t).trim()),n?n.startsWith(";")&&(n="text/plain"+n):n="text/plain;charset=US-ASCII",{arrayBuffer:_e(r),mimeType:n}}(e);return new Te(t,{headers:{"content-type":r},url:e})}const r={},n=e;e.endsWith(".gz")&&(e=e.slice(0,-3),r["content-encoding"]="gzip");const i=await ke(n,t),a=function(e,t,r={}){const n={};if(t&&t.headers){const e=t.headers;for(const t in e){const r=e[t];n[t.toLowerCase()]=String(r)}}if(!n["content-length"]){const t=function(e){if((e=>e.startsWith("http:")||e.startsWith("https:"))(e))return null;if(Ce(e))return e.length-"data:".length;try{const t=e.split("?")[0];return de.a.statSync(t).size}catch(e){}return null}(e);Number.isFinite(t)&&(n["content-length"]=t)}return Object.assign(n,r),new ue(n)}(e,i,r),{status:o,statusText:s}=function(e){if(e.statusCode)return{status:e.statusCode,statusText:e.statusMessage||"NA"};return{status:200,statusText:"OK"}}(i),u=!t||t.followRedirect||void 0===t.followRedirect;if(o>=300&&o<400&&a.has("location")&&u){const r=function(e,t){if(t.startsWith("http"))return t;const r=new URL(e);return r.pathname=t,r.href}(e,a.get("location"));return await Be(r,t)}return new Te(i,{headers:a,status:o,statusText:s,url:e})}catch(t){return new Te(null,{status:400,statusText:String(t),url:e})}}var Re=r(257),Oe=r.n(Re),Ie=r(63),Pe=r.n(Ie);function De(e,t){const r=function(e,t){const r=t.type?t.type.replace("image/",""):"jpeg",n=Pe()(e.data,[e.width,e.height,4],[4,4*e.width,1],0);return Oe()(n,r,t)}(e,t);return new Promise(e=>{const t=[];r.on("data",e=>t.push(e)),r.on("end",()=>{const r=Buffer.concat(t);e(function(e){if(Buffer.isBuffer(e)){return new Uint8Array(e).buffer}return e}(r))})})}var Me=r(258),Fe=r.n(Me),Le=r(0),Ne=r.n(Le);async function ze(e,t){pe(t,"MIMEType is required to parse image under Node.js");const r=Ne.a.promisify(Fe.a),n=e instanceof Buffer?e:Buffer.from(e),i=await r(n,t),a=[...i.shape],o=4===i.shape.length?i.shape.shift():1;return{shape:a,data:i.data,width:i.shape[0],height:i.shape[1],components:i.shape[2],layers:o}}var Ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol:function(e){return"Symbol("+e+")"};function qe(){}var He="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0;function Ge(e){return"object"==typeof e&&null!==e||"function"==typeof e}var Ve=qe,We=Promise,Ke=Promise.prototype.then,Je=Promise.resolve.bind(We),Qe=Promise.reject.bind(We);function Ye(e){return new We(e)}function $e(e){return Je(e)}function Xe(e){return Qe(e)}function Ze(e,t,r){return Ke.call(e,t,r)}function et(e,t,r){Ze(Ze(e,t,r),void 0,Ve)}function tt(e,t){et(e,t)}function rt(e,t){et(e,void 0,t)}function nt(e,t,r){return Ze(e,t,r)}function it(e){Ze(e,void 0,Ve)}var at=function(){var e=He&&He.queueMicrotask;if("function"==typeof e)return e;var t=$e(void 0);return function(e){return Ze(t,e)}}();function ot(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function st(e,t,r){try{return $e(ot(e,t,r))}catch(e){return Xe(e)}}var ut=function(){function e(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._size},enumerable:!1,configurable:!0}),e.prototype.push=function(e){var t=this._back,r=t;16383===t._elements.length&&(r={_elements:[],_next:void 0}),t._elements.push(e),r!==t&&(this._back=r,t._next=r),++this._size},e.prototype.shift=function(){var e=this._front,t=e,r=this._cursor,n=r+1,i=e._elements,a=i[r];return 16384===n&&(t=e._next,n=0),--this._size,this._cursor=n,e!==t&&(this._front=t),i[r]=void 0,a},e.prototype.forEach=function(e){for(var t=this._cursor,r=this._front,n=r._elements;!(t===n.length&&void 0===r._next||t===n.length&&(t=0,0===(n=(r=r._next)._elements).length));)e(n[t]),++t},e.prototype.peek=function(){var e=this._front,t=this._cursor;return e._elements[t]},e}();function ct(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?ft(e):"closed"===t._state?function(e){ft(e),gt(e)}(e):dt(e,t._storedError)}function lt(e,t){return Yn(e._ownerReadableStream,t)}function ht(e){"readable"===e._ownerReadableStream._state?mt(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e,t){dt(e,t)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function pt(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function ft(e){e._closedPromise=Ye((function(t,r){e._closedPromise_resolve=t,e._closedPromise_reject=r}))}function dt(e,t){ft(e),mt(e,t)}function mt(e,t){void 0!==e._closedPromise_reject&&(it(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function gt(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}var yt=Ue("[[AbortSteps]]"),bt=Ue("[[ErrorSteps]]"),vt=Ue("[[CancelSteps]]"),wt=Ue("[[PullSteps]]"),_t=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},kt=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function xt(e,t){if(void 0!==e&&("object"!=typeof(r=e)&&"function"!=typeof r))throw new TypeError(t+" is not an object.");var r}function Et(e,t){if("function"!=typeof e)throw new TypeError(t+" is not a function.")}function At(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(t+" is not an object.")}function St(e,t,r){if(void 0===e)throw new TypeError("Parameter "+t+" is required in '"+r+"'.")}function jt(e,t,r){if(void 0===e)throw new TypeError(t+" is required in '"+r+"'.")}function Tt(e){return Number(e)}function Ct(e){return 0===e?0:e}function Bt(e,t){var r=Number.MAX_SAFE_INTEGER,n=Number(e);if(n=Ct(n),!_t(n))throw new TypeError(t+" is not a finite number");if((n=function(e){return Ct(kt(e))}(n))<0||n>r)throw new TypeError(t+" is outside the accepted range of 0 to "+r+", inclusive");return _t(n)&&0!==n?n:0}function Rt(e,t){if(!Jn(e))throw new TypeError(t+" is not a ReadableStream.")}function Ot(e){return new Nt(e)}function It(e,t){e._reader._readRequests.push(t)}function Pt(e,t,r){var n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function Dt(e){return e._reader._readRequests.length}function Mt(e){var t=e._reader;return void 0!==t&&!!zt(t)}var Ft,Lt,Nt=function(){function e(e){if(St(e,1,"ReadableStreamDefaultReader"),Rt(e,"First parameter"),Qn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");ct(this,e),this._readRequests=new ut}return Object.defineProperty(e.prototype,"closed",{get:function(){return zt(this)?this._closedPromise:Xe(qt("closed"))},enumerable:!1,configurable:!0}),e.prototype.cancel=function(e){return void 0===e&&(e=void 0),zt(this)?void 0===this._ownerReadableStream?Xe(pt("cancel")):lt(this,e):Xe(qt("cancel"))},e.prototype.read=function(){if(!zt(this))return Xe(qt("read"));if(void 0===this._ownerReadableStream)return Xe(pt("read from"));var e,t,r=Ye((function(r,n){e=r,t=n}));return Ut(this,{_chunkSteps:function(t){return e({value:t,done:!1})},_closeSteps:function(){return e({value:void 0,done:!0})},_errorSteps:function(e){return t(e)}}),r},e.prototype.releaseLock=function(){if(!zt(this))throw qt("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ht(this)}},e}();function zt(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")}function Ut(e,t){var r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[wt](t)}function qt(e){return new TypeError("ReadableStreamDefaultReader.prototype."+e+" can only be used on a ReadableStreamDefaultReader")}Object.defineProperties(Nt.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(Nt.prototype,Ue.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0}),"symbol"==typeof Ue.asyncIterator&&((Ft={})[Ue.asyncIterator]=function(){return this},Lt=Ft,Object.defineProperty(Lt,Ue.asyncIterator,{enumerable:!1}));var Ht=function(){function e(e,t){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=e,this._preventCancel=t}return e.prototype.next=function(){var e=this,t=function(){return e._nextSteps()};return this._ongoingPromise=this._ongoingPromise?nt(this._ongoingPromise,t,t):t(),this._ongoingPromise},e.prototype.return=function(e){var t=this,r=function(){return t._returnSteps(e)};return this._ongoingPromise?nt(this._ongoingPromise,r,r):r()},e.prototype._nextSteps=function(){var e=this;if(this._isFinished)return Promise.resolve({value:void 0,done:!0});var t,r,n=this._reader;if(void 0===n._ownerReadableStream)return Xe(pt("iterate"));var i=Ye((function(e,n){t=e,r=n}));return Ut(n,{_chunkSteps:function(r){e._ongoingPromise=void 0,at((function(){return t({value:r,done:!1})}))},_closeSteps:function(){e._ongoingPromise=void 0,e._isFinished=!0,ht(n),t({value:void 0,done:!0})},_errorSteps:function(t){e._ongoingPromise=void 0,e._isFinished=!0,ht(n),r(t)}}),i},e.prototype._returnSteps=function(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;var t=this._reader;if(void 0===t._ownerReadableStream)return Xe(pt("finish iterating"));if(!this._preventCancel){var r=lt(t,e);return ht(t),nt(r,(function(){return{value:e,done:!0}}))}return ht(t),$e({value:e,done:!0})},e}(),Gt={next:function(){return Vt(this)?this._asyncIteratorImpl.next():Xe(Wt("next"))},return:function(e){return Vt(this)?this._asyncIteratorImpl.return(e):Xe(Wt("return"))}};function Vt(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl")}function Wt(e){return new TypeError("ReadableStreamAsyncIterator."+e+" can only be used on a ReadableSteamAsyncIterator")}void 0!==Lt&&Object.setPrototypeOf(Gt,Lt);var Kt=Number.isNaN||function(e){return e!=e};function Jt(e){return!!function(e){if("number"!=typeof e)return!1;if(Kt(e))return!1;if(e<0)return!1;return!0}(e)&&e!==1/0}function Qt(e){var t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function Yt(e,t,r){if(!Jt(r=Number(r)))throw new RangeError("Size must be a finite, non-NaN, non-negative number.");e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function $t(e){e._queue=new ut,e._queueTotalSize=0}function Xt(e){return e.slice()}var Zt=function(){function e(){throw new TypeError("Illegal constructor")}return Object.defineProperty(e.prototype,"view",{get:function(){if(!rr(this))throw br("view");return this._view},enumerable:!1,configurable:!0}),e.prototype.respond=function(e){if(!rr(this))throw br("respond");if(St(e,1,"respond"),e=Bt(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");this._view.buffer,function(e,t){if(!Jt(t=Number(t)))throw new RangeError("bytesWritten must be a finite");pr(e,t)}(this._associatedReadableByteStreamController,e)},e.prototype.respondWithNewView=function(e){if(!rr(this))throw br("respondWithNewView");if(St(e,1,"respondWithNewView"),!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");if(0===e.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===e.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");!function(e,t){var r=e._pendingPullIntos.peek();if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.byteLength!==t.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");r.buffer=t.buffer,pr(e,t.byteLength)}(this._associatedReadableByteStreamController,e)},e}();Object.defineProperties(Zt.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(Zt.prototype,Ue.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});var er=function(){function e(){throw new TypeError("Illegal constructor")}return Object.defineProperty(e.prototype,"byobRequest",{get:function(){if(!tr(this))throw vr("byobRequest");if(null===this._byobRequest&&this._pendingPullIntos.length>0){var e=this._pendingPullIntos.peek(),t=new Uint8Array(e.buffer,e.byteOffset+e.bytesFilled,e.byteLength-e.bytesFilled),r=Object.create(Zt.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(r,this,t),this._byobRequest=r}return this._byobRequest},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"desiredSize",{get:function(){if(!tr(this))throw vr("desiredSize");return gr(this)},enumerable:!1,configurable:!0}),e.prototype.close=function(){if(!tr(this))throw vr("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");var e=this._controlledReadableByteStream._state;if("readable"!==e)throw new TypeError("The stream (in "+e+" state) is not in the readable state and cannot be closed");!function(e){var t=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==t._state)return;if(e._queueTotalSize>0)return void(e._closeRequested=!0);if(e._pendingPullIntos.length>0){if(e._pendingPullIntos.peek().bytesFilled>0){var r=new TypeError("Insufficient bytes to fill elements in the given buffer");throw mr(e,r),r}}dr(e),$n(t)}(this)},e.prototype.enqueue=function(e){if(!tr(this))throw vr("enqueue");if(St(e,1,"enqueue"),!ArrayBuffer.isView(e))throw new TypeError("chunk must be an array buffer view");if(0===e.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===e.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");var t=this._controlledReadableByteStream._state;if("readable"!==t)throw new TypeError("The stream (in "+t+" state) is not in the readable state and cannot be enqueued to");!function(e,t){var r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;var n=t.buffer,i=t.byteOffset,a=t.byteLength,o=n;if(Mt(r))if(0===Dt(r))or(e,o,i,a);else{var s=new Uint8Array(o,i,a);Pt(r,s,!1)}else kr(r)?(or(e,o,i,a),hr(e)):or(e,o,i,a);nr(e)}(this,e)},e.prototype.error=function(e){if(void 0===e&&(e=void 0),!tr(this))throw vr("error");mr(this,e)},e.prototype[vt]=function(e){this._pendingPullIntos.length>0&&(this._pendingPullIntos.peek().bytesFilled=0);$t(this);var t=this._cancelAlgorithm(e);return dr(this),t},e.prototype[wt]=function(e){var t=this._controlledReadableByteStream;if(this._queueTotalSize>0){var r=this._queue.shift();this._queueTotalSize-=r.byteLength,cr(this);var n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);e._chunkSteps(n)}else{var i=this._autoAllocateChunkSize;if(void 0!==i){var a=void 0;try{a=new ArrayBuffer(i)}catch(t){return void e._errorSteps(t)}var o={buffer:a,byteOffset:0,byteLength:i,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(o)}It(t,e),nr(this)}},e}();function tr(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")}function rr(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")}function nr(e){(function(e){var t=e._controlledReadableByteStream;if("readable"!==t._state)return!1;if(e._closeRequested)return!1;if(!e._started)return!1;if(Mt(t)&&Dt(t)>0)return!0;if(kr(t)&&_r(t)>0)return!0;if(gr(e)>0)return!0;return!1})(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,et(e._pullAlgorithm(),(function(){e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,nr(e))}),(function(t){mr(e,t)}))))}function ir(e,t){var r=!1;"closed"===e._state&&(r=!0);var n=ar(t);"default"===t.readerType?Pt(e,n,r):function(e,t,r){var n=e._reader._readIntoRequests.shift();r?n._closeSteps(t):n._chunkSteps(t)}(e,n,r)}function ar(e){var t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function or(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function sr(e,t){var r=t.elementSize,n=t.bytesFilled-t.bytesFilled%r,i=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),a=t.bytesFilled+i,o=a-a%r,s=i,u=!1;o>n&&(s=o-t.bytesFilled,u=!0);for(var c,l,h,p,f,d=e._queue;s>0;){var m=d.peek(),g=Math.min(s,m.byteLength),y=t.byteOffset+t.bytesFilled;c=t.buffer,l=y,h=m.buffer,p=m.byteOffset,f=g,new Uint8Array(c).set(new Uint8Array(h,p,f),l),m.byteLength===g?d.shift():(m.byteOffset+=g,m.byteLength-=g),e._queueTotalSize-=g,ur(e,g,t),s-=g}return u}function ur(e,t,r){lr(e),r.bytesFilled+=t}function cr(e){0===e._queueTotalSize&&e._closeRequested?(dr(e),$n(e._controlledReadableByteStream)):nr(e)}function lr(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function hr(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;var t=e._pendingPullIntos.peek();sr(e,t)&&(fr(e),ir(e._controlledReadableByteStream,t))}}function pr(e,t){var r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream");!function(e,t){t.buffer=t.buffer;var r=e._controlledReadableByteStream;if(kr(r))for(;_r(r)>0;){ir(r,fr(e))}}(e,r)}else!function(e,t,r){if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range");if(ur(e,t,r),!(r.bytesFilled<r.elementSize)){fr(e);var n=r.bytesFilled%r.elementSize;if(n>0){var i=r.byteOffset+r.bytesFilled,a=r.buffer.slice(i-n,i);or(e,a,0,a.byteLength)}r.buffer=r.buffer,r.bytesFilled-=n,ir(e._controlledReadableByteStream,r),hr(e)}}(e,t,r);nr(e)}function fr(e){var t=e._pendingPullIntos.shift();return lr(e),t}function dr(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function mr(e,t){var r=e._controlledReadableByteStream;"readable"===r._state&&(!function(e){lr(e),e._pendingPullIntos=new ut}(e),$t(e),dr(e),Xn(r,t))}function gr(e){var t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function yr(e,t,r){var n=Object.create(er.prototype),i=function(){},a=function(){return $e(void 0)},o=function(){return $e(void 0)};void 0!==t.start&&(i=function(){return t.start(n)}),void 0!==t.pull&&(a=function(){return t.pull(n)}),void 0!==t.cancel&&(o=function(e){return t.cancel(e)});var s=t.autoAllocateChunkSize;if(0===s)throw new TypeError("autoAllocateChunkSize must be greater than 0");!function(e,t,r,n,i,a,o){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,$t(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=a,t._pullAlgorithm=n,t._cancelAlgorithm=i,t._autoAllocateChunkSize=o,t._pendingPullIntos=new ut,e._readableStreamController=t,et($e(r()),(function(){t._started=!0,nr(t)}),(function(e){mr(t,e)}))}(e,n,i,a,o,r,s)}function br(e){return new TypeError("ReadableStreamBYOBRequest.prototype."+e+" can only be used on a ReadableStreamBYOBRequest")}function vr(e){return new TypeError("ReadableByteStreamController.prototype."+e+" can only be used on a ReadableByteStreamController")}function wr(e,t){e._reader._readIntoRequests.push(t)}function _r(e){return e._reader._readIntoRequests.length}function kr(e){var t=e._reader;return void 0!==t&&!!Er(t)}Object.defineProperties(er.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(er.prototype,Ue.toStringTag,{value:"ReadableByteStreamController",configurable:!0});var xr=function(){function e(e){if(St(e,1,"ReadableStreamBYOBReader"),Rt(e,"First parameter"),Qn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!tr(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");ct(this,e),this._readIntoRequests=new ut}return Object.defineProperty(e.prototype,"closed",{get:function(){return Er(this)?this._closedPromise:Xe(Ar("closed"))},enumerable:!1,configurable:!0}),e.prototype.cancel=function(e){return void 0===e&&(e=void 0),Er(this)?void 0===this._ownerReadableStream?Xe(pt("cancel")):lt(this,e):Xe(Ar("cancel"))},e.prototype.read=function(e){if(!Er(this))return Xe(Ar("read"));if(!ArrayBuffer.isView(e))return Xe(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return Xe(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return Xe(new TypeError("view's buffer must have non-zero byteLength"));if(void 0===this._ownerReadableStream)return Xe(pt("read from"));var t,r,n=Ye((function(e,n){t=e,r=n}));return function(e,t,r){var n=e._ownerReadableStream;n._disturbed=!0,"errored"===n._state?r._errorSteps(n._storedError):function(e,t,r){var n=e._controlledReadableByteStream,i=1;t.constructor!==DataView&&(i=t.constructor.BYTES_PER_ELEMENT);var a=t.constructor,o={buffer:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength,bytesFilled:0,elementSize:i,viewConstructor:a,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(o),void wr(n,r);if("closed"!==n._state){if(e._queueTotalSize>0){if(sr(e,o)){var s=ar(o);return cr(e),void r._chunkSteps(s)}if(e._closeRequested){var u=new TypeError("Insufficient bytes to fill elements in the given buffer");return mr(e,u),void r._errorSteps(u)}}e._pendingPullIntos.push(o),wr(n,r),nr(e)}else{var c=new a(o.buffer,o.byteOffset,0);r._closeSteps(c)}}(n._readableStreamController,t,r)}(this,e,{_chunkSteps:function(e){return t({value:e,done:!1})},_closeSteps:function(e){return t({value:e,done:!0})},_errorSteps:function(e){return r(e)}}),n},e.prototype.releaseLock=function(){if(!Er(this))throw Ar("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ht(this)}},e}();function Er(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")}function Ar(e){return new TypeError("ReadableStreamBYOBReader.prototype."+e+" can only be used on a ReadableStreamBYOBReader")}function Sr(e,t){var r=e.highWaterMark;if(void 0===r)return t;if(Kt(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function jr(e){var t=e.size;return t||function(){return 1}}function Tr(e,t){xt(e,t);var r=null==e?void 0:e.highWaterMark,n=null==e?void 0:e.size;return{highWaterMark:void 0===r?void 0:Tt(r),size:void 0===n?void 0:Cr(n,t+" has member 'size' that")}}function Cr(e,t){return Et(e,t),function(t){return Tt(e(t))}}function Br(e,t,r){return Et(e,r),function(r){return st(e,t,[r])}}function Rr(e,t,r){return Et(e,r),function(){return st(e,t,[])}}function Or(e,t,r){return Et(e,r),function(r){return ot(e,t,[r])}}function Ir(e,t,r){return Et(e,r),function(r,n){return st(e,t,[r,n])}}function Pr(e,t){if(!Lr(e))throw new TypeError(t+" is not a WritableStream.")}Object.defineProperties(xr.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(xr.prototype,Ue.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});var Dr=function(){function e(e,t){void 0===e&&(e={}),void 0===t&&(t={}),void 0===e?e=null:At(e,"First parameter");var r=Tr(t,"Second parameter"),n=function(e,t){xt(e,t);var r=null==e?void 0:e.abort,n=null==e?void 0:e.close,i=null==e?void 0:e.start,a=null==e?void 0:e.type,o=null==e?void 0:e.write;return{abort:void 0===r?void 0:Br(r,e,t+" has member 'abort' that"),close:void 0===n?void 0:Rr(n,e,t+" has member 'close' that"),start:void 0===i?void 0:Or(i,e,t+" has member 'start' that"),write:void 0===o?void 0:Ir(o,e,t+" has member 'write' that"),type:a}}(e,"First parameter");if(Fr(this),void 0!==n.type)throw new RangeError("Invalid type is specified");var i=jr(r);!function(e,t,r,n){var i=Object.create(rn.prototype),a=function(){},o=function(){return $e(void 0)},s=function(){return $e(void 0)},u=function(){return $e(void 0)};void 0!==t.start&&(a=function(){return t.start(i)});void 0!==t.write&&(o=function(e){return t.write(e,i)});void 0!==t.close&&(s=function(){return t.close()});void 0!==t.abort&&(u=function(e){return t.abort(e)});nn(e,i,a,o,s,u,r,n)}(this,n,Sr(r,1),i)}return Object.defineProperty(e.prototype,"locked",{get:function(){if(!Lr(this))throw hn("locked");return Nr(this)},enumerable:!1,configurable:!0}),e.prototype.abort=function(e){return void 0===e&&(e=void 0),Lr(this)?Nr(this)?Xe(new TypeError("Cannot abort a stream that already has a writer")):zr(this,e):Xe(hn("abort"))},e.prototype.close=function(){return Lr(this)?Nr(this)?Xe(new TypeError("Cannot close a stream that already has a writer")):Vr(this)?Xe(new TypeError("Cannot close an already-closing stream")):Ur(this):Xe(hn("close"))},e.prototype.getWriter=function(){if(!Lr(this))throw hn("getWriter");return Mr(this)},e}();function Mr(e){return new Jr(e)}function Fr(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new ut,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function Lr(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")}function Nr(e){return void 0!==e._writer}function zr(e,t){var r=e._state;if("closed"===r||"errored"===r)return $e(void 0);if(void 0!==e._pendingAbortRequest)return e._pendingAbortRequest._promise;var n=!1;"erroring"===r&&(n=!0,t=void 0);var i=Ye((function(r,i){e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:i,_reason:t,_wasAlreadyErroring:n}}));return e._pendingAbortRequest._promise=i,n||Hr(e,t),i}function Ur(e){var t=e._state;if("closed"===t||"errored"===t)return Xe(new TypeError("The stream (in "+t+" state) is not in the writable state and cannot be closed"));var r,n=Ye((function(t,r){var n={_resolve:t,_reject:r};e._closeRequest=n})),i=e._writer;return void 0!==i&&e._backpressure&&"writable"===t&&kn(i),Yt(r=e._writableStreamController,tn,0),sn(r),n}function qr(e,t){"writable"!==e._state?Gr(e):Hr(e,t)}function Hr(e,t){var r=e._writableStreamController;e._state="erroring",e._storedError=t;var n=e._writer;void 0!==n&&Xr(n,t),!function(e){if(void 0===e._inFlightWriteRequest&&void 0===e._inFlightCloseRequest)return!1;return!0}(e)&&r._started&&Gr(e)}function Gr(e){e._state="errored",e._writableStreamController[bt]();var t=e._storedError;if(e._writeRequests.forEach((function(e){e._reject(t)})),e._writeRequests=new ut,void 0!==e._pendingAbortRequest){var r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void Wr(e);et(e._writableStreamController[yt](r._reason),(function(){r._resolve(),Wr(e)}),(function(t){r._reject(t),Wr(e)}))}else Wr(e)}function Vr(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function Wr(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);var t=e._writer;void 0!==t&&gn(t,e._storedError)}function Kr(e,t){var r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){bn(e)}(r):kn(r)),e._backpressure=t}Object.defineProperties(Dr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(Dr.prototype,Ue.toStringTag,{value:"WritableStream",configurable:!0});var Jr=function(){function e(e){if(St(e,1,"WritableStreamDefaultWriter"),Pr(e,"First parameter"),Nr(e))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=e,e._writer=this;var t,r=e._state;if("writable"===r)!Vr(e)&&e._backpressure?bn(this):wn(this),dn(this);else if("erroring"===r)vn(this,e._storedError),dn(this);else if("closed"===r)wn(this),dn(t=this),yn(t);else{var n=e._storedError;vn(this,n),mn(this,n)}}return Object.defineProperty(e.prototype,"closed",{get:function(){return Qr(this)?this._closedPromise:Xe(pn("closed"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"desiredSize",{get:function(){if(!Qr(this))throw pn("desiredSize");if(void 0===this._ownerWritableStream)throw fn("desiredSize");return function(e){var t=e._ownerWritableStream,r=t._state;if("errored"===r||"erroring"===r)return null;if("closed"===r)return 0;return on(t._writableStreamController)}(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ready",{get:function(){return Qr(this)?this._readyPromise:Xe(pn("ready"))},enumerable:!1,configurable:!0}),e.prototype.abort=function(e){return void 0===e&&(e=void 0),Qr(this)?void 0===this._ownerWritableStream?Xe(fn("abort")):function(e,t){return zr(e._ownerWritableStream,t)}(this,e):Xe(pn("abort"))},e.prototype.close=function(){if(!Qr(this))return Xe(pn("close"));var e=this._ownerWritableStream;return void 0===e?Xe(fn("close")):Vr(e)?Xe(new TypeError("Cannot close an already-closing stream")):Yr(this)},e.prototype.releaseLock=function(){if(!Qr(this))throw pn("releaseLock");void 0!==this._ownerWritableStream&&Zr(this)},e.prototype.write=function(e){return void 0===e&&(e=void 0),Qr(this)?void 0===this._ownerWritableStream?Xe(fn("write to")):en(this,e):Xe(pn("write"))},e}();function Qr(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")}function Yr(e){return Ur(e._ownerWritableStream)}function $r(e,t){"pending"===e._closedPromiseState?gn(e,t):function(e,t){mn(e,t)}(e,t)}function Xr(e,t){"pending"===e._readyPromiseState?_n(e,t):function(e,t){vn(e,t)}(e,t)}function Zr(e){var t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Xr(e,r),$r(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function en(e,t){var r=e._ownerWritableStream,n=r._writableStreamController,i=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return un(e,t),1}}(n,t);if(r!==e._ownerWritableStream)return Xe(fn("write to"));var a=r._state;if("errored"===a)return Xe(r._storedError);if(Vr(r)||"closed"===a)return Xe(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===a)return Xe(r._storedError);var o=function(e){return Ye((function(t,r){var n={_resolve:t,_reject:r};e._writeRequests.push(n)}))}(r);return function(e,t,r){try{Yt(e,t,r)}catch(t){return void un(e,t)}var n=e._controlledWritableStream;if(!Vr(n)&&"writable"===n._state){var i=cn(e);Kr(n,i)}sn(e)}(n,t,i),o}Object.defineProperties(Jr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(Jr.prototype,Ue.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});var tn={},rn=function(){function e(){throw new TypeError("Illegal constructor")}return e.prototype.error=function(e){if(void 0===e&&(e=void 0),!function(e){if(!Ge(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream"))return!1;return!0}(this))throw new TypeError("WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController");"writable"===this._controlledWritableStream._state&&ln(this,e)},e.prototype[yt]=function(e){var t=this._abortAlgorithm(e);return an(this),t},e.prototype[bt]=function(){$t(this)},e}();function nn(e,t,r,n,i,a,o,s){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,$t(t),t._started=!1,t._strategySizeAlgorithm=s,t._strategyHWM=o,t._writeAlgorithm=n,t._closeAlgorithm=i,t._abortAlgorithm=a;var u=cn(t);Kr(e,u),et($e(r()),(function(){t._started=!0,sn(t)}),(function(r){t._started=!0,qr(e,r)}))}function an(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function on(e){return e._strategyHWM-e._queueTotalSize}function sn(e){var t=e._controlledWritableStream;if(e._started&&void 0===t._inFlightWriteRequest)if("erroring"!==t._state){if(0!==e._queue.length){var r=e._queue.peek().value;r===tn?function(e){var t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),Qt(e);var r=e._closeAlgorithm();an(e),et(r,(function(){!function(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,"erroring"===e._state&&(e._storedError=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";var t=e._writer;void 0!==t&&yn(t)}(t)}),(function(e){!function(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),qr(e,t)}(t,e)}))}(e):function(e,t){var r=e._controlledWritableStream;(function(e){e._inFlightWriteRequest=e._writeRequests.shift()})(r),et(e._writeAlgorithm(t),(function(){!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);var t=r._state;if(Qt(e),!Vr(r)&&"writable"===t){var n=cn(e);Kr(r,n)}sn(e)}),(function(t){"writable"===r._state&&an(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,qr(e,t)}(r,t)}))}(e,r)}}else Gr(t)}function un(e,t){"writable"===e._controlledWritableStream._state&&ln(e,t)}function cn(e){return on(e)<=0}function ln(e,t){var r=e._controlledWritableStream;an(e),Hr(r,t)}function hn(e){return new TypeError("WritableStream.prototype."+e+" can only be used on a WritableStream")}function pn(e){return new TypeError("WritableStreamDefaultWriter.prototype."+e+" can only be used on a WritableStreamDefaultWriter")}function fn(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function dn(e){e._closedPromise=Ye((function(t,r){e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"}))}function mn(e,t){dn(e),gn(e,t)}function gn(e,t){void 0!==e._closedPromise_reject&&(it(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function yn(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function bn(e){e._readyPromise=Ye((function(t,r){e._readyPromise_resolve=t,e._readyPromise_reject=r})),e._readyPromiseState="pending"}function vn(e,t){bn(e),_n(e,t)}function wn(e){bn(e),kn(e)}function _n(e,t){void 0!==e._readyPromise_reject&&(it(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function kn(e){void 0!==e._readyPromise_resolve&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}Object.defineProperties(rn.prototype,{error:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(rn.prototype,Ue.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});var xn="undefined"!=typeof DOMException?DOMException:void 0;var En,An=function(e){if("function"!=typeof e&&"object"!=typeof e)return!1;try{return new e,!0}catch(e){return!1}}(xn)?xn:((En=function(e,t){this.message=e||"",this.name=t||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}).prototype=Object.create(Error.prototype),Object.defineProperty(En.prototype,"constructor",{value:En,writable:!0,configurable:!0}),En);function Sn(e,t,r,n,i,a){var o=Ot(e),s=Mr(t);e._disturbed=!0;var u=!1,c=$e(void 0);return Ye((function(l,h){var p,f,d,m;if(void 0!==a){if(p=function(){var r=new An("Aborted","AbortError"),a=[];n||a.push((function(){return"writable"===t._state?zr(t,r):$e(void 0)})),i||a.push((function(){return"readable"===e._state?Yn(e,r):$e(void 0)})),v((function(){return Promise.all(a.map((function(e){return e()})))}),!0,r)},a.aborted)return void p();a.addEventListener("abort",p)}if(b(e,o._closedPromise,(function(e){n?w(!0,e):v((function(){return zr(t,e)}),!0,e)})),b(t,s._closedPromise,(function(t){i?w(!0,t):v((function(){return Yn(e,t)}),!0,t)})),f=e,d=o._closedPromise,m=function(){r?w():v((function(){return function(e){var t=e._ownerWritableStream,r=t._state;return Vr(t)||"closed"===r?$e(void 0):"errored"===r?Xe(t._storedError):Yr(e)}(s)}))},"closed"===f._state?m():tt(d,m),Vr(t)||"closed"===t._state){var g=new TypeError("the destination writable stream closed before all data could be piped to it");i?w(!0,g):v((function(){return Yn(e,g)}),!0,g)}function y(){var e=c;return Ze(c,(function(){return e!==c?y():void 0}))}function b(e,t,r){"errored"===e._state?r(e._storedError):rt(t,r)}function v(e,r,n){function i(){et(e(),(function(){return _(r,n)}),(function(e){return _(!0,e)}))}u||(u=!0,"writable"!==t._state||Vr(t)?i():tt(y(),i))}function w(e,r){u||(u=!0,"writable"!==t._state||Vr(t)?_(e,r):tt(y(),(function(){return _(e,r)})))}function _(e,t){Zr(s),ht(o),void 0!==a&&a.removeEventListener("abort",p),e?h(t):l(void 0)}it(Ye((function(e,t){!function r(n){n?e():Ze(u?$e(!0):Ze(s._readyPromise,(function(){return Ye((function(e,t){Ut(o,{_chunkSteps:function(t){c=Ze(en(s,t),void 0,qe),e(!1)},_closeSteps:function(){return e(!0)},_errorSteps:t})}))})),r,t)}(!1)})))}))}var jn=function(){function e(){throw new TypeError("Illegal constructor")}return Object.defineProperty(e.prototype,"desiredSize",{get:function(){if(!Tn(this))throw Ln("desiredSize");return Dn(this)},enumerable:!1,configurable:!0}),e.prototype.close=function(){if(!Tn(this))throw Ln("close");if(!Mn(this))throw new TypeError("The stream is not in a state that permits close");On(this)},e.prototype.enqueue=function(e){if(void 0===e&&(e=void 0),!Tn(this))throw Ln("enqueue");if(!Mn(this))throw new TypeError("The stream is not in a state that permits enqueue");return In(this,e)},e.prototype.error=function(e){if(void 0===e&&(e=void 0),!Tn(this))throw Ln("error");Pn(this,e)},e.prototype[vt]=function(e){$t(this);var t=this._cancelAlgorithm(e);return Rn(this),t},e.prototype[wt]=function(e){var t=this._controlledReadableStream;if(this._queue.length>0){var r=Qt(this);this._closeRequested&&0===this._queue.length?(Rn(this),$n(t)):Cn(this),e._chunkSteps(r)}else It(t,e),Cn(this)},e}();function Tn(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")}function Cn(e){Bn(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,et(e._pullAlgorithm(),(function(){e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Cn(e))}),(function(t){Pn(e,t)}))))}function Bn(e){var t=e._controlledReadableStream;return!!Mn(e)&&(!!e._started&&(!!(Qn(t)&&Dt(t)>0)||Dn(e)>0))}function Rn(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function On(e){if(Mn(e)){var t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(Rn(e),$n(t))}}function In(e,t){if(Mn(e)){var r=e._controlledReadableStream;if(Qn(r)&&Dt(r)>0)Pt(r,t,!1);else{var n=void 0;try{n=e._strategySizeAlgorithm(t)}catch(t){throw Pn(e,t),t}try{Yt(e,t,n)}catch(t){throw Pn(e,t),t}}Cn(e)}}function Pn(e,t){var r=e._controlledReadableStream;"readable"===r._state&&($t(e),Rn(e),Xn(r,t))}function Dn(e){var t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Mn(e){var t=e._controlledReadableStream._state;return!e._closeRequested&&"readable"===t}function Fn(e,t,r,n,i,a,o){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,$t(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=o,t._strategyHWM=a,t._pullAlgorithm=n,t._cancelAlgorithm=i,e._readableStreamController=t,et($e(r()),(function(){t._started=!0,Cn(t)}),(function(e){Pn(t,e)}))}function Ln(e){return new TypeError("ReadableStreamDefaultController.prototype."+e+" can only be used on a ReadableStreamDefaultController")}function Nn(e,t,r){return Et(e,r),function(r){return st(e,t,[r])}}function zn(e,t,r){return Et(e,r),function(r){return st(e,t,[r])}}function Un(e,t,r){return Et(e,r),function(r){return ot(e,t,[r])}}function qn(e,t){if("bytes"!==(e=""+e))throw new TypeError(t+" '"+e+"' is not a valid enumeration value for ReadableStreamType");return e}function Hn(e,t){if("byob"!==(e=""+e))throw new TypeError(t+" '"+e+"' is not a valid enumeration value for ReadableStreamReaderMode");return e}function Gn(e,t){xt(e,t);var r=null==e?void 0:e.preventAbort,n=null==e?void 0:e.preventCancel,i=null==e?void 0:e.preventClose,a=null==e?void 0:e.signal;return void 0!==a&&function(e,t){if(!function(e){if("object"!=typeof e||null===e)return!1;try{return"boolean"==typeof e.aborted}catch(e){return!1}}(e))throw new TypeError(t+" is not an AbortSignal.")}(a,t+" has member 'signal' that"),{preventAbort:Boolean(r),preventCancel:Boolean(n),preventClose:Boolean(i),signal:a}}Object.defineProperties(jn.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(jn.prototype,Ue.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});var Vn=function(){function e(e,t){void 0===e&&(e={}),void 0===t&&(t={}),void 0===e?e=null:At(e,"First parameter");var r=Tr(t,"Second parameter"),n=function(e,t){xt(e,t);var r=e,n=null==r?void 0:r.autoAllocateChunkSize,i=null==r?void 0:r.cancel,a=null==r?void 0:r.pull,o=null==r?void 0:r.start,s=null==r?void 0:r.type;return{autoAllocateChunkSize:void 0===n?void 0:Bt(n,t+" has member 'autoAllocateChunkSize' that"),cancel:void 0===i?void 0:Nn(i,r,t+" has member 'cancel' that"),pull:void 0===a?void 0:zn(a,r,t+" has member 'pull' that"),start:void 0===o?void 0:Un(o,r,t+" has member 'start' that"),type:void 0===s?void 0:qn(s,t+" has member 'type' that")}}(e,"First parameter");if(Kn(this),"bytes"===n.type){if(void 0!==r.size)throw new RangeError("The strategy for a byte stream cannot have a size function");yr(this,n,Sr(r,0))}else{var i=jr(r);!function(e,t,r,n){var i=Object.create(jn.prototype),a=function(){},o=function(){return $e(void 0)},s=function(){return $e(void 0)};void 0!==t.start&&(a=function(){return t.start(i)}),void 0!==t.pull&&(o=function(){return t.pull(i)}),void 0!==t.cancel&&(s=function(e){return t.cancel(e)}),Fn(e,i,a,o,s,r,n)}(this,n,Sr(r,1),i)}}return Object.defineProperty(e.prototype,"locked",{get:function(){if(!Jn(this))throw Zn("locked");return Qn(this)},enumerable:!1,configurable:!0}),e.prototype.cancel=function(e){return void 0===e&&(e=void 0),Jn(this)?Qn(this)?Xe(new TypeError("Cannot cancel a stream that already has a reader")):Yn(this,e):Xe(Zn("cancel"))},e.prototype.getReader=function(e){if(void 0===e&&(e=void 0),!Jn(this))throw Zn("getReader");return void 0===function(e,t){xt(e,t);var r=null==e?void 0:e.mode;return{mode:void 0===r?void 0:Hn(r,t+" has member 'mode' that")}}(e,"First parameter").mode?Ot(this):new xr(this)},e.prototype.pipeThrough=function(e,t){if(void 0===t&&(t={}),!Jn(this))throw Zn("pipeThrough");St(e,1,"pipeThrough");var r=function(e,t){xt(e,t);var r=null==e?void 0:e.readable;jt(r,"readable","ReadableWritablePair"),Rt(r,t+" has member 'readable' that");var n=null==e?void 0:e.writable;return jt(n,"writable","ReadableWritablePair"),Pr(n,t+" has member 'writable' that"),{readable:r,writable:n}}(e,"First parameter"),n=Gn(t,"Second parameter");if(Qn(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Nr(r.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return it(Sn(this,r.writable,n.preventClose,n.preventAbort,n.preventCancel,n.signal)),r.readable},e.prototype.pipeTo=function(e,t){if(void 0===t&&(t={}),!Jn(this))return Xe(Zn("pipeTo"));if(void 0===e)return Xe("Parameter 1 is required in 'pipeTo'.");if(!Lr(e))return Xe(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));var r;try{r=Gn(t,"Second parameter")}catch(e){return Xe(e)}return Qn(this)?Xe(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Nr(e)?Xe(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):Sn(this,e,r.preventClose,r.preventAbort,r.preventCancel,r.signal)},e.prototype.tee=function(){if(!Jn(this))throw Zn("tee");var e=function(e,t){var r,n,i,a,o,s=Ot(e),u=!1,c=!1,l=!1,h=Ye((function(e){o=e}));function p(){return u||(u=!0,Ut(s,{_chunkSteps:function(e){at((function(){u=!1;var t=e,r=e;c||In(i._readableStreamController,t),l||In(a._readableStreamController,r)}))},_closeSteps:function(){u=!1,c||On(i._readableStreamController),l||On(a._readableStreamController),c&&l||o(void 0)},_errorSteps:function(){u=!1}})),$e(void 0)}function f(){}return i=Wn(f,p,(function(t){if(c=!0,r=t,l){var i=Xt([r,n]),a=Yn(e,i);o(a)}return h})),a=Wn(f,p,(function(t){if(l=!0,n=t,c){var i=Xt([r,n]),a=Yn(e,i);o(a)}return h})),rt(s._closedPromise,(function(e){Pn(i._readableStreamController,e),Pn(a._readableStreamController,e),c&&l||o(void 0)})),[i,a]}(this);return Xt(e)},e.prototype.values=function(e){if(void 0===e&&(e=void 0),!Jn(this))throw Zn("values");var t,r,n,i,a,o=function(e,t){xt(e,t);var r=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(r)}}(e,"First parameter");return t=this,r=o.preventCancel,n=Ot(t),i=new Ht(n,r),(a=Object.create(Gt))._asyncIteratorImpl=i,a},e}();function Wn(e,t,r,n,i){void 0===n&&(n=1),void 0===i&&(i=function(){return 1});var a=Object.create(Vn.prototype);return Kn(a),Fn(a,Object.create(jn.prototype),e,t,r,n,i),a}function Kn(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function Jn(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")}function Qn(e){return void 0!==e._reader}function Yn(e,t){return e._disturbed=!0,"closed"===e._state?$e(void 0):"errored"===e._state?Xe(e._storedError):($n(e),nt(e._readableStreamController[vt](t),qe))}function $n(e){e._state="closed";var t=e._reader;void 0!==t&&(gt(t),zt(t)&&(t._readRequests.forEach((function(e){e._closeSteps()})),t._readRequests=new ut))}function Xn(e,t){e._state="errored",e._storedError=t;var r=e._reader;void 0!==r&&(mt(r,t),zt(r)?(r._readRequests.forEach((function(e){e._errorSteps(t)})),r._readRequests=new ut):(r._readIntoRequests.forEach((function(e){e._errorSteps(t)})),r._readIntoRequests=new ut))}function Zn(e){return new TypeError("ReadableStream.prototype."+e+" can only be used on a ReadableStream")}function ei(e,t){xt(e,t);var r=null==e?void 0:e.highWaterMark;return jt(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:Tt(r)}}Object.defineProperties(Vn.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(Vn.prototype,Ue.toStringTag,{value:"ReadableStream",configurable:!0}),"symbol"==typeof Ue.asyncIterator&&Object.defineProperty(Vn.prototype,Ue.asyncIterator,{value:Vn.prototype.values,writable:!0,configurable:!0});var ti=function(e){return e.byteLength},ri=function(){function e(e){St(e,1,"ByteLengthQueuingStrategy"),e=ei(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}return Object.defineProperty(e.prototype,"highWaterMark",{get:function(){if(!ii(this))throw ni("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){if(!ii(this))throw ni("size");return ti},enumerable:!1,configurable:!0}),e}();function ni(e){return new TypeError("ByteLengthQueuingStrategy.prototype."+e+" can only be used on a ByteLengthQueuingStrategy")}function ii(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")}Object.defineProperties(ri.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(ri.prototype,Ue.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});var ai=function(){return 1},oi=function(){function e(e){St(e,1,"CountQueuingStrategy"),e=ei(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}return Object.defineProperty(e.prototype,"highWaterMark",{get:function(){if(!ui(this))throw si("highWaterMark");return this._countQueuingStrategyHighWaterMark},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){if(!ui(this))throw si("size");return ai},enumerable:!1,configurable:!0}),e}();function si(e){return new TypeError("CountQueuingStrategy.prototype."+e+" can only be used on a CountQueuingStrategy")}function ui(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")}function ci(e,t,r){return Et(e,r),function(r){return st(e,t,[r])}}function li(e,t,r){return Et(e,r),function(r){return ot(e,t,[r])}}function hi(e,t,r){return Et(e,r),function(r,n){return st(e,t,[r,n])}}Object.defineProperties(oi.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(oi.prototype,Ue.toStringTag,{value:"CountQueuingStrategy",configurable:!0});var pi=function(){function e(e,t,r){void 0===e&&(e={}),void 0===t&&(t={}),void 0===r&&(r={}),void 0===e&&(e=null);var n=Tr(t,"Second parameter"),i=Tr(r,"Third parameter"),a=function(e,t){xt(e,t);var r=null==e?void 0:e.flush,n=null==e?void 0:e.readableType,i=null==e?void 0:e.start,a=null==e?void 0:e.transform,o=null==e?void 0:e.writableType;return{flush:void 0===r?void 0:ci(r,e,t+" has member 'flush' that"),readableType:n,start:void 0===i?void 0:li(i,e,t+" has member 'start' that"),transform:void 0===a?void 0:hi(a,e,t+" has member 'transform' that"),writableType:o}}(e,"First parameter");if(void 0!==a.readableType)throw new RangeError("Invalid readableType specified");if(void 0!==a.writableType)throw new RangeError("Invalid writableType specified");var o,s=Sr(i,0),u=jr(i),c=Sr(n,1),l=jr(n);!function(e,t,r,n,i,a){function o(){return t}e._writable=function(e,t,r,n,i,a){void 0===i&&(i=1),void 0===a&&(a=function(){return 1});var o=Object.create(Dr.prototype);return Fr(o),nn(o,Object.create(rn.prototype),e,t,r,n,i,a),o}(o,(function(t){return function(e,t){var r=e._transformStreamController;if(e._backpressure){return nt(e._backpressureChangePromise,(function(){var n=e._writable;if("erroring"===n._state)throw n._storedError;return _i(r,t)}))}return _i(r,t)}(e,t)}),(function(){return function(e){var t=e._readable,r=e._transformStreamController,n=r._flushAlgorithm();return vi(r),nt(n,(function(){if("errored"===t._state)throw t._storedError;On(t._readableStreamController)}),(function(r){throw di(e,r),t._storedError}))}(e)}),(function(t){return function(e,t){return di(e,t),$e(void 0)}(e,t)}),r,n),e._readable=Wn(o,(function(){return function(e){return gi(e,!1),e._backpressureChangePromise}(e)}),(function(t){return mi(e,t),$e(void 0)}),i,a),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,gi(e,!0),e._transformStreamController=void 0}(this,Ye((function(e){o=e})),c,l,s,u),function(e,t){var r=Object.create(yi.prototype),n=function(e){try{return wi(r,e),$e(void 0)}catch(e){return Xe(e)}},i=function(){return $e(void 0)};void 0!==t.transform&&(n=function(e){return t.transform(e,r)});void 0!==t.flush&&(i=function(){return t.flush(r)});!function(e,t,r,n){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=n}(e,r,n,i)}(this,a),void 0!==a.start?o(a.start(this._transformStreamController)):o(void 0)}return Object.defineProperty(e.prototype,"readable",{get:function(){if(!fi(this))throw xi("readable");return this._readable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"writable",{get:function(){if(!fi(this))throw xi("writable");return this._writable},enumerable:!1,configurable:!0}),e}();function fi(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")}function di(e,t){Pn(e._readable._readableStreamController,t),mi(e,t)}function mi(e,t){vi(e._transformStreamController),un(e._writable._writableStreamController,t),e._backpressure&&gi(e,!1)}function gi(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=Ye((function(t){e._backpressureChangePromise_resolve=t})),e._backpressure=t}Object.defineProperties(pi.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(pi.prototype,Ue.toStringTag,{value:"TransformStream",configurable:!0});var yi=function(){function e(){throw new TypeError("Illegal constructor")}return Object.defineProperty(e.prototype,"desiredSize",{get:function(){if(!bi(this))throw ki("desiredSize");return Dn(this._controlledTransformStream._readable._readableStreamController)},enumerable:!1,configurable:!0}),e.prototype.enqueue=function(e){if(void 0===e&&(e=void 0),!bi(this))throw ki("enqueue");wi(this,e)},e.prototype.error=function(e){if(void 0===e&&(e=void 0),!bi(this))throw ki("error");var t;t=e,di(this._controlledTransformStream,t)},e.prototype.terminate=function(){if(!bi(this))throw ki("terminate");!function(e){var t=e._controlledTransformStream;On(t._readable._readableStreamController);var r=new TypeError("TransformStream terminated");mi(t,r)}(this)},e}();function bi(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")}function vi(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0}function wi(e,t){var r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!Mn(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{In(n,t)}catch(e){throw mi(r,e),r._readable._storedError}(function(e){return!Bn(e)})(n)!==r._backpressure&&gi(r,!0)}function _i(e,t){return nt(e._transformAlgorithm(t),void 0,(function(t){throw di(e._controlledTransformStream,t),t}))}function ki(e){return new TypeError("TransformStreamDefaultController.prototype."+e+" can only be used on a TransformStreamDefaultController")}function xi(e){return new TypeError("TransformStream.prototype."+e+" can only be used on a TransformStream")}Object.defineProperties(yi.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(yi.prototype,Ue.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});var Ei={ReadableStream:Vn,ReadableStreamDefaultController:jn,ReadableByteStreamController:er,ReadableStreamBYOBRequest:Zt,ReadableStreamDefaultReader:Nt,ReadableStreamBYOBReader:xr,WritableStream:Dr,WritableStreamDefaultController:rn,WritableStreamDefaultWriter:Jr,ByteLengthQueuingStrategy:ri,CountQueuingStrategy:oi,TransformStream:pi,TransformStreamDefaultController:yi};if(void 0!==He)for(var Ai in Ei)Object.prototype.hasOwnProperty.call(Ei,Ai)&&Object.defineProperty(He,Ai,{value:Ei[Ai],writable:!0,configurable:!0});delete global.ReadableStream;let Si,ji,Ti;Si=Symbol.asyncIterator;ji=Symbol.toStringTag;Ti=Symbol.toStringTag;(!m||!("TextEncoder"in y))&&(y.TextEncoder=F);(!m||!("TextDecoder"in y))&&(y.TextDecoder=M),m||"atob"in y||!ae||(y.atob=ae),m||"btoa"in y||!oe||(y.btoa=oe),m||"Headers"in y||!ue||(y.Headers=ue),m||"Response"in y||!Te||(y.Response=Te),m||"fetch"in y||!Be||(y.fetch=Be),m||"DOMParser"in y||!d.DOMParser||(y.DOMParser=d.DOMParser),m||"_encodeImageNode"in y||!De||(y._encodeImageNode=De),m||"_parseImageNode"in y||!ze||(y._parseImageNode=ze),"allSettled"in Promise||(Promise.allSettled=function(e){const t=e.map(e=>e.then(e=>({status:"fulfilled",value:e})).catch(e=>({status:"rejected",reason:e})));return Promise.all(t)});var Ci=r(1),Bi=r(22),Ri=r.n(Bi),Oi=r(7),Ii=r.n(Oi);"undefined"!=typeof self&&self,"undefined"!=typeof window&&window,"undefined"!=typeof global&&global,"undefined"!=typeof document&&document;const Pi=Boolean("object"!=typeof process||"[object process]"!==String(process)||process.browser),Di="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version),Mi=(Di&&parseFloat(Di[1]),e=>"boolean"==typeof e),Fi=e=>"function"==typeof e,Li=e=>null!==e&&"object"==typeof e,Ni=e=>Li(e)&&e.constructor==={}.constructor,zi=e=>e&&"function"==typeof e[Symbol.iterator],Ui=e=>e&&"function"==typeof e[Symbol.asyncIterator],qi=e=>"undefined"!=typeof Response&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json,Hi=e=>"undefined"!=typeof Blob&&e instanceof Blob,Gi=e=>(e=>"undefined"!=typeof ReadableStream&&e instanceof ReadableStream||Li(e)&&Fi(e.tee)&&Fi(e.cancel)&&Fi(e.getReader))(e)||(e=>Li(e)&&Fi(e.read)&&Fi(e.pipe)&&Mi(e.readable))(e);function Vi(e,t){if(!e)throw new Error(t||"loader assertion failed.")}function Wi(e){var t;if(!e)return!1;Array.isArray(e)&&(e=e[0]);return Array.isArray(null===(t=e)||void 0===t?void 0:t.extensions)}function Ki(e){var t,r;let n;return Vi(e,"null loader"),Vi(Wi(e),"invalid loader"),Array.isArray(e)&&(n=e[1],e=e[0],e={...e,options:{...e.options,...n}}),(null!==(t=e)&&void 0!==t&&t.parseTextSync||null!==(r=e)&&void 0!==r&&r.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}let Ji="";const Qi={};function Yi(e){for(const t in Qi)if(e.startsWith(t)){const r=Qi[t];e=e.replace(t,r)}return e.startsWith("http://")||e.startsWith("https://")||(e=`${Ji}${e}`),e}const $i=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,Xi=/^([-\w.]+\/[-\w.+]+)/;function Zi(e){const t=Xi.exec(e);return t?t[1]:e}function ea(e){const t=$i.exec(e);return t?t[1]:""}const ta=/\?.*/;function ra(e){if(qi(e)){const t=na(e.url||"");return{url:t,type:Zi(e.headers.get("content-type")||"")||ea(t)}}return Hi(e)?{url:na(e.name||""),type:e.type||""}:"string"==typeof e?{url:na(e),type:ea(e)}:{url:"",type:""}}function na(e){return e.replace(ta,"")}async function ia(e){if(qi(e))return e;const t={},r=function(e){return qi(e)?e.headers["content-length"]||-1:Hi(e)?e.size:"string"==typeof e?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}(e);r>=0&&(t["content-length"]=String(r));const{url:n,type:i}=ra(e);i&&(t["content-type"]=i);const a=await async function(e){if("string"==typeof e)return"data:,"+e.slice(0,5);if(e instanceof Blob){const t=e.slice(0,5);return await new Promise(e=>{const r=new FileReader;r.onload=t=>{var r;return e(null==t||null===(r=t.target)||void 0===r?void 0:r.result)},r.readAsDataURL(t)})}if(e instanceof ArrayBuffer){const t=e.slice(0,5);return"data:base64,"+function(e){let t="";const r=new Uint8Array(e);for(let e=0;e<r.byteLength;e++)t+=String.fromCharCode(r[e]);return btoa(t)}(t)}return null}(e);a&&(t["x-first-bytes"]=a),"string"==typeof e&&(e=(new TextEncoder).encode(e));const o=new Response(e,{headers:t});return Object.defineProperty(o,"url",{value:n}),o}async function aa(e){if(!e.ok){const t=await async function(e){let t=`Failed to fetch resource ${e.url} (${e.status}): `;try{const r=e.headers.get("Content-Type");let n=e.statusText;r.includes("application/json")&&(n+=" "+await e.text()),t+=n,t=t.length>60?t.slice(0,60)+"...":t}catch(e){}return t}(e);throw new Error(t)}}async function oa(e,t){if("string"==typeof e){e=Yi(e);let r=t;return null!=t&&t.fetch&&"function"!=typeof(null==t?void 0:t.fetch)&&(r=t.fetch),await fetch(e,r)}return await ia(e)}const sa=new(r(544).a)({id:"loaders.gl"});class ua{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const ca={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){var e,t,r;r=void 0,(t="console")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}},CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Pi,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},la={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function ha(){globalThis.loaders=globalThis.loaders||{};const{loaders:e}=globalThis;return e._state=e._state||{},e._state}const pa=()=>{const e=ha();return e.globalOptions=e.globalOptions||{...ca},e.globalOptions};function fa(e,t,r,n){return r=r||[],function(e,t){ma(e,null,ca,la,t);for(const r of t){const n=e&&e[r.id]||{},i=r.options&&r.options[r.id]||{},a=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};ma(n,r.id,i,a,t)}}(e,r=Array.isArray(r)?r:[r]),ya(t,e,n)}function da(e,t){const r=pa(),n=e||r;return"function"==typeof n.fetch?n.fetch:Li(n.fetch)?e=>oa(e,n):null!=t&&t.fetch?null==t?void 0:t.fetch:oa}function ma(e,t,r,n,i){const a=t||"Top level",o=t?t+".":"";for(const s in e){const u=!t&&Li(e[s]),c="baseUri"===s&&!t,l="workerUrl"===s&&t;if(!(s in r)&&!c&&!l)if(s in n)sa.warn(`${a} loader option '${o}${s}' no longer supported, use '${n[s]}'`)();else if(!u){const e=ga(s,i);sa.warn(`${a} loader option '${o}${s}' not recognized. ${e}`)()}}}function ga(e,t){const r=e.toLowerCase();let n="";for(const i of t)for(const t in i.options){if(e===t)return`Did you mean '${i.id}.${t}'?`;const a=t.toLowerCase();(r.startsWith(a)||a.startsWith(r))&&(n=n||`Did you mean '${i.id}.${t}'?`)}return n}function ya(e,t,r){const n={...e.options||{}};return function(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)}(n,r),null===n.log&&(n.log=new ua),ba(n,pa()),ba(n,t),n}function ba(e,t){for(const r in t)if(r in t){const n=t[r];Ni(n)&&Ni(e[r])?e[r]={...e[r],...t[r]}:e[r]=t[r]}}function va(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}const wa={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document},_a=wa.global||wa.self||wa.window||{},ka="object"!=typeof process||"[object process]"!==String(process)||process.browser,xa="function"==typeof importScripts,Ea="undefined"!=typeof window&&void 0!==window.orientation,Aa="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version);Aa&&parseFloat(Aa[1]);var Sa=r(543);const ja=new Map;function Ta(e){va(e.source&&!e.url||!e.source&&e.url);let t=ja.get(e.source||e.url);return t||(e.url&&(t=function(e){if(!e.startsWith("http"))return e;return Ca((t=e,`try {\n importScripts('${t}');\n} catch (error) {\n console.error(error);\n throw error;\n}`));var t}(e.url),ja.set(e.url,t)),e.source&&(t=Ca(e.source),ja.set(e.source,t))),va(t),t}function Ca(e){const t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function Ba(e){return!!e&&(e instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&e instanceof MessagePort||("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)))}function Ra(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Oa=()=>{};class Ia{static isSupported(){return"undefined"!=typeof Worker&&ka||void 0!==Sa.Worker&&!ka}constructor(e){Ra(this,"name",void 0),Ra(this,"source",void 0),Ra(this,"url",void 0),Ra(this,"terminated",!1),Ra(this,"worker",void 0),Ra(this,"onMessage",void 0),Ra(this,"onError",void 0),Ra(this,"_loadableURL","");const{name:t,source:r,url:n}=e;va(r||n),this.name=t,this.source=r,this.url=n,this.onMessage=Oa,this.onError=e=>console.log(e),this.worker=ka?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=Oa,this.onError=Oa,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,t){t=t||function e(t,r=!0,n){const i=n||new Set;if(t){if(Ba(t))i.add(t);else if(Ba(t.buffer))i.add(t.buffer);else if(ArrayBuffer.isView(t));else if(r&&"object"==typeof t)for(const n in t)e(t[n],r,i)}else;return void 0===n?Array.from(i):[]}(e),this.worker.postMessage(e,t)}_getErrorFromErrorEvent(e){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url}. `,e.message&&(t+=e.message+" in "),e.lineno&&(t+=`:${e.lineno}:${e.colno}`),new Error(t)}_createBrowserWorker(){this._loadableURL=Ta({source:this.source,url:this.url});const e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=e=>{e.data?this.onMessage(e.data):this.onError(new Error("No data received"))},e.onerror=e=>{this.onError(this._getErrorFromErrorEvent(e)),this.terminated=!0},e.onmessageerror=e=>console.error(e),e}_createNodeWorker(){let e;if(this.url){const t=this.url.includes(":/")||this.url.startsWith("/")?this.url:"./"+this.url;e=new Sa.Worker(t,{eval:!1})}else{if(!this.source)throw new Error("no worker");e=new Sa.Worker(this.source,{eval:!0})}return e.on("message",e=>{this.onMessage(e)}),e.on("error",e=>{this.onError(e)}),e.on("exit",e=>{}),e}}function Pa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Da{constructor(e,t){Pa(this,"name",void 0),Pa(this,"workerThread",void 0),Pa(this,"isRunning",!0),Pa(this,"result",void 0),Pa(this,"_resolve",()=>{}),Pa(this,"_reject",()=>{}),this.name=e,this.workerThread=t,this.result=new Promise((e,t)=>{this._resolve=e,this._reject=t})}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){va(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){va(this.isRunning),this.isRunning=!1,this._reject(e)}}function Ma(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Fa{static isSupported(){return Ia.isSupported()}constructor(e){Ma(this,"name","unnamed"),Ma(this,"source",void 0),Ma(this,"url",void 0),Ma(this,"maxConcurrency",1),Ma(this,"maxMobileConcurrency",1),Ma(this,"onDebug",()=>{}),Ma(this,"reuseWorkers",!0),Ma(this,"props",{}),Ma(this,"jobQueue",[]),Ma(this,"idleQueue",[]),Ma(this,"count",0),Ma(this,"isDestroyed",!1),this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},void 0!==e.name&&(this.name=e.name),void 0!==e.maxConcurrency&&(this.maxConcurrency=e.maxConcurrency),void 0!==e.maxMobileConcurrency&&(this.maxMobileConcurrency=e.maxMobileConcurrency),void 0!==e.reuseWorkers&&(this.reuseWorkers=e.reuseWorkers),void 0!==e.onDebug&&(this.onDebug=e.onDebug)}async startJob(e,t=((e,t,r)=>e.done(r)),r=((e,t)=>e.error(t))){const n=new Promise(n=>(this.jobQueue.push({name:e,onMessage:t,onError:r,onStart:n}),this));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;const e=this._getAvailableWorker();if(!e)return;const t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:e,backlog:this.jobQueue.length});const r=new Da(t.name,e);e.onMessage=e=>t.onMessage(r,e.type,e.payload),e.onError=e=>t.onError(r,e),t.onStart(r);try{await r.result}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;const e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Ia({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return Ea?this.maxMobileConcurrency:this.maxConcurrency}}function La(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Na={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}};class za{static isSupported(){return Ia.isSupported()}static getWorkerFarm(e={}){return za._workerFarm=za._workerFarm||new za({}),za._workerFarm.setProps(e),za._workerFarm}constructor(e){La(this,"props",void 0),La(this,"workerPools",new Map),this.props={...Na},this.setProps(e),this.workerPools=new Map}destroy(){for(const e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(const e of this.workerPools.values())e.setProps(this._getWorkerPoolProps())}getWorkerPool(e){const{name:t,source:r,url:n}=e;let i=this.workerPools.get(t);return i||(i=new Fa({name:t,source:r,url:n}),i.setProps(this._getWorkerPoolProps()),this.workerPools.set(t,i)),i}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}La(za,"_workerFarm",void 0);function Ua(e,t={}){const r=t[e.id]||{},n=e.id+"-worker.js";let i=r.workerUrl;if(i||"compression"!==e.id||(i=t.workerUrl),"test"===t._workerType&&(i=`modules/${e.module}/dist/${n}`),!i){let t=e.version;"latest"===t&&(t="beta");const r=t?"@"+t:"";i=`https://unpkg.com/@loaders.gl/${e.module}${r}/dist/${n}`}return va(i),i}async function qa(e,t,r,n,i){const a=e.id,o=Ua(e,r),s=za.getWorkerFarm(r).getWorkerPool({name:a,url:o});r=JSON.parse(JSON.stringify(r)),n=JSON.parse(JSON.stringify(n||{}));const u=await s.startJob("process-on-worker",Ha.bind(null,i));u.postMessage("process",{input:t,options:r,context:n});const c=await u.result;return await c.result}async function Ha(e,t,r,n){switch(r){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":const{id:i,input:a,options:o}=n;try{const r=await e(a,o);t.postMessage("done",{id:i,result:r})}catch(e){const r=e instanceof Error?e.message:"unknown error";t.postMessage("error",{id:i,error:r})}break;default:console.warn("parse-with-worker unknown message "+r)}}function Ga(e){if(ArrayBuffer.isView(e)&&(e=e.buffer),"undefined"!=typeof Buffer&&e instanceof ArrayBuffer){const t=new Buffer(e.byteLength),r=new Uint8Array(e);for(let e=0;e<t.length;++e)t[e]=r[e];return t}return Vi(!1)}function Va(e){return e&&"object"==typeof e&&e.isBuffer}function Wa(e){return Ga?Ga(e):e}function Ka(e){if(Va(e))return function(e){if(Va(e)){return new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer}return e}(e);if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return 0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if("string"==typeof e){const t=e;return(new TextEncoder).encode(t).buffer}if(e&&"object"==typeof e&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}function Ja(...e){const t=e.map(e=>e instanceof ArrayBuffer?new Uint8Array(e):e),r=t.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(r);let i=0;for(const e of t)n.set(e,i),i+=e.byteLength;return n.buffer}function Qa(...e){const t=e,r=t&&t.length>1&&t[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');const n=new r(t.reduce((e,t)=>e+t.length,0));let i=0;for(const e of t)n.set(e,i),i+=e.length;return n}function Ya(e,t,r){const n=void 0!==r?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}async function $a(e){const t=[];for await(const r of e)t.push(r);return Ja(...t)}const Xa=262144;function Za(e,t){return Pi?async function*(e,t){const r=e.getReader();let n;try{for(;;){const e=n||r.read();null!=t&&t._streamReadAhead&&(n=r.read());const{done:i,value:a}=await e;if(i)return;yield Ka(a)}}catch(e){r.releaseLock()}}(e,t):async function*(e,t){for await(const t of e)yield Ka(t)}(e)}function eo(e,t){if("string"==typeof e)return function*(e,t){const r=(null==t?void 0:t.chunkSize)||262144;let n=0;const i=new TextEncoder;for(;n<e.length;){const t=Math.min(e.length-n,r),a=e.slice(n,n+t);n+=t,yield i.encode(a)}}(e,t);if(e instanceof ArrayBuffer)return function*(e,t={}){const{chunkSize:r=Xa}=t;let n=0;for(;n<e.byteLength;){const t=Math.min(e.byteLength-n,r),i=new ArrayBuffer(t),a=new Uint8Array(e,n,t);new Uint8Array(i).set(a),n+=t,yield i}}(e,t);if(Hi(e))return async function*(e,t){const r=(null==t?void 0:t.chunkSize)||1048576;let n=0;for(;n<e.size;){const t=n+r,i=await e.slice(n,t).arrayBuffer();n=t,yield i}}(e,t);if(Gi(e))return Za(e,t);if(qi(e)){return Za(e.body,t)}throw new Error("makeIterator")}const to="Cannot convert supplied data type";async function ro(e,t,r){const n=e instanceof ArrayBuffer||ArrayBuffer.isView(e);if("string"==typeof e||n)return function(e,t,r){if(t.text&&"string"==typeof e)return e;var n;if((n=e)&&"object"==typeof n&&n.isBuffer&&(e=e.buffer),e instanceof ArrayBuffer){const r=e;if(t.text&&!t.binary){return new TextDecoder("utf8").decode(r)}return r}if(ArrayBuffer.isView(e)){if(t.text&&!t.binary){return new TextDecoder("utf8").decode(e)}let r=e.buffer;const n=e.byteLength||e.length;return 0===e.byteOffset&&n===r.byteLength||(r=r.slice(e.byteOffset,e.byteOffset+n)),r}throw new Error(to)}(e,t);if(Hi(e)&&(e=await ia(e)),qi(e)){const r=e;return await aa(r),t.binary?await r.arrayBuffer():await r.text()}if(Gi(e)&&(e=eo(e,r)),zi(e)||Ui(e))return $a(e);throw new Error(to)}function no(e){const t=e&&e.lastIndexOf("/");return t>=0?e.substr(t+1):""}function io(e){const t=e&&e.lastIndexOf("/");return t>=0?e.substr(0,t):""}function ao(...e){return(e=e.map((t,r)=>(r&&(t=t.replace(new RegExp("^/"),"")),r!==e.length-1&&(t=t.replace(new RegExp("/$"),"")),t))).join("/")}const oo=Le.promisify;let so,uo,co,lo,ho,po,fo,mo,go,yo,bo=Boolean(de.a);try{so=oo(de.a.readdir),uo=oo(de.a.stat),co=oo(de.a.readFile),lo=de.a.readFileSync,ho=oo(de.a.writeFile),po=de.a.writeFileSync,fo=oo(de.a.open),mo=oo(de.a.close),go=oo(de.a.read),yo=oo(de.a.fstat),bo=Boolean(de.a)}catch{}async function vo(e,t,r){const n=Buffer.alloc(r),{bytesRead:i}=await go(e,n,0,r,t);if(i!==r)throw new Error("fs.read failed");return function(e){if(Buffer.isBuffer(e)){return new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer}return e}(n)}function wo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _o(){return!("object"==typeof process&&"[object process]"===String(process)&&!process.browser)||function(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof process&&"object"==typeof process.versions&&Boolean(process.versions.electron))return!0;const t="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}()}const ko="undefined"!=typeof __VERSION__?__VERSION__:"untranspiled source";_o();class xo{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";wo(this,"storage",void 0),wo(this,"id",void 0),wo(this,"config",{}),this.storage=function(e){try{const t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch(e){return null}}(r),this.id=e,this.config={},Object.assign(this.config,t),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){return this.config={},this.updateConfiguration(e)}updateConfiguration(e){if(Object.assign(this.config,e),this.storage){const e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}return this}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function Eo(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600;const i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));const a=e.width*r,o=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}let Ao;function So(e){return"string"==typeof e?Ao[e.toUpperCase()]||Ao.WHITE:e}function jo(e,t){if(!e)throw new Error(t||"Assertion failed")}!function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(Ao||(Ao={}));const To={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document,process:"object"==typeof process&&process},Co=(globalThis,To.window||To.self||To.global),Bo=To.process||{};console;function Ro(){let e;var t,r;if(_o&&"performance"in Co)e=null==Co||null===(t=Co.performance)||void 0===t||null===(r=t.now)||void 0===r?void 0:r.call(t);else if("hrtime"in Bo){var n;const t=null==Bo||null===(n=Bo.hrtime)||void 0===n?void 0:n.call(Bo);e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}const Oo={debug:_o&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Io={enabled:!0,level:0};function Po(){}const Do={},Mo={once:!0};class Fo{constructor(){let{id:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""};wo(this,"id",void 0),wo(this,"VERSION",ko),wo(this,"_startTs",Ro()),wo(this,"_deltaTs",Ro()),wo(this,"_storage",void 0),wo(this,"userData",{}),wo(this,"LOG_THROTTLE_TIMEOUT",0),this.id=e,this._storage=new xo("__probe-".concat(this.id,"__"),Io),this.userData={},this.timeStamp("".concat(this.id," started")),function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"];const r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r);for(const r of n)"function"==typeof e[r]&&(t.find(e=>r===e)||(e[r]=e[r].bind(e)))}(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((Ro()-this._startTs).toPrecision(10))}getDelta(){return Number((Ro()-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&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:e}),this}setLevel(e){return this._storage.updateConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.updateConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){jo(e,t)}warn(e){return this._getLogFunction(0,e,Oo.warn,arguments,Mo)}error(e){return this._getLogFunction(0,e,Oo.error,arguments)}deprecated(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}probe(e,t){return this._getLogFunction(e,t,Oo.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,Oo.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return this._getLogFunction(e,t,Oo.debug||Oo.info,arguments,Mo)}table(e,t,r){return t?this._getLogFunction(e,t,console.table||Po,r&&[r],{tag:zo(t)}):Po}image(e){let{logLevel:t,priority:n,image:i,message:a="",scale:o=1}=e;return this._shouldLog(t||n)?_o?function(e){let{image:t,message:r="",scale:n=1}=e;if("string"==typeof t){const e=new Image;return e.onload=()=>{const t=Eo(e,r,n);console.log(...t)},e.src=t,Po}const i=t.nodeName||"";if("img"===i.toLowerCase())return console.log(...Eo(t,r,n)),Po;if("canvas"===i.toLowerCase()){const e=new Image;return e.onload=()=>console.log(...Eo(e,r,n)),e.src=t.toDataURL(),Po}return Po}({image:i,message:a,scale:o}):function(e){let{image:t,message:n="",scale:i=1}=e,a=null;try{a=r(!function(){var e=new Error("Cannot find module 'asciify-image'");throw e.code="MODULE_NOT_FOUND",e}())}catch(e){}if(a)return()=>a(t,{fit:"box",width:"".concat(Math.round(80*i),"%")}).then(e=>console.log(e));return Po}({image:i,message:a,scale:o}):Po}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||Po)}group(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};const n=No({logLevel:e,message:t,opts:r}),{collapsed:i}=r;return n.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(e,t,Object.assign({},r,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Po)}withGroup(e,t,r){this.group(e,t)();try{r()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=Lo(e)}_getLogFunction(e,t,r,n,i){if(this._shouldLog(e)){i=No({logLevel:e,message:t,args:n,opts:i}),jo(r=r||i.method),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=Ro();const a=i.tag||i.message;if(i.once){if(Do[a])return Po;Do[a]=Ro()}return t=function(e,t,r){if("string"==typeof t){const o=r.time?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;const r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}(function(e){let t;return t=e<10?"".concat(e.toFixed(2),"ms"):e<100?"".concat(e.toFixed(1),"ms"):e<1e3?"".concat(e.toFixed(0),"ms"):"".concat((e/1e3).toFixed(2),"s"),t}(r.total)):"";t=r.time?"".concat(e,": ").concat(o," ").concat(t):"".concat(e,": ").concat(t),n=t,i=r.color,a=r.background,_o||"string"!=typeof n||(i&&(i=So(i),n="[".concat(i,"m").concat(n,"[39m")),a&&(i=So(a),n="[".concat(a+10,"m").concat(n,"[49m"))),t=n}var n,i,a;return t}(this.id,i.message,i),r.bind(console,t,...i.args)}return Po}}function Lo(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return jo(Number.isFinite(t)&&t>=0),t}function No(e){const{logLevel:t,message:r}=e;e.logLevel=Lo(t);const n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":void 0!==r&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());const i=typeof e.message;return jo("string"===i||"object"===i),Object.assign(e,{args:n},e.opts)}function zo(e){for(const t in e)for(const r in e[t])return r||"untitled";return"empty"}wo(Fo,"VERSION",ko);const Uo=new Fo({id:"loaders.gl"}),qo=()=>{const e=ha();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};const Ho=/\.([^.]+)$/;function Go(e,t=[],r,n){if(!Vo(e))return null;if(t&&!Array.isArray(t))return Ki(t);let i=[];t&&(i=i.concat(t)),null!=r&&r.ignoreRegisteredLoaders||i.push(...qo()),function(e){for(const t of e)Ki(t)}(i);const a=function(e,t,r,n){const{url:i,type:a}=ra(e),o=i||(null==n?void 0:n.url);let s=null,u="";null!=r&&r.mimeType&&(s=Ko(t,null==r?void 0:r.mimeType),u="match forced by supplied MIME type "+(null==r?void 0:r.mimeType));var c;s=s||function(e,t){const r=t&&Ho.exec(t),n=r&&r[1];return n?function(e,t){t=t.toLowerCase();for(const r of e)for(const e of r.extensions)if(e.toLowerCase()===t)return r;return null}(e,n):null}(t,o),u=u||(s?"matched url "+o:""),s=s||Ko(t,a),u=u||(s?"matched MIME type "+a:""),s=s||function(e,t){if(!t)return null;for(const r of e)if("string"==typeof t){if(Jo(t,r))return r}else if(ArrayBuffer.isView(t)){if(Qo(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer){if(Qo(t,0,r))return r}return null}(t,e),u=u||(s?"matched initial data "+Yo(e):""),s=s||Ko(t,null==r?void 0:r.fallbackMimeType),u=u||(s?"matched fallback MIME type "+a:""),u&&Uo.log(1,`selectLoader selected ${null===(c=s)||void 0===c?void 0:c.name}: ${u}.`);return s}(e,i,r,n);if(!(a||null!=r&&r.nothrow))throw new Error(Wo(e));return a}function Vo(e){return!(e instanceof Response&&204===e.status)}function Wo(e){const{url:t,type:r}=ra(e);let i="No valid loader found (";i+=t?n.filename(t)+", ":"no url provided, ",i+=`MIME type: ${r?`"${r}"`:"not provided"}, `;const a=e?Yo(e):"";return i+=a?` first bytes: "${a}"`:"first bytes: not available",i+=")",i}function Ko(e,t){for(const r of e){if(r.mimeTypes&&r.mimeTypes.includes(t))return r;if(t==="application/x."+r.id)return r}return null}function Jo(e,t){if(t.testText)return t.testText(e);return(Array.isArray(t.tests)?t.tests:[t.tests]).some(t=>e.startsWith(t))}function Qo(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(n=>function(e,t,r,n){if(n instanceof ArrayBuffer)return function(e,t,r){if(r=r||e.byteLength,e.byteLength<r||t.byteLength<r)return!1;const n=new Uint8Array(e),i=new Uint8Array(t);for(let e=0;e<n.length;++e)if(n[e]!==i[e])return!1;return!0}(n,e,n.byteLength);switch(typeof n){case"function":return n(e,r);case"string":const i=$o(e,t,n.length);return n===i;default:return!1}}(e,t,r,n))}function Yo(e,t=5){if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return $o(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return $o(e,0,t)}return""}function $o(e,t,r){if(e.byteLength<t+r)return"";const n=new DataView(e);let i="";for(let e=0;e<r;e++)i+=String.fromCharCode(n.getUint8(t+e));return i}async function Xo(e,t,r,n){va(!n||"object"==typeof n),!t||Array.isArray(t)||Wi(t)||(n=void 0,r=t,t=void 0),e=await e,r=r||{};const{url:i}=ra(e),a=function(e,t){if(!t&&e&&!Array.isArray(e))return e;let r;if(e&&(r=Array.isArray(e)?e:[e]),t&&t.loaders){const e=Array.isArray(t.loaders)?t.loaders:[t.loaders];r=r?[...r,...e]:e}return r&&r.length?r:null}(t,n),o=await async function(e,t=[],r,n){if(!Vo(e))return null;let i=Go(e,t,{...r,nothrow:!0},n);if(i)return i;if(Hi(e)&&(i=Go(e=await e.slice(0,10).arrayBuffer(),t,r,n)),!(i||null!=r&&r.nothrow))throw new Error(Wo(e));return i}(e,a,r);return o?(n=function(e,t,r=null){if(r)return r;const n={fetch:da(t,e),...e};return Array.isArray(n.loaders)||(n.loaders=null),n}({url:i,parse:Xo,loaders:a},r=fa(r,o,a,i),n),await async function(e,t,r,n){if(function(e,t="3.3.0-alpha.3"){va(e,"no worker provided");const r=e.version}(e),qi(t)){const e=t,{ok:r,redirected:i,status:a,statusText:o,type:s,url:u}=e,c=Object.fromEntries(e.headers.entries());n.response={headers:c,ok:r,redirected:i,status:a,statusText:o,type:s,url:u}}if(t=await ro(t,e,r),e.parseTextSync&&"string"==typeof t)return r.dataType="text",e.parseTextSync(t,r,n,e);if(function(e,t){return!!za.isSupported()&&(!!(ka||null!=t&&t._nodeWorkers)&&(e.worker&&(null==t?void 0:t.worker)))}(e,r))return await qa(e,t,r,n,Xo);if(e.parseText&&"string"==typeof t)return await e.parseText(t,r,n,e);if(e.parse)return await e.parse(t,r,n,e);throw va(!e.parseSync),new Error(e.id+" loader - no parser found and worker is disabled")}(o,e,r,n)):null}async function Zo(e,t,r,n){Array.isArray(t)||Wi(t)||(void 0,r=t,t=void 0);const i=da(r);let a=e;return"string"==typeof e&&(a=await i(e)),Hi(e)&&(a=await i(e)),await Xo(a,t,r)}function es(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}const ts=1/Math.PI*180,rs=1/180*Math.PI,ns={};function is(e,{precision:t=ns.precision||4}={}){return e=function(e){return Math.round(e/ns.EPSILON)*ns.EPSILON}(e),"".concat(parseFloat(e.toPrecision(t)))}function as(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function os(e,t,r){if(as(e)){r=r||((n=e).clone?n.clone():new Array(n.length));for(let n=0;n<r.length&&n<e.length;++n)r[n]=t(e[n],n,r);return r}var n;return t(e)}function ss(e){return function(e,t){return os(e,e=>e*rs,t)}(e)}function us(e){return cs(e)}function cs(e,t){return os(e,e=>e*ts,t)}function ls(e,t,r){return os(e,e=>Math.max(t,Math.min(r,e)))}function hs(e,t,r){const n=ns.EPSILON;r&&(ns.EPSILON=r);try{if(e===t)return!0;if(as(e)&&as(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!hs(e[r],t[r]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):!(!Number.isFinite(e)||!Number.isFinite(t))&&Math.abs(e-t)<=ns.EPSILON*Math.max(1,Math.abs(e),Math.abs(t))}finally{ns.EPSILON=n}}ns.EPSILON=1e-12,ns.debug=!1,ns.precision=4,ns.printTypes=!1,ns.printDegrees=!1,ns.printRowMajor=!0;class ps extends(function(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Array)){get ELEMENTS(){return es(!1),0}clone(){return(new this.constructor).copy(this)}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}fromArray(e,t=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=e[r+t];return this.check()}to(e){return e===this?this:as(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toArray(e=[],t=0){for(let r=0;r<this.ELEMENTS;++r)e[t+r]=this[r];return e}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(ns)}formatString(e){let t="";for(let r=0;r<this.ELEMENTS;++r)t+=(r>0?", ":"")+is(this[r],e);return"".concat(e.printTypes?this.constructor.name:"","[").concat(t,"]")}equals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!hs(this[t],e[t]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,t,r){void 0===r&&(r=t,t=e,e=this);for(let n=0;n<this.ELEMENTS;++n){const i=e[n];this[n]=i+r*(t[n]-i)}return this.check()}min(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}max(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}clamp(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e[r]),t[r]);return this.check()}add(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]+=t[e];return this.check()}subtract(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]-=t[e];return this.check()}scale(e){if(Array.isArray(e))return this.multiply(e);for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}sub(e){return this.subtract(e)}setScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=e;return this.check()}addScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}divideScalar(e){return this.scale(1/e)}clampScalar(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e),t);return this.check()}multiplyByScalar(e){return this.scale(e)}get elements(){return this}check(){if(ns.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 t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}}function fs(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(e));return e}function ds(e,t,r=""){if(ns.debug&&!function(e,t){if(e.length!==t)return!1;for(let t=0;t<e.length;++t)if(!Number.isFinite(e[t]))return!1;return!0}(e,t))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return e}const ms={};function gs(e,t){ms[e]||(ms[e]=!0,console.warn("".concat(e," has been removed in version ").concat(t,", see upgrade guide for more information")))}class ys extends ps{get ELEMENTS(){return es(!1),0}copy(e){return es(!1),this}get x(){return this[0]}set x(e){this[0]=fs(e)}get y(){return this[1]}set y(e){this[1]=fs(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let t=0;t<this.ELEMENTS;++t)e+=this[t]*this[t];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let t=0;for(let r=0;r<this.ELEMENTS;++r){const n=this[r]-e[r];t+=n*n}return fs(t)}dot(e){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*e[r];return fs(t)}normalize(){const e=this.magnitude();if(0!==e)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e;return this.check()}multiply(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]*=t[e];return this.check()}divide(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t[e];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return es(e>=0&&e<this.ELEMENTS,"index is out of range"),fs(this[e])}setComponent(e,t){return es(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=t,this.check()}addVectors(e,t){return this.copy(e).add(t)}subVectors(e,t){return this.copy(e).subtract(t)}multiplyVectors(e,t){return this.copy(e).multiply(t)}addScaledVector(e,t){return this.add(new this.constructor(e).multiplyScalar(t))}}var bs=1e-6,vs="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;Math.PI;function ws(){var e=new vs(3);return vs!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function _s(e){var t=e[0],r=e[1],n=e[2];return Math.hypot(t,r,n)}function ks(e,t,r){var n=new vs(3);return n[0]=e,n[1]=t,n[2]=r,n}function xs(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Es(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2];return e[0]=i*u-a*s,e[1]=a*o-n*u,e[2]=n*s-i*o,e}function As(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,e}function Ss(e,t,r){var n=t[0],i=t[1],a=t[2];return e[0]=n*r[0]+i*r[3]+a*r[6],e[1]=n*r[1]+i*r[4]+a*r[7],e[2]=n*r[2]+i*r[5]+a*r[8],e}function js(e,t,r){var n=r[0],i=r[1],a=r[2],o=r[3],s=t[0],u=t[1],c=t[2],l=i*c-a*u,h=a*s-n*c,p=n*u-i*s,f=i*p-a*h,d=a*l-n*p,m=n*h-i*l,g=2*o;return l*=g,h*=g,p*=g,f*=2,d*=2,m*=2,e[0]=s+l+f,e[1]=u+h+d,e[2]=c+p+m,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Ts,Cs=_s;Ts=ws();function Bs(e,t,r){const n=t[0],i=t[1],a=r[3]*n+r[7]*i||1;return e[0]=(r[0]*n+r[4]*i)/a,e[1]=(r[1]*n+r[5]*i)/a,e}function Rs(e,t,r){const n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a||1;return e[0]=(r[0]*n+r[4]*i+r[8]*a)/o,e[1]=(r[1]*n+r[5]*i+r[9]*a)/o,e[2]=(r[2]*n+r[6]*i+r[10]*a)/o,e}function Os(e,t,r){const n=t[0],i=t[1],a=t[2];return e[0]=r[0]*n+r[3]*i+r[6]*a,e[1]=r[1]*n+r[4]*i+r[7]*a,e[2]=r[2]*n+r[5]*i+r[8]*a,e[3]=t[3],e}const Is=[0,0,0],Ps={};class Ds extends ys{static get ZERO(){return Ps.ZERO=Ps.ZERO||Object.freeze(new Ds(0,0,0,0))}constructor(e=0,t=0,r=0){super(-0,-0,-0),1===arguments.length&&as(e)?this.copy(e):(ns.debug&&(fs(e),fs(t),fs(r)),this[0]=e,this[1]=t,this[2]=r)}set(e,t,r){return this[0]=e,this[1]=t,this[2]=r,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return ns.debug&&(fs(e.x),fs(e.y),fs(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]=fs(e)}angle(e){return r=e,n=(t=this)[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],c=Math.sqrt(n*n+i*i+a*a)*Math.sqrt(o*o+s*s+u*u),l=c&&xs(t,r)/c,Math.acos(Math.min(Math.max(l,-1),1));var t,r,n,i,a,o,s,u,c,l}cross(e){return Es(this,this,e),this.check()}rotateX({radians:e,origin:t=Is}){var r,n,i,a,o,s;return r=this,i=t,a=e,s=[],(o=[])[0]=(n=this)[0]-i[0],o[1]=n[1]-i[1],o[2]=n[2]-i[2],s[0]=o[0],s[1]=o[1]*Math.cos(a)-o[2]*Math.sin(a),s[2]=o[1]*Math.sin(a)+o[2]*Math.cos(a),r[0]=s[0]+i[0],r[1]=s[1]+i[1],r[2]=s[2]+i[2],this.check()}rotateY({radians:e,origin:t=Is}){var r,n,i,a,o,s;return r=this,i=t,a=e,s=[],(o=[])[0]=(n=this)[0]-i[0],o[1]=n[1]-i[1],o[2]=n[2]-i[2],s[0]=o[2]*Math.sin(a)+o[0]*Math.cos(a),s[1]=o[1],s[2]=o[2]*Math.cos(a)-o[0]*Math.sin(a),r[0]=s[0]+i[0],r[1]=s[1]+i[1],r[2]=s[2]+i[2],this.check()}rotateZ({radians:e,origin:t=Is}){var r,n,i,a,o,s;return r=this,i=t,a=e,s=[],(o=[])[0]=(n=this)[0]-i[0],o[1]=n[1]-i[1],o[2]=n[2]-i[2],s[0]=o[0]*Math.cos(a)-o[1]*Math.sin(a),s[1]=o[0]*Math.sin(a)+o[1]*Math.cos(a),s[2]=o[2],r[0]=s[0]+i[0],r[1]=s[1]+i[1],r[2]=s[2]+i[2],this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return As(this,this,e),this.check()}transformAsVector(e){return Rs(this,this,e),this.check()}transformByMatrix3(e){return Ss(this,this,e),this.check()}transformByMatrix2(e){return function(e,t,r){const n=t[0],i=t[1];e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2]}(this,this,e),this.check()}transformByQuaternion(e){return js(this,this,e),this.check()}}class Ms extends ps{get ELEMENTS(){return es(!1),0}get RANK(){return es(!1),0}toString(){let e="[";if(ns.printRowMajor){e+="row-major:";for(let t=0;t<this.RANK;++t)for(let r=0;r<this.RANK;++r)e+=" ".concat(this[r*this.RANK+t])}else{e+="column-major:";for(let t=0;t<this.ELEMENTS;++t)e+=" ".concat(this[t])}return e+="]",e}getElementIndex(e,t){return t*this.RANK+e}getElement(e,t){return this[t*this.RANK+e]}setElement(e,t,r){return this[t*this.RANK+e]=fs(r),this}getColumn(e,t=new Array(this.RANK).fill(-0)){const r=e*this.RANK;for(let e=0;e<this.RANK;++e)t[e]=this[r+e];return t}setColumn(e,t){const r=e*this.RANK;for(let e=0;e<this.RANK;++e)this[r+e]=t[e];return this}}function Fs(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],h=t[8],p=t[9],f=t[10],d=t[11],m=t[12],g=t[13],y=t[14],b=t[15],v=r[0],w=r[1],_=r[2],k=r[3];return e[0]=v*n+w*s+_*h+k*m,e[1]=v*i+w*u+_*p+k*g,e[2]=v*a+w*c+_*f+k*y,e[3]=v*o+w*l+_*d+k*b,v=r[4],w=r[5],_=r[6],k=r[7],e[4]=v*n+w*s+_*h+k*m,e[5]=v*i+w*u+_*p+k*g,e[6]=v*a+w*c+_*f+k*y,e[7]=v*o+w*l+_*d+k*b,v=r[8],w=r[9],_=r[10],k=r[11],e[8]=v*n+w*s+_*h+k*m,e[9]=v*i+w*u+_*p+k*g,e[10]=v*a+w*c+_*f+k*y,e[11]=v*o+w*l+_*d+k*b,v=r[12],w=r[13],_=r[14],k=r[15],e[12]=v*n+w*s+_*h+k*m,e[13]=v*i+w*u+_*p+k*g,e[14]=v*a+w*c+_*f+k*y,e[15]=v*o+w*l+_*d+k*b,e}function Ls(e,t,r){var n=r[0],i=r[1],a=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Ns(e,t){var r=t[0],n=t[1],i=t[2],a=t[4],o=t[5],s=t[6],u=t[8],c=t[9],l=t[10];return e[0]=Math.hypot(r,n,i),e[1]=Math.hypot(a,o,s),e[2]=Math.hypot(u,c,l),e}function zs(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e}function Us(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e}!function(){var e,t=(e=new vs(2),vs!=Float32Array&&(e[0]=0,e[1]=0),e)}();function qs(e){var t=e[0],r=e[1],n=e[2],i=e[3];return Math.hypot(t,r,n,i)}function Hs(e){var t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}!function(){var e,t=(e=new vs(4),vs!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e)}();const Gs=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Vs=Object.freeze([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Ws=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL0ROW3:3,COL1ROW0:4,COL1ROW1:5,COL1ROW2:6,COL1ROW3:7,COL2ROW0:8,COL2ROW1:9,COL2ROW2:10,COL2ROW3:11,COL3ROW0:12,COL3ROW1:13,COL3ROW2:14,COL3ROW3:15}),Ks={};class Js extends Ms{static get IDENTITY(){return Ks.IDENTITY=Ks.IDENTITY||Object.freeze(new Js(Gs)),Ks.IDENTITY}static get ZERO(){return Ks.ZERO=Ks.ZERO||Object.freeze(new Js(Vs)),Ks.ZERO}get INDICES(){return Ws}get ELEMENTS(){return 16}get RANK(){return 4}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&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,t,r,n,i,a,o,s,u,c,l,h,p,f,d,m){return this[0]=e,this[1]=t,this[2]=r,this[3]=n,this[4]=i,this[5]=a,this[6]=o,this[7]=s,this[8]=u,this[9]=c,this[10]=l,this[11]=h,this[12]=p,this[13]=f,this[14]=d,this[15]=m,this.check()}setRowMajor(e,t,r,n,i,a,o,s,u,c,l,h,p,f,d,m){return this[0]=e,this[1]=i,this[2]=u,this[3]=p,this[4]=t,this[5]=a,this[6]=c,this[7]=f,this[8]=r,this[9]=o,this[10]=l,this[11]=d,this[12]=n,this[13]=s,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(Gs)}fromQuaternion(e){return function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,h=n*s,p=i*o,f=i*s,d=i*u,m=a*o,g=a*s,y=a*u;e[0]=1-h-d,e[1]=l+y,e[2]=p-g,e[3]=0,e[4]=l-y,e[5]=1-c-d,e[6]=f+m,e[7]=0,e[8]=p+g,e[9]=f-m,e[10]=1-c-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(this,e),this.check()}frustum({left:e,right:t,bottom:r,top:n,near:i,far:a}){return a===1/0?Js._computeInfinitePerspectiveOffCenter(this,e,t,r,n,i):function(e,t,r,n,i,a,o){var s=1/(r-t),u=1/(i-n),c=1/(a-o);e[0]=2*a*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*a*u,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(i+n)*u,e[10]=(o+a)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*a*2*c,e[15]=0}(this,e,t,r,n,i,a),this.check()}static _computeInfinitePerspectiveOffCenter(e,t,r,n,i,a){const o=2*a/(r-t),s=2*a/(i-n),u=(r+t)/(r-t),c=(i+n)/(i-n),l=-2*a;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=u,e[9]=c,e[10]=-1,e[11]=-1,e[12]=0,e[13]=0,e[14]=l,e[15]=0,e}lookAt(e,t,r){return 1===arguments.length&&({eye:e,center:t,up:r}=e),function(e,t,r,n){var i,a,o,s,u,c,l,h,p,f,d=t[0],m=t[1],g=t[2],y=n[0],b=n[1],v=n[2],w=r[0],_=r[1],k=r[2];Math.abs(d-w)<bs&&Math.abs(m-_)<bs&&Math.abs(g-k)<bs?function(e){e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(e):(l=d-w,h=m-_,p=g-k,i=b*(p*=f=1/Math.hypot(l,h,p))-v*(h*=f),a=v*(l*=f)-y*p,o=y*h-b*l,(f=Math.hypot(i,a,o))?(i*=f=1/f,a*=f,o*=f):(i=0,a=0,o=0),s=h*o-p*a,u=p*i-l*o,c=l*a-h*i,(f=Math.hypot(s,u,c))?(s*=f=1/f,u*=f,c*=f):(s=0,u=0,c=0),e[0]=i,e[1]=s,e[2]=l,e[3]=0,e[4]=a,e[5]=u,e[6]=h,e[7]=0,e[8]=o,e[9]=c,e[10]=p,e[11]=0,e[12]=-(i*d+a*m+o*g),e[13]=-(s*d+u*m+c*g),e[14]=-(l*d+h*m+p*g),e[15]=1)}(this,e,t=t||[0,0,0],r=r||[0,1,0]),this.check()}ortho({left:e,right:t,bottom:r,top:n,near:i=.1,far:a=500}){return function(e,t,r,n,i,a,o){var s=1/(t-r),u=1/(n-i),c=1/(a-o);e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+r)*s,e[13]=(i+n)*u,e[14]=(o+a)*c,e[15]=1}(this,e,t,r,n,i,a),this.check()}orthographic({fovy:e=45*Math.PI/180,aspect:t=1,focalDistance:r=1,near:n=.1,far:i=500}){if(e>2*Math.PI)throw Error("radians");const a=e/2,o=r*Math.tan(a),s=o*t;return(new Js).ortho({left:-s,right:s,bottom:-o,top:o,near:n,far:i})}perspective({fovy:e,fov:t=45*Math.PI/180,aspect:r=1,near:n=.1,far:i=500}={}){if((e=e||t)>2*Math.PI)throw Error("radians");return function(e,t,r,n,i){var a,o=1/Math.tan(t/2);e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=i&&i!==1/0?(a=1/(n-i),e[10]=(i+n)*a,e[14]=2*i*n*a):(e[10]=-1,e[14]=-2*n)}(this,e,r,n,i),this.check()}determinant(){return t=(e=this)[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8],l=e[9],h=e[10],p=e[11],f=e[12],d=e[13],m=e[14],g=e[15],(t*o-r*a)*(h*g-p*m)-(t*s-n*a)*(l*g-p*d)+(t*u-i*a)*(l*m-h*d)+(r*s-n*o)*(c*g-p*f)-(r*u-i*o)*(c*m-h*f)+(n*u-i*s)*(c*d-l*f);var e,t,r,n,i,a,o,s,u,c,l,h,p,f,d,m,g}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=[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=null){const r=this.getScale(t||[-0,-0,-0]),n=1/r[0],i=1/r[1],a=1/r[2];return e[0]=this[0]*n,e[1]=this[1]*i,e[2]=this[2]*a,e[3]=0,e[4]=this[4]*n,e[5]=this[5]*i,e[6]=this[6]*a,e[7]=0,e[8]=this[8]*n,e[9]=this[9]*i,e[10]=this[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e=[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=null){const r=this.getScale(t||[-0,-0,-0]),n=1/r[0],i=1/r[1],a=1/r[2];return e[0]=this[0]*n,e[1]=this[1]*i,e[2]=this[2]*a,e[3]=this[4]*n,e[4]=this[5]*i,e[5]=this[6]*a,e[6]=this[8]*n,e[7]=this[9]*i,e[8]=this[10]*a,e}transpose(){return function(e,t){if(e===t){var r=t[1],n=t[2],i=t[3],a=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=a,e[11]=t[14],e[12]=i,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15]}(this,this),this.check()}invert(){var e,t,r,n,i,a,o,s,u,c,l,h,p,f,d,m,g,y,b,v,w,_,k,x,E,A,S,j,T,C,B;return e=this,r=(t=this)[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],h=t[9],p=t[10],f=t[11],d=t[12],m=t[13],g=t[14],y=t[15],(B=(b=r*s-n*o)*(C=p*y-f*g)-(v=r*u-i*o)*(T=h*y-f*m)+(w=r*c-a*o)*(j=h*g-p*m)+(_=n*u-i*s)*(S=l*y-f*d)-(k=n*c-a*s)*(A=l*g-p*d)+(x=i*c-a*u)*(E=l*m-h*d))&&(B=1/B,e[0]=(s*C-u*T+c*j)*B,e[1]=(i*T-n*C-a*j)*B,e[2]=(m*x-g*k+y*_)*B,e[3]=(p*k-h*x-f*_)*B,e[4]=(u*S-o*C-c*A)*B,e[5]=(r*C-i*S+a*A)*B,e[6]=(g*w-d*x-y*v)*B,e[7]=(l*x-p*w+f*v)*B,e[8]=(o*T-s*S+c*E)*B,e[9]=(n*S-r*T-a*E)*B,e[10]=(d*k-m*w+y*b)*B,e[11]=(h*w-l*k-f*b)*B,e[12]=(s*A-o*j-u*E)*B,e[13]=(r*j-n*A+i*E)*B,e[14]=(m*v-d*_-g*b)*B,e[15]=(l*_-h*v+p*b)*B),this.check()}multiplyLeft(e){return Fs(this,e,this),this.check()}multiplyRight(e){return Fs(this,this,e),this.check()}rotateX(e){var t,r,n,i,a,o,s,u,c,l,h,p,f;return t=this,r=this,n=e,i=Math.sin(n),a=Math.cos(n),o=r[4],s=r[5],u=r[6],c=r[7],l=r[8],h=r[9],p=r[10],f=r[11],r!==t&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[4]=o*a+l*i,t[5]=s*a+h*i,t[6]=u*a+p*i,t[7]=c*a+f*i,t[8]=l*a-o*i,t[9]=h*a-s*i,t[10]=p*a-u*i,t[11]=f*a-c*i,this.check()}rotateY(e){var t,r,n,i,a,o,s,u,c,l,h,p,f;return t=this,r=this,n=e,i=Math.sin(n),a=Math.cos(n),o=r[0],s=r[1],u=r[2],c=r[3],l=r[8],h=r[9],p=r[10],f=r[11],r!==t&&(t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*a-l*i,t[1]=s*a-h*i,t[2]=u*a-p*i,t[3]=c*a-f*i,t[8]=o*i+l*a,t[9]=s*i+h*a,t[10]=u*i+p*a,t[11]=c*i+f*a,this.check()}rotateZ(e){var t,r,n,i,a,o,s,u,c,l,h,p,f;return t=this,r=this,n=e,i=Math.sin(n),a=Math.cos(n),o=r[0],s=r[1],u=r[2],c=r[3],l=r[4],h=r[5],p=r[6],f=r[7],r!==t&&(t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*a+l*i,t[1]=s*a+h*i,t[2]=u*a+p*i,t[3]=c*a+f*i,t[4]=l*a-o*i,t[5]=h*a-s*i,t[6]=p*a-u*i,t[7]=f*a-c*i,this.check()}rotateXYZ([e,t,r]){return this.rotateX(e).rotateY(t).rotateZ(r)}rotateAxis(e,t){return function(e,t,r,n){var i,a,o,s,u,c,l,h,p,f,d,m,g,y,b,v,w,_,k,x,E,A,S,j,T=n[0],C=n[1],B=n[2],R=Math.hypot(T,C,B);R<bs||(T*=R=1/R,C*=R,B*=R,i=Math.sin(r),o=1-(a=Math.cos(r)),s=t[0],u=t[1],c=t[2],l=t[3],h=t[4],p=t[5],f=t[6],d=t[7],m=t[8],g=t[9],y=t[10],b=t[11],v=T*T*o+a,w=C*T*o+B*i,_=B*T*o-C*i,k=T*C*o-B*i,x=C*C*o+a,E=B*C*o+T*i,A=T*B*o+C*i,S=C*B*o-T*i,j=B*B*o+a,e[0]=s*v+h*w+m*_,e[1]=u*v+p*w+g*_,e[2]=c*v+f*w+y*_,e[3]=l*v+d*w+b*_,e[4]=s*k+h*x+m*E,e[5]=u*k+p*x+g*E,e[6]=c*k+f*x+y*E,e[7]=l*k+d*x+b*E,e[8]=s*A+h*S+m*j,e[9]=u*A+p*S+g*j,e[10]=c*A+f*S+y*j,e[11]=l*A+d*S+b*j,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]))}(this,this,e,t),this.check()}scale(e){return Array.isArray(e)?Ls(this,this,e):Ls(this,this,[e,e,e]),this.check()}translate(e){var t,r,n,i,a,o,s,u,c,l,h,p,f,d,m,g,y,b;return t=this,r=this,g=(n=e)[0],y=n[1],b=n[2],r===t?(t[12]=r[0]*g+r[4]*y+r[8]*b+r[12],t[13]=r[1]*g+r[5]*y+r[9]*b+r[13],t[14]=r[2]*g+r[6]*y+r[10]*b+r[14],t[15]=r[3]*g+r[7]*y+r[11]*b+r[15]):(i=r[0],a=r[1],o=r[2],s=r[3],u=r[4],c=r[5],l=r[6],h=r[7],p=r[8],f=r[9],d=r[10],m=r[11],t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=u,t[5]=c,t[6]=l,t[7]=h,t[8]=p,t[9]=f,t[10]=d,t[11]=m,t[12]=i*g+u*y+p*b+r[12],t[13]=a*g+c*y+f*b+r[13],t[14]=o*g+l*y+d*b+r[14],t[15]=s*g+h*y+m*b+r[15]),this.check()}transform(e,t){return 4===e.length?(r=t||[-0,-0,-0,-0],i=this,a=(n=e)[0],o=n[1],s=n[2],u=n[3],r[0]=i[0]*a+i[4]*o+i[8]*s+i[12]*u,r[1]=i[1]*a+i[5]*o+i[9]*s+i[13]*u,r[2]=i[2]*a+i[6]*o+i[10]*s+i[14]*u,r[3]=i[3]*a+i[7]*o+i[11]*s+i[15]*u,ds(t=r,4),t):this.transformAsPoint(e,t);var r,n,i,a,o,s,u}transformAsPoint(e,t){const{length:r}=e;switch(r){case 2:t=Us(t||[-0,-0],e,this);break;case 3:t=As(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ds(t,e.length),t}transformAsVector(e,t){switch(e.length){case 2:t=Bs(t||[-0,-0],e,this);break;case 3:t=Rs(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ds(t,e.length),t}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,t,r){return this.identity().translate([e,t,r])}transformPoint(e,t){return gs("Matrix4.transformPoint","3.0"),this.transformAsPoint(e,t)}transformVector(e,t){return gs("Matrix4.transformVector","3.0"),this.transformAsPoint(e,t)}transformDirection(e,t){return gs("Matrix4.transformDirection","3.0"),this.transformAsVector(e,t)}}var Qs=.1,Ys=1e-12,$s=1e-15,Xs=1e-20;Math.PI,Math.PI,Math.PI,Math.PI;Math.max(6378137,6378137,6356752.314245179);const Zs=e=>e,eu=new Ds;function tu(e,t,r=Zs){return as(e)?(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]):"longitude"in e?(t[0]=r(e.longitude),t[1]=r(e.latitude),t[2]=e.height):(t[0]=r(e.x),t[1]=r(e.y),t[2]=e.z),t}function ru(e,t,r=Zs){return as(t)?(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]):"longitude"in t?(t.longitude=r(e[0]),t.latitude=r(e[1]),t.height=e[2]):(t.x=r(e[0]),t.y=r(e[1]),t.z=e[2]),t}const nu=new Ds,iu=new Ds,au=new Ds;const ou=new Ds,su={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"}},uu={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},cu={east:new Ds,north:new Ds,up:new Ds,west:new Ds,south:new Ds,down:new Ds},lu=new Ds,hu=new Ds,pu=new Ds;function fu(e,t,r,n,i,a){const o=su[t]&&su[t][r];let s,u,c;es(o&&(!n||n===o));const l=ou.copy(i);if(hs(l.x,0,1e-14)&&hs(l.y,0,1e-14)){const e=Math.sign(l.z);s=lu.fromArray(uu[t]),"east"!==t&&"west"!==t&&s.scale(e),u=hu.fromArray(uu[r]),"east"!==r&&"west"!==r&&u.scale(e),c=pu.fromArray(uu[n]),"east"!==n&&"west"!==n&&c.scale(e)}else{const{up:i,east:a,north:o}=cu;a.set(-l.y,l.x,0).normalize(),e.geodeticSurfaceNormal(l,i),o.copy(i).cross(a);const{down:h,west:p,south:f}=cu;h.copy(i).scale(-1),p.copy(a).scale(-1),f.copy(o).scale(-1),s=cu[t],u=cu[r],c=cu[n]}return a[0]=s.x,a[1]=s.y,a[2]=s.z,a[3]=0,a[4]=u.x,a[5]=u.y,a[6]=u.z,a[7]=0,a[8]=c.x,a[9]=c.y,a[10]=c.z,a[11]=0,a[12]=l.x,a[13]=l.y,a[14]=l.z,a[15]=1,a}const du=new Ds,mu=new Ds,gu=new Ds,yu=new Ds,bu=new Ds,vu=new Ds;let wu;class _u{static get WGS84(){return wu=wu||new _u(6378137,6378137,6356752.314245179),wu}constructor(e=0,t=0,r=0){es(e>=0),es(t>=0),es(r>=0),this.radii=new Ds(e,t,r),this.radiiSquared=new Ds(e*e,t*t,r*r),this.radiiToTheFourth=new Ds(e*e*e*e,t*t*t*t,r*r*r*r),this.oneOverRadii=new Ds(0===e?0:1/e,0===t?0:1/t,0===r?0:1/r),this.oneOverRadiiSquared=new Ds(0===e?0:1/(e*e),0===t?0:1/(t*t),0===r?0:1/(r*r)),this.minimumRadius=Math.min(e,t,r),this.maximumRadius=Math.max(e,t,r),this.centerToleranceSquared=Qs,0!==this.radiiSquared.z&&(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,t=[0,0,0]){const r=mu,n=gu,[,,i]=e;this.geodeticSurfaceNormalCartographic(e,r),n.copy(this.radiiSquared).scale(r);const a=Math.sqrt(r.dot(n));return n.scale(1/a),r.scale(i),n.add(r),n.to(t)}cartesianToCartographic(e,t=[0,0,0]){vu.from(e);const r=this.scaleToGeodeticSurface(vu,yu);if(!r)return;const n=this.geodeticSurfaceNormal(r,mu),i=bu;i.copy(vu).subtract(r);const a=Math.atan2(n.y,n.x),o=Math.asin(n.z),s=Math.sign(xs(i,vu))*_s(i);return ru([a,o,s],t,ns._cartographicRadians?Zs:us)}eastNorthUpToFixedFrame(e,t=new Js){return fu(this,"east","north","up",e,t)}localFrameToFixedFrame(e,t,r,n,i=new Js){return fu(this,e,t,r,n,i)}geocentricSurfaceNormal(e,t=[0,0,0]){return du.from(e).normalize().to(t)}geodeticSurfaceNormalCartographic(e,t=[0,0,0]){const r=function(e,t=eu){return tu(e,t,ns._cartographicRadians?Zs:ss)}(e),n=r[0],i=r[1],a=Math.cos(i);return du.set(a*Math.cos(n),a*Math.sin(n),Math.sin(i)).normalize(),du.to(t)}geodeticSurfaceNormal(e,t=[0,0,0]){return du.from(e).scale(this.oneOverRadiiSquared).normalize().to(t)}scaleToGeodeticSurface(e,t){return function(e,t,r=new Ds){const{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:a}=t;nu.from(e);const o=e.x,s=e.y,u=e.z,c=n.x,l=n.y,h=n.z,p=o*o*c*c,f=s*s*l*l,d=u*u*h*h,m=p+f+d,g=Math.sqrt(1/m);if(!Number.isFinite(g))return;const y=iu;if(y.copy(e).scale(g),m<a)return y.to(r);const b=i.x,v=i.y,w=i.z,_=au;_.set(y.x*b*2,y.y*v*2,y.z*w*2);let k,x,E,A,S=(1-g)*e.len()/(.5*_.len()),j=0;do{S-=j,k=1/(1+S*b),x=1/(1+S*v),E=1/(1+S*w);const e=k*k,t=x*x,r=E*E;A=p*e+f*t+d*r-1;j=A/(-2*(p*(e*k)*b+f*(t*x)*v+d*(r*E)*w))}while(Math.abs(A)>Ys);return nu.scale([k,x,E]).to(r)}(e,this,t)}scaleToGeocentricSurface(e,t=[0,0,0]){yu.from(e);const r=yu.x,n=yu.y,i=yu.z,a=this.oneOverRadiiSquared,o=1/Math.sqrt(r*r*a.x+n*n*a.y+i*i*a.z);return yu.multiplyScalar(o).to(t)}transformPositionToScaledSpace(e,t=[0,0,0]){return yu.from(e).scale(this.oneOverRadii).to(t)}transformPositionFromScaledSpace(e,t=[0,0,0]){return yu.from(e).scale(this.radii).to(t)}getSurfaceNormalIntersectionWithZAxis(e,t=0,r=[0,0,0]){es(hs(this.radii.x,this.radii.y,$s)),es(this.radii.z>0),yu.from(e);const n=yu.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(n)>=this.radii.z-t))return yu.set(0,0,n).to(r)}}const{_parseImageNode:ku}=globalThis,xu="undefined"!=typeof Image,Eu="undefined"!=typeof ImageBitmap,Au=Boolean(ku),Su=!!Pi||Au;function ju(e){const t=Cu(e);if(!t)throw new Error("Not an image");return t}function Tu(e){switch(ju(e)){case"data":return e;case"image":case"imagebitmap":const t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Cu(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?"imagebitmap":"undefined"!=typeof Image&&e instanceof Image?"image":e&&"object"==typeof e&&e.data&&e.width&&e.height?"data":null}const Bu=/^data:image\/svg\+xml/,Ru=/\.svg((\?|#).*)?$/;function Ou(e){return e&&(Bu.test(e)||Ru.test(e))}function Iu(e,t){if(Ou(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Pu(e,t,r){const n=function(e,t){if(Ou(t)){let t=(new TextDecoder).decode(e);try{"function"==typeof unescape&&"function"==typeof encodeURIComponent&&(t=unescape(encodeURIComponent(t)))}catch(e){throw new Error(e.message)}return"data:image/svg+xml;base64,"+btoa(t)}return Iu(e,t)}(e,r),i=self.URL||self.webkitURL,a="string"!=typeof n&&i.createObjectURL(n);try{return await async function(e,t){const r=new Image;if(r.src=e,t.image&&t.image.decode&&r.decode)return await r.decode(),r;return await new Promise((t,n)=>{try{r.onload=()=>t(r),r.onerror=t=>n(new Error(`Could not load image ${e}: ${t}`))}catch(e){n(e)}})}(a||n,t)}finally{a&&i.revokeObjectURL(a)}}const Du={};let Mu=!0;async function Fu(e,t,r){let n;if(Ou(r)){n=await Pu(e,t,r)}else n=Iu(e,r);const i=t&&t.imagebitmap;return await async function(e,t=null){!function(e){for(const t in e||Du)return!1;return!0}(t)&&Mu||(t=null);if(t)try{return await createImageBitmap(e,t)}catch(e){console.warn(e),Mu=!1}return await createImageBitmap(e)}(n,i)}function Lu(e){const t=Nu(e);return function(e){const t=Nu(e);if(!(t.byteLength>=24&&2303741511===t.getUint32(0,!1)))return null;return{mimeType:"image/png",width:t.getUint32(16,!1),height:t.getUint32(20,!1)}}(t)||function(e){const t=Nu(e);if(!(t.byteLength>=3&&65496===t.getUint16(0,!1)&&255===t.getUint8(2)))return null;const{tableMarkers:r,sofMarkers:n}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let i=2;for(;i+9<t.byteLength;){const e=t.getUint16(i,!1);if(n.has(e))return{mimeType:"image/jpeg",height:t.getUint16(i+5,!1),width:t.getUint16(i+7,!1)};if(!r.has(e))return null;i+=2,i+=t.getUint16(i,!1)}return null}(t)||function(e){const t=Nu(e);if(!(t.byteLength>=10&&1195984440===t.getUint32(0,!1)))return null;return{mimeType:"image/gif",width:t.getUint16(6,!0),height:t.getUint16(8,!0)}}(t)||function(e){const t=Nu(e);if(!(t.byteLength>=14&&16973===t.getUint16(0,!1)&&t.getUint32(2,!0)===t.byteLength))return null;return{mimeType:"image/bmp",width:t.getUint32(18,!0),height:t.getUint32(22,!0)}}(t)}function Nu(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}const zu={id:"image",module:"images",name:"Images",version:"3.3.0-alpha.3",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:async function(e,t,r){const n=((t=t||{}).image||{}).type||"auto",{url:i}=r||{};let a;switch(function(e){switch(e){case"auto":case"data":return function(){if(Eu)return"imagebitmap";if(xu)return"image";if(Su)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(e){switch(e){case"auto":return Eu||xu||Su;case"imagebitmap":return Eu;case"image":return xu;case"data":return Su;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}(e),e}}(n)){case"imagebitmap":a=await Fu(e,t,i);break;case"image":a=await Pu(e,t,i);break;case"data":a=await async function(e,t){const{mimeType:r}=Lu(e)||{},n=globalThis._parseImageNode;return Vi(n),await n(e,r)}(e);break;default:Vi(!1)}return"data"===n&&(a=Tu(a)),a},tests:[e=>Boolean(Lu(new DataView(e)))],options:{image:{type:"auto",decode:!0}}},Uu={draco:{decoderType:"object"==typeof WebAssembly?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},qu={name:"Draco",id:ka?"draco":"draco-nodejs",module:"draco",shapes:["mesh"],version:"3.3.0-alpha.3",worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:Uu};function Hu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Gu{constructor(e,t){Hu(this,"fields",void 0),Hu(this,"metadata",void 0),function(e,t){if(!e)throw new Error(t||"loader assertion failed.")}(Array.isArray(e)),function(e){const t={};for(const r of e)t[r.name]&&console.warn("Schema: duplicated field name",r.name,r),t[r.name]=!0}(e),this.fields=e,this.metadata=t||new Map}compareTo(e){if(this.metadata!==e.metadata)return!1;if(this.fields.length!==e.fields.length)return!1;for(let t=0;t<this.fields.length;++t)if(!this.fields[t].compareTo(e.fields[t]))return!1;return!0}select(...e){const t=Object.create(null);for(const r of e)t[r]=!0;const r=this.fields.filter(e=>t[e.name]);return new Gu(r,this.metadata)}selectAt(...e){const t=e.map(e=>this.fields[e]).filter(Boolean);return new Gu(t,this.metadata)}assign(e){let t,r=this.metadata;if(e instanceof Gu){const n=e;t=n.fields,r=Vu(Vu(new Map,this.metadata),n.metadata)}else t=e;const n=Object.create(null);for(const e of this.fields)n[e.name]=e;for(const e of t)n[e.name]=e;const i=Object.values(n);return new Gu(i,r)}}function Vu(e,t){return new Map([...e||new Map,...t||new Map])}function Wu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ku{constructor(e,t,r=!1,n=new Map){Wu(this,"name",void 0),Wu(this,"type",void 0),Wu(this,"nullable",void 0),Wu(this,"metadata",void 0),this.name=e,this.type=t,this.nullable=r,this.metadata=n}get typeId(){return this.type&&this.type.typeId}clone(){return new Ku(this.name,this.type,this.nullable,this.metadata)}compareTo(e){return this.name===e.name&&this.type===e.type&&this.nullable===e.nullable&&this.metadata===e.metadata}toString(){return`${this.type}${this.nullable?", nullable":""}${this.metadata?", metadata: "+this.metadata:""}`}}let Ju,Qu,Yu,$u,Xu,Zu,ec,tc,rc;function nc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"}(Ju||(Ju={}));class ic{static isNull(e){return e&&e.typeId===Ju.Null}static isInt(e){return e&&e.typeId===Ju.Int}static isFloat(e){return e&&e.typeId===Ju.Float}static isBinary(e){return e&&e.typeId===Ju.Binary}static isUtf8(e){return e&&e.typeId===Ju.Utf8}static isBool(e){return e&&e.typeId===Ju.Bool}static isDecimal(e){return e&&e.typeId===Ju.Decimal}static isDate(e){return e&&e.typeId===Ju.Date}static isTime(e){return e&&e.typeId===Ju.Time}static isTimestamp(e){return e&&e.typeId===Ju.Timestamp}static isInterval(e){return e&&e.typeId===Ju.Interval}static isList(e){return e&&e.typeId===Ju.List}static isStruct(e){return e&&e.typeId===Ju.Struct}static isUnion(e){return e&&e.typeId===Ju.Union}static isFixedSizeBinary(e){return e&&e.typeId===Ju.FixedSizeBinary}static isFixedSizeList(e){return e&&e.typeId===Ju.FixedSizeList}static isMap(e){return e&&e.typeId===Ju.Map}static isDictionary(e){return e&&e.typeId===Ju.Dictionary}get typeId(){return Ju.NONE}compareTo(e){return this===e}}Symbol.toStringTag;Symbol.toStringTag;Qu=Symbol.toStringTag;class ac extends ic{constructor(e,t){super(),nc(this,"isSigned",void 0),nc(this,"bitWidth",void 0),this.isSigned=e,this.bitWidth=t}get typeId(){return Ju.Int}get[Qu](){return"Int"}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}class oc extends ac{constructor(){super(!0,8)}}class sc extends ac{constructor(){super(!0,16)}}class uc extends ac{constructor(){super(!0,32)}}class cc extends ac{constructor(){super(!1,8)}}class lc extends ac{constructor(){super(!1,16)}}class hc extends ac{constructor(){super(!1,32)}}const pc=32,fc=64;Yu=Symbol.toStringTag;class dc extends ic{constructor(e){super(),nc(this,"precision",void 0),this.precision=e}get typeId(){return Ju.Float}get[Yu](){return"Float"}toString(){return"Float"+this.precision}}class mc extends dc{constructor(){super(pc)}}class gc extends dc{constructor(){super(fc)}}Symbol.toStringTag;Symbol.toStringTag;$u=Symbol.toStringTag;Xu=Symbol.toStringTag;Zu=Symbol.toStringTag;ec=Symbol.toStringTag;tc=Symbol.toStringTag;class yc extends ic{constructor(e,t){super(),nc(this,"listSize",void 0),nc(this,"children",void 0),this.listSize=e,this.children=[t]}get typeId(){return Ju.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[tc](){return"FixedSizeList"}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}rc=Symbol.toStringTag;function bc(e,t,r){const n=function(e){switch(e.constructor){case Int8Array:return new oc;case Uint8Array:return new cc;case Int16Array:return new sc;case Uint16Array:return new lc;case Int32Array:return new uc;case Uint32Array:return new hc;case Float32Array:return new mc;case Float64Array:return new gc;default:throw new Error("array type not supported")}}(t.value),i=r||function(e){const t=new Map;"byteOffset"in e&&t.set("byteOffset",e.byteOffset.toString(10));"byteStride"in e&&t.set("byteStride",e.byteStride.toString(10));"normalized"in e&&t.set("normalized",e.normalized.toString());return t}(t);return new Ku(e,new yc(t.size,new Ku("value",n)),!1,i)}function vc(e,t,r){return bc(e,t,r?wc(r.metadata):void 0)}function wc(e){const t=new Map;for(const r in e)t.set(r+".string",JSON.stringify(e[r]));return t}function _c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const kc={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},xc={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class Ec{constructor(e){_c(this,"draco",void 0),_c(this,"decoder",void 0),_c(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,t={}){const r=new this.draco.DecoderBuffer;r.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(t);const n=this.decoder.GetEncodedGeometryType(r),i=n===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let e;switch(n){case this.draco.TRIANGULAR_MESH:e=this.decoder.DecodeBufferToMesh(r,i);break;case this.draco.POINT_CLOUD:e=this.decoder.DecodeBufferToPointCloud(r,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!e.ok()||!i.ptr){const t="DRACO decompression failed: "+e.error_msg();throw new Error(t)}const a=this._getDracoLoaderData(i,n,t),o=this._getMeshData(i,a,t),s=function(e){let t=1/0,r=1/0,n=1/0,i=-1/0,a=-1/0,o=-1/0;const s=e.POSITION?e.POSITION.value:[],u=s&&s.length;for(let e=0;e<u;e+=3){const u=s[e],c=s[e+1],l=s[e+2];t=u<t?u:t,r=c<r?c:r,n=l<n?l:n,i=u>i?u:i,a=c>a?c:a,o=l>o?l:o}return[[t,r,n],[i,a,o]]}(o.attributes),u=function(e,t,r){const n=wc(t.metadata),i=[],a=function(e){const t={};for(const r in e){const n=e[r];t[n.name||"undefined"]=n}return t}(t.attributes);for(const t in e){const r=vc(t,e[t],a[t]);i.push(r)}if(r){const e=vc("indices",r);i.push(e)}return new Gu(i,n)}(o.attributes,a,o.indices);return{loader:"draco",loaderData:a,header:{vertexCount:i.num_points(),boundingBox:s},...o,schema:u}}finally{this.draco.destroy(r),i&&this.draco.destroy(i)}}_getDracoLoaderData(e,t,r){const n=this._getTopLevelMetadata(e),i=this._getDracoAttributes(e,r);return{geometry_type:t,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:n,attributes:i}}_getDracoAttributes(e,t){const r={};for(let n=0;n<e.num_attributes();n++){const i=this.decoder.GetAttribute(e,n),a=this._getAttributeMetadata(e,n);r[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:n,metadata:a};const o=this._getQuantizationTransform(i,t);o&&(r[i.unique_id()].quantization_transform=o);const s=this._getOctahedronTransform(i,t);s&&(r[i.unique_id()].octahedron_transform=s)}return r}_getMeshData(e,t,r){const n=this._getMeshAttributes(t,e,r);if(!n.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:n,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:n,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:n}}_getMeshAttributes(e,t,r){const n={};for(const i of Object.values(e.attributes)){const e=this._deduceAttributeName(i,r);i.name=e;const{value:a,size:o}=this._getAttributeValues(t,i);n[e]={value:a,size:o,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}return n}_getTriangleListIndices(e){const t=3*e.num_faces(),r=4*t,n=this.draco._malloc(r);try{return this.decoder.GetTrianglesUInt32Array(e,r,n),new Uint32Array(this.draco.HEAPF32.buffer,n,t).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(e){const t=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,t),function(e){const t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}(t)}finally{this.draco.destroy(t)}}_getAttributeValues(e,t){const r=xc[t.data_type],n=t.num_components,i=e.num_points()*n,a=i*r.BYTES_PER_ELEMENT,o=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32;default:return e.DT_INVALID}}(this.draco,r);let s;const u=this.draco._malloc(a);try{const n=this.decoder.GetAttribute(e,t.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,n,o,a,u),s=new r(this.draco.HEAPF32.buffer,u,i).slice()}finally{this.draco._free(u)}return{value:s,size:n}}_deduceAttributeName(e,t){const r=e.unique_id;for(const[e,n]of Object.entries(t.extraAttributes||{}))if(n===r)return e;const n=e.attribute_type;for(const e in kc){if(this.draco[e]===n)return kc[e]}const i=t.attributeNameEntry||"name";return e.metadata[i]?e.metadata[i].string:"CUSTOM_ATTRIBUTE_"+r}_getTopLevelMetadata(e){const t=this.decoder.GetMetadata(e);return this._getDracoMetadata(t)}_getAttributeMetadata(e,t){const r=this.decoder.GetAttributeMetadata(e,t);return this._getDracoMetadata(r)}_getDracoMetadata(e){if(!e||!e.ptr)return{};const t={},r=this.metadataQuerier.NumEntries(e);for(let n=0;n<r;n++){const r=this.metadataQuerier.GetEntryName(e,n);t[r]=this._getDracoMetadataField(e,r)}return t}_getDracoMetadataField(e,t){const r=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,t,r);const n=function(e){const t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}(r);return{int:this.metadataQuerier.GetIntEntry(e,t),string:this.metadataQuerier.GetStringEntry(e,t),double:this.metadataQuerier.GetDoubleEntry(e,t),intArray:n}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(e){const{quantizedAttributes:t=[],octahedronAttributes:r=[]}=e,n=[...t,...r];for(const e of n)this.decoder.SkipAttributeTransform(this.draco[e])}_getQuantizationTransform(e,t){const{quantizedAttributes:r=[]}=t,n=e.attribute_type();if(r.map(e=>this.decoder[e]).includes(n)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits(),range:t.range(),min_values:new Float32Array([1,2,3]).map(e=>t.min_value(e))}}finally{this.draco.destroy(t)}}return null}_getOctahedronTransform(e,t){const{octahedronAttributes:r=[]}=t,n=e.attribute_type();if(r.map(e=>this.decoder[e]).includes(n)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits()}}finally{this.draco.destroy(t)}}return null}}var Ac=r(51);const Sc={};async function jc(e,t=null,r={}){return t&&(e=function(e,t,r){if(e.startsWith("http"))return e;const n=r.modules||{};if(n[e])return n[e];if(!ka)return`modules/${t}/dist/libs/${e}`;if(r.CDN)return va(r.CDN.startsWith("http")),`${r.CDN}/${t}@3.3.0-alpha.3/dist/libs/${e}`;if(xa)return"../src/libs/"+e;return`modules/${t}/src/libs/${e}`}(e,t,r)),Sc[e]=Sc[e]||async function(e){if(e.endsWith("wasm")){const t=await fetch(e);return await t.arrayBuffer()}if(!ka)try{return Ac&&Ac.requireFromFile&&await Ac.requireFromFile(e)}catch{return null}if(xa)return importScripts(e);const t=await fetch(e);return function(e,t){if(!ka)return Ac.requireFromString&&Ac.requireFromString(e,t);if(xa)return eval.call(_a,e),null;const r=document.createElement("script");r.id=t;try{r.appendChild(document.createTextNode(e))}catch(t){r.text=e}return document.body.appendChild(r),null}(await t.text(),e)}(e),await Sc[e]}let Tc;async function Cc(e){const t=e.modules||{};return Tc=t.draco3d?Tc||t.draco3d.createDecoderModule({}).then(e=>({draco:e})):Tc||async function(e){let t,r;switch(e.draco&&e.draco.decoderType){case"js":t=await jc("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.js","draco",e);break;case"wasm":default:[t,r]=await Promise.all([await jc("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_wasm_wrapper.js","draco",e),await jc("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.wasm","draco",e)])}return t=t||globalThis.DracoDecoderModule,await function(e,t){const r={};t&&(r.wasmBinary=t);return new Promise(t=>{e({...r,onModuleLoaded:e=>t({draco:e})})})}(t,r)}(e),await Tc}const Bc={id:ka?"draco-writer":"draco-writer-nodejs",name:"Draco compressed geometry writer",module:"draco",version:"3.3.0-alpha.3",worker:!0,options:{draco:{},source:null}},Rc={...qu,parse:async function(e,t){const{draco:r}=await Cc(t),n=new Ec(r);try{return n.parseSync(e,null==t?void 0:t.draco)}finally{n.destroy()}}};new Uint8Array([0]);const Oc=[171,75,84,88,32,50,48,187,13,10,26,10];var Ic,Pc,Dc,Mc,Fc,Lc,Nc,zc,Uc;(Uc=Ic||(Ic={}))[Uc.NONE=0]="NONE",Uc[Uc.BASISLZ=1]="BASISLZ",Uc[Uc.ZSTD=2]="ZSTD",Uc[Uc.ZLIB=3]="ZLIB",function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(Pc||(Pc={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(Dc||(Dc={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(Mc||(Mc={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(Fc||(Fc={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(Lc||(Lc={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(Nc||(Nc={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(zc||(zc={}));class qc{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=Ic.NONE,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:Pc.BASICFORMAT,versionNumber:2,descriptorBlockSize:40,colorModel:Dc.UNSPECIFIED,colorPrimaries:Mc.SRGB,transferFunction:Mc.SRGB,flags:Lc.ALPHA_STRAIGHT,texelBlockDimension:{x:4,y:4,z:1,w:1},bytesPlane:[],samples:[]}],this.keyValue={},this.globalData=null}}class Hc{constructor(e,t,r,n){this._dataView=new DataView(e.buffer,e.byteOffset+t,r),this._littleEndian=n,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const r=this._offset;let n=0;for(;this._dataView.getUint8(this._offset)!==t&&n<e;)n++,this._offset++;return n<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,n)}}function Gc(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):Buffer.from(e).toString("utf8")}function Vc(e,t){const r=new Array(t.mipMapLevels);let n=t.width,i=t.height,a=0;for(let o=0;o<t.mipMapLevels;++o){const s=Kc(t,n,i,e,o),u=Wc(e,o,a,s);r[o]={compressed:!0,format:t.internalFormat,data:u,width:n,height:i,levelSize:s},n=Math.max(1,n>>1),i=Math.max(1,i>>1),a+=s}return r}function Wc(e,t,r,n){return Array.isArray(e)?e[t].levelData:new Uint8Array(e.buffer,e.byteOffset+r,n)}function Kc(e,t,r,n,i){return Array.isArray(n)?e.sizeFunction(n[i]):e.sizeFunction(t,r)}const Jc={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},Qc={131:Jc.COMPRESSED_RGB_S3TC_DXT1_EXT,132:Jc.COMPRESSED_SRGB_S3TC_DXT1_EXT,133:Jc.COMPRESSED_RGBA_S3TC_DXT1_EXT,134:Jc.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,135:Jc.COMPRESSED_RGBA_S3TC_DXT3_EXT,136:Jc.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,137:Jc.COMPRESSED_RGBA_S3TC_DXT5_EXT,138:Jc.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,139:Jc.COMPRESSED_RED_RGTC1_EXT,140:Jc.COMPRESSED_SIGNED_RED_RGTC1_EXT,141:Jc.COMPRESSED_RED_GREEN_RGTC2_EXT,142:Jc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,147:Jc.COMPRESSED_RGB8_ETC2,148:Jc.COMPRESSED_SRGB8_ETC2,149:Jc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,150:Jc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,151:Jc.COMPRESSED_RGBA8_ETC2_EAC,152:Jc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,153:Jc.COMPRESSED_R11_EAC,154:Jc.COMPRESSED_SIGNED_R11_EAC,155:Jc.COMPRESSED_RG11_EAC,156:Jc.COMPRESSED_SIGNED_RG11_EAC,157:Jc.COMPRESSED_RGBA_ASTC_4x4_KHR,158:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,159:Jc.COMPRESSED_RGBA_ASTC_5x4_KHR,160:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,161:Jc.COMPRESSED_RGBA_ASTC_5x5_KHR,162:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,163:Jc.COMPRESSED_RGBA_ASTC_6x5_KHR,164:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,165:Jc.COMPRESSED_RGBA_ASTC_6x6_KHR,166:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,167:Jc.COMPRESSED_RGBA_ASTC_8x5_KHR,168:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,169:Jc.COMPRESSED_RGBA_ASTC_8x6_KHR,170:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,171:Jc.COMPRESSED_RGBA_ASTC_8x8_KHR,172:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,173:Jc.COMPRESSED_RGBA_ASTC_10x5_KHR,174:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,175:Jc.COMPRESSED_RGBA_ASTC_10x6_KHR,176:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,177:Jc.COMPRESSED_RGBA_ASTC_10x8_KHR,178:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,179:Jc.COMPRESSED_RGBA_ASTC_10x10_KHR,180:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,181:Jc.COMPRESSED_RGBA_ASTC_12x10_KHR,182:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,183:Jc.COMPRESSED_RGBA_ASTC_12x12_KHR,184:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,1000054e3:Jc.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,1000054001:Jc.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,1000066e3:Jc.COMPRESSED_RGBA_ASTC_4x4_KHR,1000066001:Jc.COMPRESSED_RGBA_ASTC_5x4_KHR,1000066002:Jc.COMPRESSED_RGBA_ASTC_5x5_KHR,1000066003:Jc.COMPRESSED_RGBA_ASTC_6x5_KHR,1000066004:Jc.COMPRESSED_RGBA_ASTC_6x6_KHR,1000066005:Jc.COMPRESSED_RGBA_ASTC_8x5_KHR,1000066006:Jc.COMPRESSED_RGBA_ASTC_8x6_KHR,1000066007:Jc.COMPRESSED_RGBA_ASTC_8x8_KHR,1000066008:Jc.COMPRESSED_RGBA_ASTC_10x5_KHR,1000066009:Jc.COMPRESSED_RGBA_ASTC_10x6_KHR,1000066010:Jc.COMPRESSED_RGBA_ASTC_10x8_KHR,1000066011:Jc.COMPRESSED_RGBA_ASTC_10x10_KHR,1000066012:Jc.COMPRESSED_RGBA_ASTC_12x10_KHR,1000066013:Jc.COMPRESSED_RGBA_ASTC_12x12_KHR};const Yc=[171,75,84,88,32,50,48,187,13,10,26,10];function $c(e){const t=new Uint8Array(e);return!(t.byteLength<Yc.length||t[0]!==Yc[0]||t[1]!==Yc[1]||t[2]!==Yc[2]||t[3]!==Yc[3]||t[4]!==Yc[4]||t[5]!==Yc[5]||t[6]!==Yc[6]||t[7]!==Yc[7]||t[8]!==Yc[8]||t[9]!==Yc[9]||t[10]!==Yc[10]||t[11]!==Yc[11])}function Xc(e){const t=function(e){const t=new Uint8Array(e.buffer,e.byteOffset,Oc.length);if(t[0]!==Oc[0]||t[1]!==Oc[1]||t[2]!==Oc[2]||t[3]!==Oc[3]||t[4]!==Oc[4]||t[5]!==Oc[5]||t[6]!==Oc[6]||t[7]!==Oc[7]||t[8]!==Oc[8]||t[9]!==Oc[9]||t[10]!==Oc[10]||t[11]!==Oc[11])throw new Error("Missing KTX 2.0 identifier.");const r=new qc,n=17*Uint32Array.BYTES_PER_ELEMENT,i=new Hc(e,Oc.length,n,!0);r.vkFormat=i._nextUint32(),r.typeSize=i._nextUint32(),r.pixelWidth=i._nextUint32(),r.pixelHeight=i._nextUint32(),r.pixelDepth=i._nextUint32(),r.layerCount=i._nextUint32(),r.faceCount=i._nextUint32();const a=i._nextUint32();r.supercompressionScheme=i._nextUint32();const o=i._nextUint32(),s=i._nextUint32(),u=i._nextUint32(),c=i._nextUint32(),l=i._nextUint64(),h=i._nextUint64(),p=new Hc(e,Oc.length+n,3*a*8,!0);for(let t=0;t<a;t++)r.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+p._nextUint64(),p._nextUint64()),uncompressedByteLength:p._nextUint64()});const f=new Hc(e,o,s,!0),d={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:{x:f._nextUint8()+1,y:f._nextUint8()+1,z:f._nextUint8()+1,w:f._nextUint8()+1},bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},m=(d.descriptorBlockSize/4-6)/4;for(let e=0;e<m;e++)d.samples[e]={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelID:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:f._nextUint32(),sampleUpper:f._nextUint32()};r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(d);const g=new Hc(e,u,c,!0);for(;g._offset<c;){const e=g._nextUint32(),t=g._scan(e),n=Gc(t),i=g._scan(e-t.byteLength);r.keyValue[n]=n.match(/^ktx/i)?Gc(i):i,e%4&&g._skip(4-e%4)}if(h<=0)return r;const y=new Hc(e,l,h,!0),b=y._nextUint16(),v=y._nextUint16(),w=y._nextUint32(),_=y._nextUint32(),k=y._nextUint32(),x=y._nextUint32(),E=[];for(let e=0;e<a;e++)E.push({imageFlags:y._nextUint32(),rgbSliceByteOffset:y._nextUint32(),rgbSliceByteLength:y._nextUint32(),alphaSliceByteOffset:y._nextUint32(),alphaSliceByteLength:y._nextUint32()});const A=l+y._offset,S=A+w,j=S+_,T=j+k,C=new Uint8Array(e.buffer,e.byteOffset+A,w),B=new Uint8Array(e.buffer,e.byteOffset+S,_),R=new Uint8Array(e.buffer,e.byteOffset+j,k),O=new Uint8Array(e.buffer,e.byteOffset+T,x);return r.globalData={endpointCount:b,selectorCount:v,imageDescs:E,endpointsData:C,selectorsData:B,tablesData:R,extendedData:O},r}(new Uint8Array(e)),r=Math.max(1,t.levels.length),n=t.pixelWidth,i=t.pixelHeight,a=(o=t.vkFormat,Qc[o]);var o;return Vc(t.levels,{mipMapLevels:r,width:n,height:i,sizeFunction:e=>e.uncompressedByteLength,internalFormat:a})}const Zc=542327876,el=31,tl=0,rl=1,nl=2,il=3,al=4,ol=7,sl=20,ul=21,cl=131072,ll=4,hl={DXT1:Jc.COMPRESSED_RGB_S3TC_DXT1_EXT,DXT3:Jc.COMPRESSED_RGBA_S3TC_DXT3_EXT,DXT5:Jc.COMPRESSED_RGBA_S3TC_DXT5_EXT,"ATC ":Jc.COMPRESSED_RGB_ATC_WEBGL,ATCA:Jc.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,ATCI:Jc.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL},pl={DXT1:dl,DXT3:ml,DXT5:ml,"ATC ":dl,ATCA:ml,ATCI:ml};function fl(e){const t=new Int32Array(e,0,el),r=t[ul];Vi(Boolean(t[sl]&ll),"DDS: Unsupported format, must contain a FourCC code");const n=(i=r,String.fromCharCode(255&i,i>>8&255,i>>16&255,i>>24&255));var i;const a=hl[n],o=pl[n];Vi(a&&o,"DDS: Unknown pixel format "+r);let s=1;t[nl]&cl&&(s=Math.max(1,t[ol]));const u=t[al],c=t[il],l=t[rl]+4;return Vc(new Uint8Array(e,l),{mipMapLevels:s,width:u,height:c,sizeFunction:o,internalFormat:a})}function dl(e,t){return(e+3>>2)*(t+3>>2)*8}function ml(e,t){return(e+3>>2)*(t+3>>2)*16}const gl=55727696,yl=1347834371,bl=13,vl=52,wl=0,_l=2,kl=4,xl=6,El=7,Al=11,Sl=12,jl={0:[Jc.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],1:[Jc.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],2:[Jc.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],3:[Jc.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],6:[Jc.COMPRESSED_RGB_ETC1_WEBGL],7:[Jc.COMPRESSED_RGB_S3TC_DXT1_EXT],9:[Jc.COMPRESSED_RGBA_S3TC_DXT3_EXT],11:[Jc.COMPRESSED_RGBA_S3TC_DXT5_EXT],22:[Jc.COMPRESSED_RGB8_ETC2],23:[Jc.COMPRESSED_RGBA8_ETC2_EAC],24:[Jc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],25:[Jc.COMPRESSED_R11_EAC],26:[Jc.COMPRESSED_RG11_EAC],27:[Jc.COMPRESSED_RGBA_ASTC_4X4_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR],28:[Jc.COMPRESSED_RGBA_ASTC_5X4_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR],29:[Jc.COMPRESSED_RGBA_ASTC_5X5_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR],30:[Jc.COMPRESSED_RGBA_ASTC_6X5_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR],31:[Jc.COMPRESSED_RGBA_ASTC_6X6_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR],32:[Jc.COMPRESSED_RGBA_ASTC_8X5_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR],33:[Jc.COMPRESSED_RGBA_ASTC_8X6_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR],34:[Jc.COMPRESSED_RGBA_ASTC_8X8_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR],35:[Jc.COMPRESSED_RGBA_ASTC_10X5_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR],36:[Jc.COMPRESSED_RGBA_ASTC_10X6_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR],37:[Jc.COMPRESSED_RGBA_ASTC_10X8_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR],38:[Jc.COMPRESSED_RGBA_ASTC_10X10_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR],39:[Jc.COMPRESSED_RGBA_ASTC_12X10_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR],40:[Jc.COMPRESSED_RGBA_ASTC_12X12_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR]},Tl={0:Cl,1:Cl,2:Bl,3:Bl,6:Rl,7:Rl,9:Ol,11:Ol,22:Rl,23:Ol,24:Rl,25:Rl,26:Ol,27:Ol,28:function(e,t){return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16},29:function(e,t){return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16},30:function(e,t){return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16},31:function(e,t){return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16},32:function(e,t){return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16},33:function(e,t){return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16},34:function(e,t){return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16},35:function(e,t){return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16},36:function(e,t){return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16},37:function(e,t){return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16},38:function(e,t){return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16},39:function(e,t){return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16},40:function(e,t){return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16}};function Cl(e,t){return(e=Math.max(e,16))*(t=Math.max(t,8))/4}function Bl(e,t){return(e=Math.max(e,8))*(t=Math.max(t,8))/2}function Rl(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8}function Ol(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16}function Il(e){if($c(e))return Xc(e);if(function(e){return new Uint32Array(e,0,el)[tl]===Zc}(e))return fl(e);if(function(e){const t=new Uint32Array(e,0,bl)[wl];return t===gl||t===yl}(e))return function(e){const t=new Uint32Array(e,0,bl),r=t[_l],n=t[kl],i=jl[r]||[],a=i.length>1&&n?i[1]:i[0],o=Tl[r],s=t[Al],u=t[El],c=t[xl],l=vl+t[Sl];return Vc(new Uint8Array(e,l),{mipMapLevels:s,width:u,height:c,sizeFunction:o,internalFormat:a})}(e);throw new Error("Texture container format not recognized")}let Pl,Dl;async function Ml(e){const t=e.modules||{};return t.basis?t.basis:(Pl=Pl||async function(e){let t=null,r=null;return[t,r]=await Promise.all([await jc("basis_transcoder.js","textures",e),await jc("basis_transcoder.wasm","textures",e)]),t=t||globalThis.BASIS,await function(e,t){const r={};t&&(r.wasmBinary=t);return new Promise(t=>{e(r).then(e=>{const{BasisFile:r,initializeBasis:n}=e;n(),t({BasisFile:r})})})}(t,r)}(e),await Pl)}async function Fl(e){const t=e.modules||{};return t.basisEncoder?t.basisEncoder:(Dl=Dl||async function(e){let t=null,r=null;return[t,r]=await Promise.all([await jc("https://unpkg.com/@loaders.gl/textures@3.3.0-alpha.3/dist/libs/basis_encoder.js","textures",e),await jc("https://unpkg.com/@loaders.gl/textures@3.3.0-alpha.3/dist/libs/basis_encoder.wasm","textures",e)]),t=t||globalThis.BASIS,await function(e,t){const r={};t&&(r.wasmBinary=t);return new Promise(t=>{e(r).then(e=>{const{BasisFile:r,KTX2File:n,initializeBasis:i,BasisEncoder:a}=e;i(),t({BasisFile:r,KTX2File:n,BasisEncoder:a})})})}(t,r)}(e),await Dl)}const Ll=["","WEBKIT_","MOZ_"],Nl={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"};let zl=null;function Ul(e){if(!zl){e=e||function(){try{return document.createElement("canvas").getContext("webgl")}catch(e){return null}}()||void 0,zl=new Set;for(const t of Ll)for(const r in Nl)if(e&&e.getExtension(`${t}${r}`)){const e=Nl[r];zl.add(e)}}return zl}const ql={etc1:{basisFormat:0,compressed:!0,format:Jc.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Jc.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:Jc.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:Jc.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Jc.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:Jc.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 Hl(e,t){if("auto"===t.basis.containerFormat){if($c(e)){return Wl((await Fl(t)).KTX2File,e,t)}const{BasisFile:r}=await Ml(t);return Gl(r,e,t)}switch(t.basis.module){case"encoder":const r=await Fl(t);switch(t.basis.containerFormat){case"ktx2":return Wl(r.KTX2File,e,t);case"basis":default:return Gl(r.BasisFile,e,t)}case"transcoder":default:const{BasisFile:n}=await Ml(t);return Gl(n,e,t)}}function Gl(e,t,r){const n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("Failed to start basis transcoding");const e=n.getNumImages(),t=[];for(let i=0;i<e;i++){const e=n.getNumLevels(i),a=[];for(let t=0;t<e;t++)a.push(Vl(n,i,t,r));t.push(a)}return t}finally{n.close(),n.delete()}}function Vl(e,t,r,n){const i=e.getImageWidth(t,r),a=e.getImageHeight(t,r),o=e.getHasAlpha(),{compressed:s,format:u,basisFormat:c}=Jl(n,o),l=e.getImageTranscodedSizeInBytes(t,r,c),h=new Uint8Array(l);if(!e.transcodeImage(h,t,r,c,0,0))throw new Error("failed to start Basis transcoding");return{width:i,height:a,data:h,compressed:s,format:u,hasAlpha:o}}function Wl(e,t,r){const n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("failed to start KTX2 transcoding");const e=n.getLevels(),t=[];for(let i=0;i<e;i++){t.push(Kl(n,i,r));break}return[t]}finally{n.close(),n.delete()}}function Kl(e,t,r){const{alphaFlag:n,height:i,width:a}=e.getImageLevelInfo(t,0,0),{compressed:o,format:s,basisFormat:u}=Jl(r,n),c=e.getImageTranscodedSizeInBytes(t,0,0,u),l=new Uint8Array(c);if(!e.transcodeImage(l,t,0,0,u,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:a,height:i,data:l,compressed:o,hasAlpha:n,format:s}}function Jl(e,t){let r=e&&e.basis&&e.basis.format;return"auto"===r&&(r=Ql()),"object"==typeof r&&(r=t?r.alpha:r.noAlpha),r=r.toLowerCase(),ql[r]}function Ql(){const e=Ul();return e.has("astc")?"astc-4x4":e.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:e.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:e.has("etc1")?"etc1":e.has("etc2")?"etc2":"rgb565"}const Yl={name:"Texture Containers",id:"compressed-texture",module:"textures",version:"3.3.0-alpha.3",worker:!0,extensions:["ktx","ktx2","dds","pvr"],mimeTypes:["image/ktx2","image/ktx","image/vnd-ms.dds","image/x-dds","application/octet-stream"],binary:!0,options:{"compressed-texture":{libraryPath:"libs/",useBasis:!1}}},$l={...Yl,parse:async(e,t)=>t["compressed-texture"].useBasis?(t.basis={format:{alpha:"BC3",noAlpha:"BC1"},...t.basis,containerFormat:"ktx2",module:"encoder"},(await Hl(e,t))[0]):Il(e)},Xl={name:"Basis",id:ka?"basis":"basis-nodejs",module:"textures",version:"3.3.0-alpha.3",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"}}},Zl={...Xl,parse:Hl};let eh,th;function rh(e,t=null){return t?`${e}?token=${t}`:e}!function(e){e.UInt8="UInt8",e.UInt16="UInt16",e.UInt32="UInt32",e.UInt64="UInt64",e.Int16="Int16",e.Int32="Int32",e.Int64="Int64",e.Float32="Float32",e.Float64="Float64"}(eh||(eh={})),function(e){e.vertexCount="vertexCount",e.featureCount="featureCount"}(th||(th={}));var nh=5121,ih=5125,ah=5126,oh=5130;function sh(e){switch(e){case eh.UInt8:return Uint8Array;case eh.UInt16:return Uint16Array;case eh.UInt32:return Uint32Array;case eh.Float32:return Float32Array;case eh.UInt64:return Float64Array;default:throw new Error("parse i3s tile content: unknown type of data: "+e)}}const uh={UInt8:nh,UInt16:ih,Float32:ah,UInt32:ih,UInt64:oh};function ch(e){switch(e){case eh.UInt8:return 1;case eh.UInt16:case eh.Int16:return 2;case eh.UInt32:case eh.Int32:case eh.Float32:return 4;case eh.UInt64:case eh.Int64:case eh.Float64:return 8;default:throw new Error("parse i3s tile content: unknown size of data: "+e)}}let lh;!function(e){e[e.DEFAULT=-1]="DEFAULT",e[e.LNGLAT=1]="LNGLAT",e[e.METER_OFFSETS=2]="METER_OFFSETS",e[e.LNGLAT_OFFSETS=3]="LNGLAT_OFFSETS",e[e.CARTESIAN=0]="CARTESIAN"}(lh||(lh={}));const hh=new Ds([0,0,0]);async function ph(e,t,r,n,i){const a={attributes:{},indices:null,featureIds:[],vertexCount:0,modelMatrix:new Js,coordinateSystem:0,byteLength:0,texture:null};if(t.textureUrl){var o;const e=rh(t.textureUrl,null==n||null===(o=n.i3s)||void 0===o?void 0:o.token),r=function(e){switch(e){case"ktx-etc2":case"dds":return $l;case"ktx2":return Zl;case"jpg":case"png":default:return zu}}(t.textureFormat),s=await fetch(e,null==n?void 0:n.fetch),u=await s.arrayBuffer();if(null!=n&&n.i3s.decodeTextures){if(r===zu){const e={...t.textureLoaderOptions,image:{type:"data"}};try{a.texture=await i.parse(u,e)}catch(t){a.texture=await Xo(u,r,e)}}else if(r===$l||r===Zl){let e=await Zo(u,r,t.textureLoaderOptions);r===Zl&&(e=e[0]),a.texture={compressed:!0,mipmaps:!1,width:e[0].width,height:e[0].height,data:e}}}else a.texture=u}return a.material=function(e,t){let r;e?r={...e,pbrMetallicRoughness:e.pbrMetallicRoughness?{...e.pbrMetallicRoughness}:{baseColorFactor:[255,255,255,255]}}:(r={pbrMetallicRoughness:{}},t?r.pbrMetallicRoughness.baseColorTexture={texCoord:0}:r.pbrMetallicRoughness.baseColorFactor=[255,255,255,255]);r.alphaCutoff=r.alphaCutoff||.25,r.alphaMode&&(r.alphaMode=r.alphaMode.toUpperCase());r.emissiveFactor&&(r.emissiveFactor=gh(r.emissiveFactor));r.pbrMetallicRoughness&&r.pbrMetallicRoughness.baseColorFactor&&(r.pbrMetallicRoughness.baseColorFactor=gh(r.pbrMetallicRoughness.baseColorFactor));t&&function(e,t){const r={source:{image:t}};e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture?e.pbrMetallicRoughness.baseColorTexture={...e.pbrMetallicRoughness.baseColorTexture,texture:r}:e.emissiveTexture?e.emissiveTexture={...e.emissiveTexture,texture:r}:e.pbrMetallicRoughness&&e.pbrMetallicRoughness.metallicRoughnessTexture?e.pbrMetallicRoughness.metallicRoughnessTexture={...e.pbrMetallicRoughness.metallicRoughnessTexture,texture:r}:e.normalTexture?e.normalTexture={...e.normalTexture,texture:r}:e.occlusionTexture&&(e.occlusionTexture={...e.occlusionTexture,texture:r})}(r,t);return r}(t.materialDefinition,a.texture),a.material&&(a.texture=null),await async function(e,t,r,n,i){var a;const o=e.byteLength;let s,u,c,l=0,h=0;if(r.isDracoGeometry){var p;const t=await Xo(e,Rc,{draco:{attributeNameEntry:"i3s-attribute-type"}});u=t.header.vertexCount,c=null===(p=t.indices)||void 0===p?void 0:p.value;const{POSITION:r,NORMAL:n,COLOR_0:i,TEXCOORD_0:a,"feature-index":o,"uv-region":l}=t.attributes;s={position:r,normal:n,color:i,uv0:a,uvRegion:l,id:o},function(e,t){for(const r in t.loaderData.attributes){const n=t.loaderData.attributes[r];switch(n.name){case"POSITION":e.position.metadata=n.metadata;break;case"feature-index":e.id.metadata=n.metadata}}}(s,t);const h=function(e){var t,r;return null==e||null===(t=e.metadata)||void 0===t||null===(r=t["i3s-feature-ids"])||void 0===r?void 0:r.intArray}(o);h&&function(e,t){const r=e.id.value,n=new Float32Array(r.length);for(let e=0;e<r.length;e++)n[e]=t[r[e]];e.id.value=n}(s,h)}else{const{vertexAttributes:t,ordering:r,featureAttributes:i,featureAttributeOrder:a}=n.store.defaultGeometrySchema,o=function(e,t){let r=0,n=0,i=0;for(const{property:a,type:o}of t.store.defaultGeometrySchema.header){const t=sh(o);switch(a){case th.vertexCount:n=new t(e,0,4)[0],r+=ch(o);break;case th.featureCount:i=new t(e,4,4)[0],r+=ch(o)}}return{vertexCount:n,featureCount:i,byteOffset:r}}(e,n);l=o.byteOffset,u=o.vertexCount,h=o.featureCount;const{attributes:c,byteOffset:p}=dh(e,l,t,u,r),{attributes:f}=dh(e,p,i,h,a);!function(e){const{id:t,faceRange:r}=e;if(!t||!r)return;const n=t.value,i=r.value,a=i[i.length-1]+1,o=new Uint32Array(3*a);let s=0,u=0;for(let e=1;e<i.length;e+=2){const t=Number(n[s]),r=i[e],a=i[e-1],c=u+3*(r-a+1);o.fill(t,u,c),s++,u=c}e.id.value=o}(f),s=function(e,t){return{...e,...t}}(c,f)}if(null!=i&&null!==(a=i.i3s)&&void 0!==a&&a.coordinateSystem&&i.i3s.coordinateSystem!==lh.METER_OFFSETS)t.modelMatrix=function(e){var t,r;const n=e.metadata,i=(null==n||null===(t=n["i3s-scale_x"])||void 0===t?void 0:t.double)||1,a=(null==n||null===(r=n["i3s-scale_y"])||void 0===r?void 0:r.double)||1,o=new Js;return o[0]=i,o[5]=a,o}(s.position),t.coordinateSystem=lh.LNGLAT_OFFSETS;else{const e=function(e,t){const r=t.mbs,n=e.value,i=e.metadata,a=new Js,o=new Ds(r[0],r[1],r[2]),s=new Ds;return _u.WGS84.cartographicToCartesian(o,s),_u.WGS84.eastNorthUpToFixedFrame(s,a),e.value=function(e,t={},r){const n=new Float64Array(e.length),i=t["i3s-scale_x"]&&t["i3s-scale_x"].double||1,a=t["i3s-scale_y"]&&t["i3s-scale_y"].double||1;for(let t=0;t<n.length;t+=3)n[t]=e[t]*i+r.x,n[t+1]=e[t+1]*a+r.y,n[t+2]=e[t+2]+r.z;for(let e=0;e<n.length;e+=3)_u.WGS84.cartographicToCartesian(n.subarray(e,e+3),hh),n[e]=hh.x,n[e+1]=hh.y,n[e+2]=hh.z;return n}(n,i,o),a}(s.position,r);t.modelMatrix=e.invert(),t.coordinateSystem=lh.METER_OFFSETS}t.attributes={positions:s.position,normals:s.normal,colors:fh(s.color),texCoords:s.uv0,uvRegions:fh(s.uvRegion)},t.indices=c||null,s.id&&s.id.value&&(t.featureIds=s.id.value);for(const e in t.attributes)t.attributes[e]||delete t.attributes[e];return t.vertexCount=u,t.byteLength=o,t}(e,a,t,r,n)}function fh(e){return e?(e.normalized=!0,e):e}function dh(e,t,r,n,i){const a={};for(const o of i)if(r[o]){const{valueType:i,valuesPerElement:s}=r[o];if(t+n*s*ch(i)<=e.byteLength){const r=e.slice(t);let u;if("UInt64"===i)u=mh(r,n*s,ch(i));else{u=new(sh(i))(r,0,n*s)}switch(a[o]={value:u,type:uh[i],size:s},o){case"color":a.color.normalized=!0}t+=n*s*ch(i)}else if("uv0"!==o)break}return{attributes:a,byteOffset:t}}function mh(e,t,r){const n=[],i=new DataView(e);let a=0;for(let e=0;e<t;e++){const e=i.getUint32(a,!0)+2**32*i.getUint32(a+4,!0);n.push(e),a+=r}return new Uint32Array(n)}function gh(e){const t=[...e];for(let r=0;r<e.length;r++)t[r]=e[r]/255;return t}const yh={name:"I3S Content (Indexed Scene Layers)",id:ka?"i3s-content":"i3s-content-nodejs",module:"i3s",worker:!0,version:"3.3.0-alpha.3",mimeTypes:["application/octet-stream"],parse:async function(e,t,r){const{tile:n,_tileOptions:i,tileset:a,_tilesetOptions:o}=(null==t?void 0:t.i3s)||{},s=i||n,u=o||a;if(!s||!u)return null;return await ph(e,s,u,t,r)},extensions:["bin"],options:{"i3s-content":{}}};const bh=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});new Ds,new Ds;const vh=new Ds,wh=new Ds;class _h{constructor(e=[0,0,0],t=0){this.radius=-0,this.center=new Ds,this.fromCenterRadius(e,t)}fromCenterRadius(e,t){return this.center.from(e),this.radius=t,this}fromCornerPoints(e,t){return t=vh.from(t),this.center=(new Ds).from(e).add(t).scale(.5),this.radius=this.center.distance(t),this}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new _h(this.center,this.radius)}union(e){const t=this.center,r=this.radius,n=e.center,i=e.radius,a=vh.copy(n).subtract(t),o=a.magnitude();if(r>=o+i)return this.clone();if(i>=o+r)return e.clone();const s=.5*(r+o+i);return wh.copy(a).scale((-r+s)/o).add(t),this.center.copy(wh),this.radius=s,this}expand(e){const t=(e=vh.from(e)).subtract(this.center).magnitude();return t>this.radius&&(this.radius=t),this}transform(e){this.center.transform(e);const t=Ns(vh,e);return this.radius=Math.max(t[0],Math.max(t[1],t[2]))*this.radius,this}distanceSquaredTo(e){return(e=vh.from(e)).subtract(this.center).lengthSquared()-this.radius*this.radius}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}intersectPlane(e){const t=this.center,r=this.radius,n=e.normal.dot(t)+e.distance;return n<-r?bh.OUTSIDE:n<r?bh.INTERSECTING:bh.INSIDE}}function kh(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],h=t[8],p=r[0],f=r[1],d=r[2],m=r[3],g=r[4],y=r[5],b=r[6],v=r[7],w=r[8];return e[0]=p*n+f*o+d*c,e[1]=p*i+f*s+d*l,e[2]=p*a+f*u+d*h,e[3]=m*n+g*o+y*c,e[4]=m*i+g*s+y*l,e[5]=m*a+g*u+y*h,e[6]=b*n+v*o+w*c,e[7]=b*i+v*s+w*l,e[8]=b*a+v*u+w*h,e}function xh(e,t,r){var n=r[0],i=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}const Eh=Object.freeze([1,0,0,0,1,0,0,0,1]),Ah=Object.freeze([0,0,0,0,0,0,0,0,0]),Sh=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL1ROW0:3,COL1ROW1:4,COL1ROW2:5,COL2ROW0:6,COL2ROW1:7,COL2ROW2:8}),jh={};class Th extends Ms{static get IDENTITY(){return jh.IDENTITY=jh.IDENTITY||Object.freeze(new Th(Eh)),jh.IDENTITY}static get ZERO(){return jh.ZERO=jh.ZERO||Object.freeze(new Th(Ah)),jh.ZERO}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Sh}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&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.check()}set(e,t,r,n,i,a,o,s,u){return this[0]=e,this[1]=t,this[2]=r,this[3]=n,this[4]=i,this[5]=a,this[6]=o,this[7]=s,this[8]=u,this.check()}setRowMajor(e,t,r,n,i,a,o,s,u){return this[0]=e,this[1]=n,this[2]=o,this[3]=t,this[4]=i,this[5]=s,this[6]=r,this[7]=a,this[8]=u,this.check()}determinant(){return t=(e=this)[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8],t*(c*a-o*u)+r*(-c*i+o*s)+n*(u*i-a*s);var e,t,r,n,i,a,o,s,u,c}identity(){return this.copy(Eh)}fromQuaternion(e){return function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,h=n*s,p=i*o,f=i*s,d=i*u,m=a*o,g=a*s,y=a*u;e[0]=1-h-d,e[3]=l-y,e[6]=p+g,e[1]=l+y,e[4]=1-c-d,e[7]=f-m,e[2]=p-g,e[5]=f+m,e[8]=1-c-h}(this,e),this.check()}transpose(){return function(e,t){if(e===t){var r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8]}(this,this),this.check()}invert(){var e,t,r,n,i,a,o,s,u,c,l,h,p,f,d;return e=this,r=(t=this)[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],(d=r*(h=l*o-s*c)+n*(p=-l*a+s*u)+i*(f=c*a-o*u))&&(d=1/d,e[0]=h*d,e[1]=(-l*n+i*c)*d,e[2]=(s*n-i*o)*d,e[3]=p*d,e[4]=(l*r-i*u)*d,e[5]=(-s*r+i*a)*d,e[6]=f*d,e[7]=(-c*r+n*u)*d,e[8]=(o*r-n*a)*d),this.check()}multiplyLeft(e){return kh(this,e,this),this.check()}multiplyRight(e){return kh(this,this,e),this.check()}rotate(e){var t,r,n,i,a,o,s,u,c,l,h,p,f,d;return t=this,n=e,i=(r=this)[0],a=r[1],o=r[2],s=r[3],u=r[4],c=r[5],l=r[6],h=r[7],p=r[8],f=Math.sin(n),d=Math.cos(n),t[0]=d*i+f*s,t[1]=d*a+f*u,t[2]=d*o+f*c,t[3]=d*s-f*i,t[4]=d*u-f*a,t[5]=d*c-f*o,t[6]=l,t[7]=h,t[8]=p,this.check()}scale(e){return Array.isArray(e)?xh(this,this,e):xh(this,this,[e,e,e]),this.check()}translate(e){var t,r,n,i,a,o,s,u,c,l,h,p,f,d;return t=this,n=e,i=(r=this)[0],a=r[1],o=r[2],s=r[3],u=r[4],c=r[5],l=r[6],h=r[7],p=r[8],f=n[0],d=n[1],t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=u,t[5]=c,t[6]=f*i+d*s+l,t[7]=f*a+d*u+h,t[8]=f*o+d*c+p,this.check()}transform(e,t){switch(e.length){case 2:t=zs(t||[-0,-0],e,this);break;case 3:t=Ss(t||[-0,-0,-0],e,this);break;case 4:t=Os(t||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ds(t,e.length),t}transformVector(e,t){return gs("Matrix3.transformVector"),this.transform(e,t)}transformVector2(e,t){return gs("Matrix3.transformVector"),this.transform(e,t)}transformVector3(e,t){return gs("Matrix3.transformVector"),this.transform(e,t)}}function Ch(){var e=new vs(4);return vs!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Bh(e,t,r){r*=.5;var n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function Rh(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],u=r[1],c=r[2],l=r[3];return e[0]=n*l+o*s+i*c-a*u,e[1]=i*l+o*u+a*s-n*c,e[2]=a*l+o*c+n*u-i*s,e[3]=o*l-n*s-i*u-a*c,e}function Oh(e,t,r,n){var i,a,o,s,u,c=t[0],l=t[1],h=t[2],p=t[3],f=r[0],d=r[1],m=r[2],g=r[3];return(a=c*f+l*d+h*m+p*g)<0&&(a=-a,f=-f,d=-d,m=-m,g=-g),1-a>bs?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,u=Math.sin(n*i)/o):(s=1-n,u=n),e[0]=s*c+u*f,e[1]=s*l+u*d,e[2]=s*h+u*m,e[3]=s*p+u*g,e}function Ih(e,t){var r,n=t[0]+t[4]+t[8];if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var i=0;t[4]>t[0]&&(i=1),t[8]>t[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;r=Math.sqrt(t[3*i+i]-t[3*a+a]-t[3*o+o]+1),e[i]=.5*r,r=.5/r,e[3]=(t[3*a+o]-t[3*o+a])*r,e[a]=(t[3*a+i]+t[3*i+a])*r,e[o]=(t[3*o+i]+t[3*i+o])*r}return e}var Ph,Dh,Mh,Fh,Lh,Nh,zh,Uh=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e},qh=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e},Hh=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},Gh=function(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=t[3];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e[3]=s+n*(r[3]-s),e},Vh=qs,Wh=Hs,Kh=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=n*o,e[2]=i*o,e[3]=a*o,e},Jh=(Ph=ws(),Dh=ks(1,0,0),Mh=ks(0,1,0),function(e,t,r){var n=xs(t,r);return n<-.999999?(Es(Ph,Dh,t),Cs(Ph)<1e-6&&Es(Ph,Mh,t),function(e,t){var r=t[0],n=t[1],i=t[2],a=r*r+n*n+i*i;a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a}(Ph,Ph),Bh(e,Ph,Math.PI),e):n>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(Es(Ph,t,r),e[0]=Ph[0],e[1]=Ph[1],e[2]=Ph[2],e[3]=1+n,Kh(e,e))});Fh=Ch(),Lh=Ch(),Nh=new vs(9),vs!=Float32Array&&(Nh[1]=0,Nh[2]=0,Nh[3]=0,Nh[5]=0,Nh[6]=0,Nh[7]=0),Nh[0]=1,Nh[4]=1,Nh[8]=1,zh=Nh;const Qh=[0,0,0,1];class Yh extends ps{constructor(e=0,t=0,r=0,n=1){super(-0,-0,-0,-0),Array.isArray(e)&&1===arguments.length?this.copy(e):this.set(e,t,r,n)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,t,r,n){return this[0]=e,this[1]=t,this[2]=r,this[3]=n,this.check()}fromMatrix3(e){return Ih(this,e),this.check()}identity(){return function(e){e[0]=0,e[1]=0,e[2]=0,e[3]=1}(this),this.check()}fromAxisRotation(e,t){return Bh(this,e,t),this.check()}setAxisAngle(e,t){return this.fromAxisRotation(e,t)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=fs(e)}get y(){return this[1]}set y(e){this[1]=fs(e)}get z(){return this[2]}set z(e){this[2]=fs(e)}get w(){return this[3]}set w(e){this[3]=fs(e)}len(){return Vh(this)}lengthSquared(){return Wh(this)}dot(e,t){if(void 0!==t)throw new Error("Quaternion.dot only takes one argument");return Hh(this,e)}rotationTo(e,t){return Jh(this,e,t),this.check()}add(e,t){if(void 0!==t)throw new Error("Quaternion.add only takes one argument");return Uh(this,this,e),this.check()}calculateW(){return function(e,t){var r=t[0],n=t[1],i=t[2];e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i))}(this,this),this.check()}conjugate(){return function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(this,this),this.check()}invert(){return function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;e[0]=-r*s,e[1]=-n*s,e[2]=-i*s,e[3]=a*s}(this,this),this.check()}lerp(e,t,r){return Gh(this,e,t,r),this.check()}multiplyRight(e,t){return es(!t),Rh(this,this,e),this.check()}multiplyLeft(e,t){return es(!t),Rh(this,e,this),this.check()}normalize(){const e=this.len(),t=e>0?1/e:0;return this[0]=this[0]*t,this[1]=this[1]*t,this[2]=this[2]*t,this[3]=this[3]*t,0===e&&(this[3]=1),this.check()}rotateX(e){return function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);e[0]=n*u+o*s,e[1]=i*u+a*s,e[2]=a*u-i*s,e[3]=o*u-n*s}(this,this,e),this.check()}rotateY(e){return function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);e[0]=n*u-a*s,e[1]=i*u+o*s,e[2]=a*u+n*s,e[3]=o*u-i*s}(this,this,e),this.check()}rotateZ(e){return function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);e[0]=n*u+i*s,e[1]=i*u-n*s,e[2]=a*u+o*s,e[3]=o*u-a*s}(this,this,e),this.check()}scale(e){return qh(this,this,e),this.check()}slerp(e,t,r){switch(arguments.length){case 1:({start:e=Qh,target:t,ratio:r}=arguments[0]);break;case 2:[t,r]=arguments,e=this}return Oh(this,e,t,r),this.check()}transformVector4(e,t=e){return function(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],c=r[3],l=c*n+s*a-u*i,h=c*i+u*n-o*a,p=c*a+o*i-s*n,f=-o*n-s*i-u*a;e[0]=l*c+f*-o+h*-u-p*-s,e[1]=h*c+f*-s+p*-o-l*-u,e[2]=p*c+f*-u+l*-s-h*-o,e[3]=t[3]}(t,e,this),ds(t,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,t){return this.setAxisAngle(e,t)}premultiply(e,t){return this.multiplyLeft(e,t)}multiply(e,t){return this.multiplyRight(e,t)}}const $h=new Ds,Xh=new Ds,Zh=new Ds,ep=new Ds,tp=new Ds,rp=new Ds,np=new Ds,ip=0,ap=1,op=2,sp=3,up=4,cp=5,lp=6,hp=7,pp=8;class fp{constructor(e=[0,0,0],t=[0,0,0,0,0,0,0,0,0]){this.center=(new Ds).from(e),this.halfAxes=new Th(t)}get halfSize(){const e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new Ds(e).len(),new Ds(t).len(),new Ds(r).len()]}get quaternion(){const e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),n=new Ds(e).normalize(),i=new Ds(t).normalize(),a=new Ds(r).normalize();return(new Yh).fromMatrix3(new Th([...n,...i,...a]))}fromCenterHalfSizeQuaternion(e,t,r){const n=new Yh(r),i=(new Th).fromQuaternion(n);return i[0]=i[0]*t[0],i[1]=i[1]*t[0],i[2]=i[2]*t[0],i[3]=i[3]*t[1],i[4]=i[4]*t[1],i[5]=i[5]*t[1],i[6]=i[6]*t[2],i[7]=i[7]*t[2],i[8]=i[8]*t[2],this.center=(new Ds).from(e),this.halfAxes=i,this}clone(){return new fp(this.center,this.halfAxes)}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new _h){const t=this.halfAxes,r=t.getColumn(0,Zh),n=t.getColumn(1,ep),i=t.getColumn(2,tp),a=$h.copy(r).add(n).add(i);return e.center.copy(this.center),e.radius=a.magnitude(),e}intersectPlane(e){const t=this.center,r=e.normal,n=this.halfAxes,i=r.x,a=r.y,o=r.z,s=Math.abs(i*n[ip]+a*n[ap]+o*n[op])+Math.abs(i*n[sp]+a*n[up]+o*n[cp])+Math.abs(i*n[lp]+a*n[hp]+o*n[pp]),u=r.dot(t)+e.distance;return u<=-s?bh.OUTSIDE:u>=s?bh.INSIDE:bh.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){const t=Xh.from(e).subtract(this.center),r=this.halfAxes,n=r.getColumn(0,Zh),i=r.getColumn(1,ep),a=r.getColumn(2,tp),o=n.magnitude(),s=i.magnitude(),u=a.magnitude();n.normalize(),i.normalize(),a.normalize();let c,l=0;return c=Math.abs(t.dot(n))-o,c>0&&(l+=c*c),c=Math.abs(t.dot(i))-s,c>0&&(l+=c*c),c=Math.abs(t.dot(a))-u,c>0&&(l+=c*c),l}computePlaneDistances(e,t,r=[-0,-0]){let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const a=this.center,o=this.halfAxes,s=o.getColumn(0,Zh),u=o.getColumn(1,ep),c=o.getColumn(2,tp),l=rp.copy(s).add(u).add(c).add(a),h=np.copy(l).subtract(e);let p=t.dot(h);return n=Math.min(p,n),i=Math.max(p,i),l.copy(a).add(s).add(u).subtract(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),l.copy(a).add(s).subtract(u).add(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),l.copy(a).add(s).subtract(u).subtract(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),a.copy(l).subtract(s).add(u).add(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),a.copy(l).subtract(s).add(u).subtract(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),a.copy(l).subtract(s).subtract(u).add(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),a.copy(l).subtract(s).subtract(u).subtract(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),r[0]=n,r[1]=i,r}transform(e){this.center.transformAsPoint(e);const t=this.halfAxes.getColumn(0,Zh);t.transformAsPoint(e);const r=this.halfAxes.getColumn(1,ep);r.transformAsPoint(e);const n=this.halfAxes.getColumn(2,tp);return n.transformAsPoint(e),this.halfAxes=new Th([...t,...r,...n]),this}getTransform(){throw new Error("not implemented")}}const dp=new Ds,mp=new Ds;class gp{constructor(e=[0,0,1],t=0){this.normal=new Ds,this.distance=-0,this.fromNormalDistance(e,t)}fromNormalDistance(e,t){return es(Number.isFinite(t)),this.normal.from(e).normalize(),this.distance=t,this}fromPointNormal(e,t){e=dp.from(e),this.normal.from(t).normalize();const r=-this.normal.dot(e);return this.distance=r,this}fromCoefficients(e,t,r,n){return this.normal.set(e,t,r),es(hs(this.normal.len(),1)),this.distance=n,this}clone(e){return new gp(this.normal,this.distance)}equals(e){return hs(this.distance,e.distance)&&hs(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){const t=mp.copy(this.normal).transformAsVector(e).normalize(),r=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(r,t)}projectPointOntoPlane(e,t=[0,0,0]){e=dp.from(e);const r=this.getPointDistance(e),n=mp.copy(this.normal).scale(r);return e.subtract(n).to(t)}}const yp=[new Ds([1,0,0]),new Ds([0,1,0]),new Ds([0,0,1])],bp=new Ds,vp=new Ds;new gp(new Ds(1,0,0),0);class wp{static get MASK_OUTSIDE(){return 4294967295}static get MASK_INSIDE(){return 0}static get MASK_INDETERMINATE(){return 2147483647}constructor(e=[]){this.planes=e,es(this.planes.every(e=>e instanceof gp))}fromBoundingSphere(e){this.planes.length=2*yp.length;const t=e.center,r=e.radius;let n=0;for(const e of yp){let i=this.planes[n],a=this.planes[n+1];i||(i=this.planes[n]=new gp),a||(a=this.planes[n+1]=new gp);const o=bp.copy(e).scale(-r).add(t);e.dot(o);i.fromPointNormal(o,e);const s=bp.copy(e).scale(r).add(t),u=vp.copy(e).negate();u.dot(s);a.fromPointNormal(s,u),n+=2}return this}computeVisibility(e){es(e);let t=bh.INSIDE;for(const r of this.planes){switch(e.intersectPlane(r)){case bh.OUTSIDE:return bh.OUTSIDE;case bh.INTERSECTING:t=bh.INTERSECTING}}return t}computeVisibilityWithPlaneMask(e,t){if(es(e,"boundingVolume is required."),es(Number.isFinite(t),"parentPlaneMask is required."),t===wp.MASK_OUTSIDE||t===wp.MASK_INSIDE)return t;let r=wp.MASK_INSIDE;const n=this.planes;for(let i=0;i<this.planes.length;++i){const a=i<31?1<<i:0;if(i<31&&0==(t&a))continue;const o=n[i],s=e.intersectPlane(o);if(s===bh.OUTSIDE)return wp.MASK_OUTSIDE;s===bh.INTERSECTING&&(r|=a)}return r}}new Ds,new Ds,new Ds,new Ds,new Ds;const _p=new Ds,kp=new Ds,xp=new Ds,Ep=new Ds,Ap=new Ds,Sp=new Ds,jp=new Ds,Tp=new Ds,Cp=new Ds,Bp=new Ds,Rp=new Ds,Op=new Ds;Math.PI;const Ip=new Th,Pp=new Th,Dp=new Th,Mp=new Th,Fp=new Th;function Lp(e,t={}){const r=Xs;let n=0,i=0;const a=Pp,o=Dp;a.identity(),o.copy(e);const s=r*function(e){let t=0;for(let r=0;r<9;++r){const n=e[r];t+=n*n}return Math.sqrt(t)}(o);for(;i<10&&Up(o)>s;)qp(o,Mp),Fp.copy(Mp).transpose(),o.multiplyRight(Mp),o.multiplyLeft(Fp),a.multiplyRight(Mp),++n>2&&(++i,n=0);return t.unitary=a.toTarget(t.unitary),t.diagonal=o.toTarget(t.diagonal),t}const Np=[1,0,0],zp=[2,2,1];function Up(e){let t=0;for(let r=0;r<3;++r){const n=e[Ip.getElementIndex(zp[r],Np[r])];t+=2*n*n}return Math.sqrt(t)}function qp(e,t){const r=$s;let n=0,i=1;for(let t=0;t<3;++t){const r=Math.abs(e[Ip.getElementIndex(zp[t],Np[t])]);r>n&&(i=t,n=r)}const a=Np[i],o=zp[i];let s=1,u=0;if(Math.abs(e[Ip.getElementIndex(o,a)])>r){const t=(e[Ip.getElementIndex(o,o)]-e[Ip.getElementIndex(a,a)])/2/e[Ip.getElementIndex(o,a)];let r;r=t<0?-1/(-t+Math.sqrt(1+t*t)):1/(t+Math.sqrt(1+t*t)),s=1/Math.sqrt(1+r*r),u=r*s}return Th.IDENTITY.to(t),t[Ip.getElementIndex(a,a)]=t[Ip.getElementIndex(o,o)]=s,t[Ip.getElementIndex(o,a)]=u,t[Ip.getElementIndex(a,o)]=-u,t}const Hp=new Ds,Gp=new Ds,Vp=new Ds,Wp=new Ds,Kp=new Ds,Jp=new Th,Qp={diagonal:new Th,unitary:new Th};const Yp=0,$p=1,Xp=3,Zp=4,ef=5,tf=1,rf=2,nf="empty",af="scenegraph",of="pointcloud",sf="mesh",uf="I3S",cf="TILES3D",lf="geometricError",hf=1;async function pf(e){return JSON.parse((new TextDecoder).decode(e))}const ff={name:"I3S Node Page",id:"i3s-node-page",module:"i3s",version:"3.3.0-alpha.3",mimeTypes:["application/json"],parse:async function(e){return e=pf(e)},extensions:["json"],options:{}};function df(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class mf{constructor(e,t){var r,n;df(this,"tileset",void 0),df(this,"nodePages",[]),df(this,"pendingNodePages",[]),df(this,"nodesPerPage",void 0),df(this,"options",void 0),df(this,"lodSelectionMetricType",void 0),df(this,"textureDefinitionsSelectedFormats",[]),df(this,"nodesInNodePages",void 0),df(this,"textureLoaderOptions",{}),this.tileset={...e},this.nodesPerPage=(null===(r=e.nodePages)||void 0===r?void 0:r.nodesPerPage)||64,this.lodSelectionMetricType=null===(n=e.nodePages)||void 0===n?void 0:n.lodSelectionMetricType,this.options=t,this.nodesInNodePages=0,this.initSelectedFormatsForTextureDefinitions(e)}async getNodeById(e){const t=Math.floor(e/this.nodesPerPage);if(!this.nodePages[t]&&!this.pendingNodePages[t]){var r;const e=rh(`${this.tileset.url}/nodepages/${t}`,null===(r=this.options.i3s)||void 0===r?void 0:r.token);this.pendingNodePages[t]={status:"Pending",promise:Zo(e,ff,this.options)},this.nodePages[t]=await this.pendingNodePages[t].promise,this.nodesInNodePages+=this.nodePages[t].nodes.length,this.pendingNodePages[t].status="Done"}"Pending"===this.pendingNodePages[t].status&&(this.nodePages[t]=await this.pendingNodePages[t].promise);const n=e%this.nodesPerPage;return this.nodePages[t].nodes[n]}async formTileFromNodePages(e){const t=await this.getNodeById(e),r=[],n=[];for(const e of t.children||[])n.push(this.getNodeById(e));const i=await Promise.all(n);for(const e of i)r.push({id:e.index.toString(),obb:e.obb});let a,o,s,u="jpg",c=[],l=!1;if(t&&t.mesh){const{url:e,isDracoGeometry:r}=t.mesh.geometry&&this.getContentUrl(t.mesh.geometry)||{isDracoGeometry:!1};a=e,l=r;const{textureData:n,materialDefinition:i}=this.getInformationFromMaterial(t.mesh.material);s=i,u=n.format||u,n.name&&(o=`${this.tileset.url}/nodes/${t.mesh.material.resource}/textures/${n.name}`),this.tileset.attributeStorageInfo&&(c=function(e,t){const r=[],{attributeStorageInfo:n,url:i}=e;for(let e=0;e<n.length;e++){const a=n[e].key;r.push(`${i}/nodes/${t}/attributes/${a}/0`)}return r}(this.tileset,t.mesh.attribute.resource))}const h=this.getLodSelection(t);return gf({id:e.toString(),lodSelection:h,obb:t.obb,contentUrl:a,textureUrl:o,attributeUrls:c,materialDefinition:s,textureFormat:u,textureLoaderOptions:this.textureLoaderOptions,children:r,isDracoGeometry:l})}getContentUrl(e){let t=null;const r=this.tileset.geometryDefinitions[e.definition];let n=-1;if(this.options.i3s&&this.options.i3s.useDracoGeometry&&(n=r.geometryBuffers.findIndex(e=>e.compressedAttributes&&"draco"===e.compressedAttributes.encoding)),-1===n&&(n=r.geometryBuffers.findIndex(e=>!e.compressedAttributes)),-1!==n){const i=Boolean(r.geometryBuffers[n].compressedAttributes);t={url:`${this.tileset.url}/nodes/${e.resource}/geometries/${n}`,isDracoGeometry:i}}return t}getLodSelection(e){const t=[];return"maxScreenThresholdSQ"===this.lodSelectionMetricType&&t.push({metricType:"maxScreenThreshold",maxError:Math.sqrt(e.lodThreshold/(.25*Math.PI))}),t.push({metricType:this.lodSelectionMetricType,maxError:e.lodThreshold}),t}getInformationFromMaterial(e){const t={textureData:{name:null}};if(e){var r;const a=null===(r=this.tileset.materialDefinitions)||void 0===r?void 0:r[e.definition];if(a){var n,i;t.materialDefinition=a;const e=null==a||null===(n=a.pbrMetallicRoughness)||void 0===n||null===(i=n.baseColorTexture)||void 0===i?void 0:i.textureSetDefinitionId;"number"==typeof e&&(t.textureData=this.textureDefinitionsSelectedFormats[e]||t.textureData)}}return t}initSelectedFormatsForTextureDefinitions(e){this.textureDefinitionsSelectedFormats=[];const t=this.getSupportedTextureFormats(),r=e.textureSetDefinitions||[];for(const e of r){const r=e&&e.formats||[];let n=null;for(const e of t){const t=r.find(t=>t.format===e);if(t){n=t;break}}n&&"ktx2"===n.format&&(this.textureLoaderOptions.basis={format:Ql(),containerFormat:"ktx2",module:"encoder"}),this.textureDefinitionsSelectedFormats.push(n)}}getSupportedTextureFormats(){const e=[];if(!this.options.i3s||this.options.i3s.useCompressedTextures){const t=Ul();t.has("etc2")&&e.push("ktx-etc2"),t.has("dxt")&&e.push("dds"),e.push("ktx2")}return e.push("jpg"),e.push("png"),e}}function gf(e){var t,r;const n={};let i=[0,0,0,1];if(e.mbs)i=e.mbs,n.sphere=[..._u.WGS84.cartographicToCartesian(e.mbs.slice(0,3)),e.mbs[3]];else if(e.obb){n.box=[..._u.WGS84.cartographicToCartesian(e.obb.center),...e.obb.halfSize,...e.obb.quaternion];const t=(new fp).fromCenterHalfSizeQuaternion(n.box.slice(0,3),e.obb.halfSize,e.obb.quaternion).getBoundingSphere();n.sphere=[...t.center,t.radius],i=[...e.obb.center,t.radius]}const a=null===(t=e.lodSelection)||void 0===t?void 0:t[0].metricType,o=null===(r=e.lodSelection)||void 0===r?void 0:r[0].maxError,s=e.transform,u=sf,c=rf;return{...e,mbs:i,boundingVolume:n,lodMetricType:a,lodMetricValue:o,transformMatrix:s,type:u,refine:c}}const yf=/layers\/[0-9]+$/,bf=/nodes\/([0-9-]+|root)$/,vf={name:"I3S (Indexed Scene Layers)",id:"i3s",module:"i3s",version:"3.3.0-alpha.3",mimeTypes:["application/octet-stream"],parse:async function(e,t={},r){const n=r.url;t.i3s=t.i3s||{};if("504b0304"===function(e){if(e instanceof ArrayBuffer)return[...new Uint8Array(e,0,4)].map(e=>e.toString(16).padStart(2,"0")).join("");return null}(e))throw new Error("Files with .slpk extention currently are not supported by I3SLoader");let i,a;i="auto"===t.i3s.isTileset?yf.test(n):t.i3s.isTileset;a="auto"===t.isTileHeader?bf.test(n):t.i3s.isTileHeader;e=i?await async function(e,t,r){const n=JSON.parse((new TextDecoder).decode(e));return n.loader=vf,await async function(e,t,r){if(e.url=r.url,e.nodePages)e.nodePagesTile=new mf(e,t),e.root=e.nodePagesTile.formTileFromNodePages(0);else{var n;const r=rh(e.url+"/nodes/root",null===(n=t.i3s)||void 0===n?void 0:n.token);e.root=await Zo(r,e.loader,{...t,i3s:{...t.i3s,loadContent:!1,isTileHeader:!0,isTileset:!1}})}e.basePath=e.url,e.type=uf,e.lodMetricType=e.root.lodMetricType,e.lodMetricValue=e.root.lodMetricValue}(n,t,r),n}(e,t,r):a?await async function(e,t){return function(e,t){const r=t.url||"";let n,i,a;return e.geometryData&&(n=`${r}/${e.geometryData[0].href}`),e.textureData&&(i=`${r}/${e.textureData[0].href}`),e.attributeData&&(a=function(e,t){const{attributeData:r=[]}=t,n=[];for(let t=0;t<r.length;t++){const i=r[t].href.replace("./","");n.push(`${e}/${i}`)}return n}(r,e)),gf({...e,url:r,contentUrl:n,textureUrl:i,attributeUrls:a,isDracoGeometry:!1})}(e=JSON.parse((new TextDecoder).decode(e)),t)}(e,r):await async function(e,t){return await Xo(e,yh,t)}(e,t);return e},extensions:["bin"],options:{i3s:{token:null,isTileset:"auto",isTileHeader:"auto",tile:null,tileset:null,_tileOptions:null,_tilesetOptions:null,useDracoGeometry:!0,useCompressedTextures:!0,decodeTextures:!0,coordinateSystem:lh.METER_OFFSETS}}};async function wf(e,t){const{attributeName:r,attributeType:n}=t;return r?{[r]:n?_f(n,e):null}:{}}function _f(e,t){switch(e){case"String":return function(e){const t=[];try{const r=new DataView(e,0,4).getUint32(0,!0),n=new Uint32Array(e,8,r);let i=8+4*r;for(const r of n){const n=new TextDecoder("utf-8"),a=new Uint8Array(e,i,r);t.push(n.decode(a)),i+=r}}catch(e){console.error("Parse string attribute error: ",e.message)}return t}(t);case"Oid32":return kf(t);case"Float64":return function(e){return new Float64Array(e,8)}(t);case"Int16":return function(e){return new Int16Array(e,4)}(t);default:return kf(t)}}function kf(e){return new Uint32Array(e,4)}const xf={name:"I3S Attribute",id:"i3s-attribute",module:"i3s",version:"3.3.0-alpha.3",mimeTypes:["application/binary"],parse:async function(e,t){return e=wf(e,t)},extensions:["bin"],options:{},binary:!0};function Ef(){let e;if("undefined"!=typeof window&&window.performance)e=window.performance.now();else if("undefined"!=typeof process&&process.hrtime){const t=process.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}class Af{constructor(e,t){wo(this,"name",void 0),wo(this,"type",void 0),wo(this,"sampleSize",1),wo(this,"time",void 0),wo(this,"count",void 0),wo(this,"samples",void 0),wo(this,"lastTiming",void 0),wo(this,"lastSampleTime",void 0),wo(this,"lastSampleCount",void 0),wo(this,"_count",0),wo(this,"_time",0),wo(this,"_samples",0),wo(this,"_startTime",0),wo(this,"_timerPending",!1),this.name=e,this.type=t,this.reset()}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=Ef(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Ef()-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}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}_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)}}class Sf{constructor(e){wo(this,"id",void 0),wo(this,"stats",{}),this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"count";return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(const e in this.stats)this.stats[e].reset();return this}forEach(e){for(const t in this.stats)e(this.stats[t])}getTable(){const e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach(e=>this._getOrCreate(e))}_getOrCreate(e){if(!e||!e.name)return null;const{name:t,type:r}=e;return this.stats[t]||(this.stats[t]=e instanceof Af?e:new Af(t,r)),this.stats[t]}}function jf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Tf={id:"request-scheduler",throttleRequests:!0,maxRequests:6};class Cf{constructor(e={}){jf(this,"props",void 0),jf(this,"stats",void 0),jf(this,"activeRequestCount",0),jf(this,"requestQueue",[]),jf(this,"requestMap",new Map),jf(this,"deferredUpdate",null),this.props={...Tf,...e},this.stats=new Sf({id:this.props.id}),this.stats.get("Queued Requests"),this.stats.get("Active Requests"),this.stats.get("Cancelled Requests"),this.stats.get("Queued Requests Ever"),this.stats.get("Active Requests Ever")}scheduleRequest(e,t=(()=>0)){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);const r={handle:e,priority:0,getPriority:t},n=new Promise(e=>(r.resolve=e,r));return this.requestQueue.push(r),this.requestMap.set(e,n),this._issueNewRequests(),n}_issueRequest(e){const{handle:t,resolve:r}=e;let n=!1;const i=()=>{n||(n=!0,this.requestMap.delete(t),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:i}):Promise.resolve({done:i})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequestsAsync(){this.deferredUpdate=null;const e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==e){this._updateAllRequests();for(let t=0;t<e;++t){const e=this.requestQueue.shift();e&&this._issueRequest(e)}}}_updateAllRequests(){const e=this.requestQueue;for(let t=0;t<e.length;++t){const r=e[t];this._updateRequest(r)||(e.splice(t,1),this.requestMap.delete(r.handle),t--)}e.sort((e,t)=>e.priority-t.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),!(e.priority<0)||(e.resolve(null),!1)}}function Bf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Rf{constructor(e,t,r){Bf(this,"item",void 0),Bf(this,"previous",void 0),Bf(this,"next",void 0),this.item=e,this.previous=t,this.next=r}}function Of(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class If{constructor(){Of(this,"head",null),Of(this,"tail",null),Of(this,"_length",0)}get length(){return this._length}add(e){const t=new Rf(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),++this._length,t}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,t){e!==t&&(this.remove(t),this._insert(e,t))}_insert(e,t){const r=e.next;e.next=t,this.tail===e?this.tail=t:r.previous=t,t.next=r,t.previous=e,++this._length}}function Pf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Df(e){return null!=e}class Mf{constructor(){Pf(this,"_list",void 0),Pf(this,"_sentinel",void 0),Pf(this,"_trimTiles",void 0),this._list=new If,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(e){const t=e._cacheNode;Df(t)&&this._list.splice(this._sentinel,t)}add(e,t,r){Df(t._cacheNode)||(t._cacheNode=this._list.add(t),r&&r(e,t))}unloadTile(e,t,r){const n=t._cacheNode;Df(n)&&(this._list.remove(n),t._cacheNode=void 0,r&&r(e,t))}unloadTiles(e,t){const r=this._trimTiles;this._trimTiles=!1;const n=this._list,i=1024*e.maximumMemoryUsage*1024,a=this._sentinel;let o=n.head;for(;o!==a&&(e.gpuMemoryUsageInBytes>i||r);){const r=o.item;o=o.next,this.unloadTile(e,r,t)}}trim(){this._trimTiles=!0}}const Ff=new Ds,Lf=new Ds,Nf=new wp([new gp,new gp,new gp,new gp,new gp,new gp]);function zf(e,t){const{cameraDirection:r,cameraUp:n,height:i}=e,{metersPerUnit:a}=e.distanceScales,o=qf(e,e.center),s=_u.WGS84.eastNorthUpToFixedFrame(o),u=e.unprojectPosition(e.cameraPosition),c=_u.WGS84.cartographicToCartesian(u,new Ds),l=new Ds(s.transformAsVector(new Ds(r).scale(a))).normalize(),h=new Ds(s.transformAsVector(new Ds(n).scale(a))).normalize();!function(e){const t=e.getFrustumPlanes(),r=Uf(t.near,e.cameraPosition),n=qf(e,r),i=qf(e,e.cameraPosition,Lf);let a=0;Nf.planes[a++].fromPointNormal(n,Ff.copy(n).subtract(i));for(const i in t){if("near"===i)continue;const o=Uf(t[i],r,Lf),s=qf(e,o,Lf);Nf.planes[a++].fromPointNormal(s,Ff.copy(n).subtract(s))}}(e);const p=e.constructor,{longitude:f,latitude:d,width:m,bearing:g,zoom:y}=e;return{camera:{position:c,direction:l,up:h},viewport:e,topDownViewport:new p({longitude:f,latitude:d,height:i,width:m,bearing:g,zoom:y,pitch:0}),height:i,cullingVolume:Nf,frameNumber:t,sseDenominator:1.15}}function Uf(e,t,r=new Ds){const n=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-n).add(t),r}function qf(e,t,r=new Ds){const n=e.unprojectPosition(t);return _u.WGS84.cartographicToCartesian(n,r)}const Hf=new Ds;function Gf(e,t){if(e instanceof fp){const{halfAxes:r}=e,n=function(e){e.getColumn(0,Hf);const t=e.getColumn(1),r=e.getColumn(2),n=Hf.add(t).add(r);return n.len()}(r);return Math.log2(6356752.314245179/(n+t[2]))}if(e instanceof _h){const{radius:r}=e;return Math.log2(6356752.314245179/(r+t[2]))}if(e.width&&e.height){const{width:t,height:r}=e;return(Math.log2(6378137/t)+Math.log2(6378137/r))/2}return 1}function Vf(e,t,r){const n=_u.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],new Ds),i=Math.sqrt(Math.pow(n[0]-r[0],2)+Math.pow(n[1]-r[1],2)+Math.pow(n[2]-r[2],2));return Math.log2(6356752.314245179/(i+t[2]))}function Wf(e){return null!=e}const Kf=new Ds,Jf=new Ds,Qf=new Ds;function Yf(e,t,r){if(Vi(e,"3D Tile: boundingVolume must be defined"),e.box)return function(e,t,r){const n=new Ds(e[0],e[1],e[2]);t.transform(n,n);let i=[];if(10===e.length){const t=e.slice(3,6),r=new Yh;r.fromArray(e,6);const n=new Ds([1,0,0]),a=new Ds([0,1,0]),o=new Ds([0,0,1]);n.transformByQuaternion(r),n.scale(t[0]),a.transformByQuaternion(r),a.scale(t[1]),o.transformByQuaternion(r),o.scale(t[2]),i=[...n.toArray(),...a.toArray(),...o.toArray()]}else i=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];const a=t.transformAsVector(i.slice(0,3)),o=t.transformAsVector(i.slice(3,6)),s=t.transformAsVector(i.slice(6,9)),u=new Th([a[0],a[1],a[2],o[0],o[1],o[2],s[0],s[1],s[2]]);if(Wf(r))return r.center=n,r.halfAxes=u,r;return new fp(n,u)}(e.box,t,r);if(e.region){const[t,r,n,i,a,o]=e.region,s=_u.WGS84.cartographicToCartesian([cs(t),cs(i),a],Jf),u=_u.WGS84.cartographicToCartesian([cs(n),cs(r),o],Qf),c=(new Ds).addVectors(s,u).multiplyScalar(.5),l=(new Ds).subVectors(s,u).len()/2;return $f([c[0],c[1],c[2],l],new Js)}if(e.sphere)return $f(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function $f(e,t,r){const n=new Ds(e[0],e[1],e[2]);t.transform(n,n);const i=t.getScale(Kf),a=Math.max(Math.max(i[0],i[1]),i[2]),o=e[3]*a;return Wf(r)?(r.center=n,r.radius=o,r):new _h(n,o)}new Ds,new Ds,new Js,new Ds,new Ds,new Ds;function Xf(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){const r=e.dynamicScreenSpaceErrorComputedDensity,n=e.dynamicScreenSpaceErrorFactor;return function(e,t){const r=e*t;return 1-Math.exp(-r*r)}(t,r)*n}return 0}const Zf=new Ds,ed=new Ds,td=new Ds,rd=new Ds,nd=new Ds,id=new Js,ad=new Js;function od(e,t){const{topDownViewport:r}=t,n=e.header.mbs[1],i=e.header.mbs[0],a=e.header.mbs[2],o=e.header.mbs[3],s=[...e.boundingVolume.center],u=r.unprojectPosition(r.cameraPosition);_u.WGS84.cartographicToCartesian(u,Zf),ed.copy(Zf).subtract(s).normalize(),_u.WGS84.eastNorthUpToFixedFrame(s,id),ad.copy(id).invert(),td.copy(Zf).transform(ad);const c=Math.sqrt(td[0]*td[0]+td[1]*td[1]),l=c*c/td[2];rd.copy([td[0],td[1],l]);const h=rd.transform(id).subtract(s).normalize(),p=ed.cross(h).normalize().scale(o).add(s),f=_u.WGS84.cartesianToCartographic(p),d=r.project([i,n,a]),m=r.project(f);return nd.copy(d).subtract(m).magnitude()}function sd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ud{constructor(e=0){sd(this,"_map",new Map),sd(this,"_array",void 0),sd(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 Vi(e<this._array.length),this._array[e]}set(e,t){Vi(e>=0),e>=this.length&&(this.length=e+1),this._map.has(this._array[e])&&this._map.delete(this._array[e]),this._array[e]=t,this._map.set(t,e)}delete(e){const t=this._map.get(e);t>=0&&(this._array.splice(t,1),this._map.delete(e),this.length--)}peek(){return this._array[this._length-1]}push(e){if(!this._map.has(e)){const t=this.length++;this._array[t]=e,this._map.set(e,t)}}pop(){const e=this._array[--this.length];return this._map.delete(e),e}reserve(e){Vi(e>=0),e>this._array.length&&(this._array.length=e)}resize(e){Vi(e>=0),this.length=e}trim(e){null==e&&(e=this.length),this._array.length=e}reset(){this._array=[],this._map=new Map,this._length=0}find(e){return this._map.has(e)}}function cd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ld={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""};class hd{traversalFinished(e){return!0}constructor(e){cd(this,"options",void 0),cd(this,"root",void 0),cd(this,"requestedTiles",void 0),cd(this,"selectedTiles",void 0),cd(this,"emptyTiles",void 0),cd(this,"lastUpdate",(new Date).getTime()),cd(this,"updateDebounceTime",1e3),cd(this,"_traversalStack",void 0),cd(this,"_emptyTraversalStack",void 0),cd(this,"_frameNumber",void 0),this.options={...ld,...e},this._traversalStack=new ud,this._emptyTraversalStack=new ud,this._frameNumber=null,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={}}traverse(e,t,r){this.root=e,this.options={...this.options,...r},this.reset(),this.updateTile(e,t),this._frameNumber=t.frameNumber,this.executeTraversal(e,t)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(e,t){const r=this._traversalStack;for(e._selectionDepth=1,r.push(e);r.length>0;){const e=r.pop();let n=!1;this.canTraverse(e,t)&&(this.updateChildTiles(e,t),n=this.updateAndPushChildren(e,t,r,e.hasRenderContent?e._selectionDepth+1:e._selectionDepth));const i=e.parent,a=Boolean(!i||i._shouldRefine),o=!n;e.hasRenderContent?e.refine===tf?(this.loadTile(e,t),this.selectTile(e,t)):e.refine===rf&&(this.loadTile(e,t),o&&this.selectTile(e,t)):(this.emptyTiles[e.id]=e,this.loadTile(e,t),o&&this.selectTile(e,t)),this.touchTile(e,t),e._shouldRefine=n&&a}const n=(new Date).getTime();(this.traversalFinished(t)||n-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=n,this.options.onTraversalEnd(t))}updateChildTiles(e,t){const r=e.children;for(const e of r)this.updateTile(e,t);return!0}updateAndPushChildren(e,t,r,n){const{loadSiblings:i,skipLevelOfDetail:a}=this.options,o=e.children;o.sort(this.compareDistanceToCamera.bind(this));const s=e.refine===rf&&e.hasRenderContent&&!a;let u=!1,c=!0;for(const e of o)if(e._selectionDepth=n,e.isVisibleAndInRequestVolume?(r.find(e)&&r.delete(e),r.push(e),u=!0):(s||i)&&(this.loadTile(e,t),this.touchTile(e,t)),s){let r;if(r=!!e._inRequestVolume&&(e.hasRenderContent?e.contentAvailable:this.executeEmptyTraversal(e,t)),c=c&&r,!c)return!1}return u||(c=!1),c}updateTile(e,t){this.updateTileVisibility(e,t)}selectTile(e,t){this.shouldSelectTile(e)&&(e._selectedFrame=t.frameNumber,this.selectedTiles[e.id]=e)}loadTile(e,t){this.shouldLoadTile(e)&&(e._requestedFrame=t.frameNumber,e._priority=e._getPriority(),this.requestedTiles[e.id]=e)}touchTile(e,t){e.tileset._cache.touch(e),e._touchedFrame=t.frameNumber}canTraverse(e,t,r=!1,n=!1){return!!e.hasChildren&&(e.hasTilesetContent?!e.contentExpired:!(!n&&!e.isVisibleAndInRequestVolume)&&this.shouldRefine(e,t,r))}shouldLoadTile(e){return e.hasUnloadedContent||e.contentExpired}shouldSelectTile(e){return e.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(e,t,r){let n=e._screenSpaceError;return r&&(n=e.getScreenSpaceError(t,!0)),n>this.options.maximumScreenSpaceError}updateTileVisibility(e,t){const r=[];if(this.options.viewportTraversersMap)for(const e in this.options.viewportTraversersMap){this.options.viewportTraversersMap[e]===t.viewport.id&&r.push(e)}else r.push(t.viewport.id);e.updateVisibility(t,r)}compareDistanceToCamera(e,t){return e._distanceToCamera-t._distanceToCamera}anyChildrenVisible(e,t){let r=!1;for(const n of e.children)n.updateVisibility(t),r=r||n.isVisibleAndInRequestVolume;return r}executeEmptyTraversal(e,t){let r=!0;const n=this._emptyTraversalStack;for(n.push(e);n.length>0&&r;){const e=n.pop();this.updateTile(e,t),e.isVisibleAndInRequestVolume||this.loadTile(e,t),this.touchTile(e,t);if(!e.hasRenderContent&&this.canTraverse(e,t,!1,!0)){const t=e.children;for(const e of t)n.find(e)&&n.delete(e),n.push(e)}else e.contentAvailable||(r=!1)}return r}}function pd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const fd=new Ds;class dd{constructor(e,t,r,n=""){pd(this,"tileset",void 0),pd(this,"header",void 0),pd(this,"id",void 0),pd(this,"url",void 0),pd(this,"parent",void 0),pd(this,"refine",void 0),pd(this,"type",void 0),pd(this,"contentUrl",void 0),pd(this,"lodMetricType",void 0),pd(this,"lodMetricValue",void 0),pd(this,"boundingVolume",void 0),pd(this,"content",void 0),pd(this,"contentState",void 0),pd(this,"gpuMemoryUsageInBytes",void 0),pd(this,"children",void 0),pd(this,"depth",void 0),pd(this,"viewportIds",void 0),pd(this,"transform",void 0),pd(this,"extensions",void 0),pd(this,"userData",void 0),pd(this,"computedTransform",void 0),pd(this,"hasEmptyContent",void 0),pd(this,"hasTilesetContent",void 0),pd(this,"traverser",void 0),pd(this,"_cacheNode",void 0),pd(this,"_frameNumber",void 0),pd(this,"_lodJudge",void 0),pd(this,"_expireDate",void 0),pd(this,"_expiredContent",void 0),pd(this,"_shouldRefine",void 0),pd(this,"_distanceToCamera",void 0),pd(this,"_centerZDepth",void 0),pd(this,"_screenSpaceError",void 0),pd(this,"_visibilityPlaneMask",void 0),pd(this,"_visible",void 0),pd(this,"_inRequestVolume",void 0),pd(this,"_stackLength",void 0),pd(this,"_selectionDepth",void 0),pd(this,"_touchedFrame",void 0),pd(this,"_visitedFrame",void 0),pd(this,"_selectedFrame",void 0),pd(this,"_requestedFrame",void 0),pd(this,"_priority",void 0),pd(this,"_contentBoundingVolume",void 0),pd(this,"_viewerRequestVolume",void 0),pd(this,"_initialTransform",void 0),this.header=t,this.tileset=e,this.id=n||t.id,this.url=t.url,this.parent=r,this.refine=this._getRefine(t.refine),this.type=t.type,this.contentUrl=t.contentUrl,this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=Yp,this.gpuMemoryUsageInBytes=0,this.children=[],this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.depth=0,this.viewportIds=[],this.userData={},this.extensions=null,this._priority=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._screenSpaceError=0,this._cacheNode=null,this._frameNumber=null,this._cacheNode=null,this.traverser=new hd({}),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._initialTransform=new Js,this.transform=new Js,this._initializeLodMetric(t),this._initializeTransforms(t),this._initializeBoundingVolumes(t),this._initializeContent(t),this._initializeRenderingState(t),this._lodJudge=null,this._expireDate=null,this._expiredContent=null,Object.seal(this)}destroy(){this.header=null}isDestroyed(){return null===this.header}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===Xp||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===Yp}get contentExpired(){return this.contentState===Zp}get contentFailed(){return this.contentState===ef}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}getScreenSpaceError(e,t){switch(this.tileset.type){case uf:return od(this,e);case cf:return function(e,t,r){const n=e.tileset,i=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,a=r?i:e.lodMetricValue;if(0===a)return 0;const o=Math.max(e._distanceToCamera,1e-7),{height:s,sseDenominator:u}=t,{viewDistanceScale:c}=n.options;let l=a*s*(c||1)/(o*u);return l-=Xf(n,o),l}(this,e,t);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getPriority(){const e=this.tileset._traverser,{skipLevelOfDetail:t}=e.options,r=this.refine===tf||t;if(r&&!this.isVisible&&void 0!==this._visible)return-1;if(this.tileset._frameNumber-this._touchedFrame>=1)return-1;if(this.contentState===Yp)return-1;const n=this.parent,i=n&&(!r||0===this._screenSpaceError||n.hasTilesetContent)?n._screenSpaceError:this._screenSpaceError,a=e.root?e.root._screenSpaceError:0;return Math.max(a-i,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=$p;const e=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!e)return this.contentState=Yp,!1;try{const t=this.tileset.getTileUrl(this.contentUrl),r=this.tileset.loader,n={...this.tileset.loadOptions,[r.id]:{...this.tileset.loadOptions[r.id],isTileset:"json"===this.type,...this._getLoaderSpecificOptions(r.id)}};return this.content=await Zo(t,r,n),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=Xp,this._onContentLoaded(),!0}catch(e){throw this.contentState=ef,e}finally{e.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=Yp,!0}updateVisibility(e,t){if(this._frameNumber===e.frameNumber)return;const r=this.parent,n=r?r._visibilityPlaneMask:wp.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){const e=r?r.computedTransform:this.tileset.modelMatrix;this._updateTransform(e)}this._distanceToCamera=this.distanceToTile(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._visibilityPlaneMask=this.visibility(e,n),this._visible=this._visibilityPlaneMask!==wp.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._frameNumber=e.frameNumber,this.viewportIds=t}visibility(e,t){const{cullingVolume:r}=e,{boundingVolume:n}=this;return r.computeVisibilityWithPlaneMask(n,t)}contentVisibility(){return!0}distanceToTile(e){const t=this.boundingVolume;return Math.sqrt(Math.max(t.distanceSquaredTo(e.camera.position),0))}cameraSpaceZDepth({camera:e}){const t=this.boundingVolume;return fd.subVectors(t.center,e.position),e.direction.dot(fd)}insideViewerRequestVolume(e){const t=this._viewerRequestVolume;return!t||t.distanceSquaredTo(e.camera.position)<=0}updateExpiration(){if(null!=this._expireDate&&this.contentReady&&!this.hasEmptyContent){const e=Date.now();Date.lessThan(this._expireDate,e)&&(this.contentState=Zp,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 Js(e.transform):new Js;const t=this.parent,r=this.tileset,n=t&&t.computedTransform?t.computedTransform.clone():r.modelMatrix.clone();this.computedTransform=new Js(n).multiplyRight(this.transform);const i=t&&t._initialTransform?t._initialTransform.clone():new Js;this._initialTransform=new Js(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=Yp,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=wp.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||rf}_isTileset(){return-1!==this.contentUrl.indexOf(".json")}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0}this._isTileset()&&(this.hasTilesetContent=!0)}_updateBoundingVolume(e){this.boundingVolume=Yf(e.boundingVolume,this.computedTransform,this.boundingVolume);const t=e.content;t&&(t.boundingVolume&&(this._contentBoundingVolume=Yf(t.boundingVolume,this.computedTransform,this._contentBoundingVolume)),e.viewerRequestVolume&&(this._viewerRequestVolume=Yf(e.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(e=new Js){const t=e.clone().multiplyRight(this.transform);!t.equals(this.computedTransform)&&(this.computedTransform=t,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(e){switch(e){case"i3s":return{...this.tileset.options.i3s,_tileOptions:{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},isTileHeader:!1};case"3d-tiles":case"cesium-ion":default:return{assetGltfUpAxis:(t=this.tileset.tileset).asset&&t.asset.gltfUpAxis||"Y"}}var t}}class md extends hd{compareDistanceToCamera(e,t){return 0===t._distanceToCamera&&0===e._distanceToCamera?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera}updateTileVisibility(e,t){if(super.updateTileVisibility(e,t),!e.isVisibleAndInRequestVolume)return;const r=e.children.length>0;if(e.hasTilesetContent&&r){const r=e.children[0];return this.updateTileVisibility(r,t),void(e._visible=r._visible)}if(this.meetsScreenSpaceErrorEarly(e,t))return void(e._visible=!1);const n=e.refine===rf,i=e._optimChildrenWithinParent===hf;n&&i&&r&&!this.anyChildrenVisible(e,t)&&(e._visible=!1)}meetsScreenSpaceErrorEarly(e,t){const{parent:r}=e;return!(!r||r.hasTilesetContent||r.refine!==tf)&&!this.shouldRefine(e,t,!0)}}class gd{constructor(){var e,t,r;e=this,t="frameNumberMap",r=new Map,t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}register(e,t){const r=this.frameNumberMap.get(e)||new Map,n=r.get(t)||0;r.set(t,n+1),this.frameNumberMap.set(e,r)}deregister(e,t){const r=this.frameNumberMap.get(e);if(!r)return;const n=r.get(t)||1;r.set(t,n-1)}isZero(e,t){var r;return 0===((null===(r=this.frameNumberMap.get(e))||void 0===r?void 0:r.get(t))||0)}}function yd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const bd="REQUESTED",vd="COMPLETED",wd="ERROR";class _d{constructor(){yd(this,"_statusMap",void 0),yd(this,"pendingTilesRegister",new gd),this._statusMap={}}add(e,t,r,n){if(!this._statusMap[t]){const{frameNumber:i,viewport:{id:a}}=n;this._statusMap[t]={request:e,callback:r,key:t,frameState:n,status:bd},this.pendingTilesRegister.register(a,i),e().then(e=>{this._statusMap[t].status=vd;const{frameNumber:r,viewport:{id:i}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(i,r),this._statusMap[t].callback(e,n)}).catch(e=>{this._statusMap[t].status=wd;const{frameNumber:n,viewport:{id:i}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(i,n),r(e)})}}update(e,t){if(this._statusMap[e]){const{frameNumber:r,viewport:{id:n}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(n,r);const{frameNumber:i,viewport:{id:a}}=t;this.pendingTilesRegister.register(a,i),this._statusMap[e].frameState=t}}find(e){return this._statusMap[e]}hasPendingTiles(e,t){return!this.pendingTilesRegister.isZero(e,t)}}class kd extends hd{traversalFinished(e){return!this._tileManager.hasPendingTiles(e.viewport.id,this._frameNumber||0)}constructor(e){var t,r,n;super(e),n=void 0,(r="_tileManager")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,this._tileManager=new _d}shouldRefine(e,t){return e._lodJudge=function(e,t){if(0===e.lodMetricValue||isNaN(e.lodMetricValue))return"DIG";const r=2*od(e,t);return r<2?"OUT":!e.header.children||r<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}(e,t),"DIG"===e._lodJudge}updateChildTiles(e,t){const r=e.header.children||[],n=e.children,i=e.tileset;for(const a of r){const r=`${a.id}-${t.viewport.id}`,o=n&&n.find(e=>e.id===r);if(o)o&&this.updateTile(o,t);else{let n=()=>this._loadTile(a.id,i);this._tileManager.find(r)?this._tileManager.update(r,t):(i.tileset.nodePages&&(n=()=>i.tileset.nodePagesTile.formTileFromNodePages(a.id)),this._tileManager.add(n,r,t=>this._onTileLoad(t,e,r),t))}}return!1}async _loadTile(e,t){const{loader:r}=t,n=t.getTileUrl(`${t.url}/nodes/${e}`),i={...t.loadOptions,i3s:{...t.loadOptions.i3s,isTileHeader:!0}};return await Zo(n,r,i)}_onTileLoad(e,t,r){const n=new dd(t.tileset,e,t,r);t.children.push(n);const i=this._tileManager.find(n.id).frameState;this.updateTile(n,i),this._frameNumber===i.frameNumber&&(this.traversalFinished(i)||(new Date).getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(n,i)}}function xd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ed={description:"",ellipsoid:_u.WGS84,modelMatrix:new Js,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},Ad="Tiles In Tileset(s)";class Sd{constructor(e,t){xd(this,"options",void 0),xd(this,"loadOptions",void 0),xd(this,"type",void 0),xd(this,"tileset",void 0),xd(this,"loader",void 0),xd(this,"url",void 0),xd(this,"basePath",void 0),xd(this,"modelMatrix",void 0),xd(this,"ellipsoid",void 0),xd(this,"lodMetricType",void 0),xd(this,"lodMetricValue",void 0),xd(this,"refine",void 0),xd(this,"root",void 0),xd(this,"roots",void 0),xd(this,"asset",void 0),xd(this,"description",void 0),xd(this,"properties",void 0),xd(this,"extras",void 0),xd(this,"attributions",void 0),xd(this,"credits",void 0),xd(this,"stats",void 0),xd(this,"traverseCounter",void 0),xd(this,"geometricError",void 0),xd(this,"selectedTiles",void 0),xd(this,"updatePromise",null),xd(this,"tilesetInitializationPromise",void 0),xd(this,"cartographicCenter",void 0),xd(this,"cartesianCenter",void 0),xd(this,"zoom",void 0),xd(this,"boundingVolume",void 0),xd(this,"gpuMemoryUsageInBytes",void 0),xd(this,"dynamicScreenSpaceErrorComputedDensity",void 0),xd(this,"_traverser",void 0),xd(this,"_cache",void 0),xd(this,"_requestScheduler",void 0),xd(this,"_frameNumber",void 0),xd(this,"_queryParamsString",void 0),xd(this,"_queryParams",void 0),xd(this,"_extensionsUsed",void 0),xd(this,"_tiles",void 0),xd(this,"_pendingCount",void 0),xd(this,"lastUpdatedVieports",void 0),xd(this,"_requestedTiles",void 0),xd(this,"_emptyTiles",void 0),xd(this,"frameStateData",void 0),xd(this,"maximumMemoryUsage",void 0),Vi(e),this.options={...Ed,...t},this.tileset=e,this.loader=e.loader,this.type=e.type,this.url=e.url,this.basePath=e.basePath||n.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.root=null,this.roots={},this.cartographicCenter=null,this.cartesianCenter=null,this.zoom=1,this.boundingVolume=null,this.traverseCounter=0,this.geometricError=0,this._traverser=this._initializeTraverser(),this._cache=new Mf,this._requestScheduler=new Cf({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this._frameNumber=0,this._pendingCount=0,this._tiles={},this.selectedTiles=[],this._emptyTiles=[],this._requestedTiles=[],this.frameStateData={},this.lastUpdatedVieports=null,this._queryParams={},this._queryParamsString="",this.maximumMemoryUsage=this.options.maximumMemoryUsage||32,this.gpuMemoryUsageInBytes=0,this.stats=new Sf({id:this.url}),this._initializeStats(),this._extensionsUsed=void 0,this.dynamicScreenSpaceErrorComputedDensity=0,this.extras=null,this.asset={},this.credits={},this.description=this.options.description||"",this.tilesetInitializationPromise=this._initializeTileSet(e)}destroy(){this._destroy()}isLoaded(){return 0===this._pendingCount&&0!==this._frameNumber&&0===this._requestedTiles.length}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return this._queryParamsString||(this._queryParamsString=function(e){const t=[];for(const r of Object.keys(e))t.push(`${r}=${e[r]}`);switch(t.length){case 0:return"";case 1:return"?"+t[0];default:return"?"+t.join("&")}}(this._queryParams)),this._queryParamsString}setProps(e){this.options={...this.options,...e}}setOptions(e){this.options={...this.options,...e}}getTileUrl(e){return e.startsWith("data:")?e:`${e}${this.queryParams}`}hasExtension(e){return Boolean(this._extensionsUsed&&this._extensionsUsed.indexOf(e)>-1)}update(e=null){this.tilesetInitializationPromise.then(()=>{!e&&this.lastUpdatedVieports?e=this.lastUpdatedVieports:this.lastUpdatedVieports=e,e&&this.doUpdate(e)})}async selectTiles(e=null){return await this.tilesetInitializationPromise,e&&(this.lastUpdatedVieports=e),this.updatePromise||(this.updatePromise=new Promise(e=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),e(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}doUpdate(e){if("loadTiles"in this.options&&!this.options.loadTiles)return;if(this.traverseCounter>0)return;const t=e instanceof Array?e:[e];this._cache.reset(),this._frameNumber++,this.traverseCounter=t.length;const r=[];for(const e of t){const t=e.id;this._needTraverse(t)?r.push(t):this.traverseCounter--}for(const e of t){const t=e.id;if(this.roots[t]||(this.roots[t]=this._initializeTileHeaders(this.tileset,null)),!r.includes(t))continue;const n=zf(e,this._frameNumber);this._traverser.traverse(this.roots[t],n,this.options)}}_needTraverse(e){let t=e;return this.options.viewportTraversersMap&&(t=this.options.viewportTraversersMap[e]),t===e}_onTraversalEnd(e){const t=e.viewport.id;this.frameStateData[t]||(this.frameStateData[t]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});const r=this.frameStateData[t],n=Object.values(this._traverser.selectedTiles),[i,a]=function(e,t,r){if(0===r||e.length<=r)return[e,[]];const n=[],{longitude:i,latitude:a}=t.viewport;for(const[t,r]of e.entries()){const[e,o]=r.header.mbs,s=Math.abs(i-e),u=Math.abs(a-o),c=Math.sqrt(u*u+s*s);n.push([t,c])}const o=n.sort((e,t)=>e[1]-t[1]),s=[];for(let t=0;t<r;t++)s.push(e[o[t][0]]);const u=[];for(let t=r;t<o.length;t++)u.push(e[o[t][0]]);return[s,u]}(n,e,this.options.maximumTilesSelected);r.selectedTiles=i;for(const e of a)e.unselect();r._requestedTiles=Object.values(this._traverser.requestedTiles),r._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,this.traverseCounter>0||this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(const e in this.frameStateData){const t=this.frameStateData[e];this.selectedTiles=this.selectedTiles.concat(t.selectedTiles),this._requestedTiles=this._requestedTiles.concat(t._requestedTiles),this._emptyTiles=this._emptyTiles.concat(t._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(const e of this.selectedTiles)this._tiles[e.id]=e;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(e,t){if(e.length!==t.length)return!0;const r=new Set(e.map(e=>e.id)),n=new Set(t.map(e=>e.id));let i=e.filter(e=>!n.has(e.id)).length>0;return i=i||t.filter(e=>!r.has(e.id)).length>0,i}_loadTiles(){for(const e of this._requestedTiles)e.contentUnloaded&&this._loadTile(e)}_unloadTiles(){this._cache.unloadTiles(this,(e,t)=>e._unloadTile(t))}_updateStats(){let e=0,t=0;for(const r of this.selectedTiles)r.contentAvailable&&r.content&&(e++,r.content.pointCount?t+=r.content.pointCount:t+=r.content.vertexCount);this.stats.get("Tiles In View").count=this.selectedTiles.length,this.stats.get("Tiles To Render").count=e,this.stats.get("Points/Vertices").count=t}async _initializeTileSet(e){this.type===uf&&(this.calculateViewPropsI3S(),e.root=await e.root),this.root=this._initializeTileHeaders(e,null),this.type===cf&&(this._initializeTiles3DTileset(e),this.calculateViewPropsTiles3D()),this.type===uf&&this._initializeI3STileset()}calculateViewPropsI3S(){var e;const t=this.tileset.fullExtent;if(t){const{xmin:e,xmax:r,ymin:n,ymax:i,zmin:a,zmax:o}=t;return this.cartographicCenter=new Ds(e+(r-e)/2,n+(i-n)/2,a+(o-a)/2),this.cartesianCenter=_u.WGS84.cartographicToCartesian(this.cartographicCenter,new Ds),void(this.zoom=Vf(t,this.cartographicCenter,this.cartesianCenter))}const r=null===(e=this.tileset.store)||void 0===e?void 0:e.extent;if(r){const[e,t,n,i]=r;return this.cartographicCenter=new Ds(e+(n-e)/2,t+(i-t)/2,0),this.cartesianCenter=_u.WGS84.cartographicToCartesian(this.cartographicCenter,new Ds),void(this.zoom=function(e,t,r){const[n,i,a,o]=e;return Vf({xmin:n,xmax:a,ymin:i,ymax:o,zmin:0,zmax:0},t,r)}(r,this.cartographicCenter,this.cartesianCenter))}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new Ds,this.zoom=1}calculateViewPropsTiles3D(){const e=this.root;Vi(e);const{center:t}=e.boundingVolume;if(!t)return console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new Ds,void(this.zoom=1);0!==t[0]||0!==t[1]||0!==t[2]?this.cartographicCenter=_u.WGS84.cartesianToCartographic(t,new Ds):this.cartographicCenter=new Ds(0,0,-_u.WGS84.radii[0]),this.cartesianCenter=t,this.zoom=Gf(e.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(Ad),this.stats.get("Tiles Loading"),this.stats.get("Tiles In Memory"),this.stats.get("Tiles In View"),this.stats.get("Tiles To Render"),this.stats.get("Tiles Loaded"),this.stats.get("Tiles Unloaded"),this.stats.get("Failed Tile Loads"),this.stats.get("Points/Vertices","memory"),this.stats.get("Tile Memory Use","memory")}_initializeTileHeaders(e,t){const r=new dd(this,e.root,t);if(t&&(t.children.push(r),r.depth=t.depth+1),this.type===cf){const e=[];for(e.push(r);e.length>0;){const t=e.pop();this.stats.get(Ad).incrementCount();const r=t.header.children||[];for(const n of r){const r=new dd(this,n,t);t.children.push(r),r.depth=t.depth+1,e.push(r)}}}return r}_initializeTraverser(){let e;switch(this.type){case cf:e=md;break;case uf:e=kd;break;default:e=hd}return new e({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(e){this._destroySubtree(e)}async _loadTile(e){let t;try{this._onStartTileLoading(),t=await e.loadContent()}catch(t){this._onTileLoadError(e,t)}finally{this._onEndTileLoading(),this._onTileLoad(e,t)}}_onTileLoadError(e,t){this.stats.get("Failed Tile Loads").incrementCount();const r=t.message||t.toString(),n=e.url;console.error(`A 3D tile failed to load: ${e.url} ${r}`),this.options.onTileError(e,r,n)}_onTileLoad(e,t){if(t){if(this.type===uf){var r,n;const e=(null===(r=this.tileset)||void 0===r||null===(n=r.nodePagesTile)||void 0===n?void 0:n.nodesInNodePages)||0;this.stats.get(Ad).reset(),this.stats.get(Ad).addCount(e)}e&&e.content&&function(e,t){Vi(e),Vi(t);const{rtcCenter:r,gltfUpAxis:n}=t,{computedTransform:i,boundingVolume:{center:a}}=e;let o=new Js(i);switch(r&&o.translate(r),n){case"Z":break;case"Y":const e=(new Js).rotateX(Math.PI/2);o=o.multiplyRight(e);break;case"X":const t=(new Js).rotateY(-Math.PI/2);o=o.multiplyRight(t)}t.isQuantized&&o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);const s=new Ds(a);t.cartesianModelMatrix=o,t.cartesianOrigin=s;const u=_u.WGS84.cartesianToCartographic(s,new Ds),c=_u.WGS84.eastNorthUpToFixedFrame(s).invert();t.cartographicModelMatrix=c.multiplyRight(o),t.cartographicOrigin=u,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}(e,e.content),this._addTileToCache(e),this.options.onTileLoad(e)}}_onStartTileLoading(){this._pendingCount++,this.stats.get("Tiles Loading").incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get("Tiles Loading").decrementCount()}_addTileToCache(e){this._cache.add(this,e,t=>t._updateCacheStats(e))}_updateCacheStats(e){this.stats.get("Tiles Loaded").incrementCount(),this.stats.get("Tiles In Memory").incrementCount(),this.gpuMemoryUsageInBytes+=e.content.byteLength||0,this.stats.get("Tile Memory Use").count=this.gpuMemoryUsageInBytes}_unloadTile(e){this.gpuMemoryUsageInBytes-=e.content&&e.content.byteLength||0,this.stats.get("Tiles In Memory").decrementCount(),this.stats.get("Tiles Unloaded").incrementCount(),this.stats.get("Tile Memory Use").count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(e),e.unloadContent()}_destroy(){const e=[];for(this.root&&e.push(this.root);e.length>0;){const t=e.pop();for(const r of t.children)e.push(r);this._destroyTile(t)}this.root=null}_destroySubtree(e){const t=e,r=[];for(r.push(t);r.length>0;){e=r.pop();for(const t of e.children)r.push(t);e!==t&&this._destroyTile(e)}t.children=[]}_destroyTile(e){this._cache.unloadTile(this,e),this._unloadTile(e),e.destroy()}_initializeTiles3DTileset(e){if(this.asset=e.asset,!this.asset)throw new Error("Tileset must have an asset property.");if("0.0"!==this.asset.version&&"1.0"!==this.asset.version)throw new Error("The tileset must be 3D Tiles version 0.0 or 1.0.");"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)}}const jd=[9,-18,-88,0,96,90,0,0,-60,-20,-9,18,8,0,-96,30,0,0,60,-20,9,-88,-18,90,96,0,-20,-60,0,0,186,-42,-42,-150,-96,-150,60,60,60,60,54,162,-78,30,-24,-90,-60,60,-60,60,-9,-32,18,30,24,0,20,-60,0,0,-9,8,18,30,-96,0,-20,60,0,0,54,-78,162,-90,-24,30,60,-60,60,-60,-54,78,78,90,144,90,-60,-60,-60,-60,9,-8,-18,-30,-24,0,20,60,0,0,-9,18,-32,0,24,30,0,0,-60,20,9,-18,-8,0,-24,-30,0,0,60,20],Td=[0,0,-131,0,138,144,0,0,-102,-31,0,0,7,0,-138,42,0,0,102,-31,62,0,-31,0,0,-62,0,0,0,31,124,0,-62,0,0,-124,0,0,0,62,124,0,-62,0,0,-124,0,0,0,62,62,0,-31,0,0,-62,0,0,0,31,0,0,45,0,-183,-9,0,93,18,0,0,0,216,0,33,87,0,-93,12,-93,0,0,156,0,153,99,0,-93,-12,-93,0,0,-45,0,-3,9,0,93,-18,0,0,0,-55,0,48,42,0,0,-84,31,0,0,-7,0,-48,-42,0,0,84,31],Cd=[18,-36,-122,0,120,135,0,0,-84,-31,-18,36,-2,0,-120,51,0,0,84,-31,36,-165,-27,93,147,-9,0,-93,18,0,210,45,-111,-93,-57,-192,0,93,12,93,162,141,-75,-93,-129,-180,0,93,-12,93,-36,-21,27,93,39,9,0,-93,-18,0,0,0,62,0,0,31,0,0,0,-31,0,0,124,0,0,62,0,0,0,-62,0,0,124,0,0,62,0,0,0,-62,0,0,62,0,0,31,0,0,0,-31,-18,36,-64,0,66,51,0,0,-102,31,18,-36,2,0,-66,-51,0,0,102,31];class Bd{constructor(e){this.options=e,this._v00=0,this._v01=0,this._v10=0,this._v11=0,this._t=[],this._ix=this.options._width,this._iy=this.options._height}getHeight(e,t){if(e=Math.abs(e)>90?NaN:e,isNaN(e)||isNaN(t))return NaN;const r=function(e,t){t=Math.abs(t);let r=Rd(e,t);2*Math.abs(r)===t?r-=Rd(e,2*t)-r:2*Math.abs(r)>t&&(r+=r<0?t:-t);return r}(t,360);let n=(t=-180!==r?r:180)*this.options._rlonres,i=-e*this.options._rlatres,a=Math.floor(n),o=Math.min(Math.round((this.options._height-1)/2-1),Math.floor(i));n-=a,i-=o,o+=(this.options._height-1)/2,a+=a<0?this.options._width:a>=this.options._width?-this.options._width:0;let s=0,u=0,c=0,l=0,h=new Array(10);if(a!==this._ix||o!==this._iy)if(this.options.cubic){const e=[this._rawval(a,o-1),this._rawval(a+1,o-1),this._rawval(a-1,o),this._rawval(a,o),this._rawval(a+1,o),this._rawval(a+2,o),this._rawval(a-1,o+1),this._rawval(a,o+1),this._rawval(a+1,o+1),this._rawval(a+2,o+1),this._rawval(a,o+2),this._rawval(a+1,o+2)];let t=Td;0!==o&&(t=o===this.options._height-2?Cd:jd);let r=372;0!==o&&(r=o===this.options._height-2?372:240);for(let n=0;n<10;++n){h[n]=0;for(let r=0;r<12;++r)h[n]+=e[r]*t[10*r+n];h[n]/=r}}else s=this._rawval(a,o),u=this._rawval(a+1,o),c=this._rawval(a,o+1),l=this._rawval(a+1,o+1);else this.options.cubic?h=this._t:(s=this._v00,u=this._v01,c=this._v10,l=this._v11);if(!this.options.cubic){const e=(1-i)*((1-n)*s+n*u)+i*((1-n)*c+n*l),t=this.options._offset+this.options._scale*e;return this._ix=a,this._iy=o,this._v00=s,this._v01=u,this._v10=c,this._v11=l,t}let p=h[0]+n*(h[1]+n*(h[3]+n*h[6]))+i*(h[2]+n*(h[4]+n*h[7])+i*(h[5]+n*h[8]+i*h[9]));return p=this.options._offset+this.options._scale*p,this._ix=a,this._iy=o,this._t=h,p}_rawval(e,t){e<0?e+=this.options._width:e>=this.options._width&&(e-=this.options._width),(t<0||t>=this.options._height)&&(t=t<0?-t:2*(this.options._height-1)-t,e+=(e<this.options._width/2?1:-1)*this.options._width/2);const r=this.options._datastart+2*(t*this.options._swidth+e);return this.options.data[r]<<8|this.options.data[r+1]}}function Rd(e,t){return e-Math.floor(e/t)*t}function Od(e,t){const r=function*(e){let t=0;do{const r=e.indexOf(10,t);if(-1!==r){const n=e.subarray(t,r);t=r+1,yield{offset:t,line:Id(n)}}else{const r=e.subarray(t,e.length);t=e.length,yield{offset:t,line:Id(r)}}}while(t<e.length);return{offset:t,line:""}}(e);let n=r.next();if(n.done||"P5"!==n.value.line)throw new Error("Geoid model file: File not in PGM format");let i=Number.MAX_VALUE,a=0,o=-1,s=-1,u="NONE",c="UNKNOWN",l=0,h=0,p=null,f=null;do{n=r.next();const e=n.value.line;if(e.length){if("#"!==e[0]){let t=e.split(" ");if(t=t.filter(e=>""!==e),l=parseInt(t[0],10),h=parseInt(t[1],10),!l||!h)throw new Error("Geoid model file: Error reading raster size");break}{const r=e.split(" "),n=r[0],l=r[1];if("#"!==n||!l)continue;const h=r.length>2?r.slice(2):[];if("Description"===l)u=h.join(" ");else if("DateTime"===l)c=h.join(" ");else if("Offset"===l){if(!r[2])throw new Error("Geoid model file: Error reading offset");i=parseInt(r[2],10)}else if("Scale"===l){if(!r[2])throw new Error("Geoid model file: Error reading scale");a=parseFloat(r[2])}else l===(t.cubic?"MaxCubicError":"MaxBilinearError")?isFinite(parseFloat(r[2]))&&(o=parseFloat(r[2])):l===(t.cubic?"RMSCubicError":"RMSBilinearError")&&isFinite(parseFloat(r[2]))&&(s=parseFloat(r[2]))}}}while(!n.done);n=r.next();const d=parseInt(n.value.line,10);if(n.done)throw new Error("Geoid model file: Error reading maxval");if(65535!==d)throw new Error("Geoid model file: Incorrect value of maxval");if(p=n.value.offset,f=l,i===Number.MAX_VALUE)throw new Error("Geoid model file: Offset not set");if(0===a)throw new Error("Geoid model file: Scale not set");if(a<0)throw new Error("Geoid model file: Scale must be positive");if(h<2||l<2)throw new Error("Geoid model file: Raster size too small");if(1&l)throw new Error("Geoid model file: Raster width is odd");if(!(1&h))throw new Error("Geoid model file: Raster height is even");const m=l/360,g=(h-1)/180;return new Bd({cubic:t.cubic,_width:l,_height:h,_rlonres:m,_rlatres:g,_offset:i,_scale:a,_swidth:f,_datastart:p,_maxerror:o,_rmserror:s,_description:u,_datetime:c,data:e})}function Id(e){let t="";for(const r of e)t+=String.fromCharCode(r);return t}const Pd={name:"PGM - Netpbm grayscale image format",id:"pgm",module:"tile-converter",version:"3.3.0-alpha.3",mimeTypes:["image/x-portable-graymap"],parse:async(e,t)=>Od(new Uint8Array(e),t),extensions:["pgm"],options:{cubic:!1}};function Dd(e,t){const r=[e.center[0],e.center[1],e.center[2]+t.getHeight(e.center[1],e.center[0])],n=_u.WGS84.cartographicToCartesian(r,new Ds),i=(new fp).fromCenterHalfSizeQuaternion(n,e.halfSize,e.quaternion);return[...i.center,...i.halfAxes.toArray()]}function Md(e,t){const r=[],n=e.boundingVolume,i=e.lodMetricValue||.1,a={metricType:"maxScreenThreshold",maxError:2*t.mbs[3]*16/i},o={metricType:"maxScreenThresholdSQ",maxError:.25*Math.PI*a.maxError*a.maxError};return"OrientedBoundingBox"===n.constructor.name?(r.push(o),r.push(a)):(r.push(a),r.push(o)),r}function Fd(e){let t=(e.header.lodSelection.maxScreenThreshold||{}).maxError;if(!t){const r=e.header.lodSelection.maxScreenThresholdSQ;r&&(t=Math.sqrt(r.maxError/(.25*Math.PI)))}return t||(t=16),2*e.header.mbs[3]*16/t}r(259);var Ld=r(80),Nd=r.n(Ld);function zd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ud={command:"",arguments:[],port:5e3,autoPort:!0,wait:2e3,onSuccess:e=>{console.log("Started "+e.props.command)}};class qd{constructor({id:e="browser-driver"}={}){zd(this,"id",void 0),zd(this,"props",{...Ud}),zd(this,"childProcess",null),zd(this,"port",0),zd(this,"successTimer",void 0),this.id=e}async start(e){e={...Ud,...e},this.props=e;const t=[...e.arguments];return this.port=Number(e.port),e.portArg&&(e.autoPort&&(this.port=await function(e=3e3){return new Promise(t=>{Nd.a.exec("lsof -i -P -n | grep LISTEN",(r,n)=>{if(r)return void t(e);const i=[],a=/:(\d+) \(LISTEN\)/;n.split("\n").forEach(e=>{const t=a.exec(e);t&&i.push(Number(t[1]))});let o=e;for(;i.includes(o);)o++;t(o)})})}(e.port)),t.push(e.portArg,String(this.port))),await new Promise((r,n)=>{try{this._setTimeout(()=>{e.onSuccess&&e.onSuccess(this),r({})}),console.log(`Spawning ${e.command} ${e.arguments.join(" ")}`);const i=Ld.spawn(e.command,t,e.spawn);this.childProcess=i,i.stdout.on("data",e=>{console.log(e.toString())}),i.stderr.on("data",e=>{console.log(`Child process wrote to stderr: "${e}".`),this._clearTimeout(),n(new Error(e))}),i.on("error",e=>{console.log("Child process errored with "+e),this._clearTimeout(),n(e)}),i.on("close",e=>{console.log("Child process exited with "+e),this.childProcess=null,this._clearTimeout(),r({})})}catch(e){n(e)}})}async stop(){this.childProcess&&(this.childProcess.kill(),this.childProcess=null)}async exit(e=0){try{await this.stop(),process.exit(e)}catch(e){console.error(e.message||e),process.exit(1)}}_setTimeout(e){Number(this.props.wait)>0&&(this.successTimer=setTimeout(e,this.props.wait))}_clearTimeout(){this.successTimer&&clearTimeout(this.successTimer)}}var Hd=r(79),Gd=r.n(Hd);const Vd="function"==typeof atob?atob:"function"==typeof Buffer?function(e){return Buffer.from(e,"base64").toString("binary")}:Jd,Wd=Vd("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"),Kd=!(!WebAssembly||Vd===Jd)&&function(e){var t,r,n,i=-1;t=e.length-1,r=new ArrayBuffer(e.length),n=new Uint8Array(r);for(;t>i++;)n[i]=e.charCodeAt(i);return n}(Wd).buffer;Math.floor(1048576.00032768);function Jd(e){return e}Kd||console.log("WebAssembly not available or WASM module could not be decoded; md5WASM will fall back to JavaScript");r(112);async function Qd(e,t,r,n,i){"win32"===process.platform?await async function(e,t,r=0,n=Object(Ci.join)(".","*"),i){"@"===n[0]&&(n="*"+n.substr(1));const a=em(t),o=["a","-tzip","-mx="+r,a,n],s=new qd;await s.start({command:i,arguments:o,spawn:{cwd:""+e},wait:0})}(e,t,r,n,i):await async function(e,t,r=0,n="."){const i=em(t),a=["-"+r,"-r",i,n],o=new qd;await o.start({command:"zip",arguments:a,spawn:{cwd:e},wait:0})}(e,t,r,n)}async function Yd(e,t,r="index.json"){let n;n=t instanceof Promise?new Uint8Array(await t):t instanceof ArrayBuffer?new Uint8Array(t):t,await fe.promises.mkdir(e,{recursive:!0});const i=Object(Ci.join)(e,r);try{await fe.promises.writeFile(i,n)}catch(e){throw e}return console.log(i+" saved."),i}async function $d(e,t,r="index.json",n=!0){const i=await Yd(e,t,r);if(n){const e=await function(e){const t=e+".gz",r=Object(ve.createGzip)(),n=Object(fe.createReadStream)(e),i=Object(fe.createWriteStream)(t);return new Promise((e,a)=>{n.on("end",()=>{console.log(t+" compressed and saved."),e(t)}),n.on("error",e=>{console.log(t+": compression error!"),a(e)}),n.pipe(r).pipe(i)})}(i);return await Zd(i),e}return i}function Xd(e){return fe.promises.rmdir(e,{recursive:!0})}function Zd(e){return fe.promises.unlink(e)}function em(e){return Object(Ci.isAbsolute)(e)?e:Object(Ci.join)(process.cwd(),e)}function tm(e){let t=e[0];const r=Math.floor(t/3600);t-=3600*r;const n=Math.floor(t/60);t-=60*n;const i=Math.floor(t),a=e[1]/1e6;let o="";return r&&(o+=r+"h "),n&&(o+=n+"m "),i&&(o+=i+"s"),o||(o+=a+"ms"),o}async function rm(e){const{slpk:t,outputPath:r,tilesetName:n}=e,i=em(r);try{if(t){const e=Object(Ci.join)(i,n+".slpk");return(await fe.promises.stat(e)).size}const e=Object(Ci.join)(i,n);return await async function e(t){let r=0;const n=await fe.promises.readdir(t);for(const i of n){const n=await fe.promises.stat(Object(Ci.join)(t,i));n.isDirectory()?r+=await e(Object(Ci.join)(t,i)):r+=n.size}return r}(e)}catch(e){return console.log("Calculate file sizes error: ",e),null}}const nm=()=>({boundingVolume:{path:"boundingVolume"},geometricError:{path:"geometricError"},content:{path:"content"},children:{path:"children",transform:e=>e.map(e=>Ii()(e,nm()))}});async function im(e,t,r={},n={}){const i=function(e){const t="3.3.0-alpha.3"!==e.version?" (worker-utils@3.3.0-alpha.3)":"";return`${e.name}@${e.version}${t}`}(e),a=za.getWorkerFarm(r),{source:o}=r,s={name:i,source:o};o||(s.url=Ua(e,r));const u=a.getWorkerPool(s),c=r.jobName||e.name,l=await u.startJob(c,am.bind(null,n)),h=function e(t){if(null===t)return{};const r=Object.assign({},t);return Object.keys(r).forEach(n=>{"object"!=typeof t[n]||ArrayBuffer.isView(t[n])?"function"==typeof r[n]||r[n]instanceof RegExp?r[n]={}:r[n]=t[n]:r[n]=e(t[n])}),r}(r);l.postMessage("process",{input:t,options:h});return(await l.result).result}async function am(e,t,r,n){switch(r){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":const{id:i,input:a,options:o}=n;try{if(!e.process)return void t.postMessage("error",{id:i,error:"Worker not set up to process on main thread"});const r=await e.process(a,o);t.postMessage("done",{id:i,result:r})}catch(e){const r=e instanceof Error?e.message:"unknown error";t.postMessage("error",{id:i,error:r})}break;default:console.warn("process-on-worker: unknown message "+r)}}async function om(e,t,r){if(function(e,t){return!!za.isSupported()&&(!!(Pi||null!=t&&t._nodeWorkers)&&(e.worker&&(null==t?void 0:t.worker)))}(t,r={...pa(),...r}))return await im(t,e,r);if(t.encode)return await t.encode(e,r);if(t.encodeSync)return t.encodeSync(e,r);if(t.encodeText)return(new TextEncoder).encode(await t.encodeText(e,r));if(t.encodeInBatches){const n=function(e,t,r){if(t.encodeInBatches){const n=function(e){return[{table:e,start:0,end:e.length}]}(e);return t.encodeInBatches(n,r)}throw new Error("Writer could not encode data in batches")}(e,t,r),i=[];for await(const e of n)i.push(e);return Ja(...i)}if(!Pi&&t.encodeURLtoURL){const n=um("input");await async function(e,t,r){e=Yi(e),Pi||await i.writeFile(e,Wa(t),{flag:"w"}),Vi(!1)}(n,e);const a=um("output"),o=await async function(e,t,r,n){if(e=Yi(e),t=Yi(t),Pi||!r.encodeURLtoURL)throw new Error;return await r.encodeURLtoURL(e,t,n)}(n,a,t,r);return(await oa(o)).arrayBuffer()}throw new Error("Writer could not encode data")}function sm(e,t,r){if(t.encodeSync)return t.encodeSync(e,r);throw new Error("Writer could not synchronously encode data")}function um(e){return"/tmp/"+e}function cm(e,t){return Vi(e>=0),Vi(t>0),e+(t-1)&~(t-1)}function lm(e,t,r){let n;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else{const t=e.byteOffset,r=e.byteLength;n=new Uint8Array(e.buffer||e.arrayBuffer,t,r)}return t.set(n,r),r+cm(n.byteLength,4)}function hm(e,t){if(!e)throw new Error(t||"assert failed: gltf")}const pm=["SCALAR","VEC2","VEC3","VEC4"],fm=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],dm=new Map(fm),mm={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},gm={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},ym={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function bm(e){return pm[e-1]||pm[0]}function vm(e){const t=dm.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function wm(e,t){const r=ym[e.componentType],n=mm[e.type],i=gm[e.componentType],a=e.count*n,o=e.count*n*i;return hm(o>=0&&o<=t.byteLength),{ArrayType:r,length:a,byteLength:o}}function _m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const km={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]};class xm{constructor(e){_m(this,"gltf",void 0),_m(this,"sourceBuffers",void 0),_m(this,"byteLength",void 0),this.gltf=e||{json:{...km},buffers:[]},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]}getExtension(e){const t=this.getUsedExtensions().find(t=>t===e),r=this.json.extensions||{};return t?r[e]||!0:null}getRequiredExtension(e){return this.getRequiredExtensions().find(t=>t===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}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,t){if("object"==typeof t)return t;const r=this.json[e]&&this.json[e][t];if(!r)throw new Error(`glTF file error: Could not find ${e}[${t}]`);return r}getTypedArrayForBufferView(e){const t=(e=this.getBufferView(e)).buffer,r=this.gltf.buffers[t];hm(r);const n=(e.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,n,e.byteLength)}getTypedArrayForAccessor(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),r=this.getBuffer(t.buffer).data,{ArrayType:n,length:i}=wm(e,t);return new n(r,t.byteOffset+e.byteOffset,i)}getTypedArrayForImageData(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),r=this.getBuffer(t.buffer).data,n=t.byteOffset||0;return new Uint8Array(r,n,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addObjectExtension(e,t,r){return e.extensions=e.extensions||{},e.extensions[t]=r,this.registerUsedExtension(t),this}setObjectExtension(e,t,r){(e.extensions||{})[t]=r}removeObjectExtension(e,t){const r=e.extensions||{},n=r[t];return delete r[t],n}addExtension(e,t={}){return hm(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return hm(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}removeExtension(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}setDefaultScene(e){this.json.scene=e}addScene(e){const{nodeIndices:t}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}addNode(e){const{meshIndex:t,matrix:r}=e;this.json.nodes=this.json.nodes||[];const n={mesh:t};return r&&(n.matrix=r),this.json.nodes.push(n),this.json.nodes.length-1}addMesh(e){const{attributes:t,indices:r,material:n,mode:i=4}=e,a={primitives:[{attributes:this._addAttributes(t),mode:i}]};if(r){const e=this._addIndices(r);a.primitives[0].indices=e}return Number.isFinite(n)&&(a.primitives[0].material=n),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(e){const t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}addImage(e,t){const r=Lu(e),n=t||(null==r?void 0:r.mimeType),i={bufferView:this.addBufferView(e),mimeType:n};return this.json.images=this.json.images||[],this.json.images.push(i),this.json.images.length-1}addBufferView(e){const t=e.byteLength;hm(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const r={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=cm(t,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(r),this.json.bufferViews.length-1}addAccessor(e,t){const r={bufferView:e,type:bm(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){const r=this.addBufferView(e);let n={min:t.min,max:t.max};n.min&&n.max||(n=this._getAccessorMinMax(e,t.size));const i={size:t.size,componentType:vm(e),count:Math.round(e.length/t.size),min:n.min,max:n.max};return this.addAccessor(r,Object.assign(i,t))}addTexture(e){const{imageIndex:t}=e,r={source:t};return this.json.textures=this.json.textures||[],this.json.textures.push(r),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,t;this.gltf.buffers=[];const r=this.byteLength,n=new ArrayBuffer(r),i=new Uint8Array(n);let a=0;for(const e of this.sourceBuffers||[])a=lm(e,i,a);null!==(e=this.json)&&void 0!==e&&null!==(t=e.buffers)&&void 0!==t&&t[0]?this.json.buffers[0].byteLength=r:this.json.buffers=[{byteLength:r}],this.gltf.binary=n,this.sourceBuffers=[n]}_removeStringFromArray(e,t){let r=!0;for(;r;){const n=e.indexOf(t);n>-1?e.splice(n,1):r=!1}}_addAttributes(e={}){const t={};for(const r in e){const n=e[r],i=this._getGltfAttributeName(r),a=this.addBinaryBuffer(n.value,n);t[i]=a}return t}_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,t){const r={min:null,max:null};if(e.length<t)return r;r.min=[],r.max=[];const n=e.subarray(0,t);for(const e of n)r.min.push(e),r.max.push(e);for(let n=t;n<e.length;n+=t)for(let i=0;i<t;i++)r.min[0+i]=Math.min(r.min[0+i],e[n+i]),r.max[0+i]=Math.max(r.max[0+i],e[n+i]);return r}}function Em(e,t,r,n){const i=cm(r.byteLength,n),a=i-r.byteLength;if(e){const n=new Uint8Array(e.buffer,e.byteOffset+t,r.byteLength),i=new Uint8Array(r);n.set(i);for(let n=0;n<a;++n)e.setUint8(t+r.byteLength+n,32)}return t+=i}function Am(e,t,r,n){return t=Em(e,t,(new TextEncoder).encode(r),n)}const Sm=1179937895;function jm(e,t,r,n){return function(e,{firstBuffer:t=0}={}){if(e.buffers&&e.buffers.length>t)throw new Error("encodeGLTF: multiple buffers not yet implemented")}(e),function(e,t,r=0,n={}){const{magic:i=Sm,version:a=2,json:o={},binary:s}=e,u=r;t&&(t.setUint32(r+0,i,!0),t.setUint32(r+4,a,!0),t.setUint32(r+8,0,!0));const c=r+8,l=r+=12;if(t&&(t.setUint32(r+0,0,!0),t.setUint32(r+4,1313821514,!0)),r=Am(t,r+=8,JSON.stringify(o),4),t){const e=r-l-8;t.setUint32(l+0,e,!0)}if(s){const e=r;if(t&&(t.setUint32(r+0,0,!0),t.setUint32(r+4,5130562,!0)),r=Em(t,r+=8,s,4),t){const n=r-e-8;t.setUint32(e+0,n,!0)}}if(t){const e=r-u;t.setUint32(c,e,!0)}return r}(e,t,r,n)}const Tm={name:"glTF",id:"gltf",module:"gltf",version:"3.3.0-alpha.3",extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,encodeSync:function(e,t={}){const{byteOffset:r=0}=t,n=jm(e,null,r,t),i=new ArrayBuffer(n),a=new DataView(i);return jm(e,a,r,t),i},options:{gltf:{}}};const Cm={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},Bm=(Object.keys(Cm),{BATCHED_MODEL:[98,51,100,109],INSTANCED_MODEL:[105,51,100,109],POINT_CLOUD:[112,110,116,115],COMPOSITE:[99,109,112,116]});function Rm(e,t,r){if(!t)return r+12;const{magic:n,version:i=1,byteLength:a=12}=e;return Vi(Array.isArray(n)&&Number.isFinite(i)&&Number.isFinite(a)),t.setUint8(r+0,n[0]),t.setUint8(r+1,n[1]),t.setUint8(r+2,n[2]),t.setUint8(r+3,n[3]),t.setUint32(r+4,i,!0),t.setUint32(r+8,a,!0),r+=12}function Om(e,t,r){e&&e.setUint32(t+8,r,!0)}function Im(e,t,r,n){if(e)for(let i=0;i<n;i++)e.setUint8(t+i,r.charCodeAt(i));return t+n}function Pm(e,t,r,n){if(e)for(let i=0;i<n;i++)e.setUint8(t+i,r[i]);return t+n}const Dm={POINTS_LENGTH:1,POSITIONS:{byteOffset:0}};function Mm(e,t,r,n){const{featureTableJson:i=Dm}=e;let a=JSON.stringify(i);a=function(e,t){const r=e.length,n=Math.ceil(r/t)*t-r;let i="";for(let e=0;e<n;++e)i+=" ";return e+i}(a,4);const{featureTableJsonByteLength:o=a.length}=e,s=new ArrayBuffer(12),u=s.byteLength,c=r;return r+=Rm(e={magic:Bm.POINT_CLOUD,...e},t,0),t&&(t.setUint32(r+0,o,!0),t.setUint32(r+4,u,!0),t.setUint32(r+8,0,!0),t.setUint32(r+12,0,!0)),r+=16,r+=Im(t,r,a,o),Om(t,c,(r+=Pm(t,r,s,u))-c),r}function Fm(e,t,r,n){switch(Vi("string"==typeof e.type),e.type){case Cm.COMPOSITE:return function(e,t,r,n,i){const a=r;r+=Rm(e={magic:Bm.COMPOSITE,tiles:[],...e},t,r),t&&t.setUint32(r,e.tiles.length,!0),r+=4;for(let a=0;a<e.tiles.length;++a)r+=i(e.tiles[a],t,r,n);return Om(t,a,r-a),r}(e,t,r,n,Fm);case Cm.POINT_CLOUD:return Mm(e,t,r);case Cm.BATCHED_3D_MODEL:return function(e,t,r,n){const{featuresLength:i=0,batchTable:a}=e,o={BATCH_LENGTH:i},s=JSON.stringify(o),u=a?JSON.stringify(a):"",c=cm(s.length,8),l=u?cm(u.length,8):0,h=r;r=Rm(e={magic:Bm.BATCHED_MODEL,...e},t,r),t&&(t.setUint32(12,c,!0),t.setUint32(16,0,!0),t.setUint32(20,l,!0),t.setUint32(24,0,!0)),r=Am(t,r+=16,s,8),a&&(r=Am(t,r,u,8));const p=e.gltfEncoded;return p&&(r=Pm(t,r,p,p.byteLength)),Om(t,h,r-h),r}(e,t,r);case Cm.INSTANCED_3D_MODEL:return function(e,t,r,n){const{featuresLength:i=1,gltfFormat:a=1,gltfUri:o=""}=e,s=o.length,u={INSTANCES_LENGTH:i,POSITION:new Array(3*i).fill(0)},c=JSON.stringify(u),l=c.length,h=r;return r=Rm(e={magic:Bm.INSTANCED_MODEL,...e},t,0),t&&(t.setUint32(12,l,!0),t.setUint32(16,0,!0),t.setUint32(20,0,!0),t.setUint32(24,0,!0),t.setUint32(28,a,!0)),r+=20,r+=Im(t,r,c,l),Om(t,h,(r+=Im(t,r,o,s))-h),r}(e,t,r);default:throw new Error("3D Tiles: unknown tile type")}}const Lm={name:"3D Tile",id:"3d-tiles",module:"3d-tiles",version:"3.3.0-alpha.3",extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],encodeSync:function(e,t){return function(e,t){const r=Fm(e,null,0,t),n=new ArrayBuffer(r);return Fm(e,new DataView(n),0,t),n}(e,t)},binary:!0,options:{"3d-tiles":{}}};function Nm(e){return[e[0]-Math.floor(e[0]),e[1]-Math.floor(e[1])]}function zm(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Um=new Js([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),qm=new Ds;class Hm{constructor(){zm(this,"rtcCenter",void 0),zm(this,"i3sTile",void 0)}async convert(e,t=null){const r=await this.buildGltf(e);return sm({gltfEncoded:new Uint8Array(r),type:"b3dm",featuresLength:this._getFeaturesLength(t),batchTable:t},Lm)}async buildGltf(e){const{tileContent:t,textureFormat:r}=e,{material:n,attributes:i,indices:a,cartesianOrigin:o,cartographicOrigin:s,modelMatrix:u}=t,c=new xm,l=await this._addI3sTextureToGltf(t,r,c),h=this._convertI3sMaterialToGltfMaterial(n,l),p=c.addMaterial(h),f=i.positions,d=f.value;i.uvRegions&&i.texCoords&&(i.texCoords.value=function(e,t){const r=new Float32Array(e.length),n=function(e){const t=[];for(let r=0;r<e.length;r++)t[r]=e[r]/65535;return t}(t);for(let t=0;t<e.length;t+=2){const i=e.subarray(t,t+2),a=n.slice(2*t,2*t+4),o=Nm([i[0],i[1]]),s=[a[2]-a[0],a[3]-a[1]],u=[o[0]*s[0],o[1]*s[1]],c=[u[0]+a[0],u[1]+a[1]];r[t]=c[0],r[t+1]=c[1]}return r}(i.texCoords.value,i.uvRegions.value)),i.positions.value=this._normalizePositions(d,o,s,u),i.normals&&!this._checkNormals(i.normals.value)&&delete i.normals;const m=a||this._generateSynteticIndices(d.length/f.size),g=c.addMesh({attributes:i,indices:m,material:p,mode:4}),y=this._generateTransformMatrix(o),b=c.addNode({meshIndex:g,matrix:y}),v=c.addScene({nodeIndices:[b]});c.setDefaultScene(v),c.createBinaryChunk();return sm(c.gltf,Tm)}async _addI3sTextureToGltf(e,t,r){const{texture:n,material:i,attributes:a}=e;let o=null,s=n;if(!n&&i&&(s=i.pbrMetallicRoughness&&i.pbrMetallicRoughness.baseColorTexture&&i.pbrMetallicRoughness.baseColorTexture.texture.source.image),s){const e=this._deduceMimeTypeFromFormat(t),n=r.addImage(s,e);o=r.addTexture({imageIndex:n}),delete a.colors}return o}_normalizePositions(e,t,r,n){const i=new Float32Array(e.length);for(let a=0;a<e.length;a+=3){const o=e.subarray(a,a+3),s=new Ds(t);let u=new Ds(Array.from(o)).transform(n).add(r);_u.WGS84.cartographicToCartesian(u,qm),u=qm.subtract(s),i.set(u,a)}return i}_generateTransformMatrix(e){return(new Js).translate(e).multiplyLeft(Um)}_generateBatchId(e){const t=3*(e[e.length-1]+1),r=new Float32Array(t);let n=0,i=0;for(let t=0;t<e.length/2;t++){const t=3*e[n],a=3*(e[n+1]+1);r.fill(i,t,a),n+=2,i+=1}return r}_generateSynteticIndices(e){const t=new Uint32Array(e);for(let r=0;r<e;r++)t.set([r],r);return t}_deduceMimeTypeFromFormat(e){switch(e){case"jpg":return"image/jpeg";case"png":return"image/png";case"ktx2":return"image/ktx2";default:return console.warn("Unexpected texture format in I3S: "+e),"image/jpeg"}}_convertI3sMaterialToGltfMaterial(e,t){return e?(null!==t&&(e=this._setGltfTexture(e,t)),e):(e={alphaMode:"OPAQUE",doubleSided:!1,pbrMetallicRoughness:{metallicFactor:0,roughnessFactor:1}},null!==t?e.pbrMetallicRoughness.baseColorTexture={index:t,texCoord:0}:e.pbrMetallicRoughness.baseColorFactor=[1,1,1,1],e)}_setGltfTexture(e,t){const r={...e,pbrMetallicRoughness:{...e.pbrMetallicRoughness}};return e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture?r.pbrMetallicRoughness.baseColorTexture={index:t,texCoord:0}:e.emissiveTexture?r.emissiveTexture={index:t,texCoord:0}:e.pbrMetallicRoughness&&e.pbrMetallicRoughness.metallicRoughnessTexture?r.pbrMetallicRoughness.metallicRoughnessTexture={index:t,texCoord:0}:e.normalTexture?r.normalTexture={index:t,texCoord:0}:e.occlusionTexture&&(r.occlusionTexture={index:t,texCoord:0}),r}_getFeaturesLength(e){if(!e)return 0;const t=Object.keys(e)[0];return t?e[t].length:0}_checkNormals(e){return e.find(e=>e)}}function Gm(e,t){let r,n,i;const a=e.boundingVolume,o=_u.WGS84.cartesianToCartographic(a.center,new Ds);return o[2]=o[2]-t.getHeight(o[1],o[0]),a instanceof fp?(n=a.halfSize,r=new Ds(n[0],n[1],n[2]).len(),i=a.quaternion):(r=e.boundingVolume.radius,n=[r,r,r],i=(new Yh).fromMatrix3(new Th([n[0],0,0,0,n[1],0,0,0,n[2]])).normalize()),{mbs:[o[0],o[1],o[2],r],obb:{center:[o[0],o[1],o[2]],halfSize:n,quaternion:i}}}function Vm(e,t){const r=function(e){const t=[];for(let r=0;r<e.length;r+=3){const n=new Ds([e[r],e[r+1],e[r+2]]);t.push(n)}return t}(e),n=function(e,t=new fp){if(!e||0===e.length)return t.halfAxes=new Th([0,0,0,0,0,0,0,0,0]),t.center=new Ds,t;const r=e.length,n=new Ds(0,0,0);for(const t of e)n.add(t);const i=1/r;n.multiplyByScalar(i);let a=0,o=0,s=0,u=0,c=0,l=0;for(const t of e){const e=Hp.copy(t).subtract(n);a+=e.x*e.x,o+=e.x*e.y,s+=e.x*e.z,u+=e.y*e.y,c+=e.y*e.z,l+=e.z*e.z}a*=i,o*=i,s*=i,u*=i,c*=i,l*=i;const h=Jp;h[0]=a,h[1]=o,h[2]=s,h[3]=o,h[4]=u,h[5]=c,h[6]=s,h[7]=c,h[8]=l;const{unitary:p}=Lp(h,Qp),f=t.halfAxes.copy(p);let d=f.getColumn(0,Vp),m=f.getColumn(1,Wp),g=f.getColumn(2,Kp),y=-Number.MAX_VALUE,b=-Number.MAX_VALUE,v=-Number.MAX_VALUE,w=Number.MAX_VALUE,_=Number.MAX_VALUE,k=Number.MAX_VALUE;for(const t of e)y=Math.max(t.dot(d),y),b=Math.max(t.dot(m),b),v=Math.max(t.dot(g),v),w=Math.min(t.dot(d),w),_=Math.min(t.dot(m),_),k=Math.min(t.dot(g),k);d=d.multiplyByScalar(.5*(w+y)),m=m.multiplyByScalar(.5*(_+b)),g=g.multiplyByScalar(.5*(k+v)),t.center.copy(d).add(m).add(g);const x=Gp.set(y-w,b-_,v-k).multiplyByScalar(.5),E=new Th([x[0],0,0,0,x[1],0,0,0,x[2]]);return t.halfAxes.multiplyRight(E),t}(r),i=function(e,t=new _h){if(!e||0===e.length)return t.fromCenterRadius([0,0,0],0);const r=jp.copy(e[0]),n=_p.copy(r),i=kp.copy(r),a=xp.copy(r),o=Ep.copy(r),s=Ap.copy(r),u=Sp.copy(r);for(const t of e){r.copy(t);const e=r.x,c=r.y,l=r.z;e<n.x&&r.copy(n),e>o.x&&r.copy(o),c<i.y&&r.copy(i),c>s.y&&r.copy(s),l<a.z&&r.copy(a),l>u.z&&r.copy(u)}const c=Tp.copy(o).subtract(n).magnitudeSquared(),l=Tp.copy(s).subtract(i).magnitudeSquared(),h=Tp.copy(u).subtract(a).magnitudeSquared();let p=n,f=o,d=c;l>d&&(d=l,p=i,f=s),h>d&&(d=h,p=a,f=u);const m=Cp;m.x=.5*(p.x+f.x),m.y=.5*(p.y+f.y),m.z=.5*(p.z+f.z);let g=Tp.copy(f).subtract(m).magnitudeSquared(),y=Math.sqrt(g);const b=Bp;b.x=n.x,b.y=i.y,b.z=a.z;const v=Rp;v.x=o.x,v.y=s.y,v.z=u.z;const w=Op.copy(b).add(v).multiplyByScalar(.5);let _=0;for(const t of e){r.copy(t);const e=Tp.copy(r).subtract(w).magnitude();e>_&&(_=e);const n=Tp.copy(r).subtract(m).magnitudeSquared();if(n>g){const e=Math.sqrt(n);y=.5*(y+e),g=y*y;const t=e-y;m.x=(y*m.x+t*r.x)/e,m.y=(y*m.y+t*r.y)/e,m.z=(y*m.z+t*r.z)/e}}return y<_?(m.to(t.center),t.radius=y):(w.to(t.center),t.radius=_),t}(r);let a=_u.WGS84.cartesianToCartographic(i.center,new Ds),o=_u.WGS84.cartesianToCartographic(n.center,new Ds);return a[2]=a[2]-t.getHeight(a[1],a[0]),o[2]=o[2]-t.getHeight(o[1],o[0]),{mbs:[a[0],a[1],a[2],i.radius],obb:{center:o,halfSize:n.halfSize,quaternion:n.quaternion}}}function Wm(e){const t=e[3],r=new Ds(e[0],e[1],e[2]),n=new Th([t,0,0,0,t,0,0,0,t]);return new fp(r,n)}const Km={id:"3d-tiles-attributes",name:"3DTiles Attributes Worker",module:"tile-converter",version:"3.3.0-alpha.3",options:{attributes:null}};const Jm="Tile converter does not work in browser, only in node js environment";function Qm(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ym{constructor(){Qm(this,"options",void 0),Qm(this,"tilesetPath",void 0),Qm(this,"vertexCounter",void 0),Qm(this,"conversionStartTime",void 0),Qm(this,"geoidHeightModel",void 0),Qm(this,"sourceTileset",void 0),Qm(this,"attributeStorageInfo",void 0),Qm(this,"workerSource",{}),this.options={},this.tilesetPath="",this.vertexCounter=0,this.conversionStartTime=[0,0],this.geoidHeightModel=null,this.sourceTileset=null,this.attributeStorageInfo=null,this.workerSource={}}async convert(e){if(Pi)return console.log(Jm),Jm;const{inputUrl:t,outputPath:r,tilesetName:n,maxDepth:i,egmFilePath:a}=e;this.conversionStartTime=Ri.a.hrtime(),this.options={maxDepth:i},console.log("Loading egm file..."),this.geoidHeightModel=await Zo(a,Pd),console.log("Loading egm file completed!"),await this.loadWorkers();const o=await Zo(t,vf,{});this.sourceTileset=new Sd(o,{loadOptions:{i3s:{coordinateSystem:lh.LNGLAT_OFFSETS,decodeTextures:!1}}}),await this.sourceTileset.tilesetInitializationPromise;const s=this.sourceTileset.root;s.header.obb||(s.header.obb=Wm(s.header.mbs)),this.tilesetPath=Object(Ci.join)(""+r,""+n),this.attributeStorageInfo=o.attributeStorageInfo;try{await Xd(this.tilesetPath)}catch(e){}const u={boundingVolume:{box:Dd(s.header.obb,this.geoidHeightModel)},geometricError:Fd(s),children:[]};await this._addChildren(s,u,1);const c=Ii()({root:u},{asset:{path:"asset",transform:e=>Ii()(e,{version:{path:"version",default:"1.0"}})},geometricError:{path:"root",transform:e=>e.geometricError},root:{path:"root",transform:e=>Ii()(e,nm())}});await Yd(this.tilesetPath,JSON.stringify(c),"tileset.json"),this._finishConversion({slpk:!1,outputPath:r,tilesetName:n});za.getWorkerFarm({}).destroy()}async _addChildren(e,t,r){if(!(this.options.maxDepth&&r>this.options.maxDepth))for(const i of e.header.children||[]){const a=await this._loadChildNode(e,i);if(e.children.push(a),a.contentUrl){var n;await this.sourceTileset._loadTile(a),this.vertexCounter+=a.content.vertexCount;let e=null;this.attributeStorageInfo&&(e=await this._loadChildAttributes(a,this.attributeStorageInfo)),a.header.obb||(a.header.obb=Wm(a.header.mbs));const i={box:Dd(a.header.obb,this.geoidHeightModel)},o={boundingVolume:i,geometricError:Fd(a),children:[]},s={tileContent:a.content,textureFormat:null==a||null===(n=a.header)||void 0===n?void 0:n.textureFormat},u=await(new Hm).convert(s,e);o.content={uri:a.id+".b3dm",boundingVolume:i},await Yd(this.tilesetPath,new Uint8Array(u),a.id+".b3dm"),t.children.push(o),a.unloadContent(),await this._addChildren(a,o,r+1)}else await this._addChildren(a,t,r+1)}}async _loadChildNode(e,t){let r;if(this.sourceTileset.tileset.nodePages)console.log("Node conversion: "+t.id),r=await this.sourceTileset.tileset.nodePagesTile.formTileFromNodePages(t.id);else{const{loader:n}=this.sourceTileset,i=this._relativeUrlToFullUrl(e.url,t.href),a={i3s:{...this.sourceTileset.loadOptions,isTileHeader:!0,loadContent:!1}};console.log("Node conversion: "+i),r=await Zo(i,n,a)}return new dd(this.sourceTileset,r,e)}_relativeUrlToFullUrl(e,t){let r=e.split("/");const n=t.split("/");for(const e of n)switch(e){case".":continue;case"..":r=r.slice(0,-1);break;default:r.push(e)}return r.join("/")}async _loadChildAttributes(e,t){const r=[],{attributeUrls:n}=e.header;for(let e=0;e<n.length;e++){const i=n[e],a=t[e],o={attributeName:a.name,attributeType:this._getAttributeType(a)};r.push(Zo(i,xf,o))}const i=await Promise.all(r);return this._replaceNestedArrays(i),Object.assign({},...i)}_getAttributeType(e){return e.attributeValues?e.attributeValues.valueType:e.objectIds?"Oid32":""}_replaceNestedArrays(e){for(let t=0;t<e.length;t++){const r=e[t];for(const e in r)r[e]=Array.from(r[e])}}async _finishConversion(e){const t=await rm(e),r=tm(Ri.a.hrtime(this.conversionStartTime));console.log("------------------------------------------------"),console.log("Finish conversion of I3S"),console.log("Total conversion time: "+r),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",t," bytes"),console.log("------------------------------------------------")}async loadWorkers(){console.log("Loading workers source...");const e=Ua(Km,{...pa()}),t=await oa(e),r=await t.text();this.workerSource.tile3dWorkerSource=r,console.log("Loading workers source completed!")}}function $m(e,t,r){Vi(e instanceof ArrayBuffer);const n=new TextDecoder("utf8"),i=new Uint8Array(e,t,r);return n.decode(i)}const Xm={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},Zm={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,...Xm},eg={[Xm.DOUBLE]:Float64Array,[Xm.FLOAT]:Float32Array,[Xm.UNSIGNED_SHORT]:Uint16Array,[Xm.UNSIGNED_INT]:Uint32Array,[Xm.UNSIGNED_BYTE]:Uint8Array,[Xm.BYTE]:Int8Array,[Xm.SHORT]:Int16Array,[Xm.INT]:Int32Array},tg={DOUBLE:Xm.DOUBLE,FLOAT:Xm.FLOAT,UNSIGNED_SHORT:Xm.UNSIGNED_SHORT,UNSIGNED_INT:Xm.UNSIGNED_INT,UNSIGNED_BYTE:Xm.UNSIGNED_BYTE,BYTE:Xm.BYTE,SHORT:Xm.SHORT,INT:Xm.INT};class rg{static fromTypedArray(e){e=ArrayBuffer.isView(e)?e.constructor:e;for(const t in eg){if(eg[t]===e)return t}throw new Error("Failed to convert GL type")}static fromName(e){const t=tg[e];if(!t)throw new Error("Failed to convert GL type");return t}static getArrayType(e){switch(e){case Xm.UNSIGNED_SHORT_5_6_5:case Xm.UNSIGNED_SHORT_4_4_4_4:case Xm.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:const t=eg[e];if(!t)throw new Error("Failed to convert GL type");return t}}static getByteSize(e){return rg.getArrayType(e).BYTES_PER_ELEMENT}static validate(e){return Boolean(rg.getArrayType(e))}static createTypedArray(e,t,r=0,n){void 0===n&&(n=(t.byteLength-r)/rg.getByteSize(e));return new(rg.getArrayType(e))(t,r,n)}}function ng(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class ig{constructor(e,t){ng(this,"json",void 0),ng(this,"buffer",void 0),ng(this,"featuresLength",0),ng(this,"_cachedTypedArrays",{}),this.json=e,this.buffer=t}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return Boolean(this.json[e])}getGlobalProperty(e,t=Zm.UNSIGNED_INT,r=1){const n=this.json[e];return n&&Number.isFinite(n.byteOffset)?this._getTypedArrayFromBinary(e,t,r,1,n.byteOffset):n}getPropertyArray(e,t,r){const n=this.json[e];return n&&Number.isFinite(n.byteOffset)?("componentType"in n&&(t=rg.fromName(n.componentType)),this._getTypedArrayFromBinary(e,t,r,this.featuresLength,n.byteOffset)):this._getTypedArrayFromArray(e,t,n)}getProperty(e,t,r,n,i){const a=this.json[e];if(!a)return a;const o=this.getPropertyArray(e,t,r);if(1===r)return o[n];for(let e=0;e<r;++e)i[e]=o[r*n+e];return i}_getTypedArrayFromBinary(e,t,r,n,i){const a=this._cachedTypedArrays;let o=a[e];return o||(o=rg.createTypedArray(t,this.buffer.buffer,this.buffer.byteOffset+i,n*r),a[e]=o),o}_getTypedArrayFromArray(e,t,r){const n=this._cachedTypedArrays;let i=n[e];return i||(i=rg.createTypedArray(t,r),n[e]=i),i}}const ag={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},og={SCALAR:(e,t)=>e[t],VEC2:(e,t)=>[e[2*t+0],e[2*t+1]],VEC3:(e,t)=>[e[3*t+0],e[3*t+1],e[3*t+2]],VEC4:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT2:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT3:(e,t)=>[e[9*t+0],e[9*t+1],e[9*t+2],e[9*t+3],e[9*t+4],e[9*t+5],e[9*t+6],e[9*t+7],e[9*t+8]],MAT4:(e,t)=>[e[16*t+0],e[16*t+1],e[16*t+2],e[16*t+3],e[16*t+4],e[16*t+5],e[16*t+6],e[16*t+7],e[16*t+8],e[16*t+9],e[16*t+10],e[16*t+11],e[16*t+12],e[16*t+13],e[16*t+14],e[16*t+15]]},sg={SCALAR:(e,t,r)=>{t[r]=e},VEC2:(e,t,r)=>{t[2*r+0]=e[0],t[2*r+1]=e[1]},VEC3:(e,t,r)=>{t[3*r+0]=e[0],t[3*r+1]=e[1],t[3*r+2]=e[2]},VEC4:(e,t,r)=>{t[4*r+0]=e[0],t[4*r+1]=e[1],t[4*r+2]=e[2],t[4*r+3]=e[3]},MAT2:(e,t,r)=>{t[4*r+0]=e[0],t[4*r+1]=e[1],t[4*r+2]=e[2],t[4*r+3]=e[3]},MAT3:(e,t,r)=>{t[9*r+0]=e[0],t[9*r+1]=e[1],t[9*r+2]=e[2],t[9*r+3]=e[3],t[9*r+4]=e[4],t[9*r+5]=e[5],t[9*r+6]=e[6],t[9*r+7]=e[7],t[9*r+8]=e[8],t[9*r+9]=e[9]},MAT4:(e,t,r)=>{t[16*r+0]=e[0],t[16*r+1]=e[1],t[16*r+2]=e[2],t[16*r+3]=e[3],t[16*r+4]=e[4],t[16*r+5]=e[5],t[16*r+6]=e[6],t[16*r+7]=e[7],t[16*r+8]=e[8],t[16*r+9]=e[9],t[16*r+10]=e[10],t[16*r+11]=e[11],t[16*r+12]=e[12],t[16*r+13]=e[13],t[16*r+14]=e[14],t[16*r+15]=e[15]}};const ug=e=>void 0!==e;function cg(e,t,r){if(!t)return null;let n=e.getExtension("3DTILES_batch_table_hierarchy");const i=t.HIERARCHY;return i&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=i,n=i),n?function(e,t){let r,n,i;const a=e.instancesLength,o=e.classes;let s,u=e.classIds,c=e.parentCounts,l=e.parentIds,h=a;ug(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,GL.UNSIGNED_SHORT),u.type=AttributeType.SCALAR,i=getBinaryAccessor(u),u=i.createArrayBufferView(t.buffer,t.byteOffset+u.byteOffset,a));if(ug(c))for(ug(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,i=getBinaryAccessor(c),c=i.createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,a)),s=new Uint16Array(a),h=0,r=0;r<a;++r)s[r]=h,h+=c[r];ug(l)&&ug(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,i=getBinaryAccessor(l),l=i.createArrayBufferView(t.buffer,t.byteOffset+l.byteOffset,h));const p=o.length;for(r=0;r<p;++r){const e=o[r].length,n=o[r].instances,i=getBinaryProperties(e,n,t);o[r].instances=combine(i,n)}const f=new Array(p).fill(0),d=new Uint16Array(a);for(r=0;r<a;++r)n=u[r],d[r]=f[n],++f[n];const m={classes:o,classIds:u,classIndexes:d,parentCounts:c,parentIndexes:s,parentIds:l};return function(e){const t=e.classIds.length;for(let r=0;r<t;++r)hg(e,r,stack)}(m),m}(n,r):null}function lg(e,t,r){if(!e)return;const n=e.parentCounts;return e.parentIds?r(e,t):n>0?function(e,t,r){const n=e.classIds,i=e.parentCounts,a=e.parentIds,o=e.parentIndexes,s=n.length,u=scratchVisited;u.length=Math.max(u.length,s);const c=++marker,l=scratchStack;l.length=0,l.push(t);for(;l.length>0;){if(t=l.pop(),u[t]===c)continue;u[t]=c;const n=r(e,t);if(ug(n))return n;const s=i[t],h=o[t];for(let e=0;e<s;++e){const r=a[h+e];r!==t&&l.push(r)}}return null}(e,t,r):function(e,t,r){let n=!0;for(;n;){const i=r(e,t);if(ug(i))return i;const a=e.parentIds[t];n=a!==t,t=a}throw new Error("traverseHierarchySingleParent")}(e,t,r)}function hg(e,t,r){const n=e.parentCounts,i=e.parentIds,a=e.parentIndexes,o=e.classIds.length;if(!ug(i))return;assert(t<o,`Parent index ${t} exceeds the total number of instances: ${o}`),assert(-1===r.indexOf(t),"Circular dependency detected in the batch table hierarchy."),r.push(t);const s=ug(n)?n[t]:1,u=ug(n)?a[t]:t;for(let n=0;n<s;++n){const a=i[u+n];a!==t&&hg(e,a,r)}r.pop(t)}function pg(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fg(e){return null!=e}const dg=(e,t)=>e,mg={HIERARCHY:!0,extensions:!0,extras:!0};class gg{constructor(e,t,r,n={}){var i;pg(this,"json",void 0),pg(this,"binary",void 0),pg(this,"featureCount",void 0),pg(this,"_extensions",void 0),pg(this,"_properties",void 0),pg(this,"_binaryProperties",void 0),pg(this,"_hierarchy",void 0),Vi(r>=0),this.json=e||{},this.binary=t,this.featureCount=r,this._extensions=(null===(i=this.json)||void 0===i?void 0:i.extensions)||{},this._properties={};for(const e in this.json)mg[e]||(this._properties[e]=this.json[e]);this._binaryProperties=this._initializeBinaryProperties(),n["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=cg(this,this.json,this.binary))}getExtension(e){return this.json&&this.json.extensions&&this.json.extensions[e]}memorySizeInBytes(){return 0}isClass(e,t){if(this._checkBatchId(e),Vi("string"==typeof t,t),this._hierarchy){return fg(lg(this._hierarchy,e,(e,r)=>{const n=e.classIds[r];return e.classes[n].name===t}))}return!1}isExactClass(e,t){return Vi("string"==typeof t,t),this.getExactClassName(e)===t}getExactClassName(e){if(this._checkBatchId(e),this._hierarchy){const t=this._hierarchy.classIds[e];return this._hierarchy.classes[t].name}}hasProperty(e,t){return this._checkBatchId(e),Vi("string"==typeof t,t),fg(this._properties[t])||this._hasPropertyInHierarchy(e,t)}getPropertyNames(e,t){this._checkBatchId(e),(t=fg(t)?t:[]).length=0;const r=Object.keys(this._properties);return t.push(...r),this._hierarchy&&this._getPropertyNamesInHierarchy(e,t),t}getProperty(e,t){if(this._checkBatchId(e),Vi("string"==typeof t,t),this._binaryProperties){const r=this._binaryProperties[t];if(fg(r))return this._getBinaryProperty(r,e)}const r=this._properties[t];if(fg(r))return dg(r[e]);if(this._hierarchy){const r=this._getHierarchyProperty(e,t);if(fg(r))return r}}setProperty(e,t,r){const n=this.featureCount;if(this._checkBatchId(e),Vi("string"==typeof t,t),this._binaryProperties){const n=this._binaryProperties[t];if(n)return void this._setBinaryProperty(n,e,r)}if(this._hierarchy&&this._setHierarchyProperty(this,e,t,r))return;let i=this._properties[t];fg(i)||(this._properties[t]=new Array(n),i=this._properties[t]),i[e]=dg(r)}_checkBatchId(e){if(!(e>=0&&e<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(e,t){return e.unpack(e.typedArray,t)}_setBinaryProperty(e,t,r){e.pack(r,e.typedArray,t)}_initializeBinaryProperties(){let e=null;for(const t in this._properties){const r=this._properties[t],n=this._initializeBinaryProperty(t,r);n&&(e=e||{},e[t]=n)}return e}_initializeBinaryProperty(e,t){if("byteOffset"in t){const r=t;Vi(this.binary,`Property ${e} requires a batch table binary.`),Vi(r.type,`Property ${e} requires a type.`);const n=function(e,t,r,n){const{componentType:i}=e;Vi(e.componentType);const a="string"==typeof i?rg.fromName(i):i,o=ag[e.type],s=og[e.type],u=sg[e.type];return r+=e.byteOffset,{values:rg.createTypedArray(a,t,r,o*n),type:a,size:o,unpacker:s,packer:u}}(r,this.binary.buffer,0|this.binary.byteOffset,this.featureCount);return{typedArray:n.values,componentCount:n.size,unpack:n.unpacker,pack:n.packer}}return null}_hasPropertyInHierarchy(e,t){if(!this._hierarchy)return!1;const r=lg(this._hierarchy,e,(e,r)=>{const n=e.classIds[r];return fg(e.classes[n].instances[t])});return fg(r)}_getPropertyNamesInHierarchy(e,t){lg(this._hierarchy,e,(e,r)=>{const n=e.classIds[r],i=e.classes[n].instances;for(const e in i)i.hasOwnProperty(e)&&-1===t.indexOf(e)&&t.push(e)})}_getHierarchyProperty(e,t){return lg(this._hierarchy,e,(e,r)=>{const n=e.classIds[r],i=e.classes[n],a=e.classIndexes[r],o=i.instances[t];return fg(o)?fg(o.typedArray)?this._getBinaryProperty(o,a):dg(o[a]):null})}_setHierarchyProperty(e,t,r,n){const i=lg(this._hierarchy,t,(e,i)=>{const a=e.classIds[i],o=e.classes[a],s=e.classIndexes[i],u=o.instances[r];return!!fg(u)&&(Vi(i===t,`Inherited property "${r}" is read-only.`),fg(u.typedArray)?this._setBinaryProperty(u,s,n):u[s]=dg(n),!0)});return fg(i)}}function yg(e,t,r=0){const n=new DataView(t);if(e.magic=n.getUint32(r,!0),r+=4,e.version=n.getUint32(r,!0),r+=4,e.byteLength=n.getUint32(r,!0),r+=4,1!==e.version)throw new Error(`3D Tile Version ${e.version} not supported`);return r}function bg(e,t,r){const n=new DataView(t);let i;e.header=e.header||{};let a=n.getUint32(r,!0);r+=4;let o=n.getUint32(r,!0);r+=4;let s=n.getUint32(r,!0);r+=4;let u=n.getUint32(r,!0);return r+=4,s>=570425344?(r-=8,i=a,s=o,u=0,a=0,o=0,console.warn("b3dm tile in legacy format.")):u>=570425344&&(r-=4,i=s,s=a,u=o,a=0,o=0,console.warn("b3dm tile in legacy format.")),e.header.featureTableJsonByteLength=a,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=u,e.header.batchLength=i,r}function vg(e,t,r,n){return r=function(e,t,r,n){const{featureTableJsonByteLength:i,featureTableBinaryByteLength:a,batchLength:o}=e.header;if(e.featureTableJson={BATCH_LENGTH:o||0},i>0){const n=$m(t,r,i);e.featureTableJson=JSON.parse(n)}return r+=i,e.featureTableBinary=new Uint8Array(t,r,a),r+=a}(e,t,r),r=function(e,t,r,n){const{batchTableJsonByteLength:i,batchTableBinaryByteLength:a}=e.header;if(i>0){const n=$m(t,r,i);e.batchTableJson=JSON.parse(n),r+=i,a>0&&(e.batchTableBinary=new Uint8Array(t,r,a),e.batchTableBinary=new Uint8Array(e.batchTableBinary),r+=a)}return r}(e,t,r)}function wg(e,t=[0,0,0]){const r=e>>11&31,n=e>>5&63,i=31&e;return t[0]=r<<3,t[1]=n<<2,t[2]=i<<3,t}function _g(e,t,r){if(!(t||e&&e.batchIds&&r))return null;const{batchIds:n,isRGB565:i,pointCount:a}=e;if(n&&r){const e=new Uint8ClampedArray(3*a);for(let t=0;t<a;t++){const i=n[t],a=r.getProperty(i,"dimensions").map(e=>255*e);e[3*t]=a[0],e[3*t+1]=a[1],e[3*t+2]=a[2]}return{type:Zm.UNSIGNED_BYTE,value:e,size:3,normalized:!0}}if(i){const e=new Uint8ClampedArray(3*a);for(let r=0;r<a;r++){const n=wg(t[r]);e[3*r]=n[0],e[3*r+1]=n[1],e[3*r+2]=n[2]}return{type:Zm.UNSIGNED_BYTE,value:e,size:3,normalized:!0}}return t&&t.length===3*a?{type:Zm.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:Zm.UNSIGNED_BYTE,value:t,size:4,normalized:!0}}class kg extends ys{constructor(e=0,t=0){super(2),as(e)&&1===arguments.length?this.copy(e):(ns.debug&&(fs(e),fs(t)),this[0]=e,this[1]=t)}set(e,t){return this[0]=e,this[1]=t,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this.check()}fromObject(e){return ns.debug&&(fs(e.x),fs(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 Us(this,this,e),this.check()}transformAsVector(e){return Bs(this,this,e),this.check()}transformByMatrix3(e){return zs(this,this,e),this.check()}transformByMatrix2x3(e){return function(e,t,r){var n=t[0],i=t[1];e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5]}(this,this,e),this.check()}transformByMatrix2(e){return function(e,t,r){var n=t[0],i=t[1];e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i}(this,this,e),this.check()}}function xg(e,t){if(!e)throw new Error("math.gl assertion failed. "+t)}new kg,new Ds,new kg,new kg,new Uint8Array(1);function Eg(e,t=255){return ls(e,0,t)/t*2-1}function Ag(e){return e<0?-1:1}function Sg(e,t,r,n){if(xg(n),e<0||e>r||t<0||t>r)throw new Error("x and y must be unsigned normalized integers between 0 and "+r);if(n.x=Eg(e,r),n.y=Eg(t,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){const e=n.x;n.x=(1-Math.abs(n.y))*Ag(e),n.y=(1-Math.abs(e))*Ag(n.y)}return n.normalize()}function jg(e,t,r){return Sg(e,t,255,r)}const Tg=new Ds;function Cg(e,t,r){return e.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,function(e,t){const r=new Ds,n=new Float32Array(3*e.pointCount);for(let i=0;i<e.pointCount;i++)r.set(t[3*i],t[3*i+1],t[3*i+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(n,3*i);return n}(e,t)):{type:Zm.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}async function Bg(e,t,r,n,i){r=vg(e,t,r=bg(e,t,r=yg(e,t,r))),function(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}(e);const{featureTable:a,batchTable:o}=function(e){const t=new ig(e.featureTableJson,e.featureTableBinary),r=t.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(r))throw new Error("POINTS_LENGTH must be defined");t.featuresLength=r,e.featuresLength=r,e.pointsLength=r,e.pointCount=r,e.rtcCenter=t.getGlobalProperty("RTC_CENTER",Zm.FLOAT,3);const n=function(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",Zm.UNSIGNED_SHORT,1),e.batchIds)){const n=t.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");const{batchTableJson:i,batchTableBinary:a}=e;r=new gg(i,a,n)}return r}(e,t);return{featureTable:t,batchTable:n}}(e);return await async function(e,t,r,n,i){let a,o,s;const u=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];u&&(s=u.properties);const c=t.getExtension("3DTILES_draco_point_compression");if(c){o=c.properties;const t=c.byteOffset,r=c.byteLength;if(!o||!Number.isFinite(t)||!r)throw new Error("Draco properties, byteOffset, and byteLength must be defined");a=e.featureTableBinary.slice(t,t+r),e.hasPositions=Number.isFinite(o.POSITION),e.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),e.hasNormals=Number.isFinite(o.NORMAL),e.hasBatchIds=Number.isFinite(o.BATCH_ID),e.isTranslucent=Number.isFinite(o.RGBA)}if(!a)return!0;const l={buffer:a,properties:{...o,...s},featureTableProperties:o,batchTableProperties:s,dequantizeInShader:!1};return await async function(e,t,r,n){const{parse:i}=n,a={...r,draco:{...r.draco,extraAttributes:t.batchTableProperties||{}}};delete a["3d-tiles"];const o=await i(t.buffer,Rc,a),s=o.attributes.POSITION&&o.attributes.POSITION.value,u=o.attributes.COLOR_0&&o.attributes.COLOR_0.value,c=o.attributes.NORMAL&&o.attributes.NORMAL.value,l=o.attributes.BATCH_ID&&o.attributes.BATCH_ID.value,h=s&&o.attributes.POSITION.value.quantization,p=c&&o.attributes.NORMAL.value.quantization;if(h){const t=o.POSITION.data.quantization,r=t.range;e.quantizedVolumeScale=new Ds(r,r,r),e.quantizedVolumeOffset=new Ds(t.minValues),e.quantizedRange=(1<<t.quantizationBits)-1,e.isQuantizedDraco=!0}p&&(e.octEncodedRange=(1<<o.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);const f={};if(t.batchTableProperties)for(const e of Object.keys(t.batchTableProperties))o.attributes[e]&&o.attributes[e].value&&(f[e.toLowerCase()]=o.attributes[e].value);e.attributes={positions:s,colors:_g(e,u,void 0),normals:c,batchIds:l,...f}}(e,l,n,i)}(e,a,0,n,i),function(e,t,r){if(!e.attributes.positions)if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",Zm.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){const n=t.getPropertyArray("POSITION_QUANTIZED",Zm.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=65535,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Zm.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Zm.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=Cg(e,n,r)}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}(e,a,n),function(e,t,r){if(!e.attributes.colors){let n=null;t.hasProperty("RGBA")?(n=t.getPropertyArray("RGBA",Zm.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?n=t.getPropertyArray("RGB",Zm.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(n=t.getPropertyArray("RGB565",Zm.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=_g(e,n,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",Zm.UNSIGNED_BYTE,4))}(e,a,o),function(e,t){if(!e.attributes.normals){let r=null;t.hasProperty("NORMAL")?r=t.getPropertyArray("NORMAL",Zm.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",Zm.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=function(e,t){if(!t)return null;if(e.isOctEncoded16P){const r=new Float32Array(3*e.pointsLength);for(let n=0;n<e.pointsLength;n++)jg(t[2*n],t[2*n+1],Tg),Tg.toArray(r,3*n);return{type:Zm.FLOAT,size:2,value:r}}return{type:Zm.FLOAT,size:2,value:t}}(e,r)}}(e,a),r}function Rg(e,t,r){if(e.byteLength<=t+r)return"";const n=new DataView(e);let i="";for(let e=0;e<r;e++)i+=String.fromCharCode(n.getUint8(t+e));return i}function Og(e){try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse JSON from data starting with "${function(e,t=5){if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return Rg(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return Rg(e,0,t)}return""}(e)}"`)}}function Ig(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;const r=t.baseUri||t.uri;if(!r)throw new Error("'baseUri' must be provided to resolve relative url "+e);return r.substr(0,r.lastIndexOf("/")+1)+e}function Pg(e,t,r){const n=e.bufferViews[r];hm(n);const i=t[n.buffer];hm(i);const a=(n.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,a,n.byteLength)}const Dg=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]),Mg=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]),Fg={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Lg={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};let Ng;async function zg(){return Ng||(Ng=async function(){let e="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";WebAssembly.validate(Dg)&&(e="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",console.log("Warning: meshopt_decoder is using experimental SIMD support"));const t=await WebAssembly.instantiate(function(e){const t=new Uint8Array(e.length);for(let r=0;r<e.length;++r){const n=e.charCodeAt(r);t[r]=n>96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}let r=0;for(let n=0;n<e.length;++n)t[r++]=t[n]<60?Mg[t[n]]:64*(t[n]-60)+t[++n];return t.buffer.slice(0,r)}(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}()),Ng}function Ug(e,t,r,n,i,a,o){const s=e.exports.sbrk,u=n+3&-4,c=s(u*i),l=s(a.length),h=new Uint8Array(e.exports.memory.buffer);h.set(a,l);const p=t(c,n,i,l,a.length);if(0===p&&o&&o(c,u,i),r.set(h.subarray(c,c+n*i)),s(c-s(0)),0!==p)throw new Error("Malformed buffer data: "+p)}const qg="EXT_meshopt_compression";async function Hg(e,t){var r;const n=new xm(e);if(null==t||null===(r=t.gltf)||void 0===r||!r.decompressMeshes)return;const i=[];for(const t of e.json.bufferViews||[])i.push(Gg(n,t));await Promise.all(i),n.removeExtension("EXT_meshopt_compression")}async function Gg(e,t){const r=e.getObjectExtension(t,"EXT_meshopt_compression");if(r){const{byteOffset:n=0,byteLength:i=0,byteStride:a,count:o,mode:s,filter:u="NONE",buffer:c}=r,l=e.gltf.buffers[c],h=new Uint8Array(l.arrayBuffer,l.byteOffset+n,i),p=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);return await async function(e,t,r,n,i,a="NONE"){const o=await zg();Ug(o,o.exports[Lg[i]],e,t,r,n,o.exports[Fg[a||"NONE"]])}(p,o,a,h,s,u),p}return null}const Vg=["image/png","image/jpeg","image/gif"],Wg={};function Kg(e){return void 0===Wg[e]&&(Wg[e]=function(e){switch(e){case"image/webp":return function(){if(!Pi)return!1;try{return 0===document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")}catch{return!1}}();case"image/svg":return Pi;default:if(!Pi){const{_parseImageNode:t}=globalThis;return Boolean(t)&&Vg.includes(e)}return!0}}(e)),Wg[e]}const Jg="EXT_texture_webp";function Qg(e,t){const r=new xm(e);if(!Kg("image/webp")){if(r.getRequiredExtensions().includes("EXT_texture_webp"))throw new Error("gltf: Required extension EXT_texture_webp not supported by browser");return}const{json:n}=r;for(const e of n.textures||[]){const t=r.getObjectExtension(e,"EXT_texture_webp");t&&(e.source=t.source),r.removeObjectExtension(e,"EXT_texture_webp")}r.removeExtension("EXT_texture_webp")}const Yg="KHR_texture_basisu";function $g(e,t){const r=new xm(e),{json:n}=r;for(const e of n.textures||[]){const t=r.getObjectExtension(e,"KHR_texture_basisu");t&&(e.source=t.source),r.removeObjectExtension(e,"KHR_texture_basisu")}r.removeExtension("KHR_texture_basisu")}function Xg(e){const{buffer:t,size:r,count:n}=function(e){let t=e,r=1,n=0;e&&e.value&&(t=e.value,r=e.size||1);t&&(ArrayBuffer.isView(t)||(t=function(e,t,r=!1){if(!e)return null;if(Array.isArray(e))return new t(e);if(r&&!(e instanceof t))return new t(e);return e}(t,Float32Array)),n=t.length/r);return{buffer:t,size:r,count:n}}(e);return{value:t,size:r,byteOffset:0,count:n,type:bm(r),componentType:vm(t)}}const Zg="KHR_draco_mesh_compression";function ey(e,t,r){const n=new xm(e);for(const e of ay(n))n.getObjectExtension(e,"KHR_draco_mesh_compression")}async function ty(e,t,r){var n;if(null==t||null===(n=t.gltf)||void 0===n||!n.decompressMeshes)return;const i=new xm(e),a=[];for(const e of ay(i))i.getObjectExtension(e,"KHR_draco_mesh_compression")&&a.push(ny(i,e,t,r));await Promise.all(a),i.removeExtension("KHR_draco_mesh_compression")}function ry(e,t={}){const r=new xm(e);for(const e of r.json.meshes||[])iy(e,t),r.addRequiredExtension("KHR_draco_mesh_compression")}async function ny(e,t,r,n){const i=e.getObjectExtension(t,"KHR_draco_mesh_compression");if(!i)return;const a=e.getTypedArrayForBufferView(i.bufferView),o=Ya(a.buffer,a.byteOffset),{parse:s}=n,u={...r};delete u["3d-tiles"];const c=await s(o,Rc,u,n),l=function(e){const t={};for(const r in e){const n=e[r];if("indices"!==r){const e=Xg(n);t[r]=e}}return t}(c.attributes);for(const[r,n]of Object.entries(l))if(r in t.attributes){const i=t.attributes[r],a=e.getAccessor(i);null!=a&&a.min&&null!=a&&a.max&&(n.min=a.min,n.max=a.max)}t.attributes=l,c.indices&&(t.indices=Xg(c.indices)),function(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}(t)}function iy(e,t,r=4,n,i){var a;if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const o=n.DracoWriter.encodeSync({attributes:e}),s=null==i||null===(a=i.parseSync)||void 0===a?void 0:a.call(i,{attributes:e}),u=n._addFauxAttributes(s.attributes);return{primitives:[{attributes:u,mode:r,extensions:{KHR_draco_mesh_compression:{bufferView:n.addBufferView(o),attributes:u}}}]}}function*ay(e){for(const t of e.json.meshes||[])for(const e of t.primitives)yield e}const oy={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},sy={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};const uy="KHR_texture_transform",cy=new Ds,ly=new Th,hy=new Th;async function py(e,t){if(!new xm(e).getExtension("KHR_texture_transform"))return;const r=e.json.materials||[];for(let t=0;t<r.length;t++)fy(t,e)}function fy(e,t){var r,n,i;const a=[],o=null===(r=t.json.materials)||void 0===r?void 0:r[e],s=null==o||null===(n=o.pbrMetallicRoughness)||void 0===n?void 0:n.baseColorTexture;s&&dy(t,e,s,a);const u=null==o?void 0:o.emissiveTexture;u&&dy(t,e,u,a);const c=null==o?void 0:o.normalTexture;c&&dy(t,e,c,a);const l=null==o?void 0:o.occlusionTexture;l&&dy(t,e,l,a);const h=null==o||null===(i=o.pbrMetallicRoughness)||void 0===i?void 0:i.metallicRoughnessTexture;h&&dy(t,e,h,a)}function dy(e,t,r,n){const i=function(e,t){var r;const n=null===(r=e.extensions)||void 0===r?void 0:r.KHR_texture_transform,{texCoord:i=0}=e,{texCoord:a=i}=n;if(-1===t.findIndex(([e,t])=>e===i&&t===a)){const r=function(e){const{offset:t=[0,0],rotation:r=0,scale:n=[1,1]}=e,i=(new Th).set(1,0,0,0,1,0,t[0],t[1],1),a=ly.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),o=hy.set(n[0],0,0,0,n[1],0,0,0,1);return i.multiplyRight(a).multiplyRight(o)}(n);return i!==a&&(e.texCoord=a),t.push([i,a]),{originalTexCoord:i,texCoord:a,matrix:r}}return null}(r,n);if(!i)return;const a=e.json.meshes||[];for(const r of a)for(const n of r.primitives){const r=n.material;Number.isFinite(r)&&t===r&&my(e,n,i)}}function my(e,t,r){const{originalTexCoord:n,texCoord:i,matrix:a}=r,o=t.attributes["TEXCOORD_"+n];if(Number.isFinite(o)){var s;const r=null===(s=e.json.accessors)||void 0===s?void 0:s[o];if(r&&r.bufferView){var u;const o=null===(u=e.json.bufferViews)||void 0===u?void 0:u[r.bufferView];if(o){const{arrayBuffer:s,byteOffset:u}=e.buffers[o.buffer],c=(u||0)+(r.byteOffset||0)+(o.byteOffset||0),{ArrayType:l,length:h}=wm(r,o),p=sy[r.componentType],f=oy[r.type],d=o.byteStride||p*f,m=new Float32Array(h);for(let e=0;e<r.count;e++){const t=new l(s,c+e*d,2);cy.set(t[0],t[1],1),cy.transformByMatrix3(a),m.set([cy[0],cy[1]],e*f)}n===i?function(e,t,r,n){e.componentType=5126,r.push({arrayBuffer:n.buffer,byteOffset:0,byteLength:n.buffer.byteLength}),t.buffer=r.length-1,t.byteLength=n.buffer.byteLength,t.byteOffset=0,delete t.byteStride}(r,o,e.buffers,m):function(e,t,r,n,i){n.buffers.push({arrayBuffer:i.buffer,byteOffset:0,byteLength:i.buffer.byteLength});const a=n.json.bufferViews;if(!a)return;a.push({buffer:n.buffers.length-1,byteLength:i.buffer.byteLength,byteOffset:0});const o=n.json.accessors;if(!o)return;o.push({bufferView:(null==a?void 0:a.length)-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),r.attributes["TEXCOORD_"+e]=o.length-1}(i,r,t,e,m)}}}}const gy="KHR_lights_punctual";async function yy(e){const t=new xm(e),{json:r}=t,n=t.getExtension("KHR_lights_punctual");n&&(t.json.lights=n.lights,t.removeExtension("KHR_lights_punctual"));for(const e of r.nodes||[]){const r=t.getObjectExtension(e,"KHR_lights_punctual");r&&(e.light=r.light),t.removeObjectExtension(e,"KHR_lights_punctual")}}async function by(e){const t=new xm(e),{json:r}=t;if(r.lights){const e=t.addExtension("KHR_lights_punctual");hm(!e.lights),e.lights=r.lights,delete r.lights}if(t.json.lights){for(const e of t.json.lights){const r=e.node;t.addObjectExtension(r,"KHR_lights_punctual",e)}delete t.json.lights}}const vy="KHR_materials_unlit";async function wy(e){const t=new xm(e),{json:r}=t;t.removeExtension("KHR_materials_unlit");for(const e of r.materials||[]){e.extensions&&e.extensions.KHR_materials_unlit&&(e.unlit=!0),t.removeObjectExtension(e,"KHR_materials_unlit")}}function _y(e){const t=new xm(e),{json:r}=t;if(t.materials)for(const e of r.materials||[])e.unlit&&(delete e.unlit,t.addObjectExtension(e,"KHR_materials_unlit",{}),t.addExtension("KHR_materials_unlit"))}const ky="KHR_techniques_webgl";async function xy(e){const t=new xm(e),{json:r}=t,n=t.getExtension("KHR_techniques_webgl");if(n){const e=function(e,t){const{programs:r=[],shaders:n=[],techniques:i=[]}=e,a=new TextDecoder;return n.forEach(e=>{if(!Number.isFinite(e.bufferView))throw new Error("KHR_techniques_webgl: no shader code");e.code=a.decode(t.getTypedArrayForBufferView(e.bufferView))}),r.forEach(e=>{e.fragmentShader=n[e.fragmentShader],e.vertexShader=n[e.vertexShader]}),i.forEach(e=>{e.program=r[e.program]}),i}(n,t);for(const n of r.materials||[]){const r=t.getObjectExtension(n,"KHR_techniques_webgl");r&&(n.technique=Object.assign({},r,e[r.technique]),n.technique.values=Ay(n.technique,t)),t.removeObjectExtension(n,"KHR_techniques_webgl")}t.removeExtension("KHR_techniques_webgl")}}async function Ey(e,t){}function Ay(e,t){const r=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(t=>{e.uniforms[t].value&&!(t in r)&&(r[t]=e.uniforms[t].value)}),Object.keys(r).forEach(e=>{"object"==typeof r[e]&&void 0!==r[e].index&&(r[e].texture=t.getTexture(r[e].index))}),r}const Sy="EXT_feature_metadata";async function jy(e){!function(e){var t;const r=e.getExtension("EXT_feature_metadata"),n=null==r||null===(t=r.schema)||void 0===t?void 0:t.classes,i=null==r?void 0:r.featureTables;(null==r?void 0:r.featureTextures)&&console.warn('featureTextures is not yet supported in the "EXT_feature_metadata" extension.');if(n&&i)for(const t in n){const r=n[t],a=By(i,t);a&&Ty(e,a,r)}}(new xm(e))}function Ty(e,t,r){for(const i in r.properties){var n;const a=r.properties[i],o=null==t||null===(n=t.properties)||void 0===n?void 0:n[i],s=t.count;if(o){const t=Cy(e,a,s,o);o.data=t}}}function Cy(e,t,r,n){const i=n.bufferView;let a=e.getTypedArrayForBufferView(i);switch(t.type){case"STRING":{const t=n.stringOffsetBufferView;a=function(e,t,r){const n=[],i=new TextDecoder("utf8");let a=0;for(let o=0;o<r;o++){const r=t[4*(o+1)]-t[4*o],s=e.subarray(a,r+a),u=i.decode(s);n.push(u),a+=r}return n}(a,e.getTypedArrayForBufferView(t),r);break}}return a}function By(e,t){for(const r in e){const n=e[r];if(n.class===t)return n}return null}const Ry=[a,o,s,u,l,h,p,c,f];function Oy(e,t){var r;const n=(null==t||null===(r=t.gltf)||void 0===r?void 0:r.excludeExtensions)||{};return!(e in n&&!n[e])}function Iy(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Py={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},Dy={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};class My{constructor(){Iy(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}),Iy(this,"json",void 0)}normalize(e,t){this.json=e.json;const r=e.json;switch(r.asset&&r.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn("glTF: Unknown version "+r.asset.version)}if(!t.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(r),this._convertTopLevelObjectsToArrays(r),function(e){const t=new xm(e),{json:r}=t;for(const e of r.images||[]){const r=t.getObjectExtension(e,"KHR_binary_glTF");r&&Object.assign(e,r),t.removeObjectExtension(e,"KHR_binary_glTF")}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,t.removeExtension("KHR_binary_glTF")}(e),this._convertObjectIdsToArrayIndices(r),this._updateObjects(r),this._updateMaterial(r)}_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(const t in Py)this._convertTopLevelObjectToArray(e,t)}_convertTopLevelObjectToArray(e,t){const r=e[t];if(r&&!Array.isArray(r)){e[t]=[];for(const n in r){const i=r[n];i.id=i.id||n;const a=e[t].length;e[t].push(i),this.idToIndexMap[t][n]=a}}}_convertObjectIdsToArrayIndices(e){for(const t in Py)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(const t of e.textures)this._convertTextureIds(t);for(const t of e.meshes)this._convertMeshIds(t);for(const t of e.nodes)this._convertNodeIds(t);for(const t of e.scenes)this._convertSceneIds(t)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(const t of e.primitives){const{attributes:e,indices:r,material:n}=t;for(const t in e)e[t]=this._convertIdToIndex(e[t],"accessor");r&&(t.indices=this._convertIdToIndex(r,"accessor")),n&&(t.material=this._convertIdToIndex(n,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map(e=>this._convertIdToIndex(e,"node"))),e.meshes&&(e.meshes=e.meshes.map(e=>this._convertIdToIndex(e,"mesh")))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map(e=>this._convertIdToIndex(e,"node")))}_convertIdsToIndices(e,t){e[t]||(console.warn("gltf v1: json doesn't contain attribute "+t),e[t]=[]);for(const r of e[t])for(const e in r){const t=r[e],n=this._convertIdToIndex(t,e);r[e]=n}}_convertIdToIndex(e,t){const r=Dy[t];if(r in this.idToIndexMap){const n=this.idToIndexMap[r][e];if(!Number.isFinite(n))throw new Error(`gltf v1: failed to resolve ${t} with id ${e}`);return n}return e}_updateObjects(e){for(const e of this.json.buffers)delete e.type}_updateMaterial(e){for(const n of e.materials){var t,r;n.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const i=(null===(t=n.values)||void 0===t?void 0:t.tex)||(null===(r=n.values)||void 0===r?void 0:r.texture2d_0),a=e.textures.findIndex(e=>e.id===i);-1!==a&&(n.pbrMetallicRoughness.baseColorTexture={index:a})}}}function Fy(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ly={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ny={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},zy=10240,Uy=10241,qy=10242,Hy=10243,Gy=10497,Vy={magFilter:zy,minFilter:Uy,wrapS:qy,wrapT:Hy},Wy={[zy]:9729,[Uy]:9986,[qy]:Gy,[Hy]:Gy};class Ky{constructor(){Fy(this,"baseUri",""),Fy(this,"json",{}),Fy(this,"buffers",[]),Fy(this,"images",[])}postProcess(e,t={}){const{json:r,buffers:n=[],images:i=[],baseUri:a=""}=e;return hm(r),this.baseUri=a,this.json=r,this.buffers=n,this.images=i,this._resolveTree(this.json,t),this.json}_resolveTree(e,t={}){e.bufferViews&&(e.bufferViews=e.bufferViews.map((e,t)=>this._resolveBufferView(e,t))),e.images&&(e.images=e.images.map((e,t)=>this._resolveImage(e,t))),e.samplers&&(e.samplers=e.samplers.map((e,t)=>this._resolveSampler(e,t))),e.textures&&(e.textures=e.textures.map((e,t)=>this._resolveTexture(e,t))),e.accessors&&(e.accessors=e.accessors.map((e,t)=>this._resolveAccessor(e,t))),e.materials&&(e.materials=e.materials.map((e,t)=>this._resolveMaterial(e,t))),e.meshes&&(e.meshes=e.meshes.map((e,t)=>this._resolveMesh(e,t))),e.nodes&&(e.nodes=e.nodes.map((e,t)=>this._resolveNode(e,t))),e.skins&&(e.skins=e.skins.map((e,t)=>this._resolveSkin(e,t))),e.scenes&&(e.scenes=e.scenes.map((e,t)=>this._resolveScene(e,t))),void 0!==e.scene&&(e.scene=e.scenes[this.json.scene])}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const r=this.json[e]&&this.json[e][t];return r||console.warn(`glTF file error: Could not find ${e}[${t}]`),r}_resolveScene(e,t){return e.id=e.id||"scene-"+t,e.nodes=(e.nodes||[]).map(e=>this.getNode(e)),e}_resolveNode(e,t){return e.id=e.id||"node-"+t,e.children&&(e.children=e.children.map(e=>this.getNode(e))),void 0!==e.mesh?e.mesh=this.getMesh(e.mesh):void 0!==e.meshes&&e.meshes.length&&(e.mesh=e.meshes.reduce((e,t)=>{const r=this.getMesh(t);return e.id=r.id,e.primitives=e.primitives.concat(r.primitives),e},{primitives:[]})),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin)),e}_resolveSkin(e,t){return e.id=e.id||"skin-"+t,e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices),e}_resolveMesh(e,t){return e.id=e.id||"mesh-"+t,e.primitives&&(e.primitives=e.primitives.map(e=>{const t=(e={...e}).attributes;e.attributes={};for(const r in t)e.attributes[r]=this.getAccessor(t[r]);return void 0!==e.indices&&(e.indices=this.getAccessor(e.indices)),void 0!==e.material&&(e.material=this.getMaterial(e.material)),e})),e}_resolveMaterial(e,t){if(e.id=e.id||"material-"+t,e.normalTexture&&(e.normalTexture={...e.normalTexture},e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlustionTexture={...e.occlustionTexture},e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emmisiveTexture={...e.emmisiveTexture},e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.emissiveFactor||(e.emissiveFactor=e.emmisiveTexture?[1,1,1]:[0,0,0]),e.pbrMetallicRoughness){e.pbrMetallicRoughness={...e.pbrMetallicRoughness};const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}return e}_resolveAccessor(e,t){var r,n;if(e.id=e.id||"accessor-"+t,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=(r=e.componentType,Ny[r]),e.components=(n=e.type,Ly[n]),e.bytesPerElement=e.bytesPerComponent*e.components,e.bufferView){const t=e.bufferView.buffer,{ArrayType:r,byteLength:n}=wm(e,e.bufferView),i=(e.bufferView.byteOffset||0)+(e.byteOffset||0)+t.byteOffset;let a=t.arrayBuffer.slice(i,i+n);e.bufferView.byteStride&&(a=this._getValueFromInterleavedBuffer(t,i,e.bufferView.byteStride,e.bytesPerElement,e.count)),e.value=new r(a)}return e}_getValueFromInterleavedBuffer(e,t,r,n,i){const a=new Uint8Array(i*n);for(let o=0;o<i;o++){const i=t+o*r;a.set(new Uint8Array(e.arrayBuffer.slice(i,i+n)),o*n)}return a.buffer}_resolveTexture(e,t){return e.id=e.id||"texture-"+t,e.sampler="sampler"in e?this.getSampler(e.sampler):Wy,e.source=this.getImage(e.source),e}_resolveSampler(e,t){e.id=e.id||"sampler-"+t,e.parameters={};for(const t in e){const r=this._enumSamplerParameter(t);void 0!==r&&(e.parameters[r]=e[t])}return e}_enumSamplerParameter(e){return Vy[e]}_resolveImage(e,t){e.id=e.id||"image-"+t,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView));const r=this.images[t];return r&&(e.image=r),e}_resolveBufferView(e,t){const r=e.buffer,n={id:"bufferView-"+t,...e,buffer:this.buffers[r]},i=this.buffers[r].arrayBuffer;let a=this.buffers[r].byteOffset||0;return"byteOffset"in e&&(a+=e.byteOffset),n.data=new Uint8Array(i,a,e.byteLength),n}_resolveCamera(e,t){return e.id=e.id||"camera-"+t,e.perspective,e.orthographic,e}}const Jy=1735152710;function Qy(e,t=0,r={}){const n=new DataView(e),{magic:i=Jy}=r,a=n.getUint32(t,!1);return a===i||a===Jy}function Yy(e,t,r=0,n={}){const i=new DataView(t),a=function(e,t=0){return`${String.fromCharCode(e.getUint8(t+0))}${String.fromCharCode(e.getUint8(t+1))}${String.fromCharCode(e.getUint8(t+2))}${String.fromCharCode(e.getUint8(t+3))}`}(i,r+0),o=i.getUint32(r+4,!0),s=i.getUint32(r+8,!0);switch(Object.assign(e,{header:{byteOffset:r,byteLength:s,hasBinChunk:!1},type:a,version:o,json:{},binChunks:[]}),r+=12,e.version){case 1:return function(e,t,r){Vi(e.header.byteLength>20);const n=t.getUint32(r+0,!0),i=t.getUint32(r+4,!0);return r+=8,Vi(0===i),$y(e,t,r,n),r+=n,r+=Xy(e,t,r,e.header.byteLength)}(e,i,r);case 2:return function(e,t,r,n){return Vi(e.header.byteLength>20),function(e,t,r,n){for(;r+8<=e.header.byteLength;){const i=t.getUint32(r+0,!0),a=t.getUint32(r+4,!0);switch(r+=8,a){case 1313821514:$y(e,t,r,i);break;case 5130562:Xy(e,t,r,i);break;case 0:n.strict||$y(e,t,r,i);break;case 1:n.strict||Xy(e,t,r,i)}r+=cm(i,4)}}(e,t,r,n),r+e.header.byteLength}(e,i,r,{});default:throw new Error(`Invalid GLB version ${e.version}. Only supports v1 and v2.`)}}function $y(e,t,r,n){const i=new Uint8Array(t.buffer,r,n),a=new TextDecoder("utf8").decode(i);return e.json=JSON.parse(a),cm(n,4)}function Xy(e,t,r,n){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:t.buffer}),cm(n,4)}async function Zy(e,t,r=0,n,i){var a,o,s,u;!function(e,t,r,n){n.uri&&(e.baseUri=n.uri);if(t instanceof ArrayBuffer&&!Qy(t,r,n)){const e=new TextDecoder;t=e.decode(t)}if("string"==typeof t)e.json=Og(t);else if(t instanceof ArrayBuffer){const i={};r=Yy(i,t,r,n.glb),hm("glTF"===i.type,"Invalid GLB magic string "+i.type),e._glb=i,e.json=i.json}else hm(!1,"GLTF: must be ArrayBuffer or string");const i=e.json.buffers||[];if(e.buffers=new Array(i.length).fill(null),e._glb&&e._glb.header.hasBinChunk){const{binChunks:t}=e._glb;e.buffers[0]={arrayBuffer:t[0].arrayBuffer,byteOffset:t[0].byteOffset,byteLength:t[0].byteLength}}const a=e.json.images||[];e.images=new Array(a.length).fill({})}(e,t,r,n),function(e,t={}){(new My).normalize(e,t)}(e,{normalize:null==n||null===(a=n.gltf)||void 0===a?void 0:a.normalize}),function(e,t={},r){const n=Ry.filter(e=>Oy(e.name,t));for(const a of n){var i;null===(i=a.preprocess)||void 0===i||i.call(a,e,t,r)}}(e,n,i);const c=[];if(null!=n&&null!==(o=n.gltf)&&void 0!==o&&o.loadBuffers&&e.json.buffers&&await async function(e,t,r){const n=e.json.buffers||[];for(let o=0;o<n.length;++o){const s=n[o];if(s.uri){var i,a;const{fetch:n}=r;hm(n);const u=Ig(s.uri,t),c=await(null==r||null===(i=r.fetch)||void 0===i?void 0:i.call(r,u)),l=await(null==c||null===(a=c.arrayBuffer)||void 0===a?void 0:a.call(c));e.buffers[o]={arrayBuffer:l,byteOffset:0,byteLength:l.byteLength},delete s.uri}else null===e.buffers[o]&&(e.buffers[o]={arrayBuffer:new ArrayBuffer(s.byteLength),byteOffset:0,byteLength:s.byteLength})}}(e,n,i),null!=n&&null!==(s=n.gltf)&&void 0!==s&&s.loadImages){const t=async function(e,t,r){const n=function(e){const t=new Set,r=e.json.textures||[];for(const e of r)void 0!==e.source&&t.add(e.source);return Array.from(t).sort()}(e),i=e.json.images||[],a=[];for(const o of n)a.push(eb(e,i[o],o,t,r));return await Promise.all(a)}(e,n,i);c.push(t)}const l=async function(e,t={},r){const n=Ry.filter(e=>Oy(e.name,t));for(const a of n){var i;await(null===(i=a.decode)||void 0===i?void 0:i.call(a,e,t,r))}}(e,n,i);return c.push(l),await Promise.all(c),null!=n&&null!==(u=n.gltf)&&void 0!==u&&u.postProcess?function(e,t){return(new Ky).postProcess(e,t)}(e,n):e}async function eb(e,t,r,n,i){const{fetch:a,parse:o}=i;let s;if(t.uri){const e=Ig(t.uri,n),r=await a(e);s=await r.arrayBuffer()}if(Number.isFinite(t.bufferView)){const r=Pg(e.json,e.buffers,t.bufferView);s=Ya(r.buffer,r.byteOffset,r.byteLength)}hm(s,"glTF image has no data");let u=await o(s,[zu,Zl],{mimeType:t.mimeType,basis:n.basis||{format:Ql()}},i);u&&u[0]&&(u={compressed:!0,mipmaps:!1,width:u[0].width,height:u[0].height,data:u[0]}),e.images=e.images||[],e.images[r]=u}const tb={name:"glTF",id:"gltf",module:"gltf",version:"3.3.0-alpha.3",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:async function(e,t={},r){(t={...tb.options,...t}).gltf={...tb.options.gltf,...t.gltf};const{byteOffset:n=0}=t;return await Zy({},e,n,t,r)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0,postProcess:!0},log:console},deprecatedOptions:{fetchImages:"gltf.loadImages",createImages:"gltf.loadImages",decompress:"gltf.decompressMeshes",postProcess:"gltf.postProcess",gltf:{decompress:"gltf.decompressMeshes"}}};const rb=0,nb=1;function ib(e,t,r,n){e.rotateYtoZ=!0;const i=e.byteOffset+e.byteLength-r;if(0===i)throw new Error("glTF byte length must be greater than 0.");return e.gltfUpAxis=n["3d-tiles"]&&n["3d-tiles"].assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",e.gltfArrayBuffer=Ya(t,r,i),e.gltfByteOffset=0,e.gltfByteLength=i,r%4==0||console.warn(e.type+": embedded glb is not aligned to a 4-byte boundary."),e.byteOffset+e.byteLength}async function ab(e,t,r,n){const i=r["3d-tiles"]||{};if(function(e,t,r){switch(t){case rb:const t=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),r=(new TextDecoder).decode(t);e.gltfUrl=r.replace(/[\s\0]+$/,""),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case nb:break;default:throw new Error("b3dm: Illegal glTF format field")}}(e,t),i.loadGLTF){const{parse:t,fetch:i}=n;e.gltfUrl&&(e.gltfArrayBuffer=await i(e.gltfUrl,r),e.gltfByteOffset=0),e.gltfArrayBuffer&&(e.gltf=await t(e.gltfArrayBuffer,tb,r,n),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength)}}async function ob(e,t,r,n,i){var a;r=function(e,t,r,n,i){r=yg(e,t,r),r=bg(e,t,r),r=vg(e,t,r),r=ib(e,t,r,n);const a=new ig(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=a.getGlobalProperty("RTC_CENTER",Zm.FLOAT,3),r}(e,t,r,n),await ab(e,nb,n,i);const o=null==e||null===(a=e.gltf)||void 0===a?void 0:a.extensions;return o&&o.CESIUM_RTC&&(e.rtcCenter=o.CESIUM_RTC.center),r}async function sb(e,t,r,n,i){return r=function(e,t,r,n,i){if(r=yg(e,t,r),1!==e.version)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);r=bg(e,t,r);const a=new DataView(t);if(e.gltfFormat=a.getUint32(r,!0),r=vg(e,t,r+=4),r=ib(e,t,r,n),0===e.featureTableJsonByteLength)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");const o=new ig(e.featureTableJson,e.featureTableBinary),s=o.getGlobalProperty("INSTANCES_LENGTH");if(o.featuresLength=s,!Number.isFinite(s))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=o.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=o.getGlobalProperty("RTC_CENTER",Zm.FLOAT,3);new gg(e.batchTableJson,e.batchTableBinary,s);return function(e,t,r,n){const i=[new Array(n),e._batchTable][0],a=new Ds,o=new Ds,s=new Ds,u=new Ds,c=new Th,l=new Yh,h=new Ds,p={},f=new Js,d=[],m=[],g=new Ds,y=new Ds;for(let r=0;r<n;r++){let n;if(t.hasProperty("POSITION"))n=t.getProperty("POSITION",Zm.FLOAT,3,r,a);else if(t.hasProperty("POSITION_QUANTIZED")){n=t.getProperty("POSITION_QUANTIZED",Zm.UNSIGNED_SHORT,3,r,a);const e=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Zm.FLOAT,3,g);if(!e)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");const i=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Zm.FLOAT,3,y);if(!i)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const o=65535;for(let t=0;t<3;t++)n[t]=n[t]/o*i[t]+e[t]}if(!n)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");a.copy(n),p.translation=a,e.normalUp=t.getProperty("NORMAL_UP",Zm.FLOAT,3,r,d),e.normalRight=t.getProperty("NORMAL_RIGHT",Zm.FLOAT,3,r,m);const b=!1;if(e.normalUp){if(!e.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");e.hasCustomOrientation=!0}else{if(e.octNormalUp=t.getProperty("NORMAL_UP_OCT32P",Zm.UNSIGNED_SHORT,2,d),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",Zm.UNSIGNED_SHORT,2,m),e.octNormalUp){if(!e.octNormalRight)throw new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");throw new Error("i3dm: oct-encoded orientation not implemented")}e.eastNorthUp?(_u.WGS84.eastNorthUpToFixedFrame(a,f),f.getRotationMatrix3(c)):c.identity()}b&&(u.copy(o).cross(s).normalize(),c.setColumn(0,o),c.setColumn(1,s),c.setColumn(2,u)),l.fromMatrix3(c),p.rotation=l,h.set(1,1,1);const v=t.getProperty("SCALE",Zm.FLOAT,1,r);Number.isFinite(v)&&h.multiplyByScalar(v);const w=t.getProperty("SCALE_NON_UNIFORM",Zm.FLOAT,3,r,d);w&&h.scale(w),p.scale=h;let _=t.getProperty("BATCH_ID",Zm.UNSIGNED_SHORT,1,r);void 0===_&&(_=r);const k=(new Js).fromQuaternion(p.rotation);f.identity(),f.translate(p.translation),f.multiplyRight(k),f.scale(p.scale);const x=f.clone();i[r]={modelMatrix:x,batchId:_}}e.instances=i}(e,o,0,s),r}(e,t,r,n),await ab(e,e.gltfFormat,n,i),r}async function ub(e,t=0,r,n,i={}){switch(i.byteOffset=t,i.type=function(e,t=0){const r=new DataView(e);return`${String.fromCharCode(r.getUint8(t+0))}${String.fromCharCode(r.getUint8(t+1))}${String.fromCharCode(r.getUint8(t+2))}${String.fromCharCode(r.getUint8(t+3))}`}(e,t),i.type){case Cm.COMPOSITE:return await async function(e,t,r,n,i,a){r=yg(e,t,r);const o=new DataView(t);for(e.tilesLength=o.getUint32(r,!0),r+=4,e.tiles=[];e.tiles.length<e.tilesLength&&e.byteLength-r>12;){const o={};e.tiles.push(o),r=await a(t,r,n,i,o)}return r}(i,e,t,r,n,ub);case Cm.BATCHED_3D_MODEL:return await ob(i,e,t,r,n);case Cm.GLTF:return await async function(e,t,r,n){e.rotateYtoZ=!0,e.gltfUpAxis=r["3d-tiles"]&&r["3d-tiles"].assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y";const{parse:i}=n;e.gltf=await i(t,tb,r,n)}(i,e,r,n);case Cm.INSTANCED_3D_MODEL:return await sb(i,e,t,r,n);case Cm.POINT_CLOUD:return await Bg(i,e,t,r,n);default:throw new Error("3DTileLoader: unknown type "+i.type)}}async function cb(e,t,r){const n=e[t].bufferView,i=e.bufferViews[n],a=e.buffers[i.buffer];if(a.uri){const e=await oa(a.uri),t=await e.arrayBuffer();return new Uint8Array(t,i.byteOffset,i.byteLength)}return new Uint8Array(r,i.byteOffset,i.byteLength)}function lb(e){const t=new DataView(e);return t.getUint32(0,!0)+2**32*t.getUint32(4,!0)}const hb={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:"3.3.0-alpha.3",extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:async function(e){if(1952609651!==new Uint32Array(e.slice(0,4))[0])throw new Error("Wrong subtree file magic number");if(1!==new Uint32Array(e.slice(4,8))[0])throw new Error("Wrong subtree file verson, must be 1");const t=lb(e.slice(8,16)),r=new Uint8Array(e,24,t),n=new TextDecoder("utf8").decode(r),i=JSON.parse(n),a=lb(e.slice(16,24));let o=new ArrayBuffer(0);return a&&(o=e.slice(24+t)),"bufferView"in i.tileAvailability&&(i.tileAvailability.explicitBitstream=await cb(i,"tileAvailability",o)),"bufferView"in i.contentAvailability&&(i.contentAvailability.explicitBitstream=await cb(i,"contentAvailability",o)),"bufferView"in i.childSubtreeAvailability&&(i.childSubtreeAvailability.explicitBitstream=await cb(i,"childSubtreeAvailability",o)),i},options:{}},pb={QUADTREE:4,OCTREE:8};function fb(e,t){return"constant"in e?Boolean(e.constant):!!e.explicitBitstream&&function(e,t){const r=Math.floor(e/8),n=e%8;return 1==(t[r]>>n&1)}(t,e.explicitBitstream)}function db(e,t,r,n){const{basePath:i,refine:a,getRefine:o,lodMetricType:s,getTileType:u,rootLodMetricValue:c,rootBoundingVolume:l}=n,h=e.contentUrl&&e.contentUrl.replace(i+"/",""),p=c/2**t,f=function(e,t,r){if(t.region){const{childTileX:n,childTileY:i,childTileZ:a}=r,[o,s,u,c,l,h]=t.region,p=2**e,f=(u-o)/p,d=(c-s)/p,m=(h-l)/p,[g,y]=[o+f*n,o+f*(n+1)],[b,v]=[s+d*i,s+d*(i+1)],[w,_]=[l+m*a,l+m*(a+1)];return{region:[g,b,y,v,w,_]}}return console.warn("Unsupported bounding volume type: ",t),null}(t,l,r);return{children:e.children,contentUrl:e.contentUrl,content:{uri:h},id:e.contentUrl,refine:o(a),type:u(e),lodMetricType:s,lodMetricValue:p,boundingVolume:f}}function mb(e,t){return parseInt(e.toString(2)+t.toString(2),2)}function gb(e,t,r,n,i){const a=function(e){const t={};for(const r in e)t[`{${r}}`]=e[r];return t}({level:t,x:r,y:n,z:i});return e.replace(/{level}|{x}|{y}|{z}/gi,e=>a[e])}function yb(e){if(!e.contentUrl)return nf;const t=e.contentUrl.split(".").pop();switch(t){case"pnts":return of;case"i3dm":case"b3dm":case"glb":case"gltf":return af;default:return t}}function bb(e){switch(e){case"REPLACE":case"replace":return rf;case"ADD":case"add":return tf;default:return e}}function vb(e,t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){const r=new URL(e,t+"/");return decodeURI(r.toString())}return e.startsWith("/")?e:`${t}/${e}`}function wb(e,t){if(!e)return null;if(e.content){const r=e.content.uri||e.content.url;e.contentUrl=vb(r,t.basePath)}return e.id=e.contentUrl,e.lodMetricType=lf,e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform,e.type=yb(e),e.refine=bb(e.refine),e}async function _b(e){if(!e.root)return null;const t=e.basePath,r=e.root.extensions["3DTILES_implicit_tiling"],{subdivisionScheme:n,maximumLevel:i,subtreeLevels:a,subtrees:{uri:o}}=r,s=vb(gb(o,0,0,0,0),t),u=await Zo(s,hb),c=vb(e.root.content.uri,t),l=e.root.refine,h=e.root.geometricError,p=e.root.boundingVolume,f={contentUrlTemplate:c,subtreesUriTemplate:o,subdivisionScheme:n,subtreeLevels:a,maximumLevel:i,refine:l,basePath:t,lodMetricType:lf,rootLodMetricValue:h,rootBoundingVolume:p,getTileType:yb,getRefine:bb};return await async function(e,t,r){if(!e)return null;e.lodMetricType=lf,e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform;const{children:n,contentUrl:i}=await async function e(t){const{options:r,parentData:n={mortonIndex:0,x:0,y:0,z:0},childIndex:i=0,globalData:a={level:0,mortonIndex:0,x:0,y:0,z:0}}=t;let{subtree:o,level:s=0}=t;const{subdivisionScheme:u,subtreeLevels:c,maximumLevel:l,contentUrlTemplate:h,subtreesUriTemplate:p,basePath:f}=r,d={children:[],lodMetricValue:0,contentUrl:""},m=pb[u],g=1&i,y=i>>1&1,b=i>>2&1,v=(m**s-1)/(m-1);let w=mb(n.mortonIndex,i),_=v+w,k=mb(n.x,g),x=mb(n.y,y),E=mb(n.z,b),A=!1;s+1>c&&(A=fb(o.childSubtreeAvailability,w));const S=mb(a.x,k),j=mb(a.y,x),T=mb(a.z,E),C=s+a.level;if(A){const e=gb(`${f}/${p}`,C,S,j,T);o=await Zo(e,hb),a.mortonIndex=w,a.x=k,a.y=x,a.z=E,a.level=s,w=0,_=0,k=0,x=0,E=0,s=0}if(!fb(o.tileAvailability,_)||s>l)return d;fb(o.contentAvailability,_)&&(d.contentUrl=gb(h,C,S,j,T));const B=s+1,R={mortonIndex:w,x:k,y:x,z:E};for(let t=0;t<m;t++){const n=await e({subtree:o,options:r,parentData:R,childIndex:t,level:B,globalData:a});if(n.contentUrl||n.children.length){const e=db(n,C+1,{childTileX:k,childTileY:x,childTileZ:E},r);d.children.push(e)}}return d}({subtree:t,options:r});i&&(e.contentUrl=i,e.content={uri:i.replace(r.basePath+"/","")});return e.refine=bb(e.refine),e.type=yb(e),e.children=n,e.id=e.contentUrl,e}(e.root,u,f)}const kb={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:"3.3.0-alpha.3",extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:async function(e,t,r){const i=t["3d-tiles"]||{};let a;a="auto"===i.isTileset?r.url&&-1!==r.url.indexOf(".json"):i.isTileset;e=a?await async function(e,t,r){var i;const a=JSON.parse((new TextDecoder).decode(e));return a.loader=t.loader||kb,a.url=r.url,a.basePath=function(e){return n.dirname(e.url)}(a),a.root=function(e){var t,r;return(null==e||null===(t=e.extensionsRequired)||void 0===t?void 0:t.includes("3DTILES_implicit_tiling"))&&(null==e||null===(r=e.extensionsUsed)||void 0===r?void 0:r.includes("3DTILES_implicit_tiling"))}(a)?await _b(a):function(e){const t=e.basePath,r=wb(e.root,e),n=[];for(n.push(r);n.length>0;){const e=(n.pop()||{}).children||[];for(const r of e)wb(r,{basePath:t}),n.push(r)}return r}(a),a.type=cf,a.lodMetricType=lf,a.lodMetricValue=(null===(i=a.root)||void 0===i?void 0:i.lodMetricValue)||0,a}(e,t,r):await async function(e,t,r){const n={content:{featureIds:null}};return await ub(e,0,t,r,n.content),n.content}(e,t,r);return e},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function xb(e,t){if(!t){const r=await async function(e){Vi(e);const t={Authorization:"Bearer "+e},r=await oa("https://api.cesium.com/v1/assets",{fetch:{headers:t}});if(!r.ok)throw new Error(r.statusText);return await r.json()}(e);for(const e of r.items)"3DTILES"===e.type&&(t=e.id)}const r=await async function(e,t){Vi(e,t);const r={Authorization:"Bearer "+e},n="https://api.cesium.com/v1/assets/"+t;let i=await oa(""+n,{fetch:{headers:r}});if(!i.ok)throw new Error(i.statusText);let a=await i.json();if(i=await oa(n+"/endpoint",{fetch:{headers:r}}),!i.ok)throw new Error(i.statusText);const o=await i.json();return a={...a,...o},a}(e,t),{type:n,url:i}=r;return Vi("3DTILES"===n&&i),r.headers={Authorization:"Bearer "+r.accessToken},r}const Eb={...kb,id:"cesium-ion",name:"Cesium Ion",preload:async function(e,t={}){t=t["cesium-ion"]||{};const{accessToken:r}=t;let n=t.assetId;if(!Number.isFinite(n)){const t=e.match(/\/([0-9]+)\/tileset.json/);n=t&&t[1]}return xb(r,n)},parse:async(e,t,r)=>((t={...t})["3d-tiles"]=t["cesium-ion"],t.loader=Eb,kb.parse(e,t,r)),options:{"cesium-ion":{...kb.options["3d-tiles"],accessToken:null}}};var Ab=r(10),Sb=r.n(Ab);const jb=new Uint8Array(256);let Tb=jb.length;function Cb(){return Tb>jb.length-16&&(Sb.a.randomFillSync(jb),Tb=0),jb.slice(Tb,Tb+=16)}var Bb=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;var Rb=function(e){return"string"==typeof e&&Bb.test(e)};const Ob=[];for(let e=0;e<256;++e)Ob.push((e+256).toString(16).substr(1));var Ib=function(e,t=0){const r=(Ob[e[t+0]]+Ob[e[t+1]]+Ob[e[t+2]]+Ob[e[t+3]]+"-"+Ob[e[t+4]]+Ob[e[t+5]]+"-"+Ob[e[t+6]]+Ob[e[t+7]]+"-"+Ob[e[t+8]]+Ob[e[t+9]]+"-"+Ob[e[t+10]]+Ob[e[t+11]]+Ob[e[t+12]]+Ob[e[t+13]]+Ob[e[t+14]]+Ob[e[t+15]]).toLowerCase();if(!Rb(r))throw TypeError("Stringified UUID is invalid");return r};var Pb=function(e,t,r){const n=(e=e||{}).random||(e.rng||Cb)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return Ib(n)},Db=r(81),Mb=r.n(Db);function Fb(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Lb{constructor(e,t){Fb(this,"nodesPerPage",void 0),Fb(this,"nodesCounter",void 0),Fb(this,"writeFile",void 0),Fb(this,"nodePages",void 0),this.nodesPerPage=t,this.nodesCounter=0,this.nodePages=[{}],this.nodePages[0].nodes=[],this.writeFile=e}useWriteFunction(e){this.writeFile=e}getNodeById(e){const t=Math.floor(e/this.nodesPerPage),r=e%this.nodesPerPage;return this.nodePages[t].nodes[r]}updateMaterialByNodeId(e,t){const r=this.getNodeById(e);r.mesh&&(r.mesh.material={definition:t,resource:r.index})}updateVertexCountByNodeId(e,t){const r=this.getNodeById(e);r.mesh&&(r.mesh.geometry.vertexCount=t)}updateNodeAttributeByNodeId(e){const t=this.getNodeById(e);t.mesh&&(t.mesh.attribute.resource=t.index)}updateFeatureCountByNodeId(e,t){const r=this.getNodeById(e);r.mesh&&(r.mesh.geometry.featureCount=t)}updateTexelCountHintByNodeId(e,t){const r=this.getNodeById(e);r.mesh&&r.mesh.material&&(r.mesh.material.texelCountHint=t)}addChildRelation(e,t){var r;if(null==e)return;null===(r=this.getNodeById(e).children)||void 0===r||r.push(t)}updateResourceInMesh(e){e.mesh&&(e.mesh.geometry.resource=e.index)}push(e,t){let r=this.nodePages[this.nodePages.length-1];return r.nodes.length===this.nodesPerPage&&(r={nodes:[]},this.nodePages.push(r)),e.index=this.nodesCounter++,r.nodes.push(e),this.addChildRelation(t,e.index),this.updateResourceInMesh(e),e.index}async save(e,t,r=!1){if(r){for(const[r,n]of this.nodePages.entries()){const i=JSON.stringify(n),a=Object(Ci.join)(e,"nodepages");await t.enqueue({archiveKey:`nodePages/${r.toString()}.json.gz`,writePromise:this.writeFile(a,i,r.toString()+".json")})}const r=Ii()({nodeCount:this.nodesCounter},{folderPattern:{path:"folderPattern",default:"BASIC"},archiveCompressionType:{path:"archiveCompressionType",default:"STORE"},resourceCompressionType:{path:"resourceCompressionType",default:"GZIP"},I3SVersion:{path:"I3SVersion",default:"1.8"},nodeCount:{path:"nodeCount"}}),n=!1;await t.enqueue({archiveKey:"metadata.json",writePromise:this.writeFile(e,JSON.stringify(r),"metadata.json",n)})}else for(const[r,n]of this.nodePages.entries()){const i=JSON.stringify(n),a=Object(Ci.join)(e,"nodepages",r.toString());await t.enqueue({writePromise:this.writeFile(a,i)})}}}const Nb={};class zb extends ys{static get ZERO(){return Nb.ZERO=Nb.ZERO||Object.freeze(new zb(0,0,0,0))}constructor(e=0,t=0,r=0,n=0){super(-0,-0,-0,-0),as(e)&&1===arguments.length?this.copy(e):(ns.debug&&(fs(e),fs(t),fs(r),fs(n)),this[0]=e,this[1]=t,this[2]=r,this[3]=n)}set(e,t,r,n){return this[0]=e,this[1]=t,this[2]=r,this[3]=n,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 ns.debug&&(fs(e.x),fs(e.y),fs(e.z),fs(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]=fs(e)}get w(){return this[3]}set w(e){this[3]=fs(e)}transform(e){return As(this,this,e),this.check()}transformByMatrix3(e){return Os(this,this,e),this.check()}transformByMatrix2(e){return function(e,t,r){const n=t[0],i=t[1];e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e[3]=t[3]}(this,this,e),this.check()}transformByQuaternion(e){return js(this,this,e),this.check()}applyMatrix4(e){return e.transform(this,this),this}}function Ub(e){const{positions:t,normals:r,texCoords:n,colors:i,featureIndices:a}=e,o=t.length/9;if(!a.length)return{faceRange:new Uint32Array([0,o-1]),featureIds:[0],featureCount:1,positions:t,normals:r,texCoords:n,colors:i};const s=function(e){let t=1,r=1,n=qb(e.slice(0,3));const i=[],a=[],o=[n];i[0]=0,a[0]=n;for(let s=3;s<e.length;s+=3){const u=qb(e.slice(s,s+3));n!==u&&(i[t]=s/3-1,i[t+1]=s/3,a[r]=u,o.includes(u)||o.push(u),t+=2,r+=1),n=u}i[t]=e.length/3-1;const s=new Uint32Array(i),u=o.length;return{faceRange:s,featureCount:u,featureIds:a}}(a);return function(e,t){const r=e[0],n=[r.featureId||0];let i=new Float32Array(r.positions),a=new Float32Array(r.normals),o=new Uint8Array(r.colors),s=new Float32Array(r.texCoords);const u=[0];let c=0,l=0;for(let t=1;t<e.length;t++){const r=e[t];n.push(r.featureId||0),i=Qa(i,r.positions),a=Qa(a,r.normals),o=Qa(o,r.colors),s=Qa(s,r.texCoords);const h=e[c];u.push(h.positions.length/9-1+l),u.push(h.positions.length/9+l),l+=h.positions.length/9,c+=1}u.push(i.length/9-1);return{faceRange:new Uint32Array(u),featureIds:n,positions:i,normals:a,colors:o,texCoords:s,featureCount:t}}(function(e){const t=[];for(let r=0;r<e.length;r++){const n=e[r],i=t.find(e=>e.featureId===n.featureId);i?(i.positions=Qa(i.positions,n.positions),i.normals=Qa(i.normals,n.normals),i.colors=Qa(i.colors,n.colors),i.texCoords=Qa(i.texCoords,n.texCoords)):t.push(n)}return t}(function(e){const{featureIds:t,positions:r,normals:n,colors:i,texCoords:a,faceRange:o=new Uint32Array(0)}=e,s=[];let u=new Float32Array(r),c=new Float32Array(n),l=new Uint8Array(i),h=new Float32Array(a),p=0;for(let e=0;e<t.length;e++){const r=o[e+p],n=o[e+p+1],i=Hb("positions",r,n),a=Hb("normals",r,n),f=Hb("colors",r,n),d=Hb("texCoords",r,n);s.push({featureId:t[e],positions:u.slice(0,i),normals:c.slice(0,a),colors:l.slice(0,f),texCoords:h.slice(0,d)}),u=u.slice(i),c=c.slice(a),l=l.slice(f),h=h.slice(d),p+=1}return s.sort((e,t)=>e.featureId-t.featureId)}({...s,...e})),s.featureCount)}function qb(e){const t={};let r=e[0],n=1;for(const i of e)t[i]=(t[i]||0)+1,n=n>t[i]?n:t[i],r=n>t[i]?r:i;return r}function Hb(e,t,r){const n=r-t+1,i=3*n;switch(e){case"positions":case"normals":return 9*n;case"colors":return 4*i;case"texCoords":return 2*i;default:return 0}}function Gb(e){const t={};for(const r in e)t[r]={value:e[r].value};return t}function Vb(e,t,r){var n,i,a,o;const s=null==t||null===(n=t.featureIdAttributes)||void 0===n?void 0:n[0];if(null!=s&&null!==(i=s.featureIds)&&void 0!==i&&i.attribute){return e[s.featureIds.attribute].value}if(null!=s&&null!==(a=s.featureIds)&&void 0!==a&&a.hasOwnProperty("constant")&&null!=s&&null!==(o=s.featureIds)&&void 0!==o&&o.hasOwnProperty("divisor")){var u;return function(e,t=0,r=0){let n=[];if(r>0){let i=t,a=r;for(let t=0;t<e;t++)n.push(i),a-=1,0===a&&(i++,a=r)}else n=Array(e).fill(t,0,e);return n}((null==e||null===(u=e.POSITIONS)||void 0===u?void 0:u.value.length)/3||0,s.featureIds.constant,s.featureIds.divisor)}const c=(null==t?void 0:t.featureIdTextures)&&(null==t?void 0:t.featureIdTextures[0]);if(c){var l,h;return function(e,t,r){var n,i,a;const o=null==e||null===(n=e.featureIds)||void 0===n||null===(i=n.texture)||void 0===i?void 0:i.index,s=null==e||null===(a=e.featureIds)||void 0===a?void 0:a.channels;if(!s||void 0===o)return[];const u=r[o],c=[],l={r:0,g:1,b:2,a:3}[s];if(u.compressed)console.warn(`Can't get batch Ids from ${u.mimeType} compressed texture`);else for(let e=0;e<t.length;e+=2){const r=t[e],n=t[e+1],i=Math.min(Wb(r)*u.width|0,u.width-1),a=(Math.min(Wb(n)*u.height|0,u.height-1)*u.width+i)*u.components+l,o=new Uint8Array(u.data)[a];c.push(o)}return c}(c,e["TEXCOORD_"+((null==c||null===(l=c.featureIds)||void 0===l||null===(h=l.texture)||void 0===h?void 0:h.texCoord)||0)].value,r)}return(null==t?void 0:t.featureTextures)&&(null==t?void 0:t.featureTextures[0])?(console.warn("EXT_feature_metadata doesn't yet support featureTextures in primitive"),[]):[]}function Wb(e){return(e%1+1)%1}function Kb(e,t){const r=[];for(const n of t){const t=e[n]||null;r.push(t)}return r}const Jb=["CUSTOM_ATTRIBUTE_2","_BATCHID","BATCHID"];let Qb=new Ds;async function Yb(e,t,r,n,i,a,o,s,u){var c;const l=o,h=function(e=[]){const t=[];for(const r of e)t.push(sv(r));return t}(null===(c=e.gltf)||void 0===c?void 0:c.materials),p=function(e){var t,r,n,i,a,o,s,u,c,l;const h=null===(t=e.gltf)||void 0===t||null===(r=t.materials)||void 0===r?void 0:r.map(e=>({id:e.id}));let p=(null===(n=e.gltf)||void 0===n||null===(i=n.scene)||void 0===i?void 0:i.nodes)||(null===(a=e.gltf)||void 0===a||null===(o=a.scenes)||void 0===o||null===(s=o[0])||void 0===s?void 0:s.nodes)||(null===(u=e.gltf)||void 0===u?void 0:u.nodes)||[];const f=(null===(c=e.gltf)||void 0===c||null===(l=c.images)||void 0===l?void 0:l.map(e=>{var t,r,n;return{data:null!=e&&null!==(t=e.image)&&void 0!==t&&t.compressed?null:null==e||null===(r=e.image)||void 0===r?void 0:r.data.subarray(),compressed:Boolean(null==e||null===(n=e.image)||void 0===n?void 0:n.compressed),height:e.image.height,width:e.image.width,components:e.image.components,mimeType:e.mimeType}}))||[];return{gltfMaterials:h,nodes:p.map(e=>{var t;return e.mesh?{...e,images:f,mesh:{...e.mesh,primitives:null===(t=e.mesh)||void 0===t?void 0:t.primitives.map(e=>{var t,r;return{...e,indices:{value:null==e||null===(t=e.indices)||void 0===t?void 0:t.value},attributes:Gb(e.attributes),material:{id:null==e||null===(r=e.material)||void 0===r?void 0:r.id}}})}}:e}),cartographicOrigin:e.cartographicOrigin,cartesianModelMatrix:e.cartesianModelMatrix}}(e),f=await async function(e,t){const{gltfMaterials:r,nodes:n,cartographicOrigin:i,cartesianModelMatrix:a}=e,o=new Map;for(const e of r||[{id:"default"}])o.set(e.id,{positions:new Float32Array(0),normals:new Float32Array(0),texCoords:new Float32Array(0),colors:new Uint8Array(0),featureIndicesGroups:[],featureIndices:[],boundingVolumes:null});Xb(n,i,a,o,t);for(const e of o.keys()){const t=o.get(e);t&&(0!==t.positions.length?t.featureIndicesGroups&&(t.featureIndices=t.featureIndicesGroups.reduce((e,t)=>e.concat(t)),delete t.featureIndicesGroups):o.delete(e))}return o}(p,l);o&&function(e,t){for(const r of e.values()){const e=Vm(r.positions,t);r.boundingVolumes=e;const n=e.obb.center;for(let e=0;e<r.positions.length;e+=3){const i=r.positions.subarray(e,e+3);_u.WGS84.cartesianToCartographic(Array.from(i),Qb),Qb[2]=Qb[2]-t.getHeight(Qb[1],Qb[0]),Qb=Qb.subtract(n),r.positions.set(Qb,e)}}}(f,s),f.has("default")&&h.push({material:{alphaMode:"opaque",pbrMetallicRoughness:{metallicFactor:1,roughnessFactor:1}}});const d=[];let m=t,{materials:g=[]}=e.gltf||{materials:[]};null!=g&&g.length||g.push({id:"default"});for(let t=0;t<g.length;t++){const o=g[t];if(!f.has(o.id))continue;const s=f.get(o.id);if(!s)continue;const{material:c,texture:l}=h[t];d.push(await $b({convertedAttributes:s,material:c,texture:l,tileContent:e,nodeId:m,featuresHashArray:n,propertyTable:r,attributeStorageInfo:i,draco:a,workerSource:u})),m++}return d.length?d:null}async function $b({convertedAttributes:e,material:t,texture:r,tileContent:n,nodeId:i,featuresHashArray:a,propertyTable:o,attributeStorageInfo:s,draco:u,workerSource:c}){var l;const h=e.boundingVolumes,p=e.positions.length/3,{faceRange:f,featureIds:d,positions:m,normals:g,colors:y,texCoords:b,featureCount:v}=Ub(e);n.batchTableJson&&function(e,t,r,n){const i=function(e,t,r){const n={};for(let i=0;i<e.length;i++){const a=e[i],o=fv(i,t,r);n[a.toString()]=o}return n}(e,n,r);dv(t,i),dv(e,i)}(d,e.featureIndices,a,n.batchTableJson);const w=new Uint32Array(2),_=function(e){const t=new BigUint64Array(e.length);for(let r=0;r<e.length;r++)t[r]=BigInt(e[r]);return t}(d);w.set([p,v],0);const k=new Uint8Array(Ja(w.buffer,m.buffer,g.buffer,r?b.buffer:new ArrayBuffer(0),y.buffer,_.buffer,f.buffer)),x=u?async function(e,t,r,n){const{positions:i,normals:a,texCoords:o,colors:s,featureIds:u,faceRange:c}=r,l=new Uint32Array(e);for(let e=0;e<l.length;e++)l.set([e],e);const h=function(e,t){const r=new Uint32Array(e.length);let n=0,i=0;for(let e=1;e<t.length;e+=2){const a=3*(t[e]+1);r.fill(n,i,a),n++,i=a+1}return r}(new Uint32Array(t.featureIndices.length?t.featureIndices:e),c),p={positions:i,normals:a,colors:s,"feature-index":h};o.length&&(p.texCoords=o);const f={"feature-index":{"i3s-attribute-type":"feature-index","i3s-feature-ids":new Int32Array(u)}};return om({attributes:p,indices:l},Bc,{...Bc.options,source:n,reuseWorkers:!0,_nodeWorkers:!0,draco:{method:"MESH_SEQUENTIAL_ENCODING",attributesMetadata:f}})}(p,e,{positions:m,normals:g,texCoords:r?b:new Float32Array(0),colors:y,featureIds:d,faceRange:f},c.draco):null;let E=[];return s&&o&&(E=function(e,t,r){const n=[],i=function(e,t){let r=!1;for(const n of Object.values(t))e.length!==n.length&&(r=!0);return r}(e,t)?function(e,t){const r={};for(const n in t){const i=t[n];r[n]=Kb(i,e)}return r}(e,t):t,a={OBJECTID:e,...i};for(const e in a){const t=gv(e,r),i=a[e],o=mv(t,i);n.push(o)}return n}(d,o,s)),{geometry:k,compressedGeometry:x,texture:r,sharedResources:cv((null===(l=n.gltf)||void 0===l?void 0:l.materials)||[],i),meshMaterial:t,vertexCount:p,attributes:E,featureCount:v,boundingVolumes:h}}function Xb(e,t,r,n,i,a=new Js([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){if(e)for(const o of e)Zb(o,t,r,n,i,a)}function Zb(e,t,r,n,i,a=new Js([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){const o=function(e,t){let r=t;const{matrix:n,rotation:i,scale:a,translation:o}=e;return n&&(r=t.multiplyRight(n)),o&&(r=r.translate(o)),i&&(r=r.rotateXYZ(i)),a&&(r=r.scale(a)),r}(e,a),s=e.mesh,u=e.images;s&&function(e,t,r,n,i,a=!1,o=new Js([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){for(const p of e.primitives){var s,u,c,l,h;let e=null;p.material?e=i.get(p.material.id):i.has("default")&&(e=i.get("default")),Vi(null!==e,"Primitive - material mapping failed");const f=p.attributes;e&&(e.positions=Qa(e.positions,ev({vertices:f.POSITION.value,cartographicOrigin:r,cartesianModelMatrix:n,nodeMatrix:o,indices:null===(s=p.indices)||void 0===s?void 0:s.value,attributeSpecificTransformation:tv,useCartesianPositions:a})),e.normals=Qa(e.normals,ev({vertices:f.NORMAL&&f.NORMAL.value,cartographicOrigin:r,cartesianModelMatrix:n,nodeMatrix:o,indices:null===(u=p.indices)||void 0===u?void 0:u.value,attributeSpecificTransformation:rv,useCartesianPositions:!1})),e.texCoords=Qa(e.texCoords,nv(f.TEXCOORD_0&&f.TEXCOORD_0.value,null===(c=p.indices)||void 0===c?void 0:c.value)),e.colors=Qa(e.colors,iv(f.COLOR_0,null===(l=p.indices)||void 0===l?void 0:l.value)),e.featureIndicesGroups=e.featureIndicesGroups||[],e.featureIndicesGroups.push(av(ov(f,p,t),null===(h=p.indices)||void 0===h?void 0:h.value)))}}(s,u,t,r,n,i,o),Xb(e.children||[],t,r,n,i,o)}function ev(e){const{vertices:t,indices:r,attributeSpecificTransformation:n}=e,i=new Float32Array(3*r.length);if(!t)return i;for(let a=0;a<r.length;a++){const o=3*r[a],s=t.subarray(o,o+3);let u=new Ds(Array.from(s));u=n(u,e),i[3*a]=u.x,i[3*a+1]=u.y,i[3*a+2]=u.z}return i}function tv(e,t){const{cartesianModelMatrix:r,cartographicOrigin:n,nodeMatrix:i,useCartesianPositions:a}=t;return i&&(e=e.transform(i)),e=e.transform(r),a?e:(_u.WGS84.cartesianToCartographic([e[0],e[1],e[2]],e),e=e.subtract(n))}function rv(e,t){const{cartesianModelMatrix:r,nodeMatrix:n}=t;return n&&(e=e.transformAsVector(n)),e=e.transformAsVector(r)}function nv(e,t){const r=new Float32Array(2*t.length);if(!e)return r.fill(1),r;for(let n=0;n<t.length;n++){const i=2*t[n],a=e.subarray(i,i+2);r[2*n]=a[0],r[2*n+1]=a[1]}return r}function iv(e,t){const r=(null==e?void 0:e.components)||4,n=new Uint8Array(t.length*r);if(!e)return n.fill(255),n;const i=e.value;for(let e=0;e<t.length;e++){const a=t[e]*r,o=i.subarray(a,a+r),s=new Uint8Array(r);for(let e=0;e<o.length;e++)s[e]=255*o[e];n.set(s,e*r)}return n}function av(e,t){if(!e.length||!t.length)return[];const r=[];for(let n=0;n<t.length;n++){const i=t[n];r.push(e[i])}return r}function ov(e,t,r){const n=function(e,t,r){const n=null==t?void 0:t.extensions;if(!n)return[];for(const[t,i]of Object.entries(n||{}))switch(t){case"EXT_feature_metadata":return Vb(e,i,r);case"EXT_mesh_features":return console.warn("EXT_mesh_features extension is not supported yet"),[];default:return[]}return[]}(e,t,r);if(n.length)return n;for(let t=0;t<Jb.length;t++){const r=Jb[t];if(e[r]&&e[r].value)return e[r].value}return[]}function sv(e){var t,r,n,i;const a={doubleSided:e.doubleSided,emissiveFactor:null===(t=e.emissiveFactor)||void 0===t?void 0:t.map(e=>Math.round(255*e)),alphaMode:uv(e.alphaMode),pbrMetallicRoughness:{roughnessFactor:(null==e||null===(r=e.pbrMetallicRoughness)||void 0===r?void 0:r.roughnessFactor)||1,metallicFactor:(null==e||null===(n=e.pbrMetallicRoughness)||void 0===n?void 0:n.metallicFactor)||1}};let o;if(null!=e&&null!==(i=e.pbrMetallicRoughness)&&void 0!==i&&i.baseColorTexture?(o=e.pbrMetallicRoughness.baseColorTexture.texture.source,a.pbrMetallicRoughness.baseColorTexture={textureSetDefinitionId:0}):e.emissiveTexture&&(o=e.emissiveTexture.texture.source,a.pbrMetallicRoughness.baseColorTexture={textureSetDefinitionId:0}),!o){var s;const t=null==e||null===(s=e.pbrMetallicRoughness)||void 0===s?void 0:s.baseColorFactor;a.pbrMetallicRoughness.baseColorFactor=t&&t.map(e=>Math.round(255*e))||void 0}return{material:a,texture:o}}function uv(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend";default:return"opaque"}}function cv(e,t){const r={};if(!e||!e.length)return r;r.materialDefinitionInfos=[];for(const n of e){const{materialDefinitionInfo:e,textureDefinitionInfo:i}=lv(n,t);r.materialDefinitionInfos.push(e),i&&(r.textureDefinitionInfos=r.textureDefinitionInfos||[],r.textureDefinitionInfos.push(i))}return r}function lv(e,t){var r;const n=(null==e||null===(r=e.pbrMetallicRoughness)||void 0===r?void 0:r.baseColorTexture)||e.emissiveTexture;let i=null;n&&(i=function(e,t){var r,n,i;return{encoding:null!=e&&null!==(r=e.source)&&void 0!==r&&r.mimeType?[e.source.mimeType]:void 0,images:[{id:pv(e,t),size:null===(n=e.source)||void 0===n?void 0:n.image.width,length:[null===(i=e.source)||void 0===i?void 0:i.image.data.length]}]}}(n.texture,t));const{baseColorFactor:a,metallicFactor:o}=(null==e?void 0:e.pbrMetallicRoughness)||{};let s=a;return a&&0!==a[3]||!e.emissiveFactor||(s=e.emissiveFactor,s[3]=s[3]||1),{materialDefinitionInfo:hv(s||[1,1,1,1],o),textureDefinitionInfo:i}}function hv(e,t=1){const r=new zb(0,0,0,1),n=new zb(1,1,1,1),i=new zb(.04/255,.04/255,.04/255,0),a=new zb(e),o=n.subtract(i).multiply(a),s=o.lerp(o,r,t);i[3]=1;const u=i.lerp(i,a,t);return{params:{diffuse:s.toArray(),specular:u.toArray(),renderMode:"solid"}}}function pv(e,t){var r;const{width:n,height:i}=null===(r=e.source)||void 0===r?void 0:r.image,a=t+1,o=32-a.toString(2).length,s="0".repeat(o).concat(a.toString(2));return BigInt(`0b${(268435456+(n-1<<12)+(i-1<<0)).toString(2)}${s}`).toString()}function fv(e,t,r){const n=function(e,t){let r="";for(const n in e)r+=e[n][t];return r}(t,e),i=Mb()(n);return r.includes(i)?r.indexOf(i):r.push(i)-1}function dv(e,t){for(let r=0;r<e.length;r++)e[r]=t[e[r]]}function mv(e,t){let r;switch(e){case"Oid32":case"Int32":r=function(e){const t=new Uint32Array([e.length]),r=new Uint32Array(e);return Ja(t.buffer,r.buffer)}(t);break;case"Float64":r=function(e){const t=new Uint32Array([e.length]),r=new Uint8Array(4),n=new Float64Array(e);return Ja(t.buffer,r.buffer,n.buffer)}(t);break;case"string":r=yv(t);break;default:r=yv(t)}return r}function gv(e,t){return t.find(t=>t.name===e).attributeValues.valueType}function yv(e){const t=new Uint32Array([e.length]);let r=0;const n=new Uint32Array(e.length),i=[];for(let t=0;t<e.length;t++){const a=String(e[t])+"\0",o=Buffer.from(a),s=o.length;r+=s,n[t]=s,i.push(o)}const a=new Uint32Array([r]);return Ja(t.buffer,a.buffer,n.buffer,...i)}function bv(e){var t;const r=null==e||null===(t=e.content)||void 0===t?void 0:t.batchTableJson;if(r)return r;const{extensionName:n,extension:i}=function(e){var t,r,n,i,a;const o=["EXT_feature_metadata","EXT_mesh_features"];if(!(null==e||null===(t=e.content)||void 0===t||null===(r=t.gltf)||void 0===r?void 0:r.extensionsUsed))return{extensionName:null,extension:null};let s="";for(const t of null==e||null===(u=e.content)||void 0===u||null===(c=u.gltf)||void 0===c?void 0:c.extensionsUsed){var u,c;if(o.includes(t)){s=t;break}}const l=null==e||null===(n=e.content)||void 0===n||null===(i=n.gltf)||void 0===i||null===(a=i.extensions)||void 0===a?void 0:a[s];return{extensionName:s,extension:l}}(e);switch(n){case"EXT_mesh_features":return console.warn("The I3S converter does not yet support the EXT_mesh_features extension"),null;case"EXT_feature_metadata":return function(e){if(null!=e&&e.featureTextures)return console.warn("The I3S converter does not yet support the EXT_feature_metadata feature textures"),null;if(null!=e&&e.featureTables){var t;const r=null===(t=Object.keys(e.featureTables))||void 0===t?void 0:t[0];if(r){const t=null==e?void 0:e.featureTables[r],n={};for(const e in t.properties)n[e]=t.properties[e].data;return n}}return console.warn("The I3S converter couldn't handle EXT_feature_metadata extension"),null}(i);default:return null}}const vv={id:{path:"id",transform:e=>e.toUpperCase()},profile:{path:"profile",default:"meshpyramids"},version:{path:"version",default:"1.8"},resourcePattern:{path:"resourcePattern",default:["3dNodeIndexDocument","Attributes","SharedResource","Geometry"]},rootNode:{path:"rootNode",default:"./nodes/root"},extent:{path:"extent"},indexCRS:{path:"indexCRS",default:"http://www.opengis.net/def/crs/EPSG/0/4326"},vertexCRS:{path:"vertexCRS",default:"http://www.opengis.net/def/crs/EPSG/0/4326"},normalReferenceFrame:{path:"normalReferenceFrame",default:"east-north-up"},attributeEncoding:{path:"attributeEncoding",default:"application/octet-stream; version=1.6"},textureEncoding:{path:"textureEncoding",default:["image/jpeg","image/ktx2"]},lodType:{path:"lodType",default:"MeshPyramid"},lodModel:{path:"lodModel",default:"node-switching"},defaultGeometrySchema:{path:"defaultGeometrySchema",default:{geometryType:"triangles",header:[{property:"vertexCount",type:"UInt32"},{property:"featureCount",type:"UInt32"}],topology:"PerAttributeArray",ordering:["position","normal","uv0","color"],vertexAttributes:{position:{valueType:"Float32",valuesPerElement:3},normal:{valueType:"Float32",valuesPerElement:3},uv0:{valueType:"Float32",valuesPerElement:2},color:{valueType:"UInt8",valuesPerElement:4}},featureAttributeOrder:["id","faceRange"],featureAttributes:{id:{valueType:"UInt64",valuesPerElement:1},faceRange:{valueType:"UInt32",valuesPerElement:2}}}}},wv=()=>({version:{path:"version"},id:{path:"id"},path:{path:"path"},level:{path:"level"},mbs:{path:"mbs"},obb:{path:"obb"},lodSelection:{path:"lodSelection",default:[{metricType:"maxScreenThresholdSQ",maxError:196349.54374999998},{metricType:"maxScreenThreshold",maxError:999.9999999999999}]},children:{path:"children",default:null},neighbors:{path:"neighbors",default:null},parentNode:{path:"parentNode",transform:e=>Ii()(e,{id:{path:"id"},href:{path:"href"},mbs:{path:"mbs"},obb:{path:"obb"}}),default:null},sharedResource:{path:"sharedResource",default:null},featureData:{path:"featureData",default:null},geometryData:{path:"geometryData",default:null},textureData:{path:"textureData",default:null},attributeData:{path:"attributeData",default:null}});function _v(e,t,r){const n={};for(const[t,i]of e.entries())n[`Mat${r.nodePath}${t}`]=Ii()(i,{name:{path:"name",default:"standard"},type:{path:"type",default:"standard"},params:{path:"params",transform:(e,t,r)=>Ii()(r,{renderMode:{path:"renderMode",default:"solid"},shininess:{path:"shininess",default:1},reflectivity:{path:"reflectivity",default:0},ambient:{path:"ambient",default:[1,1,1,1]},diffuse:{path:"diffuse",default:[1,1,1,1]},specular:{path:"specular",default:[0,0,0,0]},useVertexColorAlpha:{path:"useVertexColorAlpha",default:!1},vertexRegions:{path:"vertexRegions",default:!1},vertexColors:{path:"vertexColors",default:!0}})}});return n}function kv(e,t,r){if(!e)return null;const n={};for(const[t,i]of e.entries()){const e=`${r.nodePath}${t}`;i.imageIndex=e,n[e]=Ii()(i,{encoding:{path:"encoding"},wrap:{path:"wrap",default:["none"]},atlas:{path:"atlas",default:!1},uvSet:{path:"uvSet",default:"uv0"},channels:{path:"channels",default:"rgb"},images:{path:"images",transform:(e,t,r)=>e.map(e=>Ii()(e,{id:{path:"id"},size:{path:"size"},href:{path:"href",default:["../textures/0"]},length:{path:"length"}}))}})}return n}function xv(e,t){if(!e)throw new Error(t||"luma.gl: assertion failed.")}const Ev={};function Av(e="id"){Ev[e]=Ev[e]||1;const t=Ev[e]++;return"".concat(e,"-").concat(t)}const Sv={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};const jv=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),Tv=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]),Cv=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0]),Bv=new Float32Array([0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1]),Rv={POSITION:{size:3,value:new Float32Array(Tv)},NORMAL:{size:3,value:new Float32Array(Cv)},TEXCOORD_0:{size:2,value:new Float32Array(Bv)}};class Ov extends class{static get DRAW_MODE(){return Sv}constructor(e={}){const{id:t=Av("geometry"),drawMode:r=Sv.TRIANGLES,attributes:n={},indices:i=null,vertexCount:a=null}=e;this.id=t,this.drawMode=0|r,this.attributes={},this.userData={},this._setAttributes(n,i),this.vertexCount=a||this._calculateVertexCount(this.attributes,this.indices)}get mode(){return this.drawMode}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(e){return"Geometry ".concat(this.id," attribute ").concat(e)}_setAttributes(e,t){t&&(this.indices=ArrayBuffer.isView(t)?{value:t,size:1}:t);for(const t in e){let r=e[t];r=ArrayBuffer.isView(r)?{value:r}:r,xv(ArrayBuffer.isView(r.value),"".concat(this._print(t),": must be typed array or object with value as typed array")),"POSITION"!==t&&"positions"!==t||r.size||(r.size=3),"indices"===t?(xv(!this.indices),this.indices=r):this.attributes[t]=r}return this.indices&&void 0!==this.indices.isIndexed&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this}_calculateVertexCount(e,t){if(t)return t.value.length;let r=1/0;for(const t in e){const n=e[t],{value:i,size:a,constant:o}=n;!o&&i&&a>=1&&(r=Math.min(r,i.length/a))}return xv(Number.isFinite(r)),r}}{constructor(e={}){const{id:t=Av("cube-geometry")}=e;super({...e,id:t,indices:{size:1,value:new Uint16Array(jv)},attributes:{...Rv,...e.attributes}})}}function Iv(e){var t,r;if(null==e||null===(t=e.parentNode)||void 0===t||!t.obb||null==e||null===(r=e.parentNode)||void 0===r||!r.mbs)return[];const n=[];return function(e,t){var r;const n=function(e){const{center:t,halfSize:r,quaternion:n}=e;return(new fp).fromCenterHalfSizeQuaternion(t,r,n)}(t.parentNode.obb),i=function(e){const t=new Ov,r=e.obb.halfSize,n=t.getAttributes(),i=new Float32Array(n.POSITION.value),a=_u.WGS84.cartographicToCartesian(e.obb.center);let o=[];for(let t=0;t<i.length;t+=3){const n=new Ds(i[t]*=r[0],i[t+1]*=r[1],i[t+2]*=r[2]).transformByQuaternion(e.obb.quaternion).add(a);o=o.concat(n)}return o}(t);if(function(e,t){let r=!0;for(let n=0;n<t.length/3;n+=3){const i=[t[n],t[n+1],t[n+2]],a=_u.WGS84.cartesianToCartographic(i);if(e.distanceTo(a)>0){r=!1;break}}return r}(n,i))return;const a=`OBB of Tile (${t.id}) doesn't fit into Parent (${null===(r=t.parentNode)||void 0===r?void 0:r.id}) tile OBB`;e.push(a)}(n,e),function(e,t){const r=Pv(t.mbs),n=Pv(t.parentNode.mbs);if(r.center.distanceTo(n.center)+r.radius>n.radius){var i;const r=`MBS of Tile (${t.id}) doesn't fit into Parent (${null===(i=t.parentNode)||void 0===i?void 0:i.id}) tile MBS`;e.push(r)}}(n,e),n}function Pv(e){return new _h([e[0],e[1],e[2]],e[3])}const Dv={name:"Basis Universal Supercompressed GPU Texture",id:Pi?"ktx2-basis-writer":"ktx2-basis-writer-nodejs",module:"textures",version:"3.3.0-alpha.3",extensions:["ktx2"],worker:!0,options:{useSRGB:!1,qualityLevel:10,encodeUASTC:!1,mipmaps:!1}},{_encodeImageNode:Mv}=globalThis;let Fv=!0;const Lv={name:"Images",id:"image",module:"images",version:"3.3.0-alpha.3",extensions:["jpeg"],options:{image:{mimeType:"image/png",jpegQuality:null}},encode:async function(e,t){return(t=t||{}).image=t.image||{},Mv?Mv(e,{type:t.image.mimeType}):async function(e,t){const{mimeType:r,jpegQuality:n}=t.image,{width:i,height:a}=function(e){return Tu(e)}(e),o=document.createElement("canvas");o.width=i,o.height=a,function(e,t,r=0,n=0){if(0===r&&0===n&&"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const r=t.getContext("bitmaprenderer");if(r)return r.transferFromImageBitmap(e),t}const i=t.getContext("2d");if(e.data){const r=new Uint8ClampedArray(e.data),n=new ImageData(r,e.width,e.height);return i.putImageData(n,0,0),t}i.drawImage(e,0,0)}(e,o);const s=await new Promise(e=>{if(n&&Fv)try{return void o.toBlob(e,r,n)}catch(e){Fv=!1}o.toBlob(e,r)});if(!s)throw new Error("image encoding failed");return await s.arrayBuffer()}(e,t)}};class Nv extends Array{enqueue(e){this.push(e)}dequeue(){return this.shift()}peek(){return this[0]}isEmpty(){return 0===this.length}}function zv(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Uv extends Nv{constructor(e=2e3,t=400){super(),zv(this,"intervalId",void 0),zv(this,"writePromise",null),zv(this,"fileMap",{}),zv(this,"listeningInterval",void 0),zv(this,"writeConcurrency",void 0),this.listeningInterval=e,this.writeConcurrency=t}async enqueue(e){super.enqueue(e),Ri.a.memoryUsage().rss>4294967296&&await this.startWrite()}startListening(){this.intervalId=setInterval(this.startWrite.bind(this),this.listeningInterval)}stopListening(){this.intervalId&&clearInterval(this.intervalId)}async startWrite(){if(this.writePromise)return await this.writePromise,void(this.writePromise=null);this.writePromise=this.doWrite(),await this.writePromise,this.writePromise=null}async finalize(){this.stopListening(),await this.startWrite()}async doWrite(){for(;this.length;){const e=[],t=[];for(let r=0;r<this.writeConcurrency;r++){const r=this.dequeue();if(!r)break;const{archiveKey:n,writePromise:i}=r;t.push(n),e.push(i)}const r=await Promise.allSettled(e);this.updateFileMap(t,r)}this.writePromise=null}updateFileMap(e,t){for(let r=0;r<e.length;r++){const n=e[r];n&&"value"in t[r]&&(this.fileMap[n]=t[r].value)}}}const qv={id:"i3s-attributes",name:"I3S Attributes Worker",module:"tile-converter",version:"3.3.0-alpha.3",options:{useCartesianPositions:!1}};var Hv;function Gv(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Vv=(null===(Hv=Ri.a.env)||void 0===Hv?void 0:Hv.IonToken)||"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ";class Wv{constructor(){Gv(this,"nodePages",void 0),Gv(this,"options",void 0),Gv(this,"layers0Path",void 0),Gv(this,"materialMap",void 0),Gv(this,"materialDefinitions",void 0),Gv(this,"vertexCounter",void 0),Gv(this,"layers0",void 0),Gv(this,"featuresHashArray",void 0),Gv(this,"refinementCounter",void 0),Gv(this,"validate",void 0),Gv(this,"boundingVolumeWarnings",[]),Gv(this,"conversionStartTime",[0,0]),Gv(this,"refreshTokenTime",[0,0]),Gv(this,"sourceTileset",null),Gv(this,"geoidHeightModel",null),Gv(this,"Loader",kb),Gv(this,"generateTextures",void 0),Gv(this,"generateBoundingVolumes",void 0),Gv(this,"layersHasTexture",void 0),Gv(this,"workerSource",{}),Gv(this,"writeQueue",new Uv),this.nodePages=new Lb(Yd,64),this.options={},this.layers0Path="",this.materialMap=new Map,this.materialDefinitions=[],this.vertexCounter=0,this.layers0=null,this.featuresHashArray=[],this.refinementCounter={tilesCount:0,tilesWithAddRefineCount:0},this.validate=!1,this.generateTextures=!1,this.generateBoundingVolumes=!1,this.layersHasTexture=!1}async convert(e){if(Pi)return console.log(Jm),Jm;this.conversionStartTime=Ri.a.hrtime();const{tilesetName:t,slpk:r,egmFilePath:n,inputUrl:i,validate:a,outputPath:o,draco:s,sevenZipExe:u,maxDepth:c,token:l,generateTextures:h,generateBoundingVolumes:p}=e;this.options={maxDepth:c,slpk:r,sevenZipExe:u,egmFilePath:n,draco:s,token:l,inputUrl:i},this.validate=Boolean(a),this.Loader=-1!==i.indexOf("https://")?Eb:kb,this.generateTextures=Boolean(h),this.generateBoundingVolumes=Boolean(p),this.writeQueue=new Uv,this.writeQueue.startListening(),console.log("Loading egm file..."),this.geoidHeightModel=await Zo(n,Pd),console.log("Loading egm file completed!"),r&&this.nodePages.useWriteFunction($d),await this.loadWorkers();try{const e=await this._fetchPreloadOptions(),n={loadOptions:{basis:{format:"rgba32"}}};e.headers&&(n.loadOptions.fetch={headers:e.headers}),Object.assign(n,e);const a=await Zo(i,this.Loader,n.loadOptions);return this.sourceTileset=new Sd(a,n),await this._createAndSaveTileset(o,t),await this._finishConversion({slpk:Boolean(r),outputPath:o,tilesetName:t}),a}catch(e){throw e}finally{za.getWorkerFarm({}).destroy()}}async _createAndSaveTileset(e,t){const r=Object(Ci.join)(""+e,""+t);try{await Xd(r)}catch(e){}this.layers0Path=Object(Ci.join)(r,"SceneServer","layers","0"),this._formLayers0(t),this.materialDefinitions=[],this.materialMap=new Map;const n=this.sourceTileset.root,i=Gm(n,this.geoidHeightModel),a=this.nodePages.push({index:0,lodThreshold:0,obb:i.obb,children:[]}),o=this.options.slpk,s=this._formRootNodeIndexDocument(i);await this._convertNodesTree(s,n,a,i),this.layers0.materialDefinitions=this.materialDefinitions,!1===this.layersHasTexture&&(this.layers0.store.defaultGeometrySchema.ordering=this.layers0.store.defaultGeometrySchema.ordering.filter(e=>"uv0"!==e)),await this._writeLayers0(),async function(e,t,r){const n={serviceItemId:Pb().replace(/-/gi,""),layerName:e,layers0:t},i=Ii()(n,{serviceItemId:{path:"serviceItemId"},serviceName:{path:"layerName"},name:{path:"layerName"},currentVersion:{path:"currentVersion",default:10.7},serviceVersion:{path:"serviceVersion",default:"1.8"},supportedBindings:{path:"supportedBindings",default:["REST"]},layers:{path:"layers0",transform:e=>[e]}}),a=Object(Ci.join)(r,"SceneServer");await Yd(a,JSON.stringify(i))}(t,this.layers0,r),await this._writeNodeIndexDocument(s,"root",Object(Ci.join)(this.layers0Path,"nodes","root")),await this.nodePages.save(this.layers0Path,this.writeQueue,o),await this.writeQueue.finalize(),await this._createSlpk(r)}_formLayers0(e){var t,r,n;const i=function(e){let t;t=e instanceof _h?e:e.getBoundingSphere();const r=t.center,n=t.radius,i=_u.WGS84.cartesianToCartographic(new Ds(r[0]+n,r[1]+n,r[2]+n),new Ds),a=_u.WGS84.cartesianToCartographic(new Ds(r[0]-n,r[1]-n,r[2]-n),new Ds);return{xmin:a[0],xmax:i[0],ymin:a[1],ymax:i[1],zmin:a[2],zmax:i[2]}}((null===(t=this.sourceTileset)||void 0===t?void 0:t.boundingVolume)||(null===(r=this.sourceTileset)||void 0===r||null===(n=r.root)||void 0===n?void 0:n.boundingVolume)),a=[i.xmin,i.ymin,i.xmax,i.ymax],o={version:`{${Pb().toUpperCase()}}`,id:0,name:e,href:"./layers/0",store:{id:`{${Pb().toUpperCase()}}`,extent:a},nodePages:{nodesPerPage:64},compressGeometry:this.options.draco,fullExtent:i};this.layers0=Ii()(o,{version:{path:"version",transform:e=>e.toUpperCase()},id:{path:"id",default:0},name:{path:"name"},href:{path:"href",default:"./layers/0"},layerType:{path:"layerType",default:"IntegratedMesh"},spatialReference:{path:"spatialReference",transform:e=>Ii()(e,{wkid:{path:"wkid",default:4326},latestWkid:{path:"latestWkid",default:4326},vcsWkid:{path:"vcsWkid",default:5773},latestVcsWkid:{path:"latestVcsWkid",default:5773}})},capabilities:{path:"capabilities",default:["View","Query"]},store:{path:"store",transform:e=>Ii()(e,vv)},fullExtent:{path:"fullExtent",transform:e=>Ii()(e,{xmin:{path:"xmin"},ymin:{path:"ymin"},xmax:{path:"xmax"},ymax:{path:"ymax"},zmin:{path:"zmin"},zmax:{path:"zmax"}})},heightModelInfo:{path:"heightModelInfo",transform:e=>Ii()(e,{heightModel:{path:"heightModel",default:"gravity_related_height"},vertCRS:{path:"vertCRS",default:"EGM96_Geoid"},heightUnit:{path:"heightUnit",default:"meter"}})},nodePages:{path:"nodePages",transform:e=>Ii()(e,{nodesPerPage:{path:"nodesPerPage"},lodSelectionMetricType:{path:"lodSelectionMetricType",default:"maxScreenThresholdSQ"}})},materialDefinitions:{path:"materialDefinitions",default:[]},textureSetDefinitions:{path:"textureSetDefinitions",default:[]},geometryDefinitions:{path:"compressGeometry",transform:e=>{const t=[{geometryBuffers:[]},{geometryBuffers:[]}];return t[0].geometryBuffers.push({offset:8,position:{type:"Float32",component:3},normal:{type:"Float32",component:3},uv0:{type:"Float32",component:2},color:{type:"UInt8",component:4},featureId:{binding:"per-feature",type:"UInt64",component:1},faceRange:{binding:"per-feature",type:"UInt32",component:2}}),t[1].geometryBuffers.push({offset:8,position:{type:"Float32",component:3},normal:{type:"Float32",component:3},color:{type:"UInt8",component:4},featureId:{binding:"per-feature",type:"UInt64",component:1},faceRange:{binding:"per-feature",type:"UInt32",component:2}}),e&&(t[0].geometryBuffers.push({compressedAttributes:{encoding:"draco",attributes:["position","normal","uv0","color","feature-index"]}}),t[1].geometryBuffers.push({compressedAttributes:{encoding:"draco",attributes:["position","normal","color","feature-index"]}})),t},default:[{geometryBuffers:[{offset:8,position:{type:"Float32",component:3},normal:{type:"Float32",component:3},uv0:{type:"Float32",component:2},color:{type:"UInt8",component:4},featureId:{binding:"per-feature",type:"UInt64",component:1},faceRange:{binding:"per-feature",type:"UInt32",component:2}},{offset:8,position:{type:"Float32",component:3},normal:{type:"Float32",component:3},color:{type:"UInt8",component:4},featureId:{binding:"per-feature",type:"UInt64",component:1},faceRange:{binding:"per-feature",type:"UInt32",component:2}}]}]},attributeStorageInfo:{path:"attributeStorageInfo",default:[]},fields:{path:"fields",default:[]},popupInfo:{path:"popupInfo",default:null}})}_formRootNodeIndexDocument(e){const t={version:`{${Pb().toUpperCase()}}`,id:"root",level:0,lodSelection:[{metricType:"maxScreenThresholdSQ",maxError:0},{metricType:"maxScreenThreshold",maxError:0}],...e,children:[]};return Ii()(t,wv())}async _convertNodesTree(e,t,r,n){if(await this.sourceTileset._loadTile(t),this.isContentSupported(t)){e.children=e.children||[],e.children.push({id:"1",href:"./1",...n});const[i]=await this._createNode(e,t,r,0),a=Object(Ci.join)(this.layers0Path,"nodes",i.path);this.options.slpk?await this.writeQueue.enqueue({archiveKey:"nodes/1/3dNodeIndexDocument.json.gz",writePromise:$d(a,JSON.stringify(i),"3dNodeIndexDocument.json")}):await this.writeQueue.enqueue({writePromise:Yd(a,JSON.stringify(i))})}else await this._addChildrenWithNeighborsAndWriteFile({parentNode:e,sourceTiles:t.children,parentId:r,level:1});await t.unloadContent()}async _writeLayers0(){this.options.slpk?await this.writeQueue.enqueue({archiveKey:"3dSceneLayer.json.gz",writePromise:$d(this.layers0Path,JSON.stringify(this.layers0),"3dSceneLayer.json")}):await this.writeQueue.enqueue({writePromise:Yd(this.layers0Path,JSON.stringify(this.layers0))})}async _writeNodeIndexDocument(e,t,r){this.options.slpk?await this.writeQueue.enqueue({archiveKey:`nodes/${t}/3dNodeIndexDocument.json.gz`,writePromise:$d(r,JSON.stringify(e),"3dNodeIndexDocument.json")}):await this.writeQueue.enqueue({writePromise:Yd(r,JSON.stringify(e))})}async _createSlpk(e){if(this.options.slpk){const t=Object(Ci.join)(e,"SceneServer","layers","0"),r=e+".slpk";await Qd(t,r,0,".",this.options.sevenZipExe);try{await Xd(e)}catch(e){}}}async _addChildrenWithNeighborsAndWriteFile(e){const t=[];await this._addChildren({...e,childNodes:t}),await this._addNeighborsAndWriteFile(e.parentNode,t)}async _addChildren(e){const{childNodes:t,sourceTiles:r,parentNode:n,parentId:i,level:a}=e;if(!(this.options.maxDepth&&a>this.options.maxDepth))for(const e of r){if("json"===e.type)await this.sourceTileset._loadTile(e),await this._addChildren({parentNode:n,sourceTiles:e.children,childNodes:t,parentId:i,level:a+1}),await e.unloadContent();else{const r=await this._createNode(n,e,i,a);n.children=n.children||[];for(const e of r)n.children.push({id:e.id,href:"../"+e.path,obb:e.obb,mbs:e.mbs}),t.push(e)}e.id&&console.log(e.id)}}async _addNeighborsAndWriteFile(e,t){for(const n of t){var r;const t=Object(Ci.join)(this.layers0Path,"nodes",n.path),i=n.path;if(delete n.path,Number(null==e||null===(r=e.children)||void 0===r?void 0:r.length)<1e3)for(const t of e.children||[])n.id!==t.id&&n.neighbors&&n.neighbors.push({...t});else console.warn(`Node ${n.id}: neighbors attribute is omited because of large number of neigbors`),delete n.neighbors;await this._writeNodeIndexDocument(n,i,t),n.neighbors=[]}}async _createNode(e,t,r,n){var i,a;this.validate&&this._checkAddRefinementTypeForTile(t),await this._updateTilesetOptions(),await this.sourceTileset._loadTile(t);let o=Gm(t,this.geoidHeightModel);const s=bv(t);!s||null!==(i=this.layers0)&&void 0!==i&&null!==(a=i.attributeStorageInfo)&&void 0!==a&&a.length||this._convertPropertyTableToNodeAttributes(s);const u=await this._convertResources(t,s),c=[],l=[],h={geometry:null,compressedGeometry:null,texture:null,sharedResources:null,meshMaterial:null,vertexCount:null,attributes:null,featureCount:null,boundingVolumes:null};for(const n of u||[h]){this.layersHasTexture=this.layersHasTexture||Boolean(n.texture),this.generateBoundingVolumes&&n.boundingVolumes&&(o=n.boundingVolumes);const i=Md(t,o),a=i.find(e=>"maxScreenThresholdSQ"===e.metricType)||{maxError:0},s=this._createNodeInNodePages(a,o,t,r,n),u=this._createNodeIndexDocument(e,o,i,s,n);s.mesh&&await this._writeResources(n,u.path),this.validate&&(this.boundingVolumeWarnings=Iv(u),this.boundingVolumeWarnings&&this.boundingVolumeWarnings.length&&console.warn("Bounding Volume Warnings: ",...this.boundingVolumeWarnings)),c.push(u),l.push(s)}return t.unloadContent(),await this._addChildrenWithNeighborsAndWriteFile({parentNode:c[0],sourceTiles:t.children,parentId:l[0].index,level:n+1}),c}async _convertResources(e,t){var r;if(!this.isContentSupported(e))return null;return await Yb(e.content,Number(this.nodePages.nodesCounter),t,this.featuresHashArray,null===(r=this.layers0)||void 0===r?void 0:r.attributeStorageInfo,this.options.draco,this.generateBoundingVolumes,this.geoidHeightModel,this.workerSource)}_createNodeInNodePages(e,t,r,n,i){const{meshMaterial:a,texture:o,vertexCount:s,featureCount:u,geometry:c}=i,l={index:0,lodThreshold:e.maxError,obb:t.obb,children:[]};c&&this.isContentSupported(r)&&(l.mesh={geometry:{definition:o?0:1,resource:0},attribute:{resource:0},material:{definition:0}});const h=this.nodePages.push(l,n);if(a&&this.nodePages.updateMaterialByNodeId(h,this._findOrCreateMaterial(a)),o){const e=o.image.height*o.image.width;this.nodePages.updateTexelCountHintByNodeId(h,e)}return s&&(this.vertexCounter+=s,this.nodePages.updateVertexCountByNodeId(h,s)),this.nodePages.updateNodeAttributeByNodeId(h),u&&this.nodePages.updateFeatureCountByNodeId(h,u),l}_createNodeIndexDocument(e,t,r,n,i){const{texture:a,attributes:o}=i,s=n.index,u={version:e.version,id:s.toString(),path:s.toString(),level:e.level+1,...t,lodSelection:r,parentNode:{id:e.id,href:"../"+e.id,mbs:e.mbs,obb:e.obb},children:[],neighbors:[]},c=Ii()(u,wv());var l,h;if(n.mesh&&(c.geometryData=[{href:"./geometries/0"}],c.sharedResource={href:"./shared"},a&&(c.textureData=[{href:"./textures/0"},{href:"./textures/1"}]),o&&o.length&&null!==(l=this.layers0)&&void 0!==l&&null!==(h=l.attributeStorageInfo)&&void 0!==h&&h.length)){c.attributeData=[];for(let e=0;e<o.length;e++){const t=this.layers0.attributeStorageInfo[e].key;c.attributeData.push({href:`./attributes/${t}/0`})}}return c}async _writeResources(e,t){const{geometry:r,compressedGeometry:n,texture:i,sharedResources:a,attributes:o}=e,s=Object(Ci.join)(this.layers0Path,"nodes",t),u=Object(Ci.join)("nodes",t);await this._writeGeometries(r,n,s,u),await this._writeShared(a,s,u,t),await this._writeTexture(i,s,u),await this._writeAttributes(o,s,u)}async _writeGeometries(e,t,r,n){if(this.options.slpk){const t=Object(Ci.join)(r,"geometries");await this.writeQueue.enqueue({archiveKey:n+"/geometries/0.bin.gz",writePromise:$d(t,e,"0.bin")})}else{const t=Object(Ci.join)(r,"geometries/0/");await this.writeQueue.enqueue({writePromise:Yd(t,e,"index.bin")})}if(this.options.draco)if(this.options.slpk){const e=Object(Ci.join)(r,"geometries");await this.writeQueue.enqueue({archiveKey:n+"/geometries/1.bin.gz",writePromise:$d(e,t,"1.bin")})}else{const e=Object(Ci.join)(r,"geometries/1/");await this.writeQueue.enqueue({writePromise:Yd(e,t,"index.bin")})}}async _writeShared(e,t,r,n){if(!e)return;e.nodePath=n;const i=Ii()(e,{materialDefinitions:{path:"materialDefinitionInfos",transform:_v},textureDefinitions:{path:"textureDefinitionInfos",transform:kv}}),a=JSON.stringify(i);if(this.options.slpk){const e=Object(Ci.join)(t,"shared");await this.writeQueue.enqueue({archiveKey:r+"/shared/sharedResource.json.gz",writePromise:$d(e,a,"sharedResource.json")})}else{const e=Object(Ci.join)(t,"shared/");await this.writeQueue.enqueue({writePromise:Yd(e,a)})}}async _writeTexture(e,t,r){if(e){const n=this._getFormatByMimeType(null==e?void 0:e.mimeType),i=[],a=e.bufferView.data;switch(n){case"jpg":case"png":if(i.push({name:"0",format:n}),await this.writeTextureFile(a,"0",n,t,r),this.generateTextures){i.push({name:"1",format:"ktx2"});const n=e.image.data.subarray(),a=new Uint8Array(n),o=om({...e.image,data:a},Dv,{...Dv.options,source:this.workerSource.ktx2,reuseWorkers:!0,_nodeWorkers:!0});await this.writeTextureFile(o,"1","ktx2",t,r)}break;case"ktx2":if(i.push({name:"1",format:n}),await this.writeTextureFile(a,"1",n,t,r),this.generateTextures){i.push({name:"0",format:"jpg"});const n=om(e.image.data[0],Lv);await this.writeTextureFile(n,"0","jpg",t,r)}}this.layers0.textureSetDefinitions.length||this.layers0.textureSetDefinitions.push({formats:i})}}async writeTextureFile(e,t,r,n,i){if(this.options.slpk){const a=Object(Ci.join)(n,"textures"),o=!1;await this.writeQueue.enqueue({archiveKey:`${i}/textures/${t}.${r}`,writePromise:$d(a,e,`${t}.${r}`,o)})}else{const i=Object(Ci.join)(n,`textures/${t}/`);await this.writeQueue.enqueue({writePromise:Yd(i,e,"index."+r)})}}async _writeAttributes(e=[],t,r){var n,i;if(null!=e&&e.length&&null!==(n=this.layers0)&&void 0!==n&&null!==(i=n.attributeStorageInfo)&&void 0!==i&&i.length)for(let n=0;n<e.length;n++){const i=this.layers0.attributeStorageInfo[n].key,a=new Uint8Array(e[n]);if(this.options.slpk){const e=Object(Ci.join)(t,"attributes",i);await this.writeQueue.enqueue({archiveKey:`${r}/attributes/${i}.bin.gz`,writePromise:$d(e,a,"0.bin")})}else{const e=Object(Ci.join)(t,`attributes/${i}/0`);await this.writeQueue.enqueue({writePromise:Yd(e,a,"index.bin")})}}}_getFormatByMimeType(e){switch(e){case"image/jpeg":return"jpg";case"image/png":return"png";case"image/ktx2":return"ktx2";default:return"jpg"}}_findOrCreateMaterial(e){const t=Mb()(JSON.stringify(e));if(this.materialMap.has(t))return this.materialMap.get(t);const r=this.materialDefinitions.push(e)-1;return this.materialMap.set(t,r),r}_createdStorageAttribute(e,t,r){const n={key:"f_"+e,name:t,ordering:["attributeValues"],header:[{property:"count",valueType:"UInt32"}],attributeValues:{valueType:"Int32",valuesPerElement:1}};switch(r){case"OBJECTID":this._setupIdAttribute(n);break;case"string":this._setupStringAttribute(n);break;case"double":this._setupDoubleAttribute(n);break;case"Int32":break;default:this._setupStringAttribute(n)}return n}getAttributeType(e,t){return"OBJECTID"===e?"OBJECTID":"string"==typeof t?"string":"number"==typeof t?Number.isInteger(t)?"Int32":"double":"string"}_setupStringAttribute(e){e.ordering.unshift("attributeByteCounts"),e.header.push({property:"attributeValuesByteCount",valueType:"UInt32"}),e.attributeValues={valueType:"String",encoding:"UTF-8",valuesPerElement:1},e.attributeByteCounts={valueType:"UInt32",valuesPerElement:1}}_setupIdAttribute(e){e.attributeValues={valueType:"Oid32",valuesPerElement:1}}_setupDoubleAttribute(e){e.attributeValues={valueType:"Float64",valuesPerElement:1}}_createFieldAttribute(e,t){return{name:e,type:t,alias:e}}_convertPropertyTableToNodeAttributes(e){let t=0;const r={OBJECTID:[0],...e};for(const e in r){const n=r[e][0],i=this.getAttributeType(e,n),a=this._createdStorageAttribute(t,e,i),o=this._getFieldAttributeType(i),s=this._createFieldAttribute(e,o),u=this._createPopupInfo(r);this.layers0.attributeStorageInfo.push(a),this.layers0.fields.push(s),this.layers0.popupInfo=u,this.layers0.layerType="3DObject",t+=1}}_getFieldAttributeType(e){switch(e){case"OBJECTID":return"esriFieldTypeOID";case"string":return"esriFieldTypeString";case"Int32":return"esriFieldTypeInteger";case"double":return"esriFieldTypeDouble";default:return"esriFieldTypeString"}}_createPopupInfo(e){const t=[],r=[];for(const r in e)t.push({fieldName:r,visible:!0,isEditable:!1,label:r});return r.push({fieldInfos:t,type:"fields"}),{title:"{OBJECTID}",mediaInfos:[],popupElements:r,fieldInfos:t,expressionInfos:[]}}async _finishConversion(e){const{tilesCount:t,tilesWithAddRefineCount:r}=this.refinementCounter,n=r?r/t*100:0,i=await rm(e),a=tm(Ri.a.hrtime(this.conversionStartTime));console.log("------------------------------------------------"),console.log("Finishing conversion of 3DTILES"),console.log("Total conversion time: "+a),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",i," bytes"),console.log('Percentage of tiles with "ADD" refinement type:',n,"%"),console.log("------------------------------------------------")}async _fetchPreloadOptions(){if(!this.Loader.preload)return{};const e={"cesium-ion":{accessToken:this.options.token||Vv}},t=await this.Loader.preload(this.options.inputUrl,e);return this.refreshTokenTime=Ri.a.hrtime(),{...e,...t}}async _updateTilesetOptions(){if(Ri.a.hrtime(this.refreshTokenTime)[0]<1800)return;this.refreshTokenTime=Ri.a.hrtime();const e=await this._fetchPreloadOptions();this.sourceTileset.options={...this.sourceTileset.options,...e},e.headers&&(this.sourceTileset.loadOptions.fetch={...this.sourceTileset.loadOptions.fetch,headers:e.headers},console.log("Authorization Bearer token has been updated"))}_checkAddRefinementTypeForTile(e){1===e.refine&&(this.refinementCounter.tilesWithAddRefineCount+=1,console.warn('This tile uses "ADD" type of refinement')),this.refinementCounter.tilesCount+=1}isContentSupported(e){var t;return["b3dm","glTF"].includes(null==e||null===(t=e.content)||void 0===t?void 0:t.type)}async loadWorkers(){if(console.log("Loading workers source..."),this.options.draco){const e=Ua(Bc,{...pa()}),t=await oa(e),r=await t.text();this.workerSource.draco=r}if(this.generateTextures){const e=Ua(Dv,{...pa()}),t=await oa(e),r=await t.text();this.workerSource.ktx2=r}const e=Ua(qv,{...pa()}),t=await oa(e),r=await t.text();this.workerSource.I3SAttributes=r,console.log("Loading workers source completed!")}}const Kv={id:"zip",module:"zip",name:"Zip Archive",version:"3.3.0-alpha.3",extensions:["zip"],mimeTypes:["application/zip"],category:"archive",tests:["PK"],options:{},parse:async function(e,t={}){const r=[],n={};try{const i=new Gd.a;return(await i.loadAsync(e,t)).forEach((e,a)=>{const o=a.name,s=async function(e,t,r={}){try{return await e.file(t).async(r.dataType||"arraybuffer")}catch(e){return r.log.error(`Unable to read ${t} from zip archive: ${e}`),e}}(i,o,t).then(t=>{n[e]=t});r.push(s)}),await Promise.all(r),n}catch(e){throw t.log.error("Unable to read zip archive: "+e),e}}};class Jv{async install(e=""){console.log('Installing "EGM2008-5" model...');const t=await Zo("https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip",Kv,{});let r=process.cwd();e&&(r=Object(Ci.join)(r,e)),await Yd(r,new Uint8Array(t["geoids/egm2008-5.pgm"]),"egm2008-5.pgm"),console.log("All dependencies were installed succesfully.")}}const Qv={I3S:"I3S",_3DTILES:"3DTILES"};function Yv(){console.log("cli: converter 3dTiles to I3S or I3S to 3dTiles..."),console.log('--install-dependencies [Run the script for installing dependencies. Run this options separate from others. Now "*.pgm" file installation is implemented]'),console.log("--max-depth [Maximal depth of hierarchical tiles tree traversal, default: infinite]"),console.log("--name [Tileset name]"),console.log('--output [Output folder, default: "data" folder]'),console.log("--slpk [Generate slpk (Scene Layer Packages) I3S output file]"),console.log("--tileset [tileset.json file (3DTiles) / http://..../SceneServer/layers/0 resource (I3S)]"),console.log("--input-type [tileset input type: I3S or 3DTILES]"),console.log('--7zExe [location of 7z.exe archiver to create slpk on Windows, default: "C:\\Program Files\\7-Zip\\7z.exe"]'),console.log('--egm [location of Earth Gravity Model *.pgm file to convert heights from ellipsoidal to gravity-related format. A model file can be loaded from GeographicLib https://geographiclib.sourceforge.io/html/geoid.html], default: "./deps/egm2008-5.zip"'),console.log("--token [Token for Cesium ION tilesets authentication]"),console.log("--no-draco [Disable draco compression for geometry]"),console.log("--generate-textures [Enable KTX2 textures generation if only one of (JPG, PNG) texture is provided or generate JPG texture if only KTX2 is provided]"),console.log("--generate-bounding-volumes [Will generate obb and mbs bounding volumes from geometry]"),console.log("--validate [Enable validation]"),process.exit(0)}function $v(e,t){if(e+1>=t.length)return"";const r=t[e+1];return 0===r.indexOf("--")?"":r}function Xv(e,t){const r=$v(e,t).toLowerCase().trim();return!("--no-draco"===t[e]&&!r)&&(!r||"true"===r)}(async function(){const[,,...e]=process.argv;0===e.length&&Yv();const t=function(e){const t={output:"data",sevenZipExe:"C:\\Program Files\\7-Zip\\7z.exe",egm:Object(Ci.join)(process.cwd(),"deps","egm2008-5.pgm"),draco:!0,installDependencies:!1,generateTextures:!1,generateBoundingVolumes:!1,validate:!1,slpk:!1};return e.forEach((r,n)=>{if(0===r.indexOf("--"))switch(r){case"--input-type":t.inputType=$v(n,e);break;case"--tileset":t.tileset=$v(n,e);break;case"--name":t.name=$v(n,e);break;case"--output":t.output=$v(n,e);break;case"--max-depth":t.maxDepth=function(e,t){const r=$v(e,t),n=Number.parseInt(r);if(isFinite(n))return n;return NaN}(n,e);break;case"--slpk":t.slpk=Xv(n,e);break;case"--7zExe":t.sevenZipExe=$v(n,e);break;case"--egm":t.egm=$v(n,e);break;case"--token":t.token=$v(n,e);break;case"--no-draco":t.draco=Xv(n,e);break;case"--validate":t.validate=Xv(n,e);break;case"--install-dependencies":t.installDependencies=Xv(n,e);break;case"--generate-textures":t.generateTextures=Xv(n,e);break;case"--generate-bounding-volumes":t.generateBoundingVolumes=Xv(n,e);break;case"--help":Yv();break;default:console.warn("Unknown option "+r),process.exit(0)}}),t}(function(e){return e.reduce((e,t)=>{const r=t.indexOf("="),n=t.slice(0,r),i=t.slice(r+1,t.length);return t.includes("=")&&t.startsWith("--")&&i?e.concat(n,i):e.concat(t)},[])}(e));if(t.installDependencies){return void(new Jv).install("deps")}const r=function(e){const t={name:()=>console.log("Missed: --name [Tileset name]"),output:()=>console.log("Missed: --output [Output path name]"),sevenZipExe:()=>console.log("Missed: --7zExe [7z archiver executable path]"),egm:()=>console.log("Missed: --egm [*.pgm earth gravity model file path]"),tileset:()=>console.log("Missed: --tileset [tileset.json file]"),inputType:()=>console.log("Missed/Incorrect: --input-type [tileset input type: I3S or 3DTILES]")},r=[];for(const n in t){const i=e[n],a=Boolean(i)&&"inputType"===n&&!Object.values(Qv).includes(i.toUpperCase());i&&!a||r.push(t[n])}r.length&&(r.forEach(e=>e()),process.exit(0));return e}(t);await async function(e){console.log("------------------------------------------------"),console.log("Starting conversion of "+e.inputType),console.log("------------------------------------------------");switch(e.inputType.toUpperCase()){case Qv.I3S:(new Ym).convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,egmFilePath:e.egm});break;case Qv._3DTILES:const t=new Wv;await t.convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,slpk:e.slpk,sevenZipExe:e.sevenZipExe,egmFilePath:e.egm,token:e.token,draco:e.draco,generateTextures:e.generateTextures,generateBoundingVolumes:e.generateBoundingVolumes,validate:e.validate});break;default:Yv()}}(r)})().catch(e=>{console.log(e),process.exit(1)})},,,,,,,,,,function(e,t){e.exports=require("worker_threads")},function(e,t,r){"use strict";function n(){return!("object"==typeof process&&"[object process]"===String(process)&&!process.browser)||function(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof process&&"object"==typeof process.versions&&Boolean(process.versions.electron))return!0;const t="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}()}r.d(t,"a",(function(){return _}));const i="undefined"!=typeof __VERSION__?__VERSION__:"untranspiled source",a=n();class o{constructor(e,t,r="sessionStorage"){this.storage=function(e){try{const t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch(e){return null}}(r),this.id=e,this.config={},Object.assign(this.config,t),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){return this.config={},this.updateConfiguration(e)}updateConfiguration(e){if(Object.assign(this.config,e),this.storage){const e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}return this}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function s(e,t,r,n=600){const i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));const a=e.width*r,o=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}const u={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function c(e){return"string"==typeof e?u[e.toUpperCase()]||u.WHITE:e}function l(e,t){if(!e)throw new Error(t||"Assertion failed")}const h={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document,process:"object"==typeof process&&process},p=h.window||h.self||h.global,f=h.process||{};console;function d(){let e;if(a&&p.performance)e=p.performance.now();else if(f.hrtime){const t=f.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}const m={debug:a&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},g={enabled:!0,level:0};function y(){}const b={},v={once:!0};function w(e){for(const t in e)for(const r in e[t])return r||"untitled";return"empty"}class _{constructor({id:e}={id:""}){this.id=e,this.VERSION=i,this._startTs=d(),this._deltaTs=d(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new o("__probe-".concat(this.id,"__"),g),this.userData={},this.timeStamp("".concat(this.id," started")),function(e,t=["constructor"]){const r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r);for(const r of n)"function"==typeof e[r]&&(t.find(e=>r===e)||(e[r]=e[r].bind(e)))}(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((d()-this._startTs).toPrecision(10))}getDelta(){return Number((d()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.updateConfiguration({enabled:e}),this}setLevel(e){return this._storage.updateConfiguration({level:e}),this}assert(e,t){l(e,t)}warn(e){return this._getLogFunction(0,e,m.warn,arguments,v)}error(e){return this._getLogFunction(0,e,m.error,arguments)}deprecated(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}probe(e,t){return this._getLogFunction(e,t,m.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,m.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,m.debug||m.info,arguments,v)}table(e,t,r){return t?this._getLogFunction(e,t,console.table||y,r&&[r],{tag:w(t)}):y}image({logLevel:e,priority:t,image:n,message:i="",scale:o=1}){return this._shouldLog(e||t)?a?function({image:e,message:t="",scale:r=1}){if("string"==typeof e){const n=new Image;return n.onload=()=>{const e=s(n,t,r);console.log(...e)},n.src=e,y}const n=e.nodeName||"";if("img"===n.toLowerCase())return console.log(...s(e,t,r)),y;if("canvas"===n.toLowerCase()){const n=new Image;return n.onload=()=>console.log(...s(n,t,r)),n.src=e.toDataURL(),y}return y}({image:n,message:i,scale:o}):function({image:e,message:t="",scale:n=1}){let i=null;try{i=r(!function(){var e=new Error("Cannot find module 'asciify-image'");throw e.code="MODULE_NOT_FOUND",e}())}catch(e){}if(i)return()=>i(e,{fit:"box",width:"".concat(Math.round(80*n),"%")}).then(e=>console.log(e));return y}({image:n,message:i,scale:o}):y}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}get(e){return this._storage.config[e]}set(e,t){this._storage.updateConfiguration({[e]:t})}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||y)}group(e,t,r={collapsed:!1}){r=x({logLevel:e,message:t,opts:r});const{collapsed:n}=r;return r.method=(n?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}groupCollapsed(e,t,r={}){return this.group(e,t,Object.assign({},r,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||y)}withGroup(e,t,r){this.group(e,t)();try{r()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=k(e)}_getLogFunction(e,t,r,n=[],i){if(this._shouldLog(e)){i=x({logLevel:e,message:t,args:n,opts:i}),l(r=r||i.method),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=d();const o=i.tag||i.message;if(i.once){if(b[o])return y;b[o]=d()}return t=function(e,t,r){if("string"==typeof t){const s=r.time?function(e,t=8){const r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}(function(e){let t;return t=e<10?"".concat(e.toFixed(2),"ms"):e<100?"".concat(e.toFixed(1),"ms"):e<1e3?"".concat(e.toFixed(0),"ms"):"".concat((e/1e3).toFixed(2),"s"),t}(r.total)):"";t=r.time?"".concat(e,": ").concat(s," ").concat(t):"".concat(e,": ").concat(t),n=t,i=r.color,o=r.background,a||"string"!=typeof n||(i&&(i=c(i),n="[".concat(i,"m").concat(n,"[39m")),o&&(i=c(o),n="[".concat(o+10,"m").concat(n,"[49m"))),t=n}var n,i,o;return t}(this.id,i.message,i),r.bind(console,t,...i.args)}return y}}function k(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return l(Number.isFinite(t)&&t>=0),t}function x(e){const{logLevel:t,message:r}=e;e.logLevel=k(t);const n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(e.args=n,typeof t){case"string":case"function":void 0!==r&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());const i=typeof e.message;return l("string"===i||"object"===i),Object.assign(e,e.opts)}_.VERSION=i}]);
|