@deck.gl/geo-layers 9.0.0-beta.8 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +2195 -1495
- package/dist/index.cjs +11 -9
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/mvt-layer/mvt-layer.d.ts +8 -8
- package/dist/mvt-layer/mvt-layer.d.ts.map +1 -1
- package/dist/mvt-layer/mvt-layer.js +0 -5
- package/dist/tile-3d-layer/tile-3d-layer.d.ts +15 -1
- package/dist/tile-3d-layer/tile-3d-layer.d.ts.map +1 -1
- package/dist/tile-layer/tile-layer.d.ts +11 -2
- package/dist/tile-layer/tile-layer.d.ts.map +1 -1
- package/dist/tile-layer/tile-layer.js +6 -3
- package/dist/tileset-2d/tileset-2d.d.ts +2 -0
- package/dist/tileset-2d/tileset-2d.d.ts.map +1 -1
- package/dist/tileset-2d/tileset-2d.js +5 -3
- package/dist.min.js +12 -12
- package/package.json +19 -19
- package/src/index.ts +2 -2
- package/src/mvt-layer/mvt-layer.ts +17 -16
- package/src/tile-layer/tile-layer.ts +22 -5
- package/src/tileset-2d/tileset-2d.ts +7 -4
package/dist.min.js
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['deck'] = factory();
|
|
6
6
|
else root['deck'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var sg=Object.create;var es=Object.defineProperty;var
|
|
8
|
-
`&&e[
|
|
9
|
-
`||e==="\r"}function
|
|
10
|
-
`);let t=new
|
|
11
|
-
`;function c0(e,t){let
|
|
7
|
+
"use strict";var __exports__=(()=>{var sg=Object.create;var es=Object.defineProperty;var ig=Object.getOwnPropertyDescriptor;var og=Object.getOwnPropertyNames;var ag=Object.getPrototypeOf,cg=Object.prototype.hasOwnProperty;var Tl=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var tt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),lt=(e,t)=>{for(var n in t)es(e,n,{get:t[n],enumerable:!0})},ts=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of og(t))!cg.call(e,s)&&s!==n&&es(e,s,{get:()=>t[s],enumerable:!(r=ig(t,s))||r.enumerable});return e},he=(e,t,n)=>(ts(e,t,"default"),n&&ts(n,t,"default")),O=(e,t,n)=>(n=e!=null?sg(ag(e)):{},ts(t||!e||!e.__esModule?es(n,"default",{value:e,enumerable:!0}):n,e)),lg=e=>ts(es({},"__esModule",{value:!0}),e);var Nt=tt(($S,_l)=>{_l.exports=globalThis.deck});var Dt=tt((eb,Bl)=>{Bl.exports=globalThis.deck});var rs=tt(ne=>{"use strict";var Cl=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",hg=Cl+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Sl="["+Cl+"]["+hg+"]*",fg=new RegExp("^"+Sl+"$"),dg=function(e,t){let n=[],r=t.exec(e);for(;r;){let s=[];s.startIndex=t.lastIndex-r[0].length;let i=r.length;for(let o=0;o<i;o++)s.push(r[o]);n.push(s),r=t.exec(e)}return n},pg=function(e){let t=fg.exec(e);return!(t===null||typeof t>"u")};ne.isExist=function(e){return typeof e<"u"};ne.isEmptyObject=function(e){return Object.keys(e).length===0};ne.merge=function(e,t,n){if(t){let r=Object.keys(t),s=r.length;for(let i=0;i<s;i++)n==="strict"?e[r[i]]=[t[r[i]]]:e[r[i]]=t[r[i]]}};ne.getValue=function(e){return ne.isExist(e)?e:""};ne.isName=pg;ne.getAllMatches=dg;ne.nameRegexp=Sl});var io=tt(Fl=>{"use strict";var so=rs(),mg={allowBooleanAttributes:!1,unpairedTags:[]};Fl.validate=function(e,t){t=Object.assign({},mg,t);let n=[],r=!1,s=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let i=0;i<e.length;i++)if(e[i]==="<"&&e[i+1]==="?"){if(i+=2,i=Ml(e,i),i.err)return i}else if(e[i]==="<"){let o=i;if(i++,e[i]==="!"){i=Il(e,i);continue}else{let a=!1;e[i]==="/"&&(a=!0,i++);let c="";for(;i<e.length&&e[i]!==">"&&e[i]!==" "&&e[i]!==" "&&e[i]!==`
|
|
8
|
+
`&&e[i]!=="\r";i++)c+=e[i];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),i--),!Bg(c)){let h;return c.trim().length===0?h="Invalid space after '<'.":h="Tag '"+c+"' is an invalid name.",st("InvalidTag",h,xt(e,i))}let l=xg(e,i);if(l===!1)return st("InvalidAttr","Attributes for '"+c+"' have open quote.",xt(e,i));let u=l.value;if(i=l.index,u[u.length-1]==="/"){let h=i-u.length;u=u.substring(0,u.length-1);let f=wl(u,t);if(f===!0)r=!0;else return st(f.err.code,f.err.msg,xt(e,h+f.err.line))}else if(a)if(l.tagClosed){if(u.trim().length>0)return st("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",xt(e,o));{let h=n.pop();if(c!==h.tagName){let f=xt(e,h.tagStartPos);return st("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+c+"'.",xt(e,o))}n.length==0&&(s=!0)}}else return st("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",xt(e,i));else{let h=wl(u,t);if(h!==!0)return st(h.err.code,h.err.msg,xt(e,i-u.length+h.err.line));if(s===!0)return st("InvalidXml","Multiple possible root nodes found.",xt(e,i));t.unpairedTags.indexOf(c)!==-1||n.push({tagName:c,tagStartPos:o}),r=!0}for(i++;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="!"){i++,i=Il(e,i);continue}else if(e[i+1]==="?"){if(i=Ml(e,++i),i.err)return i}else break;else if(e[i]==="&"){let h=_g(e,i);if(h==-1)return st("InvalidChar","char '&' is not expected.",xt(e,i));i=h}else if(s===!0&&!bl(e[i]))return st("InvalidXml","Extra text at the end",xt(e,i));e[i]==="<"&&i--}}else{if(bl(e[i]))continue;return st("InvalidChar","char '"+e[i]+"' is not expected.",xt(e,i))}if(r){if(n.length==1)return st("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",xt(e,n[0].tagStartPos));if(n.length>0)return st("InvalidXml","Invalid '"+JSON.stringify(n.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return st("InvalidXml","Start tag expected.",1);return!0};function bl(e){return e===" "||e===" "||e===`
|
|
9
|
+
`||e==="\r"}function Ml(e,t){let n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){let r=e.substr(n,t-n);if(t>5&&r==="xml")return st("InvalidXml","XML declaration allowed only at the start of the document.",xt(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function Il(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}var gg='"',Ag="'";function xg(e,t){let n="",r="",s=!1;for(;t<e.length;t++){if(e[t]===gg||e[t]===Ag)r===""?r=e[t]:r!==e[t]||(r="");else if(e[t]===">"&&r===""){s=!0;break}n+=e[t]}return r!==""?!1:{value:n,index:t,tagClosed:s}}var yg=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function wl(e,t){let n=so.getAllMatches(e,yg),r={};for(let s=0;s<n.length;s++){if(n[s][1].length===0)return st("InvalidAttr","Attribute '"+n[s][2]+"' has no space in starting.",kn(n[s]));if(n[s][3]!==void 0&&n[s][4]===void 0)return st("InvalidAttr","Attribute '"+n[s][2]+"' is without value.",kn(n[s]));if(n[s][3]===void 0&&!t.allowBooleanAttributes)return st("InvalidAttr","boolean attribute '"+n[s][2]+"' is not allowed.",kn(n[s]));let i=n[s][2];if(!Eg(i))return st("InvalidAttr","Attribute '"+i+"' is an invalid name.",kn(n[s]));if(!r.hasOwnProperty(i))r[i]=1;else return st("InvalidAttr","Attribute '"+i+"' is repeated.",kn(n[s]))}return!0}function Tg(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function _g(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,Tg(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function st(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function Eg(e){return so.isName(e)}function Bg(e){return so.isName(e)}function xt(e,t){let n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function kn(e){return e.startIndex+e[1].length}});var Rl=tt(oo=>{var vl={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e}},Cg=function(e){return Object.assign({},vl,e)};oo.buildOptions=Cg;oo.defaultOptions=vl});var Pl=tt((ob,Ll)=>{"use strict";var ao=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,[":@"]:t[":@"]}):this.child.push({[t.tagname]:t.child})}};Ll.exports=ao});var Nl=tt((ab,Ol)=>{var Sg=rs();function bg(e,t){let n={};if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let r=1,s=!1,i=!1,o="";for(;t<e.length;t++)if(e[t]==="<"&&!i){if(s&&wg(e,t))t+=7,[entityName,val,t]=Mg(e,t+1),val.indexOf("&")===-1&&(n[Lg(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(s&&Fg(e,t))t+=8;else if(s&&vg(e,t))t+=8;else if(s&&Rg(e,t))t+=9;else if(Ig)i=!0;else throw new Error("Invalid DOCTYPE");r++,o=""}else if(e[t]===">"){if(i?e[t-1]==="-"&&e[t-2]==="-"&&(i=!1,r--):r--,r===0)break}else e[t]==="["?s=!0:o+=e[t];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:t}}function Mg(e,t){let n="";for(;t<e.length&&e[t]!=="'"&&e[t]!=='"';t++)n+=e[t];if(n=n.trim(),n.indexOf(" ")!==-1)throw new Error("External entites are not supported");let r=e[t++],s="";for(;t<e.length&&e[t]!==r;t++)s+=e[t];return[n,s,t]}function Ig(e,t){return e[t+1]==="!"&&e[t+2]==="-"&&e[t+3]==="-"}function wg(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="N"&&e[t+4]==="T"&&e[t+5]==="I"&&e[t+6]==="T"&&e[t+7]==="Y"}function Fg(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="L"&&e[t+4]==="E"&&e[t+5]==="M"&&e[t+6]==="E"&&e[t+7]==="N"&&e[t+8]==="T"}function vg(e,t){return e[t+1]==="!"&&e[t+2]==="A"&&e[t+3]==="T"&&e[t+4]==="T"&&e[t+5]==="L"&&e[t+6]==="I"&&e[t+7]==="S"&&e[t+8]==="T"}function Rg(e,t){return e[t+1]==="!"&&e[t+2]==="N"&&e[t+3]==="O"&&e[t+4]==="T"&&e[t+5]==="A"&&e[t+6]==="T"&&e[t+7]==="I"&&e[t+8]==="O"&&e[t+9]==="N"}function Lg(e){if(Sg.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}Ol.exports=bg});var Ul=tt((cb,Dl)=>{var Pg=/^[-+]?0x[a-fA-F0-9]+$/,Og=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);var Ng={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Dg(e,t={}){if(t=Object.assign({},Ng,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(t.hex&&Pg.test(n))return Number.parseInt(n,16);{let r=Og.exec(n);if(r){let s=r[1],i=r[2],o=Ug(r[3]),a=r[4]||r[6];if(!t.leadingZeros&&i.length>0&&s&&n[2]!==".")return e;if(!t.leadingZeros&&i.length>0&&!s&&n[1]!==".")return e;{let c=Number(n),l=""+c;return l.search(/[eE]/)!==-1||a?t.eNotation?c:e:n.indexOf(".")!==-1?l==="0"&&o===""||l===o||s&&l==="-"+o?c:e:i?o===l||s+o===l?c:e:n===l||n===s+l?c:e}}else return e}}function Ug(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substr(0,e.length-1))),e}Dl.exports=Dg});var Hl=tt((lb,Vl)=>{"use strict";var Gl=rs(),Jn=Pl(),Gg=Nl(),Vg=Ul(),co=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,r)=>String.fromCharCode(Number.parseInt(r,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>String.fromCharCode(Number.parseInt(r,16))}},this.addExternalEntities=Hg,this.parseXml=jg,this.parseTextData=zg,this.resolveNameSpace=kg,this.buildAttributesMap=qg,this.isItStopNode=Kg,this.replaceEntitiesValue=Wg,this.readStopNodeData=Zg,this.saveTextToParentTag=Yg,this.addChild=Xg}};function Hg(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function zg(e,t,n,r,s,i,o){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e));let a=this.options.tagValueProcessor(t,e,n,s,i);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?uo(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?uo(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function kg(e){if(this.options.removeNSPrefix){let t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}var Jg=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function qg(e,t,n){if(!this.options.ignoreAttributes&&typeof e=="string"){let r=Gl.getAllMatches(e,Jg),s=r.length,i={};for(let o=0;o<s;o++){let a=this.resolveNameSpace(r[o][1]),c=r[o][4],l=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c);let u=this.options.attributeValueProcessor(a,c,t);u==null?i[l]=c:typeof u!=typeof c||u!==c?i[l]=u:i[l]=uo(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[l]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){let o={};return o[this.options.attributesGroupName]=i,o}return i}}var jg=function(e){e=e.replace(/\r\n?/g,`
|
|
10
|
+
`);let t=new Jn("!xml"),n=t,r="",s="";for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){let a=Fe(e,">",i,"Closing Tag is not closed."),c=e.substring(i+2,a).trim();if(this.options.removeNSPrefix){let h=c.indexOf(":");h!==-1&&(c=c.substr(h+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&(r=this.saveTextToParentTag(r,n,s));let l=s.substring(s.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);let u=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(u=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):u=s.lastIndexOf("."),s=s.substring(0,u),n=this.tagsNodeStack.pop(),r="",i=a}else if(e[i+1]==="?"){let a=lo(e,i,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,s),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){let c=new Jn(a.tagName);c.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(c[":@"]=this.buildAttributesMap(a.tagExp,s,a.tagName)),this.addChild(n,c,s)}i=a.closeIndex+1}else if(e.substr(i+1,3)==="!--"){let a=Fe(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){let c=e.substring(i+4,a-2);r=this.saveTextToParentTag(r,n,s),n.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}i=a}else if(e.substr(i+1,2)==="!D"){let a=Gg(e,i);this.docTypeEntities=a.entities,i=a.i}else if(e.substr(i+1,2)==="!["){let a=Fe(e,"]]>",i,"CDATA is not closed.")-2,c=e.substring(i+9,a);r=this.saveTextToParentTag(r,n,s);let l=this.parseTextData(c,n.tagname,s,!0,!1,!0,!0);l==null&&(l=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]):n.add(this.options.textNodeName,l),i=a+2}else{let a=lo(e,i,this.options.removeNSPrefix),c=a.tagName,l=a.rawTagName,u=a.tagExp,h=a.attrExpPresent,f=a.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,s,!1));let d=n;if(d&&this.options.unpairedTags.indexOf(d.tagname)!==-1&&(n=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),c!==t.tagname&&(s+=s?"."+c:c),this.isItStopNode(this.options.stopNodes,s,c)){let p="";if(u.length>0&&u.lastIndexOf("/")===u.length-1)i=a.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)i=a.closeIndex;else{let g=this.readStopNodeData(e,l,f+1);if(!g)throw new Error(`Unexpected end of ${l}`);i=g.i,p=g.tagContent}let A=new Jn(c);c!==u&&h&&(A[":@"]=this.buildAttributesMap(u,s,c)),p&&(p=this.parseTextData(p,c,s,!0,h,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),A.add(this.options.textNodeName,p),this.addChild(n,A,s)}else{if(u.length>0&&u.lastIndexOf("/")===u.length-1){c[c.length-1]==="/"?(c=c.substr(0,c.length-1),s=s.substr(0,s.length-1),u=c):u=u.substr(0,u.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));let p=new Jn(c);c!==u&&h&&(p[":@"]=this.buildAttributesMap(u,s,c)),this.addChild(n,p,s),s=s.substr(0,s.lastIndexOf("."))}else{let p=new Jn(c);this.tagsNodeStack.push(n),c!==u&&h&&(p[":@"]=this.buildAttributesMap(u,s,c)),this.addChild(n,p,s),n=p}r="",i=f}}else r+=e[i];return t.child};function Xg(e,t,n){let r=this.options.updateTag(t.tagname,n,t[":@"]);r===!1||(typeof r=="string"&&(t.tagname=r),e.addChild(t))}var Wg=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){let n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){let n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){let n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function Yg(e,t,n,r){return e&&(r===void 0&&(r=Object.keys(t.child).length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,r),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function Kg(e,t,n){let r="*."+n;for(let s in e){let i=e[s];if(r===i||t===i)return!0}return!1}function Qg(e,t,n=">"){let r,s="";for(let i=t;i<e.length;i++){let o=e[i];if(r)o===r&&(r="");else if(o==='"'||o==="'")r=o;else if(o===n[0])if(n[1]){if(e[i+1]===n[1])return{data:s,index:i}}else return{data:s,index:i};else o===" "&&(o=" ");s+=o}}function Fe(e,t,n,r){let s=e.indexOf(t,n);if(s===-1)throw new Error(r);return s+t.length-1}function lo(e,t,n,r=">"){let s=Qg(e,t+1,r);if(!s)return;let i=s.data,o=s.index,a=i.search(/\s/),c=i,l=!0;a!==-1&&(c=i.substring(0,a),i=i.substring(a+1).trimStart());let u=c;if(n){let h=c.indexOf(":");h!==-1&&(c=c.substr(h+1),l=c!==s.data.substr(h+1))}return{tagName:c,tagExp:i,closeIndex:o,attrExpPresent:l,rawTagName:u}}function Zg(e,t,n){let r=n,s=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){let i=Fe(e,">",n,`${t} is not closed`);if(e.substring(n+2,i).trim()===t&&(s--,s===0))return{tagContent:e.substring(r,n),i};n=i}else if(e[n+1]==="?")n=Fe(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=Fe(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=Fe(e,"]]>",n,"StopNode is not closed.")-2;else{let i=lo(e,n,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&s++,n=i.closeIndex)}}function uo(e,t,n){if(t&&typeof e=="string"){let r=e.trim();return r==="true"?!0:r==="false"?!1:Vg(e,n)}else return Gl.isExist(e)?e:""}Vl.exports=co});var Jl=tt(kl=>{"use strict";function $g(e,t){return zl(e,t)}function zl(e,t,n){let r,s={};for(let i=0;i<e.length;i++){let o=e[i],a=t0(o),c="";if(n===void 0?c=a:c=n+"."+a,a===t.textNodeName)r===void 0?r=o[a]:r+=""+o[a];else{if(a===void 0)continue;if(o[a]){let l=zl(o[a],t,c),u=n0(l,t);o[":@"]?e0(l,o[":@"],c,t):Object.keys(l).length===1&&l[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?l=l[t.textNodeName]:Object.keys(l).length===0&&(t.alwaysCreateTextNode?l[t.textNodeName]="":l=""),s[a]!==void 0&&s.hasOwnProperty(a)?(Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(l)):t.isArray(a,c,u)?s[a]=[l]:s[a]=l}}}return typeof r=="string"?r.length>0&&(s[t.textNodeName]=r):r!==void 0&&(s[t.textNodeName]=r),s}function t0(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(r!==":@")return r}}function e0(e,t,n,r){if(t){let s=Object.keys(t),i=s.length;for(let o=0;o<i;o++){let a=s[o];r.isArray(a,n+"."+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function n0(e,t){let{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}kl.prettify=$g});var jl=tt((hb,ql)=>{var{buildOptions:r0}=Rl(),s0=Hl(),{prettify:i0}=Jl(),o0=io(),ho=class{constructor(t){this.externalEntities={},this.options=r0(t)}parse(t,n){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});let i=o0.validate(t,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let r=new s0(this.options);r.addExternalEntities(this.externalEntities);let s=r.parseXml(t);return this.options.preserveOrder||s===void 0?s:i0(s,this.options)}addEntity(t,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}};ql.exports=ho});var Ql=tt((fb,Kl)=>{var a0=`
|
|
11
|
+
`;function c0(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=a0),Wl(e,t,"",n)}function Wl(e,t,n,r){let s="",i=!1;for(let o=0;o<e.length;o++){let a=e[o],c=l0(a);if(c===void 0)continue;let l="";if(n.length===0?l=c:l=`${n}.${c}`,c===t.textNodeName){let p=a[c];u0(l,t)||(p=t.tagValueProcessor(c,p),p=Yl(p,t)),i&&(s+=r),s+=p,i=!1;continue}else if(c===t.cdataPropName){i&&(s+=r),s+=`<![CDATA[${a[c][0][t.textNodeName]}]]>`,i=!1;continue}else if(c===t.commentPropName){s+=r+`<!--${a[c][0][t.textNodeName]}-->`,i=!0;continue}else if(c[0]==="?"){let p=Xl(a[":@"],t),A=c==="?xml"?"":r,g=a[c][0][t.textNodeName];g=g.length!==0?" "+g:"",s+=A+`<${c}${g}${p}?>`,i=!0;continue}let u=r;u!==""&&(u+=t.indentBy);let h=Xl(a[":@"],t),f=r+`<${c}${h}`,d=Wl(a[c],t,l,u);t.unpairedTags.indexOf(c)!==-1?t.suppressUnpairedNode?s+=f+">":s+=f+"/>":(!d||d.length===0)&&t.suppressEmptyNode?s+=f+"/>":d&&d.endsWith(">")?s+=f+`>${d}${r}</${c}>`:(s+=f+">",d&&r!==""&&(d.includes("/>")||d.includes("</"))?s+=r+t.indentBy+d+r:s+=d,s+=`</${c}>`),i=!0}return s}function l0(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(e.hasOwnProperty(r)&&r!==":@")return r}}function Xl(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let s=t.attributeValueProcessor(r,e[r]);s=Yl(s,t),s===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${s}"`}return n}function u0(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(".")+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]==="*."+n)return!0;return!1}function Yl(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){let r=t.entities[n];e=e.replace(r.regex,r.val)}return e}Kl.exports=c0});var $l=tt((db,Zl)=>{"use strict";var h0=Ql(),f0={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function fe(e){this.options=Object.assign({},f0,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=m0),this.processTextOrObjNode=d0,this.options.format?(this.indentate=p0,this.tagEndChar=`>
|
|
12
12
|
`,this.newLine=`
|
|
13
|
-
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}pe.prototype.build=function(e){return this.options.preserveOrder?u0(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)};pe.prototype.j2x=function(e,t){let r="",n="";for(let s in e)if(typeof e[s]>"u")this.isAttribute(s)&&(n+="");else if(e[s]===null)this.isAttribute(s)?n+="":s[0]==="?"?n+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)n+=this.buildTextValNode(e[s],s,"",t);else if(typeof e[s]!="object"){let o=this.isAttribute(s);if(o)r+=this.buildAttrPairStr(o,""+e[s]);else if(s===this.options.textNodeName){let i=this.options.tagValueProcessor(s,""+e[s]);n+=this.replaceEntitiesValue(i)}else n+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){let o=e[s].length,i="";for(let a=0;a<o;a++){let c=e[s][a];typeof c>"u"||(c===null?s[0]==="?"?n+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(t)+"<"+s+"/"+this.tagEndChar:typeof c=="object"?this.options.oneListGroup?i+=this.j2x(c,t+1).val:i+=this.processTextOrObjNode(c,s,t):i+=this.buildTextValNode(c,s,"",t))}this.options.oneListGroup&&(i=this.buildObjectNode(i,s,"",t)),n+=i}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){let o=Object.keys(e[s]),i=o.length;for(let a=0;a<i;a++)r+=this.buildAttrPairStr(o[a],""+e[s][o[a]])}else n+=this.processTextOrObjNode(e[s],s,t);return{attrStr:r,val:n}};pe.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function d0(e,t,r){let n=this.j2x(e,r+1);return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,n.attrStr,r):this.buildObjectNode(n.val,t,n.attrStr,r)}pe.prototype.buildObjectNode=function(e,t,r,n){if(e==="")return t[0]==="?"?this.indentate(n)+"<"+t+r+"?"+this.tagEndChar:this.indentate(n)+"<"+t+r+this.closeTag(t)+this.tagEndChar;{let s="</"+t+this.tagEndChar,o="";return t[0]==="?"&&(o="?",s=""),(r||r==="")&&e.indexOf("<")===-1?this.indentate(n)+"<"+t+r+o+">"+e+s:this.options.commentPropName!==!1&&t===this.options.commentPropName&&o.length===0?this.indentate(n)+`<!--${e}-->`+this.newLine:this.indentate(n)+"<"+t+r+o+this.tagEndChar+e+this.indentate(n)+s}};pe.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};pe.prototype.buildTextValNode=function(e,t,r,n){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(n)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(n)+"<"+t+r+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(t,e);return s=this.replaceEntitiesValue(s),s===""?this.indentate(n)+"<"+t+r+this.closeTag(t)+this.tagEndChar:this.indentate(n)+"<"+t+r+">"+s+"</"+t+this.tagEndChar}};pe.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){let r=this.options.entities[t];e=e.replace(r.regex,r.val)}return e};function p0(e){return this.options.indentBy.repeat(e)}function m0(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}Zl.exports=pe});var eh=et((gM,th)=>{"use strict";var g0=ai(),A0=jl(),x0=$l();th.exports={XMLParser:A0,XMLValidator:g0,XMLBuilder:x0}});var ga=et((Du,cn)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof _l=="function"&&typeof cn=="object"&&cn&&cn.exports?cn.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(Du,function(){"use strict";function e(T,m,b){this.low=T|0,this.high=m|0,this.unsigned=!!b}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function t(T){return(T&&T.__isLong__)===!0}e.isLong=t;var r={},n={};function s(T,m){var b,L,R;return m?(T>>>=0,(R=0<=T&&T<256)&&(L=n[T],L)?L:(b=i(T,(T|0)<0?-1:0,!0),R&&(n[T]=b),b)):(T|=0,(R=-128<=T&&T<128)&&(L=r[T],L)?L:(b=i(T,T<0?-1:0,!1),R&&(r[T]=b),b))}e.fromInt=s;function o(T,m){if(isNaN(T)||!isFinite(T))return m?y:g;if(m){if(T<0)return y;if(T>=d)return M}else{if(T<=-p)return w;if(T+1>=p)return S}return T<0?o(-T,m).neg():i(T%f|0,T/f|0,m)}e.fromNumber=o;function i(T,m,b){return new e(T,m,b)}e.fromBits=i;var a=Math.pow;function c(T,m,b){if(T.length===0)throw Error("empty string");if(T==="NaN"||T==="Infinity"||T==="+Infinity"||T==="-Infinity")return g;if(typeof m=="number"?(b=m,m=!1):m=!!m,b=b||10,b<2||36<b)throw RangeError("radix");var L;if((L=T.indexOf("-"))>0)throw Error("interior hyphen");if(L===0)return c(T.substring(1),m,b).neg();for(var R=o(a(b,8)),F=g,v=0;v<T.length;v+=8){var W=Math.min(8,T.length-v),z=parseInt(T.substring(v,v+W),b);if(W<8){var Z=o(a(b,W));F=F.mul(Z).add(o(z))}else F=F.mul(R),F=F.add(o(z))}return F.unsigned=m,F}e.fromString=c;function l(T){return T instanceof e?T:typeof T=="number"?o(T):typeof T=="string"?c(T):i(T.low,T.high,T.unsigned)}e.fromValue=l;var h=1<<16,u=1<<24,f=h*h,d=f*f,p=d/2,A=s(u),g=s(0);e.ZERO=g;var y=s(0,!0);e.UZERO=y;var E=s(1);e.ONE=E;var _=s(1,!0);e.UONE=_;var B=s(-1);e.NEG_ONE=B;var S=i(-1,2147483647,!1);e.MAX_VALUE=S;var M=i(-1,-1,!0);e.MAX_UNSIGNED_VALUE=M;var w=i(0,-2147483648,!1);e.MIN_VALUE=w;var C=e.prototype;return C.toInt=function(){return this.unsigned?this.low>>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},C.toString=function(m){if(m=m||10,m<2||36<m)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(w)){var b=o(m),L=this.div(b),R=L.mul(b).sub(this);return L.toString(m)+R.toInt().toString(m)}else return"-"+this.neg().toString(m);for(var F=o(a(m,6),this.unsigned),v=this,W="";;){var z=v.div(F),Z=v.sub(z.mul(F)).toInt()>>>0,X=Z.toString(m);if(v=z,v.isZero())return X+W;for(;X.length<6;)X="0"+X;W=""+X+W}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var m=this.high!=0?this.high:this.low,b=31;b>0&&!(m&1<<b);b--);return this.high!=0?b+33:b+1},C.isZero=function(){return this.high===0&&this.low===0},C.isNegative=function(){return!this.unsigned&&this.high<0},C.isPositive=function(){return this.unsigned||this.high>=0},C.isOdd=function(){return(this.low&1)===1},C.isEven=function(){return(this.low&1)===0},C.equals=function(m){return t(m)||(m=l(m)),this.unsigned!==m.unsigned&&this.high>>>31===1&&m.high>>>31===1?!1:this.high===m.high&&this.low===m.low},C.eq=C.equals,C.notEquals=function(m){return!this.eq(m)},C.neq=C.notEquals,C.lessThan=function(m){return this.comp(m)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(m){return this.comp(m)<=0},C.lte=C.lessThanOrEqual,C.greaterThan=function(m){return this.comp(m)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(m){return this.comp(m)>=0},C.gte=C.greaterThanOrEqual,C.compare=function(m){if(t(m)||(m=l(m)),this.eq(m))return 0;var b=this.isNegative(),L=m.isNegative();return b&&!L?-1:!b&&L?1:this.unsigned?m.high>>>0>this.high>>>0||m.high===this.high&&m.low>>>0>this.low>>>0?-1:1:this.sub(m).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(E)},C.neg=C.negate,C.add=function(m){t(m)||(m=l(m));var b=this.high>>>16,L=this.high&65535,R=this.low>>>16,F=this.low&65535,v=m.high>>>16,W=m.high&65535,z=m.low>>>16,Z=m.low&65535,X=0,Y=0,tt=0,xt=0;return xt+=F+Z,tt+=xt>>>16,xt&=65535,tt+=R+z,Y+=tt>>>16,tt&=65535,Y+=L+W,X+=Y>>>16,Y&=65535,X+=b+v,X&=65535,i(tt<<16|xt,X<<16|Y,this.unsigned)},C.subtract=function(m){return t(m)||(m=l(m)),this.add(m.neg())},C.sub=C.subtract,C.multiply=function(m){if(this.isZero()||(t(m)||(m=l(m)),m.isZero()))return g;if(this.eq(w))return m.isOdd()?w:g;if(m.eq(w))return this.isOdd()?w:g;if(this.isNegative())return m.isNegative()?this.neg().mul(m.neg()):this.neg().mul(m).neg();if(m.isNegative())return this.mul(m.neg()).neg();if(this.lt(A)&&m.lt(A))return o(this.toNumber()*m.toNumber(),this.unsigned);var b=this.high>>>16,L=this.high&65535,R=this.low>>>16,F=this.low&65535,v=m.high>>>16,W=m.high&65535,z=m.low>>>16,Z=m.low&65535,X=0,Y=0,tt=0,xt=0;return xt+=F*Z,tt+=xt>>>16,xt&=65535,tt+=R*Z,Y+=tt>>>16,tt&=65535,tt+=F*z,Y+=tt>>>16,tt&=65535,Y+=L*Z,X+=Y>>>16,Y&=65535,Y+=R*z,X+=Y>>>16,Y&=65535,Y+=F*W,X+=Y>>>16,Y&=65535,X+=b*Z+L*z+R*W+F*v,X&=65535,i(tt<<16|xt,X<<16|Y,this.unsigned)},C.mul=C.multiply,C.divide=function(m){if(t(m)||(m=l(m)),m.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?y:g;var b,L,R;if(this.unsigned){if(m.unsigned||(m=m.toUnsigned()),m.gt(this))return y;if(m.gt(this.shru(1)))return _;R=y}else{if(this.eq(w)){if(m.eq(E)||m.eq(B))return w;if(m.eq(w))return E;var F=this.shr(1);return b=F.div(m).shl(1),b.eq(g)?m.isNegative()?E:B:(L=this.sub(m.mul(b)),R=b.add(L.div(m)),R)}else if(m.eq(w))return this.unsigned?y:g;if(this.isNegative())return m.isNegative()?this.neg().div(m.neg()):this.neg().div(m).neg();if(m.isNegative())return this.div(m.neg()).neg();R=g}for(L=this;L.gte(m);){b=Math.max(1,Math.floor(L.toNumber()/m.toNumber()));for(var v=Math.ceil(Math.log(b)/Math.LN2),W=v<=48?1:a(2,v-48),z=o(b),Z=z.mul(m);Z.isNegative()||Z.gt(L);)b-=W,z=o(b,this.unsigned),Z=z.mul(m);z.isZero()&&(z=E),R=R.add(z),L=L.sub(Z)}return R},C.div=C.divide,C.modulo=function(m){return t(m)||(m=l(m)),this.sub(this.div(m).mul(m))},C.mod=C.modulo,C.not=function(){return i(~this.low,~this.high,this.unsigned)},C.and=function(m){return t(m)||(m=l(m)),i(this.low&m.low,this.high&m.high,this.unsigned)},C.or=function(m){return t(m)||(m=l(m)),i(this.low|m.low,this.high|m.high,this.unsigned)},C.xor=function(m){return t(m)||(m=l(m)),i(this.low^m.low,this.high^m.high,this.unsigned)},C.shiftLeft=function(m){return t(m)&&(m=m.toInt()),(m&=63)===0?this:m<32?i(this.low<<m,this.high<<m|this.low>>>32-m,this.unsigned):i(0,this.low<<m-32,this.unsigned)},C.shl=C.shiftLeft,C.shiftRight=function(m){return t(m)&&(m=m.toInt()),(m&=63)===0?this:m<32?i(this.low>>>m|this.high<<32-m,this.high>>m,this.unsigned):i(this.high>>m-32,this.high>=0?0:-1,this.unsigned)},C.shr=C.shiftRight,C.shiftRightUnsigned=function(m){if(t(m)&&(m=m.toInt()),m&=63,m===0)return this;var b=this.high;if(m<32){var L=this.low;return i(L>>>m|b<<32-m,b>>>m,this.unsigned)}else return m===32?i(b,0,this.unsigned):i(b>>>m-32,0,this.unsigned)},C.shru=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},C.toBytes=function(T){return T?this.toBytesLE():this.toBytesBE()},C.toBytesLE=function(){var T=this.high,m=this.low;return[m&255,m>>>8&255,m>>>16&255,m>>>24&255,T&255,T>>>8&255,T>>>16&255,T>>>24&255]},C.toBytesBE=function(){var T=this.high,m=this.low;return[T>>>24&255,T>>>16&255,T>>>8&255,T&255,m>>>24&255,m>>>16&255,m>>>8&255,m&255]},e})});var zs=et((ER,pf)=>{pf.exports=globalThis.h3||{}});var wa=et((LR,yf)=>{yf.exports=globalThis.luma});var js=et((RR,Tf)=>{Tf.exports=globalThis.deck});var Ef=et((PR,_f)=>{_f.exports=globalThis.luma});var yr=et((nP,Vf)=>{Vf.exports=globalThis.loaders});var Tm=et((QG,ym)=>{ym.exports=globalThis.deck});var Fm=et(ll=>{ll.read=function(e,t,r,n,s){var o,i,a=s*8-n-1,c=(1<<a)-1,l=c>>1,h=-7,u=r?s-1:0,f=r?-1:1,d=e[t+u];for(u+=f,o=d&(1<<-h)-1,d>>=-h,h+=a;h>0;o=o*256+e[t+u],u+=f,h-=8);for(i=o&(1<<-h)-1,o>>=-h,h+=n;h>0;i=i*256+e[t+u],u+=f,h-=8);if(o===0)o=1-l;else{if(o===c)return i?NaN:(d?-1:1)*(1/0);i=i+Math.pow(2,n),o=o-l}return(d?-1:1)*i*Math.pow(2,o-n)};ll.write=function(e,t,r,n,s,o){var i,a,c,l=o*8-s-1,h=(1<<l)-1,u=h>>1,f=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,A=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=h):(i=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-i))<1&&(i--,c*=2),i+u>=1?t+=f/c:t+=f*Math.pow(2,1-u),t*c>=2&&(i++,c/=2),i+u>=h?(a=0,i=h):i+u>=1?(a=(t*c-1)*Math.pow(2,s),i=i+u):(a=t*Math.pow(2,u-1)*Math.pow(2,s),i=0));s>=8;e[r+d]=a&255,d+=p,a/=256,s-=8);for(i=i<<s|a,l+=s;l>0;e[r+d]=i&255,d+=p,i/=256,l-=8);e[r+d-p]|=A*128}});var Dm=et((V4,Nm)=>{"use strict";Nm.exports=J;var Zo=Fm();function J(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}J.Varint=0;J.Fixed64=1;J.Bytes=2;J.Fixed32=5;var hl=(1<<16)*(1<<16),Lm=1/hl,nS=12,Om=typeof TextDecoder>"u"?null:new TextDecoder("utf8");J.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),s=n>>3,o=this.pos;this.type=n&7,e(s,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=$o(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Pm(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=$o(this.buf,this.pos)+$o(this.buf,this.pos+4)*hl;return this.pos+=8,e},readSFixed64:function(){var e=$o(this.buf,this.pos)+Pm(this.buf,this.pos+4)*hl;return this.pos+=8,e},readFloat:function(){var e=Zo.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Zo.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,r,n;return n=t[this.pos++],r=n&127,n<128||(n=t[this.pos++],r|=(n&127)<<7,n<128)||(n=t[this.pos++],r|=(n&127)<<14,n<128)||(n=t[this.pos++],r|=(n&127)<<21,n<128)?r:(n=t[this.pos],r|=(n&15)<<28,sS(r,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=nS&&Om?xS(this.buf,t,e):AS(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==J.Bytes)return e.push(this.readVarint(t));var r=fe(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==J.Bytes)return e.push(this.readSVarint());var t=fe(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==J.Bytes)return e.push(this.readBoolean());var t=fe(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==J.Bytes)return e.push(this.readFloat());var t=fe(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==J.Bytes)return e.push(this.readDouble());var t=fe(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==J.Bytes)return e.push(this.readFixed32());var t=fe(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==J.Bytes)return e.push(this.readSFixed32());var t=fe(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==J.Bytes)return e.push(this.readFixed64());var t=fe(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==J.Bytes)return e.push(this.readSFixed64());var t=fe(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===J.Varint)for(;this.buf[this.pos++]>127;);else if(t===J.Bytes)this.pos=this.readVarint()+this.pos;else if(t===J.Fixed32)this.pos+=4;else if(t===J.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),Hr(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),Hr(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),Hr(this.buf,e&-1,this.pos),Hr(this.buf,Math.floor(e*Lm),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),Hr(this.buf,e&-1,this.pos),Hr(this.buf,Math.floor(e*Lm),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){oS(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=yS(this.buf,e,this.pos);var r=this.pos-t;r>=128&&Rm(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),Zo.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Zo.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;n>=128&&Rm(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,J.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,cS,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,lS,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,fS,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,hS,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,uS,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,dS,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,pS,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,mS,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,gS,t)},writeBytesField:function(e,t){this.writeTag(e,J.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,J.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,J.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,J.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,J.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,J.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,J.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,J.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,J.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,J.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function sS(e,t,r){var n=r.buf,s,o;if(o=n[r.pos++],s=(o&112)>>4,o<128||(o=n[r.pos++],s|=(o&127)<<3,o<128)||(o=n[r.pos++],s|=(o&127)<<10,o<128)||(o=n[r.pos++],s|=(o&127)<<17,o<128)||(o=n[r.pos++],s|=(o&127)<<24,o<128)||(o=n[r.pos++],s|=(o&1)<<31,o<128))return Vr(e,s,t);throw new Error("Expected varint not more than 10 bytes")}function fe(e){return e.type===J.Bytes?e.readVarint()+e.pos:e.pos+1}function Vr(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function oS(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),iS(r,n,t),aS(n,t)}function iS(e,t,r){r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos]=e&127}function aS(e,t){var r=(e&7)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function Rm(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(n);for(var s=r.pos-1;s>=e;s--)r.buf[s+n]=r.buf[s]}function cS(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function lS(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function hS(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function uS(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function fS(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function dS(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function pS(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function mS(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function gS(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function $o(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function Hr(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function Pm(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function AS(e,t,r){for(var n="",s=t;s<r;){var o=e[s],i=null,a=o>239?4:o>223?3:o>191?2:1;if(s+a>r)break;var c,l,h;a===1?o<128&&(i=o):a===2?(c=e[s+1],(c&192)===128&&(i=(o&31)<<6|c&63,i<=127&&(i=null))):a===3?(c=e[s+1],l=e[s+2],(c&192)===128&&(l&192)===128&&(i=(o&15)<<12|(c&63)<<6|l&63,(i<=2047||i>=55296&&i<=57343)&&(i=null))):a===4&&(c=e[s+1],l=e[s+2],h=e[s+3],(c&192)===128&&(l&192)===128&&(h&192)===128&&(i=(o&15)<<18|(c&63)<<12|(l&63)<<6|h&63,(i<=65535||i>=1114112)&&(i=null))),i===null?(i=65533,a=1):i>65535&&(i-=65536,n+=String.fromCharCode(i>>>10&1023|55296),i=56320|i&1023),n+=String.fromCharCode(i),s+=a}return n}function xS(e,t,r){return Om.decode(e.subarray(t,r))}function yS(e,t,r){for(var n=0,s,o;n<t.length;n++){if(s=t.charCodeAt(n),s>55295&&s<57344)if(o)if(s<56320){e[r++]=239,e[r++]=191,e[r++]=189,o=s;continue}else s=o-55296<<10|s-56320|65536,o=null;else{s>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):o=s;continue}else o&&(e[r++]=239,e[r++]=191,e[r++]=189,o=null);s<128?e[r++]=s:(s<2048?e[r++]=s>>6|192:(s<65536?e[r++]=s>>12|224:(e[r++]=s>>18|240,e[r++]=s>>12&63|128),e[r++]=s>>6&63|128),e[r++]=s&63|128)}return r}});var $n={};ut($n,{GeohashLayer:()=>Zn,GreatCircleLayer:()=>an,H3ClusterLayer:()=>xn,H3HexagonLayer:()=>Je,MVTLayer:()=>Qn,QuadkeyLayer:()=>hn,S2Layer:()=>ln,TerrainLayer:()=>Gn,Tile3DLayer:()=>Nn,TileLayer:()=>te,TripsLayer:()=>mn,_GeoCellLayer:()=>bt,_Tile2DHeader:()=>ze,_Tileset2D:()=>ke,_WMSLayer:()=>Ms,_getURLFromTemplate:()=>$t});var jt={},Bl=D(Dt(),1);de(jt,D(Dt(),1));if(!Bl.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");de($n,jt);var He=D(vt(),1),Pu=D(Dt(),1);function hg(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function rs(e){if(Array.isArray(e))return e.map(t=>rs(t));if(e&&typeof e=="object"){let t={};for(let[r,n]of Object.entries(e))t[hg(r)]=rs(n);return t}return e}var rh=D(eh(),1);function mi(e,t){if(t?._parser&&t._parser!=="fast-xml-parser")throw new Error(t?._parser);let r={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:t?.removeNSPrefix,textNodeName:t?.textNodeName,isArray:(s,o,i,a)=>Boolean(t?.arrayPaths?.some(l=>o===l)),...t?._fastXML},n=y0(e,r);return t?.uncapitalizeKeys?rs(n):n}function y0(e,t){return new rh.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var T0="4.2.0-alpha.4",Ut={name:"XML",id:"xml",module:"xml",version:T0,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:_0,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>mi(new TextDecoder().decode(e),{...Ut.options.xml,...t?.xml}),parseTextSync:(e,t)=>mi(e,{...Ut.options.xml,...t?.xml})};function _0(e){return e.startsWith("<?xml")}async function Bt(e,t,r,n){return n._parse(e,t,r,n)}function V(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var Xt={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},E0=Xt.self||Xt.window||Xt.global||{},B0=Xt.window||Xt.self||Xt.global||{},C0=Xt.global||Xt.self||Xt.window||{},S0=Xt.document||{};var Jr=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var nh=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),M0=nh&&parseFloat(nh[1])||0;function gi(e,t){return sh(e||{},t)}function sh(e,t,r=0){if(r>3)return t;let n={...e};for(let[s,o]of Object.entries(t))o&&typeof o=="object"&&!Array.isArray(o)?n[s]=sh(n[s]||{},t[s],r+1):n[s]=t[s];return n}function b0(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.0-alpha.4"),globalThis._loadersgl_.version}var oh=b0();function ih(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var Wt={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},bM=Wt.self||Wt.window||Wt.global||{},IM=Wt.window||Wt.self||Wt.global||{},wM=Wt.global||Wt.self||Wt.window||{},FM=Wt.document||{};var lr=typeof process!="object"||String(process)!=="[object process]"||process.browser,ss=typeof importScripts=="function",LM=typeof window<"u"&&typeof window.orientation<"u",ah=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),RM=ah&&parseFloat(ah[1])||0;var Ai={};async function Yt(e,t=null,r={},n=null){return t&&(e=ch(e,t,r,n)),Ai[e]=Ai[e]||I0(e),await Ai[e]}function ch(e,t,r={},n=null){if(!r.useLocalLibraries&&e.startsWith("http"))return e;n=n||e;let s=r.modules||{};return s[n]?s[n]:lr?r.CDN?(ih(r.CDN.startsWith("http")),`${r.CDN}/${t}@${oh}/dist/libs/${n}`):ss?`../src/libs/${n}`:`modules/${t}/src/libs/${n}`:`modules/${t}/dist/libs/${n}`}async function I0(e){if(e.endsWith("wasm"))return await F0(e);if(!lr)try{return Ct&&Ct.requireFromFile&&await Ct.requireFromFile(e)}catch(r){return console.error(r),null}if(ss)return importScripts(e);let t=await L0(e);return w0(t,e)}function w0(e,t){if(!lr)return Ct.requireFromString&&Ct.requireFromString(e,t);if(ss)return eval.call(globalThis,e),null;let r=document.createElement("script");r.id=t;try{r.appendChild(document.createTextNode(e))}catch{r.text=e}return document.body.appendChild(r),null}async function F0(e){return lr||!Ct.readFileAsArrayBuffer||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await Ct.readFileAsArrayBuffer(e)}async function L0(e){return lr||!Ct.readFileAsText||e.startsWith("http")?await(await fetch(e)).text():await Ct.readFileAsText(e)}function hh(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?lh(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?lh(e,0,t):""}function lh(e,t,r){if(e.byteLength<=t+r)return"";let n=new DataView(e),s="";for(let o=0;o<r;o++)s+=String.fromCharCode(n.getUint8(t+o));return s}function xi(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${hh(e)}"`)}}function qr(...e){let 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');let n=t.reduce((i,a)=>i+a.length,0),s=new r(n),o=0;for(let i of t)s.set(i,o),o+=i.length;return s}function Pe(e,t,r){let n=r!==void 0?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}function me(e,t){return V(e>=0),V(t>0),e+(t-1)&~(t-1)}function yi(e,t,r){let n;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else{let s=e.byteOffset,o=e.byteLength;n=new Uint8Array(e.buffer||e.arrayBuffer,s,o)}return t.set(n,r),r+me(n.byteLength,4)}function jr(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Oe=class{constructor(t,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=jr(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(jr()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var ge=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,r="count"){return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,s=this.stats[r];return s||(t instanceof Oe?s=t:s=new Oe(r,n),this.stats[r]=s),s}};var R0="Queued Requests",P0="Active Requests",O0="Cancelled Requests",N0="Queued Requests Ever",D0="Active Requests Ever",v0={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},Ae=class{constructor(t={}){this.activeRequestCount=0,this.requestQueue=[],this.requestMap=new Map,this.updateTimer=null,this.props={...v0,...t},this.stats=new ge({id:this.props.id}),this.stats.get(R0),this.stats.get(P0),this.stats.get(O0),this.stats.get(N0),this.stats.get(D0)}scheduleRequest(t,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let n={handle:t,priority:0,getPriority:r},s=new Promise(o=>(n.resolve=o,n));return this.requestQueue.push(n),this.requestMap.set(t,s),this._issueNewRequests(),s}_issueRequest(t){let{handle:r,resolve:n}=t,s=!1,o=()=>{s||(s=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,n?n({done:o}):Promise.resolve({done:o})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;r<t;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let t=this.requestQueue;for(let r=0;r<t.length;++r){let n=t[r];this._updateRequest(n)||(t.splice(r,1),this.requestMap.delete(n.handle),r--)}t.sort((r,n)=>r.priority-n.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var xe={};ut(xe,{dirname:()=>G0,filename:()=>U0,join:()=>V0,resolve:()=>H0});function uh(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function U0(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function G0(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function V0(...e){let t="/";return e=e.map((r,n)=>(n&&(r=r.replace(new RegExp(`^${t}`),"")),n!==e.length-1&&(r=r.replace(new RegExp(`${t}$`),"")),r)),e.join(t)}function H0(...e){let t=[];for(let o=0;o<e.length;o++)t[o]=e[o];let r="",n=!1,s;for(let o=t.length-1;o>=-1&&!n;o--){let i;o>=0?i=t[o]:(s===void 0&&(s=uh()),i=s),i.length!==0&&(r=`${i}/${r}`,n=i.charCodeAt(0)===Xr)}return r=z0(r,!n),n?`/${r}`:r.length>0?r:"."}var Xr=47,Ti=46;function z0(e,t){let r="",n=-1,s=0,o,i=!1;for(let a=0;a<=e.length;++a){if(a<e.length)o=e.charCodeAt(a);else{if(o===Xr)break;o=Xr}if(o===Xr){if(!(n===a-1||s===1))if(n!==a-1&&s===2){if(r.length<2||!i||r.charCodeAt(r.length-1)!==Ti||r.charCodeAt(r.length-2)!==Ti){if(r.length>2){let c=r.length-1,l=c;for(;l>=0&&r.charCodeAt(l)!==Xr;--l);if(l!==c){r=l===-1?"":r.slice(0,l),n=a,s=0,i=!1;continue}}else if(r.length===2||r.length===1){r="",n=a,s=0,i=!1;continue}}t&&(r.length>0?r+="/..":r="..",i=!0)}else{let c=e.slice(n+1,a);r.length>0?r+=`/${c}`:r=c,i=!1}n=a,s=0}else o===Ti&&s!==-1?++s:s=-1}return r}var os=class{constructor(t){this._needsRefresh=!0,this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=k0(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}};function k0(e){let t=e?.fetch;if(t&&typeof t=="function")return(n,s)=>t(n,s);let r=e?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var wt=class extends os{};wt.type="template";wt.testURL=e=>!1;function fh(e,t){let r=Ut.parseTextSync?.(e,t),n=r?.ServiceExceptionReport?.ServiceException||r?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof n=="string"?n:n.value||n.code||"Unknown error"}var J0="4.2.0-alpha.4",Wr={id:"wms-error",name:"WMS Error",module:"wms",version:J0,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:q0,options:{wms:{throwOnError:!1}},parse:async(e,t)=>_i(new TextDecoder().decode(e),t),parseSync:(e,t)=>_i(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>_i(e,t)};function q0(e){return e.startsWith("<?xml")}function _i(e,t){let r={...Wr.options.wms,...t?.wms},n=fh(e,r),s=r.minimalErrors?n:`WMS Service error: ${n}`;if(r.throwOnError)throw new Error(s);return s}function Ne(e){return Array.isArray(e)?e:e?[e]:[]}function Yr(e){let t=Ne(e);return t.length>0&&t.every(r=>typeof r=="string")?t:[]}function Kr(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseFloat(e);default:return}}function is(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseInt(e,10);default:return}}function De(e){switch(e){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function Ei(e,t){let r=Ut.parseTextSync?.(e,t),n=r.WMT_MS_Capabilities||r.WMS_Capabilities||r,s=j0(n);if(t?.inheritedLayerProps)for(let o of s.layers)ph(o,null);return t?.includeRawJSON&&(s.json=n),t?.includeXMLText&&(s.xml=e),s}function j0(e){let t={version:String(e.version||""),name:String(e.Service?.Name||"unnamed"),title:e.Service?.Title?String(e.Service?.Title):void 0,abstract:e.Service?.Abstract?String(e.Service?.Abstract):void 0,keywords:Yr(e.Service?.KeywordList?.Keyword),fees:e.Service?.Fees?JSON.stringify(e.Service?.Fees):void 0,accessConstraints:e.Service?.AccessConstraints?JSON.stringify(e.Service?.AccessConstraints):void 0,layerLimit:is(e.Service?.LayerLimit),maxWidth:is(e.Service?.maxWidth),maxHeight:is(e.Service?.maxHeight),layers:[],requests:X0(e.Capability?.Request),exceptions:W0(e.Exception)},r=Ne(e.Capability?.Layer);for(let n of r)t.layers.push(dh(n));for(let[n,s]of Object.entries(t))s===void 0&&delete t[n];return t}function X0(e){let t={};for(let[r,n]of Object.entries(e||{})){let s=Yr(n?.Format);t[r]={mimeTypes:s}}return t}function W0(e){if(Ne(e?.Format).length>0)return{mimeTypes:Yr(e)}}function dh(e){let t={title:String(e?.Title||""),name:e?.Name&&String(e?.Name),abstract:e?.Name&&String(e?.Abstract),keywords:Yr(e.KeywordList?.Keyword)},r=e?.CRS||e?.SRS;r&&Array.isArray(r)&&r.every(l=>typeof l=="string")&&(t.crs=r);let n=e?.EX_GeographicBoundingBox&&Y0(e?.EX_GeographicBoundingBox);n&&(t.geographicBoundingBox=n),n=e?.LatLonBoundingBox&&K0(e?.LatLonBoundingBox),n&&(t.geographicBoundingBox=n);let s=e?.BoundingBox&&Q0(e?.BoundingBox);s&&s.length>0&&(t.boundingBoxes=s);let i=Ne(e?.Dimension).map(l=>$0(l));i.length&&(t.dimensions=i),e?.opaque&&(t.opaque=De(e?.opaque)),e?.cascaded&&(t.cascaded=De(e?.cascaded)),e?.queryable&&(t.queryable=De(e?.queryable));let a=Ne(e?.Layer),c=[];for(let l of a)c.push(dh(l));c.length>0&&(t.layers=c);for(let[l,h]of Object.entries(t))h===void 0&&delete t[l];return t}function Y0(e){let{westBoundLongitude:t,northBoundLatitude:r,eastBoundLongitude:n,southBoundLatitude:s}=e;return[[t,s],[n,r]]}function K0(e){let{minx:t,miny:r,maxx:n,maxy:s}=e;return[[t,r],[n,s]]}function Q0(e){return Ne(e).map(r=>Z0(r))}function Z0(e){let{CRS:t,SRS:r,minx:n,miny:s,maxx:o,maxy:i,resx:a,resy:c}=e,l={crs:t||r,boundingBox:[[Kr(n),Kr(s)],[Kr(o),Kr(i)]]};return a&&(l.xResolution=a),c&&(l.yResolution=c),l}function $0(e){let{name:t,units:r,value:n}=e,s={name:t,units:r,extent:n};return e.unitSymbol&&(s.unitSymbol=e.unitSymbol),e.default&&(s.defaultValue=e.default),e.multipleValues&&(s.multipleValues=De(e.multipleValues)),e.nearestValue&&(s.nearestValue=De(e.nearestValue)),e.current&&(s.current=De(e.current)),s}function ph(e,t){t?.geographicBoundingBox&&!e.geographicBoundingBox&&(e.geographicBoundingBox=[...t.geographicBoundingBox]),t?.crs&&!e.crs&&(e.crs=[...t.crs]),t?.boundingBoxes&&!e.boundingBoxes&&(e.boundingBoxes=[...t.boundingBoxes]),t?.dimensions&&!e.dimensions&&(e.dimensions=[...t.dimensions]);for(let r of e.layers||[])ph(r,e)}var tA="4.2.0-alpha.4",hr={id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:tA,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:eA,options:{wms:{}},parse:async(e,t)=>Ei(new TextDecoder().decode(e),t?.wms),parseTextSync:(e,t)=>Ei(e,t?.wms)};function eA(e){return e.startsWith("<?xml")}function Bi(e,t){let n=(Ut.parseTextSync?.(e,t)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(n)?n:[n]).map(o=>rA(o))}}function rA(e){return{attributes:e||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var mh={...hr,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(e,t)=>Bi(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Bi(e,t)};function Ci(e,t){return Ut.parseTextSync?.(e,t)}var gh={...hr,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(e,t)=>Ci(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Ci(e,t)};function Ah(e,t){let{type:r="auto"}=e,n=r==="auto"?sA(e.url,t):nA(r,t);if(!n)throw new Error("Not a valid image source type");return n.create(e)}function nA(e,t){for(let r of t)if(r.type===e)return r;return null}function sA(e,t){for(let r of t)if(r.testURL&&r.testURL(e))return r;return null}var xh="4.2.0-alpha.4";var oA=globalThis.loaders?.parseImageNode,Si=typeof Image<"u",Mi=typeof ImageBitmap<"u",iA=Boolean(oA),bi=Jr?!0:iA;function yh(e){switch(e){case"auto":return Mi||Si||bi;case"imagebitmap":return Mi;case"image":return Si;case"data":return bi;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Th(){if(Mi)return"imagebitmap";if(Si)return"image";if(bi)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function _h(e){let t=aA(e);if(!t)throw new Error("Not an image");return t}function Qr(e){switch(_h(e)){case"data":return e;case"image":case"imagebitmap":let 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 aA(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var cA=/^data:image\/svg\+xml/,lA=/\.svg((\?|#).*)?$/;function as(e){return e&&(cA.test(e)||lA.test(e))}function Eh(e,t){if(as(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return Ii(e,t)}function Ii(e,t){if(as(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function cs(e,t,r){let n=Eh(e,r),s=self.URL||self.webkitURL,o=typeof n!="string"&&s.createObjectURL(n);try{return await hA(o||n,t)}finally{o&&s.revokeObjectURL(o)}}async function hA(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,s)=>{try{r.onload=()=>n(r),r.onerror=o=>{let i=o instanceof Error?o.message:"error";s(new Error(i))}}catch(o){s(o)}})}var uA={},Bh=!0;async function Ch(e,t,r){let n;as(r)?n=await cs(e,t,r):n=Ii(e,r);let s=t&&t.imagebitmap;return await fA(n,s)}async function fA(e,t=null){if((dA(t)||!Bh)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),Bh=!1}return await createImageBitmap(e)}function dA(e){for(let t in e||uA)return!1;return!0}function Sh(e){return!AA(e,"ftyp",4)||!(e[8]&96)?null:pA(e)}function pA(e){switch(mA(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function mA(e,t,r){return String.fromCharCode(...e.slice(t,r))}function gA(e){return[...e].map(t=>t.charCodeAt(0))}function AA(e,t,r=0){let n=gA(t);for(let s=0;s<n.length;++s)if(n[s]!==e[s+r])return!1;return!0}var Kt=!1,Zr=!0;function ve(e){let t=$r(e);return yA(t)||EA(t)||TA(t)||_A(t)||xA(t)}function xA(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=Sh(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function yA(e){let t=$r(e);return t.byteLength>=24&&t.getUint32(0,Kt)===2303741511?{mimeType:"image/png",width:t.getUint32(16,Kt),height:t.getUint32(20,Kt)}:null}function TA(e){let t=$r(e);return t.byteLength>=10&&t.getUint32(0,Kt)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,Zr),height:t.getUint16(8,Zr)}:null}function _A(e){let t=$r(e);return t.byteLength>=14&&t.getUint16(0,Kt)===16973&&t.getUint32(2,Zr)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,Zr),height:t.getUint32(22,Zr)}:null}function EA(e){let t=$r(e);if(!(t.byteLength>=3&&t.getUint16(0,Kt)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:s}=BA(),o=2;for(;o+9<t.byteLength;){let i=t.getUint16(o,Kt);if(s.has(i))return{mimeType:"image/jpeg",height:t.getUint16(o+5,Kt),width:t.getUint16(o+7,Kt)};if(!n.has(i))return null;o+=2,o+=t.getUint16(o,Kt)}return null}function BA(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function $r(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")}async function Mh(e,t){let{mimeType:r}=ve(e)||{},n=globalThis.loaders?.parseImageNode;return V(n),await n(e,r)}async function bh(e,t,r){t=t||{};let s=(t.image||{}).type||"auto",{url:o}=r||{},i=CA(s),a;switch(i){case"imagebitmap":a=await Ch(e,t,o);break;case"image":a=await cs(e,t,o);break;case"data":a=await Mh(e,t);break;default:V(!1)}return s==="data"&&(a=Qr(a)),a}function CA(e){switch(e){case"auto":case"data":return Th();default:return yh(e),e}}var SA=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],MA=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],bA={image:{type:"auto",decode:!0}},ye={id:"image",module:"images",name:"Images",version:xh,mimeTypes:MA,extensions:SA,parse:bh,tests:[e=>Boolean(ve(new DataView(e)))],options:bA};var wi={};function Fi(e){if(wi[e]===void 0){let t=Jr?wA(e):IA(e);wi[e]=t}return wi[e]}function IA(e){let t=["image/png","image/jpeg","image/gif"],r=globalThis.loaders?.imageFormatsNode||t,n=globalThis.loaders?.parseImageNode;return Boolean(n)&&r.includes(e)}function wA(e){switch(e){case"image/avif":case"image/webp":return FA(e);default:return!0}}function FA(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var Ih={type:"wms",testURL:e=>e.toLowerCase().includes("wms"),create:e=>new Li(e)},Li=class extends wt{constructor(t){super(t),this.capabilities=null,this.url=t.url,this.data=t.url,this.substituteCRS84=t.substituteCRS84??!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...t.wmsParameters},this.vendorParameters=t.vendorParameters||{}}async getMetadata(){let t=await this.getCapabilities();return this.normalizeMetadata(t)}async getImage(t){let{boundingBox:r,bbox:n,...s}=t,o={bbox:r?[...r[0],...r[1]]:n,...s};return await this.getMap(o)}normalizeMetadata(t){return t}async getCapabilities(t,r){let n=this.getCapabilitiesURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();this._checkResponse(s,o);let i=await hr.parse(o,this.loadOptions);return this.capabilities=i,i}async getMap(t,r){let n=this.getMapURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();this._checkResponse(s,o);try{return await ye.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}async getFeatureInfo(t,r){let n=this.getFeatureInfoURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();return this._checkResponse(s,o),await mh.parse(o,this.loadOptions)}async getFeatureInfoText(t,r){let n=this.getFeatureInfoURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();return this._checkResponse(s,o),new TextDecoder().decode(o)}async describeLayer(t,r){let n=this.describeLayerURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();return this._checkResponse(s,o),await gh.parse(o,this.loadOptions)}async getLegendGraphic(t,r){let n=this.getLegendGraphicURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();this._checkResponse(s,o);try{return await ye.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}getCapabilitiesURL(t,r){let n={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetCapabilities",n,r)}getMapURL(t,r){t=this._getWMS130Parameters(t);let n={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetMap",n,r)}getFeatureInfoURL(t,r){t=this._getWMS130Parameters(t);let n={version:this.wmsParameters.version,info_format:this.wmsParameters.info_format,layers:this.wmsParameters.layers,query_layers:this.wmsParameters.query_layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetFeatureInfo",n,r)}describeLayerURL(t,r){let n={version:this.wmsParameters.version,...t};return this._getWMSUrl("DescribeLayer",n,r)}getLegendGraphicURL(t,r){let n={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetLegendGraphic",n,r)}_parseWMSUrl(t){let[r,n]=t.split("?"),s=n.split("&"),o={};for(let i of s){let[a,c]=i.split("=");o[a]=c}return{url:r,parameters:o}}_getWMSUrl(t,r,n){let s=this.url,o=!0,i={service:"WMS",version:r.version,request:t,...r,...this.vendorParameters,...n},a=["transparent","time","elevation"];for(let[c,l]of Object.entries(i))(!a.includes(c)||l)&&(s+=o?"?":"&",o=!1,s+=this._getURLParameter(c,l,r));return encodeURI(s)}_getWMS130Parameters(t){let r={...t};return r.srs&&(r.crs=r.crs||r.srs,delete r.srs),r}_getURLParameter(t,r,n){switch(t){case"crs":n.version!=="1.3.0"?t="srs":this.substituteCRS84&&r==="EPSG:4326"&&(r="CRS:84");break;case"srs":n.version==="1.3.0"&&(t="crs");break;case"bbox":let s=this._flipBoundingBox(r,n);s&&(r=s);break;default:}return t=t.toUpperCase(),Array.isArray(r)?`${t}=${r.join(",")}`:`${t}=${r?String(r):""}`}_flipBoundingBox(t,r){if(!Array.isArray(t)||t.length!==4)return null;let n=r.version==="1.3.0"&&this.flipCRS.includes(r.crs||"")&&!(this.substituteCRS84&&r.crs==="EPSG:4326"),s=t;return n?[s[1],s[0],s[3],s[2]]:s}async _fetchArrayBuffer(t){let r=await this.fetch(t),n=await r.arrayBuffer();return this._checkResponse(r,n),n}_checkResponse(t,r){let n=t.headers["content-type"];if(!t.ok||Wr.mimeTypes.includes(n)){let s=gi(this.loadOptions,{wms:{throwOnError:!0}}),o=Wr.parseSync?.(r,s);throw new Error(o)}}_parseError(t){let r=Wr.parseSync?.(t,this.loadOptions);return new Error(r)}};var ur=class extends wt{constructor(t){super(t)}async getMetadata(){throw new Error("ImageSource.getMetadata not implemented")}async getImage(t){let r=this.getGranularParameters(t),n=this.getURLFromTemplate(r),o=await(await this.fetch(n)).arrayBuffer();return await ye.parse(o)}getGranularParameters(t){let[[r,n],[s,o]]=t.boundingBox;return{...t,east:r,north:n,south:o,west:s}}getURLFromTemplate(t){let r=this.props.url;for(let[n,s]of Object.entries(t))r=r.replace(`\${${n}}`,String(s)),r=r.replace(`{${n}}`,String(s));return r}};ur.type="template";ur.testURL=e=>e.toLowerCase().includes("{");var Ri=class extends ur{constructor(t){super(t),this.data=t.url}async getMetadata(){return await this.metadata()}async getImage(t){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(t){throw new Error("not implemented")}metadataURL(t){return`${this.props.url}?f=pjson`}exportImageURL(t){let r=`bbox=${t.bbox[0]},${t.bbox[1]},${t.bbox[2]},${t.bbox[3]}`,n=`size=${t.width},${t.height}`,s={...t,bbox:r,size:n};return delete s.width,delete s.height,this.getUrl("exportImage",s)}getUrl(t,r,n){let s=`${this.props.url}/${t}`,o=!0;for(let[i,a]of Object.entries(r))s+=o?"?":"&",o=!1,Array.isArray(a)?s+=`${i.toUpperCase()}=${a.join(",")}`:s+=`${i.toUpperCase()}=${a?String(a):""}`;return s}async checkResponse(t){if(!t.ok)throw new Error("error")}},wh={type:"arcgis-image-server",testURL:e=>e.toLowerCase().includes("ImageServer"),create:e=>new Ri(e)};var LA=[Ih,wh];function Pi(e){return Ah(e,LA)}function P(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var RA=1/Math.PI*180,PA=1/180*Math.PI,OA={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...OA}};var K=globalThis.mathgl.config;function Oi(e,{precision:t=K.precision}={}){return e=NA(e),"".concat(parseFloat(e.toPrecision(t)))}function St(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ni(e){return Fh(e)}function Di(e){return Mt(e)}function Fh(e,t){return vi(e,r=>r*PA,t)}function Mt(e,t){return vi(e,r=>r*RA,t)}function ls(e,t,r){return vi(e,n=>Math.max(t,Math.min(r,n)))}function Te(e,t,r){return St(e)?e.map((n,s)=>Te(n,t[s],r)):r*t+(1-r)*e}function gt(e,t,r){let n=K.EPSILON;r&&(K.EPSILON=r);try{if(e===t)return!0;if(St(e)&&St(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!gt(e[s],t[s]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=K.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{K.EPSILON=n}}function NA(e){return Math.round(e/K.EPSILON)*K.EPSILON}function DA(e){return e.clone?e.clone():new Array(e.length)}function vi(e,t,r){if(St(e)){let n=e;r=r||DA(n);for(let s=0;s<r.length&&s<n.length;++s){let o=typeof e=="number"?e:e[s];r[s]=t(o,s,r)}return r}return t(e)}function vA(e){function t(){var r=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(r,Object.getPrototypeOf(this)),r}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}var _e=class extends vA(Array){clone(){return new this.constructor().copy(this)}fromArray(t,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=t[n+r];return this.check()}toArray(t=[],r=0){for(let n=0;n<this.ELEMENTS;++n)t[r+n]=this[n];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:St(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(K)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+Oi(this[n],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(r,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!gt(this[r],t[r]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==t[r])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,r,n){if(n===void 0)return this.lerp(this,t,r);for(let s=0;s<this.ELEMENTS;++s){let o=t[s],i=typeof r=="number"?r:r[s];this[s]=o+n*(i-o)}return this.check()}min(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(t[r],this[r]);return this.check()}max(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(t[r],this[r]);return this.check()}clamp(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),r[n]);return this.check()}add(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(t){if(typeof t=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;else for(let r=0;r<this.ELEMENTS&&r<t.length;++r)this[r]*=t[r];return this.check()}multiplyByScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}check(){if(K.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)t=t&&Number.isFinite(this[r]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=t;return this.check()}addScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t),r);return this.check()}get elements(){return this}};function UA(e,t){if(e.length!==t)return!1;for(let r=0;r<e.length;++r)if(!Number.isFinite(e[r]))return!1;return!0}function G(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(JSON.stringify(e)));return e}function Ee(e,t,r=""){if(K.debug&&!UA(e,t))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return e}function ct(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}var Be=class extends _e{get x(){return this[0]}set x(t){this[0]=G(t)}get y(){return this[1]}set y(t){this[1]=G(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*this[r];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let r=0;for(let n=0;n<this.ELEMENTS;++n){let s=this[n]-t[n];r+=s*s}return G(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return G(r)}normalize(){let t=this.magnitude();if(t!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=t;return this.check()}multiply(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return ct(t>=0&&t<this.ELEMENTS,"index is out of range"),G(this[t])}setComponent(t,r){return ct(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=r,this.check()}addVectors(t,r){return this.copy(t).add(r)}subVectors(t,r){return this.copy(t).subtract(r)}multiplyVectors(t,r){return this.copy(t).multiply(r)}addScaledVector(t,r){return this.add(new this.constructor(t).multiplyScalar(r))}};var $=typeof Float32Array<"u"?Float32Array:Array,tn=Math.random;function fr(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var a2=Math.PI/180;function GA(){let e=new $(2);return $!=Float32Array&&(e[0]=0,e[1]=0),e}function Lh(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s,e[1]=r[1]*n+r[3]*s,e}function Rh(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s+r[4],e[1]=r[1]*n+r[3]*s+r[5],e}function hs(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[3]*s+r[6],e[1]=r[1]*n+r[4]*s+r[7],e}function us(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[4]*s+r[12],e[1]=r[1]*n+r[5]*s+r[13],e}var c2=function(){let e=GA();return function(t,r,n,s,o,i){let a,c;for(r||(r=2),n||(n=0),s?c=Math.min(s*r+n,t.length):c=t.length,a=n;a<c;a+=r)e[0]=t[a],e[1]=t[a+1],o(e,e,i),t[a]=e[0],t[a+1]=e[1];return t}}();function fs(e,t,r){let n=t[0],s=t[1],o=r[3]*n+r[7]*s||1;return e[0]=(r[0]*n+r[4]*s)/o,e[1]=(r[1]*n+r[5]*s)/o,e}function ds(e,t,r){let n=t[0],s=t[1],o=t[2],i=r[3]*n+r[7]*s+r[11]*o||1;return e[0]=(r[0]*n+r[4]*s+r[8]*o)/i,e[1]=(r[1]*n+r[5]*s+r[9]*o)/i,e[2]=(r[2]*n+r[6]*s+r[10]*o)/i,e}function Ph(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s,e[1]=r[1]*n+r[3]*s,e[2]=t[2],e}function Oh(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s,e[1]=r[1]*n+r[3]*s,e[2]=t[2],e[3]=t[3],e}function ps(e,t,r){let n=t[0],s=t[1],o=t[2];return e[0]=r[0]*n+r[3]*s+r[6]*o,e[1]=r[1]*n+r[4]*s+r[7]*o,e[2]=r[2]*n+r[5]*s+r[8]*o,e[3]=t[3],e}var Ue=class extends Be{constructor(t=0,r=0){super(2),St(t)&&arguments.length===1?this.copy(t):(K.debug&&(G(t),G(r)),this[0]=t,this[1]=r)}set(t,r){return this[0]=t,this[1]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return K.debug&&(G(t.x),G(t.y)),this[0]=t.x,this[1]=t.y,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return us(this,this,t),this.check()}transformAsVector(t){return fs(this,this,t),this.check()}transformByMatrix3(t){return hs(this,this,t),this.check()}transformByMatrix2x3(t){return Rh(this,this,t),this.check()}transformByMatrix2(t){return Lh(this,this,t),this.check()}};var pr={};ut(pr,{add:()=>kA,angle:()=>zi,bezier:()=>r1,ceil:()=>JA,clone:()=>VA,copy:()=>HA,create:()=>ms,cross:()=>Ge,dist:()=>u1,distance:()=>Gh,div:()=>h1,divide:()=>Uh,dot:()=>en,equals:()=>a1,exactEquals:()=>i1,floor:()=>qA,forEach:()=>p1,fromValues:()=>gs,hermite:()=>e1,inverse:()=>ZA,len:()=>ki,length:()=>Nh,lerp:()=>$A,max:()=>XA,min:()=>jA,mul:()=>l1,multiply:()=>vh,negate:()=>QA,normalize:()=>Ui,random:()=>n1,rotateX:()=>Gi,rotateY:()=>Vi,rotateZ:()=>Hi,round:()=>WA,scale:()=>YA,scaleAndAdd:()=>KA,set:()=>zA,slerp:()=>t1,sqrDist:()=>f1,sqrLen:()=>d1,squaredDistance:()=>Vh,squaredLength:()=>Hh,str:()=>o1,sub:()=>c1,subtract:()=>Dh,transformMat3:()=>rn,transformMat4:()=>Ve,transformQuat:()=>nn,zero:()=>s1});function ms(){let e=new $(3);return $!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function VA(e){let t=new $(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Nh(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function gs(e,t,r){let n=new $(3);return n[0]=e,n[1]=t,n[2]=r,n}function HA(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function zA(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function kA(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function Dh(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function vh(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function Uh(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function JA(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function qA(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function jA(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e}function XA(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e}function WA(e,t){return e[0]=fr(t[0]),e[1]=fr(t[1]),e[2]=fr(t[2]),e}function YA(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function KA(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e}function Gh(e,t){let r=t[0]-e[0],n=t[1]-e[1],s=t[2]-e[2];return Math.sqrt(r*r+n*n+s*s)}function Vh(e,t){let r=t[0]-e[0],n=t[1]-e[1],s=t[2]-e[2];return r*r+n*n+s*s}function Hh(e){let t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function QA(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function ZA(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Ui(e,t){let r=t[0],n=t[1],s=t[2],o=r*r+n*n+s*s;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function en(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Ge(e,t,r){let n=t[0],s=t[1],o=t[2],i=r[0],a=r[1],c=r[2];return e[0]=s*c-o*a,e[1]=o*i-n*c,e[2]=n*a-s*i,e}function $A(e,t,r,n){let s=t[0],o=t[1],i=t[2];return e[0]=s+n*(r[0]-s),e[1]=o+n*(r[1]-o),e[2]=i+n*(r[2]-i),e}function t1(e,t,r,n){let s=Math.acos(Math.min(Math.max(en(t,r),-1),1)),o=Math.sin(s),i=Math.sin((1-n)*s)/o,a=Math.sin(n*s)/o;return e[0]=i*t[0]+a*r[0],e[1]=i*t[1]+a*r[1],e[2]=i*t[2]+a*r[2],e}function e1(e,t,r,n,s,o){let i=o*o,a=i*(2*o-3)+1,c=i*(o-2)+o,l=i*(o-1),h=i*(3-2*o);return e[0]=t[0]*a+r[0]*c+n[0]*l+s[0]*h,e[1]=t[1]*a+r[1]*c+n[1]*l+s[1]*h,e[2]=t[2]*a+r[2]*c+n[2]*l+s[2]*h,e}function r1(e,t,r,n,s,o){let i=1-o,a=i*i,c=o*o,l=a*i,h=3*o*a,u=3*c*i,f=c*o;return e[0]=t[0]*l+r[0]*h+n[0]*u+s[0]*f,e[1]=t[1]*l+r[1]*h+n[1]*u+s[1]*f,e[2]=t[2]*l+r[2]*h+n[2]*u+s[2]*f,e}function n1(e,t){t=t===void 0?1:t;let r=tn()*2*Math.PI,n=tn()*2-1,s=Math.sqrt(1-n*n)*t;return e[0]=Math.cos(r)*s,e[1]=Math.sin(r)*s,e[2]=n*t,e}function Ve(e,t,r){let n=t[0],s=t[1],o=t[2],i=r[3]*n+r[7]*s+r[11]*o+r[15];return i=i||1,e[0]=(r[0]*n+r[4]*s+r[8]*o+r[12])/i,e[1]=(r[1]*n+r[5]*s+r[9]*o+r[13])/i,e[2]=(r[2]*n+r[6]*s+r[10]*o+r[14])/i,e}function rn(e,t,r){let n=t[0],s=t[1],o=t[2];return e[0]=n*r[0]+s*r[3]+o*r[6],e[1]=n*r[1]+s*r[4]+o*r[7],e[2]=n*r[2]+s*r[5]+o*r[8],e}function nn(e,t,r){let n=r[0],s=r[1],o=r[2],i=r[3],a=t[0],c=t[1],l=t[2],h=s*l-o*c,u=o*a-n*l,f=n*c-s*a,d=s*f-o*u,p=o*h-n*f,A=n*u-s*h,g=i*2;return h*=g,u*=g,f*=g,d*=2,p*=2,A*=2,e[0]=a+h+d,e[1]=c+u+p,e[2]=l+f+A,e}function Gi(e,t,r,n){let s=[],o=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],o[0]=s[0],o[1]=s[1]*Math.cos(n)-s[2]*Math.sin(n),o[2]=s[1]*Math.sin(n)+s[2]*Math.cos(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function Vi(e,t,r,n){let s=[],o=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],o[0]=s[2]*Math.sin(n)+s[0]*Math.cos(n),o[1]=s[1],o[2]=s[2]*Math.cos(n)-s[0]*Math.sin(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function Hi(e,t,r,n){let s=[],o=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],o[0]=s[0]*Math.cos(n)-s[1]*Math.sin(n),o[1]=s[0]*Math.sin(n)+s[1]*Math.cos(n),o[2]=s[2],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function zi(e,t){let r=e[0],n=e[1],s=e[2],o=t[0],i=t[1],a=t[2],c=Math.sqrt((r*r+n*n+s*s)*(o*o+i*i+a*a)),l=c&&en(e,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}function s1(e){return e[0]=0,e[1]=0,e[2]=0,e}function o1(e){return"vec3(".concat(e[0],", ").concat(e[1],", ").concat(e[2],")")}function i1(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function a1(e,t){let r=e[0],n=e[1],s=e[2],o=t[0],i=t[1],a=t[2];return Math.abs(r-o)<=1e-6*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}var c1=Dh,l1=vh,h1=Uh,u1=Gh,f1=Vh,ki=Nh,d1=Hh,p1=function(){let e=ms();return function(t,r,n,s,o,i){let a,c;for(r||(r=3),n||(n=0),s?c=Math.min(s*r+n,t.length):c=t.length,a=n;a<c;a+=r)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],o(e,e,i),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2];return t}}();var Ji=[0,0,0],As,x=class extends Be{static get ZERO(){return As||(As=new x(0,0,0),Object.freeze(As)),As}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&St(t)?this.copy(t):(K.debug&&(G(t),G(r),G(n)),this[0]=t,this[1]=r,this[2]=n)}set(t,r,n){return this[0]=t,this[1]=r,this[2]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return K.debug&&(G(t.x),G(t.y),G(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=G(t)}angle(t){return zi(this,t)}cross(t){return Ge(this,this,t),this.check()}rotateX({radians:t,origin:r=Ji}){return Gi(this,this,r,t),this.check()}rotateY({radians:t,origin:r=Ji}){return Vi(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=Ji}){return Hi(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Ve(this,this,t),this.check()}transformAsVector(t){return ds(this,this,t),this.check()}transformByMatrix3(t){return rn(this,this,t),this.check()}transformByMatrix2(t){return Ph(this,this,t),this.check()}transformByQuaternion(t){return nn(this,this,t),this.check()}};var xs,mr=class extends Be{static get ZERO(){return xs||(xs=new mr(0,0,0,0),Object.freeze(xs)),xs}constructor(t=0,r=0,n=0,s=0){super(-0,-0,-0,-0),St(t)&&arguments.length===1?this.copy(t):(K.debug&&(G(t),G(r),G(n),G(s)),this[0]=t,this[1]=r,this[2]=n,this[3]=s)}set(t,r,n,s){return this[0]=t,this[1]=r,this[2]=n,this[3]=s,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return K.debug&&(G(t.x),G(t.y),G(t.z),G(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=G(t)}get w(){return this[3]}set w(t){this[3]=G(t)}transform(t){return Ve(this,this,t),this.check()}transformByMatrix3(t){return ps(this,this,t),this.check()}transformByMatrix2(t){return Oh(this,this,t),this.check()}transformByQuaternion(t){return nn(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var gr=class extends _e{toString(){let t="[";if(K.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)t+=" ".concat(this[n*this.RANK+r])}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=" ".concat(this[r])}return t+="]",t}getElementIndex(t,r){return r*this.RANK+t}getElement(t,r){return this[r*this.RANK+t]}setElement(t,r,n){return this[r*this.RANK+t]=G(n),this}getColumn(t,r=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let s=0;s<this.RANK;++s)r[s]=this[n+s];return r}setColumn(t,r){let n=t*this.RANK;for(let s=0;s<this.RANK;++s)this[n+s]=r[s];return this}};function zh(){let e=new $(9);return $!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function kh(e,t){if(e===t){let r=t[1],n=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=s}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function Jh(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=t[4],a=t[5],c=t[6],l=t[7],h=t[8],u=h*i-a*l,f=-h*o+a*c,d=l*o-i*c,p=r*u+n*f+s*d;return p?(p=1/p,e[0]=u*p,e[1]=(-h*n+s*l)*p,e[2]=(a*n-s*i)*p,e[3]=f*p,e[4]=(h*r-s*c)*p,e[5]=(-a*r+s*o)*p,e[6]=d*p,e[7]=(-l*r+n*c)*p,e[8]=(i*r-n*o)*p,e):null}function qh(e){let t=e[0],r=e[1],n=e[2],s=e[3],o=e[4],i=e[5],a=e[6],c=e[7],l=e[8];return t*(l*o-i*c)+r*(-l*s+i*a)+n*(c*s-o*a)}function qi(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=r[0],d=r[1],p=r[2],A=r[3],g=r[4],y=r[5],E=r[6],_=r[7],B=r[8];return e[0]=f*n+d*i+p*l,e[1]=f*s+d*a+p*h,e[2]=f*o+d*c+p*u,e[3]=A*n+g*i+y*l,e[4]=A*s+g*a+y*h,e[5]=A*o+g*c+y*u,e[6]=E*n+_*i+B*l,e[7]=E*s+_*a+B*h,e[8]=E*o+_*c+B*u,e}function jh(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=r[0],d=r[1];return e[0]=n,e[1]=s,e[2]=o,e[3]=i,e[4]=a,e[5]=c,e[6]=f*n+d*i+l,e[7]=f*s+d*a+h,e[8]=f*o+d*c+u,e}function Xh(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=Math.sin(r),d=Math.cos(r);return e[0]=d*n+f*i,e[1]=d*s+f*a,e[2]=d*o+f*c,e[3]=d*i-f*n,e[4]=d*a-f*s,e[5]=d*c-f*o,e[6]=l,e[7]=h,e[8]=u,e}function ji(e,t,r){let n=r[0],s=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=s*t[3],e[4]=s*t[4],e[5]=s*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Wh(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=r+r,a=n+n,c=s+s,l=r*i,h=n*i,u=n*a,f=s*i,d=s*a,p=s*c,A=o*i,g=o*a,y=o*c;return e[0]=1-u-p,e[3]=h-y,e[6]=f+g,e[1]=h+y,e[4]=1-l-p,e[7]=d-A,e[2]=f-g,e[5]=d+A,e[8]=1-l-u,e}var Xi;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL1ROW0=3]="COL1ROW0",e[e.COL1ROW1=4]="COL1ROW1",e[e.COL1ROW2=5]="COL1ROW2",e[e.COL2ROW0=6]="COL2ROW0",e[e.COL2ROW1=7]="COL2ROW1",e[e.COL2ROW2=8]="COL2ROW2"})(Xi||(Xi={}));var g1=Object.freeze([1,0,0,0,1,0,0,0,1]),k=class extends gr{static get IDENTITY(){return x1()}static get ZERO(){return A1()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Xi}constructor(t,...r){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):r.length>0?this.copy([t,...r]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(g1)}fromObject(t){return this.check()}fromQuaternion(t){return Wh(this,t),this.check()}set(t,r,n,s,o,i,a,c,l){return this[0]=t,this[1]=r,this[2]=n,this[3]=s,this[4]=o,this[5]=i,this[6]=a,this[7]=c,this[8]=l,this.check()}setRowMajor(t,r,n,s,o,i,a,c,l){return this[0]=t,this[1]=s,this[2]=a,this[3]=r,this[4]=o,this[5]=c,this[6]=n,this[7]=i,this[8]=l,this.check()}determinant(){return qh(this)}transpose(){return kh(this,this),this.check()}invert(){return Jh(this,this),this.check()}multiplyLeft(t){return qi(this,t,this),this.check()}multiplyRight(t){return qi(this,this,t),this.check()}rotate(t){return Xh(this,this,t),this.check()}scale(t){return Array.isArray(t)?ji(this,this,t):ji(this,this,[t,t]),this.check()}translate(t){return jh(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=hs(r||[-0,-0],t,this);break;case 3:n=rn(r||[-0,-0,-0],t,this);break;case 4:n=ps(r||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ee(n,t.length),n}transformVector(t,r){return this.transform(t,r)}transformVector2(t,r){return this.transform(t,r)}transformVector3(t,r){return this.transform(t,r)}},ys,Ts=null;function A1(){return ys||(ys=new k([0,0,0,0,0,0,0,0,0]),Object.freeze(ys)),ys}function x1(){return Ts||(Ts=new k,Object.freeze(Ts)),Ts}var _s={};ut(_s,{add:()=>k1,adjoint:()=>C1,clone:()=>T1,copy:()=>_1,create:()=>y1,decompose:()=>O1,determinant:()=>Ki,equals:()=>X1,exactEquals:()=>j1,frob:()=>z1,fromQuat:()=>na,fromQuat2:()=>L1,fromRotation:()=>b1,fromRotationTranslation:()=>Kh,fromRotationTranslationScale:()=>N1,fromRotationTranslationScaleOrigin:()=>D1,fromScaling:()=>M1,fromTranslation:()=>S1,fromValues:()=>E1,fromXRotation:()=>I1,fromYRotation:()=>w1,fromZRotation:()=>F1,frustum:()=>sa,getRotation:()=>P1,getScaling:()=>Qh,getTranslation:()=>R1,identity:()=>Yh,invert:()=>Yi,lookAt:()=>aa,mul:()=>W1,multiply:()=>sn,multiplyScalar:()=>J1,multiplyScalarAndAdd:()=>q1,ortho:()=>ia,orthoNO:()=>$h,orthoZO:()=>G1,perspective:()=>oa,perspectiveFromFieldOfView:()=>U1,perspectiveNO:()=>Zh,perspectiveZO:()=>v1,rotate:()=>$i,rotateX:()=>ta,rotateY:()=>ea,rotateZ:()=>ra,scale:()=>Zi,set:()=>B1,str:()=>H1,sub:()=>Y1,subtract:()=>tu,targetTo:()=>V1,translate:()=>Qi,transpose:()=>Wi});function y1(){let e=new $(16);return $!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function T1(e){let t=new $(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function _1(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function E1(e,t,r,n,s,o,i,a,c,l,h,u,f,d,p,A){let g=new $(16);return g[0]=e,g[1]=t,g[2]=r,g[3]=n,g[4]=s,g[5]=o,g[6]=i,g[7]=a,g[8]=c,g[9]=l,g[10]=h,g[11]=u,g[12]=f,g[13]=d,g[14]=p,g[15]=A,g}function B1(e,t,r,n,s,o,i,a,c,l,h,u,f,d,p,A,g){return e[0]=t,e[1]=r,e[2]=n,e[3]=s,e[4]=o,e[5]=i,e[6]=a,e[7]=c,e[8]=l,e[9]=h,e[10]=u,e[11]=f,e[12]=d,e[13]=p,e[14]=A,e[15]=g,e}function Yh(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Wi(e,t){if(e===t){let r=t[1],n=t[2],s=t[3],o=t[6],i=t[7],a=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]=o,e[11]=t[14],e[12]=s,e[13]=i,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function Yi(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=t[4],a=t[5],c=t[6],l=t[7],h=t[8],u=t[9],f=t[10],d=t[11],p=t[12],A=t[13],g=t[14],y=t[15],E=r*a-n*i,_=r*c-s*i,B=r*l-o*i,S=n*c-s*a,M=n*l-o*a,w=s*l-o*c,C=h*A-u*p,T=h*g-f*p,m=h*y-d*p,b=u*g-f*A,L=u*y-d*A,R=f*y-d*g,F=E*R-_*L+B*b+S*m-M*T+w*C;return F?(F=1/F,e[0]=(a*R-c*L+l*b)*F,e[1]=(s*L-n*R-o*b)*F,e[2]=(A*w-g*M+y*S)*F,e[3]=(f*M-u*w-d*S)*F,e[4]=(c*m-i*R-l*T)*F,e[5]=(r*R-s*m+o*T)*F,e[6]=(g*B-p*w-y*_)*F,e[7]=(h*w-f*B+d*_)*F,e[8]=(i*L-a*m+l*C)*F,e[9]=(n*m-r*L-o*C)*F,e[10]=(p*M-A*B+y*E)*F,e[11]=(u*B-h*M-d*E)*F,e[12]=(a*T-i*b-c*C)*F,e[13]=(r*b-n*T+s*C)*F,e[14]=(A*_-p*S-g*E)*F,e[15]=(h*S-u*_+f*E)*F,e):null}function C1(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=t[4],a=t[5],c=t[6],l=t[7],h=t[8],u=t[9],f=t[10],d=t[11],p=t[12],A=t[13],g=t[14],y=t[15],E=r*a-n*i,_=r*c-s*i,B=r*l-o*i,S=n*c-s*a,M=n*l-o*a,w=s*l-o*c,C=h*A-u*p,T=h*g-f*p,m=h*y-d*p,b=u*g-f*A,L=u*y-d*A,R=f*y-d*g;return e[0]=a*R-c*L+l*b,e[1]=s*L-n*R-o*b,e[2]=A*w-g*M+y*S,e[3]=f*M-u*w-d*S,e[4]=c*m-i*R-l*T,e[5]=r*R-s*m+o*T,e[6]=g*B-p*w-y*_,e[7]=h*w-f*B+d*_,e[8]=i*L-a*m+l*C,e[9]=n*m-r*L-o*C,e[10]=p*M-A*B+y*E,e[11]=u*B-h*M-d*E,e[12]=a*T-i*b-c*C,e[13]=r*b-n*T+s*C,e[14]=A*_-p*S-g*E,e[15]=h*S-u*_+f*E,e}function Ki(e){let t=e[0],r=e[1],n=e[2],s=e[3],o=e[4],i=e[5],a=e[6],c=e[7],l=e[8],h=e[9],u=e[10],f=e[11],d=e[12],p=e[13],A=e[14],g=e[15],y=t*i-r*o,E=t*a-n*o,_=r*a-n*i,B=l*p-h*d,S=l*A-u*d,M=h*A-u*p,w=t*M-r*S+n*B,C=o*M-i*S+a*B,T=l*_-h*E+u*y,m=d*_-p*E+A*y;return c*w-s*C+g*T-f*m}function sn(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=t[9],d=t[10],p=t[11],A=t[12],g=t[13],y=t[14],E=t[15],_=r[0],B=r[1],S=r[2],M=r[3];return e[0]=_*n+B*a+S*u+M*A,e[1]=_*s+B*c+S*f+M*g,e[2]=_*o+B*l+S*d+M*y,e[3]=_*i+B*h+S*p+M*E,_=r[4],B=r[5],S=r[6],M=r[7],e[4]=_*n+B*a+S*u+M*A,e[5]=_*s+B*c+S*f+M*g,e[6]=_*o+B*l+S*d+M*y,e[7]=_*i+B*h+S*p+M*E,_=r[8],B=r[9],S=r[10],M=r[11],e[8]=_*n+B*a+S*u+M*A,e[9]=_*s+B*c+S*f+M*g,e[10]=_*o+B*l+S*d+M*y,e[11]=_*i+B*h+S*p+M*E,_=r[12],B=r[13],S=r[14],M=r[15],e[12]=_*n+B*a+S*u+M*A,e[13]=_*s+B*c+S*f+M*g,e[14]=_*o+B*l+S*d+M*y,e[15]=_*i+B*h+S*p+M*E,e}function Qi(e,t,r){let n=r[0],s=r[1],o=r[2],i,a,c,l,h,u,f,d,p,A,g,y;return t===e?(e[12]=t[0]*n+t[4]*s+t[8]*o+t[12],e[13]=t[1]*n+t[5]*s+t[9]*o+t[13],e[14]=t[2]*n+t[6]*s+t[10]*o+t[14],e[15]=t[3]*n+t[7]*s+t[11]*o+t[15]):(i=t[0],a=t[1],c=t[2],l=t[3],h=t[4],u=t[5],f=t[6],d=t[7],p=t[8],A=t[9],g=t[10],y=t[11],e[0]=i,e[1]=a,e[2]=c,e[3]=l,e[4]=h,e[5]=u,e[6]=f,e[7]=d,e[8]=p,e[9]=A,e[10]=g,e[11]=y,e[12]=i*n+h*s+p*o+t[12],e[13]=a*n+u*s+A*o+t[13],e[14]=c*n+f*s+g*o+t[14],e[15]=l*n+d*s+y*o+t[15]),e}function Zi(e,t,r){let n=r[0],s=r[1],o=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]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function $i(e,t,r,n){let s=n[0],o=n[1],i=n[2],a=Math.sqrt(s*s+o*o+i*i),c,l,h,u,f,d,p,A,g,y,E,_,B,S,M,w,C,T,m,b,L,R,F,v;return a<1e-6?null:(a=1/a,s*=a,o*=a,i*=a,l=Math.sin(r),c=Math.cos(r),h=1-c,u=t[0],f=t[1],d=t[2],p=t[3],A=t[4],g=t[5],y=t[6],E=t[7],_=t[8],B=t[9],S=t[10],M=t[11],w=s*s*h+c,C=o*s*h+i*l,T=i*s*h-o*l,m=s*o*h-i*l,b=o*o*h+c,L=i*o*h+s*l,R=s*i*h+o*l,F=o*i*h-s*l,v=i*i*h+c,e[0]=u*w+A*C+_*T,e[1]=f*w+g*C+B*T,e[2]=d*w+y*C+S*T,e[3]=p*w+E*C+M*T,e[4]=u*m+A*b+_*L,e[5]=f*m+g*b+B*L,e[6]=d*m+y*b+S*L,e[7]=p*m+E*b+M*L,e[8]=u*R+A*F+_*v,e[9]=f*R+g*F+B*v,e[10]=d*R+y*F+S*v,e[11]=p*R+E*F+M*v,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function ta(e,t,r){let n=Math.sin(r),s=Math.cos(r),o=t[4],i=t[5],a=t[6],c=t[7],l=t[8],h=t[9],u=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*s+l*n,e[5]=i*s+h*n,e[6]=a*s+u*n,e[7]=c*s+f*n,e[8]=l*s-o*n,e[9]=h*s-i*n,e[10]=u*s-a*n,e[11]=f*s-c*n,e}function ea(e,t,r){let n=Math.sin(r),s=Math.cos(r),o=t[0],i=t[1],a=t[2],c=t[3],l=t[8],h=t[9],u=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*s-l*n,e[1]=i*s-h*n,e[2]=a*s-u*n,e[3]=c*s-f*n,e[8]=o*n+l*s,e[9]=i*n+h*s,e[10]=a*n+u*s,e[11]=c*n+f*s,e}function ra(e,t,r){let n=Math.sin(r),s=Math.cos(r),o=t[0],i=t[1],a=t[2],c=t[3],l=t[4],h=t[5],u=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*s+l*n,e[1]=i*s+h*n,e[2]=a*s+u*n,e[3]=c*s+f*n,e[4]=l*s-o*n,e[5]=h*s-i*n,e[6]=u*s-a*n,e[7]=f*s-c*n,e}function S1(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function M1(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function b1(e,t,r){let n=r[0],s=r[1],o=r[2],i=Math.sqrt(n*n+s*s+o*o),a,c,l;return i<1e-6?null:(i=1/i,n*=i,s*=i,o*=i,c=Math.sin(t),a=Math.cos(t),l=1-a,e[0]=n*n*l+a,e[1]=s*n*l+o*c,e[2]=o*n*l-s*c,e[3]=0,e[4]=n*s*l-o*c,e[5]=s*s*l+a,e[6]=o*s*l+n*c,e[7]=0,e[8]=n*o*l+s*c,e[9]=s*o*l-n*c,e[10]=o*o*l+a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function I1(e,t){let r=Math.sin(t),n=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function w1(e,t){let r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function F1(e,t){let r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Kh(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=n+n,c=s+s,l=o+o,h=n*a,u=n*c,f=n*l,d=s*c,p=s*l,A=o*l,g=i*a,y=i*c,E=i*l;return e[0]=1-(d+A),e[1]=u+E,e[2]=f-y,e[3]=0,e[4]=u-E,e[5]=1-(h+A),e[6]=p+g,e[7]=0,e[8]=f+y,e[9]=p-g,e[10]=1-(h+d),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function L1(e,t){let r=new $(3),n=-t[0],s=-t[1],o=-t[2],i=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=n*n+s*s+o*o+i*i;return u>0?(r[0]=(a*i+h*n+c*o-l*s)*2/u,r[1]=(c*i+h*s+l*n-a*o)*2/u,r[2]=(l*i+h*o+a*s-c*n)*2/u):(r[0]=(a*i+h*n+c*o-l*s)*2,r[1]=(c*i+h*s+l*n-a*o)*2,r[2]=(l*i+h*o+a*s-c*n)*2),Kh(e,t,r),e}function R1(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Qh(e,t){let r=t[0],n=t[1],s=t[2],o=t[4],i=t[5],a=t[6],c=t[8],l=t[9],h=t[10];return e[0]=Math.sqrt(r*r+n*n+s*s),e[1]=Math.sqrt(o*o+i*i+a*a),e[2]=Math.sqrt(c*c+l*l+h*h),e}function P1(e,t){let r=new $(3);Qh(r,t);let n=1/r[0],s=1/r[1],o=1/r[2],i=t[0]*n,a=t[1]*s,c=t[2]*o,l=t[4]*n,h=t[5]*s,u=t[6]*o,f=t[8]*n,d=t[9]*s,p=t[10]*o,A=i+h+p,g=0;return A>0?(g=Math.sqrt(A+1)*2,e[3]=.25*g,e[0]=(u-d)/g,e[1]=(f-c)/g,e[2]=(a-l)/g):i>h&&i>p?(g=Math.sqrt(1+i-h-p)*2,e[3]=(u-d)/g,e[0]=.25*g,e[1]=(a+l)/g,e[2]=(f+c)/g):h>p?(g=Math.sqrt(1+h-i-p)*2,e[3]=(f-c)/g,e[0]=(a+l)/g,e[1]=.25*g,e[2]=(u+d)/g):(g=Math.sqrt(1+p-i-h)*2,e[3]=(a-l)/g,e[0]=(f+c)/g,e[1]=(u+d)/g,e[2]=.25*g),e}function O1(e,t,r,n){t[0]=n[12],t[1]=n[13],t[2]=n[14];let s=n[0],o=n[1],i=n[2],a=n[4],c=n[5],l=n[6],h=n[8],u=n[9],f=n[10];r[0]=Math.sqrt(s*s+o*o+i*i),r[1]=Math.sqrt(a*a+c*c+l*l),r[2]=Math.sqrt(h*h+u*u+f*f);let d=1/r[0],p=1/r[1],A=1/r[2],g=s*d,y=o*p,E=i*A,_=a*d,B=c*p,S=l*A,M=h*d,w=u*p,C=f*A,T=g+B+C,m=0;return T>0?(m=Math.sqrt(T+1)*2,e[3]=.25*m,e[0]=(S-w)/m,e[1]=(M-E)/m,e[2]=(y-_)/m):g>B&&g>C?(m=Math.sqrt(1+g-B-C)*2,e[3]=(S-w)/m,e[0]=.25*m,e[1]=(y+_)/m,e[2]=(M+E)/m):B>C?(m=Math.sqrt(1+B-g-C)*2,e[3]=(M-E)/m,e[0]=(y+_)/m,e[1]=.25*m,e[2]=(S+w)/m):(m=Math.sqrt(1+C-g-B)*2,e[3]=(y-_)/m,e[0]=(M+E)/m,e[1]=(S+w)/m,e[2]=.25*m),e}function N1(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=t[3],c=s+s,l=o+o,h=i+i,u=s*c,f=s*l,d=s*h,p=o*l,A=o*h,g=i*h,y=a*c,E=a*l,_=a*h,B=n[0],S=n[1],M=n[2];return e[0]=(1-(p+g))*B,e[1]=(f+_)*B,e[2]=(d-E)*B,e[3]=0,e[4]=(f-_)*S,e[5]=(1-(u+g))*S,e[6]=(A+y)*S,e[7]=0,e[8]=(d+E)*M,e[9]=(A-y)*M,e[10]=(1-(u+p))*M,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function D1(e,t,r,n,s){let o=t[0],i=t[1],a=t[2],c=t[3],l=o+o,h=i+i,u=a+a,f=o*l,d=o*h,p=o*u,A=i*h,g=i*u,y=a*u,E=c*l,_=c*h,B=c*u,S=n[0],M=n[1],w=n[2],C=s[0],T=s[1],m=s[2],b=(1-(A+y))*S,L=(d+B)*S,R=(p-_)*S,F=(d-B)*M,v=(1-(f+y))*M,W=(g+E)*M,z=(p+_)*w,Z=(g-E)*w,X=(1-(f+A))*w;return e[0]=b,e[1]=L,e[2]=R,e[3]=0,e[4]=F,e[5]=v,e[6]=W,e[7]=0,e[8]=z,e[9]=Z,e[10]=X,e[11]=0,e[12]=r[0]+C-(b*C+F*T+z*m),e[13]=r[1]+T-(L*C+v*T+Z*m),e[14]=r[2]+m-(R*C+W*T+X*m),e[15]=1,e}function na(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=r+r,a=n+n,c=s+s,l=r*i,h=n*i,u=n*a,f=s*i,d=s*a,p=s*c,A=o*i,g=o*a,y=o*c;return e[0]=1-u-p,e[1]=h+y,e[2]=f-g,e[3]=0,e[4]=h-y,e[5]=1-l-p,e[6]=d+A,e[7]=0,e[8]=f+g,e[9]=d-A,e[10]=1-l-u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function sa(e,t,r,n,s,o,i){let a=1/(r-t),c=1/(s-n),l=1/(o-i);return e[0]=o*2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*c,e[6]=0,e[7]=0,e[8]=(r+t)*a,e[9]=(s+n)*c,e[10]=(i+o)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=i*o*2*l,e[15]=0,e}function Zh(e,t,r,n,s){let o=1/Math.tan(t/2);if(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,s!=null&&s!==1/0){let i=1/(n-s);e[10]=(s+n)*i,e[14]=2*s*n*i}else e[10]=-1,e[14]=-2*n;return e}var oa=Zh;function v1(e,t,r,n,s){let o=1/Math.tan(t/2);if(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,s!=null&&s!==1/0){let i=1/(n-s);e[10]=s*i,e[14]=s*n*i}else e[10]=-1,e[14]=-n;return e}function U1(e,t,r,n){let s=Math.tan(t.upDegrees*Math.PI/180),o=Math.tan(t.downDegrees*Math.PI/180),i=Math.tan(t.leftDegrees*Math.PI/180),a=Math.tan(t.rightDegrees*Math.PI/180),c=2/(i+a),l=2/(s+o);return e[0]=c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=l,e[6]=0,e[7]=0,e[8]=-((i-a)*c*.5),e[9]=(s-o)*l*.5,e[10]=n/(r-n),e[11]=-1,e[12]=0,e[13]=0,e[14]=n*r/(r-n),e[15]=0,e}function $h(e,t,r,n,s,o,i){let a=1/(t-r),c=1/(n-s),l=1/(o-i);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*a,e[13]=(s+n)*c,e[14]=(i+o)*l,e[15]=1,e}var ia=$h;function G1(e,t,r,n,s,o,i){let a=1/(t-r),c=1/(n-s),l=1/(o-i);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=l,e[11]=0,e[12]=(t+r)*a,e[13]=(s+n)*c,e[14]=o*l,e[15]=1,e}function aa(e,t,r,n){let s,o,i,a,c,l,h,u,f,d,p=t[0],A=t[1],g=t[2],y=n[0],E=n[1],_=n[2],B=r[0],S=r[1],M=r[2];return Math.abs(p-B)<1e-6&&Math.abs(A-S)<1e-6&&Math.abs(g-M)<1e-6?Yh(e):(u=p-B,f=A-S,d=g-M,s=1/Math.sqrt(u*u+f*f+d*d),u*=s,f*=s,d*=s,o=E*d-_*f,i=_*u-y*d,a=y*f-E*u,s=Math.sqrt(o*o+i*i+a*a),s?(s=1/s,o*=s,i*=s,a*=s):(o=0,i=0,a=0),c=f*a-d*i,l=d*o-u*a,h=u*i-f*o,s=Math.sqrt(c*c+l*l+h*h),s?(s=1/s,c*=s,l*=s,h*=s):(c=0,l=0,h=0),e[0]=o,e[1]=c,e[2]=u,e[3]=0,e[4]=i,e[5]=l,e[6]=f,e[7]=0,e[8]=a,e[9]=h,e[10]=d,e[11]=0,e[12]=-(o*p+i*A+a*g),e[13]=-(c*p+l*A+h*g),e[14]=-(u*p+f*A+d*g),e[15]=1,e)}function V1(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=n[0],c=n[1],l=n[2],h=s-r[0],u=o-r[1],f=i-r[2],d=h*h+u*u+f*f;d>0&&(d=1/Math.sqrt(d),h*=d,u*=d,f*=d);let p=c*f-l*u,A=l*h-a*f,g=a*u-c*h;return d=p*p+A*A+g*g,d>0&&(d=1/Math.sqrt(d),p*=d,A*=d,g*=d),e[0]=p,e[1]=A,e[2]=g,e[3]=0,e[4]=u*g-f*A,e[5]=f*p-h*g,e[6]=h*A-u*p,e[7]=0,e[8]=h,e[9]=u,e[10]=f,e[11]=0,e[12]=s,e[13]=o,e[14]=i,e[15]=1,e}function H1(e){return"mat4(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(e[3],", ").concat(e[4],", ").concat(e[5],", ").concat(e[6],", ").concat(e[7],", ").concat(e[8],", ").concat(e[9],", ").concat(e[10],", ").concat(e[11],", ").concat(e[12],", ").concat(e[13],", ").concat(e[14],", ").concat(e[15],")")}function z1(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8]+e[9]*e[9]+e[10]*e[10]+e[11]*e[11]+e[12]*e[12]+e[13]*e[13]+e[14]*e[14]+e[15]*e[15])}function k1(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e}function tu(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}function J1(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e}function q1(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e[4]=t[4]+r[4]*n,e[5]=t[5]+r[5]*n,e[6]=t[6]+r[6]*n,e[7]=t[7]+r[7]*n,e[8]=t[8]+r[8]*n,e[9]=t[9]+r[9]*n,e[10]=t[10]+r[10]*n,e[11]=t[11]+r[11]*n,e[12]=t[12]+r[12]*n,e[13]=t[13]+r[13]*n,e[14]=t[14]+r[14]*n,e[15]=t[15]+r[15]*n,e}function j1(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function X1(e,t){let r=e[0],n=e[1],s=e[2],o=e[3],i=e[4],a=e[5],c=e[6],l=e[7],h=e[8],u=e[9],f=e[10],d=e[11],p=e[12],A=e[13],g=e[14],y=e[15],E=t[0],_=t[1],B=t[2],S=t[3],M=t[4],w=t[5],C=t[6],T=t[7],m=t[8],b=t[9],L=t[10],R=t[11],F=t[12],v=t[13],W=t[14],z=t[15];return Math.abs(r-E)<=1e-6*Math.max(1,Math.abs(r),Math.abs(E))&&Math.abs(n-_)<=1e-6*Math.max(1,Math.abs(n),Math.abs(_))&&Math.abs(s-B)<=1e-6*Math.max(1,Math.abs(s),Math.abs(B))&&Math.abs(o-S)<=1e-6*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(i-M)<=1e-6*Math.max(1,Math.abs(i),Math.abs(M))&&Math.abs(a-w)<=1e-6*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(c-C)<=1e-6*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(l-T)<=1e-6*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(h-m)<=1e-6*Math.max(1,Math.abs(h),Math.abs(m))&&Math.abs(u-b)<=1e-6*Math.max(1,Math.abs(u),Math.abs(b))&&Math.abs(f-L)<=1e-6*Math.max(1,Math.abs(f),Math.abs(L))&&Math.abs(d-R)<=1e-6*Math.max(1,Math.abs(d),Math.abs(R))&&Math.abs(p-F)<=1e-6*Math.max(1,Math.abs(p),Math.abs(F))&&Math.abs(A-v)<=1e-6*Math.max(1,Math.abs(A),Math.abs(v))&&Math.abs(g-W)<=1e-6*Math.max(1,Math.abs(g),Math.abs(W))&&Math.abs(y-z)<=1e-6*Math.max(1,Math.abs(y),Math.abs(z))}var W1=sn,Y1=tu;function K1(){let e=new $(4);return $!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function eu(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function ru(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function nu(e){let t=e[0],r=e[1],n=e[2],s=e[3];return Math.sqrt(t*t+r*r+n*n+s*s)}function su(e){let t=e[0],r=e[1],n=e[2],s=e[3];return t*t+r*r+n*n+s*s}function ou(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=r*r+n*n+s*s+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=r*i,e[1]=n*i,e[2]=s*i,e[3]=o*i,e}function iu(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function au(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=t[3];return e[0]=s+n*(r[0]-s),e[1]=o+n*(r[1]-o),e[2]=i+n*(r[2]-i),e[3]=a+n*(r[3]-a),e}function cu(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3];return e[0]=r[0]*n+r[4]*s+r[8]*o+r[12]*i,e[1]=r[1]*n+r[5]*s+r[9]*o+r[13]*i,e[2]=r[2]*n+r[6]*s+r[10]*o+r[14]*i,e[3]=r[3]*n+r[7]*s+r[11]*o+r[15]*i,e}function lu(e,t,r){let n=t[0],s=t[1],o=t[2],i=r[0],a=r[1],c=r[2],l=r[3],h=l*n+a*o-c*s,u=l*s+c*n-i*o,f=l*o+i*s-a*n,d=-i*n-a*s-c*o;return e[0]=h*l+d*-i+u*-c-f*-a,e[1]=u*l+d*-a+f*-i-h*-c,e[2]=f*l+d*-c+h*-a-u*-i,e[3]=t[3],e}var V2=function(){let e=K1();return function(t,r,n,s,o,i){let a,c;for(r||(r=4),n||(n=0),s?c=Math.min(s*r+n,t.length):c=t.length,a=n;a<c;a+=r)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],e[3]=t[a+3],o(e,e,i),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2],t[a+3]=e[3];return t}}();var ha;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(ha||(ha={}));var Z1=45*Math.PI/180,$1=1,ca=.1,la=500,tx=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),O=class extends gr{static get IDENTITY(){return rx()}static get ZERO(){return ex()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return ha}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,r,n,s,o,i,a,c,l,h,u,f,d,p,A,g){return this[0]=t,this[1]=r,this[2]=n,this[3]=s,this[4]=o,this[5]=i,this[6]=a,this[7]=c,this[8]=l,this[9]=h,this[10]=u,this[11]=f,this[12]=d,this[13]=p,this[14]=A,this[15]=g,this.check()}setRowMajor(t,r,n,s,o,i,a,c,l,h,u,f,d,p,A,g){return this[0]=t,this[1]=o,this[2]=l,this[3]=d,this[4]=r,this[5]=i,this[6]=h,this[7]=p,this[8]=n,this[9]=a,this[10]=u,this[11]=A,this[12]=s,this[13]=c,this[14]=f,this[15]=g,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(tx)}fromObject(t){return this.check()}fromQuaternion(t){return na(this,t),this.check()}frustum(t){let{left:r,right:n,bottom:s,top:o,near:i=ca,far:a=la}=t;return a===1/0?nx(this,r,n,s,o,i):sa(this,r,n,s,o,i,a),this.check()}lookAt(t){let{eye:r,center:n=[0,0,0],up:s=[0,1,0]}=t;return aa(this,r,n,s),this.check()}ortho(t){let{left:r,right:n,bottom:s,top:o,near:i=ca,far:a=la}=t;return ia(this,r,n,s,o,i,a),this.check()}orthographic(t){let{fovy:r=Z1,aspect:n=$1,focalDistance:s=1,near:o=ca,far:i=la}=t;hu(r);let a=r/2,c=s*Math.tan(a),l=c*n;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:o,far:i})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:n=1,near:s=.1,far:o=500}=t;return hu(r),oa(this,r,n,s,o),this.check()}determinant(){return Ki(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],o=1/n[1],i=1/n[2];return t[0]=this[0]*s,t[1]=this[1]*o,t[2]=this[2]*i,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*o,t[6]=this[6]*i,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*o,t[10]=this[10]*i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],o=1/n[1],i=1/n[2];return t[0]=this[0]*s,t[1]=this[1]*o,t[2]=this[2]*i,t[3]=this[4]*s,t[4]=this[5]*o,t[5]=this[6]*i,t[6]=this[8]*s,t[7]=this[9]*o,t[8]=this[10]*i,t}transpose(){return Wi(this,this),this.check()}invert(){return Yi(this,this),this.check()}multiplyLeft(t){return sn(this,t,this),this.check()}multiplyRight(t){return sn(this,this,t),this.check()}rotateX(t){return ta(this,this,t),this.check()}rotateY(t){return ea(this,this,t),this.check()}rotateZ(t){return ra(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return $i(this,this,t,r),this.check()}scale(t){return Zi(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Qi(this,this,t),this.check()}transform(t,r){return t.length===4?(r=cu(r||[-0,-0,-0,-0],t,this),Ee(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,s;switch(n){case 2:s=us(r||[-0,-0],t,this);break;case 3:s=Ve(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ee(s,t.length),s}transformAsVector(t,r){let n;switch(t.length){case 2:n=fs(r||[-0,-0],t,this);break;case 3:n=ds(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ee(n,t.length),n}transformPoint(t,r){return this.transformAsPoint(t,r)}transformVector(t,r){return this.transformAsPoint(t,r)}transformDirection(t,r){return this.transformAsVector(t,r)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,r,n){return this.identity().translate([t,r,n])}},Es,Bs;function ex(){return Es||(Es=new O([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Es)),Es}function rx(){return Bs||(Bs=new O,Object.freeze(Bs)),Bs}function hu(e){if(e>Math.PI*2)throw Error("expected radians")}function nx(e,t,r,n,s,o){let i=2*o/(r-t),a=2*o/(s-n),c=(r+t)/(r-t),l=(s+n)/(s-n),h=-1,u=-1,f=-2*o;return e[0]=i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=c,e[9]=l,e[10]=h,e[11]=u,e[12]=0,e[13]=0,e[14]=f,e[15]=0,e}function uu(){let e=new $(4);return $!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function fu(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function ua(e,t,r){r=r*.5;let 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 fa(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=r[0],c=r[1],l=r[2],h=r[3];return e[0]=n*h+i*a+s*l-o*c,e[1]=s*h+i*c+o*a-n*l,e[2]=o*h+i*l+n*c-s*a,e[3]=i*h-n*a-s*c-o*l,e}function du(e,t,r){r*=.5;let n=t[0],s=t[1],o=t[2],i=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+i*a,e[1]=s*c+o*a,e[2]=o*c-s*a,e[3]=i*c-n*a,e}function pu(e,t,r){r*=.5;let n=t[0],s=t[1],o=t[2],i=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c-o*a,e[1]=s*c+i*a,e[2]=o*c+n*a,e[3]=i*c-s*a,e}function mu(e,t,r){r*=.5;let n=t[0],s=t[1],o=t[2],i=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+s*a,e[1]=s*c-n*a,e[2]=o*c+i*a,e[3]=i*c-o*a,e}function gu(e,t){let r=t[0],n=t[1],s=t[2];return e[0]=r,e[1]=n,e[2]=s,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-s*s)),e}function on(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=t[3],c=r[0],l=r[1],h=r[2],u=r[3],f,d,p,A,g;return f=s*c+o*l+i*h+a*u,f<0&&(f=-f,c=-c,l=-l,h=-h,u=-u),1-f>1e-6?(d=Math.acos(f),g=Math.sin(d),p=Math.sin((1-n)*d)/g,A=Math.sin(n*d)/g):(p=1-n,A=n),e[0]=p*s+A*c,e[1]=p*o+A*l,e[2]=p*i+A*h,e[3]=p*a+A*u,e}function Au(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=r*r+n*n+s*s+o*o,a=i?1/i:0;return e[0]=-r*a,e[1]=-n*a,e[2]=-s*a,e[3]=o*a,e}function xu(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function da(e,t){let r=t[0]+t[4]+t[8],n;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let o=(s+1)%3,i=(s+2)%3;n=Math.sqrt(t[s*3+s]-t[o*3+o]-t[i*3+i]+1),e[s]=.5*n,n=.5/n,e[3]=(t[o*3+i]-t[i*3+o])*n,e[o]=(t[o*3+s]+t[s*3+o])*n,e[i]=(t[i*3+s]+t[s*3+i])*n}return e}var yu=eu;var Tu=ru,_u=iu,Eu=au,Bu=nu;var Cu=su;var Su=ou;var Mu=function(){let e=ms(),t=gs(1,0,0),r=gs(0,1,0);return function(n,s,o){let i=en(s,o);return i<-.999999?(Ge(e,t,s),ki(e)<1e-6&&Ge(e,r,s),Ui(e,e),ua(n,e,Math.PI),n):i>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Ge(e,s,o),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+i,Su(n,n))}}(),tw=function(){let e=uu(),t=uu();return function(r,n,s,o,i,a){return on(e,n,i,a),on(t,s,o,a),on(r,e,t,2*a*(1-a)),r}}(),ew=function(){let e=zh();return function(t,r,n,s){return e[0]=n[0],e[3]=n[1],e[6]=n[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],Su(t,da(t,e))}}();var sx=[0,0,0,1],Qt=class extends _e{constructor(t=0,r=0,n=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,n,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,r,n,s){return this[0]=t,this[1]=r,this[2]=n,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return da(this,t),this.check()}fromAxisRotation(t,r){return ua(this,t,r),this.check()}identity(){return fu(this),this.check()}setAxisAngle(t,r){return this.fromAxisRotation(t,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=G(t)}get y(){return this[1]}set y(t){this[1]=G(t)}get z(){return this[2]}set z(t){this[2]=G(t)}get w(){return this[3]}set w(t){this[3]=G(t)}len(){return Bu(this)}lengthSquared(){return Cu(this)}dot(t){return _u(this,t)}rotationTo(t,r){return Mu(this,t,r),this.check()}add(t){return yu(this,this,t),this.check()}calculateW(){return gu(this,this),this.check()}conjugate(){return xu(this,this),this.check()}invert(){return Au(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(Eu(this,t,r,n),this.check())}multiplyRight(t){return fa(this,this,t),this.check()}multiplyLeft(t){return fa(this,t,this),this.check()}normalize(){let t=this.len(),r=t>0?1/t:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,t===0&&(this[3]=1),this.check()}rotateX(t){return du(this,this,t),this.check()}rotateY(t){return pu(this,this,t),this.check()}rotateZ(t){return mu(this,this,t),this.check()}scale(t){return Tu(this,this,t),this.check()}slerp(t,r,n){let s,o,i;switch(arguments.length){case 1:({start:s=sx,target:o,ratio:i}=t);break;case 2:s=this,o=t,i=r;break;default:s=t,o=r,i=n}return on(this,s,o,i),this.check()}transformVector4(t,r=new mr){return lu(r,t,this),Ee(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,r){return this.setAxisAngle(t,r)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Gt={};ut(Gt,{EPSILON1:()=>ox,EPSILON10:()=>px,EPSILON11:()=>mx,EPSILON12:()=>gx,EPSILON13:()=>Ax,EPSILON14:()=>xx,EPSILON15:()=>yx,EPSILON16:()=>Tx,EPSILON17:()=>_x,EPSILON18:()=>Ex,EPSILON19:()=>Bx,EPSILON2:()=>ix,EPSILON20:()=>Cx,EPSILON3:()=>ax,EPSILON4:()=>cx,EPSILON5:()=>lx,EPSILON6:()=>hx,EPSILON7:()=>ux,EPSILON8:()=>fx,EPSILON9:()=>dx,PI_OVER_FOUR:()=>Mx,PI_OVER_SIX:()=>bx,PI_OVER_TWO:()=>Sx,TWO_PI:()=>Ix});var ox=.1,ix=.01,ax=.001,cx=1e-4,lx=1e-5,hx=1e-6,ux=1e-7,fx=1e-8,dx=1e-9,px=1e-10,mx=1e-11,gx=1e-12,Ax=1e-13,xx=1e-14,yx=1e-15,Tx=1e-16,_x=1e-17,Ex=1e-18,Bx=1e-19,Cx=1e-20,Sx=Math.PI/2,Mx=Math.PI/4,bx=Math.PI/6,Ix=Math.PI*2;function Cs(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var Vt=Math.PI,Fu=Vt/4,bu=Vt/180,Iu=180/Vt,Ss=512;function se(e){let[t,r]=e;Cs(Number.isFinite(t)),Cs(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let n=t*bu,s=r*bu,o=Ss*(n+Vt)/(2*Vt),i=Ss*(Vt+Math.log(Math.tan(Fu+s*.5)))/(2*Vt);return[o,i]}function oe(e){let[t,r]=e,n=t/Ss*(2*Vt)-Vt,s=2*(Math.atan(Math.exp(r/Ss*(2*Vt)-Vt))-Fu);return[n*Iu,s*Iu]}var Uw=Math.PI/180;var Ru=6378137*Math.PI;function pa(e){let t=se(e);return t[0]=(t[0]/256-1)*Ru,t[1]=(t[1]/256-1)*Ru,t}var Jx={id:"imagery-layer",data:"",serviceType:"auto",srs:"auto",layers:{type:"array",compare:!0,value:[]},onMetadataLoad:{type:"function",value:()=>{}},onMetadataLoadError:{type:"function",value:console.error},onImageLoadStart:{type:"function",value:()=>{}},onImageLoad:{type:"function",value:()=>{}},onImageLoadError:{type:"function",compare:!1,value:(e,t)=>console.error(t,e)}},bs=class extends He.CompositeLayer{get isLoaded(){return this.state?.loadCounter===0&&super.isLoaded}shouldUpdateState(){return!0}initializeState(){this.state._nextRequestId=0,this.state.lastRequestId=-1,this.state.loadCounter=0}updateState({changeFlags:t,props:r,oldProps:n}){let{viewport:s}=this.context;t.dataChanged||r.serviceType!==n.serviceType?(this.state.imageSource=this._createImageSource(r),this._loadMetadata(),this.debounce(()=>this.loadImage(s,"image source changed"),0)):(0,He._deepEqual)(r.layers,n.layers,1)?t.viewportChanged&&this.debounce(()=>this.loadImage(s,"viewport changed")):this.debounce(()=>this.loadImage(s,"layers changed"),0)}finalizeState(){}renderLayers(){let{bounds:t,image:r,lastRequestParameters:n}=this.state;return r&&new Pu.BitmapLayer({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:n.srs==="EPSG:4326"?He.COORDINATE_SYSTEM.LNGLAT:He.COORDINATE_SYSTEM.CARTESIAN,bounds:t,image:r})}async getFeatureInfoText(t,r){let{lastRequestParameters:n}=this.state;return n?await this.state.imageSource.getFeatureInfoText?.({...n,query_layers:n.layers,x:t,y:r,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(t){if(t.data instanceof wt)return t.data;if(typeof t.data=="string")return Pi({url:t.data,loadOptions:t.loadOptions,type:t.serviceType});throw new Error("invalid image source in props.data")}async _loadMetadata(){let{imageSource:t}=this.state;try{this.state.loadCounter++;let r=await t.getMetadata();this.state.imageSource===t&&this.getCurrentLayer()?.props.onMetadataLoad(r)}catch(r){this.getCurrentLayer()?.props.onMetadataLoadError(r)}finally{this.state.loadCounter--}}async loadImage(t,r){let{layers:n,serviceType:s}=this.props;if(s==="wms"&&n.length===0)return;let o=t.getBounds(),{width:i,height:a}=t,c=this.getRequestId(),{srs:l}=this.props;l==="auto"&&(l=t.resolution?"EPSG:4326":"EPSG:3857");let h={width:i,height:a,boundingBox:[[o[0],o[1]],[o[2],o[3]]],layers:n,crs:l};if(l==="EPSG:3857"){let u=pa([o[0],o[1]]),f=pa([o[2],o[3]]);h.boundingBox=[u,f]}try{this.state.loadCounter++,this.props.onImageLoadStart(c);let u=await this.state.imageSource.getImage(h);this.state.lastRequestId<c&&(this.getCurrentLayer()?.props.onImageLoad(c),this.setState({image:u,bounds:o,lastRequestParameters:h,lastRequestId:c}))}catch(u){this.raiseError(u,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(c,u)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(t,r=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>t(),r)}},Ms=bs;(()=>{bs.layerName="WMSLayer"})(),(()=>{bs.defaultProps=Jx})();var Ou=D(Dt(),1),qx={getHeight:{type:"accessor",value:0},greatCircle:!0},Is=class extends Ou.ArcLayer{},an=Is;(()=>{Is.layerName="GreatCircleLayer"})(),(()=>{Is.defaultProps=qx})();var Nu=D(vt(),1),ma=D(Dt(),1),jx={...ma.PolygonLayer.defaultProps},ws=class extends Nu.CompositeLayer{indexToBounds(){return null}renderLayers(){let{elevationScale:t,extruded:r,wireframe:n,filled:s,stroked:o,lineWidthUnits:i,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:h,lineMiterLimit:u,lineDashJustified:f,getElevation:d,getFillColor:p,getLineColor:A,getLineWidth:g}=this.props,{updateTriggers:y,material:E,transitions:_}=this.props,B=this.getSubLayerClass("cell",ma.PolygonLayer),{updateTriggers:S,...M}=this.indexToBounds()||{};return new B({filled:s,wireframe:n,extruded:r,elevationScale:t,stroked:o,lineWidthUnits:i,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:h,lineMiterLimit:u,lineDashJustified:f,material:E,transitions:_,getElevation:d,getFillColor:p,getLineColor:A,getLineWidth:g},this.getSubLayerProps({id:"cell",updateTriggers:y&&{...S,getElevation:y.getElevation,getFillColor:y.getFillColor,getLineColor:y.getLineColor,getLineWidth:y.getLineWidth}}),M)}},bt=ws;(()=>{ws.layerName="GeoCellLayer"})(),(()=>{ws.defaultProps=jx})();var Fs=D(ga(),1),Xx=3,Wx=30,Yx=2*Wx+1,vu=180/Math.PI;function Gu(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function Uu(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Vu(e){return[Uu(e[0]),Uu(e[1])]}function Hu(e,[t,r]){switch(e){case 0:return[1,t,r];case 1:return[-t,1,r];case 2:return[-t,-r,1];case 3:return[-1,-r,-t];case 4:return[r,-1,-t];case 5:return[r,t,-1];default:throw new Error("Invalid face")}}function zu([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*vu,n*vu]}function ku(e){let t=Fs.default.fromString(e,!0,10).toString(2);for(;t.length<Xx+Yx;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),s=t.substring(3,r),o=s.length/2,i=Fs.default.fromString(n,!0,2).toString(10),a=Fs.default.fromString(s,!0,2).toString(4);for(;a.length<o;)a="0"+a;return`${i}/${a}`}function Kx(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let s=t[0];t[0]=t[1],t[1]=s}}function Ju(e){let t=e.split("/"),r=parseInt(t[0],10),n=t[1],s=n.length,o=[0,0],i;for(let a=s-1;a>=0;a--){i=s-a;let c=n[a],l=0,h=0;c==="1"?h=1:c==="2"?(l=1,h=1):c==="3"&&(l=1);let u=Math.pow(2,i-1);Kx(u,o,l,h),o[0]+=u*l,o[1]+=u*h}if(r%2===1){let a=o[0];o[0]=o[1],o[1]=a}return{face:r,ij:o,level:i}}var qu=D(ga(),1);function Qx(e){let t=e.padEnd(16,"0");return qu.default.fromString(t,16)}var Zx=100;function $x({face:e,ij:t,level:r}){let n=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(Zx*Math.pow(2,-r))),o=new Float64Array(4*s*2+2),i=0,a=0;for(let c=0;c<4;c++){let l=n[c].slice(0),h=n[c+1],u=(h[0]-l[0])/s,f=(h[1]-l[1])/s;for(let d=0;d<s;d++){l[0]+=u,l[1]+=f;let p=Gu(t,r,l),A=Vu(p),g=Hu(e,A),y=zu(g);Math.abs(y[1])>89.999&&(y[0]=a);let E=y[0]-a;y[0]+=E>180?-360:E<-180?360:0,o[i++]=y[0],o[i++]=y[1],a=y[0]}}return o[i++]=o[0],o[i++]=o[1],o}function ty(e){if(typeof e=="string"){if(e.indexOf("/")>0)return e;e=Qx(e)}return ku(e.toString())}function ju(e){let t=ty(e),r=Ju(t);return $x(r)}var ey={getS2Token:{type:"accessor",value:e=>e.token}},Ls=class extends bt{indexToBounds(){let{data:t,getS2Token:r}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(n,s)=>ju(r(n,s))}}},ln=Ls;(()=>{Ls.layerName="S2Layer"})(),(()=>{Ls.defaultProps=ey})();var Aa=512;function ry(e,t){let r=0,n=0,s=1<<e.length,o=s/Aa;for(let i=0;i<e.length;i++){s>>=1;let a=parseInt(e[i]);a%2&&(r|=s),a>1&&(n|=s)}return[[r/o,Aa-n/o],[(r+t)/o,Aa-(n+t)/o]]}function Xu(e,t=1){let[r,n]=ry(e,t),[s,o]=oe(r),[i,a]=oe(n);return[i,o,i,a,s,a,s,o,i,o]}var ny={getQuadkey:{type:"accessor",value:e=>e.quadkey}},Rs=class extends bt{indexToBounds(){let{data:t,extruded:r,getQuadkey:n}=this.props,s=r?.99:1;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(o,i)=>Xu(n(o,i),s),updateTriggers:{getPolygon:s}}}},hn=Rs;(()=>{Rs.layerName="QuadkeyLayer"})(),(()=>{Rs.defaultProps=ny})();var Vs=D(vt(),1),ff=D(Dt(),1);var ze=class{constructor(t){this.index=t,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(t){this._bbox||(this._bbox=t,"west"in t?this.boundingBox=[[t.west,t.south],[t.east,t.north]]:this.boundingBox=[[t.left,t.top],[t.right,t.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error("byteLength not defined in tile data"),t}async _loadData({getData:t,requestScheduler:r,onLoad:n,onError:s}){let{index:o,id:i,bbox:a,userData:c,zoom:l}=this,h=this._loaderId;this._abortController=new AbortController;let{signal:u}=this._abortController,f=await r.scheduleRequest(this,A=>A.isSelected?1:-1);if(!f){this._isCancelled=!0;return}if(this._isCancelled){f.done();return}let d=null,p;try{d=await t({index:o,id:i,bbox:a,userData:c,zoom:l,signal:u})}catch(A){p=A||!0}finally{f.done()}if(h===this._loaderId){if(this._loader=void 0,this.content=d,this._isCancelled&&!d){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,p?s(p,this):n(this)}}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var dn=D(vt(),1);var nt={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var Wu=new x,sy=new x,Ce=class{constructor(t=[0,0,0],r=[0,0,0],n){P(this,"center",void 0),P(this,"halfDiagonal",void 0),P(this,"minimum",void 0),P(this,"maximum",void 0),n=n||Wu.copy(t).add(r).scale(.5),this.center=new x(n),this.halfDiagonal=new x(r).subtract(this.center),this.minimum=new x(t),this.maximum=new x(r)}clone(){return new Ce(this.minimum,this.maximum,this.center)}equals(t){return this===t||Boolean(t)&&this.minimum.equals(t.minimum)&&this.maximum.equals(t.maximum)}transform(t){return this.center.transformAsPoint(t),this.halfDiagonal.transform(t),this.minimum.transform(t),this.maximum.transform(t),this}intersectPlane(t){let{halfDiagonal:r}=this,n=sy.from(t.normal),s=r.x*Math.abs(n.x)+r.y*Math.abs(n.y)+r.z*Math.abs(n.z),o=this.center.dot(n)+t.distance;return o-s>0?nt.INSIDE:o+s<0?nt.OUTSIDE:nt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=Wu.from(t).subtract(this.center),{halfDiagonal:n}=this,s=0,o;return o=Math.abs(r.x)-n.x,o>0&&(s+=o*o),o=Math.abs(r.y)-n.y,o>0&&(s+=o*o),o=Math.abs(r.z)-n.z,o>0&&(s+=o*o),s}};var un=new x,Yu=new x,Ft=class{constructor(t=[0,0,0],r=0){P(this,"center",void 0),P(this,"radius",void 0),this.radius=-0,this.center=new x,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=un.from(r),this.center=new x().from(t).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new Ft(this.center,this.radius)}union(t){let r=this.center,n=this.radius,s=t.center,o=t.radius,i=un.copy(s).subtract(r),a=i.magnitude();if(n>=a+o)return this.clone();if(o>=a+n)return t.clone();let c=(n+a+o)*.5;return Yu.copy(i).scale((-n+c)/a).add(r),this.center.copy(Yu),this.radius=c,this}expand(t){let n=un.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=_s.getScaling(un,t);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(t){let r=this.distanceTo(t);return r*r}distanceTo(t){let n=un.from(t).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(t){let r=this.center,n=this.radius,o=t.normal.dot(r)+t.distance;return o<-n?nt.OUTSIDE:o<n?nt.INTERSECTING:nt.INSIDE}};var oy=new x,iy=new x,Ps=new x,Os=new x,Ns=new x,ay=new x,cy=new x,ie={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Ht=class{constructor(t=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){P(this,"center",void 0),P(this,"halfAxes",void 0),this.center=new x().from(t),this.halfAxes=new k(r)}get halfSize(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new x(t).len(),new x(r).len(),new x(n).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),s=new x(t).normalize(),o=new x(r).normalize(),i=new x(n).normalize();return new Qt().fromMatrix3(new k([...s,...o,...i]))}fromCenterHalfSizeQuaternion(t,r,n){let s=new Qt(n),o=new k().fromQuaternion(s);return o[0]=o[0]*r[0],o[1]=o[1]*r[0],o[2]=o[2]*r[0],o[3]=o[3]*r[1],o[4]=o[4]*r[1],o[5]=o[5]*r[1],o[6]=o[6]*r[2],o[7]=o[7]*r[2],o[8]=o[8]*r[2],this.center=new x().from(t),this.halfAxes=o,this}clone(){return new Ht(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new Ft){let r=this.halfAxes,n=r.getColumn(0,Ps),s=r.getColumn(1,Os),o=r.getColumn(2,Ns),i=oy.copy(n).add(s).add(o);return t.center.copy(this.center),t.radius=i.magnitude(),t}intersectPlane(t){let r=this.center,n=t.normal,s=this.halfAxes,o=n.x,i=n.y,a=n.z,c=Math.abs(o*s[ie.COLUMN0ROW0]+i*s[ie.COLUMN0ROW1]+a*s[ie.COLUMN0ROW2])+Math.abs(o*s[ie.COLUMN1ROW0]+i*s[ie.COLUMN1ROW1]+a*s[ie.COLUMN1ROW2])+Math.abs(o*s[ie.COLUMN2ROW0]+i*s[ie.COLUMN2ROW1]+a*s[ie.COLUMN2ROW2]),l=n.dot(r)+t.distance;return l<=-c?nt.OUTSIDE:l>=c?nt.INSIDE:nt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=iy.from(t).subtract(this.center),n=this.halfAxes,s=n.getColumn(0,Ps),o=n.getColumn(1,Os),i=n.getColumn(2,Ns),a=s.magnitude(),c=o.magnitude(),l=i.magnitude();s.normalize(),o.normalize(),i.normalize();let h=0,u;return u=Math.abs(r.dot(s))-a,u>0&&(h+=u*u),u=Math.abs(r.dot(o))-c,u>0&&(h+=u*u),u=Math.abs(r.dot(i))-l,u>0&&(h+=u*u),h}computePlaneDistances(t,r,n=[-0,-0]){let s=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,i=this.center,a=this.halfAxes,c=a.getColumn(0,Ps),l=a.getColumn(1,Os),h=a.getColumn(2,Ns),u=ay.copy(c).add(l).add(h).add(i),f=cy.copy(u).subtract(t),d=r.dot(f);return s=Math.min(d,s),o=Math.max(d,o),u.copy(i).add(c).add(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),s=Math.min(d,s),o=Math.max(d,o),u.copy(i).add(c).subtract(l).add(h),f.copy(u).subtract(t),d=r.dot(f),s=Math.min(d,s),o=Math.max(d,o),u.copy(i).add(c).subtract(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).add(l).add(h),f.copy(u).subtract(t),d=r.dot(f),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).add(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).subtract(l).add(h),f.copy(u).subtract(t),d=r.dot(f),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).subtract(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),s=Math.min(d,s),o=Math.max(d,o),n[0]=s,n[1]=o,n}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,Ps);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,Os);n.transformAsPoint(t);let s=this.halfAxes.getColumn(2,Ns);return s.transformAsPoint(t),this.halfAxes=new k([...r,...n,...s]),this}getTransform(){throw new Error("not implemented")}};var Ku=new x,Qu=new x,lt=class{constructor(t=[0,0,1],r=0){P(this,"normal",void 0),P(this,"distance",void 0),this.normal=new x,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return ct(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=Ku.from(t),this.normal.from(r).normalize();let n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,r,n,s){return this.normal.set(t,r,n),ct(gt(this.normal.len(),1)),this.distance=s,this}clone(){return new lt(this.normal,this.distance)}equals(t){return gt(this.distance,t.distance)&>(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=Qu.copy(this.normal).transformAsVector(t).normalize(),n=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(n,r)}projectPointOntoPlane(t,r=[0,0,0]){let n=Ku.from(t),s=this.getPointDistance(n),o=Qu.copy(this.normal).scale(s);return n.subtract(o).to(r)}};var Zu=[new x([1,0,0]),new x([0,1,0]),new x([0,0,1])],$u=new x,ly=new x,it=class{constructor(t=[]){P(this,"planes",void 0),this.planes=t}fromBoundingSphere(t){this.planes.length=2*Zu.length;let r=t.center,n=t.radius,s=0;for(let o of Zu){let i=this.planes[s],a=this.planes[s+1];i||(i=this.planes[s]=new lt),a||(a=this.planes[s+1]=new lt);let c=$u.copy(o).scale(-n).add(r);i.fromPointNormal(c,o);let l=$u.copy(o).scale(n).add(r),h=ly.copy(o).negate();a.fromPointNormal(l,h),s+=2}return this}computeVisibility(t){let r=nt.INSIDE;for(let n of this.planes)switch(t.intersectPlane(n)){case nt.OUTSIDE:return nt.OUTSIDE;case nt.INTERSECTING:r=nt.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(ct(Number.isFinite(r),"parentPlaneMask is required."),r===it.MASK_OUTSIDE||r===it.MASK_INSIDE)return r;let n=it.MASK_INSIDE,s=this.planes;for(let o=0;o<this.planes.length;++o){let i=o<31?1<<o:0;if(o<31&&!(r&i))continue;let a=s[o],c=t.intersectPlane(a);if(c===nt.OUTSIDE)return it.MASK_OUTSIDE;c===nt.INTERSECTING&&(n|=i)}return n}};P(it,"MASK_OUTSIDE",4294967295);P(it,"MASK_INSIDE",0);P(it,"MASK_INDETERMINATE",2147483647);var cL=new x,lL=new x,hL=new x,uL=new x,fL=new x;var yL=new x,TL=new x,_L=new x,EL=new x,BL=new x,CL=new x,SL=new x,ML=new x,bL=new x,IL=new x,wL=new x,FL=new x;var Zt=new k,uy=new k,fy=new k,Ds=new k,tf=new k;function Ta(e,t={}){let r=Gt.EPSILON20,n=10,s=0,o=0,i=uy,a=fy;i.identity(),a.copy(e);let c=r*dy(a);for(;o<n&&py(a)>c;)my(a,Ds),tf.copy(Ds).transpose(),a.multiplyRight(Ds),a.multiplyLeft(tf),i.multiplyRight(Ds),++s>2&&(++o,s=0);return t.unitary=i.toTarget(t.unitary),t.diagonal=a.toTarget(t.diagonal),t}function dy(e){let t=0;for(let r=0;r<9;++r){let n=e[r];t+=n*n}return Math.sqrt(t)}var xa=[1,0,0],ya=[2,2,1];function py(e){let t=0;for(let r=0;r<3;++r){let n=e[Zt.getElementIndex(ya[r],xa[r])];t+=2*n*n}return Math.sqrt(t)}function my(e,t){let r=Gt.EPSILON15,n=0,s=1;for(let l=0;l<3;++l){let h=Math.abs(e[Zt.getElementIndex(ya[l],xa[l])]);h>n&&(s=l,n=h)}let o=xa[s],i=ya[s],a=1,c=0;if(Math.abs(e[Zt.getElementIndex(i,o)])>r){let l=e[Zt.getElementIndex(i,i)],h=e[Zt.getElementIndex(o,o)],u=e[Zt.getElementIndex(i,o)],f=(l-h)/2/u,d;f<0?d=-1/(-f+Math.sqrt(1+f*f)):d=1/(f+Math.sqrt(1+f*f)),a=1/Math.sqrt(1+d*d),c=d*a}return k.IDENTITY.to(t),t[Zt.getElementIndex(o,o)]=t[Zt.getElementIndex(i,i)]=a,t[Zt.getElementIndex(i,o)]=c,t[Zt.getElementIndex(o,i)]=-c,t}var Se=new x,gy=new x,Ay=new x,xy=new x,yy=new x,Ty=new k,_y={diagonal:new k,unitary:new k};function fn(e,t=new Ht){if(!e||e.length===0)return t.halfAxes=new k([0,0,0,0,0,0,0,0,0]),t.center=new x,t;let r=e.length,n=new x(0,0,0);for(let T of e)n.add(T);let s=1/r;n.multiplyByScalar(s);let o=0,i=0,a=0,c=0,l=0,h=0;for(let T of e){let m=Se.copy(T).subtract(n);o+=m.x*m.x,i+=m.x*m.y,a+=m.x*m.z,c+=m.y*m.y,l+=m.y*m.z,h+=m.z*m.z}o*=s,i*=s,a*=s,c*=s,l*=s,h*=s;let u=Ty;u[0]=o,u[1]=i,u[2]=a,u[3]=i,u[4]=c,u[5]=l,u[6]=a,u[7]=l,u[8]=h;let{unitary:f}=Ta(u,_y),d=t.halfAxes.copy(f),p=d.getColumn(0,Ay),A=d.getColumn(1,xy),g=d.getColumn(2,yy),y=-Number.MAX_VALUE,E=-Number.MAX_VALUE,_=-Number.MAX_VALUE,B=Number.MAX_VALUE,S=Number.MAX_VALUE,M=Number.MAX_VALUE;for(let T of e)Se.copy(T),y=Math.max(Se.dot(p),y),E=Math.max(Se.dot(A),E),_=Math.max(Se.dot(g),_),B=Math.min(Se.dot(p),B),S=Math.min(Se.dot(A),S),M=Math.min(Se.dot(g),M);p=p.multiplyByScalar(.5*(B+y)),A=A.multiplyByScalar(.5*(S+E)),g=g.multiplyByScalar(.5*(M+_)),t.center.copy(p).add(A).add(g);let w=gy.set(y-B,E-S,_-M).multiplyByScalar(.5),C=new k([w[0],0,0,0,w[1],0,0,0,w[2]]);return t.halfAxes.multiplyRight(C),t}var Ar=512,ef=3,rf=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],nf=rf.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),Ey=nf.concat([[.25,.5],[.75,.5]]),Me=class{constructor(t,r,n){this.x=t,this.y=r,this.z=n}get children(){if(!this._children){let t=this.x*2,r=this.y*2,n=this.z+1;this._children=[new Me(t,r,n),new Me(t,r+1,n),new Me(t+1,r,n),new Me(t+1,r+1,n)]}return this._children}update(t){let{viewport:r,cullingVolume:n,elevationBounds:s,minZ:o,maxZ:i,bounds:a,offset:c,project:l}=t,h=this.getBoundingVolume(s,c,l);if(a&&!this.insideBounds(a)||n.computeVisibility(h)<0)return!1;if(!this.childVisible){let{z:f}=this;if(f<i&&f>=o){let d=h.distanceTo(r.cameraPosition)*r.scale/r.height;f+=Math.floor(Math.log2(d))}if(f>=i)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let f of this.children)f.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(let r of this._children)r.getSelected(t);return t}insideBounds([t,r,n,s]){let o=Math.pow(2,this.z),i=Ar/o;return this.x*i<n&&this.y*i<s&&(this.x+1)*i>t&&(this.y+1)*i>r}getBoundingVolume(t,r,n){if(n){let c=this.z<1?Ey:this.z<2?nf:rf,l=[];for(let h of c){let u=vs(this.x+h[0],this.y+h[1],this.z);u[2]=t[0],l.push(n(u)),t[0]!==t[1]&&(u[2]=t[1],l.push(n(u)))}return fn(l)}let s=Math.pow(2,this.z),o=Ar/s,i=this.x*o+r*Ar,a=Ar-(this.y+1)*o;return new Ce([i,a,t[0]],[i+o,a+o,t[1]])}};function sf(e,t,r,n){let s=e instanceof dn._GlobeViewport&&e.resolution?e.projectPosition:null,o=Object.values(e.getFrustumPlanes()).map(({normal:d,distance:p})=>new lt(d.clone().negate(),p)),i=new it(o),a=e.distanceScales.unitsPerMeter[2],c=r&&r[0]*a||0,l=r&&r[1]*a||0,h=e instanceof dn.WebMercatorViewport&&e.pitch<=60?t:0;if(n){let[d,p,A,g]=n,y=se([d,g]),E=se([A,p]);n=[y[0],Ar-y[1],E[0],Ar-E[1]]}let u=new Me(0,0,0),f={viewport:e,project:s,cullingVolume:i,elevationBounds:[c,l],minZ:h,maxZ:t,bounds:n,offset:0};if(u.update(f),e instanceof dn.WebMercatorViewport&&e.subViewports&&e.subViewports.length>1){for(f.offset=-1;u.update(f)&&!(--f.offset<-ef););for(f.offset=1;u.update(f)&&!(++f.offset>ef););}return u.getSelected()}var ae=512,By=[-1/0,-1/0,1/0,1/0],be={type:"object",value:null,validate:(e,t)=>t.optional&&e===null||typeof e=="string"||Array.isArray(e)&&e.every(r=>typeof r=="string"),equal:(e,t)=>{if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;let r=e.length;if(r!==t.length)return!1;for(let n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}};function af(e,t){let r=[t.transformAsPoint([e[0],e[1]]),t.transformAsPoint([e[2],e[1]]),t.transformAsPoint([e[0],e[3]]),t.transformAsPoint([e[2],e[3]])];return[Math.min(...r.map(s=>s[0])),Math.min(...r.map(s=>s[1])),Math.max(...r.map(s=>s[0])),Math.max(...r.map(s=>s[1]))]}function Cy(e){return Math.abs(e.split("").reduce((t,r)=>(t<<5)-t+r.charCodeAt(0)|0,0))}function $t(e,t){if(!e||!e.length)return null;let{index:r,id:n}=t;if(Array.isArray(e)){let o=Cy(n)%e.length;e=e[o]}let s=e;for(let o of Object.keys(r)){let i=new RegExp(`{${o}}`,"g");s=s.replace(i,String(r[o]))}return Number.isInteger(r.y)&&Number.isInteger(r.z)&&(s=s.replace(/\{-y\}/g,String(Math.pow(2,r.z)-r.y-1))),s}function Sy(e,t,r){let n;if(t&&t.length===2){let[s,o]=t,i=e.getBounds({z:s}),a=e.getBounds({z:o});n=[Math.min(i[0],a[0]),Math.min(i[1],a[1]),Math.max(i[2],a[2]),Math.max(i[3],a[3])]}else n=e.getBounds();return e.isGeospatial?[Math.max(n[0],r[0]),Math.max(n[1],r[1]),Math.min(n[2],r[2]),Math.min(n[3],r[3])]:[Math.max(Math.min(n[0],r[2]),r[0]),Math.max(Math.min(n[1],r[3]),r[1]),Math.min(Math.max(n[2],r[0]),r[2]),Math.min(Math.max(n[3],r[1]),r[3])]}function cf({viewport:e,z:t,cullRect:r}){return(e.subViewports||[e]).map(s=>_a(s,t||0,r))}function _a(e,t,r){if(!Array.isArray(t)){let o=r.x-e.x,i=r.y-e.y,{width:a,height:c}=r,l={targetZ:t},h=e.unproject([o,i],l),u=e.unproject([o+a,i],l),f=e.unproject([o,i+c],l),d=e.unproject([o+a,i+c],l);return[Math.min(h[0],u[0],f[0],d[0]),Math.min(h[1],u[1],f[1],d[1]),Math.max(h[0],u[0],f[0],d[0]),Math.max(h[1],u[1],f[1],d[1])]}let n=_a(e,t[0],r),s=_a(e,t[1],r);return[Math.min(n[0],s[0]),Math.min(n[1],s[1]),Math.max(n[2],s[2]),Math.max(n[3],s[3])]}function My(e,t,r){return r?af(e,r).map(s=>s*t/ae):e.map(n=>n*t/ae)}function Ea(e,t){return Math.pow(2,e)*ae/t}function vs(e,t,r){let n=Ea(r,ae),s=e/n*360-180,o=Math.PI-2*Math.PI*t/n,i=180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o)));return[s,i]}function of(e,t,r,n){let s=Ea(r,n);return[e/s*ae,t/s*ae]}function Ba(e,t,r,n,s=ae){if(e.isGeospatial){let[l,h]=vs(t,r,n),[u,f]=vs(t+1,r+1,n);return{west:l,north:h,east:u,south:f}}let[o,i]=of(t,r,n,s),[a,c]=of(t+1,r+1,n,s);return{left:o,top:i,right:a,bottom:c}}function by(e,t,r,n,s){let o=Sy(e,null,n),i=Ea(t,r),[a,c,l,h]=My(o,i,s),u=[];for(let f=Math.floor(a);f<l;f++)for(let d=Math.floor(c);d<h;d++)u.push({x:f,y:d,z:t});return u}function Ca({viewport:e,maxZoom:t,minZoom:r,zRange:n,extent:s,tileSize:o=ae,modelMatrix:i,modelMatrixInverse:a,zoomOffset:c=0}){let l=e.isGeospatial?Math.round(e.zoom+Math.log2(ae/o))+c:Math.ceil(e.zoom)+c;if(typeof r=="number"&&Number.isFinite(r)&&l<r){if(!s)return[];l=r}typeof t=="number"&&Number.isFinite(t)&&l>t&&(l=t);let h=s;return i&&a&&s&&!e.isGeospatial&&(h=af(s,i)),e.isGeospatial?sf(e,l,n,s):by(e,l,o,h||By,a)}function Sa(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(e)}function Ma(e){return Number.isFinite(e.west)&&Number.isFinite(e.north)&&Number.isFinite(e.east)&&Number.isFinite(e.south)}function lf(e){let t={},r;return n=>{for(let s in n)if(!Iy(n[s],t[s])){r=e(n),t=n;break}return r}}function Iy(e,t){if(e===t)return!0;if(Array.isArray(e)){let r=e.length;if(!t||t.length!==r)return!1;for(let n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}return!1}var hf=1,Us=2,wy="never",Fy="no-overlap",pn="best-available",Ly=5,Ry={[pn]:Oy,[Fy]:Ny,[wy]:()=>{}},Py={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},ke=class{constructor(t){this._getCullBounds=lf(cf),this.opts={...Py,...t},this.onTileLoad=r=>{this.opts.onTileLoad?.(r),this.opts.maxCacheByteSize&&(this._cacheByteSize+=r.byteLength,this._resizeCache())},this._requestScheduler=new Ae({maxRequests:t.maxRequests,throttleRequests:Boolean(t.maxRequests&&t.maxRequests>0)}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new O,this._modelMatrixInverse=new O,this.setOptions(t)}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(t=>t.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(t=>t.needsReload)}setOptions(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom))}finalize(){for(let t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let t of this._cache.keys()){let r=this._cache.get(t);!this._selectedTiles||!this._selectedTiles.includes(r)?this._cache.delete(t):r.setNeedsReload()}}update(t,{zRange:r,modelMatrix:n}={zRange:null,modelMatrix:null}){let s=n?new O(n):new O,o=!s.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!gt(this._zRange,r)||o){o&&(this._modelMatrixInverse=s.clone().invert(),this._modelMatrix=s),this._viewport=t,this._zRange=r;let a=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:r,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=a.map(c=>this._getTile(c,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(a=>this._getTile(a.index,!0)));let i=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),i&&this._frameNumber++,this._frameNumber}isTileVisible(t,r){if(!t.isVisible)return!1;if(r&&this._viewport){let n=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:r}),{bbox:s}=t;for(let[o,i,a,c]of n){let l;if("west"in s)l=s.west<a&&s.east>o&&s.south<c&&s.north>i;else{let h=Math.min(s.top,s.bottom),u=Math.max(s.top,s.bottom);l=s.left<a&&s.right>o&&h<c&&u>i}if(l)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:r,minZoom:n,zRange:s,modelMatrix:o,modelMatrixInverse:i}){let{tileSize:a,extent:c,zoomOffset:l}=this.opts;return Ca({viewport:t,maxZoom:r,minZoom:n,zRange:s,tileSize:a,extent:c,modelMatrix:o,modelMatrixInverse:i,zoomOffset:l})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){let{tileSize:r}=this.opts;return{bbox:Ba(this._viewport,t.x,t.y,t.z,r)}}getParentIndex(t){let r=Math.floor(t.x/2),n=Math.floor(t.y/2),s=t.z-1;return{x:r,y:n,z:s}}updateTileStates(){let t=this.opts.refinementStrategy||pn,r=new Array(this._cache.size),n=0;for(let s of this._cache.values())r[n++]=s.isVisible,s.isSelected=!1,s.isVisible=!1;for(let s of this._selectedTiles)s.isSelected=!0,s.isVisible=!0;(typeof t=="function"?t:Ry[t])(Array.from(this._cache.values())),n=0;for(let s of this._cache.values())if(r[n++]!==s.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:t=0}=this.opts,r=[],n=0;for(let s of this._cache.values())s.isLoading&&(n++,!s.isSelected&&!s.isVisible&&r.push(s));for(;t>0&&n>t&&r.length>0;)r.shift().abort(),n--}_rebuildTree(){let{_cache:t}=this;for(let r of t.values())r.parent=null,r.children&&(r.children.length=0);for(let r of t.values()){let n=this._getNearestAncestor(r);r.parent=n,n?.children&&n.children.push(r)}}_resizeCache(){let{_cache:t,opts:r}=this,n=r.maxCacheSize||(r.maxCacheByteSize?1/0:Ly*this.selectedTiles.length),s=r.maxCacheByteSize||1/0;if(t.size>n||this._cacheByteSize>s){for(let[i,a]of t)if(!a.isVisible&&!a.isSelected&&(this._cacheByteSize-=r.maxCacheByteSize?a.byteLength:0,t.delete(i),this.opts.onTileUnload?.(a)),t.size<=n&&this._cacheByteSize<=s)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((i,a)=>i.zoom-a.zoom),this._dirty=!1)}_getTile(t,r){let n=this.getTileId(t),s=this._cache.get(n),o=!1;return!s&&r?(s=new ze(t),Object.assign(s,this.getTileMetadata(s.index)),Object.assign(s,{id:n,zoom:this.getTileZoom(s.index)}),o=!0,this._cache.set(n,s),this._dirty=!0):s&&s.needsReload&&(o=!0),s&&o&&s.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),s}_getNearestAncestor(t){let{_minZoom:r=0}=this,n=t.index;for(;this.getTileZoom(n)>r;){n=this.getParentIndex(n);let s=this._getTile(n);if(s)return s}return null}};function Oy(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!uf(t)&&ba(t);for(let t of e)t.isVisible=Boolean(t.state&Us)}function Ny(e){for(let r of e)r.state=0;for(let r of e)r.isSelected&&uf(r);let t=Array.from(e).sort((r,n)=>r.zoom-n.zoom);for(let r of t)if(r.isVisible=Boolean(r.state&Us),r.children&&(r.isVisible||r.state&hf))for(let n of r.children)n.state=hf;else r.isSelected&&ba(r)}function uf(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=Us,!0;t=t.parent}return!1}function ba(e){for(let t of e.children)t.isLoaded||t.content?t.state|=Us:ba(t)}var Dy={TilesetClass:ke,data:{type:"data",value:[]},dataComparator:be.equal,renderSubLayers:{type:"function",value:e=>new ff.GeoJsonLayer(e)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:e=>{}},onTileUnload:{type:"function",value:e=>{}},onTileError:{type:"function",value:e=>console.error(e)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:pn,zRange:null,maxRequests:6,zoomOffset:0},Gs=class extends Vs.CompositeLayer{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every(t=>t.isLoaded&&t.layers&&t.layers.every(r=>r.isLoaded)))}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:r}=this.state,n=t.propsOrDataChanged||t.updateTriggersChanged,s=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);r?n&&(r.setOptions(this._getTilesetOptions()),s?r.reloadAll():r.tiles.forEach(o=>{o.layers=null})):(r=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:r})),this._updateTileset()}_getTilesetOptions(){let{tileSize:t,maxCacheSize:r,maxCacheByteSize:n,refinementStrategy:s,extent:o,maxZoom:i,minZoom:a,maxRequests:c,zoomOffset:l}=this.props;return{maxCacheSize:r,maxCacheByteSize:n,maxZoom:i,minZoom:a,tileSize:t,refinementStrategy:s,extent:o,maxRequests:c,zoomOffset:l,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let t=this.state.tileset,{zRange:r,modelMatrix:n}=this.props,s=t.update(this.context.viewport,{zRange:r,modelMatrix:n}),{isLoaded:o}=t,i=this.state.isLoaded!==o,a=this.state.frameNumber!==s;o&&(i||a)&&this._onViewportLoad(),a&&this.setState({frameNumber:s}),this.state.isLoaded=o}_onViewportLoad(){let{tileset:t}=this.state,{onViewportLoad:r}=this.props;r&&r(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,r){this.props.onTileError(t),r.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){let{data:r,getTileData:n,fetch:s}=this.props,{signal:o}=t;return t.url=typeof r=="string"||Array.isArray(r)?$t(r,t):null,n?n(t):s&&t.url?s(t.url,{propName:"data",layer:this,signal:o}):null}renderSubLayers(t){return this.props.renderSubLayers(t)}getSubLayerPropsByTile(t){return null}getPickingInfo({info:t,sourceLayer:r}){let n=r.props.tile;return t.picked&&(t.tile=n),t.sourceTile=n,t}_updateAutoHighlight(t){let r=t.sourceTile;if(r&&r.layers)for(let n of r.layers)n.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map(t=>{let r=this.getSubLayerPropsByTile(t);if(!(!t.isLoaded&&!t.content))if(t.layers)r&&t.layers[0]&&Object.keys(r).some(n=>t.layers[0].props[n]!==r[n])&&(t.layers=t.layers.map(n=>n.clone(r)));else{let n=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=(0,Vs._flatten)(n,Boolean).map(s=>s.clone({tile:t,...r}))}return t.layers})}filterSubLayer({layer:t,cullRect:r}){let{tile:n}=t.props;return this.state.tileset.isTileVisible(n,r)}},te=Gs;(()=>{Gs.defaultProps=Dy})(),(()=>{Gs.layerName="TileLayer"})();var df=D(Dt(),1),vy={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:e=>e.timestamps}},Hs=class extends df.PathLayer{getShaders(){let t=super.getShaders();return t.inject={"vs:#decl":`uniform float trailLength;
|
|
13
|
+
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}fe.prototype.build=function(e){return this.options.preserveOrder?h0(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)};fe.prototype.j2x=function(e,t){let n="",r="";for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(typeof e[s]>"u")this.isAttribute(s)&&(r+="");else if(e[s]===null)this.isAttribute(s)?r+="":s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)r+=this.buildTextValNode(e[s],s,"",t);else if(typeof e[s]!="object"){let i=this.isAttribute(s);if(i)n+=this.buildAttrPairStr(i,""+e[s]);else if(s===this.options.textNodeName){let o=this.options.tagValueProcessor(s,""+e[s]);r+=this.replaceEntitiesValue(o)}else r+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){let i=e[s].length,o="";for(let a=0;a<i;a++){let c=e[s][a];typeof c>"u"||(c===null?s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar:typeof c=="object"?this.options.oneListGroup?o+=this.j2x(c,t+1).val:o+=this.processTextOrObjNode(c,s,t):o+=this.buildTextValNode(c,s,"",t))}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,"",t)),r+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){let i=Object.keys(e[s]),o=i.length;for(let a=0;a<o;a++)n+=this.buildAttrPairStr(i[a],""+e[s][i[a]])}else r+=this.processTextOrObjNode(e[s],s,t);return{attrStr:n,val:r}};fe.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function d0(e,t,n){let r=this.j2x(e,n+1);return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,r.attrStr,n):this.buildObjectNode(r.val,t,r.attrStr,n)}fe.prototype.buildObjectNode=function(e,t,n,r){if(e==="")return t[0]==="?"?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let s="</"+t+this.tagEndChar,i="";return t[0]==="?"&&(i="?",s=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(r)+"<"+t+n+i+">"+e+s:this.options.commentPropName!==!1&&t===this.options.commentPropName&&i.length===0?this.indentate(r)+`<!--${e}-->`+this.newLine:this.indentate(r)+"<"+t+n+i+this.tagEndChar+e+this.indentate(r)+s}};fe.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};fe.prototype.buildTextValNode=function(e,t,n,r){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(r)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(t,e);return s=this.replaceEntitiesValue(s),s===""?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+s+"</"+t+this.tagEndChar}};fe.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){let n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function p0(e){return this.options.indentBy.repeat(e)}function m0(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}Zl.exports=fe});var eu=tt((pb,tu)=>{"use strict";var g0=io(),A0=jl(),x0=$l();tu.exports={XMLParser:A0,XMLValidator:g0,XMLBuilder:x0}});var ma=tt((Nh,cr)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof Tl=="function"&&typeof cr=="object"&&cr&&cr.exports?cr.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(Nh,function(){"use strict";function e(T,m,M){this.low=T|0,this.high=m|0,this.unsigned=!!M}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function t(T){return(T&&T.__isLong__)===!0}e.isLong=t;var n={},r={};function s(T,m){var M,v,R;return m?(T>>>=0,(R=0<=T&&T<256)&&(v=r[T],v)?v:(M=o(T,(T|0)<0?-1:0,!0),R&&(r[T]=M),M)):(T|=0,(R=-128<=T&&T<128)&&(v=n[T],v)?v:(M=o(T,T<0?-1:0,!1),R&&(n[T]=M),M))}e.fromInt=s;function i(T,m){if(isNaN(T)||!isFinite(T))return m?y:g;if(m){if(T<0)return y;if(T>=d)return b}else{if(T<=-p)return w;if(T+1>=p)return S}return T<0?i(-T,m).neg():o(T%f|0,T/f|0,m)}e.fromNumber=i;function o(T,m,M){return new e(T,m,M)}e.fromBits=o;var a=Math.pow;function c(T,m,M){if(T.length===0)throw Error("empty string");if(T==="NaN"||T==="Infinity"||T==="+Infinity"||T==="-Infinity")return g;if(typeof m=="number"?(M=m,m=!1):m=!!m,M=M||10,M<2||36<M)throw RangeError("radix");var v;if((v=T.indexOf("-"))>0)throw Error("interior hyphen");if(v===0)return c(T.substring(1),m,M).neg();for(var R=i(a(M,8)),F=g,N=0;N<T.length;N+=8){var X=Math.min(8,T.length-N),H=parseInt(T.substring(N,N+X),M);if(X<8){var Q=i(a(M,X));F=F.mul(Q).add(i(H))}else F=F.mul(R),F=F.add(i(H))}return F.unsigned=m,F}e.fromString=c;function l(T){return T instanceof e?T:typeof T=="number"?i(T):typeof T=="string"?c(T):o(T.low,T.high,T.unsigned)}e.fromValue=l;var u=1<<16,h=1<<24,f=u*u,d=f*f,p=d/2,A=s(h),g=s(0);e.ZERO=g;var y=s(0,!0);e.UZERO=y;var E=s(1);e.ONE=E;var _=s(1,!0);e.UONE=_;var B=s(-1);e.NEG_ONE=B;var S=o(-1,2147483647,!1);e.MAX_VALUE=S;var b=o(-1,-1,!0);e.MAX_UNSIGNED_VALUE=b;var w=o(0,-2147483648,!1);e.MIN_VALUE=w;var C=e.prototype;return C.toInt=function(){return this.unsigned?this.low>>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},C.toString=function(m){if(m=m||10,m<2||36<m)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(w)){var M=i(m),v=this.div(M),R=v.mul(M).sub(this);return v.toString(m)+R.toInt().toString(m)}else return"-"+this.neg().toString(m);for(var F=i(a(m,6),this.unsigned),N=this,X="";;){var H=N.div(F),Q=N.sub(H.mul(F)).toInt()>>>0,j=Q.toString(m);if(N=H,N.isZero())return j+X;for(;j.length<6;)j="0"+j;X=""+j+X}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var m=this.high!=0?this.high:this.low,M=31;M>0&&!(m&1<<M);M--);return this.high!=0?M+33:M+1},C.isZero=function(){return this.high===0&&this.low===0},C.isNegative=function(){return!this.unsigned&&this.high<0},C.isPositive=function(){return this.unsigned||this.high>=0},C.isOdd=function(){return(this.low&1)===1},C.isEven=function(){return(this.low&1)===0},C.equals=function(m){return t(m)||(m=l(m)),this.unsigned!==m.unsigned&&this.high>>>31===1&&m.high>>>31===1?!1:this.high===m.high&&this.low===m.low},C.eq=C.equals,C.notEquals=function(m){return!this.eq(m)},C.neq=C.notEquals,C.lessThan=function(m){return this.comp(m)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(m){return this.comp(m)<=0},C.lte=C.lessThanOrEqual,C.greaterThan=function(m){return this.comp(m)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(m){return this.comp(m)>=0},C.gte=C.greaterThanOrEqual,C.compare=function(m){if(t(m)||(m=l(m)),this.eq(m))return 0;var M=this.isNegative(),v=m.isNegative();return M&&!v?-1:!M&&v?1:this.unsigned?m.high>>>0>this.high>>>0||m.high===this.high&&m.low>>>0>this.low>>>0?-1:1:this.sub(m).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(E)},C.neg=C.negate,C.add=function(m){t(m)||(m=l(m));var M=this.high>>>16,v=this.high&65535,R=this.low>>>16,F=this.low&65535,N=m.high>>>16,X=m.high&65535,H=m.low>>>16,Q=m.low&65535,j=0,W=0,$=0,At=0;return At+=F+Q,$+=At>>>16,At&=65535,$+=R+H,W+=$>>>16,$&=65535,W+=v+X,j+=W>>>16,W&=65535,j+=M+N,j&=65535,o($<<16|At,j<<16|W,this.unsigned)},C.subtract=function(m){return t(m)||(m=l(m)),this.add(m.neg())},C.sub=C.subtract,C.multiply=function(m){if(this.isZero()||(t(m)||(m=l(m)),m.isZero()))return g;if(this.eq(w))return m.isOdd()?w:g;if(m.eq(w))return this.isOdd()?w:g;if(this.isNegative())return m.isNegative()?this.neg().mul(m.neg()):this.neg().mul(m).neg();if(m.isNegative())return this.mul(m.neg()).neg();if(this.lt(A)&&m.lt(A))return i(this.toNumber()*m.toNumber(),this.unsigned);var M=this.high>>>16,v=this.high&65535,R=this.low>>>16,F=this.low&65535,N=m.high>>>16,X=m.high&65535,H=m.low>>>16,Q=m.low&65535,j=0,W=0,$=0,At=0;return At+=F*Q,$+=At>>>16,At&=65535,$+=R*Q,W+=$>>>16,$&=65535,$+=F*H,W+=$>>>16,$&=65535,W+=v*Q,j+=W>>>16,W&=65535,W+=R*H,j+=W>>>16,W&=65535,W+=F*X,j+=W>>>16,W&=65535,j+=M*Q+v*H+R*X+F*N,j&=65535,o($<<16|At,j<<16|W,this.unsigned)},C.mul=C.multiply,C.divide=function(m){if(t(m)||(m=l(m)),m.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?y:g;var M,v,R;if(this.unsigned){if(m.unsigned||(m=m.toUnsigned()),m.gt(this))return y;if(m.gt(this.shru(1)))return _;R=y}else{if(this.eq(w)){if(m.eq(E)||m.eq(B))return w;if(m.eq(w))return E;var F=this.shr(1);return M=F.div(m).shl(1),M.eq(g)?m.isNegative()?E:B:(v=this.sub(m.mul(M)),R=M.add(v.div(m)),R)}else if(m.eq(w))return this.unsigned?y:g;if(this.isNegative())return m.isNegative()?this.neg().div(m.neg()):this.neg().div(m).neg();if(m.isNegative())return this.div(m.neg()).neg();R=g}for(v=this;v.gte(m);){M=Math.max(1,Math.floor(v.toNumber()/m.toNumber()));for(var N=Math.ceil(Math.log(M)/Math.LN2),X=N<=48?1:a(2,N-48),H=i(M),Q=H.mul(m);Q.isNegative()||Q.gt(v);)M-=X,H=i(M,this.unsigned),Q=H.mul(m);H.isZero()&&(H=E),R=R.add(H),v=v.sub(Q)}return R},C.div=C.divide,C.modulo=function(m){return t(m)||(m=l(m)),this.sub(this.div(m).mul(m))},C.mod=C.modulo,C.not=function(){return o(~this.low,~this.high,this.unsigned)},C.and=function(m){return t(m)||(m=l(m)),o(this.low&m.low,this.high&m.high,this.unsigned)},C.or=function(m){return t(m)||(m=l(m)),o(this.low|m.low,this.high|m.high,this.unsigned)},C.xor=function(m){return t(m)||(m=l(m)),o(this.low^m.low,this.high^m.high,this.unsigned)},C.shiftLeft=function(m){return t(m)&&(m=m.toInt()),(m&=63)===0?this:m<32?o(this.low<<m,this.high<<m|this.low>>>32-m,this.unsigned):o(0,this.low<<m-32,this.unsigned)},C.shl=C.shiftLeft,C.shiftRight=function(m){return t(m)&&(m=m.toInt()),(m&=63)===0?this:m<32?o(this.low>>>m|this.high<<32-m,this.high>>m,this.unsigned):o(this.high>>m-32,this.high>=0?0:-1,this.unsigned)},C.shr=C.shiftRight,C.shiftRightUnsigned=function(m){if(t(m)&&(m=m.toInt()),m&=63,m===0)return this;var M=this.high;if(m<32){var v=this.low;return o(v>>>m|M<<32-m,M>>>m,this.unsigned)}else return m===32?o(M,0,this.unsigned):o(M>>>m-32,0,this.unsigned)},C.shru=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},C.toBytes=function(T){return T?this.toBytesLE():this.toBytesBE()},C.toBytesLE=function(){var T=this.high,m=this.low;return[m&255,m>>>8&255,m>>>16&255,m>>>24&255,T&255,T>>>8&255,T>>>16&255,T>>>24&255]},C.toBytesBE=function(){var T=this.high,m=this.low;return[T>>>24&255,T>>>16&255,T>>>8&255,T&255,m>>>24&255,m>>>16&255,m>>>8&255,m&255]},e})});var Hs=tt((uR,pf)=>{pf.exports=globalThis.h3||{}});var Ia=tt((yR,yf)=>{yf.exports=globalThis.luma});var qs=tt((TR,Tf)=>{Tf.exports=globalThis.deck});var Ef=tt((_R,_f)=>{_f.exports=globalThis.luma});var Tn=tt((uL,Xf)=>{Xf.exports=globalThis.loaders});var Tm=tt((GG,ym)=>{ym.exports=globalThis.deck});var Fm=tt(cl=>{cl.read=function(e,t,n,r,s){var i,o,a=s*8-r-1,c=(1<<a)-1,l=c>>1,u=-7,h=n?s-1:0,f=n?-1:1,d=e[t+h];for(h+=f,i=d&(1<<-u)-1,d>>=-u,u+=a;u>0;i=i*256+e[t+h],h+=f,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=r;u>0;o=o*256+e[t+h],h+=f,u-=8);if(i===0)i=1-l;else{if(i===c)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-l}return(d?-1:1)*o*Math.pow(2,i-r)};cl.write=function(e,t,n,r,s,i){var o,a,c,l=i*8-s-1,u=(1<<l)-1,h=u>>1,f=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,p=r?1:-1,A=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+h>=1?t+=f/c:t+=f*Math.pow(2,1-h),t*c>=2&&(o++,c/=2),o+h>=u?(a=0,o=u):o+h>=1?(a=(t*c-1)*Math.pow(2,s),o=o+h):(a=t*Math.pow(2,h-1)*Math.pow(2,s),o=0));s>=8;e[n+d]=a&255,d+=p,a/=256,s-=8);for(o=o<<s|a,l+=s;l>0;e[n+d]=o&255,d+=p,o/=256,l-=8);e[n+d-p]|=A*128}});var Nm=tt((b4,Om)=>{"use strict";Om.exports=k;var Ki=Fm();function k(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}k.Varint=0;k.Fixed64=1;k.Bytes=2;k.Fixed32=5;var ll=(1<<16)*(1<<16),vm=1/ll,nS=12,Pm=typeof TextDecoder>"u"?null:new TextDecoder("utf8");k.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),s=r>>3,i=this.pos;this.type=r&7,e(s,t,this),this.pos===i&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Qi(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Lm(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Qi(this.buf,this.pos)+Qi(this.buf,this.pos+4)*ll;return this.pos+=8,e},readSFixed64:function(){var e=Qi(this.buf,this.pos)+Lm(this.buf,this.pos+4)*ll;return this.pos+=8,e},readFloat:function(){var e=Ki.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Ki.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,n,r;return r=t[this.pos++],n=r&127,r<128||(r=t[this.pos++],n|=(r&127)<<7,r<128)||(r=t[this.pos++],n|=(r&127)<<14,r<128)||(r=t[this.pos++],n|=(r&127)<<21,r<128)?n:(r=t[this.pos],n|=(r&15)<<28,rS(n,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=nS&&Pm?AS(this.buf,t,e):gS(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==k.Bytes)return e.push(this.readVarint(t));var n=ue(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==k.Bytes)return e.push(this.readSVarint());var t=ue(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==k.Bytes)return e.push(this.readBoolean());var t=ue(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==k.Bytes)return e.push(this.readFloat());var t=ue(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==k.Bytes)return e.push(this.readDouble());var t=ue(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==k.Bytes)return e.push(this.readFixed32());var t=ue(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==k.Bytes)return e.push(this.readSFixed32());var t=ue(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==k.Bytes)return e.push(this.readFixed64());var t=ue(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==k.Bytes)return e.push(this.readSFixed64());var t=ue(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===k.Varint)for(;this.buf[this.pos++]>127;);else if(t===k.Bytes)this.pos=this.readVarint()+this.pos;else if(t===k.Fixed32)this.pos+=4;else if(t===k.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),zn(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),zn(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),zn(this.buf,e&-1,this.pos),zn(this.buf,Math.floor(e*vm),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),zn(this.buf,e&-1,this.pos),zn(this.buf,Math.floor(e*vm),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){sS(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=xS(this.buf,e,this.pos);var n=this.pos-t;n>=128&&Rm(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),Ki.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Ki.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var r=this.pos-n;r>=128&&Rm(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,k.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,aS,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,cS,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,hS,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,lS,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,uS,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,fS,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,dS,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,pS,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,mS,t)},writeBytesField:function(e,t){this.writeTag(e,k.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,k.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,k.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,k.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,k.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,k.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,k.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,k.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,k.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,k.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function rS(e,t,n){var r=n.buf,s,i;if(i=r[n.pos++],s=(i&112)>>4,i<128||(i=r[n.pos++],s|=(i&127)<<3,i<128)||(i=r[n.pos++],s|=(i&127)<<10,i<128)||(i=r[n.pos++],s|=(i&127)<<17,i<128)||(i=r[n.pos++],s|=(i&127)<<24,i<128)||(i=r[n.pos++],s|=(i&1)<<31,i<128))return Hn(e,s,t);throw new Error("Expected varint not more than 10 bytes")}function ue(e){return e.type===k.Bytes?e.readVarint()+e.pos:e.pos+1}function Hn(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function sS(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),n^4294967295?n=n+1|0:(n=0,r=r+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),iS(n,r,t),oS(r,t)}function iS(e,t,n){n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos]=e&127}function oS(e,t){var n=(e&7)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function Rm(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));n.realloc(r);for(var s=n.pos-1;s>=e;s--)n.buf[s+r]=n.buf[s]}function aS(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function cS(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function lS(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function uS(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function hS(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function fS(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function dS(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function pS(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function mS(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function Qi(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function zn(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function Lm(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function gS(e,t,n){for(var r="",s=t;s<n;){var i=e[s],o=null,a=i>239?4:i>223?3:i>191?2:1;if(s+a>n)break;var c,l,u;a===1?i<128&&(o=i):a===2?(c=e[s+1],(c&192)===128&&(o=(i&31)<<6|c&63,o<=127&&(o=null))):a===3?(c=e[s+1],l=e[s+2],(c&192)===128&&(l&192)===128&&(o=(i&15)<<12|(c&63)<<6|l&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):a===4&&(c=e[s+1],l=e[s+2],u=e[s+3],(c&192)===128&&(l&192)===128&&(u&192)===128&&(o=(i&15)<<18|(c&63)<<12|(l&63)<<6|u&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,a=1):o>65535&&(o-=65536,r+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),r+=String.fromCharCode(o),s+=a}return r}function AS(e,t,n){return Pm.decode(e.subarray(t,n))}function xS(e,t,n){for(var r=0,s,i;r<t.length;r++){if(s=t.charCodeAt(r),s>55295&&s<57344)if(i)if(s<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=s;continue}else s=i-55296<<10|s-56320|65536,i=null;else{s>56319||r+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=s;continue}else i&&(e[n++]=239,e[n++]=191,e[n++]=189,i=null);s<128?e[n++]=s:(s<2048?e[n++]=s>>6|192:(s<65536?e[n++]=s>>12|224:(e[n++]=s>>18|240,e[n++]=s>>12&63|128),e[n++]=s>>6&63|128),e[n++]=s&63|128)}return n}});var $r={};lt($r,{GeohashLayer:()=>Zr,GreatCircleLayer:()=>ar,H3ClusterLayer:()=>xr,H3HexagonLayer:()=>Je,MVTLayer:()=>Qr,QuadkeyLayer:()=>ur,S2Layer:()=>lr,TerrainLayer:()=>Gr,Tile3DLayer:()=>Or,TileLayer:()=>Zt,TripsLayer:()=>mr,_GeoCellLayer:()=>Mt,_Tile2DHeader:()=>ze,_Tileset2D:()=>ke,_WMSLayer:()=>Ss,_getURLFromTemplate:()=>Qt});var Jt={},El=O(Nt(),1);he(Jt,O(Nt(),1));if(!El.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");he($r,Jt);var He=O(Dt(),1),Lh=O(Nt(),1);function ug(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function ns(e){if(Array.isArray(e))return e.map(t=>ns(t));if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[ug(n)]=ns(r);return t}return e}var nu=O(eu(),1);function fo(e,t){if(t!=null&&t._parser&&t._parser!=="fast-xml-parser")throw new Error(t?._parser);let n={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:t?.removeNSPrefix,textNodeName:t?.textNodeName,isArray:(s,i,o,a)=>{var c;return Boolean(t==null||(c=t.arrayPaths)===null||c===void 0?void 0:c.some(u=>i===u))},...t?._fastXML},r=y0(e,n);return t!=null&&t.uncapitalizeKeys?ns(r):r}function y0(e,t){return new nu.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var T0="4.1.4",pt={name:"XML",id:"xml",module:"xml",version:T0,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:_0,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>fo(new TextDecoder().decode(e),{...pt.options.xml,...t?.xml}),parseTextSync:(e,t)=>fo(e,{...pt.options.xml,...t?.xml})};function _0(e){return e.startsWith("<?xml")}async function Bt(e,t,n,r){return r._parse(e,t,n,r)}function G(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var qt={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},E0=qt.self||qt.window||qt.global||{},B0=qt.window||qt.self||qt.global||{},C0=qt.global||qt.self||qt.window||{},S0=qt.document||{};var qn=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var ru=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),b0=ru&&parseFloat(ru[1])||0;function po(e,t){return su(e||{},t)}function su(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(n>3)return t;let r={...e};for(let[s,i]of Object.entries(t))i&&typeof i=="object"&&!Array.isArray(i)?r[s]=su(r[s]||{},t[s],n+1):r[s]=t[s];return r}function M0(){var e;return(e=globalThis._loadersgl_)!==null&&e!==void 0&&e.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.1.4"),globalThis._loadersgl_.version}var iu=M0();function ou(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var jt={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Sb=jt.self||jt.window||jt.global||{},bb=jt.window||jt.self||jt.global||{},Mb=jt.global||jt.self||jt.window||{},Ib=jt.document||{};var hn=typeof process!="object"||String(process)!=="[object process]"||process.browser,ss=typeof importScripts=="function",wb=typeof window<"u"&&typeof window.orientation<"u",au=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Fb=au&&parseFloat(au[1])||0;var mo={};async function Xt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return t&&(e=cu(e,t,n,r)),mo[e]=mo[e]||I0(e),await mo[e]}function cu(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(!n.useLocalLibraries&&e.startsWith("http"))return e;r=r||e;let s=n.modules||{};return s[r]?s[r]:hn?n.CDN?(ou(n.CDN.startsWith("http")),`${n.CDN}/${t}@${iu}/dist/libs/${r}`):ss?`../src/libs/${r}`:`modules/${t}/src/libs/${r}`:`modules/${t}/dist/libs/${r}`}async function I0(e){if(e.endsWith("wasm"))return await F0(e);if(!hn)try{return Ct&&Ct.requireFromFile&&await Ct.requireFromFile(e)}catch(n){return console.error(n),null}if(ss)return importScripts(e);let t=await v0(e);return w0(t,e)}function w0(e,t){if(!hn)return Ct.requireFromString&&Ct.requireFromString(e,t);if(ss)return eval.call(globalThis,e),null;let n=document.createElement("script");n.id=t;try{n.appendChild(document.createTextNode(e))}catch{n.text=e}return document.body.appendChild(n),null}async function F0(e){return hn||!Ct.readFileAsArrayBuffer||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await Ct.readFileAsArrayBuffer(e)}async function v0(e){return hn||!Ct.readFileAsText||e.startsWith("http")?await(await fetch(e)).text():await Ct.readFileAsText(e)}function uu(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:5;return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?lu(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?lu(e,0,t):""}function lu(e,t,n){if(e.byteLength<=t+n)return"";let r=new DataView(e),s="";for(let i=0;i<n;i++)s+=String.fromCharCode(r.getUint8(t+i));return s}function go(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${uu(e)}"`)}}function jn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let r=t,s=r&&r.length>1&&r[0].constructor||null;if(!s)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let i=r.reduce((c,l)=>c+l.length,0),o=new s(i),a=0;for(let c of r)o.set(c,a),a+=c.length;return o}function ve(e,t,n){let r=n!==void 0?new Uint8Array(e).subarray(t,t+n):new Uint8Array(e).subarray(t);return new Uint8Array(r).buffer}function de(e,t){return G(e>=0),G(t>0),e+(t-1)&~(t-1)}function Ao(e,t,n){let r;if(e instanceof ArrayBuffer)r=new Uint8Array(e);else{let s=e.byteOffset,i=e.byteLength;r=new Uint8Array(e.buffer||e.arrayBuffer,s,i)}return t.set(r,n),n+de(r.byteLength,4)}function Xn(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Re=class{constructor(t,n){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=n,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Xn(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Xn()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var pe=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,n="count"){return this._getOrCreate({name:t,type:n})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let n of Object.values(this.stats))t(n)}getTable(){let t={};return this.forEach(n=>{t[n.name]={time:n.time||0,count:n.count||0,average:n.getAverageTime()||0,hz:n.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(n=>this._getOrCreate(n))}_getOrCreate(t){let{name:n,type:r}=t,s=this.stats[n];return s||(t instanceof Re?s=t:s=new Re(n,r),this.stats[n]=s),s}};var R0="Queued Requests",L0="Active Requests",P0="Cancelled Requests",O0="Queued Requests Ever",N0="Active Requests Ever",D0={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},me=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.props=void 0,this.stats=void 0,this.activeRequestCount=0,this.requestQueue=[],this.requestMap=new Map,this.updateTimer=null,this.props={...D0,...t},this.stats=new pe({id:this.props.id}),this.stats.get(R0),this.stats.get(L0),this.stats.get(P0),this.stats.get(O0),this.stats.get(N0)}scheduleRequest(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:()=>0;if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let r={handle:t,priority:0,getPriority:n},s=new Promise(i=>(r.resolve=i,r));return this.requestQueue.push(r),this.requestMap.set(t,s),this._issueNewRequests(),s}_issueRequest(t){let{handle:n,resolve:r}=t,s=!1,i=()=>{s||(s=!0,this.requestMap.delete(n),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:i}):Promise.resolve({done:i})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let n=0;n<t;++n){let r=this.requestQueue.shift();r&&this._issueRequest(r)}}}_updateAllRequests(){let t=this.requestQueue;for(let n=0;n<t.length;++n){let r=t[n];this._updateRequest(r)||(t.splice(n,1),this.requestMap.delete(r.handle),n--)}t.sort((n,r)=>n.priority-r.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var ge={};lt(ge,{dirname:()=>G0,filename:()=>U0,join:()=>V0,resolve:()=>H0});function hu(){var e;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let t=(e=window.location)===null||e===void 0?void 0:e.pathname;return t?.slice(0,t.lastIndexOf("/")+1)||""}function U0(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function G0(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function V0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let r="/";return t=t.map((s,i)=>(i&&(s=s.replace(new RegExp(`^${r}`),"")),i!==t.length-1&&(s=s.replace(new RegExp(`${r}$`),"")),s)),t.join(r)}function H0(){let e=[];for(let s=0;s<arguments.length;s++)e[s]=s<0||arguments.length<=s?void 0:arguments[s];let t="",n=!1,r;for(let s=e.length-1;s>=-1&&!n;s--){let i;s>=0?i=e[s]:(r===void 0&&(r=hu()),i=r),i.length!==0&&(t=`${i}/${t}`,n=i.charCodeAt(0)===Wn)}return t=z0(t,!n),n?`/${t}`:t.length>0?t:"."}var Wn=47,xo=46;function z0(e,t){let n="",r=-1,s=0,i,o=!1;for(let a=0;a<=e.length;++a){if(a<e.length)i=e.charCodeAt(a);else{if(i===Wn)break;i=Wn}if(i===Wn){if(!(r===a-1||s===1))if(r!==a-1&&s===2){if(n.length<2||!o||n.charCodeAt(n.length-1)!==xo||n.charCodeAt(n.length-2)!==xo){if(n.length>2){let c=n.length-1,l=c;for(;l>=0&&n.charCodeAt(l)!==Wn;--l);if(l!==c){n=l===-1?"":n.slice(0,l),r=a,s=0,o=!1;continue}}else if(n.length===2||n.length===1){n="",r=a,s=0,o=!1;continue}}t&&(n.length>0?n+="/..":n="..",o=!0)}else{let c=e.slice(r+1,a);n.length>0?n+=`/${c}`:n=c,o=!1}r=a,s=0}else i===xo&&s!==-1?++s:s=-1}return n}var is=class{constructor(t){this.data=void 0,this.fetch=void 0,this.loadOptions=void 0,this._needsRefresh=!0,this.props=void 0,this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=k0(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function k0(e){let t=e?.fetch;if(t&&typeof t=="function")return(r,s)=>t(r,s);let n=e?.fetch;return n&&typeof n!="function"?r=>fetch(r,n):r=>fetch(r)}var wt=class extends is{};wt.type="template";wt.testURL=e=>!1;function fu(e,t){var n,r,s;let i=(n=pt.parseTextSync)===null||n===void 0?void 0:n.call(pt,e,t),o=(i==null||(r=i.ServiceExceptionReport)===null||r===void 0?void 0:r.ServiceException)||(i==null||(s=i["ogc:ServiceExceptionReport"])===null||s===void 0?void 0:s["ogc:ServiceException"]);return typeof o=="string"?o:o.value||o.code||"Unknown error"}var J0="4.1.4",Le={id:"wms-error",name:"WMS Error",module:"wms",version:J0,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:q0,options:{wms:{throwOnError:!1}},parse:async(e,t)=>yo(new TextDecoder().decode(e),t),parseSync:(e,t)=>yo(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>yo(e,t)};function q0(e){return e.startsWith("<?xml")}function yo(e,t){let n={...Le.options.wms,...t?.wms},r=fu(e,n),s=n.minimalErrors?r:`WMS Service error: ${r}`;if(n.throwOnError)throw new Error(s);return s}function Pe(e){return Array.isArray(e)?e:e?[e]:[]}function Yn(e){let t=Pe(e);return t.length>0&&t.every(n=>typeof n=="string")?t:[]}function Kn(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;switch(typeof e){case"number":return e;case"string":return parseFloat(e);default:return}}function os(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;switch(typeof e){case"number":return e;case"string":return parseInt(e,10);default:return}}function Oe(e){switch(e){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function To(e,t){var n;let r=(n=pt.parseTextSync)===null||n===void 0?void 0:n.call(pt,e,t),s=r.WMT_MS_Capabilities||r.WMS_Capabilities||r,i=j0(s);if(t!=null&&t.inheritedLayerProps)for(let o of i.layers)pu(o,null);return t!=null&&t.includeRawJSON&&(i.json=s),t!=null&&t.includeXMLText&&(i.xml=e),i}function j0(e){var t,n,r,s,i,o,a,c,l,u,h,f,d,p,A,g;let y={version:String(e.version||""),name:String(((t=e.Service)===null||t===void 0?void 0:t.Name)||"unnamed"),title:(n=e.Service)!==null&&n!==void 0&&n.Title?String((r=e.Service)===null||r===void 0?void 0:r.Title):void 0,abstract:(s=e.Service)!==null&&s!==void 0&&s.Abstract?String((i=e.Service)===null||i===void 0?void 0:i.Abstract):void 0,keywords:Yn((o=e.Service)===null||o===void 0||(a=o.KeywordList)===null||a===void 0?void 0:a.Keyword),fees:(c=e.Service)!==null&&c!==void 0&&c.Fees?JSON.stringify((l=e.Service)===null||l===void 0?void 0:l.Fees):void 0,accessConstraints:(u=e.Service)!==null&&u!==void 0&&u.AccessConstraints?JSON.stringify((h=e.Service)===null||h===void 0?void 0:h.AccessConstraints):void 0,layerLimit:os((f=e.Service)===null||f===void 0?void 0:f.LayerLimit),maxWidth:os((d=e.Service)===null||d===void 0?void 0:d.maxWidth),maxHeight:os((p=e.Service)===null||p===void 0?void 0:p.maxHeight),layers:[],requests:X0((A=e.Capability)===null||A===void 0?void 0:A.Request),exceptions:W0(e.Exception)},E=Pe((g=e.Capability)===null||g===void 0?void 0:g.Layer);for(let _ of E)y.layers.push(du(_));for(let[_,B]of Object.entries(y))B===void 0&&delete y[_];return y}function X0(e){let t={};for(let[n,r]of Object.entries(e||{})){let s=Yn(r?.Format);t[n]={mimeTypes:s}}return t}function W0(e){if(Pe(e?.Format).length>0)return{mimeTypes:Yn(e)}}function du(e){var t;let n={title:String(e?.Title||""),name:e?.Name&&String(e?.Name),abstract:e?.Name&&String(e?.Abstract),keywords:Yn((t=e.KeywordList)===null||t===void 0?void 0:t.Keyword)},r=e?.CRS||e?.SRS;r&&Array.isArray(r)&&r.every(u=>typeof u=="string")&&(n.crs=r);let s=e?.EX_GeographicBoundingBox&&Y0(e?.EX_GeographicBoundingBox);s&&(n.geographicBoundingBox=s),s=e?.LatLonBoundingBox&&K0(e?.LatLonBoundingBox),s&&(n.geographicBoundingBox=s);let i=e?.BoundingBox&&Q0(e?.BoundingBox);i&&i.length>0&&(n.boundingBoxes=i);let a=Pe(e?.Dimension).map(u=>$0(u));a.length&&(n.dimensions=a),e!=null&&e.opaque&&(n.opaque=Oe(e?.opaque)),e!=null&&e.cascaded&&(n.cascaded=Oe(e?.cascaded)),e!=null&&e.queryable&&(n.queryable=Oe(e?.queryable));let c=Pe(e?.Layer),l=[];for(let u of c)l.push(du(u));l.length>0&&(n.layers=l);for(let[u,h]of Object.entries(n))h===void 0&&delete n[u];return n}function Y0(e){let{westBoundLongitude:t,northBoundLatitude:n,eastBoundLongitude:r,southBoundLatitude:s}=e;return[[t,s],[r,n]]}function K0(e){let{minx:t,miny:n,maxx:r,maxy:s}=e;return[[t,n],[r,s]]}function Q0(e){return Pe(e).map(n=>Z0(n))}function Z0(e){let{CRS:t,SRS:n,minx:r,miny:s,maxx:i,maxy:o,resx:a,resy:c}=e,l={crs:t||n,boundingBox:[[Kn(r),Kn(s)],[Kn(i),Kn(o)]]};return a&&(l.xResolution=a),c&&(l.yResolution=c),l}function $0(e){let{name:t,units:n,value:r}=e,s={name:t,units:n,extent:r};return e.unitSymbol&&(s.unitSymbol=e.unitSymbol),e.default&&(s.defaultValue=e.default),e.multipleValues&&(s.multipleValues=Oe(e.multipleValues)),e.nearestValue&&(s.nearestValue=Oe(e.nearestValue)),e.current&&(s.current=Oe(e.current)),s}function pu(e,t){t!=null&&t.geographicBoundingBox&&!e.geographicBoundingBox&&(e.geographicBoundingBox=[...t.geographicBoundingBox]),t!=null&&t.crs&&!e.crs&&(e.crs=[...t.crs]),t!=null&&t.boundingBoxes&&!e.boundingBoxes&&(e.boundingBoxes=[...t.boundingBoxes]),t!=null&&t.dimensions&&!e.dimensions&&(e.dimensions=[...t.dimensions]);for(let n of e.layers||[])pu(n,e)}var tA="4.1.4",fn={id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:tA,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:eA,options:{wms:{}},parse:async(e,t)=>To(new TextDecoder().decode(e),t?.wms),parseTextSync:(e,t)=>To(e,t?.wms)};function eA(e){return e.startsWith("<?xml")}function _o(e,t){var n,r;let i=((r=((n=pt.parseTextSync)===null||n===void 0?void 0:n.call(pt,e,t)).FeatureInfoResponse)===null||r===void 0?void 0:r.FIELDS)||[];return{features:(Array.isArray(i)?i:[i]).map(a=>nA(a))}}function nA(e){return{attributes:e||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var mu={...fn,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(e,t)=>_o(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>_o(e,t)};function Eo(e,t){var n;return(n=pt.parseTextSync)===null||n===void 0?void 0:n.call(pt,e,t)}var gu={...fn,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(e,t)=>Eo(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Eo(e,t)};function Au(e,t){let{type:n="auto"}=e,r=n==="auto"?sA(e.url,t):rA(n,t);if(!r)throw new Error("Not a valid image source type");return r.create(e)}function rA(e,t){for(let n of t)if(n.type===e)return n;return null}function sA(e,t){for(let n of t)if(n.testURL&&n.testURL(e))return n;return null}var xu="4.1.4";var Bo,iA=(Bo=globalThis.loaders)===null||Bo===void 0?void 0:Bo.parseImageNode,Co=typeof Image<"u",So=typeof ImageBitmap<"u",oA=Boolean(iA),bo=qn?!0:oA;function yu(e){switch(e){case"auto":return So||Co||bo;case"imagebitmap":return So;case"image":return Co;case"data":return bo;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Tu(){if(So)return"imagebitmap";if(Co)return"image";if(bo)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function _u(e){let t=aA(e);if(!t)throw new Error("Not an image");return t}function Qn(e){switch(_u(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function aA(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var cA=/^data:image\/svg\+xml/,lA=/\.svg((\?|#).*)?$/;function as(e){return e&&(cA.test(e)||lA.test(e))}function Eu(e,t){if(as(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return Mo(e,t)}function Mo(e,t){if(as(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function cs(e,t,n){let r=Eu(e,n),s=self.URL||self.webkitURL,i=typeof r!="string"&&s.createObjectURL(r);try{return await uA(i||r,t)}finally{i&&s.revokeObjectURL(i)}}async function uA(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,s)=>{try{n.onload=()=>r(n),n.onerror=i=>{let o=i instanceof Error?i.message:"error";s(new Error(o))}}catch(i){s(i)}})}var hA={},Bu=!0;async function Cu(e,t,n){let r;as(n)?r=await cs(e,t,n):r=Mo(e,n);let s=t&&t.imagebitmap;return await fA(r,s)}async function fA(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if((dA(t)||!Bu)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),Bu=!1}return await createImageBitmap(e)}function dA(e){for(let t in e||hA)return!1;return!0}function Su(e){return!AA(e,"ftyp",4)||!(e[8]&96)?null:pA(e)}function pA(e){switch(mA(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function mA(e,t,n){return String.fromCharCode(...e.slice(t,n))}function gA(e){return[...e].map(t=>t.charCodeAt(0))}function AA(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=gA(t);for(let s=0;s<r.length;++s)if(r[s]!==e[s+n])return!1;return!0}var Wt=!1,Zn=!0;function Ne(e){let t=$n(e);return yA(t)||EA(t)||TA(t)||_A(t)||xA(t)}function xA(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=Su(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function yA(e){let t=$n(e);return t.byteLength>=24&&t.getUint32(0,Wt)===2303741511?{mimeType:"image/png",width:t.getUint32(16,Wt),height:t.getUint32(20,Wt)}:null}function TA(e){let t=$n(e);return t.byteLength>=10&&t.getUint32(0,Wt)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,Zn),height:t.getUint16(8,Zn)}:null}function _A(e){let t=$n(e);return t.byteLength>=14&&t.getUint16(0,Wt)===16973&&t.getUint32(2,Zn)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,Zn),height:t.getUint32(22,Zn)}:null}function EA(e){let t=$n(e);if(!(t.byteLength>=3&&t.getUint16(0,Wt)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:s}=BA(),i=2;for(;i+9<t.byteLength;){let o=t.getUint16(i,Wt);if(s.has(o))return{mimeType:"image/jpeg",height:t.getUint16(i+5,Wt),width:t.getUint16(i+7,Wt)};if(!r.has(o))return null;i+=2,i+=t.getUint16(i,Wt)}return null}function BA(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function $n(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")}async function bu(e,t){var n;let{mimeType:r}=Ne(e)||{},s=(n=globalThis.loaders)===null||n===void 0?void 0:n.parseImageNode;return G(s),await s(e,r)}async function Mu(e,t,n){t=t||{};let s=(t.image||{}).type||"auto",{url:i}=n||{},o=CA(s),a;switch(o){case"imagebitmap":a=await Cu(e,t,i);break;case"image":a=await cs(e,t,i);break;case"data":a=await bu(e,t);break;default:G(!1)}return s==="data"&&(a=Qn(a)),a}function CA(e){switch(e){case"auto":case"data":return Tu();default:return yu(e),e}}var SA=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],bA=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],MA={image:{type:"auto",decode:!0}},Ae={id:"image",module:"images",name:"Images",version:xu,mimeTypes:bA,extensions:SA,parse:Mu,tests:[e=>Boolean(Ne(new DataView(e)))],options:MA};var Io={};function wo(e){if(Io[e]===void 0){let t=qn?wA(e):IA(e);Io[e]=t}return Io[e]}function IA(e){var t,n;let r=["image/png","image/jpeg","image/gif"],s=((t=globalThis.loaders)===null||t===void 0?void 0:t.imageFormatsNode)||r,i=(n=globalThis.loaders)===null||n===void 0?void 0:n.parseImageNode;return Boolean(i)&&s.includes(e)}function wA(e){switch(e){case"image/avif":case"image/webp":return FA(e);default:return!0}}function FA(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var Iu={type:"wms",testURL:e=>e.toLowerCase().includes("wms"),create:e=>new Fo(e)},Fo=class extends wt{constructor(t){var n;super(t),this.url=void 0,this.data=void 0,this.substituteCRS84=void 0,this.flipCRS=void 0,this.wmsParameters=void 0,this.vendorParameters=void 0,this.capabilities=null,this.url=t.url,this.data=t.url,this.substituteCRS84=(n=t.substituteCRS84)!==null&&n!==void 0?n:!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...t.wmsParameters},this.vendorParameters=t.vendorParameters||{}}async getMetadata(){let t=await this.getCapabilities();return this.normalizeMetadata(t)}async getImage(t){let{boundingBox:n,bbox:r,...s}=t,i={bbox:n?[...n[0],...n[1]]:r,...s};return await this.getMap(i)}normalizeMetadata(t){return t}async getCapabilities(t,n){let r=this.getCapabilitiesURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);let o=await fn.parse(i,this.loadOptions);return this.capabilities=o,o}async getMap(t,n){let r=this.getMapURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);try{return await Ae.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}async getFeatureInfo(t,n){let r=this.getFeatureInfoURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();return this._checkResponse(s,i),await mu.parse(i,this.loadOptions)}async getFeatureInfoText(t,n){let r=this.getFeatureInfoURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();return this._checkResponse(s,i),new TextDecoder().decode(i)}async describeLayer(t,n){let r=this.describeLayerURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();return this._checkResponse(s,i),await gu.parse(i,this.loadOptions)}async getLegendGraphic(t,n){let r=this.getLegendGraphicURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);try{return await Ae.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}getCapabilitiesURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetCapabilities",r,n)}getMapURL(t,n){t=this._getWMS130Parameters(t);let r={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetMap",r,n)}getFeatureInfoURL(t,n){t=this._getWMS130Parameters(t);let r={version:this.wmsParameters.version,info_format:this.wmsParameters.info_format,layers:this.wmsParameters.layers,query_layers:this.wmsParameters.query_layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetFeatureInfo",r,n)}describeLayerURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("DescribeLayer",r,n)}getLegendGraphicURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetLegendGraphic",r,n)}_parseWMSUrl(t){let[n,r]=t.split("?"),s=r.split("&"),i={};for(let o of s){let[a,c]=o.split("=");i[a]=c}return{url:n,parameters:i}}_getWMSUrl(t,n,r){let s=this.url,i=!0,o={service:"WMS",version:n.version,request:t,...n,...this.vendorParameters,...r},a=["transparent","time","elevation"];for(let[c,l]of Object.entries(o))(!a.includes(c)||l)&&(s+=i?"?":"&",i=!1,s+=this._getURLParameter(c,l,n));return encodeURI(s)}_getWMS130Parameters(t){let n={...t};return n.srs&&(n.crs=n.crs||n.srs,delete n.srs),n}_getURLParameter(t,n,r){switch(t){case"crs":r.version!=="1.3.0"?t="srs":this.substituteCRS84&&n==="EPSG:4326"&&(n="CRS:84");break;case"srs":r.version==="1.3.0"&&(t="crs");break;case"bbox":let s=this._flipBoundingBox(n,r);s&&(n=s);break;default:}return t=t.toUpperCase(),Array.isArray(n)?`${t}=${n.join(",")}`:`${t}=${n?String(n):""}`}_flipBoundingBox(t,n){if(!Array.isArray(t)||t.length!==4)return null;let r=n.version==="1.3.0"&&this.flipCRS.includes(n.crs||"")&&!(this.substituteCRS84&&n.crs==="EPSG:4326"),s=t;return r?[s[1],s[0],s[3],s[2]]:s}async _fetchArrayBuffer(t){let n=await this.fetch(t),r=await n.arrayBuffer();return this._checkResponse(n,r),r}_checkResponse(t,n){let r=t.headers["content-type"];if(!t.ok||Le.mimeTypes.includes(r)){var s;let i=po(this.loadOptions,{wms:{throwOnError:!0}}),o=(s=Le.parseSync)===null||s===void 0?void 0:s.call(Le,n,i);throw new Error(o)}}_parseError(t){var n;let r=(n=Le.parseSync)===null||n===void 0?void 0:n.call(Le,t,this.loadOptions);return new Error(r)}};var dn=class extends wt{constructor(t){super(t)}async getMetadata(){throw new Error("ImageSource.getMetadata not implemented")}async getImage(t){let n=this.getGranularParameters(t),r=this.getURLFromTemplate(n),i=await(await this.fetch(r)).arrayBuffer();return await Ae.parse(i)}getGranularParameters(t){let[[n,r],[s,i]]=t.boundingBox;return{...t,east:n,north:r,south:i,west:s}}getURLFromTemplate(t){let n=this.props.url;for(let[r,s]of Object.entries(t))n=n.replace(`\${${r}}`,String(s)),n=n.replace(`{${r}}`,String(s));return n}};dn.type="template";dn.testURL=e=>e.toLowerCase().includes("{");var vo=class extends dn{constructor(t){super(t),this.data=void 0,this.data=t.url}async getMetadata(){return await this.metadata()}async getImage(t){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(t){throw new Error("not implemented")}metadataURL(t){return`${this.props.url}?f=pjson`}exportImageURL(t){let n=`bbox=${t.bbox[0]},${t.bbox[1]},${t.bbox[2]},${t.bbox[3]}`,r=`size=${t.width},${t.height}`,s={...t,bbox:n,size:r};return delete s.width,delete s.height,this.getUrl("exportImage",s)}getUrl(t,n,r){let s=`${this.props.url}/${t}`,i=!0;for(let[o,a]of Object.entries(n))s+=i?"?":"&",i=!1,Array.isArray(a)?s+=`${o.toUpperCase()}=${a.join(",")}`:s+=`${o.toUpperCase()}=${a?String(a):""}`;return s}async checkResponse(t){if(!t.ok)throw new Error("error")}},wu={type:"arcgis-image-server",testURL:e=>e.toLowerCase().includes("ImageServer"),create:e=>new vo(e)};var vA=[Iu,wu];function Ro(e){return Au(e,vA)}var RA=1/Math.PI*180,LA=1/180*Math.PI,PA={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...PA}};var Y=globalThis.mathgl.config;function Lo(e,{precision:t=Y.precision}={}){return e=OA(e),`${parseFloat(e.toPrecision(t))}`}function St(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Po(e){return Fu(e)}function Oo(e){return bt(e)}function Fu(e,t){return No(e,n=>n*LA,t)}function bt(e,t){return No(e,n=>n*RA,t)}function ls(e,t,n){return No(e,r=>Math.max(t,Math.min(n,r)))}function xe(e,t,n){return St(e)?e.map((r,s)=>xe(r,t[s],n)):n*t+(1-n)*e}function mt(e,t,n){let r=Y.EPSILON;n&&(Y.EPSILON=n);try{if(e===t)return!0;if(St(e)&&St(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!mt(e[s],t[s]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=Y.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{Y.EPSILON=r}}function OA(e){return Math.round(e/Y.EPSILON)*Y.EPSILON}function NA(e){return e.clone?e.clone():new Array(e.length)}function No(e,t,n){if(St(e)){let r=e;n=n||NA(r);for(let s=0;s<n.length&&s<r.length;++s){let i=typeof e=="number"?e:e[s];n[s]=t(i,s,n)}return n}return t(e)}var ye=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:St(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Y)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+Lo(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!mt(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(Y.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function DA(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function U(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function Te(e,t,n=""){if(Y.debug&&!DA(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function at(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var _e=class extends ye{get x(){return this[0]}set x(t){this[0]=U(t)}get y(){return this[1]}set y(t){this[1]=U(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return U(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return U(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return at(t>=0&&t<this.ELEMENTS,"index is out of range"),U(this[t])}setComponent(t,n){return at(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var Z=typeof Float32Array<"u"?Float32Array:Array,tr=Math.random;function pn(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var s2=Math.PI/180;function UA(){let e=new Z(2);return Z!=Float32Array&&(e[0]=0,e[1]=0),e}function vu(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e}function Ru(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s+n[4],e[1]=n[1]*r+n[3]*s+n[5],e}function us(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}function hs(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var i2=function(){let e=UA();return function(t,n,r,s,i,o){let a,c;for(n||(n=2),r||(r=0),s?c=Math.min(s*n+r,t.length):c=t.length,a=r;a<c;a+=n)e[0]=t[a],e[1]=t[a+1],i(e,e,o),t[a]=e[0],t[a+1]=e[1];return t}}();function fs(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function ds(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function Lu(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function Pu(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function ps(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}var De=class extends _e{constructor(t=0,n=0){super(2),St(t)&&arguments.length===1?this.copy(t):(Y.debug&&(U(t),U(n)),this[0]=t,this[1]=n)}set(t,n){return this[0]=t,this[1]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return Y.debug&&(U(t.x),U(t.y)),this[0]=t.x,this[1]=t.y,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return hs(this,this,t),this.check()}transformAsVector(t){return fs(this,this,t),this.check()}transformByMatrix3(t){return us(this,this,t),this.check()}transformByMatrix2x3(t){return Ru(this,this,t),this.check()}transformByMatrix2(t){return vu(this,this,t),this.check()}};var Ve={};lt(Ve,{add:()=>zA,angle:()=>Ho,bezier:()=>e1,ceil:()=>kA,clone:()=>GA,copy:()=>VA,create:()=>ms,cross:()=>Ue,dist:()=>u1,distance:()=>Gu,div:()=>l1,divide:()=>Uu,dot:()=>er,equals:()=>o1,exactEquals:()=>i1,floor:()=>JA,forEach:()=>d1,fromValues:()=>gs,hermite:()=>t1,inverse:()=>QA,len:()=>zo,length:()=>Ou,lerp:()=>ZA,max:()=>jA,min:()=>qA,mul:()=>c1,multiply:()=>Du,negate:()=>KA,normalize:()=>Do,random:()=>n1,rotateX:()=>Uo,rotateY:()=>Go,rotateZ:()=>Vo,round:()=>XA,scale:()=>WA,scaleAndAdd:()=>YA,set:()=>HA,slerp:()=>$A,sqrDist:()=>h1,sqrLen:()=>f1,squaredDistance:()=>Vu,squaredLength:()=>Hu,str:()=>s1,sub:()=>a1,subtract:()=>Nu,transformMat3:()=>nr,transformMat4:()=>Ge,transformQuat:()=>rr,zero:()=>r1});function ms(){let e=new Z(3);return Z!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function GA(e){let t=new Z(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Ou(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function gs(e,t,n){let r=new Z(3);return r[0]=e,r[1]=t,r[2]=n,r}function VA(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function HA(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function zA(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function Nu(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function Du(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}function Uu(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}function kA(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function JA(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function qA(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}function jA(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}function XA(e,t){return e[0]=pn(t[0]),e[1]=pn(t[1]),e[2]=pn(t[2]),e}function WA(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function YA(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e}function Gu(e,t){let n=t[0]-e[0],r=t[1]-e[1],s=t[2]-e[2];return Math.sqrt(n*n+r*r+s*s)}function Vu(e,t){let n=t[0]-e[0],r=t[1]-e[1],s=t[2]-e[2];return n*n+r*r+s*s}function Hu(e){let t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r}function KA(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function QA(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Do(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function er(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Ue(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],a=n[1],c=n[2];return e[0]=s*c-i*a,e[1]=i*o-r*c,e[2]=r*a-s*o,e}function ZA(e,t,n,r){let s=t[0],i=t[1],o=t[2];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e}function $A(e,t,n,r){let s=Math.acos(Math.min(Math.max(er(t,n),-1),1)),i=Math.sin(s),o=Math.sin((1-r)*s)/i,a=Math.sin(r*s)/i;return e[0]=o*t[0]+a*n[0],e[1]=o*t[1]+a*n[1],e[2]=o*t[2]+a*n[2],e}function t1(e,t,n,r,s,i){let o=i*i,a=o*(2*i-3)+1,c=o*(i-2)+i,l=o*(i-1),u=o*(3-2*i);return e[0]=t[0]*a+n[0]*c+r[0]*l+s[0]*u,e[1]=t[1]*a+n[1]*c+r[1]*l+s[1]*u,e[2]=t[2]*a+n[2]*c+r[2]*l+s[2]*u,e}function e1(e,t,n,r,s,i){let o=1-i,a=o*o,c=i*i,l=a*o,u=3*i*a,h=3*c*o,f=c*i;return e[0]=t[0]*l+n[0]*u+r[0]*h+s[0]*f,e[1]=t[1]*l+n[1]*u+r[1]*h+s[1]*f,e[2]=t[2]*l+n[2]*u+r[2]*h+s[2]*f,e}function n1(e,t){t=t===void 0?1:t;let n=tr()*2*Math.PI,r=tr()*2-1,s=Math.sqrt(1-r*r)*t;return e[0]=Math.cos(n)*s,e[1]=Math.sin(n)*s,e[2]=r*t,e}function Ge(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function nr(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function rr(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],a=t[0],c=t[1],l=t[2],u=s*l-i*c,h=i*a-r*l,f=r*c-s*a,d=s*f-i*h,p=i*u-r*f,A=r*h-s*u,g=o*2;return u*=g,h*=g,f*=g,d*=2,p*=2,A*=2,e[0]=a+u+d,e[1]=c+h+p,e[2]=l+f+A,e}function Uo(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Go(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Vo(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Ho(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],a=t[2],c=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+a*a)),l=c&&er(e,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}function r1(e){return e[0]=0,e[1]=0,e[2]=0,e}function s1(e){return`vec3(${e[0]}, ${e[1]}, ${e[2]})`}function i1(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function o1(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],a=t[2];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-o)<=1e-6*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}var a1=Nu,c1=Du,l1=Uu,u1=Gu,h1=Vu,zo=Ou,f1=Hu,d1=function(){let e=ms();return function(t,n,r,s,i,o){let a,c;for(n||(n=3),r||(r=0),s?c=Math.min(s*n+r,t.length):c=t.length,a=r;a<c;a+=n)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],i(e,e,o),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2];return t}}();var ko=[0,0,0],As,x=class extends _e{static get ZERO(){return As||(As=new x(0,0,0),Object.freeze(As)),As}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&St(t)?this.copy(t):(Y.debug&&(U(t),U(n),U(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Y.debug&&(U(t.x),U(t.y),U(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=U(t)}angle(t){return Ho(this,t)}cross(t){return Ue(this,this,t),this.check()}rotateX({radians:t,origin:n=ko}){return Uo(this,this,n,t),this.check()}rotateY({radians:t,origin:n=ko}){return Go(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=ko}){return Vo(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Ge(this,this,t),this.check()}transformAsVector(t){return ds(this,this,t),this.check()}transformByMatrix3(t){return nr(this,this,t),this.check()}transformByMatrix2(t){return Lu(this,this,t),this.check()}transformByQuaternion(t){return rr(this,this,t),this.check()}};var xs,gn=class extends _e{static get ZERO(){return xs||(xs=new gn(0,0,0,0),Object.freeze(xs)),xs}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),St(t)&&arguments.length===1?this.copy(t):(Y.debug&&(U(t),U(n),U(r),U(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return Y.debug&&(U(t.x),U(t.y),U(t.z),U(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=U(t)}get w(){return this[3]}set w(t){this[3]=U(t)}transform(t){return Ge(this,this,t),this.check()}transformByMatrix3(t){return ps(this,this,t),this.check()}transformByMatrix2(t){return Pu(this,this,t),this.check()}transformByQuaternion(t){return rr(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var An=class extends ye{toString(){let t="[";if(Y.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=U(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function zu(){let e=new Z(9);return Z!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function ku(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=s}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function Ju(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],a=t[5],c=t[6],l=t[7],u=t[8],h=u*o-a*l,f=-u*i+a*c,d=l*i-o*c,p=n*h+r*f+s*d;return p?(p=1/p,e[0]=h*p,e[1]=(-u*r+s*l)*p,e[2]=(a*r-s*o)*p,e[3]=f*p,e[4]=(u*n-s*c)*p,e[5]=(-a*n+s*i)*p,e[6]=d*p,e[7]=(-l*n+r*c)*p,e[8]=(o*n-r*i)*p,e):null}function qu(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],a=e[6],c=e[7],l=e[8];return t*(l*i-o*c)+n*(-l*s+o*a)+r*(c*s-i*a)}function Jo(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=t[8],f=n[0],d=n[1],p=n[2],A=n[3],g=n[4],y=n[5],E=n[6],_=n[7],B=n[8];return e[0]=f*r+d*o+p*l,e[1]=f*s+d*a+p*u,e[2]=f*i+d*c+p*h,e[3]=A*r+g*o+y*l,e[4]=A*s+g*a+y*u,e[5]=A*i+g*c+y*h,e[6]=E*r+_*o+B*l,e[7]=E*s+_*a+B*u,e[8]=E*i+_*c+B*h,e}function ju(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=t[8],f=n[0],d=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=a,e[5]=c,e[6]=f*r+d*o+l,e[7]=f*s+d*a+u,e[8]=f*i+d*c+h,e}function Xu(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=t[8],f=Math.sin(n),d=Math.cos(n);return e[0]=d*r+f*o,e[1]=d*s+f*a,e[2]=d*i+f*c,e[3]=d*o-f*r,e[4]=d*a-f*s,e[5]=d*c-f*i,e[6]=l,e[7]=u,e[8]=h,e}function qo(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=s*t[3],e[4]=s*t[4],e[5]=s*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Wu(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,a=r+r,c=s+s,l=n*o,u=r*o,h=r*a,f=s*o,d=s*a,p=s*c,A=i*o,g=i*a,y=i*c;return e[0]=1-h-p,e[3]=u-y,e[6]=f+g,e[1]=u+y,e[4]=1-l-p,e[7]=d-A,e[2]=f-g,e[5]=d+A,e[8]=1-l-h,e}var jo;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL1ROW0=3]="COL1ROW0",e[e.COL1ROW1=4]="COL1ROW1",e[e.COL1ROW2=5]="COL1ROW2",e[e.COL2ROW0=6]="COL2ROW0",e[e.COL2ROW1=7]="COL2ROW1",e[e.COL2ROW2=8]="COL2ROW2"})(jo||(jo={}));var m1=Object.freeze([1,0,0,0,1,0,0,0,1]),z=class extends An{static get IDENTITY(){return A1()}static get ZERO(){return g1()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return jo}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(m1)}fromObject(t){return this.check()}fromQuaternion(t){return Wu(this,t),this.check()}set(t,n,r,s,i,o,a,c,l){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=l,this.check()}setRowMajor(t,n,r,s,i,o,a,c,l){return this[0]=t,this[1]=s,this[2]=a,this[3]=n,this[4]=i,this[5]=c,this[6]=r,this[7]=o,this[8]=l,this.check()}determinant(){return qu(this)}transpose(){return ku(this,this),this.check()}invert(){return Ju(this,this),this.check()}multiplyLeft(t){return Jo(this,t,this),this.check()}multiplyRight(t){return Jo(this,this,t),this.check()}rotate(t){return Xu(this,this,t),this.check()}scale(t){return Array.isArray(t)?qo(this,this,t):qo(this,this,[t,t]),this.check()}translate(t){return ju(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=us(n||[-0,-0],t,this);break;case 3:r=nr(n||[-0,-0,-0],t,this);break;case 4:r=ps(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Te(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},ys,Ts=null;function g1(){return ys||(ys=new z([0,0,0,0,0,0,0,0,0]),Object.freeze(ys)),ys}function A1(){return Ts||(Ts=new z,Object.freeze(Ts)),Ts}var ir={};lt(ir,{add:()=>z1,adjoint:()=>B1,clone:()=>y1,copy:()=>T1,create:()=>x1,decompose:()=>L1,determinant:()=>Yo,equals:()=>j1,exactEquals:()=>q1,frob:()=>H1,fromQuat:()=>na,fromQuat2:()=>F1,fromRotation:()=>b1,fromRotationTranslation:()=>Ku,fromRotationTranslationScale:()=>P1,fromRotationTranslationScaleOrigin:()=>O1,fromScaling:()=>S1,fromTranslation:()=>C1,fromValues:()=>_1,fromXRotation:()=>M1,fromYRotation:()=>I1,fromZRotation:()=>w1,frustum:()=>ra,getRotation:()=>R1,getScaling:()=>Qu,getTranslation:()=>v1,identity:()=>Yu,invert:()=>Wo,lookAt:()=>oa,mul:()=>X1,multiply:()=>sr,multiplyScalar:()=>k1,multiplyScalarAndAdd:()=>J1,ortho:()=>ia,orthoNO:()=>$u,orthoZO:()=>U1,perspective:()=>sa,perspectiveFromFieldOfView:()=>D1,perspectiveNO:()=>Zu,perspectiveZO:()=>N1,rotate:()=>Zo,rotateX:()=>$o,rotateY:()=>ta,rotateZ:()=>ea,scale:()=>Qo,set:()=>E1,str:()=>V1,sub:()=>W1,subtract:()=>th,targetTo:()=>G1,translate:()=>Ko,transpose:()=>Xo});function x1(){let e=new Z(16);return Z!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function y1(e){let t=new Z(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function T1(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function _1(e,t,n,r,s,i,o,a,c,l,u,h,f,d,p,A){let g=new Z(16);return g[0]=e,g[1]=t,g[2]=n,g[3]=r,g[4]=s,g[5]=i,g[6]=o,g[7]=a,g[8]=c,g[9]=l,g[10]=u,g[11]=h,g[12]=f,g[13]=d,g[14]=p,g[15]=A,g}function E1(e,t,n,r,s,i,o,a,c,l,u,h,f,d,p,A,g){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=i,e[5]=o,e[6]=a,e[7]=c,e[8]=l,e[9]=u,e[10]=h,e[11]=f,e[12]=d,e[13]=p,e[14]=A,e[15]=g,e}function Yu(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Xo(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function Wo(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],a=t[5],c=t[6],l=t[7],u=t[8],h=t[9],f=t[10],d=t[11],p=t[12],A=t[13],g=t[14],y=t[15],E=n*a-r*o,_=n*c-s*o,B=n*l-i*o,S=r*c-s*a,b=r*l-i*a,w=s*l-i*c,C=u*A-h*p,T=u*g-f*p,m=u*y-d*p,M=h*g-f*A,v=h*y-d*A,R=f*y-d*g,F=E*R-_*v+B*M+S*m-b*T+w*C;return F?(F=1/F,e[0]=(a*R-c*v+l*M)*F,e[1]=(s*v-r*R-i*M)*F,e[2]=(A*w-g*b+y*S)*F,e[3]=(f*b-h*w-d*S)*F,e[4]=(c*m-o*R-l*T)*F,e[5]=(n*R-s*m+i*T)*F,e[6]=(g*B-p*w-y*_)*F,e[7]=(u*w-f*B+d*_)*F,e[8]=(o*v-a*m+l*C)*F,e[9]=(r*m-n*v-i*C)*F,e[10]=(p*b-A*B+y*E)*F,e[11]=(h*B-u*b-d*E)*F,e[12]=(a*T-o*M-c*C)*F,e[13]=(n*M-r*T+s*C)*F,e[14]=(A*_-p*S-g*E)*F,e[15]=(u*S-h*_+f*E)*F,e):null}function B1(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],a=t[5],c=t[6],l=t[7],u=t[8],h=t[9],f=t[10],d=t[11],p=t[12],A=t[13],g=t[14],y=t[15],E=n*a-r*o,_=n*c-s*o,B=n*l-i*o,S=r*c-s*a,b=r*l-i*a,w=s*l-i*c,C=u*A-h*p,T=u*g-f*p,m=u*y-d*p,M=h*g-f*A,v=h*y-d*A,R=f*y-d*g;return e[0]=a*R-c*v+l*M,e[1]=s*v-r*R-i*M,e[2]=A*w-g*b+y*S,e[3]=f*b-h*w-d*S,e[4]=c*m-o*R-l*T,e[5]=n*R-s*m+i*T,e[6]=g*B-p*w-y*_,e[7]=u*w-f*B+d*_,e[8]=o*v-a*m+l*C,e[9]=r*m-n*v-i*C,e[10]=p*b-A*B+y*E,e[11]=h*B-u*b-d*E,e[12]=a*T-o*M-c*C,e[13]=n*M-r*T+s*C,e[14]=A*_-p*S-g*E,e[15]=u*S-h*_+f*E,e}function Yo(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],a=e[6],c=e[7],l=e[8],u=e[9],h=e[10],f=e[11],d=e[12],p=e[13],A=e[14],g=e[15],y=t*o-n*i,E=t*a-r*i,_=n*a-r*o,B=l*p-u*d,S=l*A-h*d,b=u*A-h*p,w=t*b-n*S+r*B,C=i*b-o*S+a*B,T=l*_-u*E+h*y,m=d*_-p*E+A*y;return c*w-s*C+g*T-f*m}function sr(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=t[8],f=t[9],d=t[10],p=t[11],A=t[12],g=t[13],y=t[14],E=t[15],_=n[0],B=n[1],S=n[2],b=n[3];return e[0]=_*r+B*a+S*h+b*A,e[1]=_*s+B*c+S*f+b*g,e[2]=_*i+B*l+S*d+b*y,e[3]=_*o+B*u+S*p+b*E,_=n[4],B=n[5],S=n[6],b=n[7],e[4]=_*r+B*a+S*h+b*A,e[5]=_*s+B*c+S*f+b*g,e[6]=_*i+B*l+S*d+b*y,e[7]=_*o+B*u+S*p+b*E,_=n[8],B=n[9],S=n[10],b=n[11],e[8]=_*r+B*a+S*h+b*A,e[9]=_*s+B*c+S*f+b*g,e[10]=_*i+B*l+S*d+b*y,e[11]=_*o+B*u+S*p+b*E,_=n[12],B=n[13],S=n[14],b=n[15],e[12]=_*r+B*a+S*h+b*A,e[13]=_*s+B*c+S*f+b*g,e[14]=_*i+B*l+S*d+b*y,e[15]=_*o+B*u+S*p+b*E,e}function Ko(e,t,n){let r=n[0],s=n[1],i=n[2],o,a,c,l,u,h,f,d,p,A,g,y;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],a=t[1],c=t[2],l=t[3],u=t[4],h=t[5],f=t[6],d=t[7],p=t[8],A=t[9],g=t[10],y=t[11],e[0]=o,e[1]=a,e[2]=c,e[3]=l,e[4]=u,e[5]=h,e[6]=f,e[7]=d,e[8]=p,e[9]=A,e[10]=g,e[11]=y,e[12]=o*r+u*s+p*i+t[12],e[13]=a*r+h*s+A*i+t[13],e[14]=c*r+f*s+g*i+t[14],e[15]=l*r+d*s+y*i+t[15]),e}function Qo(e,t,n){let r=n[0],s=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Zo(e,t,n,r){let s=r[0],i=r[1],o=r[2],a=Math.sqrt(s*s+i*i+o*o),c,l,u,h,f,d,p,A,g,y,E,_,B,S,b,w,C,T,m,M,v,R,F,N;return a<1e-6?null:(a=1/a,s*=a,i*=a,o*=a,l=Math.sin(n),c=Math.cos(n),u=1-c,h=t[0],f=t[1],d=t[2],p=t[3],A=t[4],g=t[5],y=t[6],E=t[7],_=t[8],B=t[9],S=t[10],b=t[11],w=s*s*u+c,C=i*s*u+o*l,T=o*s*u-i*l,m=s*i*u-o*l,M=i*i*u+c,v=o*i*u+s*l,R=s*o*u+i*l,F=i*o*u-s*l,N=o*o*u+c,e[0]=h*w+A*C+_*T,e[1]=f*w+g*C+B*T,e[2]=d*w+y*C+S*T,e[3]=p*w+E*C+b*T,e[4]=h*m+A*M+_*v,e[5]=f*m+g*M+B*v,e[6]=d*m+y*M+S*v,e[7]=p*m+E*M+b*v,e[8]=h*R+A*F+_*N,e[9]=f*R+g*F+B*N,e[10]=d*R+y*F+S*N,e[11]=p*R+E*F+b*N,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function $o(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],a=t[6],c=t[7],l=t[8],u=t[9],h=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=i*s+l*r,e[5]=o*s+u*r,e[6]=a*s+h*r,e[7]=c*s+f*r,e[8]=l*s-i*r,e[9]=u*s-o*r,e[10]=h*s-a*r,e[11]=f*s-c*r,e}function ta(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],a=t[2],c=t[3],l=t[8],u=t[9],h=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s-l*r,e[1]=o*s-u*r,e[2]=a*s-h*r,e[3]=c*s-f*r,e[8]=i*r+l*s,e[9]=o*r+u*s,e[10]=a*r+h*s,e[11]=c*r+f*s,e}function ea(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],a=t[2],c=t[3],l=t[4],u=t[5],h=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s+l*r,e[1]=o*s+u*r,e[2]=a*s+h*r,e[3]=c*s+f*r,e[4]=l*s-i*r,e[5]=u*s-o*r,e[6]=h*s-a*r,e[7]=f*s-c*r,e}function C1(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function S1(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function b1(e,t,n){let r=n[0],s=n[1],i=n[2],o=Math.sqrt(r*r+s*s+i*i),a,c,l;return o<1e-6?null:(o=1/o,r*=o,s*=o,i*=o,c=Math.sin(t),a=Math.cos(t),l=1-a,e[0]=r*r*l+a,e[1]=s*r*l+i*c,e[2]=i*r*l-s*c,e[3]=0,e[4]=r*s*l-i*c,e[5]=s*s*l+a,e[6]=i*s*l+r*c,e[7]=0,e[8]=r*i*l+s*c,e[9]=s*i*l-r*c,e[10]=i*i*l+a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function M1(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=n,e[7]=0,e[8]=0,e[9]=-n,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function I1(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function w1(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=0,e[4]=-n,e[5]=r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ku(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=r+r,c=s+s,l=i+i,u=r*a,h=r*c,f=r*l,d=s*c,p=s*l,A=i*l,g=o*a,y=o*c,E=o*l;return e[0]=1-(d+A),e[1]=h+E,e[2]=f-y,e[3]=0,e[4]=h-E,e[5]=1-(u+A),e[6]=p+g,e[7]=0,e[8]=f+y,e[9]=p-g,e[10]=1-(u+d),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function F1(e,t){let n=new Z(3),r=-t[0],s=-t[1],i=-t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=r*r+s*s+i*i+o*o;return h>0?(n[0]=(a*o+u*r+c*i-l*s)*2/h,n[1]=(c*o+u*s+l*r-a*i)*2/h,n[2]=(l*o+u*i+a*s-c*r)*2/h):(n[0]=(a*o+u*r+c*i-l*s)*2,n[1]=(c*o+u*s+l*r-a*i)*2,n[2]=(l*o+u*i+a*s-c*r)*2),Ku(e,t,n),e}function v1(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Qu(e,t){let n=t[0],r=t[1],s=t[2],i=t[4],o=t[5],a=t[6],c=t[8],l=t[9],u=t[10];return e[0]=Math.sqrt(n*n+r*r+s*s),e[1]=Math.sqrt(i*i+o*o+a*a),e[2]=Math.sqrt(c*c+l*l+u*u),e}function R1(e,t){let n=new Z(3);Qu(n,t);let r=1/n[0],s=1/n[1],i=1/n[2],o=t[0]*r,a=t[1]*s,c=t[2]*i,l=t[4]*r,u=t[5]*s,h=t[6]*i,f=t[8]*r,d=t[9]*s,p=t[10]*i,A=o+u+p,g=0;return A>0?(g=Math.sqrt(A+1)*2,e[3]=.25*g,e[0]=(h-d)/g,e[1]=(f-c)/g,e[2]=(a-l)/g):o>u&&o>p?(g=Math.sqrt(1+o-u-p)*2,e[3]=(h-d)/g,e[0]=.25*g,e[1]=(a+l)/g,e[2]=(f+c)/g):u>p?(g=Math.sqrt(1+u-o-p)*2,e[3]=(f-c)/g,e[0]=(a+l)/g,e[1]=.25*g,e[2]=(h+d)/g):(g=Math.sqrt(1+p-o-u)*2,e[3]=(a-l)/g,e[0]=(f+c)/g,e[1]=(h+d)/g,e[2]=.25*g),e}function L1(e,t,n,r){t[0]=r[12],t[1]=r[13],t[2]=r[14];let s=r[0],i=r[1],o=r[2],a=r[4],c=r[5],l=r[6],u=r[8],h=r[9],f=r[10];n[0]=Math.sqrt(s*s+i*i+o*o),n[1]=Math.sqrt(a*a+c*c+l*l),n[2]=Math.sqrt(u*u+h*h+f*f);let d=1/n[0],p=1/n[1],A=1/n[2],g=s*d,y=i*p,E=o*A,_=a*d,B=c*p,S=l*A,b=u*d,w=h*p,C=f*A,T=g+B+C,m=0;return T>0?(m=Math.sqrt(T+1)*2,e[3]=.25*m,e[0]=(S-w)/m,e[1]=(b-E)/m,e[2]=(y-_)/m):g>B&&g>C?(m=Math.sqrt(1+g-B-C)*2,e[3]=(S-w)/m,e[0]=.25*m,e[1]=(y+_)/m,e[2]=(b+E)/m):B>C?(m=Math.sqrt(1+B-g-C)*2,e[3]=(b-E)/m,e[0]=(y+_)/m,e[1]=.25*m,e[2]=(S+w)/m):(m=Math.sqrt(1+C-g-B)*2,e[3]=(y-_)/m,e[0]=(b+E)/m,e[1]=(S+w)/m,e[2]=.25*m),e}function P1(e,t,n,r){let s=t[0],i=t[1],o=t[2],a=t[3],c=s+s,l=i+i,u=o+o,h=s*c,f=s*l,d=s*u,p=i*l,A=i*u,g=o*u,y=a*c,E=a*l,_=a*u,B=r[0],S=r[1],b=r[2];return e[0]=(1-(p+g))*B,e[1]=(f+_)*B,e[2]=(d-E)*B,e[3]=0,e[4]=(f-_)*S,e[5]=(1-(h+g))*S,e[6]=(A+y)*S,e[7]=0,e[8]=(d+E)*b,e[9]=(A-y)*b,e[10]=(1-(h+p))*b,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function O1(e,t,n,r,s){let i=t[0],o=t[1],a=t[2],c=t[3],l=i+i,u=o+o,h=a+a,f=i*l,d=i*u,p=i*h,A=o*u,g=o*h,y=a*h,E=c*l,_=c*u,B=c*h,S=r[0],b=r[1],w=r[2],C=s[0],T=s[1],m=s[2],M=(1-(A+y))*S,v=(d+B)*S,R=(p-_)*S,F=(d-B)*b,N=(1-(f+y))*b,X=(g+E)*b,H=(p+_)*w,Q=(g-E)*w,j=(1-(f+A))*w;return e[0]=M,e[1]=v,e[2]=R,e[3]=0,e[4]=F,e[5]=N,e[6]=X,e[7]=0,e[8]=H,e[9]=Q,e[10]=j,e[11]=0,e[12]=n[0]+C-(M*C+F*T+H*m),e[13]=n[1]+T-(v*C+N*T+Q*m),e[14]=n[2]+m-(R*C+X*T+j*m),e[15]=1,e}function na(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,a=r+r,c=s+s,l=n*o,u=r*o,h=r*a,f=s*o,d=s*a,p=s*c,A=i*o,g=i*a,y=i*c;return e[0]=1-h-p,e[1]=u+y,e[2]=f-g,e[3]=0,e[4]=u-y,e[5]=1-l-p,e[6]=d+A,e[7]=0,e[8]=f+g,e[9]=d-A,e[10]=1-l-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ra(e,t,n,r,s,i,o){let a=1/(n-t),c=1/(s-r),l=1/(i-o);return e[0]=i*2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*c,e[6]=0,e[7]=0,e[8]=(n+t)*a,e[9]=(s+r)*c,e[10]=(o+i)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*l,e[15]=0,e}function Zu(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var sa=Zu;function N1(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let o=1/(r-s);e[10]=s*o,e[14]=s*r*o}else e[10]=-1,e[14]=-r;return e}function D1(e,t,n,r){let s=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),a=Math.tan(t.rightDegrees*Math.PI/180),c=2/(o+a),l=2/(s+i);return e[0]=c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=l,e[6]=0,e[7]=0,e[8]=-((o-a)*c*.5),e[9]=(s-i)*l*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function $u(e,t,n,r,s,i,o){let a=1/(t-n),c=1/(r-s),l=1/(i-o);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+n)*a,e[13]=(s+r)*c,e[14]=(o+i)*l,e[15]=1,e}var ia=$u;function U1(e,t,n,r,s,i,o){let a=1/(t-n),c=1/(r-s),l=1/(i-o);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=l,e[11]=0,e[12]=(t+n)*a,e[13]=(s+r)*c,e[14]=i*l,e[15]=1,e}function oa(e,t,n,r){let s,i,o,a,c,l,u,h,f,d,p=t[0],A=t[1],g=t[2],y=r[0],E=r[1],_=r[2],B=n[0],S=n[1],b=n[2];return Math.abs(p-B)<1e-6&&Math.abs(A-S)<1e-6&&Math.abs(g-b)<1e-6?Yu(e):(h=p-B,f=A-S,d=g-b,s=1/Math.sqrt(h*h+f*f+d*d),h*=s,f*=s,d*=s,i=E*d-_*f,o=_*h-y*d,a=y*f-E*h,s=Math.sqrt(i*i+o*o+a*a),s?(s=1/s,i*=s,o*=s,a*=s):(i=0,o=0,a=0),c=f*a-d*o,l=d*i-h*a,u=h*o-f*i,s=Math.sqrt(c*c+l*l+u*u),s?(s=1/s,c*=s,l*=s,u*=s):(c=0,l=0,u=0),e[0]=i,e[1]=c,e[2]=h,e[3]=0,e[4]=o,e[5]=l,e[6]=f,e[7]=0,e[8]=a,e[9]=u,e[10]=d,e[11]=0,e[12]=-(i*p+o*A+a*g),e[13]=-(c*p+l*A+u*g),e[14]=-(h*p+f*A+d*g),e[15]=1,e)}function G1(e,t,n,r){let s=t[0],i=t[1],o=t[2],a=r[0],c=r[1],l=r[2],u=s-n[0],h=i-n[1],f=o-n[2],d=u*u+h*h+f*f;d>0&&(d=1/Math.sqrt(d),u*=d,h*=d,f*=d);let p=c*f-l*h,A=l*u-a*f,g=a*h-c*u;return d=p*p+A*A+g*g,d>0&&(d=1/Math.sqrt(d),p*=d,A*=d,g*=d),e[0]=p,e[1]=A,e[2]=g,e[3]=0,e[4]=h*g-f*A,e[5]=f*p-u*g,e[6]=u*A-h*p,e[7]=0,e[8]=u,e[9]=h,e[10]=f,e[11]=0,e[12]=s,e[13]=i,e[14]=o,e[15]=1,e}function V1(e){return`mat4(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]}, ${e[4]}, ${e[5]}, ${e[6]}, ${e[7]}, ${e[8]}, ${e[9]}, ${e[10]}, ${e[11]}, ${e[12]}, ${e[13]}, ${e[14]}, ${e[15]})`}function H1(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8]+e[9]*e[9]+e[10]*e[10]+e[11]*e[11]+e[12]*e[12]+e[13]*e[13]+e[14]*e[14]+e[15]*e[15])}function z1(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function th(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function k1(e,t,n){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]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function J1(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function q1(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function j1(e,t){let n=e[0],r=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],f=e[10],d=e[11],p=e[12],A=e[13],g=e[14],y=e[15],E=t[0],_=t[1],B=t[2],S=t[3],b=t[4],w=t[5],C=t[6],T=t[7],m=t[8],M=t[9],v=t[10],R=t[11],F=t[12],N=t[13],X=t[14],H=t[15];return Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(r-_)<=1e-6*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(s-B)<=1e-6*Math.max(1,Math.abs(s),Math.abs(B))&&Math.abs(i-S)<=1e-6*Math.max(1,Math.abs(i),Math.abs(S))&&Math.abs(o-b)<=1e-6*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(a-w)<=1e-6*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(c-C)<=1e-6*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(l-T)<=1e-6*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(u-m)<=1e-6*Math.max(1,Math.abs(u),Math.abs(m))&&Math.abs(h-M)<=1e-6*Math.max(1,Math.abs(h),Math.abs(M))&&Math.abs(f-v)<=1e-6*Math.max(1,Math.abs(f),Math.abs(v))&&Math.abs(d-R)<=1e-6*Math.max(1,Math.abs(d),Math.abs(R))&&Math.abs(p-F)<=1e-6*Math.max(1,Math.abs(p),Math.abs(F))&&Math.abs(A-N)<=1e-6*Math.max(1,Math.abs(A),Math.abs(N))&&Math.abs(g-X)<=1e-6*Math.max(1,Math.abs(g),Math.abs(X))&&Math.abs(y-H)<=1e-6*Math.max(1,Math.abs(y),Math.abs(H))}var X1=sr,W1=th;function Y1(){let e=new Z(4);return Z!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function eh(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function nh(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function rh(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function sh(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function ih(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function oh(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function ah(e,t,n,r){let s=t[0],i=t[1],o=t[2],a=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=a+r*(n[3]-a),e}function ch(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*s+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*s+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*s+n[11]*i+n[15]*o,e}function lh(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],a=n[1],c=n[2],l=n[3],u=l*r+a*i-c*s,h=l*s+c*r-o*i,f=l*i+o*s-a*r,d=-o*r-a*s-c*i;return e[0]=u*l+d*-o+h*-c-f*-a,e[1]=h*l+d*-a+f*-o-u*-c,e[2]=f*l+d*-c+u*-a-h*-o,e[3]=t[3],e}var D2=function(){let e=Y1();return function(t,n,r,s,i,o){let a,c;for(n||(n=4),r||(r=0),s?c=Math.min(s*n+r,t.length):c=t.length,a=r;a<c;a+=n)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],e[3]=t[a+3],i(e,e,o),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2],t[a+3]=e[3];return t}}();var la;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(la||(la={}));var Q1=45*Math.PI/180,Z1=1,aa=.1,ca=500,$1=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),L=class extends An{static get IDENTITY(){return ex()}static get ZERO(){return tx()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return la}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,n,r,s,i,o,a,c,l,u,h,f,d,p,A,g){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=l,this[9]=u,this[10]=h,this[11]=f,this[12]=d,this[13]=p,this[14]=A,this[15]=g,this.check()}setRowMajor(t,n,r,s,i,o,a,c,l,u,h,f,d,p,A,g){return this[0]=t,this[1]=i,this[2]=l,this[3]=d,this[4]=n,this[5]=o,this[6]=u,this[7]=p,this[8]=r,this[9]=a,this[10]=h,this[11]=A,this[12]=s,this[13]=c,this[14]=f,this[15]=g,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy($1)}fromObject(t){return this.check()}fromQuaternion(t){return na(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=aa,far:a=ca}=t;return a===1/0?nx(this,n,r,s,i,o):ra(this,n,r,s,i,o,a),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return oa(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=aa,far:a=ca}=t;return ia(this,n,r,s,i,o,a),this.check()}orthographic(t){let{fovy:n=Q1,aspect:r=Z1,focalDistance:s=1,near:i=aa,far:o=ca}=t;uh(n);let a=n/2,c=s*Math.tan(a),l=c*r;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return uh(n),sa(this,n,r,s,i),this.check()}determinant(){return Yo(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*s,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*s,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return Xo(this,this),this.check()}invert(){return Wo(this,this),this.check()}multiplyLeft(t){return sr(this,t,this),this.check()}multiplyRight(t){return sr(this,this,t),this.check()}rotateX(t){return $o(this,this,t),this.check()}rotateY(t){return ta(this,this,t),this.check()}rotateZ(t){return ea(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return Zo(this,this,t,n),this.check()}scale(t){return Qo(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Ko(this,this,t),this.check()}transform(t,n){return t.length===4?(n=ch(n||[-0,-0,-0,-0],t,this),Te(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=hs(n||[-0,-0],t,this);break;case 3:s=Ge(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Te(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=fs(n||[-0,-0],t,this);break;case 3:r=ds(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Te(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},_s,Es;function tx(){return _s||(_s=new L([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(_s)),_s}function ex(){return Es||(Es=new L,Object.freeze(Es)),Es}function uh(e){if(e>Math.PI*2)throw Error("expected radians")}function nx(e,t,n,r,s,i){let o=2*i/(n-t),a=2*i/(s-r),c=(n+t)/(n-t),l=(s+r)/(s-r),u=-1,h=-1,f=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=h,e[12]=0,e[13]=0,e[14]=f,e[15]=0,e}function hh(){let e=new Z(4);return Z!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function fh(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function ua(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function ha(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=n[0],c=n[1],l=n[2],u=n[3];return e[0]=r*u+o*a+s*l-i*c,e[1]=s*u+o*c+i*a-r*l,e[2]=i*u+o*l+r*c-s*a,e[3]=o*u-r*a-s*c-i*l,e}function dh(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(n),c=Math.cos(n);return e[0]=r*c+o*a,e[1]=s*c+i*a,e[2]=i*c-s*a,e[3]=o*c-r*a,e}function ph(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(n),c=Math.cos(n);return e[0]=r*c-i*a,e[1]=s*c+o*a,e[2]=i*c+r*a,e[3]=o*c-s*a,e}function mh(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(n),c=Math.cos(n);return e[0]=r*c+s*a,e[1]=s*c-r*a,e[2]=i*c+o*a,e[3]=o*c-i*a,e}function gh(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function or(e,t,n,r){let s=t[0],i=t[1],o=t[2],a=t[3],c=n[0],l=n[1],u=n[2],h=n[3],f,d,p,A,g;return f=s*c+i*l+o*u+a*h,f<0&&(f=-f,c=-c,l=-l,u=-u,h=-h),1-f>1e-6?(d=Math.acos(f),g=Math.sin(d),p=Math.sin((1-r)*d)/g,A=Math.sin(r*d)/g):(p=1-r,A=r),e[0]=p*s+A*c,e[1]=p*i+A*l,e[2]=p*o+A*u,e[3]=p*a+A*h,e}function Ah(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,a=o?1/o:0;return e[0]=-n*a,e[1]=-r*a,e[2]=-s*a,e[3]=i*a,e}function xh(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function fa(e,t){let n=t[0]+t[4]+t[8],r;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{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}var yh=eh;var Th=nh,_h=oh,Eh=ah,Bh=rh;var Ch=sh;var Sh=ih;var bh=function(){let e=ms(),t=gs(1,0,0),n=gs(0,1,0);return function(r,s,i){let o=er(s,i);return o<-.999999?(Ue(e,t,s),zo(e)<1e-6&&Ue(e,n,s),Do(e,e),ua(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Ue(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,Sh(r,r))}}(),Q2=function(){let e=hh(),t=hh();return function(n,r,s,i,o,a){return or(e,r,o,a),or(t,s,i,a),or(n,e,t,2*a*(1-a)),n}}(),Z2=function(){let e=zu();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],Sh(t,fa(t,e))}}();var rx=[0,0,0,1],Yt=class extends ye{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return fa(this,t),this.check()}fromAxisRotation(t,n){return ua(this,t,n),this.check()}identity(){return fh(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=U(t)}get y(){return this[1]}set y(t){this[1]=U(t)}get z(){return this[2]}set z(t){this[2]=U(t)}get w(){return this[3]}set w(t){this[3]=U(t)}len(){return Bh(this)}lengthSquared(){return Ch(this)}dot(t){return _h(this,t)}rotationTo(t,n){return bh(this,t,n),this.check()}add(t){return yh(this,this,t),this.check()}calculateW(){return gh(this,this),this.check()}conjugate(){return xh(this,this),this.check()}invert(){return Ah(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(Eh(this,t,n,r),this.check())}multiplyRight(t){return ha(this,this,t),this.check()}multiplyLeft(t){return ha(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return dh(this,this,t),this.check()}rotateY(t){return ph(this,this,t),this.check()}rotateZ(t){return mh(this,this,t),this.check()}scale(t){return Th(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=rx,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return or(this,s,i,o),this.check()}transformVector4(t,n=new gn){return lh(n,t,this),Te(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Ft={};lt(Ft,{EPSILON1:()=>sx,EPSILON10:()=>dx,EPSILON11:()=>px,EPSILON12:()=>mx,EPSILON13:()=>gx,EPSILON14:()=>Ax,EPSILON15:()=>xx,EPSILON16:()=>yx,EPSILON17:()=>Tx,EPSILON18:()=>_x,EPSILON19:()=>Ex,EPSILON2:()=>ix,EPSILON20:()=>Bx,EPSILON3:()=>ox,EPSILON4:()=>ax,EPSILON5:()=>cx,EPSILON6:()=>lx,EPSILON7:()=>ux,EPSILON8:()=>hx,EPSILON9:()=>fx,PI_OVER_FOUR:()=>Sx,PI_OVER_SIX:()=>bx,PI_OVER_TWO:()=>Cx,TWO_PI:()=>Mx});var sx=.1,ix=.01,ox=.001,ax=1e-4,cx=1e-5,lx=1e-6,ux=1e-7,hx=1e-8,fx=1e-9,dx=1e-10,px=1e-11,mx=1e-12,gx=1e-13,Ax=1e-14,xx=1e-15,yx=1e-16,Tx=1e-17,_x=1e-18,Ex=1e-19,Bx=1e-20,Cx=Math.PI/2,Sx=Math.PI/4,bx=Math.PI/6,Mx=Math.PI*2;function Bs(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var Ut=Math.PI,Fh=Ut/4,Mh=Ut/180,Ih=180/Ut,Cs=512;function re(e){let[t,n]=e;Bs(Number.isFinite(t)),Bs(Number.isFinite(n)&&n>=-90&&n<=90,"invalid latitude");let r=t*Mh,s=n*Mh,i=Cs*(r+Ut)/(2*Ut),o=Cs*(Ut+Math.log(Math.tan(Fh+s*.5)))/(2*Ut);return[i,o]}function se(e){let[t,n]=e,r=t/Cs*(2*Ut)-Ut,s=2*(Math.atan(Math.exp(n/Cs*(2*Ut)-Ut))-Fh);return[r*Ih,s*Ih]}var Ow=Math.PI/180;var Rh=6378137*Math.PI;function da(e){let t=re(e);return t[0]=(t[0]/256-1)*Rh,t[1]=(t[1]/256-1)*Rh,t}var kx={id:"imagery-layer",data:"",serviceType:"auto",srs:"auto",layers:{type:"array",compare:!0,value:[]},onMetadataLoad:{type:"function",value:()=>{}},onMetadataLoadError:{type:"function",value:console.error},onImageLoadStart:{type:"function",value:()=>{}},onImageLoad:{type:"function",value:()=>{}},onImageLoadError:{type:"function",compare:!1,value:(e,t)=>console.error(t,e)}},bs=class extends He.CompositeLayer{get isLoaded(){return this.state?.loadCounter===0&&super.isLoaded}shouldUpdateState(){return!0}initializeState(){this.state._nextRequestId=0,this.state.lastRequestId=-1,this.state.loadCounter=0}updateState({changeFlags:t,props:n,oldProps:r}){let{viewport:s}=this.context;t.dataChanged||n.serviceType!==r.serviceType?(this.state.imageSource=this._createImageSource(n),this._loadMetadata(),this.debounce(()=>this.loadImage(s,"image source changed"),0)):(0,He._deepEqual)(n.layers,r.layers,1)?t.viewportChanged&&this.debounce(()=>this.loadImage(s,"viewport changed")):this.debounce(()=>this.loadImage(s,"layers changed"),0)}finalizeState(){}renderLayers(){let{bounds:t,image:n,lastRequestParameters:r}=this.state;return n&&new Lh.BitmapLayer({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:r.srs==="EPSG:4326"?He.COORDINATE_SYSTEM.LNGLAT:He.COORDINATE_SYSTEM.CARTESIAN,bounds:t,image:n})}async getFeatureInfoText(t,n){let{lastRequestParameters:r}=this.state;return r?await this.state.imageSource.getFeatureInfoText?.({...r,query_layers:r.layers,x:t,y:n,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(t){if(t.data instanceof wt)return t.data;if(typeof t.data=="string")return Ro({url:t.data,loadOptions:t.loadOptions,type:t.serviceType});throw new Error("invalid image source in props.data")}async _loadMetadata(){let{imageSource:t}=this.state;try{this.state.loadCounter++;let n=await t.getMetadata();this.state.imageSource===t&&this.getCurrentLayer()?.props.onMetadataLoad(n)}catch(n){this.getCurrentLayer()?.props.onMetadataLoadError(n)}finally{this.state.loadCounter--}}async loadImage(t,n){let{layers:r,serviceType:s}=this.props;if(s==="wms"&&r.length===0)return;let i=t.getBounds(),{width:o,height:a}=t,c=this.getRequestId(),{srs:l}=this.props;l==="auto"&&(l=t.resolution?"EPSG:4326":"EPSG:3857");let u={width:o,height:a,boundingBox:[[i[0],i[1]],[i[2],i[3]]],layers:r,crs:l};if(l==="EPSG:3857"){let h=da([i[0],i[1]]),f=da([i[2],i[3]]);u.boundingBox=[h,f]}try{this.state.loadCounter++,this.props.onImageLoadStart(c);let h=await this.state.imageSource.getImage(u);this.state.lastRequestId<c&&(this.getCurrentLayer()?.props.onImageLoad(c),this.setState({image:h,bounds:i,lastRequestParameters:u,lastRequestId:c}))}catch(h){this.raiseError(h,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(c,h)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(t,n=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>t(),n)}},Ss=bs;(()=>{bs.layerName="WMSLayer"})(),(()=>{bs.defaultProps=kx})();var Ph=O(Nt(),1),Jx={getHeight:{type:"accessor",value:0},greatCircle:!0},Ms=class extends Ph.ArcLayer{},ar=Ms;(()=>{Ms.layerName="GreatCircleLayer"})(),(()=>{Ms.defaultProps=Jx})();var Oh=O(Dt(),1),pa=O(Nt(),1),qx={...pa.PolygonLayer.defaultProps},Is=class extends Oh.CompositeLayer{indexToBounds(){return null}renderLayers(){let{elevationScale:t,extruded:n,wireframe:r,filled:s,stroked:i,lineWidthUnits:o,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:u,lineMiterLimit:h,lineDashJustified:f,getElevation:d,getFillColor:p,getLineColor:A,getLineWidth:g}=this.props,{updateTriggers:y,material:E,transitions:_}=this.props,B=this.getSubLayerClass("cell",pa.PolygonLayer),{updateTriggers:S,...b}=this.indexToBounds()||{};return new B({filled:s,wireframe:r,extruded:n,elevationScale:t,stroked:i,lineWidthUnits:o,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:u,lineMiterLimit:h,lineDashJustified:f,material:E,transitions:_,getElevation:d,getFillColor:p,getLineColor:A,getLineWidth:g},this.getSubLayerProps({id:"cell",updateTriggers:y&&{...S,getElevation:y.getElevation,getFillColor:y.getFillColor,getLineColor:y.getLineColor,getLineWidth:y.getLineWidth}}),b)}},Mt=Is;(()=>{Is.layerName="GeoCellLayer"})(),(()=>{Is.defaultProps=qx})();var ws=O(ma(),1),jx=3,Xx=30,Wx=2*Xx+1,Dh=180/Math.PI;function Gh(e,t,n){let r=1<<t;return[(e[0]+n[0])/r,(e[1]+n[1])/r]}function Uh(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Vh(e){return[Uh(e[0]),Uh(e[1])]}function Hh(e,[t,n]){switch(e){case 0:return[1,t,n];case 1:return[-t,1,n];case 2:return[-t,-n,1];case 3:return[-1,-n,-t];case 4:return[n,-1,-t];case 5:return[n,t,-1];default:throw new Error("Invalid face")}}function zh([e,t,n]){let r=Math.atan2(n,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*Dh,r*Dh]}function kh(e){let t=ws.default.fromString(e,!0,10).toString(2);for(;t.length<jx+Wx;)t="0"+t;let n=t.lastIndexOf("1"),r=t.substring(0,3),s=t.substring(3,n),i=s.length/2,o=ws.default.fromString(r,!0,2).toString(10),a=ws.default.fromString(s,!0,2).toString(4);for(;a.length<i;)a="0"+a;return`${o}/${a}`}function Yx(e,t,n,r){if(r===0){n===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let s=t[0];t[0]=t[1],t[1]=s}}function Jh(e){let t=e.split("/"),n=parseInt(t[0],10),r=t[1],s=r.length,i=[0,0],o;for(let a=s-1;a>=0;a--){o=s-a;let c=r[a],l=0,u=0;c==="1"?u=1:c==="2"?(l=1,u=1):c==="3"&&(l=1);let h=Math.pow(2,o-1);Yx(h,i,l,u),i[0]+=h*l,i[1]+=h*u}if(n%2===1){let a=i[0];i[0]=i[1],i[1]=a}return{face:n,ij:i,level:o}}var qh=O(ma(),1);function Kx(e){let t=e.padEnd(16,"0");return qh.default.fromString(t,16)}var Qx=100;function Zx({face:e,ij:t,level:n}){let r=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(Qx*Math.pow(2,-n))),i=new Float64Array(4*s*2+2),o=0,a=0;for(let c=0;c<4;c++){let l=r[c].slice(0),u=r[c+1],h=(u[0]-l[0])/s,f=(u[1]-l[1])/s;for(let d=0;d<s;d++){l[0]+=h,l[1]+=f;let p=Gh(t,n,l),A=Vh(p),g=Hh(e,A),y=zh(g);Math.abs(y[1])>89.999&&(y[0]=a);let E=y[0]-a;y[0]+=E>180?-360:E<-180?360:0,i[o++]=y[0],i[o++]=y[1],a=y[0]}}return i[o++]=i[0],i[o++]=i[1],i}function $x(e){if(typeof e=="string"){if(e.indexOf("/")>0)return e;e=Kx(e)}return kh(e.toString())}function jh(e){let t=$x(e),n=Jh(t);return Zx(n)}var ty={getS2Token:{type:"accessor",value:e=>e.token}},Fs=class extends Mt{indexToBounds(){let{data:t,getS2Token:n}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(r,s)=>jh(n(r,s))}}},lr=Fs;(()=>{Fs.layerName="S2Layer"})(),(()=>{Fs.defaultProps=ty})();var ga=512;function ey(e,t){let n=0,r=0,s=1<<e.length,i=s/ga;for(let o=0;o<e.length;o++){s>>=1;let a=parseInt(e[o]);a%2&&(n|=s),a>1&&(r|=s)}return[[n/i,ga-r/i],[(n+t)/i,ga-(r+t)/i]]}function Xh(e,t=1){let[n,r]=ey(e,t),[s,i]=se(n),[o,a]=se(r);return[o,i,o,a,s,a,s,i,o,i]}var ny={getQuadkey:{type:"accessor",value:e=>e.quadkey}},vs=class extends Mt{indexToBounds(){let{data:t,extruded:n,getQuadkey:r}=this.props,s=n?.99:1;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(i,o)=>Xh(r(i,o),s),updateTriggers:{getPolygon:s}}}},ur=vs;(()=>{vs.layerName="QuadkeyLayer"})(),(()=>{vs.defaultProps=ny})();var Gs=O(Dt(),1),ff=O(Nt(),1);var ze=class{constructor(t){this.index=t,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(t){this._bbox||(this._bbox=t,"west"in t?this.boundingBox=[[t.west,t.south],[t.east,t.north]]:this.boundingBox=[[t.left,t.top],[t.right,t.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error("byteLength not defined in tile data"),t}async _loadData({getData:t,requestScheduler:n,onLoad:r,onError:s}){let{index:i,id:o,bbox:a,userData:c,zoom:l}=this,u=this._loaderId;this._abortController=new AbortController;let{signal:h}=this._abortController,f=await n.scheduleRequest(this,A=>A.isSelected?1:-1);if(!f){this._isCancelled=!0;return}if(this._isCancelled){f.done();return}let d=null,p;try{d=await t({index:i,id:o,bbox:a,userData:c,zoom:l,signal:h})}catch(A){p=A||!0}finally{f.done()}if(u===this._loaderId){if(this._loader=void 0,this.content=d,this._isCancelled&&!d){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,p?s(p,this):r(this)}}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var dr=O(Dt(),1);var nt={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var Wh=new x,ry=new x,Ee=class{constructor(t=[0,0,0],n=[0,0,0],r){r=r||Wh.copy(t).add(n).scale(.5),this.center=new x(r),this.halfDiagonal=new x(n).subtract(this.center),this.minimum=new x(t),this.maximum=new x(n)}clone(){return new Ee(this.minimum,this.maximum,this.center)}equals(t){return this===t||Boolean(t)&&this.minimum.equals(t.minimum)&&this.maximum.equals(t.maximum)}transform(t){return this.center.transformAsPoint(t),this.halfDiagonal.transform(t),this.minimum.transform(t),this.maximum.transform(t),this}intersectPlane(t){let{halfDiagonal:n}=this,r=ry.from(t.normal),s=n.x*Math.abs(r.x)+n.y*Math.abs(r.y)+n.z*Math.abs(r.z),i=this.center.dot(r)+t.distance;return i-s>0?nt.INSIDE:i+s<0?nt.OUTSIDE:nt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=Wh.from(t).subtract(this.center),{halfDiagonal:r}=this,s=0,i;return i=Math.abs(n.x)-r.x,i>0&&(s+=i*i),i=Math.abs(n.y)-r.y,i>0&&(s+=i*i),i=Math.abs(n.z)-r.z,i>0&&(s+=i*i),s}};var hr=new x,Yh=new x,vt=class{constructor(t=[0,0,0],n=0){this.radius=-0,this.center=new x,this.fromCenterRadius(t,n)}fromCenterRadius(t,n){return this.center.from(t),this.radius=n,this}fromCornerPoints(t,n){return n=hr.from(n),this.center=new x().from(t).add(n).scale(.5),this.radius=this.center.distance(n),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new vt(this.center,this.radius)}union(t){let n=this.center,r=this.radius,s=t.center,i=t.radius,o=hr.copy(s).subtract(n),a=o.magnitude();if(r>=a+i)return this.clone();if(i>=a+r)return t.clone();let c=(r+a+i)*.5;return Yh.copy(o).scale((-r+c)/a).add(n),this.center.copy(Yh),this.radius=c,this}expand(t){let r=hr.from(t).subtract(this.center).magnitude();return r>this.radius&&(this.radius=r),this}transform(t){this.center.transform(t);let n=ir.getScaling(hr,t);return this.radius=Math.max(n[0],Math.max(n[1],n[2]))*this.radius,this}distanceSquaredTo(t){let n=this.distanceTo(t);return n*n}distanceTo(t){let r=hr.from(t).subtract(this.center);return Math.max(0,r.len()-this.radius)}intersectPlane(t){let n=this.center,r=this.radius,i=t.normal.dot(n)+t.distance;return i<-r?nt.OUTSIDE:i<r?nt.INTERSECTING:nt.INSIDE}};var sy=new x,iy=new x,Rs=new x,Ls=new x,Ps=new x,oy=new x,ay=new x,ie={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Gt=class{constructor(t=[0,0,0],n=[0,0,0,0,0,0,0,0,0]){this.center=new x().from(t),this.halfAxes=new z(n)}get halfSize(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new x(t).len(),new x(n).len(),new x(r).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),s=new x(t).normalize(),i=new x(n).normalize(),o=new x(r).normalize();return new Yt().fromMatrix3(new z([...s,...i,...o]))}fromCenterHalfSizeQuaternion(t,n,r){let s=new Yt(r),i=new z().fromQuaternion(s);return i[0]=i[0]*n[0],i[1]=i[1]*n[0],i[2]=i[2]*n[0],i[3]=i[3]*n[1],i[4]=i[4]*n[1],i[5]=i[5]*n[1],i[6]=i[6]*n[2],i[7]=i[7]*n[2],i[8]=i[8]*n[2],this.center=new x().from(t),this.halfAxes=i,this}clone(){return new Gt(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new vt){let n=this.halfAxes,r=n.getColumn(0,Rs),s=n.getColumn(1,Ls),i=n.getColumn(2,Ps),o=sy.copy(r).add(s).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let n=this.center,r=t.normal,s=this.halfAxes,i=r.x,o=r.y,a=r.z,c=Math.abs(i*s[ie.COLUMN0ROW0]+o*s[ie.COLUMN0ROW1]+a*s[ie.COLUMN0ROW2])+Math.abs(i*s[ie.COLUMN1ROW0]+o*s[ie.COLUMN1ROW1]+a*s[ie.COLUMN1ROW2])+Math.abs(i*s[ie.COLUMN2ROW0]+o*s[ie.COLUMN2ROW1]+a*s[ie.COLUMN2ROW2]),l=r.dot(n)+t.distance;return l<=-c?nt.OUTSIDE:l>=c?nt.INSIDE:nt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=iy.from(t).subtract(this.center),r=this.halfAxes,s=r.getColumn(0,Rs),i=r.getColumn(1,Ls),o=r.getColumn(2,Ps),a=s.magnitude(),c=i.magnitude(),l=o.magnitude();s.normalize(),i.normalize(),o.normalize();let u=0,h;return h=Math.abs(n.dot(s))-a,h>0&&(u+=h*h),h=Math.abs(n.dot(i))-c,h>0&&(u+=h*h),h=Math.abs(n.dot(o))-l,h>0&&(u+=h*h),u}computePlaneDistances(t,n,r=[-0,-0]){let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=this.center,a=this.halfAxes,c=a.getColumn(0,Rs),l=a.getColumn(1,Ls),u=a.getColumn(2,Ps),h=oy.copy(c).add(l).add(u).add(o),f=ay.copy(h).subtract(t),d=n.dot(f);return s=Math.min(d,s),i=Math.max(d,i),h.copy(o).add(c).add(l).subtract(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),h.copy(o).add(c).subtract(l).add(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),h.copy(o).add(c).subtract(l).subtract(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),o.copy(h).subtract(c).add(l).add(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),o.copy(h).subtract(c).add(l).subtract(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),o.copy(h).subtract(c).subtract(l).add(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),o.copy(h).subtract(c).subtract(l).subtract(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),r[0]=s,r[1]=i,r}transform(t){this.center.transformAsPoint(t);let n=this.halfAxes.getColumn(0,Rs);n.transformAsPoint(t);let r=this.halfAxes.getColumn(1,Ls);r.transformAsPoint(t);let s=this.halfAxes.getColumn(2,Ps);return s.transformAsPoint(t),this.halfAxes=new z([...n,...r,...s]),this}getTransform(){throw new Error("not implemented")}};var Kh=new x,Qh=new x,ct=class{constructor(t=[0,0,1],n=0){this.normal=new x,this.distance=-0,this.fromNormalDistance(t,n)}fromNormalDistance(t,n){return at(Number.isFinite(n)),this.normal.from(t).normalize(),this.distance=n,this}fromPointNormal(t,n){t=Kh.from(t),this.normal.from(n).normalize();let r=-this.normal.dot(t);return this.distance=r,this}fromCoefficients(t,n,r,s){return this.normal.set(t,n,r),at(mt(this.normal.len(),1)),this.distance=s,this}clone(){return new ct(this.normal,this.distance)}equals(t){return mt(this.distance,t.distance)&&mt(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let n=Qh.copy(this.normal).transformAsVector(t).normalize(),r=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(r,n)}projectPointOntoPlane(t,n=[0,0,0]){let r=Kh.from(t),s=this.getPointDistance(r),i=Qh.copy(this.normal).scale(s);return r.subtract(i).to(n)}};var Zh=[new x([1,0,0]),new x([0,1,0]),new x([0,0,1])],$h=new x,cy=new x,it=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*Zh.length;let n=t.center,r=t.radius,s=0;for(let i of Zh){let o=this.planes[s],a=this.planes[s+1];o||(o=this.planes[s]=new ct),a||(a=this.planes[s+1]=new ct);let c=$h.copy(i).scale(-r).add(n);o.fromPointNormal(c,i);let l=$h.copy(i).scale(r).add(n),u=cy.copy(i).negate();a.fromPointNormal(l,u),s+=2}return this}computeVisibility(t){let n=nt.INSIDE;for(let r of this.planes)switch(t.intersectPlane(r)){case nt.OUTSIDE:return nt.OUTSIDE;case nt.INTERSECTING:n=nt.INTERSECTING;break;default:}return n}computeVisibilityWithPlaneMask(t,n){if(at(Number.isFinite(n),"parentPlaneMask is required."),n===it.MASK_OUTSIDE||n===it.MASK_INSIDE)return n;let r=it.MASK_INSIDE,s=this.planes;for(let i=0;i<this.planes.length;++i){let o=i<31?1<<i:0;if(i<31&&!(n&o))continue;let a=s[i],c=t.intersectPlane(a);if(c===nt.OUTSIDE)return it.MASK_OUTSIDE;c===nt.INTERSECTING&&(r|=o)}return r}};it.MASK_OUTSIDE=4294967295;it.MASK_INSIDE=0;it.MASK_INDETERMINATE=2147483647;var ZF=new x,$F=new x,tv=new x,ev=new x,nv=new x;var cv=new x,lv=new x,uv=new x,hv=new x,fv=new x,dv=new x,pv=new x,mv=new x,gv=new x,Av=new x,xv=new x,yv=new x;var Kt=new z,uy=new z,hy=new z,Os=new z,tf=new z;function ya(e,t={}){let n=Ft.EPSILON20,r=10,s=0,i=0,o=uy,a=hy;o.identity(),a.copy(e);let c=n*fy(a);for(;i<r&&dy(a)>c;)py(a,Os),tf.copy(Os).transpose(),a.multiplyRight(Os),a.multiplyLeft(tf),o.multiplyRight(Os),++s>2&&(++i,s=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=a.toTarget(t.diagonal),t}function fy(e){let t=0;for(let n=0;n<9;++n){let r=e[n];t+=r*r}return Math.sqrt(t)}var Aa=[1,0,0],xa=[2,2,1];function dy(e){let t=0;for(let n=0;n<3;++n){let r=e[Kt.getElementIndex(xa[n],Aa[n])];t+=2*r*r}return Math.sqrt(t)}function py(e,t){let n=Ft.EPSILON15,r=0,s=1;for(let l=0;l<3;++l){let u=Math.abs(e[Kt.getElementIndex(xa[l],Aa[l])]);u>r&&(s=l,r=u)}let i=Aa[s],o=xa[s],a=1,c=0;if(Math.abs(e[Kt.getElementIndex(o,i)])>n){let l=e[Kt.getElementIndex(o,o)],u=e[Kt.getElementIndex(i,i)],h=e[Kt.getElementIndex(o,i)],f=(l-u)/2/h,d;f<0?d=-1/(-f+Math.sqrt(1+f*f)):d=1/(f+Math.sqrt(1+f*f)),a=1/Math.sqrt(1+d*d),c=d*a}return z.IDENTITY.to(t),t[Kt.getElementIndex(i,i)]=t[Kt.getElementIndex(o,o)]=a,t[Kt.getElementIndex(o,i)]=c,t[Kt.getElementIndex(i,o)]=-c,t}var Be=new x,my=new x,gy=new x,Ay=new x,xy=new x,yy=new z,Ty={diagonal:new z,unitary:new z};function fr(e,t=new Gt){if(!e||e.length===0)return t.halfAxes=new z([0,0,0,0,0,0,0,0,0]),t.center=new x,t;let n=e.length,r=new x(0,0,0);for(let T of e)r.add(T);let s=1/n;r.multiplyByScalar(s);let i=0,o=0,a=0,c=0,l=0,u=0;for(let T of e){let m=Be.copy(T).subtract(r);i+=m.x*m.x,o+=m.x*m.y,a+=m.x*m.z,c+=m.y*m.y,l+=m.y*m.z,u+=m.z*m.z}i*=s,o*=s,a*=s,c*=s,l*=s,u*=s;let h=yy;h[0]=i,h[1]=o,h[2]=a,h[3]=o,h[4]=c,h[5]=l,h[6]=a,h[7]=l,h[8]=u;let{unitary:f}=ya(h,Ty),d=t.halfAxes.copy(f),p=d.getColumn(0,gy),A=d.getColumn(1,Ay),g=d.getColumn(2,xy),y=-Number.MAX_VALUE,E=-Number.MAX_VALUE,_=-Number.MAX_VALUE,B=Number.MAX_VALUE,S=Number.MAX_VALUE,b=Number.MAX_VALUE;for(let T of e)Be.copy(T),y=Math.max(Be.dot(p),y),E=Math.max(Be.dot(A),E),_=Math.max(Be.dot(g),_),B=Math.min(Be.dot(p),B),S=Math.min(Be.dot(A),S),b=Math.min(Be.dot(g),b);p=p.multiplyByScalar(.5*(B+y)),A=A.multiplyByScalar(.5*(S+E)),g=g.multiplyByScalar(.5*(b+_)),t.center.copy(p).add(A).add(g);let w=my.set(y-B,E-S,_-b).multiplyByScalar(.5),C=new z([w[0],0,0,0,w[1],0,0,0,w[2]]);return t.halfAxes.multiplyRight(C),t}var xn=512,ef=3,nf=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],rf=nf.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),_y=rf.concat([[.25,.5],[.75,.5]]),Ce=class{constructor(t,n,r){this.x=t,this.y=n,this.z=r}get children(){if(!this._children){let t=this.x*2,n=this.y*2,r=this.z+1;this._children=[new Ce(t,n,r),new Ce(t,n+1,r),new Ce(t+1,n,r),new Ce(t+1,n+1,r)]}return this._children}update(t){let{viewport:n,cullingVolume:r,elevationBounds:s,minZ:i,maxZ:o,bounds:a,offset:c,project:l}=t,u=this.getBoundingVolume(s,c,l);if(a&&!this.insideBounds(a)||r.computeVisibility(u)<0)return!1;if(!this.childVisible){let{z:f}=this;if(f<o&&f>=i){let d=u.distanceTo(n.cameraPosition)*n.scale/n.height;f+=Math.floor(Math.log2(d))}if(f>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let f of this.children)f.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(let n of this._children)n.getSelected(t);return t}insideBounds([t,n,r,s]){let i=Math.pow(2,this.z),o=xn/i;return this.x*o<r&&this.y*o<s&&(this.x+1)*o>t&&(this.y+1)*o>n}getBoundingVolume(t,n,r){if(r){let c=this.z<1?_y:this.z<2?rf:nf,l=[];for(let u of c){let h=Ns(this.x+u[0],this.y+u[1],this.z);h[2]=t[0],l.push(r(h)),t[0]!==t[1]&&(h[2]=t[1],l.push(r(h)))}return fr(l)}let s=Math.pow(2,this.z),i=xn/s,o=this.x*i+n*xn,a=xn-(this.y+1)*i;return new Ee([o,a,t[0]],[o+i,a+i,t[1]])}};function sf(e,t,n,r){let s=e instanceof dr._GlobeViewport&&e.resolution?e.projectPosition:null,i=Object.values(e.getFrustumPlanes()).map(({normal:d,distance:p})=>new ct(d.clone().negate(),p)),o=new it(i),a=e.distanceScales.unitsPerMeter[2],c=n&&n[0]*a||0,l=n&&n[1]*a||0,u=e instanceof dr.WebMercatorViewport&&e.pitch<=60?t:0;if(r){let[d,p,A,g]=r,y=re([d,g]),E=re([A,p]);r=[y[0],xn-y[1],E[0],xn-E[1]]}let h=new Ce(0,0,0),f={viewport:e,project:s,cullingVolume:o,elevationBounds:[c,l],minZ:u,maxZ:t,bounds:r,offset:0};if(h.update(f),e instanceof dr.WebMercatorViewport&&e.subViewports&&e.subViewports.length>1){for(f.offset=-1;h.update(f)&&!(--f.offset<-ef););for(f.offset=1;h.update(f)&&!(++f.offset>ef););}return h.getSelected()}var oe=512,Ey=[-1/0,-1/0,1/0,1/0],Se={type:"object",value:null,validate:(e,t)=>t.optional&&e===null||typeof e=="string"||Array.isArray(e)&&e.every(n=>typeof n=="string"),equal:(e,t)=>{if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}};function af(e,t){let n=[t.transformAsPoint([e[0],e[1]]),t.transformAsPoint([e[2],e[1]]),t.transformAsPoint([e[0],e[3]]),t.transformAsPoint([e[2],e[3]])];return[Math.min(...n.map(s=>s[0])),Math.min(...n.map(s=>s[1])),Math.max(...n.map(s=>s[0])),Math.max(...n.map(s=>s[1]))]}function By(e){return Math.abs(e.split("").reduce((t,n)=>(t<<5)-t+n.charCodeAt(0)|0,0))}function Qt(e,t){if(!e||!e.length)return null;let{index:n,id:r}=t;if(Array.isArray(e)){let i=By(r)%e.length;e=e[i]}let s=e;for(let i of Object.keys(n)){let o=new RegExp(`{${i}}`,"g");s=s.replace(o,String(n[i]))}return Number.isInteger(n.y)&&Number.isInteger(n.z)&&(s=s.replace(/\{-y\}/g,String(Math.pow(2,n.z)-n.y-1))),s}function Cy(e,t,n){let r;if(t&&t.length===2){let[s,i]=t,o=e.getBounds({z:s}),a=e.getBounds({z:i});r=[Math.min(o[0],a[0]),Math.min(o[1],a[1]),Math.max(o[2],a[2]),Math.max(o[3],a[3])]}else r=e.getBounds();return e.isGeospatial?[Math.max(r[0],n[0]),Math.max(r[1],n[1]),Math.min(r[2],n[2]),Math.min(r[3],n[3])]:[Math.max(Math.min(r[0],n[2]),n[0]),Math.max(Math.min(r[1],n[3]),n[1]),Math.min(Math.max(r[2],n[0]),n[2]),Math.min(Math.max(r[3],n[1]),n[3])]}function cf({viewport:e,z:t,cullRect:n}){return(e.subViewports||[e]).map(s=>Ta(s,t||0,n))}function Ta(e,t,n){if(!Array.isArray(t)){let i=n.x-e.x,o=n.y-e.y,{width:a,height:c}=n,l={targetZ:t},u=e.unproject([i,o],l),h=e.unproject([i+a,o],l),f=e.unproject([i,o+c],l),d=e.unproject([i+a,o+c],l);return[Math.min(u[0],h[0],f[0],d[0]),Math.min(u[1],h[1],f[1],d[1]),Math.max(u[0],h[0],f[0],d[0]),Math.max(u[1],h[1],f[1],d[1])]}let r=Ta(e,t[0],n),s=Ta(e,t[1],n);return[Math.min(r[0],s[0]),Math.min(r[1],s[1]),Math.max(r[2],s[2]),Math.max(r[3],s[3])]}function Sy(e,t,n){return n?af(e,n).map(s=>s*t/oe):e.map(r=>r*t/oe)}function _a(e,t){return Math.pow(2,e)*oe/t}function Ns(e,t,n){let r=_a(n,oe),s=e/r*360-180,i=Math.PI-2*Math.PI*t/r,o=180/Math.PI*Math.atan(.5*(Math.exp(i)-Math.exp(-i)));return[s,o]}function of(e,t,n,r){let s=_a(n,r);return[e/s*oe,t/s*oe]}function Ea(e,t,n,r,s=oe){if(e.isGeospatial){let[l,u]=Ns(t,n,r),[h,f]=Ns(t+1,n+1,r);return{west:l,north:u,east:h,south:f}}let[i,o]=of(t,n,r,s),[a,c]=of(t+1,n+1,r,s);return{left:i,top:o,right:a,bottom:c}}function by(e,t,n,r,s){let i=Cy(e,null,r),o=_a(t,n),[a,c,l,u]=Sy(i,o,s),h=[];for(let f=Math.floor(a);f<l;f++)for(let d=Math.floor(c);d<u;d++)h.push({x:f,y:d,z:t});return h}function Ba({viewport:e,maxZoom:t,minZoom:n,zRange:r,extent:s,tileSize:i=oe,modelMatrix:o,modelMatrixInverse:a,zoomOffset:c=0}){let l=e.isGeospatial?Math.round(e.zoom+Math.log2(oe/i))+c:Math.ceil(e.zoom)+c;if(typeof n=="number"&&Number.isFinite(n)&&l<n){if(!s)return[];l=n}typeof t=="number"&&Number.isFinite(t)&&l>t&&(l=t);let u=s;return o&&a&&s&&!e.isGeospatial&&(u=af(s,o)),e.isGeospatial?sf(e,l,r,s):by(e,l,i,u||Ey,a)}function Ca(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(e)}function Sa(e){return Number.isFinite(e.west)&&Number.isFinite(e.north)&&Number.isFinite(e.east)&&Number.isFinite(e.south)}function lf(e){let t={},n;return r=>{for(let s in r)if(!My(r[s],t[s])){n=e(r),t=r;break}return n}}function My(e,t){if(e===t)return!0;if(Array.isArray(e)){let n=e.length;if(!t||t.length!==n)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}return!1}var uf=1,Ds=2,Iy="never",wy="no-overlap",pr="best-available",Fy=5,vy={[pr]:Ly,[wy]:Py,[Iy]:()=>{}},Ry={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},ke=class{constructor(t){this._getCullBounds=lf(cf),this.opts={...Ry,...t},this.setOptions(this.opts),this.onTileLoad=n=>{this.opts.onTileLoad?.(n),this.opts.maxCacheByteSize&&(this._cacheByteSize+=n.byteLength,this._resizeCache())},this._requestScheduler=new me({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new L,this._modelMatrixInverse=new L}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(t=>t.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(t=>t.needsReload)}setOptions(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom))}finalize(){for(let t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let t of this._cache.keys()){let n=this._cache.get(t);!this._selectedTiles||!this._selectedTiles.includes(n)?this._cache.delete(t):n.setNeedsReload()}}update(t,{zRange:n,modelMatrix:r}={zRange:null,modelMatrix:null}){let s=r?new L(r):new L,i=!s.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!mt(this._zRange,n)||i){i&&(this._modelMatrixInverse=s.clone().invert(),this._modelMatrix=s),this._viewport=t,this._zRange=n;let a=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:n,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=a.map(c=>this._getTile(c,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(a=>this._getTile(a.index,!0)));let o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(t,n){if(!t.isVisible)return!1;if(n&&this._viewport){let r=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:n}),{bbox:s}=t;for(let[i,o,a,c]of r){let l;if("west"in s)l=s.west<a&&s.east>i&&s.south<c&&s.north>o;else{let u=Math.min(s.top,s.bottom),h=Math.max(s.top,s.bottom);l=s.left<a&&s.right>i&&u<c&&h>o}if(l)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:n,minZoom:r,zRange:s,modelMatrix:i,modelMatrixInverse:o}){let{tileSize:a,extent:c,zoomOffset:l}=this.opts;return Ba({viewport:t,maxZoom:n,minZoom:r,zRange:s,tileSize:a,extent:c,modelMatrix:i,modelMatrixInverse:o,zoomOffset:l})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){let{tileSize:n}=this.opts;return{bbox:Ea(this._viewport,t.x,t.y,t.z,n)}}getParentIndex(t){let n=Math.floor(t.x/2),r=Math.floor(t.y/2),s=t.z-1;return{x:n,y:r,z:s}}updateTileStates(){let t=this.opts.refinementStrategy||pr,n=new Array(this._cache.size),r=0;for(let s of this._cache.values())n[r++]=s.isVisible,s.isSelected=!1,s.isVisible=!1;for(let s of this._selectedTiles)s.isSelected=!0,s.isVisible=!0;(typeof t=="function"?t:vy[t])(Array.from(this._cache.values())),r=0;for(let s of this._cache.values())if(n[r++]!==s.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:t=0}=this.opts,n=[],r=0;for(let s of this._cache.values())s.isLoading&&(r++,!s.isSelected&&!s.isVisible&&n.push(s));for(;t>0&&r>t&&n.length>0;)n.shift().abort(),r--}_rebuildTree(){let{_cache:t}=this;for(let n of t.values())n.parent=null,n.children&&(n.children.length=0);for(let n of t.values()){let r=this._getNearestAncestor(n);n.parent=r,r?.children&&r.children.push(n)}}_resizeCache(){let{_cache:t,opts:n}=this,r=n.maxCacheSize||(n.maxCacheByteSize?1/0:Fy*this.selectedTiles.length),s=n.maxCacheByteSize||1/0;if(t.size>r||this._cacheByteSize>s){for(let[o,a]of t)if(!a.isVisible&&!a.isSelected&&(this._cacheByteSize-=n.maxCacheByteSize?a.byteLength:0,t.delete(o),this.opts.onTileUnload?.(a)),t.size<=r&&this._cacheByteSize<=s)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((o,a)=>o.zoom-a.zoom),this._dirty=!1)}_getTile(t,n){let r=this.getTileId(t),s=this._cache.get(r),i=!1;return!s&&n?(s=new ze(t),Object.assign(s,this.getTileMetadata(s.index)),Object.assign(s,{id:r,zoom:this.getTileZoom(s.index)}),i=!0,this._cache.set(r,s),this._dirty=!0):s&&s.needsReload&&(i=!0),s&&i&&s.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),s}_getNearestAncestor(t){let{_minZoom:n=0}=this,r=t.index;for(;this.getTileZoom(r)>n;){r=this.getParentIndex(r);let s=this._getTile(r);if(s)return s}return null}};function Ly(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!hf(t)&&ba(t);for(let t of e)t.isVisible=Boolean(t.state&Ds)}function Py(e){for(let n of e)n.state=0;for(let n of e)n.isSelected&&hf(n);let t=Array.from(e).sort((n,r)=>n.zoom-r.zoom);for(let n of t)if(n.isVisible=Boolean(n.state&Ds),n.children&&(n.isVisible||n.state&uf))for(let r of n.children)r.state=uf;else n.isSelected&&ba(n)}function hf(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=Ds,!0;t=t.parent}return!1}function ba(e){for(let t of e.children)t.isLoaded||t.content?t.state|=Ds:ba(t)}var Oy={TilesetClass:ke,data:{type:"data",value:[]},dataComparator:Se.equal,renderSubLayers:{type:"function",value:e=>new ff.GeoJsonLayer(e)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:e=>{}},onTileUnload:{type:"function",value:e=>{}},onTileError:{type:"function",value:e=>console.error(e)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:pr,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},Us=class extends Gs.CompositeLayer{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every(t=>t.isLoaded&&t.layers&&t.layers.every(n=>n.isLoaded)))}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:n}=this.state,r=t.propsOrDataChanged||t.updateTriggersChanged,s=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);n?r&&(n.setOptions(this._getTilesetOptions()),s?n.reloadAll():n.tiles.forEach(i=>{i.layers=null})):(n=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:n})),this._updateTileset()}_getTilesetOptions(){let{tileSize:t,maxCacheSize:n,maxCacheByteSize:r,refinementStrategy:s,extent:i,maxZoom:o,minZoom:a,maxRequests:c,debounceTime:l,zoomOffset:u}=this.props;return{maxCacheSize:n,maxCacheByteSize:r,maxZoom:o,minZoom:a,tileSize:t,refinementStrategy:s,extent:i,maxRequests:c,debounceTime:l,zoomOffset:u,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let t=this.state.tileset,{zRange:n,modelMatrix:r}=this.props,s=t.update(this.context.viewport,{zRange:n,modelMatrix:r}),{isLoaded:i}=t,o=this.state.isLoaded!==i,a=this.state.frameNumber!==s;i&&(o||a)&&this._onViewportLoad(),a&&this.setState({frameNumber:s}),this.state.isLoaded=i}_onViewportLoad(){let{tileset:t}=this.state,{onViewportLoad:n}=this.props;n&&n(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,n){this.props.onTileError(t),n.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){let{data:n,getTileData:r,fetch:s}=this.props,{signal:i}=t;return t.url=typeof n=="string"||Array.isArray(n)?Qt(n,t):null,r?r(t):s&&t.url?s(t.url,{propName:"data",layer:this,signal:i}):null}renderSubLayers(t){return this.props.renderSubLayers(t)}getSubLayerPropsByTile(t){return null}getPickingInfo(t){let n=t.sourceLayer.props.tile,r=t.info;return r.picked&&(r.tile=n),r.sourceTile=n,r}_updateAutoHighlight(t){let n=t.sourceTile;if(n&&n.layers)for(let r of n.layers)r.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map(t=>{let n=this.getSubLayerPropsByTile(t);if(!(!t.isLoaded&&!t.content))if(t.layers)n&&t.layers[0]&&Object.keys(n).some(r=>t.layers[0].props[r]!==n[r])&&(t.layers=t.layers.map(r=>r.clone(n)));else{let r=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=(0,Gs._flatten)(r,Boolean).map(s=>s.clone({tile:t,...n}))}return t.layers})}filterSubLayer({layer:t,cullRect:n}){let{tile:r}=t.props;return this.state.tileset.isTileVisible(r,n)}},Zt=Us;(()=>{Us.defaultProps=Oy})(),(()=>{Us.layerName="TileLayer"})();var df=O(Nt(),1),Ny={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:e=>e.timestamps}},Vs=class extends df.PathLayer{getShaders(){let t=super.getShaders();return t.inject={"vs:#decl":`uniform float trailLength;
|
|
14
14
|
in float instanceTimestamps;
|
|
15
15
|
in float instanceNextTimestamps;
|
|
16
16
|
out float vTime;
|
|
@@ -25,7 +25,7 @@ in float vTime;
|
|
|
25
25
|
`,"fs:DECKGL_FILTER_COLOR":`if(fadeTrail) {
|
|
26
26
|
color.a *= 1.0 - (currentTime - vTime) / trailLength;
|
|
27
27
|
}
|
|
28
|
-
`},t}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})}draw(t){let{fadeTrail:r,trailLength:n,currentTime:s}=this.props;t.uniforms={...t.uniforms,fadeTrail:r,trailLength:n,currentTime:s},super.draw(t)}},mn=Hs;(()=>{Hs.layerName="TripsLayer"})(),(()=>{Hs.defaultProps=vy})();var Af=D(zs(),1),xf=D(vt(),1);var Lt=D(zs(),1),Js=D(vt(),1),An=D(Dt(),1);var gn=D(zs(),1);function ks(e,t){t=t===void 0?e[0][0]:t;for(let r of e){let n=r[0]-t;n>180?r[0]-=360:n<-180&&(r[0]+=360)}}function Uy(e,t,r){let[n,s]=(0,gn.cellToLatLng)(e),o=t.length;ks(t,s);let i=t[0]===t[o-1]?o-1:o;for(let a=0;a<i;a++)t[a][0]=Te(s,t[a][0],r),t[a][1]=Te(n,t[a][1],r)}function mf(e,t,r){let n=e(t,r),[s,o]=(0,gn.cellToLatLng)(n);return[o,s]}function Ia(e,t=1){let r=(0,gn.cellToBoundary)(e,!0);return t!==1?Uy(e,r,t):ks(r),r}function gf(e){let t=new Float64Array(e.length*2),r=0;for(let n of e)t[r++]=n[0],t[r++]=n[1];return t}var Gy=10;function Vy(e,t){let r;return e==null?r=t:typeof e=="object"?r={...e,coverage:t}:r={getHexagon:e,coverage:t},r}var Hy={...An.PolygonLayer.defaultProps,highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:e=>e.hexagon},extruded:!0},xr=class extends Js.CompositeLayer{initializeState(){xr._checkH3Lib(),this.state={edgeLengthKM:0,resolution:-1}}shouldUpdateState({changeFlags:t}){return this._shouldUseHighPrecision()?t.propsOrDataChanged:t.somethingChanged}updateState({props:t,changeFlags:r}){if(t.highPrecision!==!0&&(r.dataChanged||r.updateTriggersChanged&&r.updateTriggersChanged.getHexagon)){let n=this._calculateH3DataProps();this.setState(n)}this._updateVertices(this.context.viewport)}_calculateH3DataProps(){let t=-1,r=!1,n=!1,{iterable:s,objectInfo:o}=(0,Js.createIterable)(this.props.data);for(let i of s){o.index++;let a=this.props.getHexagon(i,o),c=(0,Lt.getResolution)(a);if(t<0){if(t=c,!this.props.highPrecision)break}else if(t!==c){n=!0;break}if((0,Lt.isPentagon)(a)){r=!0;break}}return{resolution:t,edgeLengthKM:t>=0?(0,Lt.getHexagonEdgeLengthAvg)(t,"km"):0,hasMultipleRes:n,hasPentagon:r}}_shouldUseHighPrecision(){if(this.props.highPrecision==="auto"){let{resolution:t,hasPentagon:r,hasMultipleRes:n}=this.state,{viewport:s}=this.context;return Boolean(s?.resolution)||n||r||t>=0&&t<=5}return this.props.highPrecision}_updateVertices(t){if(this._shouldUseHighPrecision())return;let{resolution:r,edgeLengthKM:n,centerHex:s}=this.state;if(r<0)return;let o=this.props.centerHexagon||(0,Lt.latLngToCell)(t.latitude,t.longitude,r);if(s===o)return;if(s)try{if((0,Lt.gridDistance)(s,o)*n<Gy)return}catch{}let{unitsPerMeter:i}=t.distanceScales,a=Ia(o),[c,l]=(0,Lt.cellToLatLng)(o),[h,u]=t.projectFlat([l,c]);a=a.map(f=>{let d=t.projectFlat(f);return[(d[0]-h)/i[0],(d[1]-u)/i[1]]}),this.setState({centerHex:o,vertices:a})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){let{elevationScale:t,material:r,coverage:n,extruded:s,wireframe:o,stroked:i,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:h,lineWidthMaxPixels:u,getFillColor:f,getElevation:d,getLineColor:p,getLineWidth:A,transitions:g,updateTriggers:y}=this.props;return{elevationScale:t,extruded:s,coverage:n,wireframe:o,stroked:i,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:h,lineWidthMaxPixels:u,material:r,getElevation:d,getFillColor:f,getLineColor:p,getLineWidth:A,transitions:g,updateTriggers:{getFillColor:y.getFillColor,getElevation:y.getElevation,getLineColor:y.getLineColor,getLineWidth:y.getLineWidth}}}_renderPolygonLayer(){let{data:t,getHexagon:r,updateTriggers:n,coverage:s}=this.props,o=this.getSubLayerClass("hexagon-cell-hifi",An.PolygonLayer),i=this._getForwardProps();return i.updateTriggers.getPolygon=Vy(n.getHexagon,s),new o(i,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:i.updateTriggers}),{data:t,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(a,c)=>{let l=r(a,c);return gf(Ia(l,s))}})}_renderColumnLayer(){let{data:t,getHexagon:r,updateTriggers:n}=this.props,s=this.getSubLayerClass("hexagon-cell",An.ColumnLayer),o=this._getForwardProps();return o.updateTriggers.getPosition=n.getHexagon,new s(o,this.getSubLayerProps({id:"hexagon-cell",flatShading:!0,updateTriggers:o.updateTriggers}),{data:t,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:mf.bind(null,r)})}},Je=xr;(()=>{xr.defaultProps=Hy})(),(()=>{xr.layerName="H3HexagonLayer"})(),(()=>{xr._checkH3Lib=()=>{}})();var zy={getHexagons:{type:"accessor",value:e=>e.hexagons}},qs=class extends bt{initializeState(){Je._checkH3Lib()}updateState({props:t,changeFlags:r}){if(r.dataChanged||r.updateTriggersChanged&&r.updateTriggersChanged.getHexagons){let{data:n,getHexagons:s}=t,o=[],{iterable:i,objectInfo:a}=(0,xf.createIterable)(n);for(let c of i){a.index++;let l=s(c,a),h=(0,Af.cellsToMultiPolygon)(l,!0);for(let u of h){for(let f of u)ks(f);o.push(this.getSubLayerRow({polygon:u},c,a.index))}}this.setState({polygons:o})}}indexToBounds(){let{getElevation:t,getFillColor:r,getLineColor:n,getLineWidth:s}=this.props;return{data:this.state.polygons,getPolygon:o=>o.polygon,getElevation:this.getSubLayerAccessor(t),getFillColor:this.getSubLayerAccessor(r),getLineColor:this.getSubLayerAccessor(n),getLineWidth:this.getSubLayerAccessor(s)}}},xn=qs;(()=>{qs.layerName="H3ClusterLayer"})(),(()=>{qs.defaultProps=zy})();var cm=D(wa(),1),Le=D(vt(),1),lm=D(Dt(),1),hm=D(js(),1);var Bf=D(Ef(),1),zt;(function(e){e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.ONE=1]="ONE",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.LINEAR=9729]="LINEAR",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL"})(zt||(zt={}));function Fa(e,t,r,n){let s={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{u_Camera:[0,0,0],u_MetallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=1;let{imageBasedLightingEnvironment:o}=n;return o&&(s.bindings.u_DiffuseEnvSampler=o.diffuseEnvSampler,s.bindings.u_SpecularEnvSampler=o.specularEnvSampler,s.bindings.u_brdfLUT=o.brdfLutTexture,s.uniforms.u_ScaleIBLAmbient=[1,1]),n?.pbrDebug&&(s.defines.PBR_DEBUG=1,s.uniforms.u_ScaleDiffBaseMR=[0,0,0,0],s.uniforms.u_ScaleFGDSpec=[0,0,0,0]),r.NORMAL&&(s.defines.HAS_NORMALS=1),r.TANGENT&&n?.useTangents&&(s.defines.HAS_TANGENTS=1),r.TEXCOORD_0&&(s.defines.HAS_UV=1),n?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=1),n?.lights&&(s.defines.USE_LIGHTS=1),t&&ky(e,t,s),s}function ky(e,t,r){if(r.uniforms.pbr_uUnlit=Boolean(t.unlit),t.pbrMetallicRoughness&&Jy(e,t.pbrMetallicRoughness,r),t.normalTexture){yn(e,t.normalTexture,"u_NormalSampler","HAS_NORMALMAP",r);let{scale:n=1}=t.normalTexture;r.uniforms.u_NormalScale=n}if(t.occlusionTexture){yn(e,t.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP",r);let{strength:n=1}=t.occlusionTexture;r.uniforms.u_OcclusionStrength=n}switch(t.emissiveTexture&&(yn(e,t.emissiveTexture,"u_EmissiveSampler","HAS_EMISSIVEMAP",r),r.uniforms.u_EmissiveFactor=t.emissiveFactor||[0,0,0]),t.alphaMode){case"MASK":let{alphaCutoff:n=.5}=t;r.defines.ALPHA_CUTOFF=1,r.uniforms.u_AlphaCutoff=n;break;case"BLEND":Bf.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),r.parameters.blendColorOperation="add",r.parameters.blendColorSrcFactor="src-alpha",r.parameters.blendColorDstFactor="one-minus-src-alpha",r.parameters.blendAlphaOperation="add",r.parameters.blendAlphaSrcFactor="one",r.parameters.blendAlphaDstFactor="one-minus-src-alpha",r.glParameters.blend=!0,r.glParameters.blendEquation=zt.FUNC_ADD,r.glParameters.blendFunc=[zt.SRC_ALPHA,zt.ONE_MINUS_SRC_ALPHA,zt.ONE,zt.ONE_MINUS_SRC_ALPHA];break}}function Jy(e,t,r){t.baseColorTexture&&yn(e,t.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP",r),r.uniforms.u_BaseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&yn(e,t.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP",r);let{metallicFactor:n=1,roughnessFactor:s=1}=t;r.uniforms.u_MetallicRoughnessValues=[n,s]}function yn(e,t,r,n=null,s){let o=t?.texture?.sampler?.parameters||{},i=t.texture.source.image,a,c={};i.compressed?(a=i,c={[zt.TEXTURE_MIN_FILTER]:i.data.length>1?zt.LINEAR_MIPMAP_NEAREST:zt.LINEAR}):a={data:i};let l=e.createTexture({id:t.uniformName||t.id,parameters:{...o,...c},pixelStore:{[zt.UNPACK_FLIP_Y_WEBGL]:!1},...a});s.bindings[r]=l,n&&(s.defines[n]=1),s.generatedTextures.push(l)}var NR=new Uint8Array([0]);var Cf,Sf,Mf,bf,If,wf,Ff,Lf;(function(e){e[e.NONE=0]="NONE",e[e.BASISLZ=1]="BASISLZ",e[e.ZSTD=2]="ZSTD",e[e.ZLIB=3]="ZLIB"})(Cf||(Cf={})),function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(Sf||(Sf={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(Mf||(Mf={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(bf||(bf={})),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"}(If||(If={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(wf||(wf={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(Ff||(Ff={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(Lf||(Lf={}));var La=`#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
|
|
28
|
+
`},t}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})}draw(t){let{fadeTrail:n,trailLength:r,currentTime:s}=this.props;t.uniforms={...t.uniforms,fadeTrail:n,trailLength:r,currentTime:s},super.draw(t)}},mr=Vs;(()=>{Vs.layerName="TripsLayer"})(),(()=>{Vs.defaultProps=Ny})();var Af=O(Hs(),1),xf=O(Dt(),1);var Rt=O(Hs(),1),ks=O(Dt(),1),Ar=O(Nt(),1);var gr=O(Hs(),1);function zs(e,t){t=t===void 0?e[0][0]:t;for(let n of e){let r=n[0]-t;r>180?n[0]-=360:r<-180&&(n[0]+=360)}}function Dy(e,t,n){let[r,s]=(0,gr.cellToLatLng)(e),i=t.length;zs(t,s);let o=t[0]===t[i-1]?i-1:i;for(let a=0;a<o;a++)t[a][0]=xe(s,t[a][0],n),t[a][1]=xe(r,t[a][1],n)}function mf(e,t,n){let r=e(t,n),[s,i]=(0,gr.cellToLatLng)(r);return[i,s]}function Ma(e,t=1){let n=(0,gr.cellToBoundary)(e,!0);return t!==1?Dy(e,n,t):zs(n),n}function gf(e){let t=new Float64Array(e.length*2),n=0;for(let r of e)t[n++]=r[0],t[n++]=r[1];return t}var Uy=10;function Gy(e,t){let n;return e==null?n=t:typeof e=="object"?n={...e,coverage:t}:n={getHexagon:e,coverage:t},n}var Vy={...Ar.PolygonLayer.defaultProps,highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:e=>e.hexagon},extruded:!0},yn=class extends ks.CompositeLayer{initializeState(){yn._checkH3Lib(),this.state={edgeLengthKM:0,resolution:-1}}shouldUpdateState({changeFlags:t}){return this._shouldUseHighPrecision()?t.propsOrDataChanged:t.somethingChanged}updateState({props:t,changeFlags:n}){if(t.highPrecision!==!0&&(n.dataChanged||n.updateTriggersChanged&&n.updateTriggersChanged.getHexagon)){let r=this._calculateH3DataProps();this.setState(r)}this._updateVertices(this.context.viewport)}_calculateH3DataProps(){let t=-1,n=!1,r=!1,{iterable:s,objectInfo:i}=(0,ks.createIterable)(this.props.data);for(let o of s){i.index++;let a=this.props.getHexagon(o,i),c=(0,Rt.getResolution)(a);if(t<0){if(t=c,!this.props.highPrecision)break}else if(t!==c){r=!0;break}if((0,Rt.isPentagon)(a)){n=!0;break}}return{resolution:t,edgeLengthKM:t>=0?(0,Rt.getHexagonEdgeLengthAvg)(t,"km"):0,hasMultipleRes:r,hasPentagon:n}}_shouldUseHighPrecision(){if(this.props.highPrecision==="auto"){let{resolution:t,hasPentagon:n,hasMultipleRes:r}=this.state,{viewport:s}=this.context;return Boolean(s?.resolution)||r||n||t>=0&&t<=5}return this.props.highPrecision}_updateVertices(t){if(this._shouldUseHighPrecision())return;let{resolution:n,edgeLengthKM:r,centerHex:s}=this.state;if(n<0)return;let i=this.props.centerHexagon||(0,Rt.latLngToCell)(t.latitude,t.longitude,n);if(s===i)return;if(s)try{if((0,Rt.gridDistance)(s,i)*r<Uy)return}catch{}let{unitsPerMeter:o}=t.distanceScales,a=Ma(i),[c,l]=(0,Rt.cellToLatLng)(i),[u,h]=t.projectFlat([l,c]);a=a.map(f=>{let d=t.projectFlat(f);return[(d[0]-u)/o[0],(d[1]-h)/o[1]]}),this.setState({centerHex:i,vertices:a})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){let{elevationScale:t,material:n,coverage:r,extruded:s,wireframe:i,stroked:o,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:h,getFillColor:f,getElevation:d,getLineColor:p,getLineWidth:A,transitions:g,updateTriggers:y}=this.props;return{elevationScale:t,extruded:s,coverage:r,wireframe:i,stroked:o,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:h,material:n,getElevation:d,getFillColor:f,getLineColor:p,getLineWidth:A,transitions:g,updateTriggers:{getFillColor:y.getFillColor,getElevation:y.getElevation,getLineColor:y.getLineColor,getLineWidth:y.getLineWidth}}}_renderPolygonLayer(){let{data:t,getHexagon:n,updateTriggers:r,coverage:s}=this.props,i=this.getSubLayerClass("hexagon-cell-hifi",Ar.PolygonLayer),o=this._getForwardProps();return o.updateTriggers.getPolygon=Gy(r.getHexagon,s),new i(o,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:o.updateTriggers}),{data:t,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(a,c)=>{let l=n(a,c);return gf(Ma(l,s))}})}_renderColumnLayer(){let{data:t,getHexagon:n,updateTriggers:r}=this.props,s=this.getSubLayerClass("hexagon-cell",Ar.ColumnLayer),i=this._getForwardProps();return i.updateTriggers.getPosition=r.getHexagon,new s(i,this.getSubLayerProps({id:"hexagon-cell",flatShading:!0,updateTriggers:i.updateTriggers}),{data:t,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:mf.bind(null,n)})}},Je=yn;(()=>{yn.defaultProps=Vy})(),(()=>{yn.layerName="H3HexagonLayer"})(),(()=>{yn._checkH3Lib=()=>{}})();var Hy={getHexagons:{type:"accessor",value:e=>e.hexagons}},Js=class extends Mt{initializeState(){Je._checkH3Lib()}updateState({props:t,changeFlags:n}){if(n.dataChanged||n.updateTriggersChanged&&n.updateTriggersChanged.getHexagons){let{data:r,getHexagons:s}=t,i=[],{iterable:o,objectInfo:a}=(0,xf.createIterable)(r);for(let c of o){a.index++;let l=s(c,a),u=(0,Af.cellsToMultiPolygon)(l,!0);for(let h of u){for(let f of h)zs(f);i.push(this.getSubLayerRow({polygon:h},c,a.index))}}this.setState({polygons:i})}}indexToBounds(){let{getElevation:t,getFillColor:n,getLineColor:r,getLineWidth:s}=this.props;return{data:this.state.polygons,getPolygon:i=>i.polygon,getElevation:this.getSubLayerAccessor(t),getFillColor:this.getSubLayerAccessor(n),getLineColor:this.getSubLayerAccessor(r),getLineWidth:this.getSubLayerAccessor(s)}}},xr=Js;(()=>{Js.layerName="H3ClusterLayer"})(),(()=>{Js.defaultProps=Hy})();var cm=O(Ia(),1),we=O(Dt(),1),lm=O(Nt(),1),um=O(qs(),1);var Bf=O(Ef(),1),Vt;(function(e){e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.ONE=1]="ONE",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.LINEAR=9729]="LINEAR",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL"})(Vt||(Vt={}));function wa(e,t,n,r){let s={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{u_Camera:[0,0,0],u_MetallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=1;let{imageBasedLightingEnvironment:i}=r;return i&&(s.bindings.u_DiffuseEnvSampler=i.diffuseEnvSampler,s.bindings.u_SpecularEnvSampler=i.specularEnvSampler,s.bindings.u_brdfLUT=i.brdfLutTexture,s.uniforms.u_ScaleIBLAmbient=[1,1]),r?.pbrDebug&&(s.defines.PBR_DEBUG=1,s.uniforms.u_ScaleDiffBaseMR=[0,0,0,0],s.uniforms.u_ScaleFGDSpec=[0,0,0,0]),n.NORMAL&&(s.defines.HAS_NORMALS=1),n.TANGENT&&r?.useTangents&&(s.defines.HAS_TANGENTS=1),n.TEXCOORD_0&&(s.defines.HAS_UV=1),r?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=1),r?.lights&&(s.defines.USE_LIGHTS=1),t&&zy(e,t,s),s}function zy(e,t,n){if(n.uniforms.pbr_uUnlit=Boolean(t.unlit),t.pbrMetallicRoughness&&ky(e,t.pbrMetallicRoughness,n),t.normalTexture){yr(e,t.normalTexture,"u_NormalSampler","HAS_NORMALMAP",n);let{scale:r=1}=t.normalTexture;n.uniforms.u_NormalScale=r}if(t.occlusionTexture){yr(e,t.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP",n);let{strength:r=1}=t.occlusionTexture;n.uniforms.u_OcclusionStrength=r}switch(t.emissiveTexture&&(yr(e,t.emissiveTexture,"u_EmissiveSampler","HAS_EMISSIVEMAP",n),n.uniforms.u_EmissiveFactor=t.emissiveFactor||[0,0,0]),t.alphaMode){case"MASK":let{alphaCutoff:r=.5}=t;n.defines.ALPHA_CUTOFF=1,n.uniforms.u_AlphaCutoff=r;break;case"BLEND":Bf.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),n.parameters.blendColorOperation="add",n.parameters.blendColorSrcFactor="src-alpha",n.parameters.blendColorDstFactor="one-minus-src-alpha",n.parameters.blendAlphaOperation="add",n.parameters.blendAlphaSrcFactor="one",n.parameters.blendAlphaDstFactor="one-minus-src-alpha",n.glParameters.blend=!0,n.glParameters.blendEquation=Vt.FUNC_ADD,n.glParameters.blendFunc=[Vt.SRC_ALPHA,Vt.ONE_MINUS_SRC_ALPHA,Vt.ONE,Vt.ONE_MINUS_SRC_ALPHA];break}}function ky(e,t,n){t.baseColorTexture&&yr(e,t.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP",n),n.uniforms.u_BaseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&yr(e,t.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP",n);let{metallicFactor:r=1,roughnessFactor:s=1}=t;n.uniforms.u_MetallicRoughnessValues=[r,s]}function yr(e,t,n,r=null,s){let i=t?.texture?.sampler?.parameters||{},o=t.texture.source.image,a,c={};o.compressed?(a=o,c={[Vt.TEXTURE_MIN_FILTER]:o.data.length>1?Vt.LINEAR_MIPMAP_NEAREST:Vt.LINEAR}):a={data:o};let l=e.createTexture({id:t.uniformName||t.id,parameters:{...i,...c},pixelStore:{[Vt.UNPACK_FLIP_Y_WEBGL]:!1},...a});s.bindings[n]=l,r&&(s.defines[r]=1),s.generatedTextures.push(l)}var Cf="4.1.4";var js={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},Fa;async function Ra(e){let t=e.modules||{};return t.basis?t.basis:(Fa=Fa||Jy(e),await Fa)}async function Jy(e){let t=null,n=null;return[t,n]=await Promise.all([await Xt(js.TRANSCODER,"textures",e),await Xt(js.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await qy(t,n)}function qy(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e(n).then(s=>{let{BasisFile:i,initializeBasis:o}=s;o(),r({BasisFile:i})})})}var va;async function La(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(va=va||jy(e),await va)}async function jy(e){let t=null,n=null;return[t,n]=await Promise.all([await Xt(js.ENCODER,"textures",e),await Xt(js.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await Xy(t,n)}function Xy(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e(n).then(s=>{let{BasisFile:i,KTX2File:o,initializeBasis:a,BasisEncoder:c}=s;a(),r({BasisFile:i,KTX2File:o,BasisEncoder:c})})})}var qe={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919};var Wy=["","WEBKIT_","MOZ_"],Sf={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"},Xs=null;function bf(e){if(!Xs){e=e||Yy()||void 0,Xs=new Set;for(let t of Wy)for(let n in Sf)if(e&&e.getExtension(`${t}${n}`)){let r=Sf[n];Xs.add(r)}}return Xs}function Yy(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var IR=new Uint8Array([0]);var Mf,If,wf,Ff,vf,Rf,Lf,Pf;(function(e){e[e.NONE=0]="NONE",e[e.BASISLZ=1]="BASISLZ",e[e.ZSTD=2]="ZSTD",e[e.ZLIB=3]="ZLIB"})(Mf||(Mf={})),function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(If||(If={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(wf||(wf={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(Ff||(Ff={})),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"}(vf||(vf={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(Rf||(Rf={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(Lf||(Lf={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(Pf||(Pf={}));var It=[171,75,84,88,32,50,48,187,13,10,26,10];function Of(e){let t=new Uint8Array(e);return!(t.byteLength<It.length||t[0]!==It[0]||t[1]!==It[1]||t[2]!==It[2]||t[3]!==It[3]||t[4]!==It[4]||t[5]!==It[5]||t[6]!==It[6]||t[7]!==It[7]||t[8]!==It[8]||t[9]!==It[9]||t[10]!==It[10]||t[11]!==It[11])}var Ky={etc1:{basisFormat:0,compressed:!0,format:qe.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:qe.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:qe.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:qe.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:qe.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:qe.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 Oa(e,t){if(t.basis.containerFormat==="auto"){if(Of(e)){let r=await La(t);return Nf(r.KTX2File,e,t)}let{BasisFile:n}=await Ra(t);return Pa(n,e,t)}switch(t.basis.module){case"encoder":let n=await La(t);switch(t.basis.containerFormat){case"ktx2":return Nf(n.KTX2File,e,t);case"basis":default:return Pa(n.BasisFile,e,t)}case"transcoder":default:let{BasisFile:r}=await Ra(t);return Pa(r,e,t)}}function Pa(e,t,n){let r=new e(new Uint8Array(t));try{if(!r.startTranscoding())throw new Error("Failed to start basis transcoding");let s=r.getNumImages(),i=[];for(let o=0;o<s;o++){let a=r.getNumLevels(o),c=[];for(let l=0;l<a;l++)c.push(Qy(r,o,l,n));i.push(c)}return i}finally{r.close(),r.delete()}}function Qy(e,t,n,r){let s=e.getImageWidth(t,n),i=e.getImageHeight(t,n),o=e.getHasAlpha(),{compressed:a,format:c,basisFormat:l}=Df(r,o),u=e.getImageTranscodedSizeInBytes(t,n,l),h=new Uint8Array(u);if(!e.transcodeImage(h,t,n,l,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:i,data:h,compressed:a,format:c,hasAlpha:o}}function Nf(e,t,n){let r=new e(new Uint8Array(t));try{if(!r.startTranscoding())throw new Error("failed to start KTX2 transcoding");let s=r.getLevels(),i=[];for(let o=0;o<s;o++){i.push(Zy(r,o,n));break}return[i]}finally{r.close(),r.delete()}}function Zy(e,t,n){let{alphaFlag:r,height:s,width:i}=e.getImageLevelInfo(t,0,0),{compressed:o,format:a,basisFormat:c}=Df(n,r),l=e.getImageTranscodedSizeInBytes(t,0,0,c),u=new Uint8Array(l);if(!e.transcodeImage(u,t,0,0,c,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:i,height:s,data:u,compressed:o,levelSize:l,hasAlpha:r,format:a}}function Df(e,t){let n=e&&e.basis&&e.basis.format;return n==="auto"&&(n=Ws()),typeof n=="object"&&(n=t?n.alpha:n.noAlpha),n=n.toLowerCase(),Ky[n]}function Ws(){let e=bf();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"}var Uf={name:"Basis",id:"basis",module:"textures",version:Cf,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"}}},Na={...Uf,parse:Oa};var Da=`#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
|
|
29
29
|
struct AmbientLight {
|
|
30
30
|
vec3 color;
|
|
31
31
|
};
|
|
@@ -50,7 +50,7 @@ return pointLight.attenuation.x
|
|
|
50
50
|
+ pointLight.attenuation.z * distance * distance;
|
|
51
51
|
}
|
|
52
52
|
#endif
|
|
53
|
-
`;var
|
|
53
|
+
`;var $y={lightSources:{}};function Ua(e={}){let{color:t=[0,0,0],intensity:n=1}=e;return t.map(r=>r*n/255)}function tT({ambientLight:e,pointLights:t=[],directionalLights:n=[]}){let r={};return e?r["lighting_uAmbientLight.color"]=Ua(e):r["lighting_uAmbientLight.color"]=[0,0,0],t.forEach((s,i)=>{r[`lighting_uPointLight[${i}].color`]=Ua(s),r[`lighting_uPointLight[${i}].position`]=s.position,r[`lighting_uPointLight[${i}].attenuation`]=s.attenuation||[1,0,0]}),r.lighting_uPointLightCount=t.length,n.forEach((s,i)=>{r[`lighting_uDirectionalLight[${i}].color`]=Ua(s),r[`lighting_uDirectionalLight[${i}].direction`]=s.direction}),r.lighting_uDirectionalLightCount=n.length,r}function Gf(e=$y){if("lightSources"in e){let{ambientLight:t,pointLights:n,directionalLights:r}=e.lightSources||{};return t||n&&n.length>0||r&&r.length>0?Object.assign({},tT({ambientLight:t,pointLights:n,directionalLights:r}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in e){let t={pointLights:[],directionalLights:[]};for(let n of e.lights||[])switch(n.type){case"ambient":t.ambientLight=n;break;case"directional":t.directionalLights?.push(n);break;case"point":t.pointLights?.push(n);break;default:}return Gf({lightSources:t})}return{}}var Vf={name:"lights",vs:Da,fs:Da,getUniforms:Gf,defines:{MAX_LIGHTS:3}};var Hf=`uniform mat4 u_MVPMatrix;
|
|
54
54
|
uniform mat4 u_ModelMatrix;
|
|
55
55
|
uniform mat4 u_NormalMatrix;
|
|
56
56
|
out vec3 pbr_vPosition;
|
|
@@ -82,7 +82,7 @@ pbr_vUV = uv;
|
|
|
82
82
|
pbr_vUV = vec2(0.,0.);
|
|
83
83
|
#endif
|
|
84
84
|
}
|
|
85
|
-
`;var
|
|
85
|
+
`;var zf=`precision highp float;
|
|
86
86
|
uniform bool pbr_uUnlit;
|
|
87
87
|
#ifdef USE_IBL
|
|
88
88
|
uniform samplerCube u_DiffuseEnvSampler;
|
|
@@ -351,7 +351,7 @@ color = mix(color, vec3(perceptualRoughness), u_ScaleDiffBaseMR.w);
|
|
|
351
351
|
}
|
|
352
352
|
return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
|
|
353
353
|
}
|
|
354
|
-
`;var
|
|
354
|
+
`;var Ga={name:"pbr",vs:Hf,fs:zf,defines:{LIGHTING_FRAGMENT:1},dependencies:[Vf]};var qf=O(Ia(),1),jf=O(qs(),1);var kf=`#version 300 es
|
|
355
355
|
#define SHADER_NAME simple-mesh-layer-vs
|
|
356
356
|
uniform float sizeScale;
|
|
357
357
|
uniform bool composeModelMatrix;
|
|
@@ -413,7 +413,7 @@ geometry.uv = pbr_vUV;
|
|
|
413
413
|
#endif
|
|
414
414
|
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
415
415
|
}
|
|
416
|
-
`;var
|
|
416
|
+
`;var Jf=`#version 300 es
|
|
417
417
|
#define SHADER_NAME simple-mesh-layer-fs
|
|
418
418
|
precision highp float;
|
|
419
419
|
uniform bool hasTexture;
|
|
@@ -445,6 +445,6 @@ fragColor = vec4(lightColor, color.a * opacity);
|
|
|
445
445
|
#endif
|
|
446
446
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
447
447
|
}
|
|
448
|
-
`;function Xy(e){let t=e.positions||e.POSITION,r=t.value.length/t.size;e.COLOR_0||e.colors||(e.colors={size:4,value:new Uint8Array(r*4).fill(255),normalized:!0})}var Wy={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},Xs=class extends Gf.SimpleMeshLayer{getShaders(){let t=super.getShaders();return t.modules.push(Pa),{...t,vs:Df,fs:vf}}initializeState(){let{featureIds:t}=this.props;super.initializeState();let r=this.getAttributeManager();t&&r.add({featureIdsPickingColors:{type:"uint8",size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})}updateState(t){super.updateState(t);let{props:r,oldProps:n}=t;r.pbrMaterial!==n.pbrMaterial&&this.updatePbrMaterialUniforms(r.pbrMaterial)}draw(t){let{featureIds:r}=this.props;this.state.model&&(this.state.model.setUniforms({u_Camera:this.state.model.uniforms.project_uCameraPosition,pickFeatureIds:Boolean(r)}),super.draw(t))}getModel(t){let{id:r,pbrMaterial:n}=this.props,s=this.parseMaterial(n,t);this.setState({parsedPBRMaterial:s});let o=this.getShaders();return Xy(t.attributes),new Uf.Model(this.context.device,{...this.getShaders(),id:r,geometry:t,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:{...o.defines,...s?.defines,HAS_UV_REGIONS:t.attributes.uvRegions?1:0},parameters:s?.parameters,isInstanced:!0})}updatePbrMaterialUniforms(t){let{model:r}=this.state;if(r){let{mesh:n}=this.props,s=this.parseMaterial(t,n);this.setState({parsedPBRMaterial:s}),r.setBindings(s.bindings),r.setUniforms(s.uniforms)}}parseMaterial(t,r){let n=Boolean(t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture);return Fa(this.context.device,{unlit:n,...t},{NORMAL:r.attributes.normals,TEXCOORD_0:r.attributes.texCoords},{pbrDebug:!1,lights:!0,useTangents:!1})}calculateFeatureIdsPickingColors(t){let r=this.props.featureIds,n=new Uint8ClampedArray(r.length*t.size),s=[];for(let o=0;o<r.length;o++)this.encodePickingColor(r[o],s),n[o*3]=s[0],n[o*3+1]=s[1],n[o*3+2]=s[2];t.value=n}finalizeState(t){super.finalizeState(t),this.state.parsedPBRMaterial?.generatedTextures.forEach(r=>r.destroy()),this.setState({parsedPBRMaterial:null})}},Tn=Xs;(()=>{Xs.layerName="MeshLayer"})(),(()=>{Xs.defaultProps=Wy})();var um=D(yr(),1);var ce=6356752314245179e-9,Yy={radii:[6378137,6378137,ce],radiiSquared:[6378137*6378137,6378137*6378137,ce*ce],oneOverRadii:[1/6378137,1/6378137,1/ce],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(ce*ce)],maximumRadius:Math.max(6378137,6378137,ce),centerToleranceSquared:.1};function Ws(e){return e}var aP=new x;function Ky(e,t=[],r=Ws){return"longitude"in e?(t[0]=r(e.longitude),t[1]=r(e.latitude),t[2]=e.height):"x"in e?(t[0]=r(e.x),t[1]=r(e.y),t[2]=e.z):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}function Hf(e,t=[]){return Ky(e,t,K._cartographicRadians?Ws:Ni)}function Qy(e,t,r=Ws){return"longitude"in t?(t.longitude=r(e[0]),t.latitude=r(e[1]),t.height=e[2]):"x"in t?(t.x=r(e[0]),t.y=r(e[1]),t.z=e[2]):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}function zf(e,t){return Qy(e,t,K._cartographicRadians?Ws:Di)}var kf=1e-14,Zy=new x,Jf={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"}},Oa={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},_n={east:new x,north:new x,up:new x,west:new x,south:new x,down:new x},$y=new x,tT=new x,eT=new x;function Na(e,t,r,n,s,o){let i=Jf[t]&&Jf[t][r];ct(i&&(!n||n===i));let a,c,l,h=Zy.copy(s);if(gt(h.x,0,kf)&>(h.y,0,kf)){let f=Math.sign(h.z);a=$y.fromArray(Oa[t]),t!=="east"&&t!=="west"&&a.scale(f),c=tT.fromArray(Oa[r]),r!=="east"&&r!=="west"&&c.scale(f),l=eT.fromArray(Oa[n]),n!=="east"&&n!=="west"&&l.scale(f)}else{let{up:f,east:d,north:p}=_n;d.set(-h.y,h.x,0).normalize(),e.geodeticSurfaceNormal(h,f),p.copy(f).cross(d);let{down:A,west:g,south:y}=_n;A.copy(f).scale(-1),g.copy(d).scale(-1),y.copy(p).scale(-1),a=_n[t],c=_n[r],l=_n[n]}return o[0]=a.x,o[1]=a.y,o[2]=a.z,o[3]=0,o[4]=c.x,o[5]=c.y,o[6]=c.z,o[7]=0,o[8]=l.x,o[9]=l.y,o[10]=l.z,o[11]=0,o[12]=h.x,o[13]=h.y,o[14]=h.z,o[15]=1,o}var Tr=new x,rT=new x,nT=new x;function qf(e,t,r=[]){let{oneOverRadii:n,oneOverRadiiSquared:s,centerToleranceSquared:o}=t;Tr.from(e);let i=Tr.x,a=Tr.y,c=Tr.z,l=n.x,h=n.y,u=n.z,f=i*i*l*l,d=a*a*h*h,p=c*c*u*u,A=f+d+p,g=Math.sqrt(1/A);if(!Number.isFinite(g))return;let y=rT;if(y.copy(e).scale(g),A<o)return y.to(r);let E=s.x,_=s.y,B=s.z,S=nT;S.set(y.x*E*2,y.y*_*2,y.z*B*2);let M=(1-g)*Tr.len()/(.5*S.len()),w=0,C,T,m,b;do{M-=w,C=1/(1+M*E),T=1/(1+M*_),m=1/(1+M*B);let L=C*C,R=T*T,F=m*m,v=L*C,W=R*T,z=F*m;b=f*L+d*R+p*F-1;let X=-2*(f*v*E+d*W*_+p*z*B);w=b/X}while(Math.abs(b)>Gt.EPSILON12);return Tr.scale([C,T,m]).to(r)}var Ys=new x,jf=new x,iT=new x,kt=new x,aT=new x,Ks=new x,U=class{constructor(t=0,r=0,n=0){P(this,"radii",void 0),P(this,"radiiSquared",void 0),P(this,"radiiToTheFourth",void 0),P(this,"oneOverRadii",void 0),P(this,"oneOverRadiiSquared",void 0),P(this,"minimumRadius",void 0),P(this,"maximumRadius",void 0),P(this,"centerToleranceSquared",Gt.EPSILON1),P(this,"squaredXOverSquaredZ",void 0),ct(t>=0),ct(r>=0),ct(n>=0),this.radii=new x(t,r,n),this.radiiSquared=new x(t*t,r*r,n*n),this.radiiToTheFourth=new x(t*t*t*t,r*r*r*r,n*n*n*n),this.oneOverRadii=new x(t===0?0:1/t,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new x(t===0?0:1/(t*t),r===0?0:1/(r*r),n===0?0:1/(n*n)),this.minimumRadius=Math.min(t,r,n),this.maximumRadius=Math.max(t,r,n),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,r=[0,0,0]){let n=jf,s=iT,[,,o]=t;this.geodeticSurfaceNormalCartographic(t,n),s.copy(this.radiiSquared).scale(n);let i=Math.sqrt(n.dot(s));return s.scale(1/i),n.scale(o),s.add(n),s.to(r)}cartesianToCartographic(t,r=[0,0,0]){Ks.from(t);let n=this.scaleToGeodeticSurface(Ks,kt);if(!n)return;let s=this.geodeticSurfaceNormal(n,jf),o=aT;o.copy(Ks).subtract(n);let i=Math.atan2(s.y,s.x),a=Math.asin(s.z),c=Math.sign(pr.dot(o,Ks))*pr.length(o);return zf([i,a,c],r)}eastNorthUpToFixedFrame(t,r=new O){return Na(this,"east","north","up",t,r)}localFrameToFixedFrame(t,r,n,s,o=new O){return Na(this,t,r,n,s,o)}geocentricSurfaceNormal(t,r=[0,0,0]){return Ys.from(t).normalize().to(r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=Hf(t),s=n[0],o=n[1],i=Math.cos(o);return Ys.set(i*Math.cos(s),i*Math.sin(s),Math.sin(o)).normalize(),Ys.to(r)}geodeticSurfaceNormal(t,r=[0,0,0]){return Ys.from(t).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(t,r){return qf(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){kt.from(t);let n=kt.x,s=kt.y,o=kt.z,i=this.oneOverRadiiSquared,a=1/Math.sqrt(n*n*i.x+s*s*i.y+o*o*i.z);return kt.multiplyScalar(a).to(r)}transformPositionToScaledSpace(t,r=[0,0,0]){return kt.from(t).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(t,r=[0,0,0]){return kt.from(t).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){ct(gt(this.radii.x,this.radii.y,Gt.EPSILON15)),ct(this.radii.z>0),kt.from(t);let s=kt.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(s)>=this.radii.z-r))return kt.set(0,0,s).to(n)}};P(U,"WGS84",new U(6378137,6378137,ce));var Qs=class{constructor(t,r,n){this.item=t,this.previous=r,this.next=n}};var Zs=class{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(t){let r=new Qs(t,this.tail,null);return this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),++this._length,r}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,r){t!==r&&(this.remove(r),this._insert(t,r))}_insert(t,r){let n=t.next;t.next=r,this.tail===t?this.tail=r:n.previous=r,r.next=n,r.previous=t,++this._length}};var $s=class{constructor(){this._list=new Zs,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let r=t._cacheNode;r&&this._list.splice(this._sentinel,r)}add(t,r,n){r._cacheNode||(r._cacheNode=this._list.add(r),n&&n(t,r))}unloadTile(t,r,n){let s=r._cacheNode;s&&(this._list.remove(s),r._cacheNode=null,n&&n(t,r))}unloadTiles(t,r){let n=this._trimTiles;this._trimTiles=!1;let s=this._list,o=t.maximumMemoryUsage*1024*1024,i=this._sentinel,a=s.head;for(;a!==i&&(t.gpuMemoryUsageInBytes>o||n);){let c=a.item;a=a.next,this.unloadTile(t,c,r)}}trim(){this._trimTiles=!0}};function Xf(e,t){V(e),V(t);let{rtcCenter:r,gltfUpAxis:n}=t,{computedTransform:s,boundingVolume:{center:o}}=e,i=new O(s);switch(r&&i.translate(r),n){case"Z":break;case"Y":let u=new O().rotateX(Math.PI/2);i=i.multiplyRight(u);break;case"X":let f=new O().rotateY(-Math.PI/2);i=i.multiplyRight(f);break;default:break}t.isQuantized&&i.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let a=new x(o);t.cartesianModelMatrix=i,t.cartesianOrigin=a;let c=U.WGS84.cartesianToCartographic(a,new x),h=U.WGS84.eastNorthUpToFixedFrame(a).invert();t.cartographicModelMatrix=h.multiplyRight(i),t.cartographicOrigin=c,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var Wf=new x,Da=new x,va=new it([new lt,new lt,new lt,new lt,new lt,new lt]);function Kf(e,t){let{cameraDirection:r,cameraUp:n,height:s}=e,{metersPerUnit:o}=e.distanceScales,i=to(e,e.center),a=U.WGS84.eastNorthUpToFixedFrame(i),c=e.unprojectPosition(e.cameraPosition),l=U.WGS84.cartographicToCartesian(c,new x),h=new x(a.transformAsVector(new x(r).scale(o))).normalize(),u=new x(a.transformAsVector(new x(n).scale(o))).normalize();cT(e);let f=e.constructor,{longitude:d,latitude:p,width:A,bearing:g,zoom:y}=e,E=new f({longitude:d,latitude:p,height:s,width:A,bearing:g,zoom:y,pitch:0});return{camera:{position:l,direction:h,up:u},viewport:e,topDownViewport:E,height:s,cullingVolume:va,frameNumber:t,sseDenominator:1.15}}function Qf(e,t,r){if(r===0||e.length<=r)return[e,[]];let n=[],{longitude:s,latitude:o}=t.viewport;for(let[l,h]of e.entries()){let[u,f]=h.header.mbs,d=Math.abs(s-u),p=Math.abs(o-f),A=Math.sqrt(p*p+d*d);n.push([l,A])}let i=n.sort((l,h)=>l[1]-h[1]),a=[];for(let l=0;l<r;l++)a.push(e[i[l][0]]);let c=[];for(let l=r;l<i.length;l++)c.push(e[i[l][0]]);return[a,c]}function cT(e){let t=e.getFrustumPlanes(),r=Yf(t.near,e.cameraPosition),n=to(e,r),s=to(e,e.cameraPosition,Da),o=0;va.planes[o++].fromPointNormal(n,Wf.copy(n).subtract(s));for(let i in t){if(i==="near")continue;let a=t[i],c=Yf(a,r,Da),l=to(e,c,Da);va.planes[o++].fromPointNormal(l,Wf.copy(n).subtract(l))}}function Yf(e,t,r=new x){let n=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-n).add(t),r}function to(e,t,r=new x){let n=e.unprojectPosition(t);return U.WGS84.cartographicToCartesian(n,r)}var lT=6378137,hT=6378137,Ua=6356752314245179e-9,_r=new x;function Zf(e,t){if(e instanceof Ht){let{halfAxes:r}=e,n=uT(r);return Math.log2(Ua/(n+t[2]))}else if(e instanceof Ft){let{radius:r}=e;return Math.log2(Ua/(r+t[2]))}else if(e.width&&e.height){let{width:r,height:n}=e,s=Math.log2(lT/r),o=Math.log2(hT/n);return(s+o)/2}return 1}function Ga(e,t,r){U.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],_r);let n=Math.sqrt(Math.pow(_r[0]-r[0],2)+Math.pow(_r[1]-r[1],2)+Math.pow(_r[2]-r[2],2));return Math.log2(Ua/(n+t[2]))}function $f(e,t,r){let[n,s,o,i]=e;return Ga({xmin:n,xmax:o,ymin:s,ymax:i,zmin:0,zmax:0},t,r)}function uT(e){e.getColumn(0,_r);let t=e.getColumn(1),r=e.getColumn(2);return _r.add(t).add(r).len()}var gd=D(yr(),1);var At={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},ft;(function(e){e[e.ADD=1]="ADD",e[e.REPLACE=2]="REPLACE"})(ft||(ft={}));var Rt;(function(e){e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh"})(Rt||(Rt={}));var ht;(function(e){e.I3S="I3S",e.TILES3D="TILES3D"})(ht||(ht={}));var le;(function(e){e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(le||(le={}));var td={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function sd(e){return e!=null}var dt=new x,eo=new x,fT=new x,dT=new x,qe=new x,ed=new x,rd=new x,nd=new x;function ro(e,t,r){if(V(e,"3D Tile: boundingVolume must be defined"),e.box)return id(e.box,t,r);if(e.region)return mT(e.region);if(e.sphere)return pT(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function od(e,t){if(e.box)return gT(t);if(e.region){let[r,n,s,o,i,a]=e.region;return[[Mt(r),Mt(n),i],[Mt(s),Mt(o),a]]}if(e.sphere)return AT(t);throw new Error("Unkown boundingVolume type")}function id(e,t,r){let n=new x(e[0],e[1],e[2]);t.transform(n,n);let s=[];if(e.length===10){let l=e.slice(3,6),h=new Qt;h.fromArray(e,6);let u=new x([1,0,0]),f=new x([0,1,0]),d=new x([0,0,1]);u.transformByQuaternion(h),u.scale(l[0]),f.transformByQuaternion(h),f.scale(l[1]),d.transformByQuaternion(h),d.scale(l[2]),s=[...u.toArray(),...f.toArray(),...d.toArray()]}else s=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let o=t.transformAsVector(s.slice(0,3)),i=t.transformAsVector(s.slice(3,6)),a=t.transformAsVector(s.slice(6,9)),c=new k([o[0],o[1],o[2],i[0],i[1],i[2],a[0],a[1],a[2]]);return sd(r)?(r.center=n,r.halfAxes=c,r):new Ht(n,c)}function pT(e,t,r){let n=new x(e[0],e[1],e[2]);t.transform(n,n);let s=t.getScale(eo),o=Math.max(Math.max(s[0],s[1]),s[2]),i=e[3]*o;return sd(r)?(r.center=n,r.radius=i,r):new Ft(n,i)}function mT(e){let[t,r,n,s,o,i]=e,a=U.WGS84.cartographicToCartesian([Mt(t),Mt(s),o],fT),c=U.WGS84.cartographicToCartesian([Mt(n),Mt(r),i],dT),l=new x().addVectors(a,c).multiplyByScalar(.5);return U.WGS84.cartesianToCartographic(l,qe),U.WGS84.cartographicToCartesian([Mt(n),qe[1],qe[2]],ed),U.WGS84.cartographicToCartesian([qe[0],Mt(s),qe[2]],rd),U.WGS84.cartographicToCartesian([qe[0],qe[1],i],nd),id([...l,...ed.subtract(l),...rd.subtract(l),...nd.subtract(l)],new O)}function gT(e){let t=ad(),{halfAxes:r}=e,n=new x(r.getColumn(0)),s=new x(r.getColumn(1)),o=new x(r.getColumn(2));for(let i=0;i<2;i++){for(let a=0;a<2;a++){for(let c=0;c<2;c++)dt.copy(e.center),dt.add(n),dt.add(s),dt.add(o),cd(t,dt),o.negate();s.negate()}n.negate()}return t}function AT(e){let t=ad(),{center:r,radius:n}=e,s=U.WGS84.scaleToGeodeticSurface(r,dt),o;s?o=U.WGS84.geodeticSurfaceNormal(s):o=new x(0,0,1);let i=new x(o[2],-o[1],0);i.len()>0?i.normalize():i=new x(0,1,0);let a=i.clone().cross(o);for(let c of[i,a,o]){eo.copy(c).scale(n);for(let l=0;l<2;l++)dt.copy(r),dt.add(eo),cd(t,dt),eo.negate()}return t}function ad(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function cd(e,t){U.WGS84.cartesianToCartographic(t,dt),e[0][0]=Math.min(e[0][0],dt[0]),e[0][1]=Math.min(e[0][1],dt[1]),e[0][2]=Math.min(e[0][2],dt[2]),e[1][0]=Math.max(e[1][0],dt[0]),e[1][1]=Math.max(e[1][1],dt[1]),e[1][2]=Math.max(e[1][2],dt[2])}var WP=new x,YP=new x,KP=new O,QP=new x,ZP=new x,$P=new x;function xT(e,t){let r=e*t;return 1-Math.exp(-(r*r))}function yT(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){let r=e.dynamicScreenSpaceErrorComputedDensity,n=e.dynamicScreenSpaceErrorFactor;return xT(t,r)*n}return 0}function ld(e,t,r){let n=e.tileset,s=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,o=r?s:e.lodMetricValue;if(o===0)return 0;let i=Math.max(e._distanceToCamera,1e-7),{height:a,sseDenominator:c}=t,{viewDistanceScale:l}=n.options,h=o*a*(l||1)/(i*c);return h-=yT(n,i),h}var Va=new x,hd=new x,Ie=new x,ud=new x,TT=new x,Ha=new O,fd=new O;function dd(e,t){if(e.lodMetricValue===0||isNaN(e.lodMetricValue))return"DIG";let r=2*za(e,t);return r<2?"OUT":!e.header.children||r<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}function za(e,t){let{topDownViewport:r}=t,n=e.header.mbs[1],s=e.header.mbs[0],o=e.header.mbs[2],i=e.header.mbs[3],a=[...e.boundingVolume.center],c=r.unprojectPosition(r.cameraPosition);U.WGS84.cartographicToCartesian(c,Va),hd.copy(Va).subtract(a).normalize(),U.WGS84.eastNorthUpToFixedFrame(a,Ha),fd.copy(Ha).invert(),Ie.copy(Va).transform(fd);let l=Math.sqrt(Ie[0]*Ie[0]+Ie[1]*Ie[1]),h=l*l/Ie[2];ud.copy([Ie[0],Ie[1],h]);let f=ud.transform(Ha).subtract(a).normalize(),p=hd.cross(f).normalize().scale(i).add(a),A=U.WGS84.cartesianToCartographic(p),g=r.project([s,n,o]),y=r.project(A);return TT.copy(g).subtract(y).magnitude()}function pd(e){return{assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}}var En=class{constructor(t=0){this._map=new Map,this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return V(t<this._array.length),this._array[t]}set(t,r){V(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=r,this._map.set(r,t)}delete(t){let r=this._map.get(t);r>=0&&(this._array.splice(r,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){let r=this.length++;this._array[r]=t,this._map.set(t,r)}}pop(){let t=this._array[--this.length];return this._map.delete(t),t}reserve(t){V(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){V(t>=0),this.length=t}trim(t){t==null&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}};var _T={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},ee=class{traversalFinished(t){return!0}constructor(t){this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={},this.lastUpdate=new Date().getTime(),this.updateDebounceTime=1e3,this._traversalStack=new En,this._emptyTraversalStack=new En,this._frameNumber=null,this.options={..._T,...t}}traverse(t,r,n){this.root=t,this.options={...this.options,...n},this.reset(),this.updateTile(t,r),this._frameNumber=r.frameNumber,this.executeTraversal(t,r)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,r){let n=this._traversalStack;for(t._selectionDepth=1,n.push(t);n.length>0;){let o=n.pop(),i=!1;this.canTraverse(o,r)&&(this.updateChildTiles(o,r),i=this.updateAndPushChildren(o,r,n,o.hasRenderContent?o._selectionDepth+1:o._selectionDepth));let a=o.parent,c=Boolean(!a||a._shouldRefine),l=!i;o.hasRenderContent?o.refine===ft.ADD?(this.loadTile(o,r),this.selectTile(o,r)):o.refine===ft.REPLACE&&(this.loadTile(o,r),l&&this.selectTile(o,r)):(this.emptyTiles[o.id]=o,this.loadTile(o,r),l&&this.selectTile(o,r)),this.touchTile(o,r),o._shouldRefine=i&&c}let s=new Date().getTime();(this.traversalFinished(r)||s-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=s,this.options.onTraversalEnd(r))}updateChildTiles(t,r){let n=t.children;for(let s of n)this.updateTile(s,r)}updateAndPushChildren(t,r,n,s){let{loadSiblings:o,skipLevelOfDetail:i}=this.options,a=t.children;a.sort(this.compareDistanceToCamera.bind(this));let c=t.refine===ft.REPLACE&&t.hasRenderContent&&!i,l=!1,h=!0;for(let u of a)if(u._selectionDepth=s,u.isVisibleAndInRequestVolume?(n.find(u)&&n.delete(u),n.push(u),l=!0):(c||o)&&(this.loadTile(u,r),this.touchTile(u,r)),c){let f;if(u._inRequestVolume?u.hasRenderContent?f=u.contentAvailable:f=this.executeEmptyTraversal(u,r):f=!1,h=h&&f,!h)return!1}return l||(h=!1),h}updateTile(t,r){this.updateTileVisibility(t,r)}selectTile(t,r){this.shouldSelectTile(t)&&(t._selectedFrame=r.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,r){this.shouldLoadTile(t)&&(t._requestedFrame=r.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,r){t.tileset._cache.touch(t),t._touchedFrame=r.frameNumber}canTraverse(t,r,n=!1,s=!1){return t.hasChildren?t.hasTilesetContent?!t.contentExpired:!s&&!t.isVisibleAndInRequestVolume?!1:this.shouldRefine(t,r,n):!1}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,r,n=!1){let s=t._screenSpaceError;return n&&(s=t.getScreenSpaceError(r,!0)),s>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,r){let n=[];if(this.options.viewportTraversersMap)for(let s in this.options.viewportTraversersMap)this.options.viewportTraversersMap[s]===r.viewport.id&&n.push(s);else n.push(r.viewport.id);t.updateVisibility(r,n)}compareDistanceToCamera(t,r){return t._distanceToCamera-r._distanceToCamera}anyChildrenVisible(t,r){let n=!1;for(let s of t.children)s.updateVisibility(r),n=n||s.isVisibleAndInRequestVolume;return n}executeEmptyTraversal(t,r){let n=!0,s=this._emptyTraversalStack;for(s.push(t);s.length>0;){let o=s.pop(),i=!o.hasRenderContent&&this.canTraverse(o,r,!1,!1),a=!o.hasRenderContent&&o.children.length===0;if(!i&&!o.contentAvailable&&!a&&(n=!1),this.updateTile(o,r),o.isVisibleAndInRequestVolume||(this.loadTile(o,r),this.touchTile(o,r)),i){let c=o.children;for(let l of c)s.push(l)}}return n}};var md=new x;function ET(e){return e!=null}var je=class{constructor(t,r,n,s=""){this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=At.UNLOADED,this.gpuMemoryUsageInBytes=0,this.children=[],this.depth=0,this.viewportIds=[],this.transform=new O,this.extensions=null,this.implicitTiling=null,this.userData={},this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.traverser=new ee({}),this._cacheNode=null,this._frameNumber=null,this._expireDate=null,this._expiredContent=null,this._boundingBox=void 0,this._distanceToCamera=0,this._screenSpaceError=0,this._visible=void 0,this._initialTransform=new O,this._priority=0,this._selectedFrame=0,this._requestedFrame=0,this._selectionDepth=0,this._touchedFrame=0,this._centerZDepth=0,this._shouldRefine=!1,this._stackLength=0,this._visitedFrame=0,this._inRequestVolume=!1,this._lodJudge=null,this.header=r,this.tileset=t,this.id=s||r.id,this.url=r.url,this.parent=n,this.refine=this._getRefine(r.refine),this.type=r.type,this.contentUrl=r.contentUrl,this._initializeLodMetric(r),this._initializeTransforms(r),this._initializeBoundingVolumes(r),this._initializeContent(r),this._initializeRenderingState(r),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===At.READY||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===At.UNLOADED}get contentExpired(){return this.contentState===At.EXPIRED}get contentFailed(){return this.contentState===At.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=od(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,r){switch(this.tileset.type){case ht.I3S:return za(this,t);case ht.TILES3D:return ld(this,t,r);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){let t=this.tileset._traverser,{skipLevelOfDetail:r}=t.options,n=this.refine===ft.ADD||r;if(n&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===At.UNLOADED)return-1;let s=this.parent,i=s&&(!n||this._screenSpaceError===0||s.hasTilesetContent)?s._screenSpaceError:this._screenSpaceError,a=t.root?t.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=At.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=At.UNLOADED,!1;try{let n=this.tileset.getTileUrl(this.contentUrl),s=this.tileset.loader,o={...this.tileset.loadOptions,[s.id]:{...this.tileset.loadOptions[s.id],isTileset:this.type==="json",...this._getLoaderSpecificOptions(s.id)}};return this.content=await(0,gd.load)(n,s,o),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=At.READY,this._onContentLoaded(),!0}catch(n){throw this.contentState=At.FAILED,n}finally{r.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=At.UNLOADED,!0}updateVisibility(t,r){if(this._frameNumber===t.frameNumber)return;let n=this.parent,s=n?n._visibilityPlaneMask:it.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let o=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(o)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,s),this._visible=this._visibilityPlaneMask!==it.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=r}visibility(t,r){let{cullingVolume:n}=t,{boundingVolume:s}=this;return n.computeVisibilityWithPlaneMask(s,r)}contentVisibility(){return!0}distanceToTile(t){let r=this.boundingVolume;return Math.sqrt(Math.max(r.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){let r=this.boundingVolume;return md.subVectors(r.center,t.position),t.direction.dot(md)}insideViewerRequestVolume(t){let r=this._viewerRequestVolume;return!r||r.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(ET(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=At.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){"lodMetricType"in t?this.lodMetricType=t.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 t?this.lodMetricValue=t.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(t){this.transform=t.transform?new O(t.transform):new O;let r=this.parent,n=this.tileset,s=r&&r.computedTransform?r.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new O(s).multiplyRight(this.transform);let o=r&&r._initialTransform?r._initialTransform.clone():new O;this._initialTransform=new O(o).multiplyRight(this.transform)}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=At.UNLOADED,this.hasTilesetContent=!1,t.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=it.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(t){return t||this.parent&&this.parent.refine||ft.REPLACE}_isTileset(){return this.contentUrl.indexOf(".json")!==-1}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(t){this.boundingVolume=ro(t.boundingVolume,this.computedTransform,this.boundingVolume);let r=t.content;r&&(r.boundingVolume&&(this._contentBoundingVolume=ro(r.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=ro(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new O){let r=t.clone().multiplyRight(this.transform);r.equals(this.computedTransform)||(this.computedTransform=r,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(t){switch(t){case"i3s":return{...this.tileset.options.i3s,_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1};case"3d-tiles":case"cesium-ion":default:return pd(this.tileset.tileset)}}};var no=class extends ee{compareDistanceToCamera(t,r){return r._distanceToCamera===0&&t._distanceToCamera===0?r._centerZDepth-t._centerZDepth:r._distanceToCamera-t._distanceToCamera}updateTileVisibility(t,r){if(super.updateTileVisibility(t,r),!t.isVisibleAndInRequestVolume)return;let n=t.children.length>0;if(t.hasTilesetContent&&n){let i=t.children[0];this.updateTileVisibility(i,r),t._visible=i._visible;return}if(this.meetsScreenSpaceErrorEarly(t,r)){t._visible=!1;return}let s=t.refine===ft.REPLACE,o=t._optimChildrenWithinParent===td.USE_OPTIMIZATION;if(s&&o&&n&&!this.anyChildrenVisible(t,r)){t._visible=!1;return}}meetsScreenSpaceErrorEarly(t,r){let{parent:n}=t;return!n||n.hasTilesetContent||n.refine!==ft.ADD?!1:!this.shouldRefine(t,r,!0)}};var Ad=D(yr(),1);var so=class{constructor(){this.frameNumberMap=new Map}register(t,r){let n=this.frameNumberMap.get(t)||new Map,s=n.get(r)||0;n.set(r,s+1),this.frameNumberMap.set(t,n)}deregister(t,r){let n=this.frameNumberMap.get(t);if(!n)return;let s=n.get(r)||1;n.set(r,s-1)}isZero(t,r){return(this.frameNumberMap.get(t)?.get(r)||0)===0}};var ka={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},oo=class{constructor(){this.pendingTilesRegister=new so,this._statusMap={}}add(t,r,n,s){if(!this._statusMap[r]){let{frameNumber:o,viewport:{id:i}}=s;this._statusMap[r]={request:t,callback:n,key:r,frameState:s,status:ka.REQUESTED},this.pendingTilesRegister.register(i,o),t().then(a=>{this._statusMap[r].status=ka.COMPLETED;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),this._statusMap[r].callback(a,s)}).catch(a=>{this._statusMap[r].status=ka.ERROR;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),n(a)})}}update(t,r){if(this._statusMap[t]){let{frameNumber:n,viewport:{id:s}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(s,n);let{frameNumber:o,viewport:{id:i}}=r;this.pendingTilesRegister.register(i,o),this._statusMap[t].frameState=r}}find(t){return this._statusMap[t]}hasPendingTiles(t,r){return!this.pendingTilesRegister.isZero(t,r)}};var io=class extends ee{constructor(t){super(t),this._tileManager=new oo}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,r){return t._lodJudge=dd(t,r),t._lodJudge==="DIG"}updateChildTiles(t,r){let n=t.header.children||[],s=t.children,o=t.tileset;for(let i of n){let a=`${i.id}-${r.viewport.id}`,c=s&&s.find(l=>l.id===a);if(c)c&&this.updateTile(c,r);else{let l=()=>this._loadTile(i.id,o);this._tileManager.find(a)?this._tileManager.update(a,r):(o.tileset.nodePages&&(l=()=>o.tileset.nodePagesTile.formTileFromNodePages(i.id)),this._tileManager.add(l,a,u=>this._onTileLoad(u,t,a),r))}}return!1}async _loadTile(t,r){let{loader:n}=r,s=r.getTileUrl(`${r.url}/nodes/${t}`),o={...r.loadOptions,i3s:{...r.loadOptions.i3s,isTileHeader:!0}};return await(0,Ad.load)(s,n,o)}_onTileLoad(t,r,n){let s=new je(r.tileset,t,r,n);r.children.push(s);let o=this._tileManager.find(s.id).frameState;this.updateTile(s,o),this._frameNumber===o.frameNumber&&(this.traversalFinished(o)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(s,o)}};var BT={description:"",ellipsoid:U.WGS84,modelMatrix:new O,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,memoryCacheOverflow:1,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,memoryAdjustedScreenSpaceError:!1,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},ao="Tiles In Tileset(s)",Ja="Tiles In Memory",xd="Tiles In View",yd="Tiles To Render",Td="Tiles Loaded",qa="Tiles Loading",_d="Tiles Unloaded",Ed="Failed Tile Loads",Bd="Points/Vertices",ja="Tile Memory Use",Cd="Maximum Screen Space Error",Bn=class{constructor(t,r){this.root=null,this.roots={},this.asset={},this.description="",this.extras=null,this.attributions={},this.credits={},this.contentFormats={draco:!1,meshopt:!1,dds:!1,ktx2:!1},this.cartographicCenter=null,this.cartesianCenter=null,this.zoom=1,this.boundingVolume=null,this.dynamicScreenSpaceErrorComputedDensity=0,this.maximumMemoryUsage=32,this.gpuMemoryUsageInBytes=0,this.memoryAdjustedScreenSpaceError=0,this._cacheBytes=0,this._cacheOverflowBytes=0,this._frameNumber=0,this._queryParams={},this._extensionsUsed=[],this._tiles={},this._pendingCount=0,this.selectedTiles=[],this.traverseCounter=0,this.geometricError=0,this.lastUpdatedVieports=null,this._requestedTiles=[],this._emptyTiles=[],this.frameStateData={},this._cache=new $s,this.updatePromise=null,this.options={...BT,...r},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||xe.dirname(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.root.refine,this.loadOptions=this.options.loadOptions||{},this._traverser=this._initializeTraverser(),this._requestScheduler=new Ae({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.memoryAdjustedScreenSpaceError=this.options.maximumScreenSpaceError,this._cacheBytes=this.options.maximumMemoryUsage*1024*1024,this._cacheOverflowBytes=this.options.memoryCacheOverflow*1024*1024,this.stats=new ge({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(t){this.options={...this.options,...t}}getTileUrl(t){if(t.startsWith("data:"))return t;let n=t;return this.queryParams.length&&(n=`${t}${t.includes("?")?"&":"?"}${this.queryParams}`),n}hasExtension(t){return Boolean(this._extensionsUsed.indexOf(t)>-1)}update(t=null){this.tilesetInitializationPromise.then(()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)})}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise(r=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),r(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytes<this._cacheBytes?this.memoryAdjustedScreenSpaceError=Math.max(this.memoryAdjustedScreenSpaceError/1.02,this.options.maximumScreenSpaceError):this.gpuMemoryUsageInBytes>this._cacheBytes+this._cacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let r=t instanceof Array?t:[t];this._cache.reset(),this._frameNumber++,this.traverseCounter=r.length;let n=[];for(let s of r){let o=s.id;this._needTraverse(o)?n.push(o):this.traverseCounter--}for(let s of r){let o=s.id;if(this.roots[o]||(this.roots[o]=this._initializeTileHeaders(this.tileset,null)),!n.includes(o))continue;let i=Kf(s,this._frameNumber);this._traverser.traverse(this.roots[o],i,this.options)}}_needTraverse(t){let r=t;return this.options.viewportTraversersMap&&(r=this.options.viewportTraversersMap[t]),r===t}_onTraversalEnd(t){let r=t.viewport.id;this.frameStateData[r]||(this.frameStateData[r]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let n=this.frameStateData[r],s=Object.values(this._traverser.selectedTiles),[o,i]=Qf(s,t,this.options.maximumTilesSelected);n.selectedTiles=o;for(let a of i)a.unselect();n._requestedTiles=Object.values(this._traverser.requestedTiles),n._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let t in this.frameStateData){let r=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(r.selectedTiles),this._requestedTiles=this._requestedTiles.concat(r._requestedTiles),this._emptyTiles=this._emptyTiles.concat(r._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(let t of this.selectedTiles)this._tiles[t.id]=t;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(t,r){if(t.length!==r.length)return!0;let n=new Set(t.map(i=>i.id)),s=new Set(r.map(i=>i.id)),o=t.filter(i=>!s.has(i.id)).length>0;return o=o||r.filter(i=>!n.has(i.id)).length>0,o}_loadTiles(){for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,r)=>t._unloadTile(r))}_updateStats(){let t=0,r=0;for(let n of this.selectedTiles)n.contentAvailable&&n.content&&(t++,n.content.pointCount?r+=n.content.pointCount:r+=n.content.vertexCount);this.stats.get(xd).count=this.selectedTiles.length,this.stats.get(yd).count=t,this.stats.get(Bd).count=r,this.stats.get(Cd).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(t){this.type===ht.I3S&&(this.calculateViewPropsI3S(),t.root=await t.root),this.root=this._initializeTileHeaders(t,null),this.type===ht.TILES3D&&(this._initializeTiles3DTileset(t),this.calculateViewPropsTiles3D()),this.type===ht.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){let t=this.tileset.fullExtent;if(t){let{xmin:n,xmax:s,ymin:o,ymax:i,zmin:a,zmax:c}=t;this.cartographicCenter=new x(n+(s-n)/2,o+(i-o)/2,a+(c-a)/2),this.cartesianCenter=new x,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=Ga(t,this.cartographicCenter,this.cartesianCenter);return}let r=this.tileset.store?.extent;if(r){let[n,s,o,i]=r;this.cartographicCenter=new x(n+(o-n)/2,s+(i-s)/2,0),this.cartesianCenter=new x,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=$f(r,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new x,this.zoom=1}calculateViewPropsTiles3D(){let t=this.root,{center:r}=t.boundingVolume;if(!r){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new x,this.zoom=1;return}r[0]!==0||r[1]!==0||r[2]!==0?(this.cartographicCenter=new x,U.WGS84.cartesianToCartographic(r,this.cartographicCenter)):this.cartographicCenter=new x(0,0,-U.WGS84.radii[0]),this.cartesianCenter=r,this.zoom=Zf(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(ao),this.stats.get(qa),this.stats.get(Ja),this.stats.get(xd),this.stats.get(yd),this.stats.get(Td),this.stats.get(_d),this.stats.get(Ed),this.stats.get(Bd),this.stats.get(ja,"memory"),this.stats.get(Cd)}_initializeTileHeaders(t,r){let n=new je(this,t.root,r);if(r&&(r.children.push(n),n.depth=r.depth+1),this.type===ht.TILES3D){let s=[];for(s.push(n);s.length>0;){let o=s.pop();this.stats.get(ao).incrementCount();let i=o.header.children||[];for(let a of i){let c=new je(this,a,o);if(c.contentUrl?.includes("?session=")){let h=new URL(c.contentUrl).searchParams.get("session");h&&(this._queryParams.session=h)}o.children.push(c),c.depth=o.depth+1,s.push(c)}}}return n}_initializeTraverser(){let t;switch(this.type){case ht.TILES3D:t=no;break;case ht.I3S:t=io;break;default:t=ee}return new t({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let r;try{this._onStartTileLoading(),r=await t.loadContent()}catch(n){this._onTileLoadError(t,n instanceof Error?n:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(t,r)}}_onTileLoadError(t,r){this.stats.get(Ed).incrementCount();let n=r.message||r.toString(),s=t.url;console.error(`A 3D tile failed to load: ${t.url} ${n}`),this.options.onTileError(t,n,s)}_onTileLoad(t,r){if(r){if(this.type===ht.I3S){let n=this.tileset?.nodePagesTile?.nodesInNodePages||0;this.stats.get(ao).reset(),this.stats.get(ao).addCount(n)}t&&t.content&&Xf(t,t.content),this.updateContentTypes(t),this._addTileToCache(t),this.options.onTileLoad(t)}}updateContentTypes(t){if(this.type===ht.I3S)switch(t.header.isDracoGeometry&&(this.contentFormats.draco=!0),t.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}else if(this.type===ht.TILES3D){let{extensionsRemoved:r=[]}=t.content?.gltf||{};r.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),r.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),r.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(qa).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(qa).decrementCount()}_addTileToCache(t){this._cache.add(this,t,r=>r._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(Td).incrementCount(),this.stats.get(Ja).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(ja).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(Ja).decrementCount(),this.stats.get(_d).incrementCount(),this.stats.get(ja).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){let t=[];for(this.root&&t.push(this.root);t.length>0;){let r=t.pop();for(let n of r.children)t.push(n);this._destroyTile(r)}this.root=null}_destroySubtree(t){let r=t,n=[];for(n.push(r);n.length>0;){t=n.pop();for(let s of t.children)n.push(s);t!==r&&this._destroyTile(t)}r.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeTiles3DTileset(t){if(t.queryString){let r=new URLSearchParams(t.queryString),n=Object.fromEntries(r.entries());this._queryParams={...this._queryParams,...n}}if(this.asset=t.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=t.properties,this.geometricError=t.geometricError,this._extensionsUsed=t.extensionsUsed||[],this.extras=t.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}};var co="4.2.0-alpha.4";var Xe={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},W3=Object.keys(Xe);function Xa(e,t,r){V(e instanceof ArrayBuffer);let n=new TextDecoder("utf8"),s=new Uint8Array(e,t,r);return n.decode(s)}function Sd(e,t=0){let 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))}`}var Md="4.2.0-alpha.4";var bd={name:"Draco",id:"draco",module:"draco",version:Md,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function Id(e){switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function We(e){let t=1/0,r=1/0,n=1/0,s=-1/0,o=-1/0,i=-1/0,a=e.POSITION?e.POSITION.value:[],c=a&&a.length;for(let l=0;l<c;l+=3){let h=a[l],u=a[l+1],f=a[l+2];t=h<t?h:t,r=u<r?u:r,n=f<n?f:n,s=h>s?h:s,o=u>o?u:o,i=f>i?f:i}return[[t,r,n],[s,o,i]]}function Wa(e,t,r){let n=Id(t.value),s=r||wd(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:n}]},nullable:!1,metadata:s}}function wd(e){let t={};return"byteOffset"in e&&(t.byteOffset=e.byteOffset.toString(10)),"byteStride"in e&&(t.byteStride=e.byteStride.toString(10)),"normalized"in e&&(t.normalized=e.normalized.toString()),t}function Ld(e,t,r){let n=Rd(t.metadata),s=[],o=CT(t.attributes);for(let i in e){let a=e[i],c=Fd(i,a,o[i]);s.push(c)}if(r){let i=Fd("indices",r);s.push(i)}return{fields:s,metadata:n}}function CT(e){let t={};for(let r in e){let n=e[r];t[n.name||"undefined"]=n}return t}function Fd(e,t,r){let n=r?Rd(r.metadata):void 0;return Wa(e,t,n)}function Rd(e){Object.entries(e);let t={};for(let r in e)t[`${r}.string`]=JSON.stringify(e[r]);return t}var Pd={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},ST={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},MT=4,Cn=class{constructor(t){this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t,r={}){let n=new this.draco.DecoderBuffer;n.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(r);let s=this.decoder.GetEncodedGeometryType(n),o=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let i;switch(s){case this.draco.TRIANGULAR_MESH:i=this.decoder.DecodeBufferToMesh(n,o);break;case this.draco.POINT_CLOUD:i=this.decoder.DecodeBufferToPointCloud(n,o);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!i.ok()||!o.ptr){let f=`DRACO decompression failed: ${i.error_msg()}`;throw new Error(f)}let a=this._getDracoLoaderData(o,s,r),c=this._getMeshData(o,a,r),l=We(c.attributes),h=Ld(c.attributes,a,c.indices);return{loader:"draco",loaderData:a,header:{vertexCount:o.num_points(),boundingBox:l},...c,schema:h}}finally{this.draco.destroy(n),o&&this.draco.destroy(o)}}_getDracoLoaderData(t,r,n){let s=this._getTopLevelMetadata(t),o=this._getDracoAttributes(t,n);return{geometry_type:r,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:s,attributes:o}}_getDracoAttributes(t,r){let n={};for(let s=0;s<t.num_attributes();s++){let o=this.decoder.GetAttribute(t,s),i=this._getAttributeMetadata(t,s);n[o.unique_id()]={unique_id:o.unique_id(),attribute_type:o.attribute_type(),data_type:o.data_type(),num_components:o.num_components(),byte_offset:o.byte_offset(),byte_stride:o.byte_stride(),normalized:o.normalized(),attribute_index:s,metadata:i};let a=this._getQuantizationTransform(o,r);a&&(n[o.unique_id()].quantization_transform=a);let c=this._getOctahedronTransform(o,r);c&&(n[o.unique_id()].octahedron_transform=c)}return n}_getMeshData(t,r,n){let s=this._getMeshAttributes(r,t,n);if(!s.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(n.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:s,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:s,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:s}}_getMeshAttributes(t,r,n){let s={};for(let o of Object.values(t.attributes)){let i=this._deduceAttributeName(o,n);o.name=i;let{value:a,size:c}=this._getAttributeValues(r,o);s[i]={value:a,size:c,byteOffset:o.byte_offset,byteStride:o.byte_stride,normalized:o.normalized}}return s}_getTriangleListIndices(t){let n=t.num_faces()*3,s=n*MT,o=this.draco._malloc(s);try{return this.decoder.GetTrianglesUInt32Array(t,s,o),new Uint32Array(this.draco.HEAPF32.buffer,o,n).slice()}finally{this.draco._free(o)}}_getTriangleStripIndices(t){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,r),wT(r)}finally{this.draco.destroy(r)}}_getAttributeValues(t,r){let n=ST[r.data_type],s=r.num_components,i=t.num_points()*s,a=i*n.BYTES_PER_ELEMENT,c=bT(this.draco,n),l,h=this.draco._malloc(a);try{let u=this.decoder.GetAttribute(t,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,u,c,a,h),l=new n(this.draco.HEAPF32.buffer,h,i).slice()}finally{this.draco._free(h)}return{value:l,size:s}}_deduceAttributeName(t,r){let n=t.unique_id;for(let[i,a]of Object.entries(r.extraAttributes||{}))if(a===n)return i;let s=t.attribute_type;for(let i in Pd)if(this.draco[i]===s)return Pd[i];let o=r.attributeNameEntry||"name";return t.metadata[o]?t.metadata[o].string:`CUSTOM_ATTRIBUTE_${n}`}_getTopLevelMetadata(t){let r=this.decoder.GetMetadata(t);return this._getDracoMetadata(r)}_getAttributeMetadata(t,r){let n=this.decoder.GetAttributeMetadata(t,r);return this._getDracoMetadata(n)}_getDracoMetadata(t){if(!t||!t.ptr)return{};let r={},n=this.metadataQuerier.NumEntries(t);for(let s=0;s<n;s++){let o=this.metadataQuerier.GetEntryName(t,s);r[o]=this._getDracoMetadataField(t,o)}return r}_getDracoMetadataField(t,r){let n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,r,n);let s=IT(n);return{int:this.metadataQuerier.GetIntEntry(t,r),string:this.metadataQuerier.GetStringEntry(t,r),double:this.metadataQuerier.GetDoubleEntry(t,r),intArray:s}}finally{this.draco.destroy(n)}}_disableAttributeTransforms(t){let{quantizedAttributes:r=[],octahedronAttributes:n=[]}=t,s=[...r,...n];for(let o of s)this.decoder.SkipAttributeTransform(this.draco[o])}_getQuantizationTransform(t,r){let{quantizedAttributes:n=[]}=r,s=t.attribute_type();if(n.map(i=>this.decoder[i]).includes(s)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(t))return{quantization_bits:i.quantization_bits(),range:i.range(),min_values:new Float32Array([1,2,3]).map(a=>i.min_value(a))}}finally{this.draco.destroy(i)}}return null}_getOctahedronTransform(t,r){let{octahedronAttributes:n=[]}=r,s=t.attribute_type();if(n.map(i=>this.decoder[i]).includes(s)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(t))return{quantization_bits:i.quantization_bits()}}finally{this.draco.destroy(i)}}return null}};function bT(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}}function IT(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}function wT(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}var FT="1.5.6",LT="1.4.1",Ya=`https://www.gstatic.com/draco/versioned/decoders/${FT}`,Tt={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},Ka={[Tt.DECODER]:`${Ya}/${Tt.DECODER}`,[Tt.DECODER_WASM]:`${Ya}/${Tt.DECODER_WASM}`,[Tt.FALLBACK_DECODER]:`${Ya}/${Tt.FALLBACK_DECODER}`,[Tt.ENCODER]:`https://raw.githubusercontent.com/google/draco/${LT}/javascript/${Tt.ENCODER}`},Sn;async function Od(e){let t=e.modules||{};return t.draco3d?Sn=Sn||t.draco3d.createDecoderModule({}).then(r=>({draco:r})):Sn=Sn||RT(e),await Sn}async function RT(e){let t,r;switch(e.draco&&e.draco.decoderType){case"js":t=await Yt(Ka[Tt.FALLBACK_DECODER],"draco",e,Tt.FALLBACK_DECODER);break;case"wasm":default:[t,r]=await Promise.all([await Yt(Ka[Tt.DECODER],"draco",e,Tt.DECODER),await Yt(Ka[Tt.DECODER_WASM],"draco",e,Tt.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await PT(t,r)}function PT(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e({...r,onModuleLoaded:s=>n({draco:s})})})}var lo={...bd,parse:OT};async function OT(e,t){let{draco:r}=await Od(t),n=new Cn(r);try{return n.parseSync(e,t?.draco)}finally{n.destroy()}}var NT={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},st={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},N={...NT,...st};var Qa={[st.DOUBLE]:Float64Array,[st.FLOAT]:Float32Array,[st.UNSIGNED_SHORT]:Uint16Array,[st.UNSIGNED_INT]:Uint32Array,[st.UNSIGNED_BYTE]:Uint8Array,[st.BYTE]:Int8Array,[st.SHORT]:Int16Array,[st.INT]:Int32Array},DT={DOUBLE:st.DOUBLE,FLOAT:st.FLOAT,UNSIGNED_SHORT:st.UNSIGNED_SHORT,UNSIGNED_INT:st.UNSIGNED_INT,UNSIGNED_BYTE:st.UNSIGNED_BYTE,BYTE:st.BYTE,SHORT:st.SHORT,INT:st.INT},Za="Failed to convert GL type",pt=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let r in Qa)if(Qa[r]===t)return r;throw new Error(Za)}static fromName(t){let r=DT[t];if(!r)throw new Error(Za);return r}static getArrayType(t){switch(t){case st.UNSIGNED_SHORT_5_6_5:case st.UNSIGNED_SHORT_4_4_4_4:case st.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let r=Qa[t];if(!r)throw new Error(Za);return r}}static getByteSize(t){return pt.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(pt.getArrayType(t))}static createTypedArray(t,r,n=0,s){s===void 0&&(s=(r.byteLength-n)/pt.getByteSize(t));let o=pt.getArrayType(t);return new o(r,n,s)}};function Nd(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function $a(e,t=[0,0,0]){let r=e>>11&31,n=e>>5&63,s=e&31;return t[0]=r<<3,t[1]=n<<2,t[2]=s<<3,t}var IO=1/256;var wO=new Ue,FO=new x,LO=new Ue,RO=new Ue,PO=new Uint8Array(1);function Dd(e,t=255){return ls(e,0,t)/t*2-1}function vd(e){return e<0?-1:1}function Ud(e,t,r,n){if(Nd(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=Dd(e,r),n.y=Dd(t,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){let s=n.x;n.x=(1-Math.abs(n.y))*vd(s),n.y=(1-Math.abs(s))*vd(n.y)}return n.normalize()}function tc(e,t,r){return Ud(e,t,255,r)}var he=class{constructor(t,r){this.featuresLength=0,this._cachedTypedArrays={},this.json=t,this.buffer=r}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t,r=N.UNSIGNED_INT,n=1){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?this._getTypedArrayFromBinary(t,r,n,1,s.byteOffset):s}getPropertyArray(t,r,n){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?("componentType"in s&&(r=pt.fromName(s.componentType)),this._getTypedArrayFromBinary(t,r,n,this.featuresLength,s.byteOffset)):this._getTypedArrayFromArray(t,r,s)}getProperty(t,r,n,s,o){let i=this.json[t];if(!i)return i;let a=this.getPropertyArray(t,r,n);if(n===1)return a[s];for(let c=0;c<n;++c)o[c]=a[n*s+c];return o}_getTypedArrayFromBinary(t,r,n,s,o){let i=this._cachedTypedArrays,a=i[t];return a||(a=pt.createTypedArray(r,this.buffer.buffer,this.buffer.byteOffset+o,s*n),i[t]=a),a}_getTypedArrayFromArray(t,r,n){let s=this._cachedTypedArrays,o=s[t];return o||(o=pt.createTypedArray(r,n),s[t]=o),o}};var vT={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},UT={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]]},GT={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]}};function Gd(e,t,r,n){let{componentType:s}=e;V(e.componentType);let o=typeof s=="string"?pt.fromName(s):s,i=vT[e.type],a=UT[e.type],c=GT[e.type];return r+=e.byteOffset,{values:pt.createTypedArray(o,t,r,i*n),type:o,size:i,unpacker:a,packer:c}}var re=e=>e!==void 0;function Vd(e,t,r){if(!t)return null;let n=e.getExtension("3DTILES_batch_table_hierarchy"),s=t.HIERARCHY;return s&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=s,n=s),n?VT(n,r):null}function VT(e,t){let r,n,s,o=e.instancesLength,i=e.classes,a=e.classIds,c=e.parentCounts,l=e.parentIds,h=o;re(a.byteOffset)&&(a.componentType=defaultValue(a.componentType,GL.UNSIGNED_SHORT),a.type=AttributeType.SCALAR,s=getBinaryAccessor(a),a=s.createArrayBufferView(t.buffer,t.byteOffset+a.byteOffset,o));let u;if(re(c))for(re(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,s=getBinaryAccessor(c),c=s.createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,o)),u=new Uint16Array(o),h=0,r=0;r<o;++r)u[r]=h,h+=c[r];re(l)&&re(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,s=getBinaryAccessor(l),l=s.createArrayBufferView(t.buffer,t.byteOffset+l.byteOffset,h));let f=i.length;for(r=0;r<f;++r){let g=i[r].length,y=i[r].instances,E=getBinaryProperties(g,y,t);i[r].instances=combine(E,y)}let d=new Array(f).fill(0),p=new Uint16Array(o);for(r=0;r<o;++r)n=a[r],p[r]=d[n],++d[n];let A={classes:i,classIds:a,classIndexes:p,parentCounts:c,parentIndexes:u,parentIds:l};return kT(A),A}function Er(e,t,r){if(!e)return;let n=e.parentCounts;return e.parentIds?r(e,t):n>0?HT(e,t,r):zT(e,t,r)}function HT(e,t,r){let n=e.classIds,s=e.parentCounts,o=e.parentIds,i=e.parentIndexes,a=n.length,c=scratchVisited;c.length=Math.max(c.length,a);let l=++marker,h=scratchStack;for(h.length=0,h.push(t);h.length>0;){if(t=h.pop(),c[t]===l)continue;c[t]=l;let u=r(e,t);if(re(u))return u;let f=s[t],d=i[t];for(let p=0;p<f;++p){let A=o[d+p];A!==t&&h.push(A)}}return null}function zT(e,t,r){let n=!0;for(;n;){let s=r(e,t);if(re(s))return s;let o=e.parentIds[t];n=o!==t,t=o}throw new Error("traverseHierarchySingleParent")}function kT(e){let t=[],n=e.classIds.length;for(let s=0;s<n;++s)Hd(e,s,stack)}function Hd(e,t,r){let n=e.parentCounts,s=e.parentIds,o=e.parentIndexes,a=e.classIds.length;if(!re(s))return;assert(t<a,`Parent index ${t} exceeds the total number of instances: ${a}`),assert(r.indexOf(t)===-1,"Circular dependency detected in the batch table hierarchy."),r.push(t);let c=re(n)?n[t]:1,l=re(n)?o[t]:t;for(let h=0;h<c;++h){let u=s[l+h];u!==t&&Hd(e,u,r)}r.pop(t)}function _t(e){return e!=null}var ho=(e,t)=>e,JT={HIERARCHY:!0,extensions:!0,extras:!0},Ye=class{constructor(t,r,n,s={}){V(n>=0),this.json=t||{},this.binary=r,this.featureCount=n,this._extensions=this.json?.extensions||{},this._properties={};for(let o in this.json)JT[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),s["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=Vd(this,this.json,this.binary))}getExtension(t){return this.json&&this.json.extensions&&this.json.extensions[t]}memorySizeInBytes(){return 0}isClass(t,r){if(this._checkBatchId(t),V(typeof r=="string",r),this._hierarchy){let n=Er(this._hierarchy,t,(s,o)=>{let i=s.classIds[o];return s.classes[i].name===r});return _t(n)}return!1}isExactClass(t,r){return V(typeof r=="string",r),this.getExactClassName(t)===r}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){let r=this._hierarchy.classIds[t];return this._hierarchy.classes[r].name}}hasProperty(t,r){return this._checkBatchId(t),V(typeof r=="string",r),_t(this._properties[r])||this._hasPropertyInHierarchy(t,r)}getPropertyNames(t,r){this._checkBatchId(t),r=_t(r)?r:[],r.length=0;let n=Object.keys(this._properties);return r.push(...n),this._hierarchy&&this._getPropertyNamesInHierarchy(t,r),r}getProperty(t,r){if(this._checkBatchId(t),V(typeof r=="string",r),this._binaryProperties){let s=this._binaryProperties[r];if(_t(s))return this._getBinaryProperty(s,t)}let n=this._properties[r];if(_t(n))return ho(n[t],!0);if(this._hierarchy){let s=this._getHierarchyProperty(t,r);if(_t(s))return s}}setProperty(t,r,n){let s=this.featureCount;if(this._checkBatchId(t),V(typeof r=="string",r),this._binaryProperties){let i=this._binaryProperties[r];if(i){this._setBinaryProperty(i,t,n);return}}if(this._hierarchy&&this._setHierarchyProperty(this,t,r,n))return;let o=this._properties[r];_t(o)||(this._properties[r]=new Array(s),o=this._properties[r]),o[t]=ho(n,!0)}_checkBatchId(t){if(!(t>=0&&t<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(t,r){return t.unpack(t.typedArray,r)}_setBinaryProperty(t,r,n){t.pack(n,t.typedArray,r)}_initializeBinaryProperties(){let t=null;for(let r in this._properties){let n=this._properties[r],s=this._initializeBinaryProperty(r,n);s&&(t=t||{},t[r]=s)}return t}_initializeBinaryProperty(t,r){if("byteOffset"in r){let n=r;V(this.binary,`Property ${t} requires a batch table binary.`),V(n.type,`Property ${t} requires a type.`);let s=Gd(n,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:s.values,componentCount:s.size,unpack:s.unpacker,pack:s.packer}}return null}_hasPropertyInHierarchy(t,r){if(!this._hierarchy)return!1;let n=Er(this._hierarchy,t,(s,o)=>{let i=s.classIds[o],a=s.classes[i].instances;return _t(a[r])});return _t(n)}_getPropertyNamesInHierarchy(t,r){Er(this._hierarchy,t,(n,s)=>{let o=n.classIds[s],i=n.classes[o].instances;for(let a in i)i.hasOwnProperty(a)&&r.indexOf(a)===-1&&r.push(a)})}_getHierarchyProperty(t,r){return Er(this._hierarchy,t,(n,s)=>{let o=n.classIds[s],i=n.classes[o],a=n.classIndexes[s],c=i.instances[r];return _t(c)?_t(c.typedArray)?this._getBinaryProperty(c,a):ho(c[a],!0):null})}_setHierarchyProperty(t,r,n,s){let o=Er(this._hierarchy,r,(i,a)=>{let c=i.classIds[a],l=i.classes[c],h=i.classIndexes[a],u=l.instances[n];return _t(u)?(V(a===r,`Inherited property "${n}" is read-only.`),_t(u.typedArray)?this._setBinaryProperty(u,h,s):u[h]=ho(s,!0),!0):!1});return _t(o)}};function we(e,t,r=0){let 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,e.version!==1)throw new Error(`3D Tile Version ${e.version} not supported`);return r}var Br=4,zd="b3dm tile in legacy format.";function Cr(e,t,r){let n=new DataView(t),s;e.header=e.header||{};let o=n.getUint32(r,!0);r+=Br;let i=n.getUint32(r,!0);r+=Br;let a=n.getUint32(r,!0);r+=Br;let c=n.getUint32(r,!0);return r+=Br,a>=570425344?(r-=Br*2,s=o,a=i,c=0,o=0,i=0,console.warn(zd)):c>=570425344&&(r-=Br,s=a,a=o,c=i,o=0,i=0,console.warn(zd)),e.header.featureTableJsonByteLength=o,e.header.featureTableBinaryByteLength=i,e.header.batchTableJsonByteLength=a,e.header.batchTableBinaryByteLength=c,e.header.batchLength=s,r}function Sr(e,t,r,n){return r=qT(e,t,r,n),r=jT(e,t,r,n),r}function qT(e,t,r,n){let{featureTableJsonByteLength:s,featureTableBinaryByteLength:o,batchLength:i}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:i||0},s&&s>0){let a=Xa(t,r,s);e.featureTableJson=JSON.parse(a)}return r+=s||0,e.featureTableBinary=new Uint8Array(t,r,o),r+=o||0,r}function jT(e,t,r,n){let{batchTableJsonByteLength:s,batchTableBinaryByteLength:o}=e.header||{};if(s&&s>0){let i=Xa(t,r,s);e.batchTableJson=JSON.parse(i),r+=s,o&&o>0&&(e.batchTableBinary=new Uint8Array(t,r,o),e.batchTableBinary=new Uint8Array(e.batchTableBinary),r+=o)}return r}function ec(e,t,r){if(!t&&(!e||!e.batchIds||!r))return null;let{batchIds:n,isRGB565:s,pointCount:o=0}=e;if(n&&r){let i=new Uint8ClampedArray(o*3);for(let a=0;a<o;a++){let c=n[a],h=r.getProperty(c,"dimensions").map(u=>u*255);i[a*3]=h[0],i[a*3+1]=h[1],i[a*3+2]=h[2]}return{type:N.UNSIGNED_BYTE,value:i,size:3,normalized:!0}}if(t&&s){let i=new Uint8ClampedArray(o*3);for(let a=0;a<o;a++){let c=$a(t[a]);i[a*3]=c[0],i[a*3+1]=c[1],i[a*3+2]=c[2]}return{type:N.UNSIGNED_BYTE,value:i,size:3,normalized:!0}}return t&&t.length===o*3?{type:N.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:N.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var kd=new x;function Jd(e,t){if(!t)return null;if(e.isOctEncoded16P){let r=new Float32Array((e.pointsLength||0)*3);for(let n=0;n<(e.pointsLength||0);n++)tc(t[n*2],t[n*2+1],kd),kd.toArray(r,n*3);return{type:N.FLOAT,size:2,value:r}}return{type:N.FLOAT,size:2,value:t}}function qd(e,t,r){return e.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,XT(e,t)):{type:N.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function XT(e,t){let r=new x,n=new Float32Array(e.pointCount*3);for(let s=0;s<e.pointCount;s++)r.set(t[s*3],t[s*3+1],t[s*3+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(n,s*3);return n}async function jd(e,t,r,n,s){r=we(e,t,r),r=Cr(e,t,r),r=Sr(e,t,r,n),WT(e);let{featureTable:o,batchTable:i}=YT(e);return await t_(e,o,i,n,s),KT(e,o,n),QT(e,o,i),ZT(e,o),r}function WT(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function YT(e){let t=new he(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",N.FLOAT,3);let n=$T(e,t);return{featureTable:t,batchTable:n}}function KT(e,t,r){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.positions){if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",N.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let n=t.getPropertyArray("POSITION_QUANTIZED",N.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",N.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",N.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=qd(e,n,r)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function QT(e,t,r){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.colors){let n=null;t.hasProperty("RGBA")?(n=t.getPropertyArray("RGBA",N.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?n=t.getPropertyArray("RGB",N.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(n=t.getPropertyArray("RGB565",N.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=ec(e,n,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",N.UNSIGNED_BYTE,4))}function ZT(e,t){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.normals){let r=null;t.hasProperty("NORMAL")?r=t.getPropertyArray("NORMAL",N.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",N.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=Jd(e,r)}}function $T(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",N.UNSIGNED_SHORT,1),e.batchIds)){let n=t.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:s,batchTableBinary:o}=e;r=new Ye(s,o,n)}return r}async function t_(e,t,r,n,s){let o,i,a,c=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];c&&(a=c.properties);let l=t.getExtension("3DTILES_draco_point_compression");if(l){i=l.properties;let u=l.byteOffset,f=l.byteLength;if(!i||!Number.isFinite(u)||!f)throw new Error("Draco properties, byteOffset, and byteLength must be defined");o=(e.featureTableBinary||[]).slice(u,u+f),e.hasPositions=Number.isFinite(i.POSITION),e.hasColors=Number.isFinite(i.RGB)||Number.isFinite(i.RGBA),e.hasNormals=Number.isFinite(i.NORMAL),e.hasBatchIds=Number.isFinite(i.BATCH_ID),e.isTranslucent=Number.isFinite(i.RGBA)}if(!o)return!0;let h={buffer:o,properties:{...i,...a},featureTableProperties:i,batchTableProperties:a,dequantizeInShader:!1};return await e_(e,h,n,s)}async function e_(e,t,r,n){if(!n)return;let s={...r,draco:{...r?.draco,extraAttributes:t.batchTableProperties||{}}};delete s["3d-tiles"];let o=await Bt(t.buffer,lo,s,n),i=o.attributes.POSITION&&o.attributes.POSITION.value,a=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=i&&o.attributes.POSITION.value.quantization,u=c&&o.attributes.NORMAL.value.quantization;if(h){let d=o.POSITION.data.quantization,p=d.range;e.quantizedVolumeScale=new x(p,p,p),e.quantizedVolumeOffset=new x(d.minValues),e.quantizedRange=(1<<d.quantizationBits)-1,e.isQuantizedDraco=!0}u&&(e.octEncodedRange=(1<<o.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let f={};if(t.batchTableProperties)for(let d of Object.keys(t.batchTableProperties))o.attributes[d]&&o.attributes[d].value&&(f[d.toLowerCase()]=o.attributes[d].value);e.attributes={positions:i,colors:ec(e,a,void 0),normals:c,batchIds:l,...f}}var rc={};ut(rc,{decode:()=>d_,name:()=>f_});function at(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var uo={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},fo={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var r_=1.33,Xd=["SCALAR","VEC2","VEC3","VEC4"],n_=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],s_=new Map(n_),o_={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},i_={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},a_={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function po(e){return Xd[e-1]||Xd[0]}function Mr(e){let t=s_.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function br(e,t){let r=a_[e.componentType],n=o_[e.type],s=i_[e.componentType],o=e.count*n,i=e.count*n*s;at(i>=0&&i<=t.byteLength);let a=fo[e.componentType],c=uo[e.type];return{ArrayType:r,length:o,byteLength:i,componentByteSize:a,numberOfComponentsInElement:c}}function Mn(e){let{images:t,bufferViews:r}=e;t=t||[],r=r||[];let n=t.map(i=>i.bufferView);r=r.filter(i=>!n.includes(i));let s=r.reduce((i,a)=>i+a.byteLength,0),o=t.reduce((i,a)=>{let{width:c,height:l}=a.image;return i+c*l},0);return s+Math.ceil(4*o*r_)}function Wd(e,t,r){let n=e.bufferViews[r];at(n);let s=n.buffer,o=t[s];at(o);let i=(n.byteOffset||0)+o.byteOffset;return new Uint8Array(o.arrayBuffer,i,n.byteLength)}function Yd(e,t,r){let n=typeof r=="number"?e.accessors?.[r]:r;if(!n)throw new Error(`No gltf accessor ${JSON.stringify(r)}`);let s=e.bufferViews?.[n.bufferView||0];if(!s)throw new Error(`No gltf buffer view for accessor ${s}`);let{arrayBuffer:o,byteOffset:i}=t[s.buffer],a=(i||0)+(n.byteOffset||0)+(s.byteOffset||0),{ArrayType:c,length:l,componentByteSize:h,numberOfComponentsInElement:u}=br(n,s),f=h*u,d=s.byteStride||f;if(typeof s.byteStride>"u"||s.byteStride===f)return new c(o,a,l);let p=new c(l);for(let A=0;A<n.count;A++){let g=new c(o,a+A*d,u);p.set(g,A*u)}return p}function c_(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var j=class{constructor(t){this.gltf={json:t?.json||c_(),buffers:t?.buffers||[],images:t?.images||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}hasExtension(t){let r=this.getUsedExtensions().find(s=>s===t),n=this.getRequiredExtensions().find(s=>s===t);return typeof r=="string"||typeof n=="string"}getExtension(t){let r=this.getUsedExtensions().find(s=>s===t),n=this.json.extensions||{};return r?n[t]:null}getRequiredExtension(t){return this.getRequiredExtensions().find(n=>n===t)?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(t,r){return(t.extensions||{})[r]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,r){if(typeof r=="object")return r;let n=this.json[t]&&this.json[t][r];if(!n)throw new Error(`glTF file error: Could not find ${t}[${r}]`);return n}getTypedArrayForBufferView(t){t=this.getBufferView(t);let r=t.buffer,n=this.gltf.buffers[r];at(n);let s=(t.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,s,t.byteLength)}getTypedArrayForAccessor(t){let r=this.getAccessor(t);return Yd(this.gltf.json,this.gltf.buffers,r)}getTypedArrayForImageData(t){t=this.getAccessor(t);let r=this.getBufferView(t.bufferView),s=this.getBuffer(r.buffer).data,o=r.byteOffset||0;return new Uint8Array(s,o,r.byteLength)}addApplicationData(t,r){return this.json[t]=r,this}addExtraData(t,r){return this.json.extras=this.json.extras||{},this.json.extras[t]=r,this}addObjectExtension(t,r,n){return t.extensions=t.extensions||{},t.extensions[r]=n,this.registerUsedExtension(r),this}setObjectExtension(t,r,n){let s=t.extensions||{};s[r]=n}removeObjectExtension(t,r){let n=t?.extensions||{};if(n[r]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(r)||s.push(r)}delete n[r]}addExtension(t,r={}){return at(r),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=r,this.registerUsedExtension(t),r}addRequiredExtension(t,r={}){return at(r),this.addExtension(t,r),this.registerRequiredExtension(t),r}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(r=>r===t)||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(r=>r===t)||this.json.extensionsRequired.push(t)}removeExtension(t){if(this.json.extensions?.[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let r=this.json.extensionsRemoved;r.includes(t)||r.push(t)}this.json.extensions&&delete this.json.extensions[t],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t)}setDefaultScene(t){this.json.scene=t}addScene(t){let{nodeIndices:r}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:r}),this.json.scenes.length-1}addNode(t){let{meshIndex:r,matrix:n}=t;this.json.nodes=this.json.nodes||[];let s={mesh:r};return n&&(s.matrix=n),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(t){let{attributes:r,indices:n,material:s,mode:o=4}=t,a={primitives:[{attributes:this._addAttributes(r),mode:o}]};if(n){let c=this._addIndices(n);a.primitives[0].indices=c}return Number.isFinite(s)&&(a.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(t){let n={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(n),this.json.meshes.length-1}addImage(t,r){let n=ve(t),s=r||n?.mimeType,i={bufferView:this.addBufferView(t),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(i),this.json.images.length-1}addBufferView(t,r=0,n=this.byteLength){let s=t.byteLength;at(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let o={buffer:r,byteOffset:n,byteLength:s};return this.byteLength+=me(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(o),this.json.bufferViews.length-1}addAccessor(t,r){let n={bufferView:t,type:po(r.size),componentType:r.componentType,count:r.count,max:r.max,min:r.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(t,r={size:3}){let n=this.addBufferView(t),s={min:r.min,max:r.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(t,r.size));let o={size:r.size,componentType:Mr(t),count:Math.round(t.length/r.size),min:s.min,max:s.max};return this.addAccessor(n,Object.assign(o,r))}addTexture(t){let{imageIndex:r}=t,n={source:r};return this.json.textures=this.json.textures||[],this.json.textures.push(n),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){this.gltf.buffers=[];let t=this.byteLength,r=new ArrayBuffer(t),n=new Uint8Array(r),s=0;for(let o of this.sourceBuffers||[])s=yi(o,n,s);this.json?.buffers?.[0]?this.json.buffers[0].byteLength=t:this.json.buffers=[{byteLength:t}],this.gltf.binary=r,this.sourceBuffers=[r]}_removeStringFromArray(t,r){let n=!0;for(;n;){let s=t.indexOf(r);s>-1?t.splice(s,1):n=!1}}_addAttributes(t={}){let r={};for(let n in t){let s=t[n],o=this._getGltfAttributeName(n),i=this.addBinaryBuffer(s.value,s);r[o]=i}return r}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.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 t}}_getAccessorMinMax(t,r){let n={min:null,max:null};if(t.length<r)return n;n.min=[],n.max=[];let s=t.subarray(0,r);for(let o of s)n.min.push(o),n.max.push(o);for(let o=r;o<t.length;o+=r)for(let i=0;i<r;i++)n.min[0+i]=Math.min(n.min[0+i],t[o+i]),n.max[0+i]=Math.max(n.max[0+i],t[o+i]);return n}};function Kd(e){return(e%1+1)%1}var Qd={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},l_={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},Zd={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function bn(e,t){return Zd[t]*Qd[e]}function Ir(e,t,r,n){if(r!=="UINT8"&&r!=="UINT16"&&r!=="UINT32"&&r!=="UINT64")return null;let s=e.getTypedArrayForBufferView(t),o=wr(s,"SCALAR",r,n+1);return o instanceof BigInt64Array||o instanceof BigUint64Array?null:o}function wr(e,t,r,n=1){let s=Qd[t],o=l_[r],i=Zd[r],a=n*s,c=a*i,l=e.buffer,h=e.byteOffset;return h%i!==0&&(l=new Uint8Array(l).slice(h,h+c).buffer,h=0),new o(l,h,a)}function Fr(e,t,r){let n=`TEXCOORD_${t.texCoord||0}`,s=r.attributes[n],o=e.getTypedArrayForAccessor(s),i=e.gltf.json,a=t.index,c=i.textures?.[a]?.source;if(typeof c<"u"){let l=i.images?.[c]?.mimeType,h=e.gltf.images?.[c];if(h&&typeof h.width<"u"){let u=[];for(let f=0;f<o.length;f+=2){let d=h_(h,l,o,f,t.channels);u.push(d)}return u}}return[]}function mo(e,t,r,n,s){if(!r?.length)return;let o=[];for(let h of r){let u=n.findIndex(f=>f===h);u===-1&&(u=n.push(h)-1),o.push(u)}let i=new Uint32Array(o),a=e.gltf.buffers.push({arrayBuffer:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength})-1,c=e.addBufferView(i,a,0),l=e.addAccessor(c,{size:1,componentType:Mr(i),count:i.length});s.attributes[t]=l}function h_(e,t,r,n,s=[0]){let o={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},i=r[n],a=r[n+1],c=1;t&&(t.indexOf("image/jpeg")!==-1||t.indexOf("image/png")!==-1)&&(c=4);let l=u_(i,a,e,c),h=0;for(let u of s){let f=typeof u=="number"?Object.values(o)[u]:o[u],d=l+f.offset,p=Qr(e);if(p.data.length<=d)throw new Error(`${p.data.length} <= ${d}`);let A=p.data[d];h|=A<<f.shift}return h}function u_(e,t,r,n=1){let s=r.width,o=Kd(e)*(s-1),i=Math.round(o),a=r.height,c=Kd(t)*(a-1),l=Math.round(c),h=r.components?r.components:n;return(l*s+i)*h}function go(e,t,r,n,s){let o=[];for(let i=0;i<t;i++){let a=r[i],c=r[i+1]-r[i];if(c+a>n)break;let l=a/s,h=c/s;o.push(e.slice(l,l+h))}return o}function Ao(e,t,r){let n=[];for(let s=0;s<t;s++){let o=s*r;n.push(e.slice(o,o+r))}return n}function xo(e,t,r,n){if(r)throw new Error("Not implemented - arrayOffsets for strings is specified");if(n){let s=[],o=new TextDecoder("utf8"),i=0;for(let a=0;a<e;a++){let c=n[a+1]-n[a];if(c+i<=t.length){let l=t.subarray(i,c+i),h=o.decode(l);s.push(h),i+=c}}return s}return[]}var $d="EXT_mesh_features",f_=$d;async function d_(e,t){let r=new j(e);p_(r,t)}function p_(e,t){let r=e.gltf.json;if(r.meshes)for(let n of r.meshes)for(let s of n.primitives)m_(e,s,t)}function m_(e,t,r){if(!r?.gltf?.loadBuffers)return;let s=t.extensions?.[$d]?.featureIds;if(s)for(let o of s){let i;if(typeof o.attribute<"u"){let a=`_FEATURE_ID_${o.attribute}`,c=t.attributes[a];i=e.getTypedArrayForAccessor(c)}else typeof o.texture<"u"&&r?.gltf?.loadImages?i=Fr(e,o.texture,t):i=[];o.data=i}}var oc={};ut(oc,{decode:()=>A_,name:()=>g_});var nc="EXT_structural_metadata",g_=nc;async function A_(e,t){let r=new j(e);x_(r,t)}function x_(e,t){if(!t.gltf?.loadBuffers)return;let r=e.getExtension(nc);r&&(t.gltf?.loadImages&&y_(e,r),T_(e,r))}function y_(e,t){let r=t.propertyTextures,n=e.gltf.json;if(r&&n.meshes)for(let s of n.meshes)for(let o of s.primitives)E_(e,r,o,t)}function T_(e,t){let r=t.schema;if(!r)return;let n=r.classes,s=t.propertyTables;if(n&&s)for(let o in n){let i=__(s,o);i&&C_(e,r,i)}}function __(e,t){for(let r of e)if(r.class===t)return r;return null}function E_(e,t,r,n){if(!t)return;let o=r.extensions?.[nc]?.propertyTextures;if(o)for(let i of o){let a=t[i];B_(e,a,r,n)}}function B_(e,t,r,n){if(!t.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);let s=t.class;for(let o in t.properties){let i=`${s}_${o}`,a=t.properties?.[o];if(!a)continue;a.data||(a.data=[]);let c=a.data,l=Fr(e,a,r);l!==null&&(mo(e,i,l,c,r),a.data=c,n.dataAttributeNames.push(i))}}function C_(e,t,r){let n=t.classes?.[r.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let s=r.count;for(let o in n.properties){let i=n.properties[o],a=r.properties?.[o];if(a){let c=S_(e,t,i,s,a);a.data=c}}}function S_(e,t,r,n,s){let o=[],i=s.values,a=e.getTypedArrayForBufferView(i),c=M_(e,r,s,n),l=b_(e,s,n);switch(r.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{o=I_(r,n,a,c);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${r.type}`);case"STRING":{o=xo(n,a,c,l);break}case"ENUM":{o=w_(t,r,n,a,c);break}default:throw new Error(`Unknown classProperty type ${r.type}`)}return o}function M_(e,t,r,n){return t.array&&typeof t.count>"u"&&typeof r.arrayOffsets<"u"?Ir(e,r.arrayOffsets,r.arrayOffsetType||"UINT32",n):null}function b_(e,t,r){return typeof t.stringOffsets<"u"?Ir(e,t.stringOffsets,t.stringOffsetType||"UINT32",r):null}function I_(e,t,r,n){let s=e.array,o=e.count,i=bn(e.type,e.componentType),a=r.byteLength/i,c;return e.componentType?c=wr(r,e.type,e.componentType,a):c=r,s?n?go(c,t,n,r.length,i):o?Ao(c,t,o):[]:c}function w_(e,t,r,n,s){let o=t.enumType;if(!o)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let i=e.enums?.[o];if(!i)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`);let a=i.valueType||"UINT16",c=bn(t.type,a),l=n.byteLength/c,h=wr(n,t.type,a,l);if(h||(h=n),t.array){if(s)return F_({valuesData:h,numberOfElements:r,arrayOffsets:s,valuesDataBytesLength:n.length,elementSize:c,enumEntry:i});let u=t.count;return u?L_(h,r,u,i):[]}return sc(h,0,r,i)}function F_(e){let{valuesData:t,numberOfElements:r,arrayOffsets:n,valuesDataBytesLength:s,elementSize:o,enumEntry:i}=e,a=[];for(let c=0;c<r;c++){let l=n[c],h=n[c+1]-n[c];if(h+l>s)break;let u=l/o,f=h/o,d=sc(t,u,f,i);a.push(d)}return a}function L_(e,t,r,n){let s=[];for(let o=0;o<t;o++){let i=r*o,a=sc(e,i,r,n);s.push(a)}return s}function sc(e,t,r,n){let s=[];for(let o=0;o<r;o++)if(e instanceof BigInt64Array||e instanceof BigUint64Array)s.push("");else{let i=e[t+o],a=R_(n,i);a?s.push(a.name):s.push("")}return s}function R_(e,t){for(let r of e.values)if(r.value===t)return r;return null}var ic={};ut(ic,{decode:()=>O_,name:()=>P_});var tp="EXT_feature_metadata",P_=tp;async function O_(e,t){let r=new j(e);N_(r,t)}function N_(e,t){if(!t.gltf?.loadBuffers)return;let r=e.getExtension(tp);r&&(t.gltf?.loadImages&&D_(e,r),v_(e,r))}function D_(e,t){let r=t.schema;if(!r)return;let n=r.classes,{featureTextures:s}=t;if(n&&s)for(let o in n){let i=n[o],a=G_(s,o);a&&H_(e,a,i)}}function v_(e,t){let r=t.schema;if(!r)return;let n=r.classes,s=t.featureTables;if(n&&s)for(let o in n){let i=U_(s,o);i&&V_(e,r,i)}}function U_(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function G_(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function V_(e,t,r){if(!r.class)return;let n=t.classes?.[r.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let s=r.count;for(let o in n.properties){let i=n.properties[o],a=r.properties?.[o];if(a){let c=z_(e,t,i,s,a);a.data=c}}}function H_(e,t,r){let n=t.class;for(let s in r.properties){let o=t?.properties?.[s];if(o){let i=X_(e,o,n);o.data=i}}}function z_(e,t,r,n,s){let o=[],i=s.bufferView,a=e.getTypedArrayForBufferView(i),c=k_(e,r,s,n),l=J_(e,r,s,n);return r.type==="STRING"||r.componentType==="STRING"?o=xo(n,a,c,l):q_(r)&&(o=j_(r,n,a,c)),o}function k_(e,t,r,n){return t.type==="ARRAY"&&typeof t.componentCount>"u"&&typeof r.arrayOffsetBufferView<"u"?Ir(e,r.arrayOffsetBufferView,r.offsetType||"UINT32",n):null}function J_(e,t,r,n){return typeof r.stringOffsetBufferView<"u"?Ir(e,r.stringOffsetBufferView,r.offsetType||"UINT32",n):null}function q_(e){let t=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return t.includes(e.type)||typeof e.componentType<"u"&&t.includes(e.componentType)}function j_(e,t,r,n){let s=e.type==="ARRAY",o=e.componentCount,i="SCALAR",a=e.componentType||e.type,c=bn(i,a),l=r.byteLength/c,h=wr(r,i,a,l);return s?n?go(h,t,n,r.length,c):o?Ao(h,t,o):[]:h}function X_(e,t,r){let n=e.gltf.json;if(!n.meshes)return[];let s=[];for(let o of n.meshes)for(let i of o.primitives)W_(e,r,t,s,i);return s}function W_(e,t,r,n,s){let o={channels:r.channels,...r.texture},i=Fr(e,o,s);i&&mo(e,t,i,n,s)}var ep="4.2.0-alpha.4";var rp="4.2.0-alpha.4";var yo={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},ac;async function lc(e){let t=e.modules||{};return t.basis?t.basis:(ac=ac||Y_(e),await ac)}async function Y_(e){let t=null,r=null;return[t,r]=await Promise.all([await Yt(yo.TRANSCODER,"textures",e),await Yt(yo.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await K_(t,r)}function K_(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e(r).then(s=>{let{BasisFile:o,initializeBasis:i}=s;i(),n({BasisFile:o})})})}var cc;async function hc(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(cc=cc||Q_(e),await cc)}async function Q_(e){let t=null,r=null;return[t,r]=await Promise.all([await Yt(yo.ENCODER,"textures",e),await Yt(yo.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await Z_(t,r)}function Z_(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e(r).then(s=>{let{BasisFile:o,KTX2File:i,initializeBasis:a,BasisEncoder:c}=s;a(),n({BasisFile:o,KTX2File:i,BasisEncoder:c})})})}var Ke={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919};var $_=["","WEBKIT_","MOZ_"],np={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"},To=null;function sp(e){if(!To){e=e||tE()||void 0,To=new Set;for(let t of $_)for(let r in np)if(e&&e.getExtension(`${t}${r}`)){let n=np[r];To.add(n)}}return To}function tE(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var It=[171,75,84,88,32,50,48,187,13,10,26,10];function op(e){let t=new Uint8Array(e);return!(t.byteLength<It.length||t[0]!==It[0]||t[1]!==It[1]||t[2]!==It[2]||t[3]!==It[3]||t[4]!==It[4]||t[5]!==It[5]||t[6]!==It[6]||t[7]!==It[7]||t[8]!==It[8]||t[9]!==It[9]||t[10]!==It[10]||t[11]!==It[11])}var eE={etc1:{basisFormat:0,compressed:!0,format:Ke.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Ke.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:Ke.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:Ke.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Ke.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:Ke.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 fc(e,t){if(t.basis.containerFormat==="auto"){if(op(e)){let n=await hc(t);return ip(n.KTX2File,e,t)}let{BasisFile:r}=await lc(t);return uc(r,e,t)}switch(t.basis.module){case"encoder":let r=await hc(t);switch(t.basis.containerFormat){case"ktx2":return ip(r.KTX2File,e,t);case"basis":default:return uc(r.BasisFile,e,t)}case"transcoder":default:let{BasisFile:n}=await lc(t);return uc(n,e,t)}}function uc(e,t,r){let n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("Failed to start basis transcoding");let s=n.getNumImages(),o=[];for(let i=0;i<s;i++){let a=n.getNumLevels(i),c=[];for(let l=0;l<a;l++)c.push(rE(n,i,l,r));o.push(c)}return o}finally{n.close(),n.delete()}}function rE(e,t,r,n){let s=e.getImageWidth(t,r),o=e.getImageHeight(t,r),i=e.getHasAlpha(),{compressed:a,format:c,basisFormat:l}=ap(n,i),h=e.getImageTranscodedSizeInBytes(t,r,l),u=new Uint8Array(h);if(!e.transcodeImage(u,t,r,l,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:o,data:u,compressed:a,format:c,hasAlpha:i}}function ip(e,t,r){let n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("failed to start KTX2 transcoding");let s=n.getLevels(),o=[];for(let i=0;i<s;i++){o.push(nE(n,i,r));break}return[o]}finally{n.close(),n.delete()}}function nE(e,t,r){let{alphaFlag:n,height:s,width:o}=e.getImageLevelInfo(t,0,0),{compressed:i,format:a,basisFormat:c}=ap(r,n),l=e.getImageTranscodedSizeInBytes(t,0,0,c),h=new Uint8Array(l);if(!e.transcodeImage(h,t,0,0,c,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:o,height:s,data:h,compressed:i,levelSize:l,hasAlpha:n,format:a}}function ap(e,t){let r=e&&e.basis&&e.basis.format;return r==="auto"&&(r=_o()),typeof r=="object"&&(r=t?r.alpha:r.noAlpha),r=r.toLowerCase(),eE[r]}function _o(){let e=sp();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"}var cp={name:"Basis",id:"basis",module:"textures",version:rp,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"}}},dc={...cp,parse:fc};var Lr=!0,lp=1735152710,gc=12,Eo=8,sE=1313821514,oE=5130562,iE=0,aE=0,cE=1;function lE(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))}`}function hp(e,t=0,r={}){let n=new DataView(e),{magic:s=lp}=r,o=n.getUint32(t,!1);return o===s||o===lp}function up(e,t,r=0,n={}){let s=new DataView(t),o=lE(s,r+0),i=s.getUint32(r+4,Lr),a=s.getUint32(r+8,Lr);switch(Object.assign(e,{header:{byteOffset:r,byteLength:a,hasBinChunk:!1},type:o,version:i,json:{},binChunks:[]}),r+=gc,e.version){case 1:return hE(e,s,r);case 2:return uE(e,s,r,n={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function hE(e,t,r){V(e.header.byteLength>gc+Eo);let n=t.getUint32(r+0,Lr),s=t.getUint32(r+4,Lr);return r+=Eo,V(s===iE),pc(e,t,r,n),r+=n,r+=mc(e,t,r,e.header.byteLength),r}function uE(e,t,r,n){return V(e.header.byteLength>gc+Eo),fE(e,t,r,n),r+e.header.byteLength}function fE(e,t,r,n){for(;r+8<=e.header.byteLength;){let s=t.getUint32(r+0,Lr),o=t.getUint32(r+4,Lr);switch(r+=Eo,o){case sE:pc(e,t,r,s);break;case oE:mc(e,t,r,s);break;case aE:n.strict||pc(e,t,r,s);break;case cE:n.strict||mc(e,t,r,s);break;default:break}r+=me(s,4)}return r}function pc(e,t,r,n){let s=new Uint8Array(t.buffer,r,n),i=new TextDecoder("utf8").decode(s);return e.json=JSON.parse(i),me(n,4)}function mc(e,t,r,n){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:t.buffer}),me(n,4)}function Ac(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;let n=t.baseUri||t.uri;if(!n)throw new Error(`'baseUri' must be provided to resolve relative url ${e}`);return n.substr(0,n.lastIndexOf("/")+1)+e}var yc={};ut(yc,{decode:()=>CE,name:()=>BE});var dE="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",pE="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",mE=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]),gE=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]),AE={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},xE={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function fp(e,t,r,n,s,o="NONE"){let i=await yE();EE(i,i.exports[xE[s]],e,t,r,n,i.exports[AE[o||"NONE"]])}var xc;async function yE(){return xc||(xc=TE()),xc}async function TE(){let e=dE;WebAssembly.validate(mE)&&(e=pE,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(_E(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function _E(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;++n){let s=e.charCodeAt(n);t[n]=s>96?s-71:s>64?s-65:s>47?s+4:s>46?63:62}let r=0;for(let n=0;n<e.length;++n)t[r++]=t[n]<60?gE[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,r)}function EE(e,t,r,n,s,o,i){let a=e.exports.sbrk,c=n+3&-4,l=a(c*s),h=a(o.length),u=new Uint8Array(e.exports.memory.buffer);u.set(o,h);let f=t(l,n,s,h,o.length);if(f===0&&i&&i(l,c,s),r.set(u.subarray(l,l+n*s)),a(l-a(0)),f!==0)throw new Error(`Malformed buffer data: ${f}`)}var Bo="EXT_meshopt_compression",BE=Bo;async function CE(e,t){let r=new j(e);if(!t?.gltf?.decompressMeshes||!t.gltf?.loadBuffers)return;let n=[];for(let s of e.json.bufferViews||[])n.push(SE(r,s));await Promise.all(n),r.removeExtension(Bo)}async function SE(e,t){let r=e.getObjectExtension(t,Bo);if(r){let{byteOffset:n=0,byteLength:s=0,byteStride:o,count:i,mode:a,filter:c="NONE",buffer:l}=r,h=e.gltf.buffers[l],u=new Uint8Array(h.arrayBuffer,h.byteOffset+n,s),f=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await fp(f,i,o,u,a,c),e.removeObjectExtension(t,Bo)}}var Tc={};ut(Tc,{name:()=>ME,preprocess:()=>bE});var Rr="EXT_texture_webp",ME=Rr;function bE(e,t){let r=new j(e);if(!Fi("image/webp")){if(r.getRequiredExtensions().includes(Rr))throw new Error(`gltf: Required extension ${Rr} not supported by browser`);return}let{json:n}=r;for(let s of n.textures||[]){let o=r.getObjectExtension(s,Rr);o&&(s.source=o.source),r.removeObjectExtension(s,Rr)}r.removeExtension(Rr)}var _c={};ut(_c,{name:()=>IE,preprocess:()=>wE});var Co="KHR_texture_basisu",IE=Co;function wE(e,t){let r=new j(e),{json:n}=r;for(let s of n.textures||[]){let o=r.getObjectExtension(s,Co);o&&(s.source=o.source,r.removeObjectExtension(s,Co))}r.removeExtension(Co)}var Bc={};ut(Bc,{decode:()=>OE,encode:()=>NE,name:()=>RE,preprocess:()=>PE});function dp(e){let t={};for(let r in e){let n=e[r];if(r!=="indices"){let s=Ec(n);t[r]=s}}return t}function Ec(e){let{buffer:t,size:r,count:n}=FE(e);return{value:t,size:r,byteOffset:0,count:n,type:po(r),componentType:Mr(t)}}function FE(e){let t=e,r=1,n=0;return e&&e.value&&(t=e.value,r=e.size||1),t&&(ArrayBuffer.isView(t)||(t=LE(t,Float32Array)),n=t.length/r),{buffer:t,size:r,count:n}}function LE(e,t,r=!1){return e?Array.isArray(e)?new t(e):r&&!(e instanceof t)?new t(e):e:null}var Fe="KHR_draco_mesh_compression",RE=Fe;function PE(e,t,r){let n=new j(e);for(let s of pp(n))n.getObjectExtension(s,Fe)}async function OE(e,t,r){if(!t?.gltf?.decompressMeshes)return;let n=new j(e),s=[];for(let o of pp(n))n.getObjectExtension(o,Fe)&&s.push(DE(n,o,t,r));await Promise.all(s),n.removeExtension(Fe)}function NE(e,t={}){let r=new j(e);for(let n of r.json.meshes||[])vE(n,t),r.addRequiredExtension(Fe)}async function DE(e,t,r,n){let s=e.getObjectExtension(t,Fe);if(!s)return;let o=e.getTypedArrayForBufferView(s.bufferView),i=Pe(o.buffer,o.byteOffset),a={...r};delete a["3d-tiles"];let c=await Bt(i,lo,a,n),l=dp(c.attributes);for(let[h,u]of Object.entries(l))if(h in t.attributes){let f=t.attributes[h],d=e.getAccessor(f);d?.min&&d?.max&&(u.min=d.min,u.max=d.max)}t.attributes=l,c.indices&&(t.indices=Ec(c.indices)),e.removeObjectExtension(t,Fe),UE(t)}function vE(e,t,r=4,n,s){if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let o=n.DracoWriter.encodeSync({attributes:e}),i=s?.parseSync?.({attributes:e}),a=n._addFauxAttributes(i.attributes),c=n.addBufferView(o);return{primitives:[{attributes:a,mode:r,extensions:{[Fe]:{bufferView:c,attributes:a}}}]}}function UE(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*pp(e){for(let t of e.json.meshes||[])for(let r of t.primitives)yield r}var Sc={};ut(Sc,{decode:()=>zE,name:()=>GE});var Cc="KHR_texture_transform",GE=Cc,So=new x,VE=new k,HE=new k;async function zE(e,t){if(!new j(e).hasExtension(Cc)||!t.gltf?.loadBuffers)return;let s=e.json.materials||[];for(let o=0;o<s.length;o++)kE(o,e)}function kE(e,t){let r=[],n=t.json.materials?.[e],s=n?.pbrMetallicRoughness?.baseColorTexture;s&&In(t,e,s,r);let o=n?.emissiveTexture;o&&In(t,e,o,r);let i=n?.normalTexture;i&&In(t,e,i,r);let a=n?.occlusionTexture;a&&In(t,e,a,r);let c=n?.pbrMetallicRoughness?.metallicRoughnessTexture;c&&In(t,e,c,r)}function In(e,t,r,n){let s=JE(r,n);if(!s)return;let o=e.json.meshes||[];for(let i of o)for(let a of i.primitives){let c=a.material;Number.isFinite(c)&&t===c&&qE(e,a,s)}}function JE(e,t){let r=e.extensions?.[Cc],{texCoord:n=0}=e,{texCoord:s=n}=r;if(!(t.findIndex(([i,a])=>i===n&&a===s)!==-1)){let i=WE(r);return n!==s&&(e.texCoord=s),t.push([n,s]),{originalTexCoord:n,texCoord:s,matrix:i}}return null}function qE(e,t,r){let{originalTexCoord:n,texCoord:s,matrix:o}=r,i=t.attributes[`TEXCOORD_${n}`];if(Number.isFinite(i)){let a=e.json.accessors?.[i];if(a&&a.bufferView){let c=e.json.bufferViews?.[a.bufferView];if(c){let{arrayBuffer:l,byteOffset:h}=e.buffers[c.buffer],u=(h||0)+(a.byteOffset||0)+(c.byteOffset||0),{ArrayType:f,length:d}=br(a,c),p=fo[a.componentType],A=uo[a.type],g=c.byteStride||p*A,y=new Float32Array(d);for(let E=0;E<a.count;E++){let _=new f(l,u+E*g,2);So.set(_[0],_[1],1),So.transformByMatrix3(o),y.set([So[0],So[1]],E*A)}n===s?jE(a,c,e.buffers,y):XE(s,a,t,e,y)}}}}function jE(e,t,r,n){e.componentType=5126,r.push({arrayBuffer:n.buffer,byteOffset:0,byteLength:n.buffer.byteLength}),t.buffer=r.length-1,t.byteLength=n.buffer.byteLength,t.byteOffset=0,delete t.byteStride}function XE(e,t,r,n,s){n.buffers.push({arrayBuffer:s.buffer,byteOffset:0,byteLength:s.buffer.byteLength});let o=n.json.bufferViews;if(!o)return;o.push({buffer:n.buffers.length-1,byteLength:s.buffer.byteLength,byteOffset:0});let i=n.json.accessors;i&&(i.push({bufferView:o?.length-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),r.attributes[`TEXCOORD_${e}`]=i.length-1)}function WE(e){let{offset:t=[0,0],rotation:r=0,scale:n=[1,1]}=e,s=new k().set(1,0,0,0,1,0,t[0],t[1],1),o=VE.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),i=HE.set(n[0],0,0,0,n[1],0,0,0,1);return s.multiplyRight(o).multiplyRight(i)}var Mc={};ut(Mc,{decode:()=>KE,encode:()=>QE,name:()=>YE});var Qe="KHR_lights_punctual",YE=Qe;async function KE(e){let t=new j(e),{json:r}=t,n=t.getExtension(Qe);n&&(t.json.lights=n.lights,t.removeExtension(Qe));for(let s of r.nodes||[]){let o=t.getObjectExtension(s,Qe);o&&(s.light=o.light),t.removeObjectExtension(s,Qe)}}async function QE(e){let t=new j(e),{json:r}=t;if(r.lights){let n=t.addExtension(Qe);at(!n.lights),n.lights=r.lights,delete r.lights}if(t.json.lights){for(let n of t.json.lights){let s=n.node;t.addObjectExtension(s,Qe,n)}delete t.json.lights}}var bc={};ut(bc,{decode:()=>$E,encode:()=>tB,name:()=>ZE});var wn="KHR_materials_unlit",ZE=wn;async function $E(e){let t=new j(e),{json:r}=t;for(let n of r.materials||[])n.extensions&&n.extensions.KHR_materials_unlit&&(n.unlit=!0),t.removeObjectExtension(n,wn);t.removeExtension(wn)}function tB(e){let t=new j(e),{json:r}=t;if(t.materials)for(let n of r.materials||[])n.unlit&&(delete n.unlit,t.addObjectExtension(n,wn,{}),t.addExtension(wn))}var Ic={};ut(Ic,{decode:()=>rB,encode:()=>nB,name:()=>eB});var Fn="KHR_techniques_webgl",eB=Fn;async function rB(e){let t=new j(e),{json:r}=t,n=t.getExtension(Fn);if(n){let s=sB(n,t);for(let o of r.materials||[]){let i=t.getObjectExtension(o,Fn);i&&(o.technique=Object.assign({},i,s[i.technique]),o.technique.values=oB(o.technique,t)),t.removeObjectExtension(o,Fn)}t.removeExtension(Fn)}}async function nB(e,t){}function sB(e,t){let{programs:r=[],shaders:n=[],techniques:s=[]}=e,o=new TextDecoder;return n.forEach(i=>{if(Number.isFinite(i.bufferView))i.code=o.decode(t.getTypedArrayForBufferView(i.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),r.forEach(i=>{i.fragmentShader=n[i.fragmentShader],i.vertexShader=n[i.vertexShader]}),s.forEach(i=>{i.program=r[i.program]}),s}function oB(e,t){let r=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(n=>{e.uniforms[n].value&&!(n in r)&&(r[n]=e.uniforms[n].value)}),Object.keys(r).forEach(n=>{typeof r[n]=="object"&&r[n].index!==void 0&&(r[n].texture=t.getTexture(r[n].index))}),r}var mp=[oc,rc,yc,Tc,_c,Bc,Mc,bc,Ic,Sc,ic];function gp(e,t={},r){let n=mp.filter(s=>xp(s.name,t));for(let s of n)s.preprocess?.(e,t,r)}async function Ap(e,t={},r){let n=mp.filter(s=>xp(s.name,t));for(let s of n)await s.decode?.(e,t,r)}function xp(e,t){let r=t?.gltf?.excludeExtensions||{};return!(e in r&&!r[e])}var wc="KHR_binary_glTF";function yp(e){let t=new j(e),{json:r}=t;for(let n of r.images||[]){let s=t.getObjectExtension(n,wc);s&&Object.assign(n,s),t.removeObjectExtension(n,wc)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,t.removeExtension(wc)}var Tp={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},aB={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},Fc=class{constructor(){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}}normalize(t,r){this.json=t.json;let n=t.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${n.asset.version}`);return}if(!r.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(n),this._convertTopLevelObjectsToArrays(n),yp(t),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(let r in Tp)this._convertTopLevelObjectToArray(t,r)}_convertTopLevelObjectToArray(t,r){let n=t[r];if(!(!n||Array.isArray(n))){t[r]=[];for(let s in n){let o=n[s];o.id=o.id||s;let i=t[r].length;t[r].push(o),this.idToIndexMap[r][s]=i}}}_convertObjectIdsToArrayIndices(t){for(let r in Tp)this._convertIdsToIndices(t,r);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(let r of t.textures)this._convertTextureIds(r);for(let r of t.meshes)this._convertMeshIds(r);for(let r of t.nodes)this._convertNodeIds(r);for(let r of t.scenes)this._convertSceneIds(r)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(let r of t.primitives){let{attributes:n,indices:s,material:o}=r;for(let i in n)n[i]=this._convertIdToIndex(n[i],"accessor");s&&(r.indices=this._convertIdToIndex(s,"accessor")),o&&(r.material=this._convertIdToIndex(o,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map(r=>this._convertIdToIndex(r,"node"))),t.meshes&&(t.meshes=t.meshes.map(r=>this._convertIdToIndex(r,"mesh")))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map(r=>this._convertIdToIndex(r,"node")))}_convertIdsToIndices(t,r){t[r]||(console.warn(`gltf v1: json doesn't contain attribute ${r}`),t[r]=[]);for(let n of t[r])for(let s in n){let o=n[s],i=this._convertIdToIndex(o,s);n[s]=i}}_convertIdToIndex(t,r){let n=aB[r];if(n in this.idToIndexMap){let s=this.idToIndexMap[n][t];if(!Number.isFinite(s))throw new Error(`gltf v1: failed to resolve ${r} with id ${t}`);return s}return t}_updateObjects(t){for(let r of this.json.buffers)delete r.type}_updateMaterial(t){for(let r of t.materials){r.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let n=r.values?.tex||r.values?.texture2d_0||r.values?.diffuseTex,s=t.textures.findIndex(o=>o.id===n);s!==-1&&(r.pbrMetallicRoughness.baseColorTexture={index:s})}}};function _p(e,t={}){return new Fc().normalize(e,t)}async function Ep(e,t,r=0,n,s){return cB(e,t,r,n),_p(e,{normalize:n?.gltf?.normalize}),gp(e,n,s),n?.gltf?.loadBuffers&&e.json.buffers&&await lB(e,n,s),n?.gltf?.loadImages&&await hB(e,n,s),await Ap(e,n,s),e}function cB(e,t,r,n){if(n.uri&&(e.baseUri=n.uri),t instanceof ArrayBuffer&&!hp(t,r,n)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=xi(t);else if(t instanceof ArrayBuffer){let i={};r=up(i,t,r,n.glb),at(i.type==="glTF",`Invalid GLB magic string ${i.type}`),e._glb=i,e.json=i.json}else at(!1,"GLTF: must be ArrayBuffer or string");let s=e.json.buffers||[];if(e.buffers=new Array(s.length).fill(null),e._glb&&e._glb.header.hasBinChunk){let{binChunks:i}=e._glb;e.buffers[0]={arrayBuffer:i[0].arrayBuffer,byteOffset:i[0].byteOffset,byteLength:i[0].byteLength}}let o=e.json.images||[];e.images=new Array(o.length).fill({})}async function lB(e,t,r){let n=e.json.buffers||[];for(let s=0;s<n.length;++s){let o=n[s];if(o.uri){let{fetch:i}=r;at(i);let a=Ac(o.uri,t),l=await(await r?.fetch?.(a))?.arrayBuffer?.();e.buffers[s]={arrayBuffer:l,byteOffset:0,byteLength:l.byteLength},delete o.uri}else e.buffers[s]===null&&(e.buffers[s]={arrayBuffer:new ArrayBuffer(o.byteLength),byteOffset:0,byteLength:o.byteLength})}}async function hB(e,t,r){let n=uB(e),s=e.json.images||[],o=[];for(let i of n)o.push(fB(e,s[i],i,t,r));return await Promise.all(o)}function uB(e){let t=new Set,r=e.json.textures||[];for(let n of r)n.source!==void 0&&t.add(n.source);return Array.from(t).sort()}async function fB(e,t,r,n,s){let o;if(t.uri&&!t.hasOwnProperty("bufferView")){let a=Ac(t.uri,n),{fetch:c}=s;o=await(await c(a)).arrayBuffer(),t.bufferView={data:o}}if(Number.isFinite(t.bufferView)){let a=Wd(e.json,e.buffers,t.bufferView);o=Pe(a.buffer,a.byteOffset,a.byteLength)}at(o,"glTF image has no data");let i=await Bt(o,[ye,dc],{...n,mimeType:t.mimeType,basis:n.basis||{format:_o()}},s);i&&i[0]&&(i={compressed:!0,mipmaps:!1,width:i[0].width,height:i[0].height,data:i[0]}),e.images=e.images||[],e.images[r]=i}var Ze={name:"glTF",id:"gltf",module:"gltf",version:ep,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:dB,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function dB(e,t={},r){t={...Ze.options,...t},t.gltf={...Ze.options.gltf,...t.gltf};let{byteOffset:n=0}=t;return await Ep({},e,n,t,r)}var pB={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},mB={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Pt={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},gB={magFilter:Pt.TEXTURE_MAG_FILTER,minFilter:Pt.TEXTURE_MIN_FILTER,wrapS:Pt.TEXTURE_WRAP_S,wrapT:Pt.TEXTURE_WRAP_T},AB={[Pt.TEXTURE_MAG_FILTER]:Pt.LINEAR,[Pt.TEXTURE_MIN_FILTER]:Pt.NEAREST_MIPMAP_LINEAR,[Pt.TEXTURE_WRAP_S]:Pt.REPEAT,[Pt.TEXTURE_WRAP_T]:Pt.REPEAT};function xB(){return{id:"default-sampler",parameters:AB}}function yB(e){return mB[e]}function TB(e){return pB[e]}var Lc=class{constructor(){this.baseUri="",this.buffers=[],this.images=[]}postProcess(t,r={}){let{json:n,buffers:s=[],images:o=[]}=t,{baseUri:i=""}=t;return at(n),this.baseUri=i,this.buffers=s,this.images=o,this.jsonUnprocessed=n,this.json=this._resolveTree(t.json,r),this.json}_resolveTree(t,r={}){let n={...t};return this.json=n,t.bufferViews&&(n.bufferViews=t.bufferViews.map((s,o)=>this._resolveBufferView(s,o))),t.images&&(n.images=t.images.map((s,o)=>this._resolveImage(s,o))),t.samplers&&(n.samplers=t.samplers.map((s,o)=>this._resolveSampler(s,o))),t.textures&&(n.textures=t.textures.map((s,o)=>this._resolveTexture(s,o))),t.accessors&&(n.accessors=t.accessors.map((s,o)=>this._resolveAccessor(s,o))),t.materials&&(n.materials=t.materials.map((s,o)=>this._resolveMaterial(s,o))),t.meshes&&(n.meshes=t.meshes.map((s,o)=>this._resolveMesh(s,o))),t.nodes&&(n.nodes=t.nodes.map((s,o)=>this._resolveNode(s,o)),n.nodes=n.nodes.map((s,o)=>this._resolveNodeChildren(s))),t.skins&&(n.skins=t.skins.map((s,o)=>this._resolveSkin(s,o))),t.scenes&&(n.scenes=t.scenes.map((s,o)=>this._resolveScene(s,o))),typeof this.json.scene=="number"&&n.scenes&&(n.scene=n.scenes[this.json.scene]),n}getScene(t){return this._get(this.json.scenes,t)}getNode(t){return this._get(this.json.nodes,t)}getSkin(t){return this._get(this.json.skins,t)}getMesh(t){return this._get(this.json.meshes,t)}getMaterial(t){return this._get(this.json.materials,t)}getAccessor(t){return this._get(this.json.accessors,t)}getCamera(t){return this._get(this.json.cameras,t)}getTexture(t){return this._get(this.json.textures,t)}getSampler(t){return this._get(this.json.samplers,t)}getImage(t){return this._get(this.json.images,t)}getBufferView(t){return this._get(this.json.bufferViews,t)}getBuffer(t){return this._get(this.json.buffers,t)}_get(t,r){if(typeof r=="object")return r;let n=t&&t[r];return n||console.warn(`glTF file error: Could not find ${t}[${r}]`),n}_resolveScene(t,r){return{...t,id:t.id||`scene-${r}`,nodes:(t.nodes||[]).map(n=>this.getNode(n))}}_resolveNode(t,r){let n={...t,id:t?.id||`node-${r}`};return t.mesh!==void 0&&(n.mesh=this.getMesh(t.mesh)),t.camera!==void 0&&(n.camera=this.getCamera(t.camera)),t.skin!==void 0&&(n.skin=this.getSkin(t.skin)),t.meshes!==void 0&&t.meshes.length&&(n.mesh=t.meshes.reduce((s,o)=>{let i=this.getMesh(o);return s.id=i.id,s.primitives=s.primitives.concat(i.primitives),s},{primitives:[]})),n}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map(r=>this.getNode(r))),t}_resolveSkin(t,r){let n=typeof t.inverseBindMatrices=="number"?this.getAccessor(t.inverseBindMatrices):void 0;return{...t,id:t.id||`skin-${r}`,inverseBindMatrices:n}}_resolveMesh(t,r){let n={...t,id:t.id||`mesh-${r}`,primitives:[]};return t.primitives&&(n.primitives=t.primitives.map(s=>{let o={...s,attributes:{},indices:void 0,material:void 0},i=s.attributes;for(let a in i)o.attributes[a]=this.getAccessor(i[a]);return s.indices!==void 0&&(o.indices=this.getAccessor(s.indices)),s.material!==void 0&&(o.material=this.getMaterial(s.material)),o})),n}_resolveMaterial(t,r){let n={...t,id:t.id||`material-${r}`};if(n.normalTexture&&(n.normalTexture={...n.normalTexture},n.normalTexture.texture=this.getTexture(n.normalTexture.index)),n.occlusionTexture&&(n.occlusionTexture={...n.occlusionTexture},n.occlusionTexture.texture=this.getTexture(n.occlusionTexture.index)),n.emissiveTexture&&(n.emissiveTexture={...n.emissiveTexture},n.emissiveTexture.texture=this.getTexture(n.emissiveTexture.index)),n.emissiveFactor||(n.emissiveFactor=n.emissiveTexture?[1,1,1]:[0,0,0]),n.pbrMetallicRoughness){n.pbrMetallicRoughness={...n.pbrMetallicRoughness};let s=n.pbrMetallicRoughness;s.baseColorTexture&&(s.baseColorTexture={...s.baseColorTexture},s.baseColorTexture.texture=this.getTexture(s.baseColorTexture.index)),s.metallicRoughnessTexture&&(s.metallicRoughnessTexture={...s.metallicRoughnessTexture},s.metallicRoughnessTexture.texture=this.getTexture(s.metallicRoughnessTexture.index))}return n}_resolveAccessor(t,r){let n=yB(t.componentType),s=TB(t.type),o=n*s,i={...t,id:t.id||`accessor-${r}`,bytesPerComponent:n,components:s,bytesPerElement:o,value:void 0,bufferView:void 0,sparse:void 0};if(t.bufferView!==void 0&&(i.bufferView=this.getBufferView(t.bufferView)),i.bufferView){let a=i.bufferView.buffer,{ArrayType:c,byteLength:l}=br(i,i.bufferView),h=(i.bufferView.byteOffset||0)+(i.byteOffset||0)+a.byteOffset,u=a.arrayBuffer.slice(h,h+l);i.bufferView.byteStride&&(u=this._getValueFromInterleavedBuffer(a,h,i.bufferView.byteStride,i.bytesPerElement,i.count)),i.value=new c(u)}return i}_getValueFromInterleavedBuffer(t,r,n,s,o){let i=new Uint8Array(o*s);for(let a=0;a<o;a++){let c=r+a*n;i.set(new Uint8Array(t.arrayBuffer.slice(c,c+s)),a*s)}return i.buffer}_resolveTexture(t,r){return{...t,id:t.id||`texture-${r}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):xB(),source:typeof t.source=="number"?this.getImage(t.source):void 0}}_resolveSampler(t,r){let n={id:t.id||`sampler-${r}`,...t,parameters:{}};for(let s in n){let o=this._enumSamplerParameter(s);o!==void 0&&(n.parameters[o]=n[s])}return n}_enumSamplerParameter(t){return gB[t]}_resolveImage(t,r){let n={...t,id:t.id||`image-${r}`,image:null,bufferView:t.bufferView!==void 0?this.getBufferView(t.bufferView):void 0},s=this.images[r];return s&&(n.image=s),n}_resolveBufferView(t,r){let n=t.buffer,s=this.buffers[n].arrayBuffer,o=this.buffers[n].byteOffset||0;return t.byteOffset&&(o+=t.byteOffset),{id:`bufferView-${r}`,...t,buffer:this.buffers[n],data:new Uint8Array(s,o,t.byteLength)}}_resolveCamera(t,r){let n={...t,id:t.id||`camera-${r}`};return n.perspective,n.orthographic,n}};function Ln(e,t){return new Lc().postProcess(e,t)}var Mo={URI:0,EMBEDDED:1};function bo(e,t,r,n){e.rotateYtoZ=!0;let s=(e.byteOffset||0)+(e.byteLength||0)-r;if(s===0)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=Pe(t,r,s),e.gltfByteOffset=0,e.gltfByteLength=s,r%4===0||console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`),(e.byteOffset||0)+(e.byteLength||0)}async function Io(e,t,r,n){let s=r?.["3d-tiles"]||{};if(_B(e,t,r),s.loadGLTF){if(!n)return;if(e.gltfUrl){let{fetch:o}=n,i=await o(e.gltfUrl,r);e.gltfArrayBuffer=await i.arrayBuffer(),e.gltfByteOffset=0}if(e.gltfArrayBuffer){let o=await Bt(e.gltfArrayBuffer,Ze,r,n);e.gltf=Ln(o),e.gpuMemoryUsageInBytes=Mn(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function _B(e,t,r){switch(t){case Mo.URI:if(e.gltfArrayBuffer){let n=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),o=new TextDecoder().decode(n);e.gltfUrl=o.replace(/[\s\0]+$/,"")}delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case Mo.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function Bp(e,t,r,n,s){r=EB(e,t,r,n,s),await Io(e,Mo.EMBEDDED,n,s);let o=e?.gltf?.extensions;return o&&o.CESIUM_RTC&&(e.rtcCenter=o.CESIUM_RTC.center),r}function EB(e,t,r,n,s){r=we(e,t,r),r=Cr(e,t,r),r=Sr(e,t,r,n),r=bo(e,t,r,n);let o=new he(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=o.getGlobalProperty("RTC_CENTER",N.FLOAT,3),r}async function Cp(e,t,r,n,s){return r=BB(e,t,r,n,s),await Io(e,e.gltfFormat||0,n,s),r}function BB(e,t,r,n,s){if(r=we(e,t,r),e.version!==1)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);r=Cr(e,t,r);let o=new DataView(t);if(e.gltfFormat=o.getUint32(r,!0),r+=4,r=Sr(e,t,r,n),r=bo(e,t,r,n),!e?.header?.featureTableJsonByteLength||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let i=new he(e.featureTableJson,e.featureTableBinary),a=i.getGlobalProperty("INSTANCES_LENGTH");if(i.featuresLength=a,!Number.isFinite(a))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=i.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=i.getGlobalProperty("RTC_CENTER",N.FLOAT,3);let c=new Ye(e.batchTableJson,e.batchTableBinary,a);return CB(e,i,c,a),r}function CB(e,t,r,n){let s=new Array(n),o=new x,i=new x,a=new x,c=new x,l=new k,h=new Qt,u=new x,f={},d=new O,p=[],A=[],g=[],y=[];for(let E=0;E<n;E++){let _;if(t.hasProperty("POSITION"))_=t.getProperty("POSITION",N.FLOAT,3,E,o);else if(t.hasProperty("POSITION_QUANTIZED")){_=t.getProperty("POSITION_QUANTIZED",N.UNSIGNED_SHORT,3,E,o);let m=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",N.FLOAT,3);if(!m)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let b=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",N.FLOAT,3);if(!b)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let L=65535;for(let R=0;R<3;R++)_[R]=_[R]/L*b[R]+m[R]}if(!_)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");o.copy(_),f.translation=o,e.normalUp=t.getProperty("NORMAL_UP",N.FLOAT,3,E,p),e.normalRight=t.getProperty("NORMAL_RIGHT",N.FLOAT,3,E,A);let 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",N.UNSIGNED_SHORT,2,E,p),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",N.UNSIGNED_SHORT,2,E,A),e.octNormalUp)throw e.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");e.eastNorthUp?(U.WGS84.eastNorthUpToFixedFrame(o,d),d.getRotationMatrix3(l)):l.identity()}B&&(c.copy(i).cross(a).normalize(),l.setColumn(0,i),l.setColumn(1,a),l.setColumn(2,c)),h.fromMatrix3(l),f.rotation=h,u.set(1,1,1);let S=t.getProperty("SCALE",N.FLOAT,1,E,g);Number.isFinite(S)&&u.multiplyByScalar(S);let M=t.getProperty("SCALE_NON_UNIFORM",N.FLOAT,3,E,p);M&&u.scale(M),f.scale=u;let w=t.getProperty("BATCH_ID",N.UNSIGNED_SHORT,1,E,y);w===void 0&&(w=E);let C=new O().fromQuaternion(f.rotation);d.identity(),d.translate(f.translation),d.multiplyRight(C),d.scale(f.scale);let T=d.clone();s[E]={modelMatrix:T,batchId:w}}e.instances=s}async function Sp(e,t,r,n,s,o){r=we(e,t,r);let i=new DataView(t);for(e.tilesLength=i.getUint32(r,!0),r+=4,e.tiles=[];e.tiles.length<e.tilesLength&&(e.byteLength||0)-r>12;){let a={shape:"tile3d"};e.tiles.push(a),r=await o(t,r,n,s,a)}return r}async function Mp(e,t,r,n){if(e.rotateYtoZ=!0,e.gltfUpAxis=r?.["3d-tiles"]?.assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",r?.["3d-tiles"]?.loadGLTF){if(!n)return t.byteLength;let s=await Bt(t,Ze,r,n);e.gltf=Ln(s),e.gpuMemoryUsageInBytes=Mn(e.gltf)}else e.gltfArrayBuffer=t;return t.byteLength}async function Rc(e,t=0,r,n,s={shape:"tile3d"}){switch(s.byteOffset=t,s.type=Sd(e,t),s.type){case Xe.COMPOSITE:return await Sp(s,e,t,r,n,Rc);case Xe.BATCHED_3D_MODEL:return await Bp(s,e,t,r,n);case Xe.GLTF:return await Mp(s,e,r,n);case Xe.INSTANCED_3D_MODEL:return await Cp(s,e,t,r,n);case Xe.POINT_CLOUD:return await jd(s,e,t,r,n);default:throw new Error(`3DTileLoader: unknown type ${s.type}`)}}async function Pc(e,t,r){if(new Uint32Array(e.slice(0,4))[0]!==1952609651)throw new Error("Wrong subtree file magic number");if(new Uint32Array(e.slice(4,8))[0]!==1)throw new Error("Wrong subtree file verson, must be 1");let o=bp(e.slice(8,16)),i=new Uint8Array(e,24,o),c=new TextDecoder("utf8").decode(i),l=JSON.parse(c),h=bp(e.slice(16,24)),u=new ArrayBuffer(0);if(h&&(u=e.slice(24+o)),await wo(l,l.tileAvailability,u,r),Array.isArray(l.contentAvailability))for(let f of l.contentAvailability)await wo(l,f,u,r);else await wo(l,l.contentAvailability,u,r);return await wo(l,l.childSubtreeAvailability,u,r),l}async function wo(e,t,r,n){let s=Number.isFinite(t.bitstream)?t.bitstream:t.bufferView;if(typeof s!="number")return;let o=e.bufferViews[s],i=e.buffers[o.buffer];if(!n?.baseUrl)throw new Error("Url is not provided");if(!n.fetch)throw new Error("fetch is not provided");if(i.uri){let c=`${n?.baseUrl||""}/${i.uri}`,h=await(await n.fetch(c)).arrayBuffer();t.explicitBitstream=new Uint8Array(h,o.byteOffset,o.byteLength);return}let a=e.buffers.slice(0,o.buffer).reduce((c,l)=>c+l.byteLength,0);t.explicitBitstream=new Uint8Array(r.slice(a,a+i.byteLength),o.byteOffset,o.byteLength)}function bp(e){let t=new DataView(e),r=t.getUint32(0,!0),n=t.getUint32(4,!0);return r+2**32*n}var Fo={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:co,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:Pc,options:{}};var om=D(yr(),1);var em=D(yr(),1);var Lo=globalThis,SB=globalThis.document||{},Ro=globalThis.process||{},MB=globalThis.console,Wv=globalThis.navigator||{};function Ip(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,r=e||t;return Boolean(r&&r.indexOf("Electron")>=0)}function $e(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Ip()}var Oc="4.0.7";function IB(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var Po=class{constructor(t,r,n="sessionStorage"){this.storage=IB(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function wp(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function Fp(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var Oo;(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"})(Oo||(Oo={}));var wB=10;function Lp(e){return typeof e!="string"?e:(e=e.toUpperCase(),Oo[e]||Oo.WHITE)}function Rp(e,t,r){return!$e&&typeof e=="string"&&(t&&(e=`\x1B[${Lp(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${Lp(r)+wB}m${e}\x1B[49m`)),e}function Pp(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),s=e;for(let o of n){let i=s[o];typeof i=="function"&&(t.find(a=>o===a)||(s[o]=i.bind(e)))}}function Rn(e,t){if(!e)throw new Error(t||"Assertion failed")}function tr(){let e;if($e()&&Lo.performance)e=Lo?.performance?.now?.();else if("hrtime"in Ro){let t=Ro?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Pr={debug:$e()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},FB={enabled:!0,level:0};function Or(){}var Op={},Np={once:!0},Pn=class{constructor({id:t}={id:""}){this.VERSION=Oc,this._startTs=tr(),this._deltaTs=tr(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Po(`__probe-${this.id}__`,FB),this.timeStamp(`${this.id} started`),Pp(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((tr()-this._startTs).toPrecision(10))}getDelta(){return Number((tr()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t){return this._getLogFunction(0,t,Pr.warn,arguments,Np)}error(t){return this._getLogFunction(0,t,Pr.error,arguments)}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r){return this._getLogFunction(t,r,Pr.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,Pr.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,Pr.debug||Pr.info,arguments,Np)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||Or,n&&[n],{tag:RB(r)}):Or}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||Or)}group(t,r,n={collapsed:!1}){let s=Dp({logLevel:t,message:r,opts:n}),{collapsed:o}=n;return s.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Or)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=vp(t)}_getLogFunction(t,r,n,s,o){if(this._shouldLog(t)){o=Dp({logLevel:t,message:r,args:s,opts:o}),n=n||o.method,Rn(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=tr();let i=o.tag||o.message;if(o.once&&i)if(!Op[i])Op[i]=tr();else return Or;return r=LB(this.id,o.message,o),n.bind(console,r,...o.args)}return Or}};Pn.VERSION=Oc;function vp(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 Rn(Number.isFinite(t)&&t>=0),t}function Dp(e){let{logLevel:t,message:r}=e;e.logLevel=vp(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let s=typeof e.message;return Rn(s==="string"||s==="object"),Object.assign(e,{args:n},e.opts)}function LB(e,t,r){if(typeof t=="string"){let n=r.time?Fp(wp(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=Rp(t,r.color,r.background)}return t}function RB(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}globalThis.probe={};var Nc=new Pn({id:"@probe.gl/log"});var Ot=null;try{Ot=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Q(e,t,r){this.low=e|0,this.high=t|0,this.unsigned=!!r}Q.prototype.__isLong__;Object.defineProperty(Q.prototype,"__isLong__",{value:!0});function mt(e){return(e&&e.__isLong__)===!0}function Up(e){var t=Math.clz32(e&-e);return e?31-t:t}Q.isLong=mt;var Gp={},Vp={};function er(e,t){var r,n,s;return t?(e>>>=0,(s=0<=e&&e<256)&&(n=Vp[e],n)?n:(r=H(e,0,!0),s&&(Vp[e]=r),r)):(e|=0,(s=-128<=e&&e<128)&&(n=Gp[e],n)?n:(r=H(e,e<0?-1:0,!1),s&&(Gp[e]=r),r))}Q.fromInt=er;function Nt(e,t){if(isNaN(e))return t?ue:Jt;if(t){if(e<0)return ue;if(e>=Jp)return Xp}else{if(e<=-zp)return Et;if(e+1>=zp)return jp}return e<0?Nt(-e,t).neg():H(e%Dr|0,e/Dr|0,t)}Q.fromNumber=Nt;function H(e,t,r){return new Q(e,t,r)}Q.fromBits=H;var No=Math.pow;function vc(e,t,r){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(r=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?ue:Jt;if(r=r||10,r<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(n===0)return vc(e.substring(1),t,r).neg();for(var s=Nt(No(r,8)),o=Jt,i=0;i<e.length;i+=8){var a=Math.min(8,e.length-i),c=parseInt(e.substring(i,i+a),r);if(a<8){var l=Nt(No(r,a));o=o.mul(l).add(Nt(c))}else o=o.mul(s),o=o.add(Nt(c))}return o.unsigned=t,o}Q.fromString=vc;function qt(e,t){return typeof e=="number"?Nt(e,t):typeof e=="string"?vc(e,t):H(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}Q.fromValue=qt;var Hp=1<<16,PB=1<<24,Dr=Hp*Hp,Jp=Dr*Dr,zp=Jp/2,kp=er(PB),Jt=er(0);Q.ZERO=Jt;var ue=er(0,!0);Q.UZERO=ue;var Nr=er(1);Q.ONE=Nr;var qp=er(1,!0);Q.UONE=qp;var Dc=er(-1);Q.NEG_ONE=Dc;var jp=H(-1,2147483647,!1);Q.MAX_VALUE=jp;var Xp=H(-1,-1,!0);Q.MAX_UNSIGNED_VALUE=Xp;var Et=H(0,-2147483648,!1);Q.MIN_VALUE=Et;var I=Q.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low};I.toNumber=function(){return this.unsigned?(this.high>>>0)*Dr+(this.low>>>0):this.high*Dr+(this.low>>>0)};I.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Et)){var r=Nt(t),n=this.div(r),s=n.mul(r).sub(this);return n.toString(t)+s.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var o=Nt(No(t,6),this.unsigned),i=this,a="";;){var c=i.div(o),l=i.sub(c.mul(o)).toInt()>>>0,h=l.toString(t);if(i=c,i.isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}};I.getHighBits=function(){return this.high};I.getHighBitsUnsigned=function(){return this.high>>>0};I.getLowBits=function(){return this.low};I.getLowBitsUnsigned=function(){return this.low>>>0};I.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Et)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,r=31;r>0&&!(t&1<<r);r--);return this.high!=0?r+33:r+1};I.isZero=function(){return this.high===0&&this.low===0};I.eqz=I.isZero;I.isNegative=function(){return!this.unsigned&&this.high<0};I.isPositive=function(){return this.unsigned||this.high>=0};I.isOdd=function(){return(this.low&1)===1};I.isEven=function(){return(this.low&1)===0};I.equals=function(t){return mt(t)||(t=qt(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};I.eq=I.equals;I.notEquals=function(t){return!this.eq(t)};I.neq=I.notEquals;I.ne=I.notEquals;I.lessThan=function(t){return this.comp(t)<0};I.lt=I.lessThan;I.lessThanOrEqual=function(t){return this.comp(t)<=0};I.lte=I.lessThanOrEqual;I.le=I.lessThanOrEqual;I.greaterThan=function(t){return this.comp(t)>0};I.gt=I.greaterThan;I.greaterThanOrEqual=function(t){return this.comp(t)>=0};I.gte=I.greaterThanOrEqual;I.ge=I.greaterThanOrEqual;I.compare=function(t){if(mt(t)||(t=qt(t)),this.eq(t))return 0;var r=this.isNegative(),n=t.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};I.comp=I.compare;I.negate=function(){return!this.unsigned&&this.eq(Et)?Et:this.not().add(Nr)};I.neg=I.negate;I.add=function(t){mt(t)||(t=qt(t));var r=this.high>>>16,n=this.high&65535,s=this.low>>>16,o=this.low&65535,i=t.high>>>16,a=t.high&65535,c=t.low>>>16,l=t.low&65535,h=0,u=0,f=0,d=0;return d+=o+l,f+=d>>>16,d&=65535,f+=s+c,u+=f>>>16,f&=65535,u+=n+a,h+=u>>>16,u&=65535,h+=r+i,h&=65535,H(f<<16|d,h<<16|u,this.unsigned)};I.subtract=function(t){return mt(t)||(t=qt(t)),this.add(t.neg())};I.sub=I.subtract;I.multiply=function(t){if(this.isZero())return this;if(mt(t)||(t=qt(t)),Ot){var r=Ot.mul(this.low,this.high,t.low,t.high);return H(r,Ot.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?ue:Jt;if(this.eq(Et))return t.isOdd()?Et:Jt;if(t.eq(Et))return this.isOdd()?Et:Jt;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(kp)&&t.lt(kp))return Nt(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,s=this.high&65535,o=this.low>>>16,i=this.low&65535,a=t.high>>>16,c=t.high&65535,l=t.low>>>16,h=t.low&65535,u=0,f=0,d=0,p=0;return p+=i*h,d+=p>>>16,p&=65535,d+=o*h,f+=d>>>16,d&=65535,d+=i*l,f+=d>>>16,d&=65535,f+=s*h,u+=f>>>16,f&=65535,f+=o*l,u+=f>>>16,f&=65535,f+=i*c,u+=f>>>16,f&=65535,u+=n*h+s*l+o*c+i*a,u&=65535,H(d<<16|p,u<<16|f,this.unsigned)};I.mul=I.multiply;I.divide=function(t){if(mt(t)||(t=qt(t)),t.isZero())throw Error("division by zero");if(Ot){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?Ot.div_u:Ot.div_s)(this.low,this.high,t.low,t.high);return H(r,Ot.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?ue:Jt;var n,s,o;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return ue;if(t.gt(this.shru(1)))return qp;o=ue}else{if(this.eq(Et)){if(t.eq(Nr)||t.eq(Dc))return Et;if(t.eq(Et))return Nr;var i=this.shr(1);return n=i.div(t).shl(1),n.eq(Jt)?t.isNegative()?Nr:Dc:(s=this.sub(t.mul(n)),o=n.add(s.div(t)),o)}else if(t.eq(Et))return this.unsigned?ue:Jt;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=Jt}for(s=this;s.gte(t);){n=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),c=a<=48?1:No(2,a-48),l=Nt(n),h=l.mul(t);h.isNegative()||h.gt(s);)n-=c,l=Nt(n,this.unsigned),h=l.mul(t);l.isZero()&&(l=Nr),o=o.add(l),s=s.sub(h)}return o};I.div=I.divide;I.modulo=function(t){if(mt(t)||(t=qt(t)),Ot){var r=(this.unsigned?Ot.rem_u:Ot.rem_s)(this.low,this.high,t.low,t.high);return H(r,Ot.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};I.mod=I.modulo;I.rem=I.modulo;I.not=function(){return H(~this.low,~this.high,this.unsigned)};I.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};I.clz=I.countLeadingZeros;I.countTrailingZeros=function(){return this.low?Up(this.low):Up(this.high)+32};I.ctz=I.countTrailingZeros;I.and=function(t){return mt(t)||(t=qt(t)),H(this.low&t.low,this.high&t.high,this.unsigned)};I.or=function(t){return mt(t)||(t=qt(t)),H(this.low|t.low,this.high|t.high,this.unsigned)};I.xor=function(t){return mt(t)||(t=qt(t)),H(this.low^t.low,this.high^t.high,this.unsigned)};I.shiftLeft=function(t){return mt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?H(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):H(0,this.low<<t-32,this.unsigned)};I.shl=I.shiftLeft;I.shiftRight=function(t){return mt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?H(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):H(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};I.shr=I.shiftRight;I.shiftRightUnsigned=function(t){return mt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?H(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?H(this.high,0,this.unsigned):H(this.high>>>t-32,0,this.unsigned)};I.shru=I.shiftRightUnsigned;I.shr_u=I.shiftRightUnsigned;I.rotateLeft=function(t){var r;return mt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?H(this.high,this.low,this.unsigned):t<32?(r=32-t,H(this.low<<t|this.high>>>r,this.high<<t|this.low>>>r,this.unsigned)):(t-=32,r=32-t,H(this.high<<t|this.low>>>r,this.low<<t|this.high>>>r,this.unsigned))};I.rotl=I.rotateLeft;I.rotateRight=function(t){var r;return mt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?H(this.high,this.low,this.unsigned):t<32?(r=32-t,H(this.high<<r|this.low>>>t,this.low<<r|this.high>>>t,this.unsigned)):(t-=32,r=32-t,H(this.low<<r|this.high>>>t,this.high<<r|this.low>>>t,this.unsigned))};I.rotr=I.rotateRight;I.toSigned=function(){return this.unsigned?H(this.low,this.high,!1):this};I.toUnsigned=function(){return this.unsigned?this:H(this.low,this.high,!0)};I.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};I.toBytesLE=function(){var t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};I.toBytesBE=function(){var t=this.high,r=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,r>>>24,r>>>16&255,r>>>8&255,r&255]};Q.fromBytes=function(t,r,n){return n?Q.fromBytesLE(t,r):Q.fromBytesBE(t,r)};Q.fromBytesLE=function(t,r){return new Q(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)};Q.fromBytesBE=function(t,r){return new Q(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)};var vr=Q;var OB=16;function On(e){e==="X"&&(e="");let t=e.padEnd(OB,"0");return vr.fromString(t,!0,16)}function Uc(e){if(e.isZero())return"X";let t=e.countTrailingZeros(),r=t%4;t=(t-r)/4;let n=t;t*=4;let o=e.shiftRightUnsigned(t).toString(16).replace(/0+$/,"");return Array(17-n-o.length).join("0")+o}function Gc(e,t){let r=NB(e).shiftRightUnsigned(2);return e.add(vr.fromNumber(2*t+1-4).multiply(r))}function NB(e){return e.and(e.not().add(1))}var DB=3,vB=30,UB=2*vB+1,Wp=180/Math.PI;function Kp(e){if(e.length===0)throw new Error(`Invalid Hilbert quad key ${e}`);let t=e.split("/"),r=parseInt(t[0],10),n=t[1],s=n.length,o=0,i=[0,0];for(let a=s-1;a>=0;a--){o=s-a;let c=n[a],l=0,h=0;c==="1"?h=1:c==="2"?(l=1,h=1):c==="3"&&(l=1);let u=Math.pow(2,o-1);GB(u,i,l,h),i[0]+=u*l,i[1]+=u*h}if(r%2===1){let a=i[0];i[0]=i[1],i[1]=a}return{face:r,ij:i,level:o}}function Qp(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<DB+UB;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),s=t.substring(3,r),o=s.length/2,i=vr.fromString(n,!0,2).toString(10),a="";if(o!==0)for(a=vr.fromString(s,!0,2).toString(4);a.length<o;)a="0"+a;return`${i}/${a}`}function Vc(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function Yp(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Hc(e){return[Yp(e[0]),Yp(e[1])]}function zc(e,[t,r]){switch(e){case 0:return[1,t,r];case 1:return[-t,1,r];case 2:return[-t,-r,1];case 3:return[-1,-r,-t];case 4:return[r,-1,-t];case 5:return[r,t,-1];default:throw new Error("Invalid face")}}function kc([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*Wp,n*Wp]}function GB(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let s=t[0];t[0]=t[1],t[1]=s}}function Zp(e){let t=Vc(e.ij,e.level,[.5,.5]),r=Hc(t),n=zc(e.face,r);return kc(n)}var VB=100;function Jc(e){let{face:t,ij:r,level:n}=e,s=[[0,0],[0,1],[1,1],[1,0],[0,0]],o=Math.max(1,Math.ceil(VB*Math.pow(2,-n))),i=new Float64Array(4*o*2+2),a=0,c=0;for(let l=0;l<4;l++){let h=s[l].slice(0),u=s[l+1],f=(u[0]-h[0])/o,d=(u[1]-h[1])/o;for(let p=0;p<o;p++){h[0]+=f,h[1]+=d;let A=Vc(r,n,h),g=Hc(A),y=zc(t,g),E=kc(y);Math.abs(E[1])>89.999&&(E[0]=c);let _=E[0]-c;E[0]+=_>180?-360:_<-180?360:0,i[a++]=E[0],i[a++]=E[1],c=E[0]}}return i[a++]=i[0],i[a++]=i[1],i}function Ur(e){let t=HB(e);return Kp(t)}function HB(e){if(e.indexOf("/")>0)return e;let t=On(e);return Qp(t)}function qc(e){let t=Ur(e);return Zp(t)}function tm(e){let t;if(e.face===2||e.face===5){let r=null,n=0;for(let s=0;s<4;s++){let o=`${e.face}/${s}`,i=Ur(o),a=Jc(i);(typeof r>"u"||r===null)&&(r=new Float64Array(4*a.length)),r.set(a,n),n+=a.length}t=$p(r)}else{let r=Jc(e);t=$p(r)}return t}function $p(e){if(e.length%2!==0)throw new Error("Invalid corners");let t=[],r=[];for(let n=0;n<e.length;n+=2)t.push(e[n]),r.push(e[n+1]);return t.sort((n,s)=>n-s),r.sort((n,s)=>n-s),{west:t[0],east:t[t.length-1],north:r[r.length-1],south:r[0]}}function jc(e,t){let r=t?.minimumHeight||0,n=t?.maximumHeight||0,s=Ur(e),o=tm(s),i=o.west,a=o.south,c=o.east,l=o.north,h=[];return h.push(new x(i,l,r)),h.push(new x(c,l,r)),h.push(new x(c,a,r)),h.push(new x(i,a,r)),h.push(new x(i,l,n)),h.push(new x(c,l,n)),h.push(new x(c,a,n)),h.push(new x(i,a,n)),h}function Do(e){let t=e.token,r={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},n=jc(t,r),s=qc(t),o=s[0],i=s[1],a=U.WGS84.cartographicToCartesian([o,i,r.maximumHeight]),c=new x(a[0],a[1],a[2]);n.push(c);let l=fn(n);return[...l.center,...l.halfAxes]}var zB=4,kB=8,JB={QUADTREE:zB,OCTREE:kB};function qB(e,t,r){if(e?.box){let n=On(e.s2VolumeInfo.token),s=Gc(n,t),o=Uc(s),i={...e.s2VolumeInfo};switch(i.token=o,r){case"OCTREE":let l=e.s2VolumeInfo,h=l.maximumHeight-l.minimumHeight,u=h/2,f=l.minimumHeight+h/2;l.minimumHeight=f-u,l.maximumHeight=f+u;break;default:break}return{box:Do(i),s2VolumeInfo:i}}}async function Wc(e){let{implicitOptions:t,parentData:r={mortonIndex:0,x:0,y:0,z:0},childIndex:n=0,s2VolumeBox:s,loaderOptions:o}=e,{subtree:i,level:a=0,globalData:c={level:0,mortonIndex:0,x:0,y:0,z:0}}=e,{subdivisionScheme:l,subtreeLevels:h,maximumLevel:u,contentUrlTemplate:f,subtreesUriTemplate:d,basePath:p}=t,A={children:[],lodMetricValue:0,contentUrl:""};if(!u)return Nc.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${f} won't be loaded...`),A;let g=a+c.level;if(g>u)return A;let y=JB[l],E=Math.log2(y),_=n&1,B=n>>1&1,S=n>>2&1,M=(y**a-1)/(y-1),w=rr(r.mortonIndex,n,E),C=M+w,T=rr(r.x,_,1),m=rr(r.y,B,1),b=rr(r.z,S,1),L=!1;a>=h&&(L=Xc(i.childSubtreeAvailability,w));let R=rr(c.x,T,a),F=rr(c.y,m,a),v=rr(c.z,b,a);if(L){let Y=`${p}/${d}`,tt=vo(Y,g,R,F,v);i=await(0,em.load)(tt,Fo,o),c={mortonIndex:w,x:T,y:m,z:b,level:a},w=0,C=0,T=0,m=0,b=0,a=0}if(!Xc(i.tileAvailability,C))return A;Xc(i.contentAvailability,C)&&(A.contentUrl=vo(f,g,R,F,v));let Z=a+1,X={mortonIndex:w,x:T,y:m,z:b};for(let Y=0;Y<y;Y++){let tt=qB(s,Y,l),xt=await Wc({subtree:i,implicitOptions:t,loaderOptions:o,parentData:X,childIndex:Y,level:Z,globalData:{...c},s2VolumeBox:tt});if(xt.contentUrl||xt.children.length){let rg=g+1,ng=jB(xt,rg,{childTileX:T,childTileY:m,childTileZ:b},t,s);A.children.push(ng)}}return A}function Xc(e,t){let r;return Array.isArray(e)?(r=e[0],e.length>1&&Nc.once('Not supported extension "3DTILES_multiple_contents" has been detected')):r=e,"constant"in r?Boolean(r.constant):r.explicitBitstream?YB(t,r.explicitBitstream):!1}function jB(e,t,r,n,s){let{basePath:o,refine:i,getRefine:a,lodMetricType:c,getTileType:l,rootLodMetricValue:h,rootBoundingVolume:u}=n,f=e.contentUrl&&e.contentUrl.replace(`${o}/`,""),d=h/2**t,p=s?.box?{box:s.box}:u,A=XB(t,p,r);return{children:e.children,contentUrl:e.contentUrl,content:{uri:f},id:e.contentUrl,refine:a(i),type:l(e),lodMetricType:c,lodMetricValue:d,geometricError:d,transform:e.transform,boundingVolume:A}}function XB(e,t,r){if(t.region){let{childTileX:n,childTileY:s,childTileZ:o}=r,[i,a,c,l,h,u]=t.region,f=2**e,d=(c-i)/f,p=(l-a)/f,A=(u-h)/f,[g,y]=[i+d*n,i+d*(n+1)],[E,_]=[a+p*s,a+p*(s+1)],[B,S]=[h+A*o,h+A*(o+1)];return{region:[g,E,y,_,B,S]}}if(t.box)return t;throw new Error(`Unsupported bounding volume type ${t}`)}function rr(e,t,r){return(e<<r)+t}function vo(e,t,r,n,s){let o=WB({level:t,x:r,y:n,z:s});return e.replace(/{level}|{x}|{y}|{z}/gi,i=>o[i])}function WB(e){let t={};for(let r in e)t[`{${r}}`]=e[r];return t}function YB(e,t){let r=Math.floor(e/8),n=e%8;return(t[r]>>n&1)===1}function Kc(e,t=""){if(!t)return Rt.EMPTY;let n=t.split("?")[0].split(".").pop();switch(n){case"pnts":return Rt.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return Rt.SCENEGRAPH;default:return n||Rt.EMPTY}}function Qc(e){switch(e){case"REPLACE":case"replace":return ft.REPLACE;case"ADD":case"add":return ft.ADD;default:return e}}function Yc(e,t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){let n=new URL(e,`${t}/`);return decodeURI(n.toString())}else if(e.startsWith("/"))return e;return xe.resolve(t,e)}function rm(e,t){if(!e)return null;let r;if(e.content){let s=e.content.uri||e.content?.url;typeof s<"u"&&(r=Yc(s,t))}return{...e,id:r,contentUrl:r,lodMetricType:le.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Kc(e,r),refine:Qc(e.refine)}}async function im(e,t,r){let n=null,s=sm(e.root);s&&e.root?n=await nm(e.root,e,t,s,r):n=rm(e.root,t);let o=[];for(o.push(n);o.length>0;){let i=o.pop()||{},a=i.children||[],c=[];for(let l of a){let h=sm(l),u;h?u=await nm(l,e,t,h,r):u=rm(l,t),u&&(c.push(u),o.push(u))}i.children=c}return n}async function nm(e,t,r,n,s){let{subdivisionScheme:o,maximumLevel:i,availableLevels:a,subtreeLevels:c,subtrees:{uri:l}}=n,h=vo(l,0,0,0,0),u=Yc(h,r),f=await(0,om.load)(u,Fo,s),d=e.content?.uri,p=d?Yc(d,r):"",A=t?.root?.refine,g=e.geometricError,y=e.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];if(y){let S={box:Do(y),s2VolumeInfo:y};e.boundingVolume=S}let E=e.boundingVolume,_={contentUrlTemplate:p,subtreesUriTemplate:l,subdivisionScheme:o,subtreeLevels:c,maximumLevel:Number.isFinite(a)?a-1:i,refine:A,basePath:r,lodMetricType:le.GEOMETRIC_ERROR,rootLodMetricValue:g,rootBoundingVolume:E,getTileType:Kc,getRefine:Qc};return await KB(e,r,f,_,s)}async function KB(e,t,r,n,s){if(!e)return null;let{children:o,contentUrl:i}=await Wc({subtree:r,implicitOptions:n,loaderOptions:s}),a,c=null;return i&&(a=i,c={uri:i.replace(`${t}/`,"")}),{...e,id:a,contentUrl:a,lodMetricType:le.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Kc(e,a),refine:Qc(e.refine),content:c||e.content,children:o}}function sm(e){return e?.extensions?.["3DTILES_implicit_tiling"]||e?.implicitTiling}var Uo={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:co,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:QB,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function QB(e,t={},r){let n=t["3d-tiles"]||{},s;return n.isTileset==="auto"?s=r?.url&&r.url.indexOf(".json")!==-1:s=n.isTileset,s?ZB(e,t,r):$B(e,t,r)}async function ZB(e,t,r){let n=JSON.parse(new TextDecoder().decode(e)),s=r?.url||"",o=tC(s),i=await im(n,o,t||{});return{...n,shape:"tileset3d",loader:Uo,url:s,queryString:r?.queryString||"",basePath:o,root:i||n.root,type:ht.TILES3D,lodMetricType:le.GEOMETRIC_ERROR,lodMetricValue:n.root?.geometricError||0}}async function $B(e,t,r){let n={content:{shape:"tile3d",featureIds:null}};return await Rc(e,0,t,r,n.content),n.content}function tC(e){return xe.dirname(e)}var am=[0],eC={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:Uo,onTilesetLoad:{type:"function",value:e=>{}},onTileLoad:{type:"function",value:e=>{}},onTileUnload:{type:"function",value:e=>{}},onTileError:{type:"function",value:(e,t,r)=>{}},_getMeshColor:{type:"function",value:e=>[255,255,255]}},Go=class extends Le.CompositeLayer{initializeState(){"onTileLoadFail"in this.props&&Le.log.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}}get isLoaded(){return Boolean(this.state?.tileset3d?.isLoaded()&&super.isLoaded)}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({props:t,oldProps:r,changeFlags:n}){if(t.data&&t.data!==r.data&&this._loadTileset(t.data),n.viewportChanged){let{activeViewports:s}=this.state;Object.keys(s).length&&(this._updateTileset(s),this.state.lastUpdatedViewports=s,this.state.activeViewports={})}if(n.propsChanged){let{layerMap:s}=this.state;for(let o in s)s[o].needsUpdate=!0}}activateViewport(t){let{activeViewports:r,lastUpdatedViewports:n}=this.state;this.internalState.viewport=t,r[t.id]=t;let s=n?.[t.id];(!s||!t.equals(s))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:t,sourceLayer:r}){let n=r&&r.props.tile;return t.picked&&(t.object=n),t.sourceTile=n,t}filterSubLayer({layer:t,viewport:r}){let{tile:n}=t.props,{id:s}=r;return n.selected&&n.viewportIds.includes(s)}_updateAutoHighlight(t){let r=t.sourceTile,n=this.state.layerMap[r?.id];n&&n.layer&&n.layer.updateAutoHighlight(t)}async _loadTileset(t){let{loadOptions:r={}}=this.props,n=this.props.loader||this.props.loaders,s=Array.isArray(n)?n[0]:n,o={loadOptions:{...r}},i=t;if(s.preload){let l=await s.preload(t,r);l.url&&(i=l.url),l.headers&&(o.loadOptions.fetch={...o.loadOptions.fetch,headers:l.headers}),Object.assign(o,l)}let a=await(0,um.load)(i,s,o.loadOptions),c=new Bn(a,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,...o});this.setState({tileset3d:c,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(c)}_onTileLoad(t){let{lastUpdatedViewports:r}=this.state;this.props.onTileLoad(t),this._updateTileset(r),this.setNeedsUpdate()}_onTileUnload(t){delete this.state.layerMap[t.id],this.props.onTileUnload(t)}_updateTileset(t){if(!t)return;let{tileset3d:r}=this.state,{timeline:n}=this.context,s=Object.keys(t).length;!n||!s||!r||r.selectTiles(Object.values(t)).then(o=>{this.state.frameNumber!==o&&this.setState({frameNumber:o})})}_getSubLayer(t,r){if(!t.content)return null;switch(t.type){case Rt.POINTCLOUD:return this._makePointCloudLayer(t,r);case Rt.SCENEGRAPH:return this._make3DModelLayer(t);case Rt.MESH:return this._makeSimpleMeshLayer(t,r);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${t.content.type}`)}}_makePointCloudLayer(t,r){let{attributes:n,pointCount:s,constantRGBA:o,cartographicOrigin:i,modelMatrix:a}=t.content,{positions:c,normals:l,colors:h}=n;if(!c)return null;let u=r&&r.props.data||{header:{vertexCount:s},attributes:{POSITION:c,NORMAL:l,COLOR_0:h}},{pointSize:f,getPointColor:d}=this.props,p=this.getSubLayerClass("pointcloud",lm.PointCloudLayer);return new p({pointSize:f},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${t.id}`,tile:t,data:u,coordinateSystem:Le.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:i,modelMatrix:a,getColor:o||d,_offset:0})}_make3DModelLayer(t){let{gltf:r,instances:n,cartographicOrigin:s,modelMatrix:o}=t.content,i=this.getSubLayerClass("scenegraph",hm.ScenegraphLayer);return new i({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${t.id}`,tile:t,data:n||am,scenegraph:r,coordinateSystem:Le.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:s,modelMatrix:o,getTransformMatrix:a=>a.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(t,r){let n=t.content,{attributes:s,indices:o,modelMatrix:i,cartographicOrigin:a,coordinateSystem:c=Le.COORDINATE_SYSTEM.METER_OFFSETS,material:l,featureIds:h}=n,{_getMeshColor:u}=this.props,f=r&&r.props.mesh||new cm.Geometry({topology:"triangle-list",attributes:rC(s),indices:o}),d=this.getSubLayerClass("mesh",Tn);return new d(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${t.id}`,tile:t,mesh:f,data:am,getColor:u(t),pbrMaterial:l,modelMatrix:i,coordinateOrigin:a,coordinateSystem:c,featureIds:h,_offset:0})}renderLayers(){let{tileset3d:t,layerMap:r}=this.state;return t?t.tiles.map(n=>{let s=r[n.id]=r[n.id]||{tile:n},{layer:o}=s;return n.selected&&(o?s.needsUpdate&&(o=this._getSubLayer(n,o),s.needsUpdate=!1):o=this._getSubLayer(n)),s.layer=o,o}).filter(Boolean):null}},Nn=Go;(()=>{Go.defaultProps=eC})(),(()=>{Go.layerName="Tile3DLayer"})();function rC(e){let t={};return t.positions={...e.positions,value:new Float32Array(e.positions.value)},e.normals&&(t.normals=e.normals),e.texCoords&&(t.texCoords=e.texCoords),e.colors&&(t.colors=e.colors),e.uvRegions&&(t.uvRegions=e.uvRegions),t}var qo=D(vt(),1),rl=D(js(),1),xm=D(vt(),1);var nC=new Map([["centerX",Float64Array.BYTES_PER_ELEMENT],["centerY",Float64Array.BYTES_PER_ELEMENT],["centerZ",Float64Array.BYTES_PER_ELEMENT],["minHeight",Float32Array.BYTES_PER_ELEMENT],["maxHeight",Float32Array.BYTES_PER_ELEMENT],["boundingSphereCenterX",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterY",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterZ",Float64Array.BYTES_PER_ELEMENT],["boundingSphereRadius",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointX",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointY",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointZ",Float64Array.BYTES_PER_ELEMENT]]);function Zc(e){return e>>1^-(e&1)}function sC(e){let t=0,r={};for(let[n,s]of nC){let o=s===8?e.getFloat64:e.getFloat32;r[n]=o.call(e,t,!0),t+=s}return{header:r,headerEndPosition:t}}function oC(e,t){let r=t,n=3,s=e.getUint32(r,!0),o=new Uint16Array(s*n);r+=Uint32Array.BYTES_PER_ELEMENT;let i=Uint16Array.BYTES_PER_ELEMENT,a=s*i,c=r,l=c+a,h=l+a,u=0,f=0,d=0;for(let p=0;p<s;p++)u+=Zc(e.getUint16(c+i*p,!0)),f+=Zc(e.getUint16(l+i*p,!0)),d+=Zc(e.getUint16(h+i*p,!0)),o[p]=u,o[p+s]=f,o[p+s*2]=d;return r+=a*3,{vertexData:o,vertexDataEndPosition:r}}function Dn(e,t,r,n,s=!0){let o;if(n===2?o=new Uint16Array(e,t,r):o=new Uint32Array(e,t,r),!s)return o;let i=0;for(let a=0;a<o.length;++a){let c=o[a];o[a]=i-c,c===0&&++i}return o}function iC(e,t,r){let n=r,s=3,i=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;n%i!==0&&(n+=i-n%i);let a=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let c=a*3,l=Dn(e.buffer,n,c,i);return n+=c*i,{triangleIndicesEndPosition:n,triangleIndices:l}}function aC(e,t,r){let n=r,s=3,i=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,a=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let c=Dn(e.buffer,n,a,i,!1);n+=a*i;let l=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let h=Dn(e.buffer,n,l,i,!1);n+=l*i;let u=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let f=Dn(e.buffer,n,u,i,!1);n+=u*i;let d=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let p=Dn(e.buffer,n,d,i,!1);return n+=d*i,{edgeIndicesEndPosition:n,westIndices:c,southIndices:h,eastIndices:f,northIndices:p}}function cC(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function lC(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function hC(e,t){let r={};if(e.byteLength<=t)return{extensions:r,extensionsEndPosition:t};let n=t;for(;n<e.byteLength;){let s=e.getUint8(n,!0);n+=Uint8Array.BYTES_PER_ELEMENT;let o=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let i=new DataView(e.buffer,n,o);switch(s){case 1:{r.vertexNormals=cC(i);break}case 2:{r.waterMask=lC(i);break}default:}n+=o}return{extensions:r,extensionsEndPosition:n}}var nr={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},uC={maxDecodingStep:nr.extensions};function $c(e,t){let r=Object.assign({},uC,t),n=new DataView(e),{header:s,headerEndPosition:o}=sC(n);if(r.maxDecodingStep<nr.vertices)return{header:s};let{vertexData:i,vertexDataEndPosition:a}=oC(n,o);if(r.maxDecodingStep<nr.triangleIndices)return{header:s,vertexData:i};let{triangleIndices:c,triangleIndicesEndPosition:l}=iC(n,i,a);if(r.maxDecodingStep<nr.edgeIndices)return{header:s,vertexData:i,triangleIndices:c};let{westIndices:h,southIndices:u,eastIndices:f,northIndices:d,edgeIndicesEndPosition:p}=aC(n,i,l);if(r.maxDecodingStep<nr.extensions)return{header:s,vertexData:i,triangleIndices:c,westIndices:h,northIndices:d,eastIndices:f,southIndices:u};let{extensions:A}=hC(n,p);return{header:s,vertexData:i,triangleIndices:c,westIndices:h,northIndices:d,eastIndices:f,southIndices:u,extensions:A}}function Vo(e,t,r,n){let s=n?dC(n,e.POSITION.value):fC(t),o=new e.POSITION.value.constructor(s.length*6),i=new e.TEXCOORD_0.value.constructor(s.length*4),a=new t.constructor(s.length*6);for(let l=0;l<s.length;l++){let h=s[l];pC({edge:h,edgeIndex:l,attributes:e,skirtHeight:r,newPosition:o,newTexcoord0:i,newTriangles:a})}e.POSITION.value=qr(e.POSITION.value,o),e.TEXCOORD_0.value=qr(e.TEXCOORD_0.value,i);let c=t instanceof Array?t.concat(a):qr(t,a);return{attributes:e,triangles:c}}function fC(e){let t=[];for(let s=0;s<e.length;s+=3)t.push([e[s],e[s+1]]),t.push([e[s+1],e[s+2]]),t.push([e[s+2],e[s]]);t.sort((s,o)=>Math.min(...s)-Math.min(...o)||Math.max(...s)-Math.max(...o));let r=[],n=0;for(;n<t.length;)t[n][0]===t[n+1]?.[1]&&t[n][1]===t[n+1]?.[0]?n+=2:(r.push(t[n]),n++);return r}function dC(e,t){e.westIndices.sort((n,s)=>t[3*n+1]-t[3*s+1]),e.eastIndices.sort((n,s)=>t[3*s+1]-t[3*n+1]),e.southIndices.sort((n,s)=>t[3*s]-t[3*n]),e.northIndices.sort((n,s)=>t[3*n]-t[3*s]);let r=[];for(let n in e){let s=e[n];for(let o=0;o<s.length-1;o++)r.push([s[o],s[o+1]])}return r}function pC({edge:e,edgeIndex:t,attributes:r,skirtHeight:n,newPosition:s,newTexcoord0:o,newTriangles:i}){let a=r.POSITION.value.length,c=t*2,l=t*2+1;s.set(r.POSITION.value.subarray(e[0]*3,e[0]*3+3),c*3),s[c*3+2]=s[c*3+2]-n,s.set(r.POSITION.value.subarray(e[1]*3,e[1]*3+3),l*3),s[l*3+2]=s[l*3+2]-n,o.set(r.TEXCOORD_0.value.subarray(e[0]*2,e[0]*2+2),c*2),o.set(r.TEXCOORD_0.value.subarray(e[1]*2,e[1]*2+2),l*2);let h=t*2*3;i[h]=e[0],i[h+1]=a/3+l,i[h+2]=e[1],i[h+3]=a/3+l,i[h+4]=e[0],i[h+5]=a/3+c}function tl(e,t={}){let{bounds:r}=t,{header:n,vertexData:s,triangleIndices:o,westIndices:i,northIndices:a,eastIndices:c,southIndices:l}=$c(e,nr.triangleIndices),h=o,u=mC(s,n,r),f=We(u);if(t?.skirtHeight){let{attributes:d,triangles:p}=Vo(u,h,t.skirtHeight,{westIndices:i,northIndices:a,eastIndices:c,southIndices:l});u=d,h=p}return{loaderData:{header:{}},header:{vertexCount:h.length,boundingBox:f},schema:void 0,topology:"triangle-list",mode:4,indices:{value:h,size:1},attributes:u}}function mC(e,t,r){let{minHeight:n,maxHeight:s}=t,[o,i,a,c]=r||[0,0,1,1],l=a-o,h=c-i,u=s-n,f=e.length/3,d=new Float32Array(f*3),p=new Float32Array(f*2);for(let A=0;A<f;A++){let g=e[A]/32767,y=e[A+f]/32767,E=e[A+f*2]/32767;d[3*A+0]=g*l+o,d[3*A+1]=y*h+i,d[3*A+2]=E*u+n,p[2*A+0]=g,p[2*A+1]=y}return{POSITION:{value:d,size:3},TEXCOORD_0:{value:p,size:2}}}var vn=class{constructor(t=257){this.gridSize=t;let r=t-1;if(r&r-1)throw new Error(`Expected grid size to be 2^n+1, got ${t}.`);this.numTriangles=r*r*2-2,this.numParentTriangles=this.numTriangles-r*r,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let n=0;n<this.numTriangles;n++){let s=n+2,o=0,i=0,a=0,c=0,l=0,h=0;for(s&1?a=c=l=r:o=i=h=r;(s>>=1)>1;){let f=o+a>>1,d=i+c>>1;s&1?(a=o,c=i,o=l,i=h):(o=a,i=c,a=l,c=h),l=f,h=d}let u=n*4;this.coords[u+0]=o,this.coords[u+1]=i,this.coords[u+2]=a,this.coords[u+3]=c}}createTile(t){return new el(t,this)}},el=class{constructor(t,r){let n=r.gridSize;if(t.length!==n*n)throw new Error(`Expected terrain data of length ${n*n} (${n} x ${n}), got ${t.length}.`);this.terrain=t,this.martini=r,this.errors=new Float32Array(t.length),this.update()}update(){let{numTriangles:t,numParentTriangles:r,coords:n,gridSize:s}=this.martini,{terrain:o,errors:i}=this;for(let a=t-1;a>=0;a--){let c=a*4,l=n[c+0],h=n[c+1],u=n[c+2],f=n[c+3],d=l+u>>1,p=h+f>>1,A=d+p-h,g=p+l-d,y=(o[h*s+l]+o[f*s+u])/2,E=p*s+d,_=Math.abs(y-o[E]);if(i[E]=Math.max(i[E],_),a<r){let B=(h+g>>1)*s+(l+A>>1),S=(f+g>>1)*s+(u+A>>1);i[E]=Math.max(i[E],i[B],i[S])}}}getMesh(t=0){let{gridSize:r,indices:n}=this.martini,{errors:s}=this,o=0,i=0,a=r-1;n.fill(0);function c(d,p,A,g,y,E){let _=d+A>>1,B=p+g>>1;Math.abs(d-y)+Math.abs(p-E)>1&&s[B*r+_]>t?(c(y,E,d,p,_,B),c(A,g,y,E,_,B)):(n[p*r+d]=n[p*r+d]||++o,n[g*r+A]=n[g*r+A]||++o,n[E*r+y]=n[E*r+y]||++o,i++)}c(0,0,a,a,a,0),c(a,a,0,0,0,a);let l=new Uint16Array(o*2),h=new Uint32Array(i*3),u=0;function f(d,p,A,g,y,E){let _=d+A>>1,B=p+g>>1;if(Math.abs(d-y)+Math.abs(p-E)>1&&s[B*r+_]>t)f(y,E,d,p,_,B),f(A,g,y,E,_,B);else{let S=n[p*r+d]-1,M=n[g*r+A]-1,w=n[E*r+y]-1;l[2*S]=d,l[2*S+1]=p,l[2*M]=A,l[2*M+1]=g,l[2*w]=y,l[2*w+1]=E,h[u++]=S,h[u++]=M,h[u++]=w}}return f(0,0,a,a,a,0),f(a,a,0,0,0,a),{vertices:l,triangles:h}}};var Un=class{constructor(t,r,n=r){this.data=t,this.width=r,this.height=n,this.coords=[],this.triangles=[],this._halfedges=[],this._candidates=[],this._queueIndices=[],this._queue=[],this._errors=[],this._rms=[],this._pending=[],this._pendingLen=0,this._rmsSum=0;let s=r-1,o=n-1,i=this._addPoint(0,0),a=this._addPoint(s,0),c=this._addPoint(0,o),l=this._addPoint(s,o),h=this._addTriangle(l,i,c,-1,-1,-1);this._addTriangle(i,l,a,h,-1,-1),this._flush()}run(t=1){for(;this.getMaxError()>t;)this.refine()}refine(){this._step(),this._flush()}getMaxError(){return this._errors[0]}getRMSD(){return this._rmsSum>0?Math.sqrt(this._rmsSum/(this.width*this.height)):0}heightAt(t,r){return this.data[this.width*r+t]}_flush(){let t=this.coords;for(let r=0;r<this._pendingLen;r++){let n=this._pending[r],s=2*this.triangles[n*3+0],o=2*this.triangles[n*3+1],i=2*this.triangles[n*3+2];this._findCandidate(t[s],t[s+1],t[o],t[o+1],t[i],t[i+1],n)}this._pendingLen=0}_findCandidate(t,r,n,s,o,i,a){let c=Math.min(t,n,o),l=Math.min(r,s,i),h=Math.max(t,n,o),u=Math.max(r,s,i),f=sr(n,s,o,i,c,l),d=sr(o,i,t,r,c,l),p=sr(t,r,n,s,c,l),A=s-r,g=t-n,y=i-s,E=n-o,_=r-i,B=o-t,S=sr(t,r,n,s,o,i),M=this.heightAt(t,r)/S,w=this.heightAt(n,s)/S,C=this.heightAt(o,i)/S,T=0,m=0,b=0,L=0;for(let R=l;R<=u;R++){let F=0;f<0&&y!==0&&(F=Math.max(F,Math.floor(-f/y))),d<0&&_!==0&&(F=Math.max(F,Math.floor(-d/_))),p<0&&A!==0&&(F=Math.max(F,Math.floor(-p/A)));let v=f+y*F,W=d+_*F,z=p+A*F,Z=!1;for(let X=c+F;X<=h;X++){if(v>=0&&W>=0&&z>=0){Z=!0;let Y=M*v+w*W+C*z,tt=Math.abs(Y-this.heightAt(X,R));L+=tt*tt,tt>T&&(T=tt,m=X,b=R)}else if(Z)break;v+=y,W+=_,z+=A}f+=E,d+=B,p+=g}(m===t&&b===r||m===n&&b===s||m===o&&b===i)&&(T=0),this._candidates[2*a]=m,this._candidates[2*a+1]=b,this._rms[a]=L,this._queuePush(a,T,L)}_step(){let t=this._queuePop(),r=t*3+0,n=t*3+1,s=t*3+2,o=this.triangles[r],i=this.triangles[n],a=this.triangles[s],c=this.coords[2*o],l=this.coords[2*o+1],h=this.coords[2*i],u=this.coords[2*i+1],f=this.coords[2*a],d=this.coords[2*a+1],p=this._candidates[2*t],A=this._candidates[2*t+1],g=this._addPoint(p,A);if(sr(c,l,h,u,p,A)===0)this._handleCollinear(g,r);else if(sr(h,u,f,d,p,A)===0)this._handleCollinear(g,n);else if(sr(f,d,c,l,p,A)===0)this._handleCollinear(g,s);else{let y=this._halfedges[r],E=this._halfedges[n],_=this._halfedges[s],B=this._addTriangle(o,i,g,y,-1,-1,r),S=this._addTriangle(i,a,g,E,-1,B+1),M=this._addTriangle(a,o,g,_,B+2,S+1);this._legalize(B),this._legalize(S),this._legalize(M)}}_addPoint(t,r){let n=this.coords.length>>1;return this.coords.push(t,r),n}_addTriangle(t,r,n,s,o,i,a=this.triangles.length){let c=a/3;return this.triangles[a+0]=t,this.triangles[a+1]=r,this.triangles[a+2]=n,this._halfedges[a+0]=s,this._halfedges[a+1]=o,this._halfedges[a+2]=i,s>=0&&(this._halfedges[s]=a+0),o>=0&&(this._halfedges[o]=a+1),i>=0&&(this._halfedges[i]=a+2),this._candidates[2*c+0]=0,this._candidates[2*c+1]=0,this._queueIndices[c]=-1,this._rms[c]=0,this._pending[this._pendingLen++]=c,a}_legalize(t){let r=this._halfedges[t];if(r<0)return;let n=t-t%3,s=r-r%3,o=n+(t+1)%3,i=n+(t+2)%3,a=s+(r+2)%3,c=s+(r+1)%3,l=this.triangles[i],h=this.triangles[t],u=this.triangles[o],f=this.triangles[a],d=this.coords;if(!gC(d[2*l],d[2*l+1],d[2*h],d[2*h+1],d[2*u],d[2*u+1],d[2*f],d[2*f+1]))return;let p=this._halfedges[o],A=this._halfedges[i],g=this._halfedges[a],y=this._halfedges[c];this._queueRemove(n/3),this._queueRemove(s/3);let E=this._addTriangle(l,f,u,-1,g,p,n),_=this._addTriangle(f,l,h,E,A,y,s);this._legalize(E+1),this._legalize(_+2)}_handleCollinear(t,r){let n=r-r%3,s=n+(r+1)%3,o=n+(r+2)%3,i=this.triangles[o],a=this.triangles[r],c=this.triangles[s],l=this._halfedges[s],h=this._halfedges[o],u=this._halfedges[r];if(u<0){let M=this._addTriangle(t,i,a,-1,h,-1,n),w=this._addTriangle(i,t,c,M,-1,l);this._legalize(M+1),this._legalize(w+2);return}let f=u-u%3,d=f+(u+2)%3,p=f+(u+1)%3,A=this.triangles[d],g=this._halfedges[d],y=this._halfedges[p];this._queueRemove(f/3);let E=this._addTriangle(i,a,t,h,-1,-1,n),_=this._addTriangle(a,A,t,y,-1,E+1,f),B=this._addTriangle(A,c,t,g,-1,_+1),S=this._addTriangle(c,i,t,l,E+2,B+1);this._legalize(E),this._legalize(_),this._legalize(B),this._legalize(S)}_queuePush(t,r,n){let s=this._queue.length;this._queueIndices[t]=s,this._queue.push(t),this._errors.push(r),this._rmsSum+=n,this._queueUp(s)}_queuePop(){let t=this._queue.length-1;return this._queueSwap(0,t),this._queueDown(0,t),this._queuePopBack()}_queuePopBack(){let t=this._queue.pop();return this._errors.pop(),this._rmsSum-=this._rms[t],this._queueIndices[t]=-1,t}_queueRemove(t){let r=this._queueIndices[t];if(r<0){let s=this._pending.indexOf(t);if(s!==-1)this._pending[s]=this._pending[--this._pendingLen];else throw new Error("Broken triangulation (something went wrong).");return}let n=this._queue.length-1;n!==r&&(this._queueSwap(r,n),this._queueDown(r,n)||this._queueUp(r)),this._queuePopBack()}_queueLess(t,r){return this._errors[t]>this._errors[r]}_queueSwap(t,r){let n=this._queue[t],s=this._queue[r];this._queue[t]=s,this._queue[r]=n,this._queueIndices[n]=r,this._queueIndices[s]=t;let o=this._errors[t];this._errors[t]=this._errors[r],this._errors[r]=o}_queueUp(t){let r=t;for(;;){let n=r-1>>1;if(n===r||!this._queueLess(r,n))break;this._queueSwap(n,r),r=n}}_queueDown(t,r){let n=t;for(;;){let s=2*n+1;if(s>=r||s<0)break;let o=s+1,i=s;if(o<r&&this._queueLess(o,s)&&(i=o),!this._queueLess(i,n))break;this._queueSwap(n,i),n=i}return n>t}};function sr(e,t,r,n,s,o){return(r-s)*(t-o)-(n-o)*(e-s)}function gC(e,t,r,n,s,o,i,a){let c=e-i,l=t-a,h=r-i,u=n-a,f=s-i,d=o-a,p=c*c+l*l,A=h*h+u*u,g=f*f+d*d;return c*(u*g-A*d)-l*(h*g-A*f)+p*(h*d-u*f)<0}function pm(e,t){let{meshMaxError:r,bounds:n,elevationDecoder:s}=t,{data:o,width:i,height:a}=e,c,l;switch(t.tesselator){case"martini":c=Ho(o,i,a,s,t.tesselator),l=fm(r,i,c);break;case"delatin":c=Ho(o,i,a,s,t.tesselator),l=dm(r,i,a,c);break;default:i===a&&!(a&i-1)?(c=Ho(o,i,a,s,"martini"),l=fm(r,i,c)):(c=Ho(o,i,a,s,"delatin"),l=dm(r,i,a,c));break}let{vertices:h}=l,{triangles:u}=l,f=AC(h,c,i,a,n),d=We(f);if(t.skirtHeight){let{attributes:p,triangles:A}=Vo(f,u,t.skirtHeight);f=p,u=A}return{loaderData:{header:{}},header:{vertexCount:u.length,boundingBox:d},mode:4,indices:{value:Uint32Array.from(u),size:1},attributes:f}}function fm(e,t,r){let n=t+1,o=new vn(n).createTile(r),{vertices:i,triangles:a}=o.getMesh(e);return{vertices:i,triangles:a}}function dm(e,t,r,n){let s=new Un(n,t+1,r+1);s.run(e);let{coords:o,triangles:i}=s;return{vertices:o,triangles:i}}function Ho(e,t,r,n,s){let{rScaler:o,bScaler:i,gScaler:a,offset:c}=n,l=new Float32Array((t+1)*(r+1));for(let h=0,u=0;u<r;u++)for(let f=0;f<t;f++,h++){let d=h*4,p=e[d+0],A=e[d+1],g=e[d+2];l[h+u]=p*o+A*a+g*i+c}if(s==="martini"){for(let h=(t+1)*t,u=0;u<t;u++,h++)l[h]=l[h-t-1];for(let h=r,u=0;u<r+1;u++,h+=r+1)l[h]=l[h-1]}return l}function AC(e,t,r,n,s){let o=r+1,i=e.length/2,a=new Float32Array(i*3),c=new Float32Array(i*2),[l,h,u,f]=s||[0,0,r,n],d=(u-l)/r,p=(f-h)/n;for(let A=0;A<i;A++){let g=e[A*2],y=e[A*2+1],E=y*o+g;a[3*A+0]=g*d+l,a[3*A+1]=-y*p+f,a[3*A+2]=t[E],c[2*A+0]=g/r,c[2*A+1]=y/n}return{POSITION:{value:a,size:3},TEXCOORD_0:{value:c,size:2}}}var zo="4.2.0-alpha.4";var ko={name:"Terrain",id:"terrain",module:"terrain",version:zo,worker:!0,extensions:["png","pngraw","jpg","jpeg","gif","webp","bmp"],mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp"],options:{terrain:{tesselator:"auto",bounds:void 0,meshMaxError:10,elevationDecoder:{rScaler:1,gScaler:0,bScaler:0,offset:0},skirtHeight:void 0}}};var mm={name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:zo,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var xC={...ko,parse:yC};async function yC(e,t,r){let n={...t,mimeType:"application/x.image",image:{...t?.image,type:"data"}},s=await Bt(e,[],n,r),o={...xC.options.terrain,...t?.terrain};return pm(s,o)}var qG={...mm,parseSync:(e,t)=>tl(e,t?.["quantized-mesh"]),parse:async(e,t)=>tl(e,t?.["quantized-mesh"])};var gm=[1],TC={...te.defaultProps,elevationData:be,texture:{...be,optional:!0},meshMaxError:{type:"number",value:4},bounds:{type:"array",value:null,optional:!0,compare:!0},color:{type:"color",value:[255,255,255]},elevationDecoder:{type:"object",value:{rScaler:1,gScaler:0,bScaler:0,offset:0}},workerUrl:"",wireframe:!1,material:!0,loaders:[ko]};function Am(e){return Array.isArray(e)?e.join(";"):e||""}var Jo=class extends qo.CompositeLayer{updateState({props:t,oldProps:r}){let n=t.elevationData!==r.elevationData;if(n){let{elevationData:o}=t,i=o&&(Array.isArray(o)||o.includes("{x}")&&o.includes("{y}"));this.setState({isTiled:i})}let s=n||t.meshMaxError!==r.meshMaxError||t.elevationDecoder!==r.elevationDecoder||t.bounds!==r.bounds;if(!this.state.isTiled&&s){let o=this.loadTerrain(t);this.setState({terrain:o})}t.workerUrl&&qo.log.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain({elevationData:t,bounds:r,elevationDecoder:n,meshMaxError:s,signal:o}){if(!t)return null;let i=this.getLoadOptions();i={...i,terrain:{skirtHeight:this.state.isTiled?s*2:0,...i?.terrain,bounds:r,meshMaxError:s,elevationDecoder:n}};let{fetch:a}=this.props;return a(t,{propName:"elevationData",layer:this,loadOptions:i,signal:o})}getTiledTerrainData(t){let{elevationData:r,fetch:n,texture:s,elevationDecoder:o,meshMaxError:i}=this.props,{viewport:a}=this.context,c=$t(r,t),l=s&&$t(s,t),{signal:h}=t,u=[0,0],f=[0,0];if(a.isGeospatial){let g=t.bbox;u=a.projectFlat([g.west,g.south]),f=a.projectFlat([g.east,g.north])}else{let g=t.bbox;u=[g.left,g.bottom],f=[g.right,g.top]}let d=[u[0],u[1],f[0],f[1]],p=this.loadTerrain({elevationData:c,bounds:d,elevationDecoder:o,meshMaxError:i,signal:h}),A=l?n(l,{propName:"texture",layer:this,loaders:[],signal:h}).catch(g=>null):Promise.resolve(null);return Promise.all([p,A])}renderSubLayers(t){let r=this.getSubLayerClass("mesh",rl.SimpleMeshLayer),{color:n,wireframe:s,material:o}=this.props,{data:i}=t;if(!i)return null;let[a,c]=i;return new r(t,{data:gm,mesh:a,texture:c,_instanced:!1,coordinateSystem:xm.COORDINATE_SYSTEM.CARTESIAN,getPosition:l=>[0,0,0],getColor:n,wireframe:s,material:o})}onViewportLoad(t){if(!t)return;let{zRange:r}=this.state,n=t.map(i=>i.content).filter(Boolean).map(i=>i[0].header.boundingBox.map(c=>c[2]));if(n.length===0)return;let s=Math.min(...n.map(i=>i[0])),o=Math.max(...n.map(i=>i[1]));(!r||s<r[0]||o>r[1])&&this.setState({zRange:[s,o]})}renderLayers(){let{color:t,material:r,elevationData:n,texture:s,wireframe:o,meshMaxError:i,elevationDecoder:a,tileSize:c,maxZoom:l,minZoom:h,extent:u,maxRequests:f,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:g,maxCacheByteSize:y,refinementStrategy:E}=this.props;if(this.state.isTiled)return new te(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:Am(n),texture:Am(s),meshMaxError:i,elevationDecoder:a}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:c,maxZoom:l,minZoom:h,extent:u,maxRequests:f,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:g,maxCacheByteSize:y,refinementStrategy:E});if(!n)return null;let _=this.getSubLayerClass("mesh",rl.SimpleMeshLayer);return new _(this.getSubLayerProps({id:"mesh"}),{data:gm,mesh:this.state.terrain,texture:s,_instanced:!1,getPosition:B=>[0,0,0],getColor:t,material:r,wireframe:o})}},Gn=Jo;(()=>{Jo.defaultProps=TC})(),(()=>{Jo.layerName="TerrainLayer"})();var si=D(vt(),1),Tl=D(Dt(),1),Zm=D(Tm(),1);var Vn={x:0,y:1,z:2};function or(e,t={}){let{start:r=0,end:n=e.length,plane:s="xy"}=t,o=t.size||2,i=0,a=Vn[s[0]],c=Vn[s[1]];for(let l=r,h=n-o;l<n;l+=o)i+=(e[l+a]-e[h+a])*(e[l+c]+e[h+c]),h=l;return i/2}function sl(e,t,r=2,n,s="xy"){let o=t&&t.length,i=o?t[0]*r:e.length,a=Em(e,0,i,r,!0,n&&n[0],s),c=[];if(!a||a.next===a.prev)return c;let l,h,u,f,d,p,A;if(o&&(a=bC(e,t,a,r,n,s)),e.length>80*r){f=h=e[0],d=u=e[1];for(let g=r;g<i;g+=r)p=e[g],A=e[g+1],p<f&&(f=p),A<d&&(d=A),p>h&&(h=p),A>u&&(u=A);l=Math.max(h-f,u-d),l=l!==0?32767/l:0}return Hn(a,c,r,f,d,l,0),c}function Em(e,t,r,n,s,o,i){let a,c;o===void 0&&(o=or(e,{start:t,end:r,size:n,plane:i}));let l=Vn[i[0]],h=Vn[i[1]];if(s===o<0)for(a=t;a<r;a+=n)c=_m(a,e[a+l],e[a+h],c);else for(a=r-n;a>=t;a-=n)c=_m(a,e[a+l],e[a+h],c);return c&&Wo(c,c.next)&&(kn(c),c=c.next),c}function ir(e,t){if(!e)return e;t||(t=e);let r=e,n;do if(n=!1,!r.steiner&&(Wo(r,r.next)||rt(r.prev,r,r.next)===0)){if(kn(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function Hn(e,t,r,n,s,o,i){if(!e)return;!i&&o&&RC(e,n,s,o);let a=e,c,l;for(;e.prev!==e.next;){if(c=e.prev,l=e.next,o?CC(e,n,s,o):BC(e)){t.push(c.i/r|0),t.push(e.i/r|0),t.push(l.i/r|0),kn(e),e=l.next,a=l.next;continue}if(e=l,e===a){i?i===1?(e=SC(ir(e),t,r),Hn(e,t,r,n,s,o,2)):i===2&&MC(e,t,r,n,s,o):Hn(ir(e),t,r,n,s,o,1);break}}}function BC(e){let t=e.prev,r=e,n=e.next;if(rt(t,r,n)>=0)return!1;let s=t.x,o=r.x,i=n.x,a=t.y,c=r.y,l=n.y,h=s<o?s<i?s:i:o<i?o:i,u=a<c?a<l?a:l:c<l?c:l,f=s>o?s>i?s:i:o>i?o:i,d=a>c?a>l?a:l:c>l?c:l,p=n.next;for(;p!==t;){if(p.x>=h&&p.x<=f&&p.y>=u&&p.y<=d&&Gr(s,a,o,c,i,l,p.x,p.y)&&rt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function CC(e,t,r,n){let s=e.prev,o=e,i=e.next;if(rt(s,o,i)>=0)return!1;let a=s.x,c=o.x,l=i.x,h=s.y,u=o.y,f=i.y,d=a<c?a<l?a:l:c<l?c:l,p=h<u?h<f?h:f:u<f?u:f,A=a>c?a>l?a:l:c>l?c:l,g=h>u?h>f?h:f:u>f?u:f,y=nl(d,p,t,r,n),E=nl(A,g,t,r,n),_=e.prevZ,B=e.nextZ;for(;_&&_.z>=y&&B&&B.z<=E;){if(_.x>=d&&_.x<=A&&_.y>=p&&_.y<=g&&_!==s&&_!==i&&Gr(a,h,c,u,l,f,_.x,_.y)&&rt(_.prev,_,_.next)>=0||(_=_.prevZ,B.x>=d&&B.x<=A&&B.y>=p&&B.y<=g&&B!==s&&B!==i&&Gr(a,h,c,u,l,f,B.x,B.y)&&rt(B.prev,B,B.next)>=0))return!1;B=B.nextZ}for(;_&&_.z>=y;){if(_.x>=d&&_.x<=A&&_.y>=p&&_.y<=g&&_!==s&&_!==i&&Gr(a,h,c,u,l,f,_.x,_.y)&&rt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;B&&B.z<=E;){if(B.x>=d&&B.x<=A&&B.y>=p&&B.y<=g&&B!==s&&B!==i&&Gr(a,h,c,u,l,f,B.x,B.y)&&rt(B.prev,B,B.next)>=0)return!1;B=B.nextZ}return!0}function SC(e,t,r){let n=e;do{let s=n.prev,o=n.next.next;!Wo(s,o)&&Bm(s,n,n.next,o)&&zn(s,o)&&zn(o,s)&&(t.push(s.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),kn(n),kn(n.next),n=e=o),n=n.next}while(n!==e);return ir(n)}function MC(e,t,r,n,s,o){let i=e;do{let a=i.next.next;for(;a!==i.prev;){if(i.i!==a.i&&NC(i,a)){let c=Cm(i,a);i=ir(i,i.next),c=ir(c,c.next),Hn(i,t,r,n,s,o,0),Hn(c,t,r,n,s,o,0);return}a=a.next}i=i.next}while(i!==e)}function bC(e,t,r,n,s,o){let i=[],a,c,l,h,u;for(a=0,c=t.length;a<c;a++)l=t[a]*n,h=a<c-1?t[a+1]*n:e.length,u=Em(e,l,h,n,!1,s&&s[a+1],o),u===u.next&&(u.steiner=!0),i.push(OC(u));for(i.sort(IC),a=0;a<i.length;a++)r=wC(i[a],r);return r}function IC(e,t){return e.x-t.x}function wC(e,t){let r=FC(e,t);if(!r)return t;let n=Cm(r,e);return ir(n,n.next),ir(r,r.next)}function FC(e,t){let r=t,n=e.x,s=e.y,o=-1/0,i;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){let f=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(f<=n&&f>o&&(o=f,i=r.x<r.next.x?r:r.next,f===n))return i}r=r.next}while(r!==t);if(!i)return null;let a=i,c=i.x,l=i.y,h=1/0,u;r=i;do n>=r.x&&r.x>=c&&n!==r.x&&Gr(s<l?n:o,s,c,l,s<l?o:n,s,r.x,r.y)&&(u=Math.abs(s-r.y)/(n-r.x),zn(r,e)&&(u<h||u===h&&(r.x>i.x||r.x===i.x&&LC(i,r)))&&(i=r,h=u)),r=r.next;while(r!==a);return i}function LC(e,t){return rt(e.prev,e,t.prev)<0&&rt(t.next,e,e.next)<0}function RC(e,t,r,n){let s=e;do s.z===0&&(s.z=nl(s.x,s.y,t,r,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,PC(s)}function PC(e){let t,r,n=1,s,o,i,a,c,l;do{for(o=e,e=null,l=null,s=0;o;){for(s++,a=o,i=0,r=0;r<n&&(i++,a=a.nextZ,!!a);r++);for(c=n;i>0||c>0&&a;)i!==0&&(c===0||!a||o.z<=a.z)?(t=o,o=o.nextZ,i--):(t=a,a=a.nextZ,c--),l?l.nextZ=t:e=t,t.prevZ=l,l=t;o=a}l.nextZ=null,n*=2}while(s>1);return e}function nl(e,t,r,n,s){return e=(e-r)*s|0,t=(t-n)*s|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function OC(e){let t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function Gr(e,t,r,n,s,o,i,a){return(s-i)*(t-a)>=(e-i)*(o-a)&&(e-i)*(n-a)>=(r-i)*(t-a)&&(r-i)*(o-a)>=(s-i)*(n-a)}function NC(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!DC(e,t)&&(zn(e,t)&&zn(t,e)&&vC(e,t)&&(rt(e.prev,e,t.prev)||rt(e,t.prev,t))||Wo(e,t)&&rt(e.prev,e,e.next)>0&&rt(t.prev,t,t.next)>0)}function rt(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Wo(e,t){return e.x===t.x&&e.y===t.y}function Bm(e,t,r,n){let s=Xo(rt(e,t,r)),o=Xo(rt(e,t,n)),i=Xo(rt(r,n,e)),a=Xo(rt(r,n,t));return!!(s!==o&&i!==a||s===0&&jo(e,r,t)||o===0&&jo(e,n,t)||i===0&&jo(r,e,n)||a===0&&jo(r,t,n))}function jo(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Xo(e){return e>0?1:e<0?-1:0}function DC(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&Bm(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function zn(e,t){return rt(e.prev,e,e.next)<0?rt(e,t,e.next)>=0&&rt(e,e.prev,t)>=0:rt(e,t,e.prev)<0||rt(e,e.next,t)<0}function vC(e,t){let r=e,n=!1,s=(e.x+t.x)/2,o=(e.y+t.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&s<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function Cm(e,t){let r=new Jn(e.i,e.x,e.y),n=new Jn(t.i,t.x,t.y),s=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=s,s.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function _m(e,t,r,n){let s=new Jn(e,t,r);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function kn(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}var Jn=class{constructor(t,r,n){P(this,"i",void 0),P(this,"x",void 0),P(this,"y",void 0),P(this,"prev",null),P(this,"next",null),P(this,"z",0),P(this,"prevZ",null),P(this,"nextZ",null),P(this,"steiner",!1),this.i=t,this.x=r,this.y=n}};function al(e,t,r){let n=zC(e),s=Object.keys(n).filter(o=>n[o]!==Array);return kC(e,{propArrayTypes:n,...t},{numericPropKeys:r&&r.numericPropKeys||s,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function zC(e){let t={};for(let r of e)if(r.properties)for(let n in r.properties){let s=r.properties[n];t[n]=YC(s,t[n])}return t}function kC(e,t,r){let{pointPositionsCount:n,pointFeaturesCount:s,linePositionsCount:o,linePathsCount:i,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:h,polygonFeaturesCount:u,propArrayTypes:f,coordLength:d}=t,{numericPropKeys:p=[],PositionDataType:A=Float32Array,triangulate:g=!0}=r,y=e[0]&&"id"in e[0],E=e.length>65535?Uint32Array:Uint16Array,_={type:"Point",positions:new A(n*d),globalFeatureIds:new E(n),featureIds:s>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},B={type:"LineString",pathIndices:o>65535?new Uint32Array(i+1):new Uint16Array(i+1),positions:new A(o*d),globalFeatureIds:new E(o),featureIds:a>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},S={type:"Polygon",polygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),primitivePolygonIndices:c>65535?new Uint32Array(h+1):new Uint16Array(h+1),positions:new A(c*d),globalFeatureIds:new E(c),featureIds:u>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};g&&(S.triangles=[]);for(let w of[_,B,S])for(let C of p){let T=f[C];w.numericProps[C]=new T(w.positions.length/d)}B.pathIndices[i]=o,S.polygonIndices[l]=c,S.primitivePolygonIndices[h]=c;let M={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let w of e){let C=w.geometry,T=w.properties||{};switch(C.type){case"Point":JC(C,_,M,d,T),_.properties.push(il(T,p)),y&&_.fields.push({id:w.id}),M.pointFeature++;break;case"LineString":qC(C,B,M,d,T),B.properties.push(il(T,p)),y&&B.fields.push({id:w.id}),M.lineFeature++;break;case"Polygon":jC(C,S,M,d,T),S.properties.push(il(T,p)),y&&S.fields.push({id:w.id}),M.polygonFeature++;break;default:throw new Error("Invalid geometry type")}M.feature++}return WC(_,B,S,d)}function JC(e,t,r,n,s){t.positions.set(e.data,r.pointPosition*n);let o=e.data.length/n;cl(t,s,r.pointPosition,o),t.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+o),t.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+o),r.pointPosition+=o}function qC(e,t,r,n,s){t.positions.set(e.data,r.linePosition*n);let o=e.data.length/n;cl(t,s,r.linePosition,o),t.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+o),t.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+o);for(let i=0,a=e.indices.length;i<a;++i){let c=e.indices[i],l=i===a-1?e.data.length:e.indices[i+1];t.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(l-c)/n}}function jC(e,t,r,n,s){t.positions.set(e.data,r.polygonPosition*n);let o=e.data.length/n;cl(t,s,r.polygonPosition,o),t.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+o),t.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+o);for(let i=0,a=e.indices.length;i<a;++i){let c=r.polygonPosition;t.polygonIndices[r.polygonObject++]=c;let l=e.areas[i],h=e.indices[i],u=e.indices[i+1];for(let d=0,p=h.length;d<p;++d){let A=h[d],g=d===p-1?u===void 0?e.data.length:u[0]:h[d+1];t.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(g-A)/n}let f=r.polygonPosition;XC(t,l,h,{startPosition:c,endPosition:f,coordLength:n})}}function XC(e,t,r,{startPosition:n,endPosition:s,coordLength:o}){if(!e.triangles)return;let i=n*o,a=s*o,c=e.positions.subarray(i,a),l=r[0],h=r.slice(1).map(f=>(f-l)/o),u=sl(c,h,o,t);for(let f=0,d=u.length;f<d;++f)e.triangles.push(n+u[f])}function ol(e,t){let r={};for(let n in e)r[n]={value:e[n],size:t};return r}function WC(e,t,r,n){let s={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:n},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:ol(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:n},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:ol(t.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:n},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:ol(r.numericProps,1)}};return s.polygons&&r.triangles&&(s.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),s}function cl(e,t,r,n){for(let s in e.numericProps)if(s in t){let o=t[s];e.numericProps[s].fill(o,r,r+n)}}function il(e,t){let r={};for(let n in e)t.includes(n)||(r[n]=e[n]);return r}function YC(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function Qo(e,t){let r=t?.globalFeatureId;return r!==void 0?KC(e,r):QC(e,t?.type)}function KC(e,t){let r=Im(e);for(let n of r){let s=0,o=n.featureIds.value[0];for(let i=0;i<n.featureIds.value.length;i++){let a=n.featureIds.value[i];if(a!==o){if(t===n.globalFeatureIds.value[s])return Yo(n,s,i);s=i,o=a}}if(t===n.globalFeatureIds.value[s])return Yo(n,s,n.featureIds.value.length)}throw new Error(`featureId:${t} not found`)}function QC(e,t){let r=Im(e,t);return ZC(r)}function bm(e,t,r){switch(e.type){case"Point":return rS(e,t,r);case"LineString":return eS(e,t,r);case"Polygon":return wm(e,t,r);default:let n=e;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function Im(e,t){let r=[];return e.points&&(e.points.type="Point",r.push(e.points)),e.lines&&(e.lines.type="LineString",r.push(e.lines)),e.polygons&&(e.polygons.type="Polygon",r.push(e.polygons)),r}function ZC(e){let t=[];for(let r of e){if(r.featureIds.value.length===0)continue;let n=0,s=r.featureIds.value[0];for(let o=0;o<r.featureIds.value.length;o++){let i=r.featureIds.value[o];i!==s&&(t.push(Yo(r,n,o)),n=o,s=i)}t.push(Yo(r,n,r.featureIds.value.length))}return t}function Yo(e,t,r){let n=bm(e,t,r),s=tS(e,t,r),o=$C(e,t,r);return{type:"Feature",geometry:n,properties:s,...o}}function $C(e,t=0,r){return e.fields&&e.fields[e.featureIds.value[t]]}function tS(e,t=0,r){let n=Object.assign({},e.properties[e.featureIds.value[t]]);for(let s in e.numericProps)n[s]=e.numericProps[s].value[t];return n}function wm(e,t=-1/0,r=1/0){let{positions:n}=e,s=e.polygonIndices.value.filter(c=>c>=t&&c<=r),o=e.primitivePolygonIndices.value.filter(c=>c>=t&&c<=r);if(!(s.length>2)){let c=[];for(let l=0;l<o.length-1;l++){let h=o[l],u=o[l+1],f=Ko(n,h,u);c.push(f)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<s.length-1;c++){let l=s[c],h=s[c+1],u=wm(e,l,h).coordinates;a.push(u)}return{type:"MultiPolygon",coordinates:a}}function eS(e,t=-1/0,r=1/0){let{positions:n}=e,s=e.pathIndices.value.filter(a=>a>=t&&a<=r);if(!(s.length>2))return{type:"LineString",coordinates:Ko(n,s[0],s[1])};let i=[];for(let a=0;a<s.length-1;a++){let c=Ko(n,s[a],s[a+1]);i.push(c)}return{type:"MultiLineString",coordinates:i}}function rS(e,t,r){let{positions:n}=e,s=Ko(n,t,r);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function Ko(e,t,r){t=t||0,r=r||e.value.length/e.size;let n=[];for(let s=t;s<r;s++){let o=Array();for(let i=s*e.size;i<(s+1)*e.size;i++)o.push(Number(e.value[i]));n.push(o)}return n}var ml=D(Dm(),1);function vm(e){let t=e.length;if(t<=1)return[e];let r=[],n,s;for(let o=0;o<t;o++){let i=TS(e[o]);i!==0&&(s===void 0&&(s=i<0),s===i<0?(n&&r.push(n),n=[e[o]]):n&&n.push(e[o]))}return n&&r.push(n),r}function TS(e){let t=0;for(let r=0,n=e.length-1,s,o;r<e.length;n=r++)s=e[r],o=e[n],t+=(o[0]-s[0])*(s[1]+o[1]);return t}function Um(e,t,r){t&&r&&(e===1?t.id=r.readVarint():e===2?_S(r,t):e===3?t.type=r.readVarint():e===4&&(t._geometry=r.pos))}function _S(e,t){let r=e.readVarint()+e.pos;for(;e.pos<r;){let n=t._keys[e.readVarint()],s=t._values[e.readVarint()];t.properties[n]=s}}var ar=class{static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(t,r,n,s,o){this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=o,t.readFields(Um,this,r)}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,s=0,o=0,i=0,a=[],c;for(;t.pos<r;){if(s<=0){let l=t.readVarint();n=l&7,s=l>>3}if(s--,n===1||n===2)o+=t.readSVarint(),i+=t.readSVarint(),n===1&&(c&&a.push(c),c=[]),c&&c.push([o,i]);else if(n===7)c&&c.push(c[0].slice());else throw new Error(`unknown command ${n}`)}return c&&a.push(c),a}bbox(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,s=0,o=0,i=0,a=1/0,c=-1/0,l=1/0,h=-1/0;for(;t.pos<r;){if(s<=0){let u=t.readVarint();n=u&7,s=u>>3}if(s--,n===1||n===2)o+=t.readSVarint(),i+=t.readSVarint(),o<a&&(a=o),o>c&&(c=o),i<l&&(l=i),i>h&&(h=i);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,l,c,h]}_toGeoJSON(t){let r=this.loadGeometry(),n=ar.types[this.type],s,o;switch(this.type){case 1:let a=[];for(s=0;s<r.length;s++)a[s]=r[s][0];r=a,t(r,this);break;case 2:for(s=0;s<r.length;s++)t(r[s],this);break;case 3:for(r=vm(r),s=0;s<r.length;s++)for(o=0;o<r[s].length;o++)t(r[s][o],this);break}r.length===1?r=r[0]:n=`Multi${n}`;let i={type:"Feature",geometry:{type:n,coordinates:r},properties:this.properties};return this.id!==null&&(i.id=this.id),i}toGeoJSON(t){if(typeof t=="function")return this._toGeoJSON(t);let{x:r,y:n,z:s}=t,o=this.extent*Math.pow(2,s),i=this.extent*r,a=this.extent*n;function c(l){for(let h=0;h<l.length;h++){let u=l[h];u[0]=(u[0]+i)*360/o-180;let f=180-(u[1]+a)*360/o;u[1]=360/Math.PI*Math.atan(Math.exp(f*Math.PI/180))-90}}return this._toGeoJSON(c)}};var qn=class{constructor(t,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(ES,this,r),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let r=this._pbf.readVarint()+this._pbf.pos;return new ar(this._pbf,r,this.extent,this._keys,this._values)}};function ES(e,t,r){t&&r&&(e===15?t.version=r.readVarint():e===1?t.name=r.readString():e===5?t.extent=r.readVarint():e===2?t._features.push(r.pos):e===3?t._keys.push(r.readString()):e===4&&t._values.push(BS(r)))}function BS(e){let t=null,r=e.readVarint()+e.pos;for(;e.pos<r;){let n=e.readVarint()>>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}return t}var jn=class{constructor(t,r){this.layers=t.readFields(CS,{},r)}};function CS(e,t,r){if(e===3&&r){let n=new qn(r,r.readVarint()+r.pos);n.length&&t&&(t[n.name]=n)}}function Gm(e){let t=e.indices.length,r="Polygon";if(t<=1)return{type:r,data:e.data,areas:[[or(e.data)]],indices:[e.indices]};let n=[],s=[],o=[],i=[],a,c=0;for(let l,h=0,u;h<t;h++){u=e.indices[h]-c,l=e.indices[h+1]-c||e.data.length;let f=e.data.slice(u,l),d=or(f);if(d===0){let p=e.data.slice(0,u),A=e.data.slice(l);e.data=p.concat(A),c+=l-u;continue}a===void 0&&(a=d<0),a===d<0?(i.length&&(n.push(o),s.push(i)),i=[u],o=[d]):(o.push(d),i.push(u))}return o&&n.push(o),i.length&&s.push(i),{type:r,areas:n,indices:s,data:e.data}}function Vm(e,t,r,n){for(let s=0,o=e.length;s<o;s+=2){e[s]=(e[s]+t)*360/n-180;let i=180-(e[s+1]+r)*360/n;e[s+1]=360/Math.PI*Math.atan(Math.exp(i*Math.PI/180))-90}}function Hm(e,t,r){t&&r&&(e===1?t.id=r.readVarint():e===2?SS(r,t):e===3?t.type=r.readVarint():e===4&&(t._geometry=r.pos))}function SS(e,t){let r=e.readVarint()+e.pos;for(;e.pos<r;){let n=t._keys[e.readVarint()],s=t._values[e.readVarint()];t.properties[n]=s}}var zm,cr,ul,ti,fl,dl,Xn;var Wn=class{constructor(t,r,n,s,o,i){this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=o,this._geometryInfo=i,t.readFields(Hm,this,r)}loadGeometry(){let t=this._pbf;t.pos=this._geometry,zm=t.readVarint()+t.pos,cr=1,ti=0,fl=0,dl=0,Xn=0;let r=[],n=[];for(;t.pos<zm;)if(ti<=0&&(ul=t.readVarint(),cr=ul&7,ti=ul>>3),ti--,cr===1||cr===2)fl+=t.readSVarint(),dl+=t.readSVarint(),cr===1&&r.push(Xn),n.push(fl,dl),Xn+=2;else if(cr===7){if(Xn>0){let s=r[r.length-1];n.push(n[s],n[s+1]),Xn+=2}}else throw new Error(`unknown command ${cr}`);return{data:n,indices:r}}_toBinaryCoordinates(t){let r=this.loadGeometry(),n;t(r.data,this);let s=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=r.indices.length,n={type:"Point",...r};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=r.indices.length,this._geometryInfo.linePositionsCount+=r.data.length/s,n={type:"LineString",...r};break;case 3:n=Gm(r),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=n.indices.length;for(let i of n.indices)this._geometryInfo.polygonRingsCount+=i.length;this._geometryInfo.polygonPositionsCount+=n.data.length/s;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let o={type:"Feature",geometry:n,properties:this.properties};return this.id!==null&&(o.id=this.id),o}toBinaryCoordinates(t){if(typeof t=="function")return this._toBinaryCoordinates(t);let{x:r,y:n,z:s}=t,o=this.extent*Math.pow(2,s),i=this.extent*r,a=this.extent*n;return this._toBinaryCoordinates(c=>Vm(c,i,a,o))}};var Yn=class{constructor(t,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(MS,this,r),this.length=this._features.length}feature(t,r){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let n=this._pbf.readVarint()+this._pbf.pos;return new Wn(this._pbf,n,this.extent,this._keys,this._values,r)}};function MS(e,t,r){t&&r&&(e===15?t.version=r.readVarint():e===1?t.name=r.readString():e===5?t.extent=r.readVarint():e===2?t._features.push(r.pos):e===3?t._keys.push(r.readString()):e===4&&t._values.push(bS(r)))}function bS(e){let t=null,r=e.readVarint()+e.pos;for(;e.pos<r;){let n=e.readVarint()>>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}return t}var Kn=class{constructor(t,r){this.layers=t.readFields(IS,{},r)}};function IS(e,t,r){if(e===3&&r){let n=new Yn(r,r.readVarint()+r.pos);n.length&&t&&(t[n.name]=n)}}function ei(e,t){let r=FS(t),n=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(n){case"columnar-table":return{shape:"columnar-table",data:pl(e,r)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:km(e,r)};case"geojson":return km(e,r);case"binary-geometry":return pl(e,r);case"binary":return pl(e,r);default:throw new Error(n||"undefined shape")}}function pl(e,t){let[r,n]=wS(e,t),s=al(r,n);return s.byteLength=e.byteLength,s}function wS(e,t){let r=[],n={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[r,n];let s=new Kn(new ml.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(s.layers)).forEach(i=>{let a=s.layers[i];if(a)for(let c=0;c<a.length;c++){let l=a.feature(c,n),h=RS(l,t,i);r.push(h)}}),[r,n]}function km(e,t){if(e.byteLength<=0)return[];let r=[],n=new jn(new ml.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(n.layers)).forEach(o=>{let i=n.layers[o];if(i)for(let a=0;a<i.length;a++){let c=i.feature(a),l=LS(c,t,o);r.push(l)}}),r}function FS(e){if(!e?.mvt)throw new Error("mvt options required");let t=e.mvt?.coordinates==="wgs84",{tileIndex:r}=e.mvt,n=r&&Number.isFinite(r.x)&&Number.isFinite(r.y)&&Number.isFinite(r.z);if(t&&!n)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.mvt}function LS(e,t,r){let n=e.toGeoJSON(t.coordinates==="wgs84"?t.tileIndex:PS);return t.layerProperty&&(n.properties[t.layerProperty]=r),n}function RS(e,t,r){let n=e.toBinaryCoordinates(t.coordinates==="wgs84"?t.tileIndex:OS);return t.layerProperty&&n.properties&&(n.properties[t.layerProperty]=r),n}function PS(e,t){let{extent:r}=t;for(let n=0;n<e.length;n++){let s=e[n];s[0]/=r,s[1]/=r}}function OS(e,t){let{extent:r}=t;for(let n=0,s=e.length;n<s;++n)e[n]/=r}var NS="4.2.0-alpha.4",ri={name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:NS,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:null}}},DS={...ri,parse:async(e,t)=>ei(e,t),parseSync:ei,binary:!0};var vS={Point:Jm,MultiPoint:US,LineString:qm,MultiLineString:GS,Polygon:jm,MultiPolygon:VS};function Jm([e,t],[r,n],s){let o=Te(r[0],n[0],e),i=Te(r[1],n[1],t);return s.unprojectFlat([o,i])}function gl(e,t,r){return e.map(n=>Jm(n,t,r))}function US(e,t,r){return gl(e,t,r)}function qm(e,t,r){return gl(e,t,r)}function GS(e,t,r){return e.map(n=>qm(n,t,r))}function jm(e,t,r){return e.map(n=>gl(n,t,r))}function VS(e,t,r){return e.map(n=>jm(n,t,r))}function Xm(e,t,r){let n=r.projectFlat([t.west,t.north]),s=r.projectFlat([t.east,t.south]),o=[n,s];return{...e,coordinates:vS[e.type](e.coordinates,o,r)}}var HS=["points","lines","polygons"];function Al(e,t,r,n){for(let s of HS){let o=e[s]&&zS(e[s],t,r,n);if(o>=0)return o}return-1}function zS(e,t,r,n){let s=e.featureIds.value;if(!s.length)return-1;let o=0,i=s[s.length-1]+1;if(n){let c=kS(e,n);if(c)o=c[0],i=c[1]+1;else return-1}let a=-1;if(t in e.numericProps){let c=e.numericProps[t].value.findIndex((l,h)=>l===r&&s[h]>=o&&s[h]<i);return c>=0?e.globalFeatureIds.value[c]:-1}else t?a=Wm(e.properties,c=>c[t]===r,o,i):e.fields&&(a=Wm(e.fields,c=>c.id===r,o,i));return a>=0?JS(e,a):-1}function kS(e,t){if(!e.__layers){let r={},{properties:n}=e;for(let s=0;s<n.length;s++){let{layerName:o}=n[s];o&&(r[o]?r[o][1]=s:r[o]=[s,s])}e.__layers=r}return e.__layers[t]}function JS(e,t){if(!e.__ids){let r=[],n=e.featureIds.value,s=e.globalFeatureIds.value;for(let o=0;o<n.length;o++)r[n[o]]=s[o];e.__ids=r}return e.__ids[t]}function Wm(e,t,r,n){for(let s=r;s<n;s++)if(t(e[s],s))return s;return-1}var xl=512,qS={...Tl.GeoJsonLayer.defaultProps,data:be,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[ri],binary:!0},ni=class extends te{constructor(...t){super(...t)}initializeState(){super.initializeState();let t=this.context.viewport.resolution!==void 0?!1:this.props.binary;this.setState({binary:t,data:null,tileJSON:null,hoveredFeatureId:null,hoveredFeatureLayerName:null})}get isLoaded(){return Boolean(this.state?.data&&super.isLoaded)}updateState({props:t,oldProps:r,context:n,changeFlags:s}){s.dataChanged&&this._updateTileData(),this.state?.data&&(super.updateState({props:t,oldProps:r,context:n,changeFlags:s}),this._setWGS84PropertyForTiles());let{highlightColor:o}=t;o!==r.highlightColor&&Array.isArray(o)&&this.setState({highlightColor:o})}async _updateTileData(){let t=this.props.data,r=null;if(typeof t=="string"&&!Sa(t)){let{onDataLoad:n,fetch:s}=this.props;this.setState({data:null,tileJSON:null});try{r=await s(t,{propName:"data",layer:this,loaders:[]})}catch(o){this.raiseError(o,"loading TileJSON"),t=null}n&&n(r,{propName:"data",layer:this})}else t&&typeof t=="object"&&"tilejson"in t&&(r=t);r&&(t=r.tiles),this.setState({data:t,tileJSON:r})}_getTilesetOptions(){let t=super._getTilesetOptions(),r=this.state.tileJSON,{minZoom:n,maxZoom:s}=this.props;return r&&(Number.isFinite(r.minzoom)&&r.minzoom>n&&(t.minZoom=r.minzoom),Number.isFinite(r.maxzoom)&&(!Number.isFinite(s)||r.maxzoom<s)&&(t.maxZoom=r.maxzoom)),t}renderLayers(){return this.state?.data?super.renderLayers():null}getTileData(t){let{data:r,binary:n}=this.state,{index:s,signal:o}=t,i=$t(r,t);if(!i)return Promise.reject("Invalid URL");let a=this.getLoadOptions(),{fetch:c}=this.props;return a={...a,mimeType:"application/x-protobuf",mvt:{...a?.mvt,coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:s},gis:n?{format:"binary"}:{}},c(i,{propName:"data",layer:this,loadOptions:a,signal:o})}renderSubLayers(t){let{x:r,y:n,z:s}=t.tile.index,o=Math.pow(2,s),i=xl/o,a=-i,c=xl*r/o,l=xl*(1-n/o),h=new O().scale([i,a,1]);t.autoHighlight=!1,this.context.viewport.resolution||(t.modelMatrix=h,t.coordinateOrigin=[c,l,0],t.coordinateSystem=si.COORDINATE_SYSTEM.CARTESIAN,t.extensions=[...t.extensions||[],new Zm.ClipExtension]);let u=super.renderSubLayers(t);return this.state.binary&&!(u instanceof Tl.GeoJsonLayer)&&si.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),u}_updateAutoHighlight(t){let{uniqueIdProperty:r}=this.props,{hoveredFeatureId:n,hoveredFeatureLayerName:s}=this.state,o=t.object,i=null,a=null;o&&(i=yl(o,r),a=Ym(o));let{highlightColor:c}=this.props;typeof c=="function"&&(c=c(t)),(n!==i||s!==a)&&this.setState({highlightColor:c,hoveredFeatureId:i,hoveredFeatureLayerName:a})}getPickingInfo(t){let r=super.getPickingInfo(t),n=Boolean(this.context.viewport.resolution);if(this.state.binary&&r.index!==-1){let{data:s}=t.sourceLayer.props;r.object=Qo(s,{globalFeatureId:r.index})}return r.object&&!n&&(r.object=Qm(r.object,r.tile.bbox,this.context.viewport)),r}getSubLayerPropsByTile(t){return{highlightedObjectIndex:this.getHighlightedObjectIndex(t),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(t){let{hoveredFeatureId:r,hoveredFeatureLayerName:n,binary:s}=this.state,{uniqueIdProperty:o,highlightedFeatureId:i}=this.props,a=t.content,c=Km(i);if(!(Km(r)||c))return-1;let h=c?i:r;return Array.isArray(a)?a.findIndex(u=>{let f=yl(u,o)===h,d=c||Ym(u)===n;return f&&d}):a&&s?Al(a,o,h,c?"":n):-1}_pickObjects(t){let{deck:r,viewport:n}=this.context,s=n.width,o=n.height,i=n.x,a=n.y,c=[this.id];return r.pickObjects({x:i,y:a,width:s,height:o,layerIds:c,maxObjects:t})}getRenderedFeatures(t=null){let r=this._pickObjects(t),n=new Set,s=[];for(let o of r){let i=yl(o.object,this.props.uniqueIdProperty);i===void 0?s.push(o.object):n.has(i)||(n.add(i),s.push(o.object))}return s}_setWGS84PropertyForTiles(){let t="dataInWGS84";this.state.tileset.selectedTiles.forEach(n=>{n.hasOwnProperty(t)||Object.defineProperty(n,t,{get:()=>{if(!n.content)return null;if(this.state.binary&&Array.isArray(n.content)&&!n.content.length)return[];let{bbox:s}=n;if(n._contentWGS84===void 0&&Ma(s)){let o=this.state.binary?Qo(n.content):n.content;n._contentWGS84=o.map(i=>Qm(i,s,this.context.viewport))}return n._contentWGS84}})})}},Qn=ni;(()=>{ni.layerName="MVTLayer"})(),(()=>{ni.defaultProps=qS})();function yl(e,t){if(e.properties&&t)return e.properties[t];if("id"in e)return e.id}function Ym(e){return e.properties?.layerName||null}function Km(e){return e!=null&&e!==""}function Qm(e,t,r){let n={...e,geometry:{type:e.geometry.type}};return Object.defineProperty(n.geometry,"coordinates",{get:()=>Xm(e.geometry,t,r).coordinates}),n}var $m="0123456789bcdefghjkmnpqrstuvwxyz",tg={};for(let e=0;e<$m.length;e++)tg[$m.charAt(e)]=e;var jS=-90,XS=90,WS=-180,YS=180;function KS(e){let t=!0,r=XS,n=jS,s=YS,o=WS,i,a=0;for(let c=0,l=e.length;c<l;c++){let h=e[c].toLowerCase();a=tg[h];for(let u=4;u>=0;u--){let f=a>>u&1;t?(i=(s+o)/2,f===1?o=i:s=i):(i=(r+n)/2,f===1?n=i:r=i),t=!t}}return[n,o,r,s]}function eg(e){let[t,r,n,s]=KS(e);return[s,n,s,t,r,t,r,n,s,n]}var QS={getGeohash:{type:"accessor",value:e=>e.geohash}},oi=class extends bt{indexToBounds(){let{data:t,getGeohash:r}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(n,s)=>eg(r(n,s))}}},Zn=oi;(()=>{oi.layerName="GeohashLayer"})(),(()=>{oi.defaultProps=QS})();return lg($n);})();
|
|
448
|
+
`;function eT(e){let t=e.positions||e.POSITION,n=t.value.length/t.size;e.COLOR_0||e.colors||(e.colors={size:4,value:new Uint8Array(n*4).fill(255),normalized:!0})}var nT={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},Ys=class extends jf.SimpleMeshLayer{getShaders(){let t=super.getShaders();return t.modules.push(Ga),{...t,vs:kf,fs:Jf}}initializeState(){let{featureIds:t}=this.props;super.initializeState();let n=this.getAttributeManager();t&&n.add({featureIdsPickingColors:{type:"uint8",size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})}updateState(t){super.updateState(t);let{props:n,oldProps:r}=t;n.pbrMaterial!==r.pbrMaterial&&this.updatePbrMaterialUniforms(n.pbrMaterial)}draw(t){let{featureIds:n}=this.props;this.state.model&&(this.state.model.setUniforms({u_Camera:this.state.model.uniforms.project_uCameraPosition,pickFeatureIds:Boolean(n)}),super.draw(t))}getModel(t){let{id:n,pbrMaterial:r}=this.props,s=this.parseMaterial(r,t);this.setState({parsedPBRMaterial:s});let i=this.getShaders();return eT(t.attributes),new qf.Model(this.context.device,{...this.getShaders(),id:n,geometry:t,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:{...i.defines,...s?.defines,HAS_UV_REGIONS:t.attributes.uvRegions?1:0},parameters:s?.parameters,isInstanced:!0})}updatePbrMaterialUniforms(t){let{model:n}=this.state;if(n){let{mesh:r}=this.props,s=this.parseMaterial(t,r);this.setState({parsedPBRMaterial:s}),n.setBindings(s.bindings),n.setUniforms(s.uniforms)}}parseMaterial(t,n){let r=Boolean(t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture);return wa(this.context.device,{unlit:r,...t},{NORMAL:n.attributes.normals,TEXCOORD_0:n.attributes.texCoords},{pbrDebug:!1,lights:!0,useTangents:!1})}calculateFeatureIdsPickingColors(t){let n=this.props.featureIds,r=new Uint8ClampedArray(n.length*t.size),s=[];for(let i=0;i<n.length;i++)this.encodePickingColor(n[i],s),r[i*3]=s[0],r[i*3+1]=s[1],r[i*3+2]=s[2];t.value=r}finalizeState(t){super.finalizeState(t),this.state.parsedPBRMaterial?.generatedTextures.forEach(n=>n.destroy()),this.setState({parsedPBRMaterial:null})}},Tr=Ys;(()=>{Ys.layerName="MeshLayer"})(),(()=>{Ys.defaultProps=nT})();var hm=O(Tn(),1);var ae=6356752314245179e-9,rT={radii:[6378137,6378137,ae],radiiSquared:[6378137*6378137,6378137*6378137,ae*ae],oneOverRadii:[1/6378137,1/6378137,1/ae],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(ae*ae)],maximumRadius:Math.max(6378137,6378137,ae),centerToleranceSquared:.1};function Ks(e){return e}var pL=new x;function sT(e,t=[],n=Ks){return"longitude"in e?(t[0]=n(e.longitude),t[1]=n(e.latitude),t[2]=e.height):"x"in e?(t[0]=n(e.x),t[1]=n(e.y),t[2]=e.z):(t[0]=n(e[0]),t[1]=n(e[1]),t[2]=e[2]),t}function Wf(e,t=[]){return sT(e,t,Y._cartographicRadians?Ks:Po)}function iT(e,t,n=Ks){return"longitude"in t?(t.longitude=n(e[0]),t.latitude=n(e[1]),t.height=e[2]):"x"in t?(t.x=n(e[0]),t.y=n(e[1]),t.z=e[2]):(t[0]=n(e[0]),t[1]=n(e[1]),t[2]=e[2]),t}function Yf(e,t){return iT(e,t,Y._cartographicRadians?Ks:Oo)}var Kf=1e-14,oT=new x,Qf={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"}},Va={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},_r={east:new x,north:new x,up:new x,west:new x,south:new x,down:new x},aT=new x,cT=new x,lT=new x;function Ha(e,t,n,r,s,i){let o=Qf[t]&&Qf[t][n];at(o&&(!r||r===o));let a,c,l,u=oT.copy(s);if(mt(u.x,0,Kf)&&mt(u.y,0,Kf)){let f=Math.sign(u.z);a=aT.fromArray(Va[t]),t!=="east"&&t!=="west"&&a.scale(f),c=cT.fromArray(Va[n]),n!=="east"&&n!=="west"&&c.scale(f),l=lT.fromArray(Va[r]),r!=="east"&&r!=="west"&&l.scale(f)}else{let{up:f,east:d,north:p}=_r;d.set(-u.y,u.x,0).normalize(),e.geodeticSurfaceNormal(u,f),p.copy(f).cross(d);let{down:A,west:g,south:y}=_r;A.copy(f).scale(-1),g.copy(d).scale(-1),y.copy(p).scale(-1),a=_r[t],c=_r[n],l=_r[r]}return i[0]=a.x,i[1]=a.y,i[2]=a.z,i[3]=0,i[4]=c.x,i[5]=c.y,i[6]=c.z,i[7]=0,i[8]=l.x,i[9]=l.y,i[10]=l.z,i[11]=0,i[12]=u.x,i[13]=u.y,i[14]=u.z,i[15]=1,i}var _n=new x,uT=new x,hT=new x;function Zf(e,t,n=[]){let{oneOverRadii:r,oneOverRadiiSquared:s,centerToleranceSquared:i}=t;_n.from(e);let o=_n.x,a=_n.y,c=_n.z,l=r.x,u=r.y,h=r.z,f=o*o*l*l,d=a*a*u*u,p=c*c*h*h,A=f+d+p,g=Math.sqrt(1/A);if(!Number.isFinite(g))return;let y=uT;if(y.copy(e).scale(g),A<i)return y.to(n);let E=s.x,_=s.y,B=s.z,S=hT;S.set(y.x*E*2,y.y*_*2,y.z*B*2);let b=(1-g)*_n.len()/(.5*S.len()),w=0,C,T,m,M;do{b-=w,C=1/(1+b*E),T=1/(1+b*_),m=1/(1+b*B);let v=C*C,R=T*T,F=m*m,N=v*C,X=R*T,H=F*m;M=f*v+d*R+p*F-1;let j=-2*(f*N*E+d*X*_+p*H*B);w=M/j}while(Math.abs(M)>Ft.EPSILON12);return _n.scale([C,T,m]).to(n)}var Qs=new x,$f=new x,pT=new x,Ht=new x,mT=new x,Zs=new x,D=class{constructor(t=0,n=0,r=0){this.centerToleranceSquared=Ft.EPSILON1,at(t>=0),at(n>=0),at(r>=0),this.radii=new x(t,n,r),this.radiiSquared=new x(t*t,n*n,r*r),this.radiiToTheFourth=new x(t*t*t*t,n*n*n*n,r*r*r*r),this.oneOverRadii=new x(t===0?0:1/t,n===0?0:1/n,r===0?0:1/r),this.oneOverRadiiSquared=new x(t===0?0:1/(t*t),n===0?0:1/(n*n),r===0?0:1/(r*r)),this.minimumRadius=Math.min(t,n,r),this.maximumRadius=Math.max(t,n,r),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,n=[0,0,0]){let r=$f,s=pT,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,r),s.copy(this.radiiSquared).scale(r);let o=Math.sqrt(r.dot(s));return s.scale(1/o),r.scale(i),s.add(r),s.to(n)}cartesianToCartographic(t,n=[0,0,0]){Zs.from(t);let r=this.scaleToGeodeticSurface(Zs,Ht);if(!r)return;let s=this.geodeticSurfaceNormal(r,$f),i=mT;i.copy(Zs).subtract(r);let o=Math.atan2(s.y,s.x),a=Math.asin(s.z),c=Math.sign(Ve.dot(i,Zs))*Ve.length(i);return Yf([o,a,c],n)}eastNorthUpToFixedFrame(t,n=new L){return Ha(this,"east","north","up",t,n)}localFrameToFixedFrame(t,n,r,s,i=new L){return Ha(this,t,n,r,s,i)}geocentricSurfaceNormal(t,n=[0,0,0]){return Qs.from(t).normalize().to(n)}geodeticSurfaceNormalCartographic(t,n=[0,0,0]){let r=Wf(t),s=r[0],i=r[1],o=Math.cos(i);return Qs.set(o*Math.cos(s),o*Math.sin(s),Math.sin(i)).normalize(),Qs.to(n)}geodeticSurfaceNormal(t,n=[0,0,0]){return Qs.from(t).scale(this.oneOverRadiiSquared).normalize().to(n)}scaleToGeodeticSurface(t,n){return Zf(t,this,n)}scaleToGeocentricSurface(t,n=[0,0,0]){Ht.from(t);let r=Ht.x,s=Ht.y,i=Ht.z,o=this.oneOverRadiiSquared,a=1/Math.sqrt(r*r*o.x+s*s*o.y+i*i*o.z);return Ht.multiplyScalar(a).to(n)}transformPositionToScaledSpace(t,n=[0,0,0]){return Ht.from(t).scale(this.oneOverRadii).to(n)}transformPositionFromScaledSpace(t,n=[0,0,0]){return Ht.from(t).scale(this.radii).to(n)}getSurfaceNormalIntersectionWithZAxis(t,n=0,r=[0,0,0]){at(mt(this.radii.x,this.radii.y,Ft.EPSILON15)),at(this.radii.z>0),Ht.from(t);let s=Ht.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(s)>=this.radii.z-n))return Ht.set(0,0,s).to(r)}};D.WGS84=new D(6378137,6378137,ae);var $s=class{constructor(t,n,r){this.item=void 0,this.previous=void 0,this.next=void 0,this.item=t,this.previous=n,this.next=r}};var ti=class{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(t){let n=new $s(t,this.tail,null);return this.tail?(this.tail.next=n,this.tail=n):(this.head=n,this.tail=n),++this._length,n}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,n){t!==n&&(this.remove(n),this._insert(t,n))}_insert(t,n){let r=t.next;t.next=n,this.tail===t?this.tail=n:r.previous=n,n.next=r,n.previous=t,++this._length}};var ei=class{constructor(){this._list=void 0,this._sentinel=void 0,this._trimTiles=void 0,this._list=new ti,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let n=t._cacheNode;n&&this._list.splice(this._sentinel,n)}add(t,n,r){n._cacheNode||(n._cacheNode=this._list.add(n),r&&r(t,n))}unloadTile(t,n,r){let s=n._cacheNode;s&&(this._list.remove(s),n._cacheNode=null,r&&r(t,n))}unloadTiles(t,n){let r=this._trimTiles;this._trimTiles=!1;let s=this._list,i=t.maximumMemoryUsage*1024*1024,o=this._sentinel,a=s.head;for(;a!==o&&(t.gpuMemoryUsageInBytes>i||r);){let c=a.item;a=a.next,this.unloadTile(t,c,n)}}trim(){this._trimTiles=!0}};function td(e,t){G(e),G(t);let{rtcCenter:n,gltfUpAxis:r}=t,{computedTransform:s,boundingVolume:{center:i}}=e,o=new L(s);switch(n&&o.translate(n),r){case"Z":break;case"Y":let h=new L().rotateX(Math.PI/2);o=o.multiplyRight(h);break;case"X":let f=new L().rotateY(-Math.PI/2);o=o.multiplyRight(f);break;default:break}t.isQuantized&&o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let a=new x(i);t.cartesianModelMatrix=o,t.cartesianOrigin=a;let c=D.WGS84.cartesianToCartographic(a,new x),u=D.WGS84.eastNorthUpToFixedFrame(a).invert();t.cartographicModelMatrix=u.multiplyRight(o),t.cartographicOrigin=c,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var ed=new x,za=new x,ka=new it([new ct,new ct,new ct,new ct,new ct,new ct]);function rd(e,t){let{cameraDirection:n,cameraUp:r,height:s}=e,{metersPerUnit:i}=e.distanceScales,o=ni(e,e.center),a=D.WGS84.eastNorthUpToFixedFrame(o),c=e.unprojectPosition(e.cameraPosition),l=D.WGS84.cartographicToCartesian(c,new x),u=new x(a.transformAsVector(new x(n).scale(i))).normalize(),h=new x(a.transformAsVector(new x(r).scale(i))).normalize();gT(e);let f=e.constructor,{longitude:d,latitude:p,width:A,bearing:g,zoom:y}=e,E=new f({longitude:d,latitude:p,height:s,width:A,bearing:g,zoom:y,pitch:0});return{camera:{position:l,direction:u,up:h},viewport:e,topDownViewport:E,height:s,cullingVolume:ka,frameNumber:t,sseDenominator:1.15}}function sd(e,t,n){if(n===0||e.length<=n)return[e,[]];let r=[],{longitude:s,latitude:i}=t.viewport;for(let[l,u]of e.entries()){let[h,f]=u.header.mbs,d=Math.abs(s-h),p=Math.abs(i-f),A=Math.sqrt(p*p+d*d);r.push([l,A])}let o=r.sort((l,u)=>l[1]-u[1]),a=[];for(let l=0;l<n;l++)a.push(e[o[l][0]]);let c=[];for(let l=n;l<o.length;l++)c.push(e[o[l][0]]);return[a,c]}function gT(e){let t=e.getFrustumPlanes(),n=nd(t.near,e.cameraPosition),r=ni(e,n),s=ni(e,e.cameraPosition,za),i=0;ka.planes[i++].fromPointNormal(r,ed.copy(r).subtract(s));for(let o in t){if(o==="near")continue;let a=t[o],c=nd(a,n,za),l=ni(e,c,za);ka.planes[i++].fromPointNormal(l,ed.copy(r).subtract(l))}}function nd(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new x,r=e.normal.dot(t);return n.copy(e.normal).scale(e.distance-r).add(t),n}function ni(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new x,r=e.unprojectPosition(t);return D.WGS84.cartographicToCartesian(r,n)}var AT=6378137,xT=6378137,Ja=6356752314245179e-9,En=new x;function id(e,t){if(e instanceof Gt){let{halfAxes:n}=e,r=yT(n);return Math.log2(Ja/(r+t[2]))}else if(e instanceof vt){let{radius:n}=e;return Math.log2(Ja/(n+t[2]))}else if(e.width&&e.height){let{width:n,height:r}=e,s=Math.log2(AT/n),i=Math.log2(xT/r);return(s+i)/2}return 1}function qa(e,t,n){D.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],En);let r=Math.sqrt(Math.pow(En[0]-n[0],2)+Math.pow(En[1]-n[1],2)+Math.pow(En[2]-n[2],2));return Math.log2(Ja/(r+t[2]))}function od(e,t,n){let[r,s,i,o]=e;return qa({xmin:r,xmax:i,ymin:s,ymax:o,zmin:0,zmax:0},t,n)}function yT(e){e.getColumn(0,En);let t=e.getColumn(1),n=e.getColumn(2);return En.add(t).add(n).len()}var Bd=O(Tn(),1);var gt={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},yt=function(e){return e[e.ADD=1]="ADD",e[e.REPLACE=2]="REPLACE",e}({}),$t=function(e){return e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh",e}({}),ut=function(e){return e.I3S="I3S",e.TILES3D="TILES3D",e}({}),je=function(e){return e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold",e}({}),ad={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function hd(e){return e!=null}var ht=new x,ri=new x,TT=new x,_T=new x,Xe=new x,cd=new x,ld=new x,ud=new x;function si(e,t,n){if(G(e,"3D Tile: boundingVolume must be defined"),e.box)return dd(e.box,t,n);if(e.region)return BT(e.region);if(e.sphere)return ET(e.sphere,t,n);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function fd(e,t){if(e.box)return CT(t);if(e.region){let[n,r,s,i,o,a]=e.region;return[[bt(n),bt(r),o],[bt(s),bt(i),a]]}if(e.sphere)return ST(t);throw new Error("Unkown boundingVolume type")}function dd(e,t,n){let r=new x(e[0],e[1],e[2]);t.transform(r,r);let s=[];if(e.length===10){let l=e.slice(3,6),u=new Yt;u.fromArray(e,6);let h=new x([1,0,0]),f=new x([0,1,0]),d=new x([0,0,1]);h.transformByQuaternion(u),h.scale(l[0]),f.transformByQuaternion(u),f.scale(l[1]),d.transformByQuaternion(u),d.scale(l[2]),s=[...h.toArray(),...f.toArray(),...d.toArray()]}else s=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let i=t.transformAsVector(s.slice(0,3)),o=t.transformAsVector(s.slice(3,6)),a=t.transformAsVector(s.slice(6,9)),c=new z([i[0],i[1],i[2],o[0],o[1],o[2],a[0],a[1],a[2]]);return hd(n)?(n.center=r,n.halfAxes=c,n):new Gt(r,c)}function ET(e,t,n){let r=new x(e[0],e[1],e[2]);t.transform(r,r);let s=t.getScale(ri),i=Math.max(Math.max(s[0],s[1]),s[2]),o=e[3]*i;return hd(n)?(n.center=r,n.radius=o,n):new vt(r,o)}function BT(e){let[t,n,r,s,i,o]=e,a=D.WGS84.cartographicToCartesian([bt(t),bt(s),i],TT),c=D.WGS84.cartographicToCartesian([bt(r),bt(n),o],_T),l=new x().addVectors(a,c).multiplyByScalar(.5);return D.WGS84.cartesianToCartographic(l,Xe),D.WGS84.cartographicToCartesian([bt(r),Xe[1],Xe[2]],cd),D.WGS84.cartographicToCartesian([Xe[0],bt(s),Xe[2]],ld),D.WGS84.cartographicToCartesian([Xe[0],Xe[1],o],ud),dd([...l,...cd.subtract(l),...ld.subtract(l),...ud.subtract(l)],new L)}function CT(e){let t=pd(),{halfAxes:n}=e,r=new x(n.getColumn(0)),s=new x(n.getColumn(1)),i=new x(n.getColumn(2));for(let o=0;o<2;o++){for(let a=0;a<2;a++){for(let c=0;c<2;c++)ht.copy(e.center),ht.add(r),ht.add(s),ht.add(i),md(t,ht),i.negate();s.negate()}r.negate()}return t}function ST(e){let t=pd(),{center:n,radius:r}=e,s=D.WGS84.scaleToGeodeticSurface(n,ht),i;s?i=D.WGS84.geodeticSurfaceNormal(s):i=new x(0,0,1);let o=new x(i[2],-i[1],0);o.len()>0?o.normalize():o=new x(0,1,0);let a=o.clone().cross(i);for(let c of[o,a,i]){ri.copy(c).scale(r);for(let l=0;l<2;l++)ht.copy(n),ht.add(ri),md(t,ht),ri.negate()}return t}function pd(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function md(e,t){D.WGS84.cartesianToCartographic(t,ht),e[0][0]=Math.min(e[0][0],ht[0]),e[0][1]=Math.min(e[0][1],ht[1]),e[0][2]=Math.min(e[0][2],ht[2]),e[1][0]=Math.max(e[1][0],ht[0]),e[1][1]=Math.max(e[1][1],ht[1]),e[1][2]=Math.max(e[1][2],ht[2])}var e3=new x,n3=new x,r3=new L,s3=new x,i3=new x,o3=new x;function bT(e,t){let n=e*t;return 1-Math.exp(-(n*n))}function MT(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){let n=e.dynamicScreenSpaceErrorComputedDensity,r=e.dynamicScreenSpaceErrorFactor;return bT(t,n)*r}return 0}function gd(e,t,n){let r=e.tileset,s=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,i=n?s:e.lodMetricValue;if(i===0)return 0;let o=Math.max(e._distanceToCamera,1e-7),{height:a,sseDenominator:c}=t,{viewDistanceScale:l}=r.options,u=i*a*(l||1)/(o*c);return u-=MT(r,o),u}var ja=new x,Ad=new x,be=new x,xd=new x,IT=new x,Xa=new L,yd=new L;function Td(e,t){if(e.lodMetricValue===0||isNaN(e.lodMetricValue))return"DIG";let n=2*Wa(e,t);return n<2?"OUT":!e.header.children||n<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}function Wa(e,t){let{topDownViewport:n}=t,r=e.header.mbs[1],s=e.header.mbs[0],i=e.header.mbs[2],o=e.header.mbs[3],a=[...e.boundingVolume.center],c=n.unprojectPosition(n.cameraPosition);D.WGS84.cartographicToCartesian(c,ja),Ad.copy(ja).subtract(a).normalize(),D.WGS84.eastNorthUpToFixedFrame(a,Xa),yd.copy(Xa).invert(),be.copy(ja).transform(yd);let l=Math.sqrt(be[0]*be[0]+be[1]*be[1]),u=l*l/be[2];xd.copy([be[0],be[1],u]);let f=xd.transform(Xa).subtract(a).normalize(),p=Ad.cross(f).normalize().scale(o).add(a),A=D.WGS84.cartesianToCartographic(p),g=n.project([s,r,i]),y=n.project(A);return IT.copy(g).subtract(y).magnitude()}function _d(e){return{assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}}var Er=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;this._map=new Map,this._array=void 0,this._length=void 0,this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return G(t<this._array.length),this._array[t]}set(t,n){G(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=n,this._map.set(n,t)}delete(t){let n=this._map.get(t);n>=0&&(this._array.splice(n,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){let n=this.length++;this._array[n]=t,this._map.set(t,n)}}pop(){let t=this._array[--this.length];return this._map.delete(t),t}reserve(t){G(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){G(t>=0),this.length=t}trim(t){t==null&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}};var wT={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},te=class{traversalFinished(t){return!0}constructor(t){this.options=void 0,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={},this.lastUpdate=new Date().getTime(),this.updateDebounceTime=1e3,this._traversalStack=new Er,this._emptyTraversalStack=new Er,this._frameNumber=null,this.options={...wT,...t}}traverse(t,n,r){this.root=t,this.options={...this.options,...r},this.reset(),this.updateTile(t,n),this._frameNumber=n.frameNumber,this.executeTraversal(t,n)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,n){let r=this._traversalStack;for(t._selectionDepth=1,r.push(t);r.length>0;){let i=r.pop(),o=!1;this.canTraverse(i,n)&&(this.updateChildTiles(i,n),o=this.updateAndPushChildren(i,n,r,i.hasRenderContent?i._selectionDepth+1:i._selectionDepth));let a=i.parent,c=Boolean(!a||a._shouldRefine),l=!o;i.hasRenderContent?i.refine===yt.ADD?(this.loadTile(i,n),this.selectTile(i,n)):i.refine===yt.REPLACE&&(this.loadTile(i,n),l&&this.selectTile(i,n)):(this.emptyTiles[i.id]=i,this.loadTile(i,n),l&&this.selectTile(i,n)),this.touchTile(i,n),i._shouldRefine=o&&c}let s=new Date().getTime();(this.traversalFinished(n)||s-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=s,this.options.onTraversalEnd(n))}updateChildTiles(t,n){let r=t.children;for(let s of r)this.updateTile(s,n)}updateAndPushChildren(t,n,r,s){let{loadSiblings:i,skipLevelOfDetail:o}=this.options,a=t.children;a.sort(this.compareDistanceToCamera.bind(this));let c=t.refine===yt.REPLACE&&t.hasRenderContent&&!o,l=!1,u=!0;for(let h of a)if(h._selectionDepth=s,h.isVisibleAndInRequestVolume?(r.find(h)&&r.delete(h),r.push(h),l=!0):(c||i)&&(this.loadTile(h,n),this.touchTile(h,n)),c){let f;if(h._inRequestVolume?h.hasRenderContent?f=h.contentAvailable:f=this.executeEmptyTraversal(h,n):f=!1,u=u&&f,!u)return!1}return l||(u=!1),u}updateTile(t,n){this.updateTileVisibility(t,n)}selectTile(t,n){this.shouldSelectTile(t)&&(t._selectedFrame=n.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,n){this.shouldLoadTile(t)&&(t._requestedFrame=n.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,n){t.tileset._cache.touch(t),t._touchedFrame=n.frameNumber}canTraverse(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return t.hasChildren?t.hasTilesetContent?!t.contentExpired:!s&&!t.isVisibleAndInRequestVolume?!1:this.shouldRefine(t,n,r):!1}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=t._screenSpaceError;return r&&(s=t.getScreenSpaceError(n,!0)),s>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,n){let r=[];if(this.options.viewportTraversersMap)for(let s in this.options.viewportTraversersMap)this.options.viewportTraversersMap[s]===n.viewport.id&&r.push(s);else r.push(n.viewport.id);t.updateVisibility(n,r)}compareDistanceToCamera(t,n){return t._distanceToCamera-n._distanceToCamera}anyChildrenVisible(t,n){let r=!1;for(let s of t.children)s.updateVisibility(n),r=r||s.isVisibleAndInRequestVolume;return r}executeEmptyTraversal(t,n){let r=!0,s=this._emptyTraversalStack;for(s.push(t);s.length>0;){let i=s.pop(),o=!i.hasRenderContent&&this.canTraverse(i,n,!1,!1),a=!i.hasRenderContent&&i.children.length===0;if(!o&&!i.contentAvailable&&!a&&(r=!1),this.updateTile(i,n),i.isVisibleAndInRequestVolume||(this.loadTile(i,n),this.touchTile(i,n)),o){let c=i.children;for(let l of c)s.push(l)}}return r}};var Ed=new x;function FT(e){return e!=null}var We=class{constructor(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"";this.tileset=void 0,this.header=void 0,this.id=void 0,this.url=void 0,this.parent=void 0,this.refine=void 0,this.type=void 0,this.contentUrl=void 0,this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=gt.UNLOADED,this.gpuMemoryUsageInBytes=0,this.children=[],this.depth=0,this.viewportIds=[],this.transform=new L,this.extensions=null,this.implicitTiling=null,this.userData={},this.computedTransform=void 0,this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.traverser=new te({}),this._cacheNode=null,this._frameNumber=null,this._expireDate=null,this._expiredContent=null,this._boundingBox=void 0,this._distanceToCamera=0,this._screenSpaceError=0,this._visibilityPlaneMask=void 0,this._visible=void 0,this._contentBoundingVolume=void 0,this._viewerRequestVolume=void 0,this._initialTransform=new L,this._priority=0,this._selectedFrame=0,this._requestedFrame=0,this._selectionDepth=0,this._touchedFrame=0,this._centerZDepth=0,this._shouldRefine=!1,this._stackLength=0,this._visitedFrame=0,this._inRequestVolume=!1,this._lodJudge=null,this.header=n,this.tileset=t,this.id=s||n.id,this.url=n.url,this.parent=r,this.refine=this._getRefine(n.refine),this.type=n.type,this.contentUrl=n.contentUrl,this._initializeLodMetric(n),this._initializeTransforms(n),this._initializeBoundingVolumes(n),this._initializeContent(n),this._initializeRenderingState(n),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===gt.READY||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===gt.UNLOADED}get contentExpired(){return this.contentState===gt.EXPIRED}get contentFailed(){return this.contentState===gt.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=fd(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,n){switch(this.tileset.type){case ut.I3S:return Wa(this,t);case ut.TILES3D:return gd(this,t,n);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){let t=this.tileset._traverser,{skipLevelOfDetail:n}=t.options,r=this.refine===yt.ADD||n;if(r&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===gt.UNLOADED)return-1;let s=this.parent,o=s&&(!r||this._screenSpaceError===0||s.hasTilesetContent)?s._screenSpaceError:this._screenSpaceError,a=t.root?t.root._screenSpaceError:0;return Math.max(a-o,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=gt.LOADING;let n=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!n)return this.contentState=gt.UNLOADED,!1;try{let r=this.tileset.getTileUrl(this.contentUrl),s=this.tileset.loader,i={...this.tileset.loadOptions,[s.id]:{...this.tileset.loadOptions[s.id],isTileset:this.type==="json",...this._getLoaderSpecificOptions(s.id)}};return this.content=await(0,Bd.load)(r,s,i),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=gt.READY,this._onContentLoaded(),!0}catch(r){throw this.contentState=gt.FAILED,r}finally{n.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=gt.UNLOADED,!0}updateVisibility(t,n){if(this._frameNumber===t.frameNumber)return;let r=this.parent,s=r?r._visibilityPlaneMask:it.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let i=r?r.computedTransform:this.tileset.modelMatrix;this._updateTransform(i)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,s),this._visible=this._visibilityPlaneMask!==it.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=n}visibility(t,n){let{cullingVolume:r}=t,{boundingVolume:s}=this;return r.computeVisibilityWithPlaneMask(s,n)}contentVisibility(){return!0}distanceToTile(t){let n=this.boundingVolume;return Math.sqrt(Math.max(n.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth(t){let{camera:n}=t,r=this.boundingVolume;return Ed.subVectors(r.center,n.position),n.direction.dot(Ed)}insideViewerRequestVolume(t){let n=this._viewerRequestVolume;return!n||n.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(FT(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=gt.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){"lodMetricType"in t?this.lodMetricType=t.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 t?this.lodMetricValue=t.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(t){this.transform=t.transform?new L(t.transform):new L;let n=this.parent,r=this.tileset,s=n&&n.computedTransform?n.computedTransform.clone():r.modelMatrix.clone();this.computedTransform=new L(s).multiplyRight(this.transform);let i=n&&n._initialTransform?n._initialTransform.clone():new L;this._initialTransform=new L(i).multiplyRight(this.transform)}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=gt.UNLOADED,this.hasTilesetContent=!1,t.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=it.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(t){return t||this.parent&&this.parent.refine||yt.REPLACE}_isTileset(){return this.contentUrl.indexOf(".json")!==-1}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(t){this.boundingVolume=si(t.boundingVolume,this.computedTransform,this.boundingVolume);let n=t.content;n&&(n.boundingVolume&&(this._contentBoundingVolume=si(n.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=si(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(){let n=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:new L).clone().multiplyRight(this.transform);n.equals(this.computedTransform)||(this.computedTransform=n,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(t){switch(t){case"i3s":return{...this.tileset.options.i3s,_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1};case"3d-tiles":case"cesium-ion":default:return _d(this.tileset.tileset)}}};var ii=class extends te{compareDistanceToCamera(t,n){return n._distanceToCamera===0&&t._distanceToCamera===0?n._centerZDepth-t._centerZDepth:n._distanceToCamera-t._distanceToCamera}updateTileVisibility(t,n){if(super.updateTileVisibility(t,n),!t.isVisibleAndInRequestVolume)return;let r=t.children.length>0;if(t.hasTilesetContent&&r){let o=t.children[0];this.updateTileVisibility(o,n),t._visible=o._visible;return}if(this.meetsScreenSpaceErrorEarly(t,n)){t._visible=!1;return}let s=t.refine===yt.REPLACE,i=t._optimChildrenWithinParent===ad.USE_OPTIMIZATION;if(s&&i&&r&&!this.anyChildrenVisible(t,n)){t._visible=!1;return}}meetsScreenSpaceErrorEarly(t,n){let{parent:r}=t;return!r||r.hasTilesetContent||r.refine!==yt.ADD?!1:!this.shouldRefine(t,n,!0)}};var Cd=O(Tn(),1);var oi=class{constructor(){this.frameNumberMap=new Map}register(t,n){let r=this.frameNumberMap.get(t)||new Map,s=r.get(n)||0;r.set(n,s+1),this.frameNumberMap.set(t,r)}deregister(t,n){let r=this.frameNumberMap.get(t);if(!r)return;let s=r.get(n)||1;r.set(n,s-1)}isZero(t,n){var r;return(((r=this.frameNumberMap.get(t))===null||r===void 0?void 0:r.get(n))||0)===0}};var Ya={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},ai=class{constructor(){this._statusMap=void 0,this.pendingTilesRegister=new oi,this._statusMap={}}add(t,n,r,s){if(!this._statusMap[n]){let{frameNumber:i,viewport:{id:o}}=s;this._statusMap[n]={request:t,callback:r,key:n,frameState:s,status:Ya.REQUESTED},this.pendingTilesRegister.register(o,i),t().then(a=>{this._statusMap[n].status=Ya.COMPLETED;let{frameNumber:c,viewport:{id:l}}=this._statusMap[n].frameState;this.pendingTilesRegister.deregister(l,c),this._statusMap[n].callback(a,s)}).catch(a=>{this._statusMap[n].status=Ya.ERROR;let{frameNumber:c,viewport:{id:l}}=this._statusMap[n].frameState;this.pendingTilesRegister.deregister(l,c),r(a)})}}update(t,n){if(this._statusMap[t]){let{frameNumber:r,viewport:{id:s}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(s,r);let{frameNumber:i,viewport:{id:o}}=n;this.pendingTilesRegister.register(o,i),this._statusMap[t].frameState=n}}find(t){return this._statusMap[t]}hasPendingTiles(t,n){return!this.pendingTilesRegister.isZero(t,n)}};var ci=class extends te{constructor(t){super(t),this._tileManager=void 0,this._tileManager=new ai}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,n){return t._lodJudge=Td(t,n),t._lodJudge==="DIG"}updateChildTiles(t,n){let r=t.header.children||[],s=t.children,i=t.tileset;for(let o of r){let a=`${o.id}-${n.viewport.id}`,c=s&&s.find(l=>l.id===a);if(c)c&&this.updateTile(c,n);else{let l=()=>this._loadTile(o.id,i);this._tileManager.find(a)?this._tileManager.update(a,n):(i.tileset.nodePages&&(l=()=>i.tileset.nodePagesTile.formTileFromNodePages(o.id)),this._tileManager.add(l,a,h=>this._onTileLoad(h,t,a),n))}}return!1}async _loadTile(t,n){let{loader:r}=n,s=n.getTileUrl(`${n.url}/nodes/${t}`),i={...n.loadOptions,i3s:{...n.loadOptions.i3s,isTileHeader:!0}};return await(0,Cd.load)(s,r,i)}_onTileLoad(t,n,r){let s=new We(n.tileset,t,n,r);n.children.push(s);let i=this._tileManager.find(s.id).frameState;this.updateTile(s,i),this._frameNumber===i.frameNumber&&(this.traversalFinished(i)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(s,i)}};var vT={description:"",ellipsoid:D.WGS84,modelMatrix:new L,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,memoryCacheOverflow:1,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,memoryAdjustedScreenSpaceError:!1,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},li="Tiles In Tileset(s)",Ka="Tiles In Memory",Sd="Tiles In View",bd="Tiles To Render",Md="Tiles Loaded",Qa="Tiles Loading",Id="Tiles Unloaded",wd="Failed Tile Loads",Fd="Points/Vertices",Za="Tile Memory Use",vd="Maximum Screen Space Error",Br=class{constructor(t,n){this.options=void 0,this.loadOptions=void 0,this.type=void 0,this.tileset=void 0,this.loader=void 0,this.url=void 0,this.basePath=void 0,this.modelMatrix=void 0,this.ellipsoid=void 0,this.lodMetricType=void 0,this.lodMetricValue=void 0,this.refine=void 0,this.root=null,this.roots={},this.asset={},this.description="",this.properties=void 0,this.extras=null,this.attributions={},this.credits={},this.stats=void 0,this.contentFormats={draco:!1,meshopt:!1,dds:!1,ktx2:!1},this.cartographicCenter=null,this.cartesianCenter=null,this.zoom=1,this.boundingVolume=null,this.dynamicScreenSpaceErrorComputedDensity=0,this.maximumMemoryUsage=32,this.gpuMemoryUsageInBytes=0,this.memoryAdjustedScreenSpaceError=0,this._cacheBytes=0,this._cacheOverflowBytes=0,this._frameNumber=0,this._queryParams={},this._extensionsUsed=[],this._tiles={},this._pendingCount=0,this.selectedTiles=[],this.traverseCounter=0,this.geometricError=0,this.lastUpdatedVieports=null,this._requestedTiles=[],this._emptyTiles=[],this.frameStateData={},this._traverser=void 0,this._cache=new ei,this._requestScheduler=void 0,this.updatePromise=null,this.tilesetInitializationPromise=void 0,this.options={...vT,...n},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||ge.dirname(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.root.refine,this.loadOptions=this.options.loadOptions||{},this._traverser=this._initializeTraverser(),this._requestScheduler=new me({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.memoryAdjustedScreenSpaceError=this.options.maximumScreenSpaceError,this._cacheBytes=this.options.maximumMemoryUsage*1024*1024,this._cacheOverflowBytes=this.options.memoryCacheOverflow*1024*1024,this.stats=new pe({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(t){this.options={...this.options,...t}}getTileUrl(t){if(t.startsWith("data:"))return t;let r=t;return this.queryParams.length&&(r=`${t}${t.includes("?")?"&":"?"}${this.queryParams}`),r}hasExtension(t){return Boolean(this._extensionsUsed.indexOf(t)>-1)}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;this.tilesetInitializationPromise.then(()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)})}async selectTiles(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise(n=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),n(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytes<this._cacheBytes?this.memoryAdjustedScreenSpaceError=Math.max(this.memoryAdjustedScreenSpaceError/1.02,this.options.maximumScreenSpaceError):this.gpuMemoryUsageInBytes>this._cacheBytes+this._cacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let n=t instanceof Array?t:[t];this._cache.reset(),this._frameNumber++,this.traverseCounter=n.length;let r=[];for(let s of n){let i=s.id;this._needTraverse(i)?r.push(i):this.traverseCounter--}for(let s of n){let i=s.id;if(this.roots[i]||(this.roots[i]=this._initializeTileHeaders(this.tileset,null)),!r.includes(i))continue;let o=rd(s,this._frameNumber);this._traverser.traverse(this.roots[i],o,this.options)}}_needTraverse(t){let n=t;return this.options.viewportTraversersMap&&(n=this.options.viewportTraversersMap[t]),n===t}_onTraversalEnd(t){let n=t.viewport.id;this.frameStateData[n]||(this.frameStateData[n]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let r=this.frameStateData[n],s=Object.values(this._traverser.selectedTiles),[i,o]=sd(s,t,this.options.maximumTilesSelected);r.selectedTiles=i;for(let a of o)a.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(let t in this.frameStateData){let n=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(n.selectedTiles),this._requestedTiles=this._requestedTiles.concat(n._requestedTiles),this._emptyTiles=this._emptyTiles.concat(n._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(let t of this.selectedTiles)this._tiles[t.id]=t;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(t,n){if(t.length!==n.length)return!0;let r=new Set(t.map(o=>o.id)),s=new Set(n.map(o=>o.id)),i=t.filter(o=>!s.has(o.id)).length>0;return i=i||n.filter(o=>!r.has(o.id)).length>0,i}_loadTiles(){for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,n)=>t._unloadTile(n))}_updateStats(){let t=0,n=0;for(let r of this.selectedTiles)r.contentAvailable&&r.content&&(t++,r.content.pointCount?n+=r.content.pointCount:n+=r.content.vertexCount);this.stats.get(Sd).count=this.selectedTiles.length,this.stats.get(bd).count=t,this.stats.get(Fd).count=n,this.stats.get(vd).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(t){this.type===ut.I3S&&(this.calculateViewPropsI3S(),t.root=await t.root),this.root=this._initializeTileHeaders(t,null),this.type===ut.TILES3D&&(this._initializeTiles3DTileset(t),this.calculateViewPropsTiles3D()),this.type===ut.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){var t;let n=this.tileset.fullExtent;if(n){let{xmin:s,xmax:i,ymin:o,ymax:a,zmin:c,zmax:l}=n;this.cartographicCenter=new x(s+(i-s)/2,o+(a-o)/2,c+(l-c)/2),this.cartesianCenter=new x,D.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=qa(n,this.cartographicCenter,this.cartesianCenter);return}let r=(t=this.tileset.store)===null||t===void 0?void 0:t.extent;if(r){let[s,i,o,a]=r;this.cartographicCenter=new x(s+(o-s)/2,i+(a-i)/2,0),this.cartesianCenter=new x,D.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=od(r,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new x,this.zoom=1}calculateViewPropsTiles3D(){let t=this.root,{center:n}=t.boundingVolume;if(!n){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new x,this.zoom=1;return}n[0]!==0||n[1]!==0||n[2]!==0?(this.cartographicCenter=new x,D.WGS84.cartesianToCartographic(n,this.cartographicCenter)):this.cartographicCenter=new x(0,0,-D.WGS84.radii[0]),this.cartesianCenter=n,this.zoom=id(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(li),this.stats.get(Qa),this.stats.get(Ka),this.stats.get(Sd),this.stats.get(bd),this.stats.get(Md),this.stats.get(Id),this.stats.get(wd),this.stats.get(Fd),this.stats.get(Za,"memory"),this.stats.get(vd)}_initializeTileHeaders(t,n){let r=new We(this,t.root,n);if(n&&(n.children.push(r),r.depth=n.depth+1),this.type===ut.TILES3D){let i=[];for(i.push(r);i.length>0;){let o=i.pop();this.stats.get(li).incrementCount();let a=o.header.children||[];for(let c of a){var s;let l=new We(this,c,o);if((s=l.contentUrl)!==null&&s!==void 0&&s.includes("?session=")){let h=new URL(l.contentUrl).searchParams.get("session");h&&(this._queryParams.session=h)}o.children.push(l),l.depth=o.depth+1,i.push(l)}}}return r}_initializeTraverser(){let t;switch(this.type){case ut.TILES3D:t=ii;break;case ut.I3S:t=ci;break;default:t=te}return new t({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let n;try{this._onStartTileLoading(),n=await t.loadContent()}catch(r){this._onTileLoadError(t,r instanceof Error?r:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(t,n)}}_onTileLoadError(t,n){this.stats.get(wd).incrementCount();let r=n.message||n.toString(),s=t.url;console.error(`A 3D tile failed to load: ${t.url} ${r}`),this.options.onTileError(t,r,s)}_onTileLoad(t,n){if(n){if(this.type===ut.I3S){var r,s;let i=((r=this.tileset)===null||r===void 0||(s=r.nodePagesTile)===null||s===void 0?void 0:s.nodesInNodePages)||0;this.stats.get(li).reset(),this.stats.get(li).addCount(i)}t&&t.content&&td(t,t.content),this.updateContentTypes(t),this._addTileToCache(t),this.options.onTileLoad(t)}}updateContentTypes(t){if(this.type===ut.I3S)switch(t.header.isDracoGeometry&&(this.contentFormats.draco=!0),t.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}else if(this.type===ut.TILES3D){var n;let{extensionsRemoved:r=[]}=((n=t.content)===null||n===void 0?void 0:n.gltf)||{};r.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),r.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),r.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(Qa).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(Qa).decrementCount()}_addTileToCache(t){this._cache.add(this,t,n=>n._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(Md).incrementCount(),this.stats.get(Ka).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(Za).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(Ka).decrementCount(),this.stats.get(Id).incrementCount(),this.stats.get(Za).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){let t=[];for(this.root&&t.push(this.root);t.length>0;){let n=t.pop();for(let r of n.children)t.push(r);this._destroyTile(n)}this.root=null}_destroySubtree(t){let n=t,r=[];for(r.push(n);r.length>0;){t=r.pop();for(let s of t.children)r.push(s);t!==n&&this._destroyTile(t)}n.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeTiles3DTileset(t){if(t.queryString){let n=new URLSearchParams(t.queryString),r=Object.fromEntries(n.entries());this._queryParams={...this._queryParams,...r}}if(this.asset=t.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=t.properties,this.geometricError=t.geometricError,this._extensionsUsed=t.extensionsUsed||[],this.extras=t.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}};var ui="4.1.4";var Ye={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},eP=Object.keys(Ye);function $a(e,t,n){G(e instanceof ArrayBuffer);let r=new TextDecoder("utf8"),s=new Uint8Array(e,t,n);return r.decode(s)}function Rd(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=new DataView(e);return`${String.fromCharCode(n.getUint8(t+0))}${String.fromCharCode(n.getUint8(t+1))}${String.fromCharCode(n.getUint8(t+2))}${String.fromCharCode(n.getUint8(t+3))}`}var Ld="4.1.4";var Pd={name:"Draco",id:"draco",module:"draco",version:Ld,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function Od(e){switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function Ke(e){let t=1/0,n=1/0,r=1/0,s=-1/0,i=-1/0,o=-1/0,a=e.POSITION?e.POSITION.value:[],c=a&&a.length;for(let l=0;l<c;l+=3){let u=a[l],h=a[l+1],f=a[l+2];t=u<t?u:t,n=h<n?h:n,r=f<r?f:r,s=u>s?u:s,i=h>i?h:i,o=f>o?f:o}return[[t,n,r],[s,i,o]]}function tc(e,t,n){let r=Od(t.value),s=n||Nd(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:r}]},nullable:!1,metadata:s}}function Nd(e){let t={};return"byteOffset"in e&&(t.byteOffset=e.byteOffset.toString(10)),"byteStride"in e&&(t.byteStride=e.byteStride.toString(10)),"normalized"in e&&(t.normalized=e.normalized.toString()),t}function Ud(e,t,n){let r=Gd(t.metadata),s=[],i=RT(t.attributes);for(let o in e){let a=e[o],c=Dd(o,a,i[o]);s.push(c)}if(n){let o=Dd("indices",n);s.push(o)}return{fields:s,metadata:r}}function RT(e){let t={};for(let n in e){let r=e[n];t[r.name||"undefined"]=r}return t}function Dd(e,t,n){let r=n?Gd(n.metadata):void 0;return tc(e,t,r)}function Gd(e){Object.entries(e);let t={};for(let n in e)t[`${n}.string`]=JSON.stringify(e[n]);return t}var Vd={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},LT={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},PT=4,Cr=class{constructor(t){this.draco=void 0,this.decoder=void 0,this.metadataQuerier=void 0,this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=new this.draco.DecoderBuffer;r.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(n);let s=this.decoder.GetEncodedGeometryType(r),i=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(s){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(r,i);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(r,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!i.ptr){let f=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(f)}let a=this._getDracoLoaderData(i,s,n),c=this._getMeshData(i,a,n),l=Ke(c.attributes),u=Ud(c.attributes,a,c.indices);return{loader:"draco",loaderData:a,header:{vertexCount:i.num_points(),boundingBox:l},...c,schema:u}}finally{this.draco.destroy(r),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,n,r){let s=this._getTopLevelMetadata(t),i=this._getDracoAttributes(t,r);return{geometry_type:n,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:s,attributes:i}}_getDracoAttributes(t,n){let r={};for(let s=0;s<t.num_attributes();s++){let i=this.decoder.GetAttribute(t,s),o=this._getAttributeMetadata(t,s);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:s,metadata:o};let a=this._getQuantizationTransform(i,n);a&&(r[i.unique_id()].quantization_transform=a);let c=this._getOctahedronTransform(i,n);c&&(r[i.unique_id()].octahedron_transform=c)}return r}_getMeshData(t,n,r){let s=this._getMeshAttributes(n,t,r);if(!s.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:s,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:s,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:s}}_getMeshAttributes(t,n,r){let s={};for(let i of Object.values(t.attributes)){let o=this._deduceAttributeName(i,r);i.name=o;let{value:a,size:c}=this._getAttributeValues(n,i);s[o]={value:a,size:c,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}return s}_getTriangleListIndices(t){let r=t.num_faces()*3,s=r*PT,i=this.draco._malloc(s);try{return this.decoder.GetTrianglesUInt32Array(t,s,i),new Uint32Array(this.draco.HEAPF32.buffer,i,r).slice()}finally{this.draco._free(i)}}_getTriangleStripIndices(t){let n=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,n),DT(n)}finally{this.draco.destroy(n)}}_getAttributeValues(t,n){let r=LT[n.data_type],s=n.num_components,o=t.num_points()*s,a=o*r.BYTES_PER_ELEMENT,c=OT(this.draco,r),l,u=this.draco._malloc(a);try{let h=this.decoder.GetAttribute(t,n.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,h,c,a,u),l=new r(this.draco.HEAPF32.buffer,u,o).slice()}finally{this.draco._free(u)}return{value:l,size:s}}_deduceAttributeName(t,n){let r=t.unique_id;for(let[o,a]of Object.entries(n.extraAttributes||{}))if(a===r)return o;let s=t.attribute_type;for(let o in Vd)if(this.draco[o]===s)return Vd[o];let i=n.attributeNameEntry||"name";return t.metadata[i]?t.metadata[i].string:`CUSTOM_ATTRIBUTE_${r}`}_getTopLevelMetadata(t){let n=this.decoder.GetMetadata(t);return this._getDracoMetadata(n)}_getAttributeMetadata(t,n){let r=this.decoder.GetAttributeMetadata(t,n);return this._getDracoMetadata(r)}_getDracoMetadata(t){if(!t||!t.ptr)return{};let n={},r=this.metadataQuerier.NumEntries(t);for(let s=0;s<r;s++){let i=this.metadataQuerier.GetEntryName(t,s);n[i]=this._getDracoMetadataField(t,i)}return n}_getDracoMetadataField(t,n){let r=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,n,r);let s=NT(r);return{int:this.metadataQuerier.GetIntEntry(t,n),string:this.metadataQuerier.GetStringEntry(t,n),double:this.metadataQuerier.GetDoubleEntry(t,n),intArray:s}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(t){let{quantizedAttributes:n=[],octahedronAttributes:r=[]}=t,s=[...n,...r];for(let i of s)this.decoder.SkipAttributeTransform(this.draco[i])}_getQuantizationTransform(t,n){let{quantizedAttributes:r=[]}=n,s=t.attribute_type();if(r.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:new Float32Array([1,2,3]).map(a=>o.min_value(a))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(t,n){let{octahedronAttributes:r=[]}=n,s=t.attribute_type();if(r.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function OT(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}}function NT(e){let t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}function DT(e){let t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}var UT="1.5.6",GT="1.4.1",ec=`https://www.gstatic.com/draco/versioned/decoders/${UT}`,Tt={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},nc={[Tt.DECODER]:`${ec}/${Tt.DECODER}`,[Tt.DECODER_WASM]:`${ec}/${Tt.DECODER_WASM}`,[Tt.FALLBACK_DECODER]:`${ec}/${Tt.FALLBACK_DECODER}`,[Tt.ENCODER]:`https://raw.githubusercontent.com/google/draco/${GT}/javascript/${Tt.ENCODER}`},Sr;async function Hd(e){let t=e.modules||{};return t.draco3d?Sr=Sr||t.draco3d.createDecoderModule({}).then(n=>({draco:n})):Sr=Sr||VT(e),await Sr}async function VT(e){let t,n;switch(e.draco&&e.draco.decoderType){case"js":t=await Xt(nc[Tt.FALLBACK_DECODER],"draco",e,Tt.FALLBACK_DECODER);break;case"wasm":default:[t,n]=await Promise.all([await Xt(nc[Tt.DECODER],"draco",e,Tt.DECODER),await Xt(nc[Tt.DECODER_WASM],"draco",e,Tt.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await HT(t,n)}function HT(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e({...n,onModuleLoaded:s=>r({draco:s})})})}var hi={...Pd,parse:zT};async function zT(e,t){let{draco:n}=await Hd(t),r=new Cr(n);try{return r.parseSync(e,t?.draco)}finally{r.destroy()}}var kT={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},rt={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},P={...kT,...rt};var rc={[rt.DOUBLE]:Float64Array,[rt.FLOAT]:Float32Array,[rt.UNSIGNED_SHORT]:Uint16Array,[rt.UNSIGNED_INT]:Uint32Array,[rt.UNSIGNED_BYTE]:Uint8Array,[rt.BYTE]:Int8Array,[rt.SHORT]:Int16Array,[rt.INT]:Int32Array},JT={DOUBLE:rt.DOUBLE,FLOAT:rt.FLOAT,UNSIGNED_SHORT:rt.UNSIGNED_SHORT,UNSIGNED_INT:rt.UNSIGNED_INT,UNSIGNED_BYTE:rt.UNSIGNED_BYTE,BYTE:rt.BYTE,SHORT:rt.SHORT,INT:rt.INT},sc="Failed to convert GL type",ft=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let n in rc)if(rc[n]===t)return n;throw new Error(sc)}static fromName(t){let n=JT[t];if(!n)throw new Error(sc);return n}static getArrayType(t){switch(t){case rt.UNSIGNED_SHORT_5_6_5:case rt.UNSIGNED_SHORT_4_4_4_4:case rt.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let n=rc[t];if(!n)throw new Error(sc);return n}}static getByteSize(t){return ft.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(ft.getArrayType(t))}static createTypedArray(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;s===void 0&&(s=(n.byteLength-r)/ft.getByteSize(t));let i=ft.getArrayType(t);return new i(n,r,s)}};function zd(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function ic(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0],n=e>>11&31,r=e>>5&63,s=e&31;return t[0]=n<<3,t[1]=r<<2,t[2]=s<<3,t}var OP=1/256;var NP=new De,DP=new x,UP=new De,GP=new De,VP=new Uint8Array(1);function kd(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:255;return ls(e,0,t)/t*2-1}function Jd(e){return e<0?-1:1}function qd(e,t,n,r){if(zd(r),e<0||e>n||t<0||t>n)throw new Error(`x and y must be unsigned normalized integers between 0 and ${n}`);if(r.x=kd(e,n),r.y=kd(t,n),r.z=1-(Math.abs(r.x)+Math.abs(r.y)),r.z<0){let s=r.x;r.x=(1-Math.abs(r.y))*Jd(s),r.y=(1-Math.abs(s))*Jd(r.y)}return r.normalize()}function oc(e,t,n){return qd(e,t,255,n)}var ce=class{constructor(t,n){this.json=void 0,this.buffer=void 0,this.featuresLength=0,this._cachedTypedArrays={},this.json=t,this.buffer=n}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:P.UNSIGNED_INT,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,s=this.json[t];return s&&Number.isFinite(s.byteOffset)?this._getTypedArrayFromBinary(t,n,r,1,s.byteOffset):s}getPropertyArray(t,n,r){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?("componentType"in s&&(n=ft.fromName(s.componentType)),this._getTypedArrayFromBinary(t,n,r,this.featuresLength,s.byteOffset)):this._getTypedArrayFromArray(t,n,s)}getProperty(t,n,r,s,i){let o=this.json[t];if(!o)return o;let a=this.getPropertyArray(t,n,r);if(r===1)return a[s];for(let c=0;c<r;++c)i[c]=a[r*s+c];return i}_getTypedArrayFromBinary(t,n,r,s,i){let o=this._cachedTypedArrays,a=o[t];return a||(a=ft.createTypedArray(n,this.buffer.buffer,this.buffer.byteOffset+i,s*r),o[t]=a),a}_getTypedArrayFromArray(t,n,r){let s=this._cachedTypedArrays,i=s[t];return i||(i=ft.createTypedArray(n,r),s[t]=i),i}};var qT={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},jT={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]]},XT={SCALAR:(e,t,n)=>{t[n]=e},VEC2:(e,t,n)=>{t[2*n+0]=e[0],t[2*n+1]=e[1]},VEC3:(e,t,n)=>{t[3*n+0]=e[0],t[3*n+1]=e[1],t[3*n+2]=e[2]},VEC4:(e,t,n)=>{t[4*n+0]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]},MAT2:(e,t,n)=>{t[4*n+0]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]},MAT3:(e,t,n)=>{t[9*n+0]=e[0],t[9*n+1]=e[1],t[9*n+2]=e[2],t[9*n+3]=e[3],t[9*n+4]=e[4],t[9*n+5]=e[5],t[9*n+6]=e[6],t[9*n+7]=e[7],t[9*n+8]=e[8],t[9*n+9]=e[9]},MAT4:(e,t,n)=>{t[16*n+0]=e[0],t[16*n+1]=e[1],t[16*n+2]=e[2],t[16*n+3]=e[3],t[16*n+4]=e[4],t[16*n+5]=e[5],t[16*n+6]=e[6],t[16*n+7]=e[7],t[16*n+8]=e[8],t[16*n+9]=e[9],t[16*n+10]=e[10],t[16*n+11]=e[11],t[16*n+12]=e[12],t[16*n+13]=e[13],t[16*n+14]=e[14],t[16*n+15]=e[15]}};function jd(e,t,n,r){let{componentType:s}=e;G(e.componentType);let i=typeof s=="string"?ft.fromName(s):s,o=qT[e.type],a=jT[e.type],c=XT[e.type];return n+=e.byteOffset,{values:ft.createTypedArray(i,t,n,o*r),type:i,size:o,unpacker:a,packer:c}}var ee=e=>e!==void 0;function Xd(e,t,n){if(!t)return null;let r=e.getExtension("3DTILES_batch_table_hierarchy"),s=t.HIERARCHY;return s&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=s,r=s),r?WT(r,n):null}function WT(e,t){let n,r,s,i=e.instancesLength,o=e.classes,a=e.classIds,c=e.parentCounts,l=e.parentIds,u=i;ee(a.byteOffset)&&(a.componentType=defaultValue(a.componentType,GL.UNSIGNED_SHORT),a.type=AttributeType.SCALAR,s=getBinaryAccessor(a),a=s.createArrayBufferView(t.buffer,t.byteOffset+a.byteOffset,i));let h;if(ee(c))for(ee(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,s=getBinaryAccessor(c),c=s.createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,i)),h=new Uint16Array(i),u=0,n=0;n<i;++n)h[n]=u,u+=c[n];ee(l)&&ee(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,s=getBinaryAccessor(l),l=s.createArrayBufferView(t.buffer,t.byteOffset+l.byteOffset,u));let f=o.length;for(n=0;n<f;++n){let g=o[n].length,y=o[n].instances,E=getBinaryProperties(g,y,t);o[n].instances=combine(E,y)}let d=new Array(f).fill(0),p=new Uint16Array(i);for(n=0;n<i;++n)r=a[n],p[n]=d[r],++d[r];let A={classes:o,classIds:a,classIndexes:p,parentCounts:c,parentIndexes:h,parentIds:l};return QT(A),A}function Bn(e,t,n){if(!e)return;let r=e.parentCounts;return e.parentIds?n(e,t):r>0?YT(e,t,n):KT(e,t,n)}function YT(e,t,n){let r=e.classIds,s=e.parentCounts,i=e.parentIds,o=e.parentIndexes,a=r.length,c=scratchVisited;c.length=Math.max(c.length,a);let l=++marker,u=scratchStack;for(u.length=0,u.push(t);u.length>0;){if(t=u.pop(),c[t]===l)continue;c[t]=l;let h=n(e,t);if(ee(h))return h;let f=s[t],d=o[t];for(let p=0;p<f;++p){let A=i[d+p];A!==t&&u.push(A)}}return null}function KT(e,t,n){let r=!0;for(;r;){let s=n(e,t);if(ee(s))return s;let i=e.parentIds[t];r=i!==t,t=i}throw new Error("traverseHierarchySingleParent")}function QT(e){let t=[],r=e.classIds.length;for(let s=0;s<r;++s)Wd(e,s,stack)}function Wd(e,t,n){let r=e.parentCounts,s=e.parentIds,i=e.parentIndexes,a=e.classIds.length;if(!ee(s))return;assert(t<a,`Parent index ${t} exceeds the total number of instances: ${a}`),assert(n.indexOf(t)===-1,"Circular dependency detected in the batch table hierarchy."),n.push(t);let c=ee(r)?r[t]:1,l=ee(r)?i[t]:t;for(let u=0;u<c;++u){let h=s[l+u];h!==t&&Wd(e,h,n)}n.pop(t)}function _t(e){return e!=null}var fi=(e,t)=>e,ZT={HIERARCHY:!0,extensions:!0,extras:!0},Qe=class{constructor(t,n,r){var s;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};this.json=void 0,this.binary=void 0,this.featureCount=void 0,this._extensions=void 0,this._properties=void 0,this._binaryProperties=void 0,this._hierarchy=void 0,G(r>=0),this.json=t||{},this.binary=n,this.featureCount=r,this._extensions=((s=this.json)===null||s===void 0?void 0:s.extensions)||{},this._properties={};for(let o in this.json)ZT[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),i["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=Xd(this,this.json,this.binary))}getExtension(t){return this.json&&this.json.extensions&&this.json.extensions[t]}memorySizeInBytes(){return 0}isClass(t,n){if(this._checkBatchId(t),G(typeof n=="string",n),this._hierarchy){let r=Bn(this._hierarchy,t,(s,i)=>{let o=s.classIds[i];return s.classes[o].name===n});return _t(r)}return!1}isExactClass(t,n){return G(typeof n=="string",n),this.getExactClassName(t)===n}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){let n=this._hierarchy.classIds[t];return this._hierarchy.classes[n].name}}hasProperty(t,n){return this._checkBatchId(t),G(typeof n=="string",n),_t(this._properties[n])||this._hasPropertyInHierarchy(t,n)}getPropertyNames(t,n){this._checkBatchId(t),n=_t(n)?n:[],n.length=0;let r=Object.keys(this._properties);return n.push(...r),this._hierarchy&&this._getPropertyNamesInHierarchy(t,n),n}getProperty(t,n){if(this._checkBatchId(t),G(typeof n=="string",n),this._binaryProperties){let s=this._binaryProperties[n];if(_t(s))return this._getBinaryProperty(s,t)}let r=this._properties[n];if(_t(r))return fi(r[t],!0);if(this._hierarchy){let s=this._getHierarchyProperty(t,n);if(_t(s))return s}}setProperty(t,n,r){let s=this.featureCount;if(this._checkBatchId(t),G(typeof n=="string",n),this._binaryProperties){let o=this._binaryProperties[n];if(o){this._setBinaryProperty(o,t,r);return}}if(this._hierarchy&&this._setHierarchyProperty(this,t,n,r))return;let i=this._properties[n];_t(i)||(this._properties[n]=new Array(s),i=this._properties[n]),i[t]=fi(r,!0)}_checkBatchId(t){if(!(t>=0&&t<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(t,n){return t.unpack(t.typedArray,n)}_setBinaryProperty(t,n,r){t.pack(r,t.typedArray,n)}_initializeBinaryProperties(){let t=null;for(let n in this._properties){let r=this._properties[n],s=this._initializeBinaryProperty(n,r);s&&(t=t||{},t[n]=s)}return t}_initializeBinaryProperty(t,n){if("byteOffset"in n){let r=n;G(this.binary,`Property ${t} requires a batch table binary.`),G(r.type,`Property ${t} requires a type.`);let s=jd(r,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:s.values,componentCount:s.size,unpack:s.unpacker,pack:s.packer}}return null}_hasPropertyInHierarchy(t,n){if(!this._hierarchy)return!1;let r=Bn(this._hierarchy,t,(s,i)=>{let o=s.classIds[i],a=s.classes[o].instances;return _t(a[n])});return _t(r)}_getPropertyNamesInHierarchy(t,n){Bn(this._hierarchy,t,(r,s)=>{let i=r.classIds[s],o=r.classes[i].instances;for(let a in o)o.hasOwnProperty(a)&&n.indexOf(a)===-1&&n.push(a)})}_getHierarchyProperty(t,n){return Bn(this._hierarchy,t,(r,s)=>{let i=r.classIds[s],o=r.classes[i],a=r.classIndexes[s],c=o.instances[n];return _t(c)?_t(c.typedArray)?this._getBinaryProperty(c,a):fi(c[a],!0):null})}_setHierarchyProperty(t,n,r,s){let i=Bn(this._hierarchy,n,(o,a)=>{let c=o.classIds[a],l=o.classes[c],u=o.classIndexes[a],h=l.instances[r];return _t(h)?(G(a===n,`Inherited property "${r}" is read-only.`),_t(h.typedArray)?this._setBinaryProperty(h,u,s):h[u]=fi(s,!0),!0):!1});return _t(i)}};function Me(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=new DataView(t);if(e.magic=r.getUint32(n,!0),n+=4,e.version=r.getUint32(n,!0),n+=4,e.byteLength=r.getUint32(n,!0),n+=4,e.version!==1)throw new Error(`3D Tile Version ${e.version} not supported`);return n}var Cn=4,Yd="b3dm tile in legacy format.";function Sn(e,t,n){let r=new DataView(t),s;e.header=e.header||{};let i=r.getUint32(n,!0);n+=Cn;let o=r.getUint32(n,!0);n+=Cn;let a=r.getUint32(n,!0);n+=Cn;let c=r.getUint32(n,!0);return n+=Cn,a>=570425344?(n-=Cn*2,s=i,a=o,c=0,i=0,o=0,console.warn(Yd)):c>=570425344&&(n-=Cn,s=a,a=i,c=o,i=0,o=0,console.warn(Yd)),e.header.featureTableJsonByteLength=i,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=a,e.header.batchTableBinaryByteLength=c,e.header.batchLength=s,n}function bn(e,t,n,r){return n=$T(e,t,n,r),n=t_(e,t,n,r),n}function $T(e,t,n,r){let{featureTableJsonByteLength:s,featureTableBinaryByteLength:i,batchLength:o}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:o||0},s&&s>0){let a=$a(t,n,s);e.featureTableJson=JSON.parse(a)}return n+=s||0,e.featureTableBinary=new Uint8Array(t,n,i),n+=i||0,n}function t_(e,t,n,r){let{batchTableJsonByteLength:s,batchTableBinaryByteLength:i}=e.header||{};if(s&&s>0){let o=$a(t,n,s);e.batchTableJson=JSON.parse(o),n+=s,i&&i>0&&(e.batchTableBinary=new Uint8Array(t,n,i),e.batchTableBinary=new Uint8Array(e.batchTableBinary),n+=i)}return n}function ac(e,t,n){if(!t&&(!e||!e.batchIds||!n))return null;let{batchIds:r,isRGB565:s,pointCount:i=0}=e;if(r&&n){let o=new Uint8ClampedArray(i*3);for(let a=0;a<i;a++){let c=r[a],u=n.getProperty(c,"dimensions").map(h=>h*255);o[a*3]=u[0],o[a*3+1]=u[1],o[a*3+2]=u[2]}return{type:P.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}if(t&&s){let o=new Uint8ClampedArray(i*3);for(let a=0;a<i;a++){let c=ic(t[a]);o[a*3]=c[0],o[a*3+1]=c[1],o[a*3+2]=c[2]}return{type:P.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}return t&&t.length===i*3?{type:P.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:P.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var Kd=new x;function Qd(e,t){if(!t)return null;if(e.isOctEncoded16P){let n=new Float32Array((e.pointsLength||0)*3);for(let r=0;r<(e.pointsLength||0);r++)oc(t[r*2],t[r*2+1],Kd),Kd.toArray(n,r*3);return{type:P.FLOAT,size:2,value:n}}return{type:P.FLOAT,size:2,value:t}}function Zd(e,t,n){return e.isQuantized?n["3d-tiles"]&&n["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,e_(e,t)):{type:P.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function e_(e,t){let n=new x,r=new Float32Array(e.pointCount*3);for(let s=0;s<e.pointCount;s++)n.set(t[s*3],t[s*3+1],t[s*3+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(r,s*3);return r}async function $d(e,t,n,r,s){n=Me(e,t,n),n=Sn(e,t,n),n=bn(e,t,n,r),n_(e);let{featureTable:i,batchTable:o}=r_(e);return await c_(e,i,o,r,s),s_(e,i,r),i_(e,i,o),o_(e,i),n}function n_(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function r_(e){let t=new ce(e.featureTableJson,e.featureTableBinary),n=t.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(n))throw new Error("POINTS_LENGTH must be defined");t.featuresLength=n,e.featuresLength=n,e.pointsLength=n,e.pointCount=n,e.rtcCenter=t.getGlobalProperty("RTC_CENTER",P.FLOAT,3);let r=a_(e,t);return{featureTable:t,batchTable:r}}function s_(e,t,n){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.positions){if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",P.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let r=t.getPropertyArray("POSITION_QUANTIZED",P.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",P.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",P.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=Zd(e,r,n)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function i_(e,t,n){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.colors){let r=null;t.hasProperty("RGBA")?(r=t.getPropertyArray("RGBA",P.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?r=t.getPropertyArray("RGB",P.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(r=t.getPropertyArray("RGB565",P.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=ac(e,r,n)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",P.UNSIGNED_BYTE,4))}function o_(e,t){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.normals){let n=null;t.hasProperty("NORMAL")?n=t.getPropertyArray("NORMAL",P.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(n=t.getPropertyArray("NORMAL_OCT16P",P.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=Qd(e,n)}}function a_(e,t){let n=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",P.UNSIGNED_SHORT,1),e.batchIds)){let r=t.getGlobalProperty("BATCH_LENGTH");if(!r)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:s,batchTableBinary:i}=e;n=new Qe(s,i,r)}return n}async function c_(e,t,n,r,s){let i,o,a,c=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];c&&(a=c.properties);let l=t.getExtension("3DTILES_draco_point_compression");if(l){o=l.properties;let h=l.byteOffset,f=l.byteLength;if(!o||!Number.isFinite(h)||!f)throw new Error("Draco properties, byteOffset, and byteLength must be defined");i=(e.featureTableBinary||[]).slice(h,h+f),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(!i)return!0;let u={buffer:i,properties:{...o,...a},featureTableProperties:o,batchTableProperties:a,dequantizeInShader:!1};return await l_(e,u,r,s)}async function l_(e,t,n,r){if(!r)return;let s={...n,draco:{...n?.draco,extraAttributes:t.batchTableProperties||{}}};delete s["3d-tiles"];let i=await Bt(t.buffer,hi,s,r),o=i.attributes.POSITION&&i.attributes.POSITION.value,a=i.attributes.COLOR_0&&i.attributes.COLOR_0.value,c=i.attributes.NORMAL&&i.attributes.NORMAL.value,l=i.attributes.BATCH_ID&&i.attributes.BATCH_ID.value,u=o&&i.attributes.POSITION.value.quantization,h=c&&i.attributes.NORMAL.value.quantization;if(u){let d=i.POSITION.data.quantization,p=d.range;e.quantizedVolumeScale=new x(p,p,p),e.quantizedVolumeOffset=new x(d.minValues),e.quantizedRange=(1<<d.quantizationBits)-1,e.isQuantizedDraco=!0}h&&(e.octEncodedRange=(1<<i.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let f={};if(t.batchTableProperties)for(let d of Object.keys(t.batchTableProperties))i.attributes[d]&&i.attributes[d].value&&(f[d.toLowerCase()]=i.attributes[d].value);e.attributes={positions:o,colors:ac(e,a,void 0),normals:c,batchIds:l,...f}}var cc={};lt(cc,{decode:()=>__,name:()=>T_});function ot(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var di={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},pi={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var u_=1.33,tp=["SCALAR","VEC2","VEC3","VEC4"],h_=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],f_=new Map(h_),d_={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},p_={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},m_={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function mi(e){return tp[e-1]||tp[0]}function Mn(e){let t=f_.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function In(e,t){let n=m_[e.componentType],r=d_[e.type],s=p_[e.componentType],i=e.count*r,o=e.count*r*s;ot(o>=0&&o<=t.byteLength);let a=pi[e.componentType],c=di[e.type];return{ArrayType:n,length:i,byteLength:o,componentByteSize:a,numberOfComponentsInElement:c}}function br(e){let{images:t,bufferViews:n}=e;t=t||[],n=n||[];let r=t.map(o=>o.bufferView);n=n.filter(o=>!r.includes(o));let s=n.reduce((o,a)=>o+a.byteLength,0),i=t.reduce((o,a)=>{let{width:c,height:l}=a.image;return o+c*l},0);return s+Math.ceil(4*i*u_)}function ep(e,t,n){let r=e.bufferViews[n];ot(r);let s=r.buffer,i=t[s];ot(i);let o=(r.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,o,r.byteLength)}function np(e,t,n){var r,s;let i=typeof n=="number"?(r=e.accessors)===null||r===void 0?void 0:r[n]:n;if(!i)throw new Error(`No gltf accessor ${JSON.stringify(n)}`);let o=(s=e.bufferViews)===null||s===void 0?void 0:s[i.bufferView||0];if(!o)throw new Error(`No gltf buffer view for accessor ${o}`);let{arrayBuffer:a,byteOffset:c}=t[o.buffer],l=(c||0)+(i.byteOffset||0)+(o.byteOffset||0),{ArrayType:u,length:h,componentByteSize:f,numberOfComponentsInElement:d}=In(i,o),p=f*d,A=o.byteStride||p;if(typeof o.byteStride>"u"||o.byteStride===p)return new u(a,l,h);let g=new u(h);for(let y=0;y<i.count;y++){let E=new u(a,l+y*A,d);g.set(E,y*d)}return g}function g_(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var q=class{constructor(t){this.gltf=void 0,this.sourceBuffers=void 0,this.byteLength=void 0,this.gltf={json:t?.json||g_(),buffers:t?.buffers||[],images:t?.images||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}hasExtension(t){let n=this.getUsedExtensions().find(s=>s===t),r=this.getRequiredExtensions().find(s=>s===t);return typeof n=="string"||typeof r=="string"}getExtension(t){let n=this.getUsedExtensions().find(s=>s===t),r=this.json.extensions||{};return n?r[t]:null}getRequiredExtension(t){return this.getRequiredExtensions().find(r=>r===t)?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(t,n){return(t.extensions||{})[n]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,n){if(typeof n=="object")return n;let r=this.json[t]&&this.json[t][n];if(!r)throw new Error(`glTF file error: Could not find ${t}[${n}]`);return r}getTypedArrayForBufferView(t){t=this.getBufferView(t);let n=t.buffer,r=this.gltf.buffers[n];ot(r);let s=(t.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,s,t.byteLength)}getTypedArrayForAccessor(t){let n=this.getAccessor(t);return np(this.gltf.json,this.gltf.buffers,n)}getTypedArrayForImageData(t){t=this.getAccessor(t);let n=this.getBufferView(t.bufferView),s=this.getBuffer(n.buffer).data,i=n.byteOffset||0;return new Uint8Array(s,i,n.byteLength)}addApplicationData(t,n){return this.json[t]=n,this}addExtraData(t,n){return this.json.extras=this.json.extras||{},this.json.extras[t]=n,this}addObjectExtension(t,n,r){return t.extensions=t.extensions||{},t.extensions[n]=r,this.registerUsedExtension(n),this}setObjectExtension(t,n,r){let s=t.extensions||{};s[n]=r}removeObjectExtension(t,n){let r=t?.extensions||{};if(r[n]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(n)||s.push(n)}delete r[n]}addExtension(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ot(n),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=n,this.registerUsedExtension(t),n}addRequiredExtension(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ot(n),this.addExtension(t,n),this.registerRequiredExtension(t),n}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(n=>n===t)||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(n=>n===t)||this.json.extensionsRequired.push(t)}removeExtension(t){var n;if((n=this.json.extensions)!==null&&n!==void 0&&n[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let r=this.json.extensionsRemoved;r.includes(t)||r.push(t)}this.json.extensions&&delete this.json.extensions[t],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t)}setDefaultScene(t){this.json.scene=t}addScene(t){let{nodeIndices:n}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:n}),this.json.scenes.length-1}addNode(t){let{meshIndex:n,matrix:r}=t;this.json.nodes=this.json.nodes||[];let s={mesh:n};return r&&(s.matrix=r),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(t){let{attributes:n,indices:r,material:s,mode:i=4}=t,a={primitives:[{attributes:this._addAttributes(n),mode:i}]};if(r){let c=this._addIndices(r);a.primitives[0].indices=c}return Number.isFinite(s)&&(a.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(t){let r={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(r),this.json.meshes.length-1}addImage(t,n){let r=Ne(t),s=n||r?.mimeType,o={bufferView:this.addBufferView(t),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.byteLength,s=t.byteLength;ot(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let i={buffer:n,byteOffset:r,byteLength:s};return this.byteLength+=de(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(t,n){let r={bufferView:t,type:mi(n.size),componentType:n.componentType,count:n.count,max:n.max,min:n.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}addBinaryBuffer(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{size:3},r=this.addBufferView(t),s={min:n.min,max:n.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(t,n.size));let i={size:n.size,componentType:Mn(t),count:Math.round(t.length/n.size),min:s.min,max:s.max};return this.addAccessor(r,Object.assign(i,n))}addTexture(t){let{imageIndex:n}=t,r={source:n};return this.json.textures=this.json.textures||[],this.json.textures.push(r),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){var t,n;this.gltf.buffers=[];let r=this.byteLength,s=new ArrayBuffer(r),i=new Uint8Array(s),o=0;for(let a of this.sourceBuffers||[])o=Ao(a,i,o);(t=this.json)!==null&&t!==void 0&&(n=t.buffers)!==null&&n!==void 0&&n[0]?this.json.buffers[0].byteLength=r:this.json.buffers=[{byteLength:r}],this.gltf.binary=s,this.sourceBuffers=[s]}_removeStringFromArray(t,n){let r=!0;for(;r;){let s=t.indexOf(n);s>-1?t.splice(s,1):r=!1}}_addAttributes(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n={};for(let r in t){let s=t[r],i=this._getGltfAttributeName(r),o=this.addBinaryBuffer(s.value,s);n[i]=o}return n}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.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 t}}_getAccessorMinMax(t,n){let r={min:null,max:null};if(t.length<n)return r;r.min=[],r.max=[];let s=t.subarray(0,n);for(let i of s)r.min.push(i),r.max.push(i);for(let i=n;i<t.length;i+=n)for(let o=0;o<n;o++)r.min[0+o]=Math.min(r.min[0+o],t[i+o]),r.max[0+o]=Math.max(r.max[0+o],t[i+o]);return r}};function rp(e){return(e%1+1)%1}var sp={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},A_={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},ip={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function Mr(e,t){return ip[t]*sp[e]}function wn(e,t,n,r){if(n!=="UINT8"&&n!=="UINT16"&&n!=="UINT32"&&n!=="UINT64")return null;let s=e.getTypedArrayForBufferView(t),i=Fn(s,"SCALAR",n,r+1);return i instanceof BigInt64Array||i instanceof BigUint64Array?null:i}function Fn(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,s=sp[t],i=A_[n],o=ip[n],a=r*s,c=a*o,l=e.buffer,u=e.byteOffset;return u%o!==0&&(l=new Uint8Array(l).slice(u,u+c).buffer,u=0),new i(l,u,a)}function vn(e,t,n){var r,s;let i=`TEXCOORD_${t.texCoord||0}`,o=n.attributes[i],a=e.getTypedArrayForAccessor(o),c=e.gltf.json,l=t.index,u=(r=c.textures)===null||r===void 0||(s=r[l])===null||s===void 0?void 0:s.source;if(typeof u<"u"){var h,f,d;let p=(h=c.images)===null||h===void 0||(f=h[u])===null||f===void 0?void 0:f.mimeType,A=(d=e.gltf.images)===null||d===void 0?void 0:d[u];if(A&&typeof A.width<"u"){let g=[];for(let y=0;y<a.length;y+=2){let E=x_(A,p,a,y,t.channels);g.push(E)}return g}}return[]}function gi(e,t,n,r,s){if(!(n!=null&&n.length))return;let i=[];for(let u of n){let h=r.findIndex(f=>f===u);h===-1&&(h=r.push(u)-1),i.push(h)}let o=new Uint32Array(i),a=e.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,c=e.addBufferView(o,a,0),l=e.addAccessor(c,{size:1,componentType:Mn(o),count:o.length});s.attributes[t]=l}function x_(e,t,n,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[0],i={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=n[r],a=n[r+1],c=1;t&&(t.indexOf("image/jpeg")!==-1||t.indexOf("image/png")!==-1)&&(c=4);let l=y_(o,a,e,c),u=0;for(let h of s){let f=typeof h=="number"?Object.values(i)[h]:i[h],d=l+f.offset,p=Qn(e);if(p.data.length<=d)throw new Error(`${p.data.length} <= ${d}`);let A=p.data[d];u|=A<<f.shift}return u}function y_(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,s=n.width,i=rp(e)*(s-1),o=Math.round(i),a=n.height,c=rp(t)*(a-1),l=Math.round(c),u=n.components?n.components:r;return(l*s+o)*u}function Ai(e,t,n,r,s){let i=[];for(let o=0;o<t;o++){let a=n[o],c=n[o+1]-n[o];if(c+a>r)break;let l=a/s,u=c/s;i.push(e.slice(l,l+u))}return i}function xi(e,t,n){let r=[];for(let s=0;s<t;s++){let i=s*n;r.push(e.slice(i,i+n))}return r}function yi(e,t,n,r){if(n)throw new Error("Not implemented - arrayOffsets for strings is specified");if(r){let s=[],i=new TextDecoder("utf8"),o=0;for(let a=0;a<e;a++){let c=r[a+1]-r[a];if(c+o<=t.length){let l=t.subarray(o,c+o),u=i.decode(l);s.push(u),o+=c}}return s}return[]}var op="EXT_mesh_features",T_=op;async function __(e,t){let n=new q(e);E_(n,t)}function E_(e,t){let n=e.gltf.json;if(n.meshes)for(let r of n.meshes)for(let s of r.primitives)B_(e,s,t)}function B_(e,t,n){var r,s;if(!(n!=null&&(r=n.gltf)!==null&&r!==void 0&&r.loadBuffers))return;let i=(s=t.extensions)===null||s===void 0?void 0:s[op],o=i?.featureIds;if(o)for(let c of o){var a;let l;if(typeof c.attribute<"u"){let u=`_FEATURE_ID_${c.attribute}`,h=t.attributes[u];l=e.getTypedArrayForAccessor(h)}else typeof c.texture<"u"&&n!==null&&n!==void 0&&(a=n.gltf)!==null&&a!==void 0&&a.loadImages?l=vn(e,c.texture,t):l=[];c.data=l}}var hc={};lt(hc,{decode:()=>S_,name:()=>C_});var lc="EXT_structural_metadata",C_=lc;async function S_(e,t){let n=new q(e);b_(n,t)}function b_(e,t){var n,r;if(!((n=t.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let s=e.getExtension(lc);s&&((r=t.gltf)!==null&&r!==void 0&&r.loadImages&&M_(e,s),I_(e,s))}function M_(e,t){let n=t.propertyTextures,r=e.gltf.json;if(n&&r.meshes)for(let s of r.meshes)for(let i of s.primitives)F_(e,n,i,t)}function I_(e,t){let n=t.schema;if(!n)return;let r=n.classes,s=t.propertyTables;if(r&&s)for(let i in r){let o=w_(s,i);o&&R_(e,n,o)}}function w_(e,t){for(let n of e)if(n.class===t)return n;return null}function F_(e,t,n,r){var s;if(!t)return;let i=(s=n.extensions)===null||s===void 0?void 0:s[lc],o=i?.propertyTextures;if(o)for(let a of o){let c=t[a];v_(e,c,n,r)}}function v_(e,t,n,r){if(!t.properties)return;r.dataAttributeNames||(r.dataAttributeNames=[]);let s=t.class;for(let o in t.properties){var i;let a=`${s}_${o}`,c=(i=t.properties)===null||i===void 0?void 0:i[o];if(!c)continue;c.data||(c.data=[]);let l=c.data,u=vn(e,c,n);u!==null&&(gi(e,a,u,l,n),c.data=l,r.dataAttributeNames.push(a))}}function R_(e,t,n){var r;let s=(r=t.classes)===null||r===void 0?void 0:r[n.class];if(!s)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);let i=n.count;for(let a in s.properties){var o;let c=s.properties[a],l=(o=n.properties)===null||o===void 0?void 0:o[a];if(l){let u=L_(e,t,c,i,l);l.data=u}}}function L_(e,t,n,r,s){let i=[],o=s.values,a=e.getTypedArrayForBufferView(o),c=P_(e,n,s,r),l=O_(e,s,r);switch(n.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{i=N_(n,r,a,c);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${n.type}`);case"STRING":{i=yi(r,a,c,l);break}case"ENUM":{i=D_(t,n,r,a,c);break}default:throw new Error(`Unknown classProperty type ${n.type}`)}return i}function P_(e,t,n,r){return t.array&&typeof t.count>"u"&&typeof n.arrayOffsets<"u"?wn(e,n.arrayOffsets,n.arrayOffsetType||"UINT32",r):null}function O_(e,t,n){return typeof t.stringOffsets<"u"?wn(e,t.stringOffsets,t.stringOffsetType||"UINT32",n):null}function N_(e,t,n,r){let s=e.array,i=e.count,o=Mr(e.type,e.componentType),a=n.byteLength/o,c;return e.componentType?c=Fn(n,e.type,e.componentType,a):c=n,s?r?Ai(c,t,r,n.length,o):i?xi(c,t,i):[]:c}function D_(e,t,n,r,s){var i;let o=t.enumType;if(!o)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let a=(i=e.enums)===null||i===void 0?void 0:i[o];if(!a)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`);let c=a.valueType||"UINT16",l=Mr(t.type,c),u=r.byteLength/l,h=Fn(r,t.type,c,u);if(h||(h=r),t.array){if(s)return U_({valuesData:h,numberOfElements:n,arrayOffsets:s,valuesDataBytesLength:r.length,elementSize:l,enumEntry:a});let f=t.count;return f?G_(h,n,f,a):[]}return uc(h,0,n,a)}function U_(e){let{valuesData:t,numberOfElements:n,arrayOffsets:r,valuesDataBytesLength:s,elementSize:i,enumEntry:o}=e,a=[];for(let c=0;c<n;c++){let l=r[c],u=r[c+1]-r[c];if(u+l>s)break;let h=l/i,f=u/i,d=uc(t,h,f,o);a.push(d)}return a}function G_(e,t,n,r){let s=[];for(let i=0;i<t;i++){let o=n*i,a=uc(e,o,n,r);s.push(a)}return s}function uc(e,t,n,r){let s=[];for(let i=0;i<n;i++)if(e instanceof BigInt64Array||e instanceof BigUint64Array)s.push("");else{let o=e[t+i],a=V_(r,o);a?s.push(a.name):s.push("")}return s}function V_(e,t){for(let n of e.values)if(n.value===t)return n;return null}var fc={};lt(fc,{decode:()=>z_,name:()=>H_});var ap="EXT_feature_metadata",H_=ap;async function z_(e,t){let n=new q(e);k_(n,t)}function k_(e,t){var n,r;if(!((n=t.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let s=e.getExtension(ap);s&&((r=t.gltf)!==null&&r!==void 0&&r.loadImages&&J_(e,s),q_(e,s))}function J_(e,t){let n=t.schema;if(!n)return;let r=n.classes,{featureTextures:s}=t;if(r&&s)for(let i in r){let o=r[i],a=X_(s,i);a&&Y_(e,a,o)}}function q_(e,t){let n=t.schema;if(!n)return;let r=n.classes,s=t.featureTables;if(r&&s)for(let i in r){let o=j_(s,i);o&&W_(e,n,o)}}function j_(e,t){for(let n in e){let r=e[n];if(r.class===t)return r}return null}function X_(e,t){for(let n in e){let r=e[n];if(r.class===t)return r}return null}function W_(e,t,n){var r;if(!n.class)return;let s=(r=t.classes)===null||r===void 0?void 0:r[n.class];if(!s)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);let i=n.count;for(let a in s.properties){var o;let c=s.properties[a],l=(o=n.properties)===null||o===void 0?void 0:o[a];if(l){let u=K_(e,t,c,i,l);l.data=u}}}function Y_(e,t,n){let r=t.class;for(let i in n.properties){var s;let o=t==null||(s=t.properties)===null||s===void 0?void 0:s[i];if(o){let a=eE(e,o,r);o.data=a}}}function K_(e,t,n,r,s){let i=[],o=s.bufferView,a=e.getTypedArrayForBufferView(o),c=Q_(e,n,s,r),l=Z_(e,n,s,r);return n.type==="STRING"||n.componentType==="STRING"?i=yi(r,a,c,l):$_(n)&&(i=tE(n,r,a,c)),i}function Q_(e,t,n,r){return t.type==="ARRAY"&&typeof t.componentCount>"u"&&typeof n.arrayOffsetBufferView<"u"?wn(e,n.arrayOffsetBufferView,n.offsetType||"UINT32",r):null}function Z_(e,t,n,r){return typeof n.stringOffsetBufferView<"u"?wn(e,n.stringOffsetBufferView,n.offsetType||"UINT32",r):null}function $_(e){let t=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return t.includes(e.type)||typeof e.componentType<"u"&&t.includes(e.componentType)}function tE(e,t,n,r){let s=e.type==="ARRAY",i=e.componentCount,o="SCALAR",a=e.componentType||e.type,c=Mr(o,a),l=n.byteLength/c,u=Fn(n,o,a,l);return s?r?Ai(u,t,r,n.length,c):i?xi(u,t,i):[]:u}function eE(e,t,n){let r=e.gltf.json;if(!r.meshes)return[];let s=[];for(let i of r.meshes)for(let o of i.primitives)nE(e,n,t,s,o);return s}function nE(e,t,n,r,s){let i={channels:n.channels,...n.texture},o=vn(e,i,s);o&&gi(e,t,o,r,s)}var cp="4.1.4";var Rn=!0,lp=1735152710,mc=12,Ti=8,rE=1313821514,sE=5130562,iE=0,oE=0,aE=1;function cE(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]: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))}`}function up(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=new DataView(e),{magic:s=lp}=n,i=r.getUint32(t,!1);return i===s||i===lp}function hp(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},s=new DataView(t),i=cE(s,n+0),o=s.getUint32(n+4,Rn),a=s.getUint32(n+8,Rn);switch(Object.assign(e,{header:{byteOffset:n,byteLength:a,hasBinChunk:!1},type:i,version:o,json:{},binChunks:[]}),n+=mc,e.version){case 1:return lE(e,s,n);case 2:return uE(e,s,n,r={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function lE(e,t,n){G(e.header.byteLength>mc+Ti);let r=t.getUint32(n+0,Rn),s=t.getUint32(n+4,Rn);return n+=Ti,G(s===iE),dc(e,t,n,r),n+=r,n+=pc(e,t,n,e.header.byteLength),n}function uE(e,t,n,r){return G(e.header.byteLength>mc+Ti),hE(e,t,n,r),n+e.header.byteLength}function hE(e,t,n,r){for(;n+8<=e.header.byteLength;){let s=t.getUint32(n+0,Rn),i=t.getUint32(n+4,Rn);switch(n+=Ti,i){case rE:dc(e,t,n,s);break;case sE:pc(e,t,n,s);break;case oE:r.strict||dc(e,t,n,s);break;case aE:r.strict||pc(e,t,n,s);break;default:break}n+=de(s,4)}return n}function dc(e,t,n,r){let s=new Uint8Array(t.buffer,n,r),o=new TextDecoder("utf8").decode(s);return e.json=JSON.parse(o),de(r,4)}function pc(e,t,n,r){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:n,byteLength:r,arrayBuffer:t.buffer}),de(r,4)}function gc(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;let 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}var xc={};lt(xc,{decode:()=>BE,name:()=>EE});var fE="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",dE="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",pE=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]),mE=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]),gE={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},AE={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function fp(e,t,n,r,s){let i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"NONE",o=await xE();_E(o,o.exports[AE[s]],e,t,n,r,o.exports[gE[i||"NONE"]])}var Ac;async function xE(){return Ac||(Ac=yE()),Ac}async function yE(){let e=fE;WebAssembly.validate(pE)&&(e=dE,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(TE(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function TE(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r){let s=e.charCodeAt(r);t[r]=s>96?s-71:s>64?s-65:s>47?s+4:s>46?63:62}let n=0;for(let r=0;r<e.length;++r)t[n++]=t[r]<60?mE[t[r]]:(t[r]-60)*64+t[++r];return t.buffer.slice(0,n)}function _E(e,t,n,r,s,i,o){let a=e.exports.sbrk,c=r+3&-4,l=a(c*s),u=a(i.length),h=new Uint8Array(e.exports.memory.buffer);h.set(i,u);let f=t(l,r,s,u,i.length);if(f===0&&o&&o(l,c,s),n.set(h.subarray(l,l+r*s)),a(l-a(0)),f!==0)throw new Error(`Malformed buffer data: ${f}`)}var _i="EXT_meshopt_compression",EE=_i;async function BE(e,t){var n,r;let s=new q(e);if(!(t!=null&&(n=t.gltf)!==null&&n!==void 0&&n.decompressMeshes)||!((r=t.gltf)!==null&&r!==void 0&&r.loadBuffers))return;let i=[];for(let o of e.json.bufferViews||[])i.push(CE(s,o));await Promise.all(i),s.removeExtension(_i)}async function CE(e,t){let n=e.getObjectExtension(t,_i);if(n){let{byteOffset:r=0,byteLength:s=0,byteStride:i,count:o,mode:a,filter:c="NONE",buffer:l}=n,u=e.gltf.buffers[l],h=new Uint8Array(u.arrayBuffer,u.byteOffset+r,s),f=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await fp(f,o,i,h,a,c),e.removeObjectExtension(t,_i)}}var yc={};lt(yc,{name:()=>SE,preprocess:()=>bE});var Ln="EXT_texture_webp",SE=Ln;function bE(e,t){let n=new q(e);if(!wo("image/webp")){if(n.getRequiredExtensions().includes(Ln))throw new Error(`gltf: Required extension ${Ln} not supported by browser`);return}let{json:r}=n;for(let s of r.textures||[]){let i=n.getObjectExtension(s,Ln);i&&(s.source=i.source),n.removeObjectExtension(s,Ln)}n.removeExtension(Ln)}var Tc={};lt(Tc,{name:()=>ME,preprocess:()=>IE});var Ei="KHR_texture_basisu",ME=Ei;function IE(e,t){let n=new q(e),{json:r}=n;for(let s of r.textures||[]){let i=n.getObjectExtension(s,Ei);i&&(s.source=i.source,n.removeObjectExtension(s,Ei))}n.removeExtension(Ei)}var Ec={};lt(Ec,{decode:()=>LE,encode:()=>PE,name:()=>vE,preprocess:()=>RE});function dp(e){let t={};for(let n in e){let r=e[n];if(n!=="indices"){let s=_c(r);t[n]=s}}return t}function _c(e){let{buffer:t,size:n,count:r}=wE(e);return{value:t,size:n,byteOffset:0,count:r,type:mi(n),componentType:Mn(t)}}function wE(e){let t=e,n=1,r=0;return e&&e.value&&(t=e.value,n=e.size||1),t&&(ArrayBuffer.isView(t)||(t=FE(t,Float32Array)),r=t.length/n),{buffer:t,size:n,count:r}}function FE(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return e?Array.isArray(e)?new t(e):n&&!(e instanceof t)?new t(e):e:null}var Ie="KHR_draco_mesh_compression",vE=Ie;function RE(e,t,n){let r=new q(e);for(let s of pp(r))r.getObjectExtension(s,Ie)}async function LE(e,t,n){var r;if(!(t!=null&&(r=t.gltf)!==null&&r!==void 0&&r.decompressMeshes))return;let s=new q(e),i=[];for(let o of pp(s))s.getObjectExtension(o,Ie)&&i.push(OE(s,o,t,n));await Promise.all(i),s.removeExtension(Ie)}function PE(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=new q(e);for(let r of n.json.meshes||[])NE(r,t),n.addRequiredExtension(Ie)}async function OE(e,t,n,r){let s=e.getObjectExtension(t,Ie);if(!s)return;let i=e.getTypedArrayForBufferView(s.bufferView),o=ve(i.buffer,i.byteOffset),a={...n};delete a["3d-tiles"];let c=await Bt(o,hi,a,r),l=dp(c.attributes);for(let[u,h]of Object.entries(l))if(u in t.attributes){let f=t.attributes[u],d=e.getAccessor(f);d!=null&&d.min&&d!==null&&d!==void 0&&d.max&&(h.min=d.min,h.max=d.max)}t.attributes=l,c.indices&&(t.indices=_c(c.indices)),e.removeObjectExtension(t,Ie),DE(t)}function NE(e,t){var n;let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:4,s=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(!s.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let o=s.DracoWriter.encodeSync({attributes:e}),a=i==null||(n=i.parseSync)===null||n===void 0?void 0:n.call(i,{attributes:e}),c=s._addFauxAttributes(a.attributes),l=s.addBufferView(o);return{primitives:[{attributes:c,mode:r,extensions:{[Ie]:{bufferView:l,attributes:c}}}]}}function DE(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*pp(e){for(let t of e.json.meshes||[])for(let n of t.primitives)yield n}var Cc={};lt(Cc,{decode:()=>HE,name:()=>UE});var Bc="KHR_texture_transform",UE=Bc,Bi=new x,GE=new z,VE=new z;async function HE(e,t){var n;if(!new q(e).hasExtension(Bc)||!((n=t.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let i=e.json.materials||[];for(let o=0;o<i.length;o++)zE(o,e)}function zE(e,t){var n,r,s;let i=[],o=(n=t.json.materials)===null||n===void 0?void 0:n[e],a=o==null||(r=o.pbrMetallicRoughness)===null||r===void 0?void 0:r.baseColorTexture;a&&Ir(t,e,a,i);let c=o?.emissiveTexture;c&&Ir(t,e,c,i);let l=o?.normalTexture;l&&Ir(t,e,l,i);let u=o?.occlusionTexture;u&&Ir(t,e,u,i);let h=o==null||(s=o.pbrMetallicRoughness)===null||s===void 0?void 0:s.metallicRoughnessTexture;h&&Ir(t,e,h,i)}function Ir(e,t,n,r){let s=kE(n,r);if(!s)return;let i=e.json.meshes||[];for(let o of i)for(let a of o.primitives){let c=a.material;Number.isFinite(c)&&t===c&&JE(e,a,s)}}function kE(e,t){var n;let r=(n=e.extensions)===null||n===void 0?void 0:n[Bc],{texCoord:s=0}=e,{texCoord:i=s}=r;if(!(t.findIndex(a=>{let[c,l]=a;return c===s&&l===i})!==-1)){let a=XE(r);return s!==i&&(e.texCoord=i),t.push([s,i]),{originalTexCoord:s,texCoord:i,matrix:a}}return null}function JE(e,t,n){let{originalTexCoord:r,texCoord:s,matrix:i}=n,o=t.attributes[`TEXCOORD_${r}`];if(Number.isFinite(o)){var a;let l=(a=e.json.accessors)===null||a===void 0?void 0:a[o];if(l&&l.bufferView){var c;let u=(c=e.json.bufferViews)===null||c===void 0?void 0:c[l.bufferView];if(u){let{arrayBuffer:h,byteOffset:f}=e.buffers[u.buffer],d=(f||0)+(l.byteOffset||0)+(u.byteOffset||0),{ArrayType:p,length:A}=In(l,u),g=pi[l.componentType],y=di[l.type],E=u.byteStride||g*y,_=new Float32Array(A);for(let B=0;B<l.count;B++){let S=new p(h,d+B*E,2);Bi.set(S[0],S[1],1),Bi.transformByMatrix3(i),_.set([Bi[0],Bi[1]],B*y)}r===s?qE(l,u,e.buffers,_):jE(s,l,t,e,_)}}}}function qE(e,t,n,r){e.componentType=5126,n.push({arrayBuffer:r.buffer,byteOffset:0,byteLength:r.buffer.byteLength}),t.buffer=n.length-1,t.byteLength=r.buffer.byteLength,t.byteOffset=0,delete t.byteStride}function jE(e,t,n,r,s){r.buffers.push({arrayBuffer:s.buffer,byteOffset:0,byteLength:s.buffer.byteLength});let i=r.json.bufferViews;if(!i)return;i.push({buffer:r.buffers.length-1,byteLength:s.buffer.byteLength,byteOffset:0});let o=r.json.accessors;o&&(o.push({bufferView:i?.length-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),n.attributes[`TEXCOORD_${e}`]=o.length-1)}function XE(e){let{offset:t=[0,0],rotation:n=0,scale:r=[1,1]}=e,s=new z().set(1,0,0,0,1,0,t[0],t[1],1),i=GE.set(Math.cos(n),Math.sin(n),0,-Math.sin(n),Math.cos(n),0,0,0,1),o=VE.set(r[0],0,0,0,r[1],0,0,0,1);return s.multiplyRight(i).multiplyRight(o)}var Sc={};lt(Sc,{decode:()=>YE,encode:()=>KE,name:()=>WE});var Ze="KHR_lights_punctual",WE=Ze;async function YE(e){let t=new q(e),{json:n}=t,r=t.getExtension(Ze);r&&(t.json.lights=r.lights,t.removeExtension(Ze));for(let s of n.nodes||[]){let i=t.getObjectExtension(s,Ze);i&&(s.light=i.light),t.removeObjectExtension(s,Ze)}}async function KE(e){let t=new q(e),{json:n}=t;if(n.lights){let r=t.addExtension(Ze);ot(!r.lights),r.lights=n.lights,delete n.lights}if(t.json.lights){for(let r of t.json.lights){let s=r.node;t.addObjectExtension(s,Ze,r)}delete t.json.lights}}var bc={};lt(bc,{decode:()=>ZE,encode:()=>$E,name:()=>QE});var wr="KHR_materials_unlit",QE=wr;async function ZE(e){let t=new q(e),{json:n}=t;for(let r of n.materials||[])r.extensions&&r.extensions.KHR_materials_unlit&&(r.unlit=!0),t.removeObjectExtension(r,wr);t.removeExtension(wr)}function $E(e){let t=new q(e),{json:n}=t;if(t.materials)for(let r of n.materials||[])r.unlit&&(delete r.unlit,t.addObjectExtension(r,wr,{}),t.addExtension(wr))}var Mc={};lt(Mc,{decode:()=>eB,encode:()=>nB,name:()=>tB});var Fr="KHR_techniques_webgl",tB=Fr;async function eB(e){let t=new q(e),{json:n}=t,r=t.getExtension(Fr);if(r){let s=rB(r,t);for(let i of n.materials||[]){let o=t.getObjectExtension(i,Fr);o&&(i.technique=Object.assign({},o,s[o.technique]),i.technique.values=sB(i.technique,t)),t.removeObjectExtension(i,Fr)}t.removeExtension(Fr)}}async function nB(e,t){}function rB(e,t){let{programs:n=[],shaders:r=[],techniques:s=[]}=e,i=new TextDecoder;return r.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=i.decode(t.getTypedArrayForBufferView(o.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),n.forEach(o=>{o.fragmentShader=r[o.fragmentShader],o.vertexShader=r[o.vertexShader]}),s.forEach(o=>{o.program=n[o.program]}),s}function sB(e,t){let n=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(r=>{e.uniforms[r].value&&!(r in n)&&(n[r]=e.uniforms[r].value)}),Object.keys(n).forEach(r=>{typeof n[r]=="object"&&n[r].index!==void 0&&(n[r].texture=t.getTexture(n[r].index))}),n}var mp=[hc,cc,xc,yc,Tc,Ec,Sc,bc,Mc,Cc,fc];function gp(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=mp.filter(i=>xp(i.name,t));for(let i of r){var s;(s=i.preprocess)===null||s===void 0||s.call(i,e,t,n)}}async function Ap(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=mp.filter(i=>xp(i.name,t));for(let i of r){var s;await((s=i.decode)===null||s===void 0?void 0:s.call(i,e,t,n))}}function xp(e,t){var n;let r=(t==null||(n=t.gltf)===null||n===void 0?void 0:n.excludeExtensions)||{};return!(e in r&&!r[e])}var Ic="KHR_binary_glTF";function yp(e){let t=new q(e),{json:n}=t;for(let r of n.images||[]){let s=t.getObjectExtension(r,Ic);s&&Object.assign(r,s),t.removeObjectExtension(r,Ic)}n.buffers&&n.buffers[0]&&delete n.buffers[0].uri,t.removeExtension(Ic)}var Tp={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},oB={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},wc=class{constructor(){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}},this.json=void 0}normalize(t,n){this.json=t.json;let r=t.json;switch(r.asset&&r.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${r.asset.version}`);return}if(!n.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),yp(t),this._convertObjectIdsToArrayIndices(r),this._updateObjects(r),this._updateMaterial(r)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(let n in Tp)this._convertTopLevelObjectToArray(t,n)}_convertTopLevelObjectToArray(t,n){let r=t[n];if(!(!r||Array.isArray(r))){t[n]=[];for(let s in r){let i=r[s];i.id=i.id||s;let o=t[n].length;t[n].push(i),this.idToIndexMap[n][s]=o}}}_convertObjectIdsToArrayIndices(t){for(let n in Tp)this._convertIdsToIndices(t,n);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(let n of t.textures)this._convertTextureIds(n);for(let n of t.meshes)this._convertMeshIds(n);for(let n of t.nodes)this._convertNodeIds(n);for(let n of t.scenes)this._convertSceneIds(n)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(let n of t.primitives){let{attributes:r,indices:s,material:i}=n;for(let o in r)r[o]=this._convertIdToIndex(r[o],"accessor");s&&(n.indices=this._convertIdToIndex(s,"accessor")),i&&(n.material=this._convertIdToIndex(i,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map(n=>this._convertIdToIndex(n,"node"))),t.meshes&&(t.meshes=t.meshes.map(n=>this._convertIdToIndex(n,"mesh")))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map(n=>this._convertIdToIndex(n,"node")))}_convertIdsToIndices(t,n){t[n]||(console.warn(`gltf v1: json doesn't contain attribute ${n}`),t[n]=[]);for(let r of t[n])for(let s in r){let i=r[s],o=this._convertIdToIndex(i,s);r[s]=o}}_convertIdToIndex(t,n){let r=oB[n];if(r in this.idToIndexMap){let s=this.idToIndexMap[r][t];if(!Number.isFinite(s))throw new Error(`gltf v1: failed to resolve ${n} with id ${t}`);return s}return t}_updateObjects(t){for(let n of this.json.buffers)delete n.type}_updateMaterial(t){for(let i of t.materials){var n,r,s;i.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let o=((n=i.values)===null||n===void 0?void 0:n.tex)||((r=i.values)===null||r===void 0?void 0:r.texture2d_0)||((s=i.values)===null||s===void 0?void 0:s.diffuseTex),a=t.textures.findIndex(c=>c.id===o);a!==-1&&(i.pbrMetallicRoughness.baseColorTexture={index:a})}}};function _p(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new wc().normalize(e,t)}async function Ep(e,t){var n,r,s;let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return aB(e,t,i,o),_p(e,{normalize:o==null||(n=o.gltf)===null||n===void 0?void 0:n.normalize}),gp(e,o,a),o!=null&&(r=o.gltf)!==null&&r!==void 0&&r.loadBuffers&&e.json.buffers&&await cB(e,o,a),o!=null&&(s=o.gltf)!==null&&s!==void 0&&s.loadImages&&await lB(e,o,a),await Ap(e,o,a),e}function aB(e,t,n,r){if(r.uri&&(e.baseUri=r.uri),t instanceof ArrayBuffer&&!up(t,n,r)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=go(t);else if(t instanceof ArrayBuffer){let o={};n=hp(o,t,n,r.glb),ot(o.type==="glTF",`Invalid GLB magic string ${o.type}`),e._glb=o,e.json=o.json}else ot(!1,"GLTF: must be ArrayBuffer or string");let s=e.json.buffers||[];if(e.buffers=new Array(s.length).fill(null),e._glb&&e._glb.header.hasBinChunk){let{binChunks:o}=e._glb;e.buffers[0]={arrayBuffer:o[0].arrayBuffer,byteOffset:o[0].byteOffset,byteLength:o[0].byteLength}}let i=e.json.images||[];e.images=new Array(i.length).fill({})}async function cB(e,t,n){let r=e.json.buffers||[];for(let o=0;o<r.length;++o){let a=r[o];if(a.uri){var s,i;let{fetch:c}=n;ot(c);let l=gc(a.uri,t),u=await(n==null||(s=n.fetch)===null||s===void 0?void 0:s.call(n,l)),h=await(u==null||(i=u.arrayBuffer)===null||i===void 0?void 0:i.call(u));e.buffers[o]={arrayBuffer:h,byteOffset:0,byteLength:h.byteLength},delete a.uri}else e.buffers[o]===null&&(e.buffers[o]={arrayBuffer:new ArrayBuffer(a.byteLength),byteOffset:0,byteLength:a.byteLength})}}async function lB(e,t,n){let r=uB(e),s=e.json.images||[],i=[];for(let o of r)i.push(hB(e,s[o],o,t,n));return await Promise.all(i)}function uB(e){let t=new Set,n=e.json.textures||[];for(let r of n)r.source!==void 0&&t.add(r.source);return Array.from(t).sort()}async function hB(e,t,n,r,s){let i;if(t.uri&&!t.hasOwnProperty("bufferView")){let a=gc(t.uri,r),{fetch:c}=s;i=await(await c(a)).arrayBuffer(),t.bufferView={data:i}}if(Number.isFinite(t.bufferView)){let a=ep(e.json,e.buffers,t.bufferView);i=ve(a.buffer,a.byteOffset,a.byteLength)}ot(i,"glTF image has no data");let o=await Bt(i,[Ae,Na],{...r,mimeType:t.mimeType,basis:r.basis||{format:Ws()}},s);o&&o[0]&&(o={compressed:!0,mipmaps:!1,width:o[0].width,height:o[0].height,data:o[0]}),e.images=e.images||[],e.images[n]=o}var $e={name:"glTF",id:"gltf",module:"gltf",version:cp,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:fB,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function fB(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;t={...$e.options,...t},t.gltf={...$e.options.gltf,...t.gltf};let{byteOffset:r=0}=t;return await Ep({},e,r,t,n)}var dB={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},pB={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Lt={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},mB={magFilter:Lt.TEXTURE_MAG_FILTER,minFilter:Lt.TEXTURE_MIN_FILTER,wrapS:Lt.TEXTURE_WRAP_S,wrapT:Lt.TEXTURE_WRAP_T},gB={[Lt.TEXTURE_MAG_FILTER]:Lt.LINEAR,[Lt.TEXTURE_MIN_FILTER]:Lt.NEAREST_MIPMAP_LINEAR,[Lt.TEXTURE_WRAP_S]:Lt.REPEAT,[Lt.TEXTURE_WRAP_T]:Lt.REPEAT};function AB(){return{id:"default-sampler",parameters:gB}}function xB(e){return pB[e]}function yB(e){return dB[e]}var Fc=class{constructor(){this.baseUri="",this.jsonUnprocessed=void 0,this.json=void 0,this.buffers=[],this.images=[]}postProcess(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{json:r,buffers:s=[],images:i=[]}=t,{baseUri:o=""}=t;return ot(r),this.baseUri=o,this.buffers=s,this.images=i,this.jsonUnprocessed=r,this.json=this._resolveTree(t.json,n),this.json}_resolveTree(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={...t};return this.json=r,t.bufferViews&&(r.bufferViews=t.bufferViews.map((s,i)=>this._resolveBufferView(s,i))),t.images&&(r.images=t.images.map((s,i)=>this._resolveImage(s,i))),t.samplers&&(r.samplers=t.samplers.map((s,i)=>this._resolveSampler(s,i))),t.textures&&(r.textures=t.textures.map((s,i)=>this._resolveTexture(s,i))),t.accessors&&(r.accessors=t.accessors.map((s,i)=>this._resolveAccessor(s,i))),t.materials&&(r.materials=t.materials.map((s,i)=>this._resolveMaterial(s,i))),t.meshes&&(r.meshes=t.meshes.map((s,i)=>this._resolveMesh(s,i))),t.nodes&&(r.nodes=t.nodes.map((s,i)=>this._resolveNode(s,i)),r.nodes=r.nodes.map((s,i)=>this._resolveNodeChildren(s))),t.skins&&(r.skins=t.skins.map((s,i)=>this._resolveSkin(s,i))),t.scenes&&(r.scenes=t.scenes.map((s,i)=>this._resolveScene(s,i))),typeof this.json.scene=="number"&&r.scenes&&(r.scene=r.scenes[this.json.scene]),r}getScene(t){return this._get(this.json.scenes,t)}getNode(t){return this._get(this.json.nodes,t)}getSkin(t){return this._get(this.json.skins,t)}getMesh(t){return this._get(this.json.meshes,t)}getMaterial(t){return this._get(this.json.materials,t)}getAccessor(t){return this._get(this.json.accessors,t)}getCamera(t){return this._get(this.json.cameras,t)}getTexture(t){return this._get(this.json.textures,t)}getSampler(t){return this._get(this.json.samplers,t)}getImage(t){return this._get(this.json.images,t)}getBufferView(t){return this._get(this.json.bufferViews,t)}getBuffer(t){return this._get(this.json.buffers,t)}_get(t,n){if(typeof n=="object")return n;let r=t&&t[n];return r||console.warn(`glTF file error: Could not find ${t}[${n}]`),r}_resolveScene(t,n){return{...t,id:t.id||`scene-${n}`,nodes:(t.nodes||[]).map(r=>this.getNode(r))}}_resolveNode(t,n){let r={...t,id:t?.id||`node-${n}`};return t.mesh!==void 0&&(r.mesh=this.getMesh(t.mesh)),t.camera!==void 0&&(r.camera=this.getCamera(t.camera)),t.skin!==void 0&&(r.skin=this.getSkin(t.skin)),t.meshes!==void 0&&t.meshes.length&&(r.mesh=t.meshes.reduce((s,i)=>{let o=this.getMesh(i);return s.id=o.id,s.primitives=s.primitives.concat(o.primitives),s},{primitives:[]})),r}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map(n=>this.getNode(n))),t}_resolveSkin(t,n){let r=typeof t.inverseBindMatrices=="number"?this.getAccessor(t.inverseBindMatrices):void 0;return{...t,id:t.id||`skin-${n}`,inverseBindMatrices:r}}_resolveMesh(t,n){let r={...t,id:t.id||`mesh-${n}`,primitives:[]};return t.primitives&&(r.primitives=t.primitives.map(s=>{let i={...s,attributes:{},indices:void 0,material:void 0},o=s.attributes;for(let a in o)i.attributes[a]=this.getAccessor(o[a]);return s.indices!==void 0&&(i.indices=this.getAccessor(s.indices)),s.material!==void 0&&(i.material=this.getMaterial(s.material)),i})),r}_resolveMaterial(t,n){let r={...t,id:t.id||`material-${n}`};if(r.normalTexture&&(r.normalTexture={...r.normalTexture},r.normalTexture.texture=this.getTexture(r.normalTexture.index)),r.occlusionTexture&&(r.occlusionTexture={...r.occlusionTexture},r.occlusionTexture.texture=this.getTexture(r.occlusionTexture.index)),r.emissiveTexture&&(r.emissiveTexture={...r.emissiveTexture},r.emissiveTexture.texture=this.getTexture(r.emissiveTexture.index)),r.emissiveFactor||(r.emissiveFactor=r.emissiveTexture?[1,1,1]:[0,0,0]),r.pbrMetallicRoughness){r.pbrMetallicRoughness={...r.pbrMetallicRoughness};let s=r.pbrMetallicRoughness;s.baseColorTexture&&(s.baseColorTexture={...s.baseColorTexture},s.baseColorTexture.texture=this.getTexture(s.baseColorTexture.index)),s.metallicRoughnessTexture&&(s.metallicRoughnessTexture={...s.metallicRoughnessTexture},s.metallicRoughnessTexture.texture=this.getTexture(s.metallicRoughnessTexture.index))}return r}_resolveAccessor(t,n){let r=xB(t.componentType),s=yB(t.type),i=r*s,o={...t,id:t.id||`accessor-${n}`,bytesPerComponent:r,components:s,bytesPerElement:i,value:void 0,bufferView:void 0,sparse:void 0};if(t.bufferView!==void 0&&(o.bufferView=this.getBufferView(t.bufferView)),o.bufferView){let a=o.bufferView.buffer,{ArrayType:c,byteLength:l}=In(o,o.bufferView),u=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+a.byteOffset,h=a.arrayBuffer.slice(u,u+l);o.bufferView.byteStride&&(h=this._getValueFromInterleavedBuffer(a,u,o.bufferView.byteStride,o.bytesPerElement,o.count)),o.value=new c(h)}return o}_getValueFromInterleavedBuffer(t,n,r,s,i){let o=new Uint8Array(i*s);for(let a=0;a<i;a++){let c=n+a*r;o.set(new Uint8Array(t.arrayBuffer.slice(c,c+s)),a*s)}return o.buffer}_resolveTexture(t,n){return{...t,id:t.id||`texture-${n}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):AB(),source:typeof t.source=="number"?this.getImage(t.source):void 0}}_resolveSampler(t,n){let r={id:t.id||`sampler-${n}`,...t,parameters:{}};for(let s in r){let i=this._enumSamplerParameter(s);i!==void 0&&(r.parameters[i]=r[s])}return r}_enumSamplerParameter(t){return mB[t]}_resolveImage(t,n){let r={...t,id:t.id||`image-${n}`,image:null,bufferView:t.bufferView!==void 0?this.getBufferView(t.bufferView):void 0},s=this.images[n];return s&&(r.image=s),r}_resolveBufferView(t,n){let r=t.buffer,s=this.buffers[r].arrayBuffer,i=this.buffers[r].byteOffset||0;return t.byteOffset&&(i+=t.byteOffset),{id:`bufferView-${n}`,...t,buffer:this.buffers[r],data:new Uint8Array(s,i,t.byteLength)}}_resolveCamera(t,n){let r={...t,id:t.id||`camera-${n}`};return r.perspective,r.orthographic,r}};function vr(e,t){return new Fc().postProcess(e,t)}var Ci={URI:0,EMBEDDED:1};function Si(e,t,n,r){e.rotateYtoZ=!0;let s=(e.byteOffset||0)+(e.byteLength||0)-n;if(s===0)throw new Error("glTF byte length must be greater than 0.");return e.gltfUpAxis=r!=null&&r["3d-tiles"]&&r["3d-tiles"].assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",e.gltfArrayBuffer=ve(t,n,s),e.gltfByteOffset=0,e.gltfByteLength=s,n%4===0||console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`),(e.byteOffset||0)+(e.byteLength||0)}async function bi(e,t,n,r){let s=n?.["3d-tiles"]||{};if(TB(e,t,n),s.loadGLTF){if(!r)return;if(e.gltfUrl){let{fetch:i}=r,o=await i(e.gltfUrl,n);e.gltfArrayBuffer=await o.arrayBuffer(),e.gltfByteOffset=0}if(e.gltfArrayBuffer){let i=await Bt(e.gltfArrayBuffer,$e,n,r);e.gltf=vr(i),e.gpuMemoryUsageInBytes=br(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function TB(e,t,n){switch(t){case Ci.URI:if(e.gltfArrayBuffer){let r=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),i=new TextDecoder().decode(r);e.gltfUrl=i.replace(/[\s\0]+$/,"")}delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case Ci.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function Bp(e,t,n,r,s){var i;n=_B(e,t,n,r,s),await bi(e,Ci.EMBEDDED,r,s);let o=e==null||(i=e.gltf)===null||i===void 0?void 0:i.extensions;return o&&o.CESIUM_RTC&&(e.rtcCenter=o.CESIUM_RTC.center),n}function _B(e,t,n,r,s){n=Me(e,t,n),n=Sn(e,t,n),n=bn(e,t,n,r),n=Si(e,t,n,r);let i=new ce(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=i.getGlobalProperty("RTC_CENTER",P.FLOAT,3),n}async function Cp(e,t,n,r,s){return n=EB(e,t,n,r,s),await bi(e,e.gltfFormat||0,r,s),n}function EB(e,t,n,r,s){var i;if(n=Me(e,t,n),e.version!==1)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);n=Sn(e,t,n);let o=new DataView(t);if(e.gltfFormat=o.getUint32(n,!0),n+=4,n=bn(e,t,n,r),n=Si(e,t,n,r),!(e!=null&&(i=e.header)!==null&&i!==void 0&&i.featureTableJsonByteLength)||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let a=new ce(e.featureTableJson,e.featureTableBinary),c=a.getGlobalProperty("INSTANCES_LENGTH");if(a.featuresLength=c,!Number.isFinite(c))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=a.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=a.getGlobalProperty("RTC_CENTER",P.FLOAT,3);let l=new Qe(e.batchTableJson,e.batchTableBinary,c);return BB(e,a,l,c),n}function BB(e,t,n,r){let s=new Array(r),i=new x,o=new x,a=new x,c=new x,l=new z,u=new Yt,h=new x,f={},d=new L,p=[],A=[],g=[],y=[];for(let E=0;E<r;E++){let _;if(t.hasProperty("POSITION"))_=t.getProperty("POSITION",P.FLOAT,3,E,i);else if(t.hasProperty("POSITION_QUANTIZED")){_=t.getProperty("POSITION_QUANTIZED",P.UNSIGNED_SHORT,3,E,i);let m=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",P.FLOAT,3);if(!m)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let M=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",P.FLOAT,3);if(!M)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let v=65535;for(let R=0;R<3;R++)_[R]=_[R]/v*M[R]+m[R]}if(!_)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");i.copy(_),f.translation=i,e.normalUp=t.getProperty("NORMAL_UP",P.FLOAT,3,E,p),e.normalRight=t.getProperty("NORMAL_RIGHT",P.FLOAT,3,E,A);let 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",P.UNSIGNED_SHORT,2,E,p),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",P.UNSIGNED_SHORT,2,E,A),e.octNormalUp)throw e.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");e.eastNorthUp?(D.WGS84.eastNorthUpToFixedFrame(i,d),d.getRotationMatrix3(l)):l.identity()}B&&(c.copy(o).cross(a).normalize(),l.setColumn(0,o),l.setColumn(1,a),l.setColumn(2,c)),u.fromMatrix3(l),f.rotation=u,h.set(1,1,1);let S=t.getProperty("SCALE",P.FLOAT,1,E,g);Number.isFinite(S)&&h.multiplyByScalar(S);let b=t.getProperty("SCALE_NON_UNIFORM",P.FLOAT,3,E,p);b&&h.scale(b),f.scale=h;let w=t.getProperty("BATCH_ID",P.UNSIGNED_SHORT,1,E,y);w===void 0&&(w=E);let C=new L().fromQuaternion(f.rotation);d.identity(),d.translate(f.translation),d.multiplyRight(C),d.scale(f.scale);let T=d.clone();s[E]={modelMatrix:T,batchId:w}}e.instances=s}async function Sp(e,t,n,r,s,i){n=Me(e,t,n);let o=new DataView(t);for(e.tilesLength=o.getUint32(n,!0),n+=4,e.tiles=[];e.tiles.length<e.tilesLength&&(e.byteLength||0)-n>12;){let a={shape:"tile3d"};e.tiles.push(a),n=await i(t,n,r,s,a)}return n}async function bp(e,t,n,r){var s,i;if(e.rotateYtoZ=!0,e.gltfUpAxis=n!=null&&(s=n["3d-tiles"])!==null&&s!==void 0&&s.assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",n!=null&&(i=n["3d-tiles"])!==null&&i!==void 0&&i.loadGLTF){if(!r)return t.byteLength;let o=await Bt(t,$e,n,r);e.gltf=vr(o),e.gpuMemoryUsageInBytes=br(e.gltf)}else e.gltfArrayBuffer=t;return t.byteLength}async function vc(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{shape:"tile3d"};switch(s.byteOffset=t,s.type=Rd(e,t),s.type){case Ye.COMPOSITE:return await Sp(s,e,t,n,r,vc);case Ye.BATCHED_3D_MODEL:return await Bp(s,e,t,n,r);case Ye.GLTF:return await bp(s,e,n,r);case Ye.INSTANCED_3D_MODEL:return await Cp(s,e,t,n,r);case Ye.POINT_CLOUD:return await $d(s,e,t,n,r);default:throw new Error(`3DTileLoader: unknown type ${s.type}`)}}async function Rc(e,t,n){if(new Uint32Array(e.slice(0,4))[0]!==1952609651)throw new Error("Wrong subtree file magic number");if(new Uint32Array(e.slice(4,8))[0]!==1)throw new Error("Wrong subtree file verson, must be 1");let i=Mp(e.slice(8,16)),o=new Uint8Array(e,24,i),c=new TextDecoder("utf8").decode(o),l=JSON.parse(c),u=Mp(e.slice(16,24)),h=new ArrayBuffer(0);if(u&&(h=e.slice(24+i)),await Mi(l,l.tileAvailability,h,n),Array.isArray(l.contentAvailability))for(let f of l.contentAvailability)await Mi(l,f,h,n);else await Mi(l,l.contentAvailability,h,n);return await Mi(l,l.childSubtreeAvailability,h,n),l}async function Mi(e,t,n,r){let s=Number.isFinite(t.bitstream)?t.bitstream:t.bufferView;if(typeof s!="number")return;let i=e.bufferViews[s],o=e.buffers[i.buffer];if(!(r!=null&&r.baseUrl))throw new Error("Url is not provided");if(!r.fetch)throw new Error("fetch is not provided");if(o.uri){let c=`${r?.baseUrl||""}/${o.uri}`,u=await(await r.fetch(c)).arrayBuffer();t.explicitBitstream=new Uint8Array(u,i.byteOffset,i.byteLength);return}let a=e.buffers.slice(0,i.buffer).reduce((c,l)=>c+l.byteLength,0);t.explicitBitstream=new Uint8Array(n.slice(a,a+o.byteLength),i.byteOffset,i.byteLength)}function Mp(e){let t=new DataView(e),n=t.getUint32(0,!0),r=t.getUint32(4,!0);return n+2**32*r}var Ii={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:ui,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:Rc,options:{}};var im=O(Tn(),1);var em=O(Tn(),1);var wi=globalThis,CB=globalThis.document||{},Fi=globalThis.process||{},SB=globalThis.console,ND=globalThis.navigator||{};function Ip(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,n=e||t;return Boolean(n&&n.indexOf("Electron")>=0)}function tn(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Ip()}var Lc="4.0.7";function MB(e){try{let t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch{return null}}var vi=class{constructor(t,n,r="sessionStorage"){this.storage=MB(r),this.id=t,this.config=n,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let n=JSON.stringify(this.config);this.storage.setItem(this.id,n)}}_loadConfiguration(){let t={};if(this.storage){let n=this.storage.getItem(this.id);t=n?JSON.parse(n):{}}return Object.assign(this.config,t),this}};function wp(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function Fp(e,t=8){let n=Math.max(t-e.length,0);return`${" ".repeat(n)}${e}`}var Ri;(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"})(Ri||(Ri={}));var IB=10;function vp(e){return typeof e!="string"?e:(e=e.toUpperCase(),Ri[e]||Ri.WHITE)}function Rp(e,t,n){return!tn&&typeof e=="string"&&(t&&(e=`\x1B[${vp(t)}m${e}\x1B[39m`),n&&(e=`\x1B[${vp(n)+IB}m${e}\x1B[49m`)),e}function Lp(e,t=["constructor"]){let n=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(n),s=e;for(let i of r){let o=s[i];typeof o=="function"&&(t.find(a=>i===a)||(s[i]=o.bind(e)))}}function Rr(e,t){if(!e)throw new Error(t||"Assertion failed")}function en(){let e;if(tn()&&wi.performance)e=wi?.performance?.now?.();else if("hrtime"in Fi){let t=Fi?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Pn={debug:tn()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},wB={enabled:!0,level:0};function On(){}var Pp={},Op={once:!0},Lr=class{constructor({id:t}={id:""}){this.VERSION=Lc,this._startTs=en(),this._deltaTs=en(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new vi(`__probe-${this.id}__`,wB),this.timeStamp(`${this.id} started`),Lp(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((en()-this._startTs).toPrecision(10))}getDelta(){return Number((en()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,n){this._storage.setConfiguration({[t]:n})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,n){if(!t)throw new Error(n||"Assertion failed")}warn(t){return this._getLogFunction(0,t,Pn.warn,arguments,Op)}error(t){return this._getLogFunction(0,t,Pn.error,arguments)}deprecated(t,n){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${n}\` instead`)}removed(t,n){return this.error(`\`${t}\` has been removed. Use \`${n}\` instead`)}probe(t,n){return this._getLogFunction(t,n,Pn.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,Pn.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,Pn.debug||Pn.info,arguments,Op)}table(t,n,r){return n?this._getLogFunction(t,n,console.table||On,r&&[r],{tag:vB(n)}):On}time(t,n){return this._getLogFunction(t,n,console.time?console.time:console.info)}timeEnd(t,n){return this._getLogFunction(t,n,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,n){return this._getLogFunction(t,n,console.timeStamp||On)}group(t,n,r={collapsed:!1}){let s=Np({logLevel:t,message:n,opts:r}),{collapsed:i}=r;return s.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(t,n,r={}){return this.group(t,n,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||On)}withGroup(t,n,r){this.group(t,n)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Dp(t)}_getLogFunction(t,n,r,s,i){if(this._shouldLog(t)){i=Np({logLevel:t,message:n,args:s,opts:i}),r=r||i.method,Rr(r),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=en();let o=i.tag||i.message;if(i.once&&o)if(!Pp[o])Pp[o]=en();else return On;return n=FB(this.id,i.message,i),r.bind(console,n,...i.args)}return On}};Lr.VERSION=Lc;function Dp(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 Rr(Number.isFinite(t)&&t>=0),t}function Np(e){let{logLevel:t,message:n}=e;e.logLevel=Dp(t);let r=e.args?Array.from(e.args):[];for(;r.length&&r.shift()!==n;);switch(typeof t){case"string":case"function":n!==void 0&&r.unshift(n),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let s=typeof e.message;return Rr(s==="string"||s==="object"),Object.assign(e,{args:r},e.opts)}function FB(e,t,n){if(typeof t=="string"){let r=n.time?Fp(wp(n.total)):"";t=n.time?`${e}: ${r} ${t}`:`${e}: ${t}`,t=Rp(t,n.color,n.background)}return t}function vB(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}globalThis.probe={};var Pc=new Lr({id:"@probe.gl/log"});var Pt=null;try{Pt=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function K(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}K.prototype.__isLong__;Object.defineProperty(K.prototype,"__isLong__",{value:!0});function dt(e){return(e&&e.__isLong__)===!0}function Up(e){var t=Math.clz32(e&-e);return e?31-t:t}K.isLong=dt;var Gp={},Vp={};function nn(e,t){var n,r,s;return t?(e>>>=0,(s=0<=e&&e<256)&&(r=Vp[e],r)?r:(n=V(e,0,!0),s&&(Vp[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(r=Gp[e],r)?r:(n=V(e,e<0?-1:0,!1),s&&(Gp[e]=n),n))}K.fromInt=nn;function Ot(e,t){if(isNaN(e))return t?le:zt;if(t){if(e<0)return le;if(e>=Jp)return Xp}else{if(e<=-zp)return Et;if(e+1>=zp)return jp}return e<0?Ot(-e,t).neg():V(e%Dn|0,e/Dn|0,t)}K.fromNumber=Ot;function V(e,t,n){return new K(e,t,n)}K.fromBits=V;var Li=Math.pow;function Nc(e,t,n){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(n=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?le:zt;if(n=n||10,n<2||36<n)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(r===0)return Nc(e.substring(1),t,n).neg();for(var s=Ot(Li(n,8)),i=zt,o=0;o<e.length;o+=8){var a=Math.min(8,e.length-o),c=parseInt(e.substring(o,o+a),n);if(a<8){var l=Ot(Li(n,a));i=i.mul(l).add(Ot(c))}else i=i.mul(s),i=i.add(Ot(c))}return i.unsigned=t,i}K.fromString=Nc;function kt(e,t){return typeof e=="number"?Ot(e,t):typeof e=="string"?Nc(e,t):V(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}K.fromValue=kt;var Hp=1<<16,RB=1<<24,Dn=Hp*Hp,Jp=Dn*Dn,zp=Jp/2,kp=nn(RB),zt=nn(0);K.ZERO=zt;var le=nn(0,!0);K.UZERO=le;var Nn=nn(1);K.ONE=Nn;var qp=nn(1,!0);K.UONE=qp;var Oc=nn(-1);K.NEG_ONE=Oc;var jp=V(-1,2147483647,!1);K.MAX_VALUE=jp;var Xp=V(-1,-1,!0);K.MAX_UNSIGNED_VALUE=Xp;var Et=V(0,-2147483648,!1);K.MIN_VALUE=Et;var I=K.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low};I.toNumber=function(){return this.unsigned?(this.high>>>0)*Dn+(this.low>>>0):this.high*Dn+(this.low>>>0)};I.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Et)){var n=Ot(t),r=this.div(n),s=r.mul(n).sub(this);return r.toString(t)+s.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var i=Ot(Li(t,6),this.unsigned),o=this,a="";;){var c=o.div(i),l=o.sub(c.mul(i)).toInt()>>>0,u=l.toString(t);if(o=c,o.isZero())return u+a;for(;u.length<6;)u="0"+u;a=""+u+a}};I.getHighBits=function(){return this.high};I.getHighBitsUnsigned=function(){return this.high>>>0};I.getLowBits=function(){return this.low};I.getLowBitsUnsigned=function(){return this.low>>>0};I.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Et)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,n=31;n>0&&!(t&1<<n);n--);return this.high!=0?n+33:n+1};I.isZero=function(){return this.high===0&&this.low===0};I.eqz=I.isZero;I.isNegative=function(){return!this.unsigned&&this.high<0};I.isPositive=function(){return this.unsigned||this.high>=0};I.isOdd=function(){return(this.low&1)===1};I.isEven=function(){return(this.low&1)===0};I.equals=function(t){return dt(t)||(t=kt(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};I.eq=I.equals;I.notEquals=function(t){return!this.eq(t)};I.neq=I.notEquals;I.ne=I.notEquals;I.lessThan=function(t){return this.comp(t)<0};I.lt=I.lessThan;I.lessThanOrEqual=function(t){return this.comp(t)<=0};I.lte=I.lessThanOrEqual;I.le=I.lessThanOrEqual;I.greaterThan=function(t){return this.comp(t)>0};I.gt=I.greaterThan;I.greaterThanOrEqual=function(t){return this.comp(t)>=0};I.gte=I.greaterThanOrEqual;I.ge=I.greaterThanOrEqual;I.compare=function(t){if(dt(t)||(t=kt(t)),this.eq(t))return 0;var n=this.isNegative(),r=t.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};I.comp=I.compare;I.negate=function(){return!this.unsigned&&this.eq(Et)?Et:this.not().add(Nn)};I.neg=I.negate;I.add=function(t){dt(t)||(t=kt(t));var n=this.high>>>16,r=this.high&65535,s=this.low>>>16,i=this.low&65535,o=t.high>>>16,a=t.high&65535,c=t.low>>>16,l=t.low&65535,u=0,h=0,f=0,d=0;return d+=i+l,f+=d>>>16,d&=65535,f+=s+c,h+=f>>>16,f&=65535,h+=r+a,u+=h>>>16,h&=65535,u+=n+o,u&=65535,V(f<<16|d,u<<16|h,this.unsigned)};I.subtract=function(t){return dt(t)||(t=kt(t)),this.add(t.neg())};I.sub=I.subtract;I.multiply=function(t){if(this.isZero())return this;if(dt(t)||(t=kt(t)),Pt){var n=Pt.mul(this.low,this.high,t.low,t.high);return V(n,Pt.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?le:zt;if(this.eq(Et))return t.isOdd()?Et:zt;if(t.eq(Et))return this.isOdd()?Et:zt;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(kp)&&t.lt(kp))return Ot(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16,s=this.high&65535,i=this.low>>>16,o=this.low&65535,a=t.high>>>16,c=t.high&65535,l=t.low>>>16,u=t.low&65535,h=0,f=0,d=0,p=0;return p+=o*u,d+=p>>>16,p&=65535,d+=i*u,f+=d>>>16,d&=65535,d+=o*l,f+=d>>>16,d&=65535,f+=s*u,h+=f>>>16,f&=65535,f+=i*l,h+=f>>>16,f&=65535,f+=o*c,h+=f>>>16,f&=65535,h+=r*u+s*l+i*c+o*a,h&=65535,V(d<<16|p,h<<16|f,this.unsigned)};I.mul=I.multiply;I.divide=function(t){if(dt(t)||(t=kt(t)),t.isZero())throw Error("division by zero");if(Pt){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var n=(this.unsigned?Pt.div_u:Pt.div_s)(this.low,this.high,t.low,t.high);return V(n,Pt.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?le:zt;var r,s,i;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return le;if(t.gt(this.shru(1)))return qp;i=le}else{if(this.eq(Et)){if(t.eq(Nn)||t.eq(Oc))return Et;if(t.eq(Et))return Nn;var o=this.shr(1);return r=o.div(t).shl(1),r.eq(zt)?t.isNegative()?Nn:Oc:(s=this.sub(t.mul(r)),i=r.add(s.div(t)),i)}else if(t.eq(Et))return this.unsigned?le:zt;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();i=zt}for(s=this;s.gte(t);){r=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),c=a<=48?1:Li(2,a-48),l=Ot(r),u=l.mul(t);u.isNegative()||u.gt(s);)r-=c,l=Ot(r,this.unsigned),u=l.mul(t);l.isZero()&&(l=Nn),i=i.add(l),s=s.sub(u)}return i};I.div=I.divide;I.modulo=function(t){if(dt(t)||(t=kt(t)),Pt){var n=(this.unsigned?Pt.rem_u:Pt.rem_s)(this.low,this.high,t.low,t.high);return V(n,Pt.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};I.mod=I.modulo;I.rem=I.modulo;I.not=function(){return V(~this.low,~this.high,this.unsigned)};I.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};I.clz=I.countLeadingZeros;I.countTrailingZeros=function(){return this.low?Up(this.low):Up(this.high)+32};I.ctz=I.countTrailingZeros;I.and=function(t){return dt(t)||(t=kt(t)),V(this.low&t.low,this.high&t.high,this.unsigned)};I.or=function(t){return dt(t)||(t=kt(t)),V(this.low|t.low,this.high|t.high,this.unsigned)};I.xor=function(t){return dt(t)||(t=kt(t)),V(this.low^t.low,this.high^t.high,this.unsigned)};I.shiftLeft=function(t){return dt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?V(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):V(0,this.low<<t-32,this.unsigned)};I.shl=I.shiftLeft;I.shiftRight=function(t){return dt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?V(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):V(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};I.shr=I.shiftRight;I.shiftRightUnsigned=function(t){return dt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?V(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?V(this.high,0,this.unsigned):V(this.high>>>t-32,0,this.unsigned)};I.shru=I.shiftRightUnsigned;I.shr_u=I.shiftRightUnsigned;I.rotateLeft=function(t){var n;return dt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?V(this.high,this.low,this.unsigned):t<32?(n=32-t,V(this.low<<t|this.high>>>n,this.high<<t|this.low>>>n,this.unsigned)):(t-=32,n=32-t,V(this.high<<t|this.low>>>n,this.low<<t|this.high>>>n,this.unsigned))};I.rotl=I.rotateLeft;I.rotateRight=function(t){var n;return dt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?V(this.high,this.low,this.unsigned):t<32?(n=32-t,V(this.high<<n|this.low>>>t,this.low<<n|this.high>>>t,this.unsigned)):(t-=32,n=32-t,V(this.low<<n|this.high>>>t,this.high<<n|this.low>>>t,this.unsigned))};I.rotr=I.rotateRight;I.toSigned=function(){return this.unsigned?V(this.low,this.high,!1):this};I.toUnsigned=function(){return this.unsigned?this:V(this.low,this.high,!0)};I.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};I.toBytesLE=function(){var t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};I.toBytesBE=function(){var t=this.high,n=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};K.fromBytes=function(t,n,r){return r?K.fromBytesLE(t,n):K.fromBytesBE(t,n)};K.fromBytesLE=function(t,n){return new K(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};K.fromBytesBE=function(t,n){return new K(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)};var Un=K;var LB=16;function Pr(e){e==="X"&&(e="");let t=e.padEnd(LB,"0");return Un.fromString(t,!0,16)}function Dc(e){if(e.isZero())return"X";let t=e.countTrailingZeros(),n=t%4;t=(t-n)/4;let r=t;t*=4;let i=e.shiftRightUnsigned(t).toString(16).replace(/0+$/,"");return Array(17-r-i.length).join("0")+i}function Uc(e,t){let n=PB(e).shiftRightUnsigned(2);return e.add(Un.fromNumber(2*t+1-4).multiply(n))}function PB(e){return e.and(e.not().add(1))}var OB=3,NB=30,DB=2*NB+1,Wp=180/Math.PI;function Kp(e){if(e.length===0)throw new Error(`Invalid Hilbert quad key ${e}`);let t=e.split("/"),n=parseInt(t[0],10),r=t[1],s=r.length,i=0,o=[0,0];for(let a=s-1;a>=0;a--){i=s-a;let c=r[a],l=0,u=0;c==="1"?u=1:c==="2"?(l=1,u=1):c==="3"&&(l=1);let h=Math.pow(2,i-1);UB(h,o,l,u),o[0]+=h*l,o[1]+=h*u}if(n%2===1){let a=o[0];o[0]=o[1],o[1]=a}return{face:n,ij:o,level:i}}function Qp(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<OB+DB;)t="0"+t;let n=t.lastIndexOf("1"),r=t.substring(0,3),s=t.substring(3,n),i=s.length/2,o=Un.fromString(r,!0,2).toString(10),a="";if(i!==0)for(a=Un.fromString(s,!0,2).toString(4);a.length<i;)a="0"+a;return`${o}/${a}`}function Gc(e,t,n){let r=1<<t;return[(e[0]+n[0])/r,(e[1]+n[1])/r]}function Yp(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Vc(e){return[Yp(e[0]),Yp(e[1])]}function Hc(e,t){let[n,r]=t;switch(e){case 0:return[1,n,r];case 1:return[-n,1,r];case 2:return[-n,-r,1];case 3:return[-1,-r,-n];case 4:return[r,-1,-n];case 5:return[r,n,-1];default:throw new Error("Invalid face")}}function zc(e){let[t,n,r]=e,s=Math.atan2(r,Math.sqrt(t*t+n*n));return[Math.atan2(n,t)*Wp,s*Wp]}function UB(e,t,n,r){if(r===0){n===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let s=t[0];t[0]=t[1],t[1]=s}}function Zp(e){let t=Gc(e.ij,e.level,[.5,.5]),n=Vc(t),r=Hc(e.face,n);return zc(r)}var GB=100;function kc(e){let{face:t,ij:n,level:r}=e,s=[[0,0],[0,1],[1,1],[1,0],[0,0]],i=Math.max(1,Math.ceil(GB*Math.pow(2,-r))),o=new Float64Array(4*i*2+2),a=0,c=0;for(let l=0;l<4;l++){let u=s[l].slice(0),h=s[l+1],f=(h[0]-u[0])/i,d=(h[1]-u[1])/i;for(let p=0;p<i;p++){u[0]+=f,u[1]+=d;let A=Gc(n,r,u),g=Vc(A),y=Hc(t,g),E=zc(y);Math.abs(E[1])>89.999&&(E[0]=c);let _=E[0]-c;E[0]+=_>180?-360:_<-180?360:0,o[a++]=E[0],o[a++]=E[1],c=E[0]}}return o[a++]=o[0],o[a++]=o[1],o}function Gn(e){let t=VB(e);return Kp(t)}function VB(e){if(e.indexOf("/")>0)return e;let t=Pr(e);return Qp(t)}function Jc(e){let t=Gn(e);return Zp(t)}function tm(e){let t;if(e.face===2||e.face===5){let n=null,r=0;for(let s=0;s<4;s++){let i=`${e.face}/${s}`,o=Gn(i),a=kc(o);(typeof n>"u"||n===null)&&(n=new Float64Array(4*a.length)),n.set(a,r),r+=a.length}t=$p(n)}else{let n=kc(e);t=$p(n)}return t}function $p(e){if(e.length%2!==0)throw new Error("Invalid corners");let t=[],n=[];for(let r=0;r<e.length;r+=2)t.push(e[r]),n.push(e[r+1]);return t.sort((r,s)=>r-s),n.sort((r,s)=>r-s),{west:t[0],east:t[t.length-1],north:n[n.length-1],south:n[0]}}function qc(e,t){let n=t?.minimumHeight||0,r=t?.maximumHeight||0,s=Gn(e),i=tm(s),o=i.west,a=i.south,c=i.east,l=i.north,u=[];return u.push(new x(o,l,n)),u.push(new x(c,l,n)),u.push(new x(c,a,n)),u.push(new x(o,a,n)),u.push(new x(o,l,r)),u.push(new x(c,l,r)),u.push(new x(c,a,r)),u.push(new x(o,a,r)),u}function Pi(e){let t=e.token,n={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},r=qc(t,n),s=Jc(t),i=s[0],o=s[1],a=D.WGS84.cartographicToCartesian([i,o,n.maximumHeight]),c=new x(a[0],a[1],a[2]);r.push(c);let l=fr(r);return[...l.center,...l.halfAxes]}var HB=4,zB=8,kB={QUADTREE:HB,OCTREE:zB};function JB(e,t,n){if(e!=null&&e.box){let r=Pr(e.s2VolumeInfo.token),s=Uc(r,t),i=Dc(s),o={...e.s2VolumeInfo};switch(o.token=i,n){case"OCTREE":let l=e.s2VolumeInfo,u=l.maximumHeight-l.minimumHeight,h=u/2,f=l.minimumHeight+u/2;l.minimumHeight=f-h,l.maximumHeight=f+h;break;default:break}return{box:Pi(o),s2VolumeInfo:o}}}async function Xc(e){let{implicitOptions:t,parentData:n={mortonIndex:0,x:0,y:0,z:0},childIndex:r=0,s2VolumeBox:s,loaderOptions:i}=e,{subtree:o,level:a=0,globalData:c={level:0,mortonIndex:0,x:0,y:0,z:0}}=e,{subdivisionScheme:l,subtreeLevels:u,maximumLevel:h,contentUrlTemplate:f,subtreesUriTemplate:d,basePath:p}=t,A={children:[],lodMetricValue:0,contentUrl:""};if(!h)return Pc.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${f} won't be loaded...`),A;let g=a+c.level;if(g>h)return A;let y=kB[l],E=Math.log2(y),_=r&1,B=r>>1&1,S=r>>2&1,b=(y**a-1)/(y-1),w=rn(n.mortonIndex,r,E),C=b+w,T=rn(n.x,_,1),m=rn(n.y,B,1),M=rn(n.z,S,1),v=!1;a>=u&&(v=jc(o.childSubtreeAvailability,w));let R=rn(c.x,T,a),F=rn(c.y,m,a),N=rn(c.z,M,a);if(v){let W=`${p}/${d}`,$=Oi(W,g,R,F,N);o=await(0,em.load)($,Ii,i),c={mortonIndex:w,x:T,y:m,z:M,level:a},w=0,C=0,T=0,m=0,M=0,a=0}if(!jc(o.tileAvailability,C))return A;jc(o.contentAvailability,C)&&(A.contentUrl=Oi(f,g,R,F,N));let Q=a+1,j={mortonIndex:w,x:T,y:m,z:M};for(let W=0;W<y;W++){let $=JB(s,W,l),At=await Xc({subtree:o,implicitOptions:t,loaderOptions:i,parentData:j,childIndex:W,level:Q,globalData:{...c},s2VolumeBox:$});if(At.contentUrl||At.children.length){let ng=g+1,rg=qB(At,ng,{childTileX:T,childTileY:m,childTileZ:M},t,s);A.children.push(rg)}}return A}function jc(e,t){let n;return Array.isArray(e)?(n=e[0],e.length>1&&Pc.once('Not supported extension "3DTILES_multiple_contents" has been detected')):n=e,"constant"in n?Boolean(n.constant):n.explicitBitstream?WB(t,n.explicitBitstream):!1}function qB(e,t,n,r,s){let{basePath:i,refine:o,getRefine:a,lodMetricType:c,getTileType:l,rootLodMetricValue:u,rootBoundingVolume:h}=r,f=e.contentUrl&&e.contentUrl.replace(`${i}/`,""),d=u/2**t,p=s!=null&&s.box?{box:s.box}:h,A=jB(t,p,n);return{children:e.children,contentUrl:e.contentUrl,content:{uri:f},id:e.contentUrl,refine:a(o),type:l(e),lodMetricType:c,lodMetricValue:d,geometricError:d,transform:e.transform,boundingVolume:A}}function jB(e,t,n){if(t.region){let{childTileX:r,childTileY:s,childTileZ:i}=n,[o,a,c,l,u,h]=t.region,f=2**e,d=(c-o)/f,p=(l-a)/f,A=(h-u)/f,[g,y]=[o+d*r,o+d*(r+1)],[E,_]=[a+p*s,a+p*(s+1)],[B,S]=[u+A*i,u+A*(i+1)];return{region:[g,E,y,_,B,S]}}if(t.box)return t;throw new Error(`Unsupported bounding volume type ${t}`)}function rn(e,t,n){return(e<<n)+t}function Oi(e,t,n,r,s){let i=XB({level:t,x:n,y:r,z:s});return e.replace(/{level}|{x}|{y}|{z}/gi,o=>i[o])}function XB(e){let t={};for(let n in e)t[`{${n}}`]=e[n];return t}function WB(e,t){let n=Math.floor(e/8),r=e%8;return(t[n]>>r&1)===1}function Yc(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(!t)return $t.EMPTY;let r=t.split("?")[0].split(".").pop();switch(r){case"pnts":return $t.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return $t.SCENEGRAPH;default:return r||$t.EMPTY}}function Kc(e){switch(e){case"REPLACE":case"replace":return yt.REPLACE;case"ADD":case"add":return yt.ADD;default:return e}}function Wc(e,t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){let r=new URL(e,`${t}/`);return decodeURI(r.toString())}else if(e.startsWith("/"))return e;return ge.resolve(t,e)}function nm(e,t){if(!e)return null;let n;if(e.content){var r;let i=e.content.uri||((r=e.content)===null||r===void 0?void 0:r.url);typeof i<"u"&&(n=Wc(i,t))}return{...e,id:n,contentUrl:n,lodMetricType:je.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Yc(e,n),refine:Kc(e.refine)}}async function om(e,t,n){let r=null,s=sm(e.root);s&&e.root?r=await rm(e.root,e,t,s,n):r=nm(e.root,t);let i=[];for(i.push(r);i.length>0;){let o=i.pop()||{},a=o.children||[],c=[];for(let l of a){let u=sm(l),h;u?h=await rm(l,e,t,u,n):h=nm(l,t),h&&(c.push(h),i.push(h))}o.children=c}return r}async function rm(e,t,n,r,s){var i,o,a;let{subdivisionScheme:c,maximumLevel:l,availableLevels:u,subtreeLevels:h,subtrees:{uri:f}}=r,d=Oi(f,0,0,0,0),p=Wc(d,n),A=await(0,im.load)(p,Ii,s),g=(i=e.content)===null||i===void 0?void 0:i.uri,y=g?Wc(g,n):"",E=t==null||(o=t.root)===null||o===void 0?void 0:o.refine,_=e.geometricError,B=(a=e.boundingVolume.extensions)===null||a===void 0?void 0:a["3DTILES_bounding_volume_S2"];if(B){let C={box:Pi(B),s2VolumeInfo:B};e.boundingVolume=C}let S=e.boundingVolume,b={contentUrlTemplate:y,subtreesUriTemplate:f,subdivisionScheme:c,subtreeLevels:h,maximumLevel:Number.isFinite(u)?u-1:l,refine:E,basePath:n,lodMetricType:je.GEOMETRIC_ERROR,rootLodMetricValue:_,rootBoundingVolume:S,getTileType:Yc,getRefine:Kc};return await YB(e,n,A,b,s)}async function YB(e,t,n,r,s){if(!e)return null;let{children:i,contentUrl:o}=await Xc({subtree:n,implicitOptions:r,loaderOptions:s}),a,c=null;return o&&(a=o,c={uri:o.replace(`${t}/`,"")}),{...e,id:a,contentUrl:a,lodMetricType:je.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Yc(e,a),refine:Kc(e.refine),content:c||e.content,children:i}}function sm(e){var t;return(e==null||(t=e.extensions)===null||t===void 0?void 0:t["3DTILES_implicit_tiling"])||e?.implicitTiling}var Ni={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:ui,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:KB,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function KB(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=t["3d-tiles"]||{},s;return r.isTileset==="auto"?s=n?.url&&n.url.indexOf(".json")!==-1:s=r.isTileset,s?QB(e,t,n):ZB(e,t,n)}async function QB(e,t,n){var r;let s=JSON.parse(new TextDecoder().decode(e)),i=n?.url||"",o=$B(i),a=await om(s,o,t||{});return{...s,shape:"tileset3d",loader:Ni,url:i,queryString:n?.queryString||"",basePath:o,root:a||s.root,type:ut.TILES3D,lodMetricType:je.GEOMETRIC_ERROR,lodMetricValue:((r=s.root)===null||r===void 0?void 0:r.geometricError)||0}}async function ZB(e,t,n){let r={content:{shape:"tile3d",featureIds:null}};return await vc(e,0,t,n,r.content),r.content}function $B(e){return ge.dirname(e)}var am=[0],tC={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:Ni,onTilesetLoad:{type:"function",value:e=>{}},onTileLoad:{type:"function",value:e=>{}},onTileUnload:{type:"function",value:e=>{}},onTileError:{type:"function",value:(e,t,n)=>{}},_getMeshColor:{type:"function",value:e=>[255,255,255]}},Di=class extends we.CompositeLayer{initializeState(){"onTileLoadFail"in this.props&&we.log.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}}get isLoaded(){return Boolean(this.state?.tileset3d?.isLoaded()&&super.isLoaded)}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({props:t,oldProps:n,changeFlags:r}){if(t.data&&t.data!==n.data&&this._loadTileset(t.data),r.viewportChanged){let{activeViewports:s}=this.state;Object.keys(s).length&&(this._updateTileset(s),this.state.lastUpdatedViewports=s,this.state.activeViewports={})}if(r.propsChanged){let{layerMap:s}=this.state;for(let i in s)s[i].needsUpdate=!0}}activateViewport(t){let{activeViewports:n,lastUpdatedViewports:r}=this.state;this.internalState.viewport=t,n[t.id]=t;let s=r?.[t.id];(!s||!t.equals(s))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:t,sourceLayer:n}){let r=n&&n.props.tile;return t.picked&&(t.object=r),t.sourceTile=r,t}filterSubLayer({layer:t,viewport:n}){let{tile:r}=t.props,{id:s}=n;return r.selected&&r.viewportIds.includes(s)}_updateAutoHighlight(t){let n=t.sourceTile,r=this.state.layerMap[n?.id];r&&r.layer&&r.layer.updateAutoHighlight(t)}async _loadTileset(t){let{loadOptions:n={}}=this.props,r=this.props.loader||this.props.loaders,s=Array.isArray(r)?r[0]:r,i={loadOptions:{...n}},o=t;if(s.preload){let l=await s.preload(t,n);l.url&&(o=l.url),l.headers&&(i.loadOptions.fetch={...i.loadOptions.fetch,headers:l.headers}),Object.assign(i,l)}let a=await(0,hm.load)(o,s,i.loadOptions),c=new Br(a,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,...i});this.setState({tileset3d:c,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(c)}_onTileLoad(t){let{lastUpdatedViewports:n}=this.state;this.props.onTileLoad(t),this._updateTileset(n),this.setNeedsUpdate()}_onTileUnload(t){delete this.state.layerMap[t.id],this.props.onTileUnload(t)}_updateTileset(t){if(!t)return;let{tileset3d:n}=this.state,{timeline:r}=this.context,s=Object.keys(t).length;!r||!s||!n||n.selectTiles(Object.values(t)).then(i=>{this.state.frameNumber!==i&&this.setState({frameNumber:i})})}_getSubLayer(t,n){if(!t.content)return null;switch(t.type){case $t.POINTCLOUD:return this._makePointCloudLayer(t,n);case $t.SCENEGRAPH:return this._make3DModelLayer(t);case $t.MESH:return this._makeSimpleMeshLayer(t,n);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${t.content.type}`)}}_makePointCloudLayer(t,n){let{attributes:r,pointCount:s,constantRGBA:i,cartographicOrigin:o,modelMatrix:a}=t.content,{positions:c,normals:l,colors:u}=r;if(!c)return null;let h=n&&n.props.data||{header:{vertexCount:s},attributes:{POSITION:c,NORMAL:l,COLOR_0:u}},{pointSize:f,getPointColor:d}=this.props,p=this.getSubLayerClass("pointcloud",lm.PointCloudLayer);return new p({pointSize:f},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${t.id}`,tile:t,data:h,coordinateSystem:we.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:o,modelMatrix:a,getColor:i||d,_offset:0})}_make3DModelLayer(t){let{gltf:n,instances:r,cartographicOrigin:s,modelMatrix:i}=t.content,o=this.getSubLayerClass("scenegraph",um.ScenegraphLayer);return new o({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${t.id}`,tile:t,data:r||am,scenegraph:n,coordinateSystem:we.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:s,modelMatrix:i,getTransformMatrix:a=>a.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(t,n){let r=t.content,{attributes:s,indices:i,modelMatrix:o,cartographicOrigin:a,coordinateSystem:c=we.COORDINATE_SYSTEM.METER_OFFSETS,material:l,featureIds:u}=r,{_getMeshColor:h}=this.props,f=n&&n.props.mesh||new cm.Geometry({topology:"triangle-list",attributes:eC(s),indices:i}),d=this.getSubLayerClass("mesh",Tr);return new d(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${t.id}`,tile:t,mesh:f,data:am,getColor:h(t),pbrMaterial:l,modelMatrix:o,coordinateOrigin:a,coordinateSystem:c,featureIds:u,_offset:0})}renderLayers(){let{tileset3d:t,layerMap:n}=this.state;return t?t.tiles.map(r=>{let s=n[r.id]=n[r.id]||{tile:r},{layer:i}=s;return r.selected&&(i?s.needsUpdate&&(i=this._getSubLayer(r,i),s.needsUpdate=!1):i=this._getSubLayer(r)),s.layer=i,i}).filter(Boolean):null}},Or=Di;(()=>{Di.defaultProps=tC})(),(()=>{Di.layerName="Tile3DLayer"})();function eC(e){let t={};return t.positions={...e.positions,value:new Float32Array(e.positions.value)},e.normals&&(t.normals=e.normals),e.texCoords&&(t.texCoords=e.texCoords),e.colors&&(t.colors=e.colors),e.uvRegions&&(t.uvRegions=e.uvRegions),t}var ki=O(Dt(),1),el=O(qs(),1),xm=O(Dt(),1);var nC=new Map([["centerX",Float64Array.BYTES_PER_ELEMENT],["centerY",Float64Array.BYTES_PER_ELEMENT],["centerZ",Float64Array.BYTES_PER_ELEMENT],["minHeight",Float32Array.BYTES_PER_ELEMENT],["maxHeight",Float32Array.BYTES_PER_ELEMENT],["boundingSphereCenterX",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterY",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterZ",Float64Array.BYTES_PER_ELEMENT],["boundingSphereRadius",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointX",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointY",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointZ",Float64Array.BYTES_PER_ELEMENT]]);function Qc(e){return e>>1^-(e&1)}function rC(e){let t=0,n={};for(let[r,s]of nC){let i=s===8?e.getFloat64:e.getFloat32;n[r]=i.call(e,t,!0),t+=s}return{header:n,headerEndPosition:t}}function sC(e,t){let n=t,r=3,s=e.getUint32(n,!0),i=new Uint16Array(s*r);n+=Uint32Array.BYTES_PER_ELEMENT;let o=Uint16Array.BYTES_PER_ELEMENT,a=s*o,c=n,l=c+a,u=l+a,h=0,f=0,d=0;for(let p=0;p<s;p++)h+=Qc(e.getUint16(c+o*p,!0)),f+=Qc(e.getUint16(l+o*p,!0)),d+=Qc(e.getUint16(u+o*p,!0)),i[p]=h,i[p+s]=f,i[p+s*2]=d;return n+=a*3,{vertexData:i,vertexDataEndPosition:n}}function Nr(e,t,n,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i;if(r===2?i=new Uint16Array(e,t,n):i=new Uint32Array(e,t,n),!s)return i;let o=0;for(let a=0;a<i.length;++a){let c=i[a];i[a]=o-c,c===0&&++o}return i}function iC(e,t,n){let r=n,s=3,o=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;r%o!==0&&(r+=o-r%o);let a=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let c=a*3,l=Nr(e.buffer,r,c,o);return r+=c*o,{triangleIndicesEndPosition:r,triangleIndices:l}}function oC(e,t,n){let r=n,s=3,o=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,a=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let c=Nr(e.buffer,r,a,o,!1);r+=a*o;let l=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let u=Nr(e.buffer,r,l,o,!1);r+=l*o;let h=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let f=Nr(e.buffer,r,h,o,!1);r+=h*o;let d=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let p=Nr(e.buffer,r,d,o,!1);return r+=d*o,{edgeIndicesEndPosition:r,westIndices:c,southIndices:u,eastIndices:f,northIndices:p}}function aC(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function cC(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function lC(e,t){let n={};if(e.byteLength<=t)return{extensions:n,extensionsEndPosition:t};let r=t;for(;r<e.byteLength;){let s=e.getUint8(r,!0);r+=Uint8Array.BYTES_PER_ELEMENT;let i=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let o=new DataView(e.buffer,r,i);switch(s){case 1:{n.vertexNormals=aC(o);break}case 2:{n.waterMask=cC(o);break}default:}r+=i}return{extensions:n,extensionsEndPosition:r}}var sn={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},uC={maxDecodingStep:sn.extensions};function Zc(e,t){let n=Object.assign({},uC,t),r=new DataView(e),{header:s,headerEndPosition:i}=rC(r);if(n.maxDecodingStep<sn.vertices)return{header:s};let{vertexData:o,vertexDataEndPosition:a}=sC(r,i);if(n.maxDecodingStep<sn.triangleIndices)return{header:s,vertexData:o};let{triangleIndices:c,triangleIndicesEndPosition:l}=iC(r,o,a);if(n.maxDecodingStep<sn.edgeIndices)return{header:s,vertexData:o,triangleIndices:c};let{westIndices:u,southIndices:h,eastIndices:f,northIndices:d,edgeIndicesEndPosition:p}=oC(r,o,l);if(n.maxDecodingStep<sn.extensions)return{header:s,vertexData:o,triangleIndices:c,westIndices:u,northIndices:d,eastIndices:f,southIndices:h};let{extensions:A}=lC(r,p);return{header:s,vertexData:o,triangleIndices:c,westIndices:u,northIndices:d,eastIndices:f,southIndices:h,extensions:A}}function Ui(e,t,n,r){let s=r?fC(r,e.POSITION.value):hC(t),i=new e.POSITION.value.constructor(s.length*6),o=new e.TEXCOORD_0.value.constructor(s.length*4),a=new t.constructor(s.length*6);for(let l=0;l<s.length;l++){let u=s[l];dC({edge:u,edgeIndex:l,attributes:e,skirtHeight:n,newPosition:i,newTexcoord0:o,newTriangles:a})}e.POSITION.value=jn(e.POSITION.value,i),e.TEXCOORD_0.value=jn(e.TEXCOORD_0.value,o);let c=t instanceof Array?t.concat(a):jn(t,a);return{attributes:e,triangles:c}}function hC(e){let t=[];for(let o=0;o<e.length;o+=3)t.push([e[o],e[o+1]]),t.push([e[o+1],e[o+2]]),t.push([e[o+2],e[o]]);t.sort((o,a)=>Math.min(...o)-Math.min(...a)||Math.max(...o)-Math.max(...a));let n=[],r=0;for(;r<t.length;){var s,i;t[r][0]===((s=t[r+1])===null||s===void 0?void 0:s[1])&&t[r][1]===((i=t[r+1])===null||i===void 0?void 0:i[0])?r+=2:(n.push(t[r]),r++)}return n}function fC(e,t){e.westIndices.sort((r,s)=>t[3*r+1]-t[3*s+1]),e.eastIndices.sort((r,s)=>t[3*s+1]-t[3*r+1]),e.southIndices.sort((r,s)=>t[3*s]-t[3*r]),e.northIndices.sort((r,s)=>t[3*r]-t[3*s]);let n=[];for(let r in e){let s=e[r];for(let i=0;i<s.length-1;i++)n.push([s[i],s[i+1]])}return n}function dC(e){let{edge:t,edgeIndex:n,attributes:r,skirtHeight:s,newPosition:i,newTexcoord0:o,newTriangles:a}=e,c=r.POSITION.value.length,l=n*2,u=n*2+1;i.set(r.POSITION.value.subarray(t[0]*3,t[0]*3+3),l*3),i[l*3+2]=i[l*3+2]-s,i.set(r.POSITION.value.subarray(t[1]*3,t[1]*3+3),u*3),i[u*3+2]=i[u*3+2]-s,o.set(r.TEXCOORD_0.value.subarray(t[0]*2,t[0]*2+2),l*2),o.set(r.TEXCOORD_0.value.subarray(t[1]*2,t[1]*2+2),u*2);let h=n*2*3;a[h]=t[0],a[h+1]=c/3+u,a[h+2]=t[1],a[h+3]=c/3+u,a[h+4]=t[0],a[h+5]=c/3+l}function $c(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{bounds:n}=t,{header:r,vertexData:s,triangleIndices:i,westIndices:o,northIndices:a,eastIndices:c,southIndices:l}=Zc(e,sn.triangleIndices),u=i,h=pC(s,r,n),f=Ke(h);if(t!=null&&t.skirtHeight){let{attributes:d,triangles:p}=Ui(h,u,t.skirtHeight,{westIndices:o,northIndices:a,eastIndices:c,southIndices:l});h=d,u=p}return{loaderData:{header:{}},header:{vertexCount:u.length,boundingBox:f},schema:void 0,topology:"triangle-list",mode:4,indices:{value:u,size:1},attributes:h}}function pC(e,t,n){let{minHeight:r,maxHeight:s}=t,[i,o,a,c]=n||[0,0,1,1],l=a-i,u=c-o,h=s-r,f=e.length/3,d=new Float32Array(f*3),p=new Float32Array(f*2);for(let A=0;A<f;A++){let g=e[A]/32767,y=e[A+f]/32767,E=e[A+f*2]/32767;d[3*A+0]=g*l+i,d[3*A+1]=y*u+o,d[3*A+2]=E*h+r,p[2*A+0]=g,p[2*A+1]=y}return{POSITION:{value:d,size:3},TEXCOORD_0:{value:p,size:2}}}var Dr=class{constructor(t=257){this.gridSize=t;let n=t-1;if(n&n-1)throw new Error(`Expected grid size to be 2^n+1, got ${t}.`);this.numTriangles=n*n*2-2,this.numParentTriangles=this.numTriangles-n*n,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let r=0;r<this.numTriangles;r++){let s=r+2,i=0,o=0,a=0,c=0,l=0,u=0;for(s&1?a=c=l=n:i=o=u=n;(s>>=1)>1;){let f=i+a>>1,d=o+c>>1;s&1?(a=i,c=o,i=l,o=u):(i=a,o=c,a=l,c=u),l=f,u=d}let h=r*4;this.coords[h+0]=i,this.coords[h+1]=o,this.coords[h+2]=a,this.coords[h+3]=c}}createTile(t){return new tl(t,this)}},tl=class{constructor(t,n){let r=n.gridSize;if(t.length!==r*r)throw new Error(`Expected terrain data of length ${r*r} (${r} x ${r}), got ${t.length}.`);this.terrain=t,this.martini=n,this.errors=new Float32Array(t.length),this.update()}update(){let{numTriangles:t,numParentTriangles:n,coords:r,gridSize:s}=this.martini,{terrain:i,errors:o}=this;for(let a=t-1;a>=0;a--){let c=a*4,l=r[c+0],u=r[c+1],h=r[c+2],f=r[c+3],d=l+h>>1,p=u+f>>1,A=d+p-u,g=p+l-d,y=(i[u*s+l]+i[f*s+h])/2,E=p*s+d,_=Math.abs(y-i[E]);if(o[E]=Math.max(o[E],_),a<n){let B=(u+g>>1)*s+(l+A>>1),S=(f+g>>1)*s+(h+A>>1);o[E]=Math.max(o[E],o[B],o[S])}}}getMesh(t=0){let{gridSize:n,indices:r}=this.martini,{errors:s}=this,i=0,o=0,a=n-1;r.fill(0);function c(d,p,A,g,y,E){let _=d+A>>1,B=p+g>>1;Math.abs(d-y)+Math.abs(p-E)>1&&s[B*n+_]>t?(c(y,E,d,p,_,B),c(A,g,y,E,_,B)):(r[p*n+d]=r[p*n+d]||++i,r[g*n+A]=r[g*n+A]||++i,r[E*n+y]=r[E*n+y]||++i,o++)}c(0,0,a,a,a,0),c(a,a,0,0,0,a);let l=new Uint16Array(i*2),u=new Uint32Array(o*3),h=0;function f(d,p,A,g,y,E){let _=d+A>>1,B=p+g>>1;if(Math.abs(d-y)+Math.abs(p-E)>1&&s[B*n+_]>t)f(y,E,d,p,_,B),f(A,g,y,E,_,B);else{let S=r[p*n+d]-1,b=r[g*n+A]-1,w=r[E*n+y]-1;l[2*S]=d,l[2*S+1]=p,l[2*b]=A,l[2*b+1]=g,l[2*w]=y,l[2*w+1]=E,u[h++]=S,u[h++]=b,u[h++]=w}}return f(0,0,a,a,a,0),f(a,a,0,0,0,a),{vertices:l,triangles:u}}};var Ur=class{constructor(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:n;this.data=t,this.width=n,this.height=r,this.coords=[],this.triangles=[],this._halfedges=[],this._candidates=[],this._queueIndices=[],this._queue=[],this._errors=[],this._rms=[],this._pending=[],this._pendingLen=0,this._rmsSum=0;let s=n-1,i=r-1,o=this._addPoint(0,0),a=this._addPoint(s,0),c=this._addPoint(0,i),l=this._addPoint(s,i),u=this._addTriangle(l,o,c,-1,-1,-1);this._addTriangle(o,l,a,u,-1,-1),this._flush()}run(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;for(;this.getMaxError()>t;)this.refine()}refine(){this._step(),this._flush()}getMaxError(){return this._errors[0]}getRMSD(){return this._rmsSum>0?Math.sqrt(this._rmsSum/(this.width*this.height)):0}heightAt(t,n){return this.data[this.width*n+t]}_flush(){let t=this.coords;for(let n=0;n<this._pendingLen;n++){let r=this._pending[n],s=2*this.triangles[r*3+0],i=2*this.triangles[r*3+1],o=2*this.triangles[r*3+2];this._findCandidate(t[s],t[s+1],t[i],t[i+1],t[o],t[o+1],r)}this._pendingLen=0}_findCandidate(t,n,r,s,i,o,a){let c=Math.min(t,r,i),l=Math.min(n,s,o),u=Math.max(t,r,i),h=Math.max(n,s,o),f=on(r,s,i,o,c,l),d=on(i,o,t,n,c,l),p=on(t,n,r,s,c,l),A=s-n,g=t-r,y=o-s,E=r-i,_=n-o,B=i-t,S=on(t,n,r,s,i,o),b=this.heightAt(t,n)/S,w=this.heightAt(r,s)/S,C=this.heightAt(i,o)/S,T=0,m=0,M=0,v=0;for(let R=l;R<=h;R++){let F=0;f<0&&y!==0&&(F=Math.max(F,Math.floor(-f/y))),d<0&&_!==0&&(F=Math.max(F,Math.floor(-d/_))),p<0&&A!==0&&(F=Math.max(F,Math.floor(-p/A)));let N=f+y*F,X=d+_*F,H=p+A*F,Q=!1;for(let j=c+F;j<=u;j++){if(N>=0&&X>=0&&H>=0){Q=!0;let W=b*N+w*X+C*H,$=Math.abs(W-this.heightAt(j,R));v+=$*$,$>T&&(T=$,m=j,M=R)}else if(Q)break;N+=y,X+=_,H+=A}f+=E,d+=B,p+=g}(m===t&&M===n||m===r&&M===s||m===i&&M===o)&&(T=0),this._candidates[2*a]=m,this._candidates[2*a+1]=M,this._rms[a]=v,this._queuePush(a,T,v)}_step(){let t=this._queuePop(),n=t*3+0,r=t*3+1,s=t*3+2,i=this.triangles[n],o=this.triangles[r],a=this.triangles[s],c=this.coords[2*i],l=this.coords[2*i+1],u=this.coords[2*o],h=this.coords[2*o+1],f=this.coords[2*a],d=this.coords[2*a+1],p=this._candidates[2*t],A=this._candidates[2*t+1],g=this._addPoint(p,A);if(on(c,l,u,h,p,A)===0)this._handleCollinear(g,n);else if(on(u,h,f,d,p,A)===0)this._handleCollinear(g,r);else if(on(f,d,c,l,p,A)===0)this._handleCollinear(g,s);else{let y=this._halfedges[n],E=this._halfedges[r],_=this._halfedges[s],B=this._addTriangle(i,o,g,y,-1,-1,n),S=this._addTriangle(o,a,g,E,-1,B+1),b=this._addTriangle(a,i,g,_,B+2,S+1);this._legalize(B),this._legalize(S),this._legalize(b)}}_addPoint(t,n){let r=this.coords.length>>1;return this.coords.push(t,n),r}_addTriangle(t,n,r,s,i,o){let a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this.triangles.length,c=a/3;return this.triangles[a+0]=t,this.triangles[a+1]=n,this.triangles[a+2]=r,this._halfedges[a+0]=s,this._halfedges[a+1]=i,this._halfedges[a+2]=o,s>=0&&(this._halfedges[s]=a+0),i>=0&&(this._halfedges[i]=a+1),o>=0&&(this._halfedges[o]=a+2),this._candidates[2*c+0]=0,this._candidates[2*c+1]=0,this._queueIndices[c]=-1,this._rms[c]=0,this._pending[this._pendingLen++]=c,a}_legalize(t){let n=this._halfedges[t];if(n<0)return;let r=t-t%3,s=n-n%3,i=r+(t+1)%3,o=r+(t+2)%3,a=s+(n+2)%3,c=s+(n+1)%3,l=this.triangles[o],u=this.triangles[t],h=this.triangles[i],f=this.triangles[a],d=this.coords;if(!mC(d[2*l],d[2*l+1],d[2*u],d[2*u+1],d[2*h],d[2*h+1],d[2*f],d[2*f+1]))return;let p=this._halfedges[i],A=this._halfedges[o],g=this._halfedges[a],y=this._halfedges[c];this._queueRemove(r/3),this._queueRemove(s/3);let E=this._addTriangle(l,f,h,-1,g,p,r),_=this._addTriangle(f,l,u,E,A,y,s);this._legalize(E+1),this._legalize(_+2)}_handleCollinear(t,n){let r=n-n%3,s=r+(n+1)%3,i=r+(n+2)%3,o=this.triangles[i],a=this.triangles[n],c=this.triangles[s],l=this._halfedges[s],u=this._halfedges[i],h=this._halfedges[n];if(h<0){let b=this._addTriangle(t,o,a,-1,u,-1,r),w=this._addTriangle(o,t,c,b,-1,l);this._legalize(b+1),this._legalize(w+2);return}let f=h-h%3,d=f+(h+2)%3,p=f+(h+1)%3,A=this.triangles[d],g=this._halfedges[d],y=this._halfedges[p];this._queueRemove(f/3);let E=this._addTriangle(o,a,t,u,-1,-1,r),_=this._addTriangle(a,A,t,y,-1,E+1,f),B=this._addTriangle(A,c,t,g,-1,_+1),S=this._addTriangle(c,o,t,l,E+2,B+1);this._legalize(E),this._legalize(_),this._legalize(B),this._legalize(S)}_queuePush(t,n,r){let s=this._queue.length;this._queueIndices[t]=s,this._queue.push(t),this._errors.push(n),this._rmsSum+=r,this._queueUp(s)}_queuePop(){let t=this._queue.length-1;return this._queueSwap(0,t),this._queueDown(0,t),this._queuePopBack()}_queuePopBack(){let t=this._queue.pop();return this._errors.pop(),this._rmsSum-=this._rms[t],this._queueIndices[t]=-1,t}_queueRemove(t){let n=this._queueIndices[t];if(n<0){let s=this._pending.indexOf(t);if(s!==-1)this._pending[s]=this._pending[--this._pendingLen];else throw new Error("Broken triangulation (something went wrong).");return}let r=this._queue.length-1;r!==n&&(this._queueSwap(n,r),this._queueDown(n,r)||this._queueUp(n)),this._queuePopBack()}_queueLess(t,n){return this._errors[t]>this._errors[n]}_queueSwap(t,n){let r=this._queue[t],s=this._queue[n];this._queue[t]=s,this._queue[n]=r,this._queueIndices[r]=n,this._queueIndices[s]=t;let i=this._errors[t];this._errors[t]=this._errors[n],this._errors[n]=i}_queueUp(t){let n=t;for(;;){let r=n-1>>1;if(r===n||!this._queueLess(n,r))break;this._queueSwap(r,n),n=r}}_queueDown(t,n){let r=t;for(;;){let s=2*r+1;if(s>=n||s<0)break;let i=s+1,o=s;if(i<n&&this._queueLess(i,s)&&(o=i),!this._queueLess(o,r))break;this._queueSwap(r,o),r=o}return r>t}};function on(e,t,n,r,s,i){return(n-s)*(t-i)-(r-i)*(e-s)}function mC(e,t,n,r,s,i,o,a){let c=e-o,l=t-a,u=n-o,h=r-a,f=s-o,d=i-a,p=c*c+l*l,A=u*u+h*h,g=f*f+d*d;return c*(h*g-A*d)-l*(u*g-A*f)+p*(u*d-h*f)<0}function pm(e,t){let{meshMaxError:n,bounds:r,elevationDecoder:s}=t,{data:i,width:o,height:a}=e,c,l;switch(t.tesselator){case"martini":c=Gi(i,o,a,s,t.tesselator),l=fm(n,o,c);break;case"delatin":c=Gi(i,o,a,s,t.tesselator),l=dm(n,o,a,c);break;default:o===a&&!(a&o-1)?(c=Gi(i,o,a,s,"martini"),l=fm(n,o,c)):(c=Gi(i,o,a,s,"delatin"),l=dm(n,o,a,c));break}let{vertices:u}=l,{triangles:h}=l,f=gC(u,c,o,a,r),d=Ke(f);if(t.skirtHeight){let{attributes:p,triangles:A}=Ui(f,h,t.skirtHeight);f=p,h=A}return{loaderData:{header:{}},header:{vertexCount:h.length,boundingBox:d},mode:4,indices:{value:Uint32Array.from(h),size:1},attributes:f}}function fm(e,t,n){let r=t+1,i=new Dr(r).createTile(n),{vertices:o,triangles:a}=i.getMesh(e);return{vertices:o,triangles:a}}function dm(e,t,n,r){let s=new Ur(r,t+1,n+1);s.run(e);let{coords:i,triangles:o}=s;return{vertices:i,triangles:o}}function Gi(e,t,n,r,s){let{rScaler:i,bScaler:o,gScaler:a,offset:c}=r,l=new Float32Array((t+1)*(n+1));for(let u=0,h=0;h<n;h++)for(let f=0;f<t;f++,u++){let d=u*4,p=e[d+0],A=e[d+1],g=e[d+2];l[u+h]=p*i+A*a+g*o+c}if(s==="martini"){for(let u=(t+1)*t,h=0;h<t;h++,u++)l[u]=l[u-t-1];for(let u=n,h=0;h<n+1;h++,u+=n+1)l[u]=l[u-1]}return l}function gC(e,t,n,r,s){let i=n+1,o=e.length/2,a=new Float32Array(o*3),c=new Float32Array(o*2),[l,u,h,f]=s||[0,0,n,r],d=(h-l)/n,p=(f-u)/r;for(let A=0;A<o;A++){let g=e[A*2],y=e[A*2+1],E=y*i+g;a[3*A+0]=g*d+l,a[3*A+1]=-y*p+f,a[3*A+2]=t[E],c[2*A+0]=g/n,c[2*A+1]=y/r}return{POSITION:{value:a,size:3},TEXCOORD_0:{value:c,size:2}}}var Vi="4.1.4";var Hi={name:"Terrain",id:"terrain",module:"terrain",version:Vi,worker:!0,extensions:["png","pngraw","jpg","jpeg","gif","webp","bmp"],mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp"],options:{terrain:{tesselator:"auto",bounds:void 0,meshMaxError:10,elevationDecoder:{rScaler:1,gScaler:0,bScaler:0,offset:0},skirtHeight:void 0}}};var mm={name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:Vi,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var AC={...Hi,parse:xC};async function xC(e,t,n){let r={...t,mimeType:"application/x.image",image:{...t?.image,type:"data"}},s=await Bt(e,[],r,n),i={...AC.options.terrain,...t?.terrain};return pm(s,i)}var LG={...mm,parseSync:(e,t)=>$c(e,t?.["quantized-mesh"]),parse:async(e,t)=>$c(e,t?.["quantized-mesh"])};var gm=[1],yC={...Zt.defaultProps,elevationData:Se,texture:{...Se,optional:!0},meshMaxError:{type:"number",value:4},bounds:{type:"array",value:null,optional:!0,compare:!0},color:{type:"color",value:[255,255,255]},elevationDecoder:{type:"object",value:{rScaler:1,gScaler:0,bScaler:0,offset:0}},workerUrl:"",wireframe:!1,material:!0,loaders:[Hi]};function Am(e){return Array.isArray(e)?e.join(";"):e||""}var zi=class extends ki.CompositeLayer{updateState({props:t,oldProps:n}){let r=t.elevationData!==n.elevationData;if(r){let{elevationData:i}=t,o=i&&(Array.isArray(i)||i.includes("{x}")&&i.includes("{y}"));this.setState({isTiled:o})}let s=r||t.meshMaxError!==n.meshMaxError||t.elevationDecoder!==n.elevationDecoder||t.bounds!==n.bounds;if(!this.state.isTiled&&s){let i=this.loadTerrain(t);this.setState({terrain:i})}t.workerUrl&&ki.log.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain({elevationData:t,bounds:n,elevationDecoder:r,meshMaxError:s,signal:i}){if(!t)return null;let o=this.getLoadOptions();o={...o,terrain:{skirtHeight:this.state.isTiled?s*2:0,...o?.terrain,bounds:n,meshMaxError:s,elevationDecoder:r}};let{fetch:a}=this.props;return a(t,{propName:"elevationData",layer:this,loadOptions:o,signal:i})}getTiledTerrainData(t){let{elevationData:n,fetch:r,texture:s,elevationDecoder:i,meshMaxError:o}=this.props,{viewport:a}=this.context,c=Qt(n,t),l=s&&Qt(s,t),{signal:u}=t,h=[0,0],f=[0,0];if(a.isGeospatial){let g=t.bbox;h=a.projectFlat([g.west,g.south]),f=a.projectFlat([g.east,g.north])}else{let g=t.bbox;h=[g.left,g.bottom],f=[g.right,g.top]}let d=[h[0],h[1],f[0],f[1]],p=this.loadTerrain({elevationData:c,bounds:d,elevationDecoder:i,meshMaxError:o,signal:u}),A=l?r(l,{propName:"texture",layer:this,loaders:[],signal:u}).catch(g=>null):Promise.resolve(null);return Promise.all([p,A])}renderSubLayers(t){let n=this.getSubLayerClass("mesh",el.SimpleMeshLayer),{color:r,wireframe:s,material:i}=this.props,{data:o}=t;if(!o)return null;let[a,c]=o;return new n(t,{data:gm,mesh:a,texture:c,_instanced:!1,coordinateSystem:xm.COORDINATE_SYSTEM.CARTESIAN,getPosition:l=>[0,0,0],getColor:r,wireframe:s,material:i})}onViewportLoad(t){if(!t)return;let{zRange:n}=this.state,r=t.map(o=>o.content).filter(Boolean).map(o=>o[0].header.boundingBox.map(c=>c[2]));if(r.length===0)return;let s=Math.min(...r.map(o=>o[0])),i=Math.max(...r.map(o=>o[1]));(!n||s<n[0]||i>n[1])&&this.setState({zRange:[s,i]})}renderLayers(){let{color:t,material:n,elevationData:r,texture:s,wireframe:i,meshMaxError:o,elevationDecoder:a,tileSize:c,maxZoom:l,minZoom:u,extent:h,maxRequests:f,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:g,maxCacheByteSize:y,refinementStrategy:E}=this.props;if(this.state.isTiled)return new Zt(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:Am(r),texture:Am(s),meshMaxError:o,elevationDecoder:a}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:c,maxZoom:l,minZoom:u,extent:h,maxRequests:f,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:g,maxCacheByteSize:y,refinementStrategy:E});if(!r)return null;let _=this.getSubLayerClass("mesh",el.SimpleMeshLayer);return new _(this.getSubLayerProps({id:"mesh"}),{data:gm,mesh:this.state.terrain,texture:s,_instanced:!1,getPosition:B=>[0,0,0],getColor:t,material:n,wireframe:i})}},Gr=zi;(()=>{zi.defaultProps=yC})(),(()=>{zi.layerName="TerrainLayer"})();var no=O(Dt(),1),yl=O(Nt(),1),Zm=O(Tm(),1);var Vr={x:0,y:1,z:2};function an(e,t={}){let{start:n=0,end:r=e.length,plane:s="xy"}=t,i=t.size||2,o=0,a=Vr[s[0]],c=Vr[s[1]];for(let l=n,u=r-i;l<r;l+=i)o+=(e[l+a]-e[u+a])*(e[l+c]+e[u+c]),u=l;return o/2}function rl(e,t,n=2,r,s="xy"){let i=t&&t.length,o=i?t[0]*n:e.length,a=Em(e,0,o,n,!0,r&&r[0],s),c=[];if(!a||a.next===a.prev)return c;let l,u,h,f,d,p,A;if(i&&(a=bC(e,t,a,n,r,s)),e.length>80*n){f=u=e[0],d=h=e[1];for(let g=n;g<o;g+=n)p=e[g],A=e[g+1],p<f&&(f=p),A<d&&(d=A),p>u&&(u=p),A>h&&(h=A);l=Math.max(u-f,h-d),l=l!==0?32767/l:0}return Hr(a,c,n,f,d,l,0),c}function Em(e,t,n,r,s,i,o){let a,c;i===void 0&&(i=an(e,{start:t,end:n,size:r,plane:o}));let l=Vr[o[0]],u=Vr[o[1]];if(s===i<0)for(a=t;a<n;a+=r)c=_m(a,e[a+l],e[a+u],c);else for(a=n-r;a>=t;a-=r)c=_m(a,e[a+l],e[a+u],c);return c&&ji(c,c.next)&&(kr(c),c=c.next),c}function cn(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(ji(n,n.next)||et(n.prev,n,n.next)===0)){if(kr(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function Hr(e,t,n,r,s,i,o){if(!e)return;!o&&i&&vC(e,r,s,i);let a=e,c,l;for(;e.prev!==e.next;){if(c=e.prev,l=e.next,i?BC(e,r,s,i):EC(e)){t.push(c.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),kr(e),e=l.next,a=l.next;continue}if(e=l,e===a){o?o===1?(e=CC(cn(e),t,n),Hr(e,t,n,r,s,i,2)):o===2&&SC(e,t,n,r,s,i):Hr(cn(e),t,n,r,s,i,1);break}}}function EC(e){let t=e.prev,n=e,r=e.next;if(et(t,n,r)>=0)return!1;let s=t.x,i=n.x,o=r.x,a=t.y,c=n.y,l=r.y,u=s<i?s<o?s:o:i<o?i:o,h=a<c?a<l?a:l:c<l?c:l,f=s>i?s>o?s:o:i>o?i:o,d=a>c?a>l?a:l:c>l?c:l,p=r.next;for(;p!==t;){if(p.x>=u&&p.x<=f&&p.y>=h&&p.y<=d&&Vn(s,a,i,c,o,l,p.x,p.y)&&et(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function BC(e,t,n,r){let s=e.prev,i=e,o=e.next;if(et(s,i,o)>=0)return!1;let a=s.x,c=i.x,l=o.x,u=s.y,h=i.y,f=o.y,d=a<c?a<l?a:l:c<l?c:l,p=u<h?u<f?u:f:h<f?h:f,A=a>c?a>l?a:l:c>l?c:l,g=u>h?u>f?u:f:h>f?h:f,y=nl(d,p,t,n,r),E=nl(A,g,t,n,r),_=e.prevZ,B=e.nextZ;for(;_&&_.z>=y&&B&&B.z<=E;){if(_.x>=d&&_.x<=A&&_.y>=p&&_.y<=g&&_!==s&&_!==o&&Vn(a,u,c,h,l,f,_.x,_.y)&&et(_.prev,_,_.next)>=0||(_=_.prevZ,B.x>=d&&B.x<=A&&B.y>=p&&B.y<=g&&B!==s&&B!==o&&Vn(a,u,c,h,l,f,B.x,B.y)&&et(B.prev,B,B.next)>=0))return!1;B=B.nextZ}for(;_&&_.z>=y;){if(_.x>=d&&_.x<=A&&_.y>=p&&_.y<=g&&_!==s&&_!==o&&Vn(a,u,c,h,l,f,_.x,_.y)&&et(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;B&&B.z<=E;){if(B.x>=d&&B.x<=A&&B.y>=p&&B.y<=g&&B!==s&&B!==o&&Vn(a,u,c,h,l,f,B.x,B.y)&&et(B.prev,B,B.next)>=0)return!1;B=B.nextZ}return!0}function CC(e,t,n){let r=e;do{let s=r.prev,i=r.next.next;!ji(s,i)&&Bm(s,r,r.next,i)&&zr(s,i)&&zr(i,s)&&(t.push(s.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),kr(r),kr(r.next),r=e=i),r=r.next}while(r!==e);return cn(r)}function SC(e,t,n,r,s,i){let o=e;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&PC(o,a)){let c=Cm(o,a);o=cn(o,o.next),c=cn(c,c.next),Hr(o,t,n,r,s,i,0),Hr(c,t,n,r,s,i,0);return}a=a.next}o=o.next}while(o!==e)}function bC(e,t,n,r,s,i){let o=[],a,c,l,u,h;for(a=0,c=t.length;a<c;a++)l=t[a]*r,u=a<c-1?t[a+1]*r:e.length,h=Em(e,l,u,r,!1,s&&s[a+1],i),h===h.next&&(h.steiner=!0),o.push(LC(h));for(o.sort(MC),a=0;a<o.length;a++)n=IC(o[a],n);return n}function MC(e,t){return e.x-t.x}function IC(e,t){let n=wC(e,t);if(!n)return t;let r=Cm(n,e);return cn(r,r.next),cn(n,n.next)}function wC(e,t){let n=t,r=e.x,s=e.y,i=-1/0,o;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){let f=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(f<=r&&f>i&&(i=f,o=n.x<n.next.x?n:n.next,f===r))return o}n=n.next}while(n!==t);if(!o)return null;let a=o,c=o.x,l=o.y,u=1/0,h;n=o;do r>=n.x&&n.x>=c&&r!==n.x&&Vn(s<l?r:i,s,c,l,s<l?i:r,s,n.x,n.y)&&(h=Math.abs(s-n.y)/(r-n.x),zr(n,e)&&(h<u||h===u&&(n.x>o.x||n.x===o.x&&FC(o,n)))&&(o=n,u=h)),n=n.next;while(n!==a);return o}function FC(e,t){return et(e.prev,e,t.prev)<0&&et(t.next,e,e.next)<0}function vC(e,t,n,r){let s=e;do s.z===0&&(s.z=nl(s.x,s.y,t,n,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,RC(s)}function RC(e){let t,n,r=1,s,i,o,a,c,l;do{for(i=e,e=null,l=null,s=0;i;){for(s++,a=i,o=0,n=0;n<r&&(o++,a=a.nextZ,!!a);n++);for(c=r;o>0||c>0&&a;)o!==0&&(c===0||!a||i.z<=a.z)?(t=i,i=i.nextZ,o--):(t=a,a=a.nextZ,c--),l?l.nextZ=t:e=t,t.prevZ=l,l=t;i=a}l.nextZ=null,r*=2}while(s>1);return e}function nl(e,t,n,r,s){return e=(e-n)*s|0,t=(t-r)*s|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function LC(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Vn(e,t,n,r,s,i,o,a){return(s-o)*(t-a)>=(e-o)*(i-a)&&(e-o)*(r-a)>=(n-o)*(t-a)&&(n-o)*(i-a)>=(s-o)*(r-a)}function PC(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!OC(e,t)&&(zr(e,t)&&zr(t,e)&&NC(e,t)&&(et(e.prev,e,t.prev)||et(e,t.prev,t))||ji(e,t)&&et(e.prev,e,e.next)>0&&et(t.prev,t,t.next)>0)}function et(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function ji(e,t){return e.x===t.x&&e.y===t.y}function Bm(e,t,n,r){let s=qi(et(e,t,n)),i=qi(et(e,t,r)),o=qi(et(n,r,e)),a=qi(et(n,r,t));return!!(s!==i&&o!==a||s===0&&Ji(e,n,t)||i===0&&Ji(e,r,t)||o===0&&Ji(n,e,r)||a===0&&Ji(n,t,r))}function Ji(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function qi(e){return e>0?1:e<0?-1:0}function OC(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Bm(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function zr(e,t){return et(e.prev,e,e.next)<0?et(e,t,e.next)>=0&&et(e,e.prev,t)>=0:et(e,t,e.prev)<0||et(e,e.next,t)<0}function NC(e,t){let n=e,r=!1,s=(e.x+t.x)/2,i=(e.y+t.y)/2;do n.y>i!=n.next.y>i&&n.next.y!==n.y&&s<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function Cm(e,t){let n=new Jr(e.i,e.x,e.y),r=new Jr(t.i,t.x,t.y),s=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=s,s.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function _m(e,t,n,r){let s=new Jr(e,t,n);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function kr(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}var Jr=class{constructor(t,n,r){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=n,this.y=r}};function ol(e,t,n){let r=HC(e),s=Object.keys(r).filter(i=>r[i]!==Array);return zC(e,{propArrayTypes:r,...t},{numericPropKeys:n&&n.numericPropKeys||s,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function HC(e){let t={};for(let n of e)if(n.properties)for(let r in n.properties){let s=n.properties[r];t[r]=WC(s,t[r])}return t}function zC(e,t,n){let{pointPositionsCount:r,pointFeaturesCount:s,linePositionsCount:i,linePathsCount:o,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:u,polygonFeaturesCount:h,propArrayTypes:f,coordLength:d}=t,{numericPropKeys:p=[],PositionDataType:A=Float32Array,triangulate:g=!0}=n,y=e[0]&&"id"in e[0],E=e.length>65535?Uint32Array:Uint16Array,_={type:"Point",positions:new A(r*d),globalFeatureIds:new E(r),featureIds:s>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},B={type:"LineString",pathIndices:i>65535?new Uint32Array(o+1):new Uint16Array(o+1),positions:new A(i*d),globalFeatureIds:new E(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},S={type:"Polygon",polygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),primitivePolygonIndices:c>65535?new Uint32Array(u+1):new Uint16Array(u+1),positions:new A(c*d),globalFeatureIds:new E(c),featureIds:h>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};g&&(S.triangles=[]);for(let w of[_,B,S])for(let C of p){let T=f[C];w.numericProps[C]=new T(w.positions.length/d)}B.pathIndices[o]=i,S.polygonIndices[l]=c,S.primitivePolygonIndices[u]=c;let b={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let w of e){let C=w.geometry,T=w.properties||{};switch(C.type){case"Point":kC(C,_,b,d,T),_.properties.push(il(T,p)),y&&_.fields.push({id:w.id}),b.pointFeature++;break;case"LineString":JC(C,B,b,d,T),B.properties.push(il(T,p)),y&&B.fields.push({id:w.id}),b.lineFeature++;break;case"Polygon":qC(C,S,b,d,T),S.properties.push(il(T,p)),y&&S.fields.push({id:w.id}),b.polygonFeature++;break;default:throw new Error("Invalid geometry type")}b.feature++}return XC(_,B,S,d)}function kC(e,t,n,r,s){t.positions.set(e.data,n.pointPosition*r);let i=e.data.length/r;al(t,s,n.pointPosition,i),t.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+i),t.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+i),n.pointPosition+=i}function JC(e,t,n,r,s){t.positions.set(e.data,n.linePosition*r);let i=e.data.length/r;al(t,s,n.linePosition,i),t.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+i),t.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+i);for(let o=0,a=e.indices.length;o<a;++o){let c=e.indices[o],l=o===a-1?e.data.length:e.indices[o+1];t.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(l-c)/r}}function qC(e,t,n,r,s){t.positions.set(e.data,n.polygonPosition*r);let i=e.data.length/r;al(t,s,n.polygonPosition,i),t.globalFeatureIds.fill(n.feature,n.polygonPosition,n.polygonPosition+i),t.featureIds.fill(n.polygonFeature,n.polygonPosition,n.polygonPosition+i);for(let o=0,a=e.indices.length;o<a;++o){let c=n.polygonPosition;t.polygonIndices[n.polygonObject++]=c;let l=e.areas[o],u=e.indices[o],h=e.indices[o+1];for(let d=0,p=u.length;d<p;++d){let A=u[d],g=d===p-1?h===void 0?e.data.length:h[0]:u[d+1];t.primitivePolygonIndices[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(g-A)/r}let f=n.polygonPosition;jC(t,l,u,{startPosition:c,endPosition:f,coordLength:r})}}function jC(e,t,n,r){let{startPosition:s,endPosition:i,coordLength:o}=r;if(!e.triangles)return;let a=s*o,c=i*o,l=e.positions.subarray(a,c),u=n[0],h=n.slice(1).map(d=>(d-u)/o),f=rl(l,h,o,t);for(let d=0,p=f.length;d<p;++d)e.triangles.push(s+f[d])}function sl(e,t){let n={};for(let r in e)n[r]={value:e[r],size:t};return n}function XC(e,t,n,r){let s={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:r},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:sl(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:r},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:sl(t.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:r},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:sl(n.numericProps,1)}};return s.polygons&&n.triangles&&(s.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),s}function al(e,t,n,r){for(let s in e.numericProps)if(s in t){let i=t[s];e.numericProps[s].fill(i,n,n+r)}}function il(e,t){let n={};for(let r in e)t.includes(r)||(n[r]=e[r]);return n}function WC(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function Yi(e,t){let n=t?.globalFeatureId;return n!==void 0?YC(e,n):KC(e,t?.type)}function YC(e,t){let n=Im(e);for(let r of n){let s=0,i=r.featureIds.value[0];for(let o=0;o<r.featureIds.value.length;o++){let a=r.featureIds.value[o];if(a!==i){if(t===r.globalFeatureIds.value[s])return Xi(r,s,o);s=o,i=a}}if(t===r.globalFeatureIds.value[s])return Xi(r,s,r.featureIds.value.length)}throw new Error(`featureId:${t} not found`)}function KC(e,t){let n=Im(e,t);return QC(n)}function Mm(e,t,n){switch(e.type){case"Point":return eS(e,t,n);case"LineString":return tS(e,t,n);case"Polygon":return wm(e,t,n);default:let r=e;throw new Error(`Unsupported geometry type: ${r?.type}`)}}function Im(e,t){let n=[];return e.points&&(e.points.type="Point",n.push(e.points)),e.lines&&(e.lines.type="LineString",n.push(e.lines)),e.polygons&&(e.polygons.type="Polygon",n.push(e.polygons)),n}function QC(e){let t=[];for(let n of e){if(n.featureIds.value.length===0)continue;let r=0,s=n.featureIds.value[0];for(let i=0;i<n.featureIds.value.length;i++){let o=n.featureIds.value[i];o!==s&&(t.push(Xi(n,r,i)),r=i,s=o)}t.push(Xi(n,r,n.featureIds.value.length))}return t}function Xi(e,t,n){let r=Mm(e,t,n),s=$C(e,t,n),i=ZC(e,t,n);return{type:"Feature",geometry:r,properties:s,...i}}function ZC(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0;return e.fields&&e.fields[e.featureIds.value[t]]}function $C(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=Object.assign({},e.properties[e.featureIds.value[t]]);for(let s in e.numericProps)r[s]=e.numericProps[s].value[t];return r}function wm(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1/0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1/0,{positions:r}=e,s=e.polygonIndices.value.filter(c=>c>=t&&c<=n),i=e.primitivePolygonIndices.value.filter(c=>c>=t&&c<=n);if(!(s.length>2)){let c=[];for(let l=0;l<i.length-1;l++){let u=i[l],h=i[l+1],f=Wi(r,u,h);c.push(f)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<s.length-1;c++){let l=s[c],u=s[c+1],h=wm(e,l,u).coordinates;a.push(h)}return{type:"MultiPolygon",coordinates:a}}function tS(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1/0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1/0,{positions:r}=e,s=e.pathIndices.value.filter(a=>a>=t&&a<=n);if(!(s.length>2))return{type:"LineString",coordinates:Wi(r,s[0],s[1])};let o=[];for(let a=0;a<s.length-1;a++){let c=Wi(r,s[a],s[a+1]);o.push(c)}return{type:"MultiLineString",coordinates:o}}function eS(e,t,n){let{positions:r}=e,s=Wi(r,t,n);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function Wi(e,t,n){t=t||0,n=n||e.value.length/e.size;let r=[];for(let s=t;s<n;s++){let i=Array();for(let o=s*e.size;o<(s+1)*e.size;o++)i.push(Number(e.value[o]));r.push(i)}return r}var pl=O(Nm(),1);function Dm(e){let t=e.length;if(t<=1)return[e];let n=[],r,s;for(let i=0;i<t;i++){let o=yS(e[i]);o!==0&&(s===void 0&&(s=o<0),s===o<0?(r&&n.push(r),r=[e[i]]):r&&r.push(e[i]))}return r&&n.push(r),n}function yS(e){let t=0;for(let n=0,r=e.length-1,s,i;n<e.length;r=n++)s=e[n],i=e[r],t+=(i[0]-s[0])*(s[1]+i[1]);return t}function Um(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?TS(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function TS(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],s=t._values[e.readVarint()];t.properties[r]=s}}var ln=class{static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(t,n,r,s,i){this.properties=void 0,this.extent=void 0,this.type=void 0,this.id=void 0,this._pbf=void 0,this._geometry=void 0,this._keys=void 0,this._values=void 0,this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=i,t.readFields(Um,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,s=0,i=0,o=0,a=[],c;for(;t.pos<n;){if(s<=0){let l=t.readVarint();r=l&7,s=l>>3}if(s--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),r===1&&(c&&a.push(c),c=[]),c&&c.push([i,o]);else if(r===7)c&&c.push(c[0].slice());else throw new Error(`unknown command ${r}`)}return c&&a.push(c),a}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,s=0,i=0,o=0,a=1/0,c=-1/0,l=1/0,u=-1/0;for(;t.pos<n;){if(s<=0){let h=t.readVarint();r=h&7,s=h>>3}if(s--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),i<a&&(a=i),i>c&&(c=i),o<l&&(l=o),o>u&&(u=o);else if(r!==7)throw new Error(`unknown command ${r}`)}return[a,l,c,u]}_toGeoJSON(t){let n=this.loadGeometry(),r=ln.types[this.type],s,i;switch(this.type){case 1:let a=[];for(s=0;s<n.length;s++)a[s]=n[s][0];n=a,t(n,this);break;case 2:for(s=0;s<n.length;s++)t(n[s],this);break;case 3:for(n=Dm(n),s=0;s<n.length;s++)for(i=0;i<n[s].length;i++)t(n[s][i],this);break}n.length===1?n=n[0]:r=`Multi${r}`;let o={type:"Feature",geometry:{type:r,coordinates:n},properties:this.properties};return this.id!==null&&(o.id=this.id),o}toGeoJSON(t){if(typeof t=="function")return this._toGeoJSON(t);let{x:n,y:r,z:s}=t,i=this.extent*Math.pow(2,s),o=this.extent*n,a=this.extent*r;function c(l){for(let u=0;u<l.length;u++){let h=l[u];h[0]=(h[0]+o)*360/i-180;let f=180-(h[1]+a)*360/i;h[1]=360/Math.PI*Math.atan(Math.exp(f*Math.PI/180))-90}}return this._toGeoJSON(c)}};var qr=class{constructor(t,n){this.version=void 0,this.name=void 0,this.extent=void 0,this.length=void 0,this._pbf=void 0,this._keys=void 0,this._values=void 0,this._features=void 0,this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(_S,this,n),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let n=this._pbf.readVarint()+this._pbf.pos;return new ln(this._pbf,n,this.extent,this._keys,this._values)}};function _S(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(ES(n)))}function ES(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var jr=class{constructor(t,n){this.layers=void 0,this.layers=t.readFields(BS,{},n)}};function BS(e,t,n){if(e===3&&n){let r=new qr(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function Gm(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[an(e.data)]],indices:[e.indices]};let r=[],s=[],i=[],o=[],a,c=0;for(let l,u=0,h;u<t;u++){h=e.indices[u]-c,l=e.indices[u+1]-c||e.data.length;let f=e.data.slice(h,l),d=an(f);if(d===0){let p=e.data.slice(0,h),A=e.data.slice(l);e.data=p.concat(A),c+=l-h;continue}a===void 0&&(a=d<0),a===d<0?(o.length&&(r.push(i),s.push(o)),o=[h],i=[d]):(i.push(d),o.push(h))}return i&&r.push(i),o.length&&s.push(o),{type:n,areas:r,indices:s,data:e.data}}function Vm(e,t,n,r){for(let s=0,i=e.length;s<i;s+=2){e[s]=(e[s]+t)*360/r-180;let o=180-(e[s+1]+n)*360/r;e[s+1]=360/Math.PI*Math.atan(Math.exp(o*Math.PI/180))-90}}function Hm(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?CS(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function CS(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],s=t._values[e.readVarint()];t.properties[r]=s}}var zm,un,ul,Zi,hl,fl,Xr;var Wr=class{constructor(t,n,r,s,i,o){this.properties=void 0,this.extent=void 0,this.type=void 0,this.id=void 0,this._pbf=void 0,this._geometry=void 0,this._keys=void 0,this._values=void 0,this._geometryInfo=void 0,this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=i,this._geometryInfo=o,t.readFields(Hm,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry,zm=t.readVarint()+t.pos,un=1,Zi=0,hl=0,fl=0,Xr=0;let n=[],r=[];for(;t.pos<zm;)if(Zi<=0&&(ul=t.readVarint(),un=ul&7,Zi=ul>>3),Zi--,un===1||un===2)hl+=t.readSVarint(),fl+=t.readSVarint(),un===1&&n.push(Xr),r.push(hl,fl),Xr+=2;else if(un===7){if(Xr>0){let s=n[n.length-1];r.push(r[s],r[s+1]),Xr+=2}}else throw new Error(`unknown command ${un}`);return{data:r,indices:n}}_toBinaryCoordinates(t){let n=this.loadGeometry(),r;t(n.data,this);let s=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=n.indices.length,r={type:"Point",...n};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=n.indices.length,this._geometryInfo.linePositionsCount+=n.data.length/s,r={type:"LineString",...n};break;case 3:r=Gm(n),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=r.indices.length;for(let o of r.indices)this._geometryInfo.polygonRingsCount+=o.length;this._geometryInfo.polygonPositionsCount+=r.data.length/s;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:r,properties:this.properties};return this.id!==null&&(i.id=this.id),i}toBinaryCoordinates(t){if(typeof t=="function")return this._toBinaryCoordinates(t);let{x:n,y:r,z:s}=t,i=this.extent*Math.pow(2,s),o=this.extent*n,a=this.extent*r;return this._toBinaryCoordinates(c=>Vm(c,o,a,i))}};var Yr=class{constructor(t,n){this.version=void 0,this.name=void 0,this.extent=void 0,this.length=void 0,this._pbf=void 0,this._keys=void 0,this._values=void 0,this._features=void 0,this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(SS,this,n),this.length=this._features.length}feature(t,n){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let r=this._pbf.readVarint()+this._pbf.pos;return new Wr(this._pbf,r,this.extent,this._keys,this._values,n)}};function SS(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(bS(n)))}function bS(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var Kr=class{constructor(t,n){this.layers=void 0,this.layers=t.readFields(MS,{},n)}};function MS(e,t,n){if(e===3&&n){let r=new Yr(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function $i(e,t){var n,r;let s=wS(t),i=(t==null||(n=t.gis)===null||n===void 0?void 0:n.format)||(t==null||(r=t.mvt)===null||r===void 0?void 0:r.shape)||t?.shape;switch(i){case"columnar-table":return{shape:"columnar-table",data:dl(e,s)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:km(e,s)};case"geojson":return km(e,s);case"binary-geometry":return dl(e,s);case"binary":return dl(e,s);default:throw new Error(i||"undefined shape")}}function dl(e,t){let[n,r]=IS(e,t),s=ol(n,r);return s.byteLength=e.byteLength,s}function IS(e,t){let n=[],r={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[n,r];let s=new Kr(new pl.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(s.layers)).forEach(o=>{let a=s.layers[o];if(a)for(let c=0;c<a.length;c++){let l=a.feature(c,r),u=vS(l,t,o);n.push(u)}}),[n,r]}function km(e,t){if(e.byteLength<=0)return[];let n=[],r=new jr(new pl.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(r.layers)).forEach(i=>{let o=r.layers[i];if(o)for(let a=0;a<o.length;a++){let c=o.feature(a),l=FS(c,t,i);n.push(l)}}),n}function wS(e){var t;if(!(e!=null&&e.mvt))throw new Error("mvt options required");let n=((t=e.mvt)===null||t===void 0?void 0:t.coordinates)==="wgs84",{tileIndex:r}=e.mvt,s=r&&Number.isFinite(r.x)&&Number.isFinite(r.y)&&Number.isFinite(r.z);if(n&&!s)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.mvt}function FS(e,t,n){let r=e.toGeoJSON(t.coordinates==="wgs84"?t.tileIndex:RS);return t.layerProperty&&(r.properties[t.layerProperty]=n),r}function vS(e,t,n){let r=e.toBinaryCoordinates(t.coordinates==="wgs84"?t.tileIndex:LS);return t.layerProperty&&r.properties&&(r.properties[t.layerProperty]=n),r}function RS(e,t){let{extent:n}=t;for(let r=0;r<e.length;r++){let s=e[r];s[0]/=n,s[1]/=n}}function LS(e,t){let{extent:n}=t;for(let r=0,s=e.length;r<s;++r)e[r]/=n}var PS="4.1.4",to={name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:PS,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:null}}},OS={...to,parse:async(e,t)=>$i(e,t),parseSync:$i,binary:!0};var NS={Point:Jm,MultiPoint:DS,LineString:qm,MultiLineString:US,Polygon:jm,MultiPolygon:GS};function Jm([e,t],[n,r],s){let i=xe(n[0],r[0],e),o=xe(n[1],r[1],t);return s.unprojectFlat([i,o])}function ml(e,t,n){return e.map(r=>Jm(r,t,n))}function DS(e,t,n){return ml(e,t,n)}function qm(e,t,n){return ml(e,t,n)}function US(e,t,n){return e.map(r=>qm(r,t,n))}function jm(e,t,n){return e.map(r=>ml(r,t,n))}function GS(e,t,n){return e.map(r=>jm(r,t,n))}function Xm(e,t,n){let r=n.projectFlat([t.west,t.north]),s=n.projectFlat([t.east,t.south]),i=[r,s];return{...e,coordinates:NS[e.type](e.coordinates,i,n)}}var VS=["points","lines","polygons"];function gl(e,t,n,r){for(let s of VS){let i=e[s]&&HS(e[s],t,n,r);if(i>=0)return i}return-1}function HS(e,t,n,r){let s=e.featureIds.value;if(!s.length)return-1;let i=0,o=s[s.length-1]+1;if(r){let c=zS(e,r);if(c)i=c[0],o=c[1]+1;else return-1}let a=-1;if(t in e.numericProps){let c=e.numericProps[t].value.findIndex((l,u)=>l===n&&s[u]>=i&&s[u]<o);return c>=0?e.globalFeatureIds.value[c]:-1}else t?a=Wm(e.properties,c=>c[t]===n,i,o):e.fields&&(a=Wm(e.fields,c=>c.id===n,i,o));return a>=0?kS(e,a):-1}function zS(e,t){if(!e.__layers){let n={},{properties:r}=e;for(let s=0;s<r.length;s++){let{layerName:i}=r[s];i&&(n[i]?n[i][1]=s:n[i]=[s,s])}e.__layers=n}return e.__layers[t]}function kS(e,t){if(!e.__ids){let n=[],r=e.featureIds.value,s=e.globalFeatureIds.value;for(let i=0;i<r.length;i++)n[r[i]]=s[i];e.__ids=n}return e.__ids[t]}function Wm(e,t,n,r){for(let s=n;s<r;s++)if(t(e[s],s))return s;return-1}var Al=512,JS={...yl.GeoJsonLayer.defaultProps,data:Se,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[to],binary:!0},eo=class extends Zt{initializeState(){super.initializeState();let t=this.context.viewport.resolution!==void 0?!1:this.props.binary;this.setState({binary:t,data:null,tileJSON:null,hoveredFeatureId:null,hoveredFeatureLayerName:null})}get isLoaded(){return Boolean(this.state?.data&&super.isLoaded)}updateState({props:t,oldProps:n,context:r,changeFlags:s}){s.dataChanged&&this._updateTileData(),this.state?.data&&(super.updateState({props:t,oldProps:n,context:r,changeFlags:s}),this._setWGS84PropertyForTiles());let{highlightColor:i}=t;i!==n.highlightColor&&Array.isArray(i)&&this.setState({highlightColor:i})}async _updateTileData(){let t=this.props.data,n=null;if(typeof t=="string"&&!Ca(t)){let{onDataLoad:r,fetch:s}=this.props;this.setState({data:null,tileJSON:null});try{n=await s(t,{propName:"data",layer:this,loaders:[]})}catch(i){this.raiseError(i,"loading TileJSON"),t=null}r&&r(n,{propName:"data",layer:this})}else t&&typeof t=="object"&&"tilejson"in t&&(n=t);n&&(t=n.tiles),this.setState({data:t,tileJSON:n})}_getTilesetOptions(){let t=super._getTilesetOptions(),n=this.state.tileJSON,{minZoom:r,maxZoom:s}=this.props;return n&&(Number.isFinite(n.minzoom)&&n.minzoom>r&&(t.minZoom=n.minzoom),Number.isFinite(n.maxzoom)&&(!Number.isFinite(s)||n.maxzoom<s)&&(t.maxZoom=n.maxzoom)),t}renderLayers(){return this.state?.data?super.renderLayers():null}getTileData(t){let{data:n,binary:r}=this.state,{index:s,signal:i}=t,o=Qt(n,t);if(!o)return Promise.reject("Invalid URL");let a=this.getLoadOptions(),{fetch:c}=this.props;return a={...a,mimeType:"application/x-protobuf",mvt:{...a?.mvt,coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:s},gis:r?{format:"binary"}:{}},c(o,{propName:"data",layer:this,loadOptions:a,signal:i})}renderSubLayers(t){let{x:n,y:r,z:s}=t.tile.index,i=Math.pow(2,s),o=Al/i,a=-o,c=Al*n/i,l=Al*(1-r/i),u=new L().scale([o,a,1]);t.autoHighlight=!1,this.context.viewport.resolution||(t.modelMatrix=u,t.coordinateOrigin=[c,l,0],t.coordinateSystem=no.COORDINATE_SYSTEM.CARTESIAN,t.extensions=[...t.extensions||[],new Zm.ClipExtension]);let h=super.renderSubLayers(t);return this.state.binary&&!(h instanceof yl.GeoJsonLayer)&&no.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),h}_updateAutoHighlight(t){let{uniqueIdProperty:n}=this.props,{hoveredFeatureId:r,hoveredFeatureLayerName:s}=this.state,i=t.object,o=null,a=null;i&&(o=xl(i,n),a=Ym(i));let{highlightColor:c}=this.props;typeof c=="function"&&(c=c(t)),(r!==o||s!==a)&&this.setState({highlightColor:c,hoveredFeatureId:o,hoveredFeatureLayerName:a})}getPickingInfo(t){let n=super.getPickingInfo(t),r=Boolean(this.context.viewport.resolution);if(this.state.binary&&n.index!==-1){let{data:s}=t.sourceLayer.props;n.object=Yi(s,{globalFeatureId:n.index})}return n.object&&!r&&(n.object=Qm(n.object,n.tile.bbox,this.context.viewport)),n}getSubLayerPropsByTile(t){return{highlightedObjectIndex:this.getHighlightedObjectIndex(t),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(t){let{hoveredFeatureId:n,hoveredFeatureLayerName:r,binary:s}=this.state,{uniqueIdProperty:i,highlightedFeatureId:o}=this.props,a=t.content,c=Km(o);if(!(Km(n)||c))return-1;let u=c?o:n;return Array.isArray(a)?a.findIndex(h=>{let f=xl(h,i)===u,d=c||Ym(h)===r;return f&&d}):a&&s?gl(a,i,u,c?"":r):-1}_pickObjects(t){let{deck:n,viewport:r}=this.context,s=r.width,i=r.height,o=r.x,a=r.y,c=[this.id];return n.pickObjects({x:o,y:a,width:s,height:i,layerIds:c,maxObjects:t})}getRenderedFeatures(t=null){let n=this._pickObjects(t),r=new Set,s=[];for(let i of n){let o=xl(i.object,this.props.uniqueIdProperty);o===void 0?s.push(i.object):r.has(o)||(r.add(o),s.push(i.object))}return s}_setWGS84PropertyForTiles(){let t="dataInWGS84";this.state.tileset.selectedTiles.forEach(r=>{r.hasOwnProperty(t)||Object.defineProperty(r,t,{get:()=>{if(!r.content)return null;if(this.state.binary&&Array.isArray(r.content)&&!r.content.length)return[];let{bbox:s}=r;if(r._contentWGS84===void 0&&Sa(s)){let i=this.state.binary?Yi(r.content):r.content;r._contentWGS84=i.map(o=>Qm(o,s,this.context.viewport))}return r._contentWGS84}})})}},Qr=eo;(()=>{eo.layerName="MVTLayer"})(),(()=>{eo.defaultProps=JS})();function xl(e,t){if(e.properties&&t)return e.properties[t];if("id"in e)return e.id}function Ym(e){return e.properties?.layerName||null}function Km(e){return e!=null&&e!==""}function Qm(e,t,n){let r={...e,geometry:{type:e.geometry.type}};return Object.defineProperty(r.geometry,"coordinates",{get:()=>Xm(e.geometry,t,n).coordinates}),r}var $m="0123456789bcdefghjkmnpqrstuvwxyz",tg={};for(let e=0;e<$m.length;e++)tg[$m.charAt(e)]=e;var qS=-90,jS=90,XS=-180,WS=180;function YS(e){let t=!0,n=jS,r=qS,s=WS,i=XS,o,a=0;for(let c=0,l=e.length;c<l;c++){let u=e[c].toLowerCase();a=tg[u];for(let h=4;h>=0;h--){let f=a>>h&1;t?(o=(s+i)/2,f===1?i=o:s=o):(o=(n+r)/2,f===1?r=o:n=o),t=!t}}return[r,i,n,s]}function eg(e){let[t,n,r,s]=YS(e);return[s,r,s,t,n,t,n,r,s,r]}var KS={getGeohash:{type:"accessor",value:e=>e.geohash}},ro=class extends Mt{indexToBounds(){let{data:t,getGeohash:n}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(r,s)=>eg(n(r,s))}}},Zr=ro;(()=>{ro.layerName="GeohashLayer"})(),(()=>{ro.defaultProps=KS})();return lg($r);})();
|
|
449
449
|
return __exports__;
|
|
450
450
|
});
|