@deck.gl/geo-layers 9.2.11 → 9.3.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +7651 -7192
- package/dist/index.cjs +65 -53
- package/dist/index.cjs.map +2 -2
- package/dist/mvt-layer/find-index-binary.js.map +1 -1
- package/dist/tile-3d-layer/tile-3d-layer.d.ts.map +1 -1
- package/dist/tile-3d-layer/tile-3d-layer.js +20 -8
- package/dist/tile-3d-layer/tile-3d-layer.js.map +1 -1
- package/dist/wms-layer/wms-layer.d.ts +1 -2
- package/dist/wms-layer/wms-layer.d.ts.map +1 -1
- package/dist/wms-layer/wms-layer.js +7 -5
- package/dist/wms-layer/wms-layer.js.map +1 -1
- package/dist.min.js +278 -118
- package/package.json +15 -15
- package/src/mvt-layer/find-index-binary.ts +1 -1
- package/src/tile-3d-layer/tile-3d-layer.ts +21 -8
- package/src/wms-layer/wms-layer.ts +9 -8
package/dist.min.js
CHANGED
|
@@ -4,18 +4,15 @@
|
|
|
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 d1=Object.create;var sn=Object.defineProperty;var p1=Object.getOwnPropertyDescriptor;var m1=Object.getOwnPropertyNames;var g1=Object.getPrototypeOf,A1=Object.prototype.hasOwnProperty;var x1=(e,t,r)=>t in e?sn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var df=(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 rt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),pt=(e,t)=>{for(var r in t)sn(e,r,{get:t[r],enumerable:!0})},ys=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of m1(t))!A1.call(e,s)&&s!==r&&sn(e,s,{get:()=>t[s],enumerable:!(n=p1(t,s))||n.enumerable});return e},ye=(e,t,r)=>(ys(e,t,"default"),r&&ys(r,t,"default")),D=(e,t,r)=>(r=e!=null?d1(g1(e)):{},ys(t||!e||!e.__esModule?sn(r,"default",{value:e,enumerable:!0}):r,e)),y1=e=>ys(sn({},"__esModule",{value:!0}),e);var on=(e,t,r)=>(x1(e,typeof t!="symbol"?t+"":t,r),r);var zt=rt((rL,pf)=>{pf.exports=globalThis.deck});var qt=rt((sL,gf)=>{gf.exports=globalThis.deck});var Ds=rt((ML,Ru)=>{Ru.exports=globalThis.h3||{}});var eo=rt(ce=>{"use strict";var Rh=":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",WE=Rh+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Fh="["+Rh+"]["+WE+"]*",YE=new RegExp("^"+Fh+"$"),KE=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},QE=function(e){let t=YE.exec(e);return!(t===null||typeof t>"u")};ce.isExist=function(e){return typeof e<"u"};ce.isEmptyObject=function(e){return Object.keys(e).length===0};ce.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]]}};ce.getValue=function(e){return ce.isExist(e)?e:""};ce.isName=QE;ce.getAllMatches=KE;ce.nameRegexp=Fh});var La=rt(Gh=>{"use strict";var wa=eo(),ZE={allowBooleanAttributes:!1,unpairedTags:[]};Gh.validate=function(e,t){t=Object.assign({},ZE,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=Oh(e,o),o.err)return o}else if(e[o]==="<"){let i=o;if(o++,e[o]==="!"){o=Nh(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
|
-
`&&
|
|
9
|
-
`||e==="\r"}function Oh(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 ot("InvalidXml","XML declaration allowed only at the start of the document.",_t(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function Nh(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 $E='"',t_="'";function e_(e,t){let r="",n="",s=!1;for(;t<e.length;t++){if(e[t]===$E||e[t]===t_)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 r_=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Dh(e,t){let r=wa.getAllMatches(e,r_),n={};for(let s=0;s<r.length;s++){if(r[s][1].length===0)return ot("InvalidAttr","Attribute '"+r[s][2]+"' has no space in starting.",En(r[s]));if(r[s][3]!==void 0&&r[s][4]===void 0)return ot("InvalidAttr","Attribute '"+r[s][2]+"' is without value.",En(r[s]));if(r[s][3]===void 0&&!t.allowBooleanAttributes)return ot("InvalidAttr","boolean attribute '"+r[s][2]+"' is not allowed.",En(r[s]));let o=r[s][2];if(!o_(o))return ot("InvalidAttr","Attribute '"+o+"' is an invalid name.",En(r[s]));if(!n.hasOwnProperty(o))n[o]=1;else return ot("InvalidAttr","Attribute '"+o+"' is repeated.",En(r[s]))}return!0}function n_(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 s_(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,n_(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 ot(e,t,r){return{err:{code:e,msg:t,line:r.line||r,col:r.col}}}function o_(e){return wa.isName(e)}function i_(e){return wa.isName(e)}function _t(e,t){let r=e.substring(0,t).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function En(e){return e.startIndex+e[1].length}});var Vh=rt(va=>{var Uh={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}},a_=function(e){return Object.assign({},Uh,e)};va.buildOptions=a_;va.defaultOptions=Uh});var zh=rt((uR,Hh)=>{"use strict";var Ra=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})}};Hh.exports=Ra});var kh=rt((hR,qh)=>{var c_=eo();function l_(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&&h_(e,t))t+=7,[entityName,val,t]=f_(e,t+1),val.indexOf("&")===-1&&(r[g_(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(s&&d_(e,t))t+=8;else if(s&&p_(e,t))t+=8;else if(s&&m_(e,t))t+=9;else if(u_)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 f_(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 u_(e,t){return e[t+1]==="!"&&e[t+2]==="-"&&e[t+3]==="-"}function h_(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 d_(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 p_(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 m_(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 g_(e){if(c_.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}qh.exports=l_});var jh=rt((dR,Jh)=>{var A_=/^[-+]?0x[a-fA-F0-9]+$/,x_=/^([\-\+])?(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 y_={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function T_(e,t={}){if(t=Object.assign({},y_,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&&A_.test(r))return Number.parseInt(r,16);{let n=x_.exec(r);if(n){let s=n[1],o=n[2],i=E_(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 E_(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}Jh.exports=T_});var Yh=rt((pR,Wh)=>{"use strict";var Xh=eo(),_n=zh(),__=kh(),M_=jh(),Fa=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=b_,this.parseXml=w_,this.parseTextData=B_,this.resolveNameSpace=C_,this.buildAttributesMap=I_,this.isItStopNode=F_,this.replaceEntitiesValue=v_,this.readStopNodeData=O_,this.saveTextToParentTag=R_,this.addChild=L_}};function b_(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 B_(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?Oa(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?Oa(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function C_(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 S_=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function I_(e,t,r){if(!this.options.ignoreAttributes&&typeof e=="string"){let n=Xh.getAllMatches(e,S_),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 f=this.options.attributeValueProcessor(a,c,t);f==null?o[l]=c:typeof f!=typeof c||f!==c?o[l]=f:o[l]=Oa(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 w_=function(e){e=e.replace(/\r\n?/g,`
|
|
10
|
-
`);let t=new _n("!xml"),r=t,n="",s="";for(let o=0;o<e.length;o++)if(e[o]==="<")if(e[o+1]==="/"){let a=je(e,">",o,"Closing Tag is not closed."),c=e.substring(o+2,a).trim();if(this.options.removeNSPrefix){let u=c.indexOf(":");u!==-1&&(c=c.substr(u+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 f=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(f=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):f=s.lastIndexOf("."),s=s.substring(0,f),r=this.tagsNodeStack.pop(),n="",o=a}else if(e[o+1]==="?"){let a=Pa(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 _n(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=je(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=__(e,o);this.docTypeEntities=a.entities,o=a.i}else if(e.substr(o+1,2)==="!["){let a=je(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=Pa(e,o,this.options.removeNSPrefix),c=a.tagName,l=a.rawTagName,f=a.tagExp,u=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(f.length>0&&f.lastIndexOf("/")===f.length-1)c[c.length-1]==="/"?(c=c.substr(0,c.length-1),s=s.substr(0,s.length-1),f=c):f=f.substr(0,f.length-1),o=a.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)o=a.closeIndex;else{let m=this.readStopNodeData(e,l,h+1);if(!m)throw new Error(`Unexpected end of ${l}`);o=m.i,p=m.tagContent}let A=new _n(c);c!==f&&u&&(A[":@"]=this.buildAttributesMap(f,s,c)),p&&(p=this.parseTextData(p,c,s,!0,u,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),A.add(this.options.textNodeName,p),this.addChild(r,A,s)}else{if(f.length>0&&f.lastIndexOf("/")===f.length-1){c[c.length-1]==="/"?(c=c.substr(0,c.length-1),s=s.substr(0,s.length-1),f=c):f=f.substr(0,f.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));let p=new _n(c);c!==f&&u&&(p[":@"]=this.buildAttributesMap(f,s,c)),this.addChild(r,p,s),s=s.substr(0,s.lastIndexOf("."))}else{let p=new _n(c);this.tagsNodeStack.push(r),c!==f&&u&&(p[":@"]=this.buildAttributesMap(f,s,c)),this.addChild(r,p,s),r=p}n="",o=h}}else n+=e[o];return t.child};function L_(e,t,r){let n=this.options.updateTag(t.tagname,r,t[":@"]);n===!1||(typeof n=="string"&&(t.tagname=n),e.addChild(t))}var v_=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 R_(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 F_(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 P_(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 je(e,t,r,n){let s=e.indexOf(t,r);if(s===-1)throw new Error(n);return s+t.length-1}function Pa(e,t,r,n=">"){let s=P_(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 f=c;if(r){let u=c.indexOf(":");u!==-1&&(c=c.substr(u+1),l=c!==s.data.substr(u+1))}return{tagName:c,tagExp:o,closeIndex:i,attrExpPresent:l,rawTagName:f}}function O_(e,t,r){let n=r,s=1;for(;r<e.length;r++)if(e[r]==="<")if(e[r+1]==="/"){let o=je(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=je(e,"?>",r+1,"StopNode is not closed.");else if(e.substr(r+1,3)==="!--")r=je(e,"-->",r+3,"StopNode is not closed.");else if(e.substr(r+1,2)==="![")r=je(e,"]]>",r,"StopNode is not closed.")-2;else{let o=Pa(e,r,">");o&&((o&&o.tagName)===t&&o.tagExp[o.tagExp.length-1]!=="/"&&s++,r=o.closeIndex)}}function Oa(e,t,r){if(t&&typeof e=="string"){let n=e.trim();return n==="true"?!0:n==="false"?!1:M_(e,r)}else return Xh.isExist(e)?e:""}Wh.exports=Fa});var Zh=rt(Qh=>{"use strict";function N_(e,t){return Kh(e,t)}function Kh(e,t,r){let n,s={};for(let o=0;o<e.length;o++){let i=e[o],a=D_(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=Kh(i[a],t,c),f=U_(l,t);i[":@"]?G_(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,f)?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 D_(e){let t=Object.keys(e);for(let r=0;r<t.length;r++){let n=t[r];if(n!==":@")return n}}function G_(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 U_(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))}Qh.prettify=N_});var td=rt((gR,$h)=>{var{buildOptions:V_}=Vh(),H_=Yh(),{prettify:z_}=Zh(),q_=La(),Na=class{constructor(t){this.externalEntities={},this.options=V_(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=q_.validate(t,r);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}let n=new H_(this.options);n.addExternalEntities(this.externalEntities);let s=n.parseXml(t);return this.options.preserveOrder||s===void 0?s:z_(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}};$h.exports=Na});var od=rt((AR,sd)=>{var k_=`
|
|
11
|
-
`;function J_(e,t){let r="";return t.format&&t.indentBy.length>0&&(r=k_),rd(e,t,"",r)}function rd(e,t,r,n){let s="",o=!1;for(let i=0;i<e.length;i++){let a=e[i],c=j_(a);if(c===void 0)continue;let l="";if(r.length===0?l=c:l=`${r}.${c}`,c===t.textNodeName){let p=a[c];X_(l,t)||(p=t.tagValueProcessor(c,p),p=nd(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=ed(a[":@"],t),A=c==="?xml"?"":n,m=a[c][0][t.textNodeName];m=m.length!==0?" "+m:"",s+=A+`<${c}${m}${p}?>`,o=!0;continue}let f=n;f!==""&&(f+=t.indentBy);let u=ed(a[":@"],t),h=n+`<${c}${u}`,d=rd(a[c],t,l,f);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 j_(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 ed(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=nd(s,t),s===!0&&t.suppressBooleanAttributes?r+=` ${n.substr(t.attributeNamePrefix.length)}`:r+=` ${n.substr(t.attributeNamePrefix.length)}="${s}"`}return r}function X_(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 nd(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}sd.exports=J_});var ad=rt((xR,id)=>{"use strict";var W_=od(),Y_={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 be(e){this.options=Object.assign({},Y_,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Z_),this.processTextOrObjNode=K_,this.options.format?(this.indentate=Q_,this.tagEndChar=`>
|
|
12
|
-
`,this.newLine=`
|
|
13
|
-
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}be.prototype.build=function(e){return this.options.preserveOrder?W_(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)};be.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="",a="";for(let c=0;c<o;c++){let l=e[s][c];if(!(typeof l>"u"))if(l===null)s[0]==="?"?n+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(typeof l=="object")if(this.options.oneListGroup){let f=this.j2x(l,t+1);i+=f.val,this.options.attributesGroupName&&l.hasOwnProperty(this.options.attributesGroupName)&&(a+=f.attrStr)}else i+=this.processTextOrObjNode(l,s,t);else if(this.options.oneListGroup){let f=this.options.tagValueProcessor(s,l);f=this.replaceEntitiesValue(f),i+=f}else i+=this.buildTextValNode(l,s,"",t)}this.options.oneListGroup&&(i=this.buildObjectNode(i,s,a,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}};be.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 K_(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)}be.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}};be.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};be.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}};be.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 Q_(e){return this.options.indentBy.repeat(e)}function Z_(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}id.exports=be});var ld=rt((yR,cd)=>{"use strict";var $_=La(),tM=td(),eM=ad();cd.exports={XMLParser:tM,XMLValidator:$_,XMLBuilder:eM}});var uc=rt(($d,Pn)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof df=="function"&&typeof Pn=="object"&&Pn&&Pn.exports?Pn.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})($d,function(){"use strict";function e(T,g,S){this.low=T|0,this.high=g|0,this.unsigned=!!S}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,g){var S,R,F;return g?(T>>>=0,(F=0<=T&&T<256)&&(R=n[T],R)?R:(S=i(T,(T|0)<0?-1:0,!0),F&&(n[T]=S),S)):(T|=0,(F=-128<=T&&T<128)&&(R=r[T],R)?R:(S=i(T,T<0?-1:0,!1),F&&(r[T]=S),S))}e.fromInt=s;function o(T,g){if(isNaN(T)||!isFinite(T))return g?y:m;if(g){if(T<0)return y;if(T>=d)return C}else{if(T<=-p)return L;if(T+1>=p)return B}return T<0?o(-T,g).neg():i(T%h|0,T/h|0,g)}e.fromNumber=o;function i(T,g,S){return new e(T,g,S)}e.fromBits=i;var a=Math.pow;function c(T,g,S){if(T.length===0)throw Error("empty string");if(T==="NaN"||T==="Infinity"||T==="+Infinity"||T==="-Infinity")return m;if(typeof g=="number"?(S=g,g=!1):g=!!g,S=S||10,S<2||36<S)throw RangeError("radix");var R;if((R=T.indexOf("-"))>0)throw Error("interior hyphen");if(R===0)return c(T.substring(1),g,S).neg();for(var F=o(a(S,8)),v=m,G=0;G<T.length;G+=8){var X=Math.min(8,T.length-G),z=parseInt(T.substring(G,G+X),S);if(X<8){var et=o(a(S,X));v=v.mul(et).add(o(z))}else v=v.mul(F),v=v.add(o(z))}return v.unsigned=g,v}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 f=1<<16,u=1<<24,h=f*f,d=h*h,p=d/2,A=s(u),m=s(0);e.ZERO=m;var y=s(0,!0);e.UZERO=y;var _=s(1);e.ONE=_;var E=s(1,!0);e.UONE=E;var M=s(-1);e.NEG_ONE=M;var B=i(-1,2147483647,!1);e.MAX_VALUE=B;var C=i(-1,-1,!0);e.MAX_UNSIGNED_VALUE=C;var L=i(0,-2147483648,!1);e.MIN_VALUE=L;var b=e.prototype;return b.toInt=function(){return this.unsigned?this.low>>>0:this.low},b.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},b.toString=function(g){if(g=g||10,g<2||36<g)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(L)){var S=o(g),R=this.div(S),F=R.mul(S).sub(this);return R.toString(g)+F.toInt().toString(g)}else return"-"+this.neg().toString(g);for(var v=o(a(g,6),this.unsigned),G=this,X="";;){var z=G.div(v),et=G.sub(z.mul(v)).toInt()>>>0,K=et.toString(g);if(G=z,G.isZero())return K+X;for(;K.length<6;)K="0"+K;X=""+K+X}},b.getHighBits=function(){return this.high},b.getHighBitsUnsigned=function(){return this.high>>>0},b.getLowBits=function(){return this.low},b.getLowBitsUnsigned=function(){return this.low>>>0},b.getNumBitsAbs=function(){if(this.isNegative())return this.eq(L)?64:this.neg().getNumBitsAbs();for(var g=this.high!=0?this.high:this.low,S=31;S>0&&!(g&1<<S);S--);return this.high!=0?S+33:S+1},b.isZero=function(){return this.high===0&&this.low===0},b.isNegative=function(){return!this.unsigned&&this.high<0},b.isPositive=function(){return this.unsigned||this.high>=0},b.isOdd=function(){return(this.low&1)===1},b.isEven=function(){return(this.low&1)===0},b.equals=function(g){return t(g)||(g=l(g)),this.unsigned!==g.unsigned&&this.high>>>31===1&&g.high>>>31===1?!1:this.high===g.high&&this.low===g.low},b.eq=b.equals,b.notEquals=function(g){return!this.eq(g)},b.neq=b.notEquals,b.lessThan=function(g){return this.comp(g)<0},b.lt=b.lessThan,b.lessThanOrEqual=function(g){return this.comp(g)<=0},b.lte=b.lessThanOrEqual,b.greaterThan=function(g){return this.comp(g)>0},b.gt=b.greaterThan,b.greaterThanOrEqual=function(g){return this.comp(g)>=0},b.gte=b.greaterThanOrEqual,b.compare=function(g){if(t(g)||(g=l(g)),this.eq(g))return 0;var S=this.isNegative(),R=g.isNegative();return S&&!R?-1:!S&&R?1:this.unsigned?g.high>>>0>this.high>>>0||g.high===this.high&&g.low>>>0>this.low>>>0?-1:1:this.sub(g).isNegative()?-1:1},b.comp=b.compare,b.negate=function(){return!this.unsigned&&this.eq(L)?L:this.not().add(_)},b.neg=b.negate,b.add=function(g){t(g)||(g=l(g));var S=this.high>>>16,R=this.high&65535,F=this.low>>>16,v=this.low&65535,G=g.high>>>16,X=g.high&65535,z=g.low>>>16,et=g.low&65535,K=0,Y=0,$=0,bt=0;return bt+=v+et,$+=bt>>>16,bt&=65535,$+=F+z,Y+=$>>>16,$&=65535,Y+=R+X,K+=Y>>>16,Y&=65535,K+=S+G,K&=65535,i($<<16|bt,K<<16|Y,this.unsigned)},b.subtract=function(g){return t(g)||(g=l(g)),this.add(g.neg())},b.sub=b.subtract,b.multiply=function(g){if(this.isZero()||(t(g)||(g=l(g)),g.isZero()))return m;if(this.eq(L))return g.isOdd()?L:m;if(g.eq(L))return this.isOdd()?L:m;if(this.isNegative())return g.isNegative()?this.neg().mul(g.neg()):this.neg().mul(g).neg();if(g.isNegative())return this.mul(g.neg()).neg();if(this.lt(A)&&g.lt(A))return o(this.toNumber()*g.toNumber(),this.unsigned);var S=this.high>>>16,R=this.high&65535,F=this.low>>>16,v=this.low&65535,G=g.high>>>16,X=g.high&65535,z=g.low>>>16,et=g.low&65535,K=0,Y=0,$=0,bt=0;return bt+=v*et,$+=bt>>>16,bt&=65535,$+=F*et,Y+=$>>>16,$&=65535,$+=v*z,Y+=$>>>16,$&=65535,Y+=R*et,K+=Y>>>16,Y&=65535,Y+=F*z,K+=Y>>>16,Y&=65535,Y+=v*X,K+=Y>>>16,Y&=65535,K+=S*et+R*z+F*X+v*G,K&=65535,i($<<16|bt,K<<16|Y,this.unsigned)},b.mul=b.multiply,b.divide=function(g){if(t(g)||(g=l(g)),g.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?y:m;var S,R,F;if(this.unsigned){if(g.unsigned||(g=g.toUnsigned()),g.gt(this))return y;if(g.gt(this.shru(1)))return E;F=y}else{if(this.eq(L)){if(g.eq(_)||g.eq(M))return L;if(g.eq(L))return _;var v=this.shr(1);return S=v.div(g).shl(1),S.eq(m)?g.isNegative()?_:M:(R=this.sub(g.mul(S)),F=S.add(R.div(g)),F)}else if(g.eq(L))return this.unsigned?y:m;if(this.isNegative())return g.isNegative()?this.neg().div(g.neg()):this.neg().div(g).neg();if(g.isNegative())return this.div(g.neg()).neg();F=m}for(R=this;R.gte(g);){S=Math.max(1,Math.floor(R.toNumber()/g.toNumber()));for(var G=Math.ceil(Math.log(S)/Math.LN2),X=G<=48?1:a(2,G-48),z=o(S),et=z.mul(g);et.isNegative()||et.gt(R);)S-=X,z=o(S,this.unsigned),et=z.mul(g);z.isZero()&&(z=_),F=F.add(z),R=R.sub(et)}return F},b.div=b.divide,b.modulo=function(g){return t(g)||(g=l(g)),this.sub(this.div(g).mul(g))},b.mod=b.modulo,b.not=function(){return i(~this.low,~this.high,this.unsigned)},b.and=function(g){return t(g)||(g=l(g)),i(this.low&g.low,this.high&g.high,this.unsigned)},b.or=function(g){return t(g)||(g=l(g)),i(this.low|g.low,this.high|g.high,this.unsigned)},b.xor=function(g){return t(g)||(g=l(g)),i(this.low^g.low,this.high^g.high,this.unsigned)},b.shiftLeft=function(g){return t(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?i(this.low<<g,this.high<<g|this.low>>>32-g,this.unsigned):i(0,this.low<<g-32,this.unsigned)},b.shl=b.shiftLeft,b.shiftRight=function(g){return t(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?i(this.low>>>g|this.high<<32-g,this.high>>g,this.unsigned):i(this.high>>g-32,this.high>=0?0:-1,this.unsigned)},b.shr=b.shiftRight,b.shiftRightUnsigned=function(g){if(t(g)&&(g=g.toInt()),g&=63,g===0)return this;var S=this.high;if(g<32){var R=this.low;return i(R>>>g|S<<32-g,S>>>g,this.unsigned)}else return g===32?i(S,0,this.unsigned):i(S>>>g-32,0,this.unsigned)},b.shru=b.shiftRightUnsigned,b.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},b.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},b.toBytes=function(T){return T?this.toBytesLE():this.toBytesBE()},b.toBytesLE=function(){var T=this.high,g=this.low;return[g&255,g>>>8&255,g>>>16&255,g>>>24&255,T&255,T>>>8&255,T>>>16&255,T>>>24&255]},b.toBytesBE=function(){var T=this.high,g=this.low;return[T>>>24&255,T>>>16&255,T>>>8&255,T&255,g>>>24&255,g>>>16&255,g>>>8&255,g&255]},e})});var Mc=rt((wG,Dp)=>{Dp.exports=globalThis.luma});var Co=rt((LG,Gp)=>{Gp.exports=globalThis.deck});var bc=rt((vG,Up)=>{Up.exports=globalThis.luma});var Nr=rt((aU,nm)=>{nm.exports=globalThis.loaders});var L0=rt((Cz,w0)=>{w0.exports=globalThis.deck});var V0=rt(tf=>{tf.read=function(e,t,r,n,s){var o,i,a=s*8-n-1,c=(1<<a)-1,l=c>>1,f=-7,u=r?s-1:0,h=r?-1:1,d=e[t+u];for(u+=h,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=o*256+e[t+u],u+=h,f-=8);for(i=o&(1<<-f)-1,o>>=-f,f+=n;f>0;i=i*256+e[t+u],u+=h,f-=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)};tf.write=function(e,t,r,n,s,o){var i,a,c,l=o*8-s-1,f=(1<<l)-1,u=f>>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=f):(i=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-i))<1&&(i--,c*=2),i+u>=1?t+=h/c:t+=h*Math.pow(2,1-u),t*c>=2&&(i++,c/=2),i+u>=f?(a=0,i=f):i+u>=1?(a=(t*c-1)*Math.pow(2,s),i=i+u):(a=t*Math.pow(2,u-1)*Math.pow(2,s),i=0));s>=8;e[r+d]=a&255,d+=p,a/=256,s-=8);for(i=i<<s|a,l+=s;l>0;e[r+d]=i&255,d+=p,i/=256,l-=8);e[r+d-p]|=A*128}});var j0=rt((d5,J0)=>{"use strict";J0.exports=j;var Bi=V0();function j(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}j.Varint=0;j.Fixed64=1;j.Bytes=2;j.Fixed32=5;var ef=(1<<16)*(1<<16),H0=1/ef,u3=12,k0=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");j.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),s=n>>3,o=this.pos;this.type=n&7,e(s,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Ci(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=q0(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Ci(this.buf,this.pos)+Ci(this.buf,this.pos+4)*ef;return this.pos+=8,e},readSFixed64:function(){var e=Ci(this.buf,this.pos)+q0(this.buf,this.pos+4)*ef;return this.pos+=8,e},readFloat:function(){var e=Bi.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Bi.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,h3(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>=u3&&k0?C3(this.buf,t,e):B3(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==j.Bytes)return e.push(this.readVarint(t));var r=xe(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==j.Bytes)return e.push(this.readSVarint());var t=xe(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==j.Bytes)return e.push(this.readBoolean());var t=xe(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==j.Bytes)return e.push(this.readFloat());var t=xe(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==j.Bytes)return e.push(this.readDouble());var t=xe(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==j.Bytes)return e.push(this.readFixed32());var t=xe(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==j.Bytes)return e.push(this.readSFixed32());var t=xe(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==j.Bytes)return e.push(this.readFixed64());var t=xe(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==j.Bytes)return e.push(this.readSFixed64());var t=xe(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===j.Varint)for(;this.buf[this.pos++]>127;);else if(t===j.Bytes)this.pos=this.readVarint()+this.pos;else if(t===j.Fixed32)this.pos+=4;else if(t===j.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),nn(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),nn(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),nn(this.buf,e&-1,this.pos),nn(this.buf,Math.floor(e*H0),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),nn(this.buf,e&-1,this.pos),nn(this.buf,Math.floor(e*H0),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){d3(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=S3(this.buf,e,this.pos);var r=this.pos-t;r>=128&&z0(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),Bi.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Bi.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&&z0(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,j.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,g3,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,A3,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,T3,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,x3,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,y3,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,E3,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,_3,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,M3,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,b3,t)},writeBytesField:function(e,t){this.writeTag(e,j.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,j.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,j.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,j.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,j.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,j.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,j.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,j.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,j.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,j.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function h3(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 rn(e,s,t);throw new Error("Expected varint not more than 10 bytes")}function xe(e){return e.type===j.Bytes?e.readVarint()+e.pos:e.pos+1}function rn(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function d3(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),p3(r,n,t),m3(n,t)}function p3(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 m3(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 z0(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 g3(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function A3(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function x3(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function y3(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function T3(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function E3(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function _3(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function M3(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function b3(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function Ci(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function nn(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function q0(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function B3(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,f;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],f=e[s+3],(c&192)===128&&(l&192)===128&&(f&192)===128&&(i=(o&15)<<18|(c&63)<<12|(l&63)<<6|f&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 C3(e,t,r){return k0.decode(e.subarray(t,r))}function S3(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 xs={};pt(xs,{A5Layer:()=>vh,GeohashLayer:()=>h1,GreatCircleLayer:()=>Zd,H3ClusterLayer:()=>Np,H3HexagonLayer:()=>Bo,MVTLayer:()=>c1,QuadkeyLayer:()=>hp,S2Layer:()=>fp,TerrainLayer:()=>I0,Tile3DLayer:()=>T0,TileLayer:()=>nr,TripsLayer:()=>Fp,_GeoCellLayer:()=>Ft,_Tile2DHeader:()=>er,_Tileset2D:()=>rr,_WMSLayer:()=>Pr,_getURLFromTemplate:()=>oe});var Qt={},mf=D(zt(),1);ye(Qt,D(zt(),1));if(!mf.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");ye(xs,Qt);var Af=D(qt(),1),Li=D(zt(),1),T1={...Li.PolygonLayer.defaultProps},an=class extends Af.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:f,lineMiterLimit:u,lineDashJustified:h,getElevation:d,getFillColor:p,getLineColor:A,getLineWidth:m}=this.props,{updateTriggers:y,material:_,transitions:E}=this.props,M=this.getSubLayerClass("cell",Li.PolygonLayer),{updateTriggers:B,...C}=this.indexToBounds()||{};return new M({filled:s,wireframe:n,extruded:r,elevationScale:t,stroked:o,lineWidthUnits:i,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:f,lineMiterLimit:u,lineDashJustified:h,material:_,transitions:E,getElevation:d,getFillColor:p,getLineColor:A,getLineWidth:m},this.getSubLayerProps({id:"cell",updateTriggers:y&&{...B,getElevation:y.getElevation,getFillColor:y.getFillColor,getLineColor:y.getLineColor,getLineWidth:y.getLineWidth}}),C)}};an.layerName="GeoCellLayer";an.defaultProps=T1;var Ft=an;var E1=Object.defineProperty,un=(e,t)=>{for(var r in t)E1(e,r,{get:t[r],enumerable:!0})},Tt={};un(Tt,{ARRAY_TYPE:()=>st,EPSILON:()=>dt,RANDOM:()=>Ue,equals:()=>B1,setMatrixArrayType:()=>_1,toRadian:()=>b1});var dt=1e-6,st=typeof Float32Array<"u"?Float32Array:Array,Ue=Math.random;function _1(e){st=e}var M1=Math.PI/180;function b1(e){return e*M1}function B1(e,t){return Math.abs(e-t)<=dt*Math.max(1,Math.abs(e),Math.abs(t))}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Ve={};un(Ve,{LDU:()=>z1,add:()=>q1,adjoint:()=>P1,clone:()=>S1,copy:()=>I1,create:()=>C1,determinant:()=>O1,equals:()=>J1,exactEquals:()=>k1,frob:()=>H1,fromRotation:()=>G1,fromScaling:()=>U1,fromValues:()=>L1,identity:()=>w1,invert:()=>F1,mul:()=>W1,multiply:()=>Uf,multiplyScalar:()=>j1,multiplyScalarAndAdd:()=>X1,rotate:()=>N1,scale:()=>D1,set:()=>v1,str:()=>V1,sub:()=>Y1,subtract:()=>Vf,transpose:()=>R1});function C1(){var e=new st(4);return st!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function S1(e){var t=new st(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function I1(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function w1(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}function L1(e,t,r,n){var s=new st(4);return s[0]=e,s[1]=t,s[2]=r,s[3]=n,s}function v1(e,t,r,n,s){return e[0]=t,e[1]=r,e[2]=n,e[3]=s,e}function R1(e,t){if(e===t){var r=t[1];e[1]=t[2],e[2]=r}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}function F1(e,t){var r=t[0],n=t[1],s=t[2],o=t[3],i=r*o-s*n;return i?(i=1/i,e[0]=o*i,e[1]=-n*i,e[2]=-s*i,e[3]=r*i,e):null}function P1(e,t){var r=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=r,e}function O1(e){return e[0]*e[3]-e[2]*e[1]}function Uf(e,t,r){var n=t[0],s=t[1],o=t[2],i=t[3],a=r[0],c=r[1],l=r[2],f=r[3];return e[0]=n*a+o*c,e[1]=s*a+i*c,e[2]=n*l+o*f,e[3]=s*l+i*f,e}function N1(e,t,r){var 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]=n*-a+o*c,e[3]=s*-a+i*c,e}function D1(e,t,r){var n=t[0],s=t[1],o=t[2],i=t[3],a=r[0],c=r[1];return e[0]=n*a,e[1]=s*a,e[2]=o*c,e[3]=i*c,e}function G1(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=-r,e[3]=n,e}function U1(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}function V1(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function H1(e){return Math.hypot(e[0],e[1],e[2],e[3])}function z1(e,t,r,n){return e[2]=n[2]/n[0],r[0]=n[0],r[1]=n[1],r[3]=n[3]-e[2]*r[1],[e,t,r]}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}function Vf(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 k1(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function J1(e,t){var r=e[0],n=e[1],s=e[2],o=e[3],i=t[0],a=t[1],c=t[2],l=t[3];return Math.abs(r-i)<=dt*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-a)<=dt*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(s-c)<=dt*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(o-l)<=dt*Math.max(1,Math.abs(o),Math.abs(l))}function j1(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function X1(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}var W1=Uf,Y1=Vf;function K1(){var e=new st(9);return st!=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}var Pi={};un(Pi,{add:()=>lx,calculateW:()=>ZA,clone:()=>ox,conjugate:()=>rx,copy:()=>ax,create:()=>Ni,dot:()=>ru,equals:()=>mx,exactEquals:()=>px,exp:()=>Zf,fromEuler:()=>nx,fromMat3:()=>tu,fromValues:()=>ix,getAngle:()=>WA,getAxisAngle:()=>XA,identity:()=>jA,invert:()=>ex,len:()=>hx,length:()=>nu,lerp:()=>ux,ln:()=>$f,mul:()=>fx,multiply:()=>Qf,normalize:()=>Ji,pow:()=>$A,random:()=>tx,rotateX:()=>YA,rotateY:()=>KA,rotateZ:()=>QA,rotationTo:()=>gx,scale:()=>eu,set:()=>cx,setAxes:()=>xx,setAxisAngle:()=>Kf,slerp:()=>ws,sqlerp:()=>Ax,sqrLen:()=>dx,squaredLength:()=>su,str:()=>sx});var w={};un(w,{add:()=>tA,angle:()=>TA,bezier:()=>hA,ceil:()=>eA,clone:()=>Q1,copy:()=>Z1,create:()=>qi,cross:()=>Is,dist:()=>IA,distance:()=>Jf,div:()=>SA,divide:()=>kf,dot:()=>ki,equals:()=>bA,exactEquals:()=>MA,floor:()=>rA,forEach:()=>vA,fromValues:()=>Oi,hermite:()=>uA,inverse:()=>lA,len:()=>Yf,length:()=>Hf,lerp:()=>fA,max:()=>sA,min:()=>nA,mul:()=>CA,multiply:()=>qf,negate:()=>cA,normalize:()=>Wf,random:()=>dA,rotateX:()=>AA,rotateY:()=>xA,rotateZ:()=>yA,round:()=>oA,scale:()=>iA,scaleAndAdd:()=>aA,set:()=>$1,sqrDist:()=>wA,sqrLen:()=>LA,squaredDistance:()=>jf,squaredLength:()=>Xf,str:()=>_A,sub:()=>BA,subtract:()=>zf,transformMat3:()=>mA,transformMat4:()=>pA,transformQuat:()=>gA,zero:()=>EA});function qi(){var e=new st(3);return st!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Q1(e){var t=new st(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Hf(e){var t=e[0],r=e[1],n=e[2];return Math.hypot(t,r,n)}function Oi(e,t,r){var n=new st(3);return n[0]=e,n[1]=t,n[2]=r,n}function Z1(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function $1(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function tA(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function zf(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function qf(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function kf(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function eA(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function rA(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function nA(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 sA(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 oA(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e}function iA(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function aA(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 Jf(e,t){var r=t[0]-e[0],n=t[1]-e[1],s=t[2]-e[2];return Math.hypot(r,n,s)}function jf(e,t){var r=t[0]-e[0],n=t[1]-e[1],s=t[2]-e[2];return r*r+n*n+s*s}function Xf(e){var t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function cA(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function lA(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Wf(e,t){var 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 ki(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Is(e,t,r){var 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 fA(e,t,r,n){var 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 uA(e,t,r,n,s,o){var i=o*o,a=i*(2*o-3)+1,c=i*(o-2)+o,l=i*(o-1),f=i*(3-2*o);return e[0]=t[0]*a+r[0]*c+n[0]*l+s[0]*f,e[1]=t[1]*a+r[1]*c+n[1]*l+s[1]*f,e[2]=t[2]*a+r[2]*c+n[2]*l+s[2]*f,e}function hA(e,t,r,n,s,o){var i=1-o,a=i*i,c=o*o,l=a*i,f=3*o*a,u=3*c*i,h=c*o;return e[0]=t[0]*l+r[0]*f+n[0]*u+s[0]*h,e[1]=t[1]*l+r[1]*f+n[1]*u+s[1]*h,e[2]=t[2]*l+r[2]*f+n[2]*u+s[2]*h,e}function dA(e,t){t=t||1;var r=Ue()*2*Math.PI,n=Ue()*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 pA(e,t,r){var 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 mA(e,t,r){var 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 gA(e,t,r){var n=r[0],s=r[1],o=r[2],i=r[3],a=t[0],c=t[1],l=t[2],f=s*l-o*c,u=o*a-n*l,h=n*c-s*a,d=s*h-o*u,p=o*f-n*h,A=n*u-s*f,m=i*2;return f*=m,u*=m,h*=m,d*=2,p*=2,A*=2,e[0]=a+f+d,e[1]=c+u+p,e[2]=l+h+A,e}function AA(e,t,r,n){var 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 xA(e,t,r,n){var 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 yA(e,t,r,n){var 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 TA(e,t){var 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),l=Math.sqrt(o*o+i*i+a*a),f=c*l,u=f&&ki(e,t)/f;return Math.acos(Math.min(Math.max(u,-1),1))}function EA(e){return e[0]=0,e[1]=0,e[2]=0,e}function _A(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"}function MA(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function bA(e,t){var r=e[0],n=e[1],s=e[2],o=t[0],i=t[1],a=t[2];return Math.abs(r-o)<=dt*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-i)<=dt*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-a)<=dt*Math.max(1,Math.abs(s),Math.abs(a))}var BA=zf,CA=qf,SA=kf,IA=Jf,wA=jf,Yf=Hf,LA=Xf,vA=function(){var e=qi();return function(t,r,n,s,o,i){var 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}}();function RA(){var e=new st(4);return st!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function FA(e){var t=new st(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function PA(e,t,r,n){var s=new st(4);return s[0]=e,s[1]=t,s[2]=r,s[3]=n,s}function OA(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function NA(e,t,r,n,s){return e[0]=t,e[1]=r,e[2]=n,e[3]=s,e}function DA(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 GA(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 UA(e){var t=e[0],r=e[1],n=e[2],s=e[3];return Math.hypot(t,r,n,s)}function VA(e){var t=e[0],r=e[1],n=e[2],s=e[3];return t*t+r*r+n*n+s*s}function HA(e,t){var 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 zA(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function qA(e,t,r,n){var 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 kA(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function JA(e,t){var r=e[0],n=e[1],s=e[2],o=e[3],i=t[0],a=t[1],c=t[2],l=t[3];return Math.abs(r-i)<=dt*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-a)<=dt*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(s-c)<=dt*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(o-l)<=dt*Math.max(1,Math.abs(o),Math.abs(l))}var iL=function(){var e=RA();return function(t,r,n,s,o,i){var 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}}();function Ni(){var e=new st(4);return st!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function jA(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Kf(e,t,r){r=r*.5;var n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function XA(e,t){var r=Math.acos(t[3])*2,n=Math.sin(r/2);return n>dt?(e[0]=t[0]/n,e[1]=t[1]/n,e[2]=t[2]/n):(e[0]=1,e[1]=0,e[2]=0),r}function WA(e,t){var r=ru(e,t);return Math.acos(2*r*r-1)}function Qf(e,t,r){var n=t[0],s=t[1],o=t[2],i=t[3],a=r[0],c=r[1],l=r[2],f=r[3];return e[0]=n*f+i*a+s*l-o*c,e[1]=s*f+i*c+o*a-n*l,e[2]=o*f+i*l+n*c-s*a,e[3]=i*f-n*a-s*c-o*l,e}function YA(e,t,r){r*=.5;var 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 KA(e,t,r){r*=.5;var 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 QA(e,t,r){r*=.5;var 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 ZA(e,t){var 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 Zf(e,t){var r=t[0],n=t[1],s=t[2],o=t[3],i=Math.sqrt(r*r+n*n+s*s),a=Math.exp(o),c=i>0?a*Math.sin(i)/i:0;return e[0]=r*c,e[1]=n*c,e[2]=s*c,e[3]=a*Math.cos(i),e}function $f(e,t){var r=t[0],n=t[1],s=t[2],o=t[3],i=Math.sqrt(r*r+n*n+s*s),a=i>0?Math.atan2(i,o)/i:0;return e[0]=r*a,e[1]=n*a,e[2]=s*a,e[3]=.5*Math.log(r*r+n*n+s*s+o*o),e}function $A(e,t,r){return $f(e,t),eu(e,e,r),Zf(e,e),e}function ws(e,t,r,n){var s=t[0],o=t[1],i=t[2],a=t[3],c=r[0],l=r[1],f=r[2],u=r[3],h,d,p,A,m;return d=s*c+o*l+i*f+a*u,d<0&&(d=-d,c=-c,l=-l,f=-f,u=-u),1-d>dt?(h=Math.acos(d),p=Math.sin(h),A=Math.sin((1-n)*h)/p,m=Math.sin(n*h)/p):(A=1-n,m=n),e[0]=A*s+m*c,e[1]=A*o+m*l,e[2]=A*i+m*f,e[3]=A*a+m*u,e}function tx(e){var t=Ue(),r=Ue(),n=Ue(),s=Math.sqrt(1-t),o=Math.sqrt(t);return e[0]=s*Math.sin(2*Math.PI*r),e[1]=s*Math.cos(2*Math.PI*r),e[2]=o*Math.sin(2*Math.PI*n),e[3]=o*Math.cos(2*Math.PI*n),e}function ex(e,t){var 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 rx(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function tu(e,t){var 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{var s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);var 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}function nx(e,t,r,n){var s=.5*Math.PI/180;t*=s,r*=s,n*=s;var o=Math.sin(t),i=Math.cos(t),a=Math.sin(r),c=Math.cos(r),l=Math.sin(n),f=Math.cos(n);return e[0]=o*c*f-i*a*l,e[1]=i*a*f+o*c*l,e[2]=i*c*l-o*a*f,e[3]=i*c*f+o*a*l,e}function sx(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}var ox=FA,ix=PA,ax=OA,cx=NA,lx=DA,fx=Qf,eu=GA,ru=zA,ux=qA,nu=UA,hx=nu,su=VA,dx=su,Ji=HA,px=kA,mx=JA,gx=function(){var e=qi(),t=Oi(1,0,0),r=Oi(0,1,0);return function(n,s,o){var i=ki(s,o);return i<-.999999?(Is(e,t,s),Yf(e)<1e-6&&Is(e,r,s),Wf(e,e),Kf(n,e,Math.PI),n):i>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Is(e,s,o),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+i,Ji(n,n))}}(),Ax=function(){var e=Ni(),t=Ni();return function(r,n,s,o,i,a){return ws(e,n,i,a),ws(t,s,o,a),ws(r,e,t,2*a*(1-a)),r}}(),xx=function(){var e=K1();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],Ji(t,tu(t,e))}}(),P={};un(P,{add:()=>Mx,angle:()=>qx,ceil:()=>bx,clone:()=>yx,copy:()=>Ex,create:()=>ou,cross:()=>Ox,dist:()=>Zx,distance:()=>lu,div:()=>Qx,divide:()=>cu,dot:()=>Px,equals:()=>Xx,exactEquals:()=>jx,floor:()=>Bx,forEach:()=>ey,fromValues:()=>Tx,inverse:()=>Rx,len:()=>Wx,length:()=>uu,lerp:()=>Nx,max:()=>Sx,min:()=>Cx,mul:()=>Kx,multiply:()=>au,negate:()=>vx,normalize:()=>Fx,random:()=>Dx,rotate:()=>zx,round:()=>Ix,scale:()=>wx,scaleAndAdd:()=>Lx,set:()=>_x,sqrDist:()=>$x,sqrLen:()=>ty,squaredDistance:()=>fu,squaredLength:()=>hu,str:()=>Jx,sub:()=>Yx,subtract:()=>iu,transformMat2:()=>Gx,transformMat2d:()=>Ux,transformMat3:()=>Vx,transformMat4:()=>Hx,zero:()=>kx});function ou(){var e=new st(2);return st!=Float32Array&&(e[0]=0,e[1]=0),e}function yx(e){var t=new st(2);return t[0]=e[0],t[1]=e[1],t}function Tx(e,t){var r=new st(2);return r[0]=e,r[1]=t,r}function Ex(e,t){return e[0]=t[0],e[1]=t[1],e}function _x(e,t,r){return e[0]=t,e[1]=r,e}function Mx(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e}function iu(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}function au(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e}function cu(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e}function bx(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}function Bx(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}function Cx(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e}function Sx(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e}function Ix(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}function wx(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e}function Lx(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e}function lu(e,t){var r=t[0]-e[0],n=t[1]-e[1];return Math.hypot(r,n)}function fu(e,t){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n}function uu(e){var t=e[0],r=e[1];return Math.hypot(t,r)}function hu(e){var t=e[0],r=e[1];return t*t+r*r}function vx(e,t){return e[0]=-t[0],e[1]=-t[1],e}function Rx(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}function Fx(e,t){var r=t[0],n=t[1],s=r*r+n*n;return s>0&&(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e}function Px(e,t){return e[0]*t[0]+e[1]*t[1]}function Ox(e,t,r){var n=t[0]*r[1]-t[1]*r[0];return e[0]=e[1]=0,e[2]=n,e}function Nx(e,t,r,n){var s=t[0],o=t[1];return e[0]=s+n*(r[0]-s),e[1]=o+n*(r[1]-o),e}function Dx(e,t){t=t||1;var r=Ue()*2*Math.PI;return e[0]=Math.cos(r)*t,e[1]=Math.sin(r)*t,e}function Gx(e,t,r){var 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 Ux(e,t,r){var 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 Vx(e,t,r){var 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 Hx(e,t,r){var 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}function zx(e,t,r,n){var s=t[0]-r[0],o=t[1]-r[1],i=Math.sin(n),a=Math.cos(n);return e[0]=s*a-o*i+r[0],e[1]=s*i+o*a+r[1],e}function qx(e,t){var r=e[0],n=e[1],s=t[0],o=t[1],i=Math.sqrt(r*r+n*n)*Math.sqrt(s*s+o*o),a=i&&(r*s+n*o)/i;return Math.acos(Math.min(Math.max(a,-1),1))}function kx(e){return e[0]=0,e[1]=0,e}function Jx(e){return"vec2("+e[0]+", "+e[1]+")"}function jx(e,t){return e[0]===t[0]&&e[1]===t[1]}function Xx(e,t){var r=e[0],n=e[1],s=t[0],o=t[1];return Math.abs(r-s)<=dt*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-o)<=dt*Math.max(1,Math.abs(n),Math.abs(o))}var Wx=uu,Yx=iu,Kx=au,Qx=cu,Zx=lu,$x=fu,ty=hu,ey=function(){var e=ou();return function(t,r,n,s,o,i){var 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}}(),Fs=(1+Math.sqrt(5))/2,aL=2*Math.PI,Ls=2*Math.PI/5,Zt=Math.PI/5,xf=Math.PI/10,ry=2*Math.atan(Fs),Di=Math.PI-ry,cL=-.5*Math.PI+Math.acos(-1/Math.sqrt(3-Fs)),Ps=(Math.sqrt(5)-1)/2,ny=3-Math.sqrt(5),sy=Math.sqrt(3-Fs),lL=Math.sqrt(3)*sy/Fs;Tt.setMatrixArrayType(Float64Array);var ji=class Gi{constructor(t){this.vertices=t,this.isWindingCorrect()||this.vertices.reverse()}getArea(){let t=0,r=this.vertices.length;for(let n=0;n<r;n++){let s=(n+1)%r;t+=(this.vertices[s][0]-this.vertices[n][0])*(this.vertices[s][1]+this.vertices[n][1])}return t}isWindingCorrect(){return this.getArea()>=0}getVertices(){return this.vertices}scale(t){for(let r of this.vertices)P.scale(r,r,t);return this}rotate180(){for(let t of this.vertices)P.negate(t,t);return this}reflectY(){for(let t of this.vertices)t[1]=-t[1];return this.vertices.reverse(),this}translate(t){for(let r of this.vertices)P.add(r,r,t);return this}transform(t){for(let r of this.vertices)P.transformMat2(r,r,t);return this}transform2d(t){for(let r of this.vertices)P.transformMat2d(r,r,t);return this}clone(){return new Gi(this.vertices.map(r=>P.clone(r)))}getCenter(){let t=this.vertices.length;return this.vertices.reduce((n,s)=>[n[0]+s[0]/t,n[1]+s[1]/t],[0,0])}containsPoint(t){if(!this.isWindingCorrect())throw new Error("Pentagon is not counter-clockwise");let r=this.vertices.length,n=1;for(let s=0;s<r;s++){let o=this.vertices[s],i=this.vertices[(s+1)%r],a=o[0]-i[0],c=o[1]-i[1],l=t[0]-o[0],f=t[1]-o[1],u=a*f-c*l;if(u<0){let h=Math.sqrt(l*l+f*f);n=Math.min(n,u/h)}}return n}splitEdges(t){if(t<=1)return this;let r=[],n=this.vertices.length;for(let s=0;s<n;s++){let o=this.vertices[s],i=this.vertices[(s+1)%n];r.push(P.clone(o));for(let a=1;a<t;a++){let c=a/t,l=P.create();P.lerp(l,o,i,c),r.push(l)}}return new Gi(r)}};Tt.setMatrixArrayType(Float64Array);var du=[0,0],pu=[0,1],He=[.7885966681787006,1.6149108024237764],mu=[1.6171013659387945,1.054928690397459],gu=[Math.cos(xf),Math.sin(xf)],oy=2*P.length(He)*Math.cos(Zt),iy=Zt-Math.atan2(He[1],He[0]),ay=2*Ps/oy;[du,pu,He,mu,gu].forEach(e=>{P.scale(e,e,ay),P.rotate(e,e,[0,0],iy)});var cy=new ji([du,pu,He,mu,gu]),Au=Math.atan2(He[1],He[0])-Zt,ly=[0,0],vs=Ps/Math.cos(Zt),yf=Au+Zt,Rs=[vs*Math.cos(yf),vs*Math.sin(yf)],Tf=Au-Zt,fn=[vs*Math.cos(Tf),vs*Math.sin(Tf)],xu=new ji([ly,Rs,fn]),yu=Ve.fromValues(Rs[0],Rs[1],fn[0],fn[1]),fL=Ve.invert(Ve.create(),yu),fy=new Float64Array([-.0022392098386786394,21308606513250217e-22,-2559257686421274e-24,33701965267802837e-28,-4667545312611249e-30,667492870384816e-32]),uy=new Float64Array([.0022392089963541657,28831978048607556e-22,508622073997266e-23,102018123778161e-25,21912872306767718e-30,49284235482523806e-33]),hy=class{applyCoefficients(e,t){let r=Math.sin(e),n=Math.cos(e),s=2*(n-r)*(n+r),o,i;return o=s*t[5]+t[4],i=s*o+t[3],o=s*i-o+t[2],i=s*o-i+t[1],o=s*i-o+t[0],e+2*r*n*o}forward(e){return this.applyCoefficients(e,fy)}inverse(e){return this.applyCoefficients(e,uy)}};Tt.setMatrixArrayType(Float64Array);var Tu=new hy;function Ef(e){return e*(Math.PI/180)}function _f(e){return e*(180/Math.PI)}function Mf(e){let t=P.length(e),r=Math.atan2(e[1],e[0]);return[t,r]}function dy([e,t]){let r=e*Math.cos(t),n=e*Math.sin(t);return[r,n]}function py(e,[t,r,n]){let s=[t[0]-n[0],t[1]-n[1]],o=[n[0]-r[0],n[1]-r[1]],i=[e[0]-n[0],e[1]-n[1]],a=o[0]*s[1]-o[1]*s[0],c=(o[0]*i[1]-o[1]*i[0])/a,l=(s[0]*i[1]-s[1]*i[0])/a,f=1-(c+l);return[c,l,f]}function my(e,[t,r,n]){return[e[0]*t[0]+e[1]*r[0]+e[2]*n[0],e[0]*t[1]+e[1]*r[1]+e[2]*n[1]]}function Ui(e){let t=Math.atan2(e[1],e[0]),r=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),n=Math.acos(e[2]/r);return[t,n]}function _r([e,t]){let r=Math.sin(t),n=r*Math.cos(e),s=r*Math.sin(e),o=Math.cos(t);return[n,s,o]}var Eu=93;function gy([e,t]){let r=Ef(e+Eu),n=Ef(t),s=Tu.forward(n),o=Math.PI/2-s;return[r,o]}function _u([e,t]){let r=_f(e)-Eu,n=Math.PI/2-t,s=Tu.inverse(n),o=_f(s);return[r,o]}function Ay(e){let t=e.map(o=>_r(gy(o))),r=w.create();for(let o of t)w.add(r,r,o);w.normalize(r,r);let[n,s]=_u(Ui(r));return(s>89.99||s<-89.99)&&(n=e[0][0]),n=((n+180)%360+360)%360-180,e.map(o=>{let[i,a]=o;for(;i-n>180;)i=i-360;for(;i-n<-180;)i=i+360;return[i,a]})}Tt.setMatrixArrayType(Float64Array);var Os=Math.sqrt(5),Ns=Math.sqrt(.2),Mu=Math.sqrt((1-Ns)/2),bu=Math.sqrt((1+Ns)/2),Ts=.5,bf=Math.sqrt((2.5-Os)/10),Bf=Math.sqrt((2.5+Os)/10),Cf=Math.sqrt((1+Ns)/8),Sf=Math.sqrt((1-Ns)/8),If=Math.sqrt((3-Os)/8),wf=Math.sqrt((3+Os)/8),xy=[[0,0],[Mu,0],[bf,Ts],[-Cf,If],[-Cf,-If],[bf,-Ts],[-bu,0],[-Sf,-wf],[Bf,-Ts],[Bf,Ts],[-Sf,wf],[0,0]],yy=xy.map(([e,t])=>[-t,e]),Es=yy.map((e,t)=>t===0?[0,0,0,1]:t===11?[0,-1,0,0]:[...e,0,t<6?bu:Mu]);Tt.setMatrixArrayType(Float64Array);var Bu=["vu","uw","vw","vw","vw"],cn=["wu","uw","vw","vu","uw"],vi=["wu","uv","wv","wu","uw"],_s=["vu","uv","wv","wu","uw"],Ty=[Bu,_s,vi,cn,vi,_s,vi,cn,cn,cn,_s,_s],Ey=[4,2,3,2,0,4,3,2,2,0,3,0],Lf=[0,1,2,4,3,5,7,8,6,11,10,9],kt=[];function _y(){Ms([0,0],0,Es[0]);for(let e=0;e<5;e++){let t=e*Ls,r=t+Zt;Ms([t,Di],Zt,Es[e+1]),Ms([r,Math.PI-Di],Zt,Es[(e+3)%5+6])}Ms([0,Math.PI],0,Es[11])}var yr=0;function Ms(e,t,r){if(yr>11)throw new Error(`Too many origins: ${yr}`);let n=Pi.create();Pi.conjugate(n,r);let s={id:yr,axis:e,quat:r,inverseQuat:n,angle:t,orientation:Ty[yr],firstQuintant:Ey[yr]};kt.push(s),yr++}_y();kt.sort((e,t)=>Lf.indexOf(e.id)-Lf.indexOf(t.id));kt.forEach((e,t)=>e.id=t);function My(e,t){let r=t.orientation,n=r===Bu||r===cn?-1:1,s=(e-t.firstQuintant+5)%5,o=r[s];return{quintant:(t.firstQuintant+n*s+5)%5,orientation:o}}var by=class{forward([e,t]){return[Math.tan(t),e]}inverse([e,t]){return[t,Math.atan(e)]}},Tr=w.create(),ln=w.create(),vf=w.create(),Rf=w.create();function Ri(e,t){w.lerp(Tr,e,t,.5),w.normalize(Tr,Tr),w.cross(Tr,e,Tr);let r=w.length(Tr);if(r<1e-8){let n=w.subtract(w.create(),e,t);return .5*w.length(n)}return r}function By(e,t,r){return w.cross(ln,t,r),w.dot(e,ln)}function Cy(e,t,r,n,s){w.cross(ln,n,s);let o=w.dot(t,ln),i=w.dot(r,ln);return w.scale(vf,t,i),w.scale(Rf,r,o),w.sub(e,Rf,vf)}function Vi(e,t,r,n){let s=w.angle(t,r);if(s<1e-12)return w.lerp(e,t,r,n);let o=Math.sin((1-n)*s)/Math.sin(s),i=Math.sin(n*s)/Math.sin(s),a=w.scale(w.create(),t,o),c=w.scale(w.create(),r,i);return w.add(e,a,c)}Tt.setMatrixArrayType(Float64Array);var bs=w.create(),Bs=w.create(),Cs=w.create(),Er=w.create(),Sy=class{constructor(e){this._area=null,this.vertices=e,Object.freeze(this.vertices)}getBoundary(e=1,t=!0){let r=[],n=this.vertices.length;for(let s=0;s<n*e;s++){let o=s/e;r.push(this.slerp(o))}return t&&r.push(r[0]),r}slerp(e){let t=this.vertices.length,r=e%1,n=Math.floor(e%t),s=(n+1)%t;return Vi(w.create(),this.vertices[n],this.vertices[s],r)}getTransformedVertices(e){let t=this.vertices.length,r=Math.floor(e%t),n=(r+1)%t,s=(r+t-1)%t,o=w.clone(this.vertices[r]),i=w.clone(this.vertices[n]),a=w.clone(this.vertices[s]);return w.sub(i,i,o),w.sub(a,a,o),[o,i,a]}containsPoint(e){let t=this.vertices.length,r=1/0;for(let n=0;n<t;n++){let[s,o,i]=this.getTransformedVertices(n),a=w.sub(w.create(),e,s);w.normalize(a,a),w.normalize(o,o),w.normalize(i,i);let c=w.cross(w.create(),o,a),l=w.cross(w.create(),a,i),f=w.dot(s,c),u=w.dot(s,l);r=Math.min(r,f,u)}return r}getTriangleArea(e,t,r){w.lerp(bs,t,r,.5),w.lerp(Bs,r,e,.5),w.lerp(Cs,e,t,.5),w.normalize(bs,bs),w.normalize(Bs,Bs),w.normalize(Cs,Cs);let n=By(bs,Bs,Cs),s=Math.max(-1,Math.min(1,n));return Math.abs(s)<1e-8?2*s:Math.asin(s)*2}getArea(){return this._area===null&&(this._area=this._getArea()),this._area}_getArea(){if(this.vertices.length<3)return 0;if(this.vertices.length===3)return this._area=this.getTriangleArea(this.vertices[0],this.vertices[1],this.vertices[2]),this._area;w.set(Er,0,0,0);for(let t of this.vertices)w.add(Er,Er,t);w.normalize(Er,Er);let e=0;for(let t=0;t<this.vertices.length;t++){let r=this.vertices[t],n=this.vertices[(t+1)%this.vertices.length],s=this.getTriangleArea(Er,r,n);isNaN(s)||(e+=s)}return this._area=e,this._area}isWindingCorrect(){if(!(this.getArea()>0))debugger}};Tt.setMatrixArrayType(Float64Array);var Ss=class extends Sy{constructor(e){if(e.length!==3)throw new Error("SphericalTriangleShape requires exactly 3 vertices");super(e)}};Tt.setMatrixArrayType(Float64Array);var Iy=class{forward(e,t,r){let[n,s,o]=t,i=new Ss([n,s,o]),a=w.subtract(w.create(),e,n);w.normalize(a,a);let c=Cy(w.create(),n,a,s,o);w.normalize(c,c);let l=Ri(n,e)/Ri(n,c),f=i.getArea(),u=l/f,h=[1-l,u*new Ss([n,c,o]).getArea(),u*new Ss([n,s,c]).getArea()];return my(h,r)}inverse(e,t,r){let[n,s,o]=r,i=new Ss([n,s,o]),a=py(e,t),c=1-1e-14;if(a[0]>c)return n;if(a[1]>c)return s;if(a[2]>c)return o;let l=w.create();w.cross(l,s,o);let f=i.getArea(),u=1-a[0],d=a[2]/u*f,p=Math.sin(d),A=Math.sin(d/2),m=2*A*A,y=w.dot(n,s),_=w.dot(s,o),E=w.dot(o,n),M=w.length(l),B=w.dot(n,l),C=p*B+m*(y*_-E),L=m*M*(1+y),b=2/Math.acos(_)*Math.atan2(L,C),T=Vi(w.create(),s,o,b),g=Ri(n,T),S=this.safeAcos(u*g)/this.safeAcos(g);return Vi([0,0,0],n,T,S)}safeAcos(e){return e<.001?2*e+e*e*e/3:Math.acos(1-2*e*e)}};Tt.setMatrixArrayType(Float64Array);var It=-1,yt=1,wy=([e,t])=>P.fromValues(e-t,t),Hi=P.fromValues(1,0),zi=P.fromValues(0,1),Ff=P.negate(P.create(),Hi),Pf=P.negate(P.create(),zi),Fi=P.fromValues(0,0),Ly=(e,[t,r])=>{let n=Fi,s=Fi;switch(t===yt&&r===yt?(n=Hi,s=zi):t===It&&r===yt?(n=Pf,s=Ff):t===yt&&r===It?(n=zi,s=Hi):t===It&&r===It&&(n=Ff,s=Pf),e){case 0:return Fi;case 1:return n;case 2:return P.add(P.create(),s,n);case 3:return P.scaleAndAdd(P.create(),s,n,2);default:throw new Error(`Invalid Quaternary value: ${e}`)}},Of=e=>[[yt,yt],[yt,It],[yt,yt],[It,yt]][e],Nf=P.fromValues(-1,1);function Cu(e){return Array.from({length:e.length},(t,r)=>e.indexOf(r))}var Su=[0,1,3,4,5,6,7,2],Iu=[0,1,2,7,3,4,5,6],uL=Cu(Su),hL=Cu(Iu),vy=(e,t,r,n,s)=>{if(t<=0)return;let o=e[t]||0,i=e[t-1],a=r[0]+r[1],c=!0,l=!0;if(n!==(a===0)?(c=o===1||o===2,l=o===1):(c=o<2,l=o===0),!c)return;let f=l?i:i+4,u=s[f];e[t-1]=u%4,e[t]=(o+4+Math.floor(u/4)-Math.floor(f/4))%4},Ry=(e,t,r)=>{let n=BigInt(e),s=r==="vu"||r==="wu"||r==="vw",o=r==="wv"||r==="vw",i=r==="wu"||r==="uw";s&&(n=(1n<<BigInt(2*t))-n-1n);let a=Fy(n,t,o,i);if(i){let{offset:[c,l],flips:[f,u]}=a;a.offset=[l,c],f===It&&P.add(a.offset,a.offset,Nf),u===It&&P.subtract(a.offset,a.offset,Nf)}if(o){let{offset:[c,l],flips:f}=a,u=(1<<t)-(c+l);f[0]=-f[0],a.offset[1]=u,a.flips=f}return a},Fy=(e,t,r,n)=>{let s=P.create(),o=[yt,yt],i=BigInt(e),a=[];for(;i>0n||a.length<t;)a.push(Number(i%4n)),i=i>>2n;let c=n?Iu:Su;for(let f=a.length-1;f>=0;f--)vy(a,f,o,r,c),P.multiply(o,o,Of(a[f]));o[0]=yt,o[1]=yt;for(let f=a.length-1;f>=0;f--){P.scale(s,s,2);let u=Ly(a[f],o);P.add(s,s,u),P.multiply(o,o,Of(a[f]))}let l=a[0]||0;return{flips:o,k:l,offset:wy(s)}};Tt.setMatrixArrayType(Float64Array);var Py=!1,Oy=P.clone(fn),Ny=P.negate(P.create(),fn),Xi=[0,1,2,3,4].map(e=>{let t=Ve.create();return Ve.fromRotation(t,Ls*e),t}),Df=P.create();function Dy(e,t,r){let n=(Py?xu:cy).clone();P.transformMat2(Df,r.offset,yu),r.flips[0]===yt&&r.flips[1]===It&&n.rotate180();let{k:s}=r,o=r.flips[0]+r.flips[1];return((o===-2||o===2)&&s>1||o===0&&(s===0||s===3))&&n.reflectY(),r.flips[0]===It&&r.flips[1]===It?n.rotate180():r.flips[0]===It?n.translate(Ny):r.flips[1]===It&&n.translate(Oy),n.translate(Df),n.scale(1/2**e),n.transform(Xi[t]),n}function wu(e){let t=xu.clone();return t.transform(Xi[e]),t}function Gy(){let e=[];for(let t of Xi)e.push(P.transformMat2(P.create(),Rs,t));return e.reverse(),new ji(e)}Tt.setMatrixArrayType(Float64Array);var Uy=class{constructor(){if(this.vertices=[],this.invocations=0,this.addFaceCenters(),this.addVertices(),this.addMidpoints(),this.vertices.length!==62)throw new Error("Failed to construct CRS: vertices length is not 62");Object.freeze(this.vertices)}getVertex(e){this.invocations++,this.invocations===1e4&&console.warn("Too many CRS invocations, results should be cached");for(let t of this.vertices)if(w.distance(e,t)<1e-5)return t;throw new Error("Failed to find vertex in CRS")}addFaceCenters(){kt.forEach(e=>this.add(_r(e.axis)))}addVertices(){let e=Math.atan(ny);for(let t of kt)for(let r=0;r<5;r++){let n=(2*r+1)*Math.PI/5,s=_r([n+t.angle,e]);w.transformQuat(s,s,t.quat),this.add(s)}}addMidpoints(){let e=Math.atan(Ps);for(let t of kt)for(let r=0;r<5;r++){let n=2*r*Math.PI/5,s=_r([n+t.angle,e]);w.transformQuat(s,s,t.quat),this.add(s)}}add(e){let t=w.normalize(w.create(),e);return this.vertices.find(n=>w.distance(t,n)<1e-5)?!1:(this.vertices.push(t),!0)}};Tt.setMatrixArrayType(Float64Array);var Vy=new Uy,Hy=class{constructor(){this.faceTriangles=[],this.sphericalTriangles=[],this.polyhedral=new Iy,this.gnomonic=new by}forward(e,t){let r=kt[t],n=_r(e),s=w.create();w.transformQuat(s,n,r.inverseQuat);let o=Ui(s),i=this.gnomonic.forward(o);i[1]=i[1]-r.angle;let a=this.getFaceTriangleIndex(i),c=this.shouldReflect(i),l=this.getFaceTriangle(a,c,!1),f=this.getSphericalTriangle(a,t,c);return this.polyhedral.forward(n,f,l)}inverse(e,t){let r=Mf(e),n=this.getFaceTriangleIndex(r),s=this.shouldReflect(r),o=this.getFaceTriangle(n,s,!1),i=this.getSphericalTriangle(n,t,s),a=this.polyhedral.inverse(e,o,i);return Ui(a)}shouldReflect(e){let[t,r]=e;return dy([t,this.normalizeGamma(r)])[0]>Ps}getFaceTriangleIndex([e,t]){return(Math.floor(t/Zt)+10)%10}getFaceTriangle(e,t=!1,r=!1){let n=e;return t&&(n+=r?20:10),this.faceTriangles[n]?this.faceTriangles[n]:(this.faceTriangles[n]=t?this._getReflectedFaceTriangle(e,r):this._getFaceTriangle(e),Object.freeze(this.faceTriangles[n]),this.faceTriangles[n])}_getFaceTriangle(e){let t=Math.floor((e+1)/2)%5,[r,n,s]=wu(t).getVertices(),o=P.create();return P.lerp(o,n,s,.5),e%2===0?[r,o,n]:[r,s,o]}_getReflectedFaceTriangle(e,t=!1){let[r,n,s]=this._getFaceTriangle(e).map(a=>P.clone(a)),o=e%2===0;P.negate(r,r);let i=o?n:s;return P.scaleAndAdd(r,r,i,t?1+1/Math.cos(Di):2),[r,s,n]}getSphericalTriangle(e,t,r=!1){let n=10*t+e;return r&&(n+=120),this.sphericalTriangles[n]?this.sphericalTriangles[n]:(this.sphericalTriangles[n]=this._getSphericalTriangle(e,t,r),Object.freeze(this.sphericalTriangles[n]),this.sphericalTriangles[n])}_getSphericalTriangle(e,t,r=!1){let n=kt[t];return this.getFaceTriangle(e,r,!0).map(i=>{let[a,c]=Mf(i),l=[a,c+n.angle],f=_r(this.gnomonic.inverse(l));return w.transformQuat(f,f,n.quat),Vy.getVertex(f)})}normalizeGamma(e){let t=e/Ls,r=Math.round(t);return(t-r)*Ls}},Mr=2,zy=30,qy=58n,ky=0x3ffffffffffffffn;function Jy(e){let t=zy-1,r=e>>1n;for(;t>-1&&(r&0b1n)===0n;)t-=1,r=r>>(t<Mr?1n:2n);return t}function jy(e){let t=Jy(e);if(t===-1)return{origin:kt[0],segment:0,S:0n,resolution:t};let r=Number(e>>58n),n,s;if(t===0)n=kt[r],s=0;else{let l=Math.floor(r/5);n=kt[l],s=(r+n.firstQuintant)%5}if(!n)throw new Error(`Could not parse origin: ${r}`);if(t<Mr)return{origin:n,segment:s,S:0n,resolution:t};let o=t-Mr+1,i=BigInt(2*o),a=qy-i,c=(e&ky)>>a;return{origin:n,segment:s,S:c,resolution:t}}Tt.setMatrixArrayType(Float64Array);var dL=Ve.create(),Xy=new Hy;function Wy({S:e,segment:t,origin:r,resolution:n}){let{quintant:s,orientation:o}=My(t,r);if(n===Mr-1)return wu(s);if(n===Mr-2)return Gy();let i=n-Mr+1,a=Ry(e,i,o);return Dy(i,s,a)}function Lu(e,{closedRing:t=!0,segments:r="auto"}={closedRing:!0,segments:"auto"}){let{S:n,segment:s,origin:o,resolution:i}=jy(e);r==="auto"&&(r=Math.max(1,Math.pow(2,6-i)));let u=Wy({S:n,segment:s,origin:o,resolution:i}).splitEdges(r).getVertices().map(d=>Xy.inverse(d,o.id)).map(d=>_u(d)),h=Ay(u);return t&&h.push(h[0]),h.reverse(),h}function vu(e){return BigInt(`0x${e}`)}var Gf=63710072e-1,pL=4*Math.PI*Gf*Gf;Tt.setMatrixArrayType(Float64Array);var yn=D(Ds(),1);var Yy=1/Math.PI*180,Ky=1/180*Math.PI,Qy={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Qy}};var Q=globalThis.mathgl.config;function Wi(e,{precision:t=Q.precision}={}){return e=Zy(e),`${parseFloat(e.toPrecision(t))}`}function wt(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Yi(e){return Fu(e)}function Ki(e){return Lt(e)}function Fu(e,t){return Qi(e,r=>r*Ky,t)}function Lt(e,t){return Qi(e,r=>r*Yy,t)}function Gs(e,t,r){return Qi(e,n=>Math.max(t,Math.min(r,n)))}function Te(e,t,r){return wt(e)?e.map((n,s)=>Te(n,t[s],r)):r*t+(1-r)*e}function Et(e,t,r){let n=Q.EPSILON;r&&(Q.EPSILON=r);try{if(e===t)return!0;if(wt(e)&&wt(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Et(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)<=Q.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{Q.EPSILON=n}}function Zy(e){return Math.round(e/Q.EPSILON)*Q.EPSILON}function $y(e){return e.clone?e.clone():new Array(e.length)}function Qi(e,t,r){if(wt(e)){let n=e;r=r||$y(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 Ee=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:wt(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Q)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+Wi(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(!Et(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(Q.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 tT(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 V(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function _e(e,t,r=""){if(Q.debug&&!tT(e,t))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return e}function ft(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var Me=class extends Ee{get x(){return this[0]}set x(t){this[0]=V(t)}get y(){return this[1]}set y(t){this[1]=V(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 V(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return V(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 ft(t>=0&&t<this.ELEMENTS,"index is out of range"),V(this[t])}setComponent(t,r){return ft(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 tt=typeof Float32Array<"u"?Float32Array:Array,hn=Math.random;function br(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var PL=Math.PI/180;function eT(){let e=new tt(2);return tt!=Float32Array&&(e[0]=0,e[1]=0),e}function Pu(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 Ou(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 Us(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 Vs(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 OL=function(){let e=eT();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 Hs(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 zs(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 Nu(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 Du(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 qs(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 ze=class extends Me{constructor(t=0,r=0){super(2),wt(t)&&arguments.length===1?this.copy(t):(Q.debug&&(V(t),V(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 Q.debug&&(V(t.x),V(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 Vs(this,this,t),this.check()}transformAsVector(t){return Hs(this,this,t),this.check()}transformByMatrix3(t){return Us(this,this,t),this.check()}transformByMatrix2x3(t){return Ou(this,this,t),this.check()}transformByMatrix2(t){return Pu(this,this,t),this.check()}};var Je={};pt(Je,{add:()=>oT,angle:()=>ra,bezier:()=>xT,ceil:()=>iT,clone:()=>rT,copy:()=>nT,create:()=>ks,cross:()=>qe,dist:()=>ST,distance:()=>zu,div:()=>CT,divide:()=>Hu,dot:()=>dn,equals:()=>MT,exactEquals:()=>_T,floor:()=>aT,forEach:()=>LT,fromValues:()=>Js,hermite:()=>AT,inverse:()=>pT,len:()=>na,length:()=>Gu,lerp:()=>mT,max:()=>lT,min:()=>cT,mul:()=>BT,multiply:()=>Vu,negate:()=>dT,normalize:()=>Zi,random:()=>yT,rotateX:()=>$i,rotateY:()=>ta,rotateZ:()=>ea,round:()=>fT,scale:()=>uT,scaleAndAdd:()=>hT,set:()=>sT,slerp:()=>gT,sqrDist:()=>IT,sqrLen:()=>wT,squaredDistance:()=>qu,squaredLength:()=>ku,str:()=>ET,sub:()=>bT,subtract:()=>Uu,transformMat3:()=>pn,transformMat4:()=>ke,transformQuat:()=>mn,zero:()=>TT});function ks(){let e=new tt(3);return tt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function rT(e){let t=new tt(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Gu(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function Js(e,t,r){let n=new tt(3);return n[0]=e,n[1]=t,n[2]=r,n}function nT(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function sT(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function oT(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function Uu(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function Vu(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function Hu(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function iT(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function aT(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function cT(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 lT(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 fT(e,t){return e[0]=br(t[0]),e[1]=br(t[1]),e[2]=br(t[2]),e}function uT(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function hT(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 zu(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 qu(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 dT(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function pT(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Zi(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 dn(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function qe(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 mT(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 gT(e,t,r,n){let s=Math.acos(Math.min(Math.max(dn(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 AT(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),f=i*(3-2*o);return e[0]=t[0]*a+r[0]*c+n[0]*l+s[0]*f,e[1]=t[1]*a+r[1]*c+n[1]*l+s[1]*f,e[2]=t[2]*a+r[2]*c+n[2]*l+s[2]*f,e}function xT(e,t,r,n,s,o){let i=1-o,a=i*i,c=o*o,l=a*i,f=3*o*a,u=3*c*i,h=c*o;return e[0]=t[0]*l+r[0]*f+n[0]*u+s[0]*h,e[1]=t[1]*l+r[1]*f+n[1]*u+s[1]*h,e[2]=t[2]*l+r[2]*f+n[2]*u+s[2]*h,e}function yT(e,t){t=t===void 0?1:t;let r=hn()*2*Math.PI,n=hn()*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 ke(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 pn(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 mn(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],f=s*l-o*c,u=o*a-n*l,h=n*c-s*a,d=s*h-o*u,p=o*f-n*h,A=n*u-s*f,m=i*2;return f*=m,u*=m,h*=m,d*=2,p*=2,A*=2,e[0]=a+f+d,e[1]=c+u+p,e[2]=l+h+A,e}function $i(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 ta(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 ea(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 ra(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&&dn(e,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}function TT(e){return e[0]=0,e[1]=0,e[2]=0,e}function ET(e){return`vec3(${e[0]}, ${e[1]}, ${e[2]})`}function _T(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function MT(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 bT=Uu,BT=Vu,CT=Hu,ST=zu,IT=qu,na=Gu,wT=ku,LT=function(){let e=ks();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 sa=[0,0,0],js,x=class extends Me{static get ZERO(){return js||(js=new x(0,0,0),Object.freeze(js)),js}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&wt(t)?this.copy(t):(Q.debug&&(V(t),V(r),V(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 Q.debug&&(V(t.x),V(t.y),V(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]=V(t)}angle(t){return ra(this,t)}cross(t){return qe(this,this,t),this.check()}rotateX({radians:t,origin:r=sa}){return $i(this,this,r,t),this.check()}rotateY({radians:t,origin:r=sa}){return ta(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=sa}){return ea(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return ke(this,this,t),this.check()}transformAsVector(t){return zs(this,this,t),this.check()}transformByMatrix3(t){return pn(this,this,t),this.check()}transformByMatrix2(t){return Nu(this,this,t),this.check()}transformByQuaternion(t){return mn(this,this,t),this.check()}};var Xs,Cr=class extends Me{static get ZERO(){return Xs||(Xs=new Cr(0,0,0,0),Object.freeze(Xs)),Xs}constructor(t=0,r=0,n=0,s=0){super(-0,-0,-0,-0),wt(t)&&arguments.length===1?this.copy(t):(Q.debug&&(V(t),V(r),V(n),V(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 Q.debug&&(V(t.x),V(t.y),V(t.z),V(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]=V(t)}get w(){return this[3]}set w(t){this[3]=V(t)}transform(t){return ke(this,this,t),this.check()}transformByMatrix3(t){return qs(this,this,t),this.check()}transformByMatrix2(t){return Du(this,this,t),this.check()}transformByQuaternion(t){return mn(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Sr=class extends Ee{toString(){let t="[";if(Q.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]=V(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 Ju(){let e=new tt(9);return tt!=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 ju(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 Xu(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],f=t[8],u=f*i-a*l,h=-f*o+a*c,d=l*o-i*c,p=r*u+n*h+s*d;return p?(p=1/p,e[0]=u*p,e[1]=(-f*n+s*l)*p,e[2]=(a*n-s*i)*p,e[3]=h*p,e[4]=(f*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 Wu(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 oa(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],f=t[7],u=t[8],h=r[0],d=r[1],p=r[2],A=r[3],m=r[4],y=r[5],_=r[6],E=r[7],M=r[8];return e[0]=h*n+d*i+p*l,e[1]=h*s+d*a+p*f,e[2]=h*o+d*c+p*u,e[3]=A*n+m*i+y*l,e[4]=A*s+m*a+y*f,e[5]=A*o+m*c+y*u,e[6]=_*n+E*i+M*l,e[7]=_*s+E*a+M*f,e[8]=_*o+E*c+M*u,e}function Yu(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],f=t[7],u=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+f,e[8]=h*o+d*c+u,e}function Ku(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],f=t[7],u=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]=f,e[8]=u,e}function ia(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 Qu(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,f=n*i,u=n*a,h=s*i,d=s*a,p=s*c,A=o*i,m=o*a,y=o*c;return e[0]=1-u-p,e[3]=f-y,e[6]=h+m,e[1]=f+y,e[4]=1-l-p,e[7]=d-A,e[2]=h-m,e[5]=d+A,e[8]=1-l-u,e}var aa;(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"})(aa||(aa={}));var RT=Object.freeze([1,0,0,0,1,0,0,0,1]),J=class extends Sr{static get IDENTITY(){return PT()}static get ZERO(){return FT()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return aa}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(RT)}fromObject(t){return this.check()}fromQuaternion(t){return Qu(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 Wu(this)}transpose(){return ju(this,this),this.check()}invert(){return Xu(this,this),this.check()}multiplyLeft(t){return oa(this,t,this),this.check()}multiplyRight(t){return oa(this,this,t),this.check()}rotate(t){return Ku(this,this,t),this.check()}scale(t){return Array.isArray(t)?ia(this,this,t):ia(this,this,[t,t]),this.check()}translate(t){return Yu(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=Us(r||[-0,-0],t,this);break;case 3:n=pn(r||[-0,-0,-0],t,this);break;case 4:n=qs(r||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return _e(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)}},Ws,Ys=null;function FT(){return Ws||(Ws=new J([0,0,0,0,0,0,0,0,0]),Object.freeze(Ws)),Ws}function PT(){return Ys||(Ys=new J,Object.freeze(Ys)),Ys}var An={};pt(An,{add:()=>oE,adjoint:()=>VT,clone:()=>NT,copy:()=>DT,create:()=>OT,decompose:()=>KT,determinant:()=>fa,equals:()=>lE,exactEquals:()=>cE,frob:()=>sE,fromQuat:()=>Aa,fromQuat2:()=>XT,fromRotation:()=>qT,fromRotationTranslation:()=>$u,fromRotationTranslationScale:()=>QT,fromRotationTranslationScaleOrigin:()=>ZT,fromScaling:()=>zT,fromTranslation:()=>HT,fromValues:()=>GT,fromXRotation:()=>kT,fromYRotation:()=>JT,fromZRotation:()=>jT,frustum:()=>xa,getRotation:()=>YT,getScaling:()=>th,getTranslation:()=>WT,identity:()=>Zu,invert:()=>la,lookAt:()=>Ea,mul:()=>fE,multiply:()=>gn,multiplyScalar:()=>iE,multiplyScalarAndAdd:()=>aE,ortho:()=>Ta,orthoNO:()=>rh,orthoZO:()=>eE,perspective:()=>ya,perspectiveFromFieldOfView:()=>tE,perspectiveNO:()=>eh,perspectiveZO:()=>$T,rotate:()=>da,rotateX:()=>pa,rotateY:()=>ma,rotateZ:()=>ga,scale:()=>ha,set:()=>UT,str:()=>nE,sub:()=>uE,subtract:()=>nh,targetTo:()=>rE,translate:()=>ua,transpose:()=>ca});function OT(){let e=new tt(16);return tt!=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 NT(e){let t=new tt(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 DT(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 GT(e,t,r,n,s,o,i,a,c,l,f,u,h,d,p,A){let m=new tt(16);return m[0]=e,m[1]=t,m[2]=r,m[3]=n,m[4]=s,m[5]=o,m[6]=i,m[7]=a,m[8]=c,m[9]=l,m[10]=f,m[11]=u,m[12]=h,m[13]=d,m[14]=p,m[15]=A,m}function UT(e,t,r,n,s,o,i,a,c,l,f,u,h,d,p,A,m){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]=f,e[10]=u,e[11]=h,e[12]=d,e[13]=p,e[14]=A,e[15]=m,e}function Zu(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 ca(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 la(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],f=t[8],u=t[9],h=t[10],d=t[11],p=t[12],A=t[13],m=t[14],y=t[15],_=r*a-n*i,E=r*c-s*i,M=r*l-o*i,B=n*c-s*a,C=n*l-o*a,L=s*l-o*c,b=f*A-u*p,T=f*m-h*p,g=f*y-d*p,S=u*m-h*A,R=u*y-d*A,F=h*y-d*m,v=_*F-E*R+M*S+B*g-C*T+L*b;return v?(v=1/v,e[0]=(a*F-c*R+l*S)*v,e[1]=(s*R-n*F-o*S)*v,e[2]=(A*L-m*C+y*B)*v,e[3]=(h*C-u*L-d*B)*v,e[4]=(c*g-i*F-l*T)*v,e[5]=(r*F-s*g+o*T)*v,e[6]=(m*M-p*L-y*E)*v,e[7]=(f*L-h*M+d*E)*v,e[8]=(i*R-a*g+l*b)*v,e[9]=(n*g-r*R-o*b)*v,e[10]=(p*C-A*M+y*_)*v,e[11]=(u*M-f*C-d*_)*v,e[12]=(a*T-i*S-c*b)*v,e[13]=(r*S-n*T+s*b)*v,e[14]=(A*E-p*B-m*_)*v,e[15]=(f*B-u*E+h*_)*v,e):null}function VT(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],f=t[8],u=t[9],h=t[10],d=t[11],p=t[12],A=t[13],m=t[14],y=t[15],_=r*a-n*i,E=r*c-s*i,M=r*l-o*i,B=n*c-s*a,C=n*l-o*a,L=s*l-o*c,b=f*A-u*p,T=f*m-h*p,g=f*y-d*p,S=u*m-h*A,R=u*y-d*A,F=h*y-d*m;return e[0]=a*F-c*R+l*S,e[1]=s*R-n*F-o*S,e[2]=A*L-m*C+y*B,e[3]=h*C-u*L-d*B,e[4]=c*g-i*F-l*T,e[5]=r*F-s*g+o*T,e[6]=m*M-p*L-y*E,e[7]=f*L-h*M+d*E,e[8]=i*R-a*g+l*b,e[9]=n*g-r*R-o*b,e[10]=p*C-A*M+y*_,e[11]=u*M-f*C-d*_,e[12]=a*T-i*S-c*b,e[13]=r*S-n*T+s*b,e[14]=A*E-p*B-m*_,e[15]=f*B-u*E+h*_,e}function fa(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],f=e[9],u=e[10],h=e[11],d=e[12],p=e[13],A=e[14],m=e[15],y=t*i-r*o,_=t*a-n*o,E=r*a-n*i,M=l*p-f*d,B=l*A-u*d,C=f*A-u*p,L=t*C-r*B+n*M,b=o*C-i*B+a*M,T=l*E-f*_+u*y,g=d*E-p*_+A*y;return c*L-s*b+m*T-h*g}function gn(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],f=t[7],u=t[8],h=t[9],d=t[10],p=t[11],A=t[12],m=t[13],y=t[14],_=t[15],E=r[0],M=r[1],B=r[2],C=r[3];return e[0]=E*n+M*a+B*u+C*A,e[1]=E*s+M*c+B*h+C*m,e[2]=E*o+M*l+B*d+C*y,e[3]=E*i+M*f+B*p+C*_,E=r[4],M=r[5],B=r[6],C=r[7],e[4]=E*n+M*a+B*u+C*A,e[5]=E*s+M*c+B*h+C*m,e[6]=E*o+M*l+B*d+C*y,e[7]=E*i+M*f+B*p+C*_,E=r[8],M=r[9],B=r[10],C=r[11],e[8]=E*n+M*a+B*u+C*A,e[9]=E*s+M*c+B*h+C*m,e[10]=E*o+M*l+B*d+C*y,e[11]=E*i+M*f+B*p+C*_,E=r[12],M=r[13],B=r[14],C=r[15],e[12]=E*n+M*a+B*u+C*A,e[13]=E*s+M*c+B*h+C*m,e[14]=E*o+M*l+B*d+C*y,e[15]=E*i+M*f+B*p+C*_,e}function ua(e,t,r){let n=r[0],s=r[1],o=r[2],i,a,c,l,f,u,h,d,p,A,m,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],f=t[4],u=t[5],h=t[6],d=t[7],p=t[8],A=t[9],m=t[10],y=t[11],e[0]=i,e[1]=a,e[2]=c,e[3]=l,e[4]=f,e[5]=u,e[6]=h,e[7]=d,e[8]=p,e[9]=A,e[10]=m,e[11]=y,e[12]=i*n+f*s+p*o+t[12],e[13]=a*n+u*s+A*o+t[13],e[14]=c*n+h*s+m*o+t[14],e[15]=l*n+d*s+y*o+t[15]),e}function ha(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 da(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,f,u,h,d,p,A,m,y,_,E,M,B,C,L,b,T,g,S,R,F,v,G;return a<1e-6?null:(a=1/a,s*=a,o*=a,i*=a,l=Math.sin(r),c=Math.cos(r),f=1-c,u=t[0],h=t[1],d=t[2],p=t[3],A=t[4],m=t[5],y=t[6],_=t[7],E=t[8],M=t[9],B=t[10],C=t[11],L=s*s*f+c,b=o*s*f+i*l,T=i*s*f-o*l,g=s*o*f-i*l,S=o*o*f+c,R=i*o*f+s*l,F=s*i*f+o*l,v=o*i*f-s*l,G=i*i*f+c,e[0]=u*L+A*b+E*T,e[1]=h*L+m*b+M*T,e[2]=d*L+y*b+B*T,e[3]=p*L+_*b+C*T,e[4]=u*g+A*S+E*R,e[5]=h*g+m*S+M*R,e[6]=d*g+y*S+B*R,e[7]=p*g+_*S+C*R,e[8]=u*F+A*v+E*G,e[9]=h*F+m*v+M*G,e[10]=d*F+y*v+B*G,e[11]=p*F+_*v+C*G,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function pa(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],f=t[9],u=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+f*n,e[6]=a*s+u*n,e[7]=c*s+h*n,e[8]=l*s-o*n,e[9]=f*s-i*n,e[10]=u*s-a*n,e[11]=h*s-c*n,e}function ma(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],f=t[9],u=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-f*n,e[2]=a*s-u*n,e[3]=c*s-h*n,e[8]=o*n+l*s,e[9]=i*n+f*s,e[10]=a*n+u*s,e[11]=c*n+h*s,e}function ga(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],f=t[5],u=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+f*n,e[2]=a*s+u*n,e[3]=c*s+h*n,e[4]=l*s-o*n,e[5]=f*s-i*n,e[6]=u*s-a*n,e[7]=h*s-c*n,e}function HT(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 zT(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 qT(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 kT(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 JT(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 jT(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 $u(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,f=n*a,u=n*c,h=n*l,d=s*c,p=s*l,A=o*l,m=i*a,y=i*c,_=i*l;return e[0]=1-(d+A),e[1]=u+_,e[2]=h-y,e[3]=0,e[4]=u-_,e[5]=1-(f+A),e[6]=p+m,e[7]=0,e[8]=h+y,e[9]=p-m,e[10]=1-(f+d),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function XT(e,t){let r=new tt(3),n=-t[0],s=-t[1],o=-t[2],i=t[3],a=t[4],c=t[5],l=t[6],f=t[7],u=n*n+s*s+o*o+i*i;return u>0?(r[0]=(a*i+f*n+c*o-l*s)*2/u,r[1]=(c*i+f*s+l*n-a*o)*2/u,r[2]=(l*i+f*o+a*s-c*n)*2/u):(r[0]=(a*i+f*n+c*o-l*s)*2,r[1]=(c*i+f*s+l*n-a*o)*2,r[2]=(l*i+f*o+a*s-c*n)*2),$u(e,t,r),e}function WT(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function th(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],f=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+f*f),e}function YT(e,t){let r=new tt(3);th(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,f=t[5]*s,u=t[6]*o,h=t[8]*n,d=t[9]*s,p=t[10]*o,A=i+f+p,m=0;return A>0?(m=Math.sqrt(A+1)*2,e[3]=.25*m,e[0]=(u-d)/m,e[1]=(h-c)/m,e[2]=(a-l)/m):i>f&&i>p?(m=Math.sqrt(1+i-f-p)*2,e[3]=(u-d)/m,e[0]=.25*m,e[1]=(a+l)/m,e[2]=(h+c)/m):f>p?(m=Math.sqrt(1+f-i-p)*2,e[3]=(h-c)/m,e[0]=(a+l)/m,e[1]=.25*m,e[2]=(u+d)/m):(m=Math.sqrt(1+p-i-f)*2,e[3]=(a-l)/m,e[0]=(h+c)/m,e[1]=(u+d)/m,e[2]=.25*m),e}function KT(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],f=n[8],u=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(f*f+u*u+h*h);let d=1/r[0],p=1/r[1],A=1/r[2],m=s*d,y=o*p,_=i*A,E=a*d,M=c*p,B=l*A,C=f*d,L=u*p,b=h*A,T=m+M+b,g=0;return T>0?(g=Math.sqrt(T+1)*2,e[3]=.25*g,e[0]=(B-L)/g,e[1]=(C-_)/g,e[2]=(y-E)/g):m>M&&m>b?(g=Math.sqrt(1+m-M-b)*2,e[3]=(B-L)/g,e[0]=.25*g,e[1]=(y+E)/g,e[2]=(C+_)/g):M>b?(g=Math.sqrt(1+M-m-b)*2,e[3]=(C-_)/g,e[0]=(y+E)/g,e[1]=.25*g,e[2]=(B+L)/g):(g=Math.sqrt(1+b-m-M)*2,e[3]=(y-E)/g,e[0]=(C+_)/g,e[1]=(B+L)/g,e[2]=.25*g),e}function QT(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=t[3],c=s+s,l=o+o,f=i+i,u=s*c,h=s*l,d=s*f,p=o*l,A=o*f,m=i*f,y=a*c,_=a*l,E=a*f,M=n[0],B=n[1],C=n[2];return e[0]=(1-(p+m))*M,e[1]=(h+E)*M,e[2]=(d-_)*M,e[3]=0,e[4]=(h-E)*B,e[5]=(1-(u+m))*B,e[6]=(A+y)*B,e[7]=0,e[8]=(d+_)*C,e[9]=(A-y)*C,e[10]=(1-(u+p))*C,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function ZT(e,t,r,n,s){let o=t[0],i=t[1],a=t[2],c=t[3],l=o+o,f=i+i,u=a+a,h=o*l,d=o*f,p=o*u,A=i*f,m=i*u,y=a*u,_=c*l,E=c*f,M=c*u,B=n[0],C=n[1],L=n[2],b=s[0],T=s[1],g=s[2],S=(1-(A+y))*B,R=(d+M)*B,F=(p-E)*B,v=(d-M)*C,G=(1-(h+y))*C,X=(m+_)*C,z=(p+E)*L,et=(m-_)*L,K=(1-(h+A))*L;return e[0]=S,e[1]=R,e[2]=F,e[3]=0,e[4]=v,e[5]=G,e[6]=X,e[7]=0,e[8]=z,e[9]=et,e[10]=K,e[11]=0,e[12]=r[0]+b-(S*b+v*T+z*g),e[13]=r[1]+T-(R*b+G*T+et*g),e[14]=r[2]+g-(F*b+X*T+K*g),e[15]=1,e}function Aa(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,f=n*i,u=n*a,h=s*i,d=s*a,p=s*c,A=o*i,m=o*a,y=o*c;return e[0]=1-u-p,e[1]=f+y,e[2]=h-m,e[3]=0,e[4]=f-y,e[5]=1-l-p,e[6]=d+A,e[7]=0,e[8]=h+m,e[9]=d-A,e[10]=1-l-u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function xa(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 eh(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 ya=eh;function $T(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 tE(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 rh(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 Ta=rh;function eE(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 Ea(e,t,r,n){let s,o,i,a,c,l,f,u,h,d,p=t[0],A=t[1],m=t[2],y=n[0],_=n[1],E=n[2],M=r[0],B=r[1],C=r[2];return Math.abs(p-M)<1e-6&&Math.abs(A-B)<1e-6&&Math.abs(m-C)<1e-6?Zu(e):(u=p-M,h=A-B,d=m-C,s=1/Math.sqrt(u*u+h*h+d*d),u*=s,h*=s,d*=s,o=_*d-E*h,i=E*u-y*d,a=y*h-_*u,s=Math.sqrt(o*o+i*i+a*a),s?(s=1/s,o*=s,i*=s,a*=s):(o=0,i=0,a=0),c=h*a-d*i,l=d*o-u*a,f=u*i-h*o,s=Math.sqrt(c*c+l*l+f*f),s?(s=1/s,c*=s,l*=s,f*=s):(c=0,l=0,f=0),e[0]=o,e[1]=c,e[2]=u,e[3]=0,e[4]=i,e[5]=l,e[6]=h,e[7]=0,e[8]=a,e[9]=f,e[10]=d,e[11]=0,e[12]=-(o*p+i*A+a*m),e[13]=-(c*p+l*A+f*m),e[14]=-(u*p+h*A+d*m),e[15]=1,e)}function rE(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=n[0],c=n[1],l=n[2],f=s-r[0],u=o-r[1],h=i-r[2],d=f*f+u*u+h*h;d>0&&(d=1/Math.sqrt(d),f*=d,u*=d,h*=d);let p=c*h-l*u,A=l*f-a*h,m=a*u-c*f;return d=p*p+A*A+m*m,d>0&&(d=1/Math.sqrt(d),p*=d,A*=d,m*=d),e[0]=p,e[1]=A,e[2]=m,e[3]=0,e[4]=u*m-h*A,e[5]=h*p-f*m,e[6]=f*A-u*p,e[7]=0,e[8]=f,e[9]=u,e[10]=h,e[11]=0,e[12]=s,e[13]=o,e[14]=i,e[15]=1,e}function nE(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 sE(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 oE(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 nh(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 iE(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 aE(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 cE(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 lE(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],f=e[8],u=e[9],h=e[10],d=e[11],p=e[12],A=e[13],m=e[14],y=e[15],_=t[0],E=t[1],M=t[2],B=t[3],C=t[4],L=t[5],b=t[6],T=t[7],g=t[8],S=t[9],R=t[10],F=t[11],v=t[12],G=t[13],X=t[14],z=t[15];return Math.abs(r-_)<=1e-6*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(s-M)<=1e-6*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(o-B)<=1e-6*Math.max(1,Math.abs(o),Math.abs(B))&&Math.abs(i-C)<=1e-6*Math.max(1,Math.abs(i),Math.abs(C))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))&&Math.abs(c-b)<=1e-6*Math.max(1,Math.abs(c),Math.abs(b))&&Math.abs(l-T)<=1e-6*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(f-g)<=1e-6*Math.max(1,Math.abs(f),Math.abs(g))&&Math.abs(u-S)<=1e-6*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(h-R)<=1e-6*Math.max(1,Math.abs(h),Math.abs(R))&&Math.abs(d-F)<=1e-6*Math.max(1,Math.abs(d),Math.abs(F))&&Math.abs(p-v)<=1e-6*Math.max(1,Math.abs(p),Math.abs(v))&&Math.abs(A-G)<=1e-6*Math.max(1,Math.abs(A),Math.abs(G))&&Math.abs(m-X)<=1e-6*Math.max(1,Math.abs(m),Math.abs(X))&&Math.abs(y-z)<=1e-6*Math.max(1,Math.abs(y),Math.abs(z))}var fE=gn,uE=nh;function hE(){let e=new tt(4);return tt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function sh(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 oh(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 ih(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 ah(e){let t=e[0],r=e[1],n=e[2],s=e[3];return t*t+r*r+n*n+s*s}function ch(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 lh(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function fh(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 uh(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 hh(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],f=l*n+a*o-c*s,u=l*s+c*n-i*o,h=l*o+i*s-a*n,d=-i*n-a*s-c*o;return e[0]=f*l+d*-i+u*-c-h*-a,e[1]=u*l+d*-a+h*-i-f*-c,e[2]=h*l+d*-c+f*-a-u*-i,e[3]=t[3],e}var pv=function(){let e=hE();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 ba;(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"})(ba||(ba={}));var pE=45*Math.PI/180,mE=1,_a=.1,Ma=500,gE=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),O=class extends Sr{static get IDENTITY(){return xE()}static get ZERO(){return AE()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return ba}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,f,u,h,d,p,A,m){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]=f,this[10]=u,this[11]=h,this[12]=d,this[13]=p,this[14]=A,this[15]=m,this.check()}setRowMajor(t,r,n,s,o,i,a,c,l,f,u,h,d,p,A,m){return this[0]=t,this[1]=o,this[2]=l,this[3]=d,this[4]=r,this[5]=i,this[6]=f,this[7]=p,this[8]=n,this[9]=a,this[10]=u,this[11]=A,this[12]=s,this[13]=c,this[14]=h,this[15]=m,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(gE)}fromObject(t){return this.check()}fromQuaternion(t){return Aa(this,t),this.check()}frustum(t){let{left:r,right:n,bottom:s,top:o,near:i=_a,far:a=Ma}=t;return a===1/0?yE(this,r,n,s,o,i):xa(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 Ea(this,r,n,s),this.check()}ortho(t){let{left:r,right:n,bottom:s,top:o,near:i=_a,far:a=Ma}=t;return Ta(this,r,n,s,o,i,a),this.check()}orthographic(t){let{fovy:r=pE,aspect:n=mE,focalDistance:s=1,near:o=_a,far:i=Ma}=t;dh(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 dh(r),ya(this,r,n,s,o),this.check()}determinant(){return fa(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 ca(this,this),this.check()}invert(){return la(this,this),this.check()}multiplyLeft(t){return gn(this,t,this),this.check()}multiplyRight(t){return gn(this,this,t),this.check()}rotateX(t){return pa(this,this,t),this.check()}rotateY(t){return ma(this,this,t),this.check()}rotateZ(t){return ga(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return da(this,this,t,r),this.check()}scale(t){return ha(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return ua(this,this,t),this.check()}transform(t,r){return t.length===4?(r=uh(r||[-0,-0,-0,-0],t,this),_e(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,s;switch(n){case 2:s=Vs(r||[-0,-0],t,this);break;case 3:s=ke(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return _e(s,t.length),s}transformAsVector(t,r){let n;switch(t.length){case 2:n=Hs(r||[-0,-0],t,this);break;case 3:n=zs(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return _e(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])}},Ks,Qs;function AE(){return Ks||(Ks=new O([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Ks)),Ks}function xE(){return Qs||(Qs=new O,Object.freeze(Qs)),Qs}function dh(e){if(e>Math.PI*2)throw Error("expected radians")}function yE(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),f=-1,u=-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]=f,e[11]=u,e[12]=0,e[13]=0,e[14]=h,e[15]=0,e}function ph(){let e=new tt(4);return tt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function mh(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Ba(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 Ca(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],f=r[3];return e[0]=n*f+i*a+s*l-o*c,e[1]=s*f+i*c+o*a-n*l,e[2]=o*f+i*l+n*c-s*a,e[3]=i*f-n*a-s*c-o*l,e}function gh(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 Ah(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 xh(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 yh(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 xn(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=t[3],c=r[0],l=r[1],f=r[2],u=r[3],h,d,p,A,m;return h=s*c+o*l+i*f+a*u,h<0&&(h=-h,c=-c,l=-l,f=-f,u=-u),1-h>1e-6?(d=Math.acos(h),m=Math.sin(d),p=Math.sin((1-n)*d)/m,A=Math.sin(n*d)/m):(p=1-n,A=n),e[0]=p*s+A*c,e[1]=p*o+A*l,e[2]=p*i+A*f,e[3]=p*a+A*u,e}function Th(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 Eh(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Sa(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 _h=sh;var Mh=oh,bh=lh,Bh=fh,Ch=ih;var Sh=ah;var Ih=ch;var wh=function(){let e=ks(),t=Js(1,0,0),r=Js(0,1,0);return function(n,s,o){let i=dn(s,o);return i<-.999999?(qe(e,t,s),na(e)<1e-6&&qe(e,r,s),Zi(e,e),Ba(n,e,Math.PI),n):i>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(qe(e,s,o),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+i,Ih(n,n))}}(),Iv=function(){let e=ph(),t=ph();return function(r,n,s,o,i,a){return xn(e,n,i,a),xn(t,s,o,a),xn(r,e,t,2*a*(1-a)),r}}(),wv=function(){let e=Ju();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],Ih(t,Sa(t,e))}}();var TE=[0,0,0,1],$t=class extends Ee{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 Sa(this,t),this.check()}fromAxisRotation(t,r){return Ba(this,t,r),this.check()}identity(){return mh(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]=V(t)}get y(){return this[1]}set y(t){this[1]=V(t)}get z(){return this[2]}set z(t){this[2]=V(t)}get w(){return this[3]}set w(t){this[3]=V(t)}len(){return Ch(this)}lengthSquared(){return Sh(this)}dot(t){return bh(this,t)}rotationTo(t,r){return wh(this,t,r),this.check()}add(t){return _h(this,this,t),this.check()}calculateW(){return yh(this,this),this.check()}conjugate(){return Eh(this,this),this.check()}invert(){return Th(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(Bh(this,t,r,n),this.check())}multiplyRight(t){return Ca(this,this,t),this.check()}multiplyLeft(t){return Ca(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 gh(this,this,t),this.check()}rotateY(t){return Ah(this,this,t),this.check()}rotateZ(t){return xh(this,this,t),this.check()}scale(t){return Mh(this,this,t),this.check()}slerp(t,r,n){let s,o,i;switch(arguments.length){case 1:({start:s=TE,target:o,ratio:i}=t);break;case 2:s=this,o=t,i=r;break;default:s=t,o=r,i=n}return xn(this,s,o,i),this.check()}transformVector4(t,r=new Cr){return hh(r,t,this),_e(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 Pt={};pt(Pt,{EPSILON1:()=>EE,EPSILON10:()=>LE,EPSILON11:()=>vE,EPSILON12:()=>RE,EPSILON13:()=>FE,EPSILON14:()=>PE,EPSILON15:()=>OE,EPSILON16:()=>NE,EPSILON17:()=>DE,EPSILON18:()=>GE,EPSILON19:()=>UE,EPSILON2:()=>_E,EPSILON20:()=>VE,EPSILON3:()=>ME,EPSILON4:()=>bE,EPSILON5:()=>BE,EPSILON6:()=>CE,EPSILON7:()=>SE,EPSILON8:()=>IE,EPSILON9:()=>wE,PI_OVER_FOUR:()=>zE,PI_OVER_SIX:()=>qE,PI_OVER_TWO:()=>HE,TWO_PI:()=>kE});var EE=.1,_E=.01,ME=.001,bE=1e-4,BE=1e-5,CE=1e-6,SE=1e-7,IE=1e-8,wE=1e-9,LE=1e-10,vE=1e-11,RE=1e-12,FE=1e-13,PE=1e-14,OE=1e-15,NE=1e-16,DE=1e-17,GE=1e-18,UE=1e-19,VE=1e-20,HE=Math.PI/2,zE=Math.PI/4,qE=Math.PI/6,kE=Math.PI*2;function Zs(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 JE(e,t,r){let[n,s]=(0,yn.cellToLatLng)(e),o=t.length;Zs(t,s);let i=t[0]===t[o-1]?o-1:o;for(let a=0;a<i;a++)t[a][0]=Te(s,t[a][0],r),t[a][1]=Te(n,t[a][1],r)}function Lh(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?JE(e,r,t):Zs(r),r}function $s(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 jE={getPentagon:{type:"accessor",value:e=>e.pentagon}},Tn=class extends Ft{indexToBounds(){let{data:t,getPentagon:r}=this.props;return{data:t,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(n,s)=>{let o=r(n,s),i=Lu(typeof o=="string"?vu(o):o,{closedRing:!0,segments:"auto"});return $s(i)}}}};Tn.layerName="A5Layer";Tn.defaultProps=jE;var vh=Tn;var tr=D(qt(),1),Kd=D(zt(),1);function XE(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function to(e){if(Array.isArray(e))return e.map(t=>to(t));if(e&&typeof e=="object"){let t={};for(let[r,n]of Object.entries(e))t[XE(r)]=to(n);return t}return e}var fd=D(ld(),1);function Da(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=rM(e,r);return t?.uncapitalizeKeys?to(n):n}function rM(e,t){return new fd.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var nM="4.3.3",Jt={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:nM,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:sM,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>Da(new TextDecoder().decode(e),{...Jt.options.xml,...t?.xml}),parseTextSync:(e,t)=>Da(e,{...Jt.options.xml,...t?.xml})};function sM(e){return e.startsWith("<?xml")}async function vt(e,t,r,n){return n._parse(e,t,r,n)}function H(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var te={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},oM=te.self||te.window||te.global||{},iM=te.window||te.self||te.global||{},aM=te.global||te.self||te.window||{},cM=te.document||{};var Mn=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var ud=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),lM=ud&&parseFloat(ud[1])||0;var ro=globalThis,fM=globalThis.document||{},no=globalThis.process||{},uM=globalThis.console,SR=globalThis.navigator||{};function hd(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 Xe(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||hd()}var Ga="4.1.1";function Ir(e,t){if(!e)throw new Error(t||"Assertion failed")}function Ua(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 Ir(Number.isFinite(t)&&t>=0),t}function dd(e){let{logLevel:t,message:r}=e;e.logLevel=Ua(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 Ir(s==="string"||s==="object"),Object.assign(e,{args:n},e.opts)}var We=()=>{},so=class{constructor({level:t=0}={}){this.userData={},this._onceCache=new Set,this._level=t}set level(t){this.setLevel(t)}get level(){return this.getLevel()}setLevel(t){return this._level=t,this}getLevel(){return this._level}warn(t,...r){return this._log("warn",0,t,r,{once:!0})}error(t,...r){return this._log("error",0,t,r)}log(t,r,...n){return this._log("log",t,r,n)}info(t,r,...n){return this._log("info",t,r,n)}once(t,r,...n){return this._log("once",t,r,n,{once:!0})}_log(t,r,n,s,o={}){let i=dd({logLevel:r,message:n,args:this._buildArgs(r,n,s),opts:o});return this._createLogFunction(t,i,o)}_buildArgs(t,r,n){return[t,r,...n]}_createLogFunction(t,r,n){if(!this._shouldLog(r.logLevel))return We;let s=this._getOnceTag(n.tag??r.tag??r.message);if((n.once||r.once)&&s!==void 0){if(this._onceCache.has(s))return We;this._onceCache.add(s)}return this._emit(t,r)}_shouldLog(t){return this.getLevel()>=Ua(t)}_getOnceTag(t){if(t!==void 0)try{return typeof t=="string"?t:String(t)}catch{return}}};function dM(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var oo=class{constructor(t,r,n="sessionStorage"){this.storage=dM(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 pd(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 md(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var io;(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"})(io||(io={}));var pM=10;function gd(e){return typeof e!="string"?e:(e=e.toUpperCase(),io[e]||io.WHITE)}function Ad(e,t,r){return!Xe&&typeof e=="string"&&(t&&(e=`\x1B[${gd(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${gd(r)+pM}m${e}\x1B[49m`)),e}function xd(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 wr(){let e;if(Xe()&&ro.performance)e=ro?.performance?.now?.();else if("hrtime"in no){let t=no?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Lr={debug:Xe()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Va={enabled:!0,level:0},le=class extends so{constructor({id:t}={id:""}){super({level:0}),this.VERSION=Ga,this._startTs=wr(),this._deltaTs=wr(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new oo(`__probe-${this.id}__`,{[this.id]:Va}),this.timeStamp(`${this.id} started`),xd(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((wr()-this._startTs).toPrecision(10))}getDelta(){return Number((wr()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._updateConfiguration({enabled:t}),this}setLevel(t){return this._updateConfiguration({level:t}),this}get(t){return this._getConfiguration()[t]}set(t,r){this._updateConfiguration({[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,...r){return this._log("warn",0,t,r,{method:Lr.warn,once:!0})}error(t,...r){return this._log("error",0,t,r,{method:Lr.error})}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,...n){return this._log("log",t,r,n,{method:Lr.log,time:!0,once:!0})}log(t,r,...n){return this._log("log",t,r,n,{method:Lr.debug})}info(t,r,...n){return this._log("info",t,r,n,{method:console.info})}once(t,r,...n){return this._log("once",t,r,n,{method:Lr.debug||Lr.info,once:!0})}table(t,r,n){return r?this._log("table",t,r,n&&[n]||[],{method:console.table||We,tag:gM(r)}):We}time(t,r){return this._log("time",t,r,[],{method:console.time?console.time:console.info})}timeEnd(t,r){return this._log("time",t,r,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(t,r){return this._log("time",t,r,[],{method:console.timeStamp||We})}group(t,r,n={collapsed:!1}){let s=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",t,r,[],{method:s})}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._log("groupEnd",t,"",[],{method:console.groupEnd||We})}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&super._shouldLog(t)}_emit(t,r){let n=r.method;Ir(n),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=wr();let s=mM(this.id,r.message,r);return n.bind(console,s,...r.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(Va),this._storage.config[this.id]}_updateConfiguration(t){let r=this._storage.config[this.id]||{...Va};this._storage.setConfiguration({[this.id]:{...r,...t}})}};le.VERSION=Ga;function mM(e,t,r){if(typeof t=="string"){let n=r.time?md(pd(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=Ad(t,r.color,r.background)}return t}function gM(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}globalThis.probe={};var Ha=new le({id:"@probe.gl/log"});var za="4.3.3",AM=za[0]>="0"&&za[0]<="9"?`v${za}`:"";function xM(){let e=new le({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=AM,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var qa=xM();function ka(e,t){return yd(e||{},t)}function yd(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]=yd(n[s]||{},t[s],r+1):n[s]=t[s];return n}function Ja(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function ja(e){return globalThis.loaders?.modules?.[e]||null}function yM(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.3"),globalThis._loadersgl_.version}var Td=yM();function Ed(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var ee={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},hF=ee.self||ee.window||ee.global||{},dF=ee.window||ee.self||ee.global||{},pF=ee.global||ee.self||ee.window||{},mF=ee.document||{};var vr=typeof process!="object"||String(process)!=="[object process]"||process.browser,ao=typeof importScripts=="function",gF=typeof window<"u"&&typeof window.orientation<"u",_d=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),AF=_d&&parseFloat(_d[1])||0;var Xa={};async function re(e,t=null,r={},n=null){return t&&(e=Md(e,t,r,n)),Xa[e]=Xa[e]||TM(e),await Xa[e]}function Md(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]:vr?r.CDN?(Ed(r.CDN.startsWith("http")),`${r.CDN}/${t}@${Td}/dist/libs/${n}`):ao?`../src/libs/${n}`:`modules/${t}/src/libs/${n}`:`modules/${t}/dist/libs/${n}`}async function TM(e){if(e.endsWith("wasm"))return await _M(e);if(!vr)try{let{requireFromFile:r}=globalThis.loaders||{};return await r?.(e)}catch(r){return console.error(r),null}if(ao)return importScripts(e);let t=await MM(e);return EM(t,e)}function EM(e,t){if(!vr){let{requireFromString:n}=globalThis.loaders||{};return n?.(e,t)}if(ao)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 _M(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return vr||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function MM(e){let{readFileAsText:t}=globalThis.loaders||{};return vr||!t||e.startsWith("http")?await(await fetch(e)).text():await t(e)}function Bd(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?bd(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?bd(e,0,t):""}function bd(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 Wa(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${Bd(e)}"`)}}function bn(...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 Ye(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 Be(e,t){return H(e>=0),H(t>0),e+(t-1)&~(t-1)}function Ya(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+Be(n.byteLength,4)}function Bn(){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 Ke=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=Bn(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Bn()-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 Ce=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 Ke?s=t:s=new Ke(r,n),this.stats[r]=s),s}};var bM="Queued Requests",BM="Active Requests",CM="Cancelled Requests",SM="Queued Requests Ever",IM="Active Requests Ever",wM={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},Se=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...wM,...t},this.stats=new Ce({id:this.props.id}),this.stats.get(bM),this.stats.get(BM),this.stats.get(CM),this.stats.get(SM),this.stats.get(IM)}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 Ie={};pt(Ie,{dirname:()=>vM,filename:()=>LM,join:()=>RM,resolve:()=>FM});function Cd(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function LM(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function vM(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function RM(...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 FM(...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=Cd()),i=s),i.length!==0&&(r=`${i}/${r}`,n=i.charCodeAt(0)===Cn)}return r=PM(r,!n),n?`/${r}`:r.length>0?r:"."}var Cn=47,Ka=46;function PM(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===Cn)break;o=Cn}if(o===Cn){if(!(n===a-1||s===1))if(n!==a-1&&s===2){if(r.length<2||!i||r.charCodeAt(r.length-1)!==Ka||r.charCodeAt(r.length-2)!==Ka){if(r.length>2){let c=r.length-1,l=c;for(;l>=0&&r.charCodeAt(l)!==Cn;--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===Ka&&s!==-1?++s:s=-1}return r}var co=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=OM(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 OM(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 Ot=class extends co{};on(Ot,"type","template"),on(Ot,"testURL",t=>!1);function Sd(e,t){let r=Jt.parseTextSync?.(e,t),n=r?.ServiceExceptionReport?.ServiceException||r?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof n=="string"?n:n.value||n.code||"Unknown error"}var NM="4.3.3",Sn={dataType:null,batchType:null,id:"wms-error",name:"WMS Error",module:"wms",version:NM,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:DM,options:{wms:{throwOnError:!1}},parse:async(e,t)=>Qa(new TextDecoder().decode(e),t),parseSync:(e,t)=>Qa(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Qa(e,t)};function DM(e){return e.startsWith("<?xml")}function Qa(e,t){let r={...Sn.options.wms,...t?.wms},n=Sd(e,r),s=r.minimalErrors?n:`WMS Service error: ${n}`;if(r.throwOnError)throw new Error(s);return s}function Qe(e){return Array.isArray(e)?e:e?[e]:[]}function In(e){let t=Qe(e);return t.length>0&&t.every(r=>typeof r=="string")?t:[]}function wn(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseFloat(e);default:return}}function lo(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseInt(e,10);default:return}}function Ze(e){switch(e){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function Za(e,t){let r=Jt.parseTextSync?.(e,t),n=r.WMT_MS_Capabilities||r.WMS_Capabilities||r,s=GM(n);if(t?.inheritedLayerProps)for(let o of s.layers)wd(o,null);return t?.includeRawJSON&&(s.json=n),t?.includeXMLText&&(s.xml=e),s}function GM(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:In(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:lo(e.Service?.LayerLimit),maxWidth:lo(e.Service?.maxWidth),maxHeight:lo(e.Service?.maxHeight),layers:[],requests:UM(e.Capability?.Request),exceptions:VM(e.Exception)},r=Qe(e.Capability?.Layer);for(let n of r)t.layers.push(Id(n));for(let[n,s]of Object.entries(t))s===void 0&&delete t[n];return t}function UM(e){let t={};for(let[r,n]of Object.entries(e||{})){let s=In(n?.Format);t[r]={mimeTypes:s}}return t}function VM(e){if(Qe(e?.Format).length>0)return{mimeTypes:In(e)}}function Id(e){let t={title:String(e?.Title||""),name:e?.Name&&String(e?.Name),abstract:e?.Name&&String(e?.Abstract),keywords:In(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&&HM(e?.EX_GeographicBoundingBox);n&&(t.geographicBoundingBox=n),n=e?.LatLonBoundingBox&&zM(e?.LatLonBoundingBox),n&&(t.geographicBoundingBox=n);let s=e?.BoundingBox&&qM(e?.BoundingBox);s&&s.length>0&&(t.boundingBoxes=s);let i=Qe(e?.Dimension).map(l=>JM(l));i.length&&(t.dimensions=i),e?.opaque&&(t.opaque=Ze(e?.opaque)),e?.cascaded&&(t.cascaded=Ze(e?.cascaded)),e?.queryable&&(t.queryable=Ze(e?.queryable));let a=Qe(e?.Layer),c=[];for(let l of a)c.push(Id(l));c.length>0&&(t.layers=c);for(let[l,f]of Object.entries(t))f===void 0&&delete t[l];return t}function HM(e){let{westBoundLongitude:t,northBoundLatitude:r,eastBoundLongitude:n,southBoundLatitude:s}=e;return[[t,s],[n,r]]}function zM(e){let{minx:t,miny:r,maxx:n,maxy:s}=e;return[[t,r],[n,s]]}function qM(e){return Qe(e).map(r=>kM(r))}function kM(e){let{CRS:t,SRS:r,minx:n,miny:s,maxx:o,maxy:i,resx:a,resy:c}=e,l={crs:t||r,boundingBox:[[wn(n),wn(s)],[wn(o),wn(i)]]};return a&&(l.xResolution=a),c&&(l.yResolution=c),l}function JM(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=Ze(e.multipleValues)),e.nearestValue&&(s.nearestValue=Ze(e.nearestValue)),e.current&&(s.current=Ze(e.current)),s}function wd(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||[])wd(r,e)}var jM="4.3.3",Rr={dataType:null,batchType:null,id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:jM,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:XM,options:{wms:{}},parse:async(e,t)=>Za(new TextDecoder().decode(e),t?.wms),parseTextSync:(e,t)=>Za(e,t?.wms)};function XM(e){return e.startsWith("<?xml")}function $a(e,t){let n=(Jt.parseTextSync?.(e,t)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(n)?n:[n]).map(o=>WM(o))}}function WM(e){return{attributes:e||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var Ld={...Rr,dataType:null,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(e,t)=>$a(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>$a(e,t)};function tc(e,t){return Jt.parseTextSync?.(e,t)}var vd={...Rr,dataType:null,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(e,t)=>tc(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>tc(e,t)};var Rd="4.3.3";var YM=globalThis.loaders?.parseImageNode,ec=typeof Image<"u",rc=typeof ImageBitmap<"u",KM=Boolean(YM),nc=Mn?!0:KM;function Fd(e){switch(e){case"auto":return rc||ec||nc;case"imagebitmap":return rc;case"image":return ec;case"data":return nc;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Pd(){if(rc)return"imagebitmap";if(ec)return"image";if(nc)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Od(e){let t=QM(e);if(!t)throw new Error("Not an image");return t}function Ln(e){switch(Od(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 QM(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 ZM=/^data:image\/svg\+xml/,$M=/\.svg((\?|#).*)?$/;function fo(e){return e&&(ZM.test(e)||$M.test(e))}function Nd(e,t){if(fo(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 sc(e,t)}function sc(e,t){if(fo(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function uo(e,t,r){let n=Nd(e,r),s=self.URL||self.webkitURL,o=typeof n!="string"&&s.createObjectURL(n);try{return await tb(o||n,t)}finally{o&&s.revokeObjectURL(o)}}async function tb(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 eb={},Dd=!0;async function Gd(e,t,r){let n;fo(r)?n=await uo(e,t,r):n=sc(e,r);let s=t&&t.imagebitmap;return await rb(n,s)}async function rb(e,t=null){if((nb(t)||!Dd)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),Dd=!1}return await createImageBitmap(e)}function nb(e){for(let t in e||eb)return!1;return!0}function Ud(e){return!ab(e,"ftyp",4)||!(e[8]&96)?null:sb(e)}function sb(e){switch(ob(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function ob(e,t,r){return String.fromCharCode(...e.slice(t,r))}function ib(e){return[...e].map(t=>t.charCodeAt(0))}function ab(e,t,r=0){let n=ib(t);for(let s=0;s<n.length;++s)if(n[s]!==e[s+r])return!1;return!0}var ne=!1,vn=!0;function $e(e){let t=Rn(e);return lb(t)||hb(t)||fb(t)||ub(t)||cb(t)}function cb(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=Ud(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function lb(e){let t=Rn(e);return t.byteLength>=24&&t.getUint32(0,ne)===2303741511?{mimeType:"image/png",width:t.getUint32(16,ne),height:t.getUint32(20,ne)}:null}function fb(e){let t=Rn(e);return t.byteLength>=10&&t.getUint32(0,ne)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,vn),height:t.getUint16(8,vn)}:null}function ub(e){let t=Rn(e);return t.byteLength>=14&&t.getUint16(0,ne)===16973&&t.getUint32(2,vn)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,vn),height:t.getUint32(22,vn)}:null}function hb(e){let t=Rn(e);if(!(t.byteLength>=3&&t.getUint16(0,ne)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:s}=db(),o=2;for(;o+9<t.byteLength;){let i=t.getUint16(o,ne);if(s.has(i))return{mimeType:"image/jpeg",height:t.getUint16(o+5,ne),width:t.getUint16(o+7,ne)};if(!n.has(i))return null;o+=2,o+=t.getUint16(o,ne)}return null}function db(){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 Rn(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 Vd(e,t){let{mimeType:r}=$e(e)||{},n=globalThis.loaders?.parseImageNode;return H(n),await n(e,r)}async function Hd(e,t,r){t=t||{};let s=(t.image||{}).type||"auto",{url:o}=r||{},i=pb(s),a;switch(i){case"imagebitmap":a=await Gd(e,t,o);break;case"image":a=await uo(e,t,o);break;case"data":a=await Vd(e,t);break;default:H(!1)}return s==="data"&&(a=Ln(a)),a}function pb(e){switch(e){case"auto":case"data":return Pd();default:return Fd(e),e}}var mb=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],gb=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Ab={image:{type:"auto",decode:!0}},Fr={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:Rd,mimeTypes:gb,extensions:mb,parse:Hd,tests:[e=>Boolean($e(new DataView(e)))],options:Ab};var oc={};function ic(e){if(oc[e]===void 0){let t=Mn?yb(e):xb(e);oc[e]=t}return oc[e]}function xb(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 yb(e){switch(e){case"image/avif":case"image/webp":return Tb(e);default:return!0}}function Tb(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var zd={name:"Web Map Service (OGC WMS)",id:"wms",module:"wms",version:"0.0.0",extensions:[],mimeTypes:[],options:{wms:{}},type:"wms",fromUrl:!0,fromBlob:!1,testURL:e=>e.toLowerCase().includes("wms"),createDataSource:(e,t)=>new ac(e,t)},ac=class extends Ot{url;data;substituteCRS84;flipCRS;wmsParameters;vendorParameters;capabilities=null;constructor(t,r){super(r),this.url=t,this.data=t,this.substituteCRS84=r.wms?.substituteCRS84??r.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,...r.wmsParameters,...r.wms?.wmsParameters},this.vendorParameters=r.wms?.vendorParameters||r.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 Rr.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 Fr.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 Ld.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 vd.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 Fr.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||Sn.mimeTypes.includes(n)){let s=ka(this.loadOptions,{wms:{throwOnError:!0}}),o=Sn.parseSync?.(r,s);throw new Error(o)}}_parseError(t){let r=Sn.parseSync?.(t,this.loadOptions);return new Error(r)}};var qd={name:"ArcGISImageServer",id:"arcgis-image-server",module:"wms",version:"0.0.0",extensions:[],mimeTypes:[],options:{"arcgis-image-server":{}},type:"arcgis-image-server",fromUrl:!0,fromBlob:!1,testURL:e=>e.toLowerCase().includes("ImageServer"),createDataSource:(e,t)=>new cc(e,t)},cc=class extends Ot{url;data;constructor(t,r){super(r),this.url=t,this.data=t}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.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.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")}};var Eb=[zd,qd];function lc(e,t=Eb){let{type:r="auto"}=e,n=r==="auto"?Mb(e.url,t):_b(r,t);if(!n)throw new Error("Not a valid image source type");return n.createDataSource(e.url,e)}function _b(e,t){for(let r of t)if(r.type===e)return r;return null}function Mb(e,t){for(let r of t)if(r.testURL&&r.testURL(e))return r;return null}function ho(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var jt=Math.PI,Xd=jt/4,kd=jt/180,Jd=180/jt,po=512;function fe(e){let[t,r]=e;ho(Number.isFinite(t)),ho(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let n=t*kd,s=r*kd,o=po*(n+jt)/(2*jt),i=po*(jt+Math.log(Math.tan(Xd+s*.5)))/(2*jt);return[o,i]}function ue(e){let[t,r]=e,n=t/po*(2*jt)-jt,s=2*(Math.atan(Math.exp(r/po*(2*jt)-jt))-Xd);return[n*Jd,s*Jd]}var jO=Math.PI/180;var Yd=6378137*Math.PI;function fc(e){let t=fe(e);return t[0]=(t[0]/256-1)*Yd,t[1]=(t[1]/256-1)*Yd,t}var Ub={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)}},Pr=class extends tr.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,tr._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 Kd.BitmapLayer({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:n.srs==="EPSG:4326"?tr.COORDINATE_SYSTEM.LNGLAT:tr.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 Ot)return t.data;if(typeof t.data=="string")return lc({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 f={width:i,height:a,boundingBox:[[o[0],o[1]],[o[2],o[3]]],layers:n,crs:l};if(l==="EPSG:3857"){let u=fc([o[0],o[1]]),h=fc([o[2],o[3]]);f.boundingBox=[u,h]}try{this.state.loadCounter++,this.props.onImageLoadStart(c);let u=await this.state.imageSource.getImage(f);this.state.lastRequestId<c&&(this.getCurrentLayer()?.props.onImageLoad(c),this.setState({image:u,bounds:o,lastRequestParameters:f,lastRequestId:c}))}catch(u){this.raiseError(u,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(c,u)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(t,r=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>t(),r)}};Pr.layerName="WMSLayer";Pr.defaultProps=Ub;var Qd=D(zt(),1),Vb={getHeight:{type:"accessor",value:0},greatCircle:!0},Fn=class extends Qd.ArcLayer{};Fn.layerName="GreatCircleLayer";Fn.defaultProps=Vb;var Zd=Fn;var mo=D(uc(),1),Hb=3,zb=30,qb=2*zb+1,tp=180/Math.PI;function rp(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function ep(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function np(e){return[ep(e[0]),ep(e[1])]}function sp(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 op([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*tp,n*tp]}function ip(e){let t=mo.default.fromString(e,!0,10).toString(2);for(;t.length<Hb+qb;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),s=t.substring(3,r),o=s.length/2,i=mo.default.fromString(n,!0,2).toString(10),a=mo.default.fromString(s,!0,2).toString(4);for(;a.length<o;)a="0"+a;return`${i}/${a}`}function kb(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 ap(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,f=0;c==="1"?f=1:c==="2"?(l=1,f=1):c==="3"&&(l=1);let u=Math.pow(2,i-1);kb(u,o,l,f),o[0]+=u*l,o[1]+=u*f}if(r%2===1){let a=o[0];o[0]=o[1],o[1]=a}return{face:r,ij:o,level:i}}var cp=D(uc(),1);function Jb(e){let t=e.padEnd(16,"0");return cp.default.fromString(t,16)}var jb=100;function Xb({face:e,ij:t,level:r}){let n=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(jb*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),f=n[c+1],u=(f[0]-l[0])/s,h=(f[1]-l[1])/s;for(let d=0;d<s;d++){l[0]+=u,l[1]+=h;let p=rp(t,r,l),A=np(p),m=sp(e,A),y=op(m);Math.abs(y[1])>89.999&&(y[0]=a);let _=y[0]-a;y[0]+=_>180?-360:_<-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 Wb(e){if(typeof e=="string"){if(e.indexOf("/")>0)return e;e=Jb(e)}return ip(e.toString())}function lp(e){let t=Wb(e),r=ap(t);return Xb(r)}var Yb={getS2Token:{type:"accessor",value:e=>e.token}},On=class extends Ft{indexToBounds(){let{data:t,getS2Token:r}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(n,s)=>lp(r(n,s))}}};On.layerName="S2Layer";On.defaultProps=Yb;var fp=On;var hc=512;function Kb(e,t){let r=0,n=0,s=1<<e.length,o=s/hc;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,hc-n/o],[(r+t)/o,hc-(n+t)/o]]}function up(e,t=1){let[r,n]=Kb(e,t),[s,o]=ue(r),[i,a]=ue(n);return[i,o,i,a,s,a,s,o,i,o]}var Qb={getQuadkey:{type:"accessor",value:e=>e.quadkey}},Nn=class extends Ft{indexToBounds(){let{data:t,extruded:r,getQuadkey:n}=this.props,s=r?.99:1;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(o,i)=>up(n(o,i),s),updateTriggers:{getPolygon:s}}}};Nn.layerName="QuadkeyLayer";Nn.defaultProps=Qb;var hp=Nn;var Mo=D(qt(),1),wp=D(zt(),1);var er=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,f=this._loaderId;this._abortController=new AbortController;let{signal:u}=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:u})}catch(A){p=A||!0}finally{h.done()}if(f===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 Un=D(qt(),1);var it={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var dp=new x,Zb=new x,we=class{constructor(t=[0,0,0],r=[0,0,0],n){n=n||dp.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 we(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=Zb.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?it.INSIDE:o+s<0?it.OUTSIDE:it.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=dp.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 Dn=new x,pp=new x,Nt=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=Dn.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 Nt(this.center,this.radius)}union(t){let r=this.center,n=this.radius,s=t.center,o=t.radius,i=Dn.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 pp.copy(i).scale((-n+c)/a).add(r),this.center.copy(pp),this.radius=c,this}expand(t){let n=Dn.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=An.getScaling(Dn,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=Dn.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?it.OUTSIDE:o<n?it.INTERSECTING:it.INSIDE}};var $b=new x,tB=new x,go=new x,Ao=new x,xo=new x,eB=new x,rB=new x,he={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Xt=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 J(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 $t().fromMatrix3(new J([...s,...o,...i]))}fromCenterHalfSizeQuaternion(t,r,n){let s=new $t(n),o=new J().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 Xt(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new Nt){let r=this.halfAxes,n=r.getColumn(0,go),s=r.getColumn(1,Ao),o=r.getColumn(2,xo),i=$b.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[he.COLUMN0ROW0]+i*s[he.COLUMN0ROW1]+a*s[he.COLUMN0ROW2])+Math.abs(o*s[he.COLUMN1ROW0]+i*s[he.COLUMN1ROW1]+a*s[he.COLUMN1ROW2])+Math.abs(o*s[he.COLUMN2ROW0]+i*s[he.COLUMN2ROW1]+a*s[he.COLUMN2ROW2]),l=n.dot(r)+t.distance;return l<=-c?it.OUTSIDE:l>=c?it.INSIDE:it.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=tB.from(t).subtract(this.center),n=this.halfAxes,s=n.getColumn(0,go),o=n.getColumn(1,Ao),i=n.getColumn(2,xo),a=s.magnitude(),c=o.magnitude(),l=i.magnitude();s.normalize(),o.normalize(),i.normalize();let f=0,u;return u=Math.abs(r.dot(s))-a,u>0&&(f+=u*u),u=Math.abs(r.dot(o))-c,u>0&&(f+=u*u),u=Math.abs(r.dot(i))-l,u>0&&(f+=u*u),f}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,go),l=a.getColumn(1,Ao),f=a.getColumn(2,xo),u=eB.copy(c).add(l).add(f).add(i),h=rB.copy(u).subtract(t),d=r.dot(h);return s=Math.min(d,s),o=Math.max(d,o),u.copy(i).add(c).add(l).subtract(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),u.copy(i).add(c).subtract(l).add(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),u.copy(i).add(c).subtract(l).subtract(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).add(l).add(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).add(l).subtract(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).subtract(l).add(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).subtract(l).subtract(f),h.copy(u).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,go);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,Ao);n.transformAsPoint(t);let s=this.halfAxes.getColumn(2,xo);return s.transformAsPoint(t),this.halfAxes=new J([...r,...n,...s]),this}getTransform(){throw new Error("not implemented")}};var mp=new x,gp=new x,ut=class{constructor(t=[0,0,1],r=0){this.normal=new x,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return ft(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=mp.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),ft(Et(this.normal.len(),1)),this.distance=s,this}clone(){return new ut(this.normal,this.distance)}equals(t){return Et(this.distance,t.distance)&&Et(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=gp.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=mp.from(t),s=this.getPointDistance(n),o=gp.copy(this.normal).scale(s);return n.subtract(o).to(r)}};var Ap=[new x([1,0,0]),new x([0,1,0]),new x([0,0,1])],xp=new x,nB=new x,ct=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*Ap.length;let r=t.center,n=t.radius,s=0;for(let o of Ap){let i=this.planes[s],a=this.planes[s+1];i||(i=this.planes[s]=new ut),a||(a=this.planes[s+1]=new ut);let c=xp.copy(o).scale(-n).add(r);i.fromPointNormal(c,o);let l=xp.copy(o).scale(n).add(r),f=nB.copy(o).negate();a.fromPointNormal(l,f),s+=2}return this}computeVisibility(t){let r=it.INSIDE;for(let n of this.planes)switch(t.intersectPlane(n)){case it.OUTSIDE:return it.OUTSIDE;case it.INTERSECTING:r=it.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(ft(Number.isFinite(r),"parentPlaneMask is required."),r===ct.MASK_OUTSIDE||r===ct.MASK_INSIDE)return r;let n=ct.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===it.OUTSIDE)return ct.MASK_OUTSIDE;c===it.INTERSECTING&&(n|=i)}return n}};ct.MASK_OUTSIDE=4294967295;ct.MASK_INSIDE=0;ct.MASK_INDETERMINATE=2147483647;var cD=new x,lD=new x,fD=new x,uD=new x,hD=new x;var xD=new x,yD=new x,TD=new x,ED=new x,_D=new x,MD=new x,bD=new x,BD=new x,CD=new x,SD=new x,ID=new x,wD=new x;var se=new J,oB=new J,iB=new J,yo=new J,yp=new J;function mc(e,t={}){let r=Pt.EPSILON20,n=10,s=0,o=0,i=oB,a=iB;i.identity(),a.copy(e);let c=r*aB(a);for(;o<n&&cB(a)>c;)lB(a,yo),yp.copy(yo).transpose(),a.multiplyRight(yo),a.multiplyLeft(yp),i.multiplyRight(yo),++s>2&&(++o,s=0);return t.unitary=i.toTarget(t.unitary),t.diagonal=a.toTarget(t.diagonal),t}function aB(e){let t=0;for(let r=0;r<9;++r){let n=e[r];t+=n*n}return Math.sqrt(t)}var dc=[1,0,0],pc=[2,2,1];function cB(e){let t=0;for(let r=0;r<3;++r){let n=e[se.getElementIndex(pc[r],dc[r])];t+=2*n*n}return Math.sqrt(t)}function lB(e,t){let r=Pt.EPSILON15,n=0,s=1;for(let l=0;l<3;++l){let f=Math.abs(e[se.getElementIndex(pc[l],dc[l])]);f>n&&(s=l,n=f)}let o=dc[s],i=pc[s],a=1,c=0;if(Math.abs(e[se.getElementIndex(i,o)])>r){let l=e[se.getElementIndex(i,i)],f=e[se.getElementIndex(o,o)],u=e[se.getElementIndex(i,o)],h=(l-f)/2/u,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 J.IDENTITY.to(t),t[se.getElementIndex(o,o)]=t[se.getElementIndex(i,i)]=a,t[se.getElementIndex(i,o)]=c,t[se.getElementIndex(o,i)]=-c,t}var Le=new x,fB=new x,uB=new x,hB=new x,dB=new x,pB=new J,mB={diagonal:new J,unitary:new J};function Gn(e,t=new Xt){if(!e||e.length===0)return t.halfAxes=new J([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,f=0;for(let T of e){let g=Le.copy(T).subtract(n);o+=g.x*g.x,i+=g.x*g.y,a+=g.x*g.z,c+=g.y*g.y,l+=g.y*g.z,f+=g.z*g.z}o*=s,i*=s,a*=s,c*=s,l*=s,f*=s;let u=pB;u[0]=o,u[1]=i,u[2]=a,u[3]=i,u[4]=c,u[5]=l,u[6]=a,u[7]=l,u[8]=f;let{unitary:h}=mc(u,mB),d=t.halfAxes.copy(h),p=d.getColumn(0,uB),A=d.getColumn(1,hB),m=d.getColumn(2,dB),y=-Number.MAX_VALUE,_=-Number.MAX_VALUE,E=-Number.MAX_VALUE,M=Number.MAX_VALUE,B=Number.MAX_VALUE,C=Number.MAX_VALUE;for(let T of e)Le.copy(T),y=Math.max(Le.dot(p),y),_=Math.max(Le.dot(A),_),E=Math.max(Le.dot(m),E),M=Math.min(Le.dot(p),M),B=Math.min(Le.dot(A),B),C=Math.min(Le.dot(m),C);p=p.multiplyByScalar(.5*(M+y)),A=A.multiplyByScalar(.5*(B+_)),m=m.multiplyByScalar(.5*(C+E)),t.center.copy(p).add(A).add(m);let L=fB.set(y-M,_-B,E-C).multiplyByScalar(.5),b=new J([L[0],0,0,0,L[1],0,0,0,L[2]]);return t.halfAxes.multiplyRight(b),t}var Or=512,Tp=3,Ep=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],_p=Ep.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),gB=_p.concat([[.25,.5],[.75,.5]]),ve=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 ve(t,r,n),new ve(t,r+1,n),new ve(t+1,r,n),new ve(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,f=this.getBoundingVolume(s,c,l);if(a&&!this.insideBounds(a)||n.computeVisibility(f)<0)return!1;if(!this.childVisible){let{z:h}=this;if(h<i&&h>=o){let d=f.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=Or/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?gB:this.z<2?_p:Ep,l=[];for(let f of c){let u=To(this.x+f[0],this.y+f[1],this.z);u[2]=t[0],l.push(n(u)),t[0]!==t[1]&&(u[2]=t[1],l.push(n(u)))}return Gn(l)}let s=Math.pow(2,this.z),o=Or/s,i=this.x*o+r*Or,a=Or-(this.y+1)*o;return new we([i,a,t[0]],[i+o,a+o,t[1]])}};function Mp(e,t,r,n){let s=e instanceof Un._GlobeViewport&&e.resolution?e.projectPosition:null,o=Object.values(e.getFrustumPlanes()).map(({normal:d,distance:p})=>new ut(d.clone().negate(),p)),i=new ct(o),a=e.distanceScales.unitsPerMeter[2],c=r&&r[0]*a||0,l=r&&r[1]*a||0,f=e instanceof Un.WebMercatorViewport&&e.pitch<=60?t:0;if(n){let[d,p,A,m]=n,y=fe([d,m]),_=fe([A,p]);n=[y[0],Or-y[1],_[0],Or-_[1]]}let u=new ve(0,0,0),h={viewport:e,project:s,cullingVolume:i,elevationBounds:[c,l],minZ:f,maxZ:t,bounds:n,offset:0};if(u.update(h),e instanceof Un.WebMercatorViewport&&e.subViewports&&e.subViewports.length>1){for(h.offset=-1;u.update(h)&&!(--h.offset<-Tp););for(h.offset=1;u.update(h)&&!(++h.offset>Tp););}return u.getSelected()}var de=512,AB=[-1/0,-1/0,1/0,1/0],Re={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 Eo(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 xB(e){return Math.abs(e.split("").reduce((t,r)=>(t<<5)-t+r.charCodeAt(0)|0,0))}function oe(e,t){if(!e||!e.length)return null;let{index:r,id:n}=t;if(Array.isArray(e)){let o=xB(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 yB(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 Bp({viewport:e,z:t,cullRect:r}){return(e.subViewports||[e]).map(s=>gc(s,t||0,r))}function gc(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},f=e.unproject([o,i],l),u=e.unproject([o+a,i],l),h=e.unproject([o,i+c],l),d=e.unproject([o+a,i+c],l);return[Math.min(f[0],u[0],h[0],d[0]),Math.min(f[1],u[1],h[1],d[1]),Math.max(f[0],u[0],h[0],d[0]),Math.max(f[1],u[1],h[1],d[1])]}let n=gc(e,t[0],r),s=gc(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 TB(e,t,r){return r?Eo(e,r).map(s=>s*t/de):e.map(n=>n*t/de)}function Ac(e,t){return Math.pow(2,e)*de/t}function To(e,t,r){let n=Ac(r,de),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 bp(e,t,r,n){let s=Ac(r,n);return[e/s*de,t/s*de]}function xc(e,t,r,n,s=de){if(e.isGeospatial){let[l,f]=To(t,r,n),[u,h]=To(t+1,r+1,n);return{west:l,north:f,east:u,south:h}}let[o,i]=bp(t,r,n,s),[a,c]=bp(t+1,r+1,n,s);return{left:o,top:i,right:a,bottom:c}}function EB(e,t,r,n,s){let o=yB(e,null,n),i=Ac(t,r),[a,c,l,f]=TB(o,i,s),u=[];for(let h=Math.floor(a);h<l;h++)for(let d=Math.floor(c);d<f;d++)u.push({x:h,y:d,z:t});return u}function yc({viewport:e,maxZoom:t,minZoom:r,zRange:n,extent:s,tileSize:o=de,modelMatrix:i,modelMatrixInverse:a,zoomOffset:c=0}){let l=e.isGeospatial?Math.round(e.zoom+Math.log2(de/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 f=s;return i&&a&&s&&!e.isGeospatial&&(f=Eo(s,i)),e.isGeospatial?Mp(e,l,n,s):EB(e,l,o,f||AB,a)}function Tc(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(e)}function Ec(e){return Number.isFinite(e.west)&&Number.isFinite(e.north)&&Number.isFinite(e.east)&&Number.isFinite(e.south)}function Cp(e){let t={},r;return n=>{for(let s in n)if(!_B(n[s],t[s])){r=e(n),t=n;break}return r}}function _B(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 Sp=1,_o=2,MB="never",bB="no-overlap",Vn="best-available",BB=5,CB={[Vn]:IB,[bB]:wB,[MB]:()=>{}},SB={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:()=>{}},rr=class{constructor(t){this._getCullBounds=Cp(Bp),this.opts={...SB,...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 Se({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 O,this._modelMatrixInverse=new O}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(t=>t.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(t=>t.needsReload)}setOptions(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom))}finalize(){for(let t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let t of this._cache.keys()){let r=this._cache.get(t);!this._selectedTiles||!this._selectedTiles.includes(r)?this._cache.delete(t):r.setNeedsReload()}}update(t,{zRange:r,modelMatrix:n}={zRange:null,modelMatrix:null}){let s=n?new O(n):new O,o=!s.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!Et(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,n){if(!t.isVisible)return!1;if(r&&this._viewport){let s=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:r}),{bbox:o}=t;for(let[i,a,c,l]of s){let f;if("west"in o)f=o.west<c&&o.east>i&&o.south<l&&o.north>a;else{if(n&&!O.IDENTITY.equals(n)){let[d,p,A,m]=Eo([o.left,o.top,o.right,o.bottom],n);o={left:d,top:p,right:A,bottom:m}}let u=Math.min(o.top,o.bottom),h=Math.max(o.top,o.bottom);f=o.left<c&&o.right>i&&u<l&&h>a}if(f)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 yc({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:xc(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||Vn,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:CB[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:BB*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 er(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 IB(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!Ip(t)&&_c(t);for(let t of e)t.isVisible=Boolean(t.state&_o)}function wB(e){for(let r of e)r.state=0;for(let r of e)r.isSelected&&Ip(r);let t=Array.from(e).sort((r,n)=>r.zoom-n.zoom);for(let r of t)if(r.isVisible=Boolean(r.state&_o),r.children&&(r.isVisible||r.state&Sp))for(let n of r.children)n.state=Sp;else r.isSelected&&_c(r)}function Ip(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=_o,!0;t=t.parent}return!1}function _c(e){for(let t of e.children)t.isLoaded||t.content?t.state|=_o:_c(t)}var LB={TilesetClass:rr,data:{type:"data",value:[]},dataComparator:Re.equal,renderSubLayers:{type:"function",value:e=>new wp.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:Vn,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},Hn=class extends Mo.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:f}=this.props;return{maxCacheSize:r,maxCacheByteSize:n,maxZoom:i,minZoom:a,tileSize:t,refinementStrategy:s,extent:o,maxRequests:c,debounceTime:l,zoomOffset:f,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)?oe(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,Mo._flatten)(n,Boolean).map(s=>s.clone({tile:t,...r}))}return t.layers})}filterSubLayer({layer:t,cullRect:r}){let{tile:n}=t.props,{modelMatrix:s}=this.props;return this.state.tileset.isTileVisible(n,r,s?new O(s):null)}};Hn.defaultProps=LB;Hn.layerName="TileLayer";var nr=Hn;var Rp=D(zt(),1);var Lp=`uniform tripsUniforms {
|
|
7
|
+
"use strict";var __exports__=(()=>{var i1=Object.create;var hn=Object.defineProperty;var a1=Object.getOwnPropertyDescriptor;var c1=Object.getOwnPropertyNames;var l1=Object.getPrototypeOf,f1=Object.prototype.hasOwnProperty;var u1=(t,e,r)=>e in t?hn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Ef=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var qe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),me=(t,e)=>{for(var r in e)hn(t,r,{get:e[r],enumerable:!0})},Ps=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of c1(e))!f1.call(t,s)&&s!==r&&hn(t,s,{get:()=>e[s],enumerable:!(n=a1(e,s))||n.enumerable});return t},bt=(t,e,r)=>(Ps(t,e,"default"),r&&Ps(r,e,"default")),D=(t,e,r)=>(r=t!=null?i1(l1(t)):{},Ps(e||!t||!t.__esModule?hn(r,"default",{value:t,enumerable:!0}):r,t)),h1=t=>Ps(hn({},"__esModule",{value:!0}),t);var zt=(t,e,r)=>(u1(t,typeof e!="symbol"?e+"":e,r),r);var je=qe((_3,Mf)=>{Mf.exports=globalThis.deck});var Je=qe((C3,Bf)=>{Bf.exports=globalThis.deck});var Zs=qe((j3,Hu)=>{Hu.exports=globalThis.h3||{}});var Kt=qe((IL,Hh)=>{Hh.exports=globalThis.loaders});var bc=qe((kd,Jn)=>{(function(t,e){typeof define=="function"&&define.amd?define([],e):typeof Ef=="function"&&typeof Jn=="object"&&Jn&&Jn.exports?Jn.exports=e():(t.dcodeIO=t.dcodeIO||{}).Long=e()})(kd,function(){"use strict";function t(T,g,S){this.low=T|0,this.high=g|0,this.unsigned=!!S}t.prototype.__isLong__,Object.defineProperty(t.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function e(T){return(T&&T.__isLong__)===!0}t.isLong=e;var r={},n={};function s(T,g){var S,F,R;return g?(T>>>=0,(R=0<=T&&T<256)&&(F=n[T],F)?F:(S=i(T,(T|0)<0?-1:0,!0),R&&(n[T]=S),S)):(T|=0,(R=-128<=T&&T<128)&&(F=r[T],F)?F:(S=i(T,T<0?-1:0,!1),R&&(r[T]=S),S))}t.fromInt=s;function o(T,g){if(isNaN(T)||!isFinite(T))return g?y:m;if(g){if(T<0)return y;if(T>=d)return C}else{if(T<=-p)return v;if(T+1>=p)return B}return T<0?o(-T,g).neg():i(T%h|0,T/h|0,g)}t.fromNumber=o;function i(T,g,S){return new t(T,g,S)}t.fromBits=i;var a=Math.pow;function c(T,g,S){if(T.length===0)throw Error("empty string");if(T==="NaN"||T==="Infinity"||T==="+Infinity"||T==="-Infinity")return m;if(typeof g=="number"?(S=g,g=!1):g=!!g,S=S||10,S<2||36<S)throw RangeError("radix");var F;if((F=T.indexOf("-"))>0)throw Error("interior hyphen");if(F===0)return c(T.substring(1),g,S).neg();for(var R=o(a(S,8)),L=m,G=0;G<T.length;G+=8){var W=Math.min(8,T.length-G),z=parseInt(T.substring(G,G+W),S);if(W<8){var te=o(a(S,W));L=L.mul(te).add(o(z))}else L=L.mul(R),L=L.add(o(z))}return L.unsigned=g,L}t.fromString=c;function l(T){return T instanceof t?T:typeof T=="number"?o(T):typeof T=="string"?c(T):i(T.low,T.high,T.unsigned)}t.fromValue=l;var f=1<<16,u=1<<24,h=f*f,d=h*h,p=d/2,A=s(u),m=s(0);t.ZERO=m;var y=s(0,!0);t.UZERO=y;var b=s(1);t.ONE=b;var E=s(1,!0);t.UONE=E;var M=s(-1);t.NEG_ONE=M;var B=i(-1,2147483647,!1);t.MAX_VALUE=B;var C=i(-1,-1,!0);t.MAX_UNSIGNED_VALUE=C;var v=i(0,-2147483648,!1);t.MIN_VALUE=v;var _=t.prototype;return _.toInt=function(){return this.unsigned?this.low>>>0:this.low},_.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},_.toString=function(g){if(g=g||10,g<2||36<g)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(v)){var S=o(g),F=this.div(S),R=F.mul(S).sub(this);return F.toString(g)+R.toInt().toString(g)}else return"-"+this.neg().toString(g);for(var L=o(a(g,6),this.unsigned),G=this,W="";;){var z=G.div(L),te=G.sub(z.mul(L)).toInt()>>>0,K=te.toString(g);if(G=z,G.isZero())return K+W;for(;K.length<6;)K="0"+K;W=""+K+W}},_.getHighBits=function(){return this.high},_.getHighBitsUnsigned=function(){return this.high>>>0},_.getLowBits=function(){return this.low},_.getLowBitsUnsigned=function(){return this.low>>>0},_.getNumBitsAbs=function(){if(this.isNegative())return this.eq(v)?64:this.neg().getNumBitsAbs();for(var g=this.high!=0?this.high:this.low,S=31;S>0&&!(g&1<<S);S--);return this.high!=0?S+33:S+1},_.isZero=function(){return this.high===0&&this.low===0},_.isNegative=function(){return!this.unsigned&&this.high<0},_.isPositive=function(){return this.unsigned||this.high>=0},_.isOdd=function(){return(this.low&1)===1},_.isEven=function(){return(this.low&1)===0},_.equals=function(g){return e(g)||(g=l(g)),this.unsigned!==g.unsigned&&this.high>>>31===1&&g.high>>>31===1?!1:this.high===g.high&&this.low===g.low},_.eq=_.equals,_.notEquals=function(g){return!this.eq(g)},_.neq=_.notEquals,_.lessThan=function(g){return this.comp(g)<0},_.lt=_.lessThan,_.lessThanOrEqual=function(g){return this.comp(g)<=0},_.lte=_.lessThanOrEqual,_.greaterThan=function(g){return this.comp(g)>0},_.gt=_.greaterThan,_.greaterThanOrEqual=function(g){return this.comp(g)>=0},_.gte=_.greaterThanOrEqual,_.compare=function(g){if(e(g)||(g=l(g)),this.eq(g))return 0;var S=this.isNegative(),F=g.isNegative();return S&&!F?-1:!S&&F?1:this.unsigned?g.high>>>0>this.high>>>0||g.high===this.high&&g.low>>>0>this.low>>>0?-1:1:this.sub(g).isNegative()?-1:1},_.comp=_.compare,_.negate=function(){return!this.unsigned&&this.eq(v)?v:this.not().add(b)},_.neg=_.negate,_.add=function(g){e(g)||(g=l(g));var S=this.high>>>16,F=this.high&65535,R=this.low>>>16,L=this.low&65535,G=g.high>>>16,W=g.high&65535,z=g.low>>>16,te=g.low&65535,K=0,Y=0,$=0,_e=0;return _e+=L+te,$+=_e>>>16,_e&=65535,$+=R+z,Y+=$>>>16,$&=65535,Y+=F+W,K+=Y>>>16,Y&=65535,K+=S+G,K&=65535,i($<<16|_e,K<<16|Y,this.unsigned)},_.subtract=function(g){return e(g)||(g=l(g)),this.add(g.neg())},_.sub=_.subtract,_.multiply=function(g){if(this.isZero()||(e(g)||(g=l(g)),g.isZero()))return m;if(this.eq(v))return g.isOdd()?v:m;if(g.eq(v))return this.isOdd()?v:m;if(this.isNegative())return g.isNegative()?this.neg().mul(g.neg()):this.neg().mul(g).neg();if(g.isNegative())return this.mul(g.neg()).neg();if(this.lt(A)&&g.lt(A))return o(this.toNumber()*g.toNumber(),this.unsigned);var S=this.high>>>16,F=this.high&65535,R=this.low>>>16,L=this.low&65535,G=g.high>>>16,W=g.high&65535,z=g.low>>>16,te=g.low&65535,K=0,Y=0,$=0,_e=0;return _e+=L*te,$+=_e>>>16,_e&=65535,$+=R*te,Y+=$>>>16,$&=65535,$+=L*z,Y+=$>>>16,$&=65535,Y+=F*te,K+=Y>>>16,Y&=65535,Y+=R*z,K+=Y>>>16,Y&=65535,Y+=L*W,K+=Y>>>16,Y&=65535,K+=S*te+F*z+R*W+L*G,K&=65535,i($<<16|_e,K<<16|Y,this.unsigned)},_.mul=_.multiply,_.divide=function(g){if(e(g)||(g=l(g)),g.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?y:m;var S,F,R;if(this.unsigned){if(g.unsigned||(g=g.toUnsigned()),g.gt(this))return y;if(g.gt(this.shru(1)))return E;R=y}else{if(this.eq(v)){if(g.eq(b)||g.eq(M))return v;if(g.eq(v))return b;var L=this.shr(1);return S=L.div(g).shl(1),S.eq(m)?g.isNegative()?b:M:(F=this.sub(g.mul(S)),R=S.add(F.div(g)),R)}else if(g.eq(v))return this.unsigned?y:m;if(this.isNegative())return g.isNegative()?this.neg().div(g.neg()):this.neg().div(g).neg();if(g.isNegative())return this.div(g.neg()).neg();R=m}for(F=this;F.gte(g);){S=Math.max(1,Math.floor(F.toNumber()/g.toNumber()));for(var G=Math.ceil(Math.log(S)/Math.LN2),W=G<=48?1:a(2,G-48),z=o(S),te=z.mul(g);te.isNegative()||te.gt(F);)S-=W,z=o(S,this.unsigned),te=z.mul(g);z.isZero()&&(z=b),R=R.add(z),F=F.sub(te)}return R},_.div=_.divide,_.modulo=function(g){return e(g)||(g=l(g)),this.sub(this.div(g).mul(g))},_.mod=_.modulo,_.not=function(){return i(~this.low,~this.high,this.unsigned)},_.and=function(g){return e(g)||(g=l(g)),i(this.low&g.low,this.high&g.high,this.unsigned)},_.or=function(g){return e(g)||(g=l(g)),i(this.low|g.low,this.high|g.high,this.unsigned)},_.xor=function(g){return e(g)||(g=l(g)),i(this.low^g.low,this.high^g.high,this.unsigned)},_.shiftLeft=function(g){return e(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?i(this.low<<g,this.high<<g|this.low>>>32-g,this.unsigned):i(0,this.low<<g-32,this.unsigned)},_.shl=_.shiftLeft,_.shiftRight=function(g){return e(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?i(this.low>>>g|this.high<<32-g,this.high>>g,this.unsigned):i(this.high>>g-32,this.high>=0?0:-1,this.unsigned)},_.shr=_.shiftRight,_.shiftRightUnsigned=function(g){if(e(g)&&(g=g.toInt()),g&=63,g===0)return this;var S=this.high;if(g<32){var F=this.low;return i(F>>>g|S<<32-g,S>>>g,this.unsigned)}else return g===32?i(S,0,this.unsigned):i(S>>>g-32,0,this.unsigned)},_.shru=_.shiftRightUnsigned,_.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},_.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},_.toBytes=function(T){return T?this.toBytesLE():this.toBytesBE()},_.toBytesLE=function(){var T=this.high,g=this.low;return[g&255,g>>>8&255,g>>>16&255,g>>>24&255,T&255,T>>>8&255,T>>>16&255,T>>>24&255]},_.toBytesBE=function(){var T=this.high,g=this.low;return[T>>>24&255,T>>>16&255,T>>>8&255,T&255,g>>>24&255,g>>>16&255,g>>>8&255,g&255]},t})});var Rc=qe((bG,Sp)=>{Sp.exports=globalThis.luma});var zo=qe((EG,Ip)=>{Ip.exports=globalThis.deck});var Uc=qe((eU,Vp)=>{Vp.exports=globalThis.luma});var E0=qe((Oz,b0)=>{b0.exports=globalThis.deck});var F0=qe(ff=>{ff.read=function(t,e,r,n,s){var o,i,a=s*8-n-1,c=(1<<a)-1,l=c>>1,f=-7,u=r?s-1:0,h=r?-1:1,d=t[e+u];for(u+=h,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=o*256+t[e+u],u+=h,f-=8);for(i=o&(1<<-f)-1,o>>=-f,f+=n;f>0;i=i*256+t[e+u],u+=h,f-=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)};ff.write=function(t,e,r,n,s,o){var i,a,c,l=o*8-s-1,f=(1<<l)-1,u=f>>1,h=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,A=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,i=f):(i=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-i))<1&&(i--,c*=2),i+u>=1?e+=h/c:e+=h*Math.pow(2,1-u),e*c>=2&&(i++,c/=2),i+u>=f?(a=0,i=f):i+u>=1?(a=(e*c-1)*Math.pow(2,s),i=i+u):(a=e*Math.pow(2,u-1)*Math.pow(2,s),i=0));s>=8;t[r+d]=a&255,d+=p,a/=256,s-=8);for(i=i<<s|a,l+=s;l>0;t[r+d]=i&255,d+=p,i/=256,l-=8);t[r+d-p]|=A*128}});var G0=qe((_5,D0)=>{"use strict";D0.exports=J;var Vi=F0();function J(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}J.Varint=0;J.Fixed64=1;J.Bytes=2;J.Fixed32=5;var uf=(1<<16)*(1<<16),R0=1/uf,Rw=12,N0=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");J.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),s=n>>3,o=this.pos;this.type=n&7,t(s,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Hi(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=O0(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Hi(this.buf,this.pos)+Hi(this.buf,this.pos+4)*uf;return this.pos+=8,t},readSFixed64:function(){var t=Hi(this.buf,this.pos)+O0(this.buf,this.pos+4)*uf;return this.pos+=8,t},readFloat:function(){var t=Vi.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Vi.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e=this.buf,r,n;return n=e[this.pos++],r=n&127,n<128||(n=e[this.pos++],r|=(n&127)<<7,n<128)||(n=e[this.pos++],r|=(n&127)<<14,n<128)||(n=e[this.pos++],r|=(n&127)<<21,n<128)?r:(n=e[this.pos],r|=(n&15)<<28,Pw(r,t,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=Rw&&N0?Xw(this.buf,e,t):Ww(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==J.Bytes)return t.push(this.readVarint(e));var r=Tt(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==J.Bytes)return t.push(this.readSVarint());var e=Tt(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==J.Bytes)return t.push(this.readBoolean());var e=Tt(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==J.Bytes)return t.push(this.readFloat());var e=Tt(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==J.Bytes)return t.push(this.readDouble());var e=Tt(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==J.Bytes)return t.push(this.readFixed32());var e=Tt(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==J.Bytes)return t.push(this.readSFixed32());var e=Tt(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==J.Bytes)return t.push(this.readFixed64());var e=Tt(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==J.Bytes)return t.push(this.readSFixed64());var e=Tt(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===J.Varint)for(;this.buf[this.pos++]>127;);else if(e===J.Bytes)this.pos=this.readVarint()+this.pos;else if(e===J.Fixed32)this.pos+=4;else if(e===J.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),un(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),un(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),un(this.buf,t&-1,this.pos),un(this.buf,Math.floor(t*R0),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),un(this.buf,t&-1,this.pos),un(this.buf,Math.floor(t*R0),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){Ow(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?-t*2-1:t*2)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(t.length*4),this.pos++;var e=this.pos;this.pos=Yw(this.buf,t,this.pos);var r=this.pos-e;r>=128&&P0(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Vi.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Vi.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&P0(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,J.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Gw,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Uw,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,zw,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Vw,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Hw,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,kw,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,qw,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,jw,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Jw,e)},writeBytesField:function(t,e){this.writeTag(t,J.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,J.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,J.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,J.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,J.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,J.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,J.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,J.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,J.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,J.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};function Pw(t,e,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 fn(t,s,e);throw new Error("Expected varint not more than 10 bytes")}function Tt(t){return t.type===J.Bytes?t.readVarint()+t.pos:t.pos+1}function fn(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Ow(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(r=~(-t%4294967296),n=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),Nw(r,n,e),Dw(n,e)}function Nw(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function Dw(t,e){var r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function P0(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(n);for(var s=r.pos-1;s>=t;s--)r.buf[s+n]=r.buf[s]}function Gw(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function Uw(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function Vw(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function Hw(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function zw(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function kw(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function qw(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function jw(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function Jw(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function Hi(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function un(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function O0(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Ww(t,e,r){for(var n="",s=e;s<r;){var o=t[s],i=null,a=o>239?4:o>223?3:o>191?2:1;if(s+a>r)break;var c,l,f;a===1?o<128&&(i=o):a===2?(c=t[s+1],(c&192)===128&&(i=(o&31)<<6|c&63,i<=127&&(i=null))):a===3?(c=t[s+1],l=t[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=t[s+1],l=t[s+2],f=t[s+3],(c&192)===128&&(l&192)===128&&(f&192)===128&&(i=(o&15)<<18|(c&63)<<12|(l&63)<<6|f&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 Xw(t,e,r){return N0.decode(t.subarray(e,r))}function Yw(t,e,r){for(var n=0,s,o;n<e.length;n++){if(s=e.charCodeAt(n),s>55295&&s<57344)if(o)if(s<56320){t[r++]=239,t[r++]=191,t[r++]=189,o=s;continue}else s=o-55296<<10|s-56320|65536,o=null;else{s>56319||n+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):o=s;continue}else o&&(t[r++]=239,t[r++]=191,t[r++]=189,o=null);s<128?t[r++]=s:(s<2048?t[r++]=s>>6|192:(s<65536?t[r++]=s>>12|224:(t[r++]=s>>18|240,t[r++]=s>>12&63|128),t[r++]=s>>6&63|128),t[r++]=s&63|128)}return r}});var Rs={};me(Rs,{A5Layer:()=>Vh,GeohashLayer:()=>o1,GreatCircleLayer:()=>zd,H3ClusterLayer:()=>Cp,H3HexagonLayer:()=>Ho,MVTLayer:()=>t1,QuadkeyLayer:()=>rp,S2Layer:()=>ep,TerrainLayer:()=>T0,Tile3DLayer:()=>h0,TileLayer:()=>lr,TripsLayer:()=>Mp,_GeoCellLayer:()=>Oe,_Tile2DHeader:()=>ar,_Tileset2D:()=>cr,_WMSLayer:()=>Hr,_getURLFromTemplate:()=>at});var et={},_f=D(je(),1);bt(et,D(je(),1));if(!_f.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");bt(Rs,et);var Cf=D(Je(),1),ji=D(je(),1),d1={...ji.PolygonLayer.defaultProps},dn=class extends Cf.CompositeLayer{indexToBounds(){return null}renderLayers(){let{elevationScale:e,extruded:r,wireframe:n,filled:s,stroked:o,lineWidthUnits:i,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:f,lineMiterLimit:u,lineDashJustified:h,getElevation:d,getFillColor:p,getLineColor:A,getLineWidth:m}=this.props,{updateTriggers:y,material:b,transitions:E}=this.props,M=this.getSubLayerClass("cell",ji.PolygonLayer),{updateTriggers:B,...C}=this.indexToBounds()||{};return new M({filled:s,wireframe:n,extruded:r,elevationScale:e,stroked:o,lineWidthUnits:i,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:f,lineMiterLimit:u,lineDashJustified:h,material:b,transitions:E,getElevation:d,getFillColor:p,getLineColor:A,getLineWidth:m},this.getSubLayerProps({id:"cell",updateTriggers:y&&{...B,getElevation:y.getElevation,getFillColor:y.getFillColor,getLineColor:y.getLineColor,getLineWidth:y.getLineWidth}}),C)}};dn.layerName="GeoCellLayer";dn.defaultProps=d1;var Oe=dn;var p1=Object.defineProperty,An=(t,e)=>{for(var r in e)p1(t,r,{get:e[r],enumerable:!0})},Te={};An(Te,{ARRAY_TYPE:()=>ne,EPSILON:()=>pe,RANDOM:()=>kt,equals:()=>x1,setMatrixArrayType:()=>m1,toRadian:()=>A1});var pe=1e-6,ne=typeof Float32Array<"u"?Float32Array:Array,kt=Math.random;function m1(t){ne=t}var g1=Math.PI/180;function A1(t){return t*g1}function x1(t,e){return Math.abs(t-e)<=pe*Math.max(1,Math.abs(t),Math.abs(e))}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var qt={};An(qt,{LDU:()=>O1,add:()=>N1,adjoint:()=>S1,clone:()=>T1,copy:()=>b1,create:()=>y1,determinant:()=>I1,equals:()=>G1,exactEquals:()=>D1,frob:()=>P1,fromRotation:()=>L1,fromScaling:()=>F1,fromValues:()=>M1,identity:()=>E1,invert:()=>C1,mul:()=>H1,multiply:()=>Xf,multiplyScalar:()=>U1,multiplyScalarAndAdd:()=>V1,rotate:()=>w1,scale:()=>v1,set:()=>_1,str:()=>R1,sub:()=>z1,subtract:()=>Yf,transpose:()=>B1});function y1(){var t=new ne(4);return ne!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function T1(t){var e=new ne(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function b1(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function E1(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t}function M1(t,e,r,n){var s=new ne(4);return s[0]=t,s[1]=e,s[2]=r,s[3]=n,s}function _1(t,e,r,n,s){return t[0]=e,t[1]=r,t[2]=n,t[3]=s,t}function B1(t,e){if(t===e){var r=e[1];t[1]=e[2],t[2]=r}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t}function C1(t,e){var r=e[0],n=e[1],s=e[2],o=e[3],i=r*o-s*n;return i?(i=1/i,t[0]=o*i,t[1]=-n*i,t[2]=-s*i,t[3]=r*i,t):null}function S1(t,e){var r=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=r,t}function I1(t){return t[0]*t[3]-t[2]*t[1]}function Xf(t,e,r){var n=e[0],s=e[1],o=e[2],i=e[3],a=r[0],c=r[1],l=r[2],f=r[3];return t[0]=n*a+o*c,t[1]=s*a+i*c,t[2]=n*l+o*f,t[3]=s*l+i*f,t}function w1(t,e,r){var n=e[0],s=e[1],o=e[2],i=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c+o*a,t[1]=s*c+i*a,t[2]=n*-a+o*c,t[3]=s*-a+i*c,t}function v1(t,e,r){var n=e[0],s=e[1],o=e[2],i=e[3],a=r[0],c=r[1];return t[0]=n*a,t[1]=s*a,t[2]=o*c,t[3]=i*c,t}function L1(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t}function F1(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t}function R1(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function P1(t){return Math.hypot(t[0],t[1],t[2],t[3])}function O1(t,e,r,n){return t[2]=n[2]/n[0],r[0]=n[0],r[1]=n[1],r[3]=n[3]-t[2]*r[1],[t,e,r]}function N1(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function Yf(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function D1(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function G1(t,e){var r=t[0],n=t[1],s=t[2],o=t[3],i=e[0],a=e[1],c=e[2],l=e[3];return Math.abs(r-i)<=pe*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-a)<=pe*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(s-c)<=pe*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(o-l)<=pe*Math.max(1,Math.abs(o),Math.abs(l))}function U1(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function V1(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t}var H1=Xf,z1=Yf;function k1(){var t=new ne(9);return ne!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}var Yi={};An(Yi,{add:()=>rx,calculateW:()=>jA,clone:()=>ZA,conjugate:()=>YA,copy:()=>ex,create:()=>Qi,dot:()=>uu,equals:()=>cx,exactEquals:()=>ax,exp:()=>au,fromEuler:()=>KA,fromMat3:()=>lu,fromValues:()=>$A,getAngle:()=>HA,getAxisAngle:()=>VA,identity:()=>UA,invert:()=>XA,len:()=>ox,length:()=>hu,lerp:()=>sx,ln:()=>cu,mul:()=>nx,multiply:()=>iu,normalize:()=>ia,pow:()=>JA,random:()=>WA,rotateX:()=>zA,rotateY:()=>kA,rotateZ:()=>qA,rotationTo:()=>lx,scale:()=>fu,set:()=>tx,setAxes:()=>ux,setAxisAngle:()=>ou,slerp:()=>qs,sqlerp:()=>fx,sqrLen:()=>ix,squaredLength:()=>du,str:()=>QA});var w={};An(w,{add:()=>W1,angle:()=>dA,bezier:()=>oA,ceil:()=>X1,clone:()=>q1,copy:()=>j1,create:()=>sa,cross:()=>ks,dist:()=>bA,distance:()=>eu,div:()=>TA,divide:()=>$f,dot:()=>oa,equals:()=>AA,exactEquals:()=>gA,floor:()=>Y1,forEach:()=>_A,fromValues:()=>Ki,hermite:()=>sA,inverse:()=>rA,len:()=>su,length:()=>Kf,lerp:()=>nA,max:()=>Q1,min:()=>K1,mul:()=>yA,multiply:()=>Zf,negate:()=>tA,normalize:()=>nu,random:()=>iA,rotateX:()=>fA,rotateY:()=>uA,rotateZ:()=>hA,round:()=>Z1,scale:()=>$1,scaleAndAdd:()=>eA,set:()=>J1,sqrDist:()=>EA,sqrLen:()=>MA,squaredDistance:()=>tu,squaredLength:()=>ru,str:()=>mA,sub:()=>xA,subtract:()=>Qf,transformMat3:()=>cA,transformMat4:()=>aA,transformQuat:()=>lA,zero:()=>pA});function sa(){var t=new ne(3);return ne!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function q1(t){var e=new ne(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Kf(t){var e=t[0],r=t[1],n=t[2];return Math.hypot(e,r,n)}function Ki(t,e,r){var n=new ne(3);return n[0]=t,n[1]=e,n[2]=r,n}function j1(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function J1(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function W1(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function Qf(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function Zf(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function $f(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}function X1(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function Y1(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function K1(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t}function Q1(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t}function Z1(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t}function $1(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function eA(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}function eu(t,e){var r=e[0]-t[0],n=e[1]-t[1],s=e[2]-t[2];return Math.hypot(r,n,s)}function tu(t,e){var r=e[0]-t[0],n=e[1]-t[1],s=e[2]-t[2];return r*r+n*n+s*s}function ru(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}function tA(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function rA(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function nu(t,e){var r=e[0],n=e[1],s=e[2],o=r*r+n*n+s*s;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function oa(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ks(t,e,r){var n=e[0],s=e[1],o=e[2],i=r[0],a=r[1],c=r[2];return t[0]=s*c-o*a,t[1]=o*i-n*c,t[2]=n*a-s*i,t}function nA(t,e,r,n){var s=e[0],o=e[1],i=e[2];return t[0]=s+n*(r[0]-s),t[1]=o+n*(r[1]-o),t[2]=i+n*(r[2]-i),t}function sA(t,e,r,n,s,o){var i=o*o,a=i*(2*o-3)+1,c=i*(o-2)+o,l=i*(o-1),f=i*(3-2*o);return t[0]=e[0]*a+r[0]*c+n[0]*l+s[0]*f,t[1]=e[1]*a+r[1]*c+n[1]*l+s[1]*f,t[2]=e[2]*a+r[2]*c+n[2]*l+s[2]*f,t}function oA(t,e,r,n,s,o){var i=1-o,a=i*i,c=o*o,l=a*i,f=3*o*a,u=3*c*i,h=c*o;return t[0]=e[0]*l+r[0]*f+n[0]*u+s[0]*h,t[1]=e[1]*l+r[1]*f+n[1]*u+s[1]*h,t[2]=e[2]*l+r[2]*f+n[2]*u+s[2]*h,t}function iA(t,e){e=e||1;var r=kt()*2*Math.PI,n=kt()*2-1,s=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(r)*s,t[1]=Math.sin(r)*s,t[2]=n*e,t}function aA(t,e,r){var n=e[0],s=e[1],o=e[2],i=r[3]*n+r[7]*s+r[11]*o+r[15];return i=i||1,t[0]=(r[0]*n+r[4]*s+r[8]*o+r[12])/i,t[1]=(r[1]*n+r[5]*s+r[9]*o+r[13])/i,t[2]=(r[2]*n+r[6]*s+r[10]*o+r[14])/i,t}function cA(t,e,r){var n=e[0],s=e[1],o=e[2];return t[0]=n*r[0]+s*r[3]+o*r[6],t[1]=n*r[1]+s*r[4]+o*r[7],t[2]=n*r[2]+s*r[5]+o*r[8],t}function lA(t,e,r){var n=r[0],s=r[1],o=r[2],i=r[3],a=e[0],c=e[1],l=e[2],f=s*l-o*c,u=o*a-n*l,h=n*c-s*a,d=s*h-o*u,p=o*f-n*h,A=n*u-s*f,m=i*2;return f*=m,u*=m,h*=m,d*=2,p*=2,A*=2,t[0]=a+f+d,t[1]=c+u+p,t[2]=l+h+A,t}function fA(t,e,r,n){var s=[],o=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[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),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function uA(t,e,r,n){var s=[],o=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[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),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function hA(t,e,r,n){var s=[],o=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[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],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function dA(t,e){var r=t[0],n=t[1],s=t[2],o=e[0],i=e[1],a=e[2],c=Math.sqrt(r*r+n*n+s*s),l=Math.sqrt(o*o+i*i+a*a),f=c*l,u=f&&oa(t,e)/f;return Math.acos(Math.min(Math.max(u,-1),1))}function pA(t){return t[0]=0,t[1]=0,t[2]=0,t}function mA(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function gA(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function AA(t,e){var r=t[0],n=t[1],s=t[2],o=e[0],i=e[1],a=e[2];return Math.abs(r-o)<=pe*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-i)<=pe*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-a)<=pe*Math.max(1,Math.abs(s),Math.abs(a))}var xA=Qf,yA=Zf,TA=$f,bA=eu,EA=tu,su=Kf,MA=ru,_A=function(){var t=sa();return function(e,r,n,s,o,i){var a,c;for(r||(r=3),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],o(t,t,i),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2];return e}}();function BA(){var t=new ne(4);return ne!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function CA(t){var e=new ne(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function SA(t,e,r,n){var s=new ne(4);return s[0]=t,s[1]=e,s[2]=r,s[3]=n,s}function IA(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function wA(t,e,r,n,s){return t[0]=e,t[1]=r,t[2]=n,t[3]=s,t}function vA(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function LA(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function FA(t){var e=t[0],r=t[1],n=t[2],s=t[3];return Math.hypot(e,r,n,s)}function RA(t){var e=t[0],r=t[1],n=t[2],s=t[3];return e*e+r*r+n*n+s*s}function PA(t,e){var r=e[0],n=e[1],s=e[2],o=e[3],i=r*r+n*n+s*s+o*o;return i>0&&(i=1/Math.sqrt(i)),t[0]=r*i,t[1]=n*i,t[2]=s*i,t[3]=o*i,t}function OA(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function NA(t,e,r,n){var s=e[0],o=e[1],i=e[2],a=e[3];return t[0]=s+n*(r[0]-s),t[1]=o+n*(r[1]-o),t[2]=i+n*(r[2]-i),t[3]=a+n*(r[3]-a),t}function DA(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function GA(t,e){var r=t[0],n=t[1],s=t[2],o=t[3],i=e[0],a=e[1],c=e[2],l=e[3];return Math.abs(r-i)<=pe*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-a)<=pe*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(s-c)<=pe*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(o-l)<=pe*Math.max(1,Math.abs(o),Math.abs(l))}var I3=function(){var t=BA();return function(e,r,n,s,o,i){var a,c;for(r||(r=4),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],t[3]=e[a+3],o(t,t,i),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2],e[a+3]=t[3];return e}}();function Qi(){var t=new ne(4);return ne!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function UA(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function ou(t,e,r){r=r*.5;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t}function VA(t,e){var r=Math.acos(e[3])*2,n=Math.sin(r/2);return n>pe?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),r}function HA(t,e){var r=uu(t,e);return Math.acos(2*r*r-1)}function iu(t,e,r){var n=e[0],s=e[1],o=e[2],i=e[3],a=r[0],c=r[1],l=r[2],f=r[3];return t[0]=n*f+i*a+s*l-o*c,t[1]=s*f+i*c+o*a-n*l,t[2]=o*f+i*l+n*c-s*a,t[3]=i*f-n*a-s*c-o*l,t}function zA(t,e,r){r*=.5;var n=e[0],s=e[1],o=e[2],i=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c+i*a,t[1]=s*c+o*a,t[2]=o*c-s*a,t[3]=i*c-n*a,t}function kA(t,e,r){r*=.5;var n=e[0],s=e[1],o=e[2],i=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c-o*a,t[1]=s*c+i*a,t[2]=o*c+n*a,t[3]=i*c-s*a,t}function qA(t,e,r){r*=.5;var n=e[0],s=e[1],o=e[2],i=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c+s*a,t[1]=s*c-n*a,t[2]=o*c+i*a,t[3]=i*c-o*a,t}function jA(t,e){var r=e[0],n=e[1],s=e[2];return t[0]=r,t[1]=n,t[2]=s,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-s*s)),t}function au(t,e){var r=e[0],n=e[1],s=e[2],o=e[3],i=Math.sqrt(r*r+n*n+s*s),a=Math.exp(o),c=i>0?a*Math.sin(i)/i:0;return t[0]=r*c,t[1]=n*c,t[2]=s*c,t[3]=a*Math.cos(i),t}function cu(t,e){var r=e[0],n=e[1],s=e[2],o=e[3],i=Math.sqrt(r*r+n*n+s*s),a=i>0?Math.atan2(i,o)/i:0;return t[0]=r*a,t[1]=n*a,t[2]=s*a,t[3]=.5*Math.log(r*r+n*n+s*s+o*o),t}function JA(t,e,r){return cu(t,e),fu(t,t,r),au(t,t),t}function qs(t,e,r,n){var s=e[0],o=e[1],i=e[2],a=e[3],c=r[0],l=r[1],f=r[2],u=r[3],h,d,p,A,m;return d=s*c+o*l+i*f+a*u,d<0&&(d=-d,c=-c,l=-l,f=-f,u=-u),1-d>pe?(h=Math.acos(d),p=Math.sin(h),A=Math.sin((1-n)*h)/p,m=Math.sin(n*h)/p):(A=1-n,m=n),t[0]=A*s+m*c,t[1]=A*o+m*l,t[2]=A*i+m*f,t[3]=A*a+m*u,t}function WA(t){var e=kt(),r=kt(),n=kt(),s=Math.sqrt(1-e),o=Math.sqrt(e);return t[0]=s*Math.sin(2*Math.PI*r),t[1]=s*Math.cos(2*Math.PI*r),t[2]=o*Math.sin(2*Math.PI*n),t[3]=o*Math.cos(2*Math.PI*n),t}function XA(t,e){var r=e[0],n=e[1],s=e[2],o=e[3],i=r*r+n*n+s*s+o*o,a=i?1/i:0;return t[0]=-r*a,t[1]=-n*a,t[2]=-s*a,t[3]=o*a,t}function YA(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function lu(t,e){var r=e[0]+e[4]+e[8],n;if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var s=0;e[4]>e[0]&&(s=1),e[8]>e[s*3+s]&&(s=2);var o=(s+1)%3,i=(s+2)%3;n=Math.sqrt(e[s*3+s]-e[o*3+o]-e[i*3+i]+1),t[s]=.5*n,n=.5/n,t[3]=(e[o*3+i]-e[i*3+o])*n,t[o]=(e[o*3+s]+e[s*3+o])*n,t[i]=(e[i*3+s]+e[s*3+i])*n}return t}function KA(t,e,r,n){var s=.5*Math.PI/180;e*=s,r*=s,n*=s;var o=Math.sin(e),i=Math.cos(e),a=Math.sin(r),c=Math.cos(r),l=Math.sin(n),f=Math.cos(n);return t[0]=o*c*f-i*a*l,t[1]=i*a*f+o*c*l,t[2]=i*c*l-o*a*f,t[3]=i*c*f+o*a*l,t}function QA(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var ZA=CA,$A=SA,ex=IA,tx=wA,rx=vA,nx=iu,fu=LA,uu=OA,sx=NA,hu=FA,ox=hu,du=RA,ix=du,ia=PA,ax=DA,cx=GA,lx=function(){var t=sa(),e=Ki(1,0,0),r=Ki(0,1,0);return function(n,s,o){var i=oa(s,o);return i<-.999999?(ks(t,e,s),su(t)<1e-6&&ks(t,r,s),nu(t,t),ou(n,t,Math.PI),n):i>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(ks(t,s,o),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+i,ia(n,n))}}(),fx=function(){var t=Qi(),e=Qi();return function(r,n,s,o,i,a){return qs(t,n,i,a),qs(e,s,o,a),qs(r,t,e,2*a*(1-a)),r}}(),ux=function(){var t=k1();return function(e,r,n,s){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=s[0],t[4]=s[1],t[7]=s[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],ia(e,lu(e,t))}}(),P={};An(P,{add:()=>gx,angle:()=>Nx,ceil:()=>Ax,clone:()=>hx,copy:()=>px,create:()=>pu,cross:()=>Ix,dist:()=>jx,distance:()=>xu,div:()=>qx,divide:()=>Au,dot:()=>Sx,equals:()=>Vx,exactEquals:()=>Ux,floor:()=>xx,forEach:()=>Xx,fromValues:()=>dx,inverse:()=>Bx,len:()=>Hx,length:()=>Tu,lerp:()=>wx,max:()=>Tx,min:()=>yx,mul:()=>kx,multiply:()=>gu,negate:()=>_x,normalize:()=>Cx,random:()=>vx,rotate:()=>Ox,round:()=>bx,scale:()=>Ex,scaleAndAdd:()=>Mx,set:()=>mx,sqrDist:()=>Jx,sqrLen:()=>Wx,squaredDistance:()=>yu,squaredLength:()=>bu,str:()=>Gx,sub:()=>zx,subtract:()=>mu,transformMat2:()=>Lx,transformMat2d:()=>Fx,transformMat3:()=>Rx,transformMat4:()=>Px,zero:()=>Dx});function pu(){var t=new ne(2);return ne!=Float32Array&&(t[0]=0,t[1]=0),t}function hx(t){var e=new ne(2);return e[0]=t[0],e[1]=t[1],e}function dx(t,e){var r=new ne(2);return r[0]=t,r[1]=e,r}function px(t,e){return t[0]=e[0],t[1]=e[1],t}function mx(t,e,r){return t[0]=e,t[1]=r,t}function gx(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function mu(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t}function gu(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t}function Au(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t}function Ax(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function xx(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function yx(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t}function Tx(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t}function bx(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}function Ex(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t}function Mx(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t}function xu(t,e){var r=e[0]-t[0],n=e[1]-t[1];return Math.hypot(r,n)}function yu(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n}function Tu(t){var e=t[0],r=t[1];return Math.hypot(e,r)}function bu(t){var e=t[0],r=t[1];return e*e+r*r}function _x(t,e){return t[0]=-e[0],t[1]=-e[1],t}function Bx(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function Cx(t,e){var r=e[0],n=e[1],s=r*r+n*n;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t}function Sx(t,e){return t[0]*e[0]+t[1]*e[1]}function Ix(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t}function wx(t,e,r,n){var s=e[0],o=e[1];return t[0]=s+n*(r[0]-s),t[1]=o+n*(r[1]-o),t}function vx(t,e){e=e||1;var r=kt()*2*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t}function Lx(t,e,r){var n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s,t[1]=r[1]*n+r[3]*s,t}function Fx(t,e,r){var n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s+r[4],t[1]=r[1]*n+r[3]*s+r[5],t}function Rx(t,e,r){var n=e[0],s=e[1];return t[0]=r[0]*n+r[3]*s+r[6],t[1]=r[1]*n+r[4]*s+r[7],t}function Px(t,e,r){var n=e[0],s=e[1];return t[0]=r[0]*n+r[4]*s+r[12],t[1]=r[1]*n+r[5]*s+r[13],t}function Ox(t,e,r,n){var s=e[0]-r[0],o=e[1]-r[1],i=Math.sin(n),a=Math.cos(n);return t[0]=s*a-o*i+r[0],t[1]=s*i+o*a+r[1],t}function Nx(t,e){var r=t[0],n=t[1],s=e[0],o=e[1],i=Math.sqrt(r*r+n*n)*Math.sqrt(s*s+o*o),a=i&&(r*s+n*o)/i;return Math.acos(Math.min(Math.max(a,-1),1))}function Dx(t){return t[0]=0,t[1]=0,t}function Gx(t){return"vec2("+t[0]+", "+t[1]+")"}function Ux(t,e){return t[0]===e[0]&&t[1]===e[1]}function Vx(t,e){var r=t[0],n=t[1],s=e[0],o=e[1];return Math.abs(r-s)<=pe*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-o)<=pe*Math.max(1,Math.abs(n),Math.abs(o))}var Hx=Tu,zx=mu,kx=gu,qx=Au,jx=xu,Jx=yu,Wx=bu,Xx=function(){var t=pu();return function(e,r,n,s,o,i){var a,c;for(r||(r=2),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],o(t,t,i),e[a]=t[0],e[a+1]=t[1];return e}}(),Xs=(1+Math.sqrt(5))/2,w3=2*Math.PI,js=2*Math.PI/5,tt=Math.PI/5,Sf=Math.PI/10,Yx=2*Math.atan(Xs),Zi=Math.PI-Yx,v3=-.5*Math.PI+Math.acos(-1/Math.sqrt(3-Xs)),Ys=(Math.sqrt(5)-1)/2,Kx=3-Math.sqrt(5),Qx=Math.sqrt(3-Xs),L3=Math.sqrt(3)*Qx/Xs;Te.setMatrixArrayType(Float64Array);var aa=class $i{constructor(e){this.vertices=e,this.isWindingCorrect()||this.vertices.reverse()}getArea(){let e=0,r=this.vertices.length;for(let n=0;n<r;n++){let s=(n+1)%r;e+=(this.vertices[s][0]-this.vertices[n][0])*(this.vertices[s][1]+this.vertices[n][1])}return e}isWindingCorrect(){return this.getArea()>=0}getVertices(){return this.vertices}scale(e){for(let r of this.vertices)P.scale(r,r,e);return this}rotate180(){for(let e of this.vertices)P.negate(e,e);return this}reflectY(){for(let e of this.vertices)e[1]=-e[1];return this.vertices.reverse(),this}translate(e){for(let r of this.vertices)P.add(r,r,e);return this}transform(e){for(let r of this.vertices)P.transformMat2(r,r,e);return this}transform2d(e){for(let r of this.vertices)P.transformMat2d(r,r,e);return this}clone(){return new $i(this.vertices.map(r=>P.clone(r)))}getCenter(){let e=this.vertices.length;return this.vertices.reduce((n,s)=>[n[0]+s[0]/e,n[1]+s[1]/e],[0,0])}containsPoint(e){if(!this.isWindingCorrect())throw new Error("Pentagon is not counter-clockwise");let r=this.vertices.length,n=1;for(let s=0;s<r;s++){let o=this.vertices[s],i=this.vertices[(s+1)%r],a=o[0]-i[0],c=o[1]-i[1],l=e[0]-o[0],f=e[1]-o[1],u=a*f-c*l;if(u<0){let h=Math.sqrt(l*l+f*f);n=Math.min(n,u/h)}}return n}splitEdges(e){if(e<=1)return this;let r=[],n=this.vertices.length;for(let s=0;s<n;s++){let o=this.vertices[s],i=this.vertices[(s+1)%n];r.push(P.clone(o));for(let a=1;a<e;a++){let c=a/e,l=P.create();P.lerp(l,o,i,c),r.push(l)}}return new $i(r)}};Te.setMatrixArrayType(Float64Array);var Eu=[0,0],Mu=[0,1],jt=[.7885966681787006,1.6149108024237764],_u=[1.6171013659387945,1.054928690397459],Bu=[Math.cos(Sf),Math.sin(Sf)],Zx=2*P.length(jt)*Math.cos(tt),$x=tt-Math.atan2(jt[1],jt[0]),ey=2*Ys/Zx;[Eu,Mu,jt,_u,Bu].forEach(t=>{P.scale(t,t,ey),P.rotate(t,t,[0,0],$x)});var ty=new aa([Eu,Mu,jt,_u,Bu]),Cu=Math.atan2(jt[1],jt[0])-tt,ry=[0,0],Js=Ys/Math.cos(tt),If=Cu+tt,Ws=[Js*Math.cos(If),Js*Math.sin(If)],wf=Cu-tt,gn=[Js*Math.cos(wf),Js*Math.sin(wf)],Su=new aa([ry,Ws,gn]),Iu=qt.fromValues(Ws[0],Ws[1],gn[0],gn[1]),F3=qt.invert(qt.create(),Iu),ny=new Float64Array([-.0022392098386786394,21308606513250217e-22,-2559257686421274e-24,33701965267802837e-28,-4667545312611249e-30,667492870384816e-32]),sy=new Float64Array([.0022392089963541657,28831978048607556e-22,508622073997266e-23,102018123778161e-25,21912872306767718e-30,49284235482523806e-33]),oy=class{applyCoefficients(t,e){let r=Math.sin(t),n=Math.cos(t),s=2*(n-r)*(n+r),o,i;return o=s*e[5]+e[4],i=s*o+e[3],o=s*i-o+e[2],i=s*o-i+e[1],o=s*i-o+e[0],t+2*r*n*o}forward(t){return this.applyCoefficients(t,ny)}inverse(t){return this.applyCoefficients(t,sy)}};Te.setMatrixArrayType(Float64Array);var wu=new oy;function vf(t){return t*(Math.PI/180)}function Lf(t){return t*(180/Math.PI)}function Ff(t){let e=P.length(t),r=Math.atan2(t[1],t[0]);return[e,r]}function iy([t,e]){let r=t*Math.cos(e),n=t*Math.sin(e);return[r,n]}function ay(t,[e,r,n]){let s=[e[0]-n[0],e[1]-n[1]],o=[n[0]-r[0],n[1]-r[1]],i=[t[0]-n[0],t[1]-n[1]],a=o[0]*s[1]-o[1]*s[0],c=(o[0]*i[1]-o[1]*i[0])/a,l=(s[0]*i[1]-s[1]*i[0])/a,f=1-(c+l);return[c,l,f]}function cy(t,[e,r,n]){return[t[0]*e[0]+t[1]*r[0]+t[2]*n[0],t[0]*e[1]+t[1]*r[1]+t[2]*n[1]]}function ea(t){let e=Math.atan2(t[1],t[0]),r=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),n=Math.acos(t[2]/r);return[e,n]}function Sr([t,e]){let r=Math.sin(e),n=r*Math.cos(t),s=r*Math.sin(t),o=Math.cos(e);return[n,s,o]}var vu=93;function ly([t,e]){let r=vf(t+vu),n=vf(e),s=wu.forward(n),o=Math.PI/2-s;return[r,o]}function Lu([t,e]){let r=Lf(t)-vu,n=Math.PI/2-e,s=wu.inverse(n),o=Lf(s);return[r,o]}function fy(t){let e=t.map(o=>Sr(ly(o))),r=w.create();for(let o of e)w.add(r,r,o);w.normalize(r,r);let[n,s]=Lu(ea(r));return(s>89.99||s<-89.99)&&(n=t[0][0]),n=((n+180)%360+360)%360-180,t.map(o=>{let[i,a]=o;for(;i-n>180;)i=i-360;for(;i-n<-180;)i=i+360;return[i,a]})}Te.setMatrixArrayType(Float64Array);var Ks=Math.sqrt(5),Qs=Math.sqrt(.2),Fu=Math.sqrt((1-Qs)/2),Ru=Math.sqrt((1+Qs)/2),Os=.5,Rf=Math.sqrt((2.5-Ks)/10),Pf=Math.sqrt((2.5+Ks)/10),Of=Math.sqrt((1+Qs)/8),Nf=Math.sqrt((1-Qs)/8),Df=Math.sqrt((3-Ks)/8),Gf=Math.sqrt((3+Ks)/8),uy=[[0,0],[Fu,0],[Rf,Os],[-Of,Df],[-Of,-Df],[Rf,-Os],[-Ru,0],[-Nf,-Gf],[Pf,-Os],[Pf,Os],[-Nf,Gf],[0,0]],hy=uy.map(([t,e])=>[-e,t]),Ns=hy.map((t,e)=>e===0?[0,0,0,1]:e===11?[0,-1,0,0]:[...t,0,e<6?Ru:Fu]);Te.setMatrixArrayType(Float64Array);var Pu=["vu","uw","vw","vw","vw"],pn=["wu","uw","vw","vu","uw"],Ji=["wu","uv","wv","wu","uw"],Ds=["vu","uv","wv","wu","uw"],dy=[Pu,Ds,Ji,pn,Ji,Ds,Ji,pn,pn,pn,Ds,Ds],py=[4,2,3,2,0,4,3,2,2,0,3,0],Uf=[0,1,2,4,3,5,7,8,6,11,10,9],We=[];function my(){Gs([0,0],0,Ns[0]);for(let t=0;t<5;t++){let e=t*js,r=e+tt;Gs([e,Zi],tt,Ns[t+1]),Gs([r,Math.PI-Zi],tt,Ns[(t+3)%5+6])}Gs([0,Math.PI],0,Ns[11])}var _r=0;function Gs(t,e,r){if(_r>11)throw new Error(`Too many origins: ${_r}`);let n=Yi.create();Yi.conjugate(n,r);let s={id:_r,axis:t,quat:r,inverseQuat:n,angle:e,orientation:dy[_r],firstQuintant:py[_r]};We.push(s),_r++}my();We.sort((t,e)=>Uf.indexOf(t.id)-Uf.indexOf(e.id));We.forEach((t,e)=>t.id=e);function gy(t,e){let r=e.orientation,n=r===Pu||r===pn?-1:1,s=(t-e.firstQuintant+5)%5,o=r[s];return{quintant:(e.firstQuintant+n*s+5)%5,orientation:o}}var Ay=class{forward([t,e]){return[Math.tan(e),t]}inverse([t,e]){return[e,Math.atan(t)]}},Br=w.create(),mn=w.create(),Vf=w.create(),Hf=w.create();function Wi(t,e){w.lerp(Br,t,e,.5),w.normalize(Br,Br),w.cross(Br,t,Br);let r=w.length(Br);if(r<1e-8){let n=w.subtract(w.create(),t,e);return .5*w.length(n)}return r}function xy(t,e,r){return w.cross(mn,e,r),w.dot(t,mn)}function yy(t,e,r,n,s){w.cross(mn,n,s);let o=w.dot(e,mn),i=w.dot(r,mn);return w.scale(Vf,e,i),w.scale(Hf,r,o),w.sub(t,Hf,Vf)}function ta(t,e,r,n){let s=w.angle(e,r);if(s<1e-12)return w.lerp(t,e,r,n);let o=Math.sin((1-n)*s)/Math.sin(s),i=Math.sin(n*s)/Math.sin(s),a=w.scale(w.create(),e,o),c=w.scale(w.create(),r,i);return w.add(t,a,c)}Te.setMatrixArrayType(Float64Array);var Us=w.create(),Vs=w.create(),Hs=w.create(),Cr=w.create(),Ty=class{constructor(t){this._area=null,this.vertices=t,Object.freeze(this.vertices)}getBoundary(t=1,e=!0){let r=[],n=this.vertices.length;for(let s=0;s<n*t;s++){let o=s/t;r.push(this.slerp(o))}return e&&r.push(r[0]),r}slerp(t){let e=this.vertices.length,r=t%1,n=Math.floor(t%e),s=(n+1)%e;return ta(w.create(),this.vertices[n],this.vertices[s],r)}getTransformedVertices(t){let e=this.vertices.length,r=Math.floor(t%e),n=(r+1)%e,s=(r+e-1)%e,o=w.clone(this.vertices[r]),i=w.clone(this.vertices[n]),a=w.clone(this.vertices[s]);return w.sub(i,i,o),w.sub(a,a,o),[o,i,a]}containsPoint(t){let e=this.vertices.length,r=1/0;for(let n=0;n<e;n++){let[s,o,i]=this.getTransformedVertices(n),a=w.sub(w.create(),t,s);w.normalize(a,a),w.normalize(o,o),w.normalize(i,i);let c=w.cross(w.create(),o,a),l=w.cross(w.create(),a,i),f=w.dot(s,c),u=w.dot(s,l);r=Math.min(r,f,u)}return r}getTriangleArea(t,e,r){w.lerp(Us,e,r,.5),w.lerp(Vs,r,t,.5),w.lerp(Hs,t,e,.5),w.normalize(Us,Us),w.normalize(Vs,Vs),w.normalize(Hs,Hs);let n=xy(Us,Vs,Hs),s=Math.max(-1,Math.min(1,n));return Math.abs(s)<1e-8?2*s:Math.asin(s)*2}getArea(){return this._area===null&&(this._area=this._getArea()),this._area}_getArea(){if(this.vertices.length<3)return 0;if(this.vertices.length===3)return this._area=this.getTriangleArea(this.vertices[0],this.vertices[1],this.vertices[2]),this._area;w.set(Cr,0,0,0);for(let e of this.vertices)w.add(Cr,Cr,e);w.normalize(Cr,Cr);let t=0;for(let e=0;e<this.vertices.length;e++){let r=this.vertices[e],n=this.vertices[(e+1)%this.vertices.length],s=this.getTriangleArea(Cr,r,n);isNaN(s)||(t+=s)}return this._area=t,this._area}isWindingCorrect(){if(!(this.getArea()>0))debugger}};Te.setMatrixArrayType(Float64Array);var zs=class extends Ty{constructor(t){if(t.length!==3)throw new Error("SphericalTriangleShape requires exactly 3 vertices");super(t)}};Te.setMatrixArrayType(Float64Array);var by=class{forward(t,e,r){let[n,s,o]=e,i=new zs([n,s,o]),a=w.subtract(w.create(),t,n);w.normalize(a,a);let c=yy(w.create(),n,a,s,o);w.normalize(c,c);let l=Wi(n,t)/Wi(n,c),f=i.getArea(),u=l/f,h=[1-l,u*new zs([n,c,o]).getArea(),u*new zs([n,s,c]).getArea()];return cy(h,r)}inverse(t,e,r){let[n,s,o]=r,i=new zs([n,s,o]),a=ay(t,e),c=1-1e-14;if(a[0]>c)return n;if(a[1]>c)return s;if(a[2]>c)return o;let l=w.create();w.cross(l,s,o);let f=i.getArea(),u=1-a[0],d=a[2]/u*f,p=Math.sin(d),A=Math.sin(d/2),m=2*A*A,y=w.dot(n,s),b=w.dot(s,o),E=w.dot(o,n),M=w.length(l),B=w.dot(n,l),C=p*B+m*(y*b-E),v=m*M*(1+y),_=2/Math.acos(b)*Math.atan2(v,C),T=ta(w.create(),s,o,_),g=Wi(n,T),S=this.safeAcos(u*g)/this.safeAcos(g);return ta([0,0,0],n,T,S)}safeAcos(t){return t<.001?2*t+t*t*t/3:Math.acos(1-2*t*t)}};Te.setMatrixArrayType(Float64Array);var Ie=-1,ye=1,Ey=([t,e])=>P.fromValues(t-e,e),ra=P.fromValues(1,0),na=P.fromValues(0,1),zf=P.negate(P.create(),ra),kf=P.negate(P.create(),na),Xi=P.fromValues(0,0),My=(t,[e,r])=>{let n=Xi,s=Xi;switch(e===ye&&r===ye?(n=ra,s=na):e===Ie&&r===ye?(n=kf,s=zf):e===ye&&r===Ie?(n=na,s=ra):e===Ie&&r===Ie&&(n=zf,s=kf),t){case 0:return Xi;case 1:return n;case 2:return P.add(P.create(),s,n);case 3:return P.scaleAndAdd(P.create(),s,n,2);default:throw new Error(`Invalid Quaternary value: ${t}`)}},qf=t=>[[ye,ye],[ye,Ie],[ye,ye],[Ie,ye]][t],jf=P.fromValues(-1,1);function Ou(t){return Array.from({length:t.length},(e,r)=>t.indexOf(r))}var Nu=[0,1,3,4,5,6,7,2],Du=[0,1,2,7,3,4,5,6],R3=Ou(Nu),P3=Ou(Du),_y=(t,e,r,n,s)=>{if(e<=0)return;let o=t[e]||0,i=t[e-1],a=r[0]+r[1],c=!0,l=!0;if(n!==(a===0)?(c=o===1||o===2,l=o===1):(c=o<2,l=o===0),!c)return;let f=l?i:i+4,u=s[f];t[e-1]=u%4,t[e]=(o+4+Math.floor(u/4)-Math.floor(f/4))%4},By=(t,e,r)=>{let n=BigInt(t),s=r==="vu"||r==="wu"||r==="vw",o=r==="wv"||r==="vw",i=r==="wu"||r==="uw";s&&(n=(1n<<BigInt(2*e))-n-1n);let a=Cy(n,e,o,i);if(i){let{offset:[c,l],flips:[f,u]}=a;a.offset=[l,c],f===Ie&&P.add(a.offset,a.offset,jf),u===Ie&&P.subtract(a.offset,a.offset,jf)}if(o){let{offset:[c,l],flips:f}=a,u=(1<<e)-(c+l);f[0]=-f[0],a.offset[1]=u,a.flips=f}return a},Cy=(t,e,r,n)=>{let s=P.create(),o=[ye,ye],i=BigInt(t),a=[];for(;i>0n||a.length<e;)a.push(Number(i%4n)),i=i>>2n;let c=n?Du:Nu;for(let f=a.length-1;f>=0;f--)_y(a,f,o,r,c),P.multiply(o,o,qf(a[f]));o[0]=ye,o[1]=ye;for(let f=a.length-1;f>=0;f--){P.scale(s,s,2);let u=My(a[f],o);P.add(s,s,u),P.multiply(o,o,qf(a[f]))}let l=a[0]||0;return{flips:o,k:l,offset:Ey(s)}};Te.setMatrixArrayType(Float64Array);var Sy=!1,Iy=P.clone(gn),wy=P.negate(P.create(),gn),ca=[0,1,2,3,4].map(t=>{let e=qt.create();return qt.fromRotation(e,js*t),e}),Jf=P.create();function vy(t,e,r){let n=(Sy?Su:ty).clone();P.transformMat2(Jf,r.offset,Iu),r.flips[0]===ye&&r.flips[1]===Ie&&n.rotate180();let{k:s}=r,o=r.flips[0]+r.flips[1];return((o===-2||o===2)&&s>1||o===0&&(s===0||s===3))&&n.reflectY(),r.flips[0]===Ie&&r.flips[1]===Ie?n.rotate180():r.flips[0]===Ie?n.translate(wy):r.flips[1]===Ie&&n.translate(Iy),n.translate(Jf),n.scale(1/2**t),n.transform(ca[e]),n}function Gu(t){let e=Su.clone();return e.transform(ca[t]),e}function Ly(){let t=[];for(let e of ca)t.push(P.transformMat2(P.create(),Ws,e));return t.reverse(),new aa(t)}Te.setMatrixArrayType(Float64Array);var Fy=class{constructor(){if(this.vertices=[],this.invocations=0,this.addFaceCenters(),this.addVertices(),this.addMidpoints(),this.vertices.length!==62)throw new Error("Failed to construct CRS: vertices length is not 62");Object.freeze(this.vertices)}getVertex(t){this.invocations++,this.invocations===1e4&&console.warn("Too many CRS invocations, results should be cached");for(let e of this.vertices)if(w.distance(t,e)<1e-5)return e;throw new Error("Failed to find vertex in CRS")}addFaceCenters(){We.forEach(t=>this.add(Sr(t.axis)))}addVertices(){let t=Math.atan(Kx);for(let e of We)for(let r=0;r<5;r++){let n=(2*r+1)*Math.PI/5,s=Sr([n+e.angle,t]);w.transformQuat(s,s,e.quat),this.add(s)}}addMidpoints(){let t=Math.atan(Ys);for(let e of We)for(let r=0;r<5;r++){let n=2*r*Math.PI/5,s=Sr([n+e.angle,t]);w.transformQuat(s,s,e.quat),this.add(s)}}add(t){let e=w.normalize(w.create(),t);return this.vertices.find(n=>w.distance(e,n)<1e-5)?!1:(this.vertices.push(e),!0)}};Te.setMatrixArrayType(Float64Array);var Ry=new Fy,Py=class{constructor(){this.faceTriangles=[],this.sphericalTriangles=[],this.polyhedral=new by,this.gnomonic=new Ay}forward(t,e){let r=We[e],n=Sr(t),s=w.create();w.transformQuat(s,n,r.inverseQuat);let o=ea(s),i=this.gnomonic.forward(o);i[1]=i[1]-r.angle;let a=this.getFaceTriangleIndex(i),c=this.shouldReflect(i),l=this.getFaceTriangle(a,c,!1),f=this.getSphericalTriangle(a,e,c);return this.polyhedral.forward(n,f,l)}inverse(t,e){let r=Ff(t),n=this.getFaceTriangleIndex(r),s=this.shouldReflect(r),o=this.getFaceTriangle(n,s,!1),i=this.getSphericalTriangle(n,e,s),a=this.polyhedral.inverse(t,o,i);return ea(a)}shouldReflect(t){let[e,r]=t;return iy([e,this.normalizeGamma(r)])[0]>Ys}getFaceTriangleIndex([t,e]){return(Math.floor(e/tt)+10)%10}getFaceTriangle(t,e=!1,r=!1){let n=t;return e&&(n+=r?20:10),this.faceTriangles[n]?this.faceTriangles[n]:(this.faceTriangles[n]=e?this._getReflectedFaceTriangle(t,r):this._getFaceTriangle(t),Object.freeze(this.faceTriangles[n]),this.faceTriangles[n])}_getFaceTriangle(t){let e=Math.floor((t+1)/2)%5,[r,n,s]=Gu(e).getVertices(),o=P.create();return P.lerp(o,n,s,.5),t%2===0?[r,o,n]:[r,s,o]}_getReflectedFaceTriangle(t,e=!1){let[r,n,s]=this._getFaceTriangle(t).map(a=>P.clone(a)),o=t%2===0;P.negate(r,r);let i=o?n:s;return P.scaleAndAdd(r,r,i,e?1+1/Math.cos(Zi):2),[r,s,n]}getSphericalTriangle(t,e,r=!1){let n=10*e+t;return r&&(n+=120),this.sphericalTriangles[n]?this.sphericalTriangles[n]:(this.sphericalTriangles[n]=this._getSphericalTriangle(t,e,r),Object.freeze(this.sphericalTriangles[n]),this.sphericalTriangles[n])}_getSphericalTriangle(t,e,r=!1){let n=We[e];return this.getFaceTriangle(t,r,!0).map(i=>{let[a,c]=Ff(i),l=[a,c+n.angle],f=Sr(this.gnomonic.inverse(l));return w.transformQuat(f,f,n.quat),Ry.getVertex(f)})}normalizeGamma(t){let e=t/js,r=Math.round(e);return(e-r)*js}},Ir=2,Oy=30,Ny=58n,Dy=0x3ffffffffffffffn;function Gy(t){let e=Oy-1,r=t>>1n;for(;e>-1&&(r&0b1n)===0n;)e-=1,r=r>>(e<Ir?1n:2n);return e}function Uy(t){let e=Gy(t);if(e===-1)return{origin:We[0],segment:0,S:0n,resolution:e};let r=Number(t>>58n),n,s;if(e===0)n=We[r],s=0;else{let l=Math.floor(r/5);n=We[l],s=(r+n.firstQuintant)%5}if(!n)throw new Error(`Could not parse origin: ${r}`);if(e<Ir)return{origin:n,segment:s,S:0n,resolution:e};let o=e-Ir+1,i=BigInt(2*o),a=Ny-i,c=(t&Dy)>>a;return{origin:n,segment:s,S:c,resolution:e}}Te.setMatrixArrayType(Float64Array);var O3=qt.create(),Vy=new Py;function Hy({S:t,segment:e,origin:r,resolution:n}){let{quintant:s,orientation:o}=gy(e,r);if(n===Ir-1)return Gu(s);if(n===Ir-2)return Ly();let i=n-Ir+1,a=By(t,i,o);return vy(i,s,a)}function Uu(t,{closedRing:e=!0,segments:r="auto"}={closedRing:!0,segments:"auto"}){let{S:n,segment:s,origin:o,resolution:i}=Uy(t);r==="auto"&&(r=Math.max(1,Math.pow(2,6-i)));let u=Hy({S:n,segment:s,origin:o,resolution:i}).splitEdges(r).getVertices().map(d=>Vy.inverse(d,o.id)).map(d=>Lu(d)),h=fy(u);return e&&h.push(h[0]),h.reverse(),h}function Vu(t){return BigInt(`0x${t}`)}var Wf=63710072e-1,N3=4*Math.PI*Wf*Wf;Te.setMatrixArrayType(Float64Array);var Bn=D(Zs(),1);var zy=1/Math.PI*180,ky=1/180*Math.PI,qy={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...qy}};var Q=globalThis.mathgl.config;function la(t,{precision:e=Q.precision}={}){return t=jy(t),`${parseFloat(t.toPrecision(e))}`}function we(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function fa(t){return zu(t)}function ua(t){return ve(t)}function zu(t,e){return ha(t,r=>r*ky,e)}function ve(t,e){return ha(t,r=>r*zy,e)}function $s(t,e,r){return ha(t,n=>Math.max(e,Math.min(r,n)))}function Et(t,e,r){return we(t)?t.map((n,s)=>Et(n,e[s],r)):r*e+(1-r)*t}function be(t,e,r){let n=Q.EPSILON;r&&(Q.EPSILON=r);try{if(t===e)return!0;if(we(t)&&we(e)){if(t.length!==e.length)return!1;for(let s=0;s<t.length;++s)if(!be(t[s],e[s]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):typeof t=="number"&&typeof e=="number"?Math.abs(t-e)<=Q.EPSILON*Math.max(1,Math.abs(t),Math.abs(e)):!1}finally{Q.EPSILON=n}}function jy(t){return Math.round(t/Q.EPSILON)*Q.EPSILON}function Jy(t){return t.clone?t.clone():new Array(t.length)}function ha(t,e,r){if(we(t)){let n=t;r=r||Jy(n);for(let s=0;s<r.length&&s<n.length;++s){let o=typeof t=="number"?t:t[s];r[s]=e(o,s,r)}return r}return e(t)}var Mt=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(e,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=e[n+r];return this.check()}toArray(e=[],r=0){for(let n=0;n<this.ELEMENTS;++n)e[r+n]=this[n];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:we(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Q)}formatString(e){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+la(this[n],e);return`${e.printTypes?this.constructor.name:""}[${r}]`}equals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!be(this[r],e[r]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==e[r])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,r,n){if(n===void 0)return this.lerp(this,e,r);for(let s=0;s<this.ELEMENTS;++s){let o=e[s],i=typeof r=="number"?r:r[s];this[s]=o+n*(i-o)}return this.check()}min(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(e[r],this[r]);return this.check()}max(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(e[r],this[r]);return this.check()}clamp(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e[n]),r[n]);return this.check()}add(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(e){if(typeof e=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;else for(let r=0;r<this.ELEMENTS&&r<e.length;++r)this[r]*=e[r];return this.check()}multiplyByScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}check(){if(Q.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let e=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)e=e&&Number.isFinite(this[r]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=e;return this.check()}addScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e),r);return this.check()}get elements(){return this}};function Wy(t,e){if(t.length!==e)return!1;for(let r=0;r<t.length;++r)if(!Number.isFinite(t[r]))return!1;return!0}function V(t){if(!Number.isFinite(t))throw new Error(`Invalid number ${JSON.stringify(t)}`);return t}function _t(t,e,r=""){if(Q.debug&&!Wy(t,e))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return t}function fe(t,e){if(!t)throw new Error(`math.gl assertion ${e}`)}var Bt=class extends Mt{get x(){return this[0]}set x(e){this[0]=V(e)}get y(){return this[1]}set y(e){this[1]=V(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*this[r];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let r=0;for(let n=0;n<this.ELEMENTS;++n){let s=this[n]-e[n];r+=s*s}return V(r)}dot(e){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*e[n];return V(r)}normalize(){let e=this.magnitude();if(e!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=e;return this.check()}multiply(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return fe(e>=0&&e<this.ELEMENTS,"index is out of range"),V(this[e])}setComponent(e,r){return fe(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=r,this.check()}addVectors(e,r){return this.copy(e).add(r)}subVectors(e,r){return this.copy(e).subtract(r)}multiplyVectors(e,r){return this.copy(e).multiply(r)}addScaledVector(e,r){return this.add(new this.constructor(e).multiplyScalar(r))}};var ee=typeof Float32Array<"u"?Float32Array:Array,xn=Math.random;function wr(t){return t>=0?Math.round(t):t%.5===0?Math.floor(t):Math.round(t)}var rv=Math.PI/180;function Xy(){let t=new ee(2);return ee!=Float32Array&&(t[0]=0,t[1]=0),t}function ku(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s,t[1]=r[1]*n+r[3]*s,t}function qu(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s+r[4],t[1]=r[1]*n+r[3]*s+r[5],t}function eo(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[3]*s+r[6],t[1]=r[1]*n+r[4]*s+r[7],t}function to(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[4]*s+r[12],t[1]=r[1]*n+r[5]*s+r[13],t}var nv=function(){let t=Xy();return function(e,r,n,s,o,i){let a,c;for(r||(r=2),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],o(t,t,i),e[a]=t[0],e[a+1]=t[1];return e}}();function ro(t,e,r){let n=e[0],s=e[1],o=r[3]*n+r[7]*s||1;return t[0]=(r[0]*n+r[4]*s)/o,t[1]=(r[1]*n+r[5]*s)/o,t}function no(t,e,r){let n=e[0],s=e[1],o=e[2],i=r[3]*n+r[7]*s+r[11]*o||1;return t[0]=(r[0]*n+r[4]*s+r[8]*o)/i,t[1]=(r[1]*n+r[5]*s+r[9]*o)/i,t[2]=(r[2]*n+r[6]*s+r[10]*o)/i,t}function ju(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s,t[1]=r[1]*n+r[3]*s,t[2]=e[2],t}function Ju(t,e,r){let n=e[0],s=e[1];return t[0]=r[0]*n+r[2]*s,t[1]=r[1]*n+r[3]*s,t[2]=e[2],t[3]=e[3],t}function so(t,e,r){let n=e[0],s=e[1],o=e[2];return t[0]=r[0]*n+r[3]*s+r[6]*o,t[1]=r[1]*n+r[4]*s+r[7]*o,t[2]=r[2]*n+r[5]*s+r[8]*o,t[3]=e[3],t}var Jt=class extends Bt{constructor(e=0,r=0){super(2),we(e)&&arguments.length===1?this.copy(e):(Q.debug&&(V(e),V(r)),this[0]=e,this[1]=r)}set(e,r){return this[0]=e,this[1]=r,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this.check()}fromObject(e){return Q.debug&&(V(e.x),V(e.y)),this[0]=e.x,this[1]=e.y,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return to(this,this,e),this.check()}transformAsVector(e){return ro(this,this,e),this.check()}transformByMatrix3(e){return eo(this,this,e),this.check()}transformByMatrix2x3(e){return qu(this,this,e),this.check()}transformByMatrix2(e){return ku(this,this,e),this.check()}};var Yt={};me(Yt,{add:()=>Zy,angle:()=>Aa,bezier:()=>uT,ceil:()=>$y,clone:()=>Yy,copy:()=>Ky,create:()=>oo,cross:()=>Wt,dist:()=>TT,distance:()=>Qu,div:()=>yT,divide:()=>Ku,dot:()=>yn,equals:()=>gT,exactEquals:()=>mT,floor:()=>eT,forEach:()=>MT,fromValues:()=>io,hermite:()=>fT,inverse:()=>aT,len:()=>xa,length:()=>Wu,lerp:()=>cT,max:()=>rT,min:()=>tT,mul:()=>xT,multiply:()=>Yu,negate:()=>iT,normalize:()=>da,random:()=>hT,rotateX:()=>pa,rotateY:()=>ma,rotateZ:()=>ga,round:()=>nT,scale:()=>sT,scaleAndAdd:()=>oT,set:()=>Qy,slerp:()=>lT,sqrDist:()=>bT,sqrLen:()=>ET,squaredDistance:()=>Zu,squaredLength:()=>$u,str:()=>pT,sub:()=>AT,subtract:()=>Xu,transformMat3:()=>Tn,transformMat4:()=>Xt,transformQuat:()=>bn,zero:()=>dT});function oo(){let t=new ee(3);return ee!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Yy(t){let e=new ee(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Wu(t){let e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function io(t,e,r){let n=new ee(3);return n[0]=t,n[1]=e,n[2]=r,n}function Ky(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Qy(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function Zy(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function Xu(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function Yu(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function Ku(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}function $y(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function eT(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function tT(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t}function rT(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t}function nT(t,e){return t[0]=wr(e[0]),t[1]=wr(e[1]),t[2]=wr(e[2]),t}function sT(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function oT(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}function Qu(t,e){let r=e[0]-t[0],n=e[1]-t[1],s=e[2]-t[2];return Math.sqrt(r*r+n*n+s*s)}function Zu(t,e){let r=e[0]-t[0],n=e[1]-t[1],s=e[2]-t[2];return r*r+n*n+s*s}function $u(t){let e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}function iT(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function aT(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function da(t,e){let r=e[0],n=e[1],s=e[2],o=r*r+n*n+s*s;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function yn(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Wt(t,e,r){let n=e[0],s=e[1],o=e[2],i=r[0],a=r[1],c=r[2];return t[0]=s*c-o*a,t[1]=o*i-n*c,t[2]=n*a-s*i,t}function cT(t,e,r,n){let s=e[0],o=e[1],i=e[2];return t[0]=s+n*(r[0]-s),t[1]=o+n*(r[1]-o),t[2]=i+n*(r[2]-i),t}function lT(t,e,r,n){let s=Math.acos(Math.min(Math.max(yn(e,r),-1),1)),o=Math.sin(s),i=Math.sin((1-n)*s)/o,a=Math.sin(n*s)/o;return t[0]=i*e[0]+a*r[0],t[1]=i*e[1]+a*r[1],t[2]=i*e[2]+a*r[2],t}function fT(t,e,r,n,s,o){let i=o*o,a=i*(2*o-3)+1,c=i*(o-2)+o,l=i*(o-1),f=i*(3-2*o);return t[0]=e[0]*a+r[0]*c+n[0]*l+s[0]*f,t[1]=e[1]*a+r[1]*c+n[1]*l+s[1]*f,t[2]=e[2]*a+r[2]*c+n[2]*l+s[2]*f,t}function uT(t,e,r,n,s,o){let i=1-o,a=i*i,c=o*o,l=a*i,f=3*o*a,u=3*c*i,h=c*o;return t[0]=e[0]*l+r[0]*f+n[0]*u+s[0]*h,t[1]=e[1]*l+r[1]*f+n[1]*u+s[1]*h,t[2]=e[2]*l+r[2]*f+n[2]*u+s[2]*h,t}function hT(t,e){e=e===void 0?1:e;let r=xn()*2*Math.PI,n=xn()*2-1,s=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(r)*s,t[1]=Math.sin(r)*s,t[2]=n*e,t}function Xt(t,e,r){let n=e[0],s=e[1],o=e[2],i=r[3]*n+r[7]*s+r[11]*o+r[15];return i=i||1,t[0]=(r[0]*n+r[4]*s+r[8]*o+r[12])/i,t[1]=(r[1]*n+r[5]*s+r[9]*o+r[13])/i,t[2]=(r[2]*n+r[6]*s+r[10]*o+r[14])/i,t}function Tn(t,e,r){let n=e[0],s=e[1],o=e[2];return t[0]=n*r[0]+s*r[3]+o*r[6],t[1]=n*r[1]+s*r[4]+o*r[7],t[2]=n*r[2]+s*r[5]+o*r[8],t}function bn(t,e,r){let n=r[0],s=r[1],o=r[2],i=r[3],a=e[0],c=e[1],l=e[2],f=s*l-o*c,u=o*a-n*l,h=n*c-s*a,d=s*h-o*u,p=o*f-n*h,A=n*u-s*f,m=i*2;return f*=m,u*=m,h*=m,d*=2,p*=2,A*=2,t[0]=a+f+d,t[1]=c+u+p,t[2]=l+h+A,t}function pa(t,e,r,n){let s=[],o=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[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),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function ma(t,e,r,n){let s=[],o=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[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),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function ga(t,e,r,n){let s=[],o=[];return s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[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],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function Aa(t,e){let r=t[0],n=t[1],s=t[2],o=e[0],i=e[1],a=e[2],c=Math.sqrt((r*r+n*n+s*s)*(o*o+i*i+a*a)),l=c&&yn(t,e)/c;return Math.acos(Math.min(Math.max(l,-1),1))}function dT(t){return t[0]=0,t[1]=0,t[2]=0,t}function pT(t){return`vec3(${t[0]}, ${t[1]}, ${t[2]})`}function mT(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function gT(t,e){let r=t[0],n=t[1],s=t[2],o=e[0],i=e[1],a=e[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 AT=Xu,xT=Yu,yT=Ku,TT=Qu,bT=Zu,xa=Wu,ET=$u,MT=function(){let t=oo();return function(e,r,n,s,o,i){let a,c;for(r||(r=3),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],o(t,t,i),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2];return e}}();var ya=[0,0,0],ao,x=class extends Bt{static get ZERO(){return ao||(ao=new x(0,0,0),Object.freeze(ao)),ao}constructor(e=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&we(e)?this.copy(e):(Q.debug&&(V(e),V(r),V(n)),this[0]=e,this[1]=r,this[2]=n)}set(e,r,n){return this[0]=e,this[1]=r,this[2]=n,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return Q.debug&&(V(e.x),V(e.y),V(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=V(e)}angle(e){return Aa(this,e)}cross(e){return Wt(this,this,e),this.check()}rotateX({radians:e,origin:r=ya}){return pa(this,this,r,e),this.check()}rotateY({radians:e,origin:r=ya}){return ma(this,this,r,e),this.check()}rotateZ({radians:e,origin:r=ya}){return ga(this,this,r,e),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return Xt(this,this,e),this.check()}transformAsVector(e){return no(this,this,e),this.check()}transformByMatrix3(e){return Tn(this,this,e),this.check()}transformByMatrix2(e){return ju(this,this,e),this.check()}transformByQuaternion(e){return bn(this,this,e),this.check()}};var co,Lr=class extends Bt{static get ZERO(){return co||(co=new Lr(0,0,0,0),Object.freeze(co)),co}constructor(e=0,r=0,n=0,s=0){super(-0,-0,-0,-0),we(e)&&arguments.length===1?this.copy(e):(Q.debug&&(V(e),V(r),V(n),V(s)),this[0]=e,this[1]=r,this[2]=n,this[3]=s)}set(e,r,n,s){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}fromObject(e){return Q.debug&&(V(e.x),V(e.y),V(e.z),V(e.w)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e.w=this[3],e}get ELEMENTS(){return 4}get z(){return this[2]}set z(e){this[2]=V(e)}get w(){return this[3]}set w(e){this[3]=V(e)}transform(e){return Xt(this,this,e),this.check()}transformByMatrix3(e){return so(this,this,e),this.check()}transformByMatrix2(e){return Ju(this,this,e),this.check()}transformByQuaternion(e){return bn(this,this,e),this.check()}applyMatrix4(e){return e.transform(this,this),this}};var Fr=class extends Mt{toString(){let e="[";if(Q.printRowMajor){e+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)e+=` ${this[n*this.RANK+r]}`}else{e+="column-major:";for(let r=0;r<this.ELEMENTS;++r)e+=` ${this[r]}`}return e+="]",e}getElementIndex(e,r){return r*this.RANK+e}getElement(e,r){return this[r*this.RANK+e]}setElement(e,r,n){return this[r*this.RANK+e]=V(n),this}getColumn(e,r=new Array(this.RANK).fill(-0)){let n=e*this.RANK;for(let s=0;s<this.RANK;++s)r[s]=this[n+s];return r}setColumn(e,r){let n=e*this.RANK;for(let s=0;s<this.RANK;++s)this[n+s]=r[s];return this}};function eh(){let t=new ee(9);return ee!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function th(t,e){if(t===e){let r=e[1],n=e[2],s=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=s}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function rh(t,e){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],f=e[8],u=f*i-a*l,h=-f*o+a*c,d=l*o-i*c,p=r*u+n*h+s*d;return p?(p=1/p,t[0]=u*p,t[1]=(-f*n+s*l)*p,t[2]=(a*n-s*i)*p,t[3]=h*p,t[4]=(f*r-s*c)*p,t[5]=(-a*r+s*o)*p,t[6]=d*p,t[7]=(-l*r+n*c)*p,t[8]=(i*r-n*o)*p,t):null}function nh(t){let e=t[0],r=t[1],n=t[2],s=t[3],o=t[4],i=t[5],a=t[6],c=t[7],l=t[8];return e*(l*o-i*c)+r*(-l*s+i*a)+n*(c*s-o*a)}function Ta(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3],a=e[4],c=e[5],l=e[6],f=e[7],u=e[8],h=r[0],d=r[1],p=r[2],A=r[3],m=r[4],y=r[5],b=r[6],E=r[7],M=r[8];return t[0]=h*n+d*i+p*l,t[1]=h*s+d*a+p*f,t[2]=h*o+d*c+p*u,t[3]=A*n+m*i+y*l,t[4]=A*s+m*a+y*f,t[5]=A*o+m*c+y*u,t[6]=b*n+E*i+M*l,t[7]=b*s+E*a+M*f,t[8]=b*o+E*c+M*u,t}function sh(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3],a=e[4],c=e[5],l=e[6],f=e[7],u=e[8],h=r[0],d=r[1];return t[0]=n,t[1]=s,t[2]=o,t[3]=i,t[4]=a,t[5]=c,t[6]=h*n+d*i+l,t[7]=h*s+d*a+f,t[8]=h*o+d*c+u,t}function oh(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3],a=e[4],c=e[5],l=e[6],f=e[7],u=e[8],h=Math.sin(r),d=Math.cos(r);return t[0]=d*n+h*i,t[1]=d*s+h*a,t[2]=d*o+h*c,t[3]=d*i-h*n,t[4]=d*a-h*s,t[5]=d*c-h*o,t[6]=l,t[7]=f,t[8]=u,t}function ba(t,e,r){let n=r[0],s=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=s*e[3],t[4]=s*e[4],t[5]=s*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function ih(t,e){let r=e[0],n=e[1],s=e[2],o=e[3],i=r+r,a=n+n,c=s+s,l=r*i,f=n*i,u=n*a,h=s*i,d=s*a,p=s*c,A=o*i,m=o*a,y=o*c;return t[0]=1-u-p,t[3]=f-y,t[6]=h+m,t[1]=f+y,t[4]=1-l-p,t[7]=d-A,t[2]=h-m,t[5]=d+A,t[8]=1-l-u,t}var Ea;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL1ROW0=3]="COL1ROW0",t[t.COL1ROW1=4]="COL1ROW1",t[t.COL1ROW2=5]="COL1ROW2",t[t.COL2ROW0=6]="COL2ROW0",t[t.COL2ROW1=7]="COL2ROW1",t[t.COL2ROW2=8]="COL2ROW2"})(Ea||(Ea={}));var BT=Object.freeze([1,0,0,0,1,0,0,0,1]),j=class extends Fr{static get IDENTITY(){return ST()}static get ZERO(){return CT()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Ea}constructor(e,...r){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):r.length>0?this.copy([e,...r]):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}identity(){return this.copy(BT)}fromObject(e){return this.check()}fromQuaternion(e){return ih(this,e),this.check()}set(e,r,n,s,o,i,a,c,l){return this[0]=e,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(e,r,n,s,o,i,a,c,l){return this[0]=e,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 nh(this)}transpose(){return th(this,this),this.check()}invert(){return rh(this,this),this.check()}multiplyLeft(e){return Ta(this,e,this),this.check()}multiplyRight(e){return Ta(this,this,e),this.check()}rotate(e){return oh(this,this,e),this.check()}scale(e){return Array.isArray(e)?ba(this,this,e):ba(this,this,[e,e]),this.check()}translate(e){return sh(this,this,e),this.check()}transform(e,r){let n;switch(e.length){case 2:n=eo(r||[-0,-0],e,this);break;case 3:n=Tn(r||[-0,-0,-0],e,this);break;case 4:n=so(r||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return _t(n,e.length),n}transformVector(e,r){return this.transform(e,r)}transformVector2(e,r){return this.transform(e,r)}transformVector3(e,r){return this.transform(e,r)}},lo,fo=null;function CT(){return lo||(lo=new j([0,0,0,0,0,0,0,0,0]),Object.freeze(lo)),lo}function ST(){return fo||(fo=new j,Object.freeze(fo)),fo}var Mn={};me(Mn,{add:()=>ZT,adjoint:()=>RT,clone:()=>wT,copy:()=>vT,create:()=>IT,decompose:()=>kT,determinant:()=>Ba,equals:()=>rb,exactEquals:()=>tb,frob:()=>QT,fromQuat:()=>Fa,fromQuat2:()=>VT,fromRotation:()=>NT,fromRotationTranslation:()=>ch,fromRotationTranslationScale:()=>qT,fromRotationTranslationScaleOrigin:()=>jT,fromScaling:()=>OT,fromTranslation:()=>PT,fromValues:()=>LT,fromXRotation:()=>DT,fromYRotation:()=>GT,fromZRotation:()=>UT,frustum:()=>Ra,getRotation:()=>zT,getScaling:()=>lh,getTranslation:()=>HT,identity:()=>ah,invert:()=>_a,lookAt:()=>Na,mul:()=>nb,multiply:()=>En,multiplyScalar:()=>$T,multiplyScalarAndAdd:()=>eb,ortho:()=>Oa,orthoNO:()=>uh,orthoZO:()=>XT,perspective:()=>Pa,perspectiveFromFieldOfView:()=>WT,perspectiveNO:()=>fh,perspectiveZO:()=>JT,rotate:()=>Ia,rotateX:()=>wa,rotateY:()=>va,rotateZ:()=>La,scale:()=>Sa,set:()=>FT,str:()=>KT,sub:()=>sb,subtract:()=>hh,targetTo:()=>YT,translate:()=>Ca,transpose:()=>Ma});function IT(){let t=new ee(16);return ee!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function wT(t){let e=new ee(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function vT(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function LT(t,e,r,n,s,o,i,a,c,l,f,u,h,d,p,A){let m=new ee(16);return m[0]=t,m[1]=e,m[2]=r,m[3]=n,m[4]=s,m[5]=o,m[6]=i,m[7]=a,m[8]=c,m[9]=l,m[10]=f,m[11]=u,m[12]=h,m[13]=d,m[14]=p,m[15]=A,m}function FT(t,e,r,n,s,o,i,a,c,l,f,u,h,d,p,A,m){return t[0]=e,t[1]=r,t[2]=n,t[3]=s,t[4]=o,t[5]=i,t[6]=a,t[7]=c,t[8]=l,t[9]=f,t[10]=u,t[11]=h,t[12]=d,t[13]=p,t[14]=A,t[15]=m,t}function ah(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Ma(t,e){if(t===e){let r=e[1],n=e[2],s=e[3],o=e[6],i=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=s,t[13]=i,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function _a(t,e){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],f=e[8],u=e[9],h=e[10],d=e[11],p=e[12],A=e[13],m=e[14],y=e[15],b=r*a-n*i,E=r*c-s*i,M=r*l-o*i,B=n*c-s*a,C=n*l-o*a,v=s*l-o*c,_=f*A-u*p,T=f*m-h*p,g=f*y-d*p,S=u*m-h*A,F=u*y-d*A,R=h*y-d*m,L=b*R-E*F+M*S+B*g-C*T+v*_;return L?(L=1/L,t[0]=(a*R-c*F+l*S)*L,t[1]=(s*F-n*R-o*S)*L,t[2]=(A*v-m*C+y*B)*L,t[3]=(h*C-u*v-d*B)*L,t[4]=(c*g-i*R-l*T)*L,t[5]=(r*R-s*g+o*T)*L,t[6]=(m*M-p*v-y*E)*L,t[7]=(f*v-h*M+d*E)*L,t[8]=(i*F-a*g+l*_)*L,t[9]=(n*g-r*F-o*_)*L,t[10]=(p*C-A*M+y*b)*L,t[11]=(u*M-f*C-d*b)*L,t[12]=(a*T-i*S-c*_)*L,t[13]=(r*S-n*T+s*_)*L,t[14]=(A*E-p*B-m*b)*L,t[15]=(f*B-u*E+h*b)*L,t):null}function RT(t,e){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],f=e[8],u=e[9],h=e[10],d=e[11],p=e[12],A=e[13],m=e[14],y=e[15],b=r*a-n*i,E=r*c-s*i,M=r*l-o*i,B=n*c-s*a,C=n*l-o*a,v=s*l-o*c,_=f*A-u*p,T=f*m-h*p,g=f*y-d*p,S=u*m-h*A,F=u*y-d*A,R=h*y-d*m;return t[0]=a*R-c*F+l*S,t[1]=s*F-n*R-o*S,t[2]=A*v-m*C+y*B,t[3]=h*C-u*v-d*B,t[4]=c*g-i*R-l*T,t[5]=r*R-s*g+o*T,t[6]=m*M-p*v-y*E,t[7]=f*v-h*M+d*E,t[8]=i*F-a*g+l*_,t[9]=n*g-r*F-o*_,t[10]=p*C-A*M+y*b,t[11]=u*M-f*C-d*b,t[12]=a*T-i*S-c*_,t[13]=r*S-n*T+s*_,t[14]=A*E-p*B-m*b,t[15]=f*B-u*E+h*b,t}function Ba(t){let e=t[0],r=t[1],n=t[2],s=t[3],o=t[4],i=t[5],a=t[6],c=t[7],l=t[8],f=t[9],u=t[10],h=t[11],d=t[12],p=t[13],A=t[14],m=t[15],y=e*i-r*o,b=e*a-n*o,E=r*a-n*i,M=l*p-f*d,B=l*A-u*d,C=f*A-u*p,v=e*C-r*B+n*M,_=o*C-i*B+a*M,T=l*E-f*b+u*y,g=d*E-p*b+A*y;return c*v-s*_+m*T-h*g}function En(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3],a=e[4],c=e[5],l=e[6],f=e[7],u=e[8],h=e[9],d=e[10],p=e[11],A=e[12],m=e[13],y=e[14],b=e[15],E=r[0],M=r[1],B=r[2],C=r[3];return t[0]=E*n+M*a+B*u+C*A,t[1]=E*s+M*c+B*h+C*m,t[2]=E*o+M*l+B*d+C*y,t[3]=E*i+M*f+B*p+C*b,E=r[4],M=r[5],B=r[6],C=r[7],t[4]=E*n+M*a+B*u+C*A,t[5]=E*s+M*c+B*h+C*m,t[6]=E*o+M*l+B*d+C*y,t[7]=E*i+M*f+B*p+C*b,E=r[8],M=r[9],B=r[10],C=r[11],t[8]=E*n+M*a+B*u+C*A,t[9]=E*s+M*c+B*h+C*m,t[10]=E*o+M*l+B*d+C*y,t[11]=E*i+M*f+B*p+C*b,E=r[12],M=r[13],B=r[14],C=r[15],t[12]=E*n+M*a+B*u+C*A,t[13]=E*s+M*c+B*h+C*m,t[14]=E*o+M*l+B*d+C*y,t[15]=E*i+M*f+B*p+C*b,t}function Ca(t,e,r){let n=r[0],s=r[1],o=r[2],i,a,c,l,f,u,h,d,p,A,m,y;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*o+e[12],t[13]=e[1]*n+e[5]*s+e[9]*o+e[13],t[14]=e[2]*n+e[6]*s+e[10]*o+e[14],t[15]=e[3]*n+e[7]*s+e[11]*o+e[15]):(i=e[0],a=e[1],c=e[2],l=e[3],f=e[4],u=e[5],h=e[6],d=e[7],p=e[8],A=e[9],m=e[10],y=e[11],t[0]=i,t[1]=a,t[2]=c,t[3]=l,t[4]=f,t[5]=u,t[6]=h,t[7]=d,t[8]=p,t[9]=A,t[10]=m,t[11]=y,t[12]=i*n+f*s+p*o+e[12],t[13]=a*n+u*s+A*o+e[13],t[14]=c*n+h*s+m*o+e[14],t[15]=l*n+d*s+y*o+e[15]),t}function Sa(t,e,r){let n=r[0],s=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Ia(t,e,r,n){let s=n[0],o=n[1],i=n[2],a=Math.sqrt(s*s+o*o+i*i),c,l,f,u,h,d,p,A,m,y,b,E,M,B,C,v,_,T,g,S,F,R,L,G;return a<1e-6?null:(a=1/a,s*=a,o*=a,i*=a,l=Math.sin(r),c=Math.cos(r),f=1-c,u=e[0],h=e[1],d=e[2],p=e[3],A=e[4],m=e[5],y=e[6],b=e[7],E=e[8],M=e[9],B=e[10],C=e[11],v=s*s*f+c,_=o*s*f+i*l,T=i*s*f-o*l,g=s*o*f-i*l,S=o*o*f+c,F=i*o*f+s*l,R=s*i*f+o*l,L=o*i*f-s*l,G=i*i*f+c,t[0]=u*v+A*_+E*T,t[1]=h*v+m*_+M*T,t[2]=d*v+y*_+B*T,t[3]=p*v+b*_+C*T,t[4]=u*g+A*S+E*F,t[5]=h*g+m*S+M*F,t[6]=d*g+y*S+B*F,t[7]=p*g+b*S+C*F,t[8]=u*R+A*L+E*G,t[9]=h*R+m*L+M*G,t[10]=d*R+y*L+B*G,t[11]=p*R+b*L+C*G,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function wa(t,e,r){let n=Math.sin(r),s=Math.cos(r),o=e[4],i=e[5],a=e[6],c=e[7],l=e[8],f=e[9],u=e[10],h=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*s+l*n,t[5]=i*s+f*n,t[6]=a*s+u*n,t[7]=c*s+h*n,t[8]=l*s-o*n,t[9]=f*s-i*n,t[10]=u*s-a*n,t[11]=h*s-c*n,t}function va(t,e,r){let n=Math.sin(r),s=Math.cos(r),o=e[0],i=e[1],a=e[2],c=e[3],l=e[8],f=e[9],u=e[10],h=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*s-l*n,t[1]=i*s-f*n,t[2]=a*s-u*n,t[3]=c*s-h*n,t[8]=o*n+l*s,t[9]=i*n+f*s,t[10]=a*n+u*s,t[11]=c*n+h*s,t}function La(t,e,r){let n=Math.sin(r),s=Math.cos(r),o=e[0],i=e[1],a=e[2],c=e[3],l=e[4],f=e[5],u=e[6],h=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*s+l*n,t[1]=i*s+f*n,t[2]=a*s+u*n,t[3]=c*s+h*n,t[4]=l*s-o*n,t[5]=f*s-i*n,t[6]=u*s-a*n,t[7]=h*s-c*n,t}function PT(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function OT(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function NT(t,e,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(e),a=Math.cos(e),l=1-a,t[0]=n*n*l+a,t[1]=s*n*l+o*c,t[2]=o*n*l-s*c,t[3]=0,t[4]=n*s*l-o*c,t[5]=s*s*l+a,t[6]=o*s*l+n*c,t[7]=0,t[8]=n*o*l+s*c,t[9]=s*o*l-n*c,t[10]=o*o*l+a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function DT(t,e){let r=Math.sin(e),n=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function GT(t,e){let r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function UT(t,e){let r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=n,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ch(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3],a=n+n,c=s+s,l=o+o,f=n*a,u=n*c,h=n*l,d=s*c,p=s*l,A=o*l,m=i*a,y=i*c,b=i*l;return t[0]=1-(d+A),t[1]=u+b,t[2]=h-y,t[3]=0,t[4]=u-b,t[5]=1-(f+A),t[6]=p+m,t[7]=0,t[8]=h+y,t[9]=p-m,t[10]=1-(f+d),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function VT(t,e){let r=new ee(3),n=-e[0],s=-e[1],o=-e[2],i=e[3],a=e[4],c=e[5],l=e[6],f=e[7],u=n*n+s*s+o*o+i*i;return u>0?(r[0]=(a*i+f*n+c*o-l*s)*2/u,r[1]=(c*i+f*s+l*n-a*o)*2/u,r[2]=(l*i+f*o+a*s-c*n)*2/u):(r[0]=(a*i+f*n+c*o-l*s)*2,r[1]=(c*i+f*s+l*n-a*o)*2,r[2]=(l*i+f*o+a*s-c*n)*2),ch(t,e,r),t}function HT(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function lh(t,e){let r=e[0],n=e[1],s=e[2],o=e[4],i=e[5],a=e[6],c=e[8],l=e[9],f=e[10];return t[0]=Math.sqrt(r*r+n*n+s*s),t[1]=Math.sqrt(o*o+i*i+a*a),t[2]=Math.sqrt(c*c+l*l+f*f),t}function zT(t,e){let r=new ee(3);lh(r,e);let n=1/r[0],s=1/r[1],o=1/r[2],i=e[0]*n,a=e[1]*s,c=e[2]*o,l=e[4]*n,f=e[5]*s,u=e[6]*o,h=e[8]*n,d=e[9]*s,p=e[10]*o,A=i+f+p,m=0;return A>0?(m=Math.sqrt(A+1)*2,t[3]=.25*m,t[0]=(u-d)/m,t[1]=(h-c)/m,t[2]=(a-l)/m):i>f&&i>p?(m=Math.sqrt(1+i-f-p)*2,t[3]=(u-d)/m,t[0]=.25*m,t[1]=(a+l)/m,t[2]=(h+c)/m):f>p?(m=Math.sqrt(1+f-i-p)*2,t[3]=(h-c)/m,t[0]=(a+l)/m,t[1]=.25*m,t[2]=(u+d)/m):(m=Math.sqrt(1+p-i-f)*2,t[3]=(a-l)/m,t[0]=(h+c)/m,t[1]=(u+d)/m,t[2]=.25*m),t}function kT(t,e,r,n){e[0]=n[12],e[1]=n[13],e[2]=n[14];let s=n[0],o=n[1],i=n[2],a=n[4],c=n[5],l=n[6],f=n[8],u=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(f*f+u*u+h*h);let d=1/r[0],p=1/r[1],A=1/r[2],m=s*d,y=o*p,b=i*A,E=a*d,M=c*p,B=l*A,C=f*d,v=u*p,_=h*A,T=m+M+_,g=0;return T>0?(g=Math.sqrt(T+1)*2,t[3]=.25*g,t[0]=(B-v)/g,t[1]=(C-b)/g,t[2]=(y-E)/g):m>M&&m>_?(g=Math.sqrt(1+m-M-_)*2,t[3]=(B-v)/g,t[0]=.25*g,t[1]=(y+E)/g,t[2]=(C+b)/g):M>_?(g=Math.sqrt(1+M-m-_)*2,t[3]=(C-b)/g,t[0]=(y+E)/g,t[1]=.25*g,t[2]=(B+v)/g):(g=Math.sqrt(1+_-m-M)*2,t[3]=(y-E)/g,t[0]=(C+b)/g,t[1]=(B+v)/g,t[2]=.25*g),t}function qT(t,e,r,n){let s=e[0],o=e[1],i=e[2],a=e[3],c=s+s,l=o+o,f=i+i,u=s*c,h=s*l,d=s*f,p=o*l,A=o*f,m=i*f,y=a*c,b=a*l,E=a*f,M=n[0],B=n[1],C=n[2];return t[0]=(1-(p+m))*M,t[1]=(h+E)*M,t[2]=(d-b)*M,t[3]=0,t[4]=(h-E)*B,t[5]=(1-(u+m))*B,t[6]=(A+y)*B,t[7]=0,t[8]=(d+b)*C,t[9]=(A-y)*C,t[10]=(1-(u+p))*C,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function jT(t,e,r,n,s){let o=e[0],i=e[1],a=e[2],c=e[3],l=o+o,f=i+i,u=a+a,h=o*l,d=o*f,p=o*u,A=i*f,m=i*u,y=a*u,b=c*l,E=c*f,M=c*u,B=n[0],C=n[1],v=n[2],_=s[0],T=s[1],g=s[2],S=(1-(A+y))*B,F=(d+M)*B,R=(p-E)*B,L=(d-M)*C,G=(1-(h+y))*C,W=(m+b)*C,z=(p+E)*v,te=(m-b)*v,K=(1-(h+A))*v;return t[0]=S,t[1]=F,t[2]=R,t[3]=0,t[4]=L,t[5]=G,t[6]=W,t[7]=0,t[8]=z,t[9]=te,t[10]=K,t[11]=0,t[12]=r[0]+_-(S*_+L*T+z*g),t[13]=r[1]+T-(F*_+G*T+te*g),t[14]=r[2]+g-(R*_+W*T+K*g),t[15]=1,t}function Fa(t,e){let r=e[0],n=e[1],s=e[2],o=e[3],i=r+r,a=n+n,c=s+s,l=r*i,f=n*i,u=n*a,h=s*i,d=s*a,p=s*c,A=o*i,m=o*a,y=o*c;return t[0]=1-u-p,t[1]=f+y,t[2]=h-m,t[3]=0,t[4]=f-y,t[5]=1-l-p,t[6]=d+A,t[7]=0,t[8]=h+m,t[9]=d-A,t[10]=1-l-u,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Ra(t,e,r,n,s,o,i){let a=1/(r-e),c=1/(s-n),l=1/(o-i);return t[0]=o*2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o*2*c,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(s+n)*c,t[10]=(i+o)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=i*o*2*l,t[15]=0,t}function fh(t,e,r,n,s){let o=1/Math.tan(e/2);if(t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,s!=null&&s!==1/0){let i=1/(n-s);t[10]=(s+n)*i,t[14]=2*s*n*i}else t[10]=-1,t[14]=-2*n;return t}var Pa=fh;function JT(t,e,r,n,s){let o=1/Math.tan(e/2);if(t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,s!=null&&s!==1/0){let i=1/(n-s);t[10]=s*i,t[14]=s*n*i}else t[10]=-1,t[14]=-n;return t}function WT(t,e,r,n){let s=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),i=Math.tan(e.leftDegrees*Math.PI/180),a=Math.tan(e.rightDegrees*Math.PI/180),c=2/(i+a),l=2/(s+o);return t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=l,t[6]=0,t[7]=0,t[8]=-((i-a)*c*.5),t[9]=(s-o)*l*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t}function uh(t,e,r,n,s,o,i){let a=1/(e-r),c=1/(n-s),l=1/(o-i);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+r)*a,t[13]=(s+n)*c,t[14]=(i+o)*l,t[15]=1,t}var Oa=uh;function XT(t,e,r,n,s,o,i){let a=1/(e-r),c=1/(n-s),l=1/(o-i);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=l,t[11]=0,t[12]=(e+r)*a,t[13]=(s+n)*c,t[14]=o*l,t[15]=1,t}function Na(t,e,r,n){let s,o,i,a,c,l,f,u,h,d,p=e[0],A=e[1],m=e[2],y=n[0],b=n[1],E=n[2],M=r[0],B=r[1],C=r[2];return Math.abs(p-M)<1e-6&&Math.abs(A-B)<1e-6&&Math.abs(m-C)<1e-6?ah(t):(u=p-M,h=A-B,d=m-C,s=1/Math.sqrt(u*u+h*h+d*d),u*=s,h*=s,d*=s,o=b*d-E*h,i=E*u-y*d,a=y*h-b*u,s=Math.sqrt(o*o+i*i+a*a),s?(s=1/s,o*=s,i*=s,a*=s):(o=0,i=0,a=0),c=h*a-d*i,l=d*o-u*a,f=u*i-h*o,s=Math.sqrt(c*c+l*l+f*f),s?(s=1/s,c*=s,l*=s,f*=s):(c=0,l=0,f=0),t[0]=o,t[1]=c,t[2]=u,t[3]=0,t[4]=i,t[5]=l,t[6]=h,t[7]=0,t[8]=a,t[9]=f,t[10]=d,t[11]=0,t[12]=-(o*p+i*A+a*m),t[13]=-(c*p+l*A+f*m),t[14]=-(u*p+h*A+d*m),t[15]=1,t)}function YT(t,e,r,n){let s=e[0],o=e[1],i=e[2],a=n[0],c=n[1],l=n[2],f=s-r[0],u=o-r[1],h=i-r[2],d=f*f+u*u+h*h;d>0&&(d=1/Math.sqrt(d),f*=d,u*=d,h*=d);let p=c*h-l*u,A=l*f-a*h,m=a*u-c*f;return d=p*p+A*A+m*m,d>0&&(d=1/Math.sqrt(d),p*=d,A*=d,m*=d),t[0]=p,t[1]=A,t[2]=m,t[3]=0,t[4]=u*m-h*A,t[5]=h*p-f*m,t[6]=f*A-u*p,t[7]=0,t[8]=f,t[9]=u,t[10]=h,t[11]=0,t[12]=s,t[13]=o,t[14]=i,t[15]=1,t}function KT(t){return`mat4(${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}, ${t[4]}, ${t[5]}, ${t[6]}, ${t[7]}, ${t[8]}, ${t[9]}, ${t[10]}, ${t[11]}, ${t[12]}, ${t[13]}, ${t[14]}, ${t[15]})`}function QT(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+t[6]*t[6]+t[7]*t[7]+t[8]*t[8]+t[9]*t[9]+t[10]*t[10]+t[11]*t[11]+t[12]*t[12]+t[13]*t[13]+t[14]*t[14]+t[15]*t[15])}function ZT(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t}function hh(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}function $T(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t}function eb(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t}function tb(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function rb(t,e){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],f=t[8],u=t[9],h=t[10],d=t[11],p=t[12],A=t[13],m=t[14],y=t[15],b=e[0],E=e[1],M=e[2],B=e[3],C=e[4],v=e[5],_=e[6],T=e[7],g=e[8],S=e[9],F=e[10],R=e[11],L=e[12],G=e[13],W=e[14],z=e[15];return Math.abs(r-b)<=1e-6*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(s-M)<=1e-6*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(o-B)<=1e-6*Math.max(1,Math.abs(o),Math.abs(B))&&Math.abs(i-C)<=1e-6*Math.max(1,Math.abs(i),Math.abs(C))&&Math.abs(a-v)<=1e-6*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(c-_)<=1e-6*Math.max(1,Math.abs(c),Math.abs(_))&&Math.abs(l-T)<=1e-6*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(f-g)<=1e-6*Math.max(1,Math.abs(f),Math.abs(g))&&Math.abs(u-S)<=1e-6*Math.max(1,Math.abs(u),Math.abs(S))&&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-G)<=1e-6*Math.max(1,Math.abs(A),Math.abs(G))&&Math.abs(m-W)<=1e-6*Math.max(1,Math.abs(m),Math.abs(W))&&Math.abs(y-z)<=1e-6*Math.max(1,Math.abs(y),Math.abs(z))}var nb=En,sb=hh;function ob(){let t=new ee(4);return ee!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function dh(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function ph(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function mh(t){let e=t[0],r=t[1],n=t[2],s=t[3];return Math.sqrt(e*e+r*r+n*n+s*s)}function gh(t){let e=t[0],r=t[1],n=t[2],s=t[3];return e*e+r*r+n*n+s*s}function Ah(t,e){let r=e[0],n=e[1],s=e[2],o=e[3],i=r*r+n*n+s*s+o*o;return i>0&&(i=1/Math.sqrt(i)),t[0]=r*i,t[1]=n*i,t[2]=s*i,t[3]=o*i,t}function xh(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function yh(t,e,r,n){let s=e[0],o=e[1],i=e[2],a=e[3];return t[0]=s+n*(r[0]-s),t[1]=o+n*(r[1]-o),t[2]=i+n*(r[2]-i),t[3]=a+n*(r[3]-a),t}function Th(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3];return t[0]=r[0]*n+r[4]*s+r[8]*o+r[12]*i,t[1]=r[1]*n+r[5]*s+r[9]*o+r[13]*i,t[2]=r[2]*n+r[6]*s+r[10]*o+r[14]*i,t[3]=r[3]*n+r[7]*s+r[11]*o+r[15]*i,t}function bh(t,e,r){let n=e[0],s=e[1],o=e[2],i=r[0],a=r[1],c=r[2],l=r[3],f=l*n+a*o-c*s,u=l*s+c*n-i*o,h=l*o+i*s-a*n,d=-i*n-a*s-c*o;return t[0]=f*l+d*-i+u*-c-h*-a,t[1]=u*l+d*-a+h*-i-f*-c,t[2]=h*l+d*-c+f*-a-u*-i,t[3]=e[3],t}var Ov=function(){let t=ob();return function(e,r,n,s,o,i){let a,c;for(r||(r=4),n||(n=0),s?c=Math.min(s*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],t[3]=e[a+3],o(t,t,i),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2],e[a+3]=t[3];return e}}();var Ua;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"})(Ua||(Ua={}));var ab=45*Math.PI/180,cb=1,Da=.1,Ga=500,lb=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),O=class extends Fr{static get IDENTITY(){return ub()}static get ZERO(){return fb()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Ua}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,r,n,s,o,i,a,c,l,f,u,h,d,p,A,m){return this[0]=e,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]=f,this[10]=u,this[11]=h,this[12]=d,this[13]=p,this[14]=A,this[15]=m,this.check()}setRowMajor(e,r,n,s,o,i,a,c,l,f,u,h,d,p,A,m){return this[0]=e,this[1]=o,this[2]=l,this[3]=d,this[4]=r,this[5]=i,this[6]=f,this[7]=p,this[8]=n,this[9]=a,this[10]=u,this[11]=A,this[12]=s,this[13]=c,this[14]=h,this[15]=m,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(lb)}fromObject(e){return this.check()}fromQuaternion(e){return Fa(this,e),this.check()}frustum(e){let{left:r,right:n,bottom:s,top:o,near:i=Da,far:a=Ga}=e;return a===1/0?hb(this,r,n,s,o,i):Ra(this,r,n,s,o,i,a),this.check()}lookAt(e){let{eye:r,center:n=[0,0,0],up:s=[0,1,0]}=e;return Na(this,r,n,s),this.check()}ortho(e){let{left:r,right:n,bottom:s,top:o,near:i=Da,far:a=Ga}=e;return Oa(this,r,n,s,o,i,a),this.check()}orthographic(e){let{fovy:r=ab,aspect:n=cb,focalDistance:s=1,near:o=Da,far:i=Ga}=e;Eh(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(e){let{fovy:r=45*Math.PI/180,aspect:n=1,near:s=.1,far:o=500}=e;return Eh(r),Pa(this,r,n,s,o),this.check()}determinant(){return Ba(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],o=1/n[1],i=1/n[2];return e[0]=this[0]*s,e[1]=this[1]*o,e[2]=this[2]*i,e[3]=0,e[4]=this[4]*s,e[5]=this[5]*o,e[6]=this[6]*i,e[7]=0,e[8]=this[8]*s,e[9]=this[9]*o,e[10]=this[10]*i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],o=1/n[1],i=1/n[2];return e[0]=this[0]*s,e[1]=this[1]*o,e[2]=this[2]*i,e[3]=this[4]*s,e[4]=this[5]*o,e[5]=this[6]*i,e[6]=this[8]*s,e[7]=this[9]*o,e[8]=this[10]*i,e}transpose(){return Ma(this,this),this.check()}invert(){return _a(this,this),this.check()}multiplyLeft(e){return En(this,e,this),this.check()}multiplyRight(e){return En(this,this,e),this.check()}rotateX(e){return wa(this,this,e),this.check()}rotateY(e){return va(this,this,e),this.check()}rotateZ(e){return La(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,r){return Ia(this,this,e,r),this.check()}scale(e){return Sa(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return Ca(this,this,e),this.check()}transform(e,r){return e.length===4?(r=Th(r||[-0,-0,-0,-0],e,this),_t(r,4),r):this.transformAsPoint(e,r)}transformAsPoint(e,r){let{length:n}=e,s;switch(n){case 2:s=to(r||[-0,-0],e,this);break;case 3:s=Xt(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return _t(s,e.length),s}transformAsVector(e,r){let n;switch(e.length){case 2:n=ro(r||[-0,-0],e,this);break;case 3:n=no(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return _t(n,e.length),n}transformPoint(e,r){return this.transformAsPoint(e,r)}transformVector(e,r){return this.transformAsPoint(e,r)}transformDirection(e,r){return this.transformAsVector(e,r)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,r,n){return this.identity().translate([e,r,n])}},uo,ho;function fb(){return uo||(uo=new O([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(uo)),uo}function ub(){return ho||(ho=new O,Object.freeze(ho)),ho}function Eh(t){if(t>Math.PI*2)throw Error("expected radians")}function hb(t,e,r,n,s,o){let i=2*o/(r-e),a=2*o/(s-n),c=(r+e)/(r-e),l=(s+n)/(s-n),f=-1,u=-1,h=-2*o;return t[0]=i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=c,t[9]=l,t[10]=f,t[11]=u,t[12]=0,t[13]=0,t[14]=h,t[15]=0,t}function Mh(){let t=new ee(4);return ee!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function _h(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function Va(t,e,r){r=r*.5;let n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t}function Ha(t,e,r){let n=e[0],s=e[1],o=e[2],i=e[3],a=r[0],c=r[1],l=r[2],f=r[3];return t[0]=n*f+i*a+s*l-o*c,t[1]=s*f+i*c+o*a-n*l,t[2]=o*f+i*l+n*c-s*a,t[3]=i*f-n*a-s*c-o*l,t}function Bh(t,e,r){r*=.5;let n=e[0],s=e[1],o=e[2],i=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c+i*a,t[1]=s*c+o*a,t[2]=o*c-s*a,t[3]=i*c-n*a,t}function Ch(t,e,r){r*=.5;let n=e[0],s=e[1],o=e[2],i=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c-o*a,t[1]=s*c+i*a,t[2]=o*c+n*a,t[3]=i*c-s*a,t}function Sh(t,e,r){r*=.5;let n=e[0],s=e[1],o=e[2],i=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c+s*a,t[1]=s*c-n*a,t[2]=o*c+i*a,t[3]=i*c-o*a,t}function Ih(t,e){let r=e[0],n=e[1],s=e[2];return t[0]=r,t[1]=n,t[2]=s,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-s*s)),t}function _n(t,e,r,n){let s=e[0],o=e[1],i=e[2],a=e[3],c=r[0],l=r[1],f=r[2],u=r[3],h,d,p,A,m;return h=s*c+o*l+i*f+a*u,h<0&&(h=-h,c=-c,l=-l,f=-f,u=-u),1-h>1e-6?(d=Math.acos(h),m=Math.sin(d),p=Math.sin((1-n)*d)/m,A=Math.sin(n*d)/m):(p=1-n,A=n),t[0]=p*s+A*c,t[1]=p*o+A*l,t[2]=p*i+A*f,t[3]=p*a+A*u,t}function wh(t,e){let r=e[0],n=e[1],s=e[2],o=e[3],i=r*r+n*n+s*s+o*o,a=i?1/i:0;return t[0]=-r*a,t[1]=-n*a,t[2]=-s*a,t[3]=o*a,t}function vh(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function za(t,e){let r=e[0]+e[4]+e[8],n;if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{let s=0;e[4]>e[0]&&(s=1),e[8]>e[s*3+s]&&(s=2);let o=(s+1)%3,i=(s+2)%3;n=Math.sqrt(e[s*3+s]-e[o*3+o]-e[i*3+i]+1),t[s]=.5*n,n=.5/n,t[3]=(e[o*3+i]-e[i*3+o])*n,t[o]=(e[o*3+s]+e[s*3+o])*n,t[i]=(e[i*3+s]+e[s*3+i])*n}return t}var Lh=dh;var Fh=ph,Rh=xh,Ph=yh,Oh=mh;var Nh=gh;var Dh=Ah;var Gh=function(){let t=oo(),e=io(1,0,0),r=io(0,1,0);return function(n,s,o){let i=yn(s,o);return i<-.999999?(Wt(t,e,s),xa(t)<1e-6&&Wt(t,r,s),da(t,t),Va(n,t,Math.PI),n):i>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Wt(t,s,o),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+i,Dh(n,n))}}(),Yv=function(){let t=Mh(),e=Mh();return function(r,n,s,o,i,a){return _n(t,n,i,a),_n(e,s,o,a),_n(r,t,e,2*a*(1-a)),r}}(),Kv=function(){let t=eh();return function(e,r,n,s){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=s[0],t[4]=s[1],t[7]=s[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],Dh(e,za(e,t))}}();var db=[0,0,0,1],rt=class extends Mt{constructor(e=0,r=0,n=0,s=1){super(-0,-0,-0,-0),Array.isArray(e)&&arguments.length===1?this.copy(e):this.set(e,r,n,s)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,r,n,s){return this[0]=e,this[1]=r,this[2]=n,this[3]=s,this.check()}fromObject(e){return this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this.check()}fromMatrix3(e){return za(this,e),this.check()}fromAxisRotation(e,r){return Va(this,e,r),this.check()}identity(){return _h(this),this.check()}setAxisAngle(e,r){return this.fromAxisRotation(e,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=V(e)}get y(){return this[1]}set y(e){this[1]=V(e)}get z(){return this[2]}set z(e){this[2]=V(e)}get w(){return this[3]}set w(e){this[3]=V(e)}len(){return Oh(this)}lengthSquared(){return Nh(this)}dot(e){return Rh(this,e)}rotationTo(e,r){return Gh(this,e,r),this.check()}add(e){return Lh(this,this,e),this.check()}calculateW(){return Ih(this,this),this.check()}conjugate(){return vh(this,this),this.check()}invert(){return wh(this,this),this.check()}lerp(e,r,n){return n===void 0?this.lerp(this,e,r):(Ph(this,e,r,n),this.check())}multiplyRight(e){return Ha(this,this,e),this.check()}multiplyLeft(e){return Ha(this,e,this),this.check()}normalize(){let e=this.len(),r=e>0?1/e:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,e===0&&(this[3]=1),this.check()}rotateX(e){return Bh(this,this,e),this.check()}rotateY(e){return Ch(this,this,e),this.check()}rotateZ(e){return Sh(this,this,e),this.check()}scale(e){return Fh(this,this,e),this.check()}slerp(e,r,n){let s,o,i;switch(arguments.length){case 1:({start:s=db,target:o,ratio:i}=e);break;case 2:s=this,o=e,i=r;break;default:s=e,o=r,i=n}return _n(this,s,o,i),this.check()}transformVector4(e,r=new Lr){return bh(r,e,this),_t(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,r){return this.setAxisAngle(e,r)}premultiply(e){return this.multiplyLeft(e)}multiply(e){return this.multiplyRight(e)}};var Ne={};me(Ne,{EPSILON1:()=>pb,EPSILON10:()=>Mb,EPSILON11:()=>_b,EPSILON12:()=>Bb,EPSILON13:()=>Cb,EPSILON14:()=>Sb,EPSILON15:()=>Ib,EPSILON16:()=>wb,EPSILON17:()=>vb,EPSILON18:()=>Lb,EPSILON19:()=>Fb,EPSILON2:()=>mb,EPSILON20:()=>Rb,EPSILON3:()=>gb,EPSILON4:()=>Ab,EPSILON5:()=>xb,EPSILON6:()=>yb,EPSILON7:()=>Tb,EPSILON8:()=>bb,EPSILON9:()=>Eb,PI_OVER_FOUR:()=>Ob,PI_OVER_SIX:()=>Nb,PI_OVER_TWO:()=>Pb,TWO_PI:()=>Db});var pb=.1,mb=.01,gb=.001,Ab=1e-4,xb=1e-5,yb=1e-6,Tb=1e-7,bb=1e-8,Eb=1e-9,Mb=1e-10,_b=1e-11,Bb=1e-12,Cb=1e-13,Sb=1e-14,Ib=1e-15,wb=1e-16,vb=1e-17,Lb=1e-18,Fb=1e-19,Rb=1e-20,Pb=Math.PI/2,Ob=Math.PI/4,Nb=Math.PI/6,Db=Math.PI*2;function po(t,e){e=e===void 0?t[0][0]:e;for(let r of t){let n=r[0]-e;n>180?r[0]-=360:n<-180&&(r[0]+=360)}}function Gb(t,e,r){let[n,s]=(0,Bn.cellToLatLng)(t),o=e.length;po(e,s);let i=e[0]===e[o-1]?o-1:o;for(let a=0;a<i;a++)e[a][0]=Et(s,e[a][0],r),e[a][1]=Et(n,e[a][1],r)}function Uh(t,e,r){let n=t(e,r),[s,o]=(0,Bn.cellToLatLng)(n);return[o,s]}function ka(t,e=1){let r=(0,Bn.cellToBoundary)(t,!0);return e!==1?Gb(t,r,e):po(r),r}function mo(t){let e=new Float64Array(t.length*2),r=0;for(let n of t)e[r++]=n[0],e[r++]=n[1];return e}var Ub={getPentagon:{type:"accessor",value:t=>t.pentagon}},Cn=class extends Oe{indexToBounds(){let{data:e,getPentagon:r}=this.props;return{data:e,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(n,s)=>{let o=r(n,s),i=Uu(typeof o=="string"?Vu(o):o,{closedRing:!0,segments:"auto"});return mo(i)}}}};Cn.layerName="A5Layer";Cn.defaultProps=Ub;var Vh=Cn;var ir=D(Je(),1),Ud=D(je(),1),Vd=D(Kt(),1);function Vb(t){return typeof t=="string"?t.charAt(0).toLowerCase()+t.slice(1):t}function go(t){if(Array.isArray(t))return t.map(e=>go(e));if(t&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[Vb(r)]=go(n);return e}return t}var zh=":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",Hb=zh+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",zb="["+zh+"]["+Hb+"]*",kb=new RegExp("^"+zb+"$");function Ao(t,e){let r=[],n=e.exec(t);for(;n;){let s=[];s.startIndex=e.lastIndex-n[0].length;let o=n.length;for(let i=0;i<o;i++)s.push(n[i]);r.push(s),n=e.exec(t)}return r}var Rr=function(t){let e=kb.exec(t);return!(e===null||typeof e>"u")};function kh(t){return typeof t<"u"}var qb={allowBooleanAttributes:!1,unpairedTags:[]};function Xh(t,e){e=Object.assign({},qb,e);let r=[],n=!1,s=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let o=0;o<t.length;o++)if(t[o]==="<"&&t[o+1]==="?"){if(o+=2,o=jh(t,o),o.err)return o}else if(t[o]==="<"){let i=o;if(o++,t[o]==="!"){o=Jh(t,o);continue}else{let a=!1;t[o]==="/"&&(a=!0,o++);let c="";for(;o<t.length&&t[o]!==">"&&t[o]!==" "&&t[o]!==" "&&t[o]!==`
|
|
8
|
+
`&&t[o]!=="\r";o++)c+=t[o];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),o--),!Zb(c)){let u;return c.trim().length===0?u="Invalid space after '<'.":u="Tag '"+c+"' is an invalid name.",se("InvalidTag",u,Ee(t,o))}let l=Wb(t,o);if(l===!1)return se("InvalidAttr","Attributes for '"+c+"' have open quote.",Ee(t,o));let f=l.value;if(o=l.index,f[f.length-1]==="/"){let u=o-f.length;f=f.substring(0,f.length-1);let h=Wh(f,e);if(h===!0)n=!0;else return se(h.err.code,h.err.msg,Ee(t,u+h.err.line))}else if(a)if(l.tagClosed){if(f.trim().length>0)return se("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",Ee(t,i));if(r.length===0)return se("InvalidTag","Closing tag '"+c+"' has not been opened.",Ee(t,i));{let u=r.pop();if(c!==u.tagName){let h=Ee(t,u.tagStartPos);return se("InvalidTag","Expected closing tag '"+u.tagName+"' (opened in line "+h.line+", col "+h.col+") instead of closing tag '"+c+"'.",Ee(t,i))}r.length==0&&(s=!0)}}else return se("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",Ee(t,o));else{let u=Wh(f,e);if(u!==!0)return se(u.err.code,u.err.msg,Ee(t,o-f.length+u.err.line));if(s===!0)return se("InvalidXml","Multiple possible root nodes found.",Ee(t,o));e.unpairedTags.indexOf(c)!==-1||r.push({tagName:c,tagStartPos:i}),n=!0}for(o++;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="!"){o++,o=Jh(t,o);continue}else if(t[o+1]==="?"){if(o=jh(t,++o),o.err)return o}else break;else if(t[o]==="&"){let u=Kb(t,o);if(u==-1)return se("InvalidChar","char '&' is not expected.",Ee(t,o));o=u}else if(s===!0&&!qh(t[o]))return se("InvalidXml","Extra text at the end",Ee(t,o));t[o]==="<"&&o--}}else{if(qh(t[o]))continue;return se("InvalidChar","char '"+t[o]+"' is not expected.",Ee(t,o))}if(n){if(r.length==1)return se("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",Ee(t,r[0].tagStartPos));if(r.length>0)return se("InvalidXml","Invalid '"+JSON.stringify(r.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return se("InvalidXml","Start tag expected.",1);return!0}function qh(t){return t===" "||t===" "||t===`
|
|
9
|
+
`||t==="\r"}function jh(t,e){let r=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){let n=t.substr(r,e-r);if(e>5&&n==="xml")return se("InvalidXml","XML declaration allowed only at the start of the document.",Ee(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function Jh(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let r=1;for(e+=8;e<t.length;e++)if(t[e]==="<")r++;else if(t[e]===">"&&(r--,r===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}var jb='"',Jb="'";function Wb(t,e){let r="",n="",s=!1;for(;e<t.length;e++){if(t[e]===jb||t[e]===Jb)n===""?n=t[e]:n!==t[e]||(n="");else if(t[e]===">"&&n===""){s=!0;break}r+=t[e]}return n!==""?!1:{value:r,index:e,tagClosed:s}}var Xb=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Wh(t,e){let r=Ao(t,Xb),n={};for(let s=0;s<r.length;s++){if(r[s][1].length===0)return se("InvalidAttr","Attribute '"+r[s][2]+"' has no space in starting.",Sn(r[s]));if(r[s][3]!==void 0&&r[s][4]===void 0)return se("InvalidAttr","Attribute '"+r[s][2]+"' is without value.",Sn(r[s]));if(r[s][3]===void 0&&!e.allowBooleanAttributes)return se("InvalidAttr","boolean attribute '"+r[s][2]+"' is not allowed.",Sn(r[s]));let o=r[s][2];if(!Qb(o))return se("InvalidAttr","Attribute '"+o+"' is an invalid name.",Sn(r[s]));if(!n.hasOwnProperty(o))n[o]=1;else return se("InvalidAttr","Attribute '"+o+"' is repeated.",Sn(r[s]))}return!0}function Yb(t,e){let r=/\d/;for(t[e]==="x"&&(e++,r=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(r))break}return-1}function Kb(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,Yb(t,e);let r=0;for(;e<t.length;e++,r++)if(!(t[e].match(/\w/)&&r<20)){if(t[e]===";")break;return-1}return e}function se(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function Qb(t){return Rr(t)}function Zb(t){return Rr(t)}function Ee(t,e){let r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function Sn(t){return t.startIndex+t[1].length}var $b={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t},captureMetaData:!1};function Yh(t){return typeof t=="boolean"?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,allowedTags:null,tagFilter:null}:typeof t=="object"&&t!==null?{enabled:t.enabled!==!1,maxEntitySize:t.maxEntitySize??1e4,maxExpansionDepth:t.maxExpansionDepth??10,maxTotalExpansions:t.maxTotalExpansions??1e3,maxExpandedLength:t.maxExpandedLength??1e5,allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null}:Yh(!0)}var Kh=function(t){let e=Object.assign({},$b,t);return e.processEntities=Yh(e.processEntities),e};var xo;typeof Symbol!="function"?xo="@@xmlMetadata":xo=Symbol("XML Node Metadata");var Le=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,r){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:r})}addChild(e,r){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,[":@"]:e[":@"]}):this.child.push({[e.tagname]:e.child}),r!==void 0&&(this.child[this.child.length-1][xo]={startIndex:r})}static getMetaDataSymbol(){return xo}};var wn=class{constructor(e){this.suppressValidationErr=!e,this.options=e}readDocType(e,r){let n={};if(e[r+3]==="O"&&e[r+4]==="C"&&e[r+5]==="T"&&e[r+6]==="Y"&&e[r+7]==="P"&&e[r+8]==="E"){r=r+9;let s=1,o=!1,i=!1,a="";for(;r<e.length;r++)if(e[r]==="<"&&!i){if(o&&Qt(e,"!ENTITY",r)){r+=7;let c,l;if([c,l,r]=this.readEntityExp(e,r+1,this.suppressValidationErr),l.indexOf("&")===-1){let f=c.replace(/[.\-+*:]/g,"\\.");n[c]={regx:RegExp(`&${f};`,"g"),val:l}}}else if(o&&Qt(e,"!ELEMENT",r)){r+=8;let{index:c}=this.readElementExp(e,r+1);r=c}else if(o&&Qt(e,"!ATTLIST",r))r+=8;else if(o&&Qt(e,"!NOTATION",r)){r+=9;let{index:c}=this.readNotationExp(e,r+1,this.suppressValidationErr);r=c}else if(Qt(e,"!--",r))i=!0;else throw new Error("Invalid DOCTYPE");s++,a=""}else if(e[r]===">"){if(i?e[r-1]==="-"&&e[r-2]==="-"&&(i=!1,s--):s--,s===0)break}else e[r]==="["?o=!0:a+=e[r];if(s!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:r}}readEntityExp(e,r){r=Be(e,r);let n="";for(;r<e.length&&!/\s/.test(e[r])&&e[r]!=='"'&&e[r]!=="'";)n+=e[r],r++;if(In(n),r=Be(e,r),!this.suppressValidationErr){if(e.substring(r,r+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[r]==="%")throw new Error("Parameter entities are not supported")}let s="";if([r,s]=this.readIdentifierVal(e,r,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize&&s.length>this.options.maxEntitySize)throw new Error(`Entity "${n}" size (${s.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return r--,[n,s,r]}readNotationExp(e,r){r=Be(e,r);let n="";for(;r<e.length&&!/\s/.test(e[r]);)n+=e[r],r++;!this.suppressValidationErr&&In(n),r=Be(e,r);let s=e.substring(r,r+6).toUpperCase();if(!this.suppressValidationErr&&s!=="SYSTEM"&&s!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${s}"`);r+=s.length,r=Be(e,r);let o=null,i=null;if(s==="PUBLIC")[r,o]=this.readIdentifierVal(e,r,"publicIdentifier"),r=Be(e,r),(e[r]==='"'||e[r]==="'")&&([r,i]=this.readIdentifierVal(e,r,"systemIdentifier"));else if(s==="SYSTEM"&&([r,i]=this.readIdentifierVal(e,r,"systemIdentifier"),!this.suppressValidationErr&&!i))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:n,publicIdentifier:o,systemIdentifier:i,index:--r}}readIdentifierVal(e,r,n){let s="",o=e[r];if(o!=='"'&&o!=="'")throw new Error(`Expected quoted string, found "${o}"`);for(r++;r<e.length&&e[r]!==o;)s+=e[r],r++;if(e[r]!==o)throw new Error(`Unterminated ${n} value`);return r++,[r,s]}readElementExp(e,r){r=Be(e,r);let n="";for(;r<e.length&&!/\s/.test(e[r]);)n+=e[r],r++;if(!this.suppressValidationErr&&!Rr(n))throw new Error(`Invalid element name: "${n}"`);r=Be(e,r);let s="";if(e[r]==="E"&&Qt(e,"MPTY",r))r+=4;else if(e[r]==="A"&&Qt(e,"NY",r))r+=2;else if(e[r]==="("){for(r++;r<e.length&&e[r]!==")";)s+=e[r],r++;if(e[r]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[r]}"`);return{elementName:n,contentModel:s.trim(),index:r}}readAttlistExp(e,r){r=Be(e,r);let n="";for(;r<e.length&&!/\s/.test(e[r]);)n+=e[r],r++;In(n),r=Be(e,r);let s="";for(;r<e.length&&!/\s/.test(e[r]);)s+=e[r],r++;if(!In(s))throw new Error(`Invalid attribute name: "${s}"`);r=Be(e,r);let o="";if(e.substring(r,r+8).toUpperCase()==="NOTATION"){if(o="NOTATION",r+=8,r=Be(e,r),e[r]!=="(")throw new Error(`Expected '(', found "${e[r]}"`);r++;let a=[];for(;r<e.length&&e[r]!==")";){let c="";for(;r<e.length&&e[r]!=="|"&&e[r]!==")";)c+=e[r],r++;if(c=c.trim(),!In(c))throw new Error(`Invalid notation name: "${c}"`);a.push(c),e[r]==="|"&&(r++,r=Be(e,r))}if(e[r]!==")")throw new Error("Unterminated list of notations");r++,o+=" ("+a.join("|")+")"}else{for(;r<e.length&&!/\s/.test(e[r]);)o+=e[r],r++;let a=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!a.includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}r=Be(e,r);let i="";return e.substring(r,r+8).toUpperCase()==="#REQUIRED"?(i="#REQUIRED",r+=8):e.substring(r,r+7).toUpperCase()==="#IMPLIED"?(i="#IMPLIED",r+=7):[r,i]=this.readIdentifierVal(e,r,"ATTLIST"),{elementName:n,attributeName:s,attributeType:o,defaultValue:i,index:r}}},Be=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function Qt(t,e,r){for(let n=0;n<e.length;n++)if(e[n]!==t[r+n+1])return!1;return!0}function In(t){if(Rr(t))return t;throw new Error(`Invalid entity name ${t}`)}var eE=/^[-+]?0x[a-fA-F0-9]+$/,tE=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,rE={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function qa(t,e={}){if(e=Object.assign({},rE,e),!t||typeof t!="string")return t;let r=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(r))return t;if(t==="0")return 0;if(e.hex&&eE.test(r))return iE(r,16);if(r.includes("e")||r.includes("E"))return sE(t,r,e);{let n=tE.exec(r);if(n){let s=n[1]||"",o=n[2],i=oE(n[3]),a=s?t[o.length+1]===".":t[o.length]===".";if(!e.leadingZeros&&(o.length>1||o.length===1&&!a))return t;{let c=Number(r),l=String(c);if(c===0)return c;if(l.search(/[eE]/)!==-1)return e.eNotation?c:t;if(r.indexOf(".")!==-1)return l==="0"||l===i||l===`${s}${i}`?c:t;let f=o?i:r;return o?f===l||s+f===l?c:t:f===l||f===s+l?c:t}}else return t}}var nE=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function sE(t,e,r){if(!r.eNotation)return t;let n=e.match(nE);if(n){let s=n[1]||"",o=n[3].indexOf("e")===-1?"E":"e",i=n[2],a=s?t[i.length+1]===o:t[i.length]===o;return i.length>1&&a?t:i.length===1&&(n[3].startsWith(`.${o}`)||n[3][0]===o)?Number(e):r.leadingZeros&&!a?(e=(n[1]||"")+n[3],Number(e)):t}else return t}function oE(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substring(0,t.length-1))),t}function iE(t,e){if(parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function ja(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(let r of t)if(typeof r=="string"&&e===r||r instanceof RegExp&&r.test(e))return!0}:()=>!1}var vn=class{constructor(e){if(this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(r,n)=>Qh(n,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,n)=>Qh(n,16,"&#x")}},this.addExternalEntities=aE,this.parseXml=hE,this.parseTextData=cE,this.resolveNameSpace=lE,this.buildAttributesMap=uE,this.isItStopNode=gE,this.replaceEntitiesValue=pE,this.readStopNodeData=xE,this.saveTextToParentTag=mE,this.addChild=dE,this.ignoreAttributesFn=ja(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let r=0;r<this.options.stopNodes.length;r++){let n=this.options.stopNodes[r];typeof n=="string"&&(n.startsWith("*.")?this.stopNodesWildcard.add(n.substring(2)):this.stopNodesExact.add(n))}}}};function aE(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r],s=n.replace(/[.\-+*:]/g,"\\.");this.lastEntities[n]={regex:new RegExp("&"+s+";","g"),val:t[n]}}}function cE(t,e,r,n,s,o,i){if(t!==void 0&&(this.options.trimValues&&!n&&(t=t.trim()),t.length>0)){i||(t=this.replaceEntitiesValue(t,e,r));let a=this.options.tagValueProcessor(e,t,r,s,o);return a==null?t:typeof a!=typeof t||a!==t?a:this.options.trimValues?Wa(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?Wa(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function lE(t){if(this.options.removeNSPrefix){let e=t.split(":"),r=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=r+e[1])}return t}var fE=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function uE(t,e,r){if(this.options.ignoreAttributes!==!0&&typeof t=="string"){let n=Ao(t,fE),s=n.length,o={};for(let i=0;i<s;i++){let a=this.resolveNameSpace(n[i][1]);if(this.ignoreAttributesFn(a,e))continue;let 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,r,e);let f=this.options.attributeValueProcessor(a,c,e);f==null?o[l]=c:typeof f!=typeof c||f!==c?o[l]=f:o[l]=Wa(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 hE=function(t){t=t.replace(/\r\n?/g,`
|
|
10
|
+
`);let e=new Le("!xml"),r=e,n="",s="";this.entityExpansionCount=0,this.currentExpandedLength=0;let o=new wn(this.options.processEntities);for(let i=0;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){let c=Zt(t,">",i,"Closing Tag is not closed."),l=t.substring(i+2,c).trim();if(this.options.removeNSPrefix){let h=l.indexOf(":");h!==-1&&(l=l.substr(h+1))}this.options.transformTagName&&(l=this.options.transformTagName(l)),r&&(n=this.saveTextToParentTag(n,r,s));let f=s.substring(s.lastIndexOf(".")+1);if(l&&this.options.unpairedTags.indexOf(l)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);let u=0;f&&this.options.unpairedTags.indexOf(f)!==-1?(u=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):u=s.lastIndexOf("."),s=s.substring(0,u),r=this.tagsNodeStack.pop(),n="",i=c}else if(t[i+1]==="?"){let c=Ja(t,i,!1,"?>");if(!c)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,r,s),!(this.options.ignoreDeclaration&&c.tagName==="?xml"||this.options.ignorePiTags)){let l=new Le(c.tagName);l.add(this.options.textNodeName,""),c.tagName!==c.tagExp&&c.attrExpPresent&&(l[":@"]=this.buildAttributesMap(c.tagExp,s,c.tagName)),this.addChild(r,l,s,i)}i=c.closeIndex+1}else if(t.substr(i+1,3)==="!--"){let c=Zt(t,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){let l=t.substring(i+4,c-2);n=this.saveTextToParentTag(n,r,s),r.add(this.options.commentPropName,[{[this.options.textNodeName]:l}])}i=c}else if(t.substr(i+1,2)==="!D"){let c=o.readDocType(t,i);this.docTypeEntities=c.entities,i=c.i}else if(t.substr(i+1,2)==="!["){let c=Zt(t,"]]>",i,"CDATA is not closed.")-2,l=t.substring(i+9,c);n=this.saveTextToParentTag(n,r,s);let f=this.parseTextData(l,r.tagname,s,!0,!1,!0,!0);f==null&&(f=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:l}]):r.add(this.options.textNodeName,f),i=c+2}else{let c=Ja(t,i,this.options.removeNSPrefix),l=c.tagName,f=c.rawTagName,u=c.tagExp,h=c.attrExpPresent,d=c.closeIndex;if(this.options.transformTagName){let m=this.options.transformTagName(l);u===l&&(u=m),l=m}r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,s,!1));let p=r;p&&this.options.unpairedTags.indexOf(p.tagname)!==-1&&(r=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),l!==e.tagname&&(s+=s?"."+l:l);let A=i;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,s,l)){let m="";if(u.length>0&&u.lastIndexOf("/")===u.length-1)l[l.length-1]==="/"?(l=l.substr(0,l.length-1),s=s.substr(0,s.length-1),u=l):u=u.substr(0,u.length-1),i=c.closeIndex;else if(this.options.unpairedTags.indexOf(l)!==-1)i=c.closeIndex;else{let b=this.readStopNodeData(t,f,d+1);if(!b)throw new Error(`Unexpected end of ${f}`);i=b.i,m=b.tagContent}let y=new Le(l);l!==u&&h&&(y[":@"]=this.buildAttributesMap(u,s,l)),m&&(m=this.parseTextData(m,l,s,!0,h,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),y.add(this.options.textNodeName,m),this.addChild(r,y,s,A)}else{if(u.length>0&&u.lastIndexOf("/")===u.length-1){if(l[l.length-1]==="/"?(l=l.substr(0,l.length-1),s=s.substr(0,s.length-1),u=l):u=u.substr(0,u.length-1),this.options.transformTagName){let y=this.options.transformTagName(l);u===l&&(u=y),l=y}let m=new Le(l);l!==u&&h&&(m[":@"]=this.buildAttributesMap(u,s,l)),this.addChild(r,m,s,A),s=s.substr(0,s.lastIndexOf("."))}else{let m=new Le(l);this.tagsNodeStack.push(r),l!==u&&h&&(m[":@"]=this.buildAttributesMap(u,s,l)),this.addChild(r,m,s,A),r=m}n="",i=d}}else n+=t[i];return e.child};function dE(t,e,r,n){this.options.captureMetaData||(n=void 0);let s=this.options.updateTag(e.tagname,r,e[":@"]);s===!1||(typeof s=="string"&&(e.tagname=s),t.addChild(e,n))}var pE=function(t,e,r){if(t.indexOf("&")===-1)return t;let n=this.options.processEntities;if(!n.enabled||n.allowedTags&&!n.allowedTags.includes(e)||n.tagFilter&&!n.tagFilter(e,r))return t;for(let s in this.docTypeEntities){let o=this.docTypeEntities[s],i=t.match(o.regx);if(i){if(this.entityExpansionCount+=i.length,n.maxTotalExpansions&&this.entityExpansionCount>n.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n.maxTotalExpansions}`);let a=t.length;if(t=t.replace(o.regx,o.val),n.maxExpandedLength&&(this.currentExpandedLength+=t.length-a,this.currentExpandedLength>n.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${n.maxExpandedLength}`)}}if(t.indexOf("&")===-1)return t;for(let s in this.lastEntities){let o=this.lastEntities[s];t=t.replace(o.regex,o.val)}if(t.indexOf("&")===-1)return t;if(this.options.htmlEntities)for(let s in this.htmlEntities){let o=this.htmlEntities[s];t=t.replace(o.regex,o.val)}return t=t.replace(this.ampEntity.regex,this.ampEntity.val),t};function mE(t,e,r,n){return t&&(n===void 0&&(n=e.child.length===0),t=this.parseTextData(t,e.tagname,r,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,n),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function gE(t,e,r,n){return!!(e&&e.has(n)||t&&t.has(r))}function AE(t,e,r=">"){let n,s="";for(let o=e;o<t.length;o++){let i=t[o];if(n)i===n&&(n="");else if(i==='"'||i==="'")n=i;else if(i===r[0])if(r[1]){if(t[o+1]===r[1])return{data:s,index:o}}else return{data:s,index:o};else i===" "&&(i=" ");s+=i}}function Zt(t,e,r,n){let s=t.indexOf(e,r);if(s===-1)throw new Error(n);return s+e.length-1}function Ja(t,e,r,n=">"){let s=AE(t,e+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 f=c;if(r){let u=c.indexOf(":");u!==-1&&(c=c.substr(u+1),l=c!==s.data.substr(u+1))}return{tagName:c,tagExp:o,closeIndex:i,attrExpPresent:l,rawTagName:f}}function xE(t,e,r){let n=r,s=1;for(;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="/"){let o=Zt(t,">",r,`${e} is not closed`);if(t.substring(r+2,o).trim()===e&&(s--,s===0))return{tagContent:t.substring(n,r),i:o};r=o}else if(t[r+1]==="?")r=Zt(t,"?>",r+1,"StopNode is not closed.");else if(t.substr(r+1,3)==="!--")r=Zt(t,"-->",r+3,"StopNode is not closed.");else if(t.substr(r+1,2)==="![")r=Zt(t,"]]>",r,"StopNode is not closed.")-2;else{let o=Ja(t,r,">");o&&((o&&o.tagName)===e&&o.tagExp[o.tagExp.length-1]!=="/"&&s++,r=o.closeIndex)}}function Wa(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:qa(t,r)}else return kh(t)?t:""}function Qh(t,e,r){let n=Number.parseInt(t,e);return n>=0&&n<=1114111?String.fromCodePoint(n):r+t+";"}var Xa=Le.getMetaDataSymbol();function Ya(t,e){return Zh(t,e)}function Zh(t,e,r){let n,s={};for(let o=0;o<t.length;o++){let i=t[o],a=yE(i),c="";if(r===void 0?c=a:c=r+"."+a,a===e.textNodeName)n===void 0?n=i[a]:n+=""+i[a];else{if(a===void 0)continue;if(i[a]){let l=Zh(i[a],e,c),f=bE(l,e);i[Xa]!==void 0&&(l[Xa]=i[Xa]),i[":@"]?TE(l,i[":@"],c,e):Object.keys(l).length===1&&l[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?l=l[e.textNodeName]:Object.keys(l).length===0&&(e.alwaysCreateTextNode?l[e.textNodeName]="":l=""),s[a]!==void 0&&s.hasOwnProperty(a)?(Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(l)):e.isArray(a,c,f)?s[a]=[l]:s[a]=l}}}return typeof n=="string"?n.length>0&&(s[e.textNodeName]=n):n!==void 0&&(s[e.textNodeName]=n),s}function yE(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function TE(t,e,r,n){if(e){let s=Object.keys(e),o=s.length;for(let i=0;i<o;i++){let a=s[i];n.isArray(a,r+"."+a,!0,!0)?t[a]=[e[a]]:t[a]=e[a]}}}function bE(t,e){let{textNodeName:r}=e,n=Object.keys(t).length;return!!(n===0||n===1&&(t[r]||typeof t[r]=="boolean"||t[r]===0))}var Pr=class{constructor(e){this.externalEntities={},this.options=Kh(e)}parse(e,r){if(typeof e!="string"&&e.toString)e=e.toString();else if(typeof e!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let o=Xh(e,r);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}let n=new vn(this.options);n.addExternalEntities(this.externalEntities);let s=n.parseXml(e);return this.options.preserveOrder||s===void 0?s:Ya(s,this.options)}addEntity(e,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}static getMetaDataSymbol(){return Le.getMetaDataSymbol()}};function Ka(t,e){if(e?._parser&&e._parser!=="fast-xml-parser")throw new Error(e?._parser);let r={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:e?.removeNSPrefix,textNodeName:e?.textNodeName,isArray:(s,o,i,a)=>Boolean(e?.arrayPaths?.some(l=>o===l)),...e?._fastXML},n=EE(t,r);return e?.uncapitalizeKeys?go(n):n}function EE(t,e){return new Pr({ignoreAttributes:!1,attributeNamePrefix:"",...e}).parse(t)}var ME="4.4.0-alpha.18",Xe={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:ME,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:_E,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(t,e)=>Ka(new TextDecoder().decode(t),{...Xe.options.xml,...e?.xml}),parseTextSync:(t,e)=>Ka(t,{...Xe.options.xml,...e?.xml})};function _E(t){return t.startsWith("<?xml")}async function Fe(t,e,r,n){return n._parse(t,e,r,n)}function H(t,e){if(!t)throw new Error(e||"loader assertion failed.")}var nt={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},BE=nt.self||nt.window||nt.global||{},CE=nt.window||nt.self||nt.global||{},SE=nt.global||nt.self||nt.window||{},IE=nt.document||{};var Ln=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var $h=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),wE=$h&&parseFloat($h[1])||0;var yo=globalThis,vE=globalThis.document||{},To=globalThis.process||{},LE=globalThis.console,fF=globalThis.navigator||{};function ed(t){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let e=typeof navigator<"u"&&navigator.userAgent,r=t||e;return Boolean(r&&r.indexOf("Electron")>=0)}function $t(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||ed()}var Qa="4.1.1";function Or(t,e){if(!t)throw new Error(e||"Assertion failed")}function Za(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return Or(Number.isFinite(e)&&e>=0),e}function td(t){let{logLevel:e,message:r}=t;t.logLevel=Za(e);let n=t.args?Array.from(t.args):[];for(;n.length&&n.shift()!==r;);switch(typeof e){case"string":case"function":r!==void 0&&n.unshift(r),t.message=e;break;case"object":Object.assign(t,e);break;default:}typeof t.message=="function"&&(t.message=t.message());let s=typeof t.message;return Or(s==="string"||s==="object"),Object.assign(t,{args:n},t.opts)}var er=()=>{},bo=class{constructor({level:e=0}={}){this.userData={},this._onceCache=new Set,this._level=e}set level(e){this.setLevel(e)}get level(){return this.getLevel()}setLevel(e){return this._level=e,this}getLevel(){return this._level}warn(e,...r){return this._log("warn",0,e,r,{once:!0})}error(e,...r){return this._log("error",0,e,r)}log(e,r,...n){return this._log("log",e,r,n)}info(e,r,...n){return this._log("info",e,r,n)}once(e,r,...n){return this._log("once",e,r,n,{once:!0})}_log(e,r,n,s,o={}){let i=td({logLevel:r,message:n,args:this._buildArgs(r,n,s),opts:o});return this._createLogFunction(e,i,o)}_buildArgs(e,r,n){return[e,r,...n]}_createLogFunction(e,r,n){if(!this._shouldLog(r.logLevel))return er;let s=this._getOnceTag(n.tag??r.tag??r.message);if((n.once||r.once)&&s!==void 0){if(this._onceCache.has(s))return er;this._onceCache.add(s)}return this._emit(e,r)}_shouldLog(e){return this.getLevel()>=Za(e)}_getOnceTag(e){if(e!==void 0)try{return typeof e=="string"?e:String(e)}catch{return}}};function RE(t){try{let e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch{return null}}var Eo=class{constructor(e,r,n="sessionStorage"){this.storage=RE(n),this.id=e,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let e={};if(this.storage){let r=this.storage.getItem(this.id);e=r?JSON.parse(r):{}}return Object.assign(this.config,e),this}};function rd(t){let e;return t<10?e=`${t.toFixed(2)}ms`:t<100?e=`${t.toFixed(1)}ms`:t<1e3?e=`${t.toFixed(0)}ms`:e=`${(t/1e3).toFixed(2)}s`,e}function nd(t,e=8){let r=Math.max(e-t.length,0);return`${" ".repeat(r)}${t}`}var Mo;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Mo||(Mo={}));var PE=10;function sd(t){return typeof t!="string"?t:(t=t.toUpperCase(),Mo[t]||Mo.WHITE)}function od(t,e,r){return!$t&&typeof t=="string"&&(e&&(t=`\x1B[${sd(e)}m${t}\x1B[39m`),r&&(t=`\x1B[${sd(r)+PE}m${t}\x1B[49m`)),t}function id(t,e=["constructor"]){let r=Object.getPrototypeOf(t),n=Object.getOwnPropertyNames(r),s=t;for(let o of n){let i=s[o];typeof i=="function"&&(e.find(a=>o===a)||(s[o]=i.bind(t)))}}function Nr(){let t;if($t()&&yo.performance)t=yo?.performance?.now?.();else if("hrtime"in To){let e=To?.hrtime?.();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var Dr={debug:$t()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},$a={enabled:!0,level:0},ft=class extends bo{constructor({id:e}={id:""}){super({level:0}),this.VERSION=Qa,this._startTs=Nr(),this._deltaTs=Nr(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new Eo(`__probe-${this.id}__`,{[this.id]:$a}),this.timeStamp(`${this.id} started`),id(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((Nr()-this._startTs).toPrecision(10))}getDelta(){return Number((Nr()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._updateConfiguration({enabled:e}),this}setLevel(e){return this._updateConfiguration({level:e}),this}get(e){return this._getConfiguration()[e]}set(e,r){this._updateConfiguration({[e]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,r){if(!e)throw new Error(r||"Assertion failed")}warn(e,...r){return this._log("warn",0,e,r,{method:Dr.warn,once:!0})}error(e,...r){return this._log("error",0,e,r,{method:Dr.error})}deprecated(e,r){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(e,r){return this.error(`\`${e}\` has been removed. Use \`${r}\` instead`)}probe(e,r,...n){return this._log("log",e,r,n,{method:Dr.log,time:!0,once:!0})}log(e,r,...n){return this._log("log",e,r,n,{method:Dr.debug})}info(e,r,...n){return this._log("info",e,r,n,{method:console.info})}once(e,r,...n){return this._log("once",e,r,n,{method:Dr.debug||Dr.info,once:!0})}table(e,r,n){return r?this._log("table",e,r,n&&[n]||[],{method:console.table||er,tag:NE(r)}):er}time(e,r){return this._log("time",e,r,[],{method:console.time?console.time:console.info})}timeEnd(e,r){return this._log("time",e,r,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(e,r){return this._log("time",e,r,[],{method:console.timeStamp||er})}group(e,r,n={collapsed:!1}){let s=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",e,r,[],{method:s})}groupCollapsed(e,r,n={}){return this.group(e,r,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._log("groupEnd",e,"",[],{method:console.groupEnd||er})}withGroup(e,r,n){this.group(e,r)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&super._shouldLog(e)}_emit(e,r){let n=r.method;Or(n),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=Nr();let s=OE(this.id,r.message,r);return n.bind(console,s,...r.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration($a),this._storage.config[this.id]}_updateConfiguration(e){let r=this._storage.config[this.id]||{...$a};this._storage.setConfiguration({[this.id]:{...r,...e}})}};ft.VERSION=Qa;function OE(t,e,r){if(typeof e=="string"){let n=r.time?nd(rd(r.total)):"";e=r.time?`${t}: ${n} ${e}`:`${t}: ${e}`,e=od(e,r.color,r.background)}return e}function NE(t){for(let e in t)for(let r in t[e])return r||"untitled";return"empty"}globalThis.probe={};var ec=new ft({id:"@probe.gl/log"});var tc="4.4.0-alpha.18",DE=tc[0]>="0"&&tc[0]<="9"?`v${tc}`:"";function GE(){let t=new ft({id:"loaders.gl"});return globalThis.loaders||={},globalThis.loaders.log=t,globalThis.loaders.version=DE,globalThis.probe||={},globalThis.probe.loaders=t,t}var rc=GE();var ad=t=>typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer;function Fn(t,e){return cd(t||{},e)}function cd(t,e,r=0){if(r>3)return e;let n={...t};for(let[s,o]of Object.entries(e))o&&typeof o=="object"&&!Array.isArray(o)?n[s]=cd(n[s]||{},e[s],r+1):n[s]=e[s];return n}function nc(t){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,t)}function sc(t){return globalThis.loaders?.modules?.[t]||null}function UE(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.4.0-alpha.18"),globalThis._loadersgl_.version}var ld=UE();function fd(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var st={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},KF=st.self||st.window||st.global||{},QF=st.window||st.self||st.global||{},ZF=st.global||st.self||st.window||{},$F=st.document||{};var ut=typeof process!="object"||String(process)!=="[object process]"||process.browser,Rn=typeof importScripts=="function",eR=typeof window<"u"&&typeof window.orientation<"u",ud=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),tR=ud&&parseFloat(ud[1])||0;var oc={};function Pn(t={}){let e=t.useLocalLibraries??t.core?.useLocalLibraries,r=t.CDN??t.core?.CDN,n=t.modules;return{...e!==void 0?{useLocalLibraries:e}:{},...r!==void 0?{CDN:r}:{},...n!==void 0?{modules:n}:{}}}async function De(t,e=null,r={},n=null){return e&&(t=hd(t,e,r,n)),oc[t]=oc[t]||VE(t),await oc[t]}function hd(t,e,r={},n=null){if(r?.core)throw new Error("loadLibrary: options.core must be pre-normalized");if(!r.useLocalLibraries&&t.startsWith("http"))return t;n=n||t;let s=r.modules||{};return s[n]?s[n]:ut?r.CDN?(fd(r.CDN.startsWith("http")),`${r.CDN}/${e}@${ld}/dist/libs/${n}`):Rn?`../src/libs/${n}`:`modules/${e}/src/libs/${n}`:`modules/${e}/dist/libs/${n}`}async function VE(t){if(t.endsWith("wasm"))return await zE(t);if(!ut){let{requireFromFile:r}=globalThis.loaders||{};try{let n=await r?.(t);return n||!t.includes("/dist/libs/")?n:await r?.(t.replace("/dist/libs/","/src/libs/"))}catch(n){if(t.includes("/dist/libs/"))try{return await r?.(t.replace("/dist/libs/","/src/libs/"))}catch{}return console.error(n),null}}if(Rn)return importScripts(t);let e=await kE(t);return HE(e,t)}function HE(t,e){if(!ut){let{requireFromString:n}=globalThis.loaders||{};return n?.(t,e)}if(Rn)return eval.call(globalThis,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}async function zE(t){let{readFileAsArrayBuffer:e}=globalThis.loaders||{};if(ut||!e||t.startsWith("http"))return await(await fetch(t)).arrayBuffer();try{return await e(t)}catch{if(t.includes("/dist/libs/"))return await e(t.replace("/dist/libs/","/src/libs/"));throw new Error(`Failed to load ArrayBuffer from ${t}`)}}async function kE(t){let{readFileAsText:e}=globalThis.loaders||{};if(ut||!e||t.startsWith("http"))return await(await fetch(t)).text();try{return await e(t)}catch{if(t.includes("/dist/libs/"))return await e(t.replace("/dist/libs/","/src/libs/"));throw new Error(`Failed to load text from ${t}`)}}function pd(t,e=5){return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?dd(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?dd(t,0,e):""}function dd(t,e,r){if(t.byteLength<=e+r)return"";let n=new DataView(t),s="";for(let o=0;o<r;o++)s+=String.fromCharCode(n.getUint8(e+o));return s}function ic(t){try{return JSON.parse(t)}catch{throw new Error(`Failed to parse JSON from data starting with "${pd(t)}"`)}}function On(...t){let e=t,r=e&&e.length>1&&e[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let n=e.reduce((i,a)=>i+a.length,0),s=new r(n),o=0;for(let i of e)s.set(i,o),o+=i.length;return s}function tr(t,e,r){let n=r!==void 0?new Uint8Array(t).subarray(e,e+r):new Uint8Array(t).subarray(e);return new Uint8Array(n).buffer}function Ct(t,e){return H(t>=0),H(e>0),t+(e-1)&~(e-1)}function ac(t,e,r){let n;if(t instanceof ArrayBuffer)n=new Uint8Array(t);else{let s=t.byteOffset,o=t.byteLength;n=new Uint8Array(t.buffer||t.arrayBuffer,s,o)}return e.set(n,r),r+Ct(n.byteLength,4)}function Nn(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var rr=class{constructor(e,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=e,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Nn(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Nn()-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 St=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,r="count"){return this._getOrCreate({name:e,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let r of Object.values(this.stats))e(r)}getTable(){let e={};return this.forEach(r=>{e[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(r=>this._getOrCreate(r))}_getOrCreate(e){let{name:r,type:n}=e,s=this.stats[r];return s||(e instanceof rr?s=e:s=new rr(r,n),this.stats[r]=s),s}};var qE="Queued Requests",jE="Active Requests",JE="Cancelled Requests",WE="Queued Requests Ever",XE="Active Requests Ever",YE={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},It=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(e={}){this.props={...YE,...e},this.stats=new St({id:this.props.id}),this.stats.get(qE),this.stats.get(jE),this.stats.get(JE),this.stats.get(WE),this.stats.get(XE)}setProps(e){e.throttleRequests!==void 0&&(this.props.throttleRequests=e.throttleRequests),e.maxRequests!==void 0&&(this.props.maxRequests=e.maxRequests),e.debounceTime!==void 0&&(this.props.debounceTime=e.debounceTime)}scheduleRequest(e,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);let n={handle:e,priority:0,getPriority:r},s=new Promise(o=>(n.resolve=o,n));return this.requestQueue.push(n),this.requestMap.set(e,s),this._issueNewRequests(),s}_issueRequest(e){let{handle:r,resolve:n}=e,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 e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(e!==0){this._updateAllRequests();for(let r=0;r<e;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let e=this.requestQueue;for(let r=0;r<e.length;++r){let n=e[r];this._updateRequest(n)||(e.splice(r,1),this.requestMap.delete(n.handle),r--)}e.sort((r,n)=>r.priority-n.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),e.priority<0?(e.resolve(null),!1):!0}};var KE="",md={};function gd(t){for(let e in md)if(t.startsWith(e)){let r=md[e];t=t.replace(e,r)}return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`${KE}${t}`),t}function wt(t){if(t instanceof ArrayBuffer)return t;if(ad(t))return Dn(t);let{buffer:e,byteOffset:r,byteLength:n}=t;return e instanceof ArrayBuffer&&r===0&&n===e.byteLength?e:Dn(e,r,n)}function Dn(t,e=0,r=t.byteLength-e){let n=new Uint8Array(t,e,r),s=new Uint8Array(n.length);return s.set(n),s.buffer}var vt={};me(vt,{dirname:()=>ZE,filename:()=>QE,join:()=>$E,resolve:()=>eM});function Ad(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let t=window.location?.pathname;return t?.slice(0,t.lastIndexOf("/")+1)||""}function QE(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):t}function ZE(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}function $E(...t){let e="/";return t=t.map((r,n)=>(n&&(r=r.replace(new RegExp(`^${e}`),"")),n!==t.length-1&&(r=r.replace(new RegExp(`${e}$`),"")),r)),t.join(e)}function eM(...t){let e=[];for(let o=0;o<t.length;o++)e[o]=t[o];let r="",n=!1,s;for(let o=e.length-1;o>=-1&&!n;o--){let i;o>=0?i=e[o]:(s===void 0&&(s=Ad()),i=s),i.length!==0&&(r=`${i}/${r}`,n=i.charCodeAt(0)===Gn)}return r=tM(r,!n),n?`/${r}`:r.length>0?r:"."}var Gn=47,cc=46;function tM(t,e){let r="",n=-1,s=0,o,i=!1;for(let a=0;a<=t.length;++a){if(a<t.length)o=t.charCodeAt(a);else{if(o===Gn)break;o=Gn}if(o===Gn){if(!(n===a-1||s===1))if(n!==a-1&&s===2){if(r.length<2||!i||r.charCodeAt(r.length-1)!==cc||r.charCodeAt(r.length-2)!==cc){if(r.length>2){let c=r.length-1,l=c;for(;l>=0&&r.charCodeAt(l)!==Gn;--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}}e&&(r.length>0?r+="/..":r="..",i=!0)}else{let c=t.slice(n+1,a);r.length>0?r+=`/${c}`:r=c,i=!1}n=a,s=0}else o===cc&&s!==-1?++s:s=-1}return r}var lc=class{optionsType;options;data;url;loadOptions;fetch;_needsRefresh=!0;constructor(e,r,n){n?this.options=Fn({...n,core:lc.defaultOptions},r):this.options={...r},this.data=e,this.url=typeof e=="string"?gd(e):"",this.loadOptions={...this.options.core?.loadOptions},this.fetch=rM(this.loadOptions)}setProps(e){this.options=Object.assign(this.options,e),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(e=!0){let r=this._needsRefresh;return e&&(this._needsRefresh=!1),r}},Gr=lc;zt(Gr,"defaultOptions",{core:{type:"auto",attributions:[],loadOptions:{},loaders:[]}});function rM(t){let e=t?.core?.fetch;if(e&&typeof e=="function")return(n,s)=>e(n,s);let r=t?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var Lt=class{};zt(Lt,"type","template"),zt(Lt,"testURL",e=>!1);function xd(t,e){let r=Xe.parseTextSync?.(t,e),n=r?.ServiceExceptionReport?.ServiceException||r?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof n=="string"?n:n.value||n.code||"Unknown error"}var nM="4.4.0-alpha.18",Un={dataType:null,batchType:null,id:"wms-error",name:"WMS Error",module:"wms",version:nM,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:sM,options:{wms:{throwOnError:!1}},parse:async(t,e)=>fc(new TextDecoder().decode(t),e),parseSync:(t,e)=>fc(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>fc(t,e)};function sM(t){return t.startsWith("<?xml")}function fc(t,e){let r={...Un.options.wms,...e?.wms},n=xd(t,r),s=r.minimalErrors?n:`WMS Service error: ${n}`;if(r.throwOnError)throw new Error(s);return s}function nr(t){return Array.isArray(t)?t:t?[t]:[]}function Vn(t){let e=nr(t);return e.length>0&&e.every(r=>typeof r=="string")?e:[]}function Hn(t,e=void 0){switch(typeof t){case"number":return t;case"string":return parseFloat(t);default:return}}function _o(t,e=void 0){switch(typeof t){case"number":return t;case"string":return parseInt(t,10);default:return}}function sr(t){switch(t){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function uc(t,e){let r=Xe.parseTextSync?.(t,e),n=r.WMT_MS_Capabilities||r.WMS_Capabilities||r,s=oM(n);if(e?.inheritedLayerProps)for(let o of s.layers)Td(o,null);return e?.includeRawJSON&&(s.json=n),e?.includeXMLText&&(s.xml=t),s}function oM(t){let e={version:String(t.version||""),name:String(t.Service?.Name||"unnamed"),title:t.Service?.Title?String(t.Service?.Title):void 0,abstract:t.Service?.Abstract?String(t.Service?.Abstract):void 0,keywords:Vn(t.Service?.KeywordList?.Keyword),fees:t.Service?.Fees?JSON.stringify(t.Service?.Fees):void 0,accessConstraints:t.Service?.AccessConstraints?JSON.stringify(t.Service?.AccessConstraints):void 0,layerLimit:_o(t.Service?.LayerLimit),maxWidth:_o(t.Service?.maxWidth),maxHeight:_o(t.Service?.maxHeight),layers:[],requests:iM(t.Capability?.Request),exceptions:aM(t.Exception)},r=nr(t.Capability?.Layer);for(let n of r)e.layers.push(yd(n));for(let[n,s]of Object.entries(e))s===void 0&&delete e[n];return e}function iM(t){let e={};for(let[r,n]of Object.entries(t||{})){let s=Vn(n?.Format);e[r]={mimeTypes:s}}return e}function aM(t){if(nr(t?.Format).length>0)return{mimeTypes:Vn(t)}}function yd(t){let e={title:String(t?.Title||""),name:t?.Name&&String(t?.Name),abstract:t?.Name&&String(t?.Abstract),keywords:Vn(t.KeywordList?.Keyword)},r=t?.CRS||t?.SRS;r&&Array.isArray(r)&&r.every(l=>typeof l=="string")&&(e.crs=r);let n=t?.EX_GeographicBoundingBox&&cM(t?.EX_GeographicBoundingBox);n&&(e.geographicBoundingBox=n),n=t?.LatLonBoundingBox&&lM(t?.LatLonBoundingBox),n&&(e.geographicBoundingBox=n);let s=t?.BoundingBox&&fM(t?.BoundingBox);s&&s.length>0&&(e.boundingBoxes=s);let i=nr(t?.Dimension).map(l=>hM(l));i.length&&(e.dimensions=i),t?.opaque&&(e.opaque=sr(t?.opaque)),t?.cascaded&&(e.cascaded=sr(t?.cascaded)),t?.queryable&&(e.queryable=sr(t?.queryable));let a=nr(t?.Layer),c=[];for(let l of a)c.push(yd(l));c.length>0&&(e.layers=c);for(let[l,f]of Object.entries(e))f===void 0&&delete e[l];return e}function cM(t){let{westBoundLongitude:e,northBoundLatitude:r,eastBoundLongitude:n,southBoundLatitude:s}=t;return[[e,s],[n,r]]}function lM(t){let{minx:e,miny:r,maxx:n,maxy:s}=t;return[[e,r],[n,s]]}function fM(t){return nr(t).map(r=>uM(r))}function uM(t){let{CRS:e,SRS:r,minx:n,miny:s,maxx:o,maxy:i,resx:a,resy:c}=t,l={crs:e||r,boundingBox:[[Hn(n),Hn(s)],[Hn(o),Hn(i)]]};return a&&(l.xResolution=a),c&&(l.yResolution=c),l}function hM(t){let{name:e,units:r,value:n}=t,s={name:e,units:r,extent:n};return t.unitSymbol&&(s.unitSymbol=t.unitSymbol),t.default&&(s.defaultValue=t.default),t.multipleValues&&(s.multipleValues=sr(t.multipleValues)),t.nearestValue&&(s.nearestValue=sr(t.nearestValue)),t.current&&(s.current=sr(t.current)),s}function Td(t,e){e?.geographicBoundingBox&&!t.geographicBoundingBox&&(t.geographicBoundingBox=[...e.geographicBoundingBox]),e?.crs&&!t.crs&&(t.crs=[...e.crs]),e?.boundingBoxes&&!t.boundingBoxes&&(t.boundingBoxes=[...e.boundingBoxes]),e?.dimensions&&!t.dimensions&&(t.dimensions=[...e.dimensions]);for(let r of t.layers||[])Td(r,t)}var dM="4.4.0-alpha.18",Ur={dataType:null,batchType:null,id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:dM,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:pM,options:{wms:{}},parse:async(t,e)=>uc(new TextDecoder().decode(t),e?.wms),parseTextSync:(t,e)=>uc(t,e?.wms)};function pM(t){return t.startsWith("<?xml")}function hc(t,e){let n=(Xe.parseTextSync?.(t,e)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(n)?n:[n]).map(o=>mM(o))}}function mM(t){return{attributes:t||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var bd={...Ur,dataType:null,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(t,e)=>hc(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>hc(t,e)};function dc(t,e){return Xe.parseTextSync?.(t,e)}var Ed={...Ur,dataType:null,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(t,e)=>dc(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>dc(t,e)};var Md="4.4.0-alpha.18";var gM=globalThis.loaders?.parseImageNode,pc=typeof Image<"u",mc=typeof ImageBitmap<"u",AM=Boolean(gM),gc=Ln?!0:AM;function _d(t){switch(t){case"auto":return mc||pc||gc;case"imagebitmap":return mc;case"image":return pc;case"data":return gc;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function Bd(){if(mc)return"imagebitmap";if(pc)return"image";if(gc)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Cd(t){let e=xM(t);if(!e)throw new Error("Not an image");return e}function zn(t){switch(Cd(t)){case"data":return t;case"image":case"imagebitmap":let e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function xM(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}var yM=/^data:image\/svg\+xml/,TM=/\.svg((\?|#).*)?$/;function Bo(t){return t&&(yM.test(t)||TM.test(t))}function Sd(t,e){if(Bo(e)){let n=new TextDecoder().decode(t);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 Ac(t,e)}function Ac(t,e){if(Bo(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function Co(t,e,r){let n=Sd(t,r),s=self.URL||self.webkitURL,o=typeof n!="string"&&s.createObjectURL(n);try{return await bM(o||n,e)}finally{o&&s.revokeObjectURL(o)}}async function bM(t,e){let r=new Image;return r.src=t,e.image&&e.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,s)=>{try{r.onload=()=>n(r),r.onerror=o=>{let i=o instanceof Error?o.message:"error";s(new Error(i))}}catch(o){s(o)}})}var Id=!0;async function wd(t,e,r){let n;Bo(r)?n=await Co(t,e,r):n=Ac(t,r);let s=e&&e.imagebitmap;return await EM(n,s)}async function EM(t,e=null){if((MM(e)||!Id)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(r){console.warn(r),Id=!1}return await createImageBitmap(t)}function MM(t){if(!t)return!0;for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function vd(t){return!SM(t,"ftyp",4)||!(t[8]&96)?null:_M(t)}function _M(t){switch(BM(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function BM(t,e,r){return String.fromCharCode(...t.slice(e,r))}function CM(t){return[...t].map(e=>e.charCodeAt(0))}function SM(t,e,r=0){let n=CM(e);for(let s=0;s<n.length;++s)if(n[s]!==t[s+r])return!1;return!0}var ot=!1,kn=!0;function or(t){let e=qn(t);return wM(e)||FM(e)||vM(e)||LM(e)||IM(e)}function IM(t){let e=new Uint8Array(t instanceof DataView?t.buffer:t),r=vd(e);return r?{mimeType:r.mimeType,width:0,height:0}:null}function wM(t){let e=qn(t);return e.byteLength>=24&&e.getUint32(0,ot)===2303741511?{mimeType:"image/png",width:e.getUint32(16,ot),height:e.getUint32(20,ot)}:null}function vM(t){let e=qn(t);return e.byteLength>=10&&e.getUint32(0,ot)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,kn),height:e.getUint16(8,kn)}:null}function LM(t){let e=qn(t);return e.byteLength>=14&&e.getUint16(0,ot)===16973&&e.getUint32(2,kn)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,kn),height:e.getUint32(22,kn)}:null}function FM(t){let e=qn(t);if(!(e.byteLength>=3&&e.getUint16(0,ot)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:s}=RM(),o=2;for(;o+9<e.byteLength;){let i=e.getUint16(o,ot);if(s.has(i))return{mimeType:"image/jpeg",height:e.getUint16(o+5,ot),width:e.getUint16(o+7,ot)};if(!n.has(i))return null;o+=2,o+=e.getUint16(o,ot)}return null}function RM(){let t=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)t.add(r);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function qn(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}async function Ld(t,e){let{mimeType:r}=or(t)||{},n=globalThis.loaders?.parseImageNode;return H(n),await n(t,r)}async function Fd(t,e,r){e=e||{};let s=(e.image||{}).type||"auto",{url:o}=r||{},i=PM(s),a;switch(i){case"imagebitmap":a=await wd(t,e,o);break;case"image":a=await Co(t,e,o);break;case"data":a=await Ld(t,e);break;default:H(!1)}return s==="data"&&(a=zn(a)),a}function PM(t){switch(t){case"auto":case"data":return Bd();default:return _d(t),t}}var OM=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],NM=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],DM={image:{type:"auto",decode:!0}},Vr={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:Md,mimeTypes:NM,extensions:OM,parse:Fd,tests:[t=>Boolean(or(new DataView(t)))],options:DM};var xc={};function yc(t){if(xc[t]===void 0){let e=Ln?UM(t):GM(t);xc[t]=e}return xc[t]}function GM(t){let e=["image/png","image/jpeg","image/gif"],r=globalThis.loaders?.imageFormatsNode||e,n=globalThis.loaders?.parseImageNode;return Boolean(n)&&r.includes(t)}function UM(t){switch(t){case"image/avif":case"image/webp":return VM(t);default:return!0}}function VM(t){try{return document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)===0}catch{return!1}}var Io={name:"Web Map Service (OGC WMS)",id:"wms",module:"wms",version:"0.0.0",extensions:[],mimeTypes:[],type:"wms",fromUrl:!0,fromBlob:!1,defaultOptions:{wms:{}},testURL:t=>t.toLowerCase().includes("wms"),createDataSource:(t,e)=>new So(t,e)},So=class extends Gr{substituteCRS84;flipCRS;wmsParameters;vendorParameters;capabilities=null;constructor(e,r){super(e,r,Io.defaultOptions),this.substituteCRS84=r.wms?.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,...r.wmsParameters,...r.wms?.wmsParameters},this.vendorParameters=r.wms?.vendorParameters||r.vendorParameters||{}}async getMetadata(){let e=await this.getCapabilities();return this.normalizeMetadata(e)}async getImage(e){let{boundingBox:r,bbox:n,...s}=e,o={bbox:r?[...r[0],...r[1]]:n,...s};return await this.getMap(o)}normalizeMetadata(e){return e}async getCapabilities(e,r){let n=this.getCapabilitiesURL(e,r),s=await this.fetch(n),o=await s.arrayBuffer();this._checkResponse(s,o);let i=await Ur.parse(o,this.loadOptions);return this.capabilities=i,i}async getMap(e,r){let n=this.getMapURL(e,r),s=await this.fetch(n),o=await s.arrayBuffer();this._checkResponse(s,o);try{return await Vr.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}async getFeatureInfo(e,r){let n=this.getFeatureInfoURL(e,r),s=await this.fetch(n),o=await s.arrayBuffer();return this._checkResponse(s,o),await bd.parse(o,this.loadOptions)}async getFeatureInfoText(e,r){let n=this.getFeatureInfoURL(e,r),s=await this.fetch(n),o=await s.arrayBuffer();return this._checkResponse(s,o),new TextDecoder().decode(o)}async describeLayer(e,r){let n=this.describeLayerURL(e,r),s=await this.fetch(n),o=await s.arrayBuffer();return this._checkResponse(s,o),await Ed.parse(o,this.loadOptions)}async getLegendGraphic(e,r){let n=this.getLegendGraphicURL(e,r),s=await this.fetch(n),o=await s.arrayBuffer();this._checkResponse(s,o);try{return await Vr.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}getCapabilitiesURL(e,r){let n={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetCapabilities",n,r)}getMapURL(e,r){e=this._getWMS130Parameters(e);let n={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...e};return this._getWMSUrl("GetMap",n,r)}getFeatureInfoURL(e,r){e=this._getWMS130Parameters(e);let{boundingBox:n,bbox:s}=e;e.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,...e};return this._getWMSUrl("GetFeatureInfo",o,r)}describeLayerURL(e,r){let n={version:this.wmsParameters.version,...e};return this._getWMSUrl("DescribeLayer",n,r)}getLegendGraphicURL(e,r){let n={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetLegendGraphic",n,r)}_parseWMSUrl(e){let[r,n]=e.split("?"),s=n.split("&"),o={};for(let i of s){let[a,c]=i.split("=");o[a]=c}return{url:r,parameters:o}}_getWMSUrl(e,r,n){let s=this.url,o=!0,i={service:"WMS",version:r.version,request:e,...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(e){let r={...e};return r.srs&&(r.crs=r.crs||r.srs,delete r.srs),r}_getURLParameter(e,r,n){switch(e){case"crs":n.version!=="1.3.0"?e="srs":this.substituteCRS84&&r==="EPSG:4326"&&(r="CRS:84");break;case"srs":n.version==="1.3.0"&&(e="crs");break;case"bbox":let s=this._flipBoundingBox(r,n);s&&(r=s);break;case"x":n.version==="1.3.0"&&(e="i");break;case"y":n.version==="1.3.0"&&(e="j");break;default:}return e=e.toUpperCase(),Array.isArray(r)?`${e}=${r.join(",")}`:`${e}=${r?String(r):""}`}_flipBoundingBox(e,r){if(!Array.isArray(e)||e.length!==4)return null;let n=r.version==="1.3.0"&&this.flipCRS.includes(r.crs||"")&&!(this.substituteCRS84&&r.crs==="EPSG:4326"),s=e;return n?[s[1],s[0],s[3],s[2]]:s}async _fetchArrayBuffer(e){let r=await this.fetch(e),n=await r.arrayBuffer();return this._checkResponse(r,n),n}_checkResponse(e,r){let n=e.headers["content-type"];if(!e.ok||Un.mimeTypes.includes(n)){let s=Fn(this.loadOptions,{wms:{throwOnError:!0}}),o=Un.parseSync?.(r,s);throw new Error(o)}}_parseError(e){let r=Un.parseSync?.(e,this.options.core?.loadOptions);return new Error(r)}};function wo(t,e){if(!t)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}var Ye=Math.PI,Nd=Ye/4,Rd=Ye/180,Pd=180/Ye,vo=512;function ht(t){let[e,r]=t;wo(Number.isFinite(e)),wo(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let n=e*Rd,s=r*Rd,o=vo*(n+Ye)/(2*Ye),i=vo*(Ye+Math.log(Math.tan(Nd+s*.5)))/(2*Ye);return[o,i]}function dt(t){let[e,r]=t,n=e/vo*(2*Ye)-Ye,s=2*(Math.atan(Math.exp(r/vo*(2*Ye)-Ye))-Nd);return[n*Pd,s*Pd]}var GO=Math.PI/180;var Gd=6378137*Math.PI;function Tc(t){let e=ht(t);return e[0]=(e[0]/256-1)*Gd,e[1]=(e[1]/256-1)*Gd,e}var r_={id:"imagery-layer",data:"",serviceType:"auto",srs:"auto",layers:{type:"array",compare:!0,value:[]},onMetadataLoad:{type:"function",value:()=>{}},onMetadataLoadError:{type:"function",value:console.error},onImageLoadStart:{type:"function",value:()=>{}},onImageLoad:{type:"function",value:()=>{}},onImageLoadError:{type:"function",compare:!1,value:(t,e)=>console.error(e,t)}},Hr=class extends ir.CompositeLayer{get isLoaded(){return this.state?.loadCounter===0&&super.isLoaded}shouldUpdateState(){return!0}initializeState(){this.state._nextRequestId=0,this.state.lastRequestId=-1,this.state.loadCounter=0}updateState({changeFlags:e,props:r,oldProps:n}){let{viewport:s}=this.context;e.dataChanged||r.serviceType!==n.serviceType?(this.state.imageSource=this._createImageSource(r),this._loadMetadata(),this.debounce(()=>this.loadImage(s,"image source changed"),0)):(0,ir._deepEqual)(r.layers,n.layers,1)?e.viewportChanged&&this.debounce(()=>this.loadImage(s,"viewport changed")):this.debounce(()=>this.loadImage(s,"layers changed"),0)}finalizeState(){}renderLayers(){let{bounds:e,image:r,lastRequestParameters:n}=this.state;return r&&new Ud.BitmapLayer({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:n.srs==="EPSG:4326"?ir.COORDINATE_SYSTEM.LNGLAT:ir.COORDINATE_SYSTEM.CARTESIAN,bounds:e,image:r})}async getFeatureInfoText(e,r){let{lastRequestParameters:n}=this.state;return n?await this.state.imageSource.getFeatureInfoText?.({...n,query_layers:n.layers,x:e,y:r,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(e){if(e.data instanceof Lt)return e.data;if(typeof e.data=="string")return(0,Vd.createDataSource)(e.data,[Io],{core:{type:e.serviceType,loadOptions:e.loadOptions}});throw new Error("invalid image source in props.data")}async _loadMetadata(){let{imageSource:e}=this.state;try{this.state.loadCounter++;let r=await e.getMetadata();this.state.imageSource===e&&this.getCurrentLayer()?.props.onMetadataLoad(r)}catch(r){this.getCurrentLayer()?.props.onMetadataLoadError(r)}finally{this.state.loadCounter--}}async loadImage(e,r){let{layers:n,serviceType:s}=this.props;if(s==="wms"&&n.length===0)return;let o=e.getBounds(),{width:i,height:a}=e,c=this.getRequestId(),{srs:l}=this.props;l==="auto"&&(l=e.resolution?"EPSG:4326":"EPSG:3857");let f={width:i,height:a,boundingBox:[[o[0],o[1]],[o[2],o[3]]],layers:n,crs:l};if(l==="EPSG:3857"){let u=Tc([o[0],o[1]]),h=Tc([o[2],o[3]]);f.boundingBox=[u,h]}try{this.state.loadCounter++,this.props.onImageLoadStart(c);let u=await this.state.imageSource.getImage(f);this.state.lastRequestId<c&&(this.getCurrentLayer()?.props.onImageLoad(c),this.setState({image:u,bounds:o,lastRequestParameters:f,lastRequestId:c}))}catch(u){this.raiseError(u,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(c,u)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(e,r=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>e(),r)}};Hr.layerName="WMSLayer";Hr.defaultProps=r_;var Hd=D(je(),1),n_={getHeight:{type:"accessor",value:0},greatCircle:!0},jn=class extends Hd.ArcLayer{};jn.layerName="GreatCircleLayer";jn.defaultProps=n_;var zd=jn;var Lo=D(bc(),1),s_=3,o_=30,i_=2*o_+1,qd=180/Math.PI;function Jd(t,e,r){let n=1<<e;return[(t[0]+r[0])/n,(t[1]+r[1])/n]}function jd(t){return t>=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function Wd(t){return[jd(t[0]),jd(t[1])]}function Xd(t,[e,r]){switch(t){case 0:return[1,e,r];case 1:return[-e,1,r];case 2:return[-e,-r,1];case 3:return[-1,-r,-e];case 4:return[r,-1,-e];case 5:return[r,e,-1];default:throw new Error("Invalid face")}}function Yd([t,e,r]){let n=Math.atan2(r,Math.sqrt(t*t+e*e));return[Math.atan2(e,t)*qd,n*qd]}function Kd(t){let e=Lo.default.fromString(t,!0,10).toString(2);for(;e.length<s_+i_;)e="0"+e;let r=e.lastIndexOf("1"),n=e.substring(0,3),s=e.substring(3,r),o=s.length/2,i=Lo.default.fromString(n,!0,2).toString(10),a=Lo.default.fromString(s,!0,2).toString(4);for(;a.length<o;)a="0"+a;return`${i}/${a}`}function a_(t,e,r,n){if(n===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);let s=e[0];e[0]=e[1],e[1]=s}}function Qd(t){let e=t.split("/"),r=parseInt(e[0],10),n=e[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,f=0;c==="1"?f=1:c==="2"?(l=1,f=1):c==="3"&&(l=1);let u=Math.pow(2,i-1);a_(u,o,l,f),o[0]+=u*l,o[1]+=u*f}if(r%2===1){let a=o[0];o[0]=o[1],o[1]=a}return{face:r,ij:o,level:i}}var Zd=D(bc(),1);function c_(t){let e=t.padEnd(16,"0");return Zd.default.fromString(e,16)}var l_=100;function f_({face:t,ij:e,level:r}){let n=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(l_*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),f=n[c+1],u=(f[0]-l[0])/s,h=(f[1]-l[1])/s;for(let d=0;d<s;d++){l[0]+=u,l[1]+=h;let p=Jd(e,r,l),A=Wd(p),m=Xd(t,A),y=Yd(m);Math.abs(y[1])>89.999&&(y[0]=a);let b=y[0]-a;y[0]+=b>180?-360:b<-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 u_(t){if(typeof t=="string"){if(t.indexOf("/")>0)return t;t=c_(t)}return Kd(t.toString())}function $d(t){let e=u_(t),r=Qd(e);return f_(r)}var h_={getS2Token:{type:"accessor",value:t=>t.token}},Wn=class extends Oe{indexToBounds(){let{data:e,getS2Token:r}=this.props;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(n,s)=>$d(r(n,s))}}};Wn.layerName="S2Layer";Wn.defaultProps=h_;var ep=Wn;var Ec=512;function d_(t,e){let r=0,n=0,s=1<<t.length,o=s/Ec;for(let i=0;i<t.length;i++){s>>=1;let a=parseInt(t[i]);a%2&&(r|=s),a>1&&(n|=s)}return[[r/o,Ec-n/o],[(r+e)/o,Ec-(n+e)/o]]}function tp(t,e=1){let[r,n]=d_(t,e),[s,o]=dt(r),[i,a]=dt(n);return[i,o,i,a,s,a,s,o,i,o]}var p_={getQuadkey:{type:"accessor",value:t=>t.quadkey}},Xn=class extends Oe{indexToBounds(){let{data:e,extruded:r,getQuadkey:n}=this.props,s=r?.99:1;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(o,i)=>tp(n(o,i),s),updateTriggers:{getPolygon:s}}}};Xn.layerName="QuadkeyLayer";Xn.defaultProps=p_;var rp=Xn;var Uo=D(Je(),1),yp=D(je(),1);var ar=class{constructor(e){this.index=e,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(e){this._bbox||(this._bbox=e,"west"in e?this.boundingBox=[[e.west,e.south],[e.east,e.north]]:this.boundingBox=[[e.left,e.top],[e.right,e.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let e=this.content?this.content.byteLength:0;return Number.isFinite(e)||console.error("byteLength not defined in tile data"),e}async _loadData({getData:e,requestScheduler:r,onLoad:n,onError:s}){let{index:o,id:i,bbox:a,userData:c,zoom:l}=this,f=this._loaderId;this._abortController=new AbortController;let{signal:u}=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 e({index:o,id:i,bbox:a,userData:c,zoom:l,signal:u})}catch(A){p=A||!0}finally{h.done()}if(f===this._loaderId){if(this._loader=void 0,this.content=d,this._isCancelled&&!d){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,p?s(p,this):n(this)}}loadData(e){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(e),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var Qn=D(Je(),1);var oe={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var np=new x,m_=new x,Ft=class{constructor(e=[0,0,0],r=[0,0,0],n){n=n||np.copy(e).add(r).scale(.5),this.center=new x(n),this.halfDiagonal=new x(r).subtract(this.center),this.minimum=new x(e),this.maximum=new x(r)}clone(){return new Ft(this.minimum,this.maximum,this.center)}equals(e){return this===e||Boolean(e)&&this.minimum.equals(e.minimum)&&this.maximum.equals(e.maximum)}transform(e){return this.center.transformAsPoint(e),this.halfDiagonal.transform(e),this.minimum.transform(e),this.maximum.transform(e),this}intersectPlane(e){let{halfDiagonal:r}=this,n=m_.from(e.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)+e.distance;return o-s>0?oe.INSIDE:o+s<0?oe.OUTSIDE:oe.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=np.from(e).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 Yn=new x,sp=new x,Ge=class{constructor(e=[0,0,0],r=0){this.radius=-0,this.center=new x,this.fromCenterRadius(e,r)}fromCenterRadius(e,r){return this.center.from(e),this.radius=r,this}fromCornerPoints(e,r){return r=Yn.from(r),this.center=new x().from(e).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new Ge(this.center,this.radius)}union(e){let r=this.center,n=this.radius,s=e.center,o=e.radius,i=Yn.copy(s).subtract(r),a=i.magnitude();if(n>=a+o)return this.clone();if(o>=a+n)return e.clone();let c=(n+a+o)*.5;return sp.copy(i).scale((-n+c)/a).add(r),this.center.copy(sp),this.radius=c,this}expand(e){let n=Yn.from(e).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(e){this.center.transform(e);let r=Mn.getScaling(Yn,e);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(e){let r=this.distanceTo(e);return r*r}distanceTo(e){let n=Yn.from(e).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(e){let r=this.center,n=this.radius,o=e.normal.dot(r)+e.distance;return o<-n?oe.OUTSIDE:o<n?oe.INTERSECTING:oe.INSIDE}};var g_=new x,A_=new x,Fo=new x,Ro=new x,Po=new x,x_=new x,y_=new x,pt={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Ke=class{constructor(e=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){this.center=new x().from(e),this.halfAxes=new j(r)}get halfSize(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new x(e).len(),new x(r).len(),new x(n).len()]}get quaternion(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),s=new x(e).normalize(),o=new x(r).normalize(),i=new x(n).normalize();return new rt().fromMatrix3(new j([...s,...o,...i]))}fromCenterHalfSizeQuaternion(e,r,n){let s=new rt(n),o=new j().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(e),this.halfAxes=o,this}clone(){return new Ke(this.center,this.halfAxes)}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new Ge){let r=this.halfAxes,n=r.getColumn(0,Fo),s=r.getColumn(1,Ro),o=r.getColumn(2,Po),i=g_.copy(n).add(s).add(o);return e.center.copy(this.center),e.radius=i.magnitude(),e}intersectPlane(e){let r=this.center,n=e.normal,s=this.halfAxes,o=n.x,i=n.y,a=n.z,c=Math.abs(o*s[pt.COLUMN0ROW0]+i*s[pt.COLUMN0ROW1]+a*s[pt.COLUMN0ROW2])+Math.abs(o*s[pt.COLUMN1ROW0]+i*s[pt.COLUMN1ROW1]+a*s[pt.COLUMN1ROW2])+Math.abs(o*s[pt.COLUMN2ROW0]+i*s[pt.COLUMN2ROW1]+a*s[pt.COLUMN2ROW2]),l=n.dot(r)+e.distance;return l<=-c?oe.OUTSIDE:l>=c?oe.INSIDE:oe.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=A_.from(e).subtract(this.center),n=this.halfAxes,s=n.getColumn(0,Fo),o=n.getColumn(1,Ro),i=n.getColumn(2,Po),a=s.magnitude(),c=o.magnitude(),l=i.magnitude();s.normalize(),o.normalize(),i.normalize();let f=0,u;return u=Math.abs(r.dot(s))-a,u>0&&(f+=u*u),u=Math.abs(r.dot(o))-c,u>0&&(f+=u*u),u=Math.abs(r.dot(i))-l,u>0&&(f+=u*u),f}computePlaneDistances(e,r,n=[-0,-0]){let s=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,i=this.center,a=this.halfAxes,c=a.getColumn(0,Fo),l=a.getColumn(1,Ro),f=a.getColumn(2,Po),u=x_.copy(c).add(l).add(f).add(i),h=y_.copy(u).subtract(e),d=r.dot(h);return s=Math.min(d,s),o=Math.max(d,o),u.copy(i).add(c).add(l).subtract(f),h.copy(u).subtract(e),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),u.copy(i).add(c).subtract(l).add(f),h.copy(u).subtract(e),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),u.copy(i).add(c).subtract(l).subtract(f),h.copy(u).subtract(e),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).add(l).add(f),h.copy(u).subtract(e),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).add(l).subtract(f),h.copy(u).subtract(e),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).subtract(l).add(f),h.copy(u).subtract(e),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).subtract(l).subtract(f),h.copy(u).subtract(e),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),n[0]=s,n[1]=o,n}transform(e){this.center.transformAsPoint(e);let r=this.halfAxes.getColumn(0,Fo);r.transformAsPoint(e);let n=this.halfAxes.getColumn(1,Ro);n.transformAsPoint(e);let s=this.halfAxes.getColumn(2,Po);return s.transformAsPoint(e),this.halfAxes=new j([...r,...n,...s]),this}getTransform(){throw new Error("not implemented")}};var op=new x,ip=new x,ue=class{constructor(e=[0,0,1],r=0){this.normal=new x,this.distance=-0,this.fromNormalDistance(e,r)}fromNormalDistance(e,r){return fe(Number.isFinite(r)),this.normal.from(e).normalize(),this.distance=r,this}fromPointNormal(e,r){e=op.from(e),this.normal.from(r).normalize();let n=-this.normal.dot(e);return this.distance=n,this}fromCoefficients(e,r,n,s){return this.normal.set(e,r,n),fe(be(this.normal.len(),1)),this.distance=s,this}clone(){return new ue(this.normal,this.distance)}equals(e){return be(this.distance,e.distance)&&be(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){let r=ip.copy(this.normal).transformAsVector(e).normalize(),n=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(n,r)}projectPointOntoPlane(e,r=[0,0,0]){let n=op.from(e),s=this.getPointDistance(n),o=ip.copy(this.normal).scale(s);return n.subtract(o).to(r)}};var ap=[new x([1,0,0]),new x([0,1,0]),new x([0,0,1])],cp=new x,T_=new x,ae=class{constructor(e=[]){this.planes=e}fromBoundingSphere(e){this.planes.length=2*ap.length;let r=e.center,n=e.radius,s=0;for(let o of ap){let i=this.planes[s],a=this.planes[s+1];i||(i=this.planes[s]=new ue),a||(a=this.planes[s+1]=new ue);let c=cp.copy(o).scale(-n).add(r);i.fromPointNormal(c,o);let l=cp.copy(o).scale(n).add(r),f=T_.copy(o).negate();a.fromPointNormal(l,f),s+=2}return this}computeVisibility(e){let r=oe.INSIDE;for(let n of this.planes)switch(e.intersectPlane(n)){case oe.OUTSIDE:return oe.OUTSIDE;case oe.INTERSECTING:r=oe.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(e,r){if(fe(Number.isFinite(r),"parentPlaneMask is required."),r===ae.MASK_OUTSIDE||r===ae.MASK_INSIDE)return r;let n=ae.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=e.intersectPlane(a);if(c===oe.OUTSIDE)return ae.MASK_OUTSIDE;c===oe.INTERSECTING&&(n|=i)}return n}};ae.MASK_OUTSIDE=4294967295;ae.MASK_INSIDE=0;ae.MASK_INDETERMINATE=2147483647;var eD=new x,tD=new x,rD=new x,nD=new x,sD=new x;var fD=new x,uD=new x,hD=new x,dD=new x,pD=new x,mD=new x,gD=new x,AD=new x,xD=new x,yD=new x,TD=new x,bD=new x;var it=new j,E_=new j,M_=new j,Oo=new j,lp=new j;function Bc(t,e={}){let r=Ne.EPSILON20,n=10,s=0,o=0,i=E_,a=M_;i.identity(),a.copy(t);let c=r*__(a);for(;o<n&&B_(a)>c;)C_(a,Oo),lp.copy(Oo).transpose(),a.multiplyRight(Oo),a.multiplyLeft(lp),i.multiplyRight(Oo),++s>2&&(++o,s=0);return e.unitary=i.toTarget(e.unitary),e.diagonal=a.toTarget(e.diagonal),e}function __(t){let e=0;for(let r=0;r<9;++r){let n=t[r];e+=n*n}return Math.sqrt(e)}var Mc=[1,0,0],_c=[2,2,1];function B_(t){let e=0;for(let r=0;r<3;++r){let n=t[it.getElementIndex(_c[r],Mc[r])];e+=2*n*n}return Math.sqrt(e)}function C_(t,e){let r=Ne.EPSILON15,n=0,s=1;for(let l=0;l<3;++l){let f=Math.abs(t[it.getElementIndex(_c[l],Mc[l])]);f>n&&(s=l,n=f)}let o=Mc[s],i=_c[s],a=1,c=0;if(Math.abs(t[it.getElementIndex(i,o)])>r){let l=t[it.getElementIndex(i,i)],f=t[it.getElementIndex(o,o)],u=t[it.getElementIndex(i,o)],h=(l-f)/2/u,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 j.IDENTITY.to(e),e[it.getElementIndex(o,o)]=e[it.getElementIndex(i,i)]=a,e[it.getElementIndex(i,o)]=c,e[it.getElementIndex(o,i)]=-c,e}var Rt=new x,S_=new x,I_=new x,w_=new x,v_=new x,L_=new j,F_={diagonal:new j,unitary:new j};function Kn(t,e=new Ke){if(!t||t.length===0)return e.halfAxes=new j([0,0,0,0,0,0,0,0,0]),e.center=new x,e;let r=t.length,n=new x(0,0,0);for(let T of t)n.add(T);let s=1/r;n.multiplyByScalar(s);let o=0,i=0,a=0,c=0,l=0,f=0;for(let T of t){let g=Rt.copy(T).subtract(n);o+=g.x*g.x,i+=g.x*g.y,a+=g.x*g.z,c+=g.y*g.y,l+=g.y*g.z,f+=g.z*g.z}o*=s,i*=s,a*=s,c*=s,l*=s,f*=s;let u=L_;u[0]=o,u[1]=i,u[2]=a,u[3]=i,u[4]=c,u[5]=l,u[6]=a,u[7]=l,u[8]=f;let{unitary:h}=Bc(u,F_),d=e.halfAxes.copy(h),p=d.getColumn(0,I_),A=d.getColumn(1,w_),m=d.getColumn(2,v_),y=-Number.MAX_VALUE,b=-Number.MAX_VALUE,E=-Number.MAX_VALUE,M=Number.MAX_VALUE,B=Number.MAX_VALUE,C=Number.MAX_VALUE;for(let T of t)Rt.copy(T),y=Math.max(Rt.dot(p),y),b=Math.max(Rt.dot(A),b),E=Math.max(Rt.dot(m),E),M=Math.min(Rt.dot(p),M),B=Math.min(Rt.dot(A),B),C=Math.min(Rt.dot(m),C);p=p.multiplyByScalar(.5*(M+y)),A=A.multiplyByScalar(.5*(B+b)),m=m.multiplyByScalar(.5*(C+E)),e.center.copy(p).add(A).add(m);let v=S_.set(y-M,b-B,E-C).multiplyByScalar(.5),_=new j([v[0],0,0,0,v[1],0,0,0,v[2]]);return e.halfAxes.multiplyRight(_),e}var zr=512,fp=3,up=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],hp=up.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),R_=hp.concat([[.25,.5],[.75,.5]]),Pt=class{constructor(e,r,n){this.x=e,this.y=r,this.z=n}get children(){if(!this._children){let e=this.x*2,r=this.y*2,n=this.z+1;this._children=[new Pt(e,r,n),new Pt(e,r+1,n),new Pt(e+1,r,n),new Pt(e+1,r+1,n)]}return this._children}update(e){let{viewport:r,cullingVolume:n,elevationBounds:s,minZ:o,maxZ:i,bounds:a,offset:c,project:l}=e,f=this.getBoundingVolume(s,c,l);if(a&&!this.insideBounds(a)||n.computeVisibility(f)<0)return!1;if(!this.childVisible){let{z:h}=this;if(h<i&&h>=o){let d=f.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(e);return!0}getSelected(e=[]){if(this.selected&&e.push(this),this._children)for(let r of this._children)r.getSelected(e);return e}insideBounds([e,r,n,s]){let o=Math.pow(2,this.z),i=zr/o;return this.x*i<n&&this.y*i<s&&(this.x+1)*i>e&&(this.y+1)*i>r}getBoundingVolume(e,r,n){if(n){let c=this.z<1?R_:this.z<2?hp:up,l=[];for(let f of c){let u=No(this.x+f[0],this.y+f[1],this.z);u[2]=e[0],l.push(n(u)),e[0]!==e[1]&&(u[2]=e[1],l.push(n(u)))}return Kn(l)}let s=Math.pow(2,this.z),o=zr/s,i=this.x*o+r*zr,a=zr-(this.y+1)*o;return new Ft([i,a,e[0]],[i+o,a+o,e[1]])}};function dp(t,e,r,n){let s=t instanceof Qn._GlobeViewport&&t.resolution?t.projectPosition:null,o=Object.values(t.getFrustumPlanes()).map(({normal:d,distance:p})=>new ue(d.clone().negate(),p)),i=new ae(o),a=t.distanceScales.unitsPerMeter[2],c=r&&r[0]*a||0,l=r&&r[1]*a||0,f=t instanceof Qn.WebMercatorViewport&&t.pitch<=60?e:0;if(n){let[d,p,A,m]=n,y=ht([d,m]),b=ht([A,p]);n=[y[0],zr-y[1],b[0],zr-b[1]]}let u=new Pt(0,0,0),h={viewport:t,project:s,cullingVolume:i,elevationBounds:[c,l],minZ:f,maxZ:e,bounds:n,offset:0};if(u.update(h),t instanceof Qn.WebMercatorViewport&&t.subViewports&&t.subViewports.length>1){for(h.offset=-1;u.update(h)&&!(--h.offset<-fp););for(h.offset=1;u.update(h)&&!(++h.offset>fp););}return u.getSelected()}var mt=512,P_=[-1/0,-1/0,1/0,1/0],Ot={type:"object",value:null,validate:(t,e)=>e.optional&&t===null||typeof t=="string"||Array.isArray(t)&&t.every(r=>typeof r=="string"),equal:(t,e)=>{if(t===e)return!0;if(!Array.isArray(t)||!Array.isArray(e))return!1;let r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}};function Do(t,e){let r=[e.transformAsPoint([t[0],t[1]]),e.transformAsPoint([t[2],t[1]]),e.transformAsPoint([t[0],t[3]]),e.transformAsPoint([t[2],t[3]])];return[Math.min(...r.map(s=>s[0])),Math.min(...r.map(s=>s[1])),Math.max(...r.map(s=>s[0])),Math.max(...r.map(s=>s[1]))]}function O_(t){return Math.abs(t.split("").reduce((e,r)=>(e<<5)-e+r.charCodeAt(0)|0,0))}function at(t,e){if(!t||!t.length)return null;let{index:r,id:n}=e;if(Array.isArray(t)){let o=O_(n)%t.length;t=t[o]}let s=t;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 N_(t,e,r){let n;if(e&&e.length===2){let[s,o]=e,i=t.getBounds({z:s}),a=t.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=t.getBounds();return t.isGeospatial?[Math.max(n[0],r[0]),Math.max(n[1],r[1]),Math.min(n[2],r[2]),Math.min(n[3],r[3])]:[Math.max(Math.min(n[0],r[2]),r[0]),Math.max(Math.min(n[1],r[3]),r[1]),Math.min(Math.max(n[2],r[0]),r[2]),Math.min(Math.max(n[3],r[1]),r[3])]}function mp({viewport:t,z:e,cullRect:r}){return(t.subViewports||[t]).map(s=>Cc(s,e||0,r))}function Cc(t,e,r){if(!Array.isArray(e)){let o=r.x-t.x,i=r.y-t.y,{width:a,height:c}=r,l={targetZ:e},f=t.unproject([o,i],l),u=t.unproject([o+a,i],l),h=t.unproject([o,i+c],l),d=t.unproject([o+a,i+c],l);return[Math.min(f[0],u[0],h[0],d[0]),Math.min(f[1],u[1],h[1],d[1]),Math.max(f[0],u[0],h[0],d[0]),Math.max(f[1],u[1],h[1],d[1])]}let n=Cc(t,e[0],r),s=Cc(t,e[1],r);return[Math.min(n[0],s[0]),Math.min(n[1],s[1]),Math.max(n[2],s[2]),Math.max(n[3],s[3])]}function D_(t,e,r){return r?Do(t,r).map(s=>s*e/mt):t.map(n=>n*e/mt)}function Sc(t,e){return Math.pow(2,t)*mt/e}function No(t,e,r){let n=Sc(r,mt),s=t/n*360-180,o=Math.PI-2*Math.PI*e/n,i=180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o)));return[s,i]}function pp(t,e,r,n){let s=Sc(r,n);return[t/s*mt,e/s*mt]}function Ic(t,e,r,n,s=mt){if(t.isGeospatial){let[l,f]=No(e,r,n),[u,h]=No(e+1,r+1,n);return{west:l,north:f,east:u,south:h}}let[o,i]=pp(e,r,n,s),[a,c]=pp(e+1,r+1,n,s);return{left:o,top:i,right:a,bottom:c}}function G_(t,e,r,n,s){let o=N_(t,null,n),i=Sc(e,r),[a,c,l,f]=D_(o,i,s),u=[];for(let h=Math.floor(a);h<l;h++)for(let d=Math.floor(c);d<f;d++)u.push({x:h,y:d,z:e});return u}function wc({viewport:t,maxZoom:e,minZoom:r,zRange:n,extent:s,tileSize:o=mt,modelMatrix:i,modelMatrixInverse:a,zoomOffset:c=0}){let l=t.isGeospatial?Math.round(t.zoom+Math.log2(mt/o))+c:Math.ceil(t.zoom)+c;if(typeof r=="number"&&Number.isFinite(r)&&l<r){if(!s)return[];l=r}typeof e=="number"&&Number.isFinite(e)&&l>e&&(l=e);let f=s;return i&&a&&s&&!t.isGeospatial&&(f=Do(s,i)),t.isGeospatial?dp(t,l,n,s):G_(t,l,o,f||P_,a)}function vc(t){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(t)}function Lc(t){return Number.isFinite(t.west)&&Number.isFinite(t.north)&&Number.isFinite(t.east)&&Number.isFinite(t.south)}function gp(t){let e={},r;return n=>{for(let s in n)if(!U_(n[s],e[s])){r=t(n),e=n;break}return r}}function U_(t,e){if(t===e)return!0;if(Array.isArray(t)){let r=t.length;if(!e||e.length!==r)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}return!1}var Ap=1,Go=2,V_="never",H_="no-overlap",Zn="best-available",z_=5,k_={[Zn]:j_,[H_]:J_,[V_]:()=>{}},q_={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:()=>{}},cr=class{constructor(e){this._getCullBounds=gp(mp),this.opts={...q_,...e},this.setOptions(this.opts),this.onTileLoad=r=>{this.opts.onTileLoad?.(r),this.opts.maxCacheByteSize!==null&&(this._cacheByteSize+=r.byteLength,this._resizeCache())},this._requestScheduler=new It({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 O,this._modelMatrixInverse=new O}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(e=>e.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(e=>e.needsReload)}setOptions(e){Object.assign(this.opts,e),Number.isFinite(e.maxZoom)&&(this._maxZoom=Math.floor(e.maxZoom)),Number.isFinite(e.minZoom)&&(this._minZoom=Math.ceil(e.minZoom))}finalize(){for(let e of this._cache.values())e.isLoading&&e.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let e of this._cache.keys()){let r=this._cache.get(e);!this._selectedTiles||!this._selectedTiles.includes(r)?this._cache.delete(e):r.setNeedsReload()}}update(e,{zRange:r,modelMatrix:n}={zRange:null,modelMatrix:null}){let s=n?new O(n):new O,o=!s.equals(this._modelMatrix);if(!this._viewport||!e.equals(this._viewport)||!be(this._zRange,r)||o){o&&(this._modelMatrixInverse=s.clone().invert(),this._modelMatrix=s),this._viewport=e,this._zRange=r;let a=this.getTileIndices({viewport:e,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:r,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=a.map(c=>this._getTile(c,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(a=>this._getTile(a.index,!0)));let i=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),i&&this._frameNumber++,this._frameNumber}isTileVisible(e,r,n){if(!e.isVisible)return!1;if(r&&this._viewport){let s=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:r}),{bbox:o}=e;for(let[i,a,c,l]of s){let f;if("west"in o)f=o.west<c&&o.east>i&&o.south<l&&o.north>a;else{if(n&&!O.IDENTITY.equals(n)){let[d,p,A,m]=Do([o.left,o.top,o.right,o.bottom],n);o={left:d,top:p,right:A,bottom:m}}let u=Math.min(o.top,o.bottom),h=Math.max(o.top,o.bottom);f=o.left<c&&o.right>i&&u<l&&h>a}if(f)return!0}return!1}return!0}getTileIndices({viewport:e,maxZoom:r,minZoom:n,zRange:s,modelMatrix:o,modelMatrixInverse:i}){let{tileSize:a,extent:c,zoomOffset:l}=this.opts;return wc({viewport:e,maxZoom:r,minZoom:n,zRange:s,tileSize:a,extent:c,modelMatrix:o,modelMatrixInverse:i,zoomOffset:l})}getTileId(e){return`${e.x}-${e.y}-${e.z}`}getTileZoom(e){return e.z}getTileMetadata(e){let{tileSize:r}=this.opts;return{bbox:Ic(this._viewport,e.x,e.y,e.z,r)}}getParentIndex(e){let r=Math.floor(e.x/2),n=Math.floor(e.y/2),s=e.z-1;return{x:r,y:n,z:s}}updateTileStates(){let e=this.opts.refinementStrategy||Zn,r=new Array(this._cache.size),n=0;for(let s of this._cache.values())r[n++]=s.isVisible,s.isSelected=!1,s.isVisible=!1;for(let s of this._selectedTiles)s.isSelected=!0,s.isVisible=!0;(typeof e=="function"?e:k_[e])(Array.from(this._cache.values())),n=0;for(let s of this._cache.values())if(r[n++]!==s.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:e=0}=this.opts,r=[],n=0;for(let s of this._cache.values())s.isLoading&&(n++,!s.isSelected&&!s.isVisible&&r.push(s));for(;e>0&&n>e&&r.length>0;)r.shift().abort(),n--}_rebuildTree(){let{_cache:e}=this;for(let r of e.values())r.parent=null,r.children&&(r.children.length=0);for(let r of e.values()){let n=this._getNearestAncestor(r);r.parent=n,n?.children&&n.children.push(r)}}_resizeCache(){let{_cache:e,opts:r}=this,n=r.maxCacheSize??(r.maxCacheByteSize!==null?1/0:z_*this.selectedTiles.length),s=r.maxCacheByteSize??1/0;if(e.size>n||this._cacheByteSize>s){for(let[i,a]of e)if(!a.isVisible&&!a.isSelected&&(this._cacheByteSize-=r.maxCacheByteSize!==null?a.byteLength:0,e.delete(i),this.opts.onTileUnload?.(a)),e.size<=n&&this._cacheByteSize<=s)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((i,a)=>i.zoom-a.zoom),this._dirty=!1)}_getTile(e,r){let n=this.getTileId(e),s=this._cache.get(n),o=!1;return!s&&r?(s=new ar(e),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(e){let{_minZoom:r=0}=this,n=e.index;for(;this.getTileZoom(n)>r;){n=this.getParentIndex(n);let s=this._getTile(n);if(s)return s}return null}};function j_(t){for(let e of t)e.state=0;for(let e of t)e.isSelected&&!xp(e)&&Fc(e);for(let e of t)e.isVisible=Boolean(e.state&Go)}function J_(t){for(let r of t)r.state=0;for(let r of t)r.isSelected&&xp(r);let e=Array.from(t).sort((r,n)=>r.zoom-n.zoom);for(let r of e)if(r.isVisible=Boolean(r.state&Go),r.children&&(r.isVisible||r.state&Ap))for(let n of r.children)n.state=Ap;else r.isSelected&&Fc(r)}function xp(t){let e=t;for(;e;){if(e.isLoaded||e.content)return e.state|=Go,!0;e=e.parent}return!1}function Fc(t){for(let e of t.children)e.isLoaded||e.content?e.state|=Go:Fc(e)}var W_={TilesetClass:cr,data:{type:"data",value:[]},dataComparator:Ot.equal,renderSubLayers:{type:"function",value:t=>new yp.GeoJsonLayer(t)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:t=>console.error(t)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:Zn,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},$n=class extends Uo.CompositeLayer{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every(e=>e.isLoaded&&e.layers&&e.layers.every(r=>r.isLoaded)))}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({changeFlags:e}){let{tileset:r}=this.state,n=e.propsOrDataChanged||e.updateTriggersChanged,s=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getTileData);r?n&&(r.setOptions(this._getTilesetOptions()),s?r.reloadAll():r.tiles.forEach(o=>{o.layers=null})):(r=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:r})),this._updateTileset()}_getTilesetOptions(){let{tileSize:e,maxCacheSize:r,maxCacheByteSize:n,refinementStrategy:s,extent:o,maxZoom:i,minZoom:a,maxRequests:c,debounceTime:l,zoomOffset:f}=this.props;return{maxCacheSize:r,maxCacheByteSize:n,maxZoom:i,minZoom:a,tileSize:e,refinementStrategy:s,extent:o,maxRequests:c,debounceTime:l,zoomOffset:f,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let e=this.state.tileset,{zRange:r,modelMatrix:n}=this.props,s=e.update(this.context.viewport,{zRange:r,modelMatrix:n}),{isLoaded:o}=e,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:e}=this.state,{onViewportLoad:r}=this.props;r&&r(e.selectedTiles)}_onTileLoad(e){this.props.onTileLoad(e),e.layers=null,this.setNeedsUpdate()}_onTileError(e,r){this.props.onTileError(e),r.layers=null,this.setNeedsUpdate()}_onTileUnload(e){this.props.onTileUnload(e)}getTileData(e){let{data:r,getTileData:n,fetch:s}=this.props,{signal:o}=e;return e.url=typeof r=="string"||Array.isArray(r)?at(r,e):null,n?n(e):s&&e.url?s(e.url,{propName:"data",layer:this,signal:o}):null}renderSubLayers(e){return this.props.renderSubLayers(e)}getSubLayerPropsByTile(e){return null}getPickingInfo(e){let r=e.sourceLayer,n=r.props.tile,s=e.info;return s.picked&&(s.tile=n),s.sourceTile=n,s.sourceTileSubLayer=r,s}_updateAutoHighlight(e){e.sourceTileSubLayer.updateAutoHighlight(e)}renderLayers(){return this.state.tileset.tiles.map(e=>{let r=this.getSubLayerPropsByTile(e);if(!(!e.isLoaded&&!e.content))if(e.layers)r&&e.layers[0]&&Object.keys(r).some(n=>e.layers[0].props[n]!==r[n])&&(e.layers=e.layers.map(n=>n.clone(r)));else{let n=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:e.id,updateTriggers:this.props.updateTriggers}),data:e.content,_offset:0,tile:e});e.layers=(0,Uo._flatten)(n,Boolean).map(s=>s.clone({tile:e,...r}))}return e.layers})}filterSubLayer({layer:e,cullRect:r}){let{tile:n}=e.props,{modelMatrix:s}=this.props;return this.state.tileset.isTileVisible(n,r,s?new O(s):null)}};$n.defaultProps=W_;$n.layerName="TileLayer";var lr=$n;var Ep=D(je(),1);var Tp=`uniform tripsUniforms {
|
|
14
11
|
bool fadeTrail;
|
|
15
12
|
float trailLength;
|
|
16
13
|
float currentTime;
|
|
17
14
|
} trips;
|
|
18
|
-
`,
|
|
15
|
+
`,bp={name:"trips",vs:Tp,fs:Tp,uniformTypes:{fadeTrail:"f32",trailLength:"f32",currentTime:"f32"}};var X_={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:t=>t.timestamps}},es=class extends Ep.PathLayer{getShaders(){let e=super.getShaders();return e.inject={"vs:#decl":`in float instanceTimestamps;
|
|
19
16
|
in float instanceNextTimestamps;
|
|
20
17
|
out float vTime;
|
|
21
18
|
`,"vs:#main-end":`vTime = instanceTimestamps + (instanceNextTimestamps - instanceTimestamps) * vPathPosition.y / vPathLength;
|
|
@@ -26,7 +23,7 @@ out float vTime;
|
|
|
26
23
|
`,"fs:DECKGL_FILTER_COLOR":`if(trips.fadeTrail) {
|
|
27
24
|
color.a *= 1.0 - (trips.currentTime - vTime) / trips.trailLength;
|
|
28
25
|
}
|
|
29
|
-
`},t.modules=[...t.modules,vp],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,o={fadeTrail:r,trailLength:n,currentTime:s};this.state.model.shaderInputs.setProps({trips:o}),super.draw(t)}};zn.layerName="TripsLayer";zn.defaultProps=vB;var Fp=zn;var Pp=D(Ds(),1),Op=D(qt(),1);var Dt=D(Ds(),1),bo=D(qt(),1),qn=D(zt(),1);var RB=10;function FB(e,t){let r;return e==null?r=t:typeof e=="object"?r={...e,coverage:t}:r={getHexagon:e,coverage:t},r}var PB={...qn.PolygonLayer.defaultProps,highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:e=>e.hexagon},extruded:!0},Fe=class extends bo.CompositeLayer{initializeState(){Fe._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,bo.createIterable)(this.props.data);for(let i of s){o.index++;let a=this.props.getHexagon(i,o),c=(0,Dt.getResolution)(a);if(t<0){if(t=c,!this.props.highPrecision)break}else if(t!==c){n=!0;break}if((0,Dt.isPentagon)(a)){r=!0;break}}return{resolution:t,edgeLengthKM:t>=0?(0,Dt.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,Dt.latLngToCell)(t.latitude,t.longitude,r);if(s===o)return;if(s)try{if((0,Dt.gridDistance)(s,o)*n<RB)return}catch{}let{unitsPerMeter:i}=t.distanceScales,a=Ia(o),[c,l]=(0,Dt.cellToLatLng)(o),[f,u]=t.projectFlat([l,c]);a=a.map(h=>{let d=t.projectFlat(h);return[(d[0]-f)/i[0],(d[1]-u)/i[1]]}),this.setState({centerHex:o,vertices:a})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){let{elevationScale:t,material:r,coverage:n,extruded:s,wireframe:o,stroked:i,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:f,lineWidthMaxPixels:u,getFillColor:h,getElevation:d,getLineColor:p,getLineWidth:A,transitions:m,updateTriggers:y}=this.props;return{elevationScale:t,extruded:s,coverage:n,wireframe:o,stroked:i,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:f,lineWidthMaxPixels:u,material:r,getElevation:d,getFillColor:h,getLineColor:p,getLineWidth:A,transitions:m,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",qn.PolygonLayer),i=this._getForwardProps();return i.updateTriggers.getPolygon=FB(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 $s(Ia(l,s))}})}_renderColumnLayer(){let{data:t,getHexagon:r,updateTriggers:n}=this.props,s=this.getSubLayerClass("hexagon-cell",qn.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:Lh.bind(null,r)})}};Fe.defaultProps=PB;Fe.layerName="H3HexagonLayer";Fe._checkH3Lib=()=>{};var Bo=Fe;var OB={getHexagons:{type:"accessor",value:e=>e.hexagons}},kn=class extends Ft{initializeState(){Bo._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,Op.createIterable)(n);for(let c of i){a.index++;let l=s(c,a),f=(0,Pp.cellsToMultiPolygon)(l,!0);for(let u of f){for(let h of u)Zs(h);o.push(this.getSubLayerRow({polygon:u},c,a.index))}}this.setState({polygons:o})}}indexToBounds(){let{getElevation:t,getFillColor:r,getLineColor:n,getLineWidth:s}=this.props;return{data:this.state.polygons,getPolygon:o=>o.polygon,getElevation:this.getSubLayerAccessor(t),getFillColor:this.getSubLayerAccessor(r),getLineColor:this.getSubLayerAccessor(n),getLineWidth:this.getSubLayerAccessor(s)}}};kn.layerName="H3ClusterLayer";kn.defaultProps=OB;var Np=kn;var g0=D(Mc(),1),Ge=D(qt(),1),A0=D(zt(),1),x0=D(Co(),1);var zp=D(bc(),1);function Hp(e){return{addressModeU:Vp(e.wrapS),addressModeV:Vp(e.wrapT),magFilter:NB(e.magFilter),...DB(e.minFilter)}}function Vp(e){switch(e){case 33071:return"clamp-to-edge";case 10497:return"repeat";case 33648:return"mirror-repeat";default:return}}function NB(e){switch(e){case 9728:return"nearest";case 9729:return"linear";default:return}}function DB(e){switch(e){case 9728:return{minFilter:"nearest"};case 9729:return{minFilter:"linear"};case 9984:return{minFilter:"nearest",mipmapFilter:"nearest"};case 9985:return{minFilter:"linear",mipmapFilter:"nearest"};case 9986:return{minFilter:"nearest",mipmapFilter:"linear"};case 9987:return{minFilter:"linear",mipmapFilter:"linear"};default:return{}}}function Bc(e,t,r,n){let s={defines:{MANUAL_SRGB:!0,SRGB_FAST_APPROXIMATION:!0},bindings:{},uniforms:{camera:[0,0,0],metallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=!0;let{imageBasedLightingEnvironment:o}=n;return o&&(s.bindings.pbr_diffuseEnvSampler=o.diffuseEnvSampler.texture,s.bindings.pbr_specularEnvSampler=o.specularEnvSampler.texture,s.bindings.pbr_BrdfLUT=o.brdfLutTexture.texture,s.uniforms.scaleIBLAmbient=[1,1]),n?.pbrDebug&&(s.defines.PBR_DEBUG=!0,s.uniforms.scaleDiffBaseMR=[0,0,0,0],s.uniforms.scaleFGDSpec=[0,0,0,0]),r.NORMAL&&(s.defines.HAS_NORMALS=!0),r.TANGENT&&n?.useTangents&&(s.defines.HAS_TANGENTS=!0),r.TEXCOORD_0&&(s.defines.HAS_UV=!0),n?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=!0),n?.lights&&(s.defines.USE_LIGHTS=!0),t&&GB(e,t,s),s}function GB(e,t,r){if(r.uniforms.unlit=Boolean(t.unlit),t.pbrMetallicRoughness&&UB(e,t.pbrMetallicRoughness,r),t.normalTexture){Jn(e,t.normalTexture,"pbr_normalSampler","HAS_NORMALMAP",r);let{scale:n=1}=t.normalTexture;r.uniforms.normalScale=n}if(t.occlusionTexture){Jn(e,t.occlusionTexture,"pbr_occlusionSampler","HAS_OCCLUSIONMAP",r);let{strength:n=1}=t.occlusionTexture;r.uniforms.occlusionStrength=n}switch(t.emissiveTexture&&(Jn(e,t.emissiveTexture,"pbr_emissiveSampler","HAS_EMISSIVEMAP",r),r.uniforms.emissiveFactor=t.emissiveFactor||[0,0,0]),t.alphaMode||"MASK"){case"MASK":let{alphaCutoff:n=.5}=t;r.defines.ALPHA_CUTOFF=!0,r.uniforms.alphaCutoff=n;break;case"BLEND":zp.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),r.parameters.blend=!0,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=32774,r.glParameters.blendFunc=[770,771,1,771];break}}function UB(e,t,r){t.baseColorTexture&&Jn(e,t.baseColorTexture,"pbr_baseColorSampler","HAS_BASECOLORMAP",r),r.uniforms.baseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&Jn(e,t.metallicRoughnessTexture,"pbr_metallicRoughnessSampler","HAS_METALROUGHNESSMAP",r);let{metallicFactor:n=1,roughnessFactor:s=1}=t;r.uniforms.metallicRoughnessValues=[n,s]}function Jn(e,t,r,n,s){let o=t.texture.source.image,i;o.compressed?i=o:i={data:o};let a={wrapS:10497,wrapT:10497,...t?.texture?.sampler},c=e.createTexture({id:t.uniformName||t.id,sampler:Hp(a),...i});s.bindings[r]=c,n&&(s.defines[n]=!0),s.generatedTextures.push(c)}var kp=D(bc(),1);var Cc=`precision highp int;
|
|
26
|
+
`},e.modules=[...e.modules,bp],e}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})}draw(e){let{fadeTrail:r,trailLength:n,currentTime:s}=this.props,o={fadeTrail:r,trailLength:n,currentTime:s};this.state.model.shaderInputs.setProps({trips:o}),super.draw(e)}};es.layerName="TripsLayer";es.defaultProps=X_;var Mp=es;var _p=D(Zs(),1),Bp=D(Je(),1);var Ue=D(Zs(),1),Vo=D(Je(),1),ts=D(je(),1);var Y_=10;function K_(t,e){let r;return t==null?r=e:typeof t=="object"?r={...t,coverage:e}:r={getHexagon:t,coverage:e},r}var Q_={...ts.PolygonLayer.defaultProps,highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:t=>t.hexagon},extruded:!0},Nt=class extends Vo.CompositeLayer{initializeState(){Nt._checkH3Lib(),this.state={edgeLengthKM:0,resolution:-1}}shouldUpdateState({changeFlags:e}){return this._shouldUseHighPrecision()?e.propsOrDataChanged:e.somethingChanged}updateState({props:e,changeFlags:r}){if(e.highPrecision!==!0&&(r.dataChanged||r.updateTriggersChanged&&r.updateTriggersChanged.getHexagon)){let n=this._calculateH3DataProps();this.setState(n)}this._updateVertices(this.context.viewport)}_calculateH3DataProps(){let e=-1,r=!1,n=!1,{iterable:s,objectInfo:o}=(0,Vo.createIterable)(this.props.data);for(let i of s){o.index++;let a=this.props.getHexagon(i,o),c=(0,Ue.getResolution)(a);if(e<0){if(e=c,!this.props.highPrecision)break}else if(e!==c){n=!0;break}if((0,Ue.isPentagon)(a)){r=!0;break}}return{resolution:e,edgeLengthKM:e>=0?(0,Ue.getHexagonEdgeLengthAvg)(e,"km"):0,hasMultipleRes:n,hasPentagon:r}}_shouldUseHighPrecision(){if(this.props.highPrecision==="auto"){let{resolution:e,hasPentagon:r,hasMultipleRes:n}=this.state,{viewport:s}=this.context;return Boolean(s?.resolution)||n||r||e>=0&&e<=5}return this.props.highPrecision}_updateVertices(e){if(this._shouldUseHighPrecision())return;let{resolution:r,edgeLengthKM:n,centerHex:s}=this.state;if(r<0)return;let o=this.props.centerHexagon||(0,Ue.latLngToCell)(e.latitude,e.longitude,r);if(s===o)return;if(s)try{if((0,Ue.gridDistance)(s,o)*n<Y_)return}catch{}let{unitsPerMeter:i}=e.distanceScales,a=ka(o),[c,l]=(0,Ue.cellToLatLng)(o),[f,u]=e.projectFlat([l,c]);a=a.map(h=>{let d=e.projectFlat(h);return[(d[0]-f)/i[0],(d[1]-u)/i[1]]}),this.setState({centerHex:o,vertices:a})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){let{elevationScale:e,material:r,coverage:n,extruded:s,wireframe:o,stroked:i,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:f,lineWidthMaxPixels:u,getFillColor:h,getElevation:d,getLineColor:p,getLineWidth:A,transitions:m,updateTriggers:y}=this.props;return{elevationScale:e,extruded:s,coverage:n,wireframe:o,stroked:i,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:f,lineWidthMaxPixels:u,material:r,getElevation:d,getFillColor:h,getLineColor:p,getLineWidth:A,transitions:m,updateTriggers:{getFillColor:y.getFillColor,getElevation:y.getElevation,getLineColor:y.getLineColor,getLineWidth:y.getLineWidth}}}_renderPolygonLayer(){let{data:e,getHexagon:r,updateTriggers:n,coverage:s}=this.props,o=this.getSubLayerClass("hexagon-cell-hifi",ts.PolygonLayer),i=this._getForwardProps();return i.updateTriggers.getPolygon=K_(n.getHexagon,s),new o(i,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:i.updateTriggers}),{data:e,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(a,c)=>{let l=r(a,c);return mo(ka(l,s))}})}_renderColumnLayer(){let{data:e,getHexagon:r,updateTriggers:n}=this.props,s=this.getSubLayerClass("hexagon-cell",ts.ColumnLayer),o=this._getForwardProps();return o.updateTriggers.getPosition=n.getHexagon,new s(o,this.getSubLayerProps({id:"hexagon-cell",flatShading:!0,updateTriggers:o.updateTriggers}),{data:e,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:Uh.bind(null,r)})}};Nt.defaultProps=Q_;Nt.layerName="H3HexagonLayer";Nt._checkH3Lib=()=>{};var Ho=Nt;var Z_={getHexagons:{type:"accessor",value:t=>t.hexagons}},rs=class extends Oe{initializeState(){Ho._checkH3Lib()}updateState({props:e,changeFlags:r}){if(r.dataChanged||r.updateTriggersChanged&&r.updateTriggersChanged.getHexagons){let{data:n,getHexagons:s}=e,o=[],{iterable:i,objectInfo:a}=(0,Bp.createIterable)(n);for(let c of i){a.index++;let l=s(c,a),f=(0,_p.cellsToMultiPolygon)(l,!0);for(let u of f){for(let h of u)po(h);o.push(this.getSubLayerRow({polygon:u},c,a.index))}}this.setState({polygons:o})}}indexToBounds(){let{getElevation:e,getFillColor:r,getLineColor:n,getLineWidth:s}=this.props;return{data:this.state.polygons,getPolygon:o=>o.polygon,getElevation:this.getSubLayerAccessor(e),getFillColor:this.getSubLayerAccessor(r),getLineColor:this.getSubLayerAccessor(n),getLineWidth:this.getSubLayerAccessor(s)}}};rs.layerName="H3ClusterLayer";rs.defaultProps=Z_;var Cp=rs;var c0=D(Rc(),1),Ht=D(Je(),1),l0=D(je(),1),f0=D(zo(),1);var wp="4.4.0-alpha.18";var ko={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},vp;async function Oc(t){nc(t.modules);let e=sc("basis");return e||(vp||=$_(t),await vp)}async function $_(t){let e=null,r=null;return[e,r]=await Promise.all([await De(ko.TRANSCODER,"textures",t),await De(ko.TRANSCODER_WASM,"textures",t)]),e=e||globalThis.BASIS,await eB(e,r)}function eB(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(n=>{t(r).then(s=>{let{BasisFile:o,initializeBasis:i}=s;i(),n({BasisFile:o})})})}var Pc;async function Nc(t){let e=t.modules||{};return e.basisEncoder?e.basisEncoder:(Pc=Pc||tB(t),await Pc)}async function tB(t){let e=null,r=null;return[e,r]=await Promise.all([await De(ko.ENCODER,"textures",t),await De(ko.ENCODER_WASM,"textures",t)]),e=e||globalThis.BASIS,await rB(e,r)}function rB(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(n=>{t(r).then(s=>{let{BasisFile:o,KTX2File:i,initializeBasis:a,BasisEncoder:c}=s;a(),n({BasisFile:o,KTX2File:i,BasisEncoder:c})})})}var nB=["","WEBKIT_","MOZ_"],Lp={WEBGL_compressed_texture_s3tc:["bc1-rgb-unorm-webgl","bc1-rgba-unorm","bc2-rgba-unorm","bc3-rgba-unorm"],WEBGL_compressed_texture_s3tc_srgb:["bc1-rgb-unorm-srgb-webgl","bc1-rgba-unorm-srgb","bc2-rgba-unorm-srgb","bc3-rgba-unorm-srgb"],EXT_texture_compression_rgtc:["bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm"],EXT_texture_compression_bptc:["bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"],WEBGL_compressed_texture_etc1:["etc1-rbg-unorm-webgl"],WEBGL_compressed_texture_etc:["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm"],WEBGL_compressed_texture_pvrtc:["pvrtc-rgb4unorm-webgl","pvrtc-rgba4unorm-webgl","pvrtc-rbg2unorm-webgl","pvrtc-rgba2unorm-webgl"],WEBGL_compressed_texture_atc:["atc-rgb-unorm-webgl","atc-rgba-unorm-webgl","atc-rgbai-unorm-webgl"],WEBGL_compressed_texture_astc:["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]};var qo=null;function Fp(t){if(!qo){t=t||sB()||void 0,qo=new Set;for(let e of nB)for(let r in Lp)if(t&&t.getExtension(`${e}${r}`))for(let n of Lp[r])qo.add(n)}return qo}function sB(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var Re=[171,75,84,88,32,50,48,187,13,10,26,10];function Rp(t){let e=new Uint8Array(t);return!(e.byteLength<Re.length||e[0]!==Re[0]||e[1]!==Re[1]||e[2]!==Re[2]||e[3]!==Re[3]||e[4]!==Re[4]||e[5]!==Re[5]||e[6]!==Re[6]||e[7]!==Re[7]||e[8]!==Re[8]||e[9]!==Re[9]||e[10]!==Re[10]||e[11]!==Re[11])}var Np={etc1:{basisFormat:0,compressed:!0,format:36196,textureFormat:"etc1-rbg-unorm-webgl"},etc2:{basisFormat:1,compressed:!0,format:37493,textureFormat:"etc2-rgba8unorm"},bc1:{basisFormat:2,compressed:!0,format:33776,textureFormat:"bc1-rgb-unorm-webgl"},bc3:{basisFormat:3,compressed:!0,format:33779,textureFormat:"bc3-rgba-unorm"},bc4:{basisFormat:4,compressed:!0,format:36283,textureFormat:"bc4-r-unorm"},bc5:{basisFormat:5,compressed:!0,format:36285,textureFormat:"bc5-rg-unorm"},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0,format:36492,textureFormat:"bc7-rgba-unorm"},"bc7-m5":{basisFormat:7,compressed:!0,format:36492,textureFormat:"bc7-rgba-unorm"},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:35840,textureFormat:"pvrtc-rgb4unorm-webgl"},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:35842,textureFormat:"pvrtc-rgba4unorm-webgl"},"astc-4x4":{basisFormat:10,compressed:!0,format:37808,textureFormat:"astc-4x4-unorm"},"atc-rgb":{basisFormat:11,compressed:!0,format:35986,textureFormat:"atc-rgb-unorm-webgl"},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0,format:34798,textureFormat:"atc-rgbai-unorm-webgl"},rgba32:{basisFormat:13,compressed:!1,format:32856,textureFormat:"rgba8unorm"},rgb565:{basisFormat:14,compressed:!1,format:36194,textureFormat:"rgb565unorm-webgl"},bgr565:{basisFormat:15,compressed:!1,format:36194,textureFormat:"rgb565unorm-webgl"},rgba4444:{basisFormat:16,compressed:!1,format:32854,textureFormat:"rgba4unorm-webgl"}},JG=Object.freeze(Object.keys(Np));async function Dp(t,e={}){let r=Pn(e);if(!e.basis?.containerFormat||e.basis.containerFormat==="auto"){if(Rp(t)){let s=await Nc(r);return Pp(s.KTX2File,t,e)}let{BasisFile:n}=await Oc(r);return Dc(n,t,e)}switch(e.basis.module){case"encoder":let n=await Nc(r);switch(e.basis.containerFormat){case"ktx2":return Pp(n.KTX2File,t,e);case"basis":default:return Dc(n.BasisFile,t,e)}case"transcoder":default:let{BasisFile:s}=await Oc(r);return Dc(s,t,e)}}function Dc(t,e,r){let n=new t(new Uint8Array(e));try{if(!n.startTranscoding())throw new Error("Failed to start basis transcoding");let s=n.getNumImages(),o=[];for(let i=0;i<s;i++){let a=n.getNumLevels(i),c=[];for(let l=0;l<a;l++)c.push(aB(n,i,l,r));o.push(c)}return o}finally{n.close(),n.delete()}}function aB(t,e,r,n){let s=t.getImageWidth(e,r),o=t.getImageHeight(e,r),i=t.getHasAlpha(),{compressed:a,format:c,basisFormat:l,textureFormat:f}=Gp(n,i),u=t.getImageTranscodedSizeInBytes(e,r,l),h=new Uint8Array(u);if(!t.transcodeImage(h,e,r,l,0,0))throw new Error("failed to start Basis transcoding");return{shape:"texture-level",width:s,height:o,data:h,compressed:a,...c!==void 0?{format:c}:{},...f!==void 0?{textureFormat:f}:{},hasAlpha:i}}function Pp(t,e,r){let n=new t(new Uint8Array(e));try{if(!n.startTranscoding())throw new Error("failed to start KTX2 transcoding");let s=n.getLevels(),o=[];for(let i=0;i<s;i++)o.push(cB(n,i,r));return[o]}finally{n.close(),n.delete()}}function cB(t,e,r){let{alphaFlag:n,height:s,width:o}=t.getImageLevelInfo(e,0,0),{compressed:i,format:a,basisFormat:c,textureFormat:l}=Gp(r,n),f=t.getImageTranscodedSizeInBytes(e,0,0,c),u=new Uint8Array(f);if(!t.transcodeImage(u,e,0,0,c,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{shape:"texture-level",width:o,height:s,data:u,compressed:i,...a!==void 0?{format:a}:{},...l!==void 0?{textureFormat:l}:{},levelSize:f,hasAlpha:n}}function Gp(t,e){let r=t.basis?.format||"auto";r==="auto"&&(r=t.basis?.supportedTextureFormats?Op(t.basis.supportedTextureFormats):Op()),typeof r=="object"&&(r=e?r.alpha:r.noAlpha);let n=r.toLowerCase(),s=Np[n];if(!s)throw new Error(`Unknown Basis format ${r}`);return s}function Op(t=Fp()){let e=new Set(t);return kr(e,["astc-4x4-unorm","astc-4x4-unorm-srgb"])?"astc-4x4":kr(e,["bc7-rgba-unorm","bc7-rgba-unorm-srgb"])?{alpha:"bc7-m5",noAlpha:"bc7-m6-opaque-only"}:kr(e,["bc1-rgb-unorm-webgl","bc1-rgb-unorm-srgb-webgl","bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb"])?{alpha:"bc3",noAlpha:"bc1"}:kr(e,["pvrtc-rgb4unorm-webgl","pvrtc-rgba4unorm-webgl","pvrtc-rbg2unorm-webgl","pvrtc-rgba2unorm-webgl"])?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:kr(e,["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm"])?"etc2":e.has("etc1-rbg-unorm-webgl")?"etc1":kr(e,["atc-rgb-unorm-webgl","atc-rgba-unorm-webgl","atc-rgbai-unorm-webgl"])?{alpha:"atc-rgba-interpolated-alpha",noAlpha:"atc-rgb"}:"rgb565"}function kr(t,e){return e.some(r=>t.has(r))}var Up={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:wp,worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",containerFormat:"auto",module:"transcoder"}}},Gc={...Up,parse:Dp};var Pe=D(Uc(),1);function zp(t){return{addressModeU:Hp(t.wrapS),addressModeV:Hp(t.wrapT),magFilter:lB(t.magFilter),...fB(t.minFilter)}}function Hp(t){switch(t){case 33071:return"clamp-to-edge";case 10497:return"repeat";case 33648:return"mirror-repeat";default:return}}function lB(t){switch(t){case 9728:return"nearest";case 9729:return"linear";default:return}}function fB(t){switch(t){case 9728:return{minFilter:"nearest"};case 9729:return{minFilter:"linear"};case 9984:return{minFilter:"nearest",mipmapFilter:"nearest"};case 9985:return{minFilter:"linear",mipmapFilter:"nearest"};case 9986:return{minFilter:"nearest",mipmapFilter:"linear"};case 9987:return{minFilter:"linear",mipmapFilter:"linear"};default:return{}}}function Hc(t,e,r,n){let s={defines:{MANUAL_SRGB:!0,SRGB_FAST_APPROXIMATION:!0},bindings:{},uniforms:{camera:[0,0,0],metallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=!0;let{imageBasedLightingEnvironment:o}=n;return o&&(s.bindings.pbr_diffuseEnvSampler=o.diffuseEnvSampler.texture,s.bindings.pbr_specularEnvSampler=o.specularEnvSampler.texture,s.bindings.pbr_BrdfLUT=o.brdfLutTexture.texture,s.uniforms.scaleIBLAmbient=[1,1]),n?.pbrDebug&&(s.defines.PBR_DEBUG=!0,s.uniforms.scaleDiffBaseMR=[0,0,0,0],s.uniforms.scaleFGDSpec=[0,0,0,0]),r.NORMAL&&(s.defines.HAS_NORMALS=!0),r.TANGENT&&n?.useTangents&&(s.defines.HAS_TANGENTS=!0),r.TEXCOORD_0&&(s.defines.HAS_UV=!0),r.JOINTS_0&&r.WEIGHTS_0&&(s.defines.HAS_SKIN=!0),r.COLOR_0&&(s.defines.HAS_COLORS=!0),n?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=!0),n?.lights&&(s.defines.USE_LIGHTS=!0),e&&uB(t,e,s),s}function uB(t,e,r){if(r.uniforms.unlit=Boolean(e.unlit),e.pbrMetallicRoughness&&hB(t,e.pbrMetallicRoughness,r),e.normalTexture){ns(t,e.normalTexture,"pbr_normalSampler","HAS_NORMALMAP",r);let{scale:n=1}=e.normalTexture;r.uniforms.normalScale=n}if(e.occlusionTexture){ns(t,e.occlusionTexture,"pbr_occlusionSampler","HAS_OCCLUSIONMAP",r);let{strength:n=1}=e.occlusionTexture;r.uniforms.occlusionStrength=n}switch(e.emissiveTexture&&(ns(t,e.emissiveTexture,"pbr_emissiveSampler","HAS_EMISSIVEMAP",r),r.uniforms.emissiveFactor=e.emissiveFactor||[0,0,0]),e.alphaMode||"MASK"){case"MASK":let{alphaCutoff:n=.5}=e;r.defines.ALPHA_CUTOFF=!0,r.uniforms.alphaCutoff=n;break;case"BLEND":Pe.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),r.parameters.blend=!0,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=32774,r.glParameters.blendFunc=[770,771,1,771];break}}function hB(t,e,r){e.baseColorTexture&&ns(t,e.baseColorTexture,"pbr_baseColorSampler","HAS_BASECOLORMAP",r),r.uniforms.baseColorFactor=e.baseColorFactor||[1,1,1,1],e.metallicRoughnessTexture&&ns(t,e.metallicRoughnessTexture,"pbr_metallicRoughnessSampler","HAS_METALROUGHNESSMAP",r);let{metallicFactor:n=1,roughnessFactor:s=1}=e;r.uniforms.metallicRoughnessValues=[n,s]}function ns(t,e,r,n,s){let o=e.texture.source.image,i={wrapS:10497,wrapT:10497,minFilter:9729,magFilter:9729,...e?.texture?.sampler},a={id:e.uniformName||e.id,sampler:zp(i)},c;if(o.compressed)c=pB(t,o,a);else{let{width:l,height:f}=t.getExternalImageSize(o);c=t.createTexture({...a,width:l,height:f,data:o})}s.bindings[r]=c,n&&(s.defines[n]=!0),s.generatedTextures.push(c)}function Vc(t,e){return t.createTexture({...e,format:"rgba8unorm",width:1,height:1,mipLevels:1})}function kp(t){return t.textureFormat}function dB(t,e,r){let{blockWidth:n=1,blockHeight:s=1}=Pe.textureFormatDecoder.getInfo(r),o=1;for(let i=1;;i++){let a=Math.max(1,t>>i),c=Math.max(1,e>>i);if(a<n||c<s)break;o++}return o}function pB(t,e,r){let n;if(Array.isArray(e.data)&&e.data[0]?.data?n=e.data:"mipmaps"in e&&Array.isArray(e.mipmaps)?n=e.mipmaps:n=[],n.length===0||!n[0]?.data)return Pe.log.warn("createCompressedTexture: compressed image has no valid mip levels, creating fallback")(),Vc(t,r);let s=n[0],o=s.width??e.width??0,i=s.height??e.height??0;if(o<=0||i<=0)return Pe.log.warn("createCompressedTexture: base level has invalid dimensions, creating fallback")(),Vc(t,r);let a=kp(s);if(!a)return Pe.log.warn("createCompressedTexture: compressed image has no textureFormat, creating fallback")(),Vc(t,r);let c=dB(o,i,a),l=Math.min(n.length,c),f=1;for(let h=1;h<l;h++){let d=n[h];if(!d.data||d.width<=0||d.height<=0){Pe.log.warn(`createCompressedTexture: mip level ${h} has invalid data/dimensions, truncating`)();break}let p=kp(d);if(p&&p!==a){Pe.log.warn(`createCompressedTexture: mip level ${h} format '${p}' differs from base '${a}', truncating`)();break}let A=Math.max(1,o>>h),m=Math.max(1,i>>h);if(d.width!==A||d.height!==m){Pe.log.warn(`createCompressedTexture: mip level ${h} dimensions ${d.width}x${d.height} don't match expected ${A}x${m}, truncating`)();break}f++}let u=t.createTexture({...r,format:a,usage:Pe.Texture.TEXTURE|Pe.Texture.COPY_DST,width:o,height:i,mipLevels:f,data:s.data});for(let h=1;h<f;h++)u.writeData(n[h].data,{width:n[h].width,height:n[h].height,mipLevel:h});return u}var jp=D(Uc(),1);var zc=`precision highp int;
|
|
30
27
|
|
|
31
28
|
// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
|
|
32
29
|
struct AmbientLight {
|
|
@@ -67,6 +64,16 @@ uniform lightingUniforms {
|
|
|
67
64
|
vec3 lightPosition2;
|
|
68
65
|
vec3 lightDirection2;
|
|
69
66
|
vec3 lightAttenuation2;
|
|
67
|
+
|
|
68
|
+
vec3 lightColor3;
|
|
69
|
+
vec3 lightPosition3;
|
|
70
|
+
vec3 lightDirection3;
|
|
71
|
+
vec3 lightAttenuation3;
|
|
72
|
+
|
|
73
|
+
vec3 lightColor4;
|
|
74
|
+
vec3 lightPosition4;
|
|
75
|
+
vec3 lightDirection4;
|
|
76
|
+
vec3 lightAttenuation4;
|
|
70
77
|
} lighting;
|
|
71
78
|
|
|
72
79
|
PointLight lighting_getPointLight(int index) {
|
|
@@ -76,8 +83,12 @@ PointLight lighting_getPointLight(int index) {
|
|
|
76
83
|
case 1:
|
|
77
84
|
return PointLight(lighting.lightColor1, lighting.lightPosition1, lighting.lightAttenuation1);
|
|
78
85
|
case 2:
|
|
79
|
-
default:
|
|
80
86
|
return PointLight(lighting.lightColor2, lighting.lightPosition2, lighting.lightAttenuation2);
|
|
87
|
+
case 3:
|
|
88
|
+
return PointLight(lighting.lightColor3, lighting.lightPosition3, lighting.lightAttenuation3);
|
|
89
|
+
case 4:
|
|
90
|
+
default:
|
|
91
|
+
return PointLight(lighting.lightColor4, lighting.lightPosition4, lighting.lightAttenuation4);
|
|
81
92
|
}
|
|
82
93
|
}
|
|
83
94
|
|
|
@@ -88,8 +99,12 @@ DirectionalLight lighting_getDirectionalLight(int index) {
|
|
|
88
99
|
case 1:
|
|
89
100
|
return DirectionalLight(lighting.lightColor1, lighting.lightDirection1);
|
|
90
101
|
case 2:
|
|
91
|
-
default:
|
|
92
102
|
return DirectionalLight(lighting.lightColor2, lighting.lightDirection2);
|
|
103
|
+
case 3:
|
|
104
|
+
return DirectionalLight(lighting.lightColor3, lighting.lightDirection3);
|
|
105
|
+
case 4:
|
|
106
|
+
default:
|
|
107
|
+
return DirectionalLight(lighting.lightColor4, lighting.lightDirection4);
|
|
93
108
|
}
|
|
94
109
|
}
|
|
95
110
|
|
|
@@ -101,6 +116,8 @@ float getPointLightAttenuation(PointLight pointLight, float distance) {
|
|
|
101
116
|
|
|
102
117
|
// #endif
|
|
103
118
|
`;var qp=`// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
|
|
119
|
+
const MAX_LIGHTS: i32 = 5;
|
|
120
|
+
|
|
104
121
|
struct AmbientLight {
|
|
105
122
|
color: vec3<f32>,
|
|
106
123
|
};
|
|
@@ -118,32 +135,80 @@ struct DirectionalLight {
|
|
|
118
135
|
|
|
119
136
|
struct lightingUniforms {
|
|
120
137
|
enabled: i32,
|
|
121
|
-
|
|
138
|
+
lightType: i32,
|
|
139
|
+
|
|
122
140
|
directionalLightCount: i32,
|
|
141
|
+
pointLightCount: i32,
|
|
123
142
|
|
|
124
143
|
ambientColor: vec3<f32>,
|
|
125
144
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
145
|
+
lightColor0: vec3<f32>,
|
|
146
|
+
lightPosition0: vec3<f32>,
|
|
147
|
+
lightDirection0: vec3<f32>,
|
|
148
|
+
lightAttenuation0: vec3<f32>,
|
|
149
|
+
|
|
150
|
+
lightColor1: vec3<f32>,
|
|
151
|
+
lightPosition1: vec3<f32>,
|
|
152
|
+
lightDirection1: vec3<f32>,
|
|
153
|
+
lightAttenuation1: vec3<f32>,
|
|
154
|
+
|
|
155
|
+
lightColor2: vec3<f32>,
|
|
156
|
+
lightPosition2: vec3<f32>,
|
|
157
|
+
lightDirection2: vec3<f32>,
|
|
158
|
+
lightAttenuation2: vec3<f32>,
|
|
159
|
+
|
|
160
|
+
lightColor3: vec3<f32>,
|
|
161
|
+
lightPosition3: vec3<f32>,
|
|
162
|
+
lightDirection3: vec3<f32>,
|
|
163
|
+
lightAttenuation3: vec3<f32>,
|
|
164
|
+
|
|
165
|
+
lightColor4: vec3<f32>,
|
|
166
|
+
lightPosition4: vec3<f32>,
|
|
167
|
+
lightDirection4: vec3<f32>,
|
|
168
|
+
lightAttenuation4: vec3<f32>,
|
|
136
169
|
};
|
|
137
170
|
|
|
138
171
|
// Binding 0:1 is reserved for lighting (Note: could go into separate bind group as it is stable across draw calls)
|
|
139
172
|
@binding(1) @group(0) var<uniform> lighting : lightingUniforms;
|
|
140
173
|
|
|
141
174
|
fn lighting_getPointLight(index: i32) -> PointLight {
|
|
142
|
-
|
|
175
|
+
switch (index) {
|
|
176
|
+
case 0: {
|
|
177
|
+
return PointLight(lighting.lightColor0, lighting.lightPosition0, lighting.lightAttenuation0);
|
|
178
|
+
}
|
|
179
|
+
case 1: {
|
|
180
|
+
return PointLight(lighting.lightColor1, lighting.lightPosition1, lighting.lightAttenuation1);
|
|
181
|
+
}
|
|
182
|
+
case 2: {
|
|
183
|
+
return PointLight(lighting.lightColor2, lighting.lightPosition2, lighting.lightAttenuation2);
|
|
184
|
+
}
|
|
185
|
+
case 3: {
|
|
186
|
+
return PointLight(lighting.lightColor3, lighting.lightPosition3, lighting.lightAttenuation3);
|
|
187
|
+
}
|
|
188
|
+
case 4, default: {
|
|
189
|
+
return PointLight(lighting.lightColor4, lighting.lightPosition4, lighting.lightAttenuation4);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
143
192
|
}
|
|
144
193
|
|
|
145
194
|
fn lighting_getDirectionalLight(index: i32) -> DirectionalLight {
|
|
146
|
-
|
|
195
|
+
switch (index) {
|
|
196
|
+
case 0: {
|
|
197
|
+
return DirectionalLight(lighting.lightColor0, lighting.lightDirection0);
|
|
198
|
+
}
|
|
199
|
+
case 1: {
|
|
200
|
+
return DirectionalLight(lighting.lightColor1, lighting.lightDirection1);
|
|
201
|
+
}
|
|
202
|
+
case 2: {
|
|
203
|
+
return DirectionalLight(lighting.lightColor2, lighting.lightDirection2);
|
|
204
|
+
}
|
|
205
|
+
case 3: {
|
|
206
|
+
return DirectionalLight(lighting.lightColor3, lighting.lightDirection3);
|
|
207
|
+
}
|
|
208
|
+
case 4, default: {
|
|
209
|
+
return DirectionalLight(lighting.lightColor4, lighting.lightDirection4);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
147
212
|
}
|
|
148
213
|
|
|
149
214
|
fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 {
|
|
@@ -151,7 +216,7 @@ fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 {
|
|
|
151
216
|
+ pointLight.attenuation.y * distance
|
|
152
217
|
+ pointLight.attenuation.z * distance * distance;
|
|
153
218
|
}
|
|
154
|
-
`;var
|
|
219
|
+
`;var jo=5,mB=255,os;(function(t){t[t.POINT=0]="POINT",t[t.DIRECTIONAL=1]="DIRECTIONAL"})(os||(os={}));var ss={props:{},uniforms:{},name:"lighting",defines:{},uniformTypes:{enabled:"i32",lightType:"i32",directionalLightCount:"i32",pointLightCount:"i32",ambientColor:"vec3<f32>",lightColor0:"vec3<f32>",lightPosition0:"vec3<f32>",lightDirection0:"vec3<f32>",lightAttenuation0:"vec3<f32>",lightColor1:"vec3<f32>",lightPosition1:"vec3<f32>",lightDirection1:"vec3<f32>",lightAttenuation1:"vec3<f32>",lightColor2:"vec3<f32>",lightPosition2:"vec3<f32>",lightDirection2:"vec3<f32>",lightAttenuation2:"vec3<f32>",lightColor3:"vec3<f32>",lightPosition3:"vec3<f32>",lightDirection3:"vec3<f32>",lightAttenuation3:"vec3<f32>",lightColor4:"vec3<f32>",lightPosition4:"vec3<f32>",lightDirection4:"vec3<f32>",lightAttenuation4:"vec3<f32>"},defaultUniforms:{enabled:1,lightType:os.POINT,directionalLightCount:0,pointLightCount:0,ambientColor:[.1,.1,.1],lightColor0:[1,1,1],lightPosition0:[1,1,2],lightDirection0:[1,1,1],lightAttenuation0:[1,0,0],lightColor1:[1,1,1],lightPosition1:[1,1,2],lightDirection1:[1,1,1],lightAttenuation1:[1,0,0],lightColor2:[1,1,1],lightPosition2:[1,1,2],lightDirection2:[1,1,1],lightAttenuation2:[1,0,0],lightColor3:[1,1,1],lightPosition3:[1,1,2],lightDirection3:[1,1,1],lightAttenuation3:[1,0,0],lightColor4:[1,1,1],lightPosition4:[1,1,2],lightDirection4:[1,1,1],lightAttenuation4:[1,0,0]},source:qp,vs:zc,fs:zc,getUniforms:gB};function gB(t,e={}){if(t=t&&{...t},!t)return{...ss.defaultUniforms};t.lights&&(t={...t,...xB(t.lights),lights:void 0});let{ambientLight:r,pointLights:n,directionalLights:s}=t||{};if(!(r||n&&n.length>0||s&&s.length>0))return{...ss.defaultUniforms,enabled:0};let i={...ss.defaultUniforms,...e,...AB({ambientLight:r,pointLights:n,directionalLights:s})};return t.enabled!==void 0&&(i.enabled=t.enabled?1:0),i}function AB({ambientLight:t,pointLights:e=[],directionalLights:r=[]}){let n={};n.ambientColor=kc(t);let s=0,o=0,i=0;for(let a of e){if(s>=jo)break;n.lightType=os.POINT;let c=s;n[`lightColor${c}`]=kc(a),n[`lightPosition${c}`]=a.position,n[`lightAttenuation${c}`]=a.attenuation||[1,0,0],s++,o++}for(let a of r){if(s>=jo)break;n.lightType=os.DIRECTIONAL;let c=s;n[`lightColor${c}`]=kc(a),n[`lightDirection${c}`]=a.direction,s++,i++}return e.length+r.length>jo&&jp.log.warn(`MAX_LIGHTS exceeded, truncating to ${jo}`)(),n.directionalLightCount=i,n.pointLightCount=o,n}function xB(t){let e={pointLights:[],directionalLights:[]};for(let r of t||[])switch(r.type){case"ambient":e.ambientLight=r;break;case"directional":e.directionalLights?.push(r);break;case"point":e.pointLights?.push(r);break;default:}return e}function kc(t={}){let{color:e=[0,0,0],intensity:r=1}=t;return e.map(n=>n*r/mB)}var Jp=`out vec3 pbr_vPosition;
|
|
155
220
|
out vec2 pbr_vUV;
|
|
156
221
|
|
|
157
222
|
#ifdef HAS_NORMALS
|
|
@@ -184,7 +249,7 @@ void pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, ve
|
|
|
184
249
|
pbr_vUV = vec2(0.,0.);
|
|
185
250
|
#endif
|
|
186
251
|
}
|
|
187
|
-
`,
|
|
252
|
+
`,Wp=`precision highp float;
|
|
188
253
|
|
|
189
254
|
uniform pbrMaterialUniforms {
|
|
190
255
|
// Material is unlit
|
|
@@ -208,6 +273,40 @@ uniform pbrMaterialUniforms {
|
|
|
208
273
|
|
|
209
274
|
bool alphaCutoffEnabled;
|
|
210
275
|
float alphaCutoff; // #ifdef ALPHA_CUTOFF
|
|
276
|
+
|
|
277
|
+
vec3 specularColorFactor;
|
|
278
|
+
float specularIntensityFactor;
|
|
279
|
+
bool specularColorMapEnabled;
|
|
280
|
+
bool specularIntensityMapEnabled;
|
|
281
|
+
|
|
282
|
+
float ior;
|
|
283
|
+
|
|
284
|
+
float transmissionFactor;
|
|
285
|
+
bool transmissionMapEnabled;
|
|
286
|
+
|
|
287
|
+
float thicknessFactor;
|
|
288
|
+
float attenuationDistance;
|
|
289
|
+
vec3 attenuationColor;
|
|
290
|
+
|
|
291
|
+
float clearcoatFactor;
|
|
292
|
+
float clearcoatRoughnessFactor;
|
|
293
|
+
bool clearcoatMapEnabled;
|
|
294
|
+
|
|
295
|
+
vec3 sheenColorFactor;
|
|
296
|
+
float sheenRoughnessFactor;
|
|
297
|
+
bool sheenColorMapEnabled;
|
|
298
|
+
|
|
299
|
+
float iridescenceFactor;
|
|
300
|
+
float iridescenceIor;
|
|
301
|
+
vec2 iridescenceThicknessRange;
|
|
302
|
+
bool iridescenceMapEnabled;
|
|
303
|
+
|
|
304
|
+
float anisotropyStrength;
|
|
305
|
+
float anisotropyRotation;
|
|
306
|
+
vec2 anisotropyDirection;
|
|
307
|
+
bool anisotropyMapEnabled;
|
|
308
|
+
|
|
309
|
+
float emissiveStrength;
|
|
211
310
|
|
|
212
311
|
// IBL
|
|
213
312
|
bool IBLenabled;
|
|
@@ -236,6 +335,29 @@ uniform sampler2D pbr_metallicRoughnessSampler;
|
|
|
236
335
|
#ifdef HAS_OCCLUSIONMAP
|
|
237
336
|
uniform sampler2D pbr_occlusionSampler;
|
|
238
337
|
#endif
|
|
338
|
+
#ifdef HAS_SPECULARCOLORMAP
|
|
339
|
+
uniform sampler2D pbr_specularColorSampler;
|
|
340
|
+
#endif
|
|
341
|
+
#ifdef HAS_SPECULARINTENSITYMAP
|
|
342
|
+
uniform sampler2D pbr_specularIntensitySampler;
|
|
343
|
+
#endif
|
|
344
|
+
#ifdef HAS_TRANSMISSIONMAP
|
|
345
|
+
uniform sampler2D pbr_transmissionSampler;
|
|
346
|
+
#endif
|
|
347
|
+
#ifdef HAS_CLEARCOATMAP
|
|
348
|
+
uniform sampler2D pbr_clearcoatSampler;
|
|
349
|
+
uniform sampler2D pbr_clearcoatRoughnessSampler;
|
|
350
|
+
#endif
|
|
351
|
+
#ifdef HAS_SHEENCOLORMAP
|
|
352
|
+
uniform sampler2D pbr_sheenColorSampler;
|
|
353
|
+
uniform sampler2D pbr_sheenRoughnessSampler;
|
|
354
|
+
#endif
|
|
355
|
+
#ifdef HAS_IRIDESCENCEMAP
|
|
356
|
+
uniform sampler2D pbr_iridescenceSampler;
|
|
357
|
+
#endif
|
|
358
|
+
#ifdef HAS_ANISOTROPYMAP
|
|
359
|
+
uniform sampler2D pbr_anisotropySampler;
|
|
360
|
+
#endif
|
|
239
361
|
#ifdef USE_IBL
|
|
240
362
|
uniform samplerCube pbr_diffuseEnvSampler;
|
|
241
363
|
uniform samplerCube pbr_specularEnvSampler;
|
|
@@ -588,51 +710,55 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
588
710
|
`;var Xp=`struct PBRFragmentInputs {
|
|
589
711
|
pbr_vPosition: vec3f,
|
|
590
712
|
pbr_vUV: vec2f,
|
|
591
|
-
pbr_vTBN:
|
|
713
|
+
pbr_vTBN: mat3x3f,
|
|
592
714
|
pbr_vNormal: vec3f
|
|
593
715
|
};
|
|
594
716
|
|
|
595
|
-
var fragmentInputs: PBRFragmentInputs;
|
|
717
|
+
var<private> fragmentInputs: PBRFragmentInputs;
|
|
596
718
|
|
|
597
719
|
fn pbr_setPositionNormalTangentUV(position: vec4f, normal: vec4f, tangent: vec4f, uv: vec2f)
|
|
598
720
|
{
|
|
599
721
|
var pos: vec4f = pbrProjection.modelMatrix * position;
|
|
600
|
-
pbr_vPosition =
|
|
722
|
+
fragmentInputs.pbr_vPosition = pos.xyz / pos.w;
|
|
723
|
+
fragmentInputs.pbr_vNormal = vec3f(0.0, 0.0, 1.0);
|
|
724
|
+
fragmentInputs.pbr_vTBN = mat3x3f(
|
|
725
|
+
vec3f(1.0, 0.0, 0.0),
|
|
726
|
+
vec3f(0.0, 1.0, 0.0),
|
|
727
|
+
vec3f(0.0, 0.0, 1.0)
|
|
728
|
+
);
|
|
729
|
+
fragmentInputs.pbr_vUV = vec2f(0.0, 0.0);
|
|
601
730
|
|
|
602
731
|
#ifdef HAS_NORMALS
|
|
732
|
+
let normalW: vec3f = normalize((pbrProjection.normalMatrix * vec4f(normal.xyz, 0.0)).xyz);
|
|
733
|
+
fragmentInputs.pbr_vNormal = normalW;
|
|
603
734
|
#ifdef HAS_TANGENTS
|
|
604
|
-
let
|
|
605
|
-
let tangentW: vec3f = normalize(vec3(pbrProjection.modelMatrix * vec4(tangent.xyz, 0.0)));
|
|
735
|
+
let tangentW: vec3f = normalize((pbrProjection.modelMatrix * vec4f(tangent.xyz, 0.0)).xyz);
|
|
606
736
|
let bitangentW: vec3f = cross(normalW, tangentW) * tangent.w;
|
|
607
|
-
fragmentInputs
|
|
608
|
-
#else // HAS_TANGENTS != 1
|
|
609
|
-
fragmentInputs.pbr_vNormal = normalize(vec3(pbrProjection.modelMatrix * vec4(normal.xyz, 0.0)));
|
|
737
|
+
fragmentInputs.pbr_vTBN = mat3x3f(tangentW, bitangentW, normalW);
|
|
610
738
|
#endif
|
|
611
739
|
#endif
|
|
612
740
|
|
|
613
741
|
#ifdef HAS_UV
|
|
614
|
-
pbr_vUV = uv;
|
|
615
|
-
#else
|
|
616
|
-
pbr_vUV = vec2(0.,0.);
|
|
742
|
+
fragmentInputs.pbr_vUV = uv;
|
|
617
743
|
#endif
|
|
618
744
|
}
|
|
619
745
|
|
|
620
746
|
struct pbrMaterialUniforms {
|
|
621
747
|
// Material is unlit
|
|
622
|
-
unlit:
|
|
748
|
+
unlit: u32,
|
|
623
749
|
|
|
624
750
|
// Base color map
|
|
625
|
-
baseColorMapEnabled:
|
|
751
|
+
baseColorMapEnabled: u32,
|
|
626
752
|
baseColorFactor: vec4f,
|
|
627
753
|
|
|
628
|
-
normalMapEnabled :
|
|
754
|
+
normalMapEnabled : u32,
|
|
629
755
|
normalScale: f32, // #ifdef HAS_NORMALMAP
|
|
630
756
|
|
|
631
|
-
emissiveMapEnabled:
|
|
757
|
+
emissiveMapEnabled: u32,
|
|
632
758
|
emissiveFactor: vec3f, // #ifdef HAS_EMISSIVEMAP
|
|
633
759
|
|
|
634
760
|
metallicRoughnessValues: vec2f,
|
|
635
|
-
metallicRoughnessMapEnabled:
|
|
761
|
+
metallicRoughnessMapEnabled: u32,
|
|
636
762
|
|
|
637
763
|
occlusionMapEnabled: i32,
|
|
638
764
|
occlusionStrength: f32, // #ifdef HAS_OCCLUSIONMAP
|
|
@@ -647,32 +773,40 @@ struct pbrMaterialUniforms {
|
|
|
647
773
|
// debugging flags used for shader output of intermediate PBR variables
|
|
648
774
|
// #ifdef PBR_DEBUG
|
|
649
775
|
scaleDiffBaseMR: vec4f,
|
|
650
|
-
scaleFGDSpec: vec4f
|
|
776
|
+
scaleFGDSpec: vec4f,
|
|
651
777
|
// #endif
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
@binding(2) @group(0) var<uniform>
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
@binding(2) @group(0) var<uniform> pbrMaterial : pbrMaterialUniforms;
|
|
655
781
|
|
|
656
782
|
// Samplers
|
|
657
783
|
#ifdef HAS_BASECOLORMAP
|
|
658
|
-
|
|
784
|
+
@binding(3) @group(0) var pbr_baseColorSampler: texture_2d<f32>;
|
|
785
|
+
@binding(4) @group(0) var pbr_baseColorSamplerSampler: sampler;
|
|
659
786
|
#endif
|
|
660
787
|
#ifdef HAS_NORMALMAP
|
|
661
|
-
|
|
788
|
+
@binding(5) @group(0) var pbr_normalSampler: texture_2d<f32>;
|
|
789
|
+
@binding(6) @group(0) var pbr_normalSamplerSampler: sampler;
|
|
662
790
|
#endif
|
|
663
791
|
#ifdef HAS_EMISSIVEMAP
|
|
664
|
-
|
|
792
|
+
@binding(7) @group(0) var pbr_emissiveSampler: texture_2d<f32>;
|
|
793
|
+
@binding(8) @group(0) var pbr_emissiveSamplerSampler: sampler;
|
|
665
794
|
#endif
|
|
666
795
|
#ifdef HAS_METALROUGHNESSMAP
|
|
667
|
-
|
|
796
|
+
@binding(9) @group(0) var pbr_metallicRoughnessSampler: texture_2d<f32>;
|
|
797
|
+
@binding(10) @group(0) var pbr_metallicRoughnessSamplerSampler: sampler;
|
|
668
798
|
#endif
|
|
669
799
|
#ifdef HAS_OCCLUSIONMAP
|
|
670
|
-
|
|
800
|
+
@binding(11) @group(0) var pbr_occlusionSampler: texture_2d<f32>;
|
|
801
|
+
@binding(12) @group(0) var pbr_occlusionSamplerSampler: sampler;
|
|
671
802
|
#endif
|
|
672
803
|
#ifdef USE_IBL
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
804
|
+
@binding(13) @group(0) var pbr_diffuseEnvSampler: texture_cube<f32>;
|
|
805
|
+
@binding(14) @group(0) var pbr_diffuseEnvSamplerSampler: sampler;
|
|
806
|
+
@binding(15) @group(0) var pbr_specularEnvSampler: texture_cube<f32>;
|
|
807
|
+
@binding(16) @group(0) var pbr_specularEnvSamplerSampler: sampler;
|
|
808
|
+
@binding(17) @group(0) var pbr_BrdfLUT: texture_2d<f32>;
|
|
809
|
+
@binding(18) @group(0) var pbr_BrdfLUTSampler: sampler;
|
|
676
810
|
#endif
|
|
677
811
|
|
|
678
812
|
// Encapsulate the various inputs used by the various functions in the shading equation
|
|
@@ -700,17 +834,19 @@ const c_MinRoughness = 0.04;
|
|
|
700
834
|
|
|
701
835
|
fn SRGBtoLINEAR(srgbIn: vec4f ) -> vec4f
|
|
702
836
|
{
|
|
837
|
+
var linOut: vec3f = srgbIn.xyz;
|
|
703
838
|
#ifdef MANUAL_SRGB
|
|
839
|
+
let bLess: vec3f = step(vec3f(0.04045), srgbIn.xyz);
|
|
840
|
+
linOut = mix(
|
|
841
|
+
srgbIn.xyz / vec3f(12.92),
|
|
842
|
+
pow((srgbIn.xyz + vec3f(0.055)) / vec3f(1.055), vec3f(2.4)),
|
|
843
|
+
bLess
|
|
844
|
+
);
|
|
704
845
|
#ifdef SRGB_FAST_APPROXIMATION
|
|
705
|
-
|
|
706
|
-
#
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
#endif //SRGB_FAST_APPROXIMATION
|
|
710
|
-
return vec4f(linOut,srgbIn.w);;
|
|
711
|
-
#else //MANUAL_SRGB
|
|
712
|
-
return srgbIn;
|
|
713
|
-
#endif //MANUAL_SRGB
|
|
846
|
+
linOut = pow(srgbIn.xyz, vec3f(2.2));
|
|
847
|
+
#endif
|
|
848
|
+
#endif
|
|
849
|
+
return vec4f(linOut, srgbIn.w);
|
|
714
850
|
}
|
|
715
851
|
|
|
716
852
|
// Find the normal for this fragment, pulling either from a predefined normal map
|
|
@@ -718,32 +854,28 @@ fn SRGBtoLINEAR(srgbIn: vec4f ) -> vec4f
|
|
|
718
854
|
fn getNormal() -> vec3f
|
|
719
855
|
{
|
|
720
856
|
// Retrieve the tangent space matrix
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
var
|
|
726
|
-
var t: vec3f = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
|
|
857
|
+
let pos_dx: vec3f = dpdx(fragmentInputs.pbr_vPosition);
|
|
858
|
+
let pos_dy: vec3f = dpdy(fragmentInputs.pbr_vPosition);
|
|
859
|
+
let tex_dx: vec3f = dpdx(vec3f(fragmentInputs.pbr_vUV, 0.0));
|
|
860
|
+
let tex_dy: vec3f = dpdy(vec3f(fragmentInputs.pbr_vUV, 0.0));
|
|
861
|
+
var t: vec3f = (tex_dy.y * pos_dx - tex_dx.y * pos_dy) / (tex_dx.x * tex_dy.y - tex_dy.x * tex_dx.y);
|
|
727
862
|
|
|
728
|
-
#ifdef HAS_NORMALS
|
|
729
|
-
var ng: vec3f = normalize(pbr_vNormal);
|
|
730
|
-
#else
|
|
731
863
|
var ng: vec3f = cross(pos_dx, pos_dy);
|
|
864
|
+
#ifdef HAS_NORMALS
|
|
865
|
+
ng = normalize(fragmentInputs.pbr_vNormal);
|
|
732
866
|
#endif
|
|
733
|
-
|
|
734
867
|
t = normalize(t - ng * dot(ng, t));
|
|
735
868
|
var b: vec3f = normalize(cross(ng, t));
|
|
736
|
-
var tbn:
|
|
737
|
-
#
|
|
738
|
-
|
|
869
|
+
var tbn: mat3x3f = mat3x3f(t, b, ng);
|
|
870
|
+
#ifdef HAS_TANGENTS
|
|
871
|
+
tbn = fragmentInputs.pbr_vTBN;
|
|
739
872
|
#endif
|
|
740
873
|
|
|
741
|
-
#ifdef HAS_NORMALMAP
|
|
742
|
-
vec3 n = texture(pbr_normalSampler, pbr_vUV).rgb;
|
|
743
|
-
n = normalize(tbn * ((2.0 * n - 1.0) * vec3(pbrMaterial.normalScale, pbrMaterial.normalScale, 1.0)));
|
|
744
|
-
#else
|
|
745
874
|
// The tbn matrix is linearly interpolated, so we need to re-normalize
|
|
746
|
-
|
|
875
|
+
var n: vec3f = normalize(tbn[2].xyz);
|
|
876
|
+
#ifdef HAS_NORMALMAP
|
|
877
|
+
n = textureSample(pbr_normalSampler, pbr_normalSamplerSampler, fragmentInputs.pbr_vUV).rgb;
|
|
878
|
+
n = normalize(tbn * ((2.0 * n - 1.0) * vec3f(pbrMaterial.normalScale, pbrMaterial.normalScale, 1.0)));
|
|
747
879
|
#endif
|
|
748
880
|
|
|
749
881
|
return n;
|
|
@@ -753,27 +885,37 @@ fn getNormal() -> vec3f
|
|
|
753
885
|
// Precomputed Environment Maps are required uniform inputs and are computed as outlined in [1].
|
|
754
886
|
// See our README.md on Environment Maps [3] for additional discussion.
|
|
755
887
|
#ifdef USE_IBL
|
|
756
|
-
fn getIBLContribution(PBRInfo
|
|
888
|
+
fn getIBLContribution(pbrInfo: PBRInfo, n: vec3f, reflection: vec3f) -> vec3f
|
|
757
889
|
{
|
|
758
|
-
|
|
759
|
-
|
|
890
|
+
let mipCount: f32 = 9.0; // resolution of 512x512
|
|
891
|
+
let lod: f32 = pbrInfo.perceptualRoughness * mipCount;
|
|
760
892
|
// retrieve a scale and bias to F0. See [1], Figure 3
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
893
|
+
let brdf = SRGBtoLINEAR(
|
|
894
|
+
textureSample(
|
|
895
|
+
pbr_BrdfLUT,
|
|
896
|
+
pbr_BrdfLUTSampler,
|
|
897
|
+
vec2f(pbrInfo.NdotV, 1.0 - pbrInfo.perceptualRoughness)
|
|
898
|
+
)
|
|
899
|
+
).rgb;
|
|
900
|
+
let diffuseLight =
|
|
901
|
+
SRGBtoLINEAR(textureSample(pbr_diffuseEnvSampler, pbr_diffuseEnvSamplerSampler, n)).rgb;
|
|
902
|
+
let specularLightDefault =
|
|
903
|
+
SRGBtoLINEAR(textureSample(pbr_specularEnvSampler, pbr_specularEnvSamplerSampler, reflection)).rgb;
|
|
904
|
+
var specularLight = specularLightDefault;
|
|
765
905
|
#ifdef USE_TEX_LOD
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
906
|
+
specularLight = SRGBtoLINEAR(
|
|
907
|
+
textureSampleLevel(
|
|
908
|
+
pbr_specularEnvSampler,
|
|
909
|
+
pbr_specularEnvSamplerSampler,
|
|
910
|
+
reflection,
|
|
911
|
+
lod
|
|
912
|
+
)
|
|
913
|
+
).rgb;
|
|
769
914
|
#endif
|
|
770
915
|
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
// For presentation, this allows us to disable IBL terms
|
|
775
|
-
diffuse *= pbrMaterial.scaleIBLAmbient.x;
|
|
776
|
-
specular *= pbrMaterial.scaleIBLAmbient.y;
|
|
916
|
+
let diffuse = diffuseLight * pbrInfo.diffuseColor * pbrMaterial.scaleIBLAmbient.x;
|
|
917
|
+
let specular =
|
|
918
|
+
specularLight * (pbrInfo.specularColor * brdf.x + brdf.y) * pbrMaterial.scaleIBLAmbient.y;
|
|
777
919
|
|
|
778
920
|
return diffuse + specular;
|
|
779
921
|
}
|
|
@@ -783,7 +925,7 @@ fn getIBLContribution(PBRInfo pbrInfo, vec3 n, vec3 reflection) -> vec3f
|
|
|
783
925
|
// Implementation from Lambert's Photometria https://archive.org/details/lambertsphotome00lambgoog
|
|
784
926
|
// See also [1], Equation 1
|
|
785
927
|
fn diffuse(pbrInfo: PBRInfo) -> vec3<f32> {
|
|
786
|
-
return pbrInfo.diffuseColor /
|
|
928
|
+
return pbrInfo.diffuseColor / M_PI;
|
|
787
929
|
}
|
|
788
930
|
|
|
789
931
|
// The following equation models the Fresnel reflectance term of the spec equation (aka F())
|
|
@@ -817,7 +959,7 @@ fn geometricOcclusion(pbrInfo: PBRInfo) -> f32 {
|
|
|
817
959
|
fn microfacetDistribution(pbrInfo: PBRInfo) -> f32 {
|
|
818
960
|
let roughnessSq = pbrInfo.alphaRoughness * pbrInfo.alphaRoughness;
|
|
819
961
|
let f = (pbrInfo.NdotH * roughnessSq - pbrInfo.NdotH) * pbrInfo.NdotH + 1.0;
|
|
820
|
-
return roughnessSq / (
|
|
962
|
+
return roughnessSq / (M_PI * f * f);
|
|
821
963
|
}
|
|
822
964
|
|
|
823
965
|
fn PBRInfo_setAmbientLight(pbrInfo: ptr<function, PBRInfo>) {
|
|
@@ -840,7 +982,7 @@ fn PBRInfo_setDirectionalLight(pbrInfo: ptr<function, PBRInfo>, lightDirection:
|
|
|
840
982
|
}
|
|
841
983
|
|
|
842
984
|
fn PBRInfo_setPointLight(pbrInfo: ptr<function, PBRInfo>, pointLight: PointLight) {
|
|
843
|
-
let light_direction = normalize(pointLight.position - pbr_vPosition);
|
|
985
|
+
let light_direction = normalize(pointLight.position - fragmentInputs.pbr_vPosition);
|
|
844
986
|
PBRInfo_setDirectionalLight(pbrInfo, light_direction);
|
|
845
987
|
}
|
|
846
988
|
|
|
@@ -859,11 +1001,11 @@ fn calculateFinalColor(pbrInfo: PBRInfo, lightColor: vec3<f32>) -> vec3<f32> {
|
|
|
859
1001
|
|
|
860
1002
|
fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
861
1003
|
// The albedo may be defined from a base texture or a flat color
|
|
862
|
-
var baseColor: vec4<f32
|
|
1004
|
+
var baseColor: vec4<f32> = pbrMaterial.baseColorFactor;
|
|
863
1005
|
#ifdef HAS_BASECOLORMAP
|
|
864
|
-
baseColor = SRGBtoLINEAR(
|
|
865
|
-
|
|
866
|
-
|
|
1006
|
+
baseColor = SRGBtoLINEAR(
|
|
1007
|
+
textureSample(pbr_baseColorSampler, pbr_baseColorSamplerSampler, fragmentInputs.pbr_vUV)
|
|
1008
|
+
) * pbrMaterial.baseColorFactor;
|
|
867
1009
|
#endif
|
|
868
1010
|
|
|
869
1011
|
#ifdef ALPHA_CUTOFF
|
|
@@ -874,7 +1016,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
874
1016
|
|
|
875
1017
|
var color = vec3<f32>(0.0, 0.0, 0.0);
|
|
876
1018
|
|
|
877
|
-
if (pbrMaterial.unlit) {
|
|
1019
|
+
if (pbrMaterial.unlit != 0u) {
|
|
878
1020
|
color = baseColor.rgb;
|
|
879
1021
|
} else {
|
|
880
1022
|
// Metallic and Roughness material properties are packed together
|
|
@@ -885,7 +1027,11 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
885
1027
|
#ifdef HAS_METALROUGHNESSMAP
|
|
886
1028
|
// Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel.
|
|
887
1029
|
// This layout intentionally reserves the 'r' channel for (optional) occlusion map data
|
|
888
|
-
let mrSample = textureSample(
|
|
1030
|
+
let mrSample = textureSample(
|
|
1031
|
+
pbr_metallicRoughnessSampler,
|
|
1032
|
+
pbr_metallicRoughnessSamplerSampler,
|
|
1033
|
+
fragmentInputs.pbr_vUV
|
|
1034
|
+
);
|
|
889
1035
|
perceptualRoughness = mrSample.g * perceptualRoughness;
|
|
890
1036
|
metallic = mrSample.b * metallic;
|
|
891
1037
|
#endif
|
|
@@ -912,7 +1058,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
912
1058
|
let specularEnvironmentR90 = vec3<f32>(1.0, 1.0, 1.0) * reflectance90;
|
|
913
1059
|
|
|
914
1060
|
let n = getNormal(); // normal at surface point
|
|
915
|
-
let v = normalize(pbrProjection.camera - pbr_vPosition); // Vector from surface point to camera
|
|
1061
|
+
let v = normalize(pbrProjection.camera - fragmentInputs.pbr_vPosition); // Vector from surface point to camera
|
|
916
1062
|
|
|
917
1063
|
let NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
|
|
918
1064
|
let reflection = -normalize(reflect(v, n));
|
|
@@ -951,7 +1097,10 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
951
1097
|
for (var i = 0; i < lighting.pointLightCount; i++) {
|
|
952
1098
|
if (i < lighting.pointLightCount) {
|
|
953
1099
|
PBRInfo_setPointLight(&pbrInfo, lighting_getPointLight(i));
|
|
954
|
-
let attenuation = getPointLightAttenuation(
|
|
1100
|
+
let attenuation = getPointLightAttenuation(
|
|
1101
|
+
lighting_getPointLight(i),
|
|
1102
|
+
distance(lighting_getPointLight(i).position, fragmentInputs.pbr_vPosition)
|
|
1103
|
+
);
|
|
955
1104
|
color += calculateFinalColor(pbrInfo, lighting_getPointLight(i).color / attenuation);
|
|
956
1105
|
}
|
|
957
1106
|
}
|
|
@@ -959,22 +1108,25 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
959
1108
|
|
|
960
1109
|
// Calculate lighting contribution from image based lighting source (IBL)
|
|
961
1110
|
#ifdef USE_IBL
|
|
962
|
-
if (pbrMaterial.IBLenabled) {
|
|
1111
|
+
if (pbrMaterial.IBLenabled != 0) {
|
|
963
1112
|
color += getIBLContribution(pbrInfo, n, reflection);
|
|
964
1113
|
}
|
|
965
1114
|
#endif
|
|
966
1115
|
|
|
967
1116
|
// Apply optional PBR terms for additional (optional) shading
|
|
968
1117
|
#ifdef HAS_OCCLUSIONMAP
|
|
969
|
-
if (pbrMaterial.occlusionMapEnabled) {
|
|
970
|
-
let ao =
|
|
1118
|
+
if (pbrMaterial.occlusionMapEnabled != 0) {
|
|
1119
|
+
let ao =
|
|
1120
|
+
textureSample(pbr_occlusionSampler, pbr_occlusionSamplerSampler, fragmentInputs.pbr_vUV).r;
|
|
971
1121
|
color = mix(color, color * ao, pbrMaterial.occlusionStrength);
|
|
972
1122
|
}
|
|
973
1123
|
#endif
|
|
974
1124
|
|
|
975
1125
|
#ifdef HAS_EMISSIVEMAP
|
|
976
|
-
if (pbrMaterial.emissiveMapEnabled) {
|
|
977
|
-
let emissive = SRGBtoLINEAR(
|
|
1126
|
+
if (pbrMaterial.emissiveMapEnabled != 0u) {
|
|
1127
|
+
let emissive = SRGBtoLINEAR(
|
|
1128
|
+
textureSample(pbr_emissiveSampler, pbr_emissiveSamplerSampler, fragmentInputs.pbr_vUV)
|
|
1129
|
+
).rgb * pbrMaterial.emissiveFactor;
|
|
978
1130
|
color += emissive;
|
|
979
1131
|
}
|
|
980
1132
|
#endif
|
|
@@ -998,16 +1150,24 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
998
1150
|
|
|
999
1151
|
return vec4<f32>(pow(color, vec3<f32>(1.0 / 2.2)), baseColor.a);
|
|
1000
1152
|
}
|
|
1001
|
-
`;var
|
|
1153
|
+
`;var Yp=`uniform pbrProjectionUniforms {
|
|
1002
1154
|
mat4 modelViewProjectionMatrix;
|
|
1003
1155
|
mat4 modelMatrix;
|
|
1004
1156
|
mat4 normalMatrix;
|
|
1005
1157
|
vec3 camera;
|
|
1006
1158
|
} pbrProjection;
|
|
1007
|
-
`,
|
|
1159
|
+
`,yB=`struct pbrProjectionUniforms {
|
|
1160
|
+
modelViewProjectionMatrix: mat4x4<f32>,
|
|
1161
|
+
modelMatrix: mat4x4<f32>,
|
|
1162
|
+
normalMatrix: mat4x4<f32>,
|
|
1163
|
+
camera: vec3<f32>
|
|
1164
|
+
};
|
|
1165
|
+
|
|
1166
|
+
@binding(0) @group(0) var<uniform> pbrProjection: pbrProjectionUniforms;
|
|
1167
|
+
`,Kp={name:"pbrProjection",source:yB,vs:Yp,fs:Yp,getUniforms:t=>t,uniformTypes:{modelViewProjectionMatrix:"mat4x4<f32>",modelMatrix:"mat4x4<f32>",normalMatrix:"mat4x4<f32>",camera:"vec3<f32>"}};var qc={props:{},uniforms:{},name:"pbrMaterial",dependencies:[ss,Kp],source:Xp,vs:Jp,fs:Wp,defines:{LIGHTING_FRAGMENT:!0,HAS_NORMALMAP:!1,HAS_EMISSIVEMAP:!1,HAS_OCCLUSIONMAP:!1,HAS_BASECOLORMAP:!1,HAS_METALROUGHNESSMAP:!1,HAS_SPECULARCOLORMAP:!1,HAS_SPECULARINTENSITYMAP:!1,HAS_TRANSMISSIONMAP:!1,HAS_CLEARCOATMAP:!1,HAS_SHEENCOLORMAP:!1,HAS_IRIDESCENCEMAP:!1,HAS_ANISOTROPYMAP:!1,ALPHA_CUTOFF:!1,USE_IBL:!1,PBR_DEBUG:!1},getUniforms:t=>t,uniformTypes:{unlit:"i32",baseColorMapEnabled:"i32",baseColorFactor:"vec4<f32>",normalMapEnabled:"i32",normalScale:"f32",emissiveMapEnabled:"i32",emissiveFactor:"vec3<f32>",metallicRoughnessValues:"vec2<f32>",metallicRoughnessMapEnabled:"i32",occlusionMapEnabled:"i32",occlusionStrength:"f32",alphaCutoffEnabled:"i32",alphaCutoff:"f32",IBLenabled:"i32",scaleIBLAmbient:"vec2<f32>",scaleDiffBaseMR:"vec4<f32>",scaleFGDSpec:"vec4<f32>",specularColorFactor:"vec3<f32>",specularIntensityFactor:"f32",specularColorMapEnabled:"i32",specularIntensityMapEnabled:"i32",ior:"f32",transmissionFactor:"f32",transmissionMapEnabled:"i32",thicknessFactor:"f32",attenuationDistance:"f32",attenuationColor:"vec3<f32>",clearcoatFactor:"f32",clearcoatRoughnessFactor:"f32",clearcoatMapEnabled:"i32",sheenColorFactor:"vec3<f32>",sheenRoughnessFactor:"f32",sheenColorMapEnabled:"i32",iridescenceFactor:"f32",iridescenceIor:"f32",iridescenceThicknessRange:"vec2<f32>",iridescenceMapEnabled:"i32",anisotropyStrength:"f32",anisotropyRotation:"f32",anisotropyDirection:"vec2<f32>",anisotropyMapEnabled:"i32",emissiveStrength:"f32"}};var tm=D(Rc(),1),rm=D(zo(),1);var Qp=`uniform meshUniforms {
|
|
1008
1168
|
bool pickFeatureIds;
|
|
1009
1169
|
} mesh;
|
|
1010
|
-
`,
|
|
1170
|
+
`,Zp={name:"mesh",vs:Qp,fs:Qp,uniformTypes:{pickFeatureIds:"f32"}};var $p=`#version 300 es
|
|
1011
1171
|
#define SHADER_NAME simple-mesh-layer-vs
|
|
1012
1172
|
in vec3 positions;
|
|
1013
1173
|
in vec3 normals;
|
|
@@ -1066,7 +1226,7 @@ geometry.uv = pbr_vUV;
|
|
|
1066
1226
|
#endif
|
|
1067
1227
|
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
1068
1228
|
}
|
|
1069
|
-
`;var
|
|
1229
|
+
`;var em=`#version 300 es
|
|
1070
1230
|
#define SHADER_NAME simple-mesh-layer-fs
|
|
1071
1231
|
precision highp float;
|
|
1072
1232
|
uniform sampler2D sampler;
|
|
@@ -1095,7 +1255,7 @@ fragColor = vec4(lightColor, color.a * layer.opacity);
|
|
|
1095
1255
|
#endif
|
|
1096
1256
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
1097
1257
|
}
|
|
1098
|
-
`;function JB(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 jB={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},Wn=class extends em.SimpleMeshLayer{getShaders(){let t=super.getShaders();return t.modules.push(Ic,Qp),{...t,vs:Zp,fs:$p}}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,{model:n}=this.state;if(!n)return;let s={pickFeatureIds:Boolean(r)},o={camera:this.context.viewport.cameraPosition};n.shaderInputs.setProps({pbrProjection:o,mesh:s}),super.draw(t)}getModel(t){let{id:r}=this.props,n=this.parseMaterial(this.props.pbrMaterial,t);this.setState({parsedPBRMaterial:n});let s=this.getShaders();return JB(t.attributes),new tm.Model(this.context.device,{...this.getShaders(),id:r,geometry:t,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:{...s.defines,...n?.defines,HAS_UV_REGIONS:t.attributes.uvRegions?1:0},parameters:n?.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});let{pbr_baseColorSampler:o}=s.bindings,{emptyTexture:i}=this.state,a={sampler:o||i,hasTexture:Boolean(o)},{camera:c,...l}={...s.bindings,...s.uniforms};r.shaderInputs.setProps({simpleMesh:a,pbrMaterial:l})}}parseMaterial(t,r){let n=Boolean(t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture);return Bc(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})}};Wn.layerName="MeshLayer";Wn.defaultProps=jB;var rm=Wn;var y0=D(Nr(),1);var pe=6356752314245179e-9,XB={radii:[6378137,6378137,pe],radiiSquared:[6378137*6378137,6378137*6378137,pe*pe],oneOverRadii:[1/6378137,1/6378137,1/pe],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(pe*pe)],maximumRadius:Math.max(6378137,6378137,pe),centerToleranceSquared:.1};function So(e){return e}var uU=new x;function WB(e,t=[],r=So){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 sm(e,t=[]){return WB(e,t,Q._cartographicRadians?So:Yi)}function YB(e,t,r=So){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 om(e,t){return YB(e,t,Q._cartographicRadians?So:Ki)}var im=1e-14,KB=new x,am={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"}},wc={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Yn={east:new x,north:new x,up:new x,west:new x,south:new x,down:new x},QB=new x,ZB=new x,$B=new x;function Lc(e,t,r,n,s,o){let i=am[t]&&am[t][r];ft(i&&(!n||n===i));let a,c,l,f=KB.copy(s);if(Et(f.x,0,im)&&Et(f.y,0,im)){let h=Math.sign(f.z);a=QB.fromArray(wc[t]),t!=="east"&&t!=="west"&&a.scale(h),c=ZB.fromArray(wc[r]),r!=="east"&&r!=="west"&&c.scale(h),l=$B.fromArray(wc[n]),n!=="east"&&n!=="west"&&l.scale(h)}else{let{up:h,east:d,north:p}=Yn;d.set(-f.y,f.x,0).normalize(),e.geodeticSurfaceNormal(f,h),p.copy(h).cross(d);let{down:A,west:m,south:y}=Yn;A.copy(h).scale(-1),m.copy(d).scale(-1),y.copy(p).scale(-1),a=Yn[t],c=Yn[r],l=Yn[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]=f.x,o[13]=f.y,o[14]=f.z,o[15]=1,o}var Dr=new x,tC=new x,eC=new x;function cm(e,t,r=[]){let{oneOverRadii:n,oneOverRadiiSquared:s,centerToleranceSquared:o}=t;Dr.from(e);let i=Dr.x,a=Dr.y,c=Dr.z,l=n.x,f=n.y,u=n.z,h=i*i*l*l,d=a*a*f*f,p=c*c*u*u,A=h+d+p,m=Math.sqrt(1/A);if(!Number.isFinite(m))return;let y=tC;if(y.copy(e).scale(m),A<o)return y.to(r);let _=s.x,E=s.y,M=s.z,B=eC;B.set(y.x*_*2,y.y*E*2,y.z*M*2);let C=(1-m)*Dr.len()/(.5*B.len()),L=0,b,T,g,S;do{C-=L,b=1/(1+C*_),T=1/(1+C*E),g=1/(1+C*M);let R=b*b,F=T*T,v=g*g,G=R*b,X=F*T,z=v*g;S=h*R+d*F+p*v-1;let K=-2*(h*G*_+d*X*E+p*z*M);L=S/K}while(Math.abs(S)>Pt.EPSILON12);return Dr.scale([b,T,g]).to(r)}var Io=new x,lm=new x,sC=new x,Wt=new x,oC=new x,wo=new x,U=class{constructor(t=0,r=0,n=0){this.centerToleranceSquared=Pt.EPSILON1,ft(t>=0),ft(r>=0),ft(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=lm,s=sC,[,,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]){wo.from(t);let n=this.scaleToGeodeticSurface(wo,Wt);if(!n)return;let s=this.geodeticSurfaceNormal(n,lm),o=oC;o.copy(wo).subtract(n);let i=Math.atan2(s.y,s.x),a=Math.asin(s.z),c=Math.sign(Je.dot(o,wo))*Je.length(o);return om([i,a,c],r)}eastNorthUpToFixedFrame(t,r=new O){return Lc(this,"east","north","up",t,r)}localFrameToFixedFrame(t,r,n,s,o=new O){return Lc(this,t,r,n,s,o)}geocentricSurfaceNormal(t,r=[0,0,0]){return Io.from(t).normalize().to(r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=sm(t),s=n[0],o=n[1],i=Math.cos(o);return Io.set(i*Math.cos(s),i*Math.sin(s),Math.sin(o)).normalize(),Io.to(r)}geodeticSurfaceNormal(t,r=[0,0,0]){return Io.from(t).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(t,r){return cm(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){Wt.from(t);let n=Wt.x,s=Wt.y,o=Wt.z,i=this.oneOverRadiiSquared,a=1/Math.sqrt(n*n*i.x+s*s*i.y+o*o*i.z);return Wt.multiplyScalar(a).to(r)}transformPositionToScaledSpace(t,r=[0,0,0]){return Wt.from(t).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(t,r=[0,0,0]){return Wt.from(t).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){ft(Et(this.radii.x,this.radii.y,Pt.EPSILON15)),ft(this.radii.z>0),Wt.from(t);let s=Wt.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(s)>=this.radii.z-r))return Wt.set(0,0,s).to(n)}};U.WGS84=new U(6378137,6378137,pe);var Lo=class{item;previous;next;constructor(t,r,n){this.item=t,this.previous=r,this.next=n}};var vo=class{head=null;tail=null;_length=0;get length(){return this._length}add(t){let r=new Lo(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 Ro=class{_list;_sentinel;_trimTiles;constructor(){this._list=new vo,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 fm(e,t){H(e),H(t);let{rtcCenter:r,gltfUpAxis:n}=t,{computedTransform:s,boundingVolume:{center:o}}=e,i=new O(s);switch(r&&i.translate(r),n){case"Z":break;case"Y":let u=new O().rotateX(Math.PI/2);i=i.multiplyRight(u);break;case"X":let h=new O().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=U.WGS84.cartesianToCartographic(a,new x),f=U.WGS84.eastNorthUpToFixedFrame(a).invert();t.cartographicModelMatrix=f.multiplyRight(i),t.cartographicOrigin=c,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var um=new x,vc=new x,Rc=new ct([new ut,new ut,new ut,new ut,new ut,new ut]);function dm(e,t){let{cameraDirection:r,cameraUp:n,height:s}=e,{metersPerUnit:o}=e.distanceScales,i=Fo(e,e.center),a=U.WGS84.eastNorthUpToFixedFrame(i),c=e.unprojectPosition(e.cameraPosition),l=U.WGS84.cartographicToCartesian(c,new x),f=new x(a.transformAsVector(new x(r).scale(o))).normalize(),u=new x(a.transformAsVector(new x(n).scale(o))).normalize();iC(e);let h=e.constructor,{longitude:d,latitude:p,width:A,bearing:m,zoom:y}=e,_=new h({longitude:d,latitude:p,height:s,width:A,bearing:m,zoom:y,pitch:0});return{camera:{position:l,direction:f,up:u},viewport:e,topDownViewport:_,height:s,cullingVolume:Rc,frameNumber:t,sseDenominator:1.15}}function pm(e,t,r){if(r===0||e.length<=r)return[e,[]];let n=[],{longitude:s,latitude:o}=t.viewport;for(let[l,f]of e.entries()){let[u,h]=f.header.mbs,d=Math.abs(s-u),p=Math.abs(o-h),A=Math.sqrt(p*p+d*d);n.push([l,A])}let i=n.sort((l,f)=>l[1]-f[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 iC(e){let t=e.getFrustumPlanes(),r=hm(t.near,e.cameraPosition),n=Fo(e,r),s=Fo(e,e.cameraPosition,vc),o=0;Rc.planes[o++].fromPointNormal(n,um.copy(n).subtract(s));for(let i in t){if(i==="near")continue;let a=t[i],c=hm(a,r,vc),l=Fo(e,c,vc);Rc.planes[o++].fromPointNormal(l,um.copy(n).subtract(l))}}function hm(e,t,r=new x){let n=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-n).add(t),r}function Fo(e,t,r=new x){let n=e.unprojectPosition(t);return U.WGS84.cartographicToCartesian(n,r)}var aC=6378137,cC=6378137,Fc=6356752314245179e-9,Gr=new x;function mm(e,t){if(e instanceof Xt){let{halfAxes:r}=e,n=lC(r);return Math.log2(Fc/(n+t[2]))}else if(e instanceof Nt){let{radius:r}=e;return Math.log2(Fc/(r+t[2]))}else if(e.width&&e.height){let{width:r,height:n}=e,s=Math.log2(aC/r),o=Math.log2(cC/n);return(s+o)/2}return 1}function Pc(e,t,r){U.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],Gr);let n=Math.sqrt(Math.pow(Gr[0]-r[0],2)+Math.pow(Gr[1]-r[1],2)+Math.pow(Gr[2]-r[2],2));return Math.log2(Fc/(n+t[2]))}function gm(e,t,r){let[n,s,o,i]=e;return Pc({xmin:n,xmax:o,ymin:s,ymax:i,zmin:0,zmax:0},t,r)}function lC(e){e.getColumn(0,Gr);let t=e.getColumn(1),r=e.getColumn(2);return Gr.add(t).add(r).len()}var Fm=D(Nr(),1);var Mt={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},mt;(function(e){e[e.ADD=1]="ADD",e[e.REPLACE=2]="REPLACE"})(mt||(mt={}));var Gt;(function(e){e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh"})(Gt||(Gt={}));var ht;(function(e){e.I3S="I3S",e.TILES3D="TILES3D"})(ht||(ht={}));var me;(function(e){e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(me||(me={}));var Am={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function Em(e){return e!=null}var gt=new x,Po=new x,fC=new x,uC=new x,sr=new x,xm=new x,ym=new x,Tm=new x;function Oo(e,t,r){if(H(e,"3D Tile: boundingVolume must be defined"),e.box)return Mm(e.box,t,r);if(e.region)return dC(e.region);if(e.sphere)return hC(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function _m(e,t){if(e.box)return pC(t);if(e.region){let[r,n,s,o,i,a]=e.region;return[[Lt(r),Lt(n),i],[Lt(s),Lt(o),a]]}if(e.sphere)return mC(t);throw new Error("Unkown boundingVolume type")}function Mm(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),f=new $t;f.fromArray(e,6);let u=new x([1,0,0]),h=new x([0,1,0]),d=new x([0,0,1]);u.transformByQuaternion(f),u.scale(l[0]),h.transformByQuaternion(f),h.scale(l[1]),d.transformByQuaternion(f),d.scale(l[2]),s=[...u.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 J([o[0],o[1],o[2],i[0],i[1],i[2],a[0],a[1],a[2]]);return Em(r)?(r.center=n,r.halfAxes=c,r):new Xt(n,c)}function hC(e,t,r){let n=new x(e[0],e[1],e[2]);t.transform(n,n);let s=t.getScale(Po),o=Math.max(Math.max(s[0],s[1]),s[2]),i=e[3]*o;return Em(r)?(r.center=n,r.radius=i,r):new Nt(n,i)}function dC(e){let[t,r,n,s,o,i]=e,a=U.WGS84.cartographicToCartesian([Lt(t),Lt(s),o],fC),c=U.WGS84.cartographicToCartesian([Lt(n),Lt(r),i],uC),l=new x().addVectors(a,c).multiplyByScalar(.5);return U.WGS84.cartesianToCartographic(l,sr),U.WGS84.cartographicToCartesian([Lt(n),sr[1],sr[2]],xm),U.WGS84.cartographicToCartesian([sr[0],Lt(s),sr[2]],ym),U.WGS84.cartographicToCartesian([sr[0],sr[1],i],Tm),Mm([...l,...xm.subtract(l),...ym.subtract(l),...Tm.subtract(l)],new O)}function pC(e){let t=bm(),{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++)gt.copy(e.center),gt.add(n),gt.add(s),gt.add(o),Bm(t,gt),o.negate();s.negate()}n.negate()}return t}function mC(e){let t=bm(),{center:r,radius:n}=e,s=U.WGS84.scaleToGeodeticSurface(r,gt),o;s?o=U.WGS84.geodeticSurfaceNormal(s):o=new x(0,0,1);let i=new x(o[2],-o[1],0);i.len()>0?i.normalize():i=new x(0,1,0);let a=i.clone().cross(o);for(let c of[i,a,o]){Po.copy(c).scale(n);for(let l=0;l<2;l++)gt.copy(r),gt.add(Po),Bm(t,gt),Po.negate()}return t}function bm(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function Bm(e,t){U.WGS84.cartesianToCartographic(t,gt),e[0][0]=Math.min(e[0][0],gt[0]),e[0][1]=Math.min(e[0][1],gt[1]),e[0][2]=Math.min(e[0][2],gt[2]),e[1][0]=Math.max(e[1][0],gt[0]),e[1][1]=Math.max(e[1][1],gt[1]),e[1][2]=Math.max(e[1][2],gt[2])}var QU=new x,ZU=new x,$U=new O,t4=new x,e4=new x,r4=new x;function gC(e,t){let r=e*t;return 1-Math.exp(-(r*r))}function AC(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){let r=e.dynamicScreenSpaceErrorComputedDensity,n=e.dynamicScreenSpaceErrorFactor;return gC(t,r)*n}return 0}function Cm(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,f=o*a*(l||1)/(i*c);return f-=AC(n,i),f}var Oc=new x,Sm=new x,Pe=new x,Im=new x,xC=new x,Nc=new O,wm=new O;function Lm(e,t){if(e.lodMetricValue===0||isNaN(e.lodMetricValue))return"DIG";let r=2*Dc(e,t);return r<2?"OUT":!e.header.children||r<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}function Dc(e,t){let{topDownViewport:r}=t,n=e.header.mbs[1],s=e.header.mbs[0],o=e.header.mbs[2],i=e.header.mbs[3],a=[...e.boundingVolume.center],c=r.unprojectPosition(r.cameraPosition);U.WGS84.cartographicToCartesian(c,Oc),Sm.copy(Oc).subtract(a).normalize(),U.WGS84.eastNorthUpToFixedFrame(a,Nc),wm.copy(Nc).invert(),Pe.copy(Oc).transform(wm);let l=Math.sqrt(Pe[0]*Pe[0]+Pe[1]*Pe[1]),f=l*l/Pe[2];Im.copy([Pe[0],Pe[1],f]);let h=Im.transform(Nc).subtract(a).normalize(),p=Sm.cross(h).normalize().scale(i).add(a),A=U.WGS84.cartesianToCartographic(p),m=r.project([s,n,o]),y=r.project(A);return xC.copy(m).subtract(y).magnitude()}function vm(e){return{assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}}var Kn=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 H(t<this._array.length),this._array[t]}set(t,r){H(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){H(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){H(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 yC={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},ie=class{options;root=null;selectedTiles={};requestedTiles={};emptyTiles={};lastUpdate=new Date().getTime();updateDebounceTime=1e3;_traversalStack=new Kn;_emptyTraversalStack=new Kn;_frameNumber=null;traversalFinished(t){return!0}constructor(t){this.options={...yC,...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===mt.ADD?(this.loadTile(o,r),this.selectTile(o,r)):o.refine===mt.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===mt.REPLACE&&t.hasRenderContent&&!i,l=!1,f=!0;for(let u of a)if(u._selectionDepth=s,u.isVisibleAndInRequestVolume?(n.find(u)&&n.delete(u),n.push(u),l=!0):(c||o)&&(this.loadTile(u,r),this.touchTile(u,r)),c){let h;if(u._inRequestVolume?u.hasRenderContent?h=u.contentAvailable:h=this.executeEmptyTraversal(u,r):h=!1,f=f&&h,!f)return!1}return l||(f=!1),f}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){return t.hasChildren?t.hasTilesetContent?!t.contentExpired:this.shouldRefine(t,r):!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),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 Rm=new x;function TC(e){return e!=null}var or=class{tileset;header;id;url;parent;refine;type;contentUrl;lodMetricType="geometricError";lodMetricValue=0;boundingVolume=null;content=null;contentState=Mt.UNLOADED;gpuMemoryUsageInBytes=0;children=[];depth=0;viewportIds=[];transform=new O;extensions=null;implicitTiling=null;userData={};computedTransform;hasEmptyContent=!1;hasTilesetContent=!1;traverser=new ie({});_cacheNode=null;_frameNumber=null;_expireDate=null;_expiredContent=null;_boundingBox=void 0;_distanceToCamera=0;_screenSpaceError=0;_visibilityPlaneMask;_visible=void 0;_contentBoundingVolume;_viewerRequestVolume;_initialTransform=new O;_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===Mt.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===Mt.UNLOADED}get contentExpired(){return this.contentState===Mt.EXPIRED}get contentFailed(){return this.contentState===Mt.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=_m(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,r){switch(this.tileset.type){case ht.I3S:return Dc(this,t);case ht.TILES3D:return Cm(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===mt.ADD||r;if(n&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===Mt.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=Mt.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=Mt.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,Fm.load)(n,s,o),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=Mt.READY,this._onContentLoaded(),!0}catch(n){throw this.contentState=Mt.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=Mt.UNLOADED,!0}updateVisibility(t,r){if(this._frameNumber===t.frameNumber)return;let n=this.parent,s=n?n._visibilityPlaneMask:ct.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!==ct.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 Rm.subVectors(r.center,t.position),t.direction.dot(Rm)}insideViewerRequestVolume(t){let r=this._viewerRequestVolume;return!r||r.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(TC(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=Mt.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in t?this.lodMetricValue=t.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(t){this.transform=t.transform?new O(t.transform):new O;let r=this.parent,n=this.tileset,s=r&&r.computedTransform?r.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new O(s).multiplyRight(this.transform);let o=r&&r._initialTransform?r._initialTransform.clone():new O;this._initialTransform=new O(o).multiplyRight(this.transform)}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=Mt.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=ct.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||mt.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=Oo(t.boundingVolume,this.computedTransform,this.boundingVolume);let r=t.content;r&&(r.boundingVolume&&(this._contentBoundingVolume=Oo(r.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=Oo(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new O){let r=t.clone().multiplyRight(this.transform);r.equals(this.computedTransform)||(this.computedTransform=r,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(t){switch(t){case"i3s":return{...this.tileset.options.i3s,_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1};case"3d-tiles":case"cesium-ion":default:return vm(this.tileset.tileset)}}};var No=class extends ie{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===mt.REPLACE,o=t._optimChildrenWithinParent===Am.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!==mt.ADD?!1:!this.shouldRefine(t,r,!0)}};var Pm=D(Nr(),1);var Do=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 Gc={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},Go=class{_statusMap;pendingTilesRegister=new Do;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:Gc.REQUESTED},this.pendingTilesRegister.register(i,o),t().then(a=>{this._statusMap[r].status=Gc.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=Gc.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 Uo=class extends ie{_tileManager;constructor(t){super(t),this._tileManager=new Go}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,r){return t._lodJudge=Lm(t,r),t._lodJudge==="DIG"}updateChildTiles(t,r){let n=t.header.children||[],s=t.children,o=t.tileset;for(let i of n){let a=`${i.id}-${r.viewport.id}`,c=s&&s.find(l=>l.id===a);if(c)c&&this.updateTile(c,r);else{let l=()=>this._loadTile(i.id,o);this._tileManager.find(a)?this._tileManager.update(a,r):(o.tileset.nodePages&&(l=()=>o.tileset.nodePagesTile.formTileFromNodePages(i.id)),this._tileManager.add(l,a,u=>this._onTileLoad(u,t,a),r))}}return!1}async _loadTile(t,r){let{loader:n}=r,s=r.getTileUrl(`${r.url}/nodes/${t}`),o={...r.loadOptions,i3s:{...r.loadOptions.i3s,isTileHeader:!0}};return await(0,Pm.load)(s,n,o)}_onTileLoad(t,r,n){let s=new or(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 EC={description:"",ellipsoid:U.WGS84,modelMatrix:new O,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,memoryCacheOverflow:1,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,memoryAdjustedScreenSpaceError:!1,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},Vo="Tiles In Tileset(s)",Uc="Tiles In Memory",Om="Tiles In View",Nm="Tiles To Render",Dm="Tiles Loaded",Vc="Tiles Loading",Gm="Tiles Unloaded",Um="Failed Tile Loads",Vm="Points/Vertices",Hc="Tile Memory Use",Hm="Maximum Screen Space Error",Qn=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 Ro;_requestScheduler;updatePromise=null;tilesetInitializationPromise;constructor(t,r){this.options={...EC,...r},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||Ie.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 Se({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 Ce({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=dm(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]=pm(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(Om).count=this.selectedTiles.length,this.stats.get(Nm).count=t,this.stats.get(Vm).count=r,this.stats.get(Hm).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(t){this.type===ht.I3S&&(this.calculateViewPropsI3S(),t.root=await t.root),this.root=this._initializeTileHeaders(t,null),this.type===ht.TILES3D&&(this._initializeTiles3DTileset(t),this.calculateViewPropsTiles3D()),this.type===ht.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){let t=this.tileset.fullExtent;if(t){let{xmin:n,xmax:s,ymin:o,ymax:i,zmin:a,zmax:c}=t;this.cartographicCenter=new x(n+(s-n)/2,o+(i-o)/2,a+(c-a)/2),this.cartesianCenter=new x,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=Pc(t,this.cartographicCenter,this.cartesianCenter);return}let r=this.tileset.store?.extent;if(r){let[n,s,o,i]=r;this.cartographicCenter=new x(n+(o-n)/2,s+(i-s)/2,0),this.cartesianCenter=new x,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=gm(r,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new x,this.zoom=1}calculateViewPropsTiles3D(){let t=this.root,{center:r}=t.boundingVolume;if(!r){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new x,this.zoom=1;return}r[0]!==0||r[1]!==0||r[2]!==0?(this.cartographicCenter=new x,U.WGS84.cartesianToCartographic(r,this.cartographicCenter)):this.cartographicCenter=new x(0,0,-U.WGS84.radii[0]),this.cartesianCenter=r,this.zoom=mm(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(Vo),this.stats.get(Vc),this.stats.get(Uc),this.stats.get(Om),this.stats.get(Nm),this.stats.get(Dm),this.stats.get(Gm),this.stats.get(Um),this.stats.get(Vm),this.stats.get(Hc,"memory"),this.stats.get(Hm)}_initializeTileHeaders(t,r){let n=new or(this,t.root,r);if(r&&(r.children.push(n),n.depth=r.depth+1),this.type===ht.TILES3D){let s=[];for(s.push(n);s.length>0;){let o=s.pop();this.stats.get(Vo).incrementCount();let i=o.header.children||[];for(let a of i){let c=new or(this,a,o);if(c.contentUrl?.includes("?session=")){let f=new URL(c.contentUrl).searchParams.get("session");f&&(this._queryParams.session=f)}o.children.push(c),c.depth=o.depth+1,s.push(c)}}}return n}_initializeTraverser(){let t;switch(this.type){case ht.TILES3D:t=No;break;case ht.I3S:t=Uo;break;default:t=ie}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(Um).incrementCount();let n=r.message||r.toString(),s=t.url;console.error(`A 3D tile failed to load: ${t.url} ${n}`),this.options.onTileError(t,n,s)}_onTileLoad(t,r){if(r){if(this.type===ht.I3S){let n=this.tileset?.nodePagesTile?.nodesInNodePages||0;this.stats.get(Vo).reset(),this.stats.get(Vo).addCount(n)}t&&t.content&&fm(t,t.content),this.updateContentTypes(t),this._addTileToCache(t),this.options.onTileLoad(t)}}updateContentTypes(t){if(this.type===ht.I3S)switch(t.header.isDracoGeometry&&(this.contentFormats.draco=!0),t.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}else if(this.type===ht.TILES3D){let{extensionsRemoved:r=[]}=t.content?.gltf||{};r.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),r.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),r.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(Vc).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(Vc).decrementCount()}_addTileToCache(t){this._cache.add(this,t,r=>r._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(Dm).incrementCount(),this.stats.get(Uc).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(Hc).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(Uc).decrementCount(),this.stats.get(Gm).incrementCount(),this.stats.get(Hc).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 Ho="4.3.3";var ir={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},Q4=Object.keys(ir);function zc(e,t,r){H(e instanceof ArrayBuffer);let n=new TextDecoder("utf8"),s=new Uint8Array(e,t,r);return n.decode(s)}function zm(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 qm="4.3.3";var km={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:qm,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 Jm(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 ar(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 f=a[l],u=a[l+1],h=a[l+2];t=f<t?f:t,r=u<r?u:r,n=h<n?h:n,s=f>s?f:s,o=u>o?u:o,i=h>i?h:i}return[[t,r,n],[s,o,i]]}function qc(e,t,r){let n=Jm(t.value),s=r||jm(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:n}]},nullable:!1,metadata:s}}function jm(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 Wm(e,t,r){let n=Ym(t.metadata),s=[],o=_C(t.attributes);for(let i in e){let a=e[i],c=Xm(i,a,o[i]);s.push(c)}if(r){let i=Xm("indices",r);s.push(i)}return{fields:s,metadata:n}}function _C(e){let t={};for(let r in e){let n=e[r];t[n.name||"undefined"]=n}return t}function Xm(e,t,r){let n=r?Ym(r.metadata):void 0;return qc(e,t,n)}function Ym(e){Object.entries(e);let t={};for(let r in e)t[`${r}.string`]=JSON.stringify(e[r]);return t}var Km={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},MC={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},bC=4,Zn=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=ar(c.attributes),f=Wm(c.attributes,a,c.indices);return{loader:"draco",loaderData:a,header:{vertexCount:o.num_points(),boundingBox:l},...c,schema:f}}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*bC,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),SC(r)}finally{this.draco.destroy(r)}}_getAttributeValues(t,r){let n=MC[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=BC(this.draco,n),l,f=this.draco._malloc(a);try{let u=this.decoder.GetAttribute(t,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,u,c,a,f),l=new n(this.draco.HEAPF32.buffer,f,i).slice()}finally{this.draco._free(f)}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 Km)if(this.draco[i]===s)return Km[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=CC(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 BC(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 CC(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}function SC(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}var IC="1.5.6",wC="1.4.1",kc=`https://www.gstatic.com/draco/versioned/decoders/${IC}`,Bt={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},Jc={[Bt.DECODER]:`${kc}/${Bt.DECODER}`,[Bt.DECODER_WASM]:`${kc}/${Bt.DECODER_WASM}`,[Bt.FALLBACK_DECODER]:`${kc}/${Bt.FALLBACK_DECODER}`,[Bt.ENCODER]:`https://raw.githubusercontent.com/google/draco/${wC}/javascript/${Bt.ENCODER}`},jc;async function Qm(e){let t=e.modules||{};return t.draco3d?jc||=t.draco3d.createDecoderModule({}).then(r=>({draco:r})):jc||=LC(e),await jc}async function LC(e){let t,r;switch(e.draco&&e.draco.decoderType){case"js":t=await re(Jc[Bt.FALLBACK_DECODER],"draco",e,Bt.FALLBACK_DECODER);break;case"wasm":default:[t,r]=await Promise.all([await re(Jc[Bt.DECODER],"draco",e,Bt.DECODER),await re(Jc[Bt.DECODER_WASM],"draco",e,Bt.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await vC(t,r)}function vC(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e({...r,onModuleLoaded:s=>n({draco:s})})})}var zo={...km,parse:RC};async function RC(e,t){let{draco:r}=await Qm(t),n=new Zn(r);try{return n.parseSync(e,t?.draco)}finally{n.destroy()}}var FC={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},at={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},N={...FC,...at};var Xc={[at.DOUBLE]:Float64Array,[at.FLOAT]:Float32Array,[at.UNSIGNED_SHORT]:Uint16Array,[at.UNSIGNED_INT]:Uint32Array,[at.UNSIGNED_BYTE]:Uint8Array,[at.BYTE]:Int8Array,[at.SHORT]:Int16Array,[at.INT]:Int32Array},PC={DOUBLE:at.DOUBLE,FLOAT:at.FLOAT,UNSIGNED_SHORT:at.UNSIGNED_SHORT,UNSIGNED_INT:at.UNSIGNED_INT,UNSIGNED_BYTE:at.UNSIGNED_BYTE,BYTE:at.BYTE,SHORT:at.SHORT,INT:at.INT},Wc="Failed to convert GL type",At=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let r in Xc)if(Xc[r]===t)return r;throw new Error(Wc)}static fromName(t){let r=PC[t];if(!r)throw new Error(Wc);return r}static getArrayType(t){switch(t){case at.UNSIGNED_SHORT_5_6_5:case at.UNSIGNED_SHORT_4_4_4_4:case at.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let r=Xc[t];if(!r)throw new Error(Wc);return r}}static getByteSize(t){return At.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(At.getArrayType(t))}static createTypedArray(t,r,n=0,s){s===void 0&&(s=(r.byteLength-n)/At.getByteSize(t));let o=At.getArrayType(t);return new o(r,n,s)}};function Zm(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function Yc(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 v9=1/256;var R9=new ze,F9=new x,P9=new ze,O9=new ze,N9=new Uint8Array(1);function $m(e,t=255){return Gs(e,0,t)/t*2-1}function tg(e){return e<0?-1:1}function eg(e,t,r,n){if(Zm(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=$m(e,r),n.y=$m(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))*tg(s),n.y=(1-Math.abs(s))*tg(n.y)}return n.normalize()}function Kc(e,t,r){return eg(e,t,255,r)}var ge=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=N.UNSIGNED_INT,n=1){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?this._getTypedArrayFromBinary(t,r,n,1,s.byteOffset):s}getPropertyArray(t,r,n){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?("componentType"in s&&(r=At.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=At.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=At.createTypedArray(r,n),s[t]=o),o}};var OC={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},NC={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]]},DC={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 rg(e,t,r,n){let{componentType:s}=e;H(e.componentType);let o=typeof s=="string"?At.fromName(s):s,i=OC[e.type],a=NC[e.type],c=DC[e.type];return r+=e.byteOffset,{values:At.createTypedArray(o,t,r,i*n),type:o,size:i,unpacker:a,packer:c}}var ae=e=>e!==void 0;function ng(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?GC(n,r):null}function GC(e,t){let r,n,s,o=e.instancesLength,i=e.classes,a=e.classIds,c=e.parentCounts,l=e.parentIds,f=o;ae(a.byteOffset)&&(a.componentType=defaultValue(a.componentType,GL.UNSIGNED_SHORT),a.type=AttributeType.SCALAR,s=getBinaryAccessor(a),a=s.createArrayBufferView(t.buffer,t.byteOffset+a.byteOffset,o));let u;if(ae(c))for(ae(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,s=getBinaryAccessor(c),c=s.createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,o)),u=new Uint16Array(o),f=0,r=0;r<o;++r)u[r]=f,f+=c[r];ae(l)&&ae(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,f));let h=i.length;for(r=0;r<h;++r){let m=i[r].length,y=i[r].instances,_=getBinaryProperties(m,y,t);i[r].instances=combine(_,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:u,parentIds:l};return HC(A),A}function Ur(e,t,r){if(!e)return;let n=e.parentCounts;return e.parentIds?r(e,t):n>0?UC(e,t,r):VC(e,t,r)}function UC(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,f=scratchStack;for(f.length=0,f.push(t);f.length>0;){if(t=f.pop(),c[t]===l)continue;c[t]=l;let u=r(e,t);if(ae(u))return u;let h=s[t],d=i[t];for(let p=0;p<h;++p){let A=o[d+p];A!==t&&f.push(A)}}return null}function VC(e,t,r){let n=!0;for(;n;){let s=r(e,t);if(ae(s))return s;let o=e.parentIds[t];n=o!==t,t=o}throw new Error("traverseHierarchySingleParent")}function HC(e){let t=[],n=e.classIds.length;for(let s=0;s<n;++s)sg(e,s,stack)}function sg(e,t,r){let n=e.parentCounts,s=e.parentIds,o=e.parentIndexes,a=e.classIds.length;if(!ae(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=ae(n)?n[t]:1,l=ae(n)?o[t]:t;for(let f=0;f<c;++f){let u=s[l+f];u!==t&&sg(e,u,r)}r.pop(t)}function Ct(e){return e!=null}var qo=(e,t)=>e,zC={HIERARCHY:!0,extensions:!0,extras:!0},cr=class{json;binary;featureCount;_extensions;_properties;_binaryProperties;_hierarchy;constructor(t,r,n,s={}){H(n>=0),this.json=t||{},this.binary=r,this.featureCount=n,this._extensions=this.json?.extensions||{},this._properties={};for(let o in this.json)zC[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),s["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=ng(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),H(typeof r=="string",r),this._hierarchy){let n=Ur(this._hierarchy,t,(s,o)=>{let i=s.classIds[o];return s.classes[i].name===r});return Ct(n)}return!1}isExactClass(t,r){return H(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),H(typeof r=="string",r),Ct(this._properties[r])||this._hasPropertyInHierarchy(t,r)}getPropertyNames(t,r){this._checkBatchId(t),r=Ct(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),H(typeof r=="string",r),this._binaryProperties){let s=this._binaryProperties[r];if(Ct(s))return this._getBinaryProperty(s,t)}let n=this._properties[r];if(Ct(n))return qo(n[t],!0);if(this._hierarchy){let s=this._getHierarchyProperty(t,r);if(Ct(s))return s}}setProperty(t,r,n){let s=this.featureCount;if(this._checkBatchId(t),H(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];Ct(o)||(this._properties[r]=new Array(s),o=this._properties[r]),o[t]=qo(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;H(this.binary,`Property ${t} requires a batch table binary.`),H(n.type,`Property ${t} requires a type.`);let s=rg(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=Ur(this._hierarchy,t,(s,o)=>{let i=s.classIds[o],a=s.classes[i].instances;return Ct(a[r])});return Ct(n)}_getPropertyNamesInHierarchy(t,r){Ur(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 Ur(this._hierarchy,t,(n,s)=>{let o=n.classIds[s],i=n.classes[o],a=n.classIndexes[s],c=i.instances[r];return Ct(c)?Ct(c.typedArray)?this._getBinaryProperty(c,a):qo(c[a],!0):null})}_setHierarchyProperty(t,r,n,s){let o=Ur(this._hierarchy,r,(i,a)=>{let c=i.classIds[a],l=i.classes[c],f=i.classIndexes[a],u=l.instances[n];return Ct(u)?(H(a===r,`Inherited property "${n}" is read-only.`),Ct(u.typedArray)?this._setBinaryProperty(u,f,s):u[f]=qo(s,!0),!0):!1});return Ct(o)}};function Oe(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 Vr=4,og="b3dm tile in legacy format.";function Hr(e,t,r){let n=new DataView(t),s;e.header=e.header||{};let o=n.getUint32(r,!0);r+=Vr;let i=n.getUint32(r,!0);r+=Vr;let a=n.getUint32(r,!0);r+=Vr;let c=n.getUint32(r,!0);return r+=Vr,a>=570425344?(r-=Vr*2,s=o,a=i,c=0,o=0,i=0,console.warn(og)):c>=570425344&&(r-=Vr,s=a,a=o,c=i,o=0,i=0,console.warn(og)),e.header.featureTableJsonByteLength=o,e.header.featureTableBinaryByteLength=i,e.header.batchTableJsonByteLength=a,e.header.batchTableBinaryByteLength=c,e.header.batchLength=s,r}function zr(e,t,r,n){return r=qC(e,t,r,n),r=kC(e,t,r,n),r}function qC(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=zc(t,r,s);e.featureTableJson=JSON.parse(a)}return r+=s||0,e.featureTableBinary=new Uint8Array(t,r,o),r+=o||0,r}function kC(e,t,r,n){let{batchTableJsonByteLength:s,batchTableBinaryByteLength:o}=e.header||{};if(s&&s>0){let i=zc(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 Qc(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],f=r.getProperty(c,"dimensions").map(u=>u*255);i[a*3]=f[0],i[a*3+1]=f[1],i[a*3+2]=f[2]}return{type:N.UNSIGNED_BYTE,value:i,size:3,normalized:!0}}if(t&&s){let i=new Uint8ClampedArray(o*3);for(let a=0;a<o;a++){let c=Yc(t[a]);i[a*3]=c[0],i[a*3+1]=c[1],i[a*3+2]=c[2]}return{type:N.UNSIGNED_BYTE,value:i,size:3,normalized:!0}}return t&&t.length===o*3?{type:N.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:N.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var ig=new x;function ag(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++)Kc(t[n*2],t[n*2+1],ig),ig.toArray(r,n*3);return{type:N.FLOAT,size:2,value:r}}return{type:N.FLOAT,size:2,value:t}}function cg(e,t,r){return e.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,JC(e,t)):{type:N.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function JC(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 lg(e,t,r,n,s){r=Oe(e,t,r),r=Hr(e,t,r),r=zr(e,t,r,n),jC(e);let{featureTable:o,batchTable:i}=XC(e);return await ZC(e,o,i,n,s),WC(e,o,n),YC(e,o,i),KC(e,o),r}function jC(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function XC(e){let t=new ge(e.featureTableJson,e.featureTableBinary),r=t.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(r))throw new Error("POINTS_LENGTH must be defined");t.featuresLength=r,e.featuresLength=r,e.pointsLength=r,e.pointCount=r,e.rtcCenter=t.getGlobalProperty("RTC_CENTER",N.FLOAT,3);let n=QC(e,t);return{featureTable:t,batchTable:n}}function WC(e,t,r){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.positions){if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",N.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let n=t.getPropertyArray("POSITION_QUANTIZED",N.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",N.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",N.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=cg(e,n,r)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function YC(e,t,r){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.colors){let n=null;t.hasProperty("RGBA")?(n=t.getPropertyArray("RGBA",N.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?n=t.getPropertyArray("RGB",N.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(n=t.getPropertyArray("RGB565",N.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=Qc(e,n,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",N.UNSIGNED_BYTE,4))}function KC(e,t){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.normals){let r=null;t.hasProperty("NORMAL")?r=t.getPropertyArray("NORMAL",N.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",N.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=ag(e,r)}}function QC(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",N.UNSIGNED_SHORT,1),e.batchIds)){let n=t.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:s,batchTableBinary:o}=e;r=new cr(s,o,n)}return r}async function ZC(e,t,r,n,s){let o,i,a,c=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];c&&(a=c.properties);let l=t.getExtension("3DTILES_draco_point_compression");if(l){i=l.properties;let u=l.byteOffset,h=l.byteLength;if(!i||!Number.isFinite(u)||!h)throw new Error("Draco properties, byteOffset, and byteLength must be defined");o=(e.featureTableBinary||[]).slice(u,u+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 f={buffer:o,properties:{...i,...a},featureTableProperties:i,batchTableProperties:a,dequantizeInShader:!1};return await $C(e,f,n,s)}async function $C(e,t,r,n){if(!n)return;let s={...r,draco:{...r?.draco,extraAttributes:t.batchTableProperties||{}}};delete s["3d-tiles"];let o=await vt(t.buffer,zo,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,f=i&&o.attributes.POSITION.value.quantization,u=c&&o.attributes.NORMAL.value.quantization;if(f){let d=o.POSITION.data.quantization,p=d.range;e.quantizedVolumeScale=new x(p,p,p),e.quantizedVolumeOffset=new x(d.minValues),e.quantizedRange=(1<<d.quantizationBits)-1,e.isQuantizedDraco=!0}u&&(e.octEncodedRange=(1<<o.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let 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:Qc(e,a,void 0),normals:c,batchIds:l,...h}}var Zc={};pt(Zc,{createExtMeshFeatures:()=>gS,decode:()=>uS,encode:()=>hS,name:()=>fS});function lt(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var ko={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Jo={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var tS=1.33,fg=["SCALAR","VEC2","VEC3","VEC4"],eS=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],rS=new Map(eS),nS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},sS={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},oS={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function jo(e){return fg[e-1]||fg[0]}function Ne(e){let t=rS.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function qr(e,t){let r=oS[e.componentType],n=nS[e.type],s=sS[e.componentType],o=e.count*n,i=e.count*n*s;lt(i>=0&&i<=t.byteLength);let a=Jo[e.componentType],c=ko[e.type];return{ArrayType:r,length:o,byteLength:i,componentByteSize:a,numberOfComponentsInElement:c}}function $n(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*tS)}function ug(e,t,r){let n=e.bufferViews[r];lt(n);let s=n.buffer,o=t[s];lt(o);let i=(n.byteOffset||0)+o.byteOffset;return new Uint8Array(o.arrayBuffer,i,n.byteLength)}function hg(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:f,numberOfComponentsInElement:u}=qr(n,s),h=f*u,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 m=new c(o,a+A*d,u);p.set(m,A*u)}return p}function iS(){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||iS(),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];lt(n);let s=(t.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,s,t.byteLength)}getTypedArrayForAccessor(t){let r=this.getAccessor(t);return hg(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 lt(r),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=r,this.registerUsedExtension(t),r}addRequiredExtension(t,r={}){return lt(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=$e(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;lt(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let o={buffer:r,byteOffset:n,byteLength:s};return this.byteLength+=Be(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:jo(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:Ne(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(){let t=this.byteLength,r=new ArrayBuffer(t),n=new Uint8Array(r),s=0;for(let o of this.sourceBuffers||[])s=Ya(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],this.gltf.buffers=[{arrayBuffer:r,byteOffset:0,byteLength:r.byteLength}]}_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 dg(e){return(e%1+1)%1}var pg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},aS={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},mg={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function ts(e,t){return mg[t]*pg[e]}function kr(e,t,r,n){if(r!=="UINT8"&&r!=="UINT16"&&r!=="UINT32"&&r!=="UINT64")return null;let s=e.getTypedArrayForBufferView(t),o=Jr(s,"SCALAR",r,n+1);return o instanceof BigInt64Array||o instanceof BigUint64Array?null:o}function Jr(e,t,r,n=1){let s=pg[t],o=aS[r],i=mg[r],a=n*s,c=a*i,l=e.buffer,f=e.byteOffset;return f%i!==0&&(l=new Uint8Array(l).slice(f,f+c).buffer,f=0),new o(l,f,a)}function jr(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,f=e.gltf.images?.[c];if(f&&typeof f.width<"u"){let u=[];for(let h=0;h<o.length;h+=2){let d=cS(f,l,o,h,t.channels);u.push(d)}return u}}return[]}function Xo(e,t,r,n,s){if(!r?.length)return;let o=[];for(let f of r){let u=n.findIndex(h=>h===f);u===-1&&(u=n.push(f)-1),o.push(u)}let i=new Uint32Array(o),a=e.gltf.buffers.push({arrayBuffer:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength})-1,c=e.addBufferView(i,a,0),l=e.addAccessor(c,{size:1,componentType:Ne(i),count:i.length});s.attributes[t]=l}function cS(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=lS(i,a,e,c),f=0;for(let u of s){let h=typeof u=="number"?Object.values(o)[u]:o[u],d=l+h.offset,p=Ln(e);if(p.data.length<=d)throw new Error(`${p.data.length} <= ${d}`);let A=p.data[d];f|=A<<h.shift}return f}function lS(e,t,r,n=1){let s=r.width,o=dg(e)*(s-1),i=Math.round(o),a=r.height,c=dg(t)*(a-1),l=Math.round(c),f=r.components?r.components:n;return(l*s+i)*f}function Wo(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,f=c/s;o.push(e.slice(l,l+f))}return o}function Yo(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 Ko(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),f=o.decode(l);s.push(f),i+=c}}return s}return[]}var Xr="EXT_mesh_features",fS=Xr;async function uS(e,t){let r=new q(e);dS(r,t)}function hS(e,t){let r=new q(e);return mS(r,t),r.createBinaryChunk(),r.gltf}function dS(e,t){let r=e.gltf.json;if(r.meshes)for(let n of r.meshes)for(let s of n.primitives)pS(e,s,t)}function pS(e,t,r){if(!r?.gltf?.loadBuffers)return;let s=t.extensions?.[Xr]?.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=jr(e,o.texture,t):i=[];o.data=i}}function mS(e,t){let r=e.gltf.json.meshes;if(r)for(let n of r)for(let s of n.primitives)AS(e,s)}function gS(e,t,r,n){t.extensions||(t.extensions={});let s=t.extensions[Xr];s||(s={featureIds:[]},t.extensions[Xr]=s);let{featureIds:o}=s,i={featureCount:r.length,propertyTable:n,data:r};o.push(i),e.addObjectExtension(t,Xr,s)}function AS(e,t){let r=t.extensions?.[Xr];if(!r)return;let n=r.featureIds;n.forEach((s,o)=>{if(s.data){let{accessorKey:i,index:a}=xS(t.attributes),c=new Uint32Array(s.data);n[o]={featureCount:c.length,propertyTable:s.propertyTable,attribute:a},e.gltf.buffers.push({arrayBuffer:c.buffer,byteOffset:c.byteOffset,byteLength:c.byteLength});let l=e.addBufferView(c),f=e.addAccessor(l,{size:1,componentType:Ne(c),count:c.length});t.attributes[i]=f}})}function xS(e){let t="_FEATURE_ID_",r=Object.keys(e).filter(o=>o.indexOf(t)===0),n=-1;for(let o of r){let i=Number(o.substring(t.length));i>n&&(n=i)}return n++,{accessorKey:`${t}${n}`,index:n}}var el={};pt(el,{createExtStructuralMetadata:()=>VS,decode:()=>TS,encode:()=>ES,name:()=>yS});var Wr="EXT_structural_metadata",yS=Wr;async function TS(e,t){let r=new q(e);_S(r,t)}function ES(e,t){let r=new q(e);return GS(r,t),r.createBinaryChunk(),r.gltf}function _S(e,t){if(!t.gltf?.loadBuffers)return;let r=e.getExtension(Wr);r&&(t.gltf?.loadImages&&MS(e,r),bS(e,r))}function MS(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)CS(e,r,o,t)}function bS(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=BS(s,o);i&&IS(e,r,i)}}function BS(e,t){for(let r of e)if(r.class===t)return r;return null}function CS(e,t,r,n){if(!t)return;let o=r.extensions?.[Wr]?.propertyTextures;if(o)for(let i of o){let a=t[i];SS(e,a,r,n)}}function SS(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=jr(e,a,r);l!==null&&(Xo(e,i,l,c,r),a.data=c,n.dataAttributeNames.push(i))}}function IS(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=wS(e,t,i,s,a);a.data=c}}}function wS(e,t,r,n,s){let o=[],i=s.values,a=e.getTypedArrayForBufferView(i),c=LS(e,r,s,n),l=vS(e,s,n);switch(r.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{o=RS(r,n,a,c);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${r.type}`);case"STRING":{o=Ko(n,a,c,l);break}case"ENUM":{o=FS(t,r,n,a,c);break}default:throw new Error(`Unknown classProperty type ${r.type}`)}return o}function LS(e,t,r,n){return t.array&&typeof t.count>"u"&&typeof r.arrayOffsets<"u"?kr(e,r.arrayOffsets,r.arrayOffsetType||"UINT32",n):null}function vS(e,t,r){return typeof t.stringOffsets<"u"?kr(e,t.stringOffsets,t.stringOffsetType||"UINT32",r):null}function RS(e,t,r,n){let s=e.array,o=e.count,i=ts(e.type,e.componentType),a=r.byteLength/i,c;return e.componentType?c=Jr(r,e.type,e.componentType,a):c=r,s?n?Wo(c,t,n,r.length,i):o?Yo(c,t,o):[]:c}function FS(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=ts(t.type,a),l=n.byteLength/c,f=Jr(n,t.type,a,l);if(f||(f=n),t.array){if(s)return PS({valuesData:f,numberOfElements:r,arrayOffsets:s,valuesDataBytesLength:n.length,elementSize:c,enumEntry:i});let u=t.count;return u?OS(f,r,u,i):[]}return tl(f,0,r,i)}function PS(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],f=n[c+1]-n[c];if(f+l>s)break;let u=l/o,h=f/o,d=tl(t,u,h,i);a.push(d)}return a}function OS(e,t,r,n){let s=[];for(let o=0;o<t;o++){let i=r*o,a=tl(e,i,r,n);s.push(a)}return s}function tl(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=NS(n,i);a?s.push(a.name):s.push("")}return s}function NS(e,t){for(let r of e.values)if(r.value===t)return r;return null}var DS="schemaClassId";function GS(e,t){let r=e.getExtension(Wr);if(r&&r.propertyTables)for(let n of r.propertyTables){let s=n.class,o=r.schema?.classes?.[s];n.properties&&o&&US(n,o,e)}}function US(e,t,r){for(let n in e.properties){let s=e.properties[n].data;if(s){let o=t.properties[n];if(o){let i=qS(s,o,r);e.properties[n]=i}}}}function VS(e,t,r=DS){let n=e.getExtension(Wr);n||(n=e.addExtension(Wr)),n.schema=HS(t,r,n.schema);let s=zS(t,r,n.schema);return n.propertyTables||(n.propertyTables=[]),n.propertyTables.push(s)-1}function HS(e,t,r){let n=r??{id:"schema_id"},s={properties:{}};for(let o of e){let i={type:o.elementType,componentType:o.componentType};s.properties[o.name]=i}return n.classes={},n.classes[t]=s,n}function zS(e,t,r){let n={class:t,count:0},s=0,o=r.classes?.[t];for(let i of e){if(s===0&&(s=i.values.length),s!==i.values.length&&i.values.length)throw new Error("Illegal values in attributes");o?.properties[i.name]&&(n.properties||(n.properties={}),n.properties[i.name]={values:0,data:i.values})}return n.count=s,n}function qS(e,t,r){let n={values:0};if(t.type==="STRING"){let{stringData:s,stringOffsets:o}=jS(e);n.stringOffsets=$c(o,r),n.values=$c(s,r)}else if(t.type==="SCALAR"&&t.componentType){let s=JS(e,t.componentType);n.values=$c(s,r)}return n}var kS={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:Int32Array,UINT64:Uint32Array,FLOAT32:Float32Array,FLOAT64:Float64Array};function JS(e,t){let r=[];for(let s of e)r.push(Number(s));let n=kS[t];if(!n)throw new Error("Illegal component type");return new n(r)}function jS(e){let t=new TextEncoder,r=[],n=0;for(let c of e){let l=t.encode(c);n+=l.length,r.push(l)}let s=new Uint8Array(n),o=[],i=0;for(let c of r)s.set(c,i),o.push(i),i+=c.length;o.push(i);let a=new Uint32Array(o);return{stringData:s,stringOffsets:a}}function $c(e,t){return t.gltf.buffers.push({arrayBuffer:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength}),t.addBufferView(e)}var rl={};pt(rl,{decode:()=>WS,name:()=>XS});var gg="EXT_feature_metadata",XS=gg;async function WS(e,t){let r=new q(e);YS(r,t)}function YS(e,t){if(!t.gltf?.loadBuffers)return;let r=e.getExtension(gg);r&&(t.gltf?.loadImages&&KS(e,r),QS(e,r))}function KS(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=$S(s,o);a&&eI(e,a,i)}}function QS(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=ZS(s,o);i&&tI(e,r,i)}}function ZS(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function $S(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function tI(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=rI(e,t,i,s,a);a.data=c}}}function eI(e,t,r){let n=t.class;for(let s in r.properties){let o=t?.properties?.[s];if(o){let i=aI(e,o,n);o.data=i}}}function rI(e,t,r,n,s){let o=[],i=s.bufferView,a=e.getTypedArrayForBufferView(i),c=nI(e,r,s,n),l=sI(e,r,s,n);return r.type==="STRING"||r.componentType==="STRING"?o=Ko(n,a,c,l):oI(r)&&(o=iI(r,n,a,c)),o}function nI(e,t,r,n){return t.type==="ARRAY"&&typeof t.componentCount>"u"&&typeof r.arrayOffsetBufferView<"u"?kr(e,r.arrayOffsetBufferView,r.offsetType||"UINT32",n):null}function sI(e,t,r,n){return typeof r.stringOffsetBufferView<"u"?kr(e,r.stringOffsetBufferView,r.offsetType||"UINT32",n):null}function oI(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 iI(e,t,r,n){let s=e.type==="ARRAY",o=e.componentCount,i="SCALAR",a=e.componentType||e.type,c=ts(i,a),l=r.byteLength/c,f=Jr(r,i,a,l);return s?n?Wo(f,t,n,r.length,c):o?Yo(f,t,o):[]:f}function aI(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)cI(e,r,t,s,i);return s}function cI(e,t,r,n,s){let o={channels:r.channels,...r.texture},i=jr(e,o,s);i&&Xo(e,t,i,n,s)}var Ag="4.3.3";var xg="4.3.3";var Qo={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},yg;async function sl(e){Ja(e.modules);let t=ja("basis");return t||(yg||=lI(e),await yg)}async function lI(e){let t=null,r=null;return[t,r]=await Promise.all([await re(Qo.TRANSCODER,"textures",e),await re(Qo.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await fI(t,r)}function fI(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 nl;async function ol(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(nl=nl||uI(e),await nl)}async function uI(e){let t=null,r=null;return[t,r]=await Promise.all([await re(Qo.ENCODER,"textures",e),await re(Qo.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await hI(t,r)}function hI(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 lr={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 dI=["","WEBKIT_","MOZ_"],Tg={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"},Zo=null;function Eg(e){if(!Zo){e=e||pI()||void 0,Zo=new Set;for(let t of dI)for(let r in Tg)if(e&&e.getExtension(`${t}${r}`)){let n=Tg[r];Zo.add(n)}}return Zo}function pI(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var Rt=[171,75,84,88,32,50,48,187,13,10,26,10];function _g(e){let t=new Uint8Array(e);return!(t.byteLength<Rt.length||t[0]!==Rt[0]||t[1]!==Rt[1]||t[2]!==Rt[2]||t[3]!==Rt[3]||t[4]!==Rt[4]||t[5]!==Rt[5]||t[6]!==Rt[6]||t[7]!==Rt[7]||t[8]!==Rt[8]||t[9]!==Rt[9]||t[10]!==Rt[10]||t[11]!==Rt[11])}var mI={etc1:{basisFormat:0,compressed:!0,format:lr.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:lr.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:lr.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:lr.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:lr.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:lr.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 bg(e,t){if(t.basis.containerFormat==="auto"){if(_g(e)){let n=await ol(t);return Mg(n.KTX2File,e,t)}let{BasisFile:r}=await sl(t);return il(r,e,t)}switch(t.basis.module){case"encoder":let r=await ol(t);switch(t.basis.containerFormat){case"ktx2":return Mg(r.KTX2File,e,t);case"basis":default:return il(r.BasisFile,e,t)}case"transcoder":default:let{BasisFile:n}=await sl(t);return il(n,e,t)}}function il(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(gI(n,i,l,r));o.push(c)}return o}finally{n.close(),n.delete()}}function gI(e,t,r,n){let s=e.getImageWidth(t,r),o=e.getImageHeight(t,r),i=e.getHasAlpha(),{compressed:a,format:c,basisFormat:l}=Bg(n,i),f=e.getImageTranscodedSizeInBytes(t,r,l),u=new Uint8Array(f);if(!e.transcodeImage(u,t,r,l,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:o,data:u,compressed:a,format:c,hasAlpha:i}}function Mg(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(AI(n,i,r));return[o]}finally{n.close(),n.delete()}}function AI(e,t,r){let{alphaFlag:n,height:s,width:o}=e.getImageLevelInfo(t,0,0),{compressed:i,format:a,basisFormat:c}=Bg(r,n),l=e.getImageTranscodedSizeInBytes(t,0,0,c),f=new Uint8Array(l);if(!e.transcodeImage(f,t,0,0,c,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:o,height:s,data:f,compressed:i,levelSize:l,hasAlpha:n,format:a}}function Bg(e,t){let r=e&&e.basis&&e.basis.format;return r==="auto"&&(r=$o()),typeof r=="object"&&(r=t?r.alpha:r.noAlpha),r=r.toLowerCase(),mI[r]}function $o(){let e=Eg();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 Cg={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:xg,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"}}},al={...Cg,parse:bg};var Yr=!0,Sg=1735152710,fl=12,ti=8,xI=1313821514,yI=5130562,TI=0,EI=0,_I=1;function MI(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 Ig(e,t=0,r={}){let n=new DataView(e),{magic:s=Sg}=r,o=n.getUint32(t,!1);return o===s||o===Sg}function wg(e,t,r=0,n={}){let s=new DataView(t),o=MI(s,r+0),i=s.getUint32(r+4,Yr),a=s.getUint32(r+8,Yr);switch(Object.assign(e,{header:{byteOffset:r,byteLength:a,hasBinChunk:!1},type:o,version:i,json:{},binChunks:[]}),r+=fl,e.version){case 1:return bI(e,s,r);case 2:return BI(e,s,r,n={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function bI(e,t,r){H(e.header.byteLength>fl+ti);let n=t.getUint32(r+0,Yr),s=t.getUint32(r+4,Yr);return r+=ti,H(s===TI),cl(e,t,r,n),r+=n,r+=ll(e,t,r,e.header.byteLength),r}function BI(e,t,r,n){return H(e.header.byteLength>fl+ti),CI(e,t,r,n),r+e.header.byteLength}function CI(e,t,r,n){for(;r+8<=e.header.byteLength;){let s=t.getUint32(r+0,Yr),o=t.getUint32(r+4,Yr);switch(r+=ti,o){case xI:cl(e,t,r,s);break;case yI:ll(e,t,r,s);break;case EI:n.strict||cl(e,t,r,s);break;case _I:n.strict||ll(e,t,r,s);break;default:break}r+=Be(s,4)}return r}function cl(e,t,r,n){let s=new Uint8Array(t.buffer,r,n),i=new TextDecoder("utf8").decode(s);return e.json=JSON.parse(i),Be(n,4)}function ll(e,t,r,n){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:t.buffer}),Be(n,4)}function ul(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 dl={};pt(dl,{decode:()=>GI,name:()=>DI});var SI="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",II="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",wI=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]),LI=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]),vI={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},RI={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function Lg(e,t,r,n,s,o="NONE"){let i=await FI();NI(i,i.exports[RI[s]],e,t,r,n,i.exports[vI[o||"NONE"]])}var hl;async function FI(){return hl||(hl=PI()),hl}async function PI(){let e=SI;WebAssembly.validate(wI)&&(e=II,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(OI(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function OI(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?LI[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,r)}function NI(e,t,r,n,s,o,i){let a=e.exports.sbrk,c=n+3&-4,l=a(c*s),f=a(o.length),u=new Uint8Array(e.exports.memory.buffer);u.set(o,f);let h=t(l,n,s,f,o.length);if(h===0&&i&&i(l,c,s),r.set(u.subarray(l,l+n*s)),a(l-a(0)),h!==0)throw new Error(`Malformed buffer data: ${h}`)}var ei="EXT_meshopt_compression",DI=ei;async function GI(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(UI(r,s));await Promise.all(n),r.removeExtension(ei)}async function UI(e,t){let r=e.getObjectExtension(t,ei);if(r){let{byteOffset:n=0,byteLength:s=0,byteStride:o,count:i,mode:a,filter:c="NONE",buffer:l}=r,f=e.gltf.buffers[l],u=new Uint8Array(f.arrayBuffer,f.byteOffset+n,s),h=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await Lg(h,i,o,u,a,c),e.removeObjectExtension(t,ei)}}var pl={};pt(pl,{name:()=>VI,preprocess:()=>HI});var Kr="EXT_texture_webp",VI=Kr;function HI(e,t){let r=new q(e);if(!ic("image/webp")){if(r.getRequiredExtensions().includes(Kr))throw new Error(`gltf: Required extension ${Kr} not supported by browser`);return}let{json:n}=r;for(let s of n.textures||[]){let o=r.getObjectExtension(s,Kr);o&&(s.source=o.source),r.removeObjectExtension(s,Kr)}r.removeExtension(Kr)}var ml={};pt(ml,{name:()=>zI,preprocess:()=>qI});var ri="KHR_texture_basisu",zI=ri;function qI(e,t){let r=new q(e),{json:n}=r;for(let s of n.textures||[]){let o=r.getObjectExtension(s,ri);o&&(s.source=o.source,r.removeObjectExtension(s,ri))}r.removeExtension(ri)}var Al={};pt(Al,{decode:()=>WI,encode:()=>YI,name:()=>jI,preprocess:()=>XI});function vg(e){let t={};for(let r in e){let n=e[r];if(r!=="indices"){let s=gl(n);t[r]=s}}return t}function gl(e){let{buffer:t,size:r,count:n}=kI(e);return{value:t,size:r,byteOffset:0,count:n,type:jo(r),componentType:Ne(t)}}function kI(e){let t=e,r=1,n=0;return e&&e.value&&(t=e.value,r=e.size||1),t&&(ArrayBuffer.isView(t)||(t=JI(t,Float32Array)),n=t.length/r),{buffer:t,size:r,count:n}}function JI(e,t,r=!1){return e?Array.isArray(e)?new t(e):r&&!(e instanceof t)?new t(e):e:null}var De="KHR_draco_mesh_compression",jI=De;function XI(e,t,r){let n=new q(e);for(let s of Rg(n))n.getObjectExtension(s,De)}async function WI(e,t,r){if(!t?.gltf?.decompressMeshes)return;let n=new q(e),s=[];for(let o of Rg(n))n.getObjectExtension(o,De)&&s.push(KI(n,o,t,r));await Promise.all(s),n.removeExtension(De)}function YI(e,t={}){let r=new q(e);for(let n of r.json.meshes||[])QI(n,t),r.addRequiredExtension(De)}async function KI(e,t,r,n){let s=e.getObjectExtension(t,De);if(!s)return;let o=e.getTypedArrayForBufferView(s.bufferView),i=Ye(o.buffer,o.byteOffset),a={...r};delete a["3d-tiles"];let c=await vt(i,zo,a,n),l=vg(c.attributes);for(let[f,u]of Object.entries(l))if(f in t.attributes){let h=t.attributes[f],d=e.getAccessor(h);d?.min&&d?.max&&(u.min=d.min,u.max=d.max)}t.attributes=l,c.indices&&(t.indices=gl(c.indices)),e.removeObjectExtension(t,De),ZI(t)}function QI(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:{[De]:{bufferView:c,attributes:a}}}]}}function ZI(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*Rg(e){for(let t of e.json.meshes||[])for(let r of t.primitives)yield r}var xl={};pt(xl,{decode:()=>r2,name:()=>$I});var si="KHR_texture_transform",$I=si,ni=new x,t2=new J,e2=new J;async function r2(e,t){if(!new q(e).hasExtension(si)||!t.gltf?.loadBuffers)return;let s=e.json.materials||[];for(let o=0;o<s.length;o++)n2(o,e)}function n2(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?.[si]&&s2(t,e,o,s)}function s2(e,t,r,n){let s=o2(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&&i2(e,a,s)}}function o2(e,t){let r=e.extensions?.[si],{texCoord:n=0}=e,{texCoord:s=n}=r;if(!(t.findIndex(([i,a])=>i===n&&a===s)!==-1)){let i=l2(r);return n!==s&&(e.texCoord=s),t.push([n,s]),{originalTexCoord:n,texCoord:s,matrix:i}}return null}function i2(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:f}=e.buffers[c.buffer],u=(f||0)+(a.byteOffset||0)+(c.byteOffset||0),{ArrayType:h,length:d}=qr(a,c),p=Jo[a.componentType],A=ko[a.type],m=c.byteStride||p*A,y=new Float32Array(d);for(let _=0;_<a.count;_++){let E=new h(l,u+_*m,2);ni.set(E[0],E[1],1),ni.transformByMatrix3(o),y.set([ni[0],ni[1]],_*A)}n===s?a2(a,c,e.buffers,y):c2(s,a,t,e,y)}}}}function a2(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 c2(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 l2(e){let{offset:t=[0,0],rotation:r=0,scale:n=[1,1]}=e,s=new J().set(1,0,0,0,1,0,t[0],t[1],1),o=t2.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),i=e2.set(n[0],0,0,0,n[1],0,0,0,1);return s.multiplyRight(o).multiplyRight(i)}var yl={};pt(yl,{decode:()=>u2,encode:()=>h2,name:()=>f2});var fr="KHR_lights_punctual",f2=fr;async function u2(e){let t=new q(e),{json:r}=t,n=t.getExtension(fr);n&&(t.json.lights=n.lights,t.removeExtension(fr));for(let s of r.nodes||[]){let o=t.getObjectExtension(s,fr);o&&(s.light=o.light),t.removeObjectExtension(s,fr)}}async function h2(e){let t=new q(e),{json:r}=t;if(r.lights){let n=t.addExtension(fr);lt(!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,fr,n)}delete t.json.lights}}var Tl={};pt(Tl,{decode:()=>p2,encode:()=>m2,name:()=>d2});var es="KHR_materials_unlit",d2=es;async function p2(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,es);t.removeExtension(es)}function m2(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,es,{}),t.addExtension(es))}var El={};pt(El,{decode:()=>A2,encode:()=>x2,name:()=>g2});var rs="KHR_techniques_webgl",g2=rs;async function A2(e){let t=new q(e),{json:r}=t,n=t.getExtension(rs);if(n){let s=y2(n,t);for(let o of r.materials||[]){let i=t.getObjectExtension(o,rs);i&&(o.technique=Object.assign({},i,s[i.technique]),o.technique.values=T2(o.technique,t)),t.removeObjectExtension(o,rs)}t.removeExtension(rs)}}async function x2(e,t){}function y2(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 T2(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 Fg=[el,Zc,dl,pl,ml,Al,yl,Tl,El,xl,rl];function Pg(e,t={},r){let n=Fg.filter(s=>Ng(s.name,t));for(let s of n)s.preprocess?.(e,t,r)}async function Og(e,t={},r){let n=Fg.filter(s=>Ng(s.name,t));for(let s of n)await s.decode?.(e,t,r)}function Ng(e,t){let r=t?.gltf?.excludeExtensions||{};return!(e in r&&!r[e])}var _l="KHR_binary_glTF";function Dg(e){let t=new q(e),{json:r}=t;for(let n of r.images||[]){let s=t.getObjectExtension(n,_l);s&&Object.assign(n,s),t.removeObjectExtension(n,_l)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,t.removeExtension(_l)}var Gg={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},_2={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},Ml=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),Dg(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 Gg)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 Gg)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=_2[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 Ug(e,t={}){return new Ml().normalize(e,t)}async function Vg(e,t,r=0,n,s){return M2(e,t,r,n),Ug(e,{normalize:n?.gltf?.normalize}),Pg(e,n,s),n?.gltf?.loadBuffers&&e.json.buffers&&await b2(e,n,s),n?.gltf?.loadImages&&await B2(e,n,s),await Og(e,n,s),e}function M2(e,t,r,n){if(n.uri&&(e.baseUri=n.uri),t instanceof ArrayBuffer&&!Ig(t,r,n)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=Wa(t);else if(t instanceof ArrayBuffer){let i={};r=wg(i,t,r,n.glb),lt(i.type==="glTF",`Invalid GLB magic string ${i.type}`),e._glb=i,e.json=i.json}else lt(!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 b2(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;lt(i);let a=ul(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 B2(e,t,r){let n=C2(e),s=e.json.images||[],o=[];for(let i of n)o.push(S2(e,s[i],i,t,r));return await Promise.all(o)}function C2(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 S2(e,t,r,n,s){let o;if(t.uri&&!t.hasOwnProperty("bufferView")){let a=ul(t.uri,n),{fetch:c}=s;o=await(await c(a)).arrayBuffer(),t.bufferView={data:o}}if(Number.isFinite(t.bufferView)){let a=ug(e.json,e.buffers,t.bufferView);o=Ye(a.buffer,a.byteOffset,a.byteLength)}lt(o,"glTF image has no data");let i=await vt(o,[Fr,al],{...n,mimeType:t.mimeType,basis:n.basis||{format:$o()}},s);i&&i[0]&&(i={compressed:!0,mipmaps:!1,width:i[0].width,height:i[0].height,data:i[0]}),e.images=e.images||[],e.images[r]=i}var ur={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:Ag,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:I2,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function I2(e,t={},r){t={...ur.options,...t},t.gltf={...ur.options.gltf,...t.gltf};let{byteOffset:n=0}=t;return await Vg({},e,n,t,r)}var w2={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},L2={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Ut={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},v2={magFilter:Ut.TEXTURE_MAG_FILTER,minFilter:Ut.TEXTURE_MIN_FILTER,wrapS:Ut.TEXTURE_WRAP_S,wrapT:Ut.TEXTURE_WRAP_T},R2={[Ut.TEXTURE_MAG_FILTER]:Ut.LINEAR,[Ut.TEXTURE_MIN_FILTER]:Ut.NEAREST_MIPMAP_LINEAR,[Ut.TEXTURE_WRAP_S]:Ut.REPEAT,[Ut.TEXTURE_WRAP_T]:Ut.REPEAT};function F2(){return{id:"default-sampler",parameters:R2}}function P2(e){return L2[e]}function O2(e){return w2[e]}var bl=class{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(t,r={}){let{json:n,buffers:s=[],images:o=[]}=t,{baseUri:i=""}=t;return lt(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=P2(t.componentType),s=O2(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}=qr(i,i.bufferView),f=(i.bufferView.byteOffset||0)+(i.byteOffset||0)+a.byteOffset,u=a.arrayBuffer.slice(f,f+l);i.bufferView.byteStride&&(u=this._getValueFromInterleavedBuffer(a,f,i.bufferView.byteStride,i.bytesPerElement,i.count)),i.value=new c(u)}return i}_getValueFromInterleavedBuffer(t,r,n,s,o){let i=new Uint8Array(o*s);for(let a=0;a<o;a++){let c=r+a*n;i.set(new Uint8Array(t.arrayBuffer.slice(c,c+s)),a*s)}return i.buffer}_resolveTexture(t,r){return{...t,id:t.id||`texture-${r}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):F2(),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 v2[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 ns(e,t){return new bl().postProcess(e,t)}var oi={URI:0,EMBEDDED:1};function ii(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=Ye(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 ai(e,t,r,n){let s=r?.["3d-tiles"]||{};if(N2(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 vt(e.gltfArrayBuffer,ur,r,n);e.gltf=ns(o),e.gpuMemoryUsageInBytes=$n(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function N2(e,t,r){switch(t){case oi.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 oi.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function Hg(e,t,r,n,s){r=D2(e,t,r,n,s),await ai(e,oi.EMBEDDED,n,s);let o=e?.gltf?.extensions;return o&&o.CESIUM_RTC&&(e.rtcCenter=o.CESIUM_RTC.center),r}function D2(e,t,r,n,s){r=Oe(e,t,r),r=Hr(e,t,r),r=zr(e,t,r,n),r=ii(e,t,r,n);let o=new ge(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=o.getGlobalProperty("RTC_CENTER",N.FLOAT,3),r}async function zg(e,t,r,n,s){return r=G2(e,t,r,n,s),await ai(e,e.gltfFormat||0,n,s),r}function G2(e,t,r,n,s){if(r=Oe(e,t,r),e.version!==1)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);r=Hr(e,t,r);let o=new DataView(t);if(e.gltfFormat=o.getUint32(r,!0),r+=4,r=zr(e,t,r,n),r=ii(e,t,r,n),!e?.header?.featureTableJsonByteLength||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let i=new ge(e.featureTableJson,e.featureTableBinary),a=i.getGlobalProperty("INSTANCES_LENGTH");if(i.featuresLength=a,!Number.isFinite(a))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=i.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=i.getGlobalProperty("RTC_CENTER",N.FLOAT,3);let c=new cr(e.batchTableJson,e.batchTableBinary,a);return U2(e,i,c,a),r}function U2(e,t,r,n){let s=new Array(n),o=new x,i=new x,a=new x,c=new x,l=new J,f=new $t,u=new x,h={},d=new O,p=[],A=[],m=[],y=[];for(let _=0;_<n;_++){let E;if(t.hasProperty("POSITION"))E=t.getProperty("POSITION",N.FLOAT,3,_,o);else if(t.hasProperty("POSITION_QUANTIZED")){E=t.getProperty("POSITION_QUANTIZED",N.UNSIGNED_SHORT,3,_,o);let g=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",N.FLOAT,3);if(!g)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let S=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",N.FLOAT,3);if(!S)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let R=65535;for(let F=0;F<3;F++)E[F]=E[F]/R*S[F]+g[F]}if(!E)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");o.copy(E),h.translation=o,e.normalUp=t.getProperty("NORMAL_UP",N.FLOAT,3,_,p),e.normalRight=t.getProperty("NORMAL_RIGHT",N.FLOAT,3,_,A);let M=!1;if(e.normalUp){if(!e.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");e.hasCustomOrientation=!0}else{if(e.octNormalUp=t.getProperty("NORMAL_UP_OCT32P",N.UNSIGNED_SHORT,2,_,p),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",N.UNSIGNED_SHORT,2,_,A),e.octNormalUp)throw e.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");e.eastNorthUp?(U.WGS84.eastNorthUpToFixedFrame(o,d),d.getRotationMatrix3(l)):l.identity()}M&&(c.copy(i).cross(a).normalize(),l.setColumn(0,i),l.setColumn(1,a),l.setColumn(2,c)),f.fromMatrix3(l),h.rotation=f,u.set(1,1,1);let B=t.getProperty("SCALE",N.FLOAT,1,_,m);Number.isFinite(B)&&u.multiplyByScalar(B);let C=t.getProperty("SCALE_NON_UNIFORM",N.FLOAT,3,_,p);C&&u.scale(C),h.scale=u;let L=t.getProperty("BATCH_ID",N.UNSIGNED_SHORT,1,_,y);L===void 0&&(L=_);let b=new O().fromQuaternion(h.rotation);d.identity(),d.translate(h.translation),d.multiplyRight(b),d.scale(h.scale);let T=d.clone();s[_]={modelMatrix:T,batchId:L}}e.instances=s}async function qg(e,t,r,n,s,o){r=Oe(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 kg(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 vt(t,ur,r,n);e.gltf=ns(s),e.gpuMemoryUsageInBytes=$n(e.gltf)}else e.gltfArrayBuffer=t;return t.byteLength}async function Bl(e,t=0,r,n,s={shape:"tile3d"}){switch(s.byteOffset=t,s.type=zm(e,t),s.type){case ir.COMPOSITE:return await qg(s,e,t,r,n,Bl);case ir.BATCHED_3D_MODEL:return await Hg(s,e,t,r,n);case ir.GLTF:return await kg(s,e,r,n);case ir.INSTANCED_3D_MODEL:return await zg(s,e,t,r,n);case ir.POINT_CLOUD:return await lg(s,e,t,r,n);default:throw new Error(`3DTileLoader: unknown type ${s.type}`)}}async function Cl(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=Jg(e.slice(8,16)),i=new Uint8Array(e,24,o),c=new TextDecoder("utf8").decode(i),l=JSON.parse(c),f=Jg(e.slice(16,24)),u=new ArrayBuffer(0);if(f&&(u=e.slice(24+o)),await ci(l,l.tileAvailability,u,r),Array.isArray(l.contentAvailability))for(let h of l.contentAvailability)await ci(l,h,u,r);else await ci(l,l.contentAvailability,u,r);return await ci(l,l.childSubtreeAvailability,u,r),l}async function ci(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}`,f=await(await n.fetch(c)).arrayBuffer();t.explicitBitstream=new Uint8Array(f,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 Jg(e){let t=new DataView(e),r=t.getUint32(0,!0),n=t.getUint32(4,!0);return r+2**32*n}var li={dataType:null,batchType:null,id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Ho,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:Cl,options:{}};var d0=D(Nr(),1);var l0=D(Nr(),1);var Vt=null;try{Vt=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Z(e,t,r){this.low=e|0,this.high=t|0,this.unsigned=!!r}Z.prototype.__isLong__;Object.defineProperty(Z.prototype,"__isLong__",{value:!0});function xt(e){return(e&&e.__isLong__)===!0}function jg(e){var t=Math.clz32(e&-e);return e?31-t:t}Z.isLong=xt;var Xg={},Wg={};function hr(e,t){var r,n,s;return t?(e>>>=0,(s=0<=e&&e<256)&&(n=Wg[e],n)?n:(r=k(e,0,!0),s&&(Wg[e]=r),r)):(e|=0,(s=-128<=e&&e<128)&&(n=Xg[e],n)?n:(r=k(e,e<0?-1:0,!1),s&&(Xg[e]=r),r))}Z.fromInt=hr;function Ht(e,t){if(isNaN(e))return t?Ae:Yt;if(t){if(e<0)return Ae;if(e>=Zg)return e0}else{if(e<=-Kg)return St;if(e+1>=Kg)return t0}return e<0?Ht(-e,t).neg():k(e%Zr|0,e/Zr|0,t)}Z.fromNumber=Ht;function k(e,t,r){return new Z(e,t,r)}Z.fromBits=k;var fi=Math.pow;function Il(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?Ae:Yt;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 Il(e.substring(1),t,r).neg();for(var s=Ht(fi(r,8)),o=Yt,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=Ht(fi(r,a));o=o.mul(l).add(Ht(c))}else o=o.mul(s),o=o.add(Ht(c))}return o.unsigned=t,o}Z.fromString=Il;function Kt(e,t){return typeof e=="number"?Ht(e,t):typeof e=="string"?Il(e,t):k(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}Z.fromValue=Kt;var Yg=1<<16,V2=1<<24,Zr=Yg*Yg,Zg=Zr*Zr,Kg=Zg/2,Qg=hr(V2),Yt=hr(0);Z.ZERO=Yt;var Ae=hr(0,!0);Z.UZERO=Ae;var Qr=hr(1);Z.ONE=Qr;var $g=hr(1,!0);Z.UONE=$g;var Sl=hr(-1);Z.NEG_ONE=Sl;var t0=k(-1,2147483647,!1);Z.MAX_VALUE=t0;var e0=k(-1,-1,!0);Z.MAX_UNSIGNED_VALUE=e0;var St=k(0,-2147483648,!1);Z.MIN_VALUE=St;var I=Z.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low};I.toNumber=function(){return this.unsigned?(this.high>>>0)*Zr+(this.low>>>0):this.high*Zr+(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(St)){var r=Ht(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=Ht(fi(t,6),this.unsigned),i=this,a="";;){var c=i.div(o),l=i.sub(c.mul(o)).toInt()>>>0,f=l.toString(t);if(i=c,i.isZero())return f+a;for(;f.length<6;)f="0"+f;a=""+f+a}};I.getHighBits=function(){return this.high};I.getHighBitsUnsigned=function(){return this.high>>>0};I.getLowBits=function(){return this.low};I.getLowBitsUnsigned=function(){return this.low>>>0};I.getNumBitsAbs=function(){if(this.isNegative())return this.eq(St)?64:this.neg().getNumBitsAbs();for(var 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 xt(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(xt(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(St)?St:this.not().add(Qr)};I.neg=I.negate;I.add=function(t){xt(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,f=0,u=0,h=0,d=0;return d+=o+l,h+=d>>>16,d&=65535,h+=s+c,u+=h>>>16,h&=65535,u+=n+a,f+=u>>>16,u&=65535,f+=r+i,f&=65535,k(h<<16|d,f<<16|u,this.unsigned)};I.subtract=function(t){return xt(t)||(t=Kt(t)),this.add(t.neg())};I.sub=I.subtract;I.multiply=function(t){if(this.isZero())return this;if(xt(t)||(t=Kt(t)),Vt){var r=Vt.mul(this.low,this.high,t.low,t.high);return k(r,Vt.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?Ae:Yt;if(this.eq(St))return t.isOdd()?St:Yt;if(t.eq(St))return this.isOdd()?St:Yt;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(Qg)&&t.lt(Qg))return Ht(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,f=t.low&65535,u=0,h=0,d=0,p=0;return p+=i*f,d+=p>>>16,p&=65535,d+=o*f,h+=d>>>16,d&=65535,d+=i*l,h+=d>>>16,d&=65535,h+=s*f,u+=h>>>16,h&=65535,h+=o*l,u+=h>>>16,h&=65535,h+=i*c,u+=h>>>16,h&=65535,u+=n*f+s*l+o*c+i*a,u&=65535,k(d<<16|p,u<<16|h,this.unsigned)};I.mul=I.multiply;I.divide=function(t){if(xt(t)||(t=Kt(t)),t.isZero())throw Error("division by zero");if(Vt){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?Vt.div_u:Vt.div_s)(this.low,this.high,t.low,t.high);return k(r,Vt.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Ae:Yt;var n,s,o;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return Ae;if(t.gt(this.shru(1)))return $g;o=Ae}else{if(this.eq(St)){if(t.eq(Qr)||t.eq(Sl))return St;if(t.eq(St))return Qr;var i=this.shr(1);return n=i.div(t).shl(1),n.eq(Yt)?t.isNegative()?Qr:Sl:(s=this.sub(t.mul(n)),o=n.add(s.div(t)),o)}else if(t.eq(St))return this.unsigned?Ae:Yt;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=Yt}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:fi(2,a-48),l=Ht(n),f=l.mul(t);f.isNegative()||f.gt(s);)n-=c,l=Ht(n,this.unsigned),f=l.mul(t);l.isZero()&&(l=Qr),o=o.add(l),s=s.sub(f)}return o};I.div=I.divide;I.modulo=function(t){if(xt(t)||(t=Kt(t)),Vt){var r=(this.unsigned?Vt.rem_u:Vt.rem_s)(this.low,this.high,t.low,t.high);return k(r,Vt.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};I.mod=I.modulo;I.rem=I.modulo;I.not=function(){return k(~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?jg(this.low):jg(this.high)+32};I.ctz=I.countTrailingZeros;I.and=function(t){return xt(t)||(t=Kt(t)),k(this.low&t.low,this.high&t.high,this.unsigned)};I.or=function(t){return xt(t)||(t=Kt(t)),k(this.low|t.low,this.high|t.high,this.unsigned)};I.xor=function(t){return xt(t)||(t=Kt(t)),k(this.low^t.low,this.high^t.high,this.unsigned)};I.shiftLeft=function(t){return xt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?k(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):k(0,this.low<<t-32,this.unsigned)};I.shl=I.shiftLeft;I.shiftRight=function(t){return xt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?k(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):k(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};I.shr=I.shiftRight;I.shiftRightUnsigned=function(t){return xt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?k(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?k(this.high,0,this.unsigned):k(this.high>>>t-32,0,this.unsigned)};I.shru=I.shiftRightUnsigned;I.shr_u=I.shiftRightUnsigned;I.rotateLeft=function(t){var r;return xt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?k(this.high,this.low,this.unsigned):t<32?(r=32-t,k(this.low<<t|this.high>>>r,this.high<<t|this.low>>>r,this.unsigned)):(t-=32,r=32-t,k(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 xt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?k(this.high,this.low,this.unsigned):t<32?(r=32-t,k(this.high<<r|this.low>>>t,this.low<<r|this.high>>>t,this.unsigned)):(t-=32,r=32-t,k(this.low<<r|this.high>>>t,this.high<<r|this.low>>>t,this.unsigned))};I.rotr=I.rotateRight;I.toSigned=function(){return this.unsigned?k(this.low,this.high,!1):this};I.toUnsigned=function(){return this.unsigned?this:k(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]};Z.fromBytes=function(t,r,n){return n?Z.fromBytesLE(t,r):Z.fromBytesBE(t,r)};Z.fromBytesLE=function(t,r){return new Z(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)};Z.fromBytesBE=function(t,r){return new Z(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)};var $r=Z;var H2=16;function ss(e){e==="X"&&(e="");let t=e.padEnd(H2,"0");return $r.fromString(t,!0,16)}function wl(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 Ll(e,t){let r=z2(e).shiftRightUnsigned(2);return e.add($r.fromNumber(2*t+1-4).multiply(r))}function z2(e){return e.and(e.not().add(1))}var q2=3,k2=30,J2=2*k2+1,r0=180/Math.PI;function s0(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,f=0;c==="1"?f=1:c==="2"?(l=1,f=1):c==="3"&&(l=1);let u=Math.pow(2,o-1);j2(u,i,l,f),i[0]+=u*l,i[1]+=u*f}if(r%2===1){let a=i[0];i[0]=i[1],i[1]=a}return{face:r,ij:i,level:o}}function o0(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<q2+J2;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),s=t.substring(3,r),o=s.length/2,i=$r.fromString(n,!0,2).toString(10),a="";if(o!==0)for(a=$r.fromString(s,!0,2).toString(4);a.length<o;)a="0"+a;return`${i}/${a}`}function vl(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function n0(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Rl(e){return[n0(e[0]),n0(e[1])]}function Fl(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 Pl([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*r0,n*r0]}function j2(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 i0(e){let t=vl(e.ij,e.level,[.5,.5]),r=Rl(t),n=Fl(e.face,r);return Pl(n)}var X2=100;function Ol(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(X2*Math.pow(2,-n))),i=new Float64Array(4*o*2+2),a=0,c=0;for(let l=0;l<4;l++){let f=s[l].slice(0),u=s[l+1],h=(u[0]-f[0])/o,d=(u[1]-f[1])/o;for(let p=0;p<o;p++){f[0]+=h,f[1]+=d;let A=vl(r,n,f),m=Rl(A),y=Fl(t,m),_=Pl(y);Math.abs(_[1])>89.999&&(_[0]=c);let E=_[0]-c;_[0]+=E>180?-360:E<-180?360:0,i[a++]=_[0],i[a++]=_[1],c=_[0]}}return i[a++]=i[0],i[a++]=i[1],i}function tn(e){let t=W2(e);return s0(t)}function W2(e){if(e.indexOf("/")>0)return e;let t=ss(e);return o0(t)}function Nl(e){let t=tn(e);return i0(t)}function c0(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=tn(o),a=Ol(i);(typeof r>"u"||r===null)&&(r=new Float64Array(4*a.length)),r.set(a,n),n+=a.length}t=a0(r)}else{let r=Ol(e);t=a0(r)}return t}function a0(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 Dl(e,t){let r=t?.minimumHeight||0,n=t?.maximumHeight||0,s=tn(e),o=c0(s),i=o.west,a=o.south,c=o.east,l=o.north,f=[];return f.push(new x(i,l,r)),f.push(new x(c,l,r)),f.push(new x(c,a,r)),f.push(new x(i,a,r)),f.push(new x(i,l,n)),f.push(new x(c,l,n)),f.push(new x(c,a,n)),f.push(new x(i,a,n)),f}function ui(e){let t=e.token,r={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},n=Dl(t,r),s=Nl(t),o=s[0],i=s[1],a=U.WGS84.cartographicToCartesian([o,i,r.maximumHeight]),c=new x(a[0],a[1],a[2]);n.push(c);let l=Gn(n);return[...l.center,...l.halfAxes]}var Y2=4,K2=8,Q2={QUADTREE:Y2,OCTREE:K2};function Z2(e,t,r){if(e?.box){let n=ss(e.s2VolumeInfo.token),s=Ll(n,t),o=wl(s),i={...e.s2VolumeInfo};switch(i.token=o,r){case"OCTREE":let l=e.s2VolumeInfo,f=l.maximumHeight-l.minimumHeight,u=f/2,h=l.minimumHeight+f/2;l.minimumHeight=h-u,l.maximumHeight=h+u;break;default:break}return{box:ui(i),s2VolumeInfo:i}}}async function Ul(e){let{subtree:t,subtreeData:r={level:0,x:0,y:0,z:0},parentData:n={mortonIndex:0,localLevel:-1,localX:0,localY:0,localZ:0},childIndex:s=0,implicitOptions:o,loaderOptions:i,s2VolumeBox:a}=e,{subdivisionScheme:c,subtreeLevels:l,maximumLevel:f,contentUrlTemplate:u,subtreesUriTemplate:h,basePath:d}=o,p={children:[],lodMetricValue:0,contentUrl:""};if(!f)return Ha.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${u} won't be loaded...`),p;let A=n.localLevel+1,m=r.level+A;if(m>f)return p;let y=Q2[c],_=Math.log2(y),E=s&1,M=s>>1&1,B=s>>2&1,C=dr(n.localX,E,1),L=dr(n.localY,M,1),b=dr(n.localZ,B,1),T=dr(r.x,C,A),g=dr(r.y,L,A),S=dr(r.z,b,A),R=dr(n.mortonIndex,s,_),F=A===l&&Gl(t.childSubtreeAvailability,R),v,G,X,z;if(F){let Y=`${d}/${h}`,$=hi(Y,m,T,g,S);v=await(0,l0.load)($,li,i),z=0,G={level:m,x:T,y:g,z:S},X={mortonIndex:0,localLevel:0,localX:0,localY:0,localZ:0}}else v=t,z=(y**A-1)/(y-1)+R,G=r,X={mortonIndex:R,localLevel:A,localX:C,localY:L,localZ:b};if(!Gl(v.tileAvailability,z))return p;Gl(v.contentAvailability,z)&&(p.contentUrl=hi(u,m,T,g,S));for(let Y=0;Y<y;Y++){let $=Z2(a,Y,c),bt=await Ul({subtree:v,subtreeData:G,parentData:X,childIndex:Y,implicitOptions:o,loaderOptions:i,s2VolumeBox:$});(bt.contentUrl||bt.children.length)&&p.children.push(bt)}return p.contentUrl||p.children.length?$2(p,{level:m,x:T,y:g,z:S},o,a):p}function Gl(e,t){let r;return Array.isArray(e)?(r=e[0],e.length>1&&Ha.once('Not supported extension "3DTILES_multiple_contents" has been detected')):r=e,"constant"in r?Boolean(r.constant):r.explicitBitstream?rw(t,r.explicitBitstream):!1}function $2(e,t,r,n){let{basePath:s,refine:o,getRefine:i,lodMetricType:a,getTileType:c,rootLodMetricValue:l,rootBoundingVolume:f}=r,u=e.contentUrl&&e.contentUrl.replace(`${s}/`,""),h=l/2**t.level,d=n?.box?{box:n.box}:f,p=tw(d,t,r.subdivisionScheme);return{children:e.children,contentUrl:e.contentUrl,content:{uri:u},id:e.contentUrl,refine:i(o),type:c(e),lodMetricType:a,lodMetricValue:h,geometricError:h,transform:e.transform,boundingVolume:p}}function tw(e,t,r){if(e.region){let{level:n,x:s,y:o,z:i}=t,[a,c,l,f,u,h]=e.region,d=2**n,p=(l-a)/d,[A,m]=[a+p*s,a+p*(s+1)],y=(f-c)/d,[_,E]=[c+y*o,c+y*(o+1)],M,B;if(r==="OCTREE"){let C=(h-u)/d;[M,B]=[u+C*i,u+C*(i+1)]}else[M,B]=[u,h];return{region:[A,_,m,E,M,B]}}if(e.box)return e;throw new Error(`Unsupported bounding volume type ${JSON.stringify(e)}`)}function dr(e,t,r){return(e<<r)+t}function hi(e,t,r,n,s){let o=ew({level:t,x:r,y:n,z:s});return e.replace(/{level}|{x}|{y}|{z}/gi,i=>o[i])}function ew(e){let t={};for(let r in e)t[`{${r}}`]=e[r];return t}function rw(e,t){let r=Math.floor(e/8),n=e%8;return(t[r]>>n&1)===1}function Hl(e,t=""){if(!t)return Gt.EMPTY;let n=t.split("?")[0].split(".").pop();switch(n){case"pnts":return Gt.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return Gt.SCENEGRAPH;default:return n||Gt.EMPTY}}function zl(e){switch(e){case"REPLACE":case"replace":return mt.REPLACE;case"ADD":case"add":return mt.ADD;default:return e}}function Vl(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 Ie.resolve(t,e)}function f0(e,t){if(!e)return null;let r;if(e.content){let s=e.content.uri||e.content?.url;typeof s<"u"&&(r=Vl(s,t))}return{...e,id:r,contentUrl:r,lodMetricType:me.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Hl(e,r),refine:zl(e.refine)}}async function p0(e,t,r){let n=null,s=h0(e.root);s&&e.root?n=await u0(e.root,e,t,s,r):n=f0(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 f=h0(l),u;f?u=await u0(l,e,t,f,r):u=f0(l,t),u&&(c.push(u),o.push(u))}i.children=c}return n}async function u0(e,t,r,n,s){let{subdivisionScheme:o,maximumLevel:i,availableLevels:a,subtreeLevels:c,subtrees:{uri:l}}=n,f=hi(l,0,0,0,0),u=Vl(f,r),h=await(0,d0.load)(u,li,s),d=e.content?.uri,p=d?Vl(d,r):"",A=t?.root?.refine,m=e.geometricError,y=e.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];if(y){let B={box:ui(y),s2VolumeInfo:y};e.boundingVolume=B}let _=e.boundingVolume,E={contentUrlTemplate:p,subtreesUriTemplate:l,subdivisionScheme:o,subtreeLevels:c,maximumLevel:Number.isFinite(a)?a-1:i,refine:A,basePath:r,lodMetricType:me.GEOMETRIC_ERROR,rootLodMetricValue:m,rootBoundingVolume:_,getTileType:Hl,getRefine:zl};return await nw(e,r,h,E,s)}async function nw(e,t,r,n,s){if(!e)return null;let{children:o,contentUrl:i}=await Ul({subtree:r,implicitOptions:n,loaderOptions:s}),a,c=null;return i&&(a=i,c={uri:i.replace(`${t}/`,"")}),{...e,id:a,contentUrl:a,lodMetricType:me.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Hl(e,a),refine:zl(e.refine),content:c||e.content,children:o}}function h0(e){return e?.extensions?.["3DTILES_implicit_tiling"]||e?.implicitTiling}var di={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Ho,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:sw,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function sw(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?ow(e,t,r):iw(e,t,r)}async function ow(e,t,r){let n=JSON.parse(new TextDecoder().decode(e)),s=r?.url||"",o=aw(s),i=await p0(n,o,t||{});return{...n,shape:"tileset3d",loader:di,url:s,queryString:r?.queryString||"",basePath:o,root:i||n.root,type:ht.TILES3D,lodMetricType:me.GEOMETRIC_ERROR,lodMetricValue:n.root?.geometricError||0}}async function iw(e,t,r){let n={content:{shape:"tile3d",featureIds:null}};return await Bl(e,0,t,r,n.content),n.content}function aw(e){return Ie.dirname(e)}var m0=[0],cw={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:di,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]}},os=class extends Ge.CompositeLayer{initializeState(){"onTileLoadFail"in this.props&&Ge.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,y0.load)(i,s,o.loadOptions),c=new Qn(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 Gt.POINTCLOUD:return this._makePointCloudLayer(t,r);case Gt.SCENEGRAPH:return this._make3DModelLayer(t);case Gt.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:f}=n;if(!c)return null;let u=r&&r.props.data||{header:{vertexCount:s},attributes:{POSITION:c,NORMAL:l,COLOR_0:f}},{pointSize:h,getPointColor:d}=this.props,p=this.getSubLayerClass("pointcloud",A0.PointCloudLayer);return new p({pointSize:h},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${t.id}`,tile:t,data:u,coordinateSystem:Ge.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",x0.ScenegraphLayer);return new i({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${t.id}`,tile:t,data:n||m0,scenegraph:r,coordinateSystem:Ge.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=Ge.COORDINATE_SYSTEM.METER_OFFSETS,material:l,featureIds:f}=n,{_getMeshColor:u}=this.props,h=r&&r.props.mesh||new g0.Geometry({topology:"triangle-list",attributes:lw(s),indices:o}),d=this.getSubLayerClass("mesh",rm);return new d(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${t.id}`,tile:t,mesh:h,data:m0,getColor:u(t),pbrMaterial:l,modelMatrix:i,coordinateOrigin:a,coordinateSystem:c,featureIds:f,_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}};os.defaultProps=cw;os.layerName="Tile3DLayer";var T0=os;function lw(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 xi=D(qt(),1),Xl=D(Co(),1),S0=D(qt(),1);var fw=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 ql(e){return e>>1^-(e&1)}function uw(e){let t=0,r={};for(let[n,s]of fw){let o=s===8?e.getFloat64:e.getFloat32;r[n]=o.call(e,t,!0),t+=s}return{header:r,headerEndPosition:t}}function hw(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,f=l+a,u=0,h=0,d=0;for(let p=0;p<s;p++)u+=ql(e.getUint16(c+i*p,!0)),h+=ql(e.getUint16(l+i*p,!0)),d+=ql(e.getUint16(f+i*p,!0)),o[p]=u,o[p+s]=h,o[p+s*2]=d;return r+=a*3,{vertexData:o,vertexDataEndPosition:r}}function is(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 dw(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=is(e.buffer,n,c,i);return n+=c*i,{triangleIndicesEndPosition:n,triangleIndices:l}}function pw(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=is(e.buffer,n,a,i,!1);n+=a*i;let l=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let f=is(e.buffer,n,l,i,!1);n+=l*i;let u=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let h=is(e.buffer,n,u,i,!1);n+=u*i;let d=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let p=is(e.buffer,n,d,i,!1);return n+=d*i,{edgeIndicesEndPosition:n,westIndices:c,southIndices:f,eastIndices:h,northIndices:p}}function mw(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function gw(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function Aw(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=mw(i);break}case 2:{r.waterMask=gw(i);break}default:}n+=o}return{extensions:r,extensionsEndPosition:n}}var pr={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},xw={maxDecodingStep:pr.extensions};function kl(e,t){let r=Object.assign({},xw,t),n=new DataView(e),{header:s,headerEndPosition:o}=uw(n);if(r.maxDecodingStep<pr.vertices)return{header:s};let{vertexData:i,vertexDataEndPosition:a}=hw(n,o);if(r.maxDecodingStep<pr.triangleIndices)return{header:s,vertexData:i};let{triangleIndices:c,triangleIndicesEndPosition:l}=dw(n,i,a);if(r.maxDecodingStep<pr.edgeIndices)return{header:s,vertexData:i,triangleIndices:c};let{westIndices:f,southIndices:u,eastIndices:h,northIndices:d,edgeIndicesEndPosition:p}=pw(n,i,l);if(r.maxDecodingStep<pr.extensions)return{header:s,vertexData:i,triangleIndices:c,westIndices:f,northIndices:d,eastIndices:h,southIndices:u};let{extensions:A}=Aw(n,p);return{header:s,vertexData:i,triangleIndices:c,westIndices:f,northIndices:d,eastIndices:h,southIndices:u,extensions:A}}function pi(e,t,r,n){let s=n?Tw(n,e.POSITION.value):yw(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 f=s[l];Ew({edge:f,edgeIndex:l,attributes:e,skirtHeight:r,newPosition:o,newTexcoord0:i,newTriangles:a})}e.POSITION.value=bn(e.POSITION.value,o),e.TEXCOORD_0.value=bn(e.TEXCOORD_0.value,i);let c=t instanceof Array?t.concat(a):bn(t,a);return{attributes:e,triangles:c}}function yw(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 Tw(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 Ew({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 f=t*2*3;i[f]=e[0],i[f+1]=a/3+l,i[f+2]=e[1],i[f+3]=a/3+l,i[f+4]=e[0],i[f+5]=a/3+c}function Jl(e,t={}){let{bounds:r}=t,{header:n,vertexData:s,triangleIndices:o,westIndices:i,northIndices:a,eastIndices:c,southIndices:l}=kl(e,pr.triangleIndices),f=o,u=_w(s,n,r),h=ar(u);if(t?.skirtHeight){let{attributes:d,triangles:p}=pi(u,f,t.skirtHeight,{westIndices:i,northIndices:a,eastIndices:c,southIndices:l});u=d,f=p}return{loaderData:{header:{}},header:{vertexCount:f.length,boundingBox:h},schema:void 0,topology:"triangle-list",mode:4,indices:{value:f,size:1},attributes:u}}function _w(e,t,r){let{minHeight:n,maxHeight:s}=t,[o,i,a,c]=r||[0,0,1,1],l=a-o,f=c-i,u=s-n,h=e.length/3,d=new Float32Array(h*3),p=new Float32Array(h*2);for(let A=0;A<h;A++){let m=e[A]/32767,y=e[A+h]/32767,_=e[A+h*2]/32767;d[3*A+0]=m*l+o,d[3*A+1]=y*f+i,d[3*A+2]=_*u+n,p[2*A+0]=m,p[2*A+1]=y}return{POSITION:{value:d,size:3},TEXCOORD_0:{value:p,size:2}}}var as=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,f=0;for(s&1?a=c=l=r:o=i=f=r;(s>>=1)>1;){let h=o+a>>1,d=i+c>>1;s&1?(a=o,c=i,o=l,i=f):(o=a,i=c,a=l,c=f),l=h,f=d}let u=n*4;this.coords[u+0]=o,this.coords[u+1]=i,this.coords[u+2]=a,this.coords[u+3]=c}}createTile(t){return new jl(t,this)}},jl=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],f=n[c+1],u=n[c+2],h=n[c+3],d=l+u>>1,p=f+h>>1,A=d+p-f,m=p+l-d,y=(o[f*s+l]+o[h*s+u])/2,_=p*s+d,E=Math.abs(y-o[_]);if(i[_]=Math.max(i[_],E),a<r){let M=(f+m>>1)*s+(l+A>>1),B=(h+m>>1)*s+(u+A>>1);i[_]=Math.max(i[_],i[M],i[B])}}}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,m,y,_){let E=d+A>>1,M=p+m>>1;Math.abs(d-y)+Math.abs(p-_)>1&&s[M*r+E]>t?(c(y,_,d,p,E,M),c(A,m,y,_,E,M)):(n[p*r+d]=n[p*r+d]||++o,n[m*r+A]=n[m*r+A]||++o,n[_*r+y]=n[_*r+y]||++o,i++)}c(0,0,a,a,a,0),c(a,a,0,0,0,a);let l=new Uint16Array(o*2),f=new Uint32Array(i*3),u=0;function h(d,p,A,m,y,_){let E=d+A>>1,M=p+m>>1;if(Math.abs(d-y)+Math.abs(p-_)>1&&s[M*r+E]>t)h(y,_,d,p,E,M),h(A,m,y,_,E,M);else{let B=n[p*r+d]-1,C=n[m*r+A]-1,L=n[_*r+y]-1;l[2*B]=d,l[2*B+1]=p,l[2*C]=A,l[2*C+1]=m,l[2*L]=y,l[2*L+1]=_,f[u++]=B,f[u++]=C,f[u++]=L}}return h(0,0,a,a,a,0),h(a,a,0,0,0,a),{vertices:l,triangles:f}}};var cs=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),f=this._addTriangle(l,i,c,-1,-1,-1);this._addTriangle(i,l,a,f,-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),f=Math.max(t,n,o),u=Math.max(r,s,i),h=mr(n,s,o,i,c,l),d=mr(o,i,t,r,c,l),p=mr(t,r,n,s,c,l),A=s-r,m=t-n,y=i-s,_=n-o,E=r-i,M=o-t,B=mr(t,r,n,s,o,i),C=this.heightAt(t,r)/B,L=this.heightAt(n,s)/B,b=this.heightAt(o,i)/B,T=0,g=0,S=0,R=0;for(let F=l;F<=u;F++){let v=0;h<0&&y!==0&&(v=Math.max(v,Math.floor(-h/y))),d<0&&E!==0&&(v=Math.max(v,Math.floor(-d/E))),p<0&&A!==0&&(v=Math.max(v,Math.floor(-p/A)));let G=h+y*v,X=d+E*v,z=p+A*v,et=!1;for(let K=c+v;K<=f;K++){if(G>=0&&X>=0&&z>=0){et=!0;let Y=C*G+L*X+b*z,$=Math.abs(Y-this.heightAt(K,F));R+=$*$,$>T&&(T=$,g=K,S=F)}else if(et)break;G+=y,X+=E,z+=A}h+=_,d+=M,p+=m}(g===t&&S===r||g===n&&S===s||g===o&&S===i)&&(T=0),this._candidates[2*a]=g,this._candidates[2*a+1]=S,this._rms[a]=R,this._queuePush(a,T,R)}_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],f=this.coords[2*i],u=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],m=this._addPoint(p,A);if(mr(c,l,f,u,p,A)===0)this._handleCollinear(m,r);else if(mr(f,u,h,d,p,A)===0)this._handleCollinear(m,n);else if(mr(h,d,c,l,p,A)===0)this._handleCollinear(m,s);else{let y=this._halfedges[r],_=this._halfedges[n],E=this._halfedges[s],M=this._addTriangle(o,i,m,y,-1,-1,r),B=this._addTriangle(i,a,m,_,-1,M+1),C=this._addTriangle(a,o,m,E,M+2,B+1);this._legalize(M),this._legalize(B),this._legalize(C)}}_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],f=this.triangles[t],u=this.triangles[o],h=this.triangles[a],d=this.coords;if(!Mw(d[2*l],d[2*l+1],d[2*f],d[2*f+1],d[2*u],d[2*u+1],d[2*h],d[2*h+1]))return;let p=this._halfedges[o],A=this._halfedges[i],m=this._halfedges[a],y=this._halfedges[c];this._queueRemove(n/3),this._queueRemove(s/3);let _=this._addTriangle(l,h,u,-1,m,p,n),E=this._addTriangle(h,l,f,_,A,y,s);this._legalize(_+1),this._legalize(E+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],f=this._halfedges[o],u=this._halfedges[r];if(u<0){let C=this._addTriangle(t,i,a,-1,f,-1,n),L=this._addTriangle(i,t,c,C,-1,l);this._legalize(C+1),this._legalize(L+2);return}let h=u-u%3,d=h+(u+2)%3,p=h+(u+1)%3,A=this.triangles[d],m=this._halfedges[d],y=this._halfedges[p];this._queueRemove(h/3);let _=this._addTriangle(i,a,t,f,-1,-1,n),E=this._addTriangle(a,A,t,y,-1,_+1,h),M=this._addTriangle(A,c,t,m,-1,E+1),B=this._addTriangle(c,i,t,l,_+2,M+1);this._legalize(_),this._legalize(E),this._legalize(M),this._legalize(B)}_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 mr(e,t,r,n,s,o){return(r-s)*(t-o)-(n-o)*(e-s)}function Mw(e,t,r,n,s,o,i,a){let c=e-i,l=t-a,f=r-i,u=n-a,h=s-i,d=o-a,p=c*c+l*l,A=f*f+u*u,m=h*h+d*d;return c*(u*m-A*d)-l*(f*m-A*h)+p*(f*d-u*h)<0}function M0(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=mi(o,i,a,s,t.tesselator),l=E0(r,i,c);break;case"delatin":c=mi(o,i,a,s,t.tesselator),l=_0(r,i,a,c);break;default:i===a&&!(a&i-1)?(c=mi(o,i,a,s,"martini"),l=E0(r,i,c)):(c=mi(o,i,a,s,"delatin"),l=_0(r,i,a,c));break}let{vertices:f}=l,{triangles:u}=l,h=bw(f,c,i,a,n),d=ar(h);if(t.skirtHeight){let{attributes:p,triangles:A}=pi(h,u,t.skirtHeight);h=p,u=A}return{loaderData:{header:{}},header:{vertexCount:u.length,boundingBox:d},mode:4,indices:{value:Uint32Array.from(u),size:1},attributes:h}}function E0(e,t,r){let n=t+1,o=new as(n).createTile(r),{vertices:i,triangles:a}=o.getMesh(e);return{vertices:i,triangles:a}}function _0(e,t,r,n){let s=new cs(n,t+1,r+1);s.run(e);let{coords:o,triangles:i}=s;return{vertices:o,triangles:i}}function mi(e,t,r,n,s){let{rScaler:o,bScaler:i,gScaler:a,offset:c}=n,l=new Float32Array((t+1)*(r+1));for(let f=0,u=0;u<r;u++)for(let h=0;h<t;h++,f++){let d=f*4,p=e[d+0],A=e[d+1],m=e[d+2];l[f+u]=p*o+A*a+m*i+c}if(s==="martini"){for(let f=(t+1)*t,u=0;u<t;u++,f++)l[f]=l[f-t-1];for(let f=r,u=0;u<r+1;u++,f+=r+1)l[f]=l[f-1]}return l}function bw(e,t,r,n,s){let o=r+1,i=e.length/2,a=new Float32Array(i*3),c=new Float32Array(i*2),[l,f,u,h]=s||[0,0,r,n],d=(u-l)/r,p=(h-f)/n;for(let A=0;A<i;A++){let m=e[A*2],y=e[A*2+1],_=y*o+m;a[3*A+0]=m*d+l,a[3*A+1]=-y*p+h,a[3*A+2]=t[_],c[2*A+0]=m/r,c[2*A+1]=y/n}return{POSITION:{value:a,size:3},TEXCOORD_0:{value:c,size:2}}}var gi="4.3.3";var Ai={dataType:null,batchType:null,name:"Terrain",id:"terrain",module:"terrain",version:gi,worker:!0,extensions:["png","pngraw","jpg","jpeg","gif","webp","bmp"],mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp"],options:{terrain:{tesselator:"auto",bounds:void 0,meshMaxError:10,elevationDecoder:{rScaler:1,gScaler:0,bScaler:0,offset:0},skirtHeight:void 0}}};var b0={dataType:null,batchType:null,name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:gi,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var Bw={...Ai,parse:Cw};async function Cw(e,t,r){let n={...t,mimeType:"application/x.image",image:{...t?.image,type:"data"}},s=await vt(e,[],n,r),o={...Bw.options.terrain,...t?.terrain};return M0(s,o)}var Tz={...b0,parseSync:(e,t)=>Jl(e,t?.["quantized-mesh"]),parse:async(e,t)=>Jl(e,t?.["quantized-mesh"])};var B0=[1],Sw={...nr.defaultProps,elevationData:Re,texture:{...Re,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:[Ai]};function C0(e){return Array.isArray(e)?e.join(";"):e||""}var ls=class extends xi.CompositeLayer{updateState({props:t,oldProps:r}){let n=t.elevationData!==r.elevationData;if(n){let{elevationData:o}=t,i=o&&(Array.isArray(o)||Iw(o));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&&xi.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=oe(r,t),l=s&&oe(s,t),{signal:f}=t,u=[0,0],h=[0,0];if(a.isGeospatial){let m=t.bbox;u=a.projectFlat([m.west,m.south]),h=a.projectFlat([m.east,m.north])}else{let m=t.bbox;u=[m.left,m.bottom],h=[m.right,m.top]}let d=[u[0],u[1],h[0],h[1]],p=this.loadTerrain({elevationData:c,bounds:d,elevationDecoder:o,meshMaxError:i,signal:f}),A=l?n(l,{propName:"texture",layer:this,loaders:[],signal:f}).catch(m=>null):Promise.resolve(null);return Promise.all([p,A])}renderSubLayers(t){let r=this.getSubLayerClass("mesh",Xl.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:B0,mesh:a,texture:c,_instanced:!1,coordinateSystem:S0.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:f,extent:u,maxRequests:h,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:m,maxCacheByteSize:y,refinementStrategy:_}=this.props;if(this.state.isTiled)return new nr(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:C0(n),texture:C0(s),meshMaxError:i,elevationDecoder:a}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:c,maxZoom:l,minZoom:f,extent:u,maxRequests:h,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:m,maxCacheByteSize:y,refinementStrategy:_});if(!n)return null;let E=this.getSubLayerClass("mesh",Xl.SimpleMeshLayer);return new E(this.getSubLayerProps({id:"mesh"}),{data:B0,mesh:this.state.terrain,texture:s,_instanced:!1,getPosition:M=>[0,0,0],getColor:t,material:r,wireframe:o})}};ls.defaultProps=Sw;ls.layerName="TerrainLayer";var I0=ls,Iw=e=>e.includes("{x}")&&(e.includes("{y}")||e.includes("{-y}"));var wi=D(qt(),1),hf=D(zt(),1),a1=D(L0(),1);var fs={x:0,y:1,z:2};function gr(e,t={}){let{start:r=0,end:n=e.length,plane:s="xy"}=t,o=t.size||2,i=0,a=fs[s[0]],c=fs[s[1]];for(let l=r,f=n-o;l<n;l+=o)i+=(e[l+a]-e[f+a])*(e[l+c]+e[f+c]),f=l;return i/2}function Yl(e,t,r=2,n,s="xy"){let o=t&&t.length,i=o?t[0]*r:e.length,a=R0(e,0,i,r,!0,n&&n[0],s),c=[];if(!a||a.next===a.prev)return c;let l,f,u,h,d,p,A;if(o&&(a=Ow(e,t,a,r,n,s)),e.length>80*r){h=f=e[0],d=u=e[1];for(let m=r;m<i;m+=r)p=e[m],A=e[m+1],p<h&&(h=p),A<d&&(d=A),p>f&&(f=p),A>u&&(u=A);l=Math.max(f-h,u-d),l=l!==0?32767/l:0}return us(a,c,r,h,d,l,0),c}function R0(e,t,r,n,s,o,i){let a,c;o===void 0&&(o=gr(e,{start:t,end:r,size:n,plane:i}));let l=fs[i[0]],f=fs[i[1]];if(s===o<0)for(a=t;a<r;a+=n)c=v0(a,e[a+l],e[a+f],c);else for(a=r-n;a>=t;a-=n)c=v0(a,e[a+l],e[a+f],c);return c&&Ei(c,c.next)&&(ds(c),c=c.next),c}function Ar(e,t){if(!e)return e;t||(t=e);let r=e,n;do if(n=!1,!r.steiner&&(Ei(r,r.next)||nt(r.prev,r,r.next)===0)){if(ds(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function us(e,t,r,n,s,o,i){if(!e)return;!i&&o&&Vw(e,n,s,o);let a=e,c,l;for(;e.prev!==e.next;){if(c=e.prev,l=e.next,o?Rw(e,n,s,o):vw(e)){t.push(c.i/r|0),t.push(e.i/r|0),t.push(l.i/r|0),ds(e),e=l.next,a=l.next;continue}if(e=l,e===a){i?i===1?(e=Fw(Ar(e),t,r),us(e,t,r,n,s,o,2)):i===2&&Pw(e,t,r,n,s,o):us(Ar(e),t,r,n,s,o,1);break}}}function vw(e){let t=e.prev,r=e,n=e.next;if(nt(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,f=s<o?s<i?s:i:o<i?o:i,u=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>=f&&p.x<=h&&p.y>=u&&p.y<=d&&en(s,a,o,c,i,l,p.x,p.y)&&nt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Rw(e,t,r,n){let s=e.prev,o=e,i=e.next;if(nt(s,o,i)>=0)return!1;let a=s.x,c=o.x,l=i.x,f=s.y,u=o.y,h=i.y,d=a<c?a<l?a:l:c<l?c:l,p=f<u?f<h?f:h:u<h?u:h,A=a>c?a>l?a:l:c>l?c:l,m=f>u?f>h?f:h:u>h?u:h,y=Wl(d,p,t,r,n),_=Wl(A,m,t,r,n),E=e.prevZ,M=e.nextZ;for(;E&&E.z>=y&&M&&M.z<=_;){if(E.x>=d&&E.x<=A&&E.y>=p&&E.y<=m&&E!==s&&E!==i&&en(a,f,c,u,l,h,E.x,E.y)&&nt(E.prev,E,E.next)>=0||(E=E.prevZ,M.x>=d&&M.x<=A&&M.y>=p&&M.y<=m&&M!==s&&M!==i&&en(a,f,c,u,l,h,M.x,M.y)&&nt(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;E&&E.z>=y;){if(E.x>=d&&E.x<=A&&E.y>=p&&E.y<=m&&E!==s&&E!==i&&en(a,f,c,u,l,h,E.x,E.y)&&nt(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;M&&M.z<=_;){if(M.x>=d&&M.x<=A&&M.y>=p&&M.y<=m&&M!==s&&M!==i&&en(a,f,c,u,l,h,M.x,M.y)&&nt(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function Fw(e,t,r){let n=e;do{let s=n.prev,o=n.next.next;!Ei(s,o)&&F0(s,n,n.next,o)&&hs(s,o)&&hs(o,s)&&(t.push(s.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),ds(n),ds(n.next),n=e=o),n=n.next}while(n!==e);return Ar(n)}function Pw(e,t,r,n,s,o){let i=e;do{let a=i.next.next;for(;a!==i.prev;){if(i.i!==a.i&&qw(i,a)){let c=P0(i,a);i=Ar(i,i.next),c=Ar(c,c.next),us(i,t,r,n,s,o,0),us(c,t,r,n,s,o,0);return}a=a.next}i=i.next}while(i!==e)}function Ow(e,t,r,n,s,o){let i=[],a,c,l,f,u;for(a=0,c=t.length;a<c;a++)l=t[a]*n,f=a<c-1?t[a+1]*n:e.length,u=R0(e,l,f,n,!1,s&&s[a+1],o),u===u.next&&(u.steiner=!0),i.push(zw(u));for(i.sort(Nw),a=0;a<i.length;a++)r=Dw(i[a],r);return r}function Nw(e,t){return e.x-t.x}function Dw(e,t){let r=Gw(e,t);if(!r)return t;let n=P0(r,e);return Ar(n,n.next),Ar(r,r.next)}function Gw(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,f=1/0,u;r=i;do n>=r.x&&r.x>=c&&n!==r.x&&en(s<l?n:o,s,c,l,s<l?o:n,s,r.x,r.y)&&(u=Math.abs(s-r.y)/(n-r.x),hs(r,e)&&(u<f||u===f&&(r.x>i.x||r.x===i.x&&Uw(i,r)))&&(i=r,f=u)),r=r.next;while(r!==a);return i}function Uw(e,t){return nt(e.prev,e,t.prev)<0&&nt(t.next,e,e.next)<0}function Vw(e,t,r,n){let s=e;do s.z===0&&(s.z=Wl(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,Hw(s)}function Hw(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 Wl(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 zw(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 en(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 qw(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!kw(e,t)&&(hs(e,t)&&hs(t,e)&&Jw(e,t)&&(nt(e.prev,e,t.prev)||nt(e,t.prev,t))||Ei(e,t)&&nt(e.prev,e,e.next)>0&&nt(t.prev,t,t.next)>0)}function nt(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Ei(e,t){return e.x===t.x&&e.y===t.y}function F0(e,t,r,n){let s=Ti(nt(e,t,r)),o=Ti(nt(e,t,n)),i=Ti(nt(r,n,e)),a=Ti(nt(r,n,t));return!!(s!==o&&i!==a||s===0&&yi(e,r,t)||o===0&&yi(e,n,t)||i===0&&yi(r,e,n)||a===0&&yi(r,t,n))}function yi(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 Ti(e){return e>0?1:e<0?-1:0}function kw(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&&F0(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function hs(e,t){return nt(e.prev,e,e.next)<0?nt(e,t,e.next)>=0&&nt(e,e.prev,t)>=0:nt(e,t,e.prev)<0||nt(e,e.next,t)<0}function Jw(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 P0(e,t){let r=new ps(e.i,e.x,e.y),n=new ps(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 v0(e,t,r,n){let s=new ps(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 ds(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 ps=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 Zl(e,t,r){let n=Kw(e),s=Object.keys(n).filter(o=>n[o]!==Array);return Qw(e,{propArrayTypes:n,...t},{numericPropKeys:r&&r.numericPropKeys||s,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function Kw(e){let t={};for(let r of e)if(r.properties)for(let n in r.properties){let s=r.properties[n];t[n]=n3(s,t[n])}return t}function Qw(e,t,r){let{pointPositionsCount:n,pointFeaturesCount:s,linePositionsCount:o,linePathsCount:i,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:f,polygonFeaturesCount:u,propArrayTypes:h,coordLength:d}=t,{numericPropKeys:p=[],PositionDataType:A=Float32Array,triangulate:m=!0}=r,y=e[0]&&"id"in e[0],_=e.length>65535?Uint32Array:Uint16Array,E={type:"Point",positions:new A(n*d),globalFeatureIds:new _(n),featureIds:s>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},M={type:"LineString",pathIndices:o>65535?new Uint32Array(i+1):new Uint16Array(i+1),positions:new A(o*d),globalFeatureIds:new _(o),featureIds:a>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},B={type:"Polygon",polygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),primitivePolygonIndices:c>65535?new Uint32Array(f+1):new Uint16Array(f+1),positions:new A(c*d),globalFeatureIds:new _(c),featureIds:u>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};m&&(B.triangles=[]);for(let L of[E,M,B])for(let b of p){let T=h[b];L.numericProps[b]=new T(L.positions.length/d)}M.pathIndices[i]=o,B.polygonIndices[l]=c,B.primitivePolygonIndices[f]=c;let C={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let L of e){let b=L.geometry,T=L.properties||{};switch(b.type){case"Point":Zw(b,E,C,d,T),E.properties.push(Ql(T,p)),y&&E.fields.push({id:L.id}),C.pointFeature++;break;case"LineString":$w(b,M,C,d,T),M.properties.push(Ql(T,p)),y&&M.fields.push({id:L.id}),C.lineFeature++;break;case"Polygon":t3(b,B,C,d,T),B.properties.push(Ql(T,p)),y&&B.fields.push({id:L.id}),C.polygonFeature++;break;default:throw new Error("Invalid geometry type")}C.feature++}return r3(E,M,B,d)}function Zw(e,t,r,n,s){t.positions.set(e.data,r.pointPosition*n);let o=e.data.length/n;$l(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 $w(e,t,r,n,s){t.positions.set(e.data,r.linePosition*n);let o=e.data.length/n;$l(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 t3(e,t,r,n,s){t.positions.set(e.data,r.polygonPosition*n);let o=e.data.length/n;$l(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],f=e.indices[i],u=e.indices[i+1];for(let d=0,p=f.length;d<p;++d){let A=f[d],m=d===p-1?u===void 0?e.data.length:u[0]:f[d+1];t.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(m-A)/n}let h=r.polygonPosition;e3(t,l,f,{startPosition:c,endPosition:h,coordLength:n})}}function e3(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],f=r.slice(1).map(h=>(h-l)/o),u=Yl(c,f,o,t);for(let h=0,d=u.length;h<d;++h)e.triangles.push(n+u[h])}function Kl(e,t){let r={};for(let n in e)r[n]={value:e[n],size:t};return r}function r3(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:Kl(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:Kl(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:Kl(r.numericProps,1)}};return s.polygons&&r.triangles&&(s.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),s}function $l(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 Ql(e,t){let r={};for(let n in e)t.includes(n)||(r[n]=e[n]);return r}function n3(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function bi(e,t){let r=t?.globalFeatureId;return r!==void 0?s3(e,r):o3(e,t?.type)}function s3(e,t){let r=G0(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 _i(n,s,i);s=i,o=a}}if(t===n.globalFeatureIds.value[s])return _i(n,s,n.featureIds.value.length)}throw new Error(`featureId:${t} not found`)}function o3(e,t){let r=G0(e,t);return i3(r)}function D0(e,t,r){switch(e.type){case"Point":return f3(e,t,r);case"LineString":return l3(e,t,r);case"Polygon":return U0(e,t,r);default:let n=e;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function G0(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 i3(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(_i(r,n,o)),n=o,s=i)}t.push(_i(r,n,r.featureIds.value.length))}return t}function _i(e,t,r){let n=D0(e,t,r),s=c3(e,t,r),o=a3(e,t,r);return{type:"Feature",geometry:n,properties:s,...o}}function a3(e,t=0,r){return e.fields&&e.fields[e.featureIds.value[t]]}function c3(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 U0(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 f=o[l],u=o[l+1],h=Mi(n,f,u);c.push(h)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<s.length-1;c++){let l=s[c],f=s[c+1],u=U0(e,l,f).coordinates;a.push(u)}return{type:"MultiPolygon",coordinates:a}}function l3(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:Mi(n,s[0],s[1])};let i=[];for(let a=0;a<s.length-1;a++){let c=Mi(n,s[a],s[a+1]);i.push(c)}return{type:"MultiLineString",coordinates:i}}function f3(e,t,r){let{positions:n}=e,s=Mi(n,t,r);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function Mi(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 of=D(j0(),1);function I3(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 rf(e,t){if(Array.isArray(e[0])){for(let n of e)rf(n,t);return}let r=e;r[0]/=t,r[1]/=t}function X0(e,t){for(let r=0;r<e.length;++r)e[r]/=t}function nf(e,t,r){if(typeof e[0][0]!="number"){for(let i of e)nf(i,t,r);return}let n=r*Math.pow(2,t.z),s=r*t.x,o=r*t.y;for(let i=0;i<e.length;i++){let a=e[i];a[0]=(a[0]+s)*360/n-180;let c=180-(a[1]+o)*360/n;a[1]=360/Math.PI*Math.atan(Math.exp(c*Math.PI/180))-90}}function W0(e,t,r){let{x:n,y:s,z:o}=t,i=r*Math.pow(2,o),a=r*n,c=r*s;for(let l=0,f=e.length;l<f;l+=2){e[l]=(e[l]+a)*360/i-180;let u=180-(e[l+1]+c)*360/i;e[l+1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}function Y0(e){let t=e.length;if(t<=1)return[e];let r=[],n,s;for(let o=0;o<t;o++){let i=I3(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 K0(e){let t=e.indices.length,r="Polygon";if(t<=1)return{type:r,data:e.data,areas:[[gr(e.data)]],indices:[e.indices]};let n=[],s=[],o=[],i=[],a,c=0;for(let l,f=0,u;f<t;f++){u=e.indices[f]-c,l=e.indices[f+1]-c||e.data.length;let h=e.data.slice(u,l),d=gr(h);if(d===0){let p=e.data.slice(0,u),A=e.data.slice(l);e.data=p.concat(A),c+=l-u;continue}a===void 0&&(a=d<0),a===d<0?(i.length&&(n.push(o),s.push(i)),i=[u],o=[d]):(o.push(d),i.push(u))}return o&&n.push(o),i.length&&s.push(i),{type:r,areas:n,indices:s,data:e.data}}var xr=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(w3,this,r)}toGeoJSONFeature(t,r){let n=this.loadGeometry();switch(t){case"wgs84":return Q0(this,n,s=>nf(s,r,this.extent));default:return Q0(this,n,rf)}}toBinaryFeature(t,r){let n=this.loadFlatGeometry();switch(t){case"wgs84":return this._toBinaryCoordinates(n,s=>W0(s,r,this.extent));default:return this._toBinaryCoordinates(n,X0)}}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,f=-1/0;for(;t.pos<r;){if(s<=0){let u=t.readVarint();n=u&7,s=u>>3}if(s--,n===1||n===2)o+=t.readSVarint(),i+=t.readSVarint(),o<a&&(a=o),o>c&&(c=o),i<l&&(l=i),i>f&&(f=i);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,l,c,f]}_toBinaryCoordinates(t,r){let n;r(t.data,this.extent);let s=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=t.indices.length,n={type:"Point",...t};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=t.indices.length,this._geometryInfo.linePositionsCount+=t.data.length/s,n={type:"LineString",...t};break;case 3:n=K0(t),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}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}switch(s--,n){case 1:case 2:o+=t.readSVarint(),i+=t.readSVarint(),n===1&&(c&&a.push(c),c=[]),c&&c.push([o,i]);break;case 7:c&&c.push(c[0].slice());break;default:throw new Error(`unknown command ${n}`)}}return c&&a.push(c),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,s,o=0,i=0,a=0,c=0,l=[],f=[];for(;t.pos<r;)if(o<=0&&(s=t.readVarint(),n=s&7,o=s>>3),o--,n===1||n===2)i+=t.readSVarint(),a+=t.readSVarint(),n===1&&l.push(c),f.push(i,a),c+=2;else if(n===7){if(c>0){let u=l[l.length-1];f.push(f[u],f[u+1]),c+=2}}else throw new Error(`unknown command ${n}`);return{data:f,indices:l}}};on(xr,"types",["Unknown","Point","LineString","Polygon"]);function Q0(e,t,r){let n=xr.types[e.type],s,o,i;switch(e.type){case 1:let c=[];for(s=0;s<t.length;s++)c[s]=t[s][0];i=c,r(i,e.extent);break;case 2:for(i=t,s=0;s<i.length;s++)r(i[s],e.extent);break;case 3:for(i=Y0(t),s=0;s<i.length;s++)for(o=0;o<i[s].length;o++)r(i[s][o],e.extent);break;default:throw new Error("illegal vector tile type")}i.length===1?i=i[0]:n=`Multi${n}`;let a={type:"Feature",geometry:{type:n,coordinates:i},properties:e.properties};return e.id!==null&&(a.properties||={},a.properties.id=e.id),a}function w3(e,t,r){t&&r&&(e===1?t.id=r.readVarint():e===2?L3(r,t):e===3?t.type=r.readVarint():e===4&&(t._geometry=r.pos))}function L3(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 Si=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(v3,this,r),this.length=this._features.length}getGeoJSONFeature(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 xr(this._pbf,r,this.extent,this._keys,this._values)}getBinaryFeature(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 xr(this._pbf,n,this.extent,this._keys,this._values,r)}};function v3(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(R3(r)))}function R3(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 ms=class{layers;constructor(t,r){this.layers=t.readFields(F3,{},r)}};function F3(e,t,r){if(e===3&&r){let n=new Si(r,r.readVarint()+r.pos);n.length&&t&&(t[n.name]=n)}}function af(e,t){let r=O3(t),n=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(n){case"columnar-table":return{shape:"columnar-table",data:sf(e,r)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:Z0(e,r)};case"geojson":return Z0(e,r);case"binary-geometry":return sf(e,r);case"binary":return sf(e,r);default:throw new Error(n||"undefined shape")}}function sf(e,t){let[r,n]=P3(e,t),s=Zl(r,n);return s.byteLength=e.byteLength,s}function P3(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 ms(new of.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.getBinaryFeature(c,n),f=D3(l,t,i);r.push(f)}}),[r,n]}function Z0(e,t){if(e.byteLength<=0)return[];let r=[],n=new ms(new of.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.getGeoJSONFeature(a),l=N3(c,t,o);r.push(l)}}),r}function O3(e){if(!e?.mvt)throw new Error("mvt options required");if(e.mvt?.coordinates==="wgs84"&&!e.mvt.tileIndex)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.gis&&qa.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function N3(e,t,r){let n=e.toGeoJSONFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&(n.properties||={},n.properties[t.layerProperty]=r),n}function D3(e,t,r){let n=e.toBinaryFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&n.properties&&(n.properties[t.layerProperty]=r),n}var G3="4.3.3",Ii={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:G3,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:void 0}}},U3={...Ii,parse:async(e,t)=>af(e,t),parseSync:af,binary:!0};var V3={Point:$0,MultiPoint:H3,LineString:t1,MultiLineString:z3,Polygon:e1,MultiPolygon:q3};function $0([e,t],[r,n],s){let o=Te(r[0],n[0],e),i=Te(r[1],n[1],t);return s.unprojectFlat([o,i])}function cf(e,t,r){return e.map(n=>$0(n,t,r))}function H3(e,t,r){return cf(e,t,r)}function t1(e,t,r){return cf(e,t,r)}function z3(e,t,r){return e.map(n=>t1(n,t,r))}function e1(e,t,r){return e.map(n=>cf(n,t,r))}function q3(e,t,r){return e.map(n=>e1(n,t,r))}function r1(e,t,r){let n=r.projectFlat([t.west,t.north]),s=r.projectFlat([t.east,t.south]),o=[n,s];return{...e,coordinates:V3[e.type](e.coordinates,o,r)}}var k3=["points","lines","polygons"];function lf(e,t,r,n){for(let s of k3){let o=e[s]&&J3(e[s],t,r,n);if(o>=0)return o}return-1}function J3(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=j3(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,f)=>l===r&&s[f]>=o&&s[f]<i);return c>=0?e.globalFeatureIds.value[c]:-1}else t?a=n1(e.properties,c=>c[t]===r,o,i):e.fields&&(a=n1(e.fields,c=>c.id===r,o,i));return a>=0?X3(e,a):-1}function j3(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 X3(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 n1(e,t,r,n){for(let s=r;s<n;s++)if(t(e[s],s))return s;return-1}var ff=512,W3={...hf.GeoJsonLayer.defaultProps,data:Re,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[Ii],binary:!0},gs=class extends nr{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"&&!Tc(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=oe(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=ff/o,a=-i,c=ff*r/o,l=ff*(1-n/o),f=new O().scale([i,a,1]);t.autoHighlight=!1,this.context.viewport.resolution||(t.modelMatrix=f,t.coordinateOrigin=[c,l,0],t.coordinateSystem=wi.COORDINATE_SYSTEM.CARTESIAN,t.extensions=[...t.extensions||[],new a1.ClipExtension]);let u=super.renderSubLayers(t);return this.state.binary&&!(u instanceof hf.GeoJsonLayer)&&wi.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),u}_updateAutoHighlight(t){let{uniqueIdProperty:r}=this.props,{hoveredFeatureId:n,hoveredFeatureLayerName:s}=this.state,o=t.object,i=null,a=null;o&&(i=uf(o,r),a=s1(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=bi(n,{globalFeatureId:r.index})}return r.object&&!this._isWGS84()&&(r.object=i1(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=o1(i);if(!(o1(r)||c))return-1;let f=c?i:r;return Array.isArray(a)?a.findIndex(u=>{let h=uf(u,o)===f,d=c||s1(u)===n;return h&&d}):a&&s?lf(a,o,f,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=uf(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&&Ec(s)){let o=this.state.binary?bi(n.content):n.content;n._contentWGS84=o.map(i=>i1(i,s,this.context.viewport))}return n._contentWGS84}})})}};gs.layerName="MVTLayer";gs.defaultProps=W3;var c1=gs;function uf(e,t){if(e.properties&&t)return e.properties[t];if("id"in e)return e.id}function s1(e){return e.properties?.layerName||null}function o1(e){return e!=null&&e!==""}function i1(e,t,r){let n={...e,geometry:{type:e.geometry.type}};return Object.defineProperty(n.geometry,"coordinates",{get:()=>r1(e.geometry,t,r).coordinates}),n}var l1="0123456789bcdefghjkmnpqrstuvwxyz",f1={};for(let e=0;e<l1.length;e++)f1[l1.charAt(e)]=e;var Y3=-90,K3=90,Q3=-180,Z3=180;function $3(e){let t=!0,r=K3,n=Y3,s=Z3,o=Q3,i,a=0;for(let c=0,l=e.length;c<l;c++){let f=e[c].toLowerCase();a=f1[f];for(let u=4;u>=0;u--){let h=a>>u&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 u1(e){let[t,r,n,s]=$3(e);return[s,n,s,t,r,t,r,n,s,n]}var tL={getGeohash:{type:"accessor",value:e=>e.geohash}},As=class extends Ft{indexToBounds(){let{data:t,getGeohash:r}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(n,s)=>u1(r(n,s))}}};As.layerName="GeohashLayer";As.defaultProps=tL;var h1=As;return y1(xs);})();
|
|
1258
|
+
`;function TB(t){let e=t.positions||t.POSITION,r=e.value.length/e.size;t.COLOR_0||t.colors||(t.colors={size:4,value:new Uint8Array(r*4).fill(255),normalized:!0})}var bB={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},is=class extends rm.SimpleMeshLayer{getShaders(){let e=super.getShaders();return e.modules.push(qc,Zp),{...e,vs:$p,fs:em}}initializeState(){let{featureIds:e}=this.props;super.initializeState();let r=this.getAttributeManager();e&&r.add({featureIdsPickingColors:{type:"uint8",size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})}updateState(e){super.updateState(e);let{props:r,oldProps:n}=e;r.pbrMaterial!==n.pbrMaterial&&this.updatePbrMaterialUniforms(r.pbrMaterial)}draw(e){let{featureIds:r}=this.props,{model:n}=this.state;if(!n)return;let s={pickFeatureIds:Boolean(r)},o={camera:this.context.viewport.cameraPosition};n.shaderInputs.setProps({pbrProjection:o,mesh:s}),super.draw(e)}getModel(e){let{id:r}=this.props,n=this.parseMaterial(this.props.pbrMaterial,e);this.setState({parsedPBRMaterial:n});let s=this.getShaders();return TB(e.attributes),new tm.Model(this.context.device,{...this.getShaders(),id:r,geometry:e,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:{...s.defines,...n?.defines,HAS_UV_REGIONS:e.attributes.uvRegions?1:0},parameters:n?.parameters,isInstanced:!0})}updatePbrMaterialUniforms(e){let{model:r}=this.state;if(r){let{mesh:n}=this.props,s=this.parseMaterial(e,n);this.setState({parsedPBRMaterial:s});let{pbr_baseColorSampler:o}=s.bindings,{emptyTexture:i}=this.state,a={sampler:o||i,hasTexture:Boolean(o)},{camera:c,...l}={...s.bindings,...s.uniforms};r.shaderInputs.setProps({simpleMesh:a,pbrMaterial:l})}}parseMaterial(e,r){let n=Boolean(e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture);return Hc(this.context.device,{unlit:n,...e},{NORMAL:r.attributes.normals,TEXCOORD_0:r.attributes.texCoords},{pbrDebug:!1,lights:!0,useTangents:!1})}calculateFeatureIdsPickingColors(e){let r=this.props.featureIds,n=new Uint8ClampedArray(r.length*e.size),s=[];for(let 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];e.value=n}finalizeState(e){super.finalizeState(e),this.state.parsedPBRMaterial?.generatedTextures.forEach(r=>r.destroy()),this.setState({parsedPBRMaterial:null})}};is.layerName="MeshLayer";is.defaultProps=bB;var nm=is;var u0=D(Kt(),1);var gt=6356752314245179e-9,EB={radii:[6378137,6378137,gt],radiiSquared:[6378137*6378137,6378137*6378137,gt*gt],oneOverRadii:[1/6378137,1/6378137,1/gt],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(gt*gt)],maximumRadius:Math.max(6378137,6378137,gt),centerToleranceSquared:.1};function Jo(t){return t}var RU=new x;function MB(t,e=[],r=Jo){return"longitude"in t?(e[0]=r(t.longitude),e[1]=r(t.latitude),e[2]=t.height):"x"in t?(e[0]=r(t.x),e[1]=r(t.y),e[2]=t.z):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}function sm(t,e=[]){return MB(t,e,Q._cartographicRadians?Jo:fa)}function _B(t,e,r=Jo){return"longitude"in e?(e.longitude=r(t[0]),e.latitude=r(t[1]),e.height=t[2]):"x"in e?(e.x=r(t[0]),e.y=r(t[1]),e.z=t[2]):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}function om(t,e){return _B(t,e,Q._cartographicRadians?Jo:ua)}var im=1e-14,BB=new x,am={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"}},jc={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},as={east:new x,north:new x,up:new x,west:new x,south:new x,down:new x},CB=new x,SB=new x,IB=new x;function Jc(t,e,r,n,s,o){let i=am[e]&&am[e][r];fe(i&&(!n||n===i));let a,c,l,f=BB.copy(s);if(be(f.x,0,im)&&be(f.y,0,im)){let h=Math.sign(f.z);a=CB.fromArray(jc[e]),e!=="east"&&e!=="west"&&a.scale(h),c=SB.fromArray(jc[r]),r!=="east"&&r!=="west"&&c.scale(h),l=IB.fromArray(jc[n]),n!=="east"&&n!=="west"&&l.scale(h)}else{let{up:h,east:d,north:p}=as;d.set(-f.y,f.x,0).normalize(),t.geodeticSurfaceNormal(f,h),p.copy(h).cross(d);let{down:A,west:m,south:y}=as;A.copy(h).scale(-1),m.copy(d).scale(-1),y.copy(p).scale(-1),a=as[e],c=as[r],l=as[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]=f.x,o[13]=f.y,o[14]=f.z,o[15]=1,o}var qr=new x,wB=new x,vB=new x;function cm(t,e,r=[]){let{oneOverRadii:n,oneOverRadiiSquared:s,centerToleranceSquared:o}=e;qr.from(t);let i=qr.x,a=qr.y,c=qr.z,l=n.x,f=n.y,u=n.z,h=i*i*l*l,d=a*a*f*f,p=c*c*u*u,A=h+d+p,m=Math.sqrt(1/A);if(!Number.isFinite(m))return;let y=wB;if(y.copy(t).scale(m),A<o)return y.to(r);let b=s.x,E=s.y,M=s.z,B=vB;B.set(y.x*b*2,y.y*E*2,y.z*M*2);let C=(1-m)*qr.len()/(.5*B.len()),v=0,_,T,g,S;do{C-=v,_=1/(1+C*b),T=1/(1+C*E),g=1/(1+C*M);let F=_*_,R=T*T,L=g*g,G=F*_,W=R*T,z=L*g;S=h*F+d*R+p*L-1;let K=-2*(h*G*b+d*W*E+p*z*M);v=S/K}while(Math.abs(S)>Ne.EPSILON12);return qr.scale([_,T,g]).to(r)}var Wo=new x,lm=new x,RB=new x,Qe=new x,PB=new x,Xo=new x,U=class{constructor(e=0,r=0,n=0){this.centerToleranceSquared=Ne.EPSILON1,fe(e>=0),fe(r>=0),fe(n>=0),this.radii=new x(e,r,n),this.radiiSquared=new x(e*e,r*r,n*n),this.radiiToTheFourth=new x(e*e*e*e,r*r*r*r,n*n*n*n),this.oneOverRadii=new x(e===0?0:1/e,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new x(e===0?0:1/(e*e),r===0?0:1/(r*r),n===0?0:1/(n*n)),this.minimumRadius=Math.min(e,r,n),this.maximumRadius=Math.max(e,r,n),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(e){return this===e||Boolean(e&&this.radii.equals(e.radii))}toString(){return this.radii.toString()}cartographicToCartesian(e,r=[0,0,0]){let n=lm,s=RB,[,,o]=e;this.geodeticSurfaceNormalCartographic(e,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(e,r=[0,0,0]){Xo.from(e);let n=this.scaleToGeodeticSurface(Xo,Qe);if(!n)return;let s=this.geodeticSurfaceNormal(n,lm),o=PB;o.copy(Xo).subtract(n);let i=Math.atan2(s.y,s.x),a=Math.asin(s.z),c=Math.sign(Yt.dot(o,Xo))*Yt.length(o);return om([i,a,c],r)}eastNorthUpToFixedFrame(e,r=new O){return Jc(this,"east","north","up",e,r)}localFrameToFixedFrame(e,r,n,s,o=new O){return Jc(this,e,r,n,s,o)}geocentricSurfaceNormal(e,r=[0,0,0]){return Wo.from(e).normalize().to(r)}geodeticSurfaceNormalCartographic(e,r=[0,0,0]){let n=sm(e),s=n[0],o=n[1],i=Math.cos(o);return Wo.set(i*Math.cos(s),i*Math.sin(s),Math.sin(o)).normalize(),Wo.to(r)}geodeticSurfaceNormal(e,r=[0,0,0]){return Wo.from(e).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(e,r){return cm(e,this,r)}scaleToGeocentricSurface(e,r=[0,0,0]){Qe.from(e);let n=Qe.x,s=Qe.y,o=Qe.z,i=this.oneOverRadiiSquared,a=1/Math.sqrt(n*n*i.x+s*s*i.y+o*o*i.z);return Qe.multiplyScalar(a).to(r)}transformPositionToScaledSpace(e,r=[0,0,0]){return Qe.from(e).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(e,r=[0,0,0]){return Qe.from(e).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(e,r=0,n=[0,0,0]){fe(be(this.radii.x,this.radii.y,Ne.EPSILON15)),fe(this.radii.z>0),Qe.from(e);let s=Qe.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(s)>=this.radii.z-r))return Qe.set(0,0,s).to(n)}};U.WGS84=new U(6378137,6378137,gt);var Yo=class{item;previous;next;constructor(e,r,n){this.item=e,this.previous=r,this.next=n}};var Ko=class{head=null;tail=null;_length=0;get length(){return this._length}add(e){let r=new Yo(e,this.tail,null);return this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),++this._length,r}remove(e){e&&(e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,--this._length)}splice(e,r){e!==r&&(this.remove(r),this._insert(e,r))}_insert(e,r){let n=e.next;e.next=r,this.tail===e?this.tail=r:n.previous=r,r.next=n,r.previous=e,++this._length}};var Qo=class{_list;_sentinel;_trimTiles;constructor(){this._list=new Ko,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(e){let r=e._cacheNode;r&&this._list.splice(this._sentinel,r)}add(e,r,n){r._cacheNode||(r._cacheNode=this._list.add(r),n&&n(e,r))}unloadTile(e,r,n){let s=r._cacheNode;s&&(this._list.remove(s),r._cacheNode=null,n&&n(e,r))}unloadTiles(e,r){let n=this._trimTiles;this._trimTiles=!1;let s=this._list,o=e.maximumMemoryUsage*1024*1024,i=this._sentinel,a=s.head;for(;a!==i&&(e.gpuMemoryUsageInBytes>o||n);){let c=a.item;a=a.next,this.unloadTile(e,c,r)}}trim(){this._trimTiles=!0}};function fm(t,e){H(t),H(e);let{rtcCenter:r,gltfUpAxis:n}=e,{computedTransform:s,boundingVolume:{center:o}}=t,i=new O(s);switch(r&&i.translate(r),n){case"Z":break;case"Y":let h=new O().rotateX(Math.PI/2);i=i.multiplyRight(h);break;case"X":let d=new O().rotateY(-Math.PI/2);i=i.multiplyRight(d);break;default:break}e.isQuantized&&i.translate(e.quantizedVolumeOffset).scale(e.quantizedVolumeScale);let a=new x(o);e.cartesianModelMatrix=i,e.cartesianOrigin=a;let c=U.WGS84.cartesianToCartographic(a,new x),f=U.WGS84.eastNorthUpToFixedFrame(a).invert();e.cartographicModelMatrix=f.multiplyRight(i),e.cartographicOrigin=c;let u=NB(e);u&&(e.cartesianModelMatrix=new O(i).multiplyRight(u.matrix),e.cartographicModelMatrix.multiplyRight(u.matrix),u.matrix=O.IDENTITY),e.coordinateSystem||(e.modelMatrix=e.cartographicModelMatrix)}var OB=1e6**2;function NB(t){let e=t.gltf;if(!e)return null;let r=typeof e.scene=="number"?e.scene:0,s=e.scenes?.[r]?.nodes?.[0];if(!s?.matrix)return null;let o=s.matrix;return o[12]*o[12]+o[13]*o[13]+o[14]*o[14]<=OB?null:s}var um=new x,Wc=new x,Xc=new ae([new ue,new ue,new ue,new ue,new ue,new ue]);function dm(t,e){let{cameraDirection:r,cameraUp:n,height:s}=t,{metersPerUnit:o}=t.distanceScales,i=Zo(t,t.center),a=U.WGS84.eastNorthUpToFixedFrame(i),c=t.unprojectPosition(t.cameraPosition),l=U.WGS84.cartographicToCartesian(c,new x),f=new x(a.transformAsVector(new x(r).scale(o))).normalize(),u=new x(a.transformAsVector(new x(n).scale(o))).normalize();DB(t);let h=t.constructor,{longitude:d,latitude:p,width:A,bearing:m,zoom:y}=t,b=new h({longitude:d,latitude:p,height:s,width:A,bearing:m,zoom:y,pitch:0});return{camera:{position:l,direction:f,up:u},viewport:t,topDownViewport:b,height:s,cullingVolume:Xc,frameNumber:e,sseDenominator:1.15}}function pm(t,e,r){if(r===0||t.length<=r)return[t,[]];let n=[],{longitude:s,latitude:o}=e.viewport;for(let[l,f]of t.entries()){let[u,h]=f.header.mbs,d=Math.abs(s-u),p=Math.abs(o-h),A=Math.sqrt(p*p+d*d);n.push([l,A])}let i=n.sort((l,f)=>l[1]-f[1]),a=[];for(let l=0;l<r;l++)a.push(t[i[l][0]]);let c=[];for(let l=r;l<i.length;l++)c.push(t[i[l][0]]);return[a,c]}function DB(t){let e=t.getFrustumPlanes(),r=hm(e.near,t.cameraPosition),n=Zo(t,r),s=Zo(t,t.cameraPosition,Wc),o=0;Xc.planes[o++].fromPointNormal(n,um.copy(n).subtract(s));for(let i in e){if(i==="near")continue;let a=e[i],c=hm(a,r,Wc),l=Zo(t,c,Wc);Xc.planes[o++].fromPointNormal(l,um.copy(n).subtract(l))}}function hm(t,e,r=new x){let n=t.normal.dot(e);return r.copy(t.normal).scale(t.distance-n).add(e),r}function Zo(t,e,r=new x){let n=t.unprojectPosition(e);return U.WGS84.cartographicToCartesian(n,r)}var GB=6378137,UB=6378137,Yc=6356752314245179e-9,jr=new x;function mm(t,e){if(t instanceof Ke){let{halfAxes:r}=t,n=VB(r);return Math.log2(Yc/(n+e[2]))}else if(t instanceof Ge){let{radius:r}=t;return Math.log2(Yc/(r+e[2]))}else if(t.width&&t.height){let{width:r,height:n}=t,s=Math.log2(GB/r),o=Math.log2(UB/n);return(s+o)/2}return 1}function Kc(t,e,r){U.WGS84.cartographicToCartesian([t.xmax,t.ymax,t.zmax],jr);let n=Math.sqrt(Math.pow(jr[0]-r[0],2)+Math.pow(jr[1]-r[1],2)+Math.pow(jr[2]-r[2],2));return Math.log2(Yc/(n+e[2]))}function gm(t,e,r){let[n,s,o,i]=t;return Kc({xmin:n,xmax:o,ymin:s,ymax:i,zmin:0,zmax:0},e,r)}function VB(t){t.getColumn(0,jr);let e=t.getColumn(1),r=t.getColumn(2);return jr.add(e).add(r).len()}var Rm=D(Kt(),1);var Me={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},ge;(function(t){t[t.ADD=1]="ADD",t[t.REPLACE=2]="REPLACE"})(ge||(ge={}));var Ve;(function(t){t.EMPTY="empty",t.SCENEGRAPH="scenegraph",t.POINTCLOUD="pointcloud",t.MESH="mesh"})(Ve||(Ve={}));var he;(function(t){t.I3S="I3S",t.TILES3D="TILES3D"})(he||(he={}));var At;(function(t){t.GEOMETRIC_ERROR="geometricError",t.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(At||(At={}));var Am={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function bm(t){return t!=null}var Ae=new x,$o=new x,HB=new x,zB=new x,fr=new x,xm=new x,ym=new x,Tm=new x;function ei(t,e,r){if(H(t,"3D Tile: boundingVolume must be defined"),t.box)return Mm(t.box,e,r);if(t.region)return qB(t.region);if(t.sphere)return kB(t.sphere,e,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function Em(t,e){if(t.box)return jB(e);if(t.region){let[r,n,s,o,i,a]=t.region;return[[ve(r),ve(n),i],[ve(s),ve(o),a]]}if(t.sphere)return JB(e);throw new Error("Unkown boundingVolume type")}function Mm(t,e,r){let n=new x(t[0],t[1],t[2]);e.transform(n,n);let s=[];if(t.length===10){let l=t.slice(3,6),f=new rt;f.fromArray(t,6);let u=new x([1,0,0]),h=new x([0,1,0]),d=new x([0,0,1]);u.transformByQuaternion(f),u.scale(l[0]),h.transformByQuaternion(f),h.scale(l[1]),d.transformByQuaternion(f),d.scale(l[2]),s=[...u.toArray(),...h.toArray(),...d.toArray()]}else s=[...t.slice(3,6),...t.slice(6,9),...t.slice(9,12)];let o=e.transformAsVector(s.slice(0,3)),i=e.transformAsVector(s.slice(3,6)),a=e.transformAsVector(s.slice(6,9)),c=new j([o[0],o[1],o[2],i[0],i[1],i[2],a[0],a[1],a[2]]);return bm(r)?(r.center=n,r.halfAxes=c,r):new Ke(n,c)}function kB(t,e,r){let n=new x(t[0],t[1],t[2]);e.transform(n,n);let s=e.getScale($o),o=Math.max(Math.max(s[0],s[1]),s[2]),i=t[3]*o;return bm(r)?(r.center=n,r.radius=i,r):new Ge(n,i)}function qB(t){let[e,r,n,s,o,i]=t,a=U.WGS84.cartographicToCartesian([ve(e),ve(s),o],HB),c=U.WGS84.cartographicToCartesian([ve(n),ve(r),i],zB),l=new x().addVectors(a,c).multiplyByScalar(.5);return U.WGS84.cartesianToCartographic(l,fr),U.WGS84.cartographicToCartesian([ve(n),fr[1],fr[2]],xm),U.WGS84.cartographicToCartesian([fr[0],ve(s),fr[2]],ym),U.WGS84.cartographicToCartesian([fr[0],fr[1],i],Tm),Mm([...l,...xm.subtract(l),...ym.subtract(l),...Tm.subtract(l)],new O)}function jB(t){let e=_m(),{halfAxes:r}=t,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++)Ae.copy(t.center),Ae.add(n),Ae.add(s),Ae.add(o),Bm(e,Ae),o.negate();s.negate()}n.negate()}return e}function JB(t){let e=_m(),{center:r,radius:n}=t,s=U.WGS84.scaleToGeodeticSurface(r,Ae),o;s?o=U.WGS84.geodeticSurfaceNormal(s):o=new x(0,0,1);let i=new x(o[2],-o[1],0);i.len()>0?i.normalize():i=new x(0,1,0);let a=i.clone().cross(o);for(let c of[i,a,o]){$o.copy(c).scale(n);for(let l=0;l<2;l++)Ae.copy(r),Ae.add($o),Bm(e,Ae),$o.negate()}return e}function _m(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function Bm(t,e){U.WGS84.cartesianToCartographic(e,Ae),t[0][0]=Math.min(t[0][0],Ae[0]),t[0][1]=Math.min(t[0][1],Ae[1]),t[0][2]=Math.min(t[0][2],Ae[2]),t[1][0]=Math.max(t[1][0],Ae[0]),t[1][1]=Math.max(t[1][1],Ae[1]),t[1][2]=Math.max(t[1][2],Ae[2])}var y4=new x,T4=new x,b4=new O,E4=new x,M4=new x,_4=new x;function WB(t,e){let r=t*e;return 1-Math.exp(-(r*r))}function XB(t,e){if(t.dynamicScreenSpaceError&&t.dynamicScreenSpaceErrorComputedDensity){let r=t.dynamicScreenSpaceErrorComputedDensity,n=t.dynamicScreenSpaceErrorFactor;return WB(e,r)*n}return 0}function Cm(t,e,r){let n=t.tileset,s=t.parent&&t.parent.lodMetricValue||t.lodMetricValue,o=r?s:t.lodMetricValue;if(o===0)return 0;let i=Math.max(t._distanceToCamera,1e-7),{height:a,sseDenominator:c}=e,{viewDistanceScale:l}=n.options,f=o*a*(l||1)/(i*c);return f-=XB(n,i),f}var Qc=new x,Sm=new x,Dt=new x,Im=new x,YB=new x,Zc=new O,wm=new O;function vm(t,e){if(t.lodMetricValue===0||isNaN(t.lodMetricValue))return"DIG";let r=2*$c(t,e);return r<2?"OUT":!t.header.children||r<=t.lodMetricValue?"DRAW":t.header.children?"DIG":"OUT"}function $c(t,e){let{topDownViewport:r}=e,n=t.header.mbs[1],s=t.header.mbs[0],o=t.header.mbs[2],i=t.header.mbs[3],a=[...t.boundingVolume.center],c=r.unprojectPosition(r.cameraPosition);U.WGS84.cartographicToCartesian(c,Qc),Sm.copy(Qc).subtract(a).normalize(),U.WGS84.eastNorthUpToFixedFrame(a,Zc),wm.copy(Zc).invert(),Dt.copy(Qc).transform(wm);let l=Math.sqrt(Dt[0]*Dt[0]+Dt[1]*Dt[1]),f=l*l/Dt[2];Im.copy([Dt[0],Dt[1],f]);let h=Im.transform(Zc).subtract(a).normalize(),p=Sm.cross(h).normalize().scale(i).add(a),A=U.WGS84.cartesianToCartographic(p),m=r.project([s,n,o]),y=r.project(A);return YB.copy(m).subtract(y).magnitude()}function Lm(t){return{assetGltfUpAxis:t.asset&&t.asset.gltfUpAxis||"Y"}}var cs=class{_map=new Map;_array;_length;constructor(e=0){this._array=new Array(e),this._length=e}get length(){return this._length}set length(e){this._length=e,e>this._array.length&&(this._array.length=e)}get values(){return this._array}get(e){return H(e<this._array.length),this._array[e]}set(e,r){H(e>=0),e>=this.length&&(this.length=e+1),this._map.has(this._array[e])&&this._map.delete(this._array[e]),this._array[e]=r,this._map.set(r,e)}delete(e){let r=this._map.get(e);r>=0&&(this._array.splice(r,1),this._map.delete(e),this.length--)}peek(){return this._array[this._length-1]}push(e){if(!this._map.has(e)){let r=this.length++;this._array[r]=e,this._map.set(e,r)}}pop(){let e=this._array[--this.length];return this._map.delete(e),e}reserve(e){H(e>=0),e>this._array.length&&(this._array.length=e)}resize(e){H(e>=0),this.length=e}trim(e){e==null&&(e=this.length),this._array.length=e}reset(){this._array=[],this._map=new Map,this._length=0}find(e){return this._map.has(e)}};var KB={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},ct=class{options;root=null;selectedTiles={};requestedTiles={};emptyTiles={};lastUpdate=new Date().getTime();updateDebounceTime=1e3;_traversalStack=new cs;_emptyTraversalStack=new cs;_frameNumber=null;traversalFinished(e){return!0}constructor(e){this.options={...KB,...e}}traverse(e,r,n){this.root=e,this.options={...this.options,...n},this.reset(),this.updateTile(e,r),this._frameNumber=r.frameNumber,this.executeTraversal(e,r)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(e,r){let n=this._traversalStack;for(e._selectionDepth=1,n.push(e);n.length>0;){let 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===ge.ADD?(this.loadTile(o,r),this.selectTile(o,r)):o.refine===ge.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(e,r){let n=e.children;for(let s of n)this.updateTile(s,r)}updateAndPushChildren(e,r,n,s){let{loadSiblings:o,skipLevelOfDetail:i}=this.options,a=e.children;a.sort(this.compareDistanceToCamera.bind(this));let c=e.refine===ge.REPLACE&&e.hasRenderContent&&!i,l=!1,f=!0;for(let u of a)if(u._selectionDepth=s,u.isVisibleAndInRequestVolume?(n.find(u)&&n.delete(u),n.push(u),l=!0):(c||o)&&(this.loadTile(u,r),this.touchTile(u,r)),c){let h;if(u._inRequestVolume?u.hasRenderContent?h=u.contentAvailable:h=this.executeEmptyTraversal(u,r):h=!1,f=f&&h,!f)return!1}return l||(f=!1),f}updateTile(e,r){this.updateTileVisibility(e,r)}selectTile(e,r){this.shouldSelectTile(e)&&(e._selectedFrame=r.frameNumber,this.selectedTiles[e.id]=e)}loadTile(e,r){this.shouldLoadTile(e)&&(e._requestedFrame=r.frameNumber,e._priority=e._getPriority(),this.requestedTiles[e.id]=e)}touchTile(e,r){e.tileset._cache.touch(e),e._touchedFrame=r.frameNumber}canTraverse(e,r){return e.hasChildren?e.hasTilesetContent?!e.contentExpired:this.shouldRefine(e,r):!1}shouldLoadTile(e){return e.hasUnloadedContent||e.contentExpired}shouldSelectTile(e){return e.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(e,r,n=!1){let s=e._screenSpaceError;return n&&(s=e.getScreenSpaceError(r,!0)),s>e.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(e,r){let n=[];if(this.options.viewportTraversersMap)for(let s in this.options.viewportTraversersMap)this.options.viewportTraversersMap[s]===r.viewport.id&&n.push(s);else n.push(r.viewport.id);e.updateVisibility(r,n)}compareDistanceToCamera(e,r){return e._distanceToCamera-r._distanceToCamera}anyChildrenVisible(e,r){let n=!1;for(let s of e.children)s.updateVisibility(r),n=n||s.isVisibleAndInRequestVolume;return n}executeEmptyTraversal(e,r){let n=!0,s=this._emptyTraversalStack;for(s.push(e);s.length>0;){let o=s.pop(),i=!o.hasRenderContent&&this.canTraverse(o,r),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 e.hasEmptyContent||n}};var Fm=new x;function QB(t){return t!=null}var ur=class{tileset;header;id;url;parent;refine;type;contentUrl;lodMetricType="geometricError";lodMetricValue=0;boundingVolume=null;content=null;contentState=Me.UNLOADED;gpuMemoryUsageInBytes=0;children=[];depth=0;viewportIds=[];transform=new O;extensions=null;implicitTiling=null;userData={};computedTransform;hasEmptyContent=!1;hasTilesetContent=!1;traverser=new ct({});_cacheNode=null;_frameNumber=null;_expireDate=null;_expiredContent=null;_boundingBox=void 0;_distanceToCamera=0;_screenSpaceError=0;_visibilityPlaneMask;_visible=void 0;_contentBoundingVolume;_viewerRequestVolume;_initialTransform=new O;_priority=0;_selectedFrame=0;_requestedFrame=0;_selectionDepth=0;_touchedFrame=0;_centerZDepth=0;_shouldRefine=!1;_stackLength=0;_visitedFrame=0;_inRequestVolume=!1;_lodJudge=null;tileDrawn=!0;constructor(e,r,n,s=""){this.header=r,this.tileset=e,this.id=s||r.id,this.url=r.url,this.parent=n,this.refine=this._getRefine(r.refine),this.type=r.type,this.contentUrl=r.contentUrl,this._initializeLodMetric(r),this._initializeTransforms(r),this._initializeBoundingVolumes(r),this._initializeContent(r),this._initializeRenderingState(r),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===Me.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===Me.UNLOADED}get contentExpired(){return this.contentState===Me.EXPIRED}get contentFailed(){return this.contentState===Me.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=Em(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(e,r){switch(this.tileset.type){case he.I3S:return $c(this,e);case he.TILES3D:return Cm(this,e,r);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){let e=this.tileset._traverser,{skipLevelOfDetail:r}=e.options,n=this.refine===ge.ADD||r;if(n&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===Me.UNLOADED)return-1;let s=this.parent,i=s&&(!n||this._screenSpaceError===0||s.hasTilesetContent)?s._screenSpaceError:this._screenSpaceError,a=e.root?e.root._screenSpaceError:0;return Math.max(a-i,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=Me.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=Me.UNLOADED,!1;try{let n=this.tileset.getTileUrl(this.contentUrl),s=this.tileset.loader,o=this.tileset.loadOptions[s.id]||{},i={...this.tileset.loadOptions,[s.id]:{...o,isTileset:this.type==="json",...this._getLoaderSpecificOptions(s.id)}};return this.content=await(0,Rm.load)(n,s,i),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=Me.READY,this._onContentLoaded(),!0}catch(n){throw this.contentState=Me.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=Me.UNLOADED,this.tileDrawn=!0,!0}updateVisibility(e,r){if(this._frameNumber===e.frameNumber)return;let n=this.parent,s=n?n._visibilityPlaneMask:ae.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let o=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(o)}this._distanceToCamera=this.distanceToTile(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._visibilityPlaneMask=this.visibility(e,s),this._visible=this._visibilityPlaneMask!==ae.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._frameNumber=e.frameNumber,this.viewportIds=r}visibility(e,r){let{cullingVolume:n}=e,{boundingVolume:s}=this;return n.computeVisibilityWithPlaneMask(s,r)}contentVisibility(){return!0}distanceToTile(e){let r=this.boundingVolume;return Math.sqrt(Math.max(r.distanceSquaredTo(e.camera.position),0))}cameraSpaceZDepth({camera:e}){let r=this.boundingVolume;return Fm.subVectors(r.center,e.position),e.direction.dot(Fm)}insideViewerRequestVolume(e){let r=this._viewerRequestVolume;return!r||r.distanceSquaredTo(e.camera.position)<=0}updateExpiration(){if(QB(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let e=Date.now();Date.lessThan(this._expireDate,e)&&(this.contentState=Me.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(e){"lodMetricType"in e?this.lodMetricType=e.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in e?this.lodMetricValue=e.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(e){this.transform=e.transform?new O(e.transform):new O;let r=this.parent,n=this.tileset,s=r&&r.computedTransform?r.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new O(s).multiplyRight(this.transform);let o=r&&r._initialTransform?r._initialTransform.clone():new O;this._initialTransform=new O(o).multiplyRight(this.transform)}_initializeBoundingVolumes(e){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(e)}_initializeContent(e){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=Me.UNLOADED,this.hasTilesetContent=!1,e.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(e){this.depth=e.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=ae.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(e){return e||this.parent&&this.parent.refine||ge.REPLACE}_isTileset(){return this.contentUrl.indexOf(".json")!==-1}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(e){this.boundingVolume=ei(e.boundingVolume,this.computedTransform,this.boundingVolume);let r=e.content;r&&(r.boundingVolume&&(this._contentBoundingVolume=ei(r.boundingVolume,this.computedTransform,this._contentBoundingVolume)),e.viewerRequestVolume&&(this._viewerRequestVolume=ei(e.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(e=new O){let r=e.clone().multiplyRight(this.transform);r.equals(this.computedTransform)||(this.computedTransform=r,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(e){switch(e){case"i3s":return{...this.tileset.options.i3s,_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1};case"3d-tiles":case"cesium-ion":default:return Lm(this.tileset.tileset)}}};var ti=class extends ct{compareDistanceToCamera(e,r){return r._distanceToCamera===0&&e._distanceToCamera===0?r._centerZDepth-e._centerZDepth:r._distanceToCamera-e._distanceToCamera}updateTileVisibility(e,r){if(super.updateTileVisibility(e,r),!e.isVisibleAndInRequestVolume)return;let n=e.children.length>0;if(e.hasTilesetContent&&n){let i=e.children[0];this.updateTileVisibility(i,r),e._visible=i._visible;return}if(this.meetsScreenSpaceErrorEarly(e,r)){e._visible=!1;return}let s=e.refine===ge.REPLACE,o=e._optimChildrenWithinParent===Am.USE_OPTIMIZATION;if(s&&o&&n&&!this.anyChildrenVisible(e,r)){e._visible=!1;return}}meetsScreenSpaceErrorEarly(e,r){let{parent:n}=e;return!n||n.hasTilesetContent||n.refine!==ge.ADD?!1:!this.shouldRefine(e,r,!0)}};var Pm=D(Kt(),1);var ri=class{frameNumberMap=new Map;register(e,r){let n=this.frameNumberMap.get(e)||new Map,s=n.get(r)||0;n.set(r,s+1),this.frameNumberMap.set(e,n)}deregister(e,r){let n=this.frameNumberMap.get(e);if(!n)return;let s=n.get(r)||1;n.set(r,s-1)}isZero(e,r){return(this.frameNumberMap.get(e)?.get(r)||0)===0}};var el={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},ni=class{_statusMap;pendingTilesRegister=new ri;constructor(){this._statusMap={}}add(e,r,n,s){if(!this._statusMap[r]){let{frameNumber:o,viewport:{id:i}}=s;this._statusMap[r]={request:e,callback:n,key:r,frameState:s,status:el.REQUESTED},this.pendingTilesRegister.register(i,o),e().then(a=>{this._statusMap[r].status=el.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=el.ERROR;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),n(a)})}}update(e,r){if(this._statusMap[e]){let{frameNumber:n,viewport:{id:s}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(s,n);let{frameNumber:o,viewport:{id:i}}=r;this.pendingTilesRegister.register(i,o),this._statusMap[e].frameState=r}}find(e){return this._statusMap[e]}hasPendingTiles(e,r){return!this.pendingTilesRegister.isZero(e,r)}};var si=class extends ct{_tileManager;constructor(e){super(e),this._tileManager=new ni}traversalFinished(e){return!this._tileManager.hasPendingTiles(e.viewport.id,this._frameNumber||0)}shouldRefine(e,r){return e._lodJudge=vm(e,r),e._lodJudge==="DIG"}updateChildTiles(e,r){let n=e.header.children||[],s=e.children,o=e.tileset;for(let i of n){let a=`${i.id}-${r.viewport.id}`,c=s&&s.find(l=>l.id===a);if(c)c&&this.updateTile(c,r);else{let l=()=>this._loadTile(i.id,o);this._tileManager.find(a)?this._tileManager.update(a,r):(o.tileset.nodePages&&(l=()=>o.tileset.nodePagesTile.formTileFromNodePages(i.id)),this._tileManager.add(l,a,u=>this._onTileLoad(u,e,a),r))}}return!1}async _loadTile(e,r){let{loader:n}=r,s=r.getTileUrl(`${r.url}/nodes/${e}`),o={...r.loadOptions,i3s:{...r.loadOptions.i3s,isTileHeader:!0}};return await(0,Pm.load)(s,n,o)}_onTileLoad(e,r,n){let s=new ur(r.tileset,e,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 ZB={description:"",ellipsoid:U.WGS84,modelMatrix:new O,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,memoryCacheOverflow:1,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:t=>t,onUpdate:()=>{},contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,memoryAdjustedScreenSpaceError:!1,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},oi="Tiles In Tileset(s)",tl="Tiles In Memory",Om="Tiles In View",Nm="Tiles To Render",Dm="Tiles Loaded",rl="Tiles Loading",Gm="Tiles Unloaded",Um="Failed Tile Loads",Vm="Points/Vertices",nl="Tile Memory Use",Hm="Maximum Screen Space Error",ls=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 Qo;_requestScheduler;_heldTiles=new Set;updatePromise=null;tilesetInitializationPromise;constructor(e,r){this.options={...ZB,...r},this.tileset=e,this.loader=e.loader,this.type=e.type,this.url=e.url,this.basePath=e.basePath||vt.dirname(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=e.lodMetricType,this.lodMetricValue=e.lodMetricValue,this.refine=e.root.refine,this.loadOptions=this.options.loadOptions||{},this._traverser=this._initializeTraverser(),this._requestScheduler=new It({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 St({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(e)}destroy(){this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(e){this.options={...this.options,...e}}getTileUrl(e){if(e.startsWith("data:"))return e;let n=e;return this.queryParams.length&&(n=`${e}${e.includes("?")?"&":"?"}${this.queryParams}`),n}hasExtension(e){return Boolean(this._extensionsUsed.indexOf(e)>-1)}update(e=null){this.tilesetInitializationPromise.then(()=>{!e&&this.lastUpdatedVieports?e=this.lastUpdatedVieports:this.lastUpdatedVieports=e,e&&this.doUpdate(e)})}async selectTiles(e=null){return await this.tilesetInitializationPromise,e&&(this.lastUpdatedVieports=e),this.updatePromise||(this.updatePromise=new Promise(r=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),r(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytes<this._cacheBytes?this.memoryAdjustedScreenSpaceError=Math.max(this.memoryAdjustedScreenSpaceError/1.02,this.options.maximumScreenSpaceError):this.gpuMemoryUsageInBytes>this._cacheBytes+this._cacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(e){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let r=e instanceof Array?e:[e];this._cache.reset(),this._frameNumber++,this.traverseCounter=r.length;let n=[];for(let s of r){let 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=dm(s,this._frameNumber);this._traverser.traverse(this.roots[o],i,this.options)}}_needTraverse(e){let r=e;return this.options.viewportTraversersMap&&(r=this.options.viewportTraversersMap[e]),r===e}_onTraversalEnd(e){let r=e.viewport.id;this.frameStateData[r]||(this.frameStateData[r]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let n=this.frameStateData[r],s=Object.values(this._traverser.selectedTiles),[o,i]=pm(s,e,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(){let e=this.selectedTiles;this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let o in this.frameStateData){let i=this.frameStateData[o];this.selectedTiles=this.selectedTiles.concat(i.selectedTiles),this._requestedTiles=this._requestedTiles.concat(i._requestedTiles),this._emptyTiles=this._emptyTiles.concat(i._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);let r=new Set(this.selectedTiles.map(o=>o.id)),n=this.selectedTiles.some(o=>!o.tileDrawn),s=0;if(n){for(let o of r)this._heldTiles.add(o);for(let o of this._heldTiles){if(r.has(o))continue;let i=this._tiles[o];i&&i.contentAvailable?(i._selectedFrame=this._frameNumber,this.selectedTiles.push(i),s++):this._heldTiles.delete(o)}}else this._heldTiles=r;s>0&&setTimeout(()=>{this.selectTiles()},0);for(let o of this.selectedTiles)this._tiles[o.id]=o;this._loadTiles(),this._unloadTiles(),this._updateStats(),this._tilesChanged(e,this.selectedTiles)&&this.options.onUpdate()}_tilesChanged(e,r){if(e.length!==r.length)return!0;let n=new Set(e.map(i=>i.id)),s=new Set(r.map(i=>i.id)),o=e.filter(i=>!s.has(i.id)).length>0;return o=o||r.filter(i=>!n.has(i.id)).length>0,o}_loadTiles(){this._requestedTiles.sort((e,r)=>e._priority-r._priority);for(let e of this._requestedTiles)e.contentUnloaded&&this._loadTile(e)}_unloadTiles(){this._cache.unloadTiles(this,(e,r)=>e._unloadTile(r))}_updateStats(){let e=0,r=0;for(let n of this.selectedTiles)n.contentAvailable&&n.content&&(e++,n.content.pointCount?r+=n.content.pointCount:r+=n.content.vertexCount);this.stats.get(Om).count=this.selectedTiles.length,this.stats.get(Nm).count=e,this.stats.get(Vm).count=r,this.stats.get(Hm).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(e){this.type===he.I3S&&(this.calculateViewPropsI3S(),e.root=await e.root),this.root=this._initializeTileHeaders(e,null),this.type===he.TILES3D&&(this._initializeTiles3DTileset(e),this.calculateViewPropsTiles3D()),this.type===he.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){let e=this.tileset.fullExtent;if(e){let{xmin:n,xmax:s,ymin:o,ymax:i,zmin:a,zmax:c}=e;this.cartographicCenter=new x(n+(s-n)/2,o+(i-o)/2,a+(c-a)/2),this.cartesianCenter=new x,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=Kc(e,this.cartographicCenter,this.cartesianCenter);return}let r=this.tileset.store?.extent;if(r){let[n,s,o,i]=r;this.cartographicCenter=new x(n+(o-n)/2,s+(i-s)/2,0),this.cartesianCenter=new x,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=gm(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 e=this.root,{center:r}=e.boundingVolume;if(!r){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new x,this.zoom=1;return}r[0]!==0||r[1]!==0||r[2]!==0?(this.cartographicCenter=new x,U.WGS84.cartesianToCartographic(r,this.cartographicCenter)):this.cartographicCenter=new x(0,0,-U.WGS84.radii[0]),this.cartesianCenter=r,this.zoom=mm(e.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(oi),this.stats.get(rl),this.stats.get(tl),this.stats.get(Om),this.stats.get(Nm),this.stats.get(Dm),this.stats.get(Gm),this.stats.get(Um),this.stats.get(Vm),this.stats.get(nl,"memory"),this.stats.get(Hm)}_initializeTileHeaders(e,r){let n=new ur(this,e.root,r);if(r&&(r.children.push(n),n.depth=r.depth+1),this.type===he.TILES3D){let s=[];for(s.push(n);s.length>0;){let o=s.pop();this.stats.get(oi).incrementCount();let i=o.header.children||[];for(let a of i){let c=new ur(this,a,o);if(c.contentUrl?.includes("?session=")){let f=new URL(c.contentUrl).searchParams.get("session");f&&(this._queryParams.session=f)}o.children.push(c),c.depth=o.depth+1,s.push(c)}}}return n}_initializeTraverser(){let e;switch(this.type){case he.TILES3D:e=ti;break;case he.I3S:e=si;break;default:e=ct}return new e({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(e){this._destroySubtree(e)}async _loadTile(e){let r;try{this._onStartTileLoading(),r=await e.loadContent()}catch(n){this._onTileLoadError(e,n instanceof Error?n:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(e,r)}}_onTileLoadError(e,r){this.stats.get(Um).incrementCount();let n=r.message||r.toString(),s=e.url;console.error(`A 3D tile failed to load: ${e.url} ${n}`),this.options.onTileError(e,n,s)}_onTileLoad(e,r){if(r){if(this.type===he.I3S){let n=this.tileset?.nodePagesTile?.nodesInNodePages||0;this.stats.get(oi).reset(),this.stats.get(oi).addCount(n)}e&&e.content&&fm(e,e.content),this.updateContentTypes(e),this._addTileToCache(e),this.options.onTileLoad(e)}}updateContentTypes(e){if(this.type===he.I3S)switch(e.header.isDracoGeometry&&(this.contentFormats.draco=!0),e.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}else if(this.type===he.TILES3D){let{extensionsRemoved:r=[]}=e.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(rl).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(rl).decrementCount()}_addTileToCache(e){this._cache.add(this,e,r=>r._updateCacheStats(e))}_updateCacheStats(e){this.stats.get(Dm).incrementCount(),this.stats.get(tl).incrementCount(),this.gpuMemoryUsageInBytes+=e.gpuMemoryUsageInBytes||0,this.stats.get(nl).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(e){this.gpuMemoryUsageInBytes-=e.gpuMemoryUsageInBytes||0,this.stats.get(tl).decrementCount(),this.stats.get(Gm).incrementCount(),this.stats.get(nl).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(e),e.unloadContent()}_destroy(){let e=[];for(this.root&&e.push(this.root);e.length>0;){let r=e.pop();for(let n of r.children)e.push(n);this._destroyTile(r)}this.root=null}_destroySubtree(e){let r=e,n=[];for(n.push(r);n.length>0;){e=n.pop();for(let s of e.children)n.push(s);e!==r&&this._destroyTile(e)}r.children=[]}_destroyTile(e){this._cache.unloadTile(this,e),this._unloadTile(e),e.destroy()}_initializeTiles3DTileset(e){if(e.queryString){let r=new URLSearchParams(e.queryString),n=Object.fromEntries(r.entries());this._queryParams={...this._queryParams,...n}}if(this.asset=e.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=e.properties,this.geometricError=e.geometricError,this._extensionsUsed=e.extensionsUsed||[],this.extras=e.extras}_initializeI3STileset(){let e=this.loadOptions.i3s;e&&typeof e=="object"&&"token"in e&&(this._queryParams.token=e.token)}};var ii="4.4.0-alpha.18";var hr={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},y8=Object.keys(hr);function sl(t,e,r){H(t instanceof ArrayBuffer);let n=new TextDecoder("utf8"),s=new Uint8Array(t,e,r);return n.decode(s)}function zm(t,e=0){let r=new DataView(t);return`${String.fromCharCode(r.getUint8(e+0))}${String.fromCharCode(r.getUint8(e+1))}${String.fromCharCode(r.getUint8(e+2))}${String.fromCharCode(r.getUint8(e+3))}`}var $B="1.5.6",eC="1.4.1",ol=`https://www.gstatic.com/draco/versioned/decoders/${$B}`,de={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},fs={[de.DECODER]:`${ol}/${de.DECODER}`,[de.DECODER_WASM]:`${ol}/${de.DECODER_WASM}`,[de.FALLBACK_DECODER]:`${ol}/${de.FALLBACK_DECODER}`,[de.ENCODER]:`https://raw.githubusercontent.com/google/draco/${eC}/javascript/${de.ENCODER}`},il;async function qm(t={},e){let r=t.modules||{};return r.draco3d?il||=r.draco3d.createDecoderModule({}).then(n=>({draco:n})):il||=tC(t,e),await il}function km(t,e){if(t&&typeof t=="object"){if(t.default)return t.default;if(t[e])return t[e]}return t}async function tC(t,e){let r,n;switch(e){case"js":r=await De(fs[de.FALLBACK_DECODER],"draco",t,de.FALLBACK_DECODER);break;case"wasm":default:try{[r,n]=await Promise.all([await De(fs[de.DECODER],"draco",t,de.DECODER),await De(fs[de.DECODER_WASM],"draco",t,de.DECODER_WASM)])}catch{r=null,n=null}}return r=km(r,"DracoDecoderModule"),r=r||globalThis.DracoDecoderModule,!r&&!ut&&([r,n]=await Promise.all([await De(fs[de.DECODER],"draco",{...t,useLocalLibraries:!0},de.DECODER),await De(fs[de.DECODER_WASM],"draco",{...t,useLocalLibraries:!0},de.DECODER_WASM)]),r=km(r,"DracoDecoderModule"),r=r||globalThis.DracoDecoderModule),await rC(r,n)}function rC(t,e){if(typeof t!="function")throw new Error("DracoDecoderModule could not be loaded");let r={};return e&&(r.wasmBinary=e),new Promise(n=>{t({...r,onModuleLoaded:s=>n({draco:s})})})}var jm="4.4.0-alpha.18";function Jm(t){switch(t.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function dr(t){let e=1/0,r=1/0,n=1/0,s=-1/0,o=-1/0,i=-1/0,a=t.POSITION?t.POSITION.value:[],c=a&&a.length;for(let l=0;l<c;l+=3){let f=a[l],u=a[l+1],h=a[l+2];e=f<e?f:e,r=u<r?u:r,n=h<n?h:n,s=f>s?f:s,o=u>o?u:o,i=h>i?h:i}return[[e,r,n],[s,o,i]]}function al(t,e,r){let n=Jm(e.value),s=r||Wm(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:n}]},nullable:!1,metadata:s}}function Wm(t){let e={};return"byteOffset"in t&&(e.byteOffset=t.byteOffset.toString(10)),"byteStride"in t&&(e.byteStride=t.byteStride.toString(10)),"normalized"in t&&(e.normalized=t.normalized.toString()),e}function Ym(t,e,r){let n=Km(e.metadata),s=[],o=nC(e.attributes);for(let i in t){let a=t[i],c=Xm(i,a,o[i]);s.push(c)}if(r){let i=Xm("indices",r);s.push(i)}return{fields:s,metadata:n}}function nC(t){let e={};for(let r in t){let n=t[r];e[n.name||"undefined"]=n}return e}function Xm(t,e,r){let n=r?Km(r.metadata):void 0;return al(t,e,n)}function Km(t){Object.entries(t);let e={};for(let r in t)e[`${r}.string`]=JSON.stringify(t[r]);return e}var Qm={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},sC={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},oC=4,us=class{draco;decoder;metadataQuerier;constructor(e){this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e,r={}){let n=new this.draco.DecoderBuffer;n.Init(new Int8Array(e),e.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=dr(c.attributes),f=Ym(c.attributes,a,c.indices);return{loader:"draco",loaderData:a,header:{vertexCount:o.num_points(),boundingBox:l},...c,schema:f}}finally{this.draco.destroy(n),o&&this.draco.destroy(o)}}_getDracoLoaderData(e,r,n){let s=this._getTopLevelMetadata(e),o=this._getDracoAttributes(e,n);return{geometry_type:r,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:s,attributes:o}}_getDracoAttributes(e,r){let n={};for(let s=0;s<e.num_attributes();s++){let o=this.decoder.GetAttribute(e,s),i=this._getAttributeMetadata(e,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(e,r,n){let s=this._getMeshAttributes(r,e,n);if(!s.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(n.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:s,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:s,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:s}}_getMeshAttributes(e,r,n){let s={};for(let o of Object.values(e.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(e){let n=e.num_faces()*3,s=n*oC,o=this.draco._malloc(s);try{return this.decoder.GetTrianglesUInt32Array(e,s,o),new Uint32Array(this.draco.HEAPF32.buffer,o,n).slice()}finally{this.draco._free(o)}}_getTriangleStripIndices(e){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,r),cC(r)}finally{this.draco.destroy(r)}}_getAttributeValues(e,r){let n=sC[r.data_type];if(!n)return console.warn(`DRACO: Unsupported attribute type ${r.data_type}`),null;let s=r.num_components,i=e.num_points()*s,a=i*n.BYTES_PER_ELEMENT,c=iC(this.draco,n),l,f=this.draco._malloc(a);try{let u=this.decoder.GetAttribute(e,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,u,c,a,f),l=new n(this.draco.HEAPF32.buffer,f,i).slice()}finally{this.draco._free(f)}return{value:l,size:s}}_deduceAttributeName(e,r){let n=e.unique_id;for(let[i,a]of Object.entries(r.extraAttributes||{}))if(a===n)return i;let s=e.attribute_type;for(let i in Qm)if(this.draco[i]===s)return Qm[i];let o=r.attributeNameEntry||"name";return e.metadata[o]?e.metadata[o].string:`CUSTOM_ATTRIBUTE_${n}`}_getTopLevelMetadata(e){let r=this.decoder.GetMetadata(e);return this._getDracoMetadata(r)}_getAttributeMetadata(e,r){let n=this.decoder.GetAttributeMetadata(e,r);return this._getDracoMetadata(n)}_getDracoMetadata(e){if(!e||!e.ptr)return{};let r={},n=this.metadataQuerier.NumEntries(e);for(let s=0;s<n;s++){let o=this.metadataQuerier.GetEntryName(e,s);r[o]=this._getDracoMetadataField(e,o)}return r}_getDracoMetadataField(e,r){let n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,r,n);let s=aC(n);return{int:this.metadataQuerier.GetIntEntry(e,r),string:this.metadataQuerier.GetStringEntry(e,r),double:this.metadataQuerier.GetDoubleEntry(e,r),intArray:s}}finally{this.draco.destroy(n)}}_disableAttributeTransforms(e){let{quantizedAttributes:r=[],octahedronAttributes:n=[]}=e,s=[...r,...n];for(let o of s)this.decoder.SkipAttributeTransform(this.draco[o])}_getQuantizationTransform(e,r){let{quantizedAttributes:n=[]}=r,s=e.attribute_type();if(n.map(i=>this.decoder[i]).includes(s)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(e))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(e,r){let{octahedronAttributes:n=[]}=r,s=e.attribute_type();if(n.map(i=>this.decoder[i]).includes(s)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(e))return{quantization_bits:i.quantization_bits()}}finally{this.draco.destroy(i)}}return null}};function iC(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32;default:return t.DT_INVALID}}function aC(t){let e=t.size(),r=new Int32Array(e);for(let n=0;n<e;n++)r[n]=t.GetValue(n);return r}function cC(t){let e=t.size(),r=new Int32Array(e);for(let n=0;n<e;n++)r[n]=t.GetValue(n);return r}var Zm={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:jm,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",extraAttributes:{},attributeNameEntry:void 0}}},hs={...Zm,parse:lC};async function lC(t,e){let{draco:r}=await qm(Pn(e),e?.draco?.decoderType||"wasm"),n=new us(r);try{return n.parseSync(t,e?.draco)}finally{n.destroy()}}var fC={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},ie={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},N={...fC,...ie};var cl={[ie.DOUBLE]:Float64Array,[ie.FLOAT]:Float32Array,[ie.UNSIGNED_SHORT]:Uint16Array,[ie.UNSIGNED_INT]:Uint32Array,[ie.UNSIGNED_BYTE]:Uint8Array,[ie.BYTE]:Int8Array,[ie.SHORT]:Int16Array,[ie.INT]:Int32Array},uC={DOUBLE:ie.DOUBLE,FLOAT:ie.FLOAT,UNSIGNED_SHORT:ie.UNSIGNED_SHORT,UNSIGNED_INT:ie.UNSIGNED_INT,UNSIGNED_BYTE:ie.UNSIGNED_BYTE,BYTE:ie.BYTE,SHORT:ie.SHORT,INT:ie.INT},ll="Failed to convert GL type",ce=class{static fromTypedArray(e){e=ArrayBuffer.isView(e)?e.constructor:e;for(let r in cl)if(cl[r]===e)return r;throw new Error(ll)}static fromName(e){let r=uC[e];if(!r)throw new Error(ll);return r}static getArrayType(e){switch(e){case ie.UNSIGNED_SHORT_5_6_5:case ie.UNSIGNED_SHORT_4_4_4_4:case ie.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let r=cl[e];if(!r)throw new Error(ll);return r}}static getByteSize(e){return ce.getArrayType(e).BYTES_PER_ELEMENT}static validate(e){return Boolean(ce.getArrayType(e))}static createTypedArray(e,r,n=0,s){s===void 0&&(s=(r.byteLength-n)/ce.getByteSize(e));let o=ArrayBuffer.isView(r)?r.buffer:r,i=ce.getArrayType(e);return new i(o,n,s)}};function $m(t,e){if(!t)throw new Error(`math.gl assertion failed. ${e}`)}function fl(t,e=[0,0,0]){let r=t>>11&31,n=t>>5&63,s=t&31;return e[0]=r<<3,e[1]=n<<2,e[2]=s<<3,e}var e9=1/256;var t9=new Jt,r9=new x,n9=new Jt,s9=new Jt,o9=new Uint8Array(1);function eg(t,e=255){return $s(t,0,e)/e*2-1}function tg(t){return t<0?-1:1}function rg(t,e,r,n){if($m(n),t<0||t>r||e<0||e>r)throw new Error(`x and y must be unsigned normalized integers between 0 and ${r}`);if(n.x=eg(t,r),n.y=eg(e,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){let s=n.x;n.x=(1-Math.abs(n.y))*tg(s),n.y=(1-Math.abs(s))*tg(n.y)}return n.normalize()}function ul(t,e,r){return rg(t,e,255,r)}var xt=class{json;buffer;featuresLength=0;_cachedTypedArrays={};constructor(e,r){this.json=e,this.buffer=r}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return Boolean(this.json[e])}getGlobalProperty(e,r=N.UNSIGNED_INT,n=1){let s=this.json[e];return s&&Number.isFinite(s.byteOffset)?this._getTypedArrayFromBinary(e,r,n,1,s.byteOffset):s}getPropertyArray(e,r,n){let s=this.json[e];return s&&Number.isFinite(s.byteOffset)?("componentType"in s&&(r=ce.fromName(s.componentType)),this._getTypedArrayFromBinary(e,r,n,this.featuresLength,s.byteOffset)):this._getTypedArrayFromArray(e,r,s)}getProperty(e,r,n,s,o){let i=this.json[e];if(!i)return i;let a=this.getPropertyArray(e,r,n);if(n===1)return a[s];for(let c=0;c<n;++c)o[c]=a[n*s+c];return o}_getTypedArrayFromBinary(e,r,n,s,o){let i=this._cachedTypedArrays,a=i[e];return a||(a=ce.createTypedArray(r,this.buffer.buffer,this.buffer.byteOffset+o,s*n),i[e]=a),a}_getTypedArrayFromArray(e,r,n){let s=this._cachedTypedArrays,o=s[e];if(!o){if(ArrayBuffer.isView(n)){let i=n.byteOffset,c=n.byteLength/ce.getByteSize(r);o=ce.createTypedArray(r,n.buffer,i,c)}else if(n instanceof ArrayBuffer)o=ce.createTypedArray(r,n);else{let i=ce.getArrayType(r);o=new i(n)}s[e]=o}return o}};var hC={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},dC={SCALAR:(t,e)=>t[e],VEC2:(t,e)=>[t[2*e+0],t[2*e+1]],VEC3:(t,e)=>[t[3*e+0],t[3*e+1],t[3*e+2]],VEC4:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT2:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT3:(t,e)=>[t[9*e+0],t[9*e+1],t[9*e+2],t[9*e+3],t[9*e+4],t[9*e+5],t[9*e+6],t[9*e+7],t[9*e+8]],MAT4:(t,e)=>[t[16*e+0],t[16*e+1],t[16*e+2],t[16*e+3],t[16*e+4],t[16*e+5],t[16*e+6],t[16*e+7],t[16*e+8],t[16*e+9],t[16*e+10],t[16*e+11],t[16*e+12],t[16*e+13],t[16*e+14],t[16*e+15]]},pC={SCALAR:(t,e,r)=>{e[r]=t},VEC2:(t,e,r)=>{e[2*r+0]=t[0],e[2*r+1]=t[1]},VEC3:(t,e,r)=>{e[3*r+0]=t[0],e[3*r+1]=t[1],e[3*r+2]=t[2]},VEC4:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT2:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT3:(t,e,r)=>{e[9*r+0]=t[0],e[9*r+1]=t[1],e[9*r+2]=t[2],e[9*r+3]=t[3],e[9*r+4]=t[4],e[9*r+5]=t[5],e[9*r+6]=t[6],e[9*r+7]=t[7],e[9*r+8]=t[8],e[9*r+9]=t[9]},MAT4:(t,e,r)=>{e[16*r+0]=t[0],e[16*r+1]=t[1],e[16*r+2]=t[2],e[16*r+3]=t[3],e[16*r+4]=t[4],e[16*r+5]=t[5],e[16*r+6]=t[6],e[16*r+7]=t[7],e[16*r+8]=t[8],e[16*r+9]=t[9],e[16*r+10]=t[10],e[16*r+11]=t[11],e[16*r+12]=t[12],e[16*r+13]=t[13],e[16*r+14]=t[14],e[16*r+15]=t[15]}};function ng(t,e,r,n){let{componentType:s}=t;H(t.componentType);let o=typeof s=="string"?ce.fromName(s):s,i=hC[t.type],a=dC[t.type],c=pC[t.type];return r+=t.byteOffset,{values:ce.createTypedArray(o,e,r,i*n),type:o,size:i,unpacker:a,packer:c}}var lt=t=>t!==void 0;function sg(t,e,r){if(!e)return null;let n=t.getExtension("3DTILES_batch_table_hierarchy"),s=e.HIERARCHY;return s&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),e.extensions=e.extensions||{},e.extensions["3DTILES_batch_table_hierarchy"]=s,n=s),n?mC(n,r):null}function mC(t,e){let r,n,s,o=t.instancesLength,i=t.classes,a=t.classIds,c=t.parentCounts,l=t.parentIds,f=o;lt(a.byteOffset)&&(a.componentType=defaultValue(a.componentType,GL.UNSIGNED_SHORT),a.type=AttributeType.SCALAR,s=getBinaryAccessor(a),a=s.createArrayBufferView(e.buffer,e.byteOffset+a.byteOffset,o));let u;if(lt(c))for(lt(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,s=getBinaryAccessor(c),c=s.createArrayBufferView(e.buffer,e.byteOffset+c.byteOffset,o)),u=new Uint16Array(o),f=0,r=0;r<o;++r)u[r]=f,f+=c[r];lt(l)&<(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,s=getBinaryAccessor(l),l=s.createArrayBufferView(e.buffer,e.byteOffset+l.byteOffset,f));let h=i.length;for(r=0;r<h;++r){let m=i[r].length,y=i[r].instances,b=getBinaryProperties(m,y,e);i[r].instances=combine(b,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:u,parentIds:l};return xC(A),A}function Jr(t,e,r){if(!t)return;let n=t.parentCounts;return t.parentIds?r(t,e):n>0?gC(t,e,r):AC(t,e,r)}function gC(t,e,r){let n=t.classIds,s=t.parentCounts,o=t.parentIds,i=t.parentIndexes,a=n.length,c=scratchVisited;c.length=Math.max(c.length,a);let l=++marker,f=scratchStack;for(f.length=0,f.push(e);f.length>0;){if(e=f.pop(),c[e]===l)continue;c[e]=l;let u=r(t,e);if(lt(u))return u;let h=s[e],d=i[e];for(let p=0;p<h;++p){let A=o[d+p];A!==e&&f.push(A)}}return null}function AC(t,e,r){let n=!0;for(;n;){let s=r(t,e);if(lt(s))return s;let o=t.parentIds[e];n=o!==e,e=o}throw new Error("traverseHierarchySingleParent")}function xC(t){let e=[],n=t.classIds.length;for(let s=0;s<n;++s)og(t,s,stack)}function og(t,e,r){let n=t.parentCounts,s=t.parentIds,o=t.parentIndexes,a=t.classIds.length;if(!lt(s))return;assert(e<a,`Parent index ${e} exceeds the total number of instances: ${a}`),assert(r.indexOf(e)===-1,"Circular dependency detected in the batch table hierarchy."),r.push(e);let c=lt(n)?n[e]:1,l=lt(n)?o[e]:e;for(let f=0;f<c;++f){let u=s[l+f];u!==e&&og(t,u,r)}r.pop(e)}function Ce(t){return t!=null}var ai=(t,e)=>t,yC={HIERARCHY:!0,extensions:!0,extras:!0},pr=class{json;binary;featureCount;_extensions;_properties;_binaryProperties;_hierarchy;constructor(e,r,n,s={}){H(n>=0),this.json=e||{},this.binary=r,this.featureCount=n,this._extensions=this.json?.extensions||{},this._properties={};for(let o in this.json)yC[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),s["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=sg(this,this.json,this.binary))}getExtension(e){return this.json&&this.json.extensions&&this.json.extensions[e]}memorySizeInBytes(){return 0}isClass(e,r){if(this._checkBatchId(e),H(typeof r=="string",r),this._hierarchy){let n=Jr(this._hierarchy,e,(s,o)=>{let i=s.classIds[o];return s.classes[i].name===r});return Ce(n)}return!1}isExactClass(e,r){return H(typeof r=="string",r),this.getExactClassName(e)===r}getExactClassName(e){if(this._checkBatchId(e),this._hierarchy){let r=this._hierarchy.classIds[e];return this._hierarchy.classes[r].name}}hasProperty(e,r){return this._checkBatchId(e),H(typeof r=="string",r),Ce(this._properties[r])||this._hasPropertyInHierarchy(e,r)}getPropertyNames(e,r){this._checkBatchId(e),r=Ce(r)?r:[],r.length=0;let n=Object.keys(this._properties);return r.push(...n),this._hierarchy&&this._getPropertyNamesInHierarchy(e,r),r}getProperty(e,r){if(this._checkBatchId(e),H(typeof r=="string",r),this._binaryProperties){let s=this._binaryProperties[r];if(Ce(s))return this._getBinaryProperty(s,e)}let n=this._properties[r];if(Ce(n))return ai(n[e],!0);if(this._hierarchy){let s=this._getHierarchyProperty(e,r);if(Ce(s))return s}}setProperty(e,r,n){let s=this.featureCount;if(this._checkBatchId(e),H(typeof r=="string",r),this._binaryProperties){let i=this._binaryProperties[r];if(i){this._setBinaryProperty(i,e,n);return}}if(this._hierarchy&&this._setHierarchyProperty(this,e,r,n))return;let o=this._properties[r];Ce(o)||(this._properties[r]=new Array(s),o=this._properties[r]),o[e]=ai(n,!0)}_checkBatchId(e){if(!(e>=0&&e<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(e,r){return e.unpack(e.typedArray,r)}_setBinaryProperty(e,r,n){e.pack(n,e.typedArray,r)}_initializeBinaryProperties(){let e=null;for(let r in this._properties){let n=this._properties[r],s=this._initializeBinaryProperty(r,n);s&&(e=e||{},e[r]=s)}return e}_initializeBinaryProperty(e,r){if("byteOffset"in r){let n=r;H(this.binary,`Property ${e} requires a batch table binary.`),H(n.type,`Property ${e} requires a type.`);let s=ng(n,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:s.values,componentCount:s.size,unpack:s.unpacker,pack:s.packer}}return null}_hasPropertyInHierarchy(e,r){if(!this._hierarchy)return!1;let n=Jr(this._hierarchy,e,(s,o)=>{let i=s.classIds[o],a=s.classes[i].instances;return Ce(a[r])});return Ce(n)}_getPropertyNamesInHierarchy(e,r){Jr(this._hierarchy,e,(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(e,r){return Jr(this._hierarchy,e,(n,s)=>{let o=n.classIds[s],i=n.classes[o],a=n.classIndexes[s],c=i.instances[r];return Ce(c)?Ce(c.typedArray)?this._getBinaryProperty(c,a):ai(c[a],!0):null})}_setHierarchyProperty(e,r,n,s){let o=Jr(this._hierarchy,r,(i,a)=>{let c=i.classIds[a],l=i.classes[c],f=i.classIndexes[a],u=l.instances[n];return Ce(u)?(H(a===r,`Inherited property "${n}" is read-only.`),Ce(u.typedArray)?this._setBinaryProperty(u,f,s):u[f]=ai(s,!0),!0):!1});return Ce(o)}};function Gt(t,e,r=0){let n=new DataView(e);if(t.magic=n.getUint32(r,!0),r+=4,t.version=n.getUint32(r,!0),r+=4,t.byteLength=n.getUint32(r,!0),r+=4,t.version!==1)throw new Error(`3D Tile Version ${t.version} not supported`);return r}var Wr=4,ig="b3dm tile in legacy format.";function Xr(t,e,r){let n=new DataView(e),s;t.header=t.header||{};let o=n.getUint32(r,!0);r+=Wr;let i=n.getUint32(r,!0);r+=Wr;let a=n.getUint32(r,!0);r+=Wr;let c=n.getUint32(r,!0);return r+=Wr,a>=570425344?(r-=Wr*2,s=o,a=i,c=0,o=0,i=0,console.warn(ig)):c>=570425344&&(r-=Wr,s=a,a=o,c=i,o=0,i=0,console.warn(ig)),t.header.featureTableJsonByteLength=o,t.header.featureTableBinaryByteLength=i,t.header.batchTableJsonByteLength=a,t.header.batchTableBinaryByteLength=c,t.header.batchLength=s,r}function Yr(t,e,r,n){return r=TC(t,e,r,n),r=bC(t,e,r,n),r}function TC(t,e,r,n){let{featureTableJsonByteLength:s,featureTableBinaryByteLength:o,batchLength:i}=t.header||{};if(t.featureTableJson={BATCH_LENGTH:i||0},s&&s>0){let a=sl(e,r,s);t.featureTableJson=JSON.parse(a)}return r+=s||0,t.featureTableBinary=new Uint8Array(e,r,o),r+=o||0,r}function bC(t,e,r,n){let{batchTableJsonByteLength:s,batchTableBinaryByteLength:o}=t.header||{};if(s&&s>0){let i=sl(e,r,s);t.batchTableJson=JSON.parse(i),r+=s,o&&o>0&&(t.batchTableBinary=new Uint8Array(e,r,o),t.batchTableBinary=new Uint8Array(t.batchTableBinary),r+=o)}return r}function hl(t,e,r){if(!e&&(!t||!t.batchIds||!r))return null;let{batchIds:n,isRGB565:s,pointCount:o=0}=t;if(n&&r){let i=new Uint8ClampedArray(o*3);for(let a=0;a<o;a++){let c=n[a],f=r.getProperty(c,"dimensions").map(u=>u*255);i[a*3]=f[0],i[a*3+1]=f[1],i[a*3+2]=f[2]}return{type:N.UNSIGNED_BYTE,value:i,size:3,normalized:!0}}if(e&&s){let i=new Uint8ClampedArray(o*3);for(let a=0;a<o;a++){let c=fl(e[a]);i[a*3]=c[0],i[a*3+1]=c[1],i[a*3+2]=c[2]}return{type:N.UNSIGNED_BYTE,value:i,size:3,normalized:!0}}return e&&e.length===o*3?{type:N.UNSIGNED_BYTE,value:e,size:3,normalized:!0}:{type:N.UNSIGNED_BYTE,value:e||new Uint8ClampedArray,size:4,normalized:!0}}var ag=new x;function cg(t,e){if(!e)return null;if(t.isOctEncoded16P){let r=new Float32Array((t.pointsLength||0)*3);for(let n=0;n<(t.pointsLength||0);n++)ul(e[n*2],e[n*2+1],ag),ag.toArray(r,n*3);return{type:N.FLOAT,size:2,value:r}}return{type:N.FLOAT,size:2,value:e}}function lg(t,e,r){return t.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(t.isQuantized=!1,EC(t,e)):{type:N.UNSIGNED_SHORT,value:e,size:3,normalized:!0}:e}function EC(t,e){let r=new x,n=new Float32Array(t.pointCount*3);for(let s=0;s<t.pointCount;s++)r.set(e[s*3],e[s*3+1],e[s*3+2]).scale(1/t.quantizedRange).multiply(t.quantizedVolumeScale).add(t.quantizedVolumeOffset).toArray(n,s*3);return n}async function fg(t,e,r,n,s){r=Gt(t,e,r),r=Xr(t,e,r),r=Yr(t,e,r,n),MC(t);let{featureTable:o,batchTable:i}=_C(t);return await wC(t,o,i,n,s),BC(t,o,n),CC(t,o,i),SC(t,o),r}function MC(t){t.attributes={positions:null,colors:null,normals:null,batchIds:null},t.isQuantized=!1,t.isTranslucent=!1,t.isRGB565=!1,t.isOctEncoded16P=!1}function _C(t){let e=new xt(t.featureTableJson,t.featureTableBinary),r=e.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(r))throw new Error("POINTS_LENGTH must be defined");e.featuresLength=r,t.featuresLength=r,t.pointsLength=r,t.pointCount=r,t.rtcCenter=e.getGlobalProperty("RTC_CENTER",N.FLOAT,3);let n=IC(t,e);return{featureTable:e,batchTable:n}}function BC(t,e,r){if(t.attributes=t.attributes||{positions:null,colors:null,normals:null,batchIds:null},!t.attributes.positions){if(e.hasProperty("POSITION"))t.attributes.positions=e.getPropertyArray("POSITION",N.FLOAT,3);else if(e.hasProperty("POSITION_QUANTIZED")){let n=e.getPropertyArray("POSITION_QUANTIZED",N.UNSIGNED_SHORT,3);if(t.isQuantized=!0,t.quantizedRange=(1<<16)-1,t.quantizedVolumeScale=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",N.FLOAT,3),!t.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(t.quantizedVolumeOffset=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",N.FLOAT,3),!t.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");t.attributes.positions=lg(t,n,r)}}if(!t.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function CC(t,e,r){if(t.attributes=t.attributes||{positions:null,colors:null,normals:null,batchIds:null},!t.attributes.colors){let n=null;e.hasProperty("RGBA")?(n=e.getPropertyArray("RGBA",N.UNSIGNED_BYTE,4),t.isTranslucent=!0):e.hasProperty("RGB")?n=e.getPropertyArray("RGB",N.UNSIGNED_BYTE,3):e.hasProperty("RGB565")&&(n=e.getPropertyArray("RGB565",N.UNSIGNED_SHORT,1),t.isRGB565=!0),t.attributes.colors=hl(t,n,r)}e.hasProperty("CONSTANT_RGBA")&&(t.constantRGBA=e.getGlobalProperty("CONSTANT_RGBA",N.UNSIGNED_BYTE,4))}function SC(t,e){if(t.attributes=t.attributes||{positions:null,colors:null,normals:null,batchIds:null},!t.attributes.normals){let r=null;e.hasProperty("NORMAL")?r=e.getPropertyArray("NORMAL",N.FLOAT,3):e.hasProperty("NORMAL_OCT16P")&&(r=e.getPropertyArray("NORMAL_OCT16P",N.UNSIGNED_BYTE,2),t.isOctEncoded16P=!0),t.attributes.normals=cg(t,r)}}function IC(t,e){let r=null;if(!t.batchIds&&e.hasProperty("BATCH_ID")&&(t.batchIds=e.getPropertyArray("BATCH_ID",N.UNSIGNED_SHORT,1),t.batchIds)){let n=e.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:s,batchTableBinary:o}=t;r=new pr(s,o,n)}return r}async function wC(t,e,r,n,s){let o,i,a,c=t.batchTableJson&&t.batchTableJson.extensions&&t.batchTableJson.extensions["3DTILES_draco_point_compression"];c&&(a=c.properties);let l=e.getExtension("3DTILES_draco_point_compression");if(l){i=l.properties;let u=l.byteOffset,h=l.byteLength;if(!i||!Number.isFinite(u)||!h)throw new Error("Draco properties, byteOffset, and byteLength must be defined");o=(t.featureTableBinary||[]).slice(u,u+h),t.hasPositions=Number.isFinite(i.POSITION),t.hasColors=Number.isFinite(i.RGB)||Number.isFinite(i.RGBA),t.hasNormals=Number.isFinite(i.NORMAL),t.hasBatchIds=Number.isFinite(i.BATCH_ID),t.isTranslucent=Number.isFinite(i.RGBA)}if(!o)return!0;let f={buffer:o,properties:{...i,...a},featureTableProperties:i,batchTableProperties:a,dequantizeInShader:!1};return await vC(t,f,n,s)}async function vC(t,e,r,n){if(!n)return;let s={...r,draco:{...r?.draco,extraAttributes:e.batchTableProperties||{}}};delete s["3d-tiles"];let o=await Fe(e.buffer,hs,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,f=i&&o.attributes.POSITION.value.quantization,u=c&&o.attributes.NORMAL.value.quantization;if(f){let d=o.POSITION.data.quantization,p=d.range;t.quantizedVolumeScale=new x(p,p,p),t.quantizedVolumeOffset=new x(d.minValues),t.quantizedRange=(1<<d.quantizationBits)-1,t.isQuantizedDraco=!0}u&&(t.octEncodedRange=(1<<o.NORMAL.data.quantization.quantizationBits)-1,t.isOctEncodedDraco=!0);let h={};if(e.batchTableProperties)for(let d of Object.keys(e.batchTableProperties))o.attributes[d]&&o.attributes[d].value&&(h[d.toLowerCase()]=o.attributes[d].value);t.attributes={positions:i,colors:hl(t,a,void 0),normals:c,batchIds:l,...h}}var dl={};me(dl,{createExtMeshFeatures:()=>WC,decode:()=>zC,encode:()=>kC,name:()=>HC});function le(t,e){if(!t)throw new Error(e||"assert failed: gltf")}var ci={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},li={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var LC=1.33,ug=["SCALAR","VEC2","VEC3","VEC4"],FC=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],RC=new Map(FC),PC={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},OC={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},NC={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function fi(t){return ug[t-1]||ug[0]}function Ut(t){let e=RC.get(t.constructor);if(!e)throw new Error("Illegal typed array");return e}function Kr(t,e){let r=NC[t.componentType],n=PC[t.type],s=OC[t.componentType],o=t.count*n,i=t.count*n*s;le(i>=0&&i<=e.byteLength);let a=li[t.componentType],c=ci[t.type];return{ArrayType:r,length:o,byteLength:i,componentByteSize:a,numberOfComponentsInElement:c}}function ds(t){let{images:e,bufferViews:r}=t;e=e||[],r=r||[];let n=e.map(i=>i.bufferView);r=r.filter(i=>!n.includes(i));let s=r.reduce((i,a)=>i+a.byteLength,0),o=e.reduce((i,a)=>{let{width:c,height:l}=a.image;return i+c*l},0);return s+Math.ceil(4*o*LC)}function hg(t,e,r){let n=t.bufferViews[r];le(n);let s=n.buffer,o=e[s];le(o);let i=(n.byteOffset||0)+o.byteOffset;return new Uint8Array(o.arrayBuffer,i,n.byteLength)}function dg(t,e,r){let n=typeof r=="number"?t.accessors?.[r]:r;if(!n)throw new Error(`No gltf accessor ${JSON.stringify(r)}`);let s=t.bufferViews?.[n.bufferView||0];if(!s)throw new Error(`No gltf buffer view for accessor ${s}`);let{arrayBuffer:o,byteOffset:i}=e[s.buffer],a=(i||0)+(n.byteOffset||0)+(s.byteOffset||0),{ArrayType:c,length:l,componentByteSize:f,numberOfComponentsInElement:u}=Kr(n,s),h=f*u,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 m=new c(o,a+A*d,u);p.set(m,A*u)}return p}function DC(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var k=class{gltf;sourceBuffers;byteLength;constructor(e){this.gltf={json:e?.json||DC(),buffers:e?.buffers||[],images:e?.images||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}hasExtension(e){let r=this.getUsedExtensions().find(s=>s===e),n=this.getRequiredExtensions().find(s=>s===e);return typeof r=="string"||typeof n=="string"}getExtension(e){let r=this.getUsedExtensions().find(s=>s===e),n=this.json.extensions||{};return r?n[e]:null}getRequiredExtension(e){return this.getRequiredExtensions().find(n=>n===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(e,r){return(e.extensions||{})[r]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,r){if(typeof r=="object")return r;let n=this.json[e]&&this.json[e][r];if(!n)throw new Error(`glTF file error: Could not find ${e}[${r}]`);return n}getTypedArrayForBufferView(e){e=this.getBufferView(e);let r=e.buffer,n=this.gltf.buffers[r];le(n);let s=(e.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,s,e.byteLength)}getTypedArrayForAccessor(e){let r=this.getAccessor(e);return dg(this.gltf.json,this.gltf.buffers,r)}getTypedArrayForImageData(e){e=this.getAccessor(e);let r=this.getBufferView(e.bufferView),s=this.getBuffer(r.buffer).data,o=r.byteOffset||0;return new Uint8Array(s,o,r.byteLength)}addApplicationData(e,r){return this.json[e]=r,this}addExtraData(e,r){return this.json.extras=this.json.extras||{},this.json.extras[e]=r,this}addObjectExtension(e,r,n){return e.extensions=e.extensions||{},e.extensions[r]=n,this.registerUsedExtension(r),this}setObjectExtension(e,r,n){let s=e.extensions||{};s[r]=n}removeObjectExtension(e,r){let n=e?.extensions||{};if(n[r]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(r)||s.push(r)}delete n[r]}addExtension(e,r={}){return le(r),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=r,this.registerUsedExtension(e),r}addRequiredExtension(e,r={}){return le(r),this.addExtension(e,r),this.registerRequiredExtension(e),r}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(r=>r===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(r=>r===e)||this.json.extensionsRequired.push(e)}removeExtension(e){if(this.json.extensions?.[e]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let r=this.json.extensionsRemoved;r.includes(e)||r.push(e)}this.json.extensions&&delete this.json.extensions[e],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e)}setDefaultScene(e){this.json.scene=e}addScene(e){let{nodeIndices:r}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:r}),this.json.scenes.length-1}addNode(e){let{meshIndex:r,matrix:n}=e;this.json.nodes=this.json.nodes||[];let s={mesh:r};return n&&(s.matrix=n),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(e){let{attributes:r,indices:n,material:s,mode:o=4}=e,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(e){let n={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(n),this.json.meshes.length-1}addImage(e,r){let n=or(e),s=r||n?.mimeType,i={bufferView:this.addBufferView(e),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(i),this.json.images.length-1}addBufferView(e,r=0,n=this.byteLength){let s=e.byteLength;le(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);let o={buffer:r,byteOffset:n,byteLength:s};return this.byteLength+=Ct(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(o),this.json.bufferViews.length-1}addAccessor(e,r){let n={bufferView:e,type:fi(r.size),componentType:r.componentType,count:r.count,max:r.max,min:r.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(e,r={size:3}){let n=this.addBufferView(e),s={min:r.min,max:r.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(e,r.size));let o={size:r.size,componentType:Ut(e),count:Math.round(e.length/r.size),min:s.min,max:s.max};return this.addAccessor(n,Object.assign(o,r))}addTexture(e){let{imageIndex:r}=e,n={source:r};return this.json.textures=this.json.textures||[],this.json.textures.push(n),this.json.textures.length-1}addMaterial(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}createBinaryChunk(){let e=this.byteLength,r=new ArrayBuffer(e),n=new Uint8Array(r),s=0;for(let o of this.sourceBuffers||[])s=ac(o,n,s);this.json?.buffers?.[0]?this.json.buffers[0].byteLength=e:this.json.buffers=[{byteLength:e}],this.gltf.binary=r,this.sourceBuffers=[r],this.gltf.buffers=[{arrayBuffer:r,byteOffset:0,byteLength:r.byteLength}]}_removeStringFromArray(e,r){let n=!0;for(;n;){let s=e.indexOf(r);s>-1?e.splice(s,1):n=!1}}_addAttributes(e={}){let r={};for(let n in e){let s=e[n],o=this._getGltfAttributeName(n),i=this.addBinaryBuffer(s.value,s);r[o]=i}return r}_addIndices(e){return this.addBinaryBuffer(e,{size:1})}_getGltfAttributeName(e){switch(e.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return e}}_getAccessorMinMax(e,r){let n={min:null,max:null};if(e.length<r)return n;n.min=[],n.max=[];let s=e.subarray(0,r);for(let o of s)n.min.push(o),n.max.push(o);for(let o=r;o<e.length;o+=r)for(let i=0;i<r;i++)n.min[0+i]=Math.min(n.min[0+i],e[o+i]),n.max[0+i]=Math.max(n.max[0+i],e[o+i]);return n}};function pg(t){return(t%1+1)%1}var mg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},GC={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},gg={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function ps(t,e){return gg[e]*mg[t]}function Qr(t,e,r,n){if(r!=="UINT8"&&r!=="UINT16"&&r!=="UINT32"&&r!=="UINT64")return null;let s=t.getTypedArrayForBufferView(e),o=Zr(s,"SCALAR",r,n+1);return o instanceof BigInt64Array||o instanceof BigUint64Array?null:o}function Zr(t,e,r,n=1){let s=mg[e],o=GC[r],i=gg[r],a=n*s,c=a*i,l=t.buffer,f=t.byteOffset;return f%i!==0&&(l=new Uint8Array(l).slice(f,f+c).buffer,f=0),new o(wt(l),f,a)}function $r(t,e,r){let n=`TEXCOORD_${e.texCoord||0}`,s=r.attributes[n],o=t.getTypedArrayForAccessor(s),i=t.gltf.json,a=e.index,c=i.textures?.[a]?.source;if(typeof c<"u"){let l=i.images?.[c]?.mimeType,f=t.gltf.images?.[c];if(f&&typeof f.width<"u"){let u=[];for(let h=0;h<o.length;h+=2){let d=UC(f,l,o,h,e.channels);u.push(d)}return u}}return[]}function ui(t,e,r,n,s){if(!r?.length)return;let o=[];for(let f of r){let u=n.findIndex(h=>h===f);u===-1&&(u=n.push(f)-1),o.push(u)}let i=new Uint32Array(o),a=t.gltf.buffers.push({arrayBuffer:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength})-1,c=t.addBufferView(i,a,0),l=t.addAccessor(c,{size:1,componentType:Ut(i),count:i.length});s.attributes[e]=l}function UC(t,e,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;e&&(e.indexOf("image/jpeg")!==-1||e.indexOf("image/png")!==-1)&&(c=4);let l=VC(i,a,t,c),f=0;for(let u of s){let h=typeof u=="number"?Object.values(o)[u]:o[u],d=l+h.offset,p=zn(t);if(p.data.length<=d)throw new Error(`${p.data.length} <= ${d}`);let A=p.data[d];f|=A<<h.shift}return f}function VC(t,e,r,n=1){let s=r.width,o=pg(t)*(s-1),i=Math.round(o),a=r.height,c=pg(e)*(a-1),l=Math.round(c),f=r.components?r.components:n;return(l*s+i)*f}function hi(t,e,r,n,s){let o=[];for(let i=0;i<e;i++){let a=r[i],c=r[i+1]-r[i];if(c+a>n)break;let l=a/s,f=c/s;o.push(t.slice(l,l+f))}return o}function di(t,e,r){let n=[];for(let s=0;s<e;s++){let o=s*r;n.push(t.slice(o,o+r))}return n}function pi(t,e,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<t;a++){let c=n[a+1]-n[a];if(c+i<=e.length){let l=e.subarray(i,c+i),f=o.decode(l);s.push(f),i+=c}}return s}return[]}var en="EXT_mesh_features",HC=en;async function zC(t,e){let r=new k(t);qC(r,e)}function kC(t,e){let r=new k(t);return JC(r,e),r.createBinaryChunk(),r.gltf}function qC(t,e){let r=t.gltf.json;if(r.meshes)for(let n of r.meshes)for(let s of n.primitives)jC(t,s,e)}function jC(t,e,r){if(!r?.gltf?.loadBuffers)return;let s=e.extensions?.[en]?.featureIds;if(s)for(let o of s){let i;if(typeof o.attribute<"u"){let a=`_FEATURE_ID_${o.attribute}`,c=e.attributes[a];i=t.getTypedArrayForAccessor(c)}else typeof o.texture<"u"&&r?.gltf?.loadImages?i=$r(t,o.texture,e):i=[];o.data=i}}function JC(t,e){let r=t.gltf.json.meshes;if(r)for(let n of r)for(let s of n.primitives)XC(t,s)}function WC(t,e,r,n){e.extensions||(e.extensions={});let s=e.extensions[en];s||(s={featureIds:[]},e.extensions[en]=s);let{featureIds:o}=s,i={featureCount:r.length,propertyTable:n,data:r};o.push(i),t.addObjectExtension(e,en,s)}function XC(t,e){let r=e.extensions?.[en];if(!r)return;let n=r.featureIds;n.forEach((s,o)=>{if(s.data){let{accessorKey:i,index:a}=YC(e.attributes),c=new Uint32Array(s.data);n[o]={featureCount:c.length,propertyTable:s.propertyTable,attribute:a},t.gltf.buffers.push({arrayBuffer:c.buffer,byteOffset:c.byteOffset,byteLength:c.byteLength});let l=t.addBufferView(c),f=t.addAccessor(l,{size:1,componentType:Ut(c),count:c.length});e.attributes[i]=f}})}function YC(t){let e="_FEATURE_ID_",r=Object.keys(t).filter(o=>o.indexOf(e)===0),n=-1;for(let o of r){let i=Number(o.substring(e.length));i>n&&(n=i)}return n++,{accessorKey:`${e}${n}`,index:n}}var gl={};me(gl,{createExtStructuralMetadata:()=>AS,decode:()=>QC,encode:()=>ZC,name:()=>KC});var tn="EXT_structural_metadata",KC=tn;async function QC(t,e){let r=new k(t);$C(r,e)}function ZC(t,e){let r=new k(t);return mS(r,e),r.createBinaryChunk(),r.gltf}function $C(t,e){if(!e.gltf?.loadBuffers)return;let r=t.getExtension(tn);r&&(e.gltf?.loadImages&&eS(t,r),tS(t,r))}function eS(t,e){let r=e.propertyTextures,n=t.gltf.json;if(r&&n.meshes)for(let s of n.meshes)for(let o of s.primitives)nS(t,r,o,e)}function tS(t,e){let r=e.schema;if(!r)return;let n=r.classes,s=e.propertyTables;if(n&&s)for(let o in n){let i=rS(s,o);i&&oS(t,r,i)}}function rS(t,e){for(let r of t)if(r.class===e)return r;return null}function nS(t,e,r,n){if(!e)return;let o=r.extensions?.[tn]?.propertyTextures;if(o)for(let i of o){let a=e[i];sS(t,a,r,n)}}function sS(t,e,r,n){if(!e.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);let s=e.class;for(let o in e.properties){let i=`${s}_${o}`,a=e.properties?.[o];if(!a)continue;a.data||(a.data=[]);let c=a.data,l=$r(t,a,r);l!==null&&(ui(t,i,l,c,r),a.data=c,n.dataAttributeNames.push(i))}}function oS(t,e,r){let n=e.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=iS(t,e,i,s,a);a.data=c}}}function iS(t,e,r,n,s){let o=[],i=s.values,a=t.getTypedArrayForBufferView(i),c=aS(t,r,s,n),l=cS(t,s,n);switch(r.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{o=lS(r,n,a,c);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${r.type}`);case"STRING":{o=pi(n,a,c,l);break}case"ENUM":{o=fS(e,r,n,a,c);break}default:throw new Error(`Unknown classProperty type ${r.type}`)}return o}function aS(t,e,r,n){return e.array&&typeof e.count>"u"&&typeof r.arrayOffsets<"u"?Qr(t,r.arrayOffsets,r.arrayOffsetType||"UINT32",n):null}function cS(t,e,r){return typeof e.stringOffsets<"u"?Qr(t,e.stringOffsets,e.stringOffsetType||"UINT32",r):null}function lS(t,e,r,n){let s=t.array,o=t.count,i=ps(t.type,t.componentType),a=r.byteLength/i,c;return t.componentType?c=Zr(r,t.type,t.componentType,a):c=r,s?n?hi(c,e,n,r.length,i):o?di(c,e,o):[]:c}function fS(t,e,r,n,s){let o=e.enumType;if(!o)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let i=t.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=ps(e.type,a),l=n.byteLength/c,f=Zr(n,e.type,a,l);if(f||(f=n),e.array){if(s)return uS({valuesData:f,numberOfElements:r,arrayOffsets:s,valuesDataBytesLength:n.length,elementSize:c,enumEntry:i});let u=e.count;return u?hS(f,r,u,i):[]}return ml(f,0,r,i)}function uS(t){let{valuesData:e,numberOfElements:r,arrayOffsets:n,valuesDataBytesLength:s,elementSize:o,enumEntry:i}=t,a=[];for(let c=0;c<r;c++){let l=n[c],f=n[c+1]-n[c];if(f+l>s)break;let u=l/o,h=f/o,d=ml(e,u,h,i);a.push(d)}return a}function hS(t,e,r,n){let s=[];for(let o=0;o<e;o++){let i=r*o,a=ml(t,i,r,n);s.push(a)}return s}function ml(t,e,r,n){let s=[];for(let o=0;o<r;o++)if(t instanceof BigInt64Array||t instanceof BigUint64Array)s.push("");else{let i=t[e+o],a=dS(n,i);a?s.push(a.name):s.push("")}return s}function dS(t,e){for(let r of t.values)if(r.value===e)return r;return null}var pS="schemaClassId";function mS(t,e){let r=t.getExtension(tn);if(r&&r.propertyTables)for(let n of r.propertyTables){let s=n.class,o=r.schema?.classes?.[s];n.properties&&o&&gS(n,o,t)}}function gS(t,e,r){for(let n in t.properties){let s=t.properties[n].data;if(s){let o=e.properties[n];if(o){let i=TS(s,o,r);t.properties[n]=i}}}}function AS(t,e,r=pS){let n=t.getExtension(tn);n||(n=t.addExtension(tn)),n.schema=xS(e,r,n.schema);let s=yS(e,r,n.schema);return n.propertyTables||(n.propertyTables=[]),n.propertyTables.push(s)-1}function xS(t,e,r){let n=r??{id:"schema_id"},s={properties:{}};for(let o of t){let i={type:o.elementType,componentType:o.componentType};s.properties[o.name]=i}return n.classes={},n.classes[e]=s,n}function yS(t,e,r){let n={class:e,count:0},s=0,o=r.classes?.[e];for(let i of t){if(s===0&&(s=i.values.length),s!==i.values.length&&i.values.length)throw new Error("Illegal values in attributes");o?.properties[i.name]&&(n.properties||(n.properties={}),n.properties[i.name]={values:0,data:i.values})}return n.count=s,n}function TS(t,e,r){let n={values:0};if(e.type==="STRING"){let{stringData:s,stringOffsets:o}=MS(t);n.stringOffsets=pl(o,r),n.values=pl(s,r)}else if(e.type==="SCALAR"&&e.componentType){let s=ES(t,e.componentType);n.values=pl(s,r)}return n}var bS={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:Int32Array,UINT64:Uint32Array,FLOAT32:Float32Array,FLOAT64:Float64Array};function ES(t,e){let r=[];for(let s of t)r.push(Number(s));let n=bS[e];if(!n)throw new Error("Illegal component type");return new n(r)}function MS(t){let e=new TextEncoder,r=[],n=0;for(let c of t){let l=e.encode(c);n+=l.length,r.push(l)}let s=new Uint8Array(n),o=[],i=0;for(let c of r)s.set(c,i),o.push(i),i+=c.length;o.push(i);let a=new Uint32Array(o);return{stringData:s,stringOffsets:a}}function pl(t,e){return e.gltf.buffers.push({arrayBuffer:wt(t.buffer),byteOffset:t.byteOffset,byteLength:t.byteLength}),e.addBufferView(t)}var Al={};me(Al,{decode:()=>BS,name:()=>_S});var Ag="EXT_feature_metadata",_S=Ag;async function BS(t,e){let r=new k(t);CS(r,e)}function CS(t,e){if(!e.gltf?.loadBuffers)return;let r=t.getExtension(Ag);r&&(e.gltf?.loadImages&&SS(t,r),IS(t,r))}function SS(t,e){let r=e.schema;if(!r)return;let n=r.classes,{featureTextures:s}=e;if(n&&s)for(let o in n){let i=n[o],a=vS(s,o);a&&FS(t,a,i)}}function IS(t,e){let r=e.schema;if(!r)return;let n=r.classes,s=e.featureTables;if(n&&s)for(let o in n){let i=wS(s,o);i&&LS(t,r,i)}}function wS(t,e){for(let r in t){let n=t[r];if(n.class===e)return n}return null}function vS(t,e){for(let r in t){let n=t[r];if(n.class===e)return n}return null}function LS(t,e,r){if(!r.class)return;let n=e.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=RS(t,e,i,s,a);a.data=c}}}function FS(t,e,r){let n=e.class;for(let s in r.properties){let o=e?.properties?.[s];if(o){let i=GS(t,o,n);o.data=i}}}function RS(t,e,r,n,s){let o=[],i=s.bufferView,a=t.getTypedArrayForBufferView(i),c=PS(t,r,s,n),l=OS(t,r,s,n);return r.type==="STRING"||r.componentType==="STRING"?o=pi(n,a,c,l):NS(r)&&(o=DS(r,n,a,c)),o}function PS(t,e,r,n){return e.type==="ARRAY"&&typeof e.componentCount>"u"&&typeof r.arrayOffsetBufferView<"u"?Qr(t,r.arrayOffsetBufferView,r.offsetType||"UINT32",n):null}function OS(t,e,r,n){return typeof r.stringOffsetBufferView<"u"?Qr(t,r.stringOffsetBufferView,r.offsetType||"UINT32",n):null}function NS(t){let e=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return e.includes(t.type)||typeof t.componentType<"u"&&e.includes(t.componentType)}function DS(t,e,r,n){let s=t.type==="ARRAY",o=t.componentCount,i="SCALAR",a=t.componentType||t.type,c=ps(i,a),l=r.byteLength/c,f=Zr(r,i,a,l);return s?n?hi(f,e,n,r.length,c):o?di(f,e,o):[]:f}function GS(t,e,r){let n=t.gltf.json;if(!n.meshes)return[];let s=[];for(let o of n.meshes)for(let i of o.primitives)US(t,r,e,s,i);return s}function US(t,e,r,n,s){let o={channels:r.channels,...r.texture},i=$r(t,o,s);i&&ui(t,e,i,n,s)}var xg="4.4.0-alpha.18";var rn=!0,yg=1735152710,Tl=12,mi=8,VS=1313821514,HS=5130562,zS=0,kS=0,qS=1;function jS(t,e=0){return`${String.fromCharCode(t.getUint8(e+0))}${String.fromCharCode(t.getUint8(e+1))}${String.fromCharCode(t.getUint8(e+2))}${String.fromCharCode(t.getUint8(e+3))}`}function Tg(t,e=0,r={}){let n=new DataView(t),{magic:s=yg}=r,o=n.getUint32(e,!1);return o===s||o===yg}function bg(t,e,r=0,n={}){let s=new DataView(e),o=jS(s,r+0),i=s.getUint32(r+4,rn),a=s.getUint32(r+8,rn);switch(Object.assign(t,{header:{byteOffset:r,byteLength:a,hasBinChunk:!1},type:o,version:i,json:{},binChunks:[]}),r+=Tl,t.version){case 1:return JS(t,s,r);case 2:return WS(t,s,r,n={});default:throw new Error(`Invalid GLB version ${t.version}. Only supports version 1 and 2.`)}}function JS(t,e,r){H(t.header.byteLength>Tl+mi);let n=e.getUint32(r+0,rn),s=e.getUint32(r+4,rn);return r+=mi,H(s===zS),xl(t,e,r,n),r+=n,r+=yl(t,e,r,t.header.byteLength),r}function WS(t,e,r,n){return H(t.header.byteLength>Tl+mi),XS(t,e,r,n),r+t.header.byteLength}function XS(t,e,r,n){for(;r+8<=t.header.byteLength;){let s=e.getUint32(r+0,rn),o=e.getUint32(r+4,rn);switch(r+=mi,o){case VS:xl(t,e,r,s);break;case HS:yl(t,e,r,s);break;case kS:n.strict||xl(t,e,r,s);break;case qS:n.strict||yl(t,e,r,s);break;default:break}r+=Ct(s,4)}return r}function xl(t,e,r,n){let s=new Uint8Array(e.buffer,r,n),i=new TextDecoder("utf8").decode(s);return t.json=JSON.parse(i),Ct(n,4)}function yl(t,e,r,n){return t.header.hasBinChunk=!0,t.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:e.buffer}),Ct(n,4)}function bl(t,e){if(t.startsWith("data:")||t.startsWith("http:")||t.startsWith("https:"))return t;let n=e?.core?.baseUri||e.baseUri||e.uri;if(!n)throw new Error(`'baseUri' must be provided to resolve relative url ${t}`);return n.substr(0,n.lastIndexOf("/")+1)+t}var Ml={};me(Ml,{decode:()=>iI,name:()=>oI});var YS="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",KS="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",QS=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]),ZS=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]),$S={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},eI={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function Eg(t,e,r,n,s,o="NONE"){let i=await tI();sI(i,i.exports[eI[s]],t,e,r,n,i.exports[$S[o||"NONE"]])}var El;async function tI(){return El||(El=rI()),El}async function rI(){let t=YS;WebAssembly.validate(QS)&&(t=KS,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let e=await WebAssembly.instantiate(nI(t),{});return await e.instance.exports.__wasm_call_ctors(),e.instance}function nI(t){let e=new Uint8Array(t.length);for(let n=0;n<t.length;++n){let s=t.charCodeAt(n);e[n]=s>96?s-71:s>64?s-65:s>47?s+4:s>46?63:62}let r=0;for(let n=0;n<t.length;++n)e[r++]=e[n]<60?ZS[e[n]]:(e[n]-60)*64+e[++n];return e.buffer.slice(0,r)}function sI(t,e,r,n,s,o,i){let a=t.exports.sbrk,c=n+3&-4,l=a(c*s),f=a(o.length),u=new Uint8Array(t.exports.memory.buffer);u.set(o,f);let h=e(l,n,s,f,o.length);if(h===0&&i&&i(l,c,s),r.set(u.subarray(l,l+n*s)),a(l-a(0)),h!==0)throw new Error(`Malformed buffer data: ${h}`)}var gi="EXT_meshopt_compression",oI=gi;async function iI(t,e){let r=new k(t);if(!e?.gltf?.decompressMeshes||!e.gltf?.loadBuffers)return;let n=[];for(let s of t.json.bufferViews||[])n.push(aI(r,s));await Promise.all(n),r.removeExtension(gi)}async function aI(t,e){let r=t.getObjectExtension(e,gi);if(r){let{byteOffset:n=0,byteLength:s=0,byteStride:o,count:i,mode:a,filter:c="NONE",buffer:l}=r,f=t.gltf.buffers[l],u=new Uint8Array(f.arrayBuffer,f.byteOffset+n,s),h=new Uint8Array(t.gltf.buffers[e.buffer].arrayBuffer,e.byteOffset,e.byteLength);await Eg(h,i,o,u,a,c),t.removeObjectExtension(e,gi)}}var _l={};me(_l,{name:()=>cI,preprocess:()=>lI});var nn="EXT_texture_webp",cI=nn;function lI(t,e){let r=new k(t);if(!yc("image/webp")){if(r.getRequiredExtensions().includes(nn))throw new Error(`gltf: Required extension ${nn} not supported by browser`);return}let{json:n}=r;for(let s of n.textures||[]){let o=r.getObjectExtension(s,nn);o&&(s.source=o.source),r.removeObjectExtension(s,nn)}r.removeExtension(nn)}var Bl={};me(Bl,{name:()=>fI,preprocess:()=>uI});var Ai="KHR_texture_basisu",fI=Ai;function uI(t,e){let r=new k(t),{json:n}=r;for(let s of n.textures||[]){let o=r.getObjectExtension(s,Ai);o&&(s.source=o.source,r.removeObjectExtension(s,Ai))}r.removeExtension(Ai)}var Sl={};me(Sl,{decode:()=>gI,encode:()=>AI,name:()=>pI,preprocess:()=>mI});function Mg(t){let e={};for(let r in t){let n=t[r];if(r!=="indices"){let s=Cl(n);e[r]=s}}return e}function Cl(t){let{buffer:e,size:r,count:n}=hI(t);return{value:e,size:r,byteOffset:0,count:n,type:fi(r),componentType:Ut(e)}}function hI(t){let e=t,r=1,n=0;return t&&t.value&&(e=t.value,r=t.size||1),e&&(ArrayBuffer.isView(e)||(e=dI(e,Float32Array)),n=e.length/r),{buffer:e,size:r,count:n}}function dI(t,e,r=!1){return t?Array.isArray(t)?new e(t):r&&!(t instanceof e)?new e(t):t:null}var Vt="KHR_draco_mesh_compression",pI=Vt;function mI(t,e,r){let n=new k(t);for(let s of _g(n))n.getObjectExtension(s,Vt)}async function gI(t,e,r){if(!e?.gltf?.decompressMeshes)return;let n=new k(t),s=[];for(let o of _g(n))n.getObjectExtension(o,Vt)&&s.push(xI(n,o,e,r));await Promise.all(s),n.removeExtension(Vt)}function AI(t,e={}){let r=new k(t);for(let n of r.json.meshes||[])yI(n,e),r.addRequiredExtension(Vt)}async function xI(t,e,r,n){let s=t.getObjectExtension(e,Vt);if(!s)return;let o=t.getTypedArrayForBufferView(s.bufferView),i=tr(o.buffer,o.byteOffset),a={...r};delete a["3d-tiles"];let c=await Fe(i,hs,a,n),l=Mg(c.attributes);for(let[f,u]of Object.entries(l))if(f in e.attributes){let h=e.attributes[f],d=t.getAccessor(h);d?.min&&d?.max&&(u.min=d.min,u.max=d.max)}e.attributes=l,c.indices&&(e.indices=Cl(c.indices)),t.removeObjectExtension(e,Vt),TI(e)}function yI(t,e,r=4,n,s){if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let o=n.DracoWriter.encodeSync({attributes:t}),i=s?.parseSync?.({attributes:t}),a=n._addFauxAttributes(i.attributes),c=n.addBufferView(o);return{primitives:[{attributes:a,mode:r,extensions:{[Vt]:{bufferView:c,attributes:a}}}]}}function TI(t){if(!t.attributes&&Object.keys(t.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*_g(t){for(let e of t.json.meshes||[])for(let r of e.primitives)yield r}var Il={};me(Il,{decode:()=>_I,name:()=>bI});var yi="KHR_texture_transform",bI=yi,xi=new x,EI=new j,MI=new j;async function _I(t,e){if(!new k(t).hasExtension(yi)||!e.gltf?.loadBuffers)return;let s=t.json.materials||[];for(let o=0;o<s.length;o++)BI(o,t)}function BI(t,e){let r=e.json.materials?.[t],n=[r?.pbrMetallicRoughness?.baseColorTexture,r?.emissiveTexture,r?.normalTexture,r?.occlusionTexture,r?.pbrMetallicRoughness?.metallicRoughnessTexture],s=[];for(let o of n)o&&o?.extensions?.[yi]&&CI(e,t,o,s)}function CI(t,e,r,n){let s=SI(r,n);if(!s)return;let o=t.json.meshes||[];for(let i of o)for(let a of i.primitives){let c=a.material;Number.isFinite(c)&&e===c&&II(t,a,s)}}function SI(t,e){let r=t.extensions?.[yi],{texCoord:n=0}=t,{texCoord:s=n}=r;if(!(e.findIndex(([i,a])=>i===n&&a===s)!==-1)){let i=LI(r);return n!==s&&(t.texCoord=s),e.push([n,s]),{originalTexCoord:n,texCoord:s,matrix:i}}return null}function II(t,e,r){let{originalTexCoord:n,texCoord:s,matrix:o}=r,i=e.attributes[`TEXCOORD_${n}`];if(Number.isFinite(i)){let a=t.json.accessors?.[i];if(a&&a.bufferView!==void 0){let c=t.json.bufferViews?.[a.bufferView];if(c){let{arrayBuffer:l,byteOffset:f}=t.buffers[c.buffer],u=(f||0)+(a.byteOffset||0)+(c.byteOffset||0),{ArrayType:h,length:d}=Kr(a,c),p=li[a.componentType],A=ci[a.type],m=c.byteStride||p*A,y=new Float32Array(d);for(let b=0;b<a.count;b++){let E=new h(l,u+b*m,2);xi.set(E[0],E[1],1),xi.transformByMatrix3(o),y.set([xi[0],xi[1]],b*A)}n===s?wI(a,t,y,a.bufferView):vI(s,a,e,t,y)}}}}function wI(t,e,r,n){t.componentType=5126,t.byteOffset=0;let i=(e.json.accessors||[]).reduce((l,f)=>f.bufferView===n?l+1:l,0)>1;e.buffers.push({arrayBuffer:wt(r.buffer),byteOffset:0,byteLength:r.buffer.byteLength});let a=e.buffers.length-1;if(e.json.bufferViews=e.json.bufferViews||[],i){e.json.bufferViews.push({buffer:a,byteLength:r.buffer.byteLength,byteOffset:0}),t.bufferView=e.json.bufferViews.length-1;return}let c=e.json.bufferViews[n];c&&(c.buffer=a,c.byteOffset=0,c.byteLength=r.buffer.byteLength,c.byteStride!==void 0&&delete c.byteStride)}function vI(t,e,r,n,s){n.buffers.push({arrayBuffer:wt(s.buffer),byteOffset:0,byteLength:s.buffer.byteLength}),n.json.bufferViews=n.json.bufferViews||[];let o=n.json.bufferViews;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:e.count,type:"VEC2"}),r.attributes[`TEXCOORD_${t}`]=i.length-1)}function LI(t){let{offset:e=[0,0],rotation:r=0,scale:n=[1,1]}=t,s=new j().set(1,0,0,0,1,0,e[0],e[1],1),o=EI.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),i=MI.set(n[0],0,0,0,n[1],0,0,0,1);return s.multiplyRight(o).multiplyRight(i)}var wl={};me(wl,{decode:()=>RI,encode:()=>PI,name:()=>FI});var mr="KHR_lights_punctual",FI=mr;async function RI(t){let e=new k(t),{json:r}=e,n=e.getExtension(mr);n&&(e.json.lights=n.lights,e.removeExtension(mr));for(let s of r.nodes||[]){let o=e.getObjectExtension(s,mr);o&&(s.light=o.light),e.removeObjectExtension(s,mr)}}async function PI(t){let e=new k(t),{json:r}=e;if(r.lights){let n=e.addExtension(mr);le(!n.lights),n.lights=r.lights,delete r.lights}if(e.json.lights){for(let n of e.json.lights){let s=n.node;e.addObjectExtension(s,mr,n)}delete e.json.lights}}var vl={};me(vl,{decode:()=>NI,encode:()=>DI,name:()=>OI});var ms="KHR_materials_unlit",OI=ms;async function NI(t){let e=new k(t),{json:r}=e;for(let n of r.materials||[])n.extensions&&n.extensions.KHR_materials_unlit&&(n.unlit=!0),e.removeObjectExtension(n,ms);e.removeExtension(ms)}function DI(t){let e=new k(t),{json:r}=e;if(e.materials)for(let n of r.materials||[])n.unlit&&(delete n.unlit,e.addObjectExtension(n,ms,{}),e.addExtension(ms))}var Ll={};me(Ll,{decode:()=>UI,encode:()=>VI,name:()=>GI});var gs="KHR_techniques_webgl",GI=gs;async function UI(t){let e=new k(t),{json:r}=e,n=e.getExtension(gs);if(n){let s=HI(n,e);for(let o of r.materials||[]){let i=e.getObjectExtension(o,gs);i&&(o.technique=Object.assign({},i,s[i.technique]),o.technique.values=zI(o.technique,e)),e.removeObjectExtension(o,gs)}e.removeExtension(gs)}}async function VI(t,e){}function HI(t,e){let{programs:r=[],shaders:n=[],techniques:s=[]}=t,o=new TextDecoder;return n.forEach(i=>{if(Number.isFinite(i.bufferView))i.code=o.decode(e.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 zI(t,e){let r=Object.assign({},t.values);return Object.keys(t.uniforms||{}).forEach(n=>{t.uniforms[n].value&&!(n in r)&&(r[n]=t.uniforms[n].value)}),Object.keys(r).forEach(n=>{typeof r[n]=="object"&&r[n].index!==void 0&&(r[n].texture=e.getTexture(r[n].index))}),r}var Bg=[gl,dl,Ml,_l,Bl,Sl,wl,vl,Ll,Il,Al];function Cg(t,e={},r){let n=Bg.filter(s=>Ig(s.name,e));for(let s of n)s.preprocess?.(t,e,r)}async function Sg(t,e={},r){let n=Bg.filter(s=>Ig(s.name,e));for(let s of n)await s.decode?.(t,e,r)}function Ig(t,e){let r=e?.gltf?.excludeExtensions||{};return!(t in r&&!r[t])}var Fl="KHR_binary_glTF";function wg(t){let e=new k(t),{json:r}=e;for(let n of r.images||[]){let s=e.getObjectExtension(n,Fl);s&&Object.assign(n,s),e.removeObjectExtension(n,Fl)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,e.removeExtension(Fl)}var vg={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},qI={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},Rl=class{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;normalize(e,r){this.json=e.json;let n=e.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${n.asset.version}`);return}if(!r.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(n),this._convertTopLevelObjectsToArrays(n),wg(e),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_addAsset(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(e){for(let r in vg)this._convertTopLevelObjectToArray(e,r)}_convertTopLevelObjectToArray(e,r){let n=e[r];if(!(!n||Array.isArray(n))){e[r]=[];for(let s in n){let o=n[s];o.id=o.id||s;let i=e[r].length;e[r].push(o),this.idToIndexMap[r][s]=i}}}_convertObjectIdsToArrayIndices(e){for(let r in vg)this._convertIdsToIndices(e,r);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(let r of e.textures)this._convertTextureIds(r);for(let r of e.meshes)this._convertMeshIds(r);for(let r of e.nodes)this._convertNodeIds(r);for(let r of e.scenes)this._convertSceneIds(r)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(let r of e.primitives){let{attributes:n,indices:s,material: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(e){e.children&&(e.children=e.children.map(r=>this._convertIdToIndex(r,"node"))),e.meshes&&(e.meshes=e.meshes.map(r=>this._convertIdToIndex(r,"mesh")))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map(r=>this._convertIdToIndex(r,"node")))}_convertIdsToIndices(e,r){e[r]||(console.warn(`gltf v1: json doesn't contain attribute ${r}`),e[r]=[]);for(let n of e[r])for(let s in n){let o=n[s],i=this._convertIdToIndex(o,s);n[s]=i}}_convertIdToIndex(e,r){let n=qI[r];if(n in this.idToIndexMap){let s=this.idToIndexMap[n][e];if(!Number.isFinite(s))throw new Error(`gltf v1: failed to resolve ${r} with id ${e}`);return s}return e}_updateObjects(e){for(let r of this.json.buffers)delete r.type}_updateMaterial(e){for(let r of e.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=e.textures.findIndex(o=>o.id===n);s!==-1&&(r.pbrMetallicRoughness.baseColorTexture={index:s})}}};function Lg(t,e={}){return new Rl().normalize(t,e)}async function Fg(t,e,r=0,n,s){return jI(t,e,r,n),Lg(t,{normalize:n?.gltf?.normalize}),Cg(t,n,s),n?.gltf?.loadBuffers&&t.json.buffers&&await JI(t,n,s),n?.gltf?.loadImages&&await WI(t,n,s),await Sg(t,n,s),t}function jI(t,e,r,n){if(n.core?.baseUri&&(t.baseUri=n.core?.baseUri),e instanceof ArrayBuffer&&!Tg(e,r,n.glb)&&(e=new TextDecoder().decode(e)),typeof e=="string")t.json=ic(e);else if(e instanceof ArrayBuffer){let i={};r=bg(i,e,r,n.glb),le(i.type==="glTF",`Invalid GLB magic string ${i.type}`),t._glb=i,t.json=i.json}else le(!1,"GLTF: must be ArrayBuffer or string");let s=t.json.buffers||[];if(t.buffers=new Array(s.length).fill(null),t._glb&&t._glb.header.hasBinChunk){let{binChunks:i}=t._glb;t.buffers[0]={arrayBuffer:i[0].arrayBuffer,byteOffset:i[0].byteOffset,byteLength:i[0].byteLength}}let o=t.json.images||[];t.images=new Array(o.length).fill({})}async function JI(t,e,r){let n=t.json.buffers||[];for(let s=0;s<n.length;++s){let o=n[s];if(o.uri){let{fetch:i}=r;le(i);let a=bl(o.uri,e),l=await(await r?.fetch?.(a))?.arrayBuffer?.();t.buffers[s]={arrayBuffer:l,byteOffset:0,byteLength:l.byteLength},delete o.uri}else t.buffers[s]===null&&(t.buffers[s]={arrayBuffer:new ArrayBuffer(o.byteLength),byteOffset:0,byteLength:o.byteLength})}}async function WI(t,e,r){let n=XI(t),s=t.json.images||[],o=[];for(let i of n)o.push(YI(t,s[i],i,e,r));return await Promise.all(o)}function XI(t){let e=new Set,r=t.json.textures||[];for(let n of r)n.source!==void 0&&e.add(n.source);return Array.from(e).sort()}async function YI(t,e,r,n,s){let o;if(e.uri&&!e.hasOwnProperty("bufferView")){let l=bl(e.uri,n),{fetch:f}=s;o=await(await f(l)).arrayBuffer(),e.bufferView={data:o}}if(Number.isFinite(e.bufferView)){let l=hg(t.json,t.buffers,e.bufferView);o=tr(l.buffer,l.byteOffset,l.byteLength)}le(o,"glTF image has no data");let i=n,a={...i,core:{...i?.core,mimeType:e.mimeType}},c=await Fe(o,[Vr,Gc],a,s);c&&c[0]&&(c={compressed:!0,mipmaps:!1,width:c[0].width,height:c[0].height,data:c[0]}),t.images=t.images||[],t.images[r]=c}var gr={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:xg,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:KI,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0}}};async function KI(t,e={},r){let n={...gr.options,...e};n.gltf={...gr.options.gltf,...n.gltf};let s=e?.glb?.byteOffset||0;return await Fg({},t,s,n,r)}var QI={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ZI={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},He={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},$I={magFilter:He.TEXTURE_MAG_FILTER,minFilter:He.TEXTURE_MIN_FILTER,wrapS:He.TEXTURE_WRAP_S,wrapT:He.TEXTURE_WRAP_T},e2={[He.TEXTURE_MAG_FILTER]:He.LINEAR,[He.TEXTURE_MIN_FILTER]:He.NEAREST_MIPMAP_LINEAR,[He.TEXTURE_WRAP_S]:He.REPEAT,[He.TEXTURE_WRAP_T]:He.REPEAT};function t2(){return{id:"default-sampler",parameters:e2}}function r2(t){return ZI[t]}function n2(t){return QI[t]}var Pl=class{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(e,r={}){let{json:n,buffers:s=[],images:o=[]}=e,{baseUri:i=""}=e;return le(n),this.baseUri=i,this.buffers=s,this.images=o,this.jsonUnprocessed=n,this.json=this._resolveTree(e.json,r),this.json}_resolveTree(e,r={}){let n={...e};return this.json=n,e.bufferViews&&(n.bufferViews=e.bufferViews.map((s,o)=>this._resolveBufferView(s,o))),e.images&&(n.images=e.images.map((s,o)=>this._resolveImage(s,o))),e.samplers&&(n.samplers=e.samplers.map((s,o)=>this._resolveSampler(s,o))),e.textures&&(n.textures=e.textures.map((s,o)=>this._resolveTexture(s,o))),e.accessors&&(n.accessors=e.accessors.map((s,o)=>this._resolveAccessor(s,o))),e.materials&&(n.materials=e.materials.map((s,o)=>this._resolveMaterial(s,o))),e.meshes&&(n.meshes=e.meshes.map((s,o)=>this._resolveMesh(s,o))),e.nodes&&(n.nodes=e.nodes.map((s,o)=>this._resolveNode(s,o)),n.nodes=n.nodes.map((s,o)=>this._resolveNodeChildren(s))),e.skins&&(n.skins=e.skins.map((s,o)=>this._resolveSkin(s,o))),e.scenes&&(n.scenes=e.scenes.map((s,o)=>this._resolveScene(s,o))),typeof this.json.scene=="number"&&n.scenes&&(n.scene=n.scenes[this.json.scene]),n}getScene(e){return this._get(this.json.scenes,e)}getNode(e){return this._get(this.json.nodes,e)}getSkin(e){return this._get(this.json.skins,e)}getMesh(e){return this._get(this.json.meshes,e)}getMaterial(e){return this._get(this.json.materials,e)}getAccessor(e){return this._get(this.json.accessors,e)}getCamera(e){return this._get(this.json.cameras,e)}getTexture(e){return this._get(this.json.textures,e)}getSampler(e){return this._get(this.json.samplers,e)}getImage(e){return this._get(this.json.images,e)}getBufferView(e){return this._get(this.json.bufferViews,e)}getBuffer(e){return this._get(this.json.buffers,e)}_get(e,r){if(typeof r=="object")return r;let n=e&&e[r];return n||console.warn(`glTF file error: Could not find ${e}[${r}]`),n}_resolveScene(e,r){return{...e,id:e.id||`scene-${r}`,nodes:(e.nodes||[]).map(n=>this.getNode(n))}}_resolveNode(e,r){let n={...e,id:e?.id||`node-${r}`};return e.mesh!==void 0&&(n.mesh=this.getMesh(e.mesh)),e.camera!==void 0&&(n.camera=this.getCamera(e.camera)),e.skin!==void 0&&(n.skin=this.getSkin(e.skin)),e.meshes!==void 0&&e.meshes.length&&(n.mesh=e.meshes.reduce((s,o)=>{let i=this.getMesh(o);return s.id=i.id,s.primitives=s.primitives.concat(i.primitives),s},{primitives:[]})),n}_resolveNodeChildren(e){return e.children&&(e.children=e.children.map(r=>this.getNode(r))),e}_resolveSkin(e,r){let n=typeof e.inverseBindMatrices=="number"?this.getAccessor(e.inverseBindMatrices):void 0;return{...e,id:e.id||`skin-${r}`,inverseBindMatrices:n}}_resolveMesh(e,r){let n={...e,id:e.id||`mesh-${r}`,primitives:[]};return e.primitives&&(n.primitives=e.primitives.map(s=>{let 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(e,r){let n={...e,id:e.id||`material-${r}`};if(n.normalTexture&&(n.normalTexture={...n.normalTexture},n.normalTexture.texture=this.getTexture(n.normalTexture.index)),n.occlusionTexture&&(n.occlusionTexture={...n.occlusionTexture},n.occlusionTexture.texture=this.getTexture(n.occlusionTexture.index)),n.emissiveTexture&&(n.emissiveTexture={...n.emissiveTexture},n.emissiveTexture.texture=this.getTexture(n.emissiveTexture.index)),n.emissiveFactor||(n.emissiveFactor=n.emissiveTexture?[1,1,1]:[0,0,0]),n.pbrMetallicRoughness){n.pbrMetallicRoughness={...n.pbrMetallicRoughness};let s=n.pbrMetallicRoughness;s.baseColorTexture&&(s.baseColorTexture={...s.baseColorTexture},s.baseColorTexture.texture=this.getTexture(s.baseColorTexture.index)),s.metallicRoughnessTexture&&(s.metallicRoughnessTexture={...s.metallicRoughnessTexture},s.metallicRoughnessTexture.texture=this.getTexture(s.metallicRoughnessTexture.index))}return n}_resolveAccessor(e,r){let n=r2(e.componentType),s=n2(e.type),o=n*s,i={...e,id:e.id||`accessor-${r}`,bytesPerComponent:n,components:s,bytesPerElement:o,value:void 0,bufferView:void 0,sparse:void 0};if(e.bufferView!==void 0&&(i.bufferView=this.getBufferView(e.bufferView)),i.bufferView){let a=i.bufferView.buffer,{ArrayType:c,byteLength:l}=Kr(i,i.bufferView),f=(i.bufferView.byteOffset||0)+(i.byteOffset||0)+a.byteOffset,u=Dn(a.arrayBuffer,f,l);i.bufferView.byteStride&&(u=this._getValueFromInterleavedBuffer(a,f,i.bufferView.byteStride,i.bytesPerElement,i.count)),i.value=new c(u)}return i}_getValueFromInterleavedBuffer(e,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(e.arrayBuffer.slice(c,c+s)),a*s)}return i.buffer}_resolveTexture(e,r){return{...e,id:e.id||`texture-${r}`,sampler:typeof e.sampler=="number"?this.getSampler(e.sampler):t2(),source:typeof e.source=="number"?this.getImage(e.source):void 0}}_resolveSampler(e,r){let n={id:e.id||`sampler-${r}`,...e,parameters:{}};for(let s in n){let o=this._enumSamplerParameter(s);o!==void 0&&(n.parameters[o]=n[s])}return n}_enumSamplerParameter(e){return $I[e]}_resolveImage(e,r){let n={...e,id:e.id||`image-${r}`,image:null,bufferView:e.bufferView!==void 0?this.getBufferView(e.bufferView):void 0},s=this.images[r];return s&&(n.image=s),n}_resolveBufferView(e,r){let n=e.buffer,s=this.buffers[n].arrayBuffer,o=this.buffers[n].byteOffset||0;return e.byteOffset&&(o+=e.byteOffset),{id:`bufferView-${r}`,...e,buffer:this.buffers[n],data:new Uint8Array(s,o,e.byteLength)}}_resolveCamera(e,r){let n={...e,id:e.id||`camera-${r}`};return n.perspective,n.orthographic,n}};function As(t,e){return new Pl().postProcess(t,e)}var Ti={URI:0,EMBEDDED:1};function bi(t,e,r,n){t.rotateYtoZ=!0;let s=(t.byteOffset||0)+(t.byteLength||0)-r;if(s===0)throw new Error("glTF byte length must be greater than 0.");return t.gltfUpAxis=n?.["3d-tiles"]&&n["3d-tiles"].assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",t.gltfArrayBuffer=tr(e,r,s),t.gltfByteOffset=0,t.gltfByteLength=s,r%4===0||console.warn(`${t.type}: embedded glb is not aligned to a 4-byte boundary.`),(t.byteOffset||0)+(t.byteLength||0)}async function Ei(t,e,r,n){let s=r?.["3d-tiles"]||{};if(s2(t,e,r),s.loadGLTF){if(!n)return;if(t.gltfUrl){let{fetch:o}=n,i=await o(t.gltfUrl,r?.core);t.gltfArrayBuffer=await i.arrayBuffer(),t.gltfByteOffset=0}if(t.gltfArrayBuffer){let o=await Fe(t.gltfArrayBuffer,gr,r,n);t.gltf=As(o),t.gpuMemoryUsageInBytes=ds(t.gltf),delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength}}}function s2(t,e,r){switch(e){case Ti.URI:if(t.gltfArrayBuffer){let n=new Uint8Array(t.gltfArrayBuffer,t.gltfByteOffset),o=new TextDecoder().decode(n);t.gltfUrl=o.replace(/[\s\0]+$/,"")}delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength;break;case Ti.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function Rg(t,e,r,n,s){r=o2(t,e,r,n,s),await Ei(t,Ti.EMBEDDED,n,s);let o=t?.gltf?.extensions;return o&&o.CESIUM_RTC&&(t.rtcCenter=o.CESIUM_RTC.center),r}function o2(t,e,r,n,s){r=Gt(t,e,r),r=Xr(t,e,r),r=Yr(t,e,r,n),r=bi(t,e,r,n);let o=new xt(t.featureTableJson,t.featureTableBinary);return t.rtcCenter=o.getGlobalProperty("RTC_CENTER",N.FLOAT,3),r}async function Pg(t,e,r,n,s){return r=i2(t,e,r,n,s),await Ei(t,t.gltfFormat||0,n,s),r}function i2(t,e,r,n,s){if(r=Gt(t,e,r),t.version!==1)throw new Error(`Instanced 3D Model version ${t.version} is not supported`);r=Xr(t,e,r);let o=new DataView(e);if(t.gltfFormat=o.getUint32(r,!0),r+=4,r=Yr(t,e,r,n),r=bi(t,e,r,n),!t?.header?.featureTableJsonByteLength||t.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let i=new xt(t.featureTableJson,t.featureTableBinary),a=i.getGlobalProperty("INSTANCES_LENGTH");if(i.featuresLength=a,!Number.isFinite(a))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");t.eastNorthUp=i.getGlobalProperty("EAST_NORTH_UP"),t.rtcCenter=i.getGlobalProperty("RTC_CENTER",N.FLOAT,3);let c=new pr(t.batchTableJson,t.batchTableBinary,a);return a2(t,i,c,a),r}function a2(t,e,r,n){let s=new Array(n),o=new x,i=new x,a=new x,c=new x,l=new j,f=new rt,u=new x,h={},d=new O,p=[],A=[],m=[],y=[];for(let b=0;b<n;b++){let E;if(e.hasProperty("POSITION"))E=e.getProperty("POSITION",N.FLOAT,3,b,o);else if(e.hasProperty("POSITION_QUANTIZED")){E=e.getProperty("POSITION_QUANTIZED",N.UNSIGNED_SHORT,3,b,o);let g=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",N.FLOAT,3);if(!g)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let S=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",N.FLOAT,3);if(!S)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let F=65535;for(let R=0;R<3;R++)E[R]=E[R]/F*S[R]+g[R]}if(!E)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");o.copy(E),h.translation=o,t.normalUp=e.getProperty("NORMAL_UP",N.FLOAT,3,b,p),t.normalRight=e.getProperty("NORMAL_RIGHT",N.FLOAT,3,b,A);let M=!1;if(t.normalUp){if(!t.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");t.hasCustomOrientation=!0}else{if(t.octNormalUp=e.getProperty("NORMAL_UP_OCT32P",N.UNSIGNED_SHORT,2,b,p),t.octNormalRight=e.getProperty("NORMAL_RIGHT_OCT32P",N.UNSIGNED_SHORT,2,b,A),t.octNormalUp)throw t.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");t.eastNorthUp?(U.WGS84.eastNorthUpToFixedFrame(o,d),d.getRotationMatrix3(l)):l.identity()}M&&(c.copy(i).cross(a).normalize(),l.setColumn(0,i),l.setColumn(1,a),l.setColumn(2,c)),f.fromMatrix3(l),h.rotation=f,u.set(1,1,1);let B=e.getProperty("SCALE",N.FLOAT,1,b,m);Number.isFinite(B)&&u.multiplyByScalar(B);let C=e.getProperty("SCALE_NON_UNIFORM",N.FLOAT,3,b,p);C&&u.scale(C),h.scale=u;let v=e.getProperty("BATCH_ID",N.UNSIGNED_SHORT,1,b,y);v===void 0&&(v=b);let _=new O().fromQuaternion(h.rotation);d.identity(),d.translate(h.translation),d.multiplyRight(_),d.scale(h.scale);let T=d.clone();s[b]={modelMatrix:T,batchId:v}}t.instances=s}async function Og(t,e,r,n,s,o){r=Gt(t,e,r);let i=new DataView(e);for(t.tilesLength=i.getUint32(r,!0),r+=4,t.tiles=[];t.tiles.length<t.tilesLength&&(t.byteLength||0)-r>12;){let a={shape:"tile3d"};t.tiles.push(a),r=await o(e,r,n,s,a)}return r}async function Ng(t,e,r,n){if(t.rotateYtoZ=!0,t.gltfUpAxis=r?.["3d-tiles"]?.assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",r?.["3d-tiles"]?.loadGLTF){if(!n)return e.byteLength;let s=await Fe(e,gr,r,n);t.gltf=As(s),t.gpuMemoryUsageInBytes=ds(t.gltf)}else t.gltfArrayBuffer=e;return e.byteLength}async function Ol(t,e=0,r,n,s={shape:"tile3d"}){switch(s.byteOffset=e,s.type=zm(t,e),s.type){case hr.COMPOSITE:return await Og(s,t,e,r,n,Ol);case hr.BATCHED_3D_MODEL:return await Rg(s,t,e,r,n);case hr.GLTF:return await Ng(s,t,r,n);case hr.INSTANCED_3D_MODEL:return await Pg(s,t,e,r,n);case hr.POINT_CLOUD:return await fg(s,t,e,r,n);default:throw new Error(`3DTileLoader: unknown type ${s.type}`)}}async function Nl(t,e,r){if(new Uint32Array(t.slice(0,4))[0]!==1952609651)throw new Error("Wrong subtree file magic number");if(new Uint32Array(t.slice(4,8))[0]!==1)throw new Error("Wrong subtree file verson, must be 1");let o=Dg(t.slice(8,16)),i=new Uint8Array(t,24,o),c=new TextDecoder("utf8").decode(i),l=JSON.parse(c),f=Dg(t.slice(16,24)),u=new ArrayBuffer(0);if(f&&(u=t.slice(24+o)),await Mi(l,l.tileAvailability,u,r),Array.isArray(l.contentAvailability))for(let h of l.contentAvailability)await Mi(l,h,u,r);else await Mi(l,l.contentAvailability,u,r);return await Mi(l,l.childSubtreeAvailability,u,r),l}async function Mi(t,e,r,n){let s=Number.isFinite(e.bitstream)?e.bitstream:e.bufferView;if(typeof s!="number")return;let o=t.bufferViews[s],i=t.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}`,f=await(await n.fetch(c)).arrayBuffer();e.explicitBitstream=new Uint8Array(f,o.byteOffset,o.byteLength);return}let a=t.buffers.slice(0,o.buffer).reduce((c,l)=>c+l.byteLength,0);e.explicitBitstream=new Uint8Array(r.slice(a,a+i.byteLength),o.byteOffset,o.byteLength)}function Dg(t){let e=new DataView(t),r=e.getUint32(0,!0),n=e.getUint32(4,!0);return r+2**32*n}var _i={dataType:null,batchType:null,id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:ii,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:Nl,options:{}};var o0=D(Kt(),1);var t0=D(Kt(),1);var ze=null;try{ze=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Z(t,e,r){this.low=t|0,this.high=e|0,this.unsigned=!!r}Z.prototype.__isLong__;Object.defineProperty(Z.prototype,"__isLong__",{value:!0});function xe(t){return(t&&t.__isLong__)===!0}function Gg(t){var e=Math.clz32(t&-t);return t?31-e:e}Z.isLong=xe;var Ug={},Vg={};function Ar(t,e){var r,n,s;return e?(t>>>=0,(s=0<=t&&t<256)&&(n=Vg[t],n)?n:(r=q(t,0,!0),s&&(Vg[t]=r),r)):(t|=0,(s=-128<=t&&t<128)&&(n=Ug[t],n)?n:(r=q(t,t<0?-1:0,!1),s&&(Ug[t]=r),r))}Z.fromInt=Ar;function ke(t,e){if(isNaN(t))return e?yt:Ze;if(e){if(t<0)return yt;if(t>=qg)return Wg}else{if(t<=-zg)return Se;if(t+1>=zg)return Jg}return t<0?ke(-t,e).neg():q(t%on|0,t/on|0,e)}Z.fromNumber=ke;function q(t,e,r){return new Z(t,e,r)}Z.fromBits=q;var Bi=Math.pow;function Gl(t,e,r){if(t.length===0)throw Error("empty string");if(typeof e=="number"?(r=e,e=!1):e=!!e,t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return e?yt:Ze;if(r=r||10,r<2||36<r)throw RangeError("radix");var n;if((n=t.indexOf("-"))>0)throw Error("interior hyphen");if(n===0)return Gl(t.substring(1),e,r).neg();for(var s=ke(Bi(r,8)),o=Ze,i=0;i<t.length;i+=8){var a=Math.min(8,t.length-i),c=parseInt(t.substring(i,i+a),r);if(a<8){var l=ke(Bi(r,a));o=o.mul(l).add(ke(c))}else o=o.mul(s),o=o.add(ke(c))}return o.unsigned=e,o}Z.fromString=Gl;function $e(t,e){return typeof t=="number"?ke(t,e):typeof t=="string"?Gl(t,e):q(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}Z.fromValue=$e;var Hg=1<<16,c2=1<<24,on=Hg*Hg,qg=on*on,zg=qg/2,kg=Ar(c2),Ze=Ar(0);Z.ZERO=Ze;var yt=Ar(0,!0);Z.UZERO=yt;var sn=Ar(1);Z.ONE=sn;var jg=Ar(1,!0);Z.UONE=jg;var Dl=Ar(-1);Z.NEG_ONE=Dl;var Jg=q(-1,2147483647,!1);Z.MAX_VALUE=Jg;var Wg=q(-1,-1,!0);Z.MAX_UNSIGNED_VALUE=Wg;var Se=q(0,-2147483648,!1);Z.MIN_VALUE=Se;var I=Z.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low};I.toNumber=function(){return this.unsigned?(this.high>>>0)*on+(this.low>>>0):this.high*on+(this.low>>>0)};I.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Se)){var r=ke(e),n=this.div(r),s=n.mul(r).sub(this);return n.toString(e)+s.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var o=ke(Bi(e,6),this.unsigned),i=this,a="";;){var c=i.div(o),l=i.sub(c.mul(o)).toInt()>>>0,f=l.toString(e);if(i=c,i.isZero())return f+a;for(;f.length<6;)f="0"+f;a=""+f+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(Se)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,r=31;r>0&&!(e&1<<r);r--);return this.high!=0?r+33:r+1};I.isZero=function(){return this.high===0&&this.low===0};I.eqz=I.isZero;I.isNegative=function(){return!this.unsigned&&this.high<0};I.isPositive=function(){return this.unsigned||this.high>=0};I.isOdd=function(){return(this.low&1)===1};I.isEven=function(){return(this.low&1)===0};I.equals=function(e){return xe(e)||(e=$e(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};I.eq=I.equals;I.notEquals=function(e){return!this.eq(e)};I.neq=I.notEquals;I.ne=I.notEquals;I.lessThan=function(e){return this.comp(e)<0};I.lt=I.lessThan;I.lessThanOrEqual=function(e){return this.comp(e)<=0};I.lte=I.lessThanOrEqual;I.le=I.lessThanOrEqual;I.greaterThan=function(e){return this.comp(e)>0};I.gt=I.greaterThan;I.greaterThanOrEqual=function(e){return this.comp(e)>=0};I.gte=I.greaterThanOrEqual;I.ge=I.greaterThanOrEqual;I.compare=function(e){if(xe(e)||(e=$e(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1};I.comp=I.compare;I.negate=function(){return!this.unsigned&&this.eq(Se)?Se:this.not().add(sn)};I.neg=I.negate;I.add=function(e){xe(e)||(e=$e(e));var r=this.high>>>16,n=this.high&65535,s=this.low>>>16,o=this.low&65535,i=e.high>>>16,a=e.high&65535,c=e.low>>>16,l=e.low&65535,f=0,u=0,h=0,d=0;return d+=o+l,h+=d>>>16,d&=65535,h+=s+c,u+=h>>>16,h&=65535,u+=n+a,f+=u>>>16,u&=65535,f+=r+i,f&=65535,q(h<<16|d,f<<16|u,this.unsigned)};I.subtract=function(e){return xe(e)||(e=$e(e)),this.add(e.neg())};I.sub=I.subtract;I.multiply=function(e){if(this.isZero())return this;if(xe(e)||(e=$e(e)),ze){var r=ze.mul(this.low,this.high,e.low,e.high);return q(r,ze.get_high(),this.unsigned)}if(e.isZero())return this.unsigned?yt:Ze;if(this.eq(Se))return e.isOdd()?Se:Ze;if(e.eq(Se))return this.isOdd()?Se:Ze;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(kg)&&e.lt(kg))return ke(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,s=this.high&65535,o=this.low>>>16,i=this.low&65535,a=e.high>>>16,c=e.high&65535,l=e.low>>>16,f=e.low&65535,u=0,h=0,d=0,p=0;return p+=i*f,d+=p>>>16,p&=65535,d+=o*f,h+=d>>>16,d&=65535,d+=i*l,h+=d>>>16,d&=65535,h+=s*f,u+=h>>>16,h&=65535,h+=o*l,u+=h>>>16,h&=65535,h+=i*c,u+=h>>>16,h&=65535,u+=n*f+s*l+o*c+i*a,u&=65535,q(d<<16|p,u<<16|h,this.unsigned)};I.mul=I.multiply;I.divide=function(e){if(xe(e)||(e=$e(e)),e.isZero())throw Error("division by zero");if(ze){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?ze.div_u:ze.div_s)(this.low,this.high,e.low,e.high);return q(r,ze.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?yt:Ze;var n,s,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return yt;if(e.gt(this.shru(1)))return jg;o=yt}else{if(this.eq(Se)){if(e.eq(sn)||e.eq(Dl))return Se;if(e.eq(Se))return sn;var i=this.shr(1);return n=i.div(e).shl(1),n.eq(Ze)?e.isNegative()?sn:Dl:(s=this.sub(e.mul(n)),o=n.add(s.div(e)),o)}else if(e.eq(Se))return this.unsigned?yt:Ze;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=Ze}for(s=this;s.gte(e);){n=Math.max(1,Math.floor(s.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),c=a<=48?1:Bi(2,a-48),l=ke(n),f=l.mul(e);f.isNegative()||f.gt(s);)n-=c,l=ke(n,this.unsigned),f=l.mul(e);l.isZero()&&(l=sn),o=o.add(l),s=s.sub(f)}return o};I.div=I.divide;I.modulo=function(e){if(xe(e)||(e=$e(e)),ze){var r=(this.unsigned?ze.rem_u:ze.rem_s)(this.low,this.high,e.low,e.high);return q(r,ze.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};I.mod=I.modulo;I.rem=I.modulo;I.not=function(){return q(~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?Gg(this.low):Gg(this.high)+32};I.ctz=I.countTrailingZeros;I.and=function(e){return xe(e)||(e=$e(e)),q(this.low&e.low,this.high&e.high,this.unsigned)};I.or=function(e){return xe(e)||(e=$e(e)),q(this.low|e.low,this.high|e.high,this.unsigned)};I.xor=function(e){return xe(e)||(e=$e(e)),q(this.low^e.low,this.high^e.high,this.unsigned)};I.shiftLeft=function(e){return xe(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?q(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):q(0,this.low<<e-32,this.unsigned)};I.shl=I.shiftLeft;I.shiftRight=function(e){return xe(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?q(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):q(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};I.shr=I.shiftRight;I.shiftRightUnsigned=function(e){return xe(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?q(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):e===32?q(this.high,0,this.unsigned):q(this.high>>>e-32,0,this.unsigned)};I.shru=I.shiftRightUnsigned;I.shr_u=I.shiftRightUnsigned;I.rotateLeft=function(e){var r;return xe(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?q(this.high,this.low,this.unsigned):e<32?(r=32-e,q(this.low<<e|this.high>>>r,this.high<<e|this.low>>>r,this.unsigned)):(e-=32,r=32-e,q(this.high<<e|this.low>>>r,this.low<<e|this.high>>>r,this.unsigned))};I.rotl=I.rotateLeft;I.rotateRight=function(e){var r;return xe(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?q(this.high,this.low,this.unsigned):e<32?(r=32-e,q(this.high<<r|this.low>>>e,this.low<<r|this.high>>>e,this.unsigned)):(e-=32,r=32-e,q(this.low<<r|this.high>>>e,this.high<<r|this.low>>>e,this.unsigned))};I.rotr=I.rotateRight;I.toSigned=function(){return this.unsigned?q(this.low,this.high,!1):this};I.toUnsigned=function(){return this.unsigned?this:q(this.low,this.high,!0)};I.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};I.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]};I.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]};Z.fromBytes=function(e,r,n){return n?Z.fromBytesLE(e,r):Z.fromBytesBE(e,r)};Z.fromBytesLE=function(e,r){return new Z(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)};Z.fromBytesBE=function(e,r){return new Z(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)};var an=Z;var l2=16;function xs(t){t==="X"&&(t="");let e=t.padEnd(l2,"0");return an.fromString(e,!0,16)}function Ul(t){if(t.isZero())return"X";let e=t.countTrailingZeros(),r=e%4;e=(e-r)/4;let n=e;e*=4;let o=t.shiftRightUnsigned(e).toString(16).replace(/0+$/,"");return Array(17-n-o.length).join("0")+o}function Vl(t,e){let r=f2(t).shiftRightUnsigned(2);return t.add(an.fromNumber(2*e+1-4).multiply(r))}function f2(t){return t.and(t.not().add(1))}var u2=3,h2=30,d2=2*h2+1,Xg=180/Math.PI;function Kg(t){if(t.length===0)throw new Error(`Invalid Hilbert quad key ${t}`);let e=t.split("/"),r=parseInt(e[0],10),n=e[1],s=n.length,o=0,i=[0,0];for(let a=s-1;a>=0;a--){o=s-a;let c=n[a],l=0,f=0;c==="1"?f=1:c==="2"?(l=1,f=1):c==="3"&&(l=1);let u=Math.pow(2,o-1);p2(u,i,l,f),i[0]+=u*l,i[1]+=u*f}if(r%2===1){let a=i[0];i[0]=i[1],i[1]=a}return{face:r,ij:i,level:o}}function Qg(t){if(t.isZero())return"";let e=t.toString(2);for(;e.length<u2+d2;)e="0"+e;let r=e.lastIndexOf("1"),n=e.substring(0,3),s=e.substring(3,r),o=s.length/2,i=an.fromString(n,!0,2).toString(10),a="";if(o!==0)for(a=an.fromString(s,!0,2).toString(4);a.length<o;)a="0"+a;return`${i}/${a}`}function Hl(t,e,r){let n=1<<e;return[(t[0]+r[0])/n,(t[1]+r[1])/n]}function Yg(t){return t>=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function zl(t){return[Yg(t[0]),Yg(t[1])]}function kl(t,[e,r]){switch(t){case 0:return[1,e,r];case 1:return[-e,1,r];case 2:return[-e,-r,1];case 3:return[-1,-r,-e];case 4:return[r,-1,-e];case 5:return[r,e,-1];default:throw new Error("Invalid face")}}function ql([t,e,r]){let n=Math.atan2(r,Math.sqrt(t*t+e*e));return[Math.atan2(e,t)*Xg,n*Xg]}function p2(t,e,r,n){if(n===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);let s=e[0];e[0]=e[1],e[1]=s}}function Zg(t){let e=Hl(t.ij,t.level,[.5,.5]),r=zl(e),n=kl(t.face,r);return ql(n)}var m2=100;function jl(t){let{face:e,ij:r,level:n}=t,s=[[0,0],[0,1],[1,1],[1,0],[0,0]],o=Math.max(1,Math.ceil(m2*Math.pow(2,-n))),i=new Float64Array(4*o*2+2),a=0,c=0;for(let l=0;l<4;l++){let f=s[l].slice(0),u=s[l+1],h=(u[0]-f[0])/o,d=(u[1]-f[1])/o;for(let p=0;p<o;p++){f[0]+=h,f[1]+=d;let A=Hl(r,n,f),m=zl(A),y=kl(e,m),b=ql(y);Math.abs(b[1])>89.999&&(b[0]=c);let E=b[0]-c;b[0]+=E>180?-360:E<-180?360:0,i[a++]=b[0],i[a++]=b[1],c=b[0]}}return i[a++]=i[0],i[a++]=i[1],i}function cn(t){let e=g2(t);return Kg(e)}function g2(t){if(t.indexOf("/")>0)return t;let e=xs(t);return Qg(e)}function Jl(t){let e=cn(t);return Zg(e)}function e0(t){let e;if(t.face===2||t.face===5){let r=null,n=0;for(let s=0;s<4;s++){let o=`${t.face}/${s}`,i=cn(o),a=jl(i);(typeof r>"u"||r===null)&&(r=new Float64Array(4*a.length)),r.set(a,n),n+=a.length}e=$g(r)}else{let r=jl(t);e=$g(r)}return e}function $g(t){if(t.length%2!==0)throw new Error("Invalid corners");let e=[],r=[];for(let n=0;n<t.length;n+=2)e.push(t[n]),r.push(t[n+1]);return e.sort((n,s)=>n-s),r.sort((n,s)=>n-s),{west:e[0],east:e[e.length-1],north:r[r.length-1],south:r[0]}}function Wl(t,e){let r=e?.minimumHeight||0,n=e?.maximumHeight||0,s=cn(t),o=e0(s),i=o.west,a=o.south,c=o.east,l=o.north,f=[];return f.push(new x(i,l,r)),f.push(new x(c,l,r)),f.push(new x(c,a,r)),f.push(new x(i,a,r)),f.push(new x(i,l,n)),f.push(new x(c,l,n)),f.push(new x(c,a,n)),f.push(new x(i,a,n)),f}function Ci(t){let e=t.token,r={minimumHeight:t.minimumHeight,maximumHeight:t.maximumHeight},n=Wl(e,r),s=Jl(e),o=s[0],i=s[1],a=U.WGS84.cartographicToCartesian([o,i,r.maximumHeight]),c=new x(a[0],a[1],a[2]);n.push(c);let l=Kn(n);return[...l.center,...l.halfAxes]}var A2=4,x2=8,y2={QUADTREE:A2,OCTREE:x2};function T2(t,e,r){if(t?.box){let n=xs(t.s2VolumeInfo.token),s=Vl(n,e),o=Ul(s),i={...t.s2VolumeInfo};switch(i.token=o,r){case"OCTREE":let l=t.s2VolumeInfo,f=l.maximumHeight-l.minimumHeight,u=f/2,h=l.minimumHeight+f/2;l.minimumHeight=h-u,l.maximumHeight=h+u;break;default:break}return{box:Ci(i),s2VolumeInfo:i}}}async function Yl(t){let{subtree:e,subtreeData:r={level:0,x:0,y:0,z:0},parentData:n={mortonIndex:0,localLevel:-1,localX:0,localY:0,localZ:0},childIndex:s=0,implicitOptions:o,loaderOptions:i,s2VolumeBox:a}=t,{subdivisionScheme:c,subtreeLevels:l,maximumLevel:f,contentUrlTemplate:u,subtreesUriTemplate:h,basePath:d}=o,p={children:[],lodMetricValue:0,contentUrl:""};if(!f)return ec.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${u} won't be loaded...`),p;let A=n.localLevel+1,m=r.level+A;if(m>f)return p;let y=y2[c],b=Math.log2(y),E=s&1,M=s>>1&1,B=s>>2&1,C=xr(n.localX,E,1),v=xr(n.localY,M,1),_=xr(n.localZ,B,1),T=xr(r.x,C,A),g=xr(r.y,v,A),S=xr(r.z,_,A),F=xr(n.mortonIndex,s,b),R=A===l&&Xl(e.childSubtreeAvailability,F),L,G,W,z;if(R){let Y=`${d}/${h}`,$=Si(Y,m,T,g,S);L=await(0,t0.load)($,_i,i),z=0,G={level:m,x:T,y:g,z:S},W={mortonIndex:0,localLevel:0,localX:0,localY:0,localZ:0}}else L=e,z=(y**A-1)/(y-1)+F,G=r,W={mortonIndex:F,localLevel:A,localX:C,localY:v,localZ:_};if(!Xl(L.tileAvailability,z))return p;Xl(L.contentAvailability,z)&&(p.contentUrl=Si(u,m,T,g,S));for(let Y=0;Y<y;Y++){let $=T2(a,Y,c),_e=await Yl({subtree:L,subtreeData:G,parentData:W,childIndex:Y,implicitOptions:o,loaderOptions:i,s2VolumeBox:$});(_e.contentUrl||_e.children.length)&&p.children.push(_e)}return p.contentUrl||p.children.length?b2(p,{level:m,x:T,y:g,z:S},o,a):p}function Xl(t,e){let r;return Array.isArray(t)?(r=t[0],t.length>1&&ec.once('Not supported extension "3DTILES_multiple_contents" has been detected')):r=t,"constant"in r?Boolean(r.constant):r.explicitBitstream?_2(e,r.explicitBitstream):!1}function b2(t,e,r,n){let{basePath:s,refine:o,getRefine:i,lodMetricType:a,getTileType:c,rootLodMetricValue:l,rootBoundingVolume:f}=r,u=t.contentUrl&&t.contentUrl.replace(`${s}/`,""),h=l/2**e.level,d=n?.box?{box:n.box}:f,p=E2(d,e,r.subdivisionScheme);return{children:t.children,contentUrl:t.contentUrl,content:{uri:u},id:t.contentUrl,refine:i(o),type:c(t),lodMetricType:a,lodMetricValue:h,geometricError:h,transform:t.transform,boundingVolume:p}}function E2(t,e,r){if(t.region){let{level:n,x:s,y:o,z:i}=e,[a,c,l,f,u,h]=t.region,d=2**n,p=(l-a)/d,[A,m]=[a+p*s,a+p*(s+1)],y=(f-c)/d,[b,E]=[c+y*o,c+y*(o+1)],M,B;if(r==="OCTREE"){let C=(h-u)/d;[M,B]=[u+C*i,u+C*(i+1)]}else[M,B]=[u,h];return{region:[A,b,m,E,M,B]}}if(t.box)return t;throw new Error(`Unsupported bounding volume type ${JSON.stringify(t)}`)}function xr(t,e,r){return(t<<r)+e}function Si(t,e,r,n,s){let o=M2({level:e,x:r,y:n,z:s});return t.replace(/{level}|{x}|{y}|{z}/gi,i=>o[i])}function M2(t){let e={};for(let r in t)e[`{${r}}`]=t[r];return e}function _2(t,e){let r=Math.floor(t/8),n=t%8;return(e[r]>>n&1)===1}function Ql(t,e=""){if(!e)return Ve.EMPTY;let n=e.split("?")[0].split(".").pop();switch(n){case"pnts":return Ve.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return Ve.SCENEGRAPH;default:return n||Ve.EMPTY}}function Zl(t){switch(t){case"REPLACE":case"replace":return ge.REPLACE;case"ADD":case"add":return ge.ADD;default:return t}}function Kl(t,e){if(/^[a-z][0-9a-z+.-]*:/i.test(e)){let n=new URL(t,`${e}/`);return decodeURI(n.toString())}else if(t.startsWith("/"))return t;return vt.resolve(e,t)}function r0(t,e){if(!t)return null;let r;if(t.content){let s=t.content.uri||t.content?.url;typeof s<"u"&&(r=Kl(s,e))}return{...t,id:r,contentUrl:r,lodMetricType:At.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:Ql(t,r),refine:Zl(t.refine)}}async function i0(t,e,r){let n=null,s=s0(t.root);s&&t.root?n=await n0(t.root,t,e,s,r):n=r0(t.root,e);let o=[];for(o.push(n);o.length>0;){let i=o.pop()||{},a=i.children||[],c=[];for(let l of a){let f=s0(l),u;f?u=await n0(l,t,e,f,r):u=r0(l,e),u&&(c.push(u),o.push(u))}i.children=c}return n}async function n0(t,e,r,n,s){let{subdivisionScheme:o,maximumLevel:i,availableLevels:a,subtreeLevels:c,subtrees:{uri:l}}=n,f=Si(l,0,0,0,0),u=Kl(f,r),h=await(0,o0.load)(u,_i,s),d=t.content?.uri,p=d?Kl(d,r):"",A=e?.root?.refine,m=t.geometricError,y=t.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];if(y){let B={box:Ci(y),s2VolumeInfo:y};t.boundingVolume=B}let b=t.boundingVolume,E={contentUrlTemplate:p,subtreesUriTemplate:l,subdivisionScheme:o,subtreeLevels:c,maximumLevel:Number.isFinite(a)?a-1:i,refine:A,basePath:r,lodMetricType:At.GEOMETRIC_ERROR,rootLodMetricValue:m,rootBoundingVolume:b,getTileType:Ql,getRefine:Zl};return await B2(t,r,h,E,s)}async function B2(t,e,r,n,s){if(!t)return null;let{children:o,contentUrl:i}=await Yl({subtree:r,implicitOptions:n,loaderOptions:s}),a,c=null;return i&&(a=i,c={uri:i.replace(`${e}/`,"")}),{...t,id:a,contentUrl:a,lodMetricType:At.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:Ql(t,a),refine:Zl(t.refine),content:c||t.content,children:o}}function s0(t){return t?.extensions?.["3DTILES_implicit_tiling"]||t?.implicitTiling}var Ii={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:ii,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:C2,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function C2(t,e={},r){let n=e["3d-tiles"]||{},s;return n.isTileset==="auto"?s=r?.url&&r.url.indexOf(".json")!==-1:s=n.isTileset,s?S2(t,e,r):I2(t,e,r)}async function S2(t,e,r){let n=JSON.parse(new TextDecoder().decode(t)),s=r?.url||"",o=w2(s),i=await i0(n,o,e||{});return{...n,shape:"tileset3d",loader:Ii,url:s,queryString:r?.queryString||"",basePath:o,root:i||n.root,type:he.TILES3D,lodMetricType:At.GEOMETRIC_ERROR,lodMetricValue:n.root?.geometricError||0}}async function I2(t,e,r){let n={content:{shape:"tile3d",featureIds:null}};return await Ol(t,0,e,r,n.content),n.content}function w2(t){return vt.dirname(t)}var a0=[0],v2={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:Ii,onTilesetLoad:{type:"function",value:t=>{}},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:(t,e,r)=>{}},_getMeshColor:{type:"function",value:t=>[255,255,255]}},ys=class extends Ht.CompositeLayer{initializeState(){"onTileLoadFail"in this.props&&Ht.log.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}}get isLoaded(){return Boolean(this.state?.tileset3d?.isLoaded()&&super.isLoaded)}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({props:e,oldProps:r,changeFlags:n}){if(e.data&&e.data!==r.data&&this._loadTileset(e.data),n.viewportChanged){let{activeViewports:s}=this.state;Object.keys(s).length&&(this._updateTileset(s),this.state.lastUpdatedViewports=s,this.state.activeViewports={})}if(n.propsChanged){let{layerMap:s}=this.state;for(let o in s)s[o].needsUpdate=!0}}activateViewport(e){let{activeViewports:r,lastUpdatedViewports:n}=this.state;this.internalState.viewport=e,r[e.id]=e;let s=n?.[e.id];(!s||!e.equals(s))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:e,sourceLayer:r}){let n=r&&r.props.tile;return e.picked&&(e.object=n),e.sourceTile=n,e}filterSubLayer({layer:e,viewport:r}){let{tile:n}=e.props,{id:s}=r;return n.selected&&n.viewportIds.includes(s)}_updateAutoHighlight(e){let r=e.sourceTile,n=this.state.layerMap[r?.id];n&&n.layer&&n.layer.updateAutoHighlight(e)}async _loadTileset(e){let r=this.props.loadOptions||{},n=this.props.loaders?.length?this.props.loaders:this.props.loader,s=Array.isArray(n)?n[0]:n,{tileset:o,...i}=r,a={loadOptions:{...i},...o},c=e;if("preload"in s&&typeof s.preload=="function"){let u=await s.preload(e,r);u.url&&(c=u.url),u.headers&&(a.loadOptions.core={...a.loadOptions.core,fetch:{...a.loadOptions.core?.fetch,headers:u.headers}}),Object.assign(a,u)}let l=await(0,u0.load)(c,s,a.loadOptions),f=new ls(l,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,onUpdate:()=>this.setNeedsUpdate(),...a});this.setState({tileset3d:f,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(f)}_onTileLoad(e){let{lastUpdatedViewports:r}=this.state;e.tileDrawn=!1,this.props.onTileLoad(e),this._updateTileset(r),this.setNeedsUpdate()}_onTileUnload(e){delete this.state.layerMap[e.id],this.props.onTileUnload(e)}_updateTileset(e){if(!e)return;let{tileset3d:r}=this.state,{timeline:n}=this.context,s=Object.keys(e).length;!n||!s||!r||r.selectTiles(Object.values(e)).then(o=>{this.state.frameNumber!==o&&this.setState({frameNumber:o})})}_getSubLayer(e,r){if(!e.content)return null;switch(e.type){case Ve.POINTCLOUD:return this._makePointCloudLayer(e,r);case Ve.SCENEGRAPH:return this._make3DModelLayer(e);case Ve.MESH:return this._makeSimpleMeshLayer(e,r);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${e.content.type}`)}}_makePointCloudLayer(e,r){let{attributes:n,pointCount:s,constantRGBA:o,cartographicOrigin:i,modelMatrix:a}=e.content,{positions:c,normals:l,colors:f}=n;if(!c)return null;let u=r&&r.props.data||{header:{vertexCount:s},attributes:{POSITION:c,NORMAL:l,COLOR_0:f}},{pointSize:h,getPointColor:d}=this.props,p=this.getSubLayerClass("pointcloud",l0.PointCloudLayer);return new p({pointSize:h},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${e.id}`,tile:e,data:u,coordinateSystem:Ht.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:i,modelMatrix:a,getColor:o||d,_offset:0})}_make3DModelLayer(e){let{gltf:r,instances:n,cartographicOrigin:s,modelMatrix:o}=e.content,i=this.getSubLayerClass("scenegraph",f0.ScenegraphLayer);return new i({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${e.id}`,tile:e,data:n||a0,scenegraph:r,coordinateSystem:Ht.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:s,modelMatrix:o,getTransformMatrix:a=>a.modelMatrix,getPosition:[0,0,0],_offset:0,onFirstDraw:()=>{e.tileDrawn=!0}})}_makeSimpleMeshLayer(e,r){let n=e.content,{attributes:s,indices:o,modelMatrix:i,cartographicOrigin:a,coordinateSystem:c=Ht.COORDINATE_SYSTEM.METER_OFFSETS,material:l,featureIds:f}=n,{_getMeshColor:u}=this.props,h=r&&r.props.mesh||new c0.Geometry({topology:"triangle-list",attributes:L2(s),indices:o}),d=this.getSubLayerClass("mesh",nm);return new d(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${e.id}`,tile:e,mesh:h,data:a0,getColor:u(e),pbrMaterial:l,modelMatrix:i,coordinateOrigin:a,coordinateSystem:c,featureIds:f,_offset:0})}renderLayers(){let{tileset3d:e,layerMap:r}=this.state;return e?e.tiles.map(n=>{let s=r[n.id]=r[n.id]||{tile:n},{layer: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}};ys.defaultProps=v2;ys.layerName="Tile3DLayer";var h0=ys;function L2(t){let e={};return e.positions={...t.positions,value:new Float32Array(t.positions.value)},t.normals&&(e.normals=t.normals),t.texCoords&&(e.texCoords=t.texCoords),t.colors&&(e.colors=t.colors),t.uvRegions&&(e.uvRegions=t.uvRegions),e}var Ri=D(Je(),1),nf=D(zo(),1),y0=D(Je(),1);var F2=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 $l(t){return t>>1^-(t&1)}function R2(t){let e=0,r={};for(let[n,s]of F2){let o=s===8?t.getFloat64:t.getFloat32;r[n]=o.call(t,e,!0),e+=s}return{header:r,headerEndPosition:e}}function P2(t,e){let r=e,n=3,s=t.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,f=l+a,u=0,h=0,d=0;for(let p=0;p<s;p++)u+=$l(t.getUint16(c+i*p,!0)),h+=$l(t.getUint16(l+i*p,!0)),d+=$l(t.getUint16(f+i*p,!0)),o[p]=u,o[p+s]=h,o[p+s*2]=d;return r+=a*3,{vertexData:o,vertexDataEndPosition:r}}function Ts(t,e,r,n,s=!0){let o;if(n===2?o=new Uint16Array(t,e,r):o=new Uint32Array(t,e,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 O2(t,e,r){let n=r,s=3,i=e.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;n%i!==0&&(n+=i-n%i);let a=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let c=a*3,l=Ts(t.buffer,n,c,i);return n+=c*i,{triangleIndicesEndPosition:n,triangleIndices:l}}function N2(t,e,r){let n=r,s=3,i=e.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,a=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let c=Ts(t.buffer,n,a,i,!1);n+=a*i;let l=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let f=Ts(t.buffer,n,l,i,!1);n+=l*i;let u=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let h=Ts(t.buffer,n,u,i,!1);n+=u*i;let d=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let p=Ts(t.buffer,n,d,i,!1);return n+=d*i,{edgeIndicesEndPosition:n,westIndices:c,southIndices:f,eastIndices:h,northIndices:p}}function D2(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function G2(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}function U2(t,e){let r={};if(t.byteLength<=e)return{extensions:r,extensionsEndPosition:e};let n=e;for(;n<t.byteLength;){let s=t.getUint8(n,!0);n+=Uint8Array.BYTES_PER_ELEMENT;let o=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let i=new DataView(t.buffer,n,o);switch(s){case 1:{r.vertexNormals=D2(i);break}case 2:{r.waterMask=G2(i);break}default:}n+=o}return{extensions:r,extensionsEndPosition:n}}var yr={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},V2={maxDecodingStep:yr.extensions};function ef(t,e){let r=Object.assign({},V2,e),n=new DataView(t),{header:s,headerEndPosition:o}=R2(n);if(r.maxDecodingStep<yr.vertices)return{header:s};let{vertexData:i,vertexDataEndPosition:a}=P2(n,o);if(r.maxDecodingStep<yr.triangleIndices)return{header:s,vertexData:i};let{triangleIndices:c,triangleIndicesEndPosition:l}=O2(n,i,a);if(r.maxDecodingStep<yr.edgeIndices)return{header:s,vertexData:i,triangleIndices:c};let{westIndices:f,southIndices:u,eastIndices:h,northIndices:d,edgeIndicesEndPosition:p}=N2(n,i,l);if(r.maxDecodingStep<yr.extensions)return{header:s,vertexData:i,triangleIndices:c,westIndices:f,northIndices:d,eastIndices:h,southIndices:u};let{extensions:A}=U2(n,p);return{header:s,vertexData:i,triangleIndices:c,westIndices:f,northIndices:d,eastIndices:h,southIndices:u,extensions:A}}function wi(t,e,r,n){let s=n?z2(n,t.POSITION.value):H2(e),o=new t.POSITION.value.constructor(s.length*6),i=new t.TEXCOORD_0.value.constructor(s.length*4),a=new e.constructor(s.length*6);for(let l=0;l<s.length;l++){let f=s[l];k2({edge:f,edgeIndex:l,attributes:t,skirtHeight:r,newPosition:o,newTexcoord0:i,newTriangles:a})}t.POSITION.value=On(t.POSITION.value,o),t.TEXCOORD_0.value=On(t.TEXCOORD_0.value,i);let c=e instanceof Array?e.concat(a):On(e,a);return{attributes:t,triangles:c}}function H2(t){let e=[];for(let s=0;s<t.length;s+=3)e.push([t[s],t[s+1]]),e.push([t[s+1],t[s+2]]),e.push([t[s+2],t[s]]);e.sort((s,o)=>Math.min(...s)-Math.min(...o)||Math.max(...s)-Math.max(...o));let r=[],n=0;for(;n<e.length;)e[n][0]===e[n+1]?.[1]&&e[n][1]===e[n+1]?.[0]?n+=2:(r.push(e[n]),n++);return r}function z2(t,e){t.westIndices.sort((n,s)=>e[3*n+1]-e[3*s+1]),t.eastIndices.sort((n,s)=>e[3*s+1]-e[3*n+1]),t.southIndices.sort((n,s)=>e[3*s]-e[3*n]),t.northIndices.sort((n,s)=>e[3*n]-e[3*s]);let r=[];for(let n in t){let s=t[n];for(let o=0;o<s.length-1;o++)r.push([s[o],s[o+1]])}return r}function k2({edge:t,edgeIndex:e,attributes:r,skirtHeight:n,newPosition:s,newTexcoord0:o,newTriangles:i}){let a=r.POSITION.value.length,c=e*2,l=e*2+1;s.set(r.POSITION.value.subarray(t[0]*3,t[0]*3+3),c*3),s[c*3+2]=s[c*3+2]-n,s.set(r.POSITION.value.subarray(t[1]*3,t[1]*3+3),l*3),s[l*3+2]=s[l*3+2]-n,o.set(r.TEXCOORD_0.value.subarray(t[0]*2,t[0]*2+2),c*2),o.set(r.TEXCOORD_0.value.subarray(t[1]*2,t[1]*2+2),l*2);let f=e*2*3;i[f]=t[0],i[f+1]=a/3+l,i[f+2]=t[1],i[f+3]=a/3+l,i[f+4]=t[0],i[f+5]=a/3+c}function tf(t,e={}){let{bounds:r}=e,{header:n,vertexData:s,triangleIndices:o,westIndices:i,northIndices:a,eastIndices:c,southIndices:l}=ef(t,yr.triangleIndices),f=o,u=q2(s,n,r),h=dr(u);if(e?.skirtHeight){let{attributes:d,triangles:p}=wi(u,f,e.skirtHeight,{westIndices:i,northIndices:a,eastIndices:c,southIndices:l});u=d,f=p}return{loaderData:{header:{}},header:{vertexCount:f.length,boundingBox:h},schema:void 0,topology:"triangle-list",mode:4,indices:{value:f,size:1},attributes:u}}function q2(t,e,r){let{minHeight:n,maxHeight:s}=e,[o,i,a,c]=r||[0,0,1,1],l=a-o,f=c-i,u=s-n,h=t.length/3,d=new Float32Array(h*3),p=new Float32Array(h*2);for(let A=0;A<h;A++){let m=t[A]/32767,y=t[A+h]/32767,b=t[A+h*2]/32767;d[3*A+0]=m*l+o,d[3*A+1]=y*f+i,d[3*A+2]=b*u+n,p[2*A+0]=m,p[2*A+1]=y}return{POSITION:{value:d,size:3},TEXCOORD_0:{value:p,size:2}}}var bs=class{constructor(e=257){this.gridSize=e;let r=e-1;if(r&r-1)throw new Error(`Expected grid size to be 2^n+1, got ${e}.`);this.numTriangles=r*r*2-2,this.numParentTriangles=this.numTriangles-r*r,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let n=0;n<this.numTriangles;n++){let s=n+2,o=0,i=0,a=0,c=0,l=0,f=0;for(s&1?a=c=l=r:o=i=f=r;(s>>=1)>1;){let h=o+a>>1,d=i+c>>1;s&1?(a=o,c=i,o=l,i=f):(o=a,i=c,a=l,c=f),l=h,f=d}let u=n*4;this.coords[u+0]=o,this.coords[u+1]=i,this.coords[u+2]=a,this.coords[u+3]=c}}createTile(e){return new rf(e,this)}},rf=class{constructor(e,r){let n=r.gridSize;if(e.length!==n*n)throw new Error(`Expected terrain data of length ${n*n} (${n} x ${n}), got ${e.length}.`);this.terrain=e,this.martini=r,this.errors=new Float32Array(e.length),this.update()}update(){let{numTriangles:e,numParentTriangles:r,coords:n,gridSize:s}=this.martini,{terrain:o,errors:i}=this;for(let a=e-1;a>=0;a--){let c=a*4,l=n[c+0],f=n[c+1],u=n[c+2],h=n[c+3],d=l+u>>1,p=f+h>>1,A=d+p-f,m=p+l-d,y=(o[f*s+l]+o[h*s+u])/2,b=p*s+d,E=Math.abs(y-o[b]);if(i[b]=Math.max(i[b],E),a<r){let M=(f+m>>1)*s+(l+A>>1),B=(h+m>>1)*s+(u+A>>1);i[b]=Math.max(i[b],i[M],i[B])}}}getMesh(e=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,m,y,b){let E=d+A>>1,M=p+m>>1;Math.abs(d-y)+Math.abs(p-b)>1&&s[M*r+E]>e?(c(y,b,d,p,E,M),c(A,m,y,b,E,M)):(n[p*r+d]=n[p*r+d]||++o,n[m*r+A]=n[m*r+A]||++o,n[b*r+y]=n[b*r+y]||++o,i++)}c(0,0,a,a,a,0),c(a,a,0,0,0,a);let l=new Uint16Array(o*2),f=new Uint32Array(i*3),u=0;function h(d,p,A,m,y,b){let E=d+A>>1,M=p+m>>1;if(Math.abs(d-y)+Math.abs(p-b)>1&&s[M*r+E]>e)h(y,b,d,p,E,M),h(A,m,y,b,E,M);else{let B=n[p*r+d]-1,C=n[m*r+A]-1,v=n[b*r+y]-1;l[2*B]=d,l[2*B+1]=p,l[2*C]=A,l[2*C+1]=m,l[2*v]=y,l[2*v+1]=b,f[u++]=B,f[u++]=C,f[u++]=v}}return h(0,0,a,a,a,0),h(a,a,0,0,0,a),{vertices:l,triangles:f}}};var Es=class{constructor(e,r,n=r){this.data=e,this.width=r,this.height=n,this.coords=[],this.triangles=[],this._halfedges=[],this._candidates=[],this._queueIndices=[],this._queue=[],this._errors=[],this._rms=[],this._pending=[],this._pendingLen=0,this._rmsSum=0;let s=r-1,o=n-1,i=this._addPoint(0,0),a=this._addPoint(s,0),c=this._addPoint(0,o),l=this._addPoint(s,o),f=this._addTriangle(l,i,c,-1,-1,-1);this._addTriangle(i,l,a,f,-1,-1),this._flush()}run(e=1){for(;this.getMaxError()>e;)this.refine()}refine(){this._step(),this._flush()}getMaxError(){return this._errors[0]}getRMSD(){return this._rmsSum>0?Math.sqrt(this._rmsSum/(this.width*this.height)):0}heightAt(e,r){return this.data[this.width*r+e]}_flush(){let e=this.coords;for(let r=0;r<this._pendingLen;r++){let n=this._pending[r],s=2*this.triangles[n*3+0],o=2*this.triangles[n*3+1],i=2*this.triangles[n*3+2];this._findCandidate(e[s],e[s+1],e[o],e[o+1],e[i],e[i+1],n)}this._pendingLen=0}_findCandidate(e,r,n,s,o,i,a){let c=Math.min(e,n,o),l=Math.min(r,s,i),f=Math.max(e,n,o),u=Math.max(r,s,i),h=Tr(n,s,o,i,c,l),d=Tr(o,i,e,r,c,l),p=Tr(e,r,n,s,c,l),A=s-r,m=e-n,y=i-s,b=n-o,E=r-i,M=o-e,B=Tr(e,r,n,s,o,i),C=this.heightAt(e,r)/B,v=this.heightAt(n,s)/B,_=this.heightAt(o,i)/B,T=0,g=0,S=0,F=0;for(let R=l;R<=u;R++){let L=0;h<0&&y!==0&&(L=Math.max(L,Math.floor(-h/y))),d<0&&E!==0&&(L=Math.max(L,Math.floor(-d/E))),p<0&&A!==0&&(L=Math.max(L,Math.floor(-p/A)));let G=h+y*L,W=d+E*L,z=p+A*L,te=!1;for(let K=c+L;K<=f;K++){if(G>=0&&W>=0&&z>=0){te=!0;let Y=C*G+v*W+_*z,$=Math.abs(Y-this.heightAt(K,R));F+=$*$,$>T&&(T=$,g=K,S=R)}else if(te)break;G+=y,W+=E,z+=A}h+=b,d+=M,p+=m}(g===e&&S===r||g===n&&S===s||g===o&&S===i)&&(T=0),this._candidates[2*a]=g,this._candidates[2*a+1]=S,this._rms[a]=F,this._queuePush(a,T,F)}_step(){let e=this._queuePop(),r=e*3+0,n=e*3+1,s=e*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],f=this.coords[2*i],u=this.coords[2*i+1],h=this.coords[2*a],d=this.coords[2*a+1],p=this._candidates[2*e],A=this._candidates[2*e+1],m=this._addPoint(p,A);if(Tr(c,l,f,u,p,A)===0)this._handleCollinear(m,r);else if(Tr(f,u,h,d,p,A)===0)this._handleCollinear(m,n);else if(Tr(h,d,c,l,p,A)===0)this._handleCollinear(m,s);else{let y=this._halfedges[r],b=this._halfedges[n],E=this._halfedges[s],M=this._addTriangle(o,i,m,y,-1,-1,r),B=this._addTriangle(i,a,m,b,-1,M+1),C=this._addTriangle(a,o,m,E,M+2,B+1);this._legalize(M),this._legalize(B),this._legalize(C)}}_addPoint(e,r){let n=this.coords.length>>1;return this.coords.push(e,r),n}_addTriangle(e,r,n,s,o,i,a=this.triangles.length){let c=a/3;return this.triangles[a+0]=e,this.triangles[a+1]=r,this.triangles[a+2]=n,this._halfedges[a+0]=s,this._halfedges[a+1]=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(e){let r=this._halfedges[e];if(r<0)return;let n=e-e%3,s=r-r%3,o=n+(e+1)%3,i=n+(e+2)%3,a=s+(r+2)%3,c=s+(r+1)%3,l=this.triangles[i],f=this.triangles[e],u=this.triangles[o],h=this.triangles[a],d=this.coords;if(!j2(d[2*l],d[2*l+1],d[2*f],d[2*f+1],d[2*u],d[2*u+1],d[2*h],d[2*h+1]))return;let p=this._halfedges[o],A=this._halfedges[i],m=this._halfedges[a],y=this._halfedges[c];this._queueRemove(n/3),this._queueRemove(s/3);let b=this._addTriangle(l,h,u,-1,m,p,n),E=this._addTriangle(h,l,f,b,A,y,s);this._legalize(b+1),this._legalize(E+2)}_handleCollinear(e,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],f=this._halfedges[o],u=this._halfedges[r];if(u<0){let C=this._addTriangle(e,i,a,-1,f,-1,n),v=this._addTriangle(i,e,c,C,-1,l);this._legalize(C+1),this._legalize(v+2);return}let h=u-u%3,d=h+(u+2)%3,p=h+(u+1)%3,A=this.triangles[d],m=this._halfedges[d],y=this._halfedges[p];this._queueRemove(h/3);let b=this._addTriangle(i,a,e,f,-1,-1,n),E=this._addTriangle(a,A,e,y,-1,b+1,h),M=this._addTriangle(A,c,e,m,-1,E+1),B=this._addTriangle(c,i,e,l,b+2,M+1);this._legalize(b),this._legalize(E),this._legalize(M),this._legalize(B)}_queuePush(e,r,n){let s=this._queue.length;this._queueIndices[e]=s,this._queue.push(e),this._errors.push(r),this._rmsSum+=n,this._queueUp(s)}_queuePop(){let e=this._queue.length-1;return this._queueSwap(0,e),this._queueDown(0,e),this._queuePopBack()}_queuePopBack(){let e=this._queue.pop();return this._errors.pop(),this._rmsSum-=this._rms[e],this._queueIndices[e]=-1,e}_queueRemove(e){let r=this._queueIndices[e];if(r<0){let s=this._pending.indexOf(e);if(s!==-1)this._pending[s]=this._pending[--this._pendingLen];else throw new Error("Broken triangulation (something went wrong).");return}let n=this._queue.length-1;n!==r&&(this._queueSwap(r,n),this._queueDown(r,n)||this._queueUp(r)),this._queuePopBack()}_queueLess(e,r){return this._errors[e]>this._errors[r]}_queueSwap(e,r){let n=this._queue[e],s=this._queue[r];this._queue[e]=s,this._queue[r]=n,this._queueIndices[n]=r,this._queueIndices[s]=e;let o=this._errors[e];this._errors[e]=this._errors[r],this._errors[r]=o}_queueUp(e){let r=e;for(;;){let n=r-1>>1;if(n===r||!this._queueLess(r,n))break;this._queueSwap(n,r),r=n}}_queueDown(e,r){let n=e;for(;;){let s=2*n+1;if(s>=r||s<0)break;let 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>e}};function Tr(t,e,r,n,s,o){return(r-s)*(e-o)-(n-o)*(t-s)}function j2(t,e,r,n,s,o,i,a){let c=t-i,l=e-a,f=r-i,u=n-a,h=s-i,d=o-a,p=c*c+l*l,A=f*f+u*u,m=h*h+d*d;return c*(u*m-A*d)-l*(f*m-A*h)+p*(f*d-u*h)<0}function m0(t,e){let{meshMaxError:r,bounds:n,elevationDecoder:s}=e,{data:o,width:i,height:a}=t,c,l;switch(e.tesselator){case"martini":c=vi(o,i,a,s,e.tesselator),l=d0(r,i,c);break;case"delatin":c=vi(o,i,a,s,e.tesselator),l=p0(r,i,a,c);break;default:i===a&&!(a&i-1)?(c=vi(o,i,a,s,"martini"),l=d0(r,i,c)):(c=vi(o,i,a,s,"delatin"),l=p0(r,i,a,c));break}let{vertices:f}=l,{triangles:u}=l,h=J2(f,c,i,a,n),d=dr(h);if(e.skirtHeight){let{attributes:p,triangles:A}=wi(h,u,e.skirtHeight);h=p,u=A}return{loaderData:{header:{}},header:{vertexCount:u.length,boundingBox:d},mode:4,indices:{value:Uint32Array.from(u),size:1},attributes:h}}function d0(t,e,r){let n=e+1,o=new bs(n).createTile(r),{vertices:i,triangles:a}=o.getMesh(t);return{vertices:i,triangles:a}}function p0(t,e,r,n){let s=new Es(n,e+1,r+1);s.run(t);let{coords:o,triangles:i}=s;return{vertices:o,triangles:i}}function vi(t,e,r,n,s){let{rScaler:o,bScaler:i,gScaler:a,offset:c}=n,l=new Float32Array((e+1)*(r+1));for(let f=0,u=0;u<r;u++)for(let h=0;h<e;h++,f++){let d=f*4,p=t[d+0],A=t[d+1],m=t[d+2];l[f+u]=p*o+A*a+m*i+c}if(s==="martini"){for(let f=(e+1)*e,u=0;u<e;u++,f++)l[f]=l[f-e-1];for(let f=r,u=0;u<r+1;u++,f+=r+1)l[f]=l[f-1]}return l}function J2(t,e,r,n,s){let o=r+1,i=t.length/2,a=new Float32Array(i*3),c=new Float32Array(i*2),[l,f,u,h]=s||[0,0,r,n],d=(u-l)/r,p=(h-f)/n;for(let A=0;A<i;A++){let m=t[A*2],y=t[A*2+1],b=y*o+m;a[3*A+0]=m*d+l,a[3*A+1]=-y*p+h,a[3*A+2]=e[b],c[2*A+0]=m/r,c[2*A+1]=y/n}return{POSITION:{value:a,size:3},TEXCOORD_0:{value:c,size:2}}}var Li="4.4.0-alpha.18";var Fi={dataType:null,batchType:null,name:"Terrain",id:"terrain",module:"terrain",version:Li,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 g0={dataType:null,batchType:null,name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:Li,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var W2={...Fi,parse:X2};async function X2(t,e,r){let n={...e,core:{...e?.core,mimeType:"application/x.image"},image:{...e?.image,type:"data"}},s=await Fe(t,[],n,r),o={...W2.options.terrain,...e?.terrain};return m0(s,o)}var wz={...g0,parseSync:(t,e)=>tf(t,e?.["quantized-mesh"]),parse:async(t,e)=>tf(t,e?.["quantized-mesh"])};var A0=[1],Y2={...lr.defaultProps,elevationData:Ot,texture:{...Ot,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:[Fi]};function x0(t){return Array.isArray(t)?t.join(";"):t||""}var Ms=class extends Ri.CompositeLayer{updateState({props:e,oldProps:r}){let n=e.elevationData!==r.elevationData;if(n){let{elevationData:o}=e,i=o&&(Array.isArray(o)||K2(o));this.setState({isTiled:i})}let s=n||e.meshMaxError!==r.meshMaxError||e.elevationDecoder!==r.elevationDecoder||e.bounds!==r.bounds;if(!this.state.isTiled&&s){let o=this.loadTerrain(e);this.setState({terrain:o})}e.workerUrl&&Ri.log.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain({elevationData:e,bounds:r,elevationDecoder:n,meshMaxError:s,signal:o}){if(!e)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(e,{propName:"elevationData",layer:this,loadOptions:i,signal:o})}getTiledTerrainData(e){let{elevationData:r,fetch:n,texture:s,elevationDecoder:o,meshMaxError:i}=this.props,{viewport:a}=this.context,c=at(r,e),l=s&&at(s,e),{signal:f}=e,u=[0,0],h=[0,0];if(a.isGeospatial){let m=e.bbox;u=a.projectFlat([m.west,m.south]),h=a.projectFlat([m.east,m.north])}else{let m=e.bbox;u=[m.left,m.bottom],h=[m.right,m.top]}let d=[u[0],u[1],h[0],h[1]],p=this.loadTerrain({elevationData:c,bounds:d,elevationDecoder:o,meshMaxError:i,signal:f}),A=l?n(l,{propName:"texture",layer:this,loaders:[],signal:f}).catch(m=>null):Promise.resolve(null);return Promise.all([p,A])}renderSubLayers(e){let r=this.getSubLayerClass("mesh",nf.SimpleMeshLayer),{color:n,wireframe:s,material:o}=this.props,{data:i}=e;if(!i)return null;let[a,c]=i;return new r(e,{data:A0,mesh:a,texture:c,_instanced:!1,coordinateSystem:y0.COORDINATE_SYSTEM.CARTESIAN,getPosition:l=>[0,0,0],getColor:n,wireframe:s,material:o})}onViewportLoad(e){if(!e)return;let{zRange:r}=this.state,n=e.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:e,material:r,elevationData:n,texture:s,wireframe:o,meshMaxError:i,elevationDecoder:a,tileSize:c,maxZoom:l,minZoom:f,extent:u,maxRequests:h,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:m,maxCacheByteSize:y,refinementStrategy:b}=this.props;if(this.state.isTiled)return new lr(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:x0(n),texture:x0(s),meshMaxError:i,elevationDecoder:a}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:c,maxZoom:l,minZoom:f,extent:u,maxRequests:h,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:m,maxCacheByteSize:y,refinementStrategy:b});if(!n)return null;let E=this.getSubLayerClass("mesh",nf.SimpleMeshLayer);return new E(this.getSubLayerProps({id:"mesh"}),{data:A0,mesh:this.state.terrain,texture:s,_instanced:!1,getPosition:M=>[0,0,0],getColor:e,material:r,wireframe:o})}};Ms.defaultProps=Y2;Ms.layerName="TerrainLayer";var T0=Ms,K2=t=>t.includes("{x}")&&(t.includes("{y}")||t.includes("{-y}"));var qi=D(Je(),1),bf=D(je(),1),e1=D(E0(),1);function M0(t,e,r){switch(t.type){case"Point":return Z2(t,e,r);case"LineString":return Q2(t,e,r);case"Polygon":return _0(t,e,r);default:let n=t;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function _0(t,e=-1/0,r=1/0){let{positions:n}=t,s=t.polygonIndices.value.filter(c=>c>=e&&c<=r),o=t.primitivePolygonIndices.value.filter(c=>c>=e&&c<=r);if(!(s.length>2)){let c=[];for(let l=0;l<o.length-1;l++){let f=o[l],u=o[l+1],h=Pi(n,f,u);c.push(h)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<s.length-1;c++){let l=s[c],f=s[c+1],u=_0(t,l,f).coordinates;a.push(u)}return{type:"MultiPolygon",coordinates:a}}function Q2(t,e=-1/0,r=1/0){let{positions:n}=t,s=t.pathIndices.value.filter(a=>a>=e&&a<=r);if(!(s.length>2))return{type:"LineString",coordinates:Pi(n,s[0],s[1])};let i=[];for(let a=0;a<s.length-1;a++){let c=Pi(n,s[a],s[a+1]);i.push(c)}return{type:"MultiLineString",coordinates:i}}function Z2(t,e,r){let{positions:n}=t,s=Pi(n,e,r);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function Pi(t,e,r){e=e||0,r=r||t.value.length/t.size;let n=[];for(let s=e;s<r;s++){let o=Array();for(let i=s*t.size;i<(s+1)*t.size;i++)o.push(Number(t.value[i]));n.push(o)}return n}var _s={x:0,y:1,z:2};function br(t,e={}){let{start:r=0,end:n=t.length,plane:s="xy"}=e,o=e.size||2,i=0,a=_s[s[0]],c=_s[s[1]];for(let l=r,f=n-o;l<n;l+=o)i+=(t[l+a]-t[f+a])*(t[l+c]+t[f+c]),f=l;return i/2}function of(t,e,r=2,n,s="xy"){let o=e&&e.length,i=o?e[0]*r:t.length,a=C0(t,0,i,r,!0,n&&n[0],s),c=[];if(!a||a.next===a.prev)return c;let l,f,u,h,d,p,A;if(o&&(a=ow(t,e,a,r,n,s)),t.length>80*r){h=f=t[0],d=u=t[1];for(let m=r;m<i;m+=r)p=t[m],A=t[m+1],p<h&&(h=p),A<d&&(d=A),p>f&&(f=p),A>u&&(u=A);l=Math.max(f-h,u-d),l=l!==0?32767/l:0}return Bs(a,c,r,h,d,l,0),c}function C0(t,e,r,n,s,o,i){let a,c;o===void 0&&(o=br(t,{start:e,end:r,size:n,plane:i}));let l=_s[i[0]],f=_s[i[1]];if(s===o<0)for(a=e;a<r;a+=n)c=B0(a,t[a+l],t[a+f],c);else for(a=r-n;a>=e;a-=n)c=B0(a,t[a+l],t[a+f],c);return c&&Di(c,c.next)&&(Ss(c),c=c.next),c}function Er(t,e){if(!t)return t;e||(e=t);let r=t,n;do if(n=!1,!r.steiner&&(Di(r,r.next)||re(r.prev,r,r.next)===0)){if(Ss(r),r=e=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==e);return e}function Bs(t,e,r,n,s,o,i){if(!t)return;!i&&o&&fw(t,n,s,o);let a=t,c,l;for(;t.prev!==t.next;){if(c=t.prev,l=t.next,o?rw(t,n,s,o):tw(t)){e.push(c.i/r|0),e.push(t.i/r|0),e.push(l.i/r|0),Ss(t),t=l.next,a=l.next;continue}if(t=l,t===a){i?i===1?(t=nw(Er(t),e,r),Bs(t,e,r,n,s,o,2)):i===2&&sw(t,e,r,n,s,o):Bs(Er(t),e,r,n,s,o,1);break}}}function tw(t){let e=t.prev,r=t,n=t.next;if(re(e,r,n)>=0)return!1;let s=e.x,o=r.x,i=n.x,a=e.y,c=r.y,l=n.y,f=s<o?s<i?s:i:o<i?o:i,u=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!==e;){if(p.x>=f&&p.x<=h&&p.y>=u&&p.y<=d&&ln(s,a,o,c,i,l,p.x,p.y)&&re(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function rw(t,e,r,n){let s=t.prev,o=t,i=t.next;if(re(s,o,i)>=0)return!1;let a=s.x,c=o.x,l=i.x,f=s.y,u=o.y,h=i.y,d=a<c?a<l?a:l:c<l?c:l,p=f<u?f<h?f:h:u<h?u:h,A=a>c?a>l?a:l:c>l?c:l,m=f>u?f>h?f:h:u>h?u:h,y=sf(d,p,e,r,n),b=sf(A,m,e,r,n),E=t.prevZ,M=t.nextZ;for(;E&&E.z>=y&&M&&M.z<=b;){if(E.x>=d&&E.x<=A&&E.y>=p&&E.y<=m&&E!==s&&E!==i&&ln(a,f,c,u,l,h,E.x,E.y)&&re(E.prev,E,E.next)>=0||(E=E.prevZ,M.x>=d&&M.x<=A&&M.y>=p&&M.y<=m&&M!==s&&M!==i&&ln(a,f,c,u,l,h,M.x,M.y)&&re(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;E&&E.z>=y;){if(E.x>=d&&E.x<=A&&E.y>=p&&E.y<=m&&E!==s&&E!==i&&ln(a,f,c,u,l,h,E.x,E.y)&&re(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;M&&M.z<=b;){if(M.x>=d&&M.x<=A&&M.y>=p&&M.y<=m&&M!==s&&M!==i&&ln(a,f,c,u,l,h,M.x,M.y)&&re(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function nw(t,e,r){let n=t;do{let s=n.prev,o=n.next.next;!Di(s,o)&&S0(s,n,n.next,o)&&Cs(s,o)&&Cs(o,s)&&(e.push(s.i/r|0),e.push(n.i/r|0),e.push(o.i/r|0),Ss(n),Ss(n.next),n=t=o),n=n.next}while(n!==t);return Er(n)}function sw(t,e,r,n,s,o){let i=t;do{let a=i.next.next;for(;a!==i.prev;){if(i.i!==a.i&&dw(i,a)){let c=I0(i,a);i=Er(i,i.next),c=Er(c,c.next),Bs(i,e,r,n,s,o,0),Bs(c,e,r,n,s,o,0);return}a=a.next}i=i.next}while(i!==t)}function ow(t,e,r,n,s,o){let i=[],a,c,l,f,u;for(a=0,c=e.length;a<c;a++)l=e[a]*n,f=a<c-1?e[a+1]*n:t.length,u=C0(t,l,f,n,!1,s&&s[a+1],o),u===u.next&&(u.steiner=!0),i.push(hw(u));for(i.sort(iw),a=0;a<i.length;a++)r=aw(i[a],r);return r}function iw(t,e){return t.x-e.x}function aw(t,e){let r=cw(t,e);if(!r)return e;let n=I0(r,t);return Er(n,n.next),Er(r,r.next)}function cw(t,e){let r=e,n=t.x,s=t.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!==e);if(!i)return null;let a=i,c=i.x,l=i.y,f=1/0,u;r=i;do n>=r.x&&r.x>=c&&n!==r.x&&ln(s<l?n:o,s,c,l,s<l?o:n,s,r.x,r.y)&&(u=Math.abs(s-r.y)/(n-r.x),Cs(r,t)&&(u<f||u===f&&(r.x>i.x||r.x===i.x&&lw(i,r)))&&(i=r,f=u)),r=r.next;while(r!==a);return i}function lw(t,e){return re(t.prev,t,e.prev)<0&&re(e.next,t,t.next)<0}function fw(t,e,r,n){let s=t;do s.z===0&&(s.z=sf(s.x,s.y,e,r,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,uw(s)}function uw(t){let e,r,n=1,s,o,i,a,c,l;do{for(o=t,t=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)?(e=o,o=o.nextZ,i--):(e=a,a=a.nextZ,c--),l?l.nextZ=e:t=e,e.prevZ=l,l=e;o=a}l.nextZ=null,n*=2}while(s>1);return t}function sf(t,e,r,n,s){return t=(t-r)*s|0,e=(e-n)*s|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function hw(t){let e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function ln(t,e,r,n,s,o,i,a){return(s-i)*(e-a)>=(t-i)*(o-a)&&(t-i)*(n-a)>=(r-i)*(e-a)&&(r-i)*(o-a)>=(s-i)*(n-a)}function dw(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!pw(t,e)&&(Cs(t,e)&&Cs(e,t)&&mw(t,e)&&(re(t.prev,t,e.prev)||re(t,e.prev,e))||Di(t,e)&&re(t.prev,t,t.next)>0&&re(e.prev,e,e.next)>0)}function re(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Di(t,e){return t.x===e.x&&t.y===e.y}function S0(t,e,r,n){let s=Ni(re(t,e,r)),o=Ni(re(t,e,n)),i=Ni(re(r,n,t)),a=Ni(re(r,n,e));return!!(s!==o&&i!==a||s===0&&Oi(t,r,e)||o===0&&Oi(t,n,e)||i===0&&Oi(r,t,n)||a===0&&Oi(r,e,n))}function Oi(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Ni(t){return t>0?1:t<0?-1:0}function pw(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&S0(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function Cs(t,e){return re(t.prev,t,t.next)<0?re(t,e,t.next)>=0&&re(t,t.prev,e)>=0:re(t,e,t.prev)<0||re(t,t.next,e)<0}function mw(t,e){let r=t,n=!1,s=(t.x+e.x)/2,o=(t.y+e.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!==t);return n}function I0(t,e){let r=new Is(t.i,t.x,t.y),n=new Is(e.i,e.x,e.y),s=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=s,s.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function B0(t,e,r,n){let s=new Is(t,e,r);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function Ss(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}var Is=class{constructor(e,r,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=e,this.x=r,this.y=n}};function Gi(t,e,r){let n=Tw(t),s=Object.keys(n).filter(o=>n[o]!==Array);return bw(t,{propArrayTypes:n,...e},{numericPropKeys:r&&r.numericPropKeys||s,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function Tw(t){let e={};for(let r of t)if(r.properties)for(let n in r.properties){let s=r.properties[n];e[n]=Sw(s,e[n])}return e}function bw(t,e,r){let{pointPositionsCount:n,pointFeaturesCount:s,linePositionsCount:o,linePathsCount:i,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:f,polygonFeaturesCount:u,propArrayTypes:h,coordLength:d}=e,{numericPropKeys:p=[],PositionDataType:A=Float32Array,triangulate:m=!0}=r,y=t[0]&&"id"in t[0],b=t.length>65535?Uint32Array:Uint16Array,E={type:"Point",positions:new A(n*d),globalFeatureIds:new b(n),featureIds:s>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},M={type:"LineString",pathIndices:o>65535?new Uint32Array(i+1):new Uint16Array(i+1),positions:new A(o*d),globalFeatureIds:new b(o),featureIds:a>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},B={type:"Polygon",polygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),primitivePolygonIndices:c>65535?new Uint32Array(f+1):new Uint16Array(f+1),positions:new A(c*d),globalFeatureIds:new b(c),featureIds:u>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};m&&(B.triangles=[]);for(let v of[E,M,B])for(let _ of p){let T=h[_];v.numericProps[_]=new T(v.positions.length/d)}M.pathIndices[i]=o,B.polygonIndices[l]=c,B.primitivePolygonIndices[f]=c;let C={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let v of t){let _=v.geometry,T=v.properties||{};switch(_.type){case"Point":Ew(_,E,C,d,T),E.properties.push(cf(T,p)),y&&E.fields.push({id:v.id}),C.pointFeature++;break;case"LineString":Mw(_,M,C,d,T),M.properties.push(cf(T,p)),y&&M.fields.push({id:v.id}),C.lineFeature++;break;case"Polygon":_w(_,B,C,d,T),B.properties.push(cf(T,p)),y&&B.fields.push({id:v.id}),C.polygonFeature++;break;default:throw new Error("Invalid geometry type")}C.feature++}return Cw(E,M,B,d)}function Ew(t,e,r,n,s){e.positions.set(t.data,r.pointPosition*n);let o=t.data.length/n;lf(e,s,r.pointPosition,o),e.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+o),e.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+o),r.pointPosition+=o}function Mw(t,e,r,n,s){e.positions.set(t.data,r.linePosition*n);let o=t.data.length/n;lf(e,s,r.linePosition,o),e.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+o),e.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+o);for(let i=0,a=t.indices.length;i<a;++i){let c=t.indices[i],l=i===a-1?t.data.length:t.indices[i+1];e.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(l-c)/n}}function _w(t,e,r,n,s){e.positions.set(t.data,r.polygonPosition*n);let o=t.data.length/n;lf(e,s,r.polygonPosition,o),e.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+o),e.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+o);for(let i=0,a=t.indices.length;i<a;++i){let c=r.polygonPosition;e.polygonIndices[r.polygonObject++]=c;let l=t.areas[i],f=t.indices[i],u=t.indices[i+1];for(let d=0,p=f.length;d<p;++d){let A=f[d],m=d===p-1?u===void 0?t.data.length:u[0]:f[d+1];e.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(m-A)/n}let h=r.polygonPosition;Bw(e,l,f,{startPosition:c,endPosition:h,coordLength:n})}}function Bw(t,e,r,{startPosition:n,endPosition:s,coordLength:o}){if(!t.triangles)return;let i=n*o,a=s*o,c=t.positions.subarray(i,a),l=r[0],f=r.slice(1).map(h=>(h-l)/o),u=of(c,f,o,e);for(let h=0,d=u.length;h<d;++h)t.triangles.push(n+u[h])}function af(t,e){let r={};for(let n in t)r[n]={value:t[n],size:e};return r}function Cw(t,e,r,n){let s={shape:"binary-feature-collection",points:{...t,positions:{value:t.positions,size:n},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:af(t.numericProps,1)},lines:{...e,positions:{value:e.positions,size:n},pathIndices:{value:e.pathIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:af(e.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:n},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:af(r.numericProps,1)}};return s.polygons&&r.triangles&&(s.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),s}function lf(t,e,r,n){for(let s in t.numericProps)if(s in e){let o=e[s];t.numericProps[s].fill(o,r,r+n)}}function cf(t,e){let r={};for(let n in t)e.includes(n)||(r[n]=t[n]);return r}function Sw(t,e){return e===Array||!Number.isFinite(t)?Array:e===Float64Array||Math.fround(t)!==t?Float64Array:Float32Array}function ws(t,e){let r=e?.globalFeatureId;return r!==void 0?Iw(t,r):ww(t,e?.type)}function Iw(t,e){let r=L0(t);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(e===n.globalFeatureIds.value[s])return Ui(n,s,i);s=i,o=a}}if(e===n.globalFeatureIds.value[s])return Ui(n,s,n.featureIds.value.length)}throw new Error(`featureId:${e} not found`)}function ww(t,e){let r=L0(t,e);return vw(r)}function L0(t,e){let r=[];return t.points&&(t.points.type="Point",r.push(t.points)),t.lines&&(t.lines.type="LineString",r.push(t.lines)),t.polygons&&(t.polygons.type="Polygon",r.push(t.polygons)),r}function vw(t){let e=[];for(let r of t){if(r.featureIds.value.length===0)continue;let n=0,s=r.featureIds.value[0];for(let o=0;o<r.featureIds.value.length;o++){let i=r.featureIds.value[o];i!==s&&(e.push(Ui(r,n,o)),n=o,s=i)}e.push(Ui(r,n,r.featureIds.value.length))}return e}function Ui(t,e,r){let n=M0(t,e,r),s=Fw(t,e,r),o=Lw(t,e,r);return{type:"Feature",geometry:n,properties:s,...o}}function Lw(t,e=0,r){return t.fields&&t.fields[t.featureIds.value[e]]}function Fw(t,e=0,r){let n=Object.assign({},t.properties[t.featureIds.value[e]]);for(let s in t.numericProps)n[s]=t.numericProps[s].value[e];return n}var mf=D(G0(),1);function Kw(t){let e=0;for(let r=0,n=t.length-1,s,o;r<t.length;n=r++)s=t[r],o=t[n],e+=(o[0]-s[0])*(s[1]+o[1]);return e}function hf(t,e){if(Array.isArray(t[0])){for(let n of t)hf(n,e);return}let r=t;r[0]/=e,r[1]/=e}function U0(t,e){for(let r=0;r<t.length;++r)t[r]/=e}function df(t,e,r){if(typeof t[0][0]!="number"){for(let i of t)df(i,e,r);return}let n=r*Math.pow(2,e.z),s=r*e.x,o=r*e.y;for(let i=0;i<t.length;i++){let a=t[i];a[0]=(a[0]+s)*360/n-180;let c=180-(a[1]+o)*360/n;a[1]=360/Math.PI*Math.atan(Math.exp(c*Math.PI/180))-90}}function V0(t,e,r){let{x:n,y:s,z:o}=e,i=r*Math.pow(2,o),a=r*n,c=r*s;for(let l=0,f=t.length;l<f;l+=2){t[l]=(t[l]+a)*360/i-180;let u=180-(t[l+1]+c)*360/i;t[l+1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}function H0(t){let e=t.length;if(e<=1)return[t];let r=[],n,s;for(let o=0;o<e;o++){let i=Kw(t[o]);i!==0&&(s===void 0&&(s=i<0),s===i<0?(n&&r.push(n),n=[t[o]]):n&&n.push(t[o]))}return n&&r.push(n),r}function z0(t){let e=t.indices.length,r="Polygon";if(e<=1)return{type:r,data:t.data,areas:[[br(t.data)]],indices:[t.indices]};let n=[],s=[],o=[],i=[],a,c=0;for(let l,f=0,u;f<e;f++){u=t.indices[f]-c,l=t.indices[f+1]-c||t.data.length;let h=t.data.slice(u,l),d=br(h);if(d===0){let p=t.data.slice(0,u),A=t.data.slice(l);t.data=p.concat(A),c+=l-u;continue}a===void 0&&(a=d<0),a===d<0?(i.length&&(n.push(o),s.push(i)),i=[u],o=[d]):(o.push(d),i.push(u))}return o&&n.push(o),i.length&&s.push(i),{type:r,areas:n,indices:s,data:t.data}}var Mr=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(e,r,n,s,o,i){this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=s,this._values=o,this._geometryInfo=i,e.readFields(Qw,this,r)}toGeoJSONFeature(e,r){let n=this.loadGeometry();switch(e){case"wgs84":return k0(this,n,s=>df(s,r,this.extent));default:return k0(this,n,hf)}}toBinaryFeature(e,r){let n=this.loadFlatGeometry();switch(e){case"wgs84":return this._toBinaryCoordinates(n,s=>V0(s,r,this.extent));default:return this._toBinaryCoordinates(n,U0)}}bbox(){let e=this._pbf;e.pos=this._geometry;let r=e.readVarint()+e.pos,n=1,s=0,o=0,i=0,a=1/0,c=-1/0,l=1/0,f=-1/0;for(;e.pos<r;){if(s<=0){let u=e.readVarint();n=u&7,s=u>>3}if(s--,n===1||n===2)o+=e.readSVarint(),i+=e.readSVarint(),o<a&&(a=o),o>c&&(c=o),i<l&&(l=i),i>f&&(f=i);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,l,c,f]}_toBinaryCoordinates(e,r){let n;r(e.data,this.extent);let s=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=e.indices.length,n={type:"Point",...e};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=e.indices.length,this._geometryInfo.linePositionsCount+=e.data.length/s,n={type:"LineString",...e};break;case 3:n=z0(e),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}loadGeometry(){let e=this._pbf;e.pos=this._geometry;let r=e.readVarint()+e.pos,n=1,s=0,o=0,i=0,a=[],c;for(;e.pos<r;){if(s<=0){let l=e.readVarint();n=l&7,s=l>>3}switch(s--,n){case 1:case 2:o+=e.readSVarint(),i+=e.readSVarint(),n===1&&(c&&a.push(c),c=[]),c&&c.push([o,i]);break;case 7:c&&c.push(c[0].slice());break;default:throw new Error(`unknown command ${n}`)}}return c&&a.push(c),a}loadFlatGeometry(){let e=this._pbf;e.pos=this._geometry;let r=e.readVarint()+e.pos,n=1,s,o=0,i=0,a=0,c=0,l=[],f=[];for(;e.pos<r;)if(o<=0&&(s=e.readVarint(),n=s&7,o=s>>3),o--,n===1||n===2)i+=e.readSVarint(),a+=e.readSVarint(),n===1&&l.push(c),f.push(i,a),c+=2;else if(n===7){if(c>0){let u=l[l.length-1];f.push(f[u],f[u+1]),c+=2}}else throw new Error(`unknown command ${n}`);return{data:f,indices:l}}};zt(Mr,"types",["Unknown","Point","LineString","Polygon"]);function k0(t,e,r){let n=Mr.types[t.type],s,o,i;switch(t.type){case 1:let c=[];for(s=0;s<e.length;s++)c[s]=e[s][0];i=c,r(i,t.extent);break;case 2:for(i=e,s=0;s<i.length;s++)r(i[s],t.extent);break;case 3:for(i=H0(e),s=0;s<i.length;s++)for(o=0;o<i[s].length;o++)r(i[s][o],t.extent);break;default:throw new Error("illegal vector tile type")}i.length===1?i=i[0]:n=`Multi${n}`;let a={type:"Feature",geometry:{type:n,coordinates:i},properties:t.properties};return t.id!==null&&(a.properties||={},a.properties.id=t.id),a}function Qw(t,e,r){e&&r&&(t===1?e.id=r.readVarint():t===2?Zw(r,e):t===3?e.type=r.readVarint():t===4&&(e._geometry=r.pos))}function Zw(t,e){let r=t.readVarint()+t.pos;for(;t.pos<r;){let n=e._keys[t.readVarint()],s=e._values[t.readVarint()];e.properties[n]=s}}var zi=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(e,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields($w,this,r),this.length=this._features.length}getGeoJSONFeature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let r=this._pbf.readVarint()+this._pbf.pos;return new Mr(this._pbf,r,this.extent,this._keys,this._values)}getBinaryFeature(e,r){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let n=this._pbf.readVarint()+this._pbf.pos;return new Mr(this._pbf,n,this.extent,this._keys,this._values,r)}};function $w(t,e,r){e&&r&&(t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(e3(r)))}function e3(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let n=t.readVarint()>>3;e=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null}return e}var vs=class{layers;constructor(e,r){this.layers=e.readFields(t3,{},r)}};function t3(t,e,r){if(t===3&&r){let n=new zi(r,r.readVarint()+r.pos);n.length&&e&&(e[n.name]=n)}}function gf(t,e){let r=n3(e),n=e?.gis?.format||e?.mvt?.shape||e?.shape;switch(n){case"columnar-table":return{shape:"columnar-table",data:pf(t,r)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:q0(t,r)};case"geojson":return q0(t,r);case"binary-geometry":return pf(t,r);case"binary":return pf(t,r);default:throw new Error(n||"undefined shape")}}function pf(t,e){let[r,n]=r3(t,e),s=Gi(r,n);return s.byteLength=t.byteLength,s}function r3(t,e){let r=[],n={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(t.byteLength<=0)return[r,n];let s=new vs(new mf.default(t));return(e&&Array.isArray(e.layers)?e.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.getBinaryFeature(c,n),f=o3(l,e,i);r.push(f)}}),[r,n]}function q0(t,e){if(t.byteLength<=0)return[];let r=[],n=new vs(new mf.default(t));return(Array.isArray(e.layers)?e.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.getGeoJSONFeature(a),l=s3(c,e,o);r.push(l)}}),r}function n3(t){if(!t?.mvt)throw new Error("mvt options required");if(t.mvt?.coordinates==="wgs84"&&!t.mvt.tileIndex)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return t.gis&&rc.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),t.mvt}function s3(t,e,r){let n=t.toGeoJSONFeature(e.coordinates||"local",e.tileIndex);return e.layerProperty&&(n.properties||={},n.properties[e.layerProperty]=r),n}function o3(t,e,r){let n=t.toBinaryFeature(e.coordinates||"local",e.tileIndex);return e.layerProperty&&n.properties&&(n.properties[e.layerProperty]=r),n}var j0={name:"Mapbox Vector Tile",id:"mvt",module:"mvt",extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],category:"geometry"};var i3="4.4.0-alpha.18",ki={...j0,dataType:null,batchType:null,version:i3,worker:!0,options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:void 0}}},a3={...ki,parse:async(t,e)=>gf(t,e),parseSync:gf,binary:!0};var c3={Point:J0,MultiPoint:l3,LineString:W0,MultiLineString:f3,Polygon:X0,MultiPolygon:u3};function J0([t,e],[r,n],s){let o=Et(r[0],n[0],t),i=Et(r[1],n[1],e);return s.unprojectFlat([o,i])}function Af(t,e,r){return t.map(n=>J0(n,e,r))}function l3(t,e,r){return Af(t,e,r)}function W0(t,e,r){return Af(t,e,r)}function f3(t,e,r){return t.map(n=>W0(n,e,r))}function X0(t,e,r){return t.map(n=>Af(n,e,r))}function u3(t,e,r){return t.map(n=>X0(n,e,r))}function Y0(t,e,r){let n=r.projectFlat([e.west,e.north]),s=r.projectFlat([e.east,e.south]),o=[n,s];return{...t,coordinates:c3[t.type](t.coordinates,o,r)}}var h3=["points","lines","polygons"];function xf(t,e,r,n){for(let s of h3){let o=t[s]&&d3(t[s],e,r,n);if(o>=0)return o}return-1}function d3(t,e,r,n){let s=t.featureIds.value;if(!s.length)return-1;let o=0,i=s[s.length-1]+1;if(n){let c=p3(t,n);if(c)o=c[0],i=c[1]+1;else return-1}let a=-1;if(e in t.numericProps){let c=t.numericProps[e].value.findIndex((l,f)=>l===r&&s[f]>=o&&s[f]<i);return c>=0?t.globalFeatureIds.value[c]:-1}else e?a=K0(t.properties,c=>c[e]===r,o,i):t.fields&&(a=K0(t.fields,c=>c.id===r,o,i));return a>=0?m3(t,a):-1}function p3(t,e){if(!t.__layers){let r={},{properties:n}=t;for(let s=0;s<n.length;s++){let{layerName:o}=n[s];o&&(r[o]?r[o][1]=s:r[o]=[s,s])}t.__layers=r}return t.__layers[e]}function m3(t,e){if(!t.__ids){let r=[],n=t.featureIds.value,s=t.globalFeatureIds.value;for(let o=0;o<n.length;o++)r[n[o]]=s[o];t.__ids=r}return t.__ids[e]}function K0(t,e,r,n){for(let s=r;s<n;s++)if(e(t[s],s))return s;return-1}var yf=512,g3={...bf.GeoJsonLayer.defaultProps,data:Ot,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[ki],binary:!0},Ls=class extends lr{initializeState(){super.initializeState();let e=this.context.viewport.resolution!==void 0?!1:this.props.binary;this.setState({binary:e,data:null,tileJSON:null,hoveredFeatureId:null,hoveredFeatureLayerName:null})}get isLoaded(){return Boolean(this.state?.data&&super.isLoaded)}updateState({props:e,oldProps:r,context:n,changeFlags:s}){s.dataChanged&&this._updateTileData(),this.state?.data&&(super.updateState({props:e,oldProps:r,context:n,changeFlags:s}),this._setWGS84PropertyForTiles());let{highlightColor:o}=e;o!==r.highlightColor&&Array.isArray(o)&&this.setState({highlightColor:o})}async _updateTileData(){let e=this.props.data,r=null;if(typeof e=="string"&&!vc(e)){let{onDataLoad:n,fetch:s}=this.props;this.setState({data:null,tileJSON:null});try{r=await s(e,{propName:"data",layer:this,loaders:[]})}catch(o){this.raiseError(o,"loading TileJSON"),e=null}n&&n(r,{propName:"data",layer:this})}else e&&typeof e=="object"&&"tilejson"in e&&(r=e);r&&(e=r.tiles),this.setState({data:e,tileJSON:r})}_getTilesetOptions(){let e=super._getTilesetOptions(),r=this.state.tileJSON,{minZoom:n,maxZoom:s}=this.props;return r&&(Number.isFinite(r.minzoom)&&r.minzoom>n&&(e.minZoom=r.minzoom),Number.isFinite(r.maxzoom)&&(!Number.isFinite(s)||r.maxzoom<s)&&(e.maxZoom=r.maxzoom)),e}renderLayers(){return this.state?.data?super.renderLayers():null}getTileData(e){let{data:r,binary:n}=this.state,{index:s,signal:o}=e,i=at(r,e);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(e){let{x:r,y:n,z:s}=e.tile.index,o=Math.pow(2,s),i=yf/o,a=-i,c=yf*r/o,l=yf*(1-n/o),f=new O().scale([i,a,1]);e.autoHighlight=!1,this.context.viewport.resolution||(e.modelMatrix=f,e.coordinateOrigin=[c,l,0],e.coordinateSystem=qi.COORDINATE_SYSTEM.CARTESIAN,e.extensions=[...e.extensions||[],new e1.ClipExtension]);let u=super.renderSubLayers(e);return this.state.binary&&!(u instanceof bf.GeoJsonLayer)&&qi.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),u}_updateAutoHighlight(e){let{uniqueIdProperty:r}=this.props,{hoveredFeatureId:n,hoveredFeatureLayerName:s}=this.state,o=e.object,i=null,a=null;o&&(i=Tf(o,r),a=Q0(o));let{highlightColor:c}=this.props;typeof c=="function"&&(c=c(e)),(n!==i||s!==a)&&this.setState({highlightColor:c,hoveredFeatureId:i,hoveredFeatureLayerName:a})}_isWGS84(){return Boolean(this.context.viewport.resolution)}getPickingInfo(e){let r=super.getPickingInfo(e);if(this.state.binary&&r.index!==-1){let{data:n}=e.sourceLayer.props;r.object=ws(n,{globalFeatureId:r.index})}return r.object&&!this._isWGS84()&&(r.object=$0(r.object,r.tile.bbox,this.context.viewport)),r}getSubLayerPropsByTile(e){return{highlightedObjectIndex:this.getHighlightedObjectIndex(e),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(e){let{hoveredFeatureId:r,hoveredFeatureLayerName:n,binary:s}=this.state,{uniqueIdProperty:o,highlightedFeatureId:i}=this.props,a=e.content,c=Z0(i);if(!(Z0(r)||c))return-1;let f=c?i:r;return Array.isArray(a)?a.findIndex(u=>{let h=Tf(u,o)===f,d=c||Q0(u)===n;return h&&d}):a&&s?xf(a,o,f,c?"":n):-1}_pickObjects(e){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:e})}getRenderedFeatures(e=null){let r=this._pickObjects(e),n=new Set,s=[];for(let o of r){let i=Tf(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 e="dataInWGS84";this.state.tileset.selectedTiles.forEach(n=>{n.hasOwnProperty(e)||Object.defineProperty(n,e,{get:()=>{if(!n.content)return null;if(this.state.binary&&Array.isArray(n.content)&&!n.content.length)return[];let{bbox:s}=n;if(n._contentWGS84===void 0&&Lc(s)){let o=this.state.binary?ws(n.content):n.content;n._contentWGS84=o.map(i=>$0(i,s,this.context.viewport))}return n._contentWGS84}})})}};Ls.layerName="MVTLayer";Ls.defaultProps=g3;var t1=Ls;function Tf(t,e){if(t.properties&&e)return t.properties[e];if("id"in t)return t.id}function Q0(t){return t.properties?.layerName||null}function Z0(t){return t!=null&&t!==""}function $0(t,e,r){let n={...t,geometry:{type:t.geometry.type}};return Object.defineProperty(n.geometry,"coordinates",{get:()=>Y0(t.geometry,e,r).coordinates}),n}var r1="0123456789bcdefghjkmnpqrstuvwxyz",n1={};for(let t=0;t<r1.length;t++)n1[r1.charAt(t)]=t;var A3=-90,x3=90,y3=-180,T3=180;function b3(t){let e=!0,r=x3,n=A3,s=T3,o=y3,i,a=0;for(let c=0,l=t.length;c<l;c++){let f=t[c].toLowerCase();a=n1[f];for(let u=4;u>=0;u--){let h=a>>u&1;e?(i=(s+o)/2,h===1?o=i:s=i):(i=(r+n)/2,h===1?n=i:r=i),e=!e}}return[n,o,r,s]}function s1(t){let[e,r,n,s]=b3(t);return[s,n,s,e,r,e,r,n,s,n]}var E3={getGeohash:{type:"accessor",value:t=>t.geohash}},Fs=class extends Oe{indexToBounds(){let{data:e,getGeohash:r}=this.props;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(n,s)=>s1(r(n,s))}}};Fs.layerName="GeohashLayer";Fs.defaultProps=E3;var o1=Fs;return h1(Rs);})();
|
|
1099
1259
|
/*! Bundled license information:
|
|
1100
1260
|
|
|
1101
1261
|
long/dist/long.js:
|