@loaders.gl/tile-converter 3.2.3 → 3.2.4
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 +1 -1
- package/dist/converter.min.js +1 -1
- package/dist/dist.min.js +1 -1
- package/dist/es5/3d-tiles-attributes-worker.js +1 -1
- package/dist/es5/i3s-attributes-worker.js +1 -1
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/esm/3d-tiles-attributes-worker.js +1 -1
- package/dist/esm/i3s-attributes-worker.js +1 -1
- package/dist/esm/pgm-loader.js +1 -1
- package/package.json +16 -16
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 Lg})),r.d(a,"decode",(function(){return Ng}));var o={};r.r(o),r.d(o,"name",(function(){return Gg})),r.d(o,"preprocess",(function(){return Vg}));var s={};r.r(s),r.d(s,"name",(function(){return Wg})),r.d(s,"preprocess",(function(){return Kg}));var u={};r.r(u),r.d(u,"name",(function(){return Qg})),r.d(u,"preprocess",(function(){return Yg})),r.d(u,"decode",(function(){return $g})),r.d(u,"encode",(function(){return Xg}));var c={};r.r(c),r.d(c,"name",(function(){return ry})),r.d(c,"decode",(function(){return ny})),r.d(c,"encode",(function(){return iy}));var l={};r.r(l),r.d(l,"name",(function(){return ay})),r.d(l,"decode",(function(){return oy})),r.d(l,"encode",(function(){return sy}));var h={};r.r(h),r.d(h,"name",(function(){return uy})),r.d(h,"decode",(function(){return cy})),r.d(h,"encode",(function(){return ly}));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(25),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.3"){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.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(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.3",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.3/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.3",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.3/dist/libs/basis_encoder.js","textures",e),await Ec("https://unpkg.com/@loaders.gl/textures@3.2.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 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.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}}},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.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"}}},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),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.3",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.3",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.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?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.3",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=e.unprojectPosition(e.center),s=vu.WGS84.cartographicToCartesian(o,new Is),u=vu.WGS84.eastNorthUpToFixedFrame(s),c=e.unprojectPosition(e.cameraPosition),l=vu.WGS84.cartographicToCartesian(c,new Is),h=new Is(u.transformAsVector(new Is(r).scale(a))).normalize(),p=new Is(u.transformAsVector(new Is(n).scale(a))).normalize();!function(e,t){const r=e.getFrustumPlanes();let n=0;for(const i in r){const a=r[i],o=a.normal.dot(e.center);Df.copy(a.normal).scale(a.distance-o).add(e.center);const s=e.unprojectPosition(Df),u=vu.WGS84.cartographicToCartesian(s,new Is);Mf.planes[n++].fromPointNormal(u,Pf.copy(t).subtract(u))}}(e,s);const f=e.constructor,{longitude:d,latitude:m,width:g,bearing:y,zoom:b}=e;return{camera:{position:l,direction:h,up:p},viewport:e,topDownViewport:new f({longitude:d,latitude:m,height:i,width:g,bearing:y,zoom:b,pitch:0}),height:i,cullingVolume:Mf,frameNumber:t,sseDenominator:1.15}}const Lf=new Is;function Nf(e,t){if(e instanceof lp){const{halfAxes:r}=e,n=function(e){e.getColumn(0,Lf);const t=e.getColumn(1),r=e.getColumn(2),n=Lf.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 zf(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 Uf(e){return null!=e}const qf=new Is,Hf=new Is,Gf=new Is;function Vf(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(Uf(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],Hf),u=vu.WGS84.cartographicToCartesian([ss(n),ss(r),o],Gf),c=(new Is).addVectors(s,u).multiplyScalar(.5),l=(new Is).subVectors(s,u).len()/2;return Wf([c[0],c[1],c[2],l],new Ws)}if(e.sphere)return Wf(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function Wf(e,t,r){const n=new Is(e[0],e[1],e[2]);t.transform(n,n);const i=t.getScale(qf),a=Math.max(Math.max(i[0],i[1]),i[2]),o=e[3]*a;return Uf(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 Kf(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 Jf=new Is,Qf=new Is,Yf=new Is,$f=new Is,Xf=new Is,Zf=new Ws,ed=new Ws;function td(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,Jf),Qf.copy(Jf).subtract(s).normalize(),vu.WGS84.eastNorthUpToFixedFrame(s,Zf),ed.copy(Zf).invert(),Yf.copy(Jf).transform(ed);const c=Math.sqrt(Yf[0]*Yf[0]+Yf[1]*Yf[1]),l=c*c/Yf[2];$f.copy([Yf[0],Yf[1],l]);const h=$f.transform(Zf).subtract(s).normalize(),p=Qf.cross(h).normalize().scale(o).add(s),f=vu.WGS84.cartesianToCartographic(p),d=r.project([i,n,a]),m=r.project(f);return Xf.copy(d).subtract(m).magnitude()}function rd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class nd{constructor(e=0){rd(this,"_map",new Map),rd(this,"_array",void 0),rd(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 id(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ad={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""};class od{get traversalFinished(){return!0}constructor(e){id(this,"options",void 0),id(this,"root",void 0),id(this,"requestedTiles",void 0),id(this,"selectedTiles",void 0),id(this,"emptyTiles",void 0),id(this,"lastUpdate",(new Date).getTime()),id(this,"updateDebounceTime",1e3),id(this,"_traversalStack",void 0),id(this,"_emptyTraversalStack",void 0),id(this,"_frameNumber",void 0),this.options={...ad,...e},this._traversalStack=new nd,this._emptyTraversalStack=new nd,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||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 sd(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=new Is;class cd{constructor(e,t,r,n=""){sd(this,"tileset",void 0),sd(this,"header",void 0),sd(this,"id",void 0),sd(this,"url",void 0),sd(this,"parent",void 0),sd(this,"refine",void 0),sd(this,"type",void 0),sd(this,"contentUrl",void 0),sd(this,"lodMetricType",void 0),sd(this,"lodMetricValue",void 0),sd(this,"boundingVolume",void 0),sd(this,"content",void 0),sd(this,"contentState",void 0),sd(this,"gpuMemoryUsageInBytes",void 0),sd(this,"children",void 0),sd(this,"depth",void 0),sd(this,"viewportIds",void 0),sd(this,"transform",void 0),sd(this,"extensions",void 0),sd(this,"userData",void 0),sd(this,"computedTransform",void 0),sd(this,"hasEmptyContent",void 0),sd(this,"hasTilesetContent",void 0),sd(this,"traverser",void 0),sd(this,"_cacheNode",void 0),sd(this,"_frameNumber",void 0),sd(this,"_lodJudge",void 0),sd(this,"_expireDate",void 0),sd(this,"_expiredContent",void 0),sd(this,"_shouldRefine",void 0),sd(this,"_distanceToCamera",void 0),sd(this,"_centerZDepth",void 0),sd(this,"_screenSpaceError",void 0),sd(this,"_visibilityPlaneMask",void 0),sd(this,"_visible",void 0),sd(this,"_inRequestVolume",void 0),sd(this,"_stackLength",void 0),sd(this,"_selectionDepth",void 0),sd(this,"_touchedFrame",void 0),sd(this,"_visitedFrame",void 0),sd(this,"_selectedFrame",void 0),sd(this,"_requestedFrame",void 0),sd(this,"_priority",void 0),sd(this,"_contentBoundingVolume",void 0),sd(this,"_viewerRequestVolume",void 0),sd(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 od({}),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 td(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-=Kf(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 ud.subVectors(t.center,e.position),e.direction.dot(ud)}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=Vf(e.boundingVolume,this.computedTransform,this.boundingVolume);const t=e.content;t&&(t.boundingVolume&&(this._contentBoundingVolume=Vf(t.boundingVolume,this.computedTransform,this._contentBoundingVolume)),e.viewerRequestVolume&&(this._viewerRequestVolume=Vf(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 ld extends od{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 hd{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){const t=this.frameNumberMap.get(e)||0;this.frameNumberMap.set(e,t+1)}deregister(e){const t=this.frameNumberMap.get(e)||1;this.frameNumberMap.set(e,t-1)}isZero(e){return 0===(this.frameNumberMap.get(e)||0)}}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="REQUESTED",dd="COMPLETED",md="ERROR";class gd{constructor(){pd(this,"_statusMap",void 0),pd(this,"pendingTilesRegister",new hd),this._statusMap={}}add(e,t,r,n){if(!this._statusMap[t]){const{frameNumber:i}=n;this._statusMap[t]={request:e,callback:r,key:t,frameState:n,status:fd},this.pendingTilesRegister.register(i),e().then(e=>{this._statusMap[t].status=dd;const{frameNumber:r}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(r),this._statusMap[t].callback(e,n)}).catch(e=>{this._statusMap[t].status=md;const{frameNumber:n}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(n),r(e)})}}update(e,t){this._statusMap[e]&&(this.pendingTilesRegister.deregister(this._statusMap[e].frameState.frameNumber),this.pendingTilesRegister.register(t.frameNumber),this._statusMap[e].frameState=t)}find(e){return this._statusMap[e]}hasPendingTiles(e){return!this.pendingTilesRegister.isZero(e)}}class yd extends od{get traversalFinished(){return!this._tileManager.hasPendingTiles(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 gd}shouldRefine(e,t){return e._lodJudge=function(e,t){if(0===e.lodMetricValue||isNaN(e.lodMetricValue))return"DIG";const r=2*td(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 cd(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||(new Date).getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(n,i)}}function bd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const vd={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:{}},wd="Tiles In Tileset(s)";class _d{constructor(e,t){bd(this,"options",void 0),bd(this,"loadOptions",void 0),bd(this,"type",void 0),bd(this,"tileset",void 0),bd(this,"loader",void 0),bd(this,"url",void 0),bd(this,"basePath",void 0),bd(this,"modelMatrix",void 0),bd(this,"ellipsoid",void 0),bd(this,"lodMetricType",void 0),bd(this,"lodMetricValue",void 0),bd(this,"refine",void 0),bd(this,"root",void 0),bd(this,"roots",void 0),bd(this,"asset",void 0),bd(this,"description",void 0),bd(this,"properties",void 0),bd(this,"extras",void 0),bd(this,"attributions",void 0),bd(this,"credits",void 0),bd(this,"stats",void 0),bd(this,"traverseCounter",void 0),bd(this,"geometricError",void 0),bd(this,"selectedTiles",void 0),bd(this,"updatePromise",null),bd(this,"tilesetInitializationPromise",void 0),bd(this,"cartographicCenter",void 0),bd(this,"cartesianCenter",void 0),bd(this,"zoom",void 0),bd(this,"boundingVolume",void 0),bd(this,"gpuMemoryUsageInBytes",void 0),bd(this,"dynamicScreenSpaceErrorComputedDensity",void 0),bd(this,"_traverser",void 0),bd(this,"_cache",void 0),bd(this,"_requestScheduler",void 0),bd(this,"_frameNumber",void 0),bd(this,"_queryParamsString",void 0),bd(this,"_queryParams",void 0),bd(this,"_extensionsUsed",void 0),bd(this,"_tiles",void 0),bd(this,"_pendingCount",void 0),bd(this,"lastUpdatedVieports",void 0),bd(this,"_requestedTiles",void 0),bd(this,"_emptyTiles",void 0),bd(this,"frameStateData",void 0),bd(this,"maximumMemoryUsage",void 0),Hi(e),this.options={...vd,...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,this.doUpdate(e)})}async selectTiles(e=null){return await this.tilesetInitializationPromise,e&&(this.lastUpdatedVieports=e),this.updatePromise||(this.updatePromise=new Promise(e=>{setTimeout(()=>{this.doUpdate(this.lastUpdatedVieports),e(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}doUpdate(e=null){if("loadTiles"in this.options&&!this.options.loadTiles)return;if(this.traverseCounter>0)return;e instanceof Array||(e=[e]),this._cache.reset(),this._frameNumber++,this.traverseCounter=e.length;const t=[];for(const r of e){const e=r.id;this._needTraverse(e)?t.push(e):this.traverseCounter--}for(const r of e){const e=r.id;if(this.roots[e]||(this.roots[e]=this._initializeTileHeaders(this.tileset,null)),!t.includes(e))continue;const n=Ff(r,this._frameNumber);this._traverser.traverse(this.roots[e],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=zf(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 zf({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);this.cartographicCenter=vu.WGS84.cartesianToCartographic(t,new Is),this.cartesianCenter=t,this.zoom=Nf(e.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(wd),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 cd(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(wd).incrementCount();const r=t.header.children||[];for(const n of r){const r=new cd(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=ld;break;case af:e=yd;break;default:e=od}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(wd).reset(),this.stats.get(wd).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 kd=[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],xd=[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],Ed=[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 Ad{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=Sd(e,t);2*Math.abs(r)===t?r-=Sd(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=xd;0!==o&&(t=o===this.options._height-2?Ed:kd);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 Sd(e,t){return e-Math.floor(e/t)*t}function jd(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:Td(n)}}else{const r=e.subarray(t,e.length);t=e.length,yield{offset:t,line:Td(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 Ad({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 Td(e){let t="";for(const r of e)t+=String.fromCharCode(r);return t}const Cd={name:"PGM - Netpbm grayscale image format",id:"pgm",module:"tile-converter",version:"3.2.3",mimeTypes:["image/x-portable-graymap"],parse:async(e,t)=>jd(new Uint8Array(e),t),extensions:["pgm"],options:{cubic:!1}};function Bd(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 Rd(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 Od(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 Id=r(80),Pd=r.n(Id);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={command:"",arguments:[],port:5e3,autoPort:!0,wait:2e3,onSuccess:e=>{console.log("Started "+e.props.command)}};class Fd{constructor({id:e="browser-driver"}={}){Dd(this,"id",void 0),Dd(this,"props",{...Md}),Dd(this,"childProcess",null),Dd(this,"port",0),Dd(this,"successTimer",void 0),this.id=e}async start(e){e={...Md,...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=>{Pd.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=Id.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 Ld=r(79),Nd=r.n(Ld);const zd="function"==typeof atob?atob:"function"==typeof Buffer?function(e){return Buffer.from(e,"base64").toString("binary")}:Hd,Ud=zd("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"),qd=!(!WebAssembly||zd===Hd)&&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}(Ud).buffer;Math.floor(1048576.00032768);function Hd(e){return e}qd||console.log("WebAssembly not available or WASM module could not be decoded; md5WASM will fall back to JavaScript");r(112);async function Gd(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=Qd(t),o=["a","-tzip","-mx="+r,a,n],s=new Fd;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=Qd(t),a=["-"+r,"-r",i,n],o=new Fd;await o.start({command:"zip",arguments:a,spawn:{cwd:e},wait:0})}(e,t,r,n)}async function Vd(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 Wd(e,t,r="index.json",n=!0){const i=await Vd(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 Jd(i),e}return i}function Kd(e){return he.promises.rmdir(e,{recursive:!0})}function Jd(e){return he.promises.unlink(e)}function Qd(e){return Object(ji.isAbsolute)(e)?e:Object(ji.join)(process.cwd(),e)}function Yd(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 $d(e){const{slpk:t,outputPath:r,tilesetName:n}=e,i=Qd(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 Xd=()=>({boundingVolume:{path:"boundingVolume"},geometricError:{path:"geometricError"},content:{path:"content"},children:{path:"children",transform:e=>e.map(e=>Ri()(e,Xd()))}});function Zd(e){return JSON.parse(function(e){const t=new Set;return JSON.stringify(e,(e,r)=>{if("object"==typeof r&&null!==r){if(t.has(r))try{return JSON.parse(JSON.stringify(r))}catch(e){return}t.add(r)}return r})}(e))}async function em(e,t,r={},n={}){const i=function(e){const t="3.2.3"!==e.version?" (worker-utils@3.2.3)":"";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,tm.bind(null,n)),h=Zd(r);l.postMessage("process",{input:t,options:h});return(await l.result).result}async function tm(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 rm(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 em(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=im("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=im("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 nm(e,t,r){if(t.encodeSync)return t.encodeSync(e,r);throw new Error("Writer could not synchronously encode data")}function im(e){return"/tmp/"+e}function am(e,t){return Hi(e>=0),Hi(t>0),e+(t-1)&~(t-1)}function om(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+am(n.byteLength,4)}function sm(e,t){if(!e)throw new Error(t||"assert failed: gltf")}const um=["SCALAR","VEC2","VEC3","VEC4"],cm=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],lm=new Map(cm),hm={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},pm={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},fm={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function dm(e){return um[e-1]||um[0]}function mm(e){const t=lm.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function gm(e,t){const r=fm[e.componentType],n=hm[e.type],i=pm[e.componentType],a=e.count*n,o=e.count*n*i;return sm(o>=0&&o<=t.byteLength),{ArrayType:r,length:a,byteLength:o}}function ym(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const bm={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]};class vm{constructor(e){ym(this,"gltf",void 0),ym(this,"sourceBuffers",void 0),ym(this,"byteLength",void 0),this.gltf=e||{json:{...bm},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];sm(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}=gm(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 sm(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return sm(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;sm(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const r={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=am(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:dm(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:mm(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=om(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 wm(e,t,r,n){const i=am(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 _m(e,t,r,n){return t=wm(e,t,(new TextEncoder).encode(r),n)}const km=1179937895;function xm(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=km,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=_m(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=wm(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 Em={name:"glTF",id:"gltf",module:"gltf",version:"3.2.3",extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,encodeSync:function(e,t={}){const{byteOffset:r=0}=t,n=xm(e,null,r,t),i=new ArrayBuffer(n),a=new DataView(i);return xm(e,a,r,t),i},options:{gltf:{}}};const Am={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},Sm=(Object.keys(Am),{BATCHED_MODEL:[98,51,100,109],INSTANCED_MODEL:[105,51,100,109],POINT_CLOUD:[112,110,116,115],COMPOSITE:[99,109,112,116]});function jm(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 Tm(e,t,r){e&&e.setUint32(t+8,r,!0)}function Cm(e,t,r,n){if(e)for(let i=0;i<n;i++)e.setUint8(t+i,r.charCodeAt(i));return t+n}function Bm(e,t,r,n){if(e)for(let i=0;i<n;i++)e.setUint8(t+i,r[i]);return t+n}const Rm={POINTS_LENGTH:1,POSITIONS:{byteOffset:0}};function Om(e,t,r,n){const{featureTableJson:i=Rm}=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+=jm(e={magic:Sm.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+=Cm(t,r,a,o),Tm(t,c,(r+=Bm(t,r,s,u))-c),r}function Im(e,t,r,n){switch(Hi("string"==typeof e.type),e.type){case Am.COMPOSITE:return function(e,t,r,n,i){const a=r;r+=jm(e={magic:Sm.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 Tm(t,a,r-a),r}(e,t,r,n,Im);case Am.POINT_CLOUD:return Om(e,t,r);case Am.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=am(s.length,8),l=u?am(u.length,8):0,h=r;r=jm(e={magic:Sm.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=_m(t,r+=16,s,8),a&&(r=_m(t,r,u,8));const p=e.gltfEncoded;return p&&(r=Bm(t,r,p,p.byteLength)),Tm(t,h,r-h),r}(e,t,r);case Am.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=jm(e={magic:Sm.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+=Cm(t,r,c,l),Tm(t,h,(r+=Cm(t,r,o,s))-h),r}(e,t,r);default:throw new Error("3D Tiles: unknown tile type")}}const Pm={name:"3D Tile",id:"3d-tiles",module:"3d-tiles",version:"3.2.3",extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],encodeSync:function(e,t){return function(e,t){const r=Im(e,null,0,t),n=new ArrayBuffer(r);return Im(e,new DataView(n),0,t),n}(e,t)},binary:!0,options:{"3d-tiles":{}}};function Dm(e){return[e[0]-Math.floor(e[0]),e[1]-Math.floor(e[1])]}function Mm(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Fm=new Ws([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),Lm=new Is;class Nm{constructor(){Mm(this,"rtcCenter",void 0),Mm(this,"i3sTile",void 0)}async convert(e,t=null){const r=await this.buildGltf(e);return nm({gltfEncoded:new Uint8Array(r),type:"b3dm",featuresLength:this._getFeaturesLength(t),batchTable:t},Pm)}async buildGltf(e){const{tileContent:t,textureFormat:r}=e,{material:n,attributes:i,indices:a,cartesianOrigin:o,cartographicOrigin:s,modelMatrix:u}=t,c=new vm,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=Dm([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 nm(c.gltf,Em)}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,Lm),u=Lm.subtract(s),i.set(u,a)}return i}_generateTransformMatrix(e){return(new Ws).translate(e).multiplyLeft(Fm)}_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 zm(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 Um(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 qm(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 Hm={id:"3d-tiles-attributes",name:"3DTiles Attributes Worker",module:"tile-converter",version:"3.2.3",options:{attributes:null}};const Gm="Tile converter does not work in browser, only in node js environment";function Vm(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Wm{constructor(){Vm(this,"options",void 0),Vm(this,"tilesetPath",void 0),Vm(this,"vertexCounter",void 0),Vm(this,"conversionStartTime",void 0),Vm(this,"geoidHeightModel",void 0),Vm(this,"sourceTileset",void 0),Vm(this,"attributeStorageInfo",void 0),Vm(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(Gm),Gm;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,Cd),console.log("Loading egm file completed!"),await this.loadWorkers();const o=await $o(t,gf,{});this.sourceTileset=new _d(o,{loadOptions:{i3s:{coordinateSystem:sh.LNGLAT_OFFSETS,decodeTextures:!1}}}),await this.sourceTileset.tilesetInitializationPromise;const s=this.sourceTileset.root;s.header.obb||(s.header.obb=qm(s.header.mbs)),this.tilesetPath=Object(ji.join)(""+r,""+n),this.attributeStorageInfo=o.attributeStorageInfo;try{await Kd(this.tilesetPath)}catch(e){}const u={boundingVolume:{box:Bd(s.header.obb,this.geoidHeightModel)},geometricError:Od(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,Xd())}});await Vd(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=qm(a.header.mbs));const i={box:Bd(a.header.obb,this.geoidHeightModel)},o={boundingVolume:i,geometricError:Od(a),children:[]},s={tileContent:a.content,textureFormat:null==a||null===(n=a.header)||void 0===n?void 0:n.textureFormat},u=await(new Nm).convert(s,e);o.content={uri:a.id+".b3dm",boundingVolume:i},await Vd(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 cd(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 $d(e),r=Yd(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(Hm,{...la()}),t=await ia(e),r=await t.text();this.workerSource.tile3dWorkerSource=r,console.log("Loading workers source completed!")}}function Km(e,t,r){Hi(e instanceof ArrayBuffer);const n=new TextDecoder("utf8"),i=new Uint8Array(e,t,r);return n.decode(i)}const Jm={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},Qm={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,...Jm},Ym={[Jm.DOUBLE]:Float64Array,[Jm.FLOAT]:Float32Array,[Jm.UNSIGNED_SHORT]:Uint16Array,[Jm.UNSIGNED_INT]:Uint32Array,[Jm.UNSIGNED_BYTE]:Uint8Array,[Jm.BYTE]:Int8Array,[Jm.SHORT]:Int16Array,[Jm.INT]:Int32Array},$m={DOUBLE:Jm.DOUBLE,FLOAT:Jm.FLOAT,UNSIGNED_SHORT:Jm.UNSIGNED_SHORT,UNSIGNED_INT:Jm.UNSIGNED_INT,UNSIGNED_BYTE:Jm.UNSIGNED_BYTE,BYTE:Jm.BYTE,SHORT:Jm.SHORT,INT:Jm.INT};class Xm{static fromTypedArray(e){e=ArrayBuffer.isView(e)?e.constructor:e;for(const t in Ym){if(Ym[t]===e)return t}throw new Error("Failed to convert GL type")}static fromName(e){const t=$m[e];if(!t)throw new Error("Failed to convert GL type");return t}static getArrayType(e){switch(e){case Jm.UNSIGNED_SHORT_5_6_5:case Jm.UNSIGNED_SHORT_4_4_4_4:case Jm.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:const t=Ym[e];if(!t)throw new Error("Failed to convert GL type");return t}}static getByteSize(e){return Xm.getArrayType(e).BYTES_PER_ELEMENT}static validate(e){return Boolean(Xm.getArrayType(e))}static createTypedArray(e,t,r=0,n){void 0===n&&(n=(t.byteLength-r)/Xm.getByteSize(e));return new(Xm.getArrayType(e))(t,r,n)}}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}class eg{constructor(e,t){Zm(this,"json",void 0),Zm(this,"buffer",void 0),Zm(this,"featuresLength",0),Zm(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=Qm.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=Xm.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=Xm.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=Xm.createTypedArray(t,r),n[e]=i),i}}const tg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},rg={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]]},ng={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 ig=e=>void 0!==e;function ag(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;ig(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(ig(c))for(ig(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];ig(l)&&ig(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)sg(e,r,stack)}(m),m}(n,r):null}function og(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(ig(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(ig(i))return i;const a=e.parentIds[t];n=a!==t,t=a}throw new Error("traverseHierarchySingleParent")}(e,t,r)}function sg(e,t,r){const n=e.parentCounts,i=e.parentIds,a=e.parentIndexes,o=e.classIds.length;if(!ig(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=ig(n)?n[t]:1,u=ig(n)?a[t]:t;for(let n=0;n<s;++n){const a=i[u+n];a!==t&&sg(e,a,r)}r.pop(t)}function ug(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cg(e){return null!=e}const lg=(e,t)=>e,hg={HIERARCHY:!0,extensions:!0,extras:!0};class pg{constructor(e,t,r,n={}){var i;ug(this,"json",void 0),ug(this,"binary",void 0),ug(this,"featureCount",void 0),ug(this,"_extensions",void 0),ug(this,"_properties",void 0),ug(this,"_binaryProperties",void 0),ug(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)hg[e]||(this._properties[e]=this.json[e]);this._binaryProperties=this._initializeBinaryProperties(),n["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=ag(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 cg(og(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),cg(this._properties[t])||this._hasPropertyInHierarchy(e,t)}getPropertyNames(e,t){this._checkBatchId(e),(t=cg(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(cg(r))return this._getBinaryProperty(r,e)}const r=this._properties[t];if(cg(r))return lg(r[e]);if(this._hierarchy){const r=this._getHierarchyProperty(e,t);if(cg(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];cg(i)||(this._properties[t]=new Array(n),i=this._properties[t]),i[e]=lg(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?Xm.fromName(i):i,o=tg[e.type],s=rg[e.type],u=ng[e.type];return r+=e.byteOffset,{values:Xm.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=og(this._hierarchy,e,(e,r)=>{const n=e.classIds[r];return cg(e.classes[n].instances[t])});return cg(r)}_getPropertyNamesInHierarchy(e,t){og(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 og(this._hierarchy,e,(e,r)=>{const n=e.classIds[r],i=e.classes[n],a=e.classIndexes[r],o=i.instances[t];return cg(o)?cg(o.typedArray)?this._getBinaryProperty(o,a):lg(o[a]):null})}_setHierarchyProperty(e,t,r,n){const i=og(this._hierarchy,t,(e,i)=>{const a=e.classIds[i],o=e.classes[a],s=e.classIndexes[i],u=o.instances[r];return!!cg(u)&&(Hi(i===t,`Inherited property "${r}" is read-only.`),cg(u.typedArray)?this._setBinaryProperty(u,s,n):u[s]=lg(n),!0)});return cg(i)}}function fg(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 dg(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 mg(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=Km(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=Km(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 gg(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 yg(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:Qm.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=gg(t[r]);e[3*r]=n[0],e[3*r+1]=n[1],e[3*r+2]=n[2]}return{type:Qm.UNSIGNED_BYTE,value:e,size:3,normalized:!0}}return t&&t.length===3*a?{type:Qm.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:Qm.UNSIGNED_BYTE,value:t,size:4,normalized:!0}}class bg 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 vg(e,t){if(!e)throw new Error("math.gl assertion failed. "+t)}new bg,new Is,new bg,new bg,new Uint8Array(1);function wg(e,t=255){return us(e,0,t)/t*2-1}function _g(e){return e<0?-1:1}function kg(e,t,r,n){if(vg(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=wg(e,r),n.y=wg(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))*_g(e),n.y=(1-Math.abs(e))*_g(n.y)}return n.normalize()}function xg(e,t,r){return kg(e,t,255,r)}const Eg=new Is;function Ag(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:Qm.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}async function Sg(e,t,r,n,i){r=mg(e,t,r=dg(e,t,r=fg(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 eg(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",Qm.FLOAT,3);const n=function(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",Qm.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 pg(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:yg(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",Qm.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){const n=t.getPropertyArray("POSITION_QUANTIZED",Qm.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=65535,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Qm.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Qm.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=Ag(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",Qm.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?n=t.getPropertyArray("RGB",Qm.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(n=t.getPropertyArray("RGB565",Qm.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=yg(e,n,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",Qm.UNSIGNED_BYTE,4))}(e,a,o),function(e,t){if(!e.attributes.normals){let r=null;t.hasProperty("NORMAL")?r=t.getPropertyArray("NORMAL",Qm.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",Qm.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++)xg(t[2*n],t[2*n+1],Eg),Eg.toArray(r,3*n);return{type:Qm.FLOAT,size:2,value:r}}return{type:Qm.FLOAT,size:2,value:t}}(e,r)}}(e,a),r}function jg(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 Tg(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 jg(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return jg(e,0,t)}return""}(e)}"`)}}function Cg(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 Bg(e,t,r){const n=e.bufferViews[r];sm(n);const i=t[n.buffer];sm(i);const a=(n.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,a,n.byteLength)}const Rg=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]),Og=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]),Ig={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Pg={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};let Dg;async function Mg(){return Dg||(Dg=async function(){let e="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";WebAssembly.validate(Rg)&&(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?Og[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}()),Dg}function Fg(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 Lg="EXT_meshopt_compression";async function Ng(e,t){var r;const n=new vm(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(zg(n,t));await Promise.all(i),n.removeExtension("EXT_meshopt_compression")}async function zg(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 Mg();Fg(o,o.exports[Pg[i]],e,t,r,n,o.exports[Ig[a||"NONE"]])}(p,o,a,h,s,u),p}return null}const Ug=["image/png","image/jpeg","image/gif"],qg={};function Hg(e){return void 0===qg[e]&&(qg[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)&&Ug.includes(e)}return!0}}(e)),qg[e]}const Gg="EXT_texture_webp";function Vg(e,t){const r=new vm(e);if(!Hg("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 Wg="KHR_texture_basisu";function Kg(e,t){const r=new vm(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 Jg(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:dm(r),componentType:mm(t)}}const Qg="KHR_draco_mesh_compression";function Yg(e,t,r){const n=new vm(e);for(const e of ty(n))n.getObjectExtension(e,"KHR_draco_mesh_compression")}async function $g(e,t,r){var n;if(null==t||null===(n=t.gltf)||void 0===n||!n.decompressMeshes)return;const i=new vm(e),a=[];for(const e of ty(i))i.getObjectExtension(e,"KHR_draco_mesh_compression")&&a.push(Zg(i,e,t,r));await Promise.all(a),i.removeExtension("KHR_draco_mesh_compression")}function Xg(e,t={}){const r=new vm(e);for(const e of r.json.meshes||[])ey(e,t),r.addRequiredExtension("KHR_draco_mesh_compression")}async function Zg(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=Jg(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=Jg(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 ey(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*ty(e){for(const t of e.json.meshes||[])for(const e of t.primitives)yield e}const ry="KHR_lights_punctual";async function ny(e){const t=new vm(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 iy(e){const t=new vm(e),{json:r}=t;if(r.lights){const e=t.addExtension("KHR_lights_punctual");sm(!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 ay="KHR_materials_unlit";async function oy(e){const t=new vm(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 sy(e){const t=new vm(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 uy="KHR_techniques_webgl";async function cy(e){const t=new vm(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=hy(n.technique,t)),t.removeObjectExtension(n,"KHR_techniques_webgl")}t.removeExtension("KHR_techniques_webgl")}}async function ly(e,t){}function hy(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 py=[a,o,s,u,c,l,h];function fy(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 dy(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const my={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},gy={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 yy{constructor(){dy(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}),dy(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 vm(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 my)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 my)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=gy[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 by(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const vy={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},wy={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},_y=10240,ky=10241,xy=10242,Ey=10243,Ay=10497,Sy={magFilter:_y,minFilter:ky,wrapS:xy,wrapT:Ey},jy={[_y]:9729,[ky]:9986,[xy]:Ay,[Ey]:Ay};class Ty{constructor(){by(this,"baseUri",""),by(this,"json",{}),by(this,"buffers",[]),by(this,"images",[])}postProcess(e,t={}){const{json:r,buffers:n=[],images:i=[],baseUri:a=""}=e;return sm(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,wy[r]),e.components=(n=e.type,vy[n]),e.bytesPerElement=e.bytesPerComponent*e.components,e.bufferView){const t=e.bufferView.buffer,{ArrayType:r,byteLength:n}=gm(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):jy,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 Sy[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 Cy=1735152710;function By(e,t=0,r={}){const n=new DataView(e),{magic:i=Cy}=r,a=n.getUint32(t,!1);return a===i||a===Cy}function Ry(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),Oy(e,t,r,n),r+=n,r+=Iy(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:Oy(e,t,r,i);break;case 5130562:Iy(e,t,r,i);break;case 0:n.strict||Oy(e,t,r,i);break;case 1:n.strict||Iy(e,t,r,i)}r+=am(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 Oy(e,t,r,n){const i=new Uint8Array(t.buffer,r,n),a=new TextDecoder("utf8").decode(i);return e.json=JSON.parse(a),am(n,4)}function Iy(e,t,r,n){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:t.buffer}),am(n,4)}async function Py(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&&!By(t,r,n)){const e=new TextDecoder;t=e.decode(t)}if("string"==typeof t)e.json=Tg(t);else if(t instanceof ArrayBuffer){const i={};r=Ry(i,t,r,n.glb),sm("glTF"===i.type,"Invalid GLB magic string "+i.type),e._glb=i,e.json=i.json}else sm(!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 yy).normalize(e,t)}(e,{normalize:null==n||null===(a=n.gltf)||void 0===a?void 0:a.normalize}),function(e,t={},r){const n=py.filter(e=>fy(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;sm(n);const u=Cg(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(Dy(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=py.filter(e=>fy(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 Ty).postProcess(e,t)}(e,n):e}async function Dy(e,t,r,n,i){const{fetch:a,parse:o}=i;let s;if(t.uri){const e=Cg(t.uri,n),r=await a(e);s=await r.arrayBuffer()}if(Number.isFinite(t.bufferView)){const r=Bg(e.json,e.buffers,t.bufferView);s=Ja(r.buffer,r.byteOffset,r.byteLength)}sm(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 My={name:"glTF",id:"gltf",module:"gltf",version:"3.2.3",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:async function(e,t={},r){(t={...My.options,...t}).gltf={...My.options.gltf,...t.gltf};const{byteOffset:n=0}=t;return await Py({},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 Fy=0,Ly=1;function Ny(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 zy(e,t,r,n){const i=r["3d-tiles"]||{};if(function(e,t,r){switch(t){case Fy: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 Ly: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,My,r,n),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength)}}async function Uy(e,t,r,n,i){var a;r=function(e,t,r,n,i){r=fg(e,t,r),r=dg(e,t,r),r=mg(e,t,r),r=Ny(e,t,r,n);const a=new eg(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=a.getGlobalProperty("RTC_CENTER",Qm.FLOAT,3),r}(e,t,r,n),await zy(e,Ly,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 qy(e,t,r,n,i){return r=function(e,t,r,n,i){if(r=fg(e,t,r),1!==e.version)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);r=dg(e,t,r);const a=new DataView(t);if(e.gltfFormat=a.getUint32(r,!0),r=mg(e,t,r+=4),r=Ny(e,t,r,n),0===e.featureTableJsonByteLength)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");const o=new eg(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",Qm.FLOAT,3);new pg(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",Qm.FLOAT,3,r,a);else if(t.hasProperty("POSITION_QUANTIZED")){n=t.getProperty("POSITION_QUANTIZED",Qm.UNSIGNED_SHORT,3,r,a);const e=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Qm.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",Qm.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",Qm.FLOAT,3,r,d),e.normalRight=t.getProperty("NORMAL_RIGHT",Qm.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",Qm.UNSIGNED_SHORT,2,d),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",Qm.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",Qm.FLOAT,1,r);Number.isFinite(v)&&h.multiplyByScalar(v);const w=t.getProperty("SCALE_NON_UNIFORM",Qm.FLOAT,3,r,d);w&&h.scale(w),p.scale=h;let _=t.getProperty("BATCH_ID",Qm.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 zy(e,e.gltfFormat,n,i),r}async function Hy(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 Am.COMPOSITE:return await async function(e,t,r,n,i,a){r=fg(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,Hy);case Am.BATCHED_3D_MODEL:return await Uy(i,e,t,r,n);case Am.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,My,r,n)}(i,e,r,n);case Am.INSTANCED_3D_MODEL:return await qy(i,e,t,r,n);case Am.POINT_CLOUD:return await Sg(i,e,t,r,n);default:throw new Error("3DTileLoader: unknown type "+i.type)}}async function Gy(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 Vy(e){const t=new DataView(e);return t.getUint32(0,!0)+2**32*t.getUint32(4,!0)}const Wy={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:"3.2.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=Vy(e.slice(8,16)),r=new Uint8Array(e,24,t),n=new TextDecoder("utf8").decode(r),i=JSON.parse(n),a=Vy(e.slice(16,24));let o=new ArrayBuffer(0);return a&&(o=e.slice(24+t)),"bufferView"in i.tileAvailability&&(i.tileAvailability.explicitBitstream=await Gy(i,"tileAvailability",o)),"bufferView"in i.contentAvailability&&(i.contentAvailability.explicitBitstream=await Gy(i,"contentAvailability",o)),"bufferView"in i.childSubtreeAvailability&&(i.childSubtreeAvailability.explicitBitstream=await Gy(i,"childSubtreeAvailability",o)),i},options:{}},Ky={QUADTREE:4,OCTREE:8};function Jy(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 Qy(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 Yy(e,t){return parseInt(e.toString(2)+t.toString(2),2)}function $y(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 Xy(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 Zy(e){switch(e){case"REPLACE":case"replace":return Zp;case"ADD":case"add":return Xp;default:return e}}function eb(e,t){if(!e)return null;if(e.content){const r=e.content.uri||e.content.url;e.contentUrl=`${t.basePath}/${r}`}return e.id=e.contentUrl,e.lodMetricType=sf,e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform,e.type=Xy(e),e.refine=Zy(e.refine),e}async function tb(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=`${t}/${$y(o,0,0,0,0)}`,u=await $o(s,Wy),c=`${t}/${e.root.content.uri}`,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:Xy,getRefine:Zy};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=Ky[u],g=1&i,y=i>>1&1,b=i>>2&1,v=(m**s-1)/(m-1);let w=Yy(n.mortonIndex,i),_=v+w,k=Yy(n.x,g),x=Yy(n.y,y),E=Yy(n.z,b),A=!1;s+1>c&&(A=Jy(o.childSubtreeAvailability,w));const S=Yy(a.x,k),j=Yy(a.y,x),T=Yy(a.z,E),C=s+a.level;if(A){const e=$y(`${f}/${p}`,C,S,j,T);o=await $o(e,Wy),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(!Jy(o.tileAvailability,_)||s>l)return d;Jy(o.contentAvailability,_)&&(d.contentUrl=$y(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=Qy(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=Zy(e.refine),e.type=Xy(e),e.children=n,e.id=e.contentUrl,e}(e.root,u,f)}const rb={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:"3.2.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||rb,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 tb(a):function(e){const t=e.basePath,r=eb(e.root,e),n=[];for(n.push(r);n.length>0;){const e=(n.pop()||{}).children||[];for(const r of e)eb(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 Hy(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 nb(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 ib={...rb,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 nb(r,n)},parse:async(e,t,r)=>((t={...t})["3d-tiles"]=t["cesium-ion"],t.loader=ib,rb.parse(e,t,r)),options:{"cesium-ion":{...rb.options["3d-tiles"],accessToken:null}}};var ab=r(10),ob=r.n(ab);const sb=new Uint8Array(256);let ub=sb.length;function cb(){return ub>sb.length-16&&(ob.a.randomFillSync(sb),ub=0),sb.slice(ub,ub+=16)}var lb=/^(?:[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 hb=function(e){return"string"==typeof e&&lb.test(e)};const pb=[];for(let e=0;e<256;++e)pb.push((e+256).toString(16).substr(1));var fb=function(e,t=0){const r=(pb[e[t+0]]+pb[e[t+1]]+pb[e[t+2]]+pb[e[t+3]]+"-"+pb[e[t+4]]+pb[e[t+5]]+"-"+pb[e[t+6]]+pb[e[t+7]]+"-"+pb[e[t+8]]+pb[e[t+9]]+"-"+pb[e[t+10]]+pb[e[t+11]]+pb[e[t+12]]+pb[e[t+13]]+pb[e[t+14]]+pb[e[t+15]]).toLowerCase();if(!hb(r))throw TypeError("Stringified UUID is invalid");return r};var db=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 fb(n)},mb=r(81),gb=r.n(mb);function yb(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class bb{constructor(e,t){yb(this,"nodesPerPage",void 0),yb(this,"nodesCounter",void 0),yb(this,"writeFile",void 0),yb(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");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;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());t.enqueue({writePromise:this.writeFile(a,i)})}}}const vb={};class wb extends ms{static get ZERO(){return vb.ZERO=vb.ZERO||Object.freeze(new wb(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 _b(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=kb("positions",r,n),a=kb("normals",r,n),f=kb("colors",r,n),d=kb("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 kb(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 xb(e){const t={};for(const r in e)t[r]={value:e[r].value};return t}const Eb=["CUSTOM_ATTRIBUTE_2","_BATCHID","BATCHID"];let Ab=new Is;async function Sb(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(Fb(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:xb(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});Tb(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=Um(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),Ab),Ab[2]=Ab[2]-t.getHeight(Ab[1],Ab[0]),Ab=Ab.subtract(n),r.positions.set(Ab,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 jb({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 jb({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}=_b(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=Hb(i,t,r);n[a.toString()]=o}return n}(e,n,r);Gb(t,i),Gb(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 rm({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=Vb(e,r);let a=null;switch(t){case"Oid32":case"Int32":a=Wb(i[e]);break;case"Float64":a=Kb(i[e]);break;case"string":a=Jb(i[e]);break;default:a=Jb(i[e])}a&&n.push(a)}}return n}(n.batchTableJson,f,o);return{geometry:_,compressedGeometry:k,texture:r,sharedResources:Nb((null===(c=n.gltf)||void 0===c?void 0:c.materials)||[],i),meshMaterial:t,vertexCount:h,attributes:x,featureCount:b,boundingVolumes:l}}function Tb(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)Cb(o,t,r,n,i,a)}function Cb(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,Bb({vertices:p.POSITION.value,cartographicOrigin:t,cartesianModelMatrix:r,nodeMatrix:a,indices:null===(o=h.indices)||void 0===o?void 0:o.value,attributeSpecificTransformation:Rb,useCartesianPositions:i})),e.normals=Ka(e.normals,Bb({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:Ob,useCartesianPositions:!1})),e.texCoords=Ka(e.texCoords,Ib(p.TEXCOORD_0&&p.TEXCOORD_0.value,null===(u=h.indices)||void 0===u?void 0:u.value)),e.colors=Ka(e.colors,Pb(p.COLOR_0,null===(c=h.indices)||void 0===c?void 0:c.value)),e.featureIndicesGroups=e.featureIndicesGroups||[],e.featureIndicesGroups.push(Db(Mb(p),null===(l=h.indices)||void 0===l?void 0:l.value)))}}(s,t,r,n,i,o),Tb(e.children||[],t,r,n,i,o)}function Bb(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 Rb(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 Ob(e,t){const{cartesianModelMatrix:r,nodeMatrix:n}=t;return n&&(e=e.transformAsVector(n)),e=e.transformAsVector(r)}function Ib(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 Pb(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 Db(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 Mb(e){let t=[];for(let r=0;r<Eb.length;r++){const n=Eb[r];if(e[n]&&e[n].value){t=e[n].value;break}}return t}function Fb(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:Lb(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 Lb(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend";default:return"opaque"}}function Nb(e,t){const r={};if(!e||!e.length)return r;r.materialDefinitionInfos=[];for(const n of e){const{materialDefinitionInfo:e,textureDefinitionInfo:i}=zb(n,t);r.materialDefinitionInfos.push(e),i&&(r.textureDefinitionInfos=r.textureDefinitionInfos||[],r.textureDefinitionInfos.push(i))}return r}function zb(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:qb(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:Ub(s||[1,1,1,1],o),textureDefinitionInfo:i}}function Ub(e,t=1){const r=new wb(0,0,0,1),n=new wb(1,1,1,1),i=new wb(.04/255,.04/255,.04/255,0),a=new wb(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 qb(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 Hb(e,t,r){const n=function(e,t){let r="";for(const n in e)r+=e[n][t];return r}(t,e),i=gb()(n);return r.includes(i)?r.indexOf(i):r.push(i)-1}function Gb(e,t){for(let r=0;r<e.length;r++)e[r]=t[e[r]]}function Vb(e,t){return t.find(t=>t.name===e).attributeValues.valueType}function Wb(e){const t=new Uint32Array([e.length]),r=new Uint32Array(e);return Wa(t.buffer,r.buffer)}function Kb(e){const t=new Uint32Array([e.length]),r=new Uint8Array(4),n=new Float64Array(e);return Wa(t.buffer,r.buffer,n.buffer)}function Jb(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 Qb={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}}}}},Yb=()=>({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 $b(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 Xb(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 Zb(e,t){if(!e)throw new Error(t||"luma.gl: assertion failed.")}const ev={};function tv(e="id"){ev[e]=ev[e]||1;const t=ev[e]++;return"".concat(e,"-").concat(t)}const rv={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};const nv=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]),iv=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]),av=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]),ov=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]),sv={POSITION:{size:3,value:new Float32Array(iv)},NORMAL:{size:3,value:new Float32Array(av)},TEXCOORD_0:{size:2,value:new Float32Array(ov)}};class uv extends class{static get DRAW_MODE(){return rv}constructor(e={}){const{id:t=tv("geometry"),drawMode:r=rv.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,Zb(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?(Zb(!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 Zb(Number.isFinite(r)),r}}{constructor(e={}){const{id:t=tv("cube-geometry")}=e;super({...e,id:t,indices:{size:1,value:new Uint16Array(nv)},attributes:{...sv,...e.attributes}})}}function cv(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 uv,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=lv(t.mbs),n=lv(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 lv(e){return new bh([e[0],e[1],e[2]],e[3])}const hv={name:"Basis Universal Supercompressed GPU Texture",id:Oi?"ktx2-basis-writer":"ktx2-basis-writer-nodejs",module:"textures",version:"3.2.3",extensions:["ktx2"],worker:!0,options:{useSRGB:!1,qualityLevel:10,encodeUASTC:!1,mipmaps:!1}},{_encodeImageNode:pv}=globalThis;let fv=!0;const dv={name:"Images",id:"image",module:"images",version:"3.2.3",extensions:["jpeg"],options:{image:{mimeType:"image/png",jpegQuality:null}},encode:async function(e,t){return(t=t||{}).image=t.image||{},pv?pv(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&&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 mv extends Array{enqueue(e){this.push(e)}dequeue(){return this.shift()}peek(){return this[0]}isEmpty(){return 0===this.length}}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}class yv extends mv{constructor(e=2e3,t=400){super(),gv(this,"intervalId",void 0),gv(this,"writePromise",null),gv(this,"fileMap",{}),gv(this,"listeningInterval",void 0),gv(this,"writeConcurrency",void 0),this.listeningInterval=e,this.writeConcurrency=t}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 bv={id:"i3s-attributes",name:"I3S Attributes Worker",module:"tile-converter",version:"3.2.3",options:{useCartesianPositions:!1}};var vv;function wv(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const _v=(null===(vv=Ci.a.env)||void 0===vv?void 0:vv.IonToken)||"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ";class kv{constructor(){wv(this,"nodePages",void 0),wv(this,"options",void 0),wv(this,"layers0Path",void 0),wv(this,"materialMap",void 0),wv(this,"materialDefinitions",void 0),wv(this,"vertexCounter",void 0),wv(this,"layers0",void 0),wv(this,"featuresHashArray",void 0),wv(this,"refinementCounter",void 0),wv(this,"validate",void 0),wv(this,"boundingVolumeWarnings",[]),wv(this,"conversionStartTime",[0,0]),wv(this,"refreshTokenTime",[0,0]),wv(this,"sourceTileset",null),wv(this,"geoidHeightModel",null),wv(this,"Loader",rb),wv(this,"generateTextures",void 0),wv(this,"generateBoundingVolumes",void 0),wv(this,"layersHasTexture",void 0),wv(this,"workerSource",{}),wv(this,"writeQueue",new yv),this.nodePages=new bb(Vd,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(Gm),Gm;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://")?ib:rb,this.generateTextures=Boolean(h),this.generateBoundingVolumes=Boolean(p),this.writeQueue=new yv,this.writeQueue.startListening(),console.log("Loading egm file..."),this.geoidHeightModel=await $o(n,Cd),console.log("Loading egm file completed!"),r&&this.nodePages.useWriteFunction(Wd),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 _d(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 Kd(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=zm(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:db().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 Vd(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:`{${db().toUpperCase()}}`,id:0,name:e,href:"./layers/0",store:{id:`{${db().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,Qb)},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:`{${db().toUpperCase()}}`,id:"root",level:0,lodSelection:[{metricType:"maxScreenThresholdSQ",maxError:0},{metricType:"maxScreenThreshold",maxError:0}],...e,children:[]};return Ri()(t,Yb())}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?this.writeQueue.enqueue({archiveKey:"nodes/1/3dNodeIndexDocument.json.gz",writePromise:Wd(a,JSON.stringify(i),"3dNodeIndexDocument.json")}):this.writeQueue.enqueue({writePromise:Vd(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?this.writeQueue.enqueue({archiveKey:"3dSceneLayer.json.gz",writePromise:Wd(this.layers0Path,JSON.stringify(this.layers0),"3dSceneLayer.json")}):this.writeQueue.enqueue({writePromise:Vd(this.layers0Path,JSON.stringify(this.layers0))})}async _writeNodeIndexDocument(e,t,r){this.options.slpk?this.writeQueue.enqueue({archiveKey:`nodes/${t}/3dNodeIndexDocument.json.gz`,writePromise:Wd(r,JSON.stringify(e),"3dNodeIndexDocument.json")}):this.writeQueue.enqueue({writePromise:Vd(r,JSON.stringify(e))})}async _createSlpk(e){if(this.options.slpk){const t=Object(ji.join)(e,"SceneServer","layers","0"),r=e+".slpk";await Gd(t,r,0,".",this.options.sevenZipExe);try{await Kd(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=zm(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=Rd(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=cv(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 Sb(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,Yb());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");this.writeQueue.enqueue({archiveKey:n+"/geometries/0.bin.gz",writePromise:Wd(t,e,"0.bin")})}else{const t=Object(ji.join)(r,"geometries/0/");this.writeQueue.enqueue({writePromise:Vd(t,e,"index.bin")})}if(this.options.draco)if(this.options.slpk){const e=Object(ji.join)(r,"geometries");this.writeQueue.enqueue({archiveKey:n+"/geometries/1.bin.gz",writePromise:Wd(e,t,"1.bin")})}else{const e=Object(ji.join)(r,"geometries/1/");this.writeQueue.enqueue({writePromise:Vd(e,t,"index.bin")})}}async _writeShared(e,t,r,n){if(!e)return;e.nodePath=n;const i=Ri()(e,{materialDefinitions:{path:"materialDefinitionInfos",transform:$b},textureDefinitions:{path:"textureDefinitionInfos",transform:Xb}}),a=JSON.stringify(i);if(this.options.slpk){const e=Object(ji.join)(t,"shared");this.writeQueue.enqueue({archiveKey:r+"/shared/sharedResource.json.gz",writePromise:Wd(e,a,"sharedResource.json")})}else{const e=Object(ji.join)(t,"shared/");this.writeQueue.enqueue({writePromise:Vd(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=rm(e.image,hv,{...hv.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=rm(e.image.data[0],dv);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;this.writeQueue.enqueue({archiveKey:`${i}/textures/${t}.${r}`,writePromise:Wd(a,e,`${t}.${r}`,o)})}else{const i=Object(ji.join)(n,`textures/${t}/`);this.writeQueue.enqueue({writePromise:Vd(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);this.writeQueue.enqueue({archiveKey:`${r}/attributes/${i}.bin.gz`,writePromise:Wd(e,a,"0.bin")})}else{const e=Object(ji.join)(t,`attributes/${i}/0`);this.writeQueue.enqueue({writePromise:Vd(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=gb()(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 $d(e),a=Yd(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||_v}},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(hv,{...la()}),t=await ia(e),r=await t.text();this.workerSource.ktx2=r}const e=Na(bv,{...la()}),t=await ia(e),r=await t.text();this.workerSource.I3SAttributes=r,console.log("Loading workers source completed!")}}const xv={id:"zip",module:"zip",name:"Zip Archive",version:"3.2.3",extensions:["zip"],mimeTypes:["application/zip"],category:"archive",tests:["PK"],options:{},parse:async function(e,t={}){const r=[],n={};try{const i=new Nd.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 Ev{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",xv,{});let r=process.cwd();e&&(r=Object(ji.join)(r,e)),await Vd(r,new Uint8Array(t["geoids/egm2008-5.pgm"]),"egm2008-5.pgm"),console.log("All dependencies were installed succesfully.")}}const Av={I3S:"I3S",_3DTILES:"3DTILES"};function Sv(){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 jv(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&&Sv();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=jv(n,e);break;case"--tileset":t.tileset=jv(n,e);break;case"--name":t.name=jv(n,e);break;case"--output":t.output=jv(n,e);break;case"--max-depth":t.maxDepth=function(e,t){const r=jv(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=jv(n,e);break;case"--egm":t.egm=jv(n,e);break;case"--token":t.token=jv(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":Sv();break;default:console.warn("Unknown option "+r),process.exit(0)}}),t}(e);if(t.installDependencies){return void(new Ev).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(Av).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 Av.I3S:(new Wm).convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,egmFilePath:e.egm});break;case Av._3DTILES:const t=new kv;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:Sv()}}(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 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 Lg})),r.d(a,"decode",(function(){return Ng}));var o={};r.r(o),r.d(o,"name",(function(){return Gg})),r.d(o,"preprocess",(function(){return Vg}));var s={};r.r(s),r.d(s,"name",(function(){return Wg})),r.d(s,"preprocess",(function(){return Kg}));var u={};r.r(u),r.d(u,"name",(function(){return Qg})),r.d(u,"preprocess",(function(){return Yg})),r.d(u,"decode",(function(){return $g})),r.d(u,"encode",(function(){return Xg}));var c={};r.r(c),r.d(c,"name",(function(){return ry})),r.d(c,"decode",(function(){return ny})),r.d(c,"encode",(function(){return iy}));var l={};r.r(l),r.d(l,"name",(function(){return ay})),r.d(l,"decode",(function(){return oy})),r.d(l,"encode",(function(){return sy}));var h={};r.r(h),r.d(h,"name",(function(){return uy})),r.d(h,"decode",(function(){return cy})),r.d(h,"encode",(function(){return ly}));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(25),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.4"){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.4",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.4",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.4/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.4",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.4/dist/libs/basis_encoder.js","textures",e),await Ec("https://unpkg.com/@loaders.gl/textures@3.2.4/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.4",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.4",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.4",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.4",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.4",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.4",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=e.unprojectPosition(e.center),s=vu.WGS84.cartographicToCartesian(o,new Is),u=vu.WGS84.eastNorthUpToFixedFrame(s),c=e.unprojectPosition(e.cameraPosition),l=vu.WGS84.cartographicToCartesian(c,new Is),h=new Is(u.transformAsVector(new Is(r).scale(a))).normalize(),p=new Is(u.transformAsVector(new Is(n).scale(a))).normalize();!function(e,t){const r=e.getFrustumPlanes();let n=0;for(const i in r){const a=r[i],o=a.normal.dot(e.center);Df.copy(a.normal).scale(a.distance-o).add(e.center);const s=e.unprojectPosition(Df),u=vu.WGS84.cartographicToCartesian(s,new Is);Mf.planes[n++].fromPointNormal(u,Pf.copy(t).subtract(u))}}(e,s);const f=e.constructor,{longitude:d,latitude:m,width:g,bearing:y,zoom:b}=e;return{camera:{position:l,direction:h,up:p},viewport:e,topDownViewport:new f({longitude:d,latitude:m,height:i,width:g,bearing:y,zoom:b,pitch:0}),height:i,cullingVolume:Mf,frameNumber:t,sseDenominator:1.15}}const Lf=new Is;function Nf(e,t){if(e instanceof lp){const{halfAxes:r}=e,n=function(e){e.getColumn(0,Lf);const t=e.getColumn(1),r=e.getColumn(2),n=Lf.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 zf(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 Uf(e){return null!=e}const qf=new Is,Hf=new Is,Gf=new Is;function Vf(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(Uf(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],Hf),u=vu.WGS84.cartographicToCartesian([ss(n),ss(r),o],Gf),c=(new Is).addVectors(s,u).multiplyScalar(.5),l=(new Is).subVectors(s,u).len()/2;return Wf([c[0],c[1],c[2],l],new Ws)}if(e.sphere)return Wf(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function Wf(e,t,r){const n=new Is(e[0],e[1],e[2]);t.transform(n,n);const i=t.getScale(qf),a=Math.max(Math.max(i[0],i[1]),i[2]),o=e[3]*a;return Uf(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 Kf(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 Jf=new Is,Qf=new Is,Yf=new Is,$f=new Is,Xf=new Is,Zf=new Ws,ed=new Ws;function td(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,Jf),Qf.copy(Jf).subtract(s).normalize(),vu.WGS84.eastNorthUpToFixedFrame(s,Zf),ed.copy(Zf).invert(),Yf.copy(Jf).transform(ed);const c=Math.sqrt(Yf[0]*Yf[0]+Yf[1]*Yf[1]),l=c*c/Yf[2];$f.copy([Yf[0],Yf[1],l]);const h=$f.transform(Zf).subtract(s).normalize(),p=Qf.cross(h).normalize().scale(o).add(s),f=vu.WGS84.cartesianToCartographic(p),d=r.project([i,n,a]),m=r.project(f);return Xf.copy(d).subtract(m).magnitude()}function rd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class nd{constructor(e=0){rd(this,"_map",new Map),rd(this,"_array",void 0),rd(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 id(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const ad={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""};class od{get traversalFinished(){return!0}constructor(e){id(this,"options",void 0),id(this,"root",void 0),id(this,"requestedTiles",void 0),id(this,"selectedTiles",void 0),id(this,"emptyTiles",void 0),id(this,"lastUpdate",(new Date).getTime()),id(this,"updateDebounceTime",1e3),id(this,"_traversalStack",void 0),id(this,"_emptyTraversalStack",void 0),id(this,"_frameNumber",void 0),this.options={...ad,...e},this._traversalStack=new nd,this._emptyTraversalStack=new nd,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||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 sd(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=new Is;class cd{constructor(e,t,r,n=""){sd(this,"tileset",void 0),sd(this,"header",void 0),sd(this,"id",void 0),sd(this,"url",void 0),sd(this,"parent",void 0),sd(this,"refine",void 0),sd(this,"type",void 0),sd(this,"contentUrl",void 0),sd(this,"lodMetricType",void 0),sd(this,"lodMetricValue",void 0),sd(this,"boundingVolume",void 0),sd(this,"content",void 0),sd(this,"contentState",void 0),sd(this,"gpuMemoryUsageInBytes",void 0),sd(this,"children",void 0),sd(this,"depth",void 0),sd(this,"viewportIds",void 0),sd(this,"transform",void 0),sd(this,"extensions",void 0),sd(this,"userData",void 0),sd(this,"computedTransform",void 0),sd(this,"hasEmptyContent",void 0),sd(this,"hasTilesetContent",void 0),sd(this,"traverser",void 0),sd(this,"_cacheNode",void 0),sd(this,"_frameNumber",void 0),sd(this,"_lodJudge",void 0),sd(this,"_expireDate",void 0),sd(this,"_expiredContent",void 0),sd(this,"_shouldRefine",void 0),sd(this,"_distanceToCamera",void 0),sd(this,"_centerZDepth",void 0),sd(this,"_screenSpaceError",void 0),sd(this,"_visibilityPlaneMask",void 0),sd(this,"_visible",void 0),sd(this,"_inRequestVolume",void 0),sd(this,"_stackLength",void 0),sd(this,"_selectionDepth",void 0),sd(this,"_touchedFrame",void 0),sd(this,"_visitedFrame",void 0),sd(this,"_selectedFrame",void 0),sd(this,"_requestedFrame",void 0),sd(this,"_priority",void 0),sd(this,"_contentBoundingVolume",void 0),sd(this,"_viewerRequestVolume",void 0),sd(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 od({}),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 td(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-=Kf(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 ud.subVectors(t.center,e.position),e.direction.dot(ud)}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=Vf(e.boundingVolume,this.computedTransform,this.boundingVolume);const t=e.content;t&&(t.boundingVolume&&(this._contentBoundingVolume=Vf(t.boundingVolume,this.computedTransform,this._contentBoundingVolume)),e.viewerRequestVolume&&(this._viewerRequestVolume=Vf(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 ld extends od{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 hd{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){const t=this.frameNumberMap.get(e)||0;this.frameNumberMap.set(e,t+1)}deregister(e){const t=this.frameNumberMap.get(e)||1;this.frameNumberMap.set(e,t-1)}isZero(e){return 0===(this.frameNumberMap.get(e)||0)}}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="REQUESTED",dd="COMPLETED",md="ERROR";class gd{constructor(){pd(this,"_statusMap",void 0),pd(this,"pendingTilesRegister",new hd),this._statusMap={}}add(e,t,r,n){if(!this._statusMap[t]){const{frameNumber:i}=n;this._statusMap[t]={request:e,callback:r,key:t,frameState:n,status:fd},this.pendingTilesRegister.register(i),e().then(e=>{this._statusMap[t].status=dd;const{frameNumber:r}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(r),this._statusMap[t].callback(e,n)}).catch(e=>{this._statusMap[t].status=md;const{frameNumber:n}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(n),r(e)})}}update(e,t){this._statusMap[e]&&(this.pendingTilesRegister.deregister(this._statusMap[e].frameState.frameNumber),this.pendingTilesRegister.register(t.frameNumber),this._statusMap[e].frameState=t)}find(e){return this._statusMap[e]}hasPendingTiles(e){return!this.pendingTilesRegister.isZero(e)}}class yd extends od{get traversalFinished(){return!this._tileManager.hasPendingTiles(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 gd}shouldRefine(e,t){return e._lodJudge=function(e,t){if(0===e.lodMetricValue||isNaN(e.lodMetricValue))return"DIG";const r=2*td(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 cd(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||(new Date).getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(n,i)}}function bd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const vd={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:{}},wd="Tiles In Tileset(s)";class _d{constructor(e,t){bd(this,"options",void 0),bd(this,"loadOptions",void 0),bd(this,"type",void 0),bd(this,"tileset",void 0),bd(this,"loader",void 0),bd(this,"url",void 0),bd(this,"basePath",void 0),bd(this,"modelMatrix",void 0),bd(this,"ellipsoid",void 0),bd(this,"lodMetricType",void 0),bd(this,"lodMetricValue",void 0),bd(this,"refine",void 0),bd(this,"root",void 0),bd(this,"roots",void 0),bd(this,"asset",void 0),bd(this,"description",void 0),bd(this,"properties",void 0),bd(this,"extras",void 0),bd(this,"attributions",void 0),bd(this,"credits",void 0),bd(this,"stats",void 0),bd(this,"traverseCounter",void 0),bd(this,"geometricError",void 0),bd(this,"selectedTiles",void 0),bd(this,"updatePromise",null),bd(this,"tilesetInitializationPromise",void 0),bd(this,"cartographicCenter",void 0),bd(this,"cartesianCenter",void 0),bd(this,"zoom",void 0),bd(this,"boundingVolume",void 0),bd(this,"gpuMemoryUsageInBytes",void 0),bd(this,"dynamicScreenSpaceErrorComputedDensity",void 0),bd(this,"_traverser",void 0),bd(this,"_cache",void 0),bd(this,"_requestScheduler",void 0),bd(this,"_frameNumber",void 0),bd(this,"_queryParamsString",void 0),bd(this,"_queryParams",void 0),bd(this,"_extensionsUsed",void 0),bd(this,"_tiles",void 0),bd(this,"_pendingCount",void 0),bd(this,"lastUpdatedVieports",void 0),bd(this,"_requestedTiles",void 0),bd(this,"_emptyTiles",void 0),bd(this,"frameStateData",void 0),bd(this,"maximumMemoryUsage",void 0),Hi(e),this.options={...vd,...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,this.doUpdate(e)})}async selectTiles(e=null){return await this.tilesetInitializationPromise,e&&(this.lastUpdatedVieports=e),this.updatePromise||(this.updatePromise=new Promise(e=>{setTimeout(()=>{this.doUpdate(this.lastUpdatedVieports),e(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}doUpdate(e=null){if("loadTiles"in this.options&&!this.options.loadTiles)return;if(this.traverseCounter>0)return;e instanceof Array||(e=[e]),this._cache.reset(),this._frameNumber++,this.traverseCounter=e.length;const t=[];for(const r of e){const e=r.id;this._needTraverse(e)?t.push(e):this.traverseCounter--}for(const r of e){const e=r.id;if(this.roots[e]||(this.roots[e]=this._initializeTileHeaders(this.tileset,null)),!t.includes(e))continue;const n=Ff(r,this._frameNumber);this._traverser.traverse(this.roots[e],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=zf(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 zf({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);this.cartographicCenter=vu.WGS84.cartesianToCartographic(t,new Is),this.cartesianCenter=t,this.zoom=Nf(e.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(wd),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 cd(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(wd).incrementCount();const r=t.header.children||[];for(const n of r){const r=new cd(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=ld;break;case af:e=yd;break;default:e=od}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(wd).reset(),this.stats.get(wd).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 kd=[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],xd=[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],Ed=[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 Ad{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=Sd(e,t);2*Math.abs(r)===t?r-=Sd(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=xd;0!==o&&(t=o===this.options._height-2?Ed:kd);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 Sd(e,t){return e-Math.floor(e/t)*t}function jd(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:Td(n)}}else{const r=e.subarray(t,e.length);t=e.length,yield{offset:t,line:Td(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 Ad({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 Td(e){let t="";for(const r of e)t+=String.fromCharCode(r);return t}const Cd={name:"PGM - Netpbm grayscale image format",id:"pgm",module:"tile-converter",version:"3.2.4",mimeTypes:["image/x-portable-graymap"],parse:async(e,t)=>jd(new Uint8Array(e),t),extensions:["pgm"],options:{cubic:!1}};function Bd(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 Rd(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 Od(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 Id=r(80),Pd=r.n(Id);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={command:"",arguments:[],port:5e3,autoPort:!0,wait:2e3,onSuccess:e=>{console.log("Started "+e.props.command)}};class Fd{constructor({id:e="browser-driver"}={}){Dd(this,"id",void 0),Dd(this,"props",{...Md}),Dd(this,"childProcess",null),Dd(this,"port",0),Dd(this,"successTimer",void 0),this.id=e}async start(e){e={...Md,...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=>{Pd.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=Id.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 Ld=r(79),Nd=r.n(Ld);const zd="function"==typeof atob?atob:"function"==typeof Buffer?function(e){return Buffer.from(e,"base64").toString("binary")}:Hd,Ud=zd("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"),qd=!(!WebAssembly||zd===Hd)&&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}(Ud).buffer;Math.floor(1048576.00032768);function Hd(e){return e}qd||console.log("WebAssembly not available or WASM module could not be decoded; md5WASM will fall back to JavaScript");r(112);async function Gd(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=Qd(t),o=["a","-tzip","-mx="+r,a,n],s=new Fd;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=Qd(t),a=["-"+r,"-r",i,n],o=new Fd;await o.start({command:"zip",arguments:a,spawn:{cwd:e},wait:0})}(e,t,r,n)}async function Vd(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 Wd(e,t,r="index.json",n=!0){const i=await Vd(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 Jd(i),e}return i}function Kd(e){return he.promises.rmdir(e,{recursive:!0})}function Jd(e){return he.promises.unlink(e)}function Qd(e){return Object(ji.isAbsolute)(e)?e:Object(ji.join)(process.cwd(),e)}function Yd(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 $d(e){const{slpk:t,outputPath:r,tilesetName:n}=e,i=Qd(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 Xd=()=>({boundingVolume:{path:"boundingVolume"},geometricError:{path:"geometricError"},content:{path:"content"},children:{path:"children",transform:e=>e.map(e=>Ri()(e,Xd()))}});function Zd(e){return JSON.parse(function(e){const t=new Set;return JSON.stringify(e,(e,r)=>{if("object"==typeof r&&null!==r){if(t.has(r))try{return JSON.parse(JSON.stringify(r))}catch(e){return}t.add(r)}return r})}(e))}async function em(e,t,r={},n={}){const i=function(e){const t="3.2.4"!==e.version?" (worker-utils@3.2.4)":"";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,tm.bind(null,n)),h=Zd(r);l.postMessage("process",{input:t,options:h});return(await l.result).result}async function tm(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 rm(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 em(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=im("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=im("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 nm(e,t,r){if(t.encodeSync)return t.encodeSync(e,r);throw new Error("Writer could not synchronously encode data")}function im(e){return"/tmp/"+e}function am(e,t){return Hi(e>=0),Hi(t>0),e+(t-1)&~(t-1)}function om(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+am(n.byteLength,4)}function sm(e,t){if(!e)throw new Error(t||"assert failed: gltf")}const um=["SCALAR","VEC2","VEC3","VEC4"],cm=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],lm=new Map(cm),hm={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},pm={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},fm={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function dm(e){return um[e-1]||um[0]}function mm(e){const t=lm.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function gm(e,t){const r=fm[e.componentType],n=hm[e.type],i=pm[e.componentType],a=e.count*n,o=e.count*n*i;return sm(o>=0&&o<=t.byteLength),{ArrayType:r,length:a,byteLength:o}}function ym(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const bm={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]};class vm{constructor(e){ym(this,"gltf",void 0),ym(this,"sourceBuffers",void 0),ym(this,"byteLength",void 0),this.gltf=e||{json:{...bm},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];sm(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}=gm(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 sm(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return sm(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;sm(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const r={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=am(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:dm(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:mm(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=om(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 wm(e,t,r,n){const i=am(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 _m(e,t,r,n){return t=wm(e,t,(new TextEncoder).encode(r),n)}const km=1179937895;function xm(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=km,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=_m(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=wm(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 Em={name:"glTF",id:"gltf",module:"gltf",version:"3.2.4",extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,encodeSync:function(e,t={}){const{byteOffset:r=0}=t,n=xm(e,null,r,t),i=new ArrayBuffer(n),a=new DataView(i);return xm(e,a,r,t),i},options:{gltf:{}}};const Am={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},Sm=(Object.keys(Am),{BATCHED_MODEL:[98,51,100,109],INSTANCED_MODEL:[105,51,100,109],POINT_CLOUD:[112,110,116,115],COMPOSITE:[99,109,112,116]});function jm(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 Tm(e,t,r){e&&e.setUint32(t+8,r,!0)}function Cm(e,t,r,n){if(e)for(let i=0;i<n;i++)e.setUint8(t+i,r.charCodeAt(i));return t+n}function Bm(e,t,r,n){if(e)for(let i=0;i<n;i++)e.setUint8(t+i,r[i]);return t+n}const Rm={POINTS_LENGTH:1,POSITIONS:{byteOffset:0}};function Om(e,t,r,n){const{featureTableJson:i=Rm}=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+=jm(e={magic:Sm.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+=Cm(t,r,a,o),Tm(t,c,(r+=Bm(t,r,s,u))-c),r}function Im(e,t,r,n){switch(Hi("string"==typeof e.type),e.type){case Am.COMPOSITE:return function(e,t,r,n,i){const a=r;r+=jm(e={magic:Sm.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 Tm(t,a,r-a),r}(e,t,r,n,Im);case Am.POINT_CLOUD:return Om(e,t,r);case Am.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=am(s.length,8),l=u?am(u.length,8):0,h=r;r=jm(e={magic:Sm.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=_m(t,r+=16,s,8),a&&(r=_m(t,r,u,8));const p=e.gltfEncoded;return p&&(r=Bm(t,r,p,p.byteLength)),Tm(t,h,r-h),r}(e,t,r);case Am.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=jm(e={magic:Sm.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+=Cm(t,r,c,l),Tm(t,h,(r+=Cm(t,r,o,s))-h),r}(e,t,r);default:throw new Error("3D Tiles: unknown tile type")}}const Pm={name:"3D Tile",id:"3d-tiles",module:"3d-tiles",version:"3.2.4",extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],encodeSync:function(e,t){return function(e,t){const r=Im(e,null,0,t),n=new ArrayBuffer(r);return Im(e,new DataView(n),0,t),n}(e,t)},binary:!0,options:{"3d-tiles":{}}};function Dm(e){return[e[0]-Math.floor(e[0]),e[1]-Math.floor(e[1])]}function Mm(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Fm=new Ws([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),Lm=new Is;class Nm{constructor(){Mm(this,"rtcCenter",void 0),Mm(this,"i3sTile",void 0)}async convert(e,t=null){const r=await this.buildGltf(e);return nm({gltfEncoded:new Uint8Array(r),type:"b3dm",featuresLength:this._getFeaturesLength(t),batchTable:t},Pm)}async buildGltf(e){const{tileContent:t,textureFormat:r}=e,{material:n,attributes:i,indices:a,cartesianOrigin:o,cartographicOrigin:s,modelMatrix:u}=t,c=new vm,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=Dm([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 nm(c.gltf,Em)}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,Lm),u=Lm.subtract(s),i.set(u,a)}return i}_generateTransformMatrix(e){return(new Ws).translate(e).multiplyLeft(Fm)}_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 zm(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 Um(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 qm(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 Hm={id:"3d-tiles-attributes",name:"3DTiles Attributes Worker",module:"tile-converter",version:"3.2.4",options:{attributes:null}};const Gm="Tile converter does not work in browser, only in node js environment";function Vm(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Wm{constructor(){Vm(this,"options",void 0),Vm(this,"tilesetPath",void 0),Vm(this,"vertexCounter",void 0),Vm(this,"conversionStartTime",void 0),Vm(this,"geoidHeightModel",void 0),Vm(this,"sourceTileset",void 0),Vm(this,"attributeStorageInfo",void 0),Vm(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(Gm),Gm;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,Cd),console.log("Loading egm file completed!"),await this.loadWorkers();const o=await $o(t,gf,{});this.sourceTileset=new _d(o,{loadOptions:{i3s:{coordinateSystem:sh.LNGLAT_OFFSETS,decodeTextures:!1}}}),await this.sourceTileset.tilesetInitializationPromise;const s=this.sourceTileset.root;s.header.obb||(s.header.obb=qm(s.header.mbs)),this.tilesetPath=Object(ji.join)(""+r,""+n),this.attributeStorageInfo=o.attributeStorageInfo;try{await Kd(this.tilesetPath)}catch(e){}const u={boundingVolume:{box:Bd(s.header.obb,this.geoidHeightModel)},geometricError:Od(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,Xd())}});await Vd(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=qm(a.header.mbs));const i={box:Bd(a.header.obb,this.geoidHeightModel)},o={boundingVolume:i,geometricError:Od(a),children:[]},s={tileContent:a.content,textureFormat:null==a||null===(n=a.header)||void 0===n?void 0:n.textureFormat},u=await(new Nm).convert(s,e);o.content={uri:a.id+".b3dm",boundingVolume:i},await Vd(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 cd(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 $d(e),r=Yd(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(Hm,{...la()}),t=await ia(e),r=await t.text();this.workerSource.tile3dWorkerSource=r,console.log("Loading workers source completed!")}}function Km(e,t,r){Hi(e instanceof ArrayBuffer);const n=new TextDecoder("utf8"),i=new Uint8Array(e,t,r);return n.decode(i)}const Jm={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},Qm={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,...Jm},Ym={[Jm.DOUBLE]:Float64Array,[Jm.FLOAT]:Float32Array,[Jm.UNSIGNED_SHORT]:Uint16Array,[Jm.UNSIGNED_INT]:Uint32Array,[Jm.UNSIGNED_BYTE]:Uint8Array,[Jm.BYTE]:Int8Array,[Jm.SHORT]:Int16Array,[Jm.INT]:Int32Array},$m={DOUBLE:Jm.DOUBLE,FLOAT:Jm.FLOAT,UNSIGNED_SHORT:Jm.UNSIGNED_SHORT,UNSIGNED_INT:Jm.UNSIGNED_INT,UNSIGNED_BYTE:Jm.UNSIGNED_BYTE,BYTE:Jm.BYTE,SHORT:Jm.SHORT,INT:Jm.INT};class Xm{static fromTypedArray(e){e=ArrayBuffer.isView(e)?e.constructor:e;for(const t in Ym){if(Ym[t]===e)return t}throw new Error("Failed to convert GL type")}static fromName(e){const t=$m[e];if(!t)throw new Error("Failed to convert GL type");return t}static getArrayType(e){switch(e){case Jm.UNSIGNED_SHORT_5_6_5:case Jm.UNSIGNED_SHORT_4_4_4_4:case Jm.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:const t=Ym[e];if(!t)throw new Error("Failed to convert GL type");return t}}static getByteSize(e){return Xm.getArrayType(e).BYTES_PER_ELEMENT}static validate(e){return Boolean(Xm.getArrayType(e))}static createTypedArray(e,t,r=0,n){void 0===n&&(n=(t.byteLength-r)/Xm.getByteSize(e));return new(Xm.getArrayType(e))(t,r,n)}}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}class eg{constructor(e,t){Zm(this,"json",void 0),Zm(this,"buffer",void 0),Zm(this,"featuresLength",0),Zm(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=Qm.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=Xm.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=Xm.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=Xm.createTypedArray(t,r),n[e]=i),i}}const tg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},rg={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]]},ng={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 ig=e=>void 0!==e;function ag(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;ig(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(ig(c))for(ig(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];ig(l)&&ig(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)sg(e,r,stack)}(m),m}(n,r):null}function og(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(ig(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(ig(i))return i;const a=e.parentIds[t];n=a!==t,t=a}throw new Error("traverseHierarchySingleParent")}(e,t,r)}function sg(e,t,r){const n=e.parentCounts,i=e.parentIds,a=e.parentIndexes,o=e.classIds.length;if(!ig(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=ig(n)?n[t]:1,u=ig(n)?a[t]:t;for(let n=0;n<s;++n){const a=i[u+n];a!==t&&sg(e,a,r)}r.pop(t)}function ug(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cg(e){return null!=e}const lg=(e,t)=>e,hg={HIERARCHY:!0,extensions:!0,extras:!0};class pg{constructor(e,t,r,n={}){var i;ug(this,"json",void 0),ug(this,"binary",void 0),ug(this,"featureCount",void 0),ug(this,"_extensions",void 0),ug(this,"_properties",void 0),ug(this,"_binaryProperties",void 0),ug(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)hg[e]||(this._properties[e]=this.json[e]);this._binaryProperties=this._initializeBinaryProperties(),n["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=ag(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 cg(og(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),cg(this._properties[t])||this._hasPropertyInHierarchy(e,t)}getPropertyNames(e,t){this._checkBatchId(e),(t=cg(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(cg(r))return this._getBinaryProperty(r,e)}const r=this._properties[t];if(cg(r))return lg(r[e]);if(this._hierarchy){const r=this._getHierarchyProperty(e,t);if(cg(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];cg(i)||(this._properties[t]=new Array(n),i=this._properties[t]),i[e]=lg(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?Xm.fromName(i):i,o=tg[e.type],s=rg[e.type],u=ng[e.type];return r+=e.byteOffset,{values:Xm.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=og(this._hierarchy,e,(e,r)=>{const n=e.classIds[r];return cg(e.classes[n].instances[t])});return cg(r)}_getPropertyNamesInHierarchy(e,t){og(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 og(this._hierarchy,e,(e,r)=>{const n=e.classIds[r],i=e.classes[n],a=e.classIndexes[r],o=i.instances[t];return cg(o)?cg(o.typedArray)?this._getBinaryProperty(o,a):lg(o[a]):null})}_setHierarchyProperty(e,t,r,n){const i=og(this._hierarchy,t,(e,i)=>{const a=e.classIds[i],o=e.classes[a],s=e.classIndexes[i],u=o.instances[r];return!!cg(u)&&(Hi(i===t,`Inherited property "${r}" is read-only.`),cg(u.typedArray)?this._setBinaryProperty(u,s,n):u[s]=lg(n),!0)});return cg(i)}}function fg(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 dg(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 mg(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=Km(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=Km(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 gg(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 yg(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:Qm.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=gg(t[r]);e[3*r]=n[0],e[3*r+1]=n[1],e[3*r+2]=n[2]}return{type:Qm.UNSIGNED_BYTE,value:e,size:3,normalized:!0}}return t&&t.length===3*a?{type:Qm.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:Qm.UNSIGNED_BYTE,value:t,size:4,normalized:!0}}class bg 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 vg(e,t){if(!e)throw new Error("math.gl assertion failed. "+t)}new bg,new Is,new bg,new bg,new Uint8Array(1);function wg(e,t=255){return us(e,0,t)/t*2-1}function _g(e){return e<0?-1:1}function kg(e,t,r,n){if(vg(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=wg(e,r),n.y=wg(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))*_g(e),n.y=(1-Math.abs(e))*_g(n.y)}return n.normalize()}function xg(e,t,r){return kg(e,t,255,r)}const Eg=new Is;function Ag(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:Qm.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}async function Sg(e,t,r,n,i){r=mg(e,t,r=dg(e,t,r=fg(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 eg(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",Qm.FLOAT,3);const n=function(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",Qm.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 pg(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:yg(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",Qm.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){const n=t.getPropertyArray("POSITION_QUANTIZED",Qm.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=65535,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Qm.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Qm.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=Ag(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",Qm.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?n=t.getPropertyArray("RGB",Qm.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(n=t.getPropertyArray("RGB565",Qm.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=yg(e,n,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",Qm.UNSIGNED_BYTE,4))}(e,a,o),function(e,t){if(!e.attributes.normals){let r=null;t.hasProperty("NORMAL")?r=t.getPropertyArray("NORMAL",Qm.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",Qm.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++)xg(t[2*n],t[2*n+1],Eg),Eg.toArray(r,3*n);return{type:Qm.FLOAT,size:2,value:r}}return{type:Qm.FLOAT,size:2,value:t}}(e,r)}}(e,a),r}function jg(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 Tg(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 jg(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return jg(e,0,t)}return""}(e)}"`)}}function Cg(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 Bg(e,t,r){const n=e.bufferViews[r];sm(n);const i=t[n.buffer];sm(i);const a=(n.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,a,n.byteLength)}const Rg=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]),Og=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]),Ig={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Pg={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};let Dg;async function Mg(){return Dg||(Dg=async function(){let e="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";WebAssembly.validate(Rg)&&(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?Og[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}()),Dg}function Fg(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 Lg="EXT_meshopt_compression";async function Ng(e,t){var r;const n=new vm(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(zg(n,t));await Promise.all(i),n.removeExtension("EXT_meshopt_compression")}async function zg(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 Mg();Fg(o,o.exports[Pg[i]],e,t,r,n,o.exports[Ig[a||"NONE"]])}(p,o,a,h,s,u),p}return null}const Ug=["image/png","image/jpeg","image/gif"],qg={};function Hg(e){return void 0===qg[e]&&(qg[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)&&Ug.includes(e)}return!0}}(e)),qg[e]}const Gg="EXT_texture_webp";function Vg(e,t){const r=new vm(e);if(!Hg("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 Wg="KHR_texture_basisu";function Kg(e,t){const r=new vm(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 Jg(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:dm(r),componentType:mm(t)}}const Qg="KHR_draco_mesh_compression";function Yg(e,t,r){const n=new vm(e);for(const e of ty(n))n.getObjectExtension(e,"KHR_draco_mesh_compression")}async function $g(e,t,r){var n;if(null==t||null===(n=t.gltf)||void 0===n||!n.decompressMeshes)return;const i=new vm(e),a=[];for(const e of ty(i))i.getObjectExtension(e,"KHR_draco_mesh_compression")&&a.push(Zg(i,e,t,r));await Promise.all(a),i.removeExtension("KHR_draco_mesh_compression")}function Xg(e,t={}){const r=new vm(e);for(const e of r.json.meshes||[])ey(e,t),r.addRequiredExtension("KHR_draco_mesh_compression")}async function Zg(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=Jg(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=Jg(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 ey(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*ty(e){for(const t of e.json.meshes||[])for(const e of t.primitives)yield e}const ry="KHR_lights_punctual";async function ny(e){const t=new vm(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 iy(e){const t=new vm(e),{json:r}=t;if(r.lights){const e=t.addExtension("KHR_lights_punctual");sm(!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 ay="KHR_materials_unlit";async function oy(e){const t=new vm(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 sy(e){const t=new vm(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 uy="KHR_techniques_webgl";async function cy(e){const t=new vm(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=hy(n.technique,t)),t.removeObjectExtension(n,"KHR_techniques_webgl")}t.removeExtension("KHR_techniques_webgl")}}async function ly(e,t){}function hy(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 py=[a,o,s,u,c,l,h];function fy(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 dy(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const my={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},gy={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 yy{constructor(){dy(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}),dy(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 vm(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 my)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 my)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=gy[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 by(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const vy={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},wy={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},_y=10240,ky=10241,xy=10242,Ey=10243,Ay=10497,Sy={magFilter:_y,minFilter:ky,wrapS:xy,wrapT:Ey},jy={[_y]:9729,[ky]:9986,[xy]:Ay,[Ey]:Ay};class Ty{constructor(){by(this,"baseUri",""),by(this,"json",{}),by(this,"buffers",[]),by(this,"images",[])}postProcess(e,t={}){const{json:r,buffers:n=[],images:i=[],baseUri:a=""}=e;return sm(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,wy[r]),e.components=(n=e.type,vy[n]),e.bytesPerElement=e.bytesPerComponent*e.components,e.bufferView){const t=e.bufferView.buffer,{ArrayType:r,byteLength:n}=gm(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):jy,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 Sy[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 Cy=1735152710;function By(e,t=0,r={}){const n=new DataView(e),{magic:i=Cy}=r,a=n.getUint32(t,!1);return a===i||a===Cy}function Ry(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),Oy(e,t,r,n),r+=n,r+=Iy(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:Oy(e,t,r,i);break;case 5130562:Iy(e,t,r,i);break;case 0:n.strict||Oy(e,t,r,i);break;case 1:n.strict||Iy(e,t,r,i)}r+=am(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 Oy(e,t,r,n){const i=new Uint8Array(t.buffer,r,n),a=new TextDecoder("utf8").decode(i);return e.json=JSON.parse(a),am(n,4)}function Iy(e,t,r,n){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:t.buffer}),am(n,4)}async function Py(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&&!By(t,r,n)){const e=new TextDecoder;t=e.decode(t)}if("string"==typeof t)e.json=Tg(t);else if(t instanceof ArrayBuffer){const i={};r=Ry(i,t,r,n.glb),sm("glTF"===i.type,"Invalid GLB magic string "+i.type),e._glb=i,e.json=i.json}else sm(!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 yy).normalize(e,t)}(e,{normalize:null==n||null===(a=n.gltf)||void 0===a?void 0:a.normalize}),function(e,t={},r){const n=py.filter(e=>fy(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;sm(n);const u=Cg(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(Dy(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=py.filter(e=>fy(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 Ty).postProcess(e,t)}(e,n):e}async function Dy(e,t,r,n,i){const{fetch:a,parse:o}=i;let s;if(t.uri){const e=Cg(t.uri,n),r=await a(e);s=await r.arrayBuffer()}if(Number.isFinite(t.bufferView)){const r=Bg(e.json,e.buffers,t.bufferView);s=Ja(r.buffer,r.byteOffset,r.byteLength)}sm(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 My={name:"glTF",id:"gltf",module:"gltf",version:"3.2.4",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:async function(e,t={},r){(t={...My.options,...t}).gltf={...My.options.gltf,...t.gltf};const{byteOffset:n=0}=t;return await Py({},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 Fy=0,Ly=1;function Ny(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 zy(e,t,r,n){const i=r["3d-tiles"]||{};if(function(e,t,r){switch(t){case Fy: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 Ly: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,My,r,n),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength)}}async function Uy(e,t,r,n,i){var a;r=function(e,t,r,n,i){r=fg(e,t,r),r=dg(e,t,r),r=mg(e,t,r),r=Ny(e,t,r,n);const a=new eg(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=a.getGlobalProperty("RTC_CENTER",Qm.FLOAT,3),r}(e,t,r,n),await zy(e,Ly,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 qy(e,t,r,n,i){return r=function(e,t,r,n,i){if(r=fg(e,t,r),1!==e.version)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);r=dg(e,t,r);const a=new DataView(t);if(e.gltfFormat=a.getUint32(r,!0),r=mg(e,t,r+=4),r=Ny(e,t,r,n),0===e.featureTableJsonByteLength)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");const o=new eg(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",Qm.FLOAT,3);new pg(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",Qm.FLOAT,3,r,a);else if(t.hasProperty("POSITION_QUANTIZED")){n=t.getProperty("POSITION_QUANTIZED",Qm.UNSIGNED_SHORT,3,r,a);const e=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Qm.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",Qm.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",Qm.FLOAT,3,r,d),e.normalRight=t.getProperty("NORMAL_RIGHT",Qm.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",Qm.UNSIGNED_SHORT,2,d),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",Qm.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",Qm.FLOAT,1,r);Number.isFinite(v)&&h.multiplyByScalar(v);const w=t.getProperty("SCALE_NON_UNIFORM",Qm.FLOAT,3,r,d);w&&h.scale(w),p.scale=h;let _=t.getProperty("BATCH_ID",Qm.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 zy(e,e.gltfFormat,n,i),r}async function Hy(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 Am.COMPOSITE:return await async function(e,t,r,n,i,a){r=fg(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,Hy);case Am.BATCHED_3D_MODEL:return await Uy(i,e,t,r,n);case Am.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,My,r,n)}(i,e,r,n);case Am.INSTANCED_3D_MODEL:return await qy(i,e,t,r,n);case Am.POINT_CLOUD:return await Sg(i,e,t,r,n);default:throw new Error("3DTileLoader: unknown type "+i.type)}}async function Gy(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 Vy(e){const t=new DataView(e);return t.getUint32(0,!0)+2**32*t.getUint32(4,!0)}const Wy={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:"3.2.4",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=Vy(e.slice(8,16)),r=new Uint8Array(e,24,t),n=new TextDecoder("utf8").decode(r),i=JSON.parse(n),a=Vy(e.slice(16,24));let o=new ArrayBuffer(0);return a&&(o=e.slice(24+t)),"bufferView"in i.tileAvailability&&(i.tileAvailability.explicitBitstream=await Gy(i,"tileAvailability",o)),"bufferView"in i.contentAvailability&&(i.contentAvailability.explicitBitstream=await Gy(i,"contentAvailability",o)),"bufferView"in i.childSubtreeAvailability&&(i.childSubtreeAvailability.explicitBitstream=await Gy(i,"childSubtreeAvailability",o)),i},options:{}},Ky={QUADTREE:4,OCTREE:8};function Jy(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 Qy(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 Yy(e,t){return parseInt(e.toString(2)+t.toString(2),2)}function $y(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 Xy(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 Zy(e){switch(e){case"REPLACE":case"replace":return Zp;case"ADD":case"add":return Xp;default:return e}}function eb(e,t){if(!e)return null;if(e.content){const r=e.content.uri||e.content.url;e.contentUrl=`${t.basePath}/${r}`}return e.id=e.contentUrl,e.lodMetricType=sf,e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform,e.type=Xy(e),e.refine=Zy(e.refine),e}async function tb(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=`${t}/${$y(o,0,0,0,0)}`,u=await $o(s,Wy),c=`${t}/${e.root.content.uri}`,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:Xy,getRefine:Zy};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=Ky[u],g=1&i,y=i>>1&1,b=i>>2&1,v=(m**s-1)/(m-1);let w=Yy(n.mortonIndex,i),_=v+w,k=Yy(n.x,g),x=Yy(n.y,y),E=Yy(n.z,b),A=!1;s+1>c&&(A=Jy(o.childSubtreeAvailability,w));const S=Yy(a.x,k),j=Yy(a.y,x),T=Yy(a.z,E),C=s+a.level;if(A){const e=$y(`${f}/${p}`,C,S,j,T);o=await $o(e,Wy),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(!Jy(o.tileAvailability,_)||s>l)return d;Jy(o.contentAvailability,_)&&(d.contentUrl=$y(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=Qy(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=Zy(e.refine),e.type=Xy(e),e.children=n,e.id=e.contentUrl,e}(e.root,u,f)}const rb={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:"3.2.4",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||rb,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 tb(a):function(e){const t=e.basePath,r=eb(e.root,e),n=[];for(n.push(r);n.length>0;){const e=(n.pop()||{}).children||[];for(const r of e)eb(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 Hy(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 nb(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 ib={...rb,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 nb(r,n)},parse:async(e,t,r)=>((t={...t})["3d-tiles"]=t["cesium-ion"],t.loader=ib,rb.parse(e,t,r)),options:{"cesium-ion":{...rb.options["3d-tiles"],accessToken:null}}};var ab=r(10),ob=r.n(ab);const sb=new Uint8Array(256);let ub=sb.length;function cb(){return ub>sb.length-16&&(ob.a.randomFillSync(sb),ub=0),sb.slice(ub,ub+=16)}var lb=/^(?:[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 hb=function(e){return"string"==typeof e&&lb.test(e)};const pb=[];for(let e=0;e<256;++e)pb.push((e+256).toString(16).substr(1));var fb=function(e,t=0){const r=(pb[e[t+0]]+pb[e[t+1]]+pb[e[t+2]]+pb[e[t+3]]+"-"+pb[e[t+4]]+pb[e[t+5]]+"-"+pb[e[t+6]]+pb[e[t+7]]+"-"+pb[e[t+8]]+pb[e[t+9]]+"-"+pb[e[t+10]]+pb[e[t+11]]+pb[e[t+12]]+pb[e[t+13]]+pb[e[t+14]]+pb[e[t+15]]).toLowerCase();if(!hb(r))throw TypeError("Stringified UUID is invalid");return r};var db=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 fb(n)},mb=r(81),gb=r.n(mb);function yb(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class bb{constructor(e,t){yb(this,"nodesPerPage",void 0),yb(this,"nodesCounter",void 0),yb(this,"writeFile",void 0),yb(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");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;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());t.enqueue({writePromise:this.writeFile(a,i)})}}}const vb={};class wb extends ms{static get ZERO(){return vb.ZERO=vb.ZERO||Object.freeze(new wb(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 _b(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=kb("positions",r,n),a=kb("normals",r,n),f=kb("colors",r,n),d=kb("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 kb(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 xb(e){const t={};for(const r in e)t[r]={value:e[r].value};return t}const Eb=["CUSTOM_ATTRIBUTE_2","_BATCHID","BATCHID"];let Ab=new Is;async function Sb(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(Fb(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:xb(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});Tb(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=Um(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),Ab),Ab[2]=Ab[2]-t.getHeight(Ab[1],Ab[0]),Ab=Ab.subtract(n),r.positions.set(Ab,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 jb({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 jb({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}=_b(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=Hb(i,t,r);n[a.toString()]=o}return n}(e,n,r);Gb(t,i),Gb(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 rm({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=Vb(e,r);let a=null;switch(t){case"Oid32":case"Int32":a=Wb(i[e]);break;case"Float64":a=Kb(i[e]);break;case"string":a=Jb(i[e]);break;default:a=Jb(i[e])}a&&n.push(a)}}return n}(n.batchTableJson,f,o);return{geometry:_,compressedGeometry:k,texture:r,sharedResources:Nb((null===(c=n.gltf)||void 0===c?void 0:c.materials)||[],i),meshMaterial:t,vertexCount:h,attributes:x,featureCount:b,boundingVolumes:l}}function Tb(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)Cb(o,t,r,n,i,a)}function Cb(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,Bb({vertices:p.POSITION.value,cartographicOrigin:t,cartesianModelMatrix:r,nodeMatrix:a,indices:null===(o=h.indices)||void 0===o?void 0:o.value,attributeSpecificTransformation:Rb,useCartesianPositions:i})),e.normals=Ka(e.normals,Bb({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:Ob,useCartesianPositions:!1})),e.texCoords=Ka(e.texCoords,Ib(p.TEXCOORD_0&&p.TEXCOORD_0.value,null===(u=h.indices)||void 0===u?void 0:u.value)),e.colors=Ka(e.colors,Pb(p.COLOR_0,null===(c=h.indices)||void 0===c?void 0:c.value)),e.featureIndicesGroups=e.featureIndicesGroups||[],e.featureIndicesGroups.push(Db(Mb(p),null===(l=h.indices)||void 0===l?void 0:l.value)))}}(s,t,r,n,i,o),Tb(e.children||[],t,r,n,i,o)}function Bb(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 Rb(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 Ob(e,t){const{cartesianModelMatrix:r,nodeMatrix:n}=t;return n&&(e=e.transformAsVector(n)),e=e.transformAsVector(r)}function Ib(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 Pb(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 Db(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 Mb(e){let t=[];for(let r=0;r<Eb.length;r++){const n=Eb[r];if(e[n]&&e[n].value){t=e[n].value;break}}return t}function Fb(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:Lb(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 Lb(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend";default:return"opaque"}}function Nb(e,t){const r={};if(!e||!e.length)return r;r.materialDefinitionInfos=[];for(const n of e){const{materialDefinitionInfo:e,textureDefinitionInfo:i}=zb(n,t);r.materialDefinitionInfos.push(e),i&&(r.textureDefinitionInfos=r.textureDefinitionInfos||[],r.textureDefinitionInfos.push(i))}return r}function zb(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:qb(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:Ub(s||[1,1,1,1],o),textureDefinitionInfo:i}}function Ub(e,t=1){const r=new wb(0,0,0,1),n=new wb(1,1,1,1),i=new wb(.04/255,.04/255,.04/255,0),a=new wb(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 qb(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 Hb(e,t,r){const n=function(e,t){let r="";for(const n in e)r+=e[n][t];return r}(t,e),i=gb()(n);return r.includes(i)?r.indexOf(i):r.push(i)-1}function Gb(e,t){for(let r=0;r<e.length;r++)e[r]=t[e[r]]}function Vb(e,t){return t.find(t=>t.name===e).attributeValues.valueType}function Wb(e){const t=new Uint32Array([e.length]),r=new Uint32Array(e);return Wa(t.buffer,r.buffer)}function Kb(e){const t=new Uint32Array([e.length]),r=new Uint8Array(4),n=new Float64Array(e);return Wa(t.buffer,r.buffer,n.buffer)}function Jb(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 Qb={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}}}}},Yb=()=>({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 $b(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 Xb(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 Zb(e,t){if(!e)throw new Error(t||"luma.gl: assertion failed.")}const ev={};function tv(e="id"){ev[e]=ev[e]||1;const t=ev[e]++;return"".concat(e,"-").concat(t)}const rv={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};const nv=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]),iv=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]),av=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]),ov=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]),sv={POSITION:{size:3,value:new Float32Array(iv)},NORMAL:{size:3,value:new Float32Array(av)},TEXCOORD_0:{size:2,value:new Float32Array(ov)}};class uv extends class{static get DRAW_MODE(){return rv}constructor(e={}){const{id:t=tv("geometry"),drawMode:r=rv.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,Zb(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?(Zb(!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 Zb(Number.isFinite(r)),r}}{constructor(e={}){const{id:t=tv("cube-geometry")}=e;super({...e,id:t,indices:{size:1,value:new Uint16Array(nv)},attributes:{...sv,...e.attributes}})}}function cv(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 uv,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=lv(t.mbs),n=lv(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 lv(e){return new bh([e[0],e[1],e[2]],e[3])}const hv={name:"Basis Universal Supercompressed GPU Texture",id:Oi?"ktx2-basis-writer":"ktx2-basis-writer-nodejs",module:"textures",version:"3.2.4",extensions:["ktx2"],worker:!0,options:{useSRGB:!1,qualityLevel:10,encodeUASTC:!1,mipmaps:!1}},{_encodeImageNode:pv}=globalThis;let fv=!0;const dv={name:"Images",id:"image",module:"images",version:"3.2.4",extensions:["jpeg"],options:{image:{mimeType:"image/png",jpegQuality:null}},encode:async function(e,t){return(t=t||{}).image=t.image||{},pv?pv(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&&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 mv extends Array{enqueue(e){this.push(e)}dequeue(){return this.shift()}peek(){return this[0]}isEmpty(){return 0===this.length}}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}class yv extends mv{constructor(e=2e3,t=400){super(),gv(this,"intervalId",void 0),gv(this,"writePromise",null),gv(this,"fileMap",{}),gv(this,"listeningInterval",void 0),gv(this,"writeConcurrency",void 0),this.listeningInterval=e,this.writeConcurrency=t}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 bv={id:"i3s-attributes",name:"I3S Attributes Worker",module:"tile-converter",version:"3.2.4",options:{useCartesianPositions:!1}};var vv;function wv(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const _v=(null===(vv=Ci.a.env)||void 0===vv?void 0:vv.IonToken)||"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ";class kv{constructor(){wv(this,"nodePages",void 0),wv(this,"options",void 0),wv(this,"layers0Path",void 0),wv(this,"materialMap",void 0),wv(this,"materialDefinitions",void 0),wv(this,"vertexCounter",void 0),wv(this,"layers0",void 0),wv(this,"featuresHashArray",void 0),wv(this,"refinementCounter",void 0),wv(this,"validate",void 0),wv(this,"boundingVolumeWarnings",[]),wv(this,"conversionStartTime",[0,0]),wv(this,"refreshTokenTime",[0,0]),wv(this,"sourceTileset",null),wv(this,"geoidHeightModel",null),wv(this,"Loader",rb),wv(this,"generateTextures",void 0),wv(this,"generateBoundingVolumes",void 0),wv(this,"layersHasTexture",void 0),wv(this,"workerSource",{}),wv(this,"writeQueue",new yv),this.nodePages=new bb(Vd,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(Gm),Gm;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://")?ib:rb,this.generateTextures=Boolean(h),this.generateBoundingVolumes=Boolean(p),this.writeQueue=new yv,this.writeQueue.startListening(),console.log("Loading egm file..."),this.geoidHeightModel=await $o(n,Cd),console.log("Loading egm file completed!"),r&&this.nodePages.useWriteFunction(Wd),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 _d(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 Kd(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=zm(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:db().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 Vd(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:`{${db().toUpperCase()}}`,id:0,name:e,href:"./layers/0",store:{id:`{${db().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,Qb)},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:`{${db().toUpperCase()}}`,id:"root",level:0,lodSelection:[{metricType:"maxScreenThresholdSQ",maxError:0},{metricType:"maxScreenThreshold",maxError:0}],...e,children:[]};return Ri()(t,Yb())}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?this.writeQueue.enqueue({archiveKey:"nodes/1/3dNodeIndexDocument.json.gz",writePromise:Wd(a,JSON.stringify(i),"3dNodeIndexDocument.json")}):this.writeQueue.enqueue({writePromise:Vd(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?this.writeQueue.enqueue({archiveKey:"3dSceneLayer.json.gz",writePromise:Wd(this.layers0Path,JSON.stringify(this.layers0),"3dSceneLayer.json")}):this.writeQueue.enqueue({writePromise:Vd(this.layers0Path,JSON.stringify(this.layers0))})}async _writeNodeIndexDocument(e,t,r){this.options.slpk?this.writeQueue.enqueue({archiveKey:`nodes/${t}/3dNodeIndexDocument.json.gz`,writePromise:Wd(r,JSON.stringify(e),"3dNodeIndexDocument.json")}):this.writeQueue.enqueue({writePromise:Vd(r,JSON.stringify(e))})}async _createSlpk(e){if(this.options.slpk){const t=Object(ji.join)(e,"SceneServer","layers","0"),r=e+".slpk";await Gd(t,r,0,".",this.options.sevenZipExe);try{await Kd(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=zm(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=Rd(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=cv(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 Sb(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,Yb());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");this.writeQueue.enqueue({archiveKey:n+"/geometries/0.bin.gz",writePromise:Wd(t,e,"0.bin")})}else{const t=Object(ji.join)(r,"geometries/0/");this.writeQueue.enqueue({writePromise:Vd(t,e,"index.bin")})}if(this.options.draco)if(this.options.slpk){const e=Object(ji.join)(r,"geometries");this.writeQueue.enqueue({archiveKey:n+"/geometries/1.bin.gz",writePromise:Wd(e,t,"1.bin")})}else{const e=Object(ji.join)(r,"geometries/1/");this.writeQueue.enqueue({writePromise:Vd(e,t,"index.bin")})}}async _writeShared(e,t,r,n){if(!e)return;e.nodePath=n;const i=Ri()(e,{materialDefinitions:{path:"materialDefinitionInfos",transform:$b},textureDefinitions:{path:"textureDefinitionInfos",transform:Xb}}),a=JSON.stringify(i);if(this.options.slpk){const e=Object(ji.join)(t,"shared");this.writeQueue.enqueue({archiveKey:r+"/shared/sharedResource.json.gz",writePromise:Wd(e,a,"sharedResource.json")})}else{const e=Object(ji.join)(t,"shared/");this.writeQueue.enqueue({writePromise:Vd(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=rm(e.image,hv,{...hv.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=rm(e.image.data[0],dv);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;this.writeQueue.enqueue({archiveKey:`${i}/textures/${t}.${r}`,writePromise:Wd(a,e,`${t}.${r}`,o)})}else{const i=Object(ji.join)(n,`textures/${t}/`);this.writeQueue.enqueue({writePromise:Vd(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);this.writeQueue.enqueue({archiveKey:`${r}/attributes/${i}.bin.gz`,writePromise:Wd(e,a,"0.bin")})}else{const e=Object(ji.join)(t,`attributes/${i}/0`);this.writeQueue.enqueue({writePromise:Vd(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=gb()(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 $d(e),a=Yd(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||_v}},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(hv,{...la()}),t=await ia(e),r=await t.text();this.workerSource.ktx2=r}const e=Na(bv,{...la()}),t=await ia(e),r=await t.text();this.workerSource.I3SAttributes=r,console.log("Loading workers source completed!")}}const xv={id:"zip",module:"zip",name:"Zip Archive",version:"3.2.4",extensions:["zip"],mimeTypes:["application/zip"],category:"archive",tests:["PK"],options:{},parse:async function(e,t={}){const r=[],n={};try{const i=new Nd.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 Ev{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",xv,{});let r=process.cwd();e&&(r=Object(ji.join)(r,e)),await Vd(r,new Uint8Array(t["geoids/egm2008-5.pgm"]),"egm2008-5.pgm"),console.log("All dependencies were installed succesfully.")}}const Av={I3S:"I3S",_3DTILES:"3DTILES"};function Sv(){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 jv(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&&Sv();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=jv(n,e);break;case"--tileset":t.tileset=jv(n,e);break;case"--name":t.name=jv(n,e);break;case"--output":t.output=jv(n,e);break;case"--max-depth":t.maxDepth=function(e,t){const r=jv(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=jv(n,e);break;case"--egm":t.egm=jv(n,e);break;case"--token":t.token=jv(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":Sv();break;default:console.warn("Unknown option "+r),process.exit(0)}}),t}(e);if(t.installDependencies){return void(new Ev).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(Av).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 Av.I3S:(new Wm).convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,egmFilePath:e.egm});break;case Av._3DTILES:const t=new kv;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:Sv()}}(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}]);
|