@deck.gl/geo-layers 9.0.30 → 9.0.31
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/geo-cell-layer/GeoCellLayer.js +4 -3
- package/dist/geohash-layer/geohash-layer.js +4 -3
- package/dist/great-circle-layer/great-circle-layer.js +4 -3
- package/dist/h3-layers/h3-cluster-layer.js +4 -3
- package/dist/h3-layers/h3-hexagon-layer.js +6 -5
- package/dist/index.cjs +74 -133
- package/dist/index.cjs.map +2 -2
- package/dist/mesh-layer/mesh-layer.js +4 -3
- package/dist/mvt-layer/mvt-layer.js +4 -3
- package/dist/quadkey-layer/quadkey-layer.js +4 -3
- package/dist/s2-layer/s2-layer.js +4 -3
- package/dist/terrain-layer/terrain-layer.js +4 -3
- package/dist/tile-3d-layer/tile-3d-layer.js +4 -3
- package/dist/tile-layer/tile-layer.js +4 -3
- package/dist/trips-layer/trips-layer.js +4 -3
- package/dist/wms-layer/wms-layer.js +2 -2
- package/dist.min.js +12 -12
- package/package.json +2 -2
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
|
|
8
|
-
`&&e[o]!=="\r";o++)c+=e[o];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),o--),!
|
|
9
|
-
`||e==="\r"}function
|
|
10
|
-
`);let t=new kr("!xml"),r=t,n="",s="";for(let o=0;o<e.length;o++)if(e[o]==="<")if(e[o+1]==="/"){let a=
|
|
11
|
-
`;function
|
|
7
|
+
"use strict";var __exports__=(()=>{var ng=Object.create;var Hr=Object.defineProperty;var sg=Object.getOwnPropertyDescriptor;var og=Object.getOwnPropertyNames;var ig=Object.getPrototypeOf,ag=Object.prototype.hasOwnProperty;var cg=(e,t,r)=>t in e?Hr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var cl=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):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),ut=(e,t)=>{for(var r in t)Hr(e,r,{get:t[r],enumerable:!0})},Kn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of og(t))!ag.call(e,s)&&s!==r&&Hr(e,s,{get:()=>t[s],enumerable:!(n=sg(t,s))||n.enumerable});return e},ue=(e,t,r)=>(Kn(e,t,"default"),r&&Kn(r,t,"default")),N=(e,t,r)=>(r=e!=null?ng(ig(e)):{},Kn(t||!e||!e.__esModule?Hr(r,"default",{value:e,enumerable:!0}):r,e)),lg=e=>Kn(Hr({},"__esModule",{value:!0}),e);var ar=(e,t,r)=>(cg(e,typeof t!="symbol"?t+"":t,r),r);var Ot=tt((tb,ll)=>{ll.exports=globalThis.deck});var Nt=tt((rb,fl)=>{fl.exports=globalThis.deck});var Zn=tt(te=>{"use strict";var hl=":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",fg=hl+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",dl="["+hl+"]["+fg+"]*",hg=new RegExp("^"+dl+"$"),dg=function(e,t){let r=[],n=t.exec(e);for(;n;){let s=[];s.startIndex=t.lastIndex-n[0].length;let o=n.length;for(let i=0;i<o;i++)s.push(n[i]);r.push(s),n=t.exec(e)}return r},pg=function(e){let t=hg.exec(e);return!(t===null||typeof t>"u")};te.isExist=function(e){return typeof e<"u"};te.isEmptyObject=function(e){return Object.keys(e).length===0};te.merge=function(e,t,r){if(t){let n=Object.keys(t),s=n.length;for(let o=0;o<s;o++)r==="strict"?e[n[o]]=[t[n[o]]]:e[n[o]]=t[n[o]]}};te.getValue=function(e){return te.isExist(e)?e:""};te.isName=pg;te.getAllMatches=dg;te.nameRegexp=dl});var Xo=tt(xl=>{"use strict";var jo=Zn(),mg={allowBooleanAttributes:!1,unpairedTags:[]};xl.validate=function(e,t){t=Object.assign({},mg,t);let r=[],n=!1,s=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let o=0;o<e.length;o++)if(e[o]==="<"&&e[o+1]==="?"){if(o+=2,o=ml(e,o),o.err)return o}else if(e[o]==="<"){let i=o;if(o++,e[o]==="!"){o=gl(e,o);continue}else{let a=!1;e[o]==="/"&&(a=!0,o++);let c="";for(;o<e.length&&e[o]!==">"&&e[o]!==" "&&e[o]!==" "&&e[o]!==`
|
|
8
|
+
`&&e[o]!=="\r";o++)c+=e[o];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),o--),!Bg(c)){let f;return c.trim().length===0?f="Invalid space after '<'.":f="Tag '"+c+"' is an invalid name.",st("InvalidTag",f,xt(e,o))}let l=xg(e,o);if(l===!1)return st("InvalidAttr","Attributes for '"+c+"' have open quote.",xt(e,o));let u=l.value;if(o=l.index,u[u.length-1]==="/"){let f=o-u.length;u=u.substring(0,u.length-1);let h=Al(u,t);if(h===!0)n=!0;else return st(h.err.code,h.err.msg,xt(e,f+h.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,i));{let f=r.pop();if(c!==f.tagName){let h=xt(e,f.tagStartPos);return st("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+h.line+", col "+h.col+") instead of closing tag '"+c+"'.",xt(e,i))}r.length==0&&(s=!0)}}else return st("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",xt(e,o));else{let f=Al(u,t);if(f!==!0)return st(f.err.code,f.err.msg,xt(e,o-u.length+f.err.line));if(s===!0)return st("InvalidXml","Multiple possible root nodes found.",xt(e,o));t.unpairedTags.indexOf(c)!==-1||r.push({tagName:c,tagStartPos:i}),n=!0}for(o++;o<e.length;o++)if(e[o]==="<")if(e[o+1]==="!"){o++,o=gl(e,o);continue}else if(e[o+1]==="?"){if(o=ml(e,++o),o.err)return o}else break;else if(e[o]==="&"){let f=_g(e,o);if(f==-1)return st("InvalidChar","char '&' is not expected.",xt(e,o));o=f}else if(s===!0&&!pl(e[o]))return st("InvalidXml","Extra text at the end",xt(e,o));e[o]==="<"&&o--}}else{if(pl(e[o]))continue;return st("InvalidChar","char '"+e[o]+"' is not expected.",xt(e,o))}if(n){if(r.length==1)return st("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",xt(e,r[0].tagStartPos));if(r.length>0)return st("InvalidXml","Invalid '"+JSON.stringify(r.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return st("InvalidXml","Start tag expected.",1);return!0};function pl(e){return e===" "||e===" "||e===`
|
|
9
|
+
`||e==="\r"}function ml(e,t){let r=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){let n=e.substr(r,t-r);if(t>5&&n==="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 gl(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 r=1;for(t+=8;t<e.length;t++)if(e[t]==="<")r++;else if(e[t]===">"&&(r--,r===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 r="",n="",s=!1;for(;t<e.length;t++){if(e[t]===gg||e[t]===Ag)n===""?n=e[t]:n!==e[t]||(n="");else if(e[t]===">"&&n===""){s=!0;break}r+=e[t]}return n!==""?!1:{value:r,index:t,tagClosed:s}}var yg=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Al(e,t){let r=jo.getAllMatches(e,yg),n={};for(let s=0;s<r.length;s++){if(r[s][1].length===0)return st("InvalidAttr","Attribute '"+r[s][2]+"' has no space in starting.",zr(r[s]));if(r[s][3]!==void 0&&r[s][4]===void 0)return st("InvalidAttr","Attribute '"+r[s][2]+"' is without value.",zr(r[s]));if(r[s][3]===void 0&&!t.allowBooleanAttributes)return st("InvalidAttr","boolean attribute '"+r[s][2]+"' is not allowed.",zr(r[s]));let o=r[s][2];if(!Eg(o))return st("InvalidAttr","Attribute '"+o+"' is an invalid name.",zr(r[s]));if(!n.hasOwnProperty(o))n[o]=1;else return st("InvalidAttr","Attribute '"+o+"' is repeated.",zr(r[s]))}return!0}function Tg(e,t){let r=/\d/;for(e[t]==="x"&&(t++,r=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(r))break}return-1}function _g(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,Tg(e,t);let r=0;for(;t<e.length;t++,r++)if(!(e[t].match(/\w/)&&r<20)){if(e[t]===";")break;return-1}return t}function st(e,t,r){return{err:{code:e,msg:t,line:r.line||r,col:r.col}}}function Eg(e){return jo.isName(e)}function Bg(e){return jo.isName(e)}function xt(e,t){let r=e.substring(0,t).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function zr(e){return e.startIndex+e[1].length}});var Tl=tt(Wo=>{var yl={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,r){return e}},Cg=function(e){return Object.assign({},yl,e)};Wo.buildOptions=Cg;Wo.defaultOptions=yl});var El=tt((ab,_l)=>{"use strict";var Yo=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,r){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:r})}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})}};_l.exports=Yo});var Cl=tt((cb,Bl)=>{var Sg=Zn();function bg(e,t){let r={};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 n=1,s=!1,o=!1,i="";for(;t<e.length;t++)if(e[t]==="<"&&!o){if(s&&wg(e,t))t+=7,[entityName,val,t]=Mg(e,t+1),val.indexOf("&")===-1&&(r[Pg(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(s&&Lg(e,t))t+=8;else if(s&&Fg(e,t))t+=8;else if(s&&Rg(e,t))t+=9;else if(Ig)o=!0;else throw new Error("Invalid DOCTYPE");n++,i=""}else if(e[t]===">"){if(o?e[t-1]==="-"&&e[t-2]==="-"&&(o=!1,n--):n--,n===0)break}else e[t]==="["?s=!0:i+=e[t];if(n!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:t}}function Mg(e,t){let r="";for(;t<e.length&&e[t]!=="'"&&e[t]!=='"';t++)r+=e[t];if(r=r.trim(),r.indexOf(" ")!==-1)throw new Error("External entites are not supported");let n=e[t++],s="";for(;t<e.length&&e[t]!==n;t++)s+=e[t];return[r,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 Lg(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 Fg(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 Pg(e){if(Sg.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}Bl.exports=bg});var bl=tt((lb,Sl)=>{var Og=/^[-+]?0x[a-fA-F0-9]+$/,Ng=/^([\-\+])?(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 Dg={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function vg(e,t={}){if(t=Object.assign({},Dg,t),!e||typeof e!="string")return e;let r=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(r))return e;if(t.hex&&Og.test(r))return Number.parseInt(r,16);{let n=Ng.exec(r);if(n){let s=n[1],o=n[2],i=Ug(n[3]),a=n[4]||n[6];if(!t.leadingZeros&&o.length>0&&s&&r[2]!==".")return e;if(!t.leadingZeros&&o.length>0&&!s&&r[1]!==".")return e;{let c=Number(r),l=""+c;return l.search(/[eE]/)!==-1||a?t.eNotation?c:e:r.indexOf(".")!==-1?l==="0"&&i===""||l===i||s&&l==="-"+i?c:e:o?i===l||s+i===l?c:e:r===l||r===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}Sl.exports=vg});var wl=tt((ub,Il)=>{"use strict";var Ml=Zn(),kr=El(),Gg=Cl(),Vg=bl(),Ko=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:(r,n)=>String.fromCharCode(Number.parseInt(n,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,n)=>String.fromCharCode(Number.parseInt(n,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 r=0;r<t.length;r++){let n=t[r];this.lastEntities[n]={regex:new RegExp("&"+n+";","g"),val:e[n]}}}function zg(e,t,r,n,s,o,i){if(e!==void 0&&(this.options.trimValues&&!n&&(e=e.trim()),e.length>0)){i||(e=this.replaceEntitiesValue(e));let a=this.options.tagValueProcessor(t,e,r,s,o);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?Zo(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?Zo(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function kg(e){if(this.options.removeNSPrefix){let t=e.split(":"),r=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=r+t[1])}return e}var Jg=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function qg(e,t,r){if(!this.options.ignoreAttributes&&typeof e=="string"){let n=Ml.getAllMatches(e,Jg),s=n.length,o={};for(let i=0;i<s;i++){let a=this.resolveNameSpace(n[i][1]),c=n[i][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?o[l]=c:typeof u!=typeof c||u!==c?o[l]=u:o[l]=Zo(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[l]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){let i={};return i[this.options.attributesGroupName]=o,i}return o}}var jg=function(e){e=e.replace(/\r\n?/g,`
|
|
10
|
+
`);let t=new kr("!xml"),r=t,n="",s="";for(let o=0;o<e.length;o++)if(e[o]==="<")if(e[o+1]==="/"){let a=Le(e,">",o,"Closing Tag is not closed."),c=e.substring(o+2,a).trim();if(this.options.removeNSPrefix){let f=c.indexOf(":");f!==-1&&(c=c.substr(f+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),r&&(n=this.saveTextToParentTag(n,r,s));let l=s.substring(s.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);let 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),r=this.tagsNodeStack.pop(),n="",o=a}else if(e[o+1]==="?"){let a=Qo(e,o,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,r,s),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){let c=new kr(a.tagName);c.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(c[":@"]=this.buildAttributesMap(a.tagExp,s,a.tagName)),this.addChild(r,c,s)}o=a.closeIndex+1}else if(e.substr(o+1,3)==="!--"){let a=Le(e,"-->",o+4,"Comment is not closed.");if(this.options.commentPropName){let c=e.substring(o+4,a-2);n=this.saveTextToParentTag(n,r,s),r.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}o=a}else if(e.substr(o+1,2)==="!D"){let a=Gg(e,o);this.docTypeEntities=a.entities,o=a.i}else if(e.substr(o+1,2)==="!["){let a=Le(e,"]]>",o,"CDATA is not closed.")-2,c=e.substring(o+9,a);n=this.saveTextToParentTag(n,r,s);let l=this.parseTextData(c,r.tagname,s,!0,!1,!0,!0);l==null&&(l=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]):r.add(this.options.textNodeName,l),o=a+2}else{let a=Qo(e,o,this.options.removeNSPrefix),c=a.tagName,l=a.rawTagName,u=a.tagExp,f=a.attrExpPresent,h=a.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,s,!1));let d=r;if(d&&this.options.unpairedTags.indexOf(d.tagname)!==-1&&(r=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)o=a.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)o=a.closeIndex;else{let g=this.readStopNodeData(e,l,h+1);if(!g)throw new Error(`Unexpected end of ${l}`);o=g.i,p=g.tagContent}let A=new kr(c);c!==u&&f&&(A[":@"]=this.buildAttributesMap(u,s,c)),p&&(p=this.parseTextData(p,c,s,!0,f,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),A.add(this.options.textNodeName,p),this.addChild(r,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 kr(c);c!==u&&f&&(p[":@"]=this.buildAttributesMap(u,s,c)),this.addChild(r,p,s),s=s.substr(0,s.lastIndexOf("."))}else{let p=new kr(c);this.tagsNodeStack.push(r),c!==u&&f&&(p[":@"]=this.buildAttributesMap(u,s,c)),this.addChild(r,p,s),r=p}n="",o=h}}else n+=e[o];return t.child};function Xg(e,t,r){let n=this.options.updateTag(t.tagname,r,t[":@"]);n===!1||(typeof n=="string"&&(t.tagname=n),e.addChild(t))}var Wg=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){let r=this.docTypeEntities[t];e=e.replace(r.regx,r.val)}for(let t in this.lastEntities){let r=this.lastEntities[t];e=e.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){let r=this.htmlEntities[t];e=e.replace(r.regex,r.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function Yg(e,t,r,n){return e&&(n===void 0&&(n=Object.keys(t.child).length===0),e=this.parseTextData(e,t.tagname,r,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,n),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function Kg(e,t,r){let n="*."+r;for(let s in e){let o=e[s];if(n===o||t===o)return!0}return!1}function Qg(e,t,r=">"){let n,s="";for(let o=t;o<e.length;o++){let i=e[o];if(n)i===n&&(n="");else if(i==='"'||i==="'")n=i;else if(i===r[0])if(r[1]){if(e[o+1]===r[1])return{data:s,index:o}}else return{data:s,index:o};else i===" "&&(i=" ");s+=i}}function Le(e,t,r,n){let s=e.indexOf(t,r);if(s===-1)throw new Error(n);return s+t.length-1}function Qo(e,t,r,n=">"){let s=Qg(e,t+1,n);if(!s)return;let o=s.data,i=s.index,a=o.search(/\s/),c=o,l=!0;a!==-1&&(c=o.substring(0,a),o=o.substring(a+1).trimStart());let u=c;if(r){let f=c.indexOf(":");f!==-1&&(c=c.substr(f+1),l=c!==s.data.substr(f+1))}return{tagName:c,tagExp:o,closeIndex:i,attrExpPresent:l,rawTagName:u}}function Zg(e,t,r){let n=r,s=1;for(;r<e.length;r++)if(e[r]==="<")if(e[r+1]==="/"){let o=Le(e,">",r,`${t} is not closed`);if(e.substring(r+2,o).trim()===t&&(s--,s===0))return{tagContent:e.substring(n,r),i:o};r=o}else if(e[r+1]==="?")r=Le(e,"?>",r+1,"StopNode is not closed.");else if(e.substr(r+1,3)==="!--")r=Le(e,"-->",r+3,"StopNode is not closed.");else if(e.substr(r+1,2)==="![")r=Le(e,"]]>",r,"StopNode is not closed.")-2;else{let o=Qo(e,r,">");o&&((o&&o.tagName)===t&&o.tagExp[o.tagExp.length-1]!=="/"&&s++,r=o.closeIndex)}}function Zo(e,t,r){if(t&&typeof e=="string"){let n=e.trim();return n==="true"?!0:n==="false"?!1:Vg(e,r)}else return Ml.isExist(e)?e:""}Il.exports=Ko});var Rl=tt(Fl=>{"use strict";function $g(e,t){return Ll(e,t)}function Ll(e,t,r){let n,s={};for(let o=0;o<e.length;o++){let i=e[o],a=t0(i),c="";if(r===void 0?c=a:c=r+"."+a,a===t.textNodeName)n===void 0?n=i[a]:n+=""+i[a];else{if(a===void 0)continue;if(i[a]){let l=Ll(i[a],t,c),u=r0(l,t);i[":@"]?e0(l,i[":@"],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 n=="string"?n.length>0&&(s[t.textNodeName]=n):n!==void 0&&(s[t.textNodeName]=n),s}function t0(e){let t=Object.keys(e);for(let r=0;r<t.length;r++){let n=t[r];if(n!==":@")return n}}function e0(e,t,r,n){if(t){let s=Object.keys(t),o=s.length;for(let i=0;i<o;i++){let a=s[i];n.isArray(a,r+"."+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function r0(e,t){let{textNodeName:r}=t,n=Object.keys(e).length;return!!(n===0||n===1&&(e[r]||typeof e[r]=="boolean"||e[r]===0))}Fl.prettify=$g});var Ol=tt((hb,Pl)=>{var{buildOptions:n0}=Tl(),s0=wl(),{prettify:o0}=Rl(),i0=Xo(),$o=class{constructor(t){this.externalEntities={},this.options=n0(t)}parse(t,r){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let o=i0.validate(t,r);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}let n=new s0(this.options);n.addExternalEntities(this.externalEntities);let s=n.parseXml(t);return this.options.preserveOrder||s===void 0?s:o0(s,this.options)}addEntity(t,r){if(r.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(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=r}};Pl.exports=$o});var Gl=tt((db,Ul)=>{var a0=`
|
|
11
|
+
`;function c0(e,t){let r="";return t.format&&t.indentBy.length>0&&(r=a0),Dl(e,t,"",r)}function Dl(e,t,r,n){let s="",o=!1;for(let i=0;i<e.length;i++){let a=e[i],c=l0(a);if(c===void 0)continue;let l="";if(r.length===0?l=c:l=`${r}.${c}`,c===t.textNodeName){let p=a[c];u0(l,t)||(p=t.tagValueProcessor(c,p),p=vl(p,t)),o&&(s+=n),s+=p,o=!1;continue}else if(c===t.cdataPropName){o&&(s+=n),s+=`<![CDATA[${a[c][0][t.textNodeName]}]]>`,o=!1;continue}else if(c===t.commentPropName){s+=n+`<!--${a[c][0][t.textNodeName]}-->`,o=!0;continue}else if(c[0]==="?"){let p=Nl(a[":@"],t),A=c==="?xml"?"":n,g=a[c][0][t.textNodeName];g=g.length!==0?" "+g:"",s+=A+`<${c}${g}${p}?>`,o=!0;continue}let u=n;u!==""&&(u+=t.indentBy);let f=Nl(a[":@"],t),h=n+`<${c}${f}`,d=Dl(a[c],t,l,u);t.unpairedTags.indexOf(c)!==-1?t.suppressUnpairedNode?s+=h+">":s+=h+"/>":(!d||d.length===0)&&t.suppressEmptyNode?s+=h+"/>":d&&d.endsWith(">")?s+=h+`>${d}${n}</${c}>`:(s+=h+">",d&&n!==""&&(d.includes("/>")||d.includes("</"))?s+=n+t.indentBy+d+n:s+=d,s+=`</${c}>`),o=!0}return s}function l0(e){let t=Object.keys(e);for(let r=0;r<t.length;r++){let n=t[r];if(e.hasOwnProperty(n)&&n!==":@")return n}}function Nl(e,t){let r="";if(e&&!t.ignoreAttributes)for(let n in e){if(!e.hasOwnProperty(n))continue;let s=t.attributeValueProcessor(n,e[n]);s=vl(s,t),s===!0&&t.suppressBooleanAttributes?r+=` ${n.substr(t.attributeNamePrefix.length)}`:r+=` ${n.substr(t.attributeNamePrefix.length)}="${s}"`}return r}function u0(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let r=e.substr(e.lastIndexOf(".")+1);for(let n in t.stopNodes)if(t.stopNodes[n]===e||t.stopNodes[n]==="*."+r)return!0;return!1}function vl(e,t){if(e&&e.length>0&&t.processEntities)for(let r=0;r<t.entities.length;r++){let n=t.entities[r];e=e.replace(n.regex,n.val)}return e}Ul.exports=c0});var Hl=tt((pb,Vl)=>{"use strict";var f0=Gl(),h0={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({},h0,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="")}he.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)};he.prototype.j2x=function(e,t){let r="",n="";for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))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}};he.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 p0(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)}he.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}};he.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};he.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}};he.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 m0(e){return this.options.indentBy.repeat(e)}function g0(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}Ql.exports=he});var tu=tt((gb,$l)=>{"use strict";var A0=si(),x0=ql(),y0=Zl();$l.exports={XMLParser:x0,XMLValidator:A0,XMLBuilder:y0}});var ga=tt((jf,fn)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof yl=="function"&&typeof fn=="object"&&fn&&fn.exports?fn.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(jf,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 r={},n={};function s(T,m){var M,L,R;return m?(T>>>=0,(R=0<=T&&T<256)&&(L=n[T],L)?L:(M=i(T,(T|0)<0?-1:0,!0),R&&(n[T]=M),M)):(T|=0,(R=-128<=T&&T<128)&&(L=r[T],L)?L:(M=i(T,T<0?-1:0,!1),R&&(r[T]=M),M))}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 b}else{if(T<=-p)return w;if(T+1>=p)return S}return T<0?o(-T,m).neg():i(T%h|0,T/h|0,m)}e.fromNumber=o;function i(T,m,M){return new e(T,m,M)}e.fromBits=i;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 L;if((L=T.indexOf("-"))>0)throw Error("interior hyphen");if(L===0)return c(T.substring(1),m,M).neg();for(var R=o(a(M,8)),F=g,D=0;D<T.length;D+=8){var X=Math.min(8,T.length-D),H=parseInt(T.substring(D,D+X),M);if(X<8){var Q=o(a(M,X));F=F.mul(Q).add(o(H))}else F=F.mul(R),F=F.add(o(H))}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 u=1<<16,f=1<<24,h=u*u,d=h*h,p=d/2,A=s(f),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 b=i(-1,-1,!0);e.MAX_UNSIGNED_VALUE=b;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)*h+(this.low>>>0):this.high*h+(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=o(m),L=this.div(M),R=L.mul(M).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),D=this,X="";;){var H=D.div(F),Q=D.sub(H.mul(F)).toInt()>>>0,j=Q.toString(m);if(D=H,D.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(),L=m.isNegative();return M&&!L?-1:!M&&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 M=this.high>>>16,L=this.high&65535,R=this.low>>>16,F=this.low&65535,D=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+=L+X,j+=W>>>16,W&=65535,j+=M+D,j&=65535,i($<<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 o(this.toNumber()*m.toNumber(),this.unsigned);var M=this.high>>>16,L=this.high&65535,R=this.low>>>16,F=this.low&65535,D=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+=L*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+L*H+R*X+F*D,j&=65535,i($<<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,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 M=F.div(m).shl(1),M.eq(g)?m.isNegative()?E:B:(L=this.sub(m.mul(M)),R=M.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);){M=Math.max(1,Math.floor(L.toNumber()/m.toNumber()));for(var D=Math.ceil(Math.log(M)/Math.LN2),X=D<=48?1:a(2,D-48),H=o(M),Q=H.mul(m);Q.isNegative()||Q.gt(L);)M-=X,H=o(M,this.unsigned),Q=H.mul(m);H.isZero()&&(H=E),R=R.add(H),L=L.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 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 M=this.high;if(m<32){var L=this.low;return i(L>>>m|M<<32-m,M>>>m,this.unsigned)}else return m===32?i(M,0,this.unsigned):i(M>>>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 Us=tt((XR,Bh)=>{Bh.exports=globalThis.h3||{}});var wa=tt((rP,Ih)=>{Ih.exports=globalThis.luma});var zs=tt((nP,wh)=>{wh.exports=globalThis.deck});var Lh=tt((sP,Fh)=>{Fh.exports=globalThis.luma});var yr=tt((WP,nd)=>{nd.exports=globalThis.loaders});var Tm=tt((YG,ym)=>{ym.exports=globalThis.deck});var Fm=tt(il=>{il.read=function(e,t,r,n,s){var o,i,a=s*8-n-1,c=(1<<a)-1,l=c>>1,u=-7,f=r?s-1:0,h=r?-1:1,d=e[t+f];for(f+=h,o=d&(1<<-u)-1,d>>=-u,u+=a;u>0;o=o*256+e[t+f],f+=h,u-=8);for(i=o&(1<<-u)-1,o>>=-u,u+=n;u>0;i=i*256+e[t+f],f+=h,u-=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)};il.write=function(e,t,r,n,s,o){var i,a,c,l=o*8-s-1,u=(1<<l)-1,f=u>>1,h=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=u):(i=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-i))<1&&(i--,c*=2),i+f>=1?t+=h/c:t+=h*Math.pow(2,1-f),t*c>=2&&(i++,c/=2),i+f>=u?(a=0,i=u):i+f>=1?(a=(t*c-1)*Math.pow(2,s),i=i+f):(a=t*Math.pow(2,f-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=tt((D4,Nm)=>{"use strict";Nm.exports=k;var qo=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 al=(1<<16)*(1<<16),Lm=1/al,sS=12,Om=typeof TextDecoder>"u"?null:new TextDecoder("utf8");k.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=jo(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=jo(this.buf,this.pos)+jo(this.buf,this.pos+4)*al;return this.pos+=8,e},readSFixed64:function(){var e=jo(this.buf,this.pos)+Pm(this.buf,this.pos+4)*al;return this.pos+=8,e},readFloat:function(){var e=qo.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=qo.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,oS(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>=sS&&Om?yS(this.buf,t,e):xS(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 r=ue(this);for(e=e||[];this.pos<r;)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 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),Gr(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),Gr(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),Gr(this.buf,e&-1,this.pos),Gr(this.buf,Math.floor(e*Lm),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),Gr(this.buf,e&-1,this.pos),Gr(this.buf,Math.floor(e*Lm),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){iS(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=TS(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),qo.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),qo.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,k.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,lS,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,uS,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,dS,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,fS,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,hS,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,pS,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,mS,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,gS,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,AS,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 oS(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 Ur(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 Ur(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function iS(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),aS(r,n,t),cS(n,t)}function aS(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 cS(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 lS(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function uS(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function fS(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function hS(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function dS(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function pS(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function mS(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function gS(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function AS(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function jo(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function Gr(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 xS(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,u;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],u=e[s+3],(c&192)===128&&(l&192)===128&&(u&192)===128&&(i=(o&15)<<18|(c&63)<<12|(l&63)<<6|u&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 yS(e,t,r){return Om.decode(e.subarray(t,r))}function TS(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 Xn={};ut(Xn,{GeohashLayer:()=>jn,GreatCircleLayer:()=>un,H3ClusterLayer:()=>_n,H3HexagonLayer:()=>qe,MVTLayer:()=>qn,QuadkeyLayer:()=>dn,S2Layer:()=>hn,TerrainLayer:()=>Un,Tile3DLayer:()=>On,TileLayer:()=>Zt,TripsLayer:()=>xn,_GeoCellLayer:()=>St,_Tile2DHeader:()=>ke,_Tileset2D:()=>Je,_WMSLayer:()=>Es,_getURLFromTemplate:()=>Qt});var Jt={},_l=N(Nt(),1);fe(Jt,N(Nt(),1));if(!_l.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");fe(Xn,Jt);var ze=N(Dt(),1),kf=N(Nt(),1);function fg(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function Yn(e){if(Array.isArray(e))return e.map(t=>Yn(t));if(e&&typeof e=="object"){let t={};for(let[r,n]of Object.entries(e))t[fg(r)]=Yn(n);return t}return e}var eu=N(tu(),1);function fi(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=T0(e,r);return t?.uncapitalizeKeys?Yn(n):n}function T0(e,t){return new eu.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var _0="4.2.0-beta.2",vt={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:_0,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:E0,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>fi(new TextDecoder().decode(e),{...vt.options.xml,...t?.xml}),parseTextSync:(e,t)=>fi(e,{...vt.options.xml,...t?.xml})};function E0(e){return e.startsWith("<?xml")}async function Et(e,t,r,n){return n._parse(e,t,r,n)}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},B0=qt.self||qt.window||qt.global||{},C0=qt.window||qt.self||qt.global||{},S0=qt.global||qt.self||qt.window||{},b0=qt.document||{};var Jr=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var ru=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),M0=ru&&parseFloat(ru[1])||0;var Qn=globalThis,I0=globalThis.document||{},Zn=globalThis.process||{},w0=globalThis.console,Cb=globalThis.navigator||{};function nu(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 Le(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||nu()}var hi="4.0.7";function L0(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var $n=class{constructor(t,r,n="sessionStorage"){this.storage=L0(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 su(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 ou(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var ts;(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"})(ts||(ts={}));var R0=10;function iu(e){return typeof e!="string"?e:(e=e.toUpperCase(),ts[e]||ts.WHITE)}function au(e,t,r){return!Le&&typeof e=="string"&&(t&&(e=`\x1B[${iu(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${iu(r)+R0}m${e}\x1B[49m`)),e}function cu(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 qr(e,t){if(!e)throw new Error(t||"Assertion failed")}function Re(){let e;if(Le()&&Qn.performance)e=Qn?.performance?.now?.();else if("hrtime"in Zn){let t=Zn?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var cr={debug:Le()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},P0={enabled:!0,level:0};function lr(){}var lu={},uu={once:!0},jr=class{constructor({id:t}={id:""}){this.VERSION=hi,this._startTs=Re(),this._deltaTs=Re(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new $n(`__probe-${this.id}__`,P0),this.timeStamp(`${this.id} started`),cu(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((Re()-this._startTs).toPrecision(10))}getDelta(){return Number((Re()-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,cr.warn,arguments,uu)}error(t){return this._getLogFunction(0,t,cr.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,cr.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,cr.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,cr.debug||cr.info,arguments,uu)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||lr,n&&[n],{tag:N0(r)}):lr}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||lr)}group(t,r,n={collapsed:!1}){let s=fu({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||lr)}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()>=hu(t)}_getLogFunction(t,r,n,s,o){if(this._shouldLog(t)){o=fu({logLevel:t,message:r,args:s,opts:o}),n=n||o.method,qr(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=Re();let i=o.tag||o.message;if(o.once&&i)if(!lu[i])lu[i]=Re();else return lr;return r=O0(this.id,o.message,o),n.bind(console,r,...o.args)}return lr}};jr.VERSION=hi;function hu(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 qr(Number.isFinite(t)&&t>=0),t}function fu(e){let{logLevel:t,message:r}=e;e.logLevel=hu(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 qr(s==="string"||s==="object"),Object.assign(e,{args:n},e.opts)}function O0(e,t,r){if(typeof t=="string"){let n=r.time?ou(su(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=au(t,r.color,r.background)}return t}function N0(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}globalThis.probe={};var di=new jr({id:"@probe.gl/log"});function pi(e,t){return du(e||{},t)}function du(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]=du(n[s]||{},t[s],r+1):n[s]=t[s];return n}function mi(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function gi(e){return globalThis.loaders?.modules?.[e]||null}function D0(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.0-beta.2"),globalThis._loadersgl_.version}var pu=D0();function mu(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},eM=jt.self||jt.window||jt.global||{},rM=jt.window||jt.self||jt.global||{},nM=jt.global||jt.self||jt.window||{},sM=jt.document||{};var ur=typeof process!="object"||String(process)!=="[object process]"||process.browser,es=typeof importScripts=="function",oM=typeof window<"u"&&typeof window.orientation<"u",gu=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),iM=gu&&parseFloat(gu[1])||0;var Ai={};async function Xt(e,t=null,r={},n=null){return t&&(e=Au(e,t,r,n)),Ai[e]=Ai[e]||v0(e),await Ai[e]}function Au(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]:ur?r.CDN?(mu(r.CDN.startsWith("http")),`${r.CDN}/${t}@${pu}/dist/libs/${n}`):es?`../src/libs/${n}`:`modules/${t}/src/libs/${n}`:`modules/${t}/dist/libs/${n}`}async function v0(e){if(e.endsWith("wasm"))return await G0(e);if(!ur)try{let{requireFromFile:r}=globalThis.loaders||{};return await r?.(e)}catch(r){return console.error(r),null}if(es)return importScripts(e);let t=await V0(e);return U0(t,e)}function U0(e,t){if(!ur){let{requireFromString:n}=globalThis.loaders||{};return n?.(e,t)}if(es)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 G0(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return ur||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function V0(e){let{readFileAsText:t}=globalThis.loaders||{};return ur||!t||e.startsWith("http")?await(await fetch(e)).text():await t(e)}function yu(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?xu(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?xu(e,0,t):""}function xu(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 "${yu(e)}"`)}}function Xr(...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 de(e,t){return G(e>=0),G(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+de(n.byteLength,4)}function Wr(){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=Wr(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Wr()-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,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 H0="Queued Requests",z0="Active Requests",k0="Cancelled Requests",J0="Queued Requests Ever",q0="Active Requests Ever",j0={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},me=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...j0,...t},this.stats=new pe({id:this.props.id}),this.stats.get(H0),this.stats.get(z0),this.stats.get(k0),this.stats.get(J0),this.stats.get(q0)}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 ge={};ut(ge,{dirname:()=>W0,filename:()=>X0,join:()=>Y0,resolve:()=>K0});function Tu(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function X0(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function W0(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function Y0(...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 K0(...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=Tu()),i=s),i.length!==0&&(r=`${i}/${r}`,n=i.charCodeAt(0)===Yr)}return r=Q0(r,!n),n?`/${r}`:r.length>0?r:"."}var Yr=47,Ti=46;function Q0(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===Yr)break;o=Yr}if(o===Yr){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)!==Yr;--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 rs=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=Z0(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 Z0(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 Mt=class extends rs{};ar(Mt,"type","template"),ar(Mt,"testURL",t=>!1);function _u(e,t){let r=vt.parseTextSync?.(e,t),n=r?.ServiceExceptionReport?.ServiceException||r?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof n=="string"?n:n.value||n.code||"Unknown error"}var $0="4.2.0-beta.2",Kr={dataType:null,batchType:null,id:"wms-error",name:"WMS Error",module:"wms",version:$0,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:tA,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 tA(e){return e.startsWith("<?xml")}function _i(e,t){let r={...Kr.options.wms,...t?.wms},n=_u(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 Qr(e){let t=Ne(e);return t.length>0&&t.every(r=>typeof r=="string")?t:[]}function Zr(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseFloat(e);default:return}}function ns(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=vt.parseTextSync?.(e,t),n=r.WMT_MS_Capabilities||r.WMS_Capabilities||r,s=eA(n);if(t?.inheritedLayerProps)for(let o of s.layers)Bu(o,null);return t?.includeRawJSON&&(s.json=n),t?.includeXMLText&&(s.xml=e),s}function eA(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:Qr(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:ns(e.Service?.LayerLimit),maxWidth:ns(e.Service?.maxWidth),maxHeight:ns(e.Service?.maxHeight),layers:[],requests:rA(e.Capability?.Request),exceptions:nA(e.Exception)},r=Ne(e.Capability?.Layer);for(let n of r)t.layers.push(Eu(n));for(let[n,s]of Object.entries(t))s===void 0&&delete t[n];return t}function rA(e){let t={};for(let[r,n]of Object.entries(e||{})){let s=Qr(n?.Format);t[r]={mimeTypes:s}}return t}function nA(e){if(Ne(e?.Format).length>0)return{mimeTypes:Qr(e)}}function Eu(e){let t={title:String(e?.Title||""),name:e?.Name&&String(e?.Name),abstract:e?.Name&&String(e?.Abstract),keywords:Qr(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&&sA(e?.EX_GeographicBoundingBox);n&&(t.geographicBoundingBox=n),n=e?.LatLonBoundingBox&&oA(e?.LatLonBoundingBox),n&&(t.geographicBoundingBox=n);let s=e?.BoundingBox&&iA(e?.BoundingBox);s&&s.length>0&&(t.boundingBoxes=s);let i=Ne(e?.Dimension).map(l=>cA(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(Eu(l));c.length>0&&(t.layers=c);for(let[l,u]of Object.entries(t))u===void 0&&delete t[l];return t}function sA(e){let{westBoundLongitude:t,northBoundLatitude:r,eastBoundLongitude:n,southBoundLatitude:s}=e;return[[t,s],[n,r]]}function oA(e){let{minx:t,miny:r,maxx:n,maxy:s}=e;return[[t,r],[n,s]]}function iA(e){return Ne(e).map(r=>aA(r))}function aA(e){let{CRS:t,SRS:r,minx:n,miny:s,maxx:o,maxy:i,resx:a,resy:c}=e,l={crs:t||r,boundingBox:[[Zr(n),Zr(s)],[Zr(o),Zr(i)]]};return a&&(l.xResolution=a),c&&(l.yResolution=c),l}function cA(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 Bu(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||[])Bu(r,e)}var lA="4.2.0-beta.2",fr={dataType:null,batchType:null,id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:lA,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:uA,options:{wms:{}},parse:async(e,t)=>Ei(new TextDecoder().decode(e),t?.wms),parseTextSync:(e,t)=>Ei(e,t?.wms)};function uA(e){return e.startsWith("<?xml")}function Bi(e,t){let n=(vt.parseTextSync?.(e,t)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(n)?n:[n]).map(o=>fA(o))}}function fA(e){return{attributes:e||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var Cu={...fr,dataType:null,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 vt.parseTextSync?.(e,t)}var Su={...fr,dataType:null,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(e,t)=>Ci(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Ci(e,t)};function bu(e,t){let{type:r="auto"}=e,n=r==="auto"?dA(e.url,t):hA(r,t);if(!n)throw new Error("Not a valid image source type");return n.create(e)}function hA(e,t){for(let r of t)if(r.type===e)return r;return null}function dA(e,t){for(let r of t)if(r.testURL&&r.testURL(e))return r;return null}var Mu="4.2.0-beta.2";var pA=globalThis.loaders?.parseImageNode,Si=typeof Image<"u",bi=typeof ImageBitmap<"u",mA=Boolean(pA),Mi=Jr?!0:mA;function Iu(e){switch(e){case"auto":return bi||Si||Mi;case"imagebitmap":return bi;case"image":return Si;case"data":return Mi;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function wu(){if(bi)return"imagebitmap";if(Si)return"image";if(Mi)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Fu(e){let t=gA(e);if(!t)throw new Error("Not an image");return t}function $r(e){switch(Fu(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 gA(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 AA=/^data:image\/svg\+xml/,xA=/\.svg((\?|#).*)?$/;function ss(e){return e&&(AA.test(e)||xA.test(e))}function Lu(e,t){if(ss(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(ss(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function os(e,t,r){let n=Lu(e,r),s=self.URL||self.webkitURL,o=typeof n!="string"&&s.createObjectURL(n);try{return await yA(o||n,t)}finally{o&&s.revokeObjectURL(o)}}async function yA(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 TA={},Ru=!0;async function Pu(e,t,r){let n;ss(r)?n=await os(e,t,r):n=Ii(e,r);let s=t&&t.imagebitmap;return await _A(n,s)}async function _A(e,t=null){if((EA(t)||!Ru)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),Ru=!1}return await createImageBitmap(e)}function EA(e){for(let t in e||TA)return!1;return!0}function Ou(e){return!bA(e,"ftyp",4)||!(e[8]&96)?null:BA(e)}function BA(e){switch(CA(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function CA(e,t,r){return String.fromCharCode(...e.slice(t,r))}function SA(e){return[...e].map(t=>t.charCodeAt(0))}function bA(e,t,r=0){let n=SA(t);for(let s=0;s<n.length;++s)if(n[s]!==e[s+r])return!1;return!0}var Wt=!1,tn=!0;function ve(e){let t=en(e);return IA(t)||LA(t)||wA(t)||FA(t)||MA(t)}function MA(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=Ou(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function IA(e){let t=en(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 wA(e){let t=en(e);return t.byteLength>=10&&t.getUint32(0,Wt)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,tn),height:t.getUint16(8,tn)}:null}function FA(e){let t=en(e);return t.byteLength>=14&&t.getUint16(0,Wt)===16973&&t.getUint32(2,tn)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,tn),height:t.getUint32(22,tn)}:null}function LA(e){let t=en(e);if(!(t.byteLength>=3&&t.getUint16(0,Wt)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:s}=RA(),o=2;for(;o+9<t.byteLength;){let i=t.getUint16(o,Wt);if(s.has(i))return{mimeType:"image/jpeg",height:t.getUint16(o+5,Wt),width:t.getUint16(o+7,Wt)};if(!n.has(i))return null;o+=2,o+=t.getUint16(o,Wt)}return null}function RA(){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 en(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 Nu(e,t){let{mimeType:r}=ve(e)||{},n=globalThis.loaders?.parseImageNode;return G(n),await n(e,r)}async function Du(e,t,r){t=t||{};let s=(t.image||{}).type||"auto",{url:o}=r||{},i=PA(s),a;switch(i){case"imagebitmap":a=await Pu(e,t,o);break;case"image":a=await os(e,t,o);break;case"data":a=await Nu(e,t);break;default:G(!1)}return s==="data"&&(a=$r(a)),a}function PA(e){switch(e){case"auto":case"data":return wu();default:return Iu(e),e}}var OA=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],NA=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],DA={image:{type:"auto",decode:!0}},Ae={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:Mu,mimeTypes:NA,extensions:OA,parse:Du,tests:[e=>Boolean(ve(new DataView(e)))],options:DA};var wi={};function Fi(e){if(wi[e]===void 0){let t=Jr?UA(e):vA(e);wi[e]=t}return wi[e]}function vA(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 UA(e){switch(e){case"image/avif":case"image/webp":return GA(e);default:return!0}}function GA(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var vu={type:"wms",testURL:e=>e.toLowerCase().includes("wms"),create:e=>new Li(e)},Li=class extends Mt{url;data;substituteCRS84;flipCRS;wmsParameters;vendorParameters;capabilities=null;constructor(t){super(t),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 fr.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 Ae.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 Cu.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 Su.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 Ae.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{boundingBox:n,bbox:s}=t;t.bbox=n?[...n[0],...n[1]]:s;let o={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",o,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;case"x":n.version==="1.3.0"&&(t="i");break;case"y":n.version==="1.3.0"&&(t="j");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||Kr.mimeTypes.includes(n)){let s=pi(this.loadOptions,{wms:{throwOnError:!0}}),o=Kr.parseSync?.(r,s);throw new Error(o)}}_parseError(t){let r=Kr.parseSync?.(t,this.loadOptions);return new Error(r)}};var hr=class extends Mt{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 Ae.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}};ar(hr,"type","template"),ar(hr,"testURL",t=>t.toLowerCase().includes("{"));var Ri=class extends hr{data;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")}},Uu={type:"arcgis-image-server",testURL:e=>e.toLowerCase().includes("ImageServer"),create:e=>new Ri(e)};var VA=[vu,Uu];function Pi(e){return bu(e,VA)}var HA=1/Math.PI*180,zA=1/180*Math.PI,kA={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...kA}};var Y=globalThis.mathgl.config;function Oi(e,{precision:t=Y.precision}={}){return e=JA(e),`${parseFloat(e.toPrecision(t))}`}function Bt(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ni(e){return Gu(e)}function Di(e){return Ct(e)}function Gu(e,t){return vi(e,r=>r*zA,t)}function Ct(e,t){return vi(e,r=>r*HA,t)}function is(e,t,r){return vi(e,n=>Math.max(t,Math.min(r,n)))}function xe(e,t,r){return Bt(e)?e.map((n,s)=>xe(n,t[s],r)):r*t+(1-r)*e}function mt(e,t,r){let n=Y.EPSILON;r&&(Y.EPSILON=r);try{if(e===t)return!0;if(Bt(e)&&Bt(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=n}}function JA(e){return Math.round(e/Y.EPSILON)*Y.EPSILON}function qA(e){return e.clone?e.clone():new Array(e.length)}function vi(e,t,r){if(Bt(e)){let n=e;r=r||qA(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)}var ye=class extends 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:Bt(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 r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+Oi(this[n],t);return`${t.printTypes?this.constructor.name:""}[${r}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!mt(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(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 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 jA(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 U(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function Te(e,t,r=""){if(Y.debug&&!jA(e,t))throw new Error(`math.gl: ${r} 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 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 U(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return U(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 at(t>=0&&t<this.ELEMENTS,"index is out of range"),U(this[t])}setComponent(t,r){return at(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 Z=typeof Float32Array<"u"?Float32Array:Array,rn=Math.random;function dr(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var V2=Math.PI/180;function XA(){let e=new Z(2);return Z!=Float32Array&&(e[0]=0,e[1]=0),e}function Vu(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 Hu(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 as(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 cs(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 H2=function(){let e=XA();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 ls(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 us(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 zu(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 ku(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 fs(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 _e{constructor(t=0,r=0){super(2),Bt(t)&&arguments.length===1?this.copy(t):(Y.debug&&(U(t),U(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 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 cs(this,this,t),this.check()}transformAsVector(t){return ls(this,this,t),this.check()}transformByMatrix3(t){return as(this,this,t),this.check()}transformByMatrix2x3(t){return Hu(this,this,t),this.check()}transformByMatrix2(t){return Vu(this,this,t),this.check()}};var He={};ut(He,{add:()=>QA,angle:()=>zi,bezier:()=>u1,ceil:()=>ZA,clone:()=>WA,copy:()=>YA,create:()=>hs,cross:()=>Ge,dist:()=>y1,distance:()=>Wu,div:()=>x1,divide:()=>Xu,dot:()=>nn,equals:()=>m1,exactEquals:()=>p1,floor:()=>$A,forEach:()=>E1,fromValues:()=>ds,hermite:()=>l1,inverse:()=>i1,len:()=>ki,length:()=>Ju,lerp:()=>a1,max:()=>e1,min:()=>t1,mul:()=>A1,multiply:()=>ju,negate:()=>o1,normalize:()=>Ui,random:()=>f1,rotateX:()=>Gi,rotateY:()=>Vi,rotateZ:()=>Hi,round:()=>r1,scale:()=>n1,scaleAndAdd:()=>s1,set:()=>KA,slerp:()=>c1,sqrDist:()=>T1,sqrLen:()=>_1,squaredDistance:()=>Yu,squaredLength:()=>Ku,str:()=>d1,sub:()=>g1,subtract:()=>qu,transformMat3:()=>sn,transformMat4:()=>Ve,transformQuat:()=>on,zero:()=>h1});function hs(){let e=new Z(3);return Z!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function WA(e){let t=new Z(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Ju(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function ds(e,t,r){let n=new Z(3);return n[0]=e,n[1]=t,n[2]=r,n}function YA(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function KA(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function QA(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function qu(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function ju(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function Xu(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function ZA(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function $A(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function t1(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 e1(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 r1(e,t){return e[0]=dr(t[0]),e[1]=dr(t[1]),e[2]=dr(t[2]),e}function n1(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function s1(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 Wu(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 Yu(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 Ku(e){let t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function o1(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function i1(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 nn(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 a1(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 c1(e,t,r,n){let s=Math.acos(Math.min(Math.max(nn(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 l1(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),u=i*(3-2*o);return e[0]=t[0]*a+r[0]*c+n[0]*l+s[0]*u,e[1]=t[1]*a+r[1]*c+n[1]*l+s[1]*u,e[2]=t[2]*a+r[2]*c+n[2]*l+s[2]*u,e}function u1(e,t,r,n,s,o){let i=1-o,a=i*i,c=o*o,l=a*i,u=3*o*a,f=3*c*i,h=c*o;return e[0]=t[0]*l+r[0]*u+n[0]*f+s[0]*h,e[1]=t[1]*l+r[1]*u+n[1]*f+s[1]*h,e[2]=t[2]*l+r[2]*u+n[2]*f+s[2]*h,e}function f1(e,t){t=t===void 0?1:t;let r=rn()*2*Math.PI,n=rn()*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 sn(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 on(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],u=s*l-o*c,f=o*a-n*l,h=n*c-s*a,d=s*h-o*f,p=o*u-n*h,A=n*f-s*u,g=i*2;return u*=g,f*=g,h*=g,d*=2,p*=2,A*=2,e[0]=a+u+d,e[1]=c+f+p,e[2]=l+h+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&&nn(e,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}function h1(e){return e[0]=0,e[1]=0,e[2]=0,e}function d1(e){return`vec3(${e[0]}, ${e[1]}, ${e[2]})`}function p1(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function m1(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 g1=qu,A1=ju,x1=Xu,y1=Wu,T1=Yu,ki=Ju,_1=Ku,E1=function(){let e=hs();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],ps,x=class extends _e{static get ZERO(){return ps||(ps=new x(0,0,0),Object.freeze(ps)),ps}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&Bt(t)?this.copy(t):(Y.debug&&(U(t),U(r),U(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 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 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 us(this,this,t),this.check()}transformByMatrix3(t){return sn(this,this,t),this.check()}transformByMatrix2(t){return zu(this,this,t),this.check()}transformByQuaternion(t){return on(this,this,t),this.check()}};var ms,mr=class extends _e{static get ZERO(){return ms||(ms=new mr(0,0,0,0),Object.freeze(ms)),ms}constructor(t=0,r=0,n=0,s=0){super(-0,-0,-0,-0),Bt(t)&&arguments.length===1?this.copy(t):(Y.debug&&(U(t),U(r),U(n),U(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 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 Ve(this,this,t),this.check()}transformByMatrix3(t){return fs(this,this,t),this.check()}transformByMatrix2(t){return ku(this,this,t),this.check()}transformByQuaternion(t){return on(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var gr=class extends ye{toString(){let t="[";if(Y.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)t+=` ${this[n*this.RANK+r]}`}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=` ${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]=U(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 Qu(){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 Zu(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 $u(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],u=t[8],f=u*i-a*l,h=-u*o+a*c,d=l*o-i*c,p=r*f+n*h+s*d;return p?(p=1/p,e[0]=f*p,e[1]=(-u*n+s*l)*p,e[2]=(a*n-s*i)*p,e[3]=h*p,e[4]=(u*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 tf(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],u=t[7],f=t[8],h=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]=h*n+d*i+p*l,e[1]=h*s+d*a+p*u,e[2]=h*o+d*c+p*f,e[3]=A*n+g*i+y*l,e[4]=A*s+g*a+y*u,e[5]=A*o+g*c+y*f,e[6]=E*n+_*i+B*l,e[7]=E*s+_*a+B*u,e[8]=E*o+_*c+B*f,e}function ef(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],u=t[7],f=t[8],h=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]=h*n+d*i+l,e[7]=h*s+d*a+u,e[8]=h*o+d*c+f,e}function rf(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],u=t[7],f=t[8],h=Math.sin(r),d=Math.cos(r);return e[0]=d*n+h*i,e[1]=d*s+h*a,e[2]=d*o+h*c,e[3]=d*i-h*n,e[4]=d*a-h*s,e[5]=d*c-h*o,e[6]=l,e[7]=u,e[8]=f,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 nf(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,u=n*i,f=n*a,h=s*i,d=s*a,p=s*c,A=o*i,g=o*a,y=o*c;return e[0]=1-f-p,e[3]=u-y,e[6]=h+g,e[1]=u+y,e[4]=1-l-p,e[7]=d-A,e[2]=h-g,e[5]=d+A,e[8]=1-l-f,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 C1=Object.freeze([1,0,0,0,1,0,0,0,1]),z=class extends gr{static get IDENTITY(){return b1()}static get ZERO(){return S1()}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(C1)}fromObject(t){return this.check()}fromQuaternion(t){return nf(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 tf(this)}transpose(){return Zu(this,this),this.check()}invert(){return $u(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 rf(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 ef(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=as(r||[-0,-0],t,this);break;case 3:n=sn(r||[-0,-0,-0],t,this);break;case 4:n=fs(r||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Te(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)}},gs,As=null;function S1(){return gs||(gs=new z([0,0,0,0,0,0,0,0,0]),Object.freeze(gs)),gs}function b1(){return As||(As=new z,Object.freeze(As)),As}var cn={};ut(cn,{add:()=>Q1,adjoint:()=>R1,clone:()=>I1,copy:()=>w1,create:()=>M1,decompose:()=>z1,determinant:()=>Ki,equals:()=>ex,exactEquals:()=>tx,frob:()=>K1,fromQuat:()=>na,fromQuat2:()=>G1,fromRotation:()=>N1,fromRotationTranslation:()=>of,fromRotationTranslationScale:()=>k1,fromRotationTranslationScaleOrigin:()=>J1,fromScaling:()=>O1,fromTranslation:()=>P1,fromValues:()=>F1,fromXRotation:()=>D1,fromYRotation:()=>v1,fromZRotation:()=>U1,frustum:()=>sa,getRotation:()=>H1,getScaling:()=>af,getTranslation:()=>V1,identity:()=>sf,invert:()=>Yi,lookAt:()=>aa,mul:()=>rx,multiply:()=>an,multiplyScalar:()=>Z1,multiplyScalarAndAdd:()=>$1,ortho:()=>ia,orthoNO:()=>lf,orthoZO:()=>X1,perspective:()=>oa,perspectiveFromFieldOfView:()=>j1,perspectiveNO:()=>cf,perspectiveZO:()=>q1,rotate:()=>$i,rotateX:()=>ta,rotateY:()=>ea,rotateZ:()=>ra,scale:()=>Zi,set:()=>L1,str:()=>Y1,sub:()=>nx,subtract:()=>uf,targetTo:()=>W1,translate:()=>Qi,transpose:()=>Wi});function M1(){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 I1(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 w1(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 F1(e,t,r,n,s,o,i,a,c,l,u,f,h,d,p,A){let g=new Z(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]=u,g[11]=f,g[12]=h,g[13]=d,g[14]=p,g[15]=A,g}function L1(e,t,r,n,s,o,i,a,c,l,u,f,h,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]=u,e[10]=f,e[11]=h,e[12]=d,e[13]=p,e[14]=A,e[15]=g,e}function sf(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],u=t[8],f=t[9],h=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,b=n*l-o*a,w=s*l-o*c,C=u*A-f*p,T=u*g-h*p,m=u*y-d*p,M=f*g-h*A,L=f*y-d*A,R=h*y-d*g,F=E*R-_*L+B*M+S*m-b*T+w*C;return F?(F=1/F,e[0]=(a*R-c*L+l*M)*F,e[1]=(s*L-n*R-o*M)*F,e[2]=(A*w-g*b+y*S)*F,e[3]=(h*b-f*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]=(u*w-h*B+d*_)*F,e[8]=(i*L-a*m+l*C)*F,e[9]=(n*m-r*L-o*C)*F,e[10]=(p*b-A*B+y*E)*F,e[11]=(f*B-u*b-d*E)*F,e[12]=(a*T-i*M-c*C)*F,e[13]=(r*M-n*T+s*C)*F,e[14]=(A*_-p*S-g*E)*F,e[15]=(u*S-f*_+h*E)*F,e):null}function R1(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],u=t[8],f=t[9],h=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,b=n*l-o*a,w=s*l-o*c,C=u*A-f*p,T=u*g-h*p,m=u*y-d*p,M=f*g-h*A,L=f*y-d*A,R=h*y-d*g;return e[0]=a*R-c*L+l*M,e[1]=s*L-n*R-o*M,e[2]=A*w-g*b+y*S,e[3]=h*b-f*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]=u*w-h*B+d*_,e[8]=i*L-a*m+l*C,e[9]=n*m-r*L-o*C,e[10]=p*b-A*B+y*E,e[11]=f*B-u*b-d*E,e[12]=a*T-i*M-c*C,e[13]=r*M-n*T+s*C,e[14]=A*_-p*S-g*E,e[15]=u*S-f*_+h*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],u=e[9],f=e[10],h=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-u*d,S=l*A-f*d,b=u*A-f*p,w=t*b-r*S+n*B,C=o*b-i*S+a*B,T=l*_-u*E+f*y,m=d*_-p*E+A*y;return c*w-s*C+g*T-h*m}function an(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],u=t[7],f=t[8],h=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],b=r[3];return e[0]=_*n+B*a+S*f+b*A,e[1]=_*s+B*c+S*h+b*g,e[2]=_*o+B*l+S*d+b*y,e[3]=_*i+B*u+S*p+b*E,_=r[4],B=r[5],S=r[6],b=r[7],e[4]=_*n+B*a+S*f+b*A,e[5]=_*s+B*c+S*h+b*g,e[6]=_*o+B*l+S*d+b*y,e[7]=_*i+B*u+S*p+b*E,_=r[8],B=r[9],S=r[10],b=r[11],e[8]=_*n+B*a+S*f+b*A,e[9]=_*s+B*c+S*h+b*g,e[10]=_*o+B*l+S*d+b*y,e[11]=_*i+B*u+S*p+b*E,_=r[12],B=r[13],S=r[14],b=r[15],e[12]=_*n+B*a+S*f+b*A,e[13]=_*s+B*c+S*h+b*g,e[14]=_*o+B*l+S*d+b*y,e[15]=_*i+B*u+S*p+b*E,e}function Qi(e,t,r){let n=r[0],s=r[1],o=r[2],i,a,c,l,u,f,h,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],u=t[4],f=t[5],h=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]=u,e[5]=f,e[6]=h,e[7]=d,e[8]=p,e[9]=A,e[10]=g,e[11]=y,e[12]=i*n+u*s+p*o+t[12],e[13]=a*n+f*s+A*o+t[13],e[14]=c*n+h*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,u,f,h,d,p,A,g,y,E,_,B,S,b,w,C,T,m,M,L,R,F,D;return a<1e-6?null:(a=1/a,s*=a,o*=a,i*=a,l=Math.sin(r),c=Math.cos(r),u=1-c,f=t[0],h=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=o*s*u+i*l,T=i*s*u-o*l,m=s*o*u-i*l,M=o*o*u+c,L=i*o*u+s*l,R=s*i*u+o*l,F=o*i*u-s*l,D=i*i*u+c,e[0]=f*w+A*C+_*T,e[1]=h*w+g*C+B*T,e[2]=d*w+y*C+S*T,e[3]=p*w+E*C+b*T,e[4]=f*m+A*M+_*L,e[5]=h*m+g*M+B*L,e[6]=d*m+y*M+S*L,e[7]=p*m+E*M+b*L,e[8]=f*R+A*F+_*D,e[9]=h*R+g*F+B*D,e[10]=d*R+y*F+S*D,e[11]=p*R+E*F+b*D,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],u=t[9],f=t[10],h=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+u*n,e[6]=a*s+f*n,e[7]=c*s+h*n,e[8]=l*s-o*n,e[9]=u*s-i*n,e[10]=f*s-a*n,e[11]=h*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],u=t[9],f=t[10],h=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-u*n,e[2]=a*s-f*n,e[3]=c*s-h*n,e[8]=o*n+l*s,e[9]=i*n+u*s,e[10]=a*n+f*s,e[11]=c*n+h*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],u=t[5],f=t[6],h=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+u*n,e[2]=a*s+f*n,e[3]=c*s+h*n,e[4]=l*s-o*n,e[5]=u*s-i*n,e[6]=f*s-a*n,e[7]=h*s-c*n,e}function P1(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 O1(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 N1(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 D1(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 v1(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 U1(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 of(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,u=n*a,f=n*c,h=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]=f+E,e[2]=h-y,e[3]=0,e[4]=f-E,e[5]=1-(u+A),e[6]=p+g,e[7]=0,e[8]=h+y,e[9]=p-g,e[10]=1-(u+d),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function G1(e,t){let r=new Z(3),n=-t[0],s=-t[1],o=-t[2],i=t[3],a=t[4],c=t[5],l=t[6],u=t[7],f=n*n+s*s+o*o+i*i;return f>0?(r[0]=(a*i+u*n+c*o-l*s)*2/f,r[1]=(c*i+u*s+l*n-a*o)*2/f,r[2]=(l*i+u*o+a*s-c*n)*2/f):(r[0]=(a*i+u*n+c*o-l*s)*2,r[1]=(c*i+u*s+l*n-a*o)*2,r[2]=(l*i+u*o+a*s-c*n)*2),of(e,t,r),e}function V1(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function af(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],u=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+u*u),e}function H1(e,t){let r=new Z(3);af(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,u=t[5]*s,f=t[6]*o,h=t[8]*n,d=t[9]*s,p=t[10]*o,A=i+u+p,g=0;return A>0?(g=Math.sqrt(A+1)*2,e[3]=.25*g,e[0]=(f-d)/g,e[1]=(h-c)/g,e[2]=(a-l)/g):i>u&&i>p?(g=Math.sqrt(1+i-u-p)*2,e[3]=(f-d)/g,e[0]=.25*g,e[1]=(a+l)/g,e[2]=(h+c)/g):u>p?(g=Math.sqrt(1+u-i-p)*2,e[3]=(h-c)/g,e[0]=(a+l)/g,e[1]=.25*g,e[2]=(f+d)/g):(g=Math.sqrt(1+p-i-u)*2,e[3]=(a-l)/g,e[0]=(h+c)/g,e[1]=(f+d)/g,e[2]=.25*g),e}function z1(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],u=n[8],f=n[9],h=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(u*u+f*f+h*h);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,b=u*d,w=f*p,C=h*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 k1(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=t[3],c=s+s,l=o+o,u=i+i,f=s*c,h=s*l,d=s*u,p=o*l,A=o*u,g=i*u,y=a*c,E=a*l,_=a*u,B=n[0],S=n[1],b=n[2];return e[0]=(1-(p+g))*B,e[1]=(h+_)*B,e[2]=(d-E)*B,e[3]=0,e[4]=(h-_)*S,e[5]=(1-(f+g))*S,e[6]=(A+y)*S,e[7]=0,e[8]=(d+E)*b,e[9]=(A-y)*b,e[10]=(1-(f+p))*b,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function J1(e,t,r,n,s){let o=t[0],i=t[1],a=t[2],c=t[3],l=o+o,u=i+i,f=a+a,h=o*l,d=o*u,p=o*f,A=i*u,g=i*f,y=a*f,E=c*l,_=c*u,B=c*f,S=n[0],b=n[1],w=n[2],C=s[0],T=s[1],m=s[2],M=(1-(A+y))*S,L=(d+B)*S,R=(p-_)*S,F=(d-B)*b,D=(1-(h+y))*b,X=(g+E)*b,H=(p+_)*w,Q=(g-E)*w,j=(1-(h+A))*w;return e[0]=M,e[1]=L,e[2]=R,e[3]=0,e[4]=F,e[5]=D,e[6]=X,e[7]=0,e[8]=H,e[9]=Q,e[10]=j,e[11]=0,e[12]=r[0]+C-(M*C+F*T+H*m),e[13]=r[1]+T-(L*C+D*T+Q*m),e[14]=r[2]+m-(R*C+X*T+j*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,u=n*i,f=n*a,h=s*i,d=s*a,p=s*c,A=o*i,g=o*a,y=o*c;return e[0]=1-f-p,e[1]=u+y,e[2]=h-g,e[3]=0,e[4]=u-y,e[5]=1-l-p,e[6]=d+A,e[7]=0,e[8]=h+g,e[9]=d-A,e[10]=1-l-f,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 cf(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=cf;function q1(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 j1(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 lf(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=lf;function X1(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,u,f,h,d,p=t[0],A=t[1],g=t[2],y=n[0],E=n[1],_=n[2],B=r[0],S=r[1],b=r[2];return Math.abs(p-B)<1e-6&&Math.abs(A-S)<1e-6&&Math.abs(g-b)<1e-6?sf(e):(f=p-B,h=A-S,d=g-b,s=1/Math.sqrt(f*f+h*h+d*d),f*=s,h*=s,d*=s,o=E*d-_*h,i=_*f-y*d,a=y*h-E*f,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=h*a-d*i,l=d*o-f*a,u=f*i-h*o,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]=o,e[1]=c,e[2]=f,e[3]=0,e[4]=i,e[5]=l,e[6]=h,e[7]=0,e[8]=a,e[9]=u,e[10]=d,e[11]=0,e[12]=-(o*p+i*A+a*g),e[13]=-(c*p+l*A+u*g),e[14]=-(f*p+h*A+d*g),e[15]=1,e)}function W1(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=n[0],c=n[1],l=n[2],u=s-r[0],f=o-r[1],h=i-r[2],d=u*u+f*f+h*h;d>0&&(d=1/Math.sqrt(d),u*=d,f*=d,h*=d);let p=c*h-l*f,A=l*u-a*h,g=a*f-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]=f*g-h*A,e[5]=h*p-u*g,e[6]=u*A-f*p,e[7]=0,e[8]=u,e[9]=f,e[10]=h,e[11]=0,e[12]=s,e[13]=o,e[14]=i,e[15]=1,e}function Y1(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 K1(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 Q1(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 uf(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 Z1(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 $1(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 tx(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 ex(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],u=e[8],f=e[9],h=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],L=t[10],R=t[11],F=t[12],D=t[13],X=t[14],H=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-b)<=1e-6*Math.max(1,Math.abs(i),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(f-M)<=1e-6*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(h-L)<=1e-6*Math.max(1,Math.abs(h),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-D)<=1e-6*Math.max(1,Math.abs(A),Math.abs(D))&&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 rx=an,nx=uf;function sx(){let e=new Z(4);return Z!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function ff(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 hf(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 df(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 pf(e){let t=e[0],r=e[1],n=e[2],s=e[3];return t*t+r*r+n*n+s*s}function mf(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 gf(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Af(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 xf(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 yf(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],u=l*n+a*o-c*s,f=l*s+c*n-i*o,h=l*o+i*s-a*n,d=-i*n-a*s-c*o;return e[0]=u*l+d*-i+f*-c-h*-a,e[1]=f*l+d*-a+h*-i-u*-c,e[2]=h*l+d*-c+u*-a-f*-i,e[3]=t[3],e}var yw=function(){let e=sx();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 ua;(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"})(ua||(ua={}));var ix=45*Math.PI/180,ax=1,ca=.1,la=500,cx=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),P=class extends gr{static get IDENTITY(){return ux()}static get ZERO(){return lx()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return ua}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,u,f,h,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]=u,this[10]=f,this[11]=h,this[12]=d,this[13]=p,this[14]=A,this[15]=g,this.check()}setRowMajor(t,r,n,s,o,i,a,c,l,u,f,h,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]=u,this[7]=p,this[8]=n,this[9]=a,this[10]=f,this[11]=A,this[12]=s,this[13]=c,this[14]=h,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(cx)}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?fx(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=ix,aspect:n=ax,focalDistance:s=1,near:o=ca,far:i=la}=t;Tf(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 Tf(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 an(this,t,this),this.check()}multiplyRight(t){return an(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=xf(r||[-0,-0,-0,-0],t,this),Te(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,s;switch(n){case 2:s=cs(r||[-0,-0],t,this);break;case 3:s=Ve(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Te(s,t.length),s}transformAsVector(t,r){let n;switch(t.length){case 2:n=ls(r||[-0,-0],t,this);break;case 3:n=us(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Te(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])}},xs,ys;function lx(){return xs||(xs=new P([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(xs)),xs}function ux(){return ys||(ys=new P,Object.freeze(ys)),ys}function Tf(e){if(e>Math.PI*2)throw Error("expected radians")}function fx(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),u=-1,f=-1,h=-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]=u,e[11]=f,e[12]=0,e[13]=0,e[14]=h,e[15]=0,e}function _f(){let e=new Z(4);return Z!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Ef(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function fa(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 ha(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],u=r[3];return e[0]=n*u+i*a+s*l-o*c,e[1]=s*u+i*c+o*a-n*l,e[2]=o*u+i*l+n*c-s*a,e[3]=i*u-n*a-s*c-o*l,e}function Bf(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 Cf(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 Sf(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 bf(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 ln(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=t[3],c=r[0],l=r[1],u=r[2],f=r[3],h,d,p,A,g;return h=s*c+o*l+i*u+a*f,h<0&&(h=-h,c=-c,l=-l,u=-u,f=-f),1-h>1e-6?(d=Math.acos(h),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*u,e[3]=p*a+A*f,e}function Mf(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 If(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 wf=ff;var Ff=hf,Lf=gf,Rf=Af,Pf=df;var Of=pf;var Nf=mf;var Df=function(){let e=hs(),t=ds(1,0,0),r=ds(0,1,0);return function(n,s,o){let i=nn(s,o);return i<-.999999?(Ge(e,t,s),ki(e)<1e-6&&Ge(e,r,s),Ui(e,e),fa(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,Nf(n,n))}}(),Pw=function(){let e=_f(),t=_f();return function(r,n,s,o,i,a){return ln(e,n,i,a),ln(t,s,o,a),ln(r,e,t,2*a*(1-a)),r}}(),Ow=function(){let e=Qu();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],Nf(t,da(t,e))}}();var hx=[0,0,0,1],Yt=class extends ye{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 fa(this,t,r),this.check()}identity(){return Ef(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]=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 Pf(this)}lengthSquared(){return Of(this)}dot(t){return Lf(this,t)}rotationTo(t,r){return Df(this,t,r),this.check()}add(t){return wf(this,this,t),this.check()}calculateW(){return bf(this,this),this.check()}conjugate(){return If(this,this),this.check()}invert(){return Mf(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(Rf(this,t,r,n),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(),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 Bf(this,this,t),this.check()}rotateY(t){return Cf(this,this,t),this.check()}rotateZ(t){return Sf(this,this,t),this.check()}scale(t){return Ff(this,this,t),this.check()}slerp(t,r,n){let s,o,i;switch(arguments.length){case 1:({start:s=hx,target:o,ratio:i}=t);break;case 2:s=this,o=t,i=r;break;default:s=t,o=r,i=n}return ln(this,s,o,i),this.check()}transformVector4(t,r=new mr){return yf(r,t,this),Te(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 It={};ut(It,{EPSILON1:()=>dx,EPSILON10:()=>Ex,EPSILON11:()=>Bx,EPSILON12:()=>Cx,EPSILON13:()=>Sx,EPSILON14:()=>bx,EPSILON15:()=>Mx,EPSILON16:()=>Ix,EPSILON17:()=>wx,EPSILON18:()=>Fx,EPSILON19:()=>Lx,EPSILON2:()=>px,EPSILON20:()=>Rx,EPSILON3:()=>mx,EPSILON4:()=>gx,EPSILON5:()=>Ax,EPSILON6:()=>xx,EPSILON7:()=>yx,EPSILON8:()=>Tx,EPSILON9:()=>_x,PI_OVER_FOUR:()=>Ox,PI_OVER_SIX:()=>Nx,PI_OVER_TWO:()=>Px,TWO_PI:()=>Dx});var dx=.1,px=.01,mx=.001,gx=1e-4,Ax=1e-5,xx=1e-6,yx=1e-7,Tx=1e-8,_x=1e-9,Ex=1e-10,Bx=1e-11,Cx=1e-12,Sx=1e-13,bx=1e-14,Mx=1e-15,Ix=1e-16,wx=1e-17,Fx=1e-18,Lx=1e-19,Rx=1e-20,Px=Math.PI/2,Ox=Math.PI/4,Nx=Math.PI/6,Dx=Math.PI*2;function Ts(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var Ut=Math.PI,Vf=Ut/4,vf=Ut/180,Uf=180/Ut,_s=512;function re(e){let[t,r]=e;Ts(Number.isFinite(t)),Ts(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let n=t*vf,s=r*vf,o=_s*(n+Ut)/(2*Ut),i=_s*(Ut+Math.log(Math.tan(Vf+s*.5)))/(2*Ut);return[o,i]}function ne(e){let[t,r]=e,n=t/_s*(2*Ut)-Ut,s=2*(Math.atan(Math.exp(r/_s*(2*Ut)-Ut))-Vf);return[n*Uf,s*Uf]}var AF=Math.PI/180;var zf=6378137*Math.PI;function pa(e){let t=re(e);return t[0]=(t[0]/256-1)*zf,t[1]=(t[1]/256-1)*zf,t}var Zx={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 ze.CompositeLayer{get isLoaded(){return this.state?.loadCounter===0&&super.isLoaded}shouldUpdateState(){return!0}initializeState(){this.state._nextRequestId=0,this.state.lastRequestId=-1,this.state.loadCounter=0}updateState({changeFlags: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,ze._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 kf.BitmapLayer({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:n.srs==="EPSG:4326"?ze.COORDINATE_SYSTEM.LNGLAT:ze.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 Mt)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 u={width:i,height:a,boundingBox:[[o[0],o[1]],[o[2],o[3]]],layers:n,crs:l};if(l==="EPSG:3857"){let f=pa([o[0],o[1]]),h=pa([o[2],o[3]]);u.boundingBox=[f,h]}try{this.state.loadCounter++,this.props.onImageLoadStart(c);let f=await this.state.imageSource.getImage(u);this.state.lastRequestId<c&&(this.getCurrentLayer()?.props.onImageLoad(c),this.setState({image:f,bounds:o,lastRequestParameters:u,lastRequestId:c}))}catch(f){this.raiseError(f,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(c,f)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(t,r=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>t(),r)}},Es=Bs;(()=>{Bs.layerName="WMSLayer"})(),(()=>{Bs.defaultProps=Zx})();var Jf=N(Nt(),1),$x={getHeight:{type:"accessor",value:0},greatCircle:!0},Cs=class extends Jf.ArcLayer{},un=Cs;(()=>{Cs.layerName="GreatCircleLayer"})(),(()=>{Cs.defaultProps=$x})();var qf=N(Dt(),1),ma=N(Nt(),1),ty={...ma.PolygonLayer.defaultProps},Ss=class extends qf.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:u,lineMiterLimit:f,lineDashJustified:h,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,...b}=this.indexToBounds()||{};return new B({filled:s,wireframe:n,extruded:r,elevationScale:t,stroked:o,lineWidthUnits:i,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:u,lineMiterLimit:f,lineDashJustified:h,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)}},St=Ss;(()=>{Ss.layerName="GeoCellLayer"})(),(()=>{Ss.defaultProps=ty})();var bs=N(ga(),1),ey=3,ry=30,ny=2*ry+1,Xf=180/Math.PI;function Yf(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function Wf(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Kf(e){return[Wf(e[0]),Wf(e[1])]}function Qf(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 Zf([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*Xf,n*Xf]}function $f(e){let t=bs.default.fromString(e,!0,10).toString(2);for(;t.length<ey+ny;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),s=t.substring(3,r),o=s.length/2,i=bs.default.fromString(n,!0,2).toString(10),a=bs.default.fromString(s,!0,2).toString(4);for(;a.length<o;)a="0"+a;return`${i}/${a}`}function sy(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 th(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,u=0;c==="1"?u=1:c==="2"?(l=1,u=1):c==="3"&&(l=1);let f=Math.pow(2,i-1);sy(f,o,l,u),o[0]+=f*l,o[1]+=f*u}if(r%2===1){let a=o[0];o[0]=o[1],o[1]=a}return{face:r,ij:o,level:i}}var eh=N(ga(),1);function oy(e){let t=e.padEnd(16,"0");return eh.default.fromString(t,16)}var iy=100;function ay({face:e,ij:t,level:r}){let n=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(iy*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),u=n[c+1],f=(u[0]-l[0])/s,h=(u[1]-l[1])/s;for(let d=0;d<s;d++){l[0]+=f,l[1]+=h;let p=Yf(t,r,l),A=Kf(p),g=Qf(e,A),y=Zf(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 cy(e){if(typeof e=="string"){if(e.indexOf("/")>0)return e;e=oy(e)}return $f(e.toString())}function rh(e){let t=cy(e),r=th(t);return ay(r)}var ly={getS2Token:{type:"accessor",value:e=>e.token}},Ms=class extends St{indexToBounds(){let{data:t,getS2Token:r}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(n,s)=>rh(r(n,s))}}},hn=Ms;(()=>{Ms.layerName="S2Layer"})(),(()=>{Ms.defaultProps=ly})();var Aa=512;function uy(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 nh(e,t=1){let[r,n]=uy(e,t),[s,o]=ne(r),[i,a]=ne(n);return[i,o,i,a,s,a,s,o,i,o]}var fy={getQuadkey:{type:"accessor",value:e=>e.quadkey}},Is=class extends St{indexToBounds(){let{data:t,extruded:r,getQuadkey:n}=this.props,s=r?.99:1;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(o,i)=>nh(n(o,i),s),updateTriggers:{getPolygon:s}}}},dn=Is;(()=>{Is.layerName="QuadkeyLayer"})(),(()=>{Is.defaultProps=fy})();var Ds=N(Dt(),1),_h=N(Nt(),1);var ke=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,u=this._loaderId;this._abortController=new AbortController;let{signal:f}=this._abortController,h=await r.scheduleRequest(this,A=>A.isSelected?1:-1);if(!h){this._isCancelled=!0;return}if(this._isCancelled){h.done();return}let d=null,p;try{d=await t({index:o,id:i,bbox:a,userData:c,zoom:l,signal:f})}catch(A){p=A||!0}finally{h.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):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 gn=N(Dt(),1);var rt={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var sh=new x,hy=new x,Ee=class{constructor(t=[0,0,0],r=[0,0,0],n){n=n||sh.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 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:r}=this,n=hy.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?rt.INSIDE:o+s<0?rt.OUTSIDE:rt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=sh.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 pn=new x,oh=new x,wt=class{constructor(t=[0,0,0],r=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=pn.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 wt(this.center,this.radius)}union(t){let r=this.center,n=this.radius,s=t.center,o=t.radius,i=pn.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 oh.copy(i).scale((-n+c)/a).add(r),this.center.copy(oh),this.radius=c,this}expand(t){let n=pn.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=cn.getScaling(pn,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=pn.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?rt.OUTSIDE:o<n?rt.INTERSECTING:rt.INSIDE}};var dy=new x,py=new x,ws=new x,Fs=new x,Ls=new x,my=new x,gy=new x,se={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],r=[0,0,0,0,0,0,0,0,0]){this.center=new x().from(t),this.halfAxes=new z(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 Yt().fromMatrix3(new z([...s,...o,...i]))}fromCenterHalfSizeQuaternion(t,r,n){let s=new Yt(n),o=new z().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 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 wt){let r=this.halfAxes,n=r.getColumn(0,ws),s=r.getColumn(1,Fs),o=r.getColumn(2,Ls),i=dy.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[se.COLUMN0ROW0]+i*s[se.COLUMN0ROW1]+a*s[se.COLUMN0ROW2])+Math.abs(o*s[se.COLUMN1ROW0]+i*s[se.COLUMN1ROW1]+a*s[se.COLUMN1ROW2])+Math.abs(o*s[se.COLUMN2ROW0]+i*s[se.COLUMN2ROW1]+a*s[se.COLUMN2ROW2]),l=n.dot(r)+t.distance;return l<=-c?rt.OUTSIDE:l>=c?rt.INSIDE:rt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=py.from(t).subtract(this.center),n=this.halfAxes,s=n.getColumn(0,ws),o=n.getColumn(1,Fs),i=n.getColumn(2,Ls),a=s.magnitude(),c=o.magnitude(),l=i.magnitude();s.normalize(),o.normalize(),i.normalize();let u=0,f;return f=Math.abs(r.dot(s))-a,f>0&&(u+=f*f),f=Math.abs(r.dot(o))-c,f>0&&(u+=f*f),f=Math.abs(r.dot(i))-l,f>0&&(u+=f*f),u}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,ws),l=a.getColumn(1,Fs),u=a.getColumn(2,Ls),f=my.copy(c).add(l).add(u).add(i),h=gy.copy(f).subtract(t),d=r.dot(h);return s=Math.min(d,s),o=Math.max(d,o),f.copy(i).add(c).add(l).subtract(u),h.copy(f).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),f.copy(i).add(c).subtract(l).add(u),h.copy(f).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),f.copy(i).add(c).subtract(l).subtract(u),h.copy(f).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(f).subtract(c).add(l).add(u),h.copy(f).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(f).subtract(c).add(l).subtract(u),h.copy(f).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(f).subtract(c).subtract(l).add(u),h.copy(f).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(f).subtract(c).subtract(l).subtract(u),h.copy(f).subtract(t),d=r.dot(h),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,ws);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,Fs);n.transformAsPoint(t);let s=this.halfAxes.getColumn(2,Ls);return s.transformAsPoint(t),this.halfAxes=new z([...r,...n,...s]),this}getTransform(){throw new Error("not implemented")}};var ih=new x,ah=new x,ct=class{constructor(t=[0,0,1],r=0){this.normal=new x,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return at(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=ih.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),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 r=ah.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=ih.from(t),s=this.getPointDistance(n),o=ah.copy(this.normal).scale(s);return n.subtract(o).to(r)}};var ch=[new x([1,0,0]),new x([0,1,0]),new x([0,0,1])],lh=new x,Ay=new x,ot=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*ch.length;let r=t.center,n=t.radius,s=0;for(let o of ch){let i=this.planes[s],a=this.planes[s+1];i||(i=this.planes[s]=new ct),a||(a=this.planes[s+1]=new ct);let c=lh.copy(o).scale(-n).add(r);i.fromPointNormal(c,o);let l=lh.copy(o).scale(n).add(r),u=Ay.copy(o).negate();a.fromPointNormal(l,u),s+=2}return this}computeVisibility(t){let r=rt.INSIDE;for(let n of this.planes)switch(t.intersectPlane(n)){case rt.OUTSIDE:return rt.OUTSIDE;case rt.INTERSECTING:r=rt.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(at(Number.isFinite(r),"parentPlaneMask is required."),r===ot.MASK_OUTSIDE||r===ot.MASK_INSIDE)return r;let n=ot.MASK_INSIDE,s=this.planes;for(let 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===rt.OUTSIDE)return ot.MASK_OUTSIDE;c===rt.INTERSECTING&&(n|=i)}return n}};ot.MASK_OUTSIDE=4294967295;ot.MASK_INSIDE=0;ot.MASK_INDETERMINATE=2147483647;var OL=new x,NL=new x,DL=new x,vL=new x,UL=new x;var qL=new x,jL=new x,XL=new x,WL=new x,YL=new x,KL=new x,QL=new x,ZL=new x,$L=new x,tR=new x,eR=new x,rR=new x;var Kt=new z,yy=new z,Ty=new z,Rs=new z,uh=new z;function Ta(e,t={}){let r=It.EPSILON20,n=10,s=0,o=0,i=yy,a=Ty;i.identity(),a.copy(e);let c=r*_y(a);for(;o<n&&Ey(a)>c;)By(a,Rs),uh.copy(Rs).transpose(),a.multiplyRight(Rs),a.multiplyLeft(uh),i.multiplyRight(Rs),++s>2&&(++o,s=0);return t.unitary=i.toTarget(t.unitary),t.diagonal=a.toTarget(t.diagonal),t}function _y(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 Ey(e){let t=0;for(let r=0;r<3;++r){let n=e[Kt.getElementIndex(ya[r],xa[r])];t+=2*n*n}return Math.sqrt(t)}function By(e,t){let r=It.EPSILON15,n=0,s=1;for(let l=0;l<3;++l){let u=Math.abs(e[Kt.getElementIndex(ya[l],xa[l])]);u>n&&(s=l,n=u)}let o=xa[s],i=ya[s],a=1,c=0;if(Math.abs(e[Kt.getElementIndex(i,o)])>r){let l=e[Kt.getElementIndex(i,i)],u=e[Kt.getElementIndex(o,o)],f=e[Kt.getElementIndex(i,o)],h=(l-u)/2/f,d;h<0?d=-1/(-h+Math.sqrt(1+h*h)):d=1/(h+Math.sqrt(1+h*h)),a=1/Math.sqrt(1+d*d),c=d*a}return z.IDENTITY.to(t),t[Kt.getElementIndex(o,o)]=t[Kt.getElementIndex(i,i)]=a,t[Kt.getElementIndex(i,o)]=c,t[Kt.getElementIndex(o,i)]=-c,t}var Be=new x,Cy=new x,Sy=new x,by=new x,My=new x,Iy=new z,wy={diagonal:new z,unitary:new z};function mn(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 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,u=0;for(let T of e){let m=Be.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,u+=m.z*m.z}o*=s,i*=s,a*=s,c*=s,l*=s,u*=s;let f=Iy;f[0]=o,f[1]=i,f[2]=a,f[3]=i,f[4]=c,f[5]=l,f[6]=a,f[7]=l,f[8]=u;let{unitary:h}=Ta(f,wy),d=t.halfAxes.copy(h),p=d.getColumn(0,Sy),A=d.getColumn(1,by),g=d.getColumn(2,My),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=Cy.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 Ar=512,fh=3,hh=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],dh=hh.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),Fy=dh.concat([[.25,.5],[.75,.5]]),Ce=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 Ce(t,r,n),new Ce(t,r+1,n),new Ce(t+1,r,n),new Ce(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,u=this.getBoundingVolume(s,c,l);if(a&&!this.insideBounds(a)||n.computeVisibility(u)<0)return!1;if(!this.childVisible){let{z:h}=this;if(h<i&&h>=o){let d=u.distanceTo(r.cameraPosition)*r.scale/r.height;h+=Math.floor(Math.log2(d))}if(h>=i)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let h of this.children)h.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?Fy:this.z<2?dh:hh,l=[];for(let u of c){let f=Ps(this.x+u[0],this.y+u[1],this.z);f[2]=t[0],l.push(n(f)),t[0]!==t[1]&&(f[2]=t[1],l.push(n(f)))}return mn(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 Ee([i,a,t[0]],[i+o,a+o,t[1]])}};function ph(e,t,r,n){let s=e instanceof gn._GlobeViewport&&e.resolution?e.projectPosition:null,o=Object.values(e.getFrustumPlanes()).map(({normal:d,distance:p})=>new ct(d.clone().negate(),p)),i=new ot(o),a=e.distanceScales.unitsPerMeter[2],c=r&&r[0]*a||0,l=r&&r[1]*a||0,u=e instanceof gn.WebMercatorViewport&&e.pitch<=60?t:0;if(n){let[d,p,A,g]=n,y=re([d,g]),E=re([A,p]);n=[y[0],Ar-y[1],E[0],Ar-E[1]]}let f=new Ce(0,0,0),h={viewport:e,project:s,cullingVolume:i,elevationBounds:[c,l],minZ:u,maxZ:t,bounds:n,offset:0};if(f.update(h),e instanceof gn.WebMercatorViewport&&e.subViewports&&e.subViewports.length>1){for(h.offset=-1;f.update(h)&&!(--h.offset<-fh););for(h.offset=1;f.update(h)&&!(++h.offset>fh););}return f.getSelected()}var oe=512,Ly=[-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(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 gh(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 Ry(e){return Math.abs(e.split("").reduce((t,r)=>(t<<5)-t+r.charCodeAt(0)|0,0))}function Qt(e,t){if(!e||!e.length)return null;let{index:r,id:n}=t;if(Array.isArray(e)){let o=Ry(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 Py(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 Ah({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},u=e.unproject([o,i],l),f=e.unproject([o+a,i],l),h=e.unproject([o,i+c],l),d=e.unproject([o+a,i+c],l);return[Math.min(u[0],f[0],h[0],d[0]),Math.min(u[1],f[1],h[1],d[1]),Math.max(u[0],f[0],h[0],d[0]),Math.max(u[1],f[1],h[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 Oy(e,t,r){return r?gh(e,r).map(s=>s*t/oe):e.map(n=>n*t/oe)}function Ea(e,t){return Math.pow(2,e)*oe/t}function Ps(e,t,r){let n=Ea(r,oe),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 mh(e,t,r,n){let s=Ea(r,n);return[e/s*oe,t/s*oe]}function Ba(e,t,r,n,s=oe){if(e.isGeospatial){let[l,u]=Ps(t,r,n),[f,h]=Ps(t+1,r+1,n);return{west:l,north:u,east:f,south:h}}let[o,i]=mh(t,r,n,s),[a,c]=mh(t+1,r+1,n,s);return{left:o,top:i,right:a,bottom:c}}function Ny(e,t,r,n,s){let o=Py(e,null,n),i=Ea(t,r),[a,c,l,u]=Oy(o,i,s),f=[];for(let h=Math.floor(a);h<l;h++)for(let d=Math.floor(c);d<u;d++)f.push({x:h,y:d,z:t});return f}function Ca({viewport:e,maxZoom:t,minZoom:r,zRange:n,extent:s,tileSize:o=oe,modelMatrix:i,modelMatrixInverse:a,zoomOffset:c=0}){let l=e.isGeospatial?Math.round(e.zoom+Math.log2(oe/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 u=s;return i&&a&&s&&!e.isGeospatial&&(u=gh(s,i)),e.isGeospatial?ph(e,l,n,s):Ny(e,l,o,u||Ly,a)}function Sa(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(e)}function ba(e){return Number.isFinite(e.west)&&Number.isFinite(e.north)&&Number.isFinite(e.east)&&Number.isFinite(e.south)}function xh(e){let t={},r;return n=>{for(let s in n)if(!Dy(n[s],t[s])){r=e(n),t=n;break}return r}}function Dy(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 yh=1,Os=2,vy="never",Uy="no-overlap",An="best-available",Gy=5,Vy={[An]:zy,[Uy]:ky,[vy]:()=>{}},Hy={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:()=>{}},Je=class{constructor(t){this._getCullBounds=xh(Ah),this.opts={...Hy,...t},this.setOptions(this.opts),this.onTileLoad=r=>{this.opts.onTileLoad?.(r),this.opts.maxCacheByteSize!=null&&(this._cacheByteSize+=r.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 P,this._modelMatrixInverse=new P}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 P(n):new P,o=!s.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!mt(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 u=Math.min(s.top,s.bottom),f=Math.max(s.top,s.bottom);l=s.left<a&&s.right>o&&u<c&&f>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||An,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:Vy[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!=null?1/0:Gy*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!=null?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 ke(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 zy(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!Th(t)&&Ma(t);for(let t of e)t.isVisible=Boolean(t.state&Os)}function ky(e){for(let r of e)r.state=0;for(let r of e)r.isSelected&&Th(r);let t=Array.from(e).sort((r,n)=>r.zoom-n.zoom);for(let r of t)if(r.isVisible=Boolean(r.state&Os),r.children&&(r.isVisible||r.state&yh))for(let n of r.children)n.state=yh;else r.isSelected&&Ma(r)}function Th(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=Os,!0;t=t.parent}return!1}function Ma(e){for(let t of e.children)t.isLoaded||t.content?t.state|=Os:Ma(t)}var Jy={TilesetClass:Je,data:{type:"data",value:[]},dataComparator:Se.equal,renderSubLayers:{type:"function",value:e=>new _h.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:An,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},Ns=class extends Ds.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,debounceTime:l,zoomOffset:u}=this.props;return{maxCacheSize:r,maxCacheByteSize:n,maxZoom:i,minZoom:a,tileSize:t,refinementStrategy:s,extent:o,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: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)?Qt(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(t){let r=t.sourceLayer,n=r.props.tile,s=t.info;return s.picked&&(s.tile=n),s.sourceTile=n,s.sourceTileSubLayer=r,s}_updateAutoHighlight(t){t.sourceTileSubLayer.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,Ds._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)}},Zt=Ns;(()=>{Ns.defaultProps=Jy})(),(()=>{Ns.layerName="TileLayer"})();var Eh=N(Nt(),1),qy={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 Eh.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?f0(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 r="",n="";for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))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}};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,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)}fe.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}};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,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}};fe.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}Vl.exports=fe});var kl=tt((mb,zl)=>{"use strict";var g0=Xo(),A0=Ol(),x0=Hl();zl.exports={XMLParser:A0,XMLValidator:g0,XMLBuilder:x0}});var oa=tt((Df,hn)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof cl=="function"&&typeof hn=="object"&&hn&&hn.exports?hn.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(Df,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 r={},n={};function s(T,m){var M,F,R;return m?(T>>>=0,(R=0<=T&&T<256)&&(F=n[T],F)?F:(M=i(T,(T|0)<0?-1:0,!0),R&&(n[T]=M),M)):(T|=0,(R=-128<=T&&T<128)&&(F=r[T],F)?F:(M=i(T,T<0?-1:0,!1),R&&(r[T]=M),M))}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 b}else{if(T<=-p)return w;if(T+1>=p)return S}return T<0?o(-T,m).neg():i(T%h|0,T/h|0,m)}e.fromNumber=o;function i(T,m,M){return new e(T,m,M)}e.fromBits=i;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 F;if((F=T.indexOf("-"))>0)throw Error("interior hyphen");if(F===0)return c(T.substring(1),m,M).neg();for(var R=o(a(M,8)),L=g,D=0;D<T.length;D+=8){var X=Math.min(8,T.length-D),H=parseInt(T.substring(D,D+X),M);if(X<8){var Q=o(a(M,X));L=L.mul(Q).add(o(H))}else L=L.mul(R),L=L.add(o(H))}return L.unsigned=m,L}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 u=1<<16,f=1<<24,h=u*u,d=h*h,p=d/2,A=s(f),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 b=i(-1,-1,!0);e.MAX_UNSIGNED_VALUE=b;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)*h+(this.low>>>0):this.high*h+(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=o(m),F=this.div(M),R=F.mul(M).sub(this);return F.toString(m)+R.toInt().toString(m)}else return"-"+this.neg().toString(m);for(var L=o(a(m,6),this.unsigned),D=this,X="";;){var H=D.div(L),Q=D.sub(H.mul(L)).toInt()>>>0,j=Q.toString(m);if(D=H,D.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(),F=m.isNegative();return M&&!F?-1:!M&&F?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,F=this.high&65535,R=this.low>>>16,L=this.low&65535,D=m.high>>>16,X=m.high&65535,H=m.low>>>16,Q=m.low&65535,j=0,W=0,$=0,At=0;return At+=L+Q,$+=At>>>16,At&=65535,$+=R+H,W+=$>>>16,$&=65535,W+=F+X,j+=W>>>16,W&=65535,j+=M+D,j&=65535,i($<<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 o(this.toNumber()*m.toNumber(),this.unsigned);var M=this.high>>>16,F=this.high&65535,R=this.low>>>16,L=this.low&65535,D=m.high>>>16,X=m.high&65535,H=m.low>>>16,Q=m.low&65535,j=0,W=0,$=0,At=0;return At+=L*Q,$+=At>>>16,At&=65535,$+=R*Q,W+=$>>>16,$&=65535,$+=L*H,W+=$>>>16,$&=65535,W+=F*Q,j+=W>>>16,W&=65535,W+=R*H,j+=W>>>16,W&=65535,W+=L*X,j+=W>>>16,W&=65535,j+=M*Q+F*H+R*X+L*D,j&=65535,i($<<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,F,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 L=this.shr(1);return M=L.div(m).shl(1),M.eq(g)?m.isNegative()?E:B:(F=this.sub(m.mul(M)),R=M.add(F.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(F=this;F.gte(m);){M=Math.max(1,Math.floor(F.toNumber()/m.toNumber()));for(var D=Math.ceil(Math.log(M)/Math.LN2),X=D<=48?1:a(2,D-48),H=o(M),Q=H.mul(m);Q.isNegative()||Q.gt(F);)M-=X,H=o(M,this.unsigned),Q=H.mul(m);H.isZero()&&(H=E),R=R.add(H),F=F.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 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 M=this.high;if(m<32){var F=this.low;return i(F>>>m|M<<32-m,M>>>m,this.unsigned)}else return m===32?i(M,0,this.unsigned):i(M>>>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 Rs=tt((jR,gh)=>{gh.exports=globalThis.h3||{}});var xa=tt((e3,Eh)=>{Eh.exports=globalThis.luma});var Ds=tt((r3,Bh)=>{Bh.exports=globalThis.deck});var Sh=tt((n3,Ch)=>{Ch.exports=globalThis.luma});var yr=tt((X3,Zh)=>{Zh.exports=globalThis.loaders});var Am=tt((WG,gm)=>{gm.exports=globalThis.deck});var Mm=tt(Yc=>{Yc.read=function(e,t,r,n,s){var o,i,a=s*8-n-1,c=(1<<a)-1,l=c>>1,u=-7,f=r?s-1:0,h=r?-1:1,d=e[t+f];for(f+=h,o=d&(1<<-u)-1,d>>=-u,u+=a;u>0;o=o*256+e[t+f],f+=h,u-=8);for(i=o&(1<<-u)-1,o>>=-u,u+=n;u>0;i=i*256+e[t+f],f+=h,u-=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)};Yc.write=function(e,t,r,n,s,o){var i,a,c,l=o*8-s-1,u=(1<<l)-1,f=u>>1,h=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=u):(i=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-i))<1&&(i--,c*=2),i+f>=1?t+=h/c:t+=h*Math.pow(2,1-f),t*c>=2&&(i++,c/=2),i+f>=u?(a=0,i=u):i+f>=1?(a=(t*c-1)*Math.pow(2,s),i=i+f):(a=t*Math.pow(2,f-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 Pm=tt((N4,Rm)=>{"use strict";Rm.exports=k;var Do=Mm();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 Kc=(1<<16)*(1<<16),Im=1/Kc,nS=12,Fm=typeof TextDecoder>"u"?null:new TextDecoder("utf8");k.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=vo(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=vo(this.buf,this.pos)+vo(this.buf,this.pos+4)*Kc;return this.pos+=8,e},readSFixed64:function(){var e=vo(this.buf,this.pos)+Lm(this.buf,this.pos+4)*Kc;return this.pos+=8,e},readFloat:function(){var e=Do.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Do.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&&Fm?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!==k.Bytes)return e.push(this.readVarint(t));var r=le(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==k.Bytes)return e.push(this.readSVarint());var t=le(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=le(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=le(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=le(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=le(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=le(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=le(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=le(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 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),Gr(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),Gr(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),Gr(this.buf,e&-1,this.pos),Gr(this.buf,Math.floor(e*Im),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),Gr(this.buf,e&-1,this.pos),Gr(this.buf,Math.floor(e*Im),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&&wm(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),Do.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Do.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&&wm(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,k.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,hS,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,uS,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,fS,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,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 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 Ur(e,s,t);throw new Error("Expected varint not more than 10 bytes")}function le(e){return e.type===k.Bytes?e.readVarint()+e.pos:e.pos+1}function Ur(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 wm(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 uS(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function fS(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function hS(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 vo(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function Gr(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function Lm(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,u;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],u=e[s+3],(c&192)===128&&(l&192)===128&&(u&192)===128&&(i=(o&15)<<18|(c&63)<<12|(l&63)<<6|u&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 Fm.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 Yn={};ut(Yn,{GeohashLayer:()=>tg,GreatCircleLayer:()=>Of,H3ClusterLayer:()=>_h,H3HexagonLayer:()=>Ns,MVTLayer:()=>Km,QuadkeyLayer:()=>Yf,S2Layer:()=>Xf,TerrainLayer:()=>mm,Tile3DLayer:()=>am,TileLayer:()=>qe,TripsLayer:()=>mh,_GeoCellLayer:()=>Yt,_Tile2DHeader:()=>ke,_Tileset2D:()=>Je,_WMSLayer:()=>Ar,_getURLFromTemplate:()=>Qt});var kt={},ul=N(Ot(),1);ue(kt,N(Ot(),1));if(!ul.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");ue(Yn,kt);var ze=N(Nt(),1),Rf=N(Ot(),1);function ug(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function Qn(e){if(Array.isArray(e))return e.map(t=>Qn(t));if(e&&typeof e=="object"){let t={};for(let[r,n]of Object.entries(e))t[ug(r)]=Qn(n);return t}return e}var Jl=N(kl(),1);function ti(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?Qn(n):n}function y0(e,t){return new Jl.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var T0="4.2.0-beta.2",Dt={dataType:null,batchType:null,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)=>ti(new TextDecoder().decode(e),{...Dt.options.xml,...t?.xml}),parseTextSync:(e,t)=>ti(e,{...Dt.options.xml,...t?.xml})};function _0(e){return e.startsWith("<?xml")}async function Et(e,t,r,n){return n._parse(e,t,r,n)}function G(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var Jt={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},E0=Jt.self||Jt.window||Jt.global||{},B0=Jt.window||Jt.self||Jt.global||{},C0=Jt.global||Jt.self||Jt.window||{},S0=Jt.document||{};var Jr=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var ql=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),b0=ql&&parseFloat(ql[1])||0;var $n=globalThis,M0=globalThis.document||{},ts=globalThis.process||{},I0=globalThis.console,Bb=globalThis.navigator||{};function jl(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 Fe(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||jl()}var ei="4.0.7";function L0(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var es=class{constructor(t,r,n="sessionStorage"){this.storage=L0(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 Xl(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 Wl(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var rs;(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"})(rs||(rs={}));var F0=10;function Yl(e){return typeof e!="string"?e:(e=e.toUpperCase(),rs[e]||rs.WHITE)}function Kl(e,t,r){return!Fe&&typeof e=="string"&&(t&&(e=`\x1B[${Yl(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${Yl(r)+F0}m${e}\x1B[49m`)),e}function Ql(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 qr(e,t){if(!e)throw new Error(t||"Assertion failed")}function Re(){let e;if(Fe()&&$n.performance)e=$n?.performance?.now?.();else if("hrtime"in ts){let t=ts?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var cr={debug:Fe()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},R0={enabled:!0,level:0};function lr(){}var Zl={},$l={once:!0},jr=class{constructor({id:t}={id:""}){this.VERSION=ei,this._startTs=Re(),this._deltaTs=Re(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new es(`__probe-${this.id}__`,R0),this.timeStamp(`${this.id} started`),Ql(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((Re()-this._startTs).toPrecision(10))}getDelta(){return Number((Re()-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,cr.warn,arguments,$l)}error(t){return this._getLogFunction(0,t,cr.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,cr.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,cr.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,cr.debug||cr.info,arguments,$l)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||lr,n&&[n],{tag:O0(r)}):lr}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||lr)}group(t,r,n={collapsed:!1}){let s=tu({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||lr)}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()>=eu(t)}_getLogFunction(t,r,n,s,o){if(this._shouldLog(t)){o=tu({logLevel:t,message:r,args:s,opts:o}),n=n||o.method,qr(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=Re();let i=o.tag||o.message;if(o.once&&i)if(!Zl[i])Zl[i]=Re();else return lr;return r=P0(this.id,o.message,o),n.bind(console,r,...o.args)}return lr}};jr.VERSION=ei;function eu(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 qr(Number.isFinite(t)&&t>=0),t}function tu(e){let{logLevel:t,message:r}=e;e.logLevel=eu(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 qr(s==="string"||s==="object"),Object.assign(e,{args:n},e.opts)}function P0(e,t,r){if(typeof t=="string"){let n=r.time?Wl(Xl(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=Kl(t,r.color,r.background)}return t}function O0(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}globalThis.probe={};var ri=new jr({id:"@probe.gl/log"});function ni(e,t){return ru(e||{},t)}function ru(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]=ru(n[s]||{},t[s],r+1):n[s]=t[s];return n}function si(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function oi(e){return globalThis.loaders?.modules?.[e]||null}function N0(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.0-beta.2"),globalThis._loadersgl_.version}var nu=N0();function su(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var qt={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},tM=qt.self||qt.window||qt.global||{},eM=qt.window||qt.self||qt.global||{},rM=qt.global||qt.self||qt.window||{},nM=qt.document||{};var ur=typeof process!="object"||String(process)!=="[object process]"||process.browser,ns=typeof importScripts=="function",sM=typeof window<"u"&&typeof window.orientation<"u",ou=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),oM=ou&&parseFloat(ou[1])||0;var ii={};async function jt(e,t=null,r={},n=null){return t&&(e=iu(e,t,r,n)),ii[e]=ii[e]||D0(e),await ii[e]}function iu(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]:ur?r.CDN?(su(r.CDN.startsWith("http")),`${r.CDN}/${t}@${nu}/dist/libs/${n}`):ns?`../src/libs/${n}`:`modules/${t}/src/libs/${n}`:`modules/${t}/dist/libs/${n}`}async function D0(e){if(e.endsWith("wasm"))return await U0(e);if(!ur)try{let{requireFromFile:r}=globalThis.loaders||{};return await r?.(e)}catch(r){return console.error(r),null}if(ns)return importScripts(e);let t=await G0(e);return v0(t,e)}function v0(e,t){if(!ur){let{requireFromString:n}=globalThis.loaders||{};return n?.(e,t)}if(ns)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 U0(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return ur||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function G0(e){let{readFileAsText:t}=globalThis.loaders||{};return ur||!t||e.startsWith("http")?await(await fetch(e)).text():await t(e)}function cu(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?au(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?au(e,0,t):""}function au(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 ai(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${cu(e)}"`)}}function Xr(...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 he(e,t){return G(e>=0),G(t>0),e+(t-1)&~(t-1)}function ci(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+he(n.byteLength,4)}function Wr(){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=Wr(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Wr()-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 de=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 V0="Queued Requests",H0="Active Requests",z0="Cancelled Requests",k0="Queued Requests Ever",J0="Active Requests Ever",q0={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},pe=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...q0,...t},this.stats=new de({id:this.props.id}),this.stats.get(V0),this.stats.get(H0),this.stats.get(z0),this.stats.get(k0),this.stats.get(J0)}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 me={};ut(me,{dirname:()=>X0,filename:()=>j0,join:()=>W0,resolve:()=>Y0});function lu(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function j0(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function X0(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function W0(...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 Y0(...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=lu()),i=s),i.length!==0&&(r=`${i}/${r}`,n=i.charCodeAt(0)===Yr)}return r=K0(r,!n),n?`/${r}`:r.length>0?r:"."}var Yr=47,li=46;function K0(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===Yr)break;o=Yr}if(o===Yr){if(!(n===a-1||s===1))if(n!==a-1&&s===2){if(r.length<2||!i||r.charCodeAt(r.length-1)!==li||r.charCodeAt(r.length-2)!==li){if(r.length>2){let c=r.length-1,l=c;for(;l>=0&&r.charCodeAt(l)!==Yr;--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===li&&s!==-1?++s:s=-1}return r}var ss=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=Q0(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 Q0(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 bt=class extends ss{};ar(bt,"type","template"),ar(bt,"testURL",t=>!1);function uu(e,t){let r=Dt.parseTextSync?.(e,t),n=r?.ServiceExceptionReport?.ServiceException||r?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof n=="string"?n:n.value||n.code||"Unknown error"}var Z0="4.2.0-beta.2",Kr={dataType:null,batchType:null,id:"wms-error",name:"WMS Error",module:"wms",version:Z0,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:$0,options:{wms:{throwOnError:!1}},parse:async(e,t)=>ui(new TextDecoder().decode(e),t),parseSync:(e,t)=>ui(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>ui(e,t)};function $0(e){return e.startsWith("<?xml")}function ui(e,t){let r={...Kr.options.wms,...t?.wms},n=uu(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 Qr(e){let t=Ne(e);return t.length>0&&t.every(r=>typeof r=="string")?t:[]}function Zr(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseFloat(e);default:return}}function os(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 fi(e,t){let r=Dt.parseTextSync?.(e,t),n=r.WMT_MS_Capabilities||r.WMS_Capabilities||r,s=tA(n);if(t?.inheritedLayerProps)for(let o of s.layers)hu(o,null);return t?.includeRawJSON&&(s.json=n),t?.includeXMLText&&(s.xml=e),s}function tA(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:Qr(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:os(e.Service?.LayerLimit),maxWidth:os(e.Service?.maxWidth),maxHeight:os(e.Service?.maxHeight),layers:[],requests:eA(e.Capability?.Request),exceptions:rA(e.Exception)},r=Ne(e.Capability?.Layer);for(let n of r)t.layers.push(fu(n));for(let[n,s]of Object.entries(t))s===void 0&&delete t[n];return t}function eA(e){let t={};for(let[r,n]of Object.entries(e||{})){let s=Qr(n?.Format);t[r]={mimeTypes:s}}return t}function rA(e){if(Ne(e?.Format).length>0)return{mimeTypes:Qr(e)}}function fu(e){let t={title:String(e?.Title||""),name:e?.Name&&String(e?.Name),abstract:e?.Name&&String(e?.Abstract),keywords:Qr(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&&nA(e?.EX_GeographicBoundingBox);n&&(t.geographicBoundingBox=n),n=e?.LatLonBoundingBox&&sA(e?.LatLonBoundingBox),n&&(t.geographicBoundingBox=n);let s=e?.BoundingBox&&oA(e?.BoundingBox);s&&s.length>0&&(t.boundingBoxes=s);let i=Ne(e?.Dimension).map(l=>aA(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(fu(l));c.length>0&&(t.layers=c);for(let[l,u]of Object.entries(t))u===void 0&&delete t[l];return t}function nA(e){let{westBoundLongitude:t,northBoundLatitude:r,eastBoundLongitude:n,southBoundLatitude:s}=e;return[[t,s],[n,r]]}function sA(e){let{minx:t,miny:r,maxx:n,maxy:s}=e;return[[t,r],[n,s]]}function oA(e){return Ne(e).map(r=>iA(r))}function iA(e){let{CRS:t,SRS:r,minx:n,miny:s,maxx:o,maxy:i,resx:a,resy:c}=e,l={crs:t||r,boundingBox:[[Zr(n),Zr(s)],[Zr(o),Zr(i)]]};return a&&(l.xResolution=a),c&&(l.yResolution=c),l}function aA(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 hu(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||[])hu(r,e)}var cA="4.2.0-beta.2",fr={dataType:null,batchType:null,id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:cA,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:lA,options:{wms:{}},parse:async(e,t)=>fi(new TextDecoder().decode(e),t?.wms),parseTextSync:(e,t)=>fi(e,t?.wms)};function lA(e){return e.startsWith("<?xml")}function hi(e,t){let n=(Dt.parseTextSync?.(e,t)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(n)?n:[n]).map(o=>uA(o))}}function uA(e){return{attributes:e||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var du={...fr,dataType:null,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(e,t)=>hi(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>hi(e,t)};function di(e,t){return Dt.parseTextSync?.(e,t)}var pu={...fr,dataType:null,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(e,t)=>di(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>di(e,t)};function mu(e,t){let{type:r="auto"}=e,n=r==="auto"?hA(e.url,t):fA(r,t);if(!n)throw new Error("Not a valid image source type");return n.create(e)}function fA(e,t){for(let r of t)if(r.type===e)return r;return null}function hA(e,t){for(let r of t)if(r.testURL&&r.testURL(e))return r;return null}var gu="4.2.0-beta.2";var dA=globalThis.loaders?.parseImageNode,pi=typeof Image<"u",mi=typeof ImageBitmap<"u",pA=Boolean(dA),gi=Jr?!0:pA;function Au(e){switch(e){case"auto":return mi||pi||gi;case"imagebitmap":return mi;case"image":return pi;case"data":return gi;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function xu(){if(mi)return"imagebitmap";if(pi)return"image";if(gi)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function yu(e){let t=mA(e);if(!t)throw new Error("Not an image");return t}function $r(e){switch(yu(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 mA(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 gA=/^data:image\/svg\+xml/,AA=/\.svg((\?|#).*)?$/;function is(e){return e&&(gA.test(e)||AA.test(e))}function Tu(e,t){if(is(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 Ai(e,t)}function Ai(e,t){if(is(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function as(e,t,r){let n=Tu(e,r),s=self.URL||self.webkitURL,o=typeof n!="string"&&s.createObjectURL(n);try{return await xA(o||n,t)}finally{o&&s.revokeObjectURL(o)}}async function xA(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 yA={},_u=!0;async function Eu(e,t,r){let n;is(r)?n=await as(e,t,r):n=Ai(e,r);let s=t&&t.imagebitmap;return await TA(n,s)}async function TA(e,t=null){if((_A(t)||!_u)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),_u=!1}return await createImageBitmap(e)}function _A(e){for(let t in e||yA)return!1;return!0}function Bu(e){return!SA(e,"ftyp",4)||!(e[8]&96)?null:EA(e)}function EA(e){switch(BA(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function BA(e,t,r){return String.fromCharCode(...e.slice(t,r))}function CA(e){return[...e].map(t=>t.charCodeAt(0))}function SA(e,t,r=0){let n=CA(t);for(let s=0;s<n.length;++s)if(n[s]!==e[s+r])return!1;return!0}var Xt=!1,tn=!0;function ve(e){let t=en(e);return MA(t)||LA(t)||IA(t)||wA(t)||bA(t)}function bA(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=Bu(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function MA(e){let t=en(e);return t.byteLength>=24&&t.getUint32(0,Xt)===2303741511?{mimeType:"image/png",width:t.getUint32(16,Xt),height:t.getUint32(20,Xt)}:null}function IA(e){let t=en(e);return t.byteLength>=10&&t.getUint32(0,Xt)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,tn),height:t.getUint16(8,tn)}:null}function wA(e){let t=en(e);return t.byteLength>=14&&t.getUint16(0,Xt)===16973&&t.getUint32(2,tn)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,tn),height:t.getUint32(22,tn)}:null}function LA(e){let t=en(e);if(!(t.byteLength>=3&&t.getUint16(0,Xt)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:s}=FA(),o=2;for(;o+9<t.byteLength;){let i=t.getUint16(o,Xt);if(s.has(i))return{mimeType:"image/jpeg",height:t.getUint16(o+5,Xt),width:t.getUint16(o+7,Xt)};if(!n.has(i))return null;o+=2,o+=t.getUint16(o,Xt)}return null}function FA(){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 en(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 Cu(e,t){let{mimeType:r}=ve(e)||{},n=globalThis.loaders?.parseImageNode;return G(n),await n(e,r)}async function Su(e,t,r){t=t||{};let s=(t.image||{}).type||"auto",{url:o}=r||{},i=RA(s),a;switch(i){case"imagebitmap":a=await Eu(e,t,o);break;case"image":a=await as(e,t,o);break;case"data":a=await Cu(e,t);break;default:G(!1)}return s==="data"&&(a=$r(a)),a}function RA(e){switch(e){case"auto":case"data":return xu();default:return Au(e),e}}var PA=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],OA=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],NA={image:{type:"auto",decode:!0}},ge={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:gu,mimeTypes:OA,extensions:PA,parse:Su,tests:[e=>Boolean(ve(new DataView(e)))],options:NA};var xi={};function yi(e){if(xi[e]===void 0){let t=Jr?vA(e):DA(e);xi[e]=t}return xi[e]}function DA(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 vA(e){switch(e){case"image/avif":case"image/webp":return UA(e);default:return!0}}function UA(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var bu={type:"wms",testURL:e=>e.toLowerCase().includes("wms"),create:e=>new Ti(e)},Ti=class extends bt{url;data;substituteCRS84;flipCRS;wmsParameters;vendorParameters;capabilities=null;constructor(t){super(t),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 fr.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 ge.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 du.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 pu.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 ge.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{boundingBox:n,bbox:s}=t;t.bbox=n?[...n[0],...n[1]]:s;let o={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",o,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;case"x":n.version==="1.3.0"&&(t="i");break;case"y":n.version==="1.3.0"&&(t="j");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||Kr.mimeTypes.includes(n)){let s=ni(this.loadOptions,{wms:{throwOnError:!0}}),o=Kr.parseSync?.(r,s);throw new Error(o)}}_parseError(t){let r=Kr.parseSync?.(t,this.loadOptions);return new Error(r)}};var hr=class extends bt{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 ge.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}};ar(hr,"type","template"),ar(hr,"testURL",t=>t.toLowerCase().includes("{"));var _i=class extends hr{data;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")}},Mu={type:"arcgis-image-server",testURL:e=>e.toLowerCase().includes("ImageServer"),create:e=>new _i(e)};var GA=[bu,Mu];function Ei(e){return mu(e,GA)}var VA=1/Math.PI*180,HA=1/180*Math.PI,zA={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...zA}};var Y=globalThis.mathgl.config;function Bi(e,{precision:t=Y.precision}={}){return e=kA(e),`${parseFloat(e.toPrecision(t))}`}function Bt(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ci(e){return Iu(e)}function Si(e){return Ct(e)}function Iu(e,t){return bi(e,r=>r*HA,t)}function Ct(e,t){return bi(e,r=>r*VA,t)}function cs(e,t,r){return bi(e,n=>Math.max(t,Math.min(r,n)))}function Ae(e,t,r){return Bt(e)?e.map((n,s)=>Ae(n,t[s],r)):r*t+(1-r)*e}function mt(e,t,r){let n=Y.EPSILON;r&&(Y.EPSILON=r);try{if(e===t)return!0;if(Bt(e)&&Bt(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=n}}function kA(e){return Math.round(e/Y.EPSILON)*Y.EPSILON}function JA(e){return e.clone?e.clone():new Array(e.length)}function bi(e,t,r){if(Bt(e)){let n=e;r=r||JA(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)}var xe=class extends 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:Bt(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 r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+Bi(this[n],t);return`${t.printTypes?this.constructor.name:""}[${r}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!mt(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(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 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 qA(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 U(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function ye(e,t,r=""){if(Y.debug&&!qA(e,t))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return e}function at(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var Te=class extends xe{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 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 U(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return U(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 at(t>=0&&t<this.ELEMENTS,"index is out of range"),U(this[t])}setComponent(t,r){return at(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 Z=typeof Float32Array<"u"?Float32Array:Array,rn=Math.random;function dr(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var G2=Math.PI/180;function jA(){let e=new Z(2);return Z!=Float32Array&&(e[0]=0,e[1]=0),e}function wu(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 Lu(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 ls(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 V2=function(){let e=jA();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 hs(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 Fu(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 Ru(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 ds(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 Te{constructor(t=0,r=0){super(2),Bt(t)&&arguments.length===1?this.copy(t):(Y.debug&&(U(t),U(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 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 us(this,this,t),this.check()}transformAsVector(t){return fs(this,this,t),this.check()}transformByMatrix3(t){return ls(this,this,t),this.check()}transformByMatrix2x3(t){return Lu(this,this,t),this.check()}transformByMatrix2(t){return wu(this,this,t),this.check()}};var He={};ut(He,{add:()=>KA,angle:()=>Fi,bezier:()=>l1,ceil:()=>QA,clone:()=>XA,copy:()=>WA,create:()=>ps,cross:()=>Ge,dist:()=>x1,distance:()=>vu,div:()=>A1,divide:()=>Du,dot:()=>nn,equals:()=>p1,exactEquals:()=>d1,floor:()=>ZA,forEach:()=>_1,fromValues:()=>ms,hermite:()=>c1,inverse:()=>o1,len:()=>Ri,length:()=>Pu,lerp:()=>i1,max:()=>t1,min:()=>$A,mul:()=>g1,multiply:()=>Nu,negate:()=>s1,normalize:()=>Mi,random:()=>u1,rotateX:()=>Ii,rotateY:()=>wi,rotateZ:()=>Li,round:()=>e1,scale:()=>r1,scaleAndAdd:()=>n1,set:()=>YA,slerp:()=>a1,sqrDist:()=>y1,sqrLen:()=>T1,squaredDistance:()=>Uu,squaredLength:()=>Gu,str:()=>h1,sub:()=>m1,subtract:()=>Ou,transformMat3:()=>sn,transformMat4:()=>Ve,transformQuat:()=>on,zero:()=>f1});function ps(){let e=new Z(3);return Z!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function XA(e){let t=new Z(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Pu(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function ms(e,t,r){let n=new Z(3);return n[0]=e,n[1]=t,n[2]=r,n}function WA(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function YA(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 Ou(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function Nu(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function Du(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function QA(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function ZA(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function $A(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 t1(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 e1(e,t){return e[0]=dr(t[0]),e[1]=dr(t[1]),e[2]=dr(t[2]),e}function r1(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function n1(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 vu(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 Uu(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 Gu(e){let t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function s1(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function o1(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Mi(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 nn(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 i1(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 a1(e,t,r,n){let s=Math.acos(Math.min(Math.max(nn(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 c1(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),u=i*(3-2*o);return e[0]=t[0]*a+r[0]*c+n[0]*l+s[0]*u,e[1]=t[1]*a+r[1]*c+n[1]*l+s[1]*u,e[2]=t[2]*a+r[2]*c+n[2]*l+s[2]*u,e}function l1(e,t,r,n,s,o){let i=1-o,a=i*i,c=o*o,l=a*i,u=3*o*a,f=3*c*i,h=c*o;return e[0]=t[0]*l+r[0]*u+n[0]*f+s[0]*h,e[1]=t[1]*l+r[1]*u+n[1]*f+s[1]*h,e[2]=t[2]*l+r[2]*u+n[2]*f+s[2]*h,e}function u1(e,t){t=t===void 0?1:t;let r=rn()*2*Math.PI,n=rn()*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 sn(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 on(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],u=s*l-o*c,f=o*a-n*l,h=n*c-s*a,d=s*h-o*f,p=o*u-n*h,A=n*f-s*u,g=i*2;return u*=g,f*=g,h*=g,d*=2,p*=2,A*=2,e[0]=a+u+d,e[1]=c+f+p,e[2]=l+h+A,e}function Ii(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 wi(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 Li(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 Fi(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&&nn(e,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}function f1(e){return e[0]=0,e[1]=0,e[2]=0,e}function h1(e){return`vec3(${e[0]}, ${e[1]}, ${e[2]})`}function d1(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function p1(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 m1=Ou,g1=Nu,A1=Du,x1=vu,y1=Uu,Ri=Pu,T1=Gu,_1=function(){let e=ps();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 Pi=[0,0,0],gs,x=class extends Te{static get ZERO(){return gs||(gs=new x(0,0,0),Object.freeze(gs)),gs}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&Bt(t)?this.copy(t):(Y.debug&&(U(t),U(r),U(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 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 Fi(this,t)}cross(t){return Ge(this,this,t),this.check()}rotateX({radians:t,origin:r=Pi}){return Ii(this,this,r,t),this.check()}rotateY({radians:t,origin:r=Pi}){return wi(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=Pi}){return Li(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Ve(this,this,t),this.check()}transformAsVector(t){return hs(this,this,t),this.check()}transformByMatrix3(t){return sn(this,this,t),this.check()}transformByMatrix2(t){return Fu(this,this,t),this.check()}transformByQuaternion(t){return on(this,this,t),this.check()}};var As,mr=class extends Te{static get ZERO(){return As||(As=new mr(0,0,0,0),Object.freeze(As)),As}constructor(t=0,r=0,n=0,s=0){super(-0,-0,-0,-0),Bt(t)&&arguments.length===1?this.copy(t):(Y.debug&&(U(t),U(r),U(n),U(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 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 Ve(this,this,t),this.check()}transformByMatrix3(t){return ds(this,this,t),this.check()}transformByMatrix2(t){return Ru(this,this,t),this.check()}transformByQuaternion(t){return on(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var gr=class extends xe{toString(){let t="[";if(Y.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)t+=` ${this[n*this.RANK+r]}`}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=` ${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]=U(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 Vu(){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 Hu(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 zu(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],u=t[8],f=u*i-a*l,h=-u*o+a*c,d=l*o-i*c,p=r*f+n*h+s*d;return p?(p=1/p,e[0]=f*p,e[1]=(-u*n+s*l)*p,e[2]=(a*n-s*i)*p,e[3]=h*p,e[4]=(u*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 ku(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 Oi(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],u=t[7],f=t[8],h=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]=h*n+d*i+p*l,e[1]=h*s+d*a+p*u,e[2]=h*o+d*c+p*f,e[3]=A*n+g*i+y*l,e[4]=A*s+g*a+y*u,e[5]=A*o+g*c+y*f,e[6]=E*n+_*i+B*l,e[7]=E*s+_*a+B*u,e[8]=E*o+_*c+B*f,e}function Ju(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],u=t[7],f=t[8],h=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]=h*n+d*i+l,e[7]=h*s+d*a+u,e[8]=h*o+d*c+f,e}function qu(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],u=t[7],f=t[8],h=Math.sin(r),d=Math.cos(r);return e[0]=d*n+h*i,e[1]=d*s+h*a,e[2]=d*o+h*c,e[3]=d*i-h*n,e[4]=d*a-h*s,e[5]=d*c-h*o,e[6]=l,e[7]=u,e[8]=f,e}function Ni(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 ju(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,u=n*i,f=n*a,h=s*i,d=s*a,p=s*c,A=o*i,g=o*a,y=o*c;return e[0]=1-f-p,e[3]=u-y,e[6]=h+g,e[1]=u+y,e[4]=1-l-p,e[7]=d-A,e[2]=h-g,e[5]=d+A,e[8]=1-l-f,e}var Di;(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"})(Di||(Di={}));var B1=Object.freeze([1,0,0,0,1,0,0,0,1]),z=class extends gr{static get IDENTITY(){return S1()}static get ZERO(){return C1()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Di}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(B1)}fromObject(t){return this.check()}fromQuaternion(t){return ju(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 ku(this)}transpose(){return Hu(this,this),this.check()}invert(){return zu(this,this),this.check()}multiplyLeft(t){return Oi(this,t,this),this.check()}multiplyRight(t){return Oi(this,this,t),this.check()}rotate(t){return qu(this,this,t),this.check()}scale(t){return Array.isArray(t)?Ni(this,this,t):Ni(this,this,[t,t]),this.check()}translate(t){return Ju(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=ls(r||[-0,-0],t,this);break;case 3:n=sn(r||[-0,-0,-0],t,this);break;case 4:n=ds(r||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return ye(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)}},xs,ys=null;function C1(){return xs||(xs=new z([0,0,0,0,0,0,0,0,0]),Object.freeze(xs)),xs}function S1(){return ys||(ys=new z,Object.freeze(ys)),ys}var cn={};ut(cn,{add:()=>K1,adjoint:()=>F1,clone:()=>M1,copy:()=>I1,create:()=>b1,decompose:()=>H1,determinant:()=>Gi,equals:()=>tx,exactEquals:()=>$1,frob:()=>Y1,fromQuat:()=>ji,fromQuat2:()=>U1,fromRotation:()=>O1,fromRotationTranslation:()=>Wu,fromRotationTranslationScale:()=>z1,fromRotationTranslationScaleOrigin:()=>k1,fromScaling:()=>P1,fromTranslation:()=>R1,fromValues:()=>w1,fromXRotation:()=>N1,fromYRotation:()=>D1,fromZRotation:()=>v1,frustum:()=>Xi,getRotation:()=>V1,getScaling:()=>Yu,getTranslation:()=>G1,identity:()=>Xu,invert:()=>Ui,lookAt:()=>Ki,mul:()=>ex,multiply:()=>an,multiplyScalar:()=>Q1,multiplyScalarAndAdd:()=>Z1,ortho:()=>Yi,orthoNO:()=>Qu,orthoZO:()=>j1,perspective:()=>Wi,perspectiveFromFieldOfView:()=>q1,perspectiveNO:()=>Ku,perspectiveZO:()=>J1,rotate:()=>zi,rotateX:()=>ki,rotateY:()=>Ji,rotateZ:()=>qi,scale:()=>Hi,set:()=>L1,str:()=>W1,sub:()=>rx,subtract:()=>Zu,targetTo:()=>X1,translate:()=>Vi,transpose:()=>vi});function b1(){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 M1(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 I1(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 w1(e,t,r,n,s,o,i,a,c,l,u,f,h,d,p,A){let g=new Z(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]=u,g[11]=f,g[12]=h,g[13]=d,g[14]=p,g[15]=A,g}function L1(e,t,r,n,s,o,i,a,c,l,u,f,h,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]=u,e[10]=f,e[11]=h,e[12]=d,e[13]=p,e[14]=A,e[15]=g,e}function Xu(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 vi(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 Ui(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],u=t[8],f=t[9],h=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,b=n*l-o*a,w=s*l-o*c,C=u*A-f*p,T=u*g-h*p,m=u*y-d*p,M=f*g-h*A,F=f*y-d*A,R=h*y-d*g,L=E*R-_*F+B*M+S*m-b*T+w*C;return L?(L=1/L,e[0]=(a*R-c*F+l*M)*L,e[1]=(s*F-n*R-o*M)*L,e[2]=(A*w-g*b+y*S)*L,e[3]=(h*b-f*w-d*S)*L,e[4]=(c*m-i*R-l*T)*L,e[5]=(r*R-s*m+o*T)*L,e[6]=(g*B-p*w-y*_)*L,e[7]=(u*w-h*B+d*_)*L,e[8]=(i*F-a*m+l*C)*L,e[9]=(n*m-r*F-o*C)*L,e[10]=(p*b-A*B+y*E)*L,e[11]=(f*B-u*b-d*E)*L,e[12]=(a*T-i*M-c*C)*L,e[13]=(r*M-n*T+s*C)*L,e[14]=(A*_-p*S-g*E)*L,e[15]=(u*S-f*_+h*E)*L,e):null}function F1(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],u=t[8],f=t[9],h=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,b=n*l-o*a,w=s*l-o*c,C=u*A-f*p,T=u*g-h*p,m=u*y-d*p,M=f*g-h*A,F=f*y-d*A,R=h*y-d*g;return e[0]=a*R-c*F+l*M,e[1]=s*F-n*R-o*M,e[2]=A*w-g*b+y*S,e[3]=h*b-f*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]=u*w-h*B+d*_,e[8]=i*F-a*m+l*C,e[9]=n*m-r*F-o*C,e[10]=p*b-A*B+y*E,e[11]=f*B-u*b-d*E,e[12]=a*T-i*M-c*C,e[13]=r*M-n*T+s*C,e[14]=A*_-p*S-g*E,e[15]=u*S-f*_+h*E,e}function Gi(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],u=e[9],f=e[10],h=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-u*d,S=l*A-f*d,b=u*A-f*p,w=t*b-r*S+n*B,C=o*b-i*S+a*B,T=l*_-u*E+f*y,m=d*_-p*E+A*y;return c*w-s*C+g*T-h*m}function an(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],u=t[7],f=t[8],h=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],b=r[3];return e[0]=_*n+B*a+S*f+b*A,e[1]=_*s+B*c+S*h+b*g,e[2]=_*o+B*l+S*d+b*y,e[3]=_*i+B*u+S*p+b*E,_=r[4],B=r[5],S=r[6],b=r[7],e[4]=_*n+B*a+S*f+b*A,e[5]=_*s+B*c+S*h+b*g,e[6]=_*o+B*l+S*d+b*y,e[7]=_*i+B*u+S*p+b*E,_=r[8],B=r[9],S=r[10],b=r[11],e[8]=_*n+B*a+S*f+b*A,e[9]=_*s+B*c+S*h+b*g,e[10]=_*o+B*l+S*d+b*y,e[11]=_*i+B*u+S*p+b*E,_=r[12],B=r[13],S=r[14],b=r[15],e[12]=_*n+B*a+S*f+b*A,e[13]=_*s+B*c+S*h+b*g,e[14]=_*o+B*l+S*d+b*y,e[15]=_*i+B*u+S*p+b*E,e}function Vi(e,t,r){let n=r[0],s=r[1],o=r[2],i,a,c,l,u,f,h,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],u=t[4],f=t[5],h=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]=u,e[5]=f,e[6]=h,e[7]=d,e[8]=p,e[9]=A,e[10]=g,e[11]=y,e[12]=i*n+u*s+p*o+t[12],e[13]=a*n+f*s+A*o+t[13],e[14]=c*n+h*s+g*o+t[14],e[15]=l*n+d*s+y*o+t[15]),e}function Hi(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 zi(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,u,f,h,d,p,A,g,y,E,_,B,S,b,w,C,T,m,M,F,R,L,D;return a<1e-6?null:(a=1/a,s*=a,o*=a,i*=a,l=Math.sin(r),c=Math.cos(r),u=1-c,f=t[0],h=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=o*s*u+i*l,T=i*s*u-o*l,m=s*o*u-i*l,M=o*o*u+c,F=i*o*u+s*l,R=s*i*u+o*l,L=o*i*u-s*l,D=i*i*u+c,e[0]=f*w+A*C+_*T,e[1]=h*w+g*C+B*T,e[2]=d*w+y*C+S*T,e[3]=p*w+E*C+b*T,e[4]=f*m+A*M+_*F,e[5]=h*m+g*M+B*F,e[6]=d*m+y*M+S*F,e[7]=p*m+E*M+b*F,e[8]=f*R+A*L+_*D,e[9]=h*R+g*L+B*D,e[10]=d*R+y*L+S*D,e[11]=p*R+E*L+b*D,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function ki(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],u=t[9],f=t[10],h=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+u*n,e[6]=a*s+f*n,e[7]=c*s+h*n,e[8]=l*s-o*n,e[9]=u*s-i*n,e[10]=f*s-a*n,e[11]=h*s-c*n,e}function Ji(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],u=t[9],f=t[10],h=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-u*n,e[2]=a*s-f*n,e[3]=c*s-h*n,e[8]=o*n+l*s,e[9]=i*n+u*s,e[10]=a*n+f*s,e[11]=c*n+h*s,e}function qi(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],u=t[5],f=t[6],h=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+u*n,e[2]=a*s+f*n,e[3]=c*s+h*n,e[4]=l*s-o*n,e[5]=u*s-i*n,e[6]=f*s-a*n,e[7]=h*s-c*n,e}function R1(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 P1(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 O1(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 N1(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 D1(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 v1(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 Wu(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,u=n*a,f=n*c,h=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]=f+E,e[2]=h-y,e[3]=0,e[4]=f-E,e[5]=1-(u+A),e[6]=p+g,e[7]=0,e[8]=h+y,e[9]=p-g,e[10]=1-(u+d),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function U1(e,t){let r=new Z(3),n=-t[0],s=-t[1],o=-t[2],i=t[3],a=t[4],c=t[5],l=t[6],u=t[7],f=n*n+s*s+o*o+i*i;return f>0?(r[0]=(a*i+u*n+c*o-l*s)*2/f,r[1]=(c*i+u*s+l*n-a*o)*2/f,r[2]=(l*i+u*o+a*s-c*n)*2/f):(r[0]=(a*i+u*n+c*o-l*s)*2,r[1]=(c*i+u*s+l*n-a*o)*2,r[2]=(l*i+u*o+a*s-c*n)*2),Wu(e,t,r),e}function G1(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Yu(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],u=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+u*u),e}function V1(e,t){let r=new Z(3);Yu(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,u=t[5]*s,f=t[6]*o,h=t[8]*n,d=t[9]*s,p=t[10]*o,A=i+u+p,g=0;return A>0?(g=Math.sqrt(A+1)*2,e[3]=.25*g,e[0]=(f-d)/g,e[1]=(h-c)/g,e[2]=(a-l)/g):i>u&&i>p?(g=Math.sqrt(1+i-u-p)*2,e[3]=(f-d)/g,e[0]=.25*g,e[1]=(a+l)/g,e[2]=(h+c)/g):u>p?(g=Math.sqrt(1+u-i-p)*2,e[3]=(h-c)/g,e[0]=(a+l)/g,e[1]=.25*g,e[2]=(f+d)/g):(g=Math.sqrt(1+p-i-u)*2,e[3]=(a-l)/g,e[0]=(h+c)/g,e[1]=(f+d)/g,e[2]=.25*g),e}function H1(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],u=n[8],f=n[9],h=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(u*u+f*f+h*h);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,b=u*d,w=f*p,C=h*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 z1(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=t[3],c=s+s,l=o+o,u=i+i,f=s*c,h=s*l,d=s*u,p=o*l,A=o*u,g=i*u,y=a*c,E=a*l,_=a*u,B=n[0],S=n[1],b=n[2];return e[0]=(1-(p+g))*B,e[1]=(h+_)*B,e[2]=(d-E)*B,e[3]=0,e[4]=(h-_)*S,e[5]=(1-(f+g))*S,e[6]=(A+y)*S,e[7]=0,e[8]=(d+E)*b,e[9]=(A-y)*b,e[10]=(1-(f+p))*b,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function k1(e,t,r,n,s){let o=t[0],i=t[1],a=t[2],c=t[3],l=o+o,u=i+i,f=a+a,h=o*l,d=o*u,p=o*f,A=i*u,g=i*f,y=a*f,E=c*l,_=c*u,B=c*f,S=n[0],b=n[1],w=n[2],C=s[0],T=s[1],m=s[2],M=(1-(A+y))*S,F=(d+B)*S,R=(p-_)*S,L=(d-B)*b,D=(1-(h+y))*b,X=(g+E)*b,H=(p+_)*w,Q=(g-E)*w,j=(1-(h+A))*w;return e[0]=M,e[1]=F,e[2]=R,e[3]=0,e[4]=L,e[5]=D,e[6]=X,e[7]=0,e[8]=H,e[9]=Q,e[10]=j,e[11]=0,e[12]=r[0]+C-(M*C+L*T+H*m),e[13]=r[1]+T-(F*C+D*T+Q*m),e[14]=r[2]+m-(R*C+X*T+j*m),e[15]=1,e}function ji(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,u=n*i,f=n*a,h=s*i,d=s*a,p=s*c,A=o*i,g=o*a,y=o*c;return e[0]=1-f-p,e[1]=u+y,e[2]=h-g,e[3]=0,e[4]=u-y,e[5]=1-l-p,e[6]=d+A,e[7]=0,e[8]=h+g,e[9]=d-A,e[10]=1-l-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Xi(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 Ku(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 Wi=Ku;function J1(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 q1(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 Qu(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 Yi=Qu;function j1(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 Ki(e,t,r,n){let s,o,i,a,c,l,u,f,h,d,p=t[0],A=t[1],g=t[2],y=n[0],E=n[1],_=n[2],B=r[0],S=r[1],b=r[2];return Math.abs(p-B)<1e-6&&Math.abs(A-S)<1e-6&&Math.abs(g-b)<1e-6?Xu(e):(f=p-B,h=A-S,d=g-b,s=1/Math.sqrt(f*f+h*h+d*d),f*=s,h*=s,d*=s,o=E*d-_*h,i=_*f-y*d,a=y*h-E*f,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=h*a-d*i,l=d*o-f*a,u=f*i-h*o,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]=o,e[1]=c,e[2]=f,e[3]=0,e[4]=i,e[5]=l,e[6]=h,e[7]=0,e[8]=a,e[9]=u,e[10]=d,e[11]=0,e[12]=-(o*p+i*A+a*g),e[13]=-(c*p+l*A+u*g),e[14]=-(f*p+h*A+d*g),e[15]=1,e)}function X1(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=n[0],c=n[1],l=n[2],u=s-r[0],f=o-r[1],h=i-r[2],d=u*u+f*f+h*h;d>0&&(d=1/Math.sqrt(d),u*=d,f*=d,h*=d);let p=c*h-l*f,A=l*u-a*h,g=a*f-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]=f*g-h*A,e[5]=h*p-u*g,e[6]=u*A-f*p,e[7]=0,e[8]=u,e[9]=f,e[10]=h,e[11]=0,e[12]=s,e[13]=o,e[14]=i,e[15]=1,e}function W1(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 Y1(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 Zu(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 Q1(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 Z1(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 $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]}function tx(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],u=e[8],f=e[9],h=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],F=t[10],R=t[11],L=t[12],D=t[13],X=t[14],H=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-b)<=1e-6*Math.max(1,Math.abs(i),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(f-M)<=1e-6*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(h-F)<=1e-6*Math.max(1,Math.abs(h),Math.abs(F))&&Math.abs(d-R)<=1e-6*Math.max(1,Math.abs(d),Math.abs(R))&&Math.abs(p-L)<=1e-6*Math.max(1,Math.abs(p),Math.abs(L))&&Math.abs(A-D)<=1e-6*Math.max(1,Math.abs(A),Math.abs(D))&&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 ex=an,rx=Zu;function nx(){let e=new Z(4);return Z!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function $u(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 tf(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 ef(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 rf(e){let t=e[0],r=e[1],n=e[2],s=e[3];return t*t+r*r+n*n+s*s}function nf(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 sf(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function of(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 af(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 cf(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],u=l*n+a*o-c*s,f=l*s+c*n-i*o,h=l*o+i*s-a*n,d=-i*n-a*s-c*o;return e[0]=u*l+d*-i+f*-c-h*-a,e[1]=f*l+d*-a+h*-i-u*-c,e[2]=h*l+d*-c+u*-a-f*-i,e[3]=t[3],e}var xw=function(){let e=nx();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 $i;(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"})($i||($i={}));var ox=45*Math.PI/180,ix=1,Qi=.1,Zi=500,ax=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),P=class extends gr{static get IDENTITY(){return lx()}static get ZERO(){return cx()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return $i}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,u,f,h,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]=u,this[10]=f,this[11]=h,this[12]=d,this[13]=p,this[14]=A,this[15]=g,this.check()}setRowMajor(t,r,n,s,o,i,a,c,l,u,f,h,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]=u,this[7]=p,this[8]=n,this[9]=a,this[10]=f,this[11]=A,this[12]=s,this[13]=c,this[14]=h,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(ax)}fromObject(t){return this.check()}fromQuaternion(t){return ji(this,t),this.check()}frustum(t){let{left:r,right:n,bottom:s,top:o,near:i=Qi,far:a=Zi}=t;return a===1/0?ux(this,r,n,s,o,i):Xi(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 Ki(this,r,n,s),this.check()}ortho(t){let{left:r,right:n,bottom:s,top:o,near:i=Qi,far:a=Zi}=t;return Yi(this,r,n,s,o,i,a),this.check()}orthographic(t){let{fovy:r=ox,aspect:n=ix,focalDistance:s=1,near:o=Qi,far:i=Zi}=t;lf(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 lf(r),Wi(this,r,n,s,o),this.check()}determinant(){return Gi(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 vi(this,this),this.check()}invert(){return Ui(this,this),this.check()}multiplyLeft(t){return an(this,t,this),this.check()}multiplyRight(t){return an(this,this,t),this.check()}rotateX(t){return ki(this,this,t),this.check()}rotateY(t){return Ji(this,this,t),this.check()}rotateZ(t){return qi(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return zi(this,this,t,r),this.check()}scale(t){return Hi(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Vi(this,this,t),this.check()}transform(t,r){return t.length===4?(r=af(r||[-0,-0,-0,-0],t,this),ye(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 ye(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=hs(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return ye(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])}},Ts,_s;function cx(){return Ts||(Ts=new P([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Ts)),Ts}function lx(){return _s||(_s=new P,Object.freeze(_s)),_s}function lf(e){if(e>Math.PI*2)throw Error("expected radians")}function ux(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),u=-1,f=-1,h=-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]=u,e[11]=f,e[12]=0,e[13]=0,e[14]=h,e[15]=0,e}function uf(){let e=new Z(4);return Z!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function ff(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function ta(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 ea(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],u=r[3];return e[0]=n*u+i*a+s*l-o*c,e[1]=s*u+i*c+o*a-n*l,e[2]=o*u+i*l+n*c-s*a,e[3]=i*u-n*a-s*c-o*l,e}function hf(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 df(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 pf(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 mf(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 ln(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=t[3],c=r[0],l=r[1],u=r[2],f=r[3],h,d,p,A,g;return h=s*c+o*l+i*u+a*f,h<0&&(h=-h,c=-c,l=-l,u=-u,f=-f),1-h>1e-6?(d=Math.acos(h),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*u,e[3]=p*a+A*f,e}function gf(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 Af(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function ra(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 xf=$u;var yf=tf,Tf=sf,_f=of,Ef=ef;var Bf=rf;var Cf=nf;var Sf=function(){let e=ps(),t=ms(1,0,0),r=ms(0,1,0);return function(n,s,o){let i=nn(s,o);return i<-.999999?(Ge(e,t,s),Ri(e)<1e-6&&Ge(e,r,s),Mi(e,e),ta(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,Cf(n,n))}}(),Rw=function(){let e=uf(),t=uf();return function(r,n,s,o,i,a){return ln(e,n,i,a),ln(t,s,o,a),ln(r,e,t,2*a*(1-a)),r}}(),Pw=function(){let e=Vu();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],Cf(t,ra(t,e))}}();var fx=[0,0,0,1],Wt=class extends xe{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 ra(this,t),this.check()}fromAxisRotation(t,r){return ta(this,t,r),this.check()}identity(){return ff(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]=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 Ef(this)}lengthSquared(){return Bf(this)}dot(t){return Tf(this,t)}rotationTo(t,r){return Sf(this,t,r),this.check()}add(t){return xf(this,this,t),this.check()}calculateW(){return mf(this,this),this.check()}conjugate(){return Af(this,this),this.check()}invert(){return gf(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(_f(this,t,r,n),this.check())}multiplyRight(t){return ea(this,this,t),this.check()}multiplyLeft(t){return ea(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 hf(this,this,t),this.check()}rotateY(t){return df(this,this,t),this.check()}rotateZ(t){return pf(this,this,t),this.check()}scale(t){return yf(this,this,t),this.check()}slerp(t,r,n){let s,o,i;switch(arguments.length){case 1:({start:s=fx,target:o,ratio:i}=t);break;case 2:s=this,o=t,i=r;break;default:s=t,o=r,i=n}return ln(this,s,o,i),this.check()}transformVector4(t,r=new mr){return cf(r,t,this),ye(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 Mt={};ut(Mt,{EPSILON1:()=>hx,EPSILON10:()=>_x,EPSILON11:()=>Ex,EPSILON12:()=>Bx,EPSILON13:()=>Cx,EPSILON14:()=>Sx,EPSILON15:()=>bx,EPSILON16:()=>Mx,EPSILON17:()=>Ix,EPSILON18:()=>wx,EPSILON19:()=>Lx,EPSILON2:()=>dx,EPSILON20:()=>Fx,EPSILON3:()=>px,EPSILON4:()=>mx,EPSILON5:()=>gx,EPSILON6:()=>Ax,EPSILON7:()=>xx,EPSILON8:()=>yx,EPSILON9:()=>Tx,PI_OVER_FOUR:()=>Px,PI_OVER_SIX:()=>Ox,PI_OVER_TWO:()=>Rx,TWO_PI:()=>Nx});var hx=.1,dx=.01,px=.001,mx=1e-4,gx=1e-5,Ax=1e-6,xx=1e-7,yx=1e-8,Tx=1e-9,_x=1e-10,Ex=1e-11,Bx=1e-12,Cx=1e-13,Sx=1e-14,bx=1e-15,Mx=1e-16,Ix=1e-17,wx=1e-18,Lx=1e-19,Fx=1e-20,Rx=Math.PI/2,Px=Math.PI/4,Ox=Math.PI/6,Nx=Math.PI*2;function Es(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var vt=Math.PI,wf=vt/4,bf=vt/180,Mf=180/vt,Bs=512;function ee(e){let[t,r]=e;Es(Number.isFinite(t)),Es(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let n=t*bf,s=r*bf,o=Bs*(n+vt)/(2*vt),i=Bs*(vt+Math.log(Math.tan(wf+s*.5)))/(2*vt);return[o,i]}function re(e){let[t,r]=e,n=t/Bs*(2*vt)-vt,s=2*(Math.atan(Math.exp(r/Bs*(2*vt)-vt))-wf);return[n*Mf,s*Mf]}var gL=Math.PI/180;var Ff=6378137*Math.PI;function na(e){let t=ee(e);return t[0]=(t[0]/256-1)*Ff,t[1]=(t[1]/256-1)*Ff,t}var Qx={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)}},Ar=class extends ze.CompositeLayer{get isLoaded(){return this.state?.loadCounter===0&&super.isLoaded}shouldUpdateState(){return!0}initializeState(){this.state._nextRequestId=0,this.state.lastRequestId=-1,this.state.loadCounter=0}updateState({changeFlags: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,ze._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 Rf.BitmapLayer({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:n.srs==="EPSG:4326"?ze.COORDINATE_SYSTEM.LNGLAT:ze.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 bt)return t.data;if(typeof t.data=="string")return Ei({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 u={width:i,height:a,boundingBox:[[o[0],o[1]],[o[2],o[3]]],layers:n,crs:l};if(l==="EPSG:3857"){let f=na([o[0],o[1]]),h=na([o[2],o[3]]);u.boundingBox=[f,h]}try{this.state.loadCounter++,this.props.onImageLoadStart(c);let f=await this.state.imageSource.getImage(u);this.state.lastRequestId<c&&(this.getCurrentLayer()?.props.onImageLoad(c),this.setState({image:f,bounds:o,lastRequestParameters:u,lastRequestId:c}))}catch(f){this.raiseError(f,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(c,f)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(t,r=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>t(),r)}};Ar.layerName="WMSLayer";Ar.defaultProps=Qx;var Pf=N(Ot(),1),Zx={getHeight:{type:"accessor",value:0},greatCircle:!0},un=class extends Pf.ArcLayer{};un.layerName="GreatCircleLayer";un.defaultProps=Zx;var Of=un;var Nf=N(Nt(),1),sa=N(Ot(),1),$x={...sa.PolygonLayer.defaultProps},fn=class extends Nf.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:u,lineMiterLimit:f,lineDashJustified:h,getElevation:d,getFillColor:p,getLineColor:A,getLineWidth:g}=this.props,{updateTriggers:y,material:E,transitions:_}=this.props,B=this.getSubLayerClass("cell",sa.PolygonLayer),{updateTriggers:S,...b}=this.indexToBounds()||{};return new B({filled:s,wireframe:n,extruded:r,elevationScale:t,stroked:o,lineWidthUnits:i,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:u,lineMiterLimit:f,lineDashJustified:h,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)}};fn.layerName="GeoCellLayer";fn.defaultProps=$x;var Yt=fn;var Cs=N(oa(),1),ty=3,ey=30,ry=2*ey+1,vf=180/Math.PI;function Gf(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function Uf(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Vf(e){return[Uf(e[0]),Uf(e[1])]}function Hf(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 zf([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*vf,n*vf]}function kf(e){let t=Cs.default.fromString(e,!0,10).toString(2);for(;t.length<ty+ry;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),s=t.substring(3,r),o=s.length/2,i=Cs.default.fromString(n,!0,2).toString(10),a=Cs.default.fromString(s,!0,2).toString(4);for(;a.length<o;)a="0"+a;return`${i}/${a}`}function ny(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 Jf(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,u=0;c==="1"?u=1:c==="2"?(l=1,u=1):c==="3"&&(l=1);let f=Math.pow(2,i-1);ny(f,o,l,u),o[0]+=f*l,o[1]+=f*u}if(r%2===1){let a=o[0];o[0]=o[1],o[1]=a}return{face:r,ij:o,level:i}}var qf=N(oa(),1);function sy(e){let t=e.padEnd(16,"0");return qf.default.fromString(t,16)}var oy=100;function iy({face:e,ij:t,level:r}){let n=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(oy*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),u=n[c+1],f=(u[0]-l[0])/s,h=(u[1]-l[1])/s;for(let d=0;d<s;d++){l[0]+=f,l[1]+=h;let p=Gf(t,r,l),A=Vf(p),g=Hf(e,A),y=zf(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 ay(e){if(typeof e=="string"){if(e.indexOf("/")>0)return e;e=sy(e)}return kf(e.toString())}function jf(e){let t=ay(e),r=Jf(t);return iy(r)}var cy={getS2Token:{type:"accessor",value:e=>e.token}},dn=class extends Yt{indexToBounds(){let{data:t,getS2Token:r}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(n,s)=>jf(r(n,s))}}};dn.layerName="S2Layer";dn.defaultProps=cy;var Xf=dn;var ia=512;function ly(e,t){let r=0,n=0,s=1<<e.length,o=s/ia;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,ia-n/o],[(r+t)/o,ia-(n+t)/o]]}function Wf(e,t=1){let[r,n]=ly(e,t),[s,o]=re(r),[i,a]=re(n);return[i,o,i,a,s,a,s,o,i,o]}var uy={getQuadkey:{type:"accessor",value:e=>e.quadkey}},pn=class extends Yt{indexToBounds(){let{data:t,extruded:r,getQuadkey:n}=this.props,s=r?.99:1;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(o,i)=>Wf(n(o,i),s),updateTriggers:{getPolygon:s}}}};pn.layerName="QuadkeyLayer";pn.defaultProps=uy;var Yf=pn;var Fs=N(Nt(),1),dh=N(Ot(),1);var ke=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,u=this._loaderId;this._abortController=new AbortController;let{signal:f}=this._abortController,h=await r.scheduleRequest(this,A=>A.isSelected?1:-1);if(!h){this._isCancelled=!0;return}if(this._isCancelled){h.done();return}let d=null,p;try{d=await t({index:o,id:i,bbox:a,userData:c,zoom:l,signal:f})}catch(A){p=A||!0}finally{h.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):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 An=N(Nt(),1);var rt={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var Kf=new x,fy=new x,_e=class{constructor(t=[0,0,0],r=[0,0,0],n){n=n||Kf.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 _e(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=fy.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?rt.INSIDE:o+s<0?rt.OUTSIDE:rt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=Kf.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 mn=new x,Qf=new x,It=class{constructor(t=[0,0,0],r=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=mn.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 It(this.center,this.radius)}union(t){let r=this.center,n=this.radius,s=t.center,o=t.radius,i=mn.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 Qf.copy(i).scale((-n+c)/a).add(r),this.center.copy(Qf),this.radius=c,this}expand(t){let n=mn.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=cn.getScaling(mn,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=mn.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?rt.OUTSIDE:o<n?rt.INTERSECTING:rt.INSIDE}};var hy=new x,dy=new x,Ss=new x,bs=new x,Ms=new x,py=new x,my=new x,ne={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Ut=class{constructor(t=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){this.center=new x().from(t),this.halfAxes=new z(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 Wt().fromMatrix3(new z([...s,...o,...i]))}fromCenterHalfSizeQuaternion(t,r,n){let s=new Wt(n),o=new z().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 Ut(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new It){let r=this.halfAxes,n=r.getColumn(0,Ss),s=r.getColumn(1,bs),o=r.getColumn(2,Ms),i=hy.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[ne.COLUMN0ROW0]+i*s[ne.COLUMN0ROW1]+a*s[ne.COLUMN0ROW2])+Math.abs(o*s[ne.COLUMN1ROW0]+i*s[ne.COLUMN1ROW1]+a*s[ne.COLUMN1ROW2])+Math.abs(o*s[ne.COLUMN2ROW0]+i*s[ne.COLUMN2ROW1]+a*s[ne.COLUMN2ROW2]),l=n.dot(r)+t.distance;return l<=-c?rt.OUTSIDE:l>=c?rt.INSIDE:rt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=dy.from(t).subtract(this.center),n=this.halfAxes,s=n.getColumn(0,Ss),o=n.getColumn(1,bs),i=n.getColumn(2,Ms),a=s.magnitude(),c=o.magnitude(),l=i.magnitude();s.normalize(),o.normalize(),i.normalize();let u=0,f;return f=Math.abs(r.dot(s))-a,f>0&&(u+=f*f),f=Math.abs(r.dot(o))-c,f>0&&(u+=f*f),f=Math.abs(r.dot(i))-l,f>0&&(u+=f*f),u}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,Ss),l=a.getColumn(1,bs),u=a.getColumn(2,Ms),f=py.copy(c).add(l).add(u).add(i),h=my.copy(f).subtract(t),d=r.dot(h);return s=Math.min(d,s),o=Math.max(d,o),f.copy(i).add(c).add(l).subtract(u),h.copy(f).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),f.copy(i).add(c).subtract(l).add(u),h.copy(f).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),f.copy(i).add(c).subtract(l).subtract(u),h.copy(f).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(f).subtract(c).add(l).add(u),h.copy(f).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(f).subtract(c).add(l).subtract(u),h.copy(f).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(f).subtract(c).subtract(l).add(u),h.copy(f).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(f).subtract(c).subtract(l).subtract(u),h.copy(f).subtract(t),d=r.dot(h),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,Ss);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,bs);n.transformAsPoint(t);let s=this.halfAxes.getColumn(2,Ms);return s.transformAsPoint(t),this.halfAxes=new z([...r,...n,...s]),this}getTransform(){throw new Error("not implemented")}};var Zf=new x,$f=new x,ct=class{constructor(t=[0,0,1],r=0){this.normal=new x,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return at(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=Zf.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),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 r=$f.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=Zf.from(t),s=this.getPointDistance(n),o=$f.copy(this.normal).scale(s);return n.subtract(o).to(r)}};var th=[new x([1,0,0]),new x([0,1,0]),new x([0,0,1])],eh=new x,gy=new x,ot=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*th.length;let r=t.center,n=t.radius,s=0;for(let o of th){let i=this.planes[s],a=this.planes[s+1];i||(i=this.planes[s]=new ct),a||(a=this.planes[s+1]=new ct);let c=eh.copy(o).scale(-n).add(r);i.fromPointNormal(c,o);let l=eh.copy(o).scale(n).add(r),u=gy.copy(o).negate();a.fromPointNormal(l,u),s+=2}return this}computeVisibility(t){let r=rt.INSIDE;for(let n of this.planes)switch(t.intersectPlane(n)){case rt.OUTSIDE:return rt.OUTSIDE;case rt.INTERSECTING:r=rt.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(at(Number.isFinite(r),"parentPlaneMask is required."),r===ot.MASK_OUTSIDE||r===ot.MASK_INSIDE)return r;let n=ot.MASK_INSIDE,s=this.planes;for(let 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===rt.OUTSIDE)return ot.MASK_OUTSIDE;c===rt.INTERSECTING&&(n|=i)}return n}};ot.MASK_OUTSIDE=4294967295;ot.MASK_INSIDE=0;ot.MASK_INDETERMINATE=2147483647;var OF=new x,NF=new x,DF=new x,vF=new x,UF=new x;var JF=new x,qF=new x,jF=new x,XF=new x,WF=new x,YF=new x,KF=new x,QF=new x,ZF=new x,$F=new x,tR=new x,eR=new x;var Kt=new z,xy=new z,yy=new z,Is=new z,rh=new z;function la(e,t={}){let r=Mt.EPSILON20,n=10,s=0,o=0,i=xy,a=yy;i.identity(),a.copy(e);let c=r*Ty(a);for(;o<n&&_y(a)>c;)Ey(a,Is),rh.copy(Is).transpose(),a.multiplyRight(Is),a.multiplyLeft(rh),i.multiplyRight(Is),++s>2&&(++o,s=0);return t.unitary=i.toTarget(t.unitary),t.diagonal=a.toTarget(t.diagonal),t}function Ty(e){let t=0;for(let r=0;r<9;++r){let n=e[r];t+=n*n}return Math.sqrt(t)}var aa=[1,0,0],ca=[2,2,1];function _y(e){let t=0;for(let r=0;r<3;++r){let n=e[Kt.getElementIndex(ca[r],aa[r])];t+=2*n*n}return Math.sqrt(t)}function Ey(e,t){let r=Mt.EPSILON15,n=0,s=1;for(let l=0;l<3;++l){let u=Math.abs(e[Kt.getElementIndex(ca[l],aa[l])]);u>n&&(s=l,n=u)}let o=aa[s],i=ca[s],a=1,c=0;if(Math.abs(e[Kt.getElementIndex(i,o)])>r){let l=e[Kt.getElementIndex(i,i)],u=e[Kt.getElementIndex(o,o)],f=e[Kt.getElementIndex(i,o)],h=(l-u)/2/f,d;h<0?d=-1/(-h+Math.sqrt(1+h*h)):d=1/(h+Math.sqrt(1+h*h)),a=1/Math.sqrt(1+d*d),c=d*a}return z.IDENTITY.to(t),t[Kt.getElementIndex(o,o)]=t[Kt.getElementIndex(i,i)]=a,t[Kt.getElementIndex(i,o)]=c,t[Kt.getElementIndex(o,i)]=-c,t}var Ee=new x,By=new x,Cy=new x,Sy=new x,by=new x,My=new z,Iy={diagonal:new z,unitary:new z};function gn(e,t=new Ut){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 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,u=0;for(let T of e){let m=Ee.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,u+=m.z*m.z}o*=s,i*=s,a*=s,c*=s,l*=s,u*=s;let f=My;f[0]=o,f[1]=i,f[2]=a,f[3]=i,f[4]=c,f[5]=l,f[6]=a,f[7]=l,f[8]=u;let{unitary:h}=la(f,Iy),d=t.halfAxes.copy(h),p=d.getColumn(0,Cy),A=d.getColumn(1,Sy),g=d.getColumn(2,by),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)Ee.copy(T),y=Math.max(Ee.dot(p),y),E=Math.max(Ee.dot(A),E),_=Math.max(Ee.dot(g),_),B=Math.min(Ee.dot(p),B),S=Math.min(Ee.dot(A),S),b=Math.min(Ee.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=By.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 xr=512,nh=3,sh=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],oh=sh.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),wy=oh.concat([[.25,.5],[.75,.5]]),Be=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 Be(t,r,n),new Be(t,r+1,n),new Be(t+1,r,n),new Be(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,u=this.getBoundingVolume(s,c,l);if(a&&!this.insideBounds(a)||n.computeVisibility(u)<0)return!1;if(!this.childVisible){let{z:h}=this;if(h<i&&h>=o){let d=u.distanceTo(r.cameraPosition)*r.scale/r.height;h+=Math.floor(Math.log2(d))}if(h>=i)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let h of this.children)h.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=xr/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?wy:this.z<2?oh:sh,l=[];for(let u of c){let f=ws(this.x+u[0],this.y+u[1],this.z);f[2]=t[0],l.push(n(f)),t[0]!==t[1]&&(f[2]=t[1],l.push(n(f)))}return gn(l)}let s=Math.pow(2,this.z),o=xr/s,i=this.x*o+r*xr,a=xr-(this.y+1)*o;return new _e([i,a,t[0]],[i+o,a+o,t[1]])}};function ih(e,t,r,n){let s=e instanceof An._GlobeViewport&&e.resolution?e.projectPosition:null,o=Object.values(e.getFrustumPlanes()).map(({normal:d,distance:p})=>new ct(d.clone().negate(),p)),i=new ot(o),a=e.distanceScales.unitsPerMeter[2],c=r&&r[0]*a||0,l=r&&r[1]*a||0,u=e instanceof An.WebMercatorViewport&&e.pitch<=60?t:0;if(n){let[d,p,A,g]=n,y=ee([d,g]),E=ee([A,p]);n=[y[0],xr-y[1],E[0],xr-E[1]]}let f=new Be(0,0,0),h={viewport:e,project:s,cullingVolume:i,elevationBounds:[c,l],minZ:u,maxZ:t,bounds:n,offset:0};if(f.update(h),e instanceof An.WebMercatorViewport&&e.subViewports&&e.subViewports.length>1){for(h.offset=-1;f.update(h)&&!(--h.offset<-nh););for(h.offset=1;f.update(h)&&!(++h.offset>nh););}return f.getSelected()}var se=512,Ly=[-1/0,-1/0,1/0,1/0],Ce={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 ch(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 Fy(e){return Math.abs(e.split("").reduce((t,r)=>(t<<5)-t+r.charCodeAt(0)|0,0))}function Qt(e,t){if(!e||!e.length)return null;let{index:r,id:n}=t;if(Array.isArray(e)){let o=Fy(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 Ry(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 lh({viewport:e,z:t,cullRect:r}){return(e.subViewports||[e]).map(s=>ua(s,t||0,r))}function ua(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},u=e.unproject([o,i],l),f=e.unproject([o+a,i],l),h=e.unproject([o,i+c],l),d=e.unproject([o+a,i+c],l);return[Math.min(u[0],f[0],h[0],d[0]),Math.min(u[1],f[1],h[1],d[1]),Math.max(u[0],f[0],h[0],d[0]),Math.max(u[1],f[1],h[1],d[1])]}let n=ua(e,t[0],r),s=ua(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 Py(e,t,r){return r?ch(e,r).map(s=>s*t/se):e.map(n=>n*t/se)}function fa(e,t){return Math.pow(2,e)*se/t}function ws(e,t,r){let n=fa(r,se),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 ah(e,t,r,n){let s=fa(r,n);return[e/s*se,t/s*se]}function ha(e,t,r,n,s=se){if(e.isGeospatial){let[l,u]=ws(t,r,n),[f,h]=ws(t+1,r+1,n);return{west:l,north:u,east:f,south:h}}let[o,i]=ah(t,r,n,s),[a,c]=ah(t+1,r+1,n,s);return{left:o,top:i,right:a,bottom:c}}function Oy(e,t,r,n,s){let o=Ry(e,null,n),i=fa(t,r),[a,c,l,u]=Py(o,i,s),f=[];for(let h=Math.floor(a);h<l;h++)for(let d=Math.floor(c);d<u;d++)f.push({x:h,y:d,z:t});return f}function da({viewport:e,maxZoom:t,minZoom:r,zRange:n,extent:s,tileSize:o=se,modelMatrix:i,modelMatrixInverse:a,zoomOffset:c=0}){let l=e.isGeospatial?Math.round(e.zoom+Math.log2(se/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 u=s;return i&&a&&s&&!e.isGeospatial&&(u=ch(s,i)),e.isGeospatial?ih(e,l,n,s):Oy(e,l,o,u||Ly,a)}function pa(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 uh(e){let t={},r;return n=>{for(let s in n)if(!Ny(n[s],t[s])){r=e(n),t=n;break}return r}}function Ny(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 fh=1,Ls=2,Dy="never",vy="no-overlap",xn="best-available",Uy=5,Gy={[xn]:Hy,[vy]:zy,[Dy]:()=>{}},Vy={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:()=>{}},Je=class{constructor(t){this._getCullBounds=uh(lh),this.opts={...Vy,...t},this.setOptions(this.opts),this.onTileLoad=r=>{this.opts.onTileLoad?.(r),this.opts.maxCacheByteSize!=null&&(this._cacheByteSize+=r.byteLength,this._resizeCache())},this._requestScheduler=new pe({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 P,this._modelMatrixInverse=new P}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 P(n):new P,o=!s.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!mt(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 u=Math.min(s.top,s.bottom),f=Math.max(s.top,s.bottom);l=s.left<a&&s.right>o&&u<c&&f>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 da({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:ha(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||xn,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:Gy[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!=null?1/0:Uy*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!=null?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 ke(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 Hy(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!hh(t)&&ga(t);for(let t of e)t.isVisible=Boolean(t.state&Ls)}function zy(e){for(let r of e)r.state=0;for(let r of e)r.isSelected&&hh(r);let t=Array.from(e).sort((r,n)=>r.zoom-n.zoom);for(let r of t)if(r.isVisible=Boolean(r.state&Ls),r.children&&(r.isVisible||r.state&fh))for(let n of r.children)n.state=fh;else r.isSelected&&ga(r)}function hh(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=Ls,!0;t=t.parent}return!1}function ga(e){for(let t of e.children)t.isLoaded||t.content?t.state|=Ls:ga(t)}var ky={TilesetClass:Je,data:{type:"data",value:[]},dataComparator:Ce.equal,renderSubLayers:{type:"function",value:e=>new dh.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:xn,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},yn=class extends Fs.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,debounceTime:l,zoomOffset:u}=this.props;return{maxCacheSize:r,maxCacheByteSize:n,maxZoom:i,minZoom:a,tileSize:t,refinementStrategy:s,extent:o,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: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)?Qt(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(t){let r=t.sourceLayer,n=r.props.tile,s=t.info;return s.picked&&(s.tile=n),s.sourceTile=n,s.sourceTileSubLayer=r,s}_updateAutoHighlight(t){t.sourceTileSubLayer.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,Fs._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)}};yn.defaultProps=ky;yn.layerName="TileLayer";var qe=yn;var ph=N(Ot(),1),Jy={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:e=>e.timestamps}},Tn=class extends ph.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)}},xn=vs;(()=>{vs.layerName="TripsLayer"})(),(()=>{vs.defaultProps=qy})();var bh=N(Us(),1),Mh=N(Dt(),1);var Ft=N(Us(),1),Vs=N(Dt(),1),Tn=N(Nt(),1);var yn=N(Us(),1);function Gs(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 jy(e,t,r){let[n,s]=(0,yn.cellToLatLng)(e),o=t.length;Gs(t,s);let i=t[0]===t[o-1]?o-1:o;for(let a=0;a<i;a++)t[a][0]=xe(s,t[a][0],r),t[a][1]=xe(n,t[a][1],r)}function Ch(e,t,r){let n=e(t,r),[s,o]=(0,yn.cellToLatLng)(n);return[o,s]}function Ia(e,t=1){let r=(0,yn.cellToBoundary)(e,!0);return t!==1?jy(e,r,t):Gs(r),r}function Sh(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 Xy=10;function Wy(e,t){let r;return e==null?r=t:typeof e=="object"?r={...e,coverage:t}:r={getHexagon:e,coverage:t},r}var Yy={...Tn.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 Vs.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,Vs.createIterable)(this.props.data);for(let i of s){o.index++;let a=this.props.getHexagon(i,o),c=(0,Ft.getResolution)(a);if(t<0){if(t=c,!this.props.highPrecision)break}else if(t!==c){n=!0;break}if((0,Ft.isPentagon)(a)){r=!0;break}}return{resolution:t,edgeLengthKM:t>=0?(0,Ft.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,Ft.latLngToCell)(t.latitude,t.longitude,r);if(s===o)return;if(s)try{if((0,Ft.gridDistance)(s,o)*n<Xy)return}catch{}let{unitsPerMeter:i}=t.distanceScales,a=Ia(o),[c,l]=(0,Ft.cellToLatLng)(o),[u,f]=t.projectFlat([l,c]);a=a.map(h=>{let d=t.projectFlat(h);return[(d[0]-u)/i[0],(d[1]-f)/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:u,lineWidthMaxPixels:f,getFillColor:h,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:u,lineWidthMaxPixels:f,material:r,getElevation:d,getFillColor:h,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",Tn.PolygonLayer),i=this._getForwardProps();return i.updateTriggers.getPolygon=Wy(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 Sh(Ia(l,s))}})}_renderColumnLayer(){let{data:t,getHexagon:r,updateTriggers:n}=this.props,s=this.getSubLayerClass("hexagon-cell",Tn.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:Ch.bind(null,r)})}},qe=xr;(()=>{xr.defaultProps=Yy})(),(()=>{xr.layerName="H3HexagonLayer"})(),(()=>{xr._checkH3Lib=()=>{}})();var Ky={getHexagons:{type:"accessor",value:e=>e.hexagons}},Hs=class extends St{initializeState(){qe._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,Mh.createIterable)(n);for(let c of i){a.index++;let l=s(c,a),u=(0,bh.cellsToMultiPolygon)(l,!0);for(let f of u){for(let h of f)Gs(h);o.push(this.getSubLayerRow({polygon:f},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)}}},_n=Hs;(()=>{Hs.layerName="H3ClusterLayer"})(),(()=>{Hs.defaultProps=Ky})();var cm=N(wa(),1),we=N(Dt(),1),lm=N(Nt(),1),um=N(zs(),1);var Rh=N(Lh(),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 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&&Qy(e,t,s),s}function Qy(e,t,r){if(r.uniforms.pbr_uUnlit=Boolean(t.unlit),t.pbrMetallicRoughness&&Zy(e,t.pbrMetallicRoughness,r),t.normalTexture){En(e,t.normalTexture,"u_NormalSampler","HAS_NORMALMAP",r);let{scale:n=1}=t.normalTexture;r.uniforms.u_NormalScale=n}if(t.occlusionTexture){En(e,t.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP",r);let{strength:n=1}=t.occlusionTexture;r.uniforms.u_OcclusionStrength=n}switch(t.emissiveTexture&&(En(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":Rh.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=Vt.FUNC_ADD,r.glParameters.blendFunc=[Vt.SRC_ALPHA,Vt.ONE_MINUS_SRC_ALPHA,Vt.ONE,Vt.ONE_MINUS_SRC_ALPHA];break}}function Zy(e,t,r){t.baseColorTexture&&En(e,t.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP",r),r.uniforms.u_BaseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&En(e,t.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP",r);let{metallicFactor:n=1,roughnessFactor:s=1}=t;r.uniforms.u_MetallicRoughnessValues=[n,s]}function En(e,t,r,n=null,s){let o=t?.texture?.sampler?.parameters||{},i=t.texture.source.image,a,c={};i.compressed?(a=i,c={[Vt.TEXTURE_MIN_FILTER]:i.data.length>1?Vt.LINEAR_MIPMAP_NEAREST:Vt.LINEAR}):a={data:i};let l=e.createTexture({id:t.uniformName||t.id,parameters:{...o,...c},pixelStore:{[Vt.UNPACK_FLIP_Y_WEBGL]:!1},...a});s.bindings[r]=l,n&&(s.defines[n]=1),s.generatedTextures.push(l)}var Ph="4.2.0-beta.2";var ks={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},Oh;async function Ra(e){mi(e.modules);let t=gi("basis");return t||(Oh||=$y(e),await Oh)}async function $y(e){let t=null,r=null;return[t,r]=await Promise.all([await Xt(ks.TRANSCODER,"textures",e),await Xt(ks.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await tT(t,r)}function tT(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 La;async function Pa(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(La=La||eT(e),await La)}async function eT(e){let t=null,r=null;return[t,r]=await Promise.all([await Xt(ks.ENCODER,"textures",e),await Xt(ks.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await rT(t,r)}function rT(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 je={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919};var nT=["","WEBKIT_","MOZ_"],Nh={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"},Js=null;function Dh(e){if(!Js){e=e||sT()||void 0,Js=new Set;for(let t of nT)for(let r in Nh)if(e&&e.getExtension(`${t}${r}`)){let n=Nh[r];Js.add(n)}}return Js}function sT(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var hP=new Uint8Array([0]);var vh,Uh,Gh,Vh,Hh,zh,kh,Jh;(function(e){e[e.NONE=0]="NONE",e[e.BASISLZ=1]="BASISLZ",e[e.ZSTD=2]="ZSTD",e[e.ZLIB=3]="ZLIB"})(vh||(vh={})),function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(Uh||(Uh={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(Gh||(Gh={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(Vh||(Vh={})),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"}(Hh||(Hh={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(zh||(zh={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(kh||(kh={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(Jh||(Jh={}));var bt=[171,75,84,88,32,50,48,187,13,10,26,10];function qh(e){let t=new Uint8Array(e);return!(t.byteLength<bt.length||t[0]!==bt[0]||t[1]!==bt[1]||t[2]!==bt[2]||t[3]!==bt[3]||t[4]!==bt[4]||t[5]!==bt[5]||t[6]!==bt[6]||t[7]!==bt[7]||t[8]!==bt[8]||t[9]!==bt[9]||t[10]!==bt[10]||t[11]!==bt[11])}var oT={etc1:{basisFormat:0,compressed:!0,format:je.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:je.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:je.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:je.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:je.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:je.COMPRESSED_RGBA_ASTC_4X4_KHR},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};async function Na(e,t){if(t.basis.containerFormat==="auto"){if(qh(e)){let n=await Pa(t);return jh(n.KTX2File,e,t)}let{BasisFile:r}=await Ra(t);return Oa(r,e,t)}switch(t.basis.module){case"encoder":let r=await Pa(t);switch(t.basis.containerFormat){case"ktx2":return jh(r.KTX2File,e,t);case"basis":default:return Oa(r.BasisFile,e,t)}case"transcoder":default:let{BasisFile:n}=await Ra(t);return Oa(n,e,t)}}function Oa(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(iT(n,i,l,r));o.push(c)}return o}finally{n.close(),n.delete()}}function iT(e,t,r,n){let s=e.getImageWidth(t,r),o=e.getImageHeight(t,r),i=e.getHasAlpha(),{compressed:a,format:c,basisFormat:l}=Xh(n,i),u=e.getImageTranscodedSizeInBytes(t,r,l),f=new Uint8Array(u);if(!e.transcodeImage(f,t,r,l,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:o,data:f,compressed:a,format:c,hasAlpha:i}}function jh(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(aT(n,i,r));break}return[o]}finally{n.close(),n.delete()}}function aT(e,t,r){let{alphaFlag:n,height:s,width:o}=e.getImageLevelInfo(t,0,0),{compressed:i,format:a,basisFormat:c}=Xh(r,n),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:o,height:s,data:u,compressed:i,levelSize:l,hasAlpha:n,format:a}}function Xh(e,t){let r=e&&e.basis&&e.basis.format;return r==="auto"&&(r=qs()),typeof r=="object"&&(r=t?r.alpha:r.noAlpha),r=r.toLowerCase(),oT[r]}function qs(){let e=Dh();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 Wh={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:Ph,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"}}},Da={...Wh,parse:Na};var va=`#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:r,trailLength:n,currentTime:s}=this.props;t.uniforms={...t.uniforms,fadeTrail:r,trailLength:n,currentTime:s},super.draw(t)}};Tn.layerName="TripsLayer";Tn.defaultProps=Jy;var mh=Tn;var yh=N(Rs(),1),Th=N(Nt(),1);var wt=N(Rs(),1),Os=N(Nt(),1),En=N(Ot(),1);var _n=N(Rs(),1);function Ps(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 qy(e,t,r){let[n,s]=(0,_n.cellToLatLng)(e),o=t.length;Ps(t,s);let i=t[0]===t[o-1]?o-1:o;for(let a=0;a<i;a++)t[a][0]=Ae(s,t[a][0],r),t[a][1]=Ae(n,t[a][1],r)}function Ah(e,t,r){let n=e(t,r),[s,o]=(0,_n.cellToLatLng)(n);return[o,s]}function Aa(e,t=1){let r=(0,_n.cellToBoundary)(e,!0);return t!==1?qy(e,r,t):Ps(r),r}function xh(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 jy=10;function Xy(e,t){let r;return e==null?r=t:typeof e=="object"?r={...e,coverage:t}:r={getHexagon:e,coverage:t},r}var Wy={...En.PolygonLayer.defaultProps,highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:e=>e.hexagon},extruded:!0},Se=class extends Os.CompositeLayer{initializeState(){Se._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,Os.createIterable)(this.props.data);for(let i of s){o.index++;let a=this.props.getHexagon(i,o),c=(0,wt.getResolution)(a);if(t<0){if(t=c,!this.props.highPrecision)break}else if(t!==c){n=!0;break}if((0,wt.isPentagon)(a)){r=!0;break}}return{resolution:t,edgeLengthKM:t>=0?(0,wt.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,wt.latLngToCell)(t.latitude,t.longitude,r);if(s===o)return;if(s)try{if((0,wt.gridDistance)(s,o)*n<jy)return}catch{}let{unitsPerMeter:i}=t.distanceScales,a=Aa(o),[c,l]=(0,wt.cellToLatLng)(o),[u,f]=t.projectFlat([l,c]);a=a.map(h=>{let d=t.projectFlat(h);return[(d[0]-u)/i[0],(d[1]-f)/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:u,lineWidthMaxPixels:f,getFillColor:h,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:u,lineWidthMaxPixels:f,material:r,getElevation:d,getFillColor:h,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",En.PolygonLayer),i=this._getForwardProps();return i.updateTriggers.getPolygon=Xy(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 xh(Aa(l,s))}})}_renderColumnLayer(){let{data:t,getHexagon:r,updateTriggers:n}=this.props,s=this.getSubLayerClass("hexagon-cell",En.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:Ah.bind(null,r)})}};Se.defaultProps=Wy;Se.layerName="H3HexagonLayer";Se._checkH3Lib=()=>{};var Ns=Se;var Yy={getHexagons:{type:"accessor",value:e=>e.hexagons}},Bn=class extends Yt{initializeState(){Ns._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,Th.createIterable)(n);for(let c of i){a.index++;let l=s(c,a),u=(0,yh.cellsToMultiPolygon)(l,!0);for(let f of u){for(let h of f)Ps(h);o.push(this.getSubLayerRow({polygon:f},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)}}};Bn.layerName="H3ClusterLayer";Bn.defaultProps=Yy;var _h=Bn;var nm=N(xa(),1),we=N(Nt(),1),sm=N(Ot(),1),om=N(Ds(),1);var bh=N(Sh(),1),Gt;(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"})(Gt||(Gt={}));function ya(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&&Qy(e,t.pbrMetallicRoughness,r),t.normalTexture){Cn(e,t.normalTexture,"u_NormalSampler","HAS_NORMALMAP",r);let{scale:n=1}=t.normalTexture;r.uniforms.u_NormalScale=n}if(t.occlusionTexture){Cn(e,t.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP",r);let{strength:n=1}=t.occlusionTexture;r.uniforms.u_OcclusionStrength=n}switch(t.emissiveTexture&&(Cn(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":bh.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),r.parameters.blendColorOperation="add",r.parameters.blendColorSrcFactor="src-alpha",r.parameters.blendColorDstFactor="one-minus-src-alpha",r.parameters.blendAlphaOperation="add",r.parameters.blendAlphaSrcFactor="one",r.parameters.blendAlphaDstFactor="one-minus-src-alpha",r.glParameters.blend=!0,r.glParameters.blendEquation=Gt.FUNC_ADD,r.glParameters.blendFunc=[Gt.SRC_ALPHA,Gt.ONE_MINUS_SRC_ALPHA,Gt.ONE,Gt.ONE_MINUS_SRC_ALPHA];break}}function Qy(e,t,r){t.baseColorTexture&&Cn(e,t.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP",r),r.uniforms.u_BaseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&Cn(e,t.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP",r);let{metallicFactor:n=1,roughnessFactor:s=1}=t;r.uniforms.u_MetallicRoughnessValues=[n,s]}function Cn(e,t,r,n=null,s){let o=t?.texture?.sampler?.parameters||{},i=t.texture.source.image,a,c={};i.compressed?(a=i,c={[Gt.TEXTURE_MIN_FILTER]:i.data.length>1?Gt.LINEAR_MIPMAP_NEAREST:Gt.LINEAR}):a={data:i};let l=e.createTexture({id:t.uniformName||t.id,parameters:{...o,...c},pixelStore:{[Gt.UNPACK_FLIP_Y_WEBGL]:!1},...a});s.bindings[r]=l,n&&(s.defines[n]=1),s.generatedTextures.push(l)}var Mh="4.2.0-beta.2";var vs={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},Ih;async function _a(e){si(e.modules);let t=oi("basis");return t||(Ih||=Zy(e),await Ih)}async function Zy(e){let t=null,r=null;return[t,r]=await Promise.all([await jt(vs.TRANSCODER,"textures",e),await jt(vs.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await $y(t,r)}function $y(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 Ta;async function Ea(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(Ta=Ta||tT(e),await Ta)}async function tT(e){let t=null,r=null;return[t,r]=await Promise.all([await jt(vs.ENCODER,"textures",e),await jt(vs.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await eT(t,r)}function eT(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 je={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919};var rT=["","WEBKIT_","MOZ_"],wh={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"},Us=null;function Lh(e){if(!Us){e=e||nT()||void 0,Us=new Set;for(let t of rT)for(let r in wh)if(e&&e.getExtension(`${t}${r}`)){let n=wh[r];Us.add(n)}}return Us}function nT(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var f3=new Uint8Array([0]);var Fh,Rh,Ph,Oh,Nh,Dh,vh,Uh;(function(e){e[e.NONE=0]="NONE",e[e.BASISLZ=1]="BASISLZ",e[e.ZSTD=2]="ZSTD",e[e.ZLIB=3]="ZLIB"})(Fh||(Fh={})),function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(Rh||(Rh={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(Ph||(Ph={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(Oh||(Oh={})),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"}(Nh||(Nh={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(Dh||(Dh={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(vh||(vh={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(Uh||(Uh={}));var St=[171,75,84,88,32,50,48,187,13,10,26,10];function Gh(e){let t=new Uint8Array(e);return!(t.byteLength<St.length||t[0]!==St[0]||t[1]!==St[1]||t[2]!==St[2]||t[3]!==St[3]||t[4]!==St[4]||t[5]!==St[5]||t[6]!==St[6]||t[7]!==St[7]||t[8]!==St[8]||t[9]!==St[9]||t[10]!==St[10]||t[11]!==St[11])}var sT={etc1:{basisFormat:0,compressed:!0,format:je.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:je.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:je.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:je.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:je.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:je.COMPRESSED_RGBA_ASTC_4X4_KHR},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};async function Ca(e,t){if(t.basis.containerFormat==="auto"){if(Gh(e)){let n=await Ea(t);return Vh(n.KTX2File,e,t)}let{BasisFile:r}=await _a(t);return Ba(r,e,t)}switch(t.basis.module){case"encoder":let r=await Ea(t);switch(t.basis.containerFormat){case"ktx2":return Vh(r.KTX2File,e,t);case"basis":default:return Ba(r.BasisFile,e,t)}case"transcoder":default:let{BasisFile:n}=await _a(t);return Ba(n,e,t)}}function Ba(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(oT(n,i,l,r));o.push(c)}return o}finally{n.close(),n.delete()}}function oT(e,t,r,n){let s=e.getImageWidth(t,r),o=e.getImageHeight(t,r),i=e.getHasAlpha(),{compressed:a,format:c,basisFormat:l}=Hh(n,i),u=e.getImageTranscodedSizeInBytes(t,r,l),f=new Uint8Array(u);if(!e.transcodeImage(f,t,r,l,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:o,data:f,compressed:a,format:c,hasAlpha:i}}function Vh(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(iT(n,i,r));break}return[o]}finally{n.close(),n.delete()}}function iT(e,t,r){let{alphaFlag:n,height:s,width:o}=e.getImageLevelInfo(t,0,0),{compressed:i,format:a,basisFormat:c}=Hh(r,n),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:o,height:s,data:u,compressed:i,levelSize:l,hasAlpha:n,format:a}}function Hh(e,t){let r=e&&e.basis&&e.basis.format;return r==="auto"&&(r=Gs()),typeof r=="object"&&(r=t?r.alpha:r.noAlpha),r=r.toLowerCase(),sT[r]}function Gs(){let e=Lh();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 zh={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:Mh,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"}}},Sa={...zh,parse:Ca};var ba=`#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 aT={lightSources:{}};function Ma(e={}){let{color:t=[0,0,0],intensity:r=1}=e;return t.map(n=>n*r/255)}function cT({ambientLight:e,pointLights:t=[],directionalLights:r=[]}){let n={};return e?n["lighting_uAmbientLight.color"]=Ma(e):n["lighting_uAmbientLight.color"]=[0,0,0],t.forEach((s,o)=>{n[`lighting_uPointLight[${o}].color`]=Ma(s),n[`lighting_uPointLight[${o}].position`]=s.position,n[`lighting_uPointLight[${o}].attenuation`]=s.attenuation||[1,0,0]}),n.lighting_uPointLightCount=t.length,r.forEach((s,o)=>{n[`lighting_uDirectionalLight[${o}].color`]=Ma(s),n[`lighting_uDirectionalLight[${o}].direction`]=s.direction}),n.lighting_uDirectionalLightCount=r.length,n}function kh(e=aT){if("lightSources"in e){let{ambientLight:t,pointLights:r,directionalLights:n}=e.lightSources||{};return t||r&&r.length>0||n&&n.length>0?Object.assign({},cT({ambientLight:t,pointLights:r,directionalLights:n}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in e){let t={pointLights:[],directionalLights:[]};for(let r of e.lights||[])switch(r.type){case"ambient":t.ambientLight=r;break;case"directional":t.directionalLights?.push(r);break;case"point":t.pointLights?.push(r);break;default:}return kh({lightSources:t})}return{}}var Jh={name:"lights",vs:ba,fs:ba,getUniforms:kh,defines:{MAX_LIGHTS:3}};var qh=`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 jh=`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 Ia={name:"pbr",vs:qh,fs:jh,defines:{LIGHTING_FRAGMENT:1},dependencies:[Jh]};var Yh=N(xa(),1),Kh=N(Ds(),1);var Xh=`#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 Wh=`#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 uT(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 fT={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},js=class extends rd.SimpleMeshLayer{getShaders(){let t=super.getShaders();return t.modules.push(Ga),{...t,vs:$h,fs:td}}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 uT(t.attributes),new ed.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})}},Bn=js;(()=>{js.layerName="MeshLayer"})(),(()=>{js.defaultProps=fT})();var fm=N(yr(),1);var ie=6356752314245179e-9,hT={radii:[6378137,6378137,ie],radiiSquared:[6378137*6378137,6378137*6378137,ie*ie],oneOverRadii:[1/6378137,1/6378137,1/ie],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(ie*ie)],maximumRadius:Math.max(6378137,6378137,ie),centerToleranceSquared:.1};function Xs(e){return e}var ZP=new x;function dT(e,t=[],r=Xs){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 sd(e,t=[]){return dT(e,t,Y._cartographicRadians?Xs:Ni)}function pT(e,t,r=Xs){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 od(e,t){return pT(e,t,Y._cartographicRadians?Xs:Di)}var id=1e-14,mT=new x,ad={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]},Cn={east:new x,north:new x,up:new x,west:new x,south:new x,down:new x},gT=new x,AT=new x,xT=new x;function Ha(e,t,r,n,s,o){let i=ad[t]&&ad[t][r];at(i&&(!n||n===i));let a,c,l,u=mT.copy(s);if(mt(u.x,0,id)&&mt(u.y,0,id)){let h=Math.sign(u.z);a=gT.fromArray(Va[t]),t!=="east"&&t!=="west"&&a.scale(h),c=AT.fromArray(Va[r]),r!=="east"&&r!=="west"&&c.scale(h),l=xT.fromArray(Va[n]),n!=="east"&&n!=="west"&&l.scale(h)}else{let{up:h,east:d,north:p}=Cn;d.set(-u.y,u.x,0).normalize(),e.geodeticSurfaceNormal(u,h),p.copy(h).cross(d);let{down:A,west:g,south:y}=Cn;A.copy(h).scale(-1),g.copy(d).scale(-1),y.copy(p).scale(-1),a=Cn[t],c=Cn[r],l=Cn[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]=u.x,o[13]=u.y,o[14]=u.z,o[15]=1,o}var Tr=new x,yT=new x,TT=new x;function cd(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,u=n.y,f=n.z,h=i*i*l*l,d=a*a*u*u,p=c*c*f*f,A=h+d+p,g=Math.sqrt(1/A);if(!Number.isFinite(g))return;let y=yT;if(y.copy(e).scale(g),A<o)return y.to(r);let E=s.x,_=s.y,B=s.z,S=TT;S.set(y.x*E*2,y.y*_*2,y.z*B*2);let b=(1-g)*Tr.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 L=C*C,R=T*T,F=m*m,D=L*C,X=R*T,H=F*m;M=h*L+d*R+p*F-1;let j=-2*(h*D*E+d*X*_+p*H*B);w=M/j}while(Math.abs(M)>It.EPSILON12);return Tr.scale([C,T,m]).to(r)}var Ws=new x,ld=new x,BT=new x,Ht=new x,CT=new x,Ys=new x,v=class{constructor(t=0,r=0,n=0){this.centerToleranceSquared=It.EPSILON1,at(t>=0),at(r>=0),at(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=ld,s=BT,[,,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]){Ys.from(t);let n=this.scaleToGeodeticSurface(Ys,Ht);if(!n)return;let s=this.geodeticSurfaceNormal(n,ld),o=CT;o.copy(Ys).subtract(n);let i=Math.atan2(s.y,s.x),a=Math.asin(s.z),c=Math.sign(He.dot(o,Ys))*He.length(o);return od([i,a,c],r)}eastNorthUpToFixedFrame(t,r=new P){return Ha(this,"east","north","up",t,r)}localFrameToFixedFrame(t,r,n,s,o=new P){return Ha(this,t,r,n,s,o)}geocentricSurfaceNormal(t,r=[0,0,0]){return Ws.from(t).normalize().to(r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=sd(t),s=n[0],o=n[1],i=Math.cos(o);return Ws.set(i*Math.cos(s),i*Math.sin(s),Math.sin(o)).normalize(),Ws.to(r)}geodeticSurfaceNormal(t,r=[0,0,0]){return Ws.from(t).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(t,r){return cd(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){Ht.from(t);let n=Ht.x,s=Ht.y,o=Ht.z,i=this.oneOverRadiiSquared,a=1/Math.sqrt(n*n*i.x+s*s*i.y+o*o*i.z);return Ht.multiplyScalar(a).to(r)}transformPositionToScaledSpace(t,r=[0,0,0]){return Ht.from(t).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(t,r=[0,0,0]){return Ht.from(t).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){at(mt(this.radii.x,this.radii.y,It.EPSILON15)),at(this.radii.z>0),Ht.from(t);let s=Ht.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(s)>=this.radii.z-r))return Ht.set(0,0,s).to(n)}};v.WGS84=new v(6378137,6378137,ie);var Ks=class{item;previous;next;constructor(t,r,n){this.item=t,this.previous=r,this.next=n}};var Qs=class{head=null;tail=null;_length=0;get length(){return this._length}add(t){let r=new Ks(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 Zs=class{_list;_sentinel;_trimTiles;constructor(){this._list=new Qs,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 ud(e,t){G(e),G(t);let{rtcCenter:r,gltfUpAxis:n}=t,{computedTransform:s,boundingVolume:{center:o}}=e,i=new P(s);switch(r&&i.translate(r),n){case"Z":break;case"Y":let f=new P().rotateX(Math.PI/2);i=i.multiplyRight(f);break;case"X":let h=new P().rotateY(-Math.PI/2);i=i.multiplyRight(h);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=v.WGS84.cartesianToCartographic(a,new x),u=v.WGS84.eastNorthUpToFixedFrame(a).invert();t.cartographicModelMatrix=u.multiplyRight(i),t.cartographicOrigin=c,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var fd=new x,za=new x,ka=new ot([new ct,new ct,new ct,new ct,new ct,new ct]);function dd(e,t){let{cameraDirection:r,cameraUp:n,height:s}=e,{metersPerUnit:o}=e.distanceScales,i=$s(e,e.center),a=v.WGS84.eastNorthUpToFixedFrame(i),c=e.unprojectPosition(e.cameraPosition),l=v.WGS84.cartographicToCartesian(c,new x),u=new x(a.transformAsVector(new x(r).scale(o))).normalize(),f=new x(a.transformAsVector(new x(n).scale(o))).normalize();ST(e);let h=e.constructor,{longitude:d,latitude:p,width:A,bearing:g,zoom:y}=e,E=new h({longitude:d,latitude:p,height:s,width:A,bearing:g,zoom:y,pitch:0});return{camera:{position:l,direction:u,up:f},viewport:e,topDownViewport:E,height:s,cullingVolume:ka,frameNumber:t,sseDenominator:1.15}}function pd(e,t,r){if(r===0||e.length<=r)return[e,[]];let n=[],{longitude:s,latitude:o}=t.viewport;for(let[l,u]of e.entries()){let[f,h]=u.header.mbs,d=Math.abs(s-f),p=Math.abs(o-h),A=Math.sqrt(p*p+d*d);n.push([l,A])}let i=n.sort((l,u)=>l[1]-u[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 ST(e){let t=e.getFrustumPlanes(),r=hd(t.near,e.cameraPosition),n=$s(e,r),s=$s(e,e.cameraPosition,za),o=0;ka.planes[o++].fromPointNormal(n,fd.copy(n).subtract(s));for(let i in t){if(i==="near")continue;let a=t[i],c=hd(a,r,za),l=$s(e,c,za);ka.planes[o++].fromPointNormal(l,fd.copy(n).subtract(l))}}function hd(e,t,r=new x){let n=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-n).add(t),r}function $s(e,t,r=new x){let n=e.unprojectPosition(t);return v.WGS84.cartographicToCartesian(n,r)}var bT=6378137,MT=6378137,Ja=6356752314245179e-9,_r=new x;function md(e,t){if(e instanceof Gt){let{halfAxes:r}=e,n=IT(r);return Math.log2(Ja/(n+t[2]))}else if(e instanceof wt){let{radius:r}=e;return Math.log2(Ja/(r+t[2]))}else if(e.width&&e.height){let{width:r,height:n}=e,s=Math.log2(bT/r),o=Math.log2(MT/n);return(s+o)/2}return 1}function qa(e,t,r){v.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(Ja/(n+t[2]))}function gd(e,t,r){let[n,s,o,i]=e;return qa({xmin:n,xmax:o,ymin:s,ymax:i,zmin:0,zmax:0},t,r)}function IT(e){e.getColumn(0,_r);let t=e.getColumn(1),r=e.getColumn(2);return _r.add(t).add(r).len()}var Pd=N(yr(),1);var gt={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 Lt;(function(e){e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh"})(Lt||(Lt={}));var lt;(function(e){e.I3S="I3S",e.TILES3D="TILES3D"})(lt||(lt={}));var ae;(function(e){e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(ae||(ae={}));var Ad={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function _d(e){return e!=null}var ht=new x,to=new x,wT=new x,FT=new x,Xe=new x,xd=new x,yd=new x,Td=new x;function eo(e,t,r){if(G(e,"3D Tile: boundingVolume must be defined"),e.box)return Bd(e.box,t,r);if(e.region)return RT(e.region);if(e.sphere)return LT(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function Ed(e,t){if(e.box)return PT(t);if(e.region){let[r,n,s,o,i,a]=e.region;return[[Ct(r),Ct(n),i],[Ct(s),Ct(o),a]]}if(e.sphere)return OT(t);throw new Error("Unkown boundingVolume type")}function Bd(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),u=new Yt;u.fromArray(e,6);let f=new x([1,0,0]),h=new x([0,1,0]),d=new x([0,0,1]);f.transformByQuaternion(u),f.scale(l[0]),h.transformByQuaternion(u),h.scale(l[1]),d.transformByQuaternion(u),d.scale(l[2]),s=[...f.toArray(),...h.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 z([o[0],o[1],o[2],i[0],i[1],i[2],a[0],a[1],a[2]]);return _d(r)?(r.center=n,r.halfAxes=c,r):new Gt(n,c)}function LT(e,t,r){let n=new x(e[0],e[1],e[2]);t.transform(n,n);let s=t.getScale(to),o=Math.max(Math.max(s[0],s[1]),s[2]),i=e[3]*o;return _d(r)?(r.center=n,r.radius=i,r):new wt(n,i)}function RT(e){let[t,r,n,s,o,i]=e,a=v.WGS84.cartographicToCartesian([Ct(t),Ct(s),o],wT),c=v.WGS84.cartographicToCartesian([Ct(n),Ct(r),i],FT),l=new x().addVectors(a,c).multiplyByScalar(.5);return v.WGS84.cartesianToCartographic(l,Xe),v.WGS84.cartographicToCartesian([Ct(n),Xe[1],Xe[2]],xd),v.WGS84.cartographicToCartesian([Xe[0],Ct(s),Xe[2]],yd),v.WGS84.cartographicToCartesian([Xe[0],Xe[1],i],Td),Bd([...l,...xd.subtract(l),...yd.subtract(l),...Td.subtract(l)],new P)}function PT(e){let t=Cd(),{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++)ht.copy(e.center),ht.add(n),ht.add(s),ht.add(o),Sd(t,ht),o.negate();s.negate()}n.negate()}return t}function OT(e){let t=Cd(),{center:r,radius:n}=e,s=v.WGS84.scaleToGeodeticSurface(r,ht),o;s?o=v.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]){to.copy(c).scale(n);for(let l=0;l<2;l++)ht.copy(r),ht.add(to),Sd(t,ht),to.negate()}return t}function Cd(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function Sd(e,t){v.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 U3=new x,G3=new x,V3=new P,H3=new x,z3=new x,k3=new x;function NT(e,t){let r=e*t;return 1-Math.exp(-(r*r))}function DT(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){let r=e.dynamicScreenSpaceErrorComputedDensity,n=e.dynamicScreenSpaceErrorFactor;return NT(t,r)*n}return 0}function bd(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,u=o*a*(l||1)/(i*c);return u-=DT(n,i),u}var ja=new x,Md=new x,be=new x,Id=new x,vT=new x,Xa=new P,wd=new P;function Fd(e,t){if(e.lodMetricValue===0||isNaN(e.lodMetricValue))return"DIG";let r=2*Wa(e,t);return r<2?"OUT":!e.header.children||r<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}function Wa(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);v.WGS84.cartographicToCartesian(c,ja),Md.copy(ja).subtract(a).normalize(),v.WGS84.eastNorthUpToFixedFrame(a,Xa),wd.copy(Xa).invert(),be.copy(ja).transform(wd);let l=Math.sqrt(be[0]*be[0]+be[1]*be[1]),u=l*l/be[2];Id.copy([be[0],be[1],u]);let h=Id.transform(Xa).subtract(a).normalize(),p=Md.cross(h).normalize().scale(i).add(a),A=v.WGS84.cartesianToCartographic(p),g=r.project([s,n,o]),y=r.project(A);return vT.copy(g).subtract(y).magnitude()}function Ld(e){return{assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}}var Sn=class{_map=new Map;_array;_length;constructor(t=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,r){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]=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){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 UT={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},$t=class{options;root=null;selectedTiles={};requestedTiles={};emptyTiles={};lastUpdate=new Date().getTime();updateDebounceTime=1e3;_traversalStack=new Sn;_emptyTraversalStack=new Sn;_frameNumber=null;traversalFinished(t){return!0}constructor(t){this.options={...UT,...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,u=!0;for(let f of a)if(f._selectionDepth=s,f.isVisibleAndInRequestVolume?(n.find(f)&&n.delete(f),n.push(f),l=!0):(c||o)&&(this.loadTile(f,r),this.touchTile(f,r)),c){let h;if(f._inRequestVolume?f.hasRenderContent?h=f.contentAvailable:h=this.executeEmptyTraversal(f,r):h=!1,u=u&&h,!u)return!1}return l||(u=!1),u}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 Rd=new x;function GT(e){return e!=null}var We=class{tileset;header;id;url;parent;refine;type;contentUrl;lodMetricType="geometricError";lodMetricValue=0;boundingVolume=null;content=null;contentState=gt.UNLOADED;gpuMemoryUsageInBytes=0;children=[];depth=0;viewportIds=[];transform=new P;extensions=null;implicitTiling=null;userData={};computedTransform;hasEmptyContent=!1;hasTilesetContent=!1;traverser=new $t({});_cacheNode=null;_frameNumber=null;_expireDate=null;_expiredContent=null;_boundingBox=void 0;_distanceToCamera=0;_screenSpaceError=0;_visibilityPlaneMask;_visible=void 0;_contentBoundingVolume;_viewerRequestVolume;_initialTransform=new P;_priority=0;_selectedFrame=0;_requestedFrame=0;_selectionDepth=0;_touchedFrame=0;_centerZDepth=0;_shouldRefine=!1;_stackLength=0;_visitedFrame=0;_inRequestVolume=!1;_lodJudge=null;constructor(t,r,n,s=""){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===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=Ed(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,r){switch(this.tileset.type){case lt.I3S:return Wa(this,t);case lt.TILES3D:return bd(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===gt.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=gt.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=gt.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,Pd.load)(n,s,o),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(n){throw this.contentState=gt.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=gt.UNLOADED,!0}updateVisibility(t,r){if(this._frameNumber===t.frameNumber)return;let n=this.parent,s=n?n._visibilityPlaneMask:ot.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!==ot.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 Rd.subVectors(r.center,t.position),t.direction.dot(Rd)}insideViewerRequestVolume(t){let r=this._viewerRequestVolume;return!r||r.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(GT(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 P(t.transform):new P;let r=this.parent,n=this.tileset,s=r&&r.computedTransform?r.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new P(s).multiplyRight(this.transform);let o=r&&r._initialTransform?r._initialTransform.clone():new P;this._initialTransform=new P(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=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=ot.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(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=eo(t.boundingVolume,this.computedTransform,this.boundingVolume);let r=t.content;r&&(r.boundingVolume&&(this._contentBoundingVolume=eo(r.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=eo(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new P){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 Ld(this.tileset.tileset)}}};var ro=class extends $t{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===Ad.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 Od=N(yr(),1);var no=class{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 Ya={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},so=class{_statusMap;pendingTilesRegister=new no;constructor(){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:Ya.REQUESTED},this.pendingTilesRegister.register(i,o),t().then(a=>{this._statusMap[r].status=Ya.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=Ya.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 oo=class extends $t{_tileManager;constructor(t){super(t),this._tileManager=new so}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,r){return t._lodJudge=Fd(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,f=>this._onTileLoad(f,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,Od.load)(s,n,o)}_onTileLoad(t,r,n){let s=new We(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 VT={description:"",ellipsoid:v.WGS84,modelMatrix:new P,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:{}},io="Tiles In Tileset(s)",Ka="Tiles In Memory",Nd="Tiles In View",Dd="Tiles To Render",vd="Tiles Loaded",Qa="Tiles Loading",Ud="Tiles Unloaded",Gd="Failed Tile Loads",Vd="Points/Vertices",Za="Tile Memory Use",Hd="Maximum Screen Space Error",bn=class{options;loadOptions;type;tileset;loader;url;basePath;modelMatrix;ellipsoid;lodMetricType;lodMetricValue;refine;root=null;roots={};asset={};description="";properties;extras=null;attributions={};credits={};stats;contentFormats={draco:!1,meshopt:!1,dds:!1,ktx2:!1};cartographicCenter=null;cartesianCenter=null;zoom=1;boundingVolume=null;dynamicScreenSpaceErrorComputedDensity=0;maximumMemoryUsage=32;gpuMemoryUsageInBytes=0;memoryAdjustedScreenSpaceError=0;_cacheBytes=0;_cacheOverflowBytes=0;_frameNumber=0;_queryParams={};_extensionsUsed=[];_tiles={};_pendingCount=0;selectedTiles=[];traverseCounter=0;geometricError=0;lastUpdatedVieports=null;_requestedTiles=[];_emptyTiles=[];frameStateData={};_traverser;_cache=new Zs;_requestScheduler;updatePromise=null;tilesetInitializationPromise;constructor(t,r){this.options={...VT,...r},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 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=dd(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]=pd(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(Nd).count=this.selectedTiles.length,this.stats.get(Dd).count=t,this.stats.get(Vd).count=r,this.stats.get(Hd).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(t){this.type===lt.I3S&&(this.calculateViewPropsI3S(),t.root=await t.root),this.root=this._initializeTileHeaders(t,null),this.type===lt.TILES3D&&(this._initializeTiles3DTileset(t),this.calculateViewPropsTiles3D()),this.type===lt.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,v.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=qa(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,v.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=gd(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,v.WGS84.cartesianToCartographic(r,this.cartographicCenter)):this.cartographicCenter=new x(0,0,-v.WGS84.radii[0]),this.cartesianCenter=r,this.zoom=md(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(io),this.stats.get(Qa),this.stats.get(Ka),this.stats.get(Nd),this.stats.get(Dd),this.stats.get(vd),this.stats.get(Ud),this.stats.get(Gd),this.stats.get(Vd),this.stats.get(Za,"memory"),this.stats.get(Hd)}_initializeTileHeaders(t,r){let n=new We(this,t.root,r);if(r&&(r.children.push(n),n.depth=r.depth+1),this.type===lt.TILES3D){let s=[];for(s.push(n);s.length>0;){let o=s.pop();this.stats.get(io).incrementCount();let i=o.header.children||[];for(let a of i){let c=new We(this,a,o);if(c.contentUrl?.includes("?session=")){let u=new URL(c.contentUrl).searchParams.get("session");u&&(this._queryParams.session=u)}o.children.push(c),c.depth=o.depth+1,s.push(c)}}}return n}_initializeTraverser(){let t;switch(this.type){case lt.TILES3D:t=ro;break;case lt.I3S:t=oo;break;default:t=$t}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(Gd).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===lt.I3S){let n=this.tileset?.nodePagesTile?.nodesInNodePages||0;this.stats.get(io).reset(),this.stats.get(io).addCount(n)}t&&t.content&&ud(t,t.content),this.updateContentTypes(t),this._addTileToCache(t),this.options.onTileLoad(t)}}updateContentTypes(t){if(this.type===lt.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===lt.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(vd).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(Ud).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 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 ao="4.2.0-beta.2";var Ye={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},UO=Object.keys(Ye);function $a(e,t,r){G(e instanceof ArrayBuffer);let n=new TextDecoder("utf8"),s=new Uint8Array(e,t,r);return n.decode(s)}function zd(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 kd="4.2.0-beta.2";var Jd={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:kd,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 qd(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,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 u=a[l],f=a[l+1],h=a[l+2];t=u<t?u:t,r=f<r?f:r,n=h<n?h:n,s=u>s?u:s,o=f>o?f:o,i=h>i?h:i}return[[t,r,n],[s,o,i]]}function tc(e,t,r){let n=qd(t.value),s=r||jd(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:n}]},nullable:!1,metadata:s}}function jd(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 Wd(e,t,r){let n=Yd(t.metadata),s=[],o=HT(t.attributes);for(let i in e){let a=e[i],c=Xd(i,a,o[i]);s.push(c)}if(r){let i=Xd("indices",r);s.push(i)}return{fields:s,metadata:n}}function HT(e){let t={};for(let r in e){let n=e[r];t[n.name||"undefined"]=n}return t}function Xd(e,t,r){let n=r?Yd(r.metadata):void 0;return tc(e,t,n)}function Yd(e){Object.entries(e);let t={};for(let r in e)t[`${r}.string`]=JSON.stringify(e[r]);return t}var Kd={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},zT={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},kT=4,Mn=class{draco;decoder;metadataQuerier;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 h=`DRACO decompression failed: ${i.error_msg()}`;throw new Error(h)}let a=this._getDracoLoaderData(o,s,r),c=this._getMeshData(o,a,r),l=Ke(c.attributes),u=Wd(c.attributes,a,c.indices);return{loader:"draco",loaderData:a,header:{vertexCount:o.num_points(),boundingBox:l},...c,schema:u}}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 a=this._getAttributeValues(r,o);if(a){let{value:c,size:l}=a;s[i]={value:c,size:l,byteOffset:o.byte_offset,byteStride:o.byte_stride,normalized:o.normalized}}}return s}_getTriangleListIndices(t){let n=t.num_faces()*3,s=n*kT,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),jT(r)}finally{this.draco.destroy(r)}}_getAttributeValues(t,r){let n=zT[r.data_type];if(!n)return console.warn(`DRACO: Unsupported attribute type ${r.data_type}`),null;let s=r.num_components,i=t.num_points()*s,a=i*n.BYTES_PER_ELEMENT,c=JT(this.draco,n),l,u=this.draco._malloc(a);try{let f=this.decoder.GetAttribute(t,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,f,c,a,u),l=new n(this.draco.HEAPF32.buffer,u,i).slice()}finally{this.draco._free(u)}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 Kd)if(this.draco[i]===s)return Kd[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=qT(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 JT(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 qT(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}function jT(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}var XT="1.5.6",WT="1.4.1",ec=`https://www.gstatic.com/draco/versioned/decoders/${XT}`,yt={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},rc={[yt.DECODER]:`${ec}/${yt.DECODER}`,[yt.DECODER_WASM]:`${ec}/${yt.DECODER_WASM}`,[yt.FALLBACK_DECODER]:`${ec}/${yt.FALLBACK_DECODER}`,[yt.ENCODER]:`https://raw.githubusercontent.com/google/draco/${WT}/javascript/${yt.ENCODER}`},nc;async function Qd(e){let t=e.modules||{};return t.draco3d?nc||=t.draco3d.createDecoderModule({}).then(r=>({draco:r})):nc||=YT(e),await nc}async function YT(e){let t,r;switch(e.draco&&e.draco.decoderType){case"js":t=await Xt(rc[yt.FALLBACK_DECODER],"draco",e,yt.FALLBACK_DECODER);break;case"wasm":default:[t,r]=await Promise.all([await Xt(rc[yt.DECODER],"draco",e,yt.DECODER),await Xt(rc[yt.DECODER_WASM],"draco",e,yt.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await KT(t,r)}function KT(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e({...r,onModuleLoaded:s=>n({draco:s})})})}var co={...Jd,parse:QT};async function QT(e,t){let{draco:r}=await Qd(t),n=new Mn(r);try{return n.parseSync(e,t?.draco)}finally{n.destroy()}}var ZT={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},nt={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},O={...ZT,...nt};var sc={[nt.DOUBLE]:Float64Array,[nt.FLOAT]:Float32Array,[nt.UNSIGNED_SHORT]:Uint16Array,[nt.UNSIGNED_INT]:Uint32Array,[nt.UNSIGNED_BYTE]:Uint8Array,[nt.BYTE]:Int8Array,[nt.SHORT]:Int16Array,[nt.INT]:Int32Array},$T={DOUBLE:nt.DOUBLE,FLOAT:nt.FLOAT,UNSIGNED_SHORT:nt.UNSIGNED_SHORT,UNSIGNED_INT:nt.UNSIGNED_INT,UNSIGNED_BYTE:nt.UNSIGNED_BYTE,BYTE:nt.BYTE,SHORT:nt.SHORT,INT:nt.INT},oc="Failed to convert GL type",dt=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let r in sc)if(sc[r]===t)return r;throw new Error(oc)}static fromName(t){let r=$T[t];if(!r)throw new Error(oc);return r}static getArrayType(t){switch(t){case nt.UNSIGNED_SHORT_5_6_5:case nt.UNSIGNED_SHORT_4_4_4_4:case nt.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let r=sc[t];if(!r)throw new Error(oc);return r}}static getByteSize(t){return dt.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(dt.getArrayType(t))}static createTypedArray(t,r,n=0,s){s===void 0&&(s=(r.byteLength-n)/dt.getByteSize(t));let o=dt.getArrayType(t);return new o(r,n,s)}};function Zd(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function ic(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 xN=1/256;var yN=new Ue,TN=new x,_N=new Ue,EN=new Ue,BN=new Uint8Array(1);function $d(e,t=255){return is(e,0,t)/t*2-1}function tp(e){return e<0?-1:1}function ep(e,t,r,n){if(Zd(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=$d(e,r),n.y=$d(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))*tp(s),n.y=(1-Math.abs(s))*tp(n.y)}return n.normalize()}function ac(e,t,r){return ep(e,t,255,r)}var ce=class{json;buffer;featuresLength=0;_cachedTypedArrays={};constructor(t,r){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=O.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=dt.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=dt.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=dt.createTypedArray(r,n),s[t]=o),o}};var t_={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},e_={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]]},r_={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 rp(e,t,r,n){let{componentType:s}=e;G(e.componentType);let o=typeof s=="string"?dt.fromName(s):s,i=t_[e.type],a=e_[e.type],c=r_[e.type];return r+=e.byteOffset,{values:dt.createTypedArray(o,t,r,i*n),type:o,size:i,unpacker:a,packer:c}}var te=e=>e!==void 0;function np(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?n_(n,r):null}function n_(e,t){let r,n,s,o=e.instancesLength,i=e.classes,a=e.classIds,c=e.parentCounts,l=e.parentIds,u=o;te(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 f;if(te(c))for(te(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)),f=new Uint16Array(o),u=0,r=0;r<o;++r)f[r]=u,u+=c[r];te(l)&&te(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 h=i.length;for(r=0;r<h;++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(h).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:f,parentIds:l};return i_(A),A}function Er(e,t,r){if(!e)return;let n=e.parentCounts;return e.parentIds?r(e,t):n>0?s_(e,t,r):o_(e,t,r)}function s_(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,u=scratchStack;for(u.length=0,u.push(t);u.length>0;){if(t=u.pop(),c[t]===l)continue;c[t]=l;let f=r(e,t);if(te(f))return f;let h=s[t],d=i[t];for(let p=0;p<h;++p){let A=o[d+p];A!==t&&u.push(A)}}return null}function o_(e,t,r){let n=!0;for(;n;){let s=r(e,t);if(te(s))return s;let o=e.parentIds[t];n=o!==t,t=o}throw new Error("traverseHierarchySingleParent")}function i_(e){let t=[],n=e.classIds.length;for(let s=0;s<n;++s)sp(e,s,stack)}function sp(e,t,r){let n=e.parentCounts,s=e.parentIds,o=e.parentIndexes,a=e.classIds.length;if(!te(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=te(n)?n[t]:1,l=te(n)?o[t]:t;for(let u=0;u<c;++u){let f=s[l+u];f!==t&&sp(e,f,r)}r.pop(t)}function Tt(e){return e!=null}var lo=(e,t)=>e,a_={HIERARCHY:!0,extensions:!0,extras:!0},Qe=class{json;binary;featureCount;_extensions;_properties;_binaryProperties;_hierarchy;constructor(t,r,n,s={}){G(n>=0),this.json=t||{},this.binary=r,this.featureCount=n,this._extensions=this.json?.extensions||{},this._properties={};for(let o in this.json)a_[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),s["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=np(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),G(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 Tt(n)}return!1}isExactClass(t,r){return G(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),G(typeof r=="string",r),Tt(this._properties[r])||this._hasPropertyInHierarchy(t,r)}getPropertyNames(t,r){this._checkBatchId(t),r=Tt(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),G(typeof r=="string",r),this._binaryProperties){let s=this._binaryProperties[r];if(Tt(s))return this._getBinaryProperty(s,t)}let n=this._properties[r];if(Tt(n))return lo(n[t],!0);if(this._hierarchy){let s=this._getHierarchyProperty(t,r);if(Tt(s))return s}}setProperty(t,r,n){let s=this.featureCount;if(this._checkBatchId(t),G(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];Tt(o)||(this._properties[r]=new Array(s),o=this._properties[r]),o[t]=lo(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;G(this.binary,`Property ${t} requires a batch table binary.`),G(n.type,`Property ${t} requires a type.`);let s=rp(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 Tt(a[r])});return Tt(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 Tt(c)?Tt(c.typedArray)?this._getBinaryProperty(c,a):lo(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],u=i.classIndexes[a],f=l.instances[n];return Tt(f)?(G(a===r,`Inherited property "${n}" is read-only.`),Tt(f.typedArray)?this._setBinaryProperty(f,u,s):f[u]=lo(s,!0),!0):!1});return Tt(o)}};function Me(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,op="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(op)):c>=570425344&&(r-=Br,s=a,a=o,c=i,o=0,i=0,console.warn(op)),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=c_(e,t,r,n),r=l_(e,t,r,n),r}function c_(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=$a(t,r,s);e.featureTableJson=JSON.parse(a)}return r+=s||0,e.featureTableBinary=new Uint8Array(t,r,o),r+=o||0,r}function l_(e,t,r,n){let{batchTableJsonByteLength:s,batchTableBinaryByteLength:o}=e.header||{};if(s&&s>0){let i=$a(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 cc(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],u=r.getProperty(c,"dimensions").map(f=>f*255);i[a*3]=u[0],i[a*3+1]=u[1],i[a*3+2]=u[2]}return{type:O.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=ic(t[a]);i[a*3]=c[0],i[a*3+1]=c[1],i[a*3+2]=c[2]}return{type:O.UNSIGNED_BYTE,value:i,size:3,normalized:!0}}return t&&t.length===o*3?{type:O.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:O.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var ip=new x;function ap(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++)ac(t[n*2],t[n*2+1],ip),ip.toArray(r,n*3);return{type:O.FLOAT,size:2,value:r}}return{type:O.FLOAT,size:2,value:t}}function cp(e,t,r){return e.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,u_(e,t)):{type:O.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function u_(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 lp(e,t,r,n,s){r=Me(e,t,r),r=Cr(e,t,r),r=Sr(e,t,r,n),f_(e);let{featureTable:o,batchTable:i}=h_(e);return await A_(e,o,i,n,s),d_(e,o,n),p_(e,o,i),m_(e,o),r}function f_(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function h_(e){let t=new ce(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",O.FLOAT,3);let n=g_(e,t);return{featureTable:t,batchTable:n}}function d_(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",O.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let n=t.getPropertyArray("POSITION_QUANTIZED",O.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",O.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",O.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=cp(e,n,r)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function p_(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",O.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?n=t.getPropertyArray("RGB",O.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(n=t.getPropertyArray("RGB565",O.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=cc(e,n,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",O.UNSIGNED_BYTE,4))}function m_(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",O.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",O.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=ap(e,r)}}function g_(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",O.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 Qe(s,o,n)}return r}async function A_(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 f=l.byteOffset,h=l.byteLength;if(!i||!Number.isFinite(f)||!h)throw new Error("Draco properties, byteOffset, and byteLength must be defined");o=(e.featureTableBinary||[]).slice(f,f+h),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 u={buffer:o,properties:{...i,...a},featureTableProperties:i,batchTableProperties:a,dequantizeInShader:!1};return await x_(e,u,n,s)}async function x_(e,t,r,n){if(!n)return;let s={...r,draco:{...r?.draco,extraAttributes:t.batchTableProperties||{}}};delete s["3d-tiles"];let o=await Et(t.buffer,co,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,u=i&&o.attributes.POSITION.value.quantization,f=c&&o.attributes.NORMAL.value.quantization;if(u){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}f&&(e.octEncodedRange=(1<<o.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let h={};if(t.batchTableProperties)for(let d of Object.keys(t.batchTableProperties))o.attributes[d]&&o.attributes[d].value&&(h[d.toLowerCase()]=o.attributes[d].value);e.attributes={positions:i,colors:cc(e,a,void 0),normals:c,batchIds:l,...h}}var lc={};ut(lc,{decode:()=>F_,name:()=>w_});function it(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 y_=1.33,up=["SCALAR","VEC2","VEC3","VEC4"],T_=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],__=new Map(T_),E_={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},B_={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},C_={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function ho(e){return up[e-1]||up[0]}function br(e){let t=__.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function Mr(e,t){let r=C_[e.componentType],n=E_[e.type],s=B_[e.componentType],o=e.count*n,i=e.count*n*s;it(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 In(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*y_)}function fp(e,t,r){let n=e.bufferViews[r];it(n);let s=n.buffer,o=t[s];it(o);let i=(n.byteOffset||0)+o.byteOffset;return new Uint8Array(o.arrayBuffer,i,n.byteLength)}function hp(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:u,numberOfComponentsInElement:f}=Mr(n,s),h=u*f,d=s.byteStride||h;if(typeof s.byteStride>"u"||s.byteStride===h)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,f);p.set(g,A*f)}return p}function S_(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var q=class{gltf;sourceBuffers;byteLength;constructor(t){this.gltf={json:t?.json||S_(),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];it(n);let s=(t.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,s,t.byteLength)}getTypedArrayForAccessor(t){let r=this.getAccessor(t);return hp(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 it(r),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=r,this.registerUsedExtension(t),r}addRequiredExtension(t,r={}){return it(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;it(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let o={buffer:r,byteOffset:n,byteLength:s};return this.byteLength+=de(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:ho(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:br(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 dp(e){return(e%1+1)%1}var pp={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},b_={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},mp={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function wn(e,t){return mp[t]*pp[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=pp[t],o=b_[r],i=mp[r],a=n*s,c=a*i,l=e.buffer,u=e.byteOffset;return u%i!==0&&(l=new Uint8Array(l).slice(u,u+c).buffer,u=0),new o(l,u,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,u=e.gltf.images?.[c];if(u&&typeof u.width<"u"){let f=[];for(let h=0;h<o.length;h+=2){let d=M_(u,l,o,h,t.channels);f.push(d)}return f}}return[]}function po(e,t,r,n,s){if(!r?.length)return;let o=[];for(let u of r){let f=n.findIndex(h=>h===u);f===-1&&(f=n.push(u)-1),o.push(f)}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:br(i),count:i.length});s.attributes[t]=l}function M_(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=I_(i,a,e,c),u=0;for(let f of s){let h=typeof f=="number"?Object.values(o)[f]:o[f],d=l+h.offset,p=$r(e);if(p.data.length<=d)throw new Error(`${p.data.length} <= ${d}`);let A=p.data[d];u|=A<<h.shift}return u}function I_(e,t,r,n=1){let s=r.width,o=dp(e)*(s-1),i=Math.round(o),a=r.height,c=dp(t)*(a-1),l=Math.round(c),u=r.components?r.components:n;return(l*s+i)*u}function mo(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,u=c/s;o.push(e.slice(l,l+u))}return o}function go(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 Ao(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),u=o.decode(l);s.push(u),i+=c}}return s}return[]}var gp="EXT_mesh_features",w_=gp;async function F_(e,t){let r=new q(e);L_(r,t)}function L_(e,t){let r=e.gltf.json;if(r.meshes)for(let n of r.meshes)for(let s of n.primitives)R_(e,s,t)}function R_(e,t,r){if(!r?.gltf?.loadBuffers)return;let s=t.extensions?.[gp]?.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 hc={};ut(hc,{decode:()=>O_,name:()=>P_});var uc="EXT_structural_metadata",P_=uc;async function O_(e,t){let r=new q(e);N_(r,t)}function N_(e,t){if(!t.gltf?.loadBuffers)return;let r=e.getExtension(uc);r&&(t.gltf?.loadImages&&D_(e,r),v_(e,r))}function D_(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)G_(e,r,o,t)}function v_(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=U_(s,o);i&&H_(e,r,i)}}function U_(e,t){for(let r of e)if(r.class===t)return r;return null}function G_(e,t,r,n){if(!t)return;let o=r.extensions?.[uc]?.propertyTextures;if(o)for(let i of o){let a=t[i];V_(e,a,r,n)}}function V_(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&&(po(e,i,l,c,r),a.data=c,n.dataAttributeNames.push(i))}}function H_(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=z_(e,t,i,s,a);a.data=c}}}function z_(e,t,r,n,s){let o=[],i=s.values,a=e.getTypedArrayForBufferView(i),c=k_(e,r,s,n),l=J_(e,s,n);switch(r.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{o=q_(r,n,a,c);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${r.type}`);case"STRING":{o=Ao(n,a,c,l);break}case"ENUM":{o=j_(t,r,n,a,c);break}default:throw new Error(`Unknown classProperty type ${r.type}`)}return o}function k_(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 J_(e,t,r){return typeof t.stringOffsets<"u"?Ir(e,t.stringOffsets,t.stringOffsetType||"UINT32",r):null}function q_(e,t,r,n){let s=e.array,o=e.count,i=wn(e.type,e.componentType),a=r.byteLength/i,c;return e.componentType?c=wr(r,e.type,e.componentType,a):c=r,s?n?mo(c,t,n,r.length,i):o?go(c,t,o):[]:c}function j_(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=wn(t.type,a),l=n.byteLength/c,u=wr(n,t.type,a,l);if(u||(u=n),t.array){if(s)return X_({valuesData:u,numberOfElements:r,arrayOffsets:s,valuesDataBytesLength:n.length,elementSize:c,enumEntry:i});let f=t.count;return f?W_(u,r,f,i):[]}return fc(u,0,r,i)}function X_(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],u=n[c+1]-n[c];if(u+l>s)break;let f=l/o,h=u/o,d=fc(t,f,h,i);a.push(d)}return a}function W_(e,t,r,n){let s=[];for(let o=0;o<t;o++){let i=r*o,a=fc(e,i,r,n);s.push(a)}return s}function fc(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=Y_(n,i);a?s.push(a.name):s.push("")}return s}function Y_(e,t){for(let r of e.values)if(r.value===t)return r;return null}var dc={};ut(dc,{decode:()=>Q_,name:()=>K_});var Ap="EXT_feature_metadata",K_=Ap;async function Q_(e,t){let r=new q(e);Z_(r,t)}function Z_(e,t){if(!t.gltf?.loadBuffers)return;let r=e.getExtension(Ap);r&&(t.gltf?.loadImages&&$_(e,r),tE(e,r))}function $_(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=rE(s,o);a&&sE(e,a,i)}}function tE(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=eE(s,o);i&&nE(e,r,i)}}function eE(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function rE(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function nE(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=oE(e,t,i,s,a);a.data=c}}}function sE(e,t,r){let n=t.class;for(let s in r.properties){let o=t?.properties?.[s];if(o){let i=uE(e,o,n);o.data=i}}}function oE(e,t,r,n,s){let o=[],i=s.bufferView,a=e.getTypedArrayForBufferView(i),c=iE(e,r,s,n),l=aE(e,r,s,n);return r.type==="STRING"||r.componentType==="STRING"?o=Ao(n,a,c,l):cE(r)&&(o=lE(r,n,a,c)),o}function iE(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 aE(e,t,r,n){return typeof r.stringOffsetBufferView<"u"?Ir(e,r.stringOffsetBufferView,r.offsetType||"UINT32",n):null}function cE(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 lE(e,t,r,n){let s=e.type==="ARRAY",o=e.componentCount,i="SCALAR",a=e.componentType||e.type,c=wn(i,a),l=r.byteLength/c,u=wr(r,i,a,l);return s?n?mo(u,t,n,r.length,c):o?go(u,t,o):[]:u}function uE(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)fE(e,r,t,s,i);return s}function fE(e,t,r,n,s){let o={channels:r.channels,...r.texture},i=Fr(e,o,s);i&&po(e,t,i,n,s)}var xp="4.2.0-beta.2";var Lr=!0,yp=1735152710,gc=12,xo=8,hE=1313821514,dE=5130562,pE=0,mE=0,gE=1;function AE(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 Tp(e,t=0,r={}){let n=new DataView(e),{magic:s=yp}=r,o=n.getUint32(t,!1);return o===s||o===yp}function _p(e,t,r=0,n={}){let s=new DataView(t),o=AE(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 xE(e,s,r);case 2:return yE(e,s,r,n={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function xE(e,t,r){G(e.header.byteLength>gc+xo);let n=t.getUint32(r+0,Lr),s=t.getUint32(r+4,Lr);return r+=xo,G(s===pE),pc(e,t,r,n),r+=n,r+=mc(e,t,r,e.header.byteLength),r}function yE(e,t,r,n){return G(e.header.byteLength>gc+xo),TE(e,t,r,n),r+e.header.byteLength}function TE(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+=xo,o){case hE:pc(e,t,r,s);break;case dE:mc(e,t,r,s);break;case mE:n.strict||pc(e,t,r,s);break;case gE:n.strict||mc(e,t,r,s);break;default:break}r+=de(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),de(n,4)}function mc(e,t,r,n){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:t.buffer}),de(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:()=>RE,name:()=>LE});var _E="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",EE="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",BE=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]),CE=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]),SE={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},bE={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function Ep(e,t,r,n,s,o="NONE"){let i=await ME();FE(i,i.exports[bE[s]],e,t,r,n,i.exports[SE[o||"NONE"]])}var xc;async function ME(){return xc||(xc=IE()),xc}async function IE(){let e=_E;WebAssembly.validate(BE)&&(e=EE,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(wE(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function wE(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?CE[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,r)}function FE(e,t,r,n,s,o,i){let a=e.exports.sbrk,c=n+3&-4,l=a(c*s),u=a(o.length),f=new Uint8Array(e.exports.memory.buffer);f.set(o,u);let h=t(l,n,s,u,o.length);if(h===0&&i&&i(l,c,s),r.set(f.subarray(l,l+n*s)),a(l-a(0)),h!==0)throw new Error(`Malformed buffer data: ${h}`)}var yo="EXT_meshopt_compression",LE=yo;async function RE(e,t){let r=new q(e);if(!t?.gltf?.decompressMeshes||!t.gltf?.loadBuffers)return;let n=[];for(let s of e.json.bufferViews||[])n.push(PE(r,s));await Promise.all(n),r.removeExtension(yo)}async function PE(e,t){let r=e.getObjectExtension(t,yo);if(r){let{byteOffset:n=0,byteLength:s=0,byteStride:o,count:i,mode:a,filter:c="NONE",buffer:l}=r,u=e.gltf.buffers[l],f=new Uint8Array(u.arrayBuffer,u.byteOffset+n,s),h=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await Ep(h,i,o,f,a,c),e.removeObjectExtension(t,yo)}}var Tc={};ut(Tc,{name:()=>OE,preprocess:()=>NE});var Rr="EXT_texture_webp",OE=Rr;function NE(e,t){let r=new q(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:()=>DE,preprocess:()=>vE});var To="KHR_texture_basisu",DE=To;function vE(e,t){let r=new q(e),{json:n}=r;for(let s of n.textures||[]){let o=r.getObjectExtension(s,To);o&&(s.source=o.source,r.removeObjectExtension(s,To))}r.removeExtension(To)}var Bc={};ut(Bc,{decode:()=>zE,encode:()=>kE,name:()=>VE,preprocess:()=>HE});function Bp(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}=UE(e);return{value:t,size:r,byteOffset:0,count:n,type:ho(r),componentType:br(t)}}function UE(e){let t=e,r=1,n=0;return e&&e.value&&(t=e.value,r=e.size||1),t&&(ArrayBuffer.isView(t)||(t=GE(t,Float32Array)),n=t.length/r),{buffer:t,size:r,count:n}}function GE(e,t,r=!1){return e?Array.isArray(e)?new t(e):r&&!(e instanceof t)?new t(e):e:null}var Ie="KHR_draco_mesh_compression",VE=Ie;function HE(e,t,r){let n=new q(e);for(let s of Cp(n))n.getObjectExtension(s,Ie)}async function zE(e,t,r){if(!t?.gltf?.decompressMeshes)return;let n=new q(e),s=[];for(let o of Cp(n))n.getObjectExtension(o,Ie)&&s.push(JE(n,o,t,r));await Promise.all(s),n.removeExtension(Ie)}function kE(e,t={}){let r=new q(e);for(let n of r.json.meshes||[])qE(n,t),r.addRequiredExtension(Ie)}async function JE(e,t,r,n){let s=e.getObjectExtension(t,Ie);if(!s)return;let o=e.getTypedArrayForBufferView(s.bufferView),i=Pe(o.buffer,o.byteOffset),a={...r};delete a["3d-tiles"];let c=await Et(i,co,a,n),l=Bp(c.attributes);for(let[u,f]of Object.entries(l))if(u in t.attributes){let h=t.attributes[u],d=e.getAccessor(h);d?.min&&d?.max&&(f.min=d.min,f.max=d.max)}t.attributes=l,c.indices&&(t.indices=Ec(c.indices)),e.removeObjectExtension(t,Ie),jE(t)}function qE(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:{[Ie]:{bufferView:c,attributes:a}}}]}}function jE(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*Cp(e){for(let t of e.json.meshes||[])for(let r of t.primitives)yield r}var Cc={};ut(Cc,{decode:()=>KE,name:()=>XE});var Eo="KHR_texture_transform",XE=Eo,_o=new x,WE=new z,YE=new z;async function KE(e,t){if(!new q(e).hasExtension(Eo)||!t.gltf?.loadBuffers)return;let s=e.json.materials||[];for(let o=0;o<s.length;o++)QE(o,e)}function QE(e,t){let r=t.json.materials?.[e],n=[r?.pbrMetallicRoughness?.baseColorTexture,r?.emissiveTexture,r?.normalTexture,r?.occlusionTexture,r?.pbrMetallicRoughness?.metallicRoughnessTexture],s=[];for(let o of n)o&&o?.extensions?.[Eo]&&ZE(t,e,o,s)}function ZE(e,t,r,n){let s=$E(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&&tB(e,a,s)}}function $E(e,t){let r=e.extensions?.[Eo],{texCoord:n=0}=e,{texCoord:s=n}=r;if(!(t.findIndex(([i,a])=>i===n&&a===s)!==-1)){let i=nB(r);return n!==s&&(e.texCoord=s),t.push([n,s]),{originalTexCoord:n,texCoord:s,matrix:i}}return null}function tB(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:u}=e.buffers[c.buffer],f=(u||0)+(a.byteOffset||0)+(c.byteOffset||0),{ArrayType:h,length:d}=Mr(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 h(l,f+E*g,2);_o.set(_[0],_[1],1),_o.transformByMatrix3(o),y.set([_o[0],_o[1]],E*A)}n===s?eB(a,c,e.buffers,y):rB(s,a,t,e,y)}}}}function eB(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 rB(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 nB(e){let{offset:t=[0,0],rotation:r=0,scale:n=[1,1]}=e,s=new z().set(1,0,0,0,1,0,t[0],t[1],1),o=WE.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),i=YE.set(n[0],0,0,0,n[1],0,0,0,1);return s.multiplyRight(o).multiplyRight(i)}var Sc={};ut(Sc,{decode:()=>oB,encode:()=>iB,name:()=>sB});var Ze="KHR_lights_punctual",sB=Ze;async function oB(e){let t=new q(e),{json:r}=t,n=t.getExtension(Ze);n&&(t.json.lights=n.lights,t.removeExtension(Ze));for(let s of r.nodes||[]){let o=t.getObjectExtension(s,Ze);o&&(s.light=o.light),t.removeObjectExtension(s,Ze)}}async function iB(e){let t=new q(e),{json:r}=t;if(r.lights){let n=t.addExtension(Ze);it(!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,Ze,n)}delete t.json.lights}}var bc={};ut(bc,{decode:()=>cB,encode:()=>lB,name:()=>aB});var Fn="KHR_materials_unlit",aB=Fn;async function cB(e){let t=new q(e),{json:r}=t;for(let n of r.materials||[])n.extensions&&n.extensions.KHR_materials_unlit&&(n.unlit=!0),t.removeObjectExtension(n,Fn);t.removeExtension(Fn)}function lB(e){let t=new q(e),{json:r}=t;if(t.materials)for(let n of r.materials||[])n.unlit&&(delete n.unlit,t.addObjectExtension(n,Fn,{}),t.addExtension(Fn))}var Mc={};ut(Mc,{decode:()=>fB,encode:()=>hB,name:()=>uB});var Ln="KHR_techniques_webgl",uB=Ln;async function fB(e){let t=new q(e),{json:r}=t,n=t.getExtension(Ln);if(n){let s=dB(n,t);for(let o of r.materials||[]){let i=t.getObjectExtension(o,Ln);i&&(o.technique=Object.assign({},i,s[i.technique]),o.technique.values=pB(o.technique,t)),t.removeObjectExtension(o,Ln)}t.removeExtension(Ln)}}async function hB(e,t){}function dB(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 pB(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 Sp=[hc,lc,yc,Tc,_c,Bc,Sc,bc,Mc,Cc,dc];function bp(e,t={},r){let n=Sp.filter(s=>Ip(s.name,t));for(let s of n)s.preprocess?.(e,t,r)}async function Mp(e,t={},r){let n=Sp.filter(s=>Ip(s.name,t));for(let s of n)await s.decode?.(e,t,r)}function Ip(e,t){let r=t?.gltf?.excludeExtensions||{};return!(e in r&&!r[e])}var Ic="KHR_binary_glTF";function wp(e){let t=new q(e),{json:r}=t;for(let n of r.images||[]){let s=t.getObjectExtension(n,Ic);s&&Object.assign(n,s),t.removeObjectExtension(n,Ic)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,t.removeExtension(Ic)}var Fp={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},gB={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{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;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),wp(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 Fp)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 Fp)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=gB[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 Lp(e,t={}){return new wc().normalize(e,t)}async function Rp(e,t,r=0,n,s){return AB(e,t,r,n),Lp(e,{normalize:n?.gltf?.normalize}),bp(e,n,s),n?.gltf?.loadBuffers&&e.json.buffers&&await xB(e,n,s),n?.gltf?.loadImages&&await yB(e,n,s),await Mp(e,n,s),e}function AB(e,t,r,n){if(n.uri&&(e.baseUri=n.uri),t instanceof ArrayBuffer&&!Tp(t,r,n)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=xi(t);else if(t instanceof ArrayBuffer){let i={};r=_p(i,t,r,n.glb),it(i.type==="glTF",`Invalid GLB magic string ${i.type}`),e._glb=i,e.json=i.json}else it(!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 xB(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;it(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 yB(e,t,r){let n=TB(e),s=e.json.images||[],o=[];for(let i of n)o.push(_B(e,s[i],i,t,r));return await Promise.all(o)}function TB(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 _B(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=fp(e.json,e.buffers,t.bufferView);o=Pe(a.buffer,a.byteOffset,a.byteLength)}it(o,"glTF image has no data");let i=await Et(o,[Ae,Da],{...n,mimeType:t.mimeType,basis:n.basis||{format:qs()}},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 $e={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:xp,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:EB,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function EB(e,t={},r){t={...$e.options,...t},t.gltf={...$e.options.gltf,...t.gltf};let{byteOffset:n=0}=t;return await Rp({},e,n,t,r)}var BB={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},CB={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Rt={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},SB={magFilter:Rt.TEXTURE_MAG_FILTER,minFilter:Rt.TEXTURE_MIN_FILTER,wrapS:Rt.TEXTURE_WRAP_S,wrapT:Rt.TEXTURE_WRAP_T},bB={[Rt.TEXTURE_MAG_FILTER]:Rt.LINEAR,[Rt.TEXTURE_MIN_FILTER]:Rt.NEAREST_MIPMAP_LINEAR,[Rt.TEXTURE_WRAP_S]:Rt.REPEAT,[Rt.TEXTURE_WRAP_T]:Rt.REPEAT};function MB(){return{id:"default-sampler",parameters:bB}}function IB(e){return CB[e]}function wB(e){return BB[e]}var Fc=class{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(t,r={}){let{json:n,buffers:s=[],images:o=[]}=t,{baseUri:i=""}=t;return it(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=IB(t.componentType),s=wB(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}=Mr(i,i.bufferView),u=(i.bufferView.byteOffset||0)+(i.byteOffset||0)+a.byteOffset,f=a.arrayBuffer.slice(u,u+l);i.bufferView.byteStride&&(f=this._getValueFromInterleavedBuffer(a,u,i.bufferView.byteStride,i.bytesPerElement,i.count)),i.value=new c(f)}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):MB(),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 SB[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 Rn(e,t){return new Fc().postProcess(e,t)}var Bo={URI:0,EMBEDDED:1};function Co(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 So(e,t,r,n){let s=r?.["3d-tiles"]||{};if(FB(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 Et(e.gltfArrayBuffer,$e,r,n);e.gltf=Rn(o),e.gpuMemoryUsageInBytes=In(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function FB(e,t,r){switch(t){case Bo.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 Bo.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function Pp(e,t,r,n,s){r=LB(e,t,r,n,s),await So(e,Bo.EMBEDDED,n,s);let o=e?.gltf?.extensions;return o&&o.CESIUM_RTC&&(e.rtcCenter=o.CESIUM_RTC.center),r}function LB(e,t,r,n,s){r=Me(e,t,r),r=Cr(e,t,r),r=Sr(e,t,r,n),r=Co(e,t,r,n);let o=new ce(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=o.getGlobalProperty("RTC_CENTER",O.FLOAT,3),r}async function Op(e,t,r,n,s){return r=RB(e,t,r,n,s),await So(e,e.gltfFormat||0,n,s),r}function RB(e,t,r,n,s){if(r=Me(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=Co(e,t,r,n),!e?.header?.featureTableJsonByteLength||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let i=new ce(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",O.FLOAT,3);let c=new Qe(e.batchTableJson,e.batchTableBinary,a);return PB(e,i,c,a),r}function PB(e,t,r,n){let s=new Array(n),o=new x,i=new x,a=new x,c=new x,l=new z,u=new Yt,f=new x,h={},d=new P,p=[],A=[],g=[],y=[];for(let E=0;E<n;E++){let _;if(t.hasProperty("POSITION"))_=t.getProperty("POSITION",O.FLOAT,3,E,o);else if(t.hasProperty("POSITION_QUANTIZED")){_=t.getProperty("POSITION_QUANTIZED",O.UNSIGNED_SHORT,3,E,o);let m=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",O.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",O.FLOAT,3);if(!M)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*M[R]+m[R]}if(!_)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");o.copy(_),h.translation=o,e.normalUp=t.getProperty("NORMAL_UP",O.FLOAT,3,E,p),e.normalRight=t.getProperty("NORMAL_RIGHT",O.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",O.UNSIGNED_SHORT,2,E,p),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",O.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?(v.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)),u.fromMatrix3(l),h.rotation=u,f.set(1,1,1);let S=t.getProperty("SCALE",O.FLOAT,1,E,g);Number.isFinite(S)&&f.multiplyByScalar(S);let b=t.getProperty("SCALE_NON_UNIFORM",O.FLOAT,3,E,p);b&&f.scale(b),h.scale=f;let w=t.getProperty("BATCH_ID",O.UNSIGNED_SHORT,1,E,y);w===void 0&&(w=E);let C=new P().fromQuaternion(h.rotation);d.identity(),d.translate(h.translation),d.multiplyRight(C),d.scale(h.scale);let T=d.clone();s[E]={modelMatrix:T,batchId:w}}e.instances=s}async function Np(e,t,r,n,s,o){r=Me(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 Dp(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 Et(t,$e,r,n);e.gltf=Rn(s),e.gpuMemoryUsageInBytes=In(e.gltf)}else e.gltfArrayBuffer=t;return t.byteLength}async function Lc(e,t=0,r,n,s={shape:"tile3d"}){switch(s.byteOffset=t,s.type=zd(e,t),s.type){case Ye.COMPOSITE:return await Np(s,e,t,r,n,Lc);case Ye.BATCHED_3D_MODEL:return await Pp(s,e,t,r,n);case Ye.GLTF:return await Dp(s,e,r,n);case Ye.INSTANCED_3D_MODEL:return await Op(s,e,t,r,n);case Ye.POINT_CLOUD:return await lp(s,e,t,r,n);default:throw new Error(`3DTileLoader: unknown type ${s.type}`)}}async function Rc(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=vp(e.slice(8,16)),i=new Uint8Array(e,24,o),c=new TextDecoder("utf8").decode(i),l=JSON.parse(c),u=vp(e.slice(16,24)),f=new ArrayBuffer(0);if(u&&(f=e.slice(24+o)),await bo(l,l.tileAvailability,f,r),Array.isArray(l.contentAvailability))for(let h of l.contentAvailability)await bo(l,h,f,r);else await bo(l,l.contentAvailability,f,r);return await bo(l,l.childSubtreeAvailability,f,r),l}async function bo(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}`,u=await(await n.fetch(c)).arrayBuffer();t.explicitBitstream=new Uint8Array(u,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 vp(e){let t=new DataView(e),r=t.getUint32(0,!0),n=t.getUint32(4,!0);return r+2**32*n}var Mo={dataType:null,batchType:null,id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:ao,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:Rc,options:{}};var om=N(yr(),1);var em=N(yr(),1);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,r){this.low=e|0,this.high=t|0,this.unsigned=!!r}K.prototype.__isLong__;Object.defineProperty(K.prototype,"__isLong__",{value:!0});function pt(e){return(e&&e.__isLong__)===!0}function Up(e){var t=Math.clz32(e&-e);return e?31-t:t}K.isLong=pt;var Gp={},Vp={};function tr(e,t){var r,n,s;return t?(e>>>=0,(s=0<=e&&e<256)&&(n=Vp[e],n)?n:(r=V(e,0,!0),s&&(Vp[e]=r),r)):(e|=0,(s=-128<=e&&e<128)&&(n=Gp[e],n)?n:(r=V(e,e<0?-1:0,!1),s&&(Gp[e]=r),r))}K.fromInt=tr;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 _t;if(e+1>=zp)return jp}return e<0?Ot(-e,t).neg():V(e%Or|0,e/Or|0,t)}K.fromNumber=Ot;function V(e,t,r){return new K(e,t,r)}K.fromBits=V;var Io=Math.pow;function Oc(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?le:zt;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 Oc(e.substring(1),t,r).neg();for(var s=Ot(Io(r,8)),o=zt,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=Ot(Io(r,a));o=o.mul(l).add(Ot(c))}else o=o.mul(s),o=o.add(Ot(c))}return o.unsigned=t,o}K.fromString=Oc;function kt(e,t){return typeof e=="number"?Ot(e,t):typeof e=="string"?Oc(e,t):V(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}K.fromValue=kt;var Hp=1<<16,OB=1<<24,Or=Hp*Hp,Jp=Or*Or,zp=Jp/2,kp=tr(OB),zt=tr(0);K.ZERO=zt;var le=tr(0,!0);K.UZERO=le;var Pr=tr(1);K.ONE=Pr;var qp=tr(1,!0);K.UONE=qp;var Pc=tr(-1);K.NEG_ONE=Pc;var jp=V(-1,2147483647,!1);K.MAX_VALUE=jp;var Xp=V(-1,-1,!0);K.MAX_UNSIGNED_VALUE=Xp;var _t=V(0,-2147483648,!1);K.MIN_VALUE=_t;var I=K.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low};I.toNumber=function(){return this.unsigned?(this.high>>>0)*Or+(this.low>>>0):this.high*Or+(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(_t)){var r=Ot(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=Ot(Io(t,6),this.unsigned),i=this,a="";;){var c=i.div(o),l=i.sub(c.mul(o)).toInt()>>>0,u=l.toString(t);if(i=c,i.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(_t)?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 pt(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(pt(t)||(t=kt(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(_t)?_t:this.not().add(Pr)};I.neg=I.negate;I.add=function(t){pt(t)||(t=kt(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,u=0,f=0,h=0,d=0;return d+=o+l,h+=d>>>16,d&=65535,h+=s+c,f+=h>>>16,h&=65535,f+=n+a,u+=f>>>16,f&=65535,u+=r+i,u&=65535,V(h<<16|d,u<<16|f,this.unsigned)};I.subtract=function(t){return pt(t)||(t=kt(t)),this.add(t.neg())};I.sub=I.subtract;I.multiply=function(t){if(this.isZero())return this;if(pt(t)||(t=kt(t)),Pt){var r=Pt.mul(this.low,this.high,t.low,t.high);return V(r,Pt.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?le:zt;if(this.eq(_t))return t.isOdd()?_t:zt;if(t.eq(_t))return this.isOdd()?_t: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 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,u=t.low&65535,f=0,h=0,d=0,p=0;return p+=i*u,d+=p>>>16,p&=65535,d+=o*u,h+=d>>>16,d&=65535,d+=i*l,h+=d>>>16,d&=65535,h+=s*u,f+=h>>>16,h&=65535,h+=o*l,f+=h>>>16,h&=65535,h+=i*c,f+=h>>>16,h&=65535,f+=n*u+s*l+o*c+i*a,f&=65535,V(d<<16|p,f<<16|h,this.unsigned)};I.mul=I.multiply;I.divide=function(t){if(pt(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 r=(this.unsigned?Pt.div_u:Pt.div_s)(this.low,this.high,t.low,t.high);return V(r,Pt.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?le:zt;var n,s,o;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return le;if(t.gt(this.shru(1)))return qp;o=le}else{if(this.eq(_t)){if(t.eq(Pr)||t.eq(Pc))return _t;if(t.eq(_t))return Pr;var i=this.shr(1);return n=i.div(t).shl(1),n.eq(zt)?t.isNegative()?Pr:Pc:(s=this.sub(t.mul(n)),o=n.add(s.div(t)),o)}else if(t.eq(_t))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();o=zt}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:Io(2,a-48),l=Ot(n),u=l.mul(t);u.isNegative()||u.gt(s);)n-=c,l=Ot(n,this.unsigned),u=l.mul(t);l.isZero()&&(l=Pr),o=o.add(l),s=s.sub(u)}return o};I.div=I.divide;I.modulo=function(t){if(pt(t)||(t=kt(t)),Pt){var r=(this.unsigned?Pt.rem_u:Pt.rem_s)(this.low,this.high,t.low,t.high);return V(r,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 pt(t)||(t=kt(t)),V(this.low&t.low,this.high&t.high,this.unsigned)};I.or=function(t){return pt(t)||(t=kt(t)),V(this.low|t.low,this.high|t.high,this.unsigned)};I.xor=function(t){return pt(t)||(t=kt(t)),V(this.low^t.low,this.high^t.high,this.unsigned)};I.shiftLeft=function(t){return pt(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 pt(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 pt(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 r;return pt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?V(this.high,this.low,this.unsigned):t<32?(r=32-t,V(this.low<<t|this.high>>>r,this.high<<t|this.low>>>r,this.unsigned)):(t-=32,r=32-t,V(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 pt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?V(this.high,this.low,this.unsigned):t<32?(r=32-t,V(this.high<<r|this.low>>>t,this.low<<r|this.high>>>t,this.unsigned)):(t-=32,r=32-t,V(this.low<<r|this.high>>>t,this.high<<r|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,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]};K.fromBytes=function(t,r,n){return n?K.fromBytesLE(t,r):K.fromBytesBE(t,r)};K.fromBytesLE=function(t,r){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,r)};K.fromBytesBE=function(t,r){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],r)};var Nr=K;var NB=16;function Pn(e){e==="X"&&(e="");let t=e.padEnd(NB,"0");return Nr.fromString(t,!0,16)}function Nc(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 Dc(e,t){let r=DB(e).shiftRightUnsigned(2);return e.add(Nr.fromNumber(2*t+1-4).multiply(r))}function DB(e){return e.and(e.not().add(1))}var vB=3,UB=30,GB=2*UB+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,u=0;c==="1"?u=1:c==="2"?(l=1,u=1):c==="3"&&(l=1);let f=Math.pow(2,o-1);VB(f,i,l,u),i[0]+=f*l,i[1]+=f*u}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<vB+GB;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),s=t.substring(3,r),o=s.length/2,i=Nr.fromString(n,!0,2).toString(10),a="";if(o!==0)for(a=Nr.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 Uc(e){return[Yp(e[0]),Yp(e[1])]}function Gc(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 Vc([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*Wp,n*Wp]}function VB(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=Uc(t),n=Gc(e.face,r);return Vc(n)}var HB=100;function Hc(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(HB*Math.pow(2,-n))),i=new Float64Array(4*o*2+2),a=0,c=0;for(let l=0;l<4;l++){let u=s[l].slice(0),f=s[l+1],h=(f[0]-u[0])/o,d=(f[1]-u[1])/o;for(let p=0;p<o;p++){u[0]+=h,u[1]+=d;let A=vc(r,n,u),g=Uc(A),y=Gc(t,g),E=Vc(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 Dr(e){let t=zB(e);return Kp(t)}function zB(e){if(e.indexOf("/")>0)return e;let t=Pn(e);return Qp(t)}function zc(e){let t=Dr(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=Dr(o),a=Hc(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=Hc(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 kc(e,t){let r=t?.minimumHeight||0,n=t?.maximumHeight||0,s=Dr(e),o=tm(s),i=o.west,a=o.south,c=o.east,l=o.north,u=[];return u.push(new x(i,l,r)),u.push(new x(c,l,r)),u.push(new x(c,a,r)),u.push(new x(i,a,r)),u.push(new x(i,l,n)),u.push(new x(c,l,n)),u.push(new x(c,a,n)),u.push(new x(i,a,n)),u}function wo(e){let t=e.token,r={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},n=kc(t,r),s=zc(t),o=s[0],i=s[1],a=v.WGS84.cartographicToCartesian([o,i,r.maximumHeight]),c=new x(a[0],a[1],a[2]);n.push(c);let l=mn(n);return[...l.center,...l.halfAxes]}var kB=4,JB=8,qB={QUADTREE:kB,OCTREE:JB};function jB(e,t,r){if(e?.box){let n=Pn(e.s2VolumeInfo.token),s=Dc(n,t),o=Nc(s),i={...e.s2VolumeInfo};switch(i.token=o,r){case"OCTREE":let l=e.s2VolumeInfo,u=l.maximumHeight-l.minimumHeight,f=u/2,h=l.minimumHeight+u/2;l.minimumHeight=h-f,l.maximumHeight=h+f;break;default:break}return{box:wo(i),s2VolumeInfo:i}}}async function qc(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:u,maximumLevel:f,contentUrlTemplate:h,subtreesUriTemplate:d,basePath:p}=t,A={children:[],lodMetricValue:0,contentUrl:""};if(!f)return di.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${h} won't be loaded...`),A;let g=a+c.level;if(g>f)return A;let y=qB[l],E=Math.log2(y),_=n&1,B=n>>1&1,S=n>>2&1,b=(y**a-1)/(y-1),w=er(r.mortonIndex,n,E),C=b+w,T=er(r.x,_,1),m=er(r.y,B,1),M=er(r.z,S,1),L=!1;a>=u&&(L=Jc(i.childSubtreeAvailability,w));let R=er(c.x,T,a),F=er(c.y,m,a),D=er(c.z,M,a);if(L){let W=`${p}/${d}`,$=Fo(W,g,R,F,D);i=await(0,em.load)($,Mo,o),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(i.tileAvailability,C))return A;Jc(i.contentAvailability,C)&&(A.contentUrl=Fo(h,g,R,F,D));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 qc({subtree:i,implicitOptions:t,loaderOptions:o,parentData:j,childIndex:W,level:Q,globalData:{...c},s2VolumeBox:$});if(At.contentUrl||At.children.length){let rg=g+1,ng=XB(At,rg,{childTileX:T,childTileY:m,childTileZ:M},t,s);A.children.push(ng)}}return A}function Jc(e,t){let r;return Array.isArray(e)?(r=e[0],e.length>1&&di.once('Not supported extension "3DTILES_multiple_contents" has been detected')):r=e,"constant"in r?Boolean(r.constant):r.explicitBitstream?KB(t,r.explicitBitstream):!1}function XB(e,t,r,n,s){let{basePath:o,refine:i,getRefine:a,lodMetricType:c,getTileType:l,rootLodMetricValue:u,rootBoundingVolume:f}=n,h=e.contentUrl&&e.contentUrl.replace(`${o}/`,""),d=u/2**t,p=s?.box?{box:s.box}:f,A=WB(t,p,r);return{children:e.children,contentUrl:e.contentUrl,content:{uri:h},id:e.contentUrl,refine:a(i),type:l(e),lodMetricType:c,lodMetricValue:d,geometricError:d,transform:e.transform,boundingVolume:A}}function WB(e,t,r){if(t.region){let{childTileX:n,childTileY:s,childTileZ:o}=r,[i,a,c,l,u,f]=t.region,h=2**e,d=(c-i)/h,p=(l-a)/h,A=(f-u)/h,[g,y]=[i+d*n,i+d*(n+1)],[E,_]=[a+p*s,a+p*(s+1)],[B,S]=[u+A*o,u+A*(o+1)];return{region:[g,E,y,_,B,S]}}if(t.box)return t;throw new Error(`Unsupported bounding volume type ${JSON.stringify(t)}`)}function er(e,t,r){return(e<<r)+t}function Fo(e,t,r,n,s){let o=YB({level:t,x:r,y:n,z:s});return e.replace(/{level}|{x}|{y}|{z}/gi,i=>o[i])}function YB(e){let t={};for(let r in e)t[`{${r}}`]=e[r];return t}function KB(e,t){let r=Math.floor(e/8),n=e%8;return(t[r]>>n&1)===1}function Xc(e,t=""){if(!t)return Lt.EMPTY;let n=t.split("?")[0].split(".").pop();switch(n){case"pnts":return Lt.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return Lt.SCENEGRAPH;default:return n||Lt.EMPTY}}function Wc(e){switch(e){case"REPLACE":case"replace":return ft.REPLACE;case"ADD":case"add":return ft.ADD;default:return e}}function jc(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 ge.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=jc(s,t))}return{...e,id:r,contentUrl:r,lodMetricType:ae.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Xc(e,r),refine:Wc(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 u=sm(l),f;u?f=await nm(l,e,t,u,r):f=rm(l,t),f&&(c.push(f),o.push(f))}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,u=Fo(l,0,0,0,0),f=jc(u,r),h=await(0,om.load)(f,Mo,s),d=e.content?.uri,p=d?jc(d,r):"",A=t?.root?.refine,g=e.geometricError,y=e.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];if(y){let S={box:wo(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:ae.GEOMETRIC_ERROR,rootLodMetricValue:g,rootBoundingVolume:E,getTileType:Xc,getRefine:Wc};return await QB(e,r,h,_,s)}async function QB(e,t,r,n,s){if(!e)return null;let{children:o,contentUrl:i}=await qc({subtree:r,implicitOptions:n,loaderOptions:s}),a,c=null;return i&&(a=i,c={uri:i.replace(`${t}/`,"")}),{...e,id:a,contentUrl:a,lodMetricType:ae.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Xc(e,a),refine:Wc(e.refine),content:c||e.content,children:o}}function sm(e){return e?.extensions?.["3DTILES_implicit_tiling"]||e?.implicitTiling}var Lo={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:ao,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:ZB,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function ZB(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?$B(e,t,r):tC(e,t,r)}async function $B(e,t,r){let n=JSON.parse(new TextDecoder().decode(e)),s=r?.url||"",o=eC(s),i=await im(n,o,t||{});return{...n,shape:"tileset3d",loader:Lo,url:s,queryString:r?.queryString||"",basePath:o,root:i||n.root,type:lt.TILES3D,lodMetricType:ae.GEOMETRIC_ERROR,lodMetricValue:n.root?.geometricError||0}}async function tC(e,t,r){let n={content:{shape:"tile3d",featureIds:null}};return await Lc(e,0,t,r,n.content),n.content}function eC(e){return ge.dirname(e)}var am=[0],rC={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:Lo,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]}},Ro=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: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,fm.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 Lt.POINTCLOUD:return this._makePointCloudLayer(t,r);case Lt.SCENEGRAPH:return this._make3DModelLayer(t);case Lt.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:u}=n;if(!c)return null;let f=r&&r.props.data||{header:{vertexCount:s},attributes:{POSITION:c,NORMAL:l,COLOR_0:u}},{pointSize:h,getPointColor:d}=this.props,p=this.getSubLayerClass("pointcloud",lm.PointCloudLayer);return new p({pointSize:h},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${t.id}`,tile:t,data:f,coordinateSystem:we.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",um.ScenegraphLayer);return new i({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${t.id}`,tile:t,data:n||am,scenegraph:r,coordinateSystem:we.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=we.COORDINATE_SYSTEM.METER_OFFSETS,material:l,featureIds:u}=n,{_getMeshColor:f}=this.props,h=r&&r.props.mesh||new cm.Geometry({topology:"triangle-list",attributes:nC(s),indices:o}),d=this.getSubLayerClass("mesh",Bn);return new d(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${t.id}`,tile:t,mesh:h,data:am,getColor:f(t),pbrMaterial:l,modelMatrix:i,coordinateOrigin:a,coordinateSystem:c,featureIds:u,_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}},On=Ro;(()=>{Ro.defaultProps=rC})(),(()=>{Ro.layerName="Tile3DLayer"})();function nC(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 Uo=N(Dt(),1),$c=N(zs(),1),xm=N(Dt(),1);var sC=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 Yc(e){return e>>1^-(e&1)}function oC(e){let t=0,r={};for(let[n,s]of sC){let o=s===8?e.getFloat64:e.getFloat32;r[n]=o.call(e,t,!0),t+=s}return{header:r,headerEndPosition:t}}function iC(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,u=l+a,f=0,h=0,d=0;for(let p=0;p<s;p++)f+=Yc(e.getUint16(c+i*p,!0)),h+=Yc(e.getUint16(l+i*p,!0)),d+=Yc(e.getUint16(u+i*p,!0)),o[p]=f,o[p+s]=h,o[p+s*2]=d;return r+=a*3,{vertexData:o,vertexDataEndPosition:r}}function Nn(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 aC(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=Nn(e.buffer,n,c,i);return n+=c*i,{triangleIndicesEndPosition:n,triangleIndices:l}}function cC(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=Nn(e.buffer,n,a,i,!1);n+=a*i;let l=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let u=Nn(e.buffer,n,l,i,!1);n+=l*i;let f=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let h=Nn(e.buffer,n,f,i,!1);n+=f*i;let d=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let p=Nn(e.buffer,n,d,i,!1);return n+=d*i,{edgeIndicesEndPosition:n,westIndices:c,southIndices:u,eastIndices:h,northIndices:p}}function lC(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function uC(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function fC(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=lC(i);break}case 2:{r.waterMask=uC(i);break}default:}n+=o}return{extensions:r,extensionsEndPosition:n}}var rr={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},hC={maxDecodingStep:rr.extensions};function Kc(e,t){let r=Object.assign({},hC,t),n=new DataView(e),{header:s,headerEndPosition:o}=oC(n);if(r.maxDecodingStep<rr.vertices)return{header:s};let{vertexData:i,vertexDataEndPosition:a}=iC(n,o);if(r.maxDecodingStep<rr.triangleIndices)return{header:s,vertexData:i};let{triangleIndices:c,triangleIndicesEndPosition:l}=aC(n,i,a);if(r.maxDecodingStep<rr.edgeIndices)return{header:s,vertexData:i,triangleIndices:c};let{westIndices:u,southIndices:f,eastIndices:h,northIndices:d,edgeIndicesEndPosition:p}=cC(n,i,l);if(r.maxDecodingStep<rr.extensions)return{header:s,vertexData:i,triangleIndices:c,westIndices:u,northIndices:d,eastIndices:h,southIndices:f};let{extensions:A}=fC(n,p);return{header:s,vertexData:i,triangleIndices:c,westIndices:u,northIndices:d,eastIndices:h,southIndices:f,extensions:A}}function Po(e,t,r,n){let s=n?pC(n,e.POSITION.value):dC(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 u=s[l];mC({edge:u,edgeIndex:l,attributes:e,skirtHeight:r,newPosition:o,newTexcoord0:i,newTriangles:a})}e.POSITION.value=Xr(e.POSITION.value,o),e.TEXCOORD_0.value=Xr(e.TEXCOORD_0.value,i);let c=t instanceof Array?t.concat(a):Xr(t,a);return{attributes:e,triangles:c}}function dC(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 pC(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 mC({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 u=t*2*3;i[u]=e[0],i[u+1]=a/3+l,i[u+2]=e[1],i[u+3]=a/3+l,i[u+4]=e[0],i[u+5]=a/3+c}function Qc(e,t={}){let{bounds:r}=t,{header:n,vertexData:s,triangleIndices:o,westIndices:i,northIndices:a,eastIndices:c,southIndices:l}=Kc(e,rr.triangleIndices),u=o,f=gC(s,n,r),h=Ke(f);if(t?.skirtHeight){let{attributes:d,triangles:p}=Po(f,u,t.skirtHeight,{westIndices:i,northIndices:a,eastIndices:c,southIndices:l});f=d,u=p}return{loaderData:{header:{}},header:{vertexCount:u.length,boundingBox:h},schema:void 0,topology:"triangle-list",mode:4,indices:{value:u,size:1},attributes:f}}function gC(e,t,r){let{minHeight:n,maxHeight:s}=t,[o,i,a,c]=r||[0,0,1,1],l=a-o,u=c-i,f=s-n,h=e.length/3,d=new Float32Array(h*3),p=new Float32Array(h*2);for(let A=0;A<h;A++){let g=e[A]/32767,y=e[A+h]/32767,E=e[A+h*2]/32767;d[3*A+0]=g*l+o,d[3*A+1]=y*u+i,d[3*A+2]=E*f+n,p[2*A+0]=g,p[2*A+1]=y}return{POSITION:{value:d,size:3},TEXCOORD_0:{value:p,size:2}}}var Dn=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,u=0;for(s&1?a=c=l=r:o=i=u=r;(s>>=1)>1;){let h=o+a>>1,d=i+c>>1;s&1?(a=o,c=i,o=l,i=u):(o=a,i=c,a=l,c=u),l=h,u=d}let f=n*4;this.coords[f+0]=o,this.coords[f+1]=i,this.coords[f+2]=a,this.coords[f+3]=c}}createTile(t){return new Zc(t,this)}},Zc=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],u=n[c+1],f=n[c+2],h=n[c+3],d=l+f>>1,p=u+h>>1,A=d+p-u,g=p+l-d,y=(o[u*s+l]+o[h*s+f])/2,E=p*s+d,_=Math.abs(y-o[E]);if(i[E]=Math.max(i[E],_),a<r){let B=(u+g>>1)*s+(l+A>>1),S=(h+g>>1)*s+(f+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),u=new Uint32Array(i*3),f=0;function h(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)h(y,E,d,p,_,B),h(A,g,y,E,_,B);else{let S=n[p*r+d]-1,b=n[g*r+A]-1,w=n[E*r+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[f++]=S,u[f++]=b,u[f++]=w}}return h(0,0,a,a,a,0),h(a,a,0,0,0,a),{vertices:l,triangles:u}}};var vn=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),u=this._addTriangle(l,i,c,-1,-1,-1);this._addTriangle(i,l,a,u,-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),u=Math.max(t,n,o),f=Math.max(r,s,i),h=nr(n,s,o,i,c,l),d=nr(o,i,t,r,c,l),p=nr(t,r,n,s,c,l),A=s-r,g=t-n,y=i-s,E=n-o,_=r-i,B=o-t,S=nr(t,r,n,s,o,i),b=this.heightAt(t,r)/S,w=this.heightAt(n,s)/S,C=this.heightAt(o,i)/S,T=0,m=0,M=0,L=0;for(let R=l;R<=f;R++){let F=0;h<0&&y!==0&&(F=Math.max(F,Math.floor(-h/y))),d<0&&_!==0&&(F=Math.max(F,Math.floor(-d/_))),p<0&&A!==0&&(F=Math.max(F,Math.floor(-p/A)));let D=h+y*F,X=d+_*F,H=p+A*F,Q=!1;for(let j=c+F;j<=u;j++){if(D>=0&&X>=0&&H>=0){Q=!0;let W=b*D+w*X+C*H,$=Math.abs(W-this.heightAt(j,R));L+=$*$,$>T&&(T=$,m=j,M=R)}else if(Q)break;D+=y,X+=_,H+=A}h+=E,d+=B,p+=g}(m===t&&M===r||m===n&&M===s||m===o&&M===i)&&(T=0),this._candidates[2*a]=m,this._candidates[2*a+1]=M,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],u=this.coords[2*i],f=this.coords[2*i+1],h=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(nr(c,l,u,f,p,A)===0)this._handleCollinear(g,r);else if(nr(u,f,h,d,p,A)===0)this._handleCollinear(g,n);else if(nr(h,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),b=this._addTriangle(a,o,g,_,B+2,S+1);this._legalize(B),this._legalize(S),this._legalize(b)}}_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],u=this.triangles[t],f=this.triangles[o],h=this.triangles[a],d=this.coords;if(!AC(d[2*l],d[2*l+1],d[2*u],d[2*u+1],d[2*f],d[2*f+1],d[2*h],d[2*h+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,h,f,-1,g,p,n),_=this._addTriangle(h,l,u,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],u=this._halfedges[o],f=this._halfedges[r];if(f<0){let b=this._addTriangle(t,i,a,-1,u,-1,n),w=this._addTriangle(i,t,c,b,-1,l);this._legalize(b+1),this._legalize(w+2);return}let h=f-f%3,d=h+(f+2)%3,p=h+(f+1)%3,A=this.triangles[d],g=this._halfedges[d],y=this._halfedges[p];this._queueRemove(h/3);let E=this._addTriangle(i,a,t,u,-1,-1,n),_=this._addTriangle(a,A,t,y,-1,E+1,h),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 nr(e,t,r,n,s,o){return(r-s)*(t-o)-(n-o)*(e-s)}function AC(e,t,r,n,s,o,i,a){let c=e-i,l=t-a,u=r-i,f=n-a,h=s-i,d=o-a,p=c*c+l*l,A=u*u+f*f,g=h*h+d*d;return c*(f*g-A*d)-l*(u*g-A*h)+p*(u*d-f*h)<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=Oo(o,i,a,s,t.tesselator),l=hm(r,i,c);break;case"delatin":c=Oo(o,i,a,s,t.tesselator),l=dm(r,i,a,c);break;default:i===a&&!(a&i-1)?(c=Oo(o,i,a,s,"martini"),l=hm(r,i,c)):(c=Oo(o,i,a,s,"delatin"),l=dm(r,i,a,c));break}let{vertices:u}=l,{triangles:f}=l,h=xC(u,c,i,a,n),d=Ke(h);if(t.skirtHeight){let{attributes:p,triangles:A}=Po(h,f,t.skirtHeight);h=p,f=A}return{loaderData:{header:{}},header:{vertexCount:f.length,boundingBox:d},mode:4,indices:{value:Uint32Array.from(f),size:1},attributes:h}}function hm(e,t,r){let n=t+1,o=new Dn(n).createTile(r),{vertices:i,triangles:a}=o.getMesh(e);return{vertices:i,triangles:a}}function dm(e,t,r,n){let s=new vn(n,t+1,r+1);s.run(e);let{coords:o,triangles:i}=s;return{vertices:o,triangles:i}}function Oo(e,t,r,n,s){let{rScaler:o,bScaler:i,gScaler:a,offset:c}=n,l=new Float32Array((t+1)*(r+1));for(let u=0,f=0;f<r;f++)for(let h=0;h<t;h++,u++){let d=u*4,p=e[d+0],A=e[d+1],g=e[d+2];l[u+f]=p*o+A*a+g*i+c}if(s==="martini"){for(let u=(t+1)*t,f=0;f<t;f++,u++)l[u]=l[u-t-1];for(let u=r,f=0;f<r+1;f++,u+=r+1)l[u]=l[u-1]}return l}function xC(e,t,r,n,s){let o=r+1,i=e.length/2,a=new Float32Array(i*3),c=new Float32Array(i*2),[l,u,f,h]=s||[0,0,r,n],d=(f-l)/r,p=(h-u)/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+h,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 No="4.2.0-beta.2";var Do={dataType:null,batchType:null,name:"Terrain",id:"terrain",module:"terrain",version:No,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={dataType:null,batchType:null,name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:No,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var yC={...Do,parse:TC};async function TC(e,t,r){let n={...t,mimeType:"application/x.image",image:{...t?.image,type:"data"}},s=await Et(e,[],n,r),o={...yC.options.terrain,...t?.terrain};return pm(s,o)}var kG={...mm,parseSync:(e,t)=>Qc(e,t?.["quantized-mesh"]),parse:async(e,t)=>Qc(e,t?.["quantized-mesh"])};var gm=[1],_C={...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:[Do]};function Am(e){return Array.isArray(e)?e.join(";"):e||""}var vo=class extends Uo.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&&Uo.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=Qt(r,t),l=s&&Qt(s,t),{signal:u}=t,f=[0,0],h=[0,0];if(a.isGeospatial){let g=t.bbox;f=a.projectFlat([g.west,g.south]),h=a.projectFlat([g.east,g.north])}else{let g=t.bbox;f=[g.left,g.bottom],h=[g.right,g.top]}let d=[f[0],f[1],h[0],h[1]],p=this.loadTerrain({elevationData:c,bounds:d,elevationDecoder:o,meshMaxError:i,signal:u}),A=l?n(l,{propName:"texture",layer:this,loaders:[],signal:u}).catch(g=>null):Promise.resolve(null);return Promise.all([p,A])}renderSubLayers(t){let r=this.getSubLayerClass("mesh",$c.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:u,extent:f,maxRequests:h,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(n),texture:Am(s),meshMaxError:i,elevationDecoder:a}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:c,maxZoom:l,minZoom:u,extent:f,maxRequests:h,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:g,maxCacheByteSize:y,refinementStrategy:E});if(!n)return null;let _=this.getSubLayerClass("mesh",$c.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})}},Un=vo;(()=>{vo.defaultProps=_C})(),(()=>{vo.layerName="TerrainLayer"})();var ei=N(Dt(),1),xl=N(Nt(),1),Zm=N(Tm(),1);var Gn={x:0,y:1,z:2};function sr(e,t={}){let{start:r=0,end:n=e.length,plane:s="xy"}=t,o=t.size||2,i=0,a=Gn[s[0]],c=Gn[s[1]];for(let l=r,u=n-o;l<n;l+=o)i+=(e[l+a]-e[u+a])*(e[l+c]+e[u+c]),u=l;return i/2}function el(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,u,f,h,d,p,A;if(o&&(a=IC(e,t,a,r,n,s)),e.length>80*r){h=u=e[0],d=f=e[1];for(let g=r;g<i;g+=r)p=e[g],A=e[g+1],p<h&&(h=p),A<d&&(d=A),p>u&&(u=p),A>f&&(f=A);l=Math.max(u-h,f-d),l=l!==0?32767/l:0}return Vn(a,c,r,h,d,l,0),c}function Em(e,t,r,n,s,o,i){let a,c;o===void 0&&(o=sr(e,{start:t,end:r,size:n,plane:i}));let l=Gn[i[0]],u=Gn[i[1]];if(s===o<0)for(a=t;a<r;a+=n)c=_m(a,e[a+l],e[a+u],c);else for(a=r-n;a>=t;a-=n)c=_m(a,e[a+l],e[a+u],c);return c&&Ho(c,c.next)&&(zn(c),c=c.next),c}function or(e,t){if(!e)return e;t||(t=e);let r=e,n;do if(n=!1,!r.steiner&&(Ho(r,r.next)||et(r.prev,r,r.next)===0)){if(zn(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function Vn(e,t,r,n,s,o,i){if(!e)return;!i&&o&&PC(e,n,s,o);let a=e,c,l;for(;e.prev!==e.next;){if(c=e.prev,l=e.next,o?SC(e,n,s,o):CC(e)){t.push(c.i/r|0),t.push(e.i/r|0),t.push(l.i/r|0),zn(e),e=l.next,a=l.next;continue}if(e=l,e===a){i?i===1?(e=bC(or(e),t,r),Vn(e,t,r,n,s,o,2)):i===2&&MC(e,t,r,n,s,o):Vn(or(e),t,r,n,s,o,1);break}}}function CC(e){let t=e.prev,r=e,n=e.next;if(et(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,u=s<o?s<i?s:i:o<i?o:i,f=a<c?a<l?a:l:c<l?c:l,h=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>=u&&p.x<=h&&p.y>=f&&p.y<=d&&vr(s,a,o,c,i,l,p.x,p.y)&&et(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function SC(e,t,r,n){let s=e.prev,o=e,i=e.next;if(et(s,o,i)>=0)return!1;let a=s.x,c=o.x,l=i.x,u=s.y,f=o.y,h=i.y,d=a<c?a<l?a:l:c<l?c:l,p=u<f?u<h?u:h:f<h?f:h,A=a>c?a>l?a:l:c>l?c:l,g=u>f?u>h?u:h:f>h?f:h,y=tl(d,p,t,r,n),E=tl(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&&vr(a,u,c,f,l,h,_.x,_.y)&&et(_.prev,_,_.next)>=0||(_=_.prevZ,B.x>=d&&B.x<=A&&B.y>=p&&B.y<=g&&B!==s&&B!==i&&vr(a,u,c,f,l,h,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&&_!==i&&vr(a,u,c,f,l,h,_.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!==i&&vr(a,u,c,f,l,h,B.x,B.y)&&et(B.prev,B,B.next)>=0)return!1;B=B.nextZ}return!0}function bC(e,t,r){let n=e;do{let s=n.prev,o=n.next.next;!Ho(s,o)&&Bm(s,n,n.next,o)&&Hn(s,o)&&Hn(o,s)&&(t.push(s.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),zn(n),zn(n.next),n=e=o),n=n.next}while(n!==e);return or(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&&DC(i,a)){let c=Cm(i,a);i=or(i,i.next),c=or(c,c.next),Vn(i,t,r,n,s,o,0),Vn(c,t,r,n,s,o,0);return}a=a.next}i=i.next}while(i!==e)}function IC(e,t,r,n,s,o){let i=[],a,c,l,u,f;for(a=0,c=t.length;a<c;a++)l=t[a]*n,u=a<c-1?t[a+1]*n:e.length,f=Em(e,l,u,n,!1,s&&s[a+1],o),f===f.next&&(f.steiner=!0),i.push(NC(f));for(i.sort(wC),a=0;a<i.length;a++)r=FC(i[a],r);return r}function wC(e,t){return e.x-t.x}function FC(e,t){let r=LC(e,t);if(!r)return t;let n=Cm(r,e);return or(n,n.next),or(r,r.next)}function LC(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 h=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(h<=n&&h>o&&(o=h,i=r.x<r.next.x?r:r.next,h===n))return i}r=r.next}while(r!==t);if(!i)return null;let a=i,c=i.x,l=i.y,u=1/0,f;r=i;do n>=r.x&&r.x>=c&&n!==r.x&&vr(s<l?n:o,s,c,l,s<l?o:n,s,r.x,r.y)&&(f=Math.abs(s-r.y)/(n-r.x),Hn(r,e)&&(f<u||f===u&&(r.x>i.x||r.x===i.x&&RC(i,r)))&&(i=r,u=f)),r=r.next;while(r!==a);return i}function RC(e,t){return et(e.prev,e,t.prev)<0&&et(t.next,e,e.next)<0}function PC(e,t,r,n){let s=e;do s.z===0&&(s.z=tl(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,OC(s)}function OC(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 tl(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 NC(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 vr(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 DC(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!vC(e,t)&&(Hn(e,t)&&Hn(t,e)&&UC(e,t)&&(et(e.prev,e,t.prev)||et(e,t.prev,t))||Ho(e,t)&&et(e.prev,e,e.next)>0&&et(t.prev,t,t.next)>0)}function et(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Ho(e,t){return e.x===t.x&&e.y===t.y}function Bm(e,t,r,n){let s=Vo(et(e,t,r)),o=Vo(et(e,t,n)),i=Vo(et(r,n,e)),a=Vo(et(r,n,t));return!!(s!==o&&i!==a||s===0&&Go(e,r,t)||o===0&&Go(e,n,t)||i===0&&Go(r,e,n)||a===0&&Go(r,t,n))}function Go(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 Vo(e){return e>0?1:e<0?-1:0}function vC(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 Hn(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 UC(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 kn(e.i,e.x,e.y),n=new kn(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 kn(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 zn(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 kn=class{constructor(t,r,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=r,this.y=n}};function sl(e,t,r){let n=kC(e),s=Object.keys(n).filter(o=>n[o]!==Array);return JC(e,{propArrayTypes:n,...t},{numericPropKeys:r&&r.numericPropKeys||s,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function kC(e){let t={};for(let r of e)if(r.properties)for(let n in r.properties){let s=r.properties[n];t[n]=KC(s,t[n])}return t}function JC(e,t,r){let{pointPositionsCount:n,pointFeaturesCount:s,linePositionsCount:o,linePathsCount:i,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:u,polygonFeaturesCount:f,propArrayTypes:h,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(u+1):new Uint16Array(u+1),positions:new A(c*d),globalFeatureIds:new E(c),featureIds:f>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=h[C];w.numericProps[C]=new T(w.positions.length/d)}B.pathIndices[i]=o,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":qC(C,_,b,d,T),_.properties.push(nl(T,p)),y&&_.fields.push({id:w.id}),b.pointFeature++;break;case"LineString":jC(C,B,b,d,T),B.properties.push(nl(T,p)),y&&B.fields.push({id:w.id}),b.lineFeature++;break;case"Polygon":XC(C,S,b,d,T),S.properties.push(nl(T,p)),y&&S.fields.push({id:w.id}),b.polygonFeature++;break;default:throw new Error("Invalid geometry type")}b.feature++}return YC(_,B,S,d)}function qC(e,t,r,n,s){t.positions.set(e.data,r.pointPosition*n);let o=e.data.length/n;ol(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 jC(e,t,r,n,s){t.positions.set(e.data,r.linePosition*n);let o=e.data.length/n;ol(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 XC(e,t,r,n,s){t.positions.set(e.data,r.polygonPosition*n);let o=e.data.length/n;ol(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],u=e.indices[i],f=e.indices[i+1];for(let d=0,p=u.length;d<p;++d){let A=u[d],g=d===p-1?f===void 0?e.data.length:f[0]:u[d+1];t.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(g-A)/n}let h=r.polygonPosition;WC(t,l,u,{startPosition:c,endPosition:h,coordLength:n})}}function WC(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],u=r.slice(1).map(h=>(h-l)/o),f=el(c,u,o,t);for(let h=0,d=f.length;h<d;++h)e.triangles.push(n+f[h])}function rl(e,t){let r={};for(let n in e)r[n]={value:e[n],size:t};return r}function YC(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:rl(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:rl(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:rl(r.numericProps,1)}};return s.polygons&&r.triangles&&(s.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),s}function ol(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 nl(e,t){let r={};for(let n in e)t.includes(n)||(r[n]=e[n]);return r}function KC(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function Jo(e,t){let r=t?.globalFeatureId;return r!==void 0?QC(e,r):ZC(e,t?.type)}function QC(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 zo(n,s,i);s=i,o=a}}if(t===n.globalFeatureIds.value[s])return zo(n,s,n.featureIds.value.length)}throw new Error(`featureId:${t} not found`)}function ZC(e,t){let r=Im(e,t);return $C(r)}function Mm(e,t,r){switch(e.type){case"Point":return nS(e,t,r);case"LineString":return rS(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 $C(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(zo(r,n,o)),n=o,s=i)}t.push(zo(r,n,r.featureIds.value.length))}return t}function zo(e,t,r){let n=Mm(e,t,r),s=eS(e,t,r),o=tS(e,t,r);return{type:"Feature",geometry:n,properties:s,...o}}function tS(e,t=0,r){return e.fields&&e.fields[e.featureIds.value[t]]}function eS(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 u=o[l],f=o[l+1],h=ko(n,u,f);c.push(h)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<s.length-1;c++){let l=s[c],u=s[c+1],f=wm(e,l,u).coordinates;a.push(f)}return{type:"MultiPolygon",coordinates:a}}function rS(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 nS(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 hl=N(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=_S(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 _S(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?ES(r,t):e===3?t.type=r.readVarint():e===4&&(t._geometry=r.pos))}function ES(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 Vr=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;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,u=-1/0;for(;t.pos<r;){if(s<=0){let f=t.readVarint();n=f&7,s=f>>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>u&&(u=i);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,l,c,u]}_toGeoJSON(t){let r=this.loadGeometry(),n=Vr.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 u=0;u<l.length;u++){let f=l[u];f[0]=(f[0]+i)*360/o-180;let h=180-(f[1]+a)*360/o;f[1]=360/Math.PI*Math.atan(Math.exp(h*Math.PI/180))-90}}return this._toGeoJSON(c)}};var Xo=class{version;name;extent;length;_pbf;_keys;_values;_features;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(BS,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 Vr(this._pbf,r,this.extent,this._keys,this._values)}};function BS(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(CS(r)))}function CS(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 Wo=class{layers;constructor(t,r){this.layers=t.readFields(SS,{},r)}};function SS(e,t,r){if(e===3&&r){let n=new Xo(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:[[sr(e.data)]],indices:[e.indices]};let n=[],s=[],o=[],i=[],a,c=0;for(let l,u=0,f;u<t;u++){f=e.indices[u]-c,l=e.indices[u+1]-c||e.data.length;let h=e.data.slice(f,l),d=sr(h);if(d===0){let p=e.data.slice(0,f),A=e.data.slice(l);e.data=p.concat(A),c+=l-f;continue}a===void 0&&(a=d<0),a===d<0?(i.length&&(n.push(o),s.push(i)),i=[f],o=[d]):(o.push(d),i.push(f))}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?bS(r,t):e===3?t.type=r.readVarint():e===4&&(t._geometry=r.pos))}function bS(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,ir,cl,Yo,ll,ul,Jn;var Ko=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;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,ir=1,Yo=0,ll=0,ul=0,Jn=0;let r=[],n=[];for(;t.pos<zm;)if(Yo<=0&&(cl=t.readVarint(),ir=cl&7,Yo=cl>>3),Yo--,ir===1||ir===2)ll+=t.readSVarint(),ul+=t.readSVarint(),ir===1&&r.push(Jn),n.push(ll,ul),Jn+=2;else if(ir===7){if(Jn>0){let s=r[r.length-1];n.push(n[s],n[s+1]),Jn+=2}}else throw new Error(`unknown command ${ir}`);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 Qo=class{version;name;extent;length;_pbf;_keys;_values;_features;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 Ko(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(IS(r)))}function IS(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 Zo=class{layers;constructor(t,r){this.layers=t.readFields(wS,{},r)}};function wS(e,t,r){if(e===3&&r){let n=new Qo(r,r.readVarint()+r.pos);n.length&&t&&(t[n.name]=n)}}function dl(e,t){let r=LS(t),n=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(n){case"columnar-table":return{shape:"columnar-table",data:fl(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 fl(e,r);case"binary":return fl(e,r);default:throw new Error(n||"undefined shape")}}function fl(e,t){let[r,n]=FS(e,t),s=sl(r,n);return s.byteLength=e.byteLength,s}function FS(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 Zo(new hl.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),u=PS(l,t,i);r.push(u)}}),[r,n]}function km(e,t){if(e.byteLength<=0)return[];let r=[],n=new Wo(new hl.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=RS(c,t,o);r.push(l)}}),r}function LS(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 RS(e,t,r){let n=e.toGeoJSON(t.coordinates==="wgs84"?t.tileIndex:OS);return t.layerProperty&&(n.properties[t.layerProperty]=r),n}function PS(e,t,r){let n=e.toBinaryCoordinates(t.coordinates==="wgs84"?t.tileIndex:NS);return t.layerProperty&&n.properties&&(n.properties[t.layerProperty]=r),n}function OS(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 NS(e,t){let{extent:r}=t;for(let n=0,s=e.length;n<s;++n)e[n]/=r}var DS="4.2.0-beta.2",$o={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:DS,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}}},vS={...$o,parse:async(e,t)=>dl(e,t),parseSync:dl,binary:!0};var US={Point:Jm,MultiPoint:GS,LineString:qm,MultiLineString:VS,Polygon:jm,MultiPolygon:HS};function Jm([e,t],[r,n],s){let o=xe(r[0],n[0],e),i=xe(r[1],n[1],t);return s.unprojectFlat([o,i])}function pl(e,t,r){return e.map(n=>Jm(n,t,r))}function GS(e,t,r){return pl(e,t,r)}function qm(e,t,r){return pl(e,t,r)}function VS(e,t,r){return e.map(n=>qm(n,t,r))}function jm(e,t,r){return e.map(n=>pl(n,t,r))}function HS(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:US[e.type](e.coordinates,o,r)}}var zS=["points","lines","polygons"];function ml(e,t,r,n){for(let s of zS){let o=e[s]&&kS(e[s],t,r,n);if(o>=0)return o}return-1}function kS(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=JS(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,u)=>l===r&&s[u]>=o&&s[u]<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?qS(e,a):-1}function JS(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 qS(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 gl=512,jS={...xl.GeoJsonLayer.defaultProps,data:Se,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[$o],binary:!0},ti=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: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=Qt(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=gl/o,a=-i,c=gl*r/o,l=gl*(1-n/o),u=new P().scale([i,a,1]);t.autoHighlight=!1,this.context.viewport.resolution||(t.modelMatrix=u,t.coordinateOrigin=[c,l,0],t.coordinateSystem=ei.COORDINATE_SYSTEM.CARTESIAN,t.extensions=[...t.extensions||[],new Zm.ClipExtension]);let f=super.renderSubLayers(t);return this.state.binary&&!(f instanceof xl.GeoJsonLayer)&&ei.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),f}_updateAutoHighlight(t){let{uniqueIdProperty:r}=this.props,{hoveredFeatureId:n,hoveredFeatureLayerName:s}=this.state,o=t.object,i=null,a=null;o&&(i=Al(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})}_isWGS84(){return Boolean(this.context.viewport.resolution)}getPickingInfo(t){let r=super.getPickingInfo(t);if(this.state.binary&&r.index!==-1){let{data:n}=t.sourceLayer.props;r.object=Jo(n,{globalFeatureId:r.index})}return r.object&&!this._isWGS84()&&(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 u=c?i:r;return Array.isArray(a)?a.findIndex(f=>{let h=Al(f,o)===u,d=c||Ym(f)===n;return h&&d}):a&&s?ml(a,o,u,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=Al(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&&ba(s)){let o=this.state.binary?Jo(n.content):n.content;n._contentWGS84=o.map(i=>Qm(i,s,this.context.viewport))}return n._contentWGS84}})})}},qn=ti;(()=>{ti.layerName="MVTLayer"})(),(()=>{ti.defaultProps=jS})();function Al(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 XS=-90,WS=90,YS=-180,KS=180;function QS(e){let t=!0,r=WS,n=XS,s=KS,o=YS,i,a=0;for(let c=0,l=e.length;c<l;c++){let u=e[c].toLowerCase();a=tg[u];for(let f=4;f>=0;f--){let h=a>>f&1;t?(i=(s+o)/2,h===1?o=i:s=i):(i=(r+n)/2,h===1?n=i:r=i),t=!t}}return[n,o,r,s]}function eg(e){let[t,r,n,s]=QS(e);return[s,n,s,t,r,t,r,n,s,n]}var ZS={getGeohash:{type:"accessor",value:e=>e.geohash}},ri=class extends St{indexToBounds(){let{data:t,getGeohash:r}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(n,s)=>eg(r(n,s))}}},jn=ri;(()=>{ri.layerName="GeohashLayer"})(),(()=>{ri.defaultProps=ZS})();return ug(Xn);})();
|
|
448
|
+
`;function lT(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 uT={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},Sn=class extends Kh.SimpleMeshLayer{getShaders(){let t=super.getShaders();return t.modules.push(Ia),{...t,vs:Xh,fs:Wh}}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 lT(t.attributes),new Yh.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 ya(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})}};Sn.layerName="MeshLayer";Sn.defaultProps=uT;var Qh=Sn;var im=N(yr(),1);var oe=6356752314245179e-9,fT={radii:[6378137,6378137,oe],radiiSquared:[6378137*6378137,6378137*6378137,oe*oe],oneOverRadii:[1/6378137,1/6378137,1/oe],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(oe*oe)],maximumRadius:Math.max(6378137,6378137,oe),centerToleranceSquared:.1};function Vs(e){return e}var Q3=new x;function hT(e,t=[],r=Vs){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 $h(e,t=[]){return hT(e,t,Y._cartographicRadians?Vs:Ci)}function dT(e,t,r=Vs){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 td(e,t){return dT(e,t,Y._cartographicRadians?Vs:Si)}var ed=1e-14,pT=new x,rd={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},wa={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},bn={east:new x,north:new x,up:new x,west:new x,south:new x,down:new x},mT=new x,gT=new x,AT=new x;function La(e,t,r,n,s,o){let i=rd[t]&&rd[t][r];at(i&&(!n||n===i));let a,c,l,u=pT.copy(s);if(mt(u.x,0,ed)&&mt(u.y,0,ed)){let h=Math.sign(u.z);a=mT.fromArray(wa[t]),t!=="east"&&t!=="west"&&a.scale(h),c=gT.fromArray(wa[r]),r!=="east"&&r!=="west"&&c.scale(h),l=AT.fromArray(wa[n]),n!=="east"&&n!=="west"&&l.scale(h)}else{let{up:h,east:d,north:p}=bn;d.set(-u.y,u.x,0).normalize(),e.geodeticSurfaceNormal(u,h),p.copy(h).cross(d);let{down:A,west:g,south:y}=bn;A.copy(h).scale(-1),g.copy(d).scale(-1),y.copy(p).scale(-1),a=bn[t],c=bn[r],l=bn[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]=u.x,o[13]=u.y,o[14]=u.z,o[15]=1,o}var Tr=new x,xT=new x,yT=new x;function nd(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,u=n.y,f=n.z,h=i*i*l*l,d=a*a*u*u,p=c*c*f*f,A=h+d+p,g=Math.sqrt(1/A);if(!Number.isFinite(g))return;let y=xT;if(y.copy(e).scale(g),A<o)return y.to(r);let E=s.x,_=s.y,B=s.z,S=yT;S.set(y.x*E*2,y.y*_*2,y.z*B*2);let b=(1-g)*Tr.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 F=C*C,R=T*T,L=m*m,D=F*C,X=R*T,H=L*m;M=h*F+d*R+p*L-1;let j=-2*(h*D*E+d*X*_+p*H*B);w=M/j}while(Math.abs(M)>Mt.EPSILON12);return Tr.scale([C,T,m]).to(r)}var Hs=new x,sd=new x,ET=new x,Vt=new x,BT=new x,zs=new x,v=class{constructor(t=0,r=0,n=0){this.centerToleranceSquared=Mt.EPSILON1,at(t>=0),at(r>=0),at(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=sd,s=ET,[,,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]){zs.from(t);let n=this.scaleToGeodeticSurface(zs,Vt);if(!n)return;let s=this.geodeticSurfaceNormal(n,sd),o=BT;o.copy(zs).subtract(n);let i=Math.atan2(s.y,s.x),a=Math.asin(s.z),c=Math.sign(He.dot(o,zs))*He.length(o);return td([i,a,c],r)}eastNorthUpToFixedFrame(t,r=new P){return La(this,"east","north","up",t,r)}localFrameToFixedFrame(t,r,n,s,o=new P){return La(this,t,r,n,s,o)}geocentricSurfaceNormal(t,r=[0,0,0]){return Hs.from(t).normalize().to(r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=$h(t),s=n[0],o=n[1],i=Math.cos(o);return Hs.set(i*Math.cos(s),i*Math.sin(s),Math.sin(o)).normalize(),Hs.to(r)}geodeticSurfaceNormal(t,r=[0,0,0]){return Hs.from(t).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(t,r){return nd(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){Vt.from(t);let n=Vt.x,s=Vt.y,o=Vt.z,i=this.oneOverRadiiSquared,a=1/Math.sqrt(n*n*i.x+s*s*i.y+o*o*i.z);return Vt.multiplyScalar(a).to(r)}transformPositionToScaledSpace(t,r=[0,0,0]){return Vt.from(t).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(t,r=[0,0,0]){return Vt.from(t).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){at(mt(this.radii.x,this.radii.y,Mt.EPSILON15)),at(this.radii.z>0),Vt.from(t);let s=Vt.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(s)>=this.radii.z-r))return Vt.set(0,0,s).to(n)}};v.WGS84=new v(6378137,6378137,oe);var ks=class{item;previous;next;constructor(t,r,n){this.item=t,this.previous=r,this.next=n}};var Js=class{head=null;tail=null;_length=0;get length(){return this._length}add(t){let r=new ks(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 qs=class{_list;_sentinel;_trimTiles;constructor(){this._list=new Js,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 od(e,t){G(e),G(t);let{rtcCenter:r,gltfUpAxis:n}=t,{computedTransform:s,boundingVolume:{center:o}}=e,i=new P(s);switch(r&&i.translate(r),n){case"Z":break;case"Y":let f=new P().rotateX(Math.PI/2);i=i.multiplyRight(f);break;case"X":let h=new P().rotateY(-Math.PI/2);i=i.multiplyRight(h);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=v.WGS84.cartesianToCartographic(a,new x),u=v.WGS84.eastNorthUpToFixedFrame(a).invert();t.cartographicModelMatrix=u.multiplyRight(i),t.cartographicOrigin=c,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var id=new x,Fa=new x,Ra=new ot([new ct,new ct,new ct,new ct,new ct,new ct]);function cd(e,t){let{cameraDirection:r,cameraUp:n,height:s}=e,{metersPerUnit:o}=e.distanceScales,i=js(e,e.center),a=v.WGS84.eastNorthUpToFixedFrame(i),c=e.unprojectPosition(e.cameraPosition),l=v.WGS84.cartographicToCartesian(c,new x),u=new x(a.transformAsVector(new x(r).scale(o))).normalize(),f=new x(a.transformAsVector(new x(n).scale(o))).normalize();CT(e);let h=e.constructor,{longitude:d,latitude:p,width:A,bearing:g,zoom:y}=e,E=new h({longitude:d,latitude:p,height:s,width:A,bearing:g,zoom:y,pitch:0});return{camera:{position:l,direction:u,up:f},viewport:e,topDownViewport:E,height:s,cullingVolume:Ra,frameNumber:t,sseDenominator:1.15}}function ld(e,t,r){if(r===0||e.length<=r)return[e,[]];let n=[],{longitude:s,latitude:o}=t.viewport;for(let[l,u]of e.entries()){let[f,h]=u.header.mbs,d=Math.abs(s-f),p=Math.abs(o-h),A=Math.sqrt(p*p+d*d);n.push([l,A])}let i=n.sort((l,u)=>l[1]-u[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=ad(t.near,e.cameraPosition),n=js(e,r),s=js(e,e.cameraPosition,Fa),o=0;Ra.planes[o++].fromPointNormal(n,id.copy(n).subtract(s));for(let i in t){if(i==="near")continue;let a=t[i],c=ad(a,r,Fa),l=js(e,c,Fa);Ra.planes[o++].fromPointNormal(l,id.copy(n).subtract(l))}}function ad(e,t,r=new x){let n=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-n).add(t),r}function js(e,t,r=new x){let n=e.unprojectPosition(t);return v.WGS84.cartographicToCartesian(n,r)}var ST=6378137,bT=6378137,Pa=6356752314245179e-9,_r=new x;function ud(e,t){if(e instanceof Ut){let{halfAxes:r}=e,n=MT(r);return Math.log2(Pa/(n+t[2]))}else if(e instanceof It){let{radius:r}=e;return Math.log2(Pa/(r+t[2]))}else if(e.width&&e.height){let{width:r,height:n}=e,s=Math.log2(ST/r),o=Math.log2(bT/n);return(s+o)/2}return 1}function Oa(e,t,r){v.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(Pa/(n+t[2]))}function fd(e,t,r){let[n,s,o,i]=e;return Oa({xmin:n,xmax:o,ymin:s,ymax:i,zmin:0,zmax:0},t,r)}function MT(e){e.getColumn(0,_r);let t=e.getColumn(1),r=e.getColumn(2);return _r.add(t).add(r).len()}var Id=N(yr(),1);var gt={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 Lt;(function(e){e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh"})(Lt||(Lt={}));var lt;(function(e){e.I3S="I3S",e.TILES3D="TILES3D"})(lt||(lt={}));var ie;(function(e){e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(ie||(ie={}));var hd={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function gd(e){return e!=null}var ht=new x,Xs=new x,IT=new x,wT=new x,Xe=new x,dd=new x,pd=new x,md=new x;function Ws(e,t,r){if(G(e,"3D Tile: boundingVolume must be defined"),e.box)return xd(e.box,t,r);if(e.region)return FT(e.region);if(e.sphere)return LT(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function Ad(e,t){if(e.box)return RT(t);if(e.region){let[r,n,s,o,i,a]=e.region;return[[Ct(r),Ct(n),i],[Ct(s),Ct(o),a]]}if(e.sphere)return PT(t);throw new Error("Unkown boundingVolume type")}function xd(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),u=new Wt;u.fromArray(e,6);let f=new x([1,0,0]),h=new x([0,1,0]),d=new x([0,0,1]);f.transformByQuaternion(u),f.scale(l[0]),h.transformByQuaternion(u),h.scale(l[1]),d.transformByQuaternion(u),d.scale(l[2]),s=[...f.toArray(),...h.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 z([o[0],o[1],o[2],i[0],i[1],i[2],a[0],a[1],a[2]]);return gd(r)?(r.center=n,r.halfAxes=c,r):new Ut(n,c)}function LT(e,t,r){let n=new x(e[0],e[1],e[2]);t.transform(n,n);let s=t.getScale(Xs),o=Math.max(Math.max(s[0],s[1]),s[2]),i=e[3]*o;return gd(r)?(r.center=n,r.radius=i,r):new It(n,i)}function FT(e){let[t,r,n,s,o,i]=e,a=v.WGS84.cartographicToCartesian([Ct(t),Ct(s),o],IT),c=v.WGS84.cartographicToCartesian([Ct(n),Ct(r),i],wT),l=new x().addVectors(a,c).multiplyByScalar(.5);return v.WGS84.cartesianToCartographic(l,Xe),v.WGS84.cartographicToCartesian([Ct(n),Xe[1],Xe[2]],dd),v.WGS84.cartographicToCartesian([Xe[0],Ct(s),Xe[2]],pd),v.WGS84.cartographicToCartesian([Xe[0],Xe[1],i],md),xd([...l,...dd.subtract(l),...pd.subtract(l),...md.subtract(l)],new P)}function RT(e){let t=yd(),{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++)ht.copy(e.center),ht.add(n),ht.add(s),ht.add(o),Td(t,ht),o.negate();s.negate()}n.negate()}return t}function PT(e){let t=yd(),{center:r,radius:n}=e,s=v.WGS84.scaleToGeodeticSurface(r,ht),o;s?o=v.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]){Xs.copy(c).scale(n);for(let l=0;l<2;l++)ht.copy(r),ht.add(Xs),Td(t,ht),Xs.negate()}return t}function yd(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function Td(e,t){v.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 vP=new x,UP=new x,GP=new P,VP=new x,HP=new x,zP=new x;function OT(e,t){let r=e*t;return 1-Math.exp(-(r*r))}function NT(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){let r=e.dynamicScreenSpaceErrorComputedDensity,n=e.dynamicScreenSpaceErrorFactor;return OT(t,r)*n}return 0}function _d(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,u=o*a*(l||1)/(i*c);return u-=NT(n,i),u}var Na=new x,Ed=new x,be=new x,Bd=new x,DT=new x,Da=new P,Cd=new P;function Sd(e,t){if(e.lodMetricValue===0||isNaN(e.lodMetricValue))return"DIG";let r=2*va(e,t);return r<2?"OUT":!e.header.children||r<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}function va(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);v.WGS84.cartographicToCartesian(c,Na),Ed.copy(Na).subtract(a).normalize(),v.WGS84.eastNorthUpToFixedFrame(a,Da),Cd.copy(Da).invert(),be.copy(Na).transform(Cd);let l=Math.sqrt(be[0]*be[0]+be[1]*be[1]),u=l*l/be[2];Bd.copy([be[0],be[1],u]);let h=Bd.transform(Da).subtract(a).normalize(),p=Ed.cross(h).normalize().scale(i).add(a),A=v.WGS84.cartesianToCartographic(p),g=r.project([s,n,o]),y=r.project(A);return DT.copy(g).subtract(y).magnitude()}function bd(e){return{assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}}var Mn=class{_map=new Map;_array;_length;constructor(t=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,r){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]=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){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 vT={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},Zt=class{options;root=null;selectedTiles={};requestedTiles={};emptyTiles={};lastUpdate=new Date().getTime();updateDebounceTime=1e3;_traversalStack=new Mn;_emptyTraversalStack=new Mn;_frameNumber=null;traversalFinished(t){return!0}constructor(t){this.options={...vT,...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,u=!0;for(let f of a)if(f._selectionDepth=s,f.isVisibleAndInRequestVolume?(n.find(f)&&n.delete(f),n.push(f),l=!0):(c||o)&&(this.loadTile(f,r),this.touchTile(f,r)),c){let h;if(f._inRequestVolume?f.hasRenderContent?h=f.contentAvailable:h=this.executeEmptyTraversal(f,r):h=!1,u=u&&h,!u)return!1}return l||(u=!1),u}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 UT(e){return e!=null}var We=class{tileset;header;id;url;parent;refine;type;contentUrl;lodMetricType="geometricError";lodMetricValue=0;boundingVolume=null;content=null;contentState=gt.UNLOADED;gpuMemoryUsageInBytes=0;children=[];depth=0;viewportIds=[];transform=new P;extensions=null;implicitTiling=null;userData={};computedTransform;hasEmptyContent=!1;hasTilesetContent=!1;traverser=new Zt({});_cacheNode=null;_frameNumber=null;_expireDate=null;_expiredContent=null;_boundingBox=void 0;_distanceToCamera=0;_screenSpaceError=0;_visibilityPlaneMask;_visible=void 0;_contentBoundingVolume;_viewerRequestVolume;_initialTransform=new P;_priority=0;_selectedFrame=0;_requestedFrame=0;_selectionDepth=0;_touchedFrame=0;_centerZDepth=0;_shouldRefine=!1;_stackLength=0;_visitedFrame=0;_inRequestVolume=!1;_lodJudge=null;constructor(t,r,n,s=""){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===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=Ad(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,r){switch(this.tileset.type){case lt.I3S:return va(this,t);case lt.TILES3D:return _d(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===gt.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=gt.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=gt.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,Id.load)(n,s,o),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(n){throw this.contentState=gt.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=gt.UNLOADED,!0}updateVisibility(t,r){if(this._frameNumber===t.frameNumber)return;let n=this.parent,s=n?n._visibilityPlaneMask:ot.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!==ot.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(UT(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 P(t.transform):new P;let r=this.parent,n=this.tileset,s=r&&r.computedTransform?r.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new P(s).multiplyRight(this.transform);let o=r&&r._initialTransform?r._initialTransform.clone():new P;this._initialTransform=new P(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=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=ot.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(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=Ws(t.boundingVolume,this.computedTransform,this.boundingVolume);let r=t.content;r&&(r.boundingVolume&&(this._contentBoundingVolume=Ws(r.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=Ws(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new P){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 bd(this.tileset.tileset)}}};var Ys=class extends Zt{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===hd.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 wd=N(yr(),1);var Ks=class{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 Ua={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},Qs=class{_statusMap;pendingTilesRegister=new Ks;constructor(){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:Ua.REQUESTED},this.pendingTilesRegister.register(i,o),t().then(a=>{this._statusMap[r].status=Ua.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=Ua.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 Zs=class extends Zt{_tileManager;constructor(t){super(t),this._tileManager=new Qs}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,r){return t._lodJudge=Sd(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,f=>this._onTileLoad(f,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,wd.load)(s,n,o)}_onTileLoad(t,r,n){let s=new We(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 GT={description:"",ellipsoid:v.WGS84,modelMatrix:new P,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:{}},$s="Tiles In Tileset(s)",Ga="Tiles In Memory",Ld="Tiles In View",Fd="Tiles To Render",Rd="Tiles Loaded",Va="Tiles Loading",Pd="Tiles Unloaded",Od="Failed Tile Loads",Nd="Points/Vertices",Ha="Tile Memory Use",Dd="Maximum Screen Space Error",In=class{options;loadOptions;type;tileset;loader;url;basePath;modelMatrix;ellipsoid;lodMetricType;lodMetricValue;refine;root=null;roots={};asset={};description="";properties;extras=null;attributions={};credits={};stats;contentFormats={draco:!1,meshopt:!1,dds:!1,ktx2:!1};cartographicCenter=null;cartesianCenter=null;zoom=1;boundingVolume=null;dynamicScreenSpaceErrorComputedDensity=0;maximumMemoryUsage=32;gpuMemoryUsageInBytes=0;memoryAdjustedScreenSpaceError=0;_cacheBytes=0;_cacheOverflowBytes=0;_frameNumber=0;_queryParams={};_extensionsUsed=[];_tiles={};_pendingCount=0;selectedTiles=[];traverseCounter=0;geometricError=0;lastUpdatedVieports=null;_requestedTiles=[];_emptyTiles=[];frameStateData={};_traverser;_cache=new qs;_requestScheduler;updatePromise=null;tilesetInitializationPromise;constructor(t,r){this.options={...GT,...r},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||me.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 pe({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 de({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=cd(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]=ld(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(Ld).count=this.selectedTiles.length,this.stats.get(Fd).count=t,this.stats.get(Nd).count=r,this.stats.get(Dd).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(t){this.type===lt.I3S&&(this.calculateViewPropsI3S(),t.root=await t.root),this.root=this._initializeTileHeaders(t,null),this.type===lt.TILES3D&&(this._initializeTiles3DTileset(t),this.calculateViewPropsTiles3D()),this.type===lt.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,v.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=Oa(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,v.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=fd(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,v.WGS84.cartesianToCartographic(r,this.cartographicCenter)):this.cartographicCenter=new x(0,0,-v.WGS84.radii[0]),this.cartesianCenter=r,this.zoom=ud(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get($s),this.stats.get(Va),this.stats.get(Ga),this.stats.get(Ld),this.stats.get(Fd),this.stats.get(Rd),this.stats.get(Pd),this.stats.get(Od),this.stats.get(Nd),this.stats.get(Ha,"memory"),this.stats.get(Dd)}_initializeTileHeaders(t,r){let n=new We(this,t.root,r);if(r&&(r.children.push(n),n.depth=r.depth+1),this.type===lt.TILES3D){let s=[];for(s.push(n);s.length>0;){let o=s.pop();this.stats.get($s).incrementCount();let i=o.header.children||[];for(let a of i){let c=new We(this,a,o);if(c.contentUrl?.includes("?session=")){let u=new URL(c.contentUrl).searchParams.get("session");u&&(this._queryParams.session=u)}o.children.push(c),c.depth=o.depth+1,s.push(c)}}}return n}_initializeTraverser(){let t;switch(this.type){case lt.TILES3D:t=Ys;break;case lt.I3S:t=Zs;break;default:t=Zt}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(Od).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===lt.I3S){let n=this.tileset?.nodePagesTile?.nodesInNodePages||0;this.stats.get($s).reset(),this.stats.get($s).addCount(n)}t&&t.content&&od(t,t.content),this.updateContentTypes(t),this._addTileToCache(t),this.options.onTileLoad(t)}}updateContentTypes(t){if(this.type===lt.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===lt.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(Va).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(Va).decrementCount()}_addTileToCache(t){this._cache.add(this,t,r=>r._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(Rd).incrementCount(),this.stats.get(Ga).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(Ha).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(Ga).decrementCount(),this.stats.get(Pd).incrementCount(),this.stats.get(Ha).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 to="4.2.0-beta.2";var Ye={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},vO=Object.keys(Ye);function za(e,t,r){G(e instanceof ArrayBuffer);let n=new TextDecoder("utf8"),s=new Uint8Array(e,t,r);return n.decode(s)}function vd(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 Ud="4.2.0-beta.2";var Gd={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:Ud,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function Vd(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,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 u=a[l],f=a[l+1],h=a[l+2];t=u<t?u:t,r=f<r?f:r,n=h<n?h:n,s=u>s?u:s,o=f>o?f:o,i=h>i?h:i}return[[t,r,n],[s,o,i]]}function ka(e,t,r){let n=Vd(t.value),s=r||Hd(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:n}]},nullable:!1,metadata:s}}function Hd(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 kd(e,t,r){let n=Jd(t.metadata),s=[],o=VT(t.attributes);for(let i in e){let a=e[i],c=zd(i,a,o[i]);s.push(c)}if(r){let i=zd("indices",r);s.push(i)}return{fields:s,metadata:n}}function VT(e){let t={};for(let r in e){let n=e[r];t[n.name||"undefined"]=n}return t}function zd(e,t,r){let n=r?Jd(r.metadata):void 0;return ka(e,t,n)}function Jd(e){Object.entries(e);let t={};for(let r in e)t[`${r}.string`]=JSON.stringify(e[r]);return t}var qd={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},HT={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},zT=4,wn=class{draco;decoder;metadataQuerier;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 h=`DRACO decompression failed: ${i.error_msg()}`;throw new Error(h)}let a=this._getDracoLoaderData(o,s,r),c=this._getMeshData(o,a,r),l=Ke(c.attributes),u=kd(c.attributes,a,c.indices);return{loader:"draco",loaderData:a,header:{vertexCount:o.num_points(),boundingBox:l},...c,schema:u}}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 a=this._getAttributeValues(r,o);if(a){let{value:c,size:l}=a;s[i]={value:c,size:l,byteOffset:o.byte_offset,byteStride:o.byte_stride,normalized:o.normalized}}}return s}_getTriangleListIndices(t){let n=t.num_faces()*3,s=n*zT,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),qT(r)}finally{this.draco.destroy(r)}}_getAttributeValues(t,r){let n=HT[r.data_type];if(!n)return console.warn(`DRACO: Unsupported attribute type ${r.data_type}`),null;let s=r.num_components,i=t.num_points()*s,a=i*n.BYTES_PER_ELEMENT,c=kT(this.draco,n),l,u=this.draco._malloc(a);try{let f=this.decoder.GetAttribute(t,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,f,c,a,u),l=new n(this.draco.HEAPF32.buffer,u,i).slice()}finally{this.draco._free(u)}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 qd)if(this.draco[i]===s)return qd[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=JT(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 kT(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 JT(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}function qT(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}var jT="1.5.6",XT="1.4.1",Ja=`https://www.gstatic.com/draco/versioned/decoders/${jT}`,yt={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},qa={[yt.DECODER]:`${Ja}/${yt.DECODER}`,[yt.DECODER_WASM]:`${Ja}/${yt.DECODER_WASM}`,[yt.FALLBACK_DECODER]:`${Ja}/${yt.FALLBACK_DECODER}`,[yt.ENCODER]:`https://raw.githubusercontent.com/google/draco/${XT}/javascript/${yt.ENCODER}`},ja;async function jd(e){let t=e.modules||{};return t.draco3d?ja||=t.draco3d.createDecoderModule({}).then(r=>({draco:r})):ja||=WT(e),await ja}async function WT(e){let t,r;switch(e.draco&&e.draco.decoderType){case"js":t=await jt(qa[yt.FALLBACK_DECODER],"draco",e,yt.FALLBACK_DECODER);break;case"wasm":default:[t,r]=await Promise.all([await jt(qa[yt.DECODER],"draco",e,yt.DECODER),await jt(qa[yt.DECODER_WASM],"draco",e,yt.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await YT(t,r)}function YT(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e({...r,onModuleLoaded:s=>n({draco:s})})})}var eo={...Gd,parse:KT};async function KT(e,t){let{draco:r}=await jd(t),n=new wn(r);try{return n.parseSync(e,t?.draco)}finally{n.destroy()}}var QT={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},nt={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},O={...QT,...nt};var Xa={[nt.DOUBLE]:Float64Array,[nt.FLOAT]:Float32Array,[nt.UNSIGNED_SHORT]:Uint16Array,[nt.UNSIGNED_INT]:Uint32Array,[nt.UNSIGNED_BYTE]:Uint8Array,[nt.BYTE]:Int8Array,[nt.SHORT]:Int16Array,[nt.INT]:Int32Array},ZT={DOUBLE:nt.DOUBLE,FLOAT:nt.FLOAT,UNSIGNED_SHORT:nt.UNSIGNED_SHORT,UNSIGNED_INT:nt.UNSIGNED_INT,UNSIGNED_BYTE:nt.UNSIGNED_BYTE,BYTE:nt.BYTE,SHORT:nt.SHORT,INT:nt.INT},Wa="Failed to convert GL type",dt=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let r in Xa)if(Xa[r]===t)return r;throw new Error(Wa)}static fromName(t){let r=ZT[t];if(!r)throw new Error(Wa);return r}static getArrayType(t){switch(t){case nt.UNSIGNED_SHORT_5_6_5:case nt.UNSIGNED_SHORT_4_4_4_4:case nt.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let r=Xa[t];if(!r)throw new Error(Wa);return r}}static getByteSize(t){return dt.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(dt.getArrayType(t))}static createTypedArray(t,r,n=0,s){s===void 0&&(s=(r.byteLength-n)/dt.getByteSize(t));let o=dt.getArrayType(t);return new o(r,n,s)}};function Xd(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function Ya(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 AN=1/256;var xN=new Ue,yN=new x,TN=new Ue,_N=new Ue,EN=new Uint8Array(1);function Wd(e,t=255){return cs(e,0,t)/t*2-1}function Yd(e){return e<0?-1:1}function Kd(e,t,r,n){if(Xd(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=Wd(e,r),n.y=Wd(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))*Yd(s),n.y=(1-Math.abs(s))*Yd(n.y)}return n.normalize()}function Ka(e,t,r){return Kd(e,t,255,r)}var ae=class{json;buffer;featuresLength=0;_cachedTypedArrays={};constructor(t,r){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=O.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=dt.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=dt.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=dt.createTypedArray(r,n),s[t]=o),o}};var $T={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},t_={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]]},e_={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 Qd(e,t,r,n){let{componentType:s}=e;G(e.componentType);let o=typeof s=="string"?dt.fromName(s):s,i=$T[e.type],a=t_[e.type],c=e_[e.type];return r+=e.byteOffset,{values:dt.createTypedArray(o,t,r,i*n),type:o,size:i,unpacker:a,packer:c}}var $t=e=>e!==void 0;function Zd(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?r_(n,r):null}function r_(e,t){let r,n,s,o=e.instancesLength,i=e.classes,a=e.classIds,c=e.parentCounts,l=e.parentIds,u=o;$t(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 f;if($t(c))for($t(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)),f=new Uint16Array(o),u=0,r=0;r<o;++r)f[r]=u,u+=c[r];$t(l)&&$t(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 h=i.length;for(r=0;r<h;++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(h).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:f,parentIds:l};return o_(A),A}function Er(e,t,r){if(!e)return;let n=e.parentCounts;return e.parentIds?r(e,t):n>0?n_(e,t,r):s_(e,t,r)}function n_(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,u=scratchStack;for(u.length=0,u.push(t);u.length>0;){if(t=u.pop(),c[t]===l)continue;c[t]=l;let f=r(e,t);if($t(f))return f;let h=s[t],d=i[t];for(let p=0;p<h;++p){let A=o[d+p];A!==t&&u.push(A)}}return null}function s_(e,t,r){let n=!0;for(;n;){let s=r(e,t);if($t(s))return s;let o=e.parentIds[t];n=o!==t,t=o}throw new Error("traverseHierarchySingleParent")}function o_(e){let t=[],n=e.classIds.length;for(let s=0;s<n;++s)$d(e,s,stack)}function $d(e,t,r){let n=e.parentCounts,s=e.parentIds,o=e.parentIndexes,a=e.classIds.length;if(!$t(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=$t(n)?n[t]:1,l=$t(n)?o[t]:t;for(let u=0;u<c;++u){let f=s[l+u];f!==t&&$d(e,f,r)}r.pop(t)}function Tt(e){return e!=null}var ro=(e,t)=>e,i_={HIERARCHY:!0,extensions:!0,extras:!0},Qe=class{json;binary;featureCount;_extensions;_properties;_binaryProperties;_hierarchy;constructor(t,r,n,s={}){G(n>=0),this.json=t||{},this.binary=r,this.featureCount=n,this._extensions=this.json?.extensions||{},this._properties={};for(let o in this.json)i_[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),s["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=Zd(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),G(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 Tt(n)}return!1}isExactClass(t,r){return G(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),G(typeof r=="string",r),Tt(this._properties[r])||this._hasPropertyInHierarchy(t,r)}getPropertyNames(t,r){this._checkBatchId(t),r=Tt(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),G(typeof r=="string",r),this._binaryProperties){let s=this._binaryProperties[r];if(Tt(s))return this._getBinaryProperty(s,t)}let n=this._properties[r];if(Tt(n))return ro(n[t],!0);if(this._hierarchy){let s=this._getHierarchyProperty(t,r);if(Tt(s))return s}}setProperty(t,r,n){let s=this.featureCount;if(this._checkBatchId(t),G(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];Tt(o)||(this._properties[r]=new Array(s),o=this._properties[r]),o[t]=ro(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;G(this.binary,`Property ${t} requires a batch table binary.`),G(n.type,`Property ${t} requires a type.`);let s=Qd(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 Tt(a[r])});return Tt(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 Tt(c)?Tt(c.typedArray)?this._getBinaryProperty(c,a):ro(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],u=i.classIndexes[a],f=l.instances[n];return Tt(f)?(G(a===r,`Inherited property "${n}" is read-only.`),Tt(f.typedArray)?this._setBinaryProperty(f,u,s):f[u]=ro(s,!0),!0):!1});return Tt(o)}};function Me(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,tp="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(tp)):c>=570425344&&(r-=Br,s=a,a=o,c=i,o=0,i=0,console.warn(tp)),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=a_(e,t,r,n),r=c_(e,t,r,n),r}function a_(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=za(t,r,s);e.featureTableJson=JSON.parse(a)}return r+=s||0,e.featureTableBinary=new Uint8Array(t,r,o),r+=o||0,r}function c_(e,t,r,n){let{batchTableJsonByteLength:s,batchTableBinaryByteLength:o}=e.header||{};if(s&&s>0){let i=za(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 Qa(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],u=r.getProperty(c,"dimensions").map(f=>f*255);i[a*3]=u[0],i[a*3+1]=u[1],i[a*3+2]=u[2]}return{type:O.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=Ya(t[a]);i[a*3]=c[0],i[a*3+1]=c[1],i[a*3+2]=c[2]}return{type:O.UNSIGNED_BYTE,value:i,size:3,normalized:!0}}return t&&t.length===o*3?{type:O.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:O.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var ep=new x;function rp(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++)Ka(t[n*2],t[n*2+1],ep),ep.toArray(r,n*3);return{type:O.FLOAT,size:2,value:r}}return{type:O.FLOAT,size:2,value:t}}function np(e,t,r){return e.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,l_(e,t)):{type:O.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function l_(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 sp(e,t,r,n,s){r=Me(e,t,r),r=Cr(e,t,r),r=Sr(e,t,r,n),u_(e);let{featureTable:o,batchTable:i}=f_(e);return await g_(e,o,i,n,s),h_(e,o,n),d_(e,o,i),p_(e,o),r}function u_(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function f_(e){let t=new ae(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",O.FLOAT,3);let n=m_(e,t);return{featureTable:t,batchTable:n}}function h_(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",O.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let n=t.getPropertyArray("POSITION_QUANTIZED",O.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",O.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",O.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=np(e,n,r)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function d_(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",O.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?n=t.getPropertyArray("RGB",O.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(n=t.getPropertyArray("RGB565",O.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=Qa(e,n,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",O.UNSIGNED_BYTE,4))}function p_(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",O.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",O.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=rp(e,r)}}function m_(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",O.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 Qe(s,o,n)}return r}async function g_(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 f=l.byteOffset,h=l.byteLength;if(!i||!Number.isFinite(f)||!h)throw new Error("Draco properties, byteOffset, and byteLength must be defined");o=(e.featureTableBinary||[]).slice(f,f+h),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 u={buffer:o,properties:{...i,...a},featureTableProperties:i,batchTableProperties:a,dequantizeInShader:!1};return await A_(e,u,n,s)}async function A_(e,t,r,n){if(!n)return;let s={...r,draco:{...r?.draco,extraAttributes:t.batchTableProperties||{}}};delete s["3d-tiles"];let o=await Et(t.buffer,eo,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,u=i&&o.attributes.POSITION.value.quantization,f=c&&o.attributes.NORMAL.value.quantization;if(u){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}f&&(e.octEncodedRange=(1<<o.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let h={};if(t.batchTableProperties)for(let d of Object.keys(t.batchTableProperties))o.attributes[d]&&o.attributes[d].value&&(h[d.toLowerCase()]=o.attributes[d].value);e.attributes={positions:i,colors:Qa(e,a,void 0),normals:c,batchIds:l,...h}}var Za={};ut(Za,{decode:()=>w_,name:()=>I_});function it(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var no={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},so={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var x_=1.33,op=["SCALAR","VEC2","VEC3","VEC4"],y_=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],T_=new Map(y_),__={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},E_={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},B_={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function oo(e){return op[e-1]||op[0]}function br(e){let t=T_.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function Mr(e,t){let r=B_[e.componentType],n=__[e.type],s=E_[e.componentType],o=e.count*n,i=e.count*n*s;it(i>=0&&i<=t.byteLength);let a=so[e.componentType],c=no[e.type];return{ArrayType:r,length:o,byteLength:i,componentByteSize:a,numberOfComponentsInElement:c}}function Ln(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*x_)}function ip(e,t,r){let n=e.bufferViews[r];it(n);let s=n.buffer,o=t[s];it(o);let i=(n.byteOffset||0)+o.byteOffset;return new Uint8Array(o.arrayBuffer,i,n.byteLength)}function ap(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:u,numberOfComponentsInElement:f}=Mr(n,s),h=u*f,d=s.byteStride||h;if(typeof s.byteStride>"u"||s.byteStride===h)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,f);p.set(g,A*f)}return p}function C_(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var q=class{gltf;sourceBuffers;byteLength;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];it(n);let s=(t.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,s,t.byteLength)}getTypedArrayForAccessor(t){let r=this.getAccessor(t);return ap(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 it(r),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=r,this.registerUsedExtension(t),r}addRequiredExtension(t,r={}){return it(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;it(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let o={buffer:r,byteOffset:n,byteLength:s};return this.byteLength+=he(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:oo(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:br(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=ci(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 cp(e){return(e%1+1)%1}var lp={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},S_={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},up={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function Fn(e,t){return up[t]*lp[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=lp[t],o=S_[r],i=up[r],a=n*s,c=a*i,l=e.buffer,u=e.byteOffset;return u%i!==0&&(l=new Uint8Array(l).slice(u,u+c).buffer,u=0),new o(l,u,a)}function Lr(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,u=e.gltf.images?.[c];if(u&&typeof u.width<"u"){let f=[];for(let h=0;h<o.length;h+=2){let d=b_(u,l,o,h,t.channels);f.push(d)}return f}}return[]}function io(e,t,r,n,s){if(!r?.length)return;let o=[];for(let u of r){let f=n.findIndex(h=>h===u);f===-1&&(f=n.push(u)-1),o.push(f)}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:br(i),count:i.length});s.attributes[t]=l}function b_(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=M_(i,a,e,c),u=0;for(let f of s){let h=typeof f=="number"?Object.values(o)[f]:o[f],d=l+h.offset,p=$r(e);if(p.data.length<=d)throw new Error(`${p.data.length} <= ${d}`);let A=p.data[d];u|=A<<h.shift}return u}function M_(e,t,r,n=1){let s=r.width,o=cp(e)*(s-1),i=Math.round(o),a=r.height,c=cp(t)*(a-1),l=Math.round(c),u=r.components?r.components:n;return(l*s+i)*u}function ao(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,u=c/s;o.push(e.slice(l,l+u))}return o}function co(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 lo(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),u=o.decode(l);s.push(u),i+=c}}return s}return[]}var fp="EXT_mesh_features",I_=fp;async function w_(e,t){let r=new q(e);L_(r,t)}function L_(e,t){let r=e.gltf.json;if(r.meshes)for(let n of r.meshes)for(let s of n.primitives)F_(e,s,t)}function F_(e,t,r){if(!r?.gltf?.loadBuffers)return;let s=t.extensions?.[fp]?.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=Lr(e,o.texture,t):i=[];o.data=i}}var ec={};ut(ec,{decode:()=>P_,name:()=>R_});var $a="EXT_structural_metadata",R_=$a;async function P_(e,t){let r=new q(e);O_(r,t)}function O_(e,t){if(!t.gltf?.loadBuffers)return;let r=e.getExtension($a);r&&(t.gltf?.loadImages&&N_(e,r),D_(e,r))}function N_(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)U_(e,r,o,t)}function D_(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=v_(s,o);i&&V_(e,r,i)}}function v_(e,t){for(let r of e)if(r.class===t)return r;return null}function U_(e,t,r,n){if(!t)return;let o=r.extensions?.[$a]?.propertyTextures;if(o)for(let i of o){let a=t[i];G_(e,a,r,n)}}function G_(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=Lr(e,a,r);l!==null&&(io(e,i,l,c,r),a.data=c,n.dataAttributeNames.push(i))}}function V_(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=H_(e,t,i,s,a);a.data=c}}}function H_(e,t,r,n,s){let o=[],i=s.values,a=e.getTypedArrayForBufferView(i),c=z_(e,r,s,n),l=k_(e,s,n);switch(r.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{o=J_(r,n,a,c);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${r.type}`);case"STRING":{o=lo(n,a,c,l);break}case"ENUM":{o=q_(t,r,n,a,c);break}default:throw new Error(`Unknown classProperty type ${r.type}`)}return o}function z_(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 k_(e,t,r){return typeof t.stringOffsets<"u"?Ir(e,t.stringOffsets,t.stringOffsetType||"UINT32",r):null}function J_(e,t,r,n){let s=e.array,o=e.count,i=Fn(e.type,e.componentType),a=r.byteLength/i,c;return e.componentType?c=wr(r,e.type,e.componentType,a):c=r,s?n?ao(c,t,n,r.length,i):o?co(c,t,o):[]:c}function q_(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=Fn(t.type,a),l=n.byteLength/c,u=wr(n,t.type,a,l);if(u||(u=n),t.array){if(s)return j_({valuesData:u,numberOfElements:r,arrayOffsets:s,valuesDataBytesLength:n.length,elementSize:c,enumEntry:i});let f=t.count;return f?X_(u,r,f,i):[]}return tc(u,0,r,i)}function j_(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],u=n[c+1]-n[c];if(u+l>s)break;let f=l/o,h=u/o,d=tc(t,f,h,i);a.push(d)}return a}function X_(e,t,r,n){let s=[];for(let o=0;o<t;o++){let i=r*o,a=tc(e,i,r,n);s.push(a)}return s}function tc(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=W_(n,i);a?s.push(a.name):s.push("")}return s}function W_(e,t){for(let r of e.values)if(r.value===t)return r;return null}var rc={};ut(rc,{decode:()=>K_,name:()=>Y_});var hp="EXT_feature_metadata",Y_=hp;async function K_(e,t){let r=new q(e);Q_(r,t)}function Q_(e,t){if(!t.gltf?.loadBuffers)return;let r=e.getExtension(hp);r&&(t.gltf?.loadImages&&Z_(e,r),$_(e,r))}function Z_(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=eE(s,o);a&&nE(e,a,i)}}function $_(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=tE(s,o);i&&rE(e,r,i)}}function tE(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function eE(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function rE(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=sE(e,t,i,s,a);a.data=c}}}function nE(e,t,r){let n=t.class;for(let s in r.properties){let o=t?.properties?.[s];if(o){let i=lE(e,o,n);o.data=i}}}function sE(e,t,r,n,s){let o=[],i=s.bufferView,a=e.getTypedArrayForBufferView(i),c=oE(e,r,s,n),l=iE(e,r,s,n);return r.type==="STRING"||r.componentType==="STRING"?o=lo(n,a,c,l):aE(r)&&(o=cE(r,n,a,c)),o}function oE(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 iE(e,t,r,n){return typeof r.stringOffsetBufferView<"u"?Ir(e,r.stringOffsetBufferView,r.offsetType||"UINT32",n):null}function aE(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 cE(e,t,r,n){let s=e.type==="ARRAY",o=e.componentCount,i="SCALAR",a=e.componentType||e.type,c=Fn(i,a),l=r.byteLength/c,u=wr(r,i,a,l);return s?n?ao(u,t,n,r.length,c):o?co(u,t,o):[]:u}function lE(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)uE(e,r,t,s,i);return s}function uE(e,t,r,n,s){let o={channels:r.channels,...r.texture},i=Lr(e,o,s);i&&io(e,t,i,n,s)}var dp="4.2.0-beta.2";var Fr=!0,pp=1735152710,oc=12,uo=8,fE=1313821514,hE=5130562,dE=0,pE=0,mE=1;function gE(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 mp(e,t=0,r={}){let n=new DataView(e),{magic:s=pp}=r,o=n.getUint32(t,!1);return o===s||o===pp}function gp(e,t,r=0,n={}){let s=new DataView(t),o=gE(s,r+0),i=s.getUint32(r+4,Fr),a=s.getUint32(r+8,Fr);switch(Object.assign(e,{header:{byteOffset:r,byteLength:a,hasBinChunk:!1},type:o,version:i,json:{},binChunks:[]}),r+=oc,e.version){case 1:return AE(e,s,r);case 2:return xE(e,s,r,n={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function AE(e,t,r){G(e.header.byteLength>oc+uo);let n=t.getUint32(r+0,Fr),s=t.getUint32(r+4,Fr);return r+=uo,G(s===dE),nc(e,t,r,n),r+=n,r+=sc(e,t,r,e.header.byteLength),r}function xE(e,t,r,n){return G(e.header.byteLength>oc+uo),yE(e,t,r,n),r+e.header.byteLength}function yE(e,t,r,n){for(;r+8<=e.header.byteLength;){let s=t.getUint32(r+0,Fr),o=t.getUint32(r+4,Fr);switch(r+=uo,o){case fE:nc(e,t,r,s);break;case hE:sc(e,t,r,s);break;case pE:n.strict||nc(e,t,r,s);break;case mE:n.strict||sc(e,t,r,s);break;default:break}r+=he(s,4)}return r}function nc(e,t,r,n){let s=new Uint8Array(t.buffer,r,n),i=new TextDecoder("utf8").decode(s);return e.json=JSON.parse(i),he(n,4)}function sc(e,t,r,n){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:t.buffer}),he(n,4)}function ic(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 cc={};ut(cc,{decode:()=>FE,name:()=>LE});var TE="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",_E="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",EE=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]),BE=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]),CE={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},SE={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function Ap(e,t,r,n,s,o="NONE"){let i=await bE();wE(i,i.exports[SE[s]],e,t,r,n,i.exports[CE[o||"NONE"]])}var ac;async function bE(){return ac||(ac=ME()),ac}async function ME(){let e=TE;WebAssembly.validate(EE)&&(e=_E,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(IE(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function IE(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?BE[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,r)}function wE(e,t,r,n,s,o,i){let a=e.exports.sbrk,c=n+3&-4,l=a(c*s),u=a(o.length),f=new Uint8Array(e.exports.memory.buffer);f.set(o,u);let h=t(l,n,s,u,o.length);if(h===0&&i&&i(l,c,s),r.set(f.subarray(l,l+n*s)),a(l-a(0)),h!==0)throw new Error(`Malformed buffer data: ${h}`)}var fo="EXT_meshopt_compression",LE=fo;async function FE(e,t){let r=new q(e);if(!t?.gltf?.decompressMeshes||!t.gltf?.loadBuffers)return;let n=[];for(let s of e.json.bufferViews||[])n.push(RE(r,s));await Promise.all(n),r.removeExtension(fo)}async function RE(e,t){let r=e.getObjectExtension(t,fo);if(r){let{byteOffset:n=0,byteLength:s=0,byteStride:o,count:i,mode:a,filter:c="NONE",buffer:l}=r,u=e.gltf.buffers[l],f=new Uint8Array(u.arrayBuffer,u.byteOffset+n,s),h=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await Ap(h,i,o,f,a,c),e.removeObjectExtension(t,fo)}}var lc={};ut(lc,{name:()=>PE,preprocess:()=>OE});var Rr="EXT_texture_webp",PE=Rr;function OE(e,t){let r=new q(e);if(!yi("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 uc={};ut(uc,{name:()=>NE,preprocess:()=>DE});var ho="KHR_texture_basisu",NE=ho;function DE(e,t){let r=new q(e),{json:n}=r;for(let s of n.textures||[]){let o=r.getObjectExtension(s,ho);o&&(s.source=o.source,r.removeObjectExtension(s,ho))}r.removeExtension(ho)}var hc={};ut(hc,{decode:()=>HE,encode:()=>zE,name:()=>GE,preprocess:()=>VE});function xp(e){let t={};for(let r in e){let n=e[r];if(r!=="indices"){let s=fc(n);t[r]=s}}return t}function fc(e){let{buffer:t,size:r,count:n}=vE(e);return{value:t,size:r,byteOffset:0,count:n,type:oo(r),componentType:br(t)}}function vE(e){let t=e,r=1,n=0;return e&&e.value&&(t=e.value,r=e.size||1),t&&(ArrayBuffer.isView(t)||(t=UE(t,Float32Array)),n=t.length/r),{buffer:t,size:r,count:n}}function UE(e,t,r=!1){return e?Array.isArray(e)?new t(e):r&&!(e instanceof t)?new t(e):e:null}var Ie="KHR_draco_mesh_compression",GE=Ie;function VE(e,t,r){let n=new q(e);for(let s of yp(n))n.getObjectExtension(s,Ie)}async function HE(e,t,r){if(!t?.gltf?.decompressMeshes)return;let n=new q(e),s=[];for(let o of yp(n))n.getObjectExtension(o,Ie)&&s.push(kE(n,o,t,r));await Promise.all(s),n.removeExtension(Ie)}function zE(e,t={}){let r=new q(e);for(let n of r.json.meshes||[])JE(n,t),r.addRequiredExtension(Ie)}async function kE(e,t,r,n){let s=e.getObjectExtension(t,Ie);if(!s)return;let o=e.getTypedArrayForBufferView(s.bufferView),i=Pe(o.buffer,o.byteOffset),a={...r};delete a["3d-tiles"];let c=await Et(i,eo,a,n),l=xp(c.attributes);for(let[u,f]of Object.entries(l))if(u in t.attributes){let h=t.attributes[u],d=e.getAccessor(h);d?.min&&d?.max&&(f.min=d.min,f.max=d.max)}t.attributes=l,c.indices&&(t.indices=fc(c.indices)),e.removeObjectExtension(t,Ie),qE(t)}function JE(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:{[Ie]:{bufferView:c,attributes:a}}}]}}function qE(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*yp(e){for(let t of e.json.meshes||[])for(let r of t.primitives)yield r}var dc={};ut(dc,{decode:()=>YE,name:()=>jE});var mo="KHR_texture_transform",jE=mo,po=new x,XE=new z,WE=new z;async function YE(e,t){if(!new q(e).hasExtension(mo)||!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=t.json.materials?.[e],n=[r?.pbrMetallicRoughness?.baseColorTexture,r?.emissiveTexture,r?.normalTexture,r?.occlusionTexture,r?.pbrMetallicRoughness?.metallicRoughnessTexture],s=[];for(let o of n)o&&o?.extensions?.[mo]&&QE(t,e,o,s)}function QE(e,t,r,n){let s=ZE(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&&$E(e,a,s)}}function ZE(e,t){let r=e.extensions?.[mo],{texCoord:n=0}=e,{texCoord:s=n}=r;if(!(t.findIndex(([i,a])=>i===n&&a===s)!==-1)){let i=rB(r);return n!==s&&(e.texCoord=s),t.push([n,s]),{originalTexCoord:n,texCoord:s,matrix:i}}return null}function $E(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:u}=e.buffers[c.buffer],f=(u||0)+(a.byteOffset||0)+(c.byteOffset||0),{ArrayType:h,length:d}=Mr(a,c),p=so[a.componentType],A=no[a.type],g=c.byteStride||p*A,y=new Float32Array(d);for(let E=0;E<a.count;E++){let _=new h(l,f+E*g,2);po.set(_[0],_[1],1),po.transformByMatrix3(o),y.set([po[0],po[1]],E*A)}n===s?tB(a,c,e.buffers,y):eB(s,a,t,e,y)}}}}function tB(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 eB(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 rB(e){let{offset:t=[0,0],rotation:r=0,scale:n=[1,1]}=e,s=new z().set(1,0,0,0,1,0,t[0],t[1],1),o=XE.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),i=WE.set(n[0],0,0,0,n[1],0,0,0,1);return s.multiplyRight(o).multiplyRight(i)}var pc={};ut(pc,{decode:()=>sB,encode:()=>oB,name:()=>nB});var Ze="KHR_lights_punctual",nB=Ze;async function sB(e){let t=new q(e),{json:r}=t,n=t.getExtension(Ze);n&&(t.json.lights=n.lights,t.removeExtension(Ze));for(let s of r.nodes||[]){let o=t.getObjectExtension(s,Ze);o&&(s.light=o.light),t.removeObjectExtension(s,Ze)}}async function oB(e){let t=new q(e),{json:r}=t;if(r.lights){let n=t.addExtension(Ze);it(!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,Ze,n)}delete t.json.lights}}var mc={};ut(mc,{decode:()=>aB,encode:()=>cB,name:()=>iB});var Rn="KHR_materials_unlit",iB=Rn;async function aB(e){let t=new q(e),{json:r}=t;for(let n of r.materials||[])n.extensions&&n.extensions.KHR_materials_unlit&&(n.unlit=!0),t.removeObjectExtension(n,Rn);t.removeExtension(Rn)}function cB(e){let t=new q(e),{json:r}=t;if(t.materials)for(let n of r.materials||[])n.unlit&&(delete n.unlit,t.addObjectExtension(n,Rn,{}),t.addExtension(Rn))}var gc={};ut(gc,{decode:()=>uB,encode:()=>fB,name:()=>lB});var Pn="KHR_techniques_webgl",lB=Pn;async function uB(e){let t=new q(e),{json:r}=t,n=t.getExtension(Pn);if(n){let s=hB(n,t);for(let o of r.materials||[]){let i=t.getObjectExtension(o,Pn);i&&(o.technique=Object.assign({},i,s[i.technique]),o.technique.values=dB(o.technique,t)),t.removeObjectExtension(o,Pn)}t.removeExtension(Pn)}}async function fB(e,t){}function hB(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 dB(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 Tp=[ec,Za,cc,lc,uc,hc,pc,mc,gc,dc,rc];function _p(e,t={},r){let n=Tp.filter(s=>Bp(s.name,t));for(let s of n)s.preprocess?.(e,t,r)}async function Ep(e,t={},r){let n=Tp.filter(s=>Bp(s.name,t));for(let s of n)await s.decode?.(e,t,r)}function Bp(e,t){let r=t?.gltf?.excludeExtensions||{};return!(e in r&&!r[e])}var Ac="KHR_binary_glTF";function Cp(e){let t=new q(e),{json:r}=t;for(let n of r.images||[]){let s=t.getObjectExtension(n,Ac);s&&Object.assign(n,s),t.removeObjectExtension(n,Ac)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,t.removeExtension(Ac)}var Sp={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},mB={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},xc=class{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;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),Cp(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 Sp)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 Sp)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=mB[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 bp(e,t={}){return new xc().normalize(e,t)}async function Mp(e,t,r=0,n,s){return gB(e,t,r,n),bp(e,{normalize:n?.gltf?.normalize}),_p(e,n,s),n?.gltf?.loadBuffers&&e.json.buffers&&await AB(e,n,s),n?.gltf?.loadImages&&await xB(e,n,s),await Ep(e,n,s),e}function gB(e,t,r,n){if(n.uri&&(e.baseUri=n.uri),t instanceof ArrayBuffer&&!mp(t,r,n)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=ai(t);else if(t instanceof ArrayBuffer){let i={};r=gp(i,t,r,n.glb),it(i.type==="glTF",`Invalid GLB magic string ${i.type}`),e._glb=i,e.json=i.json}else it(!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 AB(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;it(i);let a=ic(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 xB(e,t,r){let n=yB(e),s=e.json.images||[],o=[];for(let i of n)o.push(TB(e,s[i],i,t,r));return await Promise.all(o)}function yB(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 TB(e,t,r,n,s){let o;if(t.uri&&!t.hasOwnProperty("bufferView")){let a=ic(t.uri,n),{fetch:c}=s;o=await(await c(a)).arrayBuffer(),t.bufferView={data:o}}if(Number.isFinite(t.bufferView)){let a=ip(e.json,e.buffers,t.bufferView);o=Pe(a.buffer,a.byteOffset,a.byteLength)}it(o,"glTF image has no data");let i=await Et(o,[ge,Sa],{...n,mimeType:t.mimeType,basis:n.basis||{format:Gs()}},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 $e={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:dp,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:_B,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function _B(e,t={},r){t={...$e.options,...t},t.gltf={...$e.options.gltf,...t.gltf};let{byteOffset:n=0}=t;return await Mp({},e,n,t,r)}var EB={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},BB={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Ft={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},CB={magFilter:Ft.TEXTURE_MAG_FILTER,minFilter:Ft.TEXTURE_MIN_FILTER,wrapS:Ft.TEXTURE_WRAP_S,wrapT:Ft.TEXTURE_WRAP_T},SB={[Ft.TEXTURE_MAG_FILTER]:Ft.LINEAR,[Ft.TEXTURE_MIN_FILTER]:Ft.NEAREST_MIPMAP_LINEAR,[Ft.TEXTURE_WRAP_S]:Ft.REPEAT,[Ft.TEXTURE_WRAP_T]:Ft.REPEAT};function bB(){return{id:"default-sampler",parameters:SB}}function MB(e){return BB[e]}function IB(e){return EB[e]}var yc=class{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(t,r={}){let{json:n,buffers:s=[],images:o=[]}=t,{baseUri:i=""}=t;return it(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=MB(t.componentType),s=IB(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}=Mr(i,i.bufferView),u=(i.bufferView.byteOffset||0)+(i.byteOffset||0)+a.byteOffset,f=a.arrayBuffer.slice(u,u+l);i.bufferView.byteStride&&(f=this._getValueFromInterleavedBuffer(a,u,i.bufferView.byteStride,i.bytesPerElement,i.count)),i.value=new c(f)}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):bB(),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 CB[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 On(e,t){return new yc().postProcess(e,t)}var go={URI:0,EMBEDDED:1};function Ao(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 xo(e,t,r,n){let s=r?.["3d-tiles"]||{};if(wB(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 Et(e.gltfArrayBuffer,$e,r,n);e.gltf=On(o),e.gpuMemoryUsageInBytes=Ln(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function wB(e,t,r){switch(t){case go.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 go.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function Ip(e,t,r,n,s){r=LB(e,t,r,n,s),await xo(e,go.EMBEDDED,n,s);let o=e?.gltf?.extensions;return o&&o.CESIUM_RTC&&(e.rtcCenter=o.CESIUM_RTC.center),r}function LB(e,t,r,n,s){r=Me(e,t,r),r=Cr(e,t,r),r=Sr(e,t,r,n),r=Ao(e,t,r,n);let o=new ae(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=o.getGlobalProperty("RTC_CENTER",O.FLOAT,3),r}async function wp(e,t,r,n,s){return r=FB(e,t,r,n,s),await xo(e,e.gltfFormat||0,n,s),r}function FB(e,t,r,n,s){if(r=Me(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=Ao(e,t,r,n),!e?.header?.featureTableJsonByteLength||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let i=new ae(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",O.FLOAT,3);let c=new Qe(e.batchTableJson,e.batchTableBinary,a);return RB(e,i,c,a),r}function RB(e,t,r,n){let s=new Array(n),o=new x,i=new x,a=new x,c=new x,l=new z,u=new Wt,f=new x,h={},d=new P,p=[],A=[],g=[],y=[];for(let E=0;E<n;E++){let _;if(t.hasProperty("POSITION"))_=t.getProperty("POSITION",O.FLOAT,3,E,o);else if(t.hasProperty("POSITION_QUANTIZED")){_=t.getProperty("POSITION_QUANTIZED",O.UNSIGNED_SHORT,3,E,o);let m=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",O.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",O.FLOAT,3);if(!M)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let F=65535;for(let R=0;R<3;R++)_[R]=_[R]/F*M[R]+m[R]}if(!_)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");o.copy(_),h.translation=o,e.normalUp=t.getProperty("NORMAL_UP",O.FLOAT,3,E,p),e.normalRight=t.getProperty("NORMAL_RIGHT",O.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",O.UNSIGNED_SHORT,2,E,p),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",O.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?(v.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)),u.fromMatrix3(l),h.rotation=u,f.set(1,1,1);let S=t.getProperty("SCALE",O.FLOAT,1,E,g);Number.isFinite(S)&&f.multiplyByScalar(S);let b=t.getProperty("SCALE_NON_UNIFORM",O.FLOAT,3,E,p);b&&f.scale(b),h.scale=f;let w=t.getProperty("BATCH_ID",O.UNSIGNED_SHORT,1,E,y);w===void 0&&(w=E);let C=new P().fromQuaternion(h.rotation);d.identity(),d.translate(h.translation),d.multiplyRight(C),d.scale(h.scale);let T=d.clone();s[E]={modelMatrix:T,batchId:w}}e.instances=s}async function Lp(e,t,r,n,s,o){r=Me(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 Fp(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 Et(t,$e,r,n);e.gltf=On(s),e.gpuMemoryUsageInBytes=Ln(e.gltf)}else e.gltfArrayBuffer=t;return t.byteLength}async function Tc(e,t=0,r,n,s={shape:"tile3d"}){switch(s.byteOffset=t,s.type=vd(e,t),s.type){case Ye.COMPOSITE:return await Lp(s,e,t,r,n,Tc);case Ye.BATCHED_3D_MODEL:return await Ip(s,e,t,r,n);case Ye.GLTF:return await Fp(s,e,r,n);case Ye.INSTANCED_3D_MODEL:return await wp(s,e,t,r,n);case Ye.POINT_CLOUD:return await sp(s,e,t,r,n);default:throw new Error(`3DTileLoader: unknown type ${s.type}`)}}async function _c(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=Rp(e.slice(8,16)),i=new Uint8Array(e,24,o),c=new TextDecoder("utf8").decode(i),l=JSON.parse(c),u=Rp(e.slice(16,24)),f=new ArrayBuffer(0);if(u&&(f=e.slice(24+o)),await yo(l,l.tileAvailability,f,r),Array.isArray(l.contentAvailability))for(let h of l.contentAvailability)await yo(l,h,f,r);else await yo(l,l.contentAvailability,f,r);return await yo(l,l.childSubtreeAvailability,f,r),l}async function yo(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}`,u=await(await n.fetch(c)).arrayBuffer();t.explicitBitstream=new Uint8Array(u,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 Rp(e){let t=new DataView(e),r=t.getUint32(0,!0),n=t.getUint32(4,!0);return r+2**32*n}var To={dataType:null,batchType:null,id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:to,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:_c,options:{}};var tm=N(yr(),1);var Kp=N(yr(),1);var Rt=null;try{Rt=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,r){this.low=e|0,this.high=t|0,this.unsigned=!!r}K.prototype.__isLong__;Object.defineProperty(K.prototype,"__isLong__",{value:!0});function pt(e){return(e&&e.__isLong__)===!0}function Pp(e){var t=Math.clz32(e&-e);return e?31-t:t}K.isLong=pt;var Op={},Np={};function tr(e,t){var r,n,s;return t?(e>>>=0,(s=0<=e&&e<256)&&(n=Np[e],n)?n:(r=V(e,0,!0),s&&(Np[e]=r),r)):(e|=0,(s=-128<=e&&e<128)&&(n=Op[e],n)?n:(r=V(e,e<0?-1:0,!1),s&&(Op[e]=r),r))}K.fromInt=tr;function Pt(e,t){if(isNaN(e))return t?ce:Ht;if(t){if(e<0)return ce;if(e>=Gp)return zp}else{if(e<=-vp)return _t;if(e+1>=vp)return Hp}return e<0?Pt(-e,t).neg():V(e%Or|0,e/Or|0,t)}K.fromNumber=Pt;function V(e,t,r){return new K(e,t,r)}K.fromBits=V;var _o=Math.pow;function Bc(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?ce:Ht;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 Bc(e.substring(1),t,r).neg();for(var s=Pt(_o(r,8)),o=Ht,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=Pt(_o(r,a));o=o.mul(l).add(Pt(c))}else o=o.mul(s),o=o.add(Pt(c))}return o.unsigned=t,o}K.fromString=Bc;function zt(e,t){return typeof e=="number"?Pt(e,t):typeof e=="string"?Bc(e,t):V(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}K.fromValue=zt;var Dp=1<<16,PB=1<<24,Or=Dp*Dp,Gp=Or*Or,vp=Gp/2,Up=tr(PB),Ht=tr(0);K.ZERO=Ht;var ce=tr(0,!0);K.UZERO=ce;var Pr=tr(1);K.ONE=Pr;var Vp=tr(1,!0);K.UONE=Vp;var Ec=tr(-1);K.NEG_ONE=Ec;var Hp=V(-1,2147483647,!1);K.MAX_VALUE=Hp;var zp=V(-1,-1,!0);K.MAX_UNSIGNED_VALUE=zp;var _t=V(0,-2147483648,!1);K.MIN_VALUE=_t;var I=K.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low};I.toNumber=function(){return this.unsigned?(this.high>>>0)*Or+(this.low>>>0):this.high*Or+(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(_t)){var r=Pt(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=Pt(_o(t,6),this.unsigned),i=this,a="";;){var c=i.div(o),l=i.sub(c.mul(o)).toInt()>>>0,u=l.toString(t);if(i=c,i.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(_t)?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 pt(t)||(t=zt(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(pt(t)||(t=zt(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(_t)?_t:this.not().add(Pr)};I.neg=I.negate;I.add=function(t){pt(t)||(t=zt(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,u=0,f=0,h=0,d=0;return d+=o+l,h+=d>>>16,d&=65535,h+=s+c,f+=h>>>16,h&=65535,f+=n+a,u+=f>>>16,f&=65535,u+=r+i,u&=65535,V(h<<16|d,u<<16|f,this.unsigned)};I.subtract=function(t){return pt(t)||(t=zt(t)),this.add(t.neg())};I.sub=I.subtract;I.multiply=function(t){if(this.isZero())return this;if(pt(t)||(t=zt(t)),Rt){var r=Rt.mul(this.low,this.high,t.low,t.high);return V(r,Rt.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?ce:Ht;if(this.eq(_t))return t.isOdd()?_t:Ht;if(t.eq(_t))return this.isOdd()?_t:Ht;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(Up)&&t.lt(Up))return Pt(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,u=t.low&65535,f=0,h=0,d=0,p=0;return p+=i*u,d+=p>>>16,p&=65535,d+=o*u,h+=d>>>16,d&=65535,d+=i*l,h+=d>>>16,d&=65535,h+=s*u,f+=h>>>16,h&=65535,h+=o*l,f+=h>>>16,h&=65535,h+=i*c,f+=h>>>16,h&=65535,f+=n*u+s*l+o*c+i*a,f&=65535,V(d<<16|p,f<<16|h,this.unsigned)};I.mul=I.multiply;I.divide=function(t){if(pt(t)||(t=zt(t)),t.isZero())throw Error("division by zero");if(Rt){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?Rt.div_u:Rt.div_s)(this.low,this.high,t.low,t.high);return V(r,Rt.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?ce:Ht;var n,s,o;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return ce;if(t.gt(this.shru(1)))return Vp;o=ce}else{if(this.eq(_t)){if(t.eq(Pr)||t.eq(Ec))return _t;if(t.eq(_t))return Pr;var i=this.shr(1);return n=i.div(t).shl(1),n.eq(Ht)?t.isNegative()?Pr:Ec:(s=this.sub(t.mul(n)),o=n.add(s.div(t)),o)}else if(t.eq(_t))return this.unsigned?ce:Ht;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=Ht}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:_o(2,a-48),l=Pt(n),u=l.mul(t);u.isNegative()||u.gt(s);)n-=c,l=Pt(n,this.unsigned),u=l.mul(t);l.isZero()&&(l=Pr),o=o.add(l),s=s.sub(u)}return o};I.div=I.divide;I.modulo=function(t){if(pt(t)||(t=zt(t)),Rt){var r=(this.unsigned?Rt.rem_u:Rt.rem_s)(this.low,this.high,t.low,t.high);return V(r,Rt.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?Pp(this.low):Pp(this.high)+32};I.ctz=I.countTrailingZeros;I.and=function(t){return pt(t)||(t=zt(t)),V(this.low&t.low,this.high&t.high,this.unsigned)};I.or=function(t){return pt(t)||(t=zt(t)),V(this.low|t.low,this.high|t.high,this.unsigned)};I.xor=function(t){return pt(t)||(t=zt(t)),V(this.low^t.low,this.high^t.high,this.unsigned)};I.shiftLeft=function(t){return pt(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 pt(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 pt(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 r;return pt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?V(this.high,this.low,this.unsigned):t<32?(r=32-t,V(this.low<<t|this.high>>>r,this.high<<t|this.low>>>r,this.unsigned)):(t-=32,r=32-t,V(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 pt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?V(this.high,this.low,this.unsigned):t<32?(r=32-t,V(this.high<<r|this.low>>>t,this.low<<r|this.high>>>t,this.unsigned)):(t-=32,r=32-t,V(this.low<<r|this.high>>>t,this.high<<r|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,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]};K.fromBytes=function(t,r,n){return n?K.fromBytesLE(t,r):K.fromBytesBE(t,r)};K.fromBytesLE=function(t,r){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,r)};K.fromBytesBE=function(t,r){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],r)};var Nr=K;var OB=16;function Nn(e){e==="X"&&(e="");let t=e.padEnd(OB,"0");return Nr.fromString(t,!0,16)}function Cc(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 Sc(e,t){let r=NB(e).shiftRightUnsigned(2);return e.add(Nr.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,kp=180/Math.PI;function qp(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,u=0;c==="1"?u=1:c==="2"?(l=1,u=1):c==="3"&&(l=1);let f=Math.pow(2,o-1);GB(f,i,l,u),i[0]+=f*l,i[1]+=f*u}if(r%2===1){let a=i[0];i[0]=i[1],i[1]=a}return{face:r,ij:i,level:o}}function jp(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=Nr.fromString(n,!0,2).toString(10),a="";if(o!==0)for(a=Nr.fromString(s,!0,2).toString(4);a.length<o;)a="0"+a;return`${i}/${a}`}function bc(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function Jp(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Mc(e){return[Jp(e[0]),Jp(e[1])]}function Ic(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 wc([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*kp,n*kp]}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 Xp(e){let t=bc(e.ij,e.level,[.5,.5]),r=Mc(t),n=Ic(e.face,r);return wc(n)}var VB=100;function Lc(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 u=s[l].slice(0),f=s[l+1],h=(f[0]-u[0])/o,d=(f[1]-u[1])/o;for(let p=0;p<o;p++){u[0]+=h,u[1]+=d;let A=bc(r,n,u),g=Mc(A),y=Ic(t,g),E=wc(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 Dr(e){let t=HB(e);return qp(t)}function HB(e){if(e.indexOf("/")>0)return e;let t=Nn(e);return jp(t)}function Fc(e){let t=Dr(e);return Xp(t)}function Yp(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=Dr(o),a=Lc(i);(typeof r>"u"||r===null)&&(r=new Float64Array(4*a.length)),r.set(a,n),n+=a.length}t=Wp(r)}else{let r=Lc(e);t=Wp(r)}return t}function Wp(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 Rc(e,t){let r=t?.minimumHeight||0,n=t?.maximumHeight||0,s=Dr(e),o=Yp(s),i=o.west,a=o.south,c=o.east,l=o.north,u=[];return u.push(new x(i,l,r)),u.push(new x(c,l,r)),u.push(new x(c,a,r)),u.push(new x(i,a,r)),u.push(new x(i,l,n)),u.push(new x(c,l,n)),u.push(new x(c,a,n)),u.push(new x(i,a,n)),u}function Eo(e){let t=e.token,r={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},n=Rc(t,r),s=Fc(t),o=s[0],i=s[1],a=v.WGS84.cartographicToCartesian([o,i,r.maximumHeight]),c=new x(a[0],a[1],a[2]);n.push(c);let l=gn(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=Nn(e.s2VolumeInfo.token),s=Sc(n,t),o=Cc(s),i={...e.s2VolumeInfo};switch(i.token=o,r){case"OCTREE":let l=e.s2VolumeInfo,u=l.maximumHeight-l.minimumHeight,f=u/2,h=l.minimumHeight+u/2;l.minimumHeight=h-f,l.maximumHeight=h+f;break;default:break}return{box:Eo(i),s2VolumeInfo:i}}}async function Oc(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:u,maximumLevel:f,contentUrlTemplate:h,subtreesUriTemplate:d,basePath:p}=t,A={children:[],lodMetricValue:0,contentUrl:""};if(!f)return ri.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${h} won't be loaded...`),A;let g=a+c.level;if(g>f)return A;let y=JB[l],E=Math.log2(y),_=n&1,B=n>>1&1,S=n>>2&1,b=(y**a-1)/(y-1),w=er(r.mortonIndex,n,E),C=b+w,T=er(r.x,_,1),m=er(r.y,B,1),M=er(r.z,S,1),F=!1;a>=u&&(F=Pc(i.childSubtreeAvailability,w));let R=er(c.x,T,a),L=er(c.y,m,a),D=er(c.z,M,a);if(F){let W=`${p}/${d}`,$=Bo(W,g,R,L,D);i=await(0,Kp.load)($,To,o),c={mortonIndex:w,x:T,y:m,z:M,level:a},w=0,C=0,T=0,m=0,M=0,a=0}if(!Pc(i.tileAvailability,C))return A;Pc(i.contentAvailability,C)&&(A.contentUrl=Bo(h,g,R,L,D));let Q=a+1,j={mortonIndex:w,x:T,y:m,z:M};for(let W=0;W<y;W++){let $=qB(s,W,l),At=await Oc({subtree:i,implicitOptions:t,loaderOptions:o,parentData:j,childIndex:W,level:Q,globalData:{...c},s2VolumeBox:$});if(At.contentUrl||At.children.length){let eg=g+1,rg=jB(At,eg,{childTileX:T,childTileY:m,childTileZ:M},t,s);A.children.push(rg)}}return A}function Pc(e,t){let r;return Array.isArray(e)?(r=e[0],e.length>1&&ri.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:u,rootBoundingVolume:f}=n,h=e.contentUrl&&e.contentUrl.replace(`${o}/`,""),d=u/2**t,p=s?.box?{box:s.box}:f,A=XB(t,p,r);return{children:e.children,contentUrl:e.contentUrl,content:{uri:h},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,u,f]=t.region,h=2**e,d=(c-i)/h,p=(l-a)/h,A=(f-u)/h,[g,y]=[i+d*n,i+d*(n+1)],[E,_]=[a+p*s,a+p*(s+1)],[B,S]=[u+A*o,u+A*(o+1)];return{region:[g,E,y,_,B,S]}}if(t.box)return t;throw new Error(`Unsupported bounding volume type ${JSON.stringify(t)}`)}function er(e,t,r){return(e<<r)+t}function Bo(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 Dc(e,t=""){if(!t)return Lt.EMPTY;let n=t.split("?")[0].split(".").pop();switch(n){case"pnts":return Lt.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return Lt.SCENEGRAPH;default:return n||Lt.EMPTY}}function vc(e){switch(e){case"REPLACE":case"replace":return ft.REPLACE;case"ADD":case"add":return ft.ADD;default:return e}}function Nc(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 me.resolve(t,e)}function Qp(e,t){if(!e)return null;let r;if(e.content){let s=e.content.uri||e.content?.url;typeof s<"u"&&(r=Nc(s,t))}return{...e,id:r,contentUrl:r,lodMetricType:ie.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Dc(e,r),refine:vc(e.refine)}}async function em(e,t,r){let n=null,s=$p(e.root);s&&e.root?n=await Zp(e.root,e,t,s,r):n=Qp(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 u=$p(l),f;u?f=await Zp(l,e,t,u,r):f=Qp(l,t),f&&(c.push(f),o.push(f))}i.children=c}return n}async function Zp(e,t,r,n,s){let{subdivisionScheme:o,maximumLevel:i,availableLevels:a,subtreeLevels:c,subtrees:{uri:l}}=n,u=Bo(l,0,0,0,0),f=Nc(u,r),h=await(0,tm.load)(f,To,s),d=e.content?.uri,p=d?Nc(d,r):"",A=t?.root?.refine,g=e.geometricError,y=e.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];if(y){let S={box:Eo(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:ie.GEOMETRIC_ERROR,rootLodMetricValue:g,rootBoundingVolume:E,getTileType:Dc,getRefine:vc};return await KB(e,r,h,_,s)}async function KB(e,t,r,n,s){if(!e)return null;let{children:o,contentUrl:i}=await Oc({subtree:r,implicitOptions:n,loaderOptions:s}),a,c=null;return i&&(a=i,c={uri:i.replace(`${t}/`,"")}),{...e,id:a,contentUrl:a,lodMetricType:ie.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Dc(e,a),refine:vc(e.refine),content:c||e.content,children:o}}function $p(e){return e?.extensions?.["3DTILES_implicit_tiling"]||e?.implicitTiling}var Co={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:to,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 em(n,o,t||{});return{...n,shape:"tileset3d",loader:Co,url:s,queryString:r?.queryString||"",basePath:o,root:i||n.root,type:lt.TILES3D,lodMetricType:ie.GEOMETRIC_ERROR,lodMetricValue:n.root?.geometricError||0}}async function $B(e,t,r){let n={content:{shape:"tile3d",featureIds:null}};return await Tc(e,0,t,r,n.content),n.content}function tC(e){return me.dirname(e)}var rm=[0],eC={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:Co,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]}},Dn=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: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,im.load)(i,s,o.loadOptions),c=new In(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 Lt.POINTCLOUD:return this._makePointCloudLayer(t,r);case Lt.SCENEGRAPH:return this._make3DModelLayer(t);case Lt.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:u}=n;if(!c)return null;let f=r&&r.props.data||{header:{vertexCount:s},attributes:{POSITION:c,NORMAL:l,COLOR_0:u}},{pointSize:h,getPointColor:d}=this.props,p=this.getSubLayerClass("pointcloud",sm.PointCloudLayer);return new p({pointSize:h},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${t.id}`,tile:t,data:f,coordinateSystem:we.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",om.ScenegraphLayer);return new i({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${t.id}`,tile:t,data:n||rm,scenegraph:r,coordinateSystem:we.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=we.COORDINATE_SYSTEM.METER_OFFSETS,material:l,featureIds:u}=n,{_getMeshColor:f}=this.props,h=r&&r.props.mesh||new nm.Geometry({topology:"triangle-list",attributes:rC(s),indices:o}),d=this.getSubLayerClass("mesh",Qh);return new d(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${t.id}`,tile:t,mesh:h,data:rm,getColor:f(t),pbrMaterial:l,modelMatrix:i,coordinateOrigin:a,coordinateSystem:c,featureIds:u,_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}};Dn.defaultProps=eC;Dn.layerName="Tile3DLayer";var am=Dn;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 wo=N(Nt(),1),zc=N(Ds(),1),pm=N(Nt(),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 Uc(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,u=l+a,f=0,h=0,d=0;for(let p=0;p<s;p++)f+=Uc(e.getUint16(c+i*p,!0)),h+=Uc(e.getUint16(l+i*p,!0)),d+=Uc(e.getUint16(u+i*p,!0)),o[p]=f,o[p+s]=h,o[p+s*2]=d;return r+=a*3,{vertexData:o,vertexDataEndPosition:r}}function vn(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=vn(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=vn(e.buffer,n,a,i,!1);n+=a*i;let l=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let u=vn(e.buffer,n,l,i,!1);n+=l*i;let f=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let h=vn(e.buffer,n,f,i,!1);n+=f*i;let d=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let p=vn(e.buffer,n,d,i,!1);return n+=d*i,{edgeIndicesEndPosition:n,westIndices:c,southIndices:u,eastIndices:h,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 uC(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 rr={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},fC={maxDecodingStep:rr.extensions};function Gc(e,t){let r=Object.assign({},fC,t),n=new DataView(e),{header:s,headerEndPosition:o}=sC(n);if(r.maxDecodingStep<rr.vertices)return{header:s};let{vertexData:i,vertexDataEndPosition:a}=oC(n,o);if(r.maxDecodingStep<rr.triangleIndices)return{header:s,vertexData:i};let{triangleIndices:c,triangleIndicesEndPosition:l}=iC(n,i,a);if(r.maxDecodingStep<rr.edgeIndices)return{header:s,vertexData:i,triangleIndices:c};let{westIndices:u,southIndices:f,eastIndices:h,northIndices:d,edgeIndicesEndPosition:p}=aC(n,i,l);if(r.maxDecodingStep<rr.extensions)return{header:s,vertexData:i,triangleIndices:c,westIndices:u,northIndices:d,eastIndices:h,southIndices:f};let{extensions:A}=uC(n,p);return{header:s,vertexData:i,triangleIndices:c,westIndices:u,northIndices:d,eastIndices:h,southIndices:f,extensions:A}}function So(e,t,r,n){let s=n?dC(n,e.POSITION.value):hC(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 u=s[l];pC({edge:u,edgeIndex:l,attributes:e,skirtHeight:r,newPosition:o,newTexcoord0:i,newTriangles:a})}e.POSITION.value=Xr(e.POSITION.value,o),e.TEXCOORD_0.value=Xr(e.TEXCOORD_0.value,i);let c=t instanceof Array?t.concat(a):Xr(t,a);return{attributes:e,triangles:c}}function hC(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 u=t*2*3;i[u]=e[0],i[u+1]=a/3+l,i[u+2]=e[1],i[u+3]=a/3+l,i[u+4]=e[0],i[u+5]=a/3+c}function Vc(e,t={}){let{bounds:r}=t,{header:n,vertexData:s,triangleIndices:o,westIndices:i,northIndices:a,eastIndices:c,southIndices:l}=Gc(e,rr.triangleIndices),u=o,f=mC(s,n,r),h=Ke(f);if(t?.skirtHeight){let{attributes:d,triangles:p}=So(f,u,t.skirtHeight,{westIndices:i,northIndices:a,eastIndices:c,southIndices:l});f=d,u=p}return{loaderData:{header:{}},header:{vertexCount:u.length,boundingBox:h},schema:void 0,topology:"triangle-list",mode:4,indices:{value:u,size:1},attributes:f}}function mC(e,t,r){let{minHeight:n,maxHeight:s}=t,[o,i,a,c]=r||[0,0,1,1],l=a-o,u=c-i,f=s-n,h=e.length/3,d=new Float32Array(h*3),p=new Float32Array(h*2);for(let A=0;A<h;A++){let g=e[A]/32767,y=e[A+h]/32767,E=e[A+h*2]/32767;d[3*A+0]=g*l+o,d[3*A+1]=y*u+i,d[3*A+2]=E*f+n,p[2*A+0]=g,p[2*A+1]=y}return{POSITION:{value:d,size:3},TEXCOORD_0:{value:p,size:2}}}var Un=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,u=0;for(s&1?a=c=l=r:o=i=u=r;(s>>=1)>1;){let h=o+a>>1,d=i+c>>1;s&1?(a=o,c=i,o=l,i=u):(o=a,i=c,a=l,c=u),l=h,u=d}let f=n*4;this.coords[f+0]=o,this.coords[f+1]=i,this.coords[f+2]=a,this.coords[f+3]=c}}createTile(t){return new Hc(t,this)}},Hc=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],u=n[c+1],f=n[c+2],h=n[c+3],d=l+f>>1,p=u+h>>1,A=d+p-u,g=p+l-d,y=(o[u*s+l]+o[h*s+f])/2,E=p*s+d,_=Math.abs(y-o[E]);if(i[E]=Math.max(i[E],_),a<r){let B=(u+g>>1)*s+(l+A>>1),S=(h+g>>1)*s+(f+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),u=new Uint32Array(i*3),f=0;function h(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)h(y,E,d,p,_,B),h(A,g,y,E,_,B);else{let S=n[p*r+d]-1,b=n[g*r+A]-1,w=n[E*r+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[f++]=S,u[f++]=b,u[f++]=w}}return h(0,0,a,a,a,0),h(a,a,0,0,0,a),{vertices:l,triangles:u}}};var Gn=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),u=this._addTriangle(l,i,c,-1,-1,-1);this._addTriangle(i,l,a,u,-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),u=Math.max(t,n,o),f=Math.max(r,s,i),h=nr(n,s,o,i,c,l),d=nr(o,i,t,r,c,l),p=nr(t,r,n,s,c,l),A=s-r,g=t-n,y=i-s,E=n-o,_=r-i,B=o-t,S=nr(t,r,n,s,o,i),b=this.heightAt(t,r)/S,w=this.heightAt(n,s)/S,C=this.heightAt(o,i)/S,T=0,m=0,M=0,F=0;for(let R=l;R<=f;R++){let L=0;h<0&&y!==0&&(L=Math.max(L,Math.floor(-h/y))),d<0&&_!==0&&(L=Math.max(L,Math.floor(-d/_))),p<0&&A!==0&&(L=Math.max(L,Math.floor(-p/A)));let D=h+y*L,X=d+_*L,H=p+A*L,Q=!1;for(let j=c+L;j<=u;j++){if(D>=0&&X>=0&&H>=0){Q=!0;let W=b*D+w*X+C*H,$=Math.abs(W-this.heightAt(j,R));F+=$*$,$>T&&(T=$,m=j,M=R)}else if(Q)break;D+=y,X+=_,H+=A}h+=E,d+=B,p+=g}(m===t&&M===r||m===n&&M===s||m===o&&M===i)&&(T=0),this._candidates[2*a]=m,this._candidates[2*a+1]=M,this._rms[a]=F,this._queuePush(a,T,F)}_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],u=this.coords[2*i],f=this.coords[2*i+1],h=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(nr(c,l,u,f,p,A)===0)this._handleCollinear(g,r);else if(nr(u,f,h,d,p,A)===0)this._handleCollinear(g,n);else if(nr(h,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),b=this._addTriangle(a,o,g,_,B+2,S+1);this._legalize(B),this._legalize(S),this._legalize(b)}}_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],u=this.triangles[t],f=this.triangles[o],h=this.triangles[a],d=this.coords;if(!gC(d[2*l],d[2*l+1],d[2*u],d[2*u+1],d[2*f],d[2*f+1],d[2*h],d[2*h+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,h,f,-1,g,p,n),_=this._addTriangle(h,l,u,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],u=this._halfedges[o],f=this._halfedges[r];if(f<0){let b=this._addTriangle(t,i,a,-1,u,-1,n),w=this._addTriangle(i,t,c,b,-1,l);this._legalize(b+1),this._legalize(w+2);return}let h=f-f%3,d=h+(f+2)%3,p=h+(f+1)%3,A=this.triangles[d],g=this._halfedges[d],y=this._halfedges[p];this._queueRemove(h/3);let E=this._addTriangle(i,a,t,u,-1,-1,n),_=this._addTriangle(a,A,t,y,-1,E+1,h),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 nr(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,u=r-i,f=n-a,h=s-i,d=o-a,p=c*c+l*l,A=u*u+f*f,g=h*h+d*d;return c*(f*g-A*d)-l*(u*g-A*h)+p*(u*d-f*h)<0}function um(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=bo(o,i,a,s,t.tesselator),l=cm(r,i,c);break;case"delatin":c=bo(o,i,a,s,t.tesselator),l=lm(r,i,a,c);break;default:i===a&&!(a&i-1)?(c=bo(o,i,a,s,"martini"),l=cm(r,i,c)):(c=bo(o,i,a,s,"delatin"),l=lm(r,i,a,c));break}let{vertices:u}=l,{triangles:f}=l,h=AC(u,c,i,a,n),d=Ke(h);if(t.skirtHeight){let{attributes:p,triangles:A}=So(h,f,t.skirtHeight);h=p,f=A}return{loaderData:{header:{}},header:{vertexCount:f.length,boundingBox:d},mode:4,indices:{value:Uint32Array.from(f),size:1},attributes:h}}function cm(e,t,r){let n=t+1,o=new Un(n).createTile(r),{vertices:i,triangles:a}=o.getMesh(e);return{vertices:i,triangles:a}}function lm(e,t,r,n){let s=new Gn(n,t+1,r+1);s.run(e);let{coords:o,triangles:i}=s;return{vertices:o,triangles:i}}function bo(e,t,r,n,s){let{rScaler:o,bScaler:i,gScaler:a,offset:c}=n,l=new Float32Array((t+1)*(r+1));for(let u=0,f=0;f<r;f++)for(let h=0;h<t;h++,u++){let d=u*4,p=e[d+0],A=e[d+1],g=e[d+2];l[u+f]=p*o+A*a+g*i+c}if(s==="martini"){for(let u=(t+1)*t,f=0;f<t;f++,u++)l[u]=l[u-t-1];for(let u=r,f=0;f<r+1;f++,u+=r+1)l[u]=l[u-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,u,f,h]=s||[0,0,r,n],d=(f-l)/r,p=(h-u)/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+h,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 Mo="4.2.0-beta.2";var Io={dataType:null,batchType:null,name:"Terrain",id:"terrain",module:"terrain",version:Mo,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 fm={dataType:null,batchType:null,name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:Mo,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var xC={...Io,parse:yC};async function yC(e,t,r){let n={...t,mimeType:"application/x.image",image:{...t?.image,type:"data"}},s=await Et(e,[],n,r),o={...xC.options.terrain,...t?.terrain};return um(s,o)}var zG={...fm,parseSync:(e,t)=>Vc(e,t?.["quantized-mesh"]),parse:async(e,t)=>Vc(e,t?.["quantized-mesh"])};var hm=[1],TC={...qe.defaultProps,elevationData:Ce,texture:{...Ce,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:[Io]};function dm(e){return Array.isArray(e)?e.join(";"):e||""}var Vn=class extends wo.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&&wo.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=Qt(r,t),l=s&&Qt(s,t),{signal:u}=t,f=[0,0],h=[0,0];if(a.isGeospatial){let g=t.bbox;f=a.projectFlat([g.west,g.south]),h=a.projectFlat([g.east,g.north])}else{let g=t.bbox;f=[g.left,g.bottom],h=[g.right,g.top]}let d=[f[0],f[1],h[0],h[1]],p=this.loadTerrain({elevationData:c,bounds:d,elevationDecoder:o,meshMaxError:i,signal:u}),A=l?n(l,{propName:"texture",layer:this,loaders:[],signal:u}).catch(g=>null):Promise.resolve(null);return Promise.all([p,A])}renderSubLayers(t){let r=this.getSubLayerClass("mesh",zc.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:hm,mesh:a,texture:c,_instanced:!1,coordinateSystem:pm.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:u,extent:f,maxRequests:h,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:g,maxCacheByteSize:y,refinementStrategy:E}=this.props;if(this.state.isTiled)return new qe(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:dm(n),texture:dm(s),meshMaxError:i,elevationDecoder:a}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:c,maxZoom:l,minZoom:u,extent:f,maxRequests:h,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:g,maxCacheByteSize:y,refinementStrategy:E});if(!n)return null;let _=this.getSubLayerClass("mesh",zc.SimpleMeshLayer);return new _(this.getSubLayerProps({id:"mesh"}),{data:hm,mesh:this.state.terrain,texture:s,_instanced:!1,getPosition:B=>[0,0,0],getColor:t,material:r,wireframe:o})}};Vn.defaultProps=TC;Vn.layerName="TerrainLayer";var mm=Vn;var qo=N(Nt(),1),al=N(Ot(),1),Ym=N(Am(),1);var Hn={x:0,y:1,z:2};function sr(e,t={}){let{start:r=0,end:n=e.length,plane:s="xy"}=t,o=t.size||2,i=0,a=Hn[s[0]],c=Hn[s[1]];for(let l=r,u=n-o;l<n;l+=o)i+=(e[l+a]-e[u+a])*(e[l+c]+e[u+c]),u=l;return i/2}function Jc(e,t,r=2,n,s="xy"){let o=t&&t.length,i=o?t[0]*r:e.length,a=ym(e,0,i,r,!0,n&&n[0],s),c=[];if(!a||a.next===a.prev)return c;let l,u,f,h,d,p,A;if(o&&(a=MC(e,t,a,r,n,s)),e.length>80*r){h=u=e[0],d=f=e[1];for(let g=r;g<i;g+=r)p=e[g],A=e[g+1],p<h&&(h=p),A<d&&(d=A),p>u&&(u=p),A>f&&(f=A);l=Math.max(u-h,f-d),l=l!==0?32767/l:0}return zn(a,c,r,h,d,l,0),c}function ym(e,t,r,n,s,o,i){let a,c;o===void 0&&(o=sr(e,{start:t,end:r,size:n,plane:i}));let l=Hn[i[0]],u=Hn[i[1]];if(s===o<0)for(a=t;a<r;a+=n)c=xm(a,e[a+l],e[a+u],c);else for(a=r-n;a>=t;a-=n)c=xm(a,e[a+l],e[a+u],c);return c&&Ro(c,c.next)&&(Jn(c),c=c.next),c}function or(e,t){if(!e)return e;t||(t=e);let r=e,n;do if(n=!1,!r.steiner&&(Ro(r,r.next)||et(r.prev,r,r.next)===0)){if(Jn(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function zn(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),Jn(e),e=l.next,a=l.next;continue}if(e=l,e===a){i?i===1?(e=SC(or(e),t,r),zn(e,t,r,n,s,o,2)):i===2&&bC(e,t,r,n,s,o):zn(or(e),t,r,n,s,o,1);break}}}function BC(e){let t=e.prev,r=e,n=e.next;if(et(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,u=s<o?s<i?s:i:o<i?o:i,f=a<c?a<l?a:l:c<l?c:l,h=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>=u&&p.x<=h&&p.y>=f&&p.y<=d&&vr(s,a,o,c,i,l,p.x,p.y)&&et(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(et(s,o,i)>=0)return!1;let a=s.x,c=o.x,l=i.x,u=s.y,f=o.y,h=i.y,d=a<c?a<l?a:l:c<l?c:l,p=u<f?u<h?u:h:f<h?f:h,A=a>c?a>l?a:l:c>l?c:l,g=u>f?u>h?u:h:f>h?f:h,y=kc(d,p,t,r,n),E=kc(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&&vr(a,u,c,f,l,h,_.x,_.y)&&et(_.prev,_,_.next)>=0||(_=_.prevZ,B.x>=d&&B.x<=A&&B.y>=p&&B.y<=g&&B!==s&&B!==i&&vr(a,u,c,f,l,h,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&&_!==i&&vr(a,u,c,f,l,h,_.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!==i&&vr(a,u,c,f,l,h,B.x,B.y)&&et(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;!Ro(s,o)&&Tm(s,n,n.next,o)&&kn(s,o)&&kn(o,s)&&(t.push(s.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),Jn(n),Jn(n.next),n=e=o),n=n.next}while(n!==e);return or(n)}function bC(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=_m(i,a);i=or(i,i.next),c=or(c,c.next),zn(i,t,r,n,s,o,0),zn(c,t,r,n,s,o,0);return}a=a.next}i=i.next}while(i!==e)}function MC(e,t,r,n,s,o){let i=[],a,c,l,u,f;for(a=0,c=t.length;a<c;a++)l=t[a]*n,u=a<c-1?t[a+1]*n:e.length,f=ym(e,l,u,n,!1,s&&s[a+1],o),f===f.next&&(f.steiner=!0),i.push(OC(f));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=LC(e,t);if(!r)return t;let n=_m(r,e);return or(n,n.next),or(r,r.next)}function LC(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 h=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(h<=n&&h>o&&(o=h,i=r.x<r.next.x?r:r.next,h===n))return i}r=r.next}while(r!==t);if(!i)return null;let a=i,c=i.x,l=i.y,u=1/0,f;r=i;do n>=r.x&&r.x>=c&&n!==r.x&&vr(s<l?n:o,s,c,l,s<l?o:n,s,r.x,r.y)&&(f=Math.abs(s-r.y)/(n-r.x),kn(r,e)&&(f<u||f===u&&(r.x>i.x||r.x===i.x&&FC(i,r)))&&(i=r,u=f)),r=r.next;while(r!==a);return i}function FC(e,t){return et(e.prev,e,t.prev)<0&&et(t.next,e,e.next)<0}function RC(e,t,r,n){let s=e;do s.z===0&&(s.z=kc(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 kc(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 vr(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)&&(kn(e,t)&&kn(t,e)&&vC(e,t)&&(et(e.prev,e,t.prev)||et(e,t.prev,t))||Ro(e,t)&&et(e.prev,e,e.next)>0&&et(t.prev,t,t.next)>0)}function et(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Ro(e,t){return e.x===t.x&&e.y===t.y}function Tm(e,t,r,n){let s=Fo(et(e,t,r)),o=Fo(et(e,t,n)),i=Fo(et(r,n,e)),a=Fo(et(r,n,t));return!!(s!==o&&i!==a||s===0&&Lo(e,r,t)||o===0&&Lo(e,n,t)||i===0&&Lo(r,e,n)||a===0&&Lo(r,t,n))}function Lo(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 Fo(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&&Tm(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function kn(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 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 _m(e,t){let r=new qn(e.i,e.x,e.y),n=new qn(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 xm(e,t,r,n){let s=new qn(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 Jn(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 qn=class{constructor(t,r,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=r,this.y=n}};function Xc(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:u,polygonFeaturesCount:f,propArrayTypes:h,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(u+1):new Uint16Array(u+1),positions:new A(c*d),globalFeatureIds:new E(c),featureIds:f>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=h[C];w.numericProps[C]=new T(w.positions.length/d)}B.pathIndices[i]=o,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":JC(C,_,b,d,T),_.properties.push(jc(T,p)),y&&_.fields.push({id:w.id}),b.pointFeature++;break;case"LineString":qC(C,B,b,d,T),B.properties.push(jc(T,p)),y&&B.fields.push({id:w.id}),b.lineFeature++;break;case"Polygon":jC(C,S,b,d,T),S.properties.push(jc(T,p)),y&&S.fields.push({id:w.id}),b.polygonFeature++;break;default:throw new Error("Invalid geometry type")}b.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;Wc(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;Wc(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;Wc(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],u=e.indices[i],f=e.indices[i+1];for(let d=0,p=u.length;d<p;++d){let A=u[d],g=d===p-1?f===void 0?e.data.length:f[0]:u[d+1];t.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(g-A)/n}let h=r.polygonPosition;XC(t,l,u,{startPosition:c,endPosition:h,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],u=r.slice(1).map(h=>(h-l)/o),f=Jc(c,u,o,t);for(let h=0,d=f.length;h<d;++h)e.triangles.push(n+f[h])}function qc(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:qc(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:qc(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:qc(r.numericProps,1)}};return s.polygons&&r.triangles&&(s.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),s}function Wc(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 jc(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 No(e,t){let r=t?.globalFeatureId;return r!==void 0?KC(e,r):QC(e,t?.type)}function KC(e,t){let r=Sm(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 Po(n,s,i);s=i,o=a}}if(t===n.globalFeatureIds.value[s])return Po(n,s,n.featureIds.value.length)}throw new Error(`featureId:${t} not found`)}function QC(e,t){let r=Sm(e,t);return ZC(r)}function Cm(e,t,r){switch(e.type){case"Point":return rS(e,t,r);case"LineString":return eS(e,t,r);case"Polygon":return bm(e,t,r);default:let n=e;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function Sm(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(Po(r,n,o)),n=o,s=i)}t.push(Po(r,n,r.featureIds.value.length))}return t}function Po(e,t,r){let n=Cm(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 bm(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 u=o[l],f=o[l+1],h=Oo(n,u,f);c.push(h)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<s.length-1;c++){let l=s[c],u=s[c+1],f=bm(e,l,u).coordinates;a.push(f)}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:Oo(n,s[0],s[1])};let i=[];for(let a=0;a<s.length-1;a++){let c=Oo(n,s[a],s[a+1]);i.push(c)}return{type:"MultiLineString",coordinates:i}}function rS(e,t,r){let{positions:n}=e,s=Oo(n,t,r);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function Oo(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 el=N(Pm(),1);function Om(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 Nm(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 Vr=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;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(Nm,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,u=-1/0;for(;t.pos<r;){if(s<=0){let f=t.readVarint();n=f&7,s=f>>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>u&&(u=i);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,l,c,u]}_toGeoJSON(t){let r=this.loadGeometry(),n=Vr.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=Om(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 u=0;u<l.length;u++){let f=l[u];f[0]=(f[0]+i)*360/o-180;let h=180-(f[1]+a)*360/o;f[1]=360/Math.PI*Math.atan(Math.exp(h*Math.PI/180))-90}}return this._toGeoJSON(c)}};var Uo=class{version;name;extent;length;_pbf;_keys;_values;_features;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 Vr(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 Go=class{layers;constructor(t,r){this.layers=t.readFields(CS,{},r)}};function CS(e,t,r){if(e===3&&r){let n=new Uo(r,r.readVarint()+r.pos);n.length&&t&&(t[n.name]=n)}}function Dm(e){let t=e.indices.length,r="Polygon";if(t<=1)return{type:r,data:e.data,areas:[[sr(e.data)]],indices:[e.indices]};let n=[],s=[],o=[],i=[],a,c=0;for(let l,u=0,f;u<t;u++){f=e.indices[u]-c,l=e.indices[u+1]-c||e.data.length;let h=e.data.slice(f,l),d=sr(h);if(d===0){let p=e.data.slice(0,f),A=e.data.slice(l);e.data=p.concat(A),c+=l-f;continue}a===void 0&&(a=d<0),a===d<0?(i.length&&(n.push(o),s.push(i)),i=[f],o=[d]):(o.push(d),i.push(f))}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 Um(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 Gm,ir,Qc,Vo,Zc,$c,jn;var Ho=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;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(Um,this,r)}loadGeometry(){let t=this._pbf;t.pos=this._geometry,Gm=t.readVarint()+t.pos,ir=1,Vo=0,Zc=0,$c=0,jn=0;let r=[],n=[];for(;t.pos<Gm;)if(Vo<=0&&(Qc=t.readVarint(),ir=Qc&7,Vo=Qc>>3),Vo--,ir===1||ir===2)Zc+=t.readSVarint(),$c+=t.readSVarint(),ir===1&&r.push(jn),n.push(Zc,$c),jn+=2;else if(ir===7){if(jn>0){let s=r[r.length-1];n.push(n[s],n[s+1]),jn+=2}}else throw new Error(`unknown command ${ir}`);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=Dm(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 zo=class{version;name;extent;length;_pbf;_keys;_values;_features;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(bS,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 Ho(this._pbf,n,this.extent,this._keys,this._values,r)}};function bS(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(MS(r)))}function MS(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 ko=class{layers;constructor(t,r){this.layers=t.readFields(IS,{},r)}};function IS(e,t,r){if(e===3&&r){let n=new zo(r,r.readVarint()+r.pos);n.length&&t&&(t[n.name]=n)}}function rl(e,t){let r=LS(t),n=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(n){case"columnar-table":return{shape:"columnar-table",data:tl(e,r)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:Vm(e,r)};case"geojson":return Vm(e,r);case"binary-geometry":return tl(e,r);case"binary":return tl(e,r);default:throw new Error(n||"undefined shape")}}function tl(e,t){let[r,n]=wS(e,t),s=Xc(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 ko(new el.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),u=RS(l,t,i);r.push(u)}}),[r,n]}function Vm(e,t){if(e.byteLength<=0)return[];let r=[],n=new Go(new el.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=FS(c,t,o);r.push(l)}}),r}function LS(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 FS(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-beta.2",Jo={dataType:null,batchType:null,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={...Jo,parse:async(e,t)=>rl(e,t),parseSync:rl,binary:!0};var vS={Point:Hm,MultiPoint:US,LineString:zm,MultiLineString:GS,Polygon:km,MultiPolygon:VS};function Hm([e,t],[r,n],s){let o=Ae(r[0],n[0],e),i=Ae(r[1],n[1],t);return s.unprojectFlat([o,i])}function nl(e,t,r){return e.map(n=>Hm(n,t,r))}function US(e,t,r){return nl(e,t,r)}function zm(e,t,r){return nl(e,t,r)}function GS(e,t,r){return e.map(n=>zm(n,t,r))}function km(e,t,r){return e.map(n=>nl(n,t,r))}function VS(e,t,r){return e.map(n=>km(n,t,r))}function Jm(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 sl(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,u)=>l===r&&s[u]>=o&&s[u]<i);return c>=0?e.globalFeatureIds.value[c]:-1}else t?a=qm(e.properties,c=>c[t]===r,o,i):e.fields&&(a=qm(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 qm(e,t,r,n){for(let s=r;s<n;s++)if(t(e[s],s))return s;return-1}var ol=512,qS={...al.GeoJsonLayer.defaultProps,data:Ce,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[Jo],binary:!0},Xn=class extends qe{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"&&!pa(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=Qt(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=ol/o,a=-i,c=ol*r/o,l=ol*(1-n/o),u=new P().scale([i,a,1]);t.autoHighlight=!1,this.context.viewport.resolution||(t.modelMatrix=u,t.coordinateOrigin=[c,l,0],t.coordinateSystem=qo.COORDINATE_SYSTEM.CARTESIAN,t.extensions=[...t.extensions||[],new Ym.ClipExtension]);let f=super.renderSubLayers(t);return this.state.binary&&!(f instanceof al.GeoJsonLayer)&&qo.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),f}_updateAutoHighlight(t){let{uniqueIdProperty:r}=this.props,{hoveredFeatureId:n,hoveredFeatureLayerName:s}=this.state,o=t.object,i=null,a=null;o&&(i=il(o,r),a=jm(o));let{highlightColor:c}=this.props;typeof c=="function"&&(c=c(t)),(n!==i||s!==a)&&this.setState({highlightColor:c,hoveredFeatureId:i,hoveredFeatureLayerName:a})}_isWGS84(){return Boolean(this.context.viewport.resolution)}getPickingInfo(t){let r=super.getPickingInfo(t);if(this.state.binary&&r.index!==-1){let{data:n}=t.sourceLayer.props;r.object=No(n,{globalFeatureId:r.index})}return r.object&&!this._isWGS84()&&(r.object=Wm(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=Xm(i);if(!(Xm(r)||c))return-1;let u=c?i:r;return Array.isArray(a)?a.findIndex(f=>{let h=il(f,o)===u,d=c||jm(f)===n;return h&&d}):a&&s?sl(a,o,u,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=il(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?No(n.content):n.content;n._contentWGS84=o.map(i=>Wm(i,s,this.context.viewport))}return n._contentWGS84}})})}};Xn.layerName="MVTLayer";Xn.defaultProps=qS;var Km=Xn;function il(e,t){if(e.properties&&t)return e.properties[t];if("id"in e)return e.id}function jm(e){return e.properties?.layerName||null}function Xm(e){return e!=null&&e!==""}function Wm(e,t,r){let n={...e,geometry:{type:e.geometry.type}};return Object.defineProperty(n.geometry,"coordinates",{get:()=>Jm(e.geometry,t,r).coordinates}),n}var Qm="0123456789bcdefghjkmnpqrstuvwxyz",Zm={};for(let e=0;e<Qm.length;e++)Zm[Qm.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 u=e[c].toLowerCase();a=Zm[u];for(let f=4;f>=0;f--){let h=a>>f&1;t?(i=(s+o)/2,h===1?o=i:s=i):(i=(r+n)/2,h===1?n=i:r=i),t=!t}}return[n,o,r,s]}function $m(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}},Wn=class extends Yt{indexToBounds(){let{data:t,getGeohash:r}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(n,s)=>$m(r(n,s))}}};Wn.layerName="GeohashLayer";Wn.defaultProps=QS;var tg=Wn;return lg(Yn);})();
|
|
449
449
|
return __exports__;
|
|
450
450
|
});
|