@deck.gl/geo-layers 9.2.5 → 9.2.7

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.min.js CHANGED
@@ -4,18 +4,18 @@
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 qT=Object.create;var Rs=Object.defineProperty;var kT=Object.getOwnPropertyDescriptor;var HT=Object.getOwnPropertyNames;var YT=Object.getPrototypeOf,WT=Object.prototype.hasOwnProperty;var JT=(e,t,n)=>t in e?Rs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var $1=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var ct=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Tt=(e,t)=>{for(var n in t)Rs(e,n,{get:t[n],enumerable:!0})},Xi=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of HT(t))!WT.call(e,s)&&s!==n&&Rs(e,s,{get:()=>t[s],enumerable:!(r=kT(t,s))||r.enumerable});return e},tn=(e,t,n)=>(Xi(e,t,"default"),n&&Xi(n,t,"default")),G=(e,t,n)=>(n=e!=null?qT(YT(e)):{},Xi(t||!e||!e.__esModule?Rs(n,"default",{value:e,enumerable:!0}):n,e)),jT=e=>Xi(Rs({},"__esModule",{value:!0}),e);var mr=(e,t,n)=>(JT(e,typeof t!="symbol"?t+"":t,n),n);var he=ct((MU,tp)=>{tp.exports=globalThis.deck});var le=ct((yU,np)=>{np.exports=globalThis.deck});var uo=ct((GU,Mu)=>{Mu.exports=globalThis.h3||{}});var Ro=ct(De=>{"use strict";var Ad=":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",jL=Ad+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",yd="["+Ad+"]["+jL+"]*",XL=new RegExp("^"+yd+"$"),KL=function(e,t){let n=[],r=t.exec(e);for(;r;){let s=[];s.startIndex=t.lastIndex-r[0].length;let i=r.length;for(let o=0;o<i;o++)s.push(r[o]);n.push(s),r=t.exec(e)}return n},QL=function(e){let t=XL.exec(e);return!(t===null||typeof t>"u")};De.isExist=function(e){return typeof e<"u"};De.isEmptyObject=function(e){return Object.keys(e).length===0};De.merge=function(e,t,n){if(t){let r=Object.keys(t),s=r.length;for(let i=0;i<s;i++)n==="strict"?e[r[i]]=[t[r[i]]]:e[r[i]]=t[r[i]]}};De.getValue=function(e){return De.isExist(e)?e:""};De.isName=QL;De.getAllMatches=KL;De.nameRegexp=yd});var Qh=ct(Cd=>{"use strict";var Kh=Ro(),ZL={allowBooleanAttributes:!1,unpairedTags:[]};Cd.validate=function(e,t){t=Object.assign({},ZL,t);let n=[],r=!1,s=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let i=0;i<e.length;i++)if(e[i]==="<"&&e[i+1]==="?"){if(i+=2,i=Td(e,i),i.err)return i}else if(e[i]==="<"){let o=i;if(i++,e[i]==="!"){i=_d(e,i);continue}else{let c=!1;e[i]==="/"&&(c=!0,i++);let a="";for(;i<e.length&&e[i]!==">"&&e[i]!==" "&&e[i]!==" "&&e[i]!==`
8
- `&&e[i]!=="\r";i++)a+=e[i];if(a=a.trim(),a[a.length-1]==="/"&&(a=a.substring(0,a.length-1),i--),!oR(a)){let f;return a.trim().length===0?f="Invalid space after '<'.":f="Tag '"+a+"' is an invalid name.",mt("InvalidTag",f,kt(e,i))}let h=eR(e,i);if(h===!1)return mt("InvalidAttr","Attributes for '"+a+"' have open quote.",kt(e,i));let l=h.value;if(i=h.index,l[l.length-1]==="/"){let f=i-l.length;l=l.substring(0,l.length-1);let p=Sd(l,t);if(p===!0)r=!0;else return mt(p.err.code,p.err.msg,kt(e,f+p.err.line))}else if(c)if(h.tagClosed){if(l.trim().length>0)return mt("InvalidTag","Closing tag '"+a+"' can't have attributes or invalid starting.",kt(e,o));if(n.length===0)return mt("InvalidTag","Closing tag '"+a+"' has not been opened.",kt(e,o));{let f=n.pop();if(a!==f.tagName){let p=kt(e,f.tagStartPos);return mt("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+p.line+", col "+p.col+") instead of closing tag '"+a+"'.",kt(e,o))}n.length==0&&(s=!0)}}else return mt("InvalidTag","Closing tag '"+a+"' doesn't have proper closing.",kt(e,i));else{let f=Sd(l,t);if(f!==!0)return mt(f.err.code,f.err.msg,kt(e,i-l.length+f.err.line));if(s===!0)return mt("InvalidXml","Multiple possible root nodes found.",kt(e,i));t.unpairedTags.indexOf(a)!==-1||n.push({tagName:a,tagStartPos:o}),r=!0}for(i++;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="!"){i++,i=_d(e,i);continue}else if(e[i+1]==="?"){if(i=Td(e,++i),i.err)return i}else break;else if(e[i]==="&"){let f=sR(e,i);if(f==-1)return mt("InvalidChar","char '&' is not expected.",kt(e,i));i=f}else if(s===!0&&!Ed(e[i]))return mt("InvalidXml","Extra text at the end",kt(e,i));e[i]==="<"&&i--}}else{if(Ed(e[i]))continue;return mt("InvalidChar","char '"+e[i]+"' is not expected.",kt(e,i))}if(r){if(n.length==1)return mt("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",kt(e,n[0].tagStartPos));if(n.length>0)return mt("InvalidXml","Invalid '"+JSON.stringify(n.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return mt("InvalidXml","Start tag expected.",1);return!0};function Ed(e){return e===" "||e===" "||e===`
9
- `||e==="\r"}function Td(e,t){let n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){let r=e.substr(n,t-n);if(t>5&&r==="xml")return mt("InvalidXml","XML declaration allowed only at the start of the document.",kt(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function _d(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}var $L='"',tR="'";function eR(e,t){let n="",r="",s=!1;for(;t<e.length;t++){if(e[t]===$L||e[t]===tR)r===""?r=e[t]:r!==e[t]||(r="");else if(e[t]===">"&&r===""){s=!0;break}n+=e[t]}return r!==""?!1:{value:n,index:t,tagClosed:s}}var nR=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Sd(e,t){let n=Kh.getAllMatches(e,nR),r={};for(let s=0;s<n.length;s++){if(n[s][1].length===0)return mt("InvalidAttr","Attribute '"+n[s][2]+"' has no space in starting.",Gs(n[s]));if(n[s][3]!==void 0&&n[s][4]===void 0)return mt("InvalidAttr","Attribute '"+n[s][2]+"' is without value.",Gs(n[s]));if(n[s][3]===void 0&&!t.allowBooleanAttributes)return mt("InvalidAttr","boolean attribute '"+n[s][2]+"' is not allowed.",Gs(n[s]));let i=n[s][2];if(!iR(i))return mt("InvalidAttr","Attribute '"+i+"' is an invalid name.",Gs(n[s]));if(!r.hasOwnProperty(i))r[i]=1;else return mt("InvalidAttr","Attribute '"+i+"' is repeated.",Gs(n[s]))}return!0}function rR(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function sR(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,rR(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function mt(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function iR(e){return Kh.isName(e)}function oR(e){return Kh.isName(e)}function kt(e,t){let n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Gs(e){return e.startIndex+e[1].length}});var Ld=ct(Zh=>{var Bd={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e}},cR=function(e){return Object.assign({},Bd,e)};Zh.buildOptions=cR;Zh.defaultOptions=Bd});var bd=ct((L9,Rd)=>{"use strict";var $h=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,[":@"]:t[":@"]}):this.child.push({[t.tagname]:t.child})}};Rd.exports=$h});var Id=ct((R9,wd)=>{var aR=Ro();function hR(e,t){let n={};if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let r=1,s=!1,i=!1,o="";for(;t<e.length;t++)if(e[t]==="<"&&!i){if(s&&pR(e,t))t+=7,[entityName,val,t]=lR(e,t+1),val.indexOf("&")===-1&&(n[gR(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(s&&uR(e,t))t+=8;else if(s&&dR(e,t))t+=8;else if(s&&mR(e,t))t+=9;else if(fR)i=!0;else throw new Error("Invalid DOCTYPE");r++,o=""}else if(e[t]===">"){if(i?e[t-1]==="-"&&e[t-2]==="-"&&(i=!1,r--):r--,r===0)break}else e[t]==="["?s=!0:o+=e[t];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:t}}function lR(e,t){let n="";for(;t<e.length&&e[t]!=="'"&&e[t]!=='"';t++)n+=e[t];if(n=n.trim(),n.indexOf(" ")!==-1)throw new Error("External entites are not supported");let r=e[t++],s="";for(;t<e.length&&e[t]!==r;t++)s+=e[t];return[n,s,t]}function fR(e,t){return e[t+1]==="!"&&e[t+2]==="-"&&e[t+3]==="-"}function pR(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 uR(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 dR(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 mR(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 gR(e){if(aR.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}wd.exports=hR});var Od=ct((b9,Pd)=>{var xR=/^[-+]?0x[a-fA-F0-9]+$/,MR=/^([\-\+])?(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 AR={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function yR(e,t={}){if(t=Object.assign({},AR,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(t.hex&&xR.test(n))return Number.parseInt(n,16);{let r=MR.exec(n);if(r){let s=r[1],i=r[2],o=ER(r[3]),c=r[4]||r[6];if(!t.leadingZeros&&i.length>0&&s&&n[2]!==".")return e;if(!t.leadingZeros&&i.length>0&&!s&&n[1]!==".")return e;{let a=Number(n),h=""+a;return h.search(/[eE]/)!==-1||c?t.eNotation?a:e:n.indexOf(".")!==-1?h==="0"&&o===""||h===o||s&&h==="-"+o?a:e:i?o===h||s+o===h?a:e:n===h||n===s+h?a:e}}else return e}}function ER(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}Pd.exports=yR});var Fd=ct((w9,Nd)=>{"use strict";var vd=Ro(),zs=bd(),TR=Id(),_R=Od(),tl=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,r)=>String.fromCharCode(Number.parseInt(r,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>String.fromCharCode(Number.parseInt(r,16))}},this.addExternalEntities=SR,this.parseXml=bR,this.parseTextData=CR,this.resolveNameSpace=BR,this.buildAttributesMap=RR,this.isItStopNode=OR,this.replaceEntitiesValue=IR,this.readStopNodeData=NR,this.saveTextToParentTag=PR,this.addChild=wR}};function SR(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function CR(e,t,n,r,s,i,o){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e));let c=this.options.tagValueProcessor(t,e,n,s,i);return c==null?e:typeof c!=typeof e||c!==e?c:this.options.trimValues?nl(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?nl(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function BR(e){if(this.options.removeNSPrefix){let t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}var LR=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function RR(e,t,n){if(!this.options.ignoreAttributes&&typeof e=="string"){let r=vd.getAllMatches(e,LR),s=r.length,i={};for(let o=0;o<s;o++){let c=this.resolveNameSpace(r[o][1]),a=r[o][4],h=this.options.attributeNamePrefix+c;if(c.length)if(this.options.transformAttributeName&&(h=this.options.transformAttributeName(h)),h==="__proto__"&&(h="#__proto__"),a!==void 0){this.options.trimValues&&(a=a.trim()),a=this.replaceEntitiesValue(a);let l=this.options.attributeValueProcessor(c,a,t);l==null?i[h]=a:typeof l!=typeof a||l!==a?i[h]=l:i[h]=nl(a,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[h]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){let o={};return o[this.options.attributesGroupName]=i,o}return i}}var bR=function(e){e=e.replace(/\r\n?/g,`
10
- `);let t=new zs("!xml"),n=t,r="",s="";for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){let c=Fn(e,">",i,"Closing Tag is not closed."),a=e.substring(i+2,c).trim();if(this.options.removeNSPrefix){let f=a.indexOf(":");f!==-1&&(a=a.substr(f+1))}this.options.transformTagName&&(a=this.options.transformTagName(a)),n&&(r=this.saveTextToParentTag(r,n,s));let h=s.substring(s.lastIndexOf(".")+1);if(a&&this.options.unpairedTags.indexOf(a)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${a}>`);let l=0;h&&this.options.unpairedTags.indexOf(h)!==-1?(l=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):l=s.lastIndexOf("."),s=s.substring(0,l),n=this.tagsNodeStack.pop(),r="",i=c}else if(e[i+1]==="?"){let c=el(e,i,!1,"?>");if(!c)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,s),!(this.options.ignoreDeclaration&&c.tagName==="?xml"||this.options.ignorePiTags)){let a=new zs(c.tagName);a.add(this.options.textNodeName,""),c.tagName!==c.tagExp&&c.attrExpPresent&&(a[":@"]=this.buildAttributesMap(c.tagExp,s,c.tagName)),this.addChild(n,a,s)}i=c.closeIndex+1}else if(e.substr(i+1,3)==="!--"){let c=Fn(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){let a=e.substring(i+4,c-2);r=this.saveTextToParentTag(r,n,s),n.add(this.options.commentPropName,[{[this.options.textNodeName]:a}])}i=c}else if(e.substr(i+1,2)==="!D"){let c=TR(e,i);this.docTypeEntities=c.entities,i=c.i}else if(e.substr(i+1,2)==="!["){let c=Fn(e,"]]>",i,"CDATA is not closed.")-2,a=e.substring(i+9,c);r=this.saveTextToParentTag(r,n,s);let h=this.parseTextData(a,n.tagname,s,!0,!1,!0,!0);h==null&&(h=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:a}]):n.add(this.options.textNodeName,h),i=c+2}else{let c=el(e,i,this.options.removeNSPrefix),a=c.tagName,h=c.rawTagName,l=c.tagExp,f=c.attrExpPresent,p=c.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,s,!1));let u=n;if(u&&this.options.unpairedTags.indexOf(u.tagname)!==-1&&(n=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),a!==t.tagname&&(s+=s?"."+a:a),this.isItStopNode(this.options.stopNodes,s,a)){let d="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)a[a.length-1]==="/"?(a=a.substr(0,a.length-1),s=s.substr(0,s.length-1),l=a):l=l.substr(0,l.length-1),i=c.closeIndex;else if(this.options.unpairedTags.indexOf(a)!==-1)i=c.closeIndex;else{let m=this.readStopNodeData(e,h,p+1);if(!m)throw new Error(`Unexpected end of ${h}`);i=m.i,d=m.tagContent}let g=new zs(a);a!==l&&f&&(g[":@"]=this.buildAttributesMap(l,s,a)),d&&(d=this.parseTextData(d,a,s,!0,f,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),g.add(this.options.textNodeName,d),this.addChild(n,g,s)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){a[a.length-1]==="/"?(a=a.substr(0,a.length-1),s=s.substr(0,s.length-1),l=a):l=l.substr(0,l.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));let d=new zs(a);a!==l&&f&&(d[":@"]=this.buildAttributesMap(l,s,a)),this.addChild(n,d,s),s=s.substr(0,s.lastIndexOf("."))}else{let d=new zs(a);this.tagsNodeStack.push(n),a!==l&&f&&(d[":@"]=this.buildAttributesMap(l,s,a)),this.addChild(n,d,s),n=d}r="",i=p}}else r+=e[i];return t.child};function wR(e,t,n){let r=this.options.updateTag(t.tagname,n,t[":@"]);r===!1||(typeof r=="string"&&(t.tagname=r),e.addChild(t))}var IR=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){let n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){let n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){let n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function PR(e,t,n,r){return e&&(r===void 0&&(r=Object.keys(t.child).length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,r),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function OR(e,t,n){let r="*."+n;for(let s in e){let i=e[s];if(r===i||t===i)return!0}return!1}function vR(e,t,n=">"){let r,s="";for(let i=t;i<e.length;i++){let o=e[i];if(r)o===r&&(r="");else if(o==='"'||o==="'")r=o;else if(o===n[0])if(n[1]){if(e[i+1]===n[1])return{data:s,index:i}}else return{data:s,index:i};else o===" "&&(o=" ");s+=o}}function Fn(e,t,n,r){let s=e.indexOf(t,n);if(s===-1)throw new Error(r);return s+t.length-1}function el(e,t,n,r=">"){let s=vR(e,t+1,r);if(!s)return;let i=s.data,o=s.index,c=i.search(/\s/),a=i,h=!0;c!==-1&&(a=i.substring(0,c),i=i.substring(c+1).trimStart());let l=a;if(n){let f=a.indexOf(":");f!==-1&&(a=a.substr(f+1),h=a!==s.data.substr(f+1))}return{tagName:a,tagExp:i,closeIndex:o,attrExpPresent:h,rawTagName:l}}function NR(e,t,n){let r=n,s=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){let i=Fn(e,">",n,`${t} is not closed`);if(e.substring(n+2,i).trim()===t&&(s--,s===0))return{tagContent:e.substring(r,n),i};n=i}else if(e[n+1]==="?")n=Fn(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=Fn(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=Fn(e,"]]>",n,"StopNode is not closed.")-2;else{let i=el(e,n,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&s++,n=i.closeIndex)}}function nl(e,t,n){if(t&&typeof e=="string"){let r=e.trim();return r==="true"?!0:r==="false"?!1:_R(e,n)}else return vd.isExist(e)?e:""}Nd.exports=tl});var Gd=ct(Ud=>{"use strict";function FR(e,t){return Dd(e,t)}function Dd(e,t,n){let r,s={};for(let i=0;i<e.length;i++){let o=e[i],c=DR(o),a="";if(n===void 0?a=c:a=n+"."+c,c===t.textNodeName)r===void 0?r=o[c]:r+=""+o[c];else{if(c===void 0)continue;if(o[c]){let h=Dd(o[c],t,a),l=GR(h,t);o[":@"]?UR(h,o[":@"],a,t):Object.keys(h).length===1&&h[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?h=h[t.textNodeName]:Object.keys(h).length===0&&(t.alwaysCreateTextNode?h[t.textNodeName]="":h=""),s[c]!==void 0&&s.hasOwnProperty(c)?(Array.isArray(s[c])||(s[c]=[s[c]]),s[c].push(h)):t.isArray(c,a,l)?s[c]=[h]:s[c]=h}}}return typeof r=="string"?r.length>0&&(s[t.textNodeName]=r):r!==void 0&&(s[t.textNodeName]=r),s}function DR(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(r!==":@")return r}}function UR(e,t,n,r){if(t){let s=Object.keys(t),i=s.length;for(let o=0;o<i;o++){let c=s[o];r.isArray(c,n+"."+c,!0,!0)?e[c]=[t[c]]:e[c]=t[c]}}}function GR(e,t){let{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}Ud.prettify=FR});var Vd=ct((P9,zd)=>{var{buildOptions:zR}=Ld(),VR=Fd(),{prettify:qR}=Gd(),kR=Qh(),rl=class{constructor(t){this.externalEntities={},this.options=zR(t)}parse(t,n){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});let i=kR.validate(t,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let r=new VR(this.options);r.addExternalEntities(this.externalEntities);let s=r.parseXml(t);return this.options.preserveOrder||s===void 0?s:qR(s,this.options)}addEntity(t,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}};zd.exports=rl});var Wd=ct((O9,Yd)=>{var HR=`
11
- `;function YR(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=HR),kd(e,t,"",n)}function kd(e,t,n,r){let s="",i=!1;for(let o=0;o<e.length;o++){let c=e[o],a=WR(c);if(a===void 0)continue;let h="";if(n.length===0?h=a:h=`${n}.${a}`,a===t.textNodeName){let d=c[a];JR(h,t)||(d=t.tagValueProcessor(a,d),d=Hd(d,t)),i&&(s+=r),s+=d,i=!1;continue}else if(a===t.cdataPropName){i&&(s+=r),s+=`<![CDATA[${c[a][0][t.textNodeName]}]]>`,i=!1;continue}else if(a===t.commentPropName){s+=r+`<!--${c[a][0][t.textNodeName]}-->`,i=!0;continue}else if(a[0]==="?"){let d=qd(c[":@"],t),g=a==="?xml"?"":r,m=c[a][0][t.textNodeName];m=m.length!==0?" "+m:"",s+=g+`<${a}${m}${d}?>`,i=!0;continue}let l=r;l!==""&&(l+=t.indentBy);let f=qd(c[":@"],t),p=r+`<${a}${f}`,u=kd(c[a],t,h,l);t.unpairedTags.indexOf(a)!==-1?t.suppressUnpairedNode?s+=p+">":s+=p+"/>":(!u||u.length===0)&&t.suppressEmptyNode?s+=p+"/>":u&&u.endsWith(">")?s+=p+`>${u}${r}</${a}>`:(s+=p+">",u&&r!==""&&(u.includes("/>")||u.includes("</"))?s+=r+t.indentBy+u+r:s+=u,s+=`</${a}>`),i=!0}return s}function WR(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(e.hasOwnProperty(r)&&r!==":@")return r}}function qd(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let s=t.attributeValueProcessor(r,e[r]);s=Hd(s,t),s===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${s}"`}return n}function JR(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(".")+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]==="*."+n)return!0;return!1}function Hd(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){let r=t.entities[n];e=e.replace(r.regex,r.val)}return e}Yd.exports=YR});var jd=ct((v9,Jd)=>{"use strict";var jR=Wd(),XR={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:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function sn(e){this.options=Object.assign({},XR,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=ZR),this.processTextOrObjNode=KR,this.options.format?(this.indentate=QR,this.tagEndChar=`>
7
+ "use strict";var __exports__=(()=>{var d1=Object.create;var nn=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?nn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ff=(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)nn(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&&nn(e,s,{get:()=>t[s],enumerable:!(n=p1(t,s))||n.enumerable});return e},xe=(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?nn(r,"default",{value:e,enumerable:!0}):r,e)),y1=e=>ys(nn({},"__esModule",{value:!0}),e);var sn=(e,t,r)=>(x1(e,typeof t!="symbol"?t+"":t,r),r);var zt=rt((nL,uf)=>{uf.exports=globalThis.deck});var qt=rt((oL,df)=>{df.exports=globalThis.deck});var Ds=rt((bL,wu)=>{wu.exports=globalThis.h3||{}});var eo=rt(ce=>{"use strict";var wh=":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=wh+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Lh="["+wh+"]["+WE+"]*",YE=new RegExp("^"+Lh+"$"),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=Lh});var wa=rt(Oh=>{"use strict";var Ia=eo(),ZE={allowBooleanAttributes:!1,unpairedTags:[]};Oh.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=Rh(e,o),o.err)return o}else if(e[o]==="<"){let i=o;if(o++,e[o]==="!"){o=Fh(e,o);continue}else{let a=!1;e[o]==="/"&&(a=!0,o++);let c="";for(;o<e.length&&e[o]!==">"&&e[o]!==" "&&e[o]!==" "&&e[o]!==`
8
+ `&&e[o]!=="\r";o++)c+=e[o];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),o--),!i_(c)){let u;return c.trim().length===0?u="Invalid space after '<'.":u="Tag '"+c+"' is an invalid name.",ot("InvalidTag",u,_t(e,o))}let l=e_(e,o);if(l===!1)return ot("InvalidAttr","Attributes for '"+c+"' have open quote.",_t(e,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=Ph(f,t);if(h===!0)n=!0;else return ot(h.err.code,h.err.msg,_t(e,u+h.err.line))}else if(a)if(l.tagClosed){if(f.trim().length>0)return ot("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",_t(e,i));if(r.length===0)return ot("InvalidTag","Closing tag '"+c+"' has not been opened.",_t(e,i));{let u=r.pop();if(c!==u.tagName){let h=_t(e,u.tagStartPos);return ot("InvalidTag","Expected closing tag '"+u.tagName+"' (opened in line "+h.line+", col "+h.col+") instead of closing tag '"+c+"'.",_t(e,i))}r.length==0&&(s=!0)}}else return ot("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",_t(e,o));else{let u=Ph(f,t);if(u!==!0)return ot(u.err.code,u.err.msg,_t(e,o-f.length+u.err.line));if(s===!0)return ot("InvalidXml","Multiple possible root nodes found.",_t(e,o));t.unpairedTags.indexOf(c)!==-1||r.push({tagName:c,tagStartPos:i}),n=!0}for(o++;o<e.length;o++)if(e[o]==="<")if(e[o+1]==="!"){o++,o=Fh(e,o);continue}else if(e[o+1]==="?"){if(o=Rh(e,++o),o.err)return o}else break;else if(e[o]==="&"){let u=s_(e,o);if(u==-1)return ot("InvalidChar","char '&' is not expected.",_t(e,o));o=u}else if(s===!0&&!vh(e[o]))return ot("InvalidXml","Extra text at the end",_t(e,o));e[o]==="<"&&o--}}else{if(vh(e[o]))continue;return ot("InvalidChar","char '"+e[o]+"' is not expected.",_t(e,o))}if(n){if(r.length==1)return ot("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",_t(e,r[0].tagStartPos));if(r.length>0)return ot("InvalidXml","Invalid '"+JSON.stringify(r.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return ot("InvalidXml","Start tag expected.",1);return!0};function vh(e){return e===" "||e===" "||e===`
9
+ `||e==="\r"}function Rh(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 Fh(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 Ph(e,t){let r=Ia.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.",Tn(r[s]));if(r[s][3]!==void 0&&r[s][4]===void 0)return ot("InvalidAttr","Attribute '"+r[s][2]+"' is without value.",Tn(r[s]));if(r[s][3]===void 0&&!t.allowBooleanAttributes)return ot("InvalidAttr","boolean attribute '"+r[s][2]+"' is not allowed.",Tn(r[s]));let o=r[s][2];if(!o_(o))return ot("InvalidAttr","Attribute '"+o+"' is an invalid name.",Tn(r[s]));if(!n.hasOwnProperty(o))n[o]=1;else return ot("InvalidAttr","Attribute '"+o+"' is repeated.",Tn(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 Ia.isName(e)}function i_(e){return Ia.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 Tn(e){return e.startIndex+e[1].length}});var Dh=rt(La=>{var Nh={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({},Nh,e)};La.buildOptions=a_;La.defaultOptions=Nh});var Uh=rt((hR,Gh)=>{"use strict";var va=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})}};Gh.exports=va});var Hh=rt((dR,Vh)=>{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}`)}Vh.exports=l_});var qh=rt((pR,zh)=>{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}zh.exports=T_});var jh=rt((mR,Jh)=>{"use strict";var kh=eo(),En=Uh(),__=Hh(),M_=qh(),Ra=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?Pa(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?Pa(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=kh.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]=Pa(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 En("!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=Fa(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 En(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=Fa(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 En(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 En(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 En(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 Fa(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=Fa(e,r,">");o&&((o&&o.tagName)===t&&o.tagExp[o.tagExp.length-1]!=="/"&&s++,r=o.closeIndex)}}function Pa(e,t,r){if(t&&typeof e=="string"){let n=e.trim();return n==="true"?!0:n==="false"?!1:M_(e,r)}else return kh.isExist(e)?e:""}Jh.exports=Ra});var Yh=rt(Wh=>{"use strict";function N_(e,t){return Xh(e,t)}function Xh(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=Xh(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))}Wh.prettify=N_});var Qh=rt((AR,Kh)=>{var{buildOptions:V_}=Dh(),H_=jh(),{prettify:z_}=Yh(),q_=wa(),Oa=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 '&#xD;'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=r}};Kh.exports=Oa});var rd=rt((xR,ed)=>{var k_=`
11
+ `;function J_(e,t){let r="";return t.format&&t.indentBy.length>0&&(r=k_),$h(e,t,"",r)}function $h(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=td(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=Zh(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=Zh(a[":@"],t),h=n+`<${c}${u}`,d=$h(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 Zh(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=td(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 td(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}ed.exports=J_});var sd=rt((yR,nd)=>{"use strict";var W_=rd(),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:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Me(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
12
  `,this.newLine=`
13
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}sn.prototype.build=function(e){return this.options.preserveOrder?jR(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)};sn.prototype.j2x=function(e,t){let n="",r="";for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(typeof e[s]>"u")this.isAttribute(s)&&(r+="");else if(e[s]===null)this.isAttribute(s)?r+="":s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)r+=this.buildTextValNode(e[s],s,"",t);else if(typeof e[s]!="object"){let i=this.isAttribute(s);if(i)n+=this.buildAttrPairStr(i,""+e[s]);else if(s===this.options.textNodeName){let o=this.options.tagValueProcessor(s,""+e[s]);r+=this.replaceEntitiesValue(o)}else r+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){let i=e[s].length,o="",c="";for(let a=0;a<i;a++){let h=e[s][a];if(!(typeof h>"u"))if(h===null)s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(typeof h=="object")if(this.options.oneListGroup){let l=this.j2x(h,t+1);o+=l.val,this.options.attributesGroupName&&h.hasOwnProperty(this.options.attributesGroupName)&&(c+=l.attrStr)}else o+=this.processTextOrObjNode(h,s,t);else if(this.options.oneListGroup){let l=this.options.tagValueProcessor(s,h);l=this.replaceEntitiesValue(l),o+=l}else o+=this.buildTextValNode(h,s,"",t)}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,c,t)),r+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){let i=Object.keys(e[s]),o=i.length;for(let c=0;c<o;c++)n+=this.buildAttrPairStr(i[c],""+e[s][i[c]])}else r+=this.processTextOrObjNode(e[s],s,t);return{attrStr:n,val:r}};sn.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 KR(e,t,n){let r=this.j2x(e,n+1);return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,r.attrStr,n):this.buildObjectNode(r.val,t,r.attrStr,n)}sn.prototype.buildObjectNode=function(e,t,n,r){if(e==="")return t[0]==="?"?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let s="</"+t+this.tagEndChar,i="";return t[0]==="?"&&(i="?",s=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(r)+"<"+t+n+i+">"+e+s:this.options.commentPropName!==!1&&t===this.options.commentPropName&&i.length===0?this.indentate(r)+`<!--${e}-->`+this.newLine:this.indentate(r)+"<"+t+n+i+this.tagEndChar+e+this.indentate(r)+s}};sn.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};sn.prototype.buildTextValNode=function(e,t,n,r){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(r)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(t,e);return s=this.replaceEntitiesValue(s),s===""?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+s+"</"+t+this.tagEndChar}};sn.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){let n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function QR(e){return this.options.indentBy.repeat(e)}function ZR(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}Jd.exports=sn});var Kd=ct((N9,Xd)=>{"use strict";var $R=Qh(),tb=Vd(),eb=jd();Xd.exports={XMLParser:tb,XMLValidator:$R,XMLBuilder:eb}});var Rl=ct((Hm,ti)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof $1=="function"&&typeof ti=="object"&&ti&&ti.exports?ti.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(Hm,function(){"use strict";function e(S,x,R){this.low=S|0,this.high=x|0,this.unsigned=!!R}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function t(S){return(S&&S.__isLong__)===!0}e.isLong=t;var n={},r={};function s(S,x){var R,b,w;return x?(S>>>=0,(w=0<=S&&S<256)&&(b=r[S],b)?b:(R=o(S,(S|0)<0?-1:0,!0),w&&(r[S]=R),R)):(S|=0,(w=-128<=S&&S<128)&&(b=n[S],b)?b:(R=o(S,S<0?-1:0,!1),w&&(n[S]=R),R))}e.fromInt=s;function i(S,x){if(isNaN(S)||!isFinite(S))return x?M:m;if(x){if(S<0)return M;if(S>=u)return _}else{if(S<=-d)return L;if(S+1>=d)return T}return S<0?i(-S,x).neg():o(S%p|0,S/p|0,x)}e.fromNumber=i;function o(S,x,R){return new e(S,x,R)}e.fromBits=o;var c=Math.pow;function a(S,x,R){if(S.length===0)throw Error("empty string");if(S==="NaN"||S==="Infinity"||S==="+Infinity"||S==="-Infinity")return m;if(typeof x=="number"?(R=x,x=!1):x=!!x,R=R||10,R<2||36<R)throw RangeError("radix");var b;if((b=S.indexOf("-"))>0)throw Error("interior hyphen");if(b===0)return a(S.substring(1),x,R).neg();for(var w=i(c(R,8)),B=m,v=0;v<S.length;v+=8){var H=Math.min(8,S.length-v),V=parseInt(S.substring(v,v+H),R);if(H<8){var tt=i(c(R,H));B=B.mul(tt).add(i(V))}else B=B.mul(w),B=B.add(i(V))}return B.unsigned=x,B}e.fromString=a;function h(S){return S instanceof e?S:typeof S=="number"?i(S):typeof S=="string"?a(S):o(S.low,S.high,S.unsigned)}e.fromValue=h;var l=1<<16,f=1<<24,p=l*l,u=p*p,d=u/2,g=s(f),m=s(0);e.ZERO=m;var M=s(0,!0);e.UZERO=M;var E=s(1);e.ONE=E;var A=s(1,!0);e.UONE=A;var y=s(-1);e.NEG_ONE=y;var T=o(-1,2147483647,!1);e.MAX_VALUE=T;var _=o(-1,-1,!0);e.MAX_UNSIGNED_VALUE=_;var L=o(0,-2147483648,!1);e.MIN_VALUE=L;var C=e.prototype;return C.toInt=function(){return this.unsigned?this.low>>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},C.toString=function(x){if(x=x||10,x<2||36<x)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(L)){var R=i(x),b=this.div(R),w=b.mul(R).sub(this);return b.toString(x)+w.toInt().toString(x)}else return"-"+this.neg().toString(x);for(var B=i(c(x,6),this.unsigned),v=this,H="";;){var V=v.div(B),tt=v.sub(V.mul(B)).toInt()>>>0,Y=tt.toString(x);if(v=V,v.isZero())return Y+H;for(;Y.length<6;)Y="0"+Y;H=""+Y+H}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){if(this.isNegative())return this.eq(L)?64:this.neg().getNumBitsAbs();for(var x=this.high!=0?this.high:this.low,R=31;R>0&&!(x&1<<R);R--);return this.high!=0?R+33:R+1},C.isZero=function(){return this.high===0&&this.low===0},C.isNegative=function(){return!this.unsigned&&this.high<0},C.isPositive=function(){return this.unsigned||this.high>=0},C.isOdd=function(){return(this.low&1)===1},C.isEven=function(){return(this.low&1)===0},C.equals=function(x){return t(x)||(x=h(x)),this.unsigned!==x.unsigned&&this.high>>>31===1&&x.high>>>31===1?!1:this.high===x.high&&this.low===x.low},C.eq=C.equals,C.notEquals=function(x){return!this.eq(x)},C.neq=C.notEquals,C.lessThan=function(x){return this.comp(x)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(x){return this.comp(x)<=0},C.lte=C.lessThanOrEqual,C.greaterThan=function(x){return this.comp(x)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(x){return this.comp(x)>=0},C.gte=C.greaterThanOrEqual,C.compare=function(x){if(t(x)||(x=h(x)),this.eq(x))return 0;var R=this.isNegative(),b=x.isNegative();return R&&!b?-1:!R&&b?1:this.unsigned?x.high>>>0>this.high>>>0||x.high===this.high&&x.low>>>0>this.low>>>0?-1:1:this.sub(x).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(L)?L:this.not().add(E)},C.neg=C.negate,C.add=function(x){t(x)||(x=h(x));var R=this.high>>>16,b=this.high&65535,w=this.low>>>16,B=this.low&65535,v=x.high>>>16,H=x.high&65535,V=x.low>>>16,tt=x.low&65535,Y=0,et=0,ot=0,Yt=0;return Yt+=B+tt,ot+=Yt>>>16,Yt&=65535,ot+=w+V,et+=ot>>>16,ot&=65535,et+=b+H,Y+=et>>>16,et&=65535,Y+=R+v,Y&=65535,o(ot<<16|Yt,Y<<16|et,this.unsigned)},C.subtract=function(x){return t(x)||(x=h(x)),this.add(x.neg())},C.sub=C.subtract,C.multiply=function(x){if(this.isZero()||(t(x)||(x=h(x)),x.isZero()))return m;if(this.eq(L))return x.isOdd()?L:m;if(x.eq(L))return this.isOdd()?L:m;if(this.isNegative())return x.isNegative()?this.neg().mul(x.neg()):this.neg().mul(x).neg();if(x.isNegative())return this.mul(x.neg()).neg();if(this.lt(g)&&x.lt(g))return i(this.toNumber()*x.toNumber(),this.unsigned);var R=this.high>>>16,b=this.high&65535,w=this.low>>>16,B=this.low&65535,v=x.high>>>16,H=x.high&65535,V=x.low>>>16,tt=x.low&65535,Y=0,et=0,ot=0,Yt=0;return Yt+=B*tt,ot+=Yt>>>16,Yt&=65535,ot+=w*tt,et+=ot>>>16,ot&=65535,ot+=B*V,et+=ot>>>16,ot&=65535,et+=b*tt,Y+=et>>>16,et&=65535,et+=w*V,Y+=et>>>16,et&=65535,et+=B*H,Y+=et>>>16,et&=65535,Y+=R*tt+b*V+w*H+B*v,Y&=65535,o(ot<<16|Yt,Y<<16|et,this.unsigned)},C.mul=C.multiply,C.divide=function(x){if(t(x)||(x=h(x)),x.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?M:m;var R,b,w;if(this.unsigned){if(x.unsigned||(x=x.toUnsigned()),x.gt(this))return M;if(x.gt(this.shru(1)))return A;w=M}else{if(this.eq(L)){if(x.eq(E)||x.eq(y))return L;if(x.eq(L))return E;var B=this.shr(1);return R=B.div(x).shl(1),R.eq(m)?x.isNegative()?E:y:(b=this.sub(x.mul(R)),w=R.add(b.div(x)),w)}else if(x.eq(L))return this.unsigned?M:m;if(this.isNegative())return x.isNegative()?this.neg().div(x.neg()):this.neg().div(x).neg();if(x.isNegative())return this.div(x.neg()).neg();w=m}for(b=this;b.gte(x);){R=Math.max(1,Math.floor(b.toNumber()/x.toNumber()));for(var v=Math.ceil(Math.log(R)/Math.LN2),H=v<=48?1:c(2,v-48),V=i(R),tt=V.mul(x);tt.isNegative()||tt.gt(b);)R-=H,V=i(R,this.unsigned),tt=V.mul(x);V.isZero()&&(V=E),w=w.add(V),b=b.sub(tt)}return w},C.div=C.divide,C.modulo=function(x){return t(x)||(x=h(x)),this.sub(this.div(x).mul(x))},C.mod=C.modulo,C.not=function(){return o(~this.low,~this.high,this.unsigned)},C.and=function(x){return t(x)||(x=h(x)),o(this.low&x.low,this.high&x.high,this.unsigned)},C.or=function(x){return t(x)||(x=h(x)),o(this.low|x.low,this.high|x.high,this.unsigned)},C.xor=function(x){return t(x)||(x=h(x)),o(this.low^x.low,this.high^x.high,this.unsigned)},C.shiftLeft=function(x){return t(x)&&(x=x.toInt()),(x&=63)===0?this:x<32?o(this.low<<x,this.high<<x|this.low>>>32-x,this.unsigned):o(0,this.low<<x-32,this.unsigned)},C.shl=C.shiftLeft,C.shiftRight=function(x){return t(x)&&(x=x.toInt()),(x&=63)===0?this:x<32?o(this.low>>>x|this.high<<32-x,this.high>>x,this.unsigned):o(this.high>>x-32,this.high>=0?0:-1,this.unsigned)},C.shr=C.shiftRight,C.shiftRightUnsigned=function(x){if(t(x)&&(x=x.toInt()),x&=63,x===0)return this;var R=this.high;if(x<32){var b=this.low;return o(b>>>x|R<<32-x,R>>>x,this.unsigned)}else return x===32?o(R,0,this.unsigned):o(R>>>x-32,0,this.unsigned)},C.shru=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},C.toBytes=function(S){return S?this.toBytesLE():this.toBytesBE()},C.toBytesLE=function(){var S=this.high,x=this.low;return[x&255,x>>>8&255,x>>>16&255,x>>>24&255,S&255,S>>>8&255,S>>>16&255,S>>>24&255]},C.toBytesBE=function(){var S=this.high,x=this.low;return[S>>>24&255,S>>>16&255,S>>>8&255,S&255,x>>>24&255,x>>>16&255,x>>>8&255,x&255]},e})});var Vl=ct((kH,Rg)=>{Rg.exports=globalThis.luma});var Qo=ct((HH,bg)=>{bg.exports=globalThis.deck});var jl=ct((uY,Wg)=>{Wg.exports=globalThis.luma});var Fr=ct((kY,lx)=>{lx.exports=globalThis.loaders});var nT=ct((Qot,eT)=>{eT.exports=globalThis.deck});var pT=ct(z1=>{z1.read=function(e,t,n,r,s){var i,o,c=s*8-r-1,a=(1<<c)-1,h=a>>1,l=-7,f=n?s-1:0,p=n?-1:1,u=e[t+f];for(f+=p,i=u&(1<<-l)-1,u>>=-l,l+=c;l>0;i=i*256+e[t+f],f+=p,l-=8);for(o=i&(1<<-l)-1,i>>=-l,l+=r;l>0;o=o*256+e[t+f],f+=p,l-=8);if(i===0)i=1-h;else{if(i===a)return o?NaN:(u?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-h}return(u?-1:1)*o*Math.pow(2,i-r)};z1.write=function(e,t,n,r,s,i){var o,c,a,h=i*8-s-1,l=(1<<h)-1,f=l>>1,p=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,u=r?0:i-1,d=r?1:-1,g=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+f>=1?t+=p/a:t+=p*Math.pow(2,1-f),t*a>=2&&(o++,a/=2),o+f>=l?(c=0,o=l):o+f>=1?(c=(t*a-1)*Math.pow(2,s),o=o+f):(c=t*Math.pow(2,f-1)*Math.pow(2,s),o=0));s>=8;e[n+u]=c&255,u+=d,c/=256,s-=8);for(o=o<<s|c,h+=s;h>0;e[n+u]=o&255,u+=d,o/=256,h-=8);e[n+u-d]|=g*128}});var MT=ct((Uct,xT)=>{"use strict";xT.exports=Q;var Ja=pT();function Q(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}Q.Varint=0;Q.Fixed64=1;Q.Bytes=2;Q.Fixed32=5;var V1=(1<<16)*(1<<16),uT=1/V1,E6=12,gT=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");Q.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),s=r>>3,i=this.pos;this.type=r&7,e(s,t,this),this.pos===i&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=ja(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=mT(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=ja(this.buf,this.pos)+ja(this.buf,this.pos+4)*V1;return this.pos+=8,e},readSFixed64:function(){var e=ja(this.buf,this.pos)+mT(this.buf,this.pos+4)*V1;return this.pos+=8,e},readFloat:function(){var e=Ja.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Ja.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,n,r;return r=t[this.pos++],n=r&127,r<128||(r=t[this.pos++],n|=(r&127)<<7,r<128)||(r=t[this.pos++],n|=(r&127)<<14,r<128)||(r=t[this.pos++],n|=(r&127)<<21,r<128)?n:(r=t[this.pos],n|=(r&15)<<28,T6(n,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=E6&&gT?F6(this.buf,t,e):N6(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!==Q.Bytes)return e.push(this.readVarint(t));var n=$e(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==Q.Bytes)return e.push(this.readSVarint());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==Q.Bytes)return e.push(this.readBoolean());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==Q.Bytes)return e.push(this.readFloat());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==Q.Bytes)return e.push(this.readDouble());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==Q.Bytes)return e.push(this.readFixed32());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==Q.Bytes)return e.push(this.readSFixed32());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==Q.Bytes)return e.push(this.readFixed64());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==Q.Bytes)return e.push(this.readSFixed64());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===Q.Varint)for(;this.buf[this.pos++]>127;);else if(t===Q.Bytes)this.pos=this.readVarint()+this.pos;else if(t===Q.Fixed32)this.pos+=4;else if(t===Q.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),Bs(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),Bs(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),Bs(this.buf,e&-1,this.pos),Bs(this.buf,Math.floor(e*uT),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),Bs(this.buf,e&-1,this.pos),Bs(this.buf,Math.floor(e*uT),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){_6(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=D6(this.buf,e,this.pos);var n=this.pos-t;n>=128&&dT(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),Ja.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Ja.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var r=this.pos-n;r>=128&&dT(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,Q.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,B6,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,L6,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,w6,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,R6,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,b6,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,I6,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,P6,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,O6,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,v6,t)},writeBytesField:function(e,t){this.writeTag(e,Q.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,Q.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,Q.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,Q.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,Q.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,Q.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,Q.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,Q.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,Q.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,Q.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function T6(e,t,n){var r=n.buf,s,i;if(i=r[n.pos++],s=(i&112)>>4,i<128||(i=r[n.pos++],s|=(i&127)<<3,i<128)||(i=r[n.pos++],s|=(i&127)<<10,i<128)||(i=r[n.pos++],s|=(i&127)<<17,i<128)||(i=r[n.pos++],s|=(i&127)<<24,i<128)||(i=r[n.pos++],s|=(i&1)<<31,i<128))return Cs(e,s,t);throw new Error("Expected varint not more than 10 bytes")}function $e(e){return e.type===Q.Bytes?e.readVarint()+e.pos:e.pos+1}function Cs(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function _6(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),n^4294967295?n=n+1|0:(n=0,r=r+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),S6(n,r,t),C6(r,t)}function S6(e,t,n){n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos]=e&127}function C6(e,t){var n=(e&7)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function dT(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));n.realloc(r);for(var s=n.pos-1;s>=e;s--)n.buf[s+r]=n.buf[s]}function B6(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function L6(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function R6(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function b6(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function w6(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function I6(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function P6(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function O6(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function v6(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function ja(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function Bs(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function mT(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function N6(e,t,n){for(var r="",s=t;s<n;){var i=e[s],o=null,c=i>239?4:i>223?3:i>191?2:1;if(s+c>n)break;var a,h,l;c===1?i<128&&(o=i):c===2?(a=e[s+1],(a&192)===128&&(o=(i&31)<<6|a&63,o<=127&&(o=null))):c===3?(a=e[s+1],h=e[s+2],(a&192)===128&&(h&192)===128&&(o=(i&15)<<12|(a&63)<<6|h&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):c===4&&(a=e[s+1],h=e[s+2],l=e[s+3],(a&192)===128&&(h&192)===128&&(l&192)===128&&(o=(i&15)<<18|(a&63)<<12|(h&63)<<6|l&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,c=1):o>65535&&(o-=65536,r+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),r+=String.fromCharCode(o),s+=c}return r}function F6(e,t,n){return gT.decode(e.subarray(t,n))}function D6(e,t,n){for(var r=0,s,i;r<t.length;r++){if(s=t.charCodeAt(r),s>55295&&s<57344)if(i)if(s<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=s;continue}else s=i-55296<<10|s-56320|65536,i=null;else{s>56319||r+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=s;continue}else i&&(e[n++]=239,e[n++]=191,e[n++]=189,i=null);s<128?e[n++]=s:(s<2048?e[n++]=s>>6|192:(s<65536?e[n++]=s>>12|224:(e[n++]=s>>18|240,e[n++]=s>>12&63|128),e[n++]=s>>6&63|128),e[n++]=s&63|128)}return n}});var ji={};Tt(ji,{A5Layer:()=>Md,GeohashLayer:()=>GT,GreatCircleLayer:()=>km,H3ClusterLayer:()=>Lg,H3HexagonLayer:()=>Ko,MVTLayer:()=>NT,QuadkeyLayer:()=>rg,S2Layer:()=>eg,TerrainLayer:()=>tT,Tile3DLayer:()=>WE,TileLayer:()=>jn,TripsLayer:()=>Sg,_GeoCellLayer:()=>$t,_Tile2DHeader:()=>Yn,_Tileset2D:()=>Jn,_WMSLayer:()=>vr,_getURLFromTemplate:()=>we});var ye={},ep=G(he(),1);tn(ye,G(he(),1));if(!ep.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");tn(ji,ye);var rp=G(le(),1),rh=G(he(),1),XT={...rh.PolygonLayer.defaultProps},bs=class extends rp.CompositeLayer{indexToBounds(){return null}renderLayers(){let{elevationScale:t,extruded:n,wireframe:r,filled:s,stroked:i,lineWidthUnits:o,lineWidthScale:c,lineWidthMinPixels:a,lineWidthMaxPixels:h,lineJointRounded:l,lineMiterLimit:f,lineDashJustified:p,getElevation:u,getFillColor:d,getLineColor:g,getLineWidth:m}=this.props,{updateTriggers:M,material:E,transitions:A}=this.props,y=this.getSubLayerClass("cell",rh.PolygonLayer),{updateTriggers:T,..._}=this.indexToBounds()||{};return new y({filled:s,wireframe:r,extruded:n,elevationScale:t,stroked:i,lineWidthUnits:o,lineWidthScale:c,lineWidthMinPixels:a,lineWidthMaxPixels:h,lineJointRounded:l,lineMiterLimit:f,lineDashJustified:p,material:E,transitions:A,getElevation:u,getFillColor:d,getLineColor:g,getLineWidth:m},this.getSubLayerProps({id:"cell",updateTriggers:M&&{...T,getElevation:M.getElevation,getFillColor:M.getFillColor,getLineColor:M.getLineColor,getLineWidth:M.getLineWidth}}),_)}};bs.layerName="GeoCellLayer";bs.defaultProps=XT;var $t=bs;var KT=Object.defineProperty,Os=(e,t)=>{for(var n in t)KT(e,n,{get:t[n],enumerable:!0})},qt={};Os(qt,{ARRAY_TYPE:()=>ut,EPSILON:()=>Rt,RANDOM:()=>On,equals:()=>t_,setMatrixArrayType:()=>QT,toRadian:()=>$T});var Rt=1e-6,ut=typeof Float32Array<"u"?Float32Array:Array,On=Math.random;function QT(e){ut=e}var ZT=Math.PI/180;function $T(e){return e*ZT}function t_(e,t){return Math.abs(e-t)<=Rt*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 vn={};Os(vn,{LDU:()=>x_,add:()=>M_,adjoint:()=>h_,clone:()=>n_,copy:()=>r_,create:()=>e_,determinant:()=>l_,equals:()=>y_,exactEquals:()=>A_,frob:()=>g_,fromRotation:()=>u_,fromScaling:()=>d_,fromValues:()=>i_,identity:()=>s_,invert:()=>a_,mul:()=>__,multiply:()=>Cp,multiplyScalar:()=>E_,multiplyScalarAndAdd:()=>T_,rotate:()=>f_,scale:()=>p_,set:()=>o_,str:()=>m_,sub:()=>S_,subtract:()=>Bp,transpose:()=>c_});function e_(){var e=new ut(4);return ut!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function n_(e){var t=new ut(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function r_(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function s_(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}function i_(e,t,n,r){var s=new ut(4);return s[0]=e,s[1]=t,s[2]=n,s[3]=r,s}function o_(e,t,n,r,s){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e}function c_(e,t){if(e===t){var n=t[1];e[1]=t[2],e[2]=n}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}function a_(e,t){var n=t[0],r=t[1],s=t[2],i=t[3],o=n*i-s*r;return o?(o=1/o,e[0]=i*o,e[1]=-r*o,e[2]=-s*o,e[3]=n*o,e):null}function h_(e,t){var n=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=n,e}function l_(e){return e[0]*e[3]-e[2]*e[1]}function Cp(e,t,n){var r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*c+i*a,e[1]=s*c+o*a,e[2]=r*h+i*l,e[3]=s*h+o*l,e}function f_(e,t,n){var r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+i*c,e[1]=s*a+o*c,e[2]=r*-c+i*a,e[3]=s*-c+o*a,e}function p_(e,t,n){var r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1];return e[0]=r*c,e[1]=s*c,e[2]=i*a,e[3]=o*a,e}function u_(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=-n,e[3]=r,e}function d_(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}function m_(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function g_(e){return Math.hypot(e[0],e[1],e[2],e[3])}function x_(e,t,n,r){return e[2]=r[2]/r[0],n[0]=r[0],n[1]=r[1],n[3]=r[3]-e[2]*n[1],[e,t,n]}function M_(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function Bp(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}function A_(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function y_(e,t){var n=e[0],r=e[1],s=e[2],i=e[3],o=t[0],c=t[1],a=t[2],h=t[3];return Math.abs(n-o)<=Rt*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-c)<=Rt*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(s-a)<=Rt*Math.max(1,Math.abs(s),Math.abs(a))&&Math.abs(i-h)<=Rt*Math.max(1,Math.abs(i),Math.abs(h))}function E_(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function T_(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e}var __=Cp,S_=Bp;function C_(){var e=new ut(9);return ut!=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 ch={};Os(ch,{add:()=>US,calculateW:()=>LS,clone:()=>vS,conjugate:()=>IS,copy:()=>FS,create:()=>hh,dot:()=>qp,equals:()=>HS,exactEquals:()=>kS,exp:()=>Up,fromEuler:()=>PS,fromMat3:()=>zp,fromValues:()=>NS,getAngle:()=>_S,getAxisAngle:()=>TS,identity:()=>ES,invert:()=>wS,len:()=>VS,length:()=>kp,lerp:()=>zS,ln:()=>Gp,mul:()=>GS,multiply:()=>Dp,normalize:()=>Mh,pow:()=>RS,random:()=>bS,rotateX:()=>SS,rotateY:()=>CS,rotateZ:()=>BS,rotationTo:()=>YS,scale:()=>Vp,set:()=>DS,setAxes:()=>JS,setAxisAngle:()=>Fp,slerp:()=>io,sqlerp:()=>WS,sqrLen:()=>qS,squaredLength:()=>Hp,str:()=>OS});var P={};Os(P,{add:()=>b_,angle:()=>X_,bezier:()=>V_,ceil:()=>w_,clone:()=>B_,copy:()=>L_,create:()=>gh,cross:()=>so,dist:()=>rS,distance:()=>Ip,div:()=>nS,divide:()=>wp,dot:()=>xh,equals:()=>$_,exactEquals:()=>Z_,floor:()=>I_,forEach:()=>oS,fromValues:()=>ah,hermite:()=>z_,inverse:()=>U_,len:()=>Np,length:()=>Lp,lerp:()=>G_,max:()=>O_,min:()=>P_,mul:()=>eS,multiply:()=>bp,negate:()=>D_,normalize:()=>vp,random:()=>q_,rotateX:()=>W_,rotateY:()=>J_,rotateZ:()=>j_,round:()=>v_,scale:()=>N_,scaleAndAdd:()=>F_,set:()=>R_,sqrDist:()=>sS,sqrLen:()=>iS,squaredDistance:()=>Pp,squaredLength:()=>Op,str:()=>Q_,sub:()=>tS,subtract:()=>Rp,transformMat3:()=>H_,transformMat4:()=>k_,transformQuat:()=>Y_,zero:()=>K_});function gh(){var e=new ut(3);return ut!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function B_(e){var t=new ut(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Lp(e){var t=e[0],n=e[1],r=e[2];return Math.hypot(t,n,r)}function ah(e,t,n){var r=new ut(3);return r[0]=e,r[1]=t,r[2]=n,r}function L_(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function R_(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function b_(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function Rp(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function bp(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}function wp(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}function w_(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function I_(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function P_(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}function O_(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}function v_(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e}function N_(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function F_(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e}function Ip(e,t){var n=t[0]-e[0],r=t[1]-e[1],s=t[2]-e[2];return Math.hypot(n,r,s)}function Pp(e,t){var n=t[0]-e[0],r=t[1]-e[1],s=t[2]-e[2];return n*n+r*r+s*s}function Op(e){var t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r}function D_(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function U_(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function vp(e,t){var n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function xh(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function so(e,t,n){var r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function G_(e,t,n,r){var s=t[0],i=t[1],o=t[2];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e}function z_(e,t,n,r,s,i){var o=i*i,c=o*(2*i-3)+1,a=o*(i-2)+i,h=o*(i-1),l=o*(3-2*i);return e[0]=t[0]*c+n[0]*a+r[0]*h+s[0]*l,e[1]=t[1]*c+n[1]*a+r[1]*h+s[1]*l,e[2]=t[2]*c+n[2]*a+r[2]*h+s[2]*l,e}function V_(e,t,n,r,s,i){var o=1-i,c=o*o,a=i*i,h=c*o,l=3*i*c,f=3*a*o,p=a*i;return e[0]=t[0]*h+n[0]*l+r[0]*f+s[0]*p,e[1]=t[1]*h+n[1]*l+r[1]*f+s[1]*p,e[2]=t[2]*h+n[2]*l+r[2]*f+s[2]*p,e}function q_(e,t){t=t||1;var n=On()*2*Math.PI,r=On()*2-1,s=Math.sqrt(1-r*r)*t;return e[0]=Math.cos(n)*s,e[1]=Math.sin(n)*s,e[2]=r*t,e}function k_(e,t,n){var r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function H_(e,t,n){var r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function Y_(e,t,n){var r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function W_(e,t,n,r){var s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function J_(e,t,n,r){var s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function j_(e,t,n,r){var s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function X_(e,t){var n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt(n*n+r*r+s*s),h=Math.sqrt(i*i+o*o+c*c),l=a*h,f=l&&xh(e,t)/l;return Math.acos(Math.min(Math.max(f,-1),1))}function K_(e){return e[0]=0,e[1]=0,e[2]=0,e}function Q_(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"}function Z_(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function $_(e,t){var n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2];return Math.abs(n-i)<=Rt*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-o)<=Rt*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(s-c)<=Rt*Math.max(1,Math.abs(s),Math.abs(c))}var tS=Rp,eS=bp,nS=wp,rS=Ip,sS=Pp,Np=Lp,iS=Op,oS=function(){var e=gh();return function(t,n,r,s,i,o){var c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();function cS(){var e=new ut(4);return ut!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function aS(e){var t=new ut(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function hS(e,t,n,r){var s=new ut(4);return s[0]=e,s[1]=t,s[2]=n,s[3]=r,s}function lS(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function fS(e,t,n,r,s){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e}function pS(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function uS(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function dS(e){var t=e[0],n=e[1],r=e[2],s=e[3];return Math.hypot(t,n,r,s)}function mS(e){var t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function gS(e,t){var n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function xS(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function MS(e,t,n,r){var s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function AS(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function yS(e,t){var n=e[0],r=e[1],s=e[2],i=e[3],o=t[0],c=t[1],a=t[2],h=t[3];return Math.abs(n-o)<=Rt*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-c)<=Rt*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(s-a)<=Rt*Math.max(1,Math.abs(s),Math.abs(a))&&Math.abs(i-h)<=Rt*Math.max(1,Math.abs(i),Math.abs(h))}var TU=function(){var e=cS();return function(t,n,r,s,i,o){var c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();function hh(){var e=new ut(4);return ut!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function ES(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Fp(e,t,n){n=n*.5;var r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function TS(e,t){var n=Math.acos(t[3])*2,r=Math.sin(n/2);return r>Rt?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),n}function _S(e,t){var n=qp(e,t);return Math.acos(2*n*n-1)}function Dp(e,t,n){var r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*l+o*c+s*h-i*a,e[1]=s*l+o*a+i*c-r*h,e[2]=i*l+o*h+r*a-s*c,e[3]=o*l-r*c-s*a-i*h,e}function SS(e,t,n){n*=.5;var r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function CS(e,t,n){n*=.5;var r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function BS(e,t,n){n*=.5;var r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function LS(e,t){var n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function Up(e,t){var n=t[0],r=t[1],s=t[2],i=t[3],o=Math.sqrt(n*n+r*r+s*s),c=Math.exp(i),a=o>0?c*Math.sin(o)/o:0;return e[0]=n*a,e[1]=r*a,e[2]=s*a,e[3]=c*Math.cos(o),e}function Gp(e,t){var n=t[0],r=t[1],s=t[2],i=t[3],o=Math.sqrt(n*n+r*r+s*s),c=o>0?Math.atan2(o,i)/o:0;return e[0]=n*c,e[1]=r*c,e[2]=s*c,e[3]=.5*Math.log(n*n+r*r+s*s+i*i),e}function RS(e,t,n){return Gp(e,t),Vp(e,e,n),Up(e,e),e}function io(e,t,n,r){var s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],h=n[1],l=n[2],f=n[3],p,u,d,g,m;return u=s*a+i*h+o*l+c*f,u<0&&(u=-u,a=-a,h=-h,l=-l,f=-f),1-u>Rt?(p=Math.acos(u),d=Math.sin(p),g=Math.sin((1-r)*p)/d,m=Math.sin(r*p)/d):(g=1-r,m=r),e[0]=g*s+m*a,e[1]=g*i+m*h,e[2]=g*o+m*l,e[3]=g*c+m*f,e}function bS(e){var t=On(),n=On(),r=On(),s=Math.sqrt(1-t),i=Math.sqrt(t);return e[0]=s*Math.sin(2*Math.PI*n),e[1]=s*Math.cos(2*Math.PI*n),e[2]=i*Math.sin(2*Math.PI*r),e[3]=i*Math.cos(2*Math.PI*r),e}function wS(e,t){var n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function IS(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function zp(e,t){var n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);var i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}function PS(e,t,n,r){var s=.5*Math.PI/180;t*=s,n*=s,r*=s;var i=Math.sin(t),o=Math.cos(t),c=Math.sin(n),a=Math.cos(n),h=Math.sin(r),l=Math.cos(r);return e[0]=i*a*l-o*c*h,e[1]=o*c*l+i*a*h,e[2]=o*a*h-i*c*l,e[3]=o*a*l+i*c*h,e}function OS(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}var vS=aS,NS=hS,FS=lS,DS=fS,US=pS,GS=Dp,Vp=uS,qp=xS,zS=MS,kp=dS,VS=kp,Hp=mS,qS=Hp,Mh=gS,kS=AS,HS=yS,YS=function(){var e=gh(),t=ah(1,0,0),n=ah(0,1,0);return function(r,s,i){var o=xh(s,i);return o<-.999999?(so(e,t,s),Np(e)<1e-6&&so(e,n,s),vp(e,e),Fp(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(so(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,Mh(r,r))}}(),WS=function(){var e=hh(),t=hh();return function(n,r,s,i,o,c){return io(e,r,o,c),io(t,s,i,c),io(n,e,t,2*c*(1-c)),n}}(),JS=function(){var e=C_();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],Mh(t,zp(t,e))}}(),D={};Os(D,{add:()=>ZS,angle:()=>MC,ceil:()=>$S,clone:()=>jS,copy:()=>KS,create:()=>Yp,cross:()=>lC,dist:()=>LC,distance:()=>Xp,div:()=>BC,divide:()=>jp,dot:()=>hC,equals:()=>TC,exactEquals:()=>EC,floor:()=>tC,forEach:()=>wC,fromValues:()=>XS,inverse:()=>cC,len:()=>_C,length:()=>Qp,lerp:()=>fC,max:()=>nC,min:()=>eC,mul:()=>CC,multiply:()=>Jp,negate:()=>oC,normalize:()=>aC,random:()=>pC,rotate:()=>xC,round:()=>rC,scale:()=>sC,scaleAndAdd:()=>iC,set:()=>QS,sqrDist:()=>RC,sqrLen:()=>bC,squaredDistance:()=>Kp,squaredLength:()=>Zp,str:()=>yC,sub:()=>SC,subtract:()=>Wp,transformMat2:()=>uC,transformMat2d:()=>dC,transformMat3:()=>mC,transformMat4:()=>gC,zero:()=>AC});function Yp(){var e=new ut(2);return ut!=Float32Array&&(e[0]=0,e[1]=0),e}function jS(e){var t=new ut(2);return t[0]=e[0],t[1]=e[1],t}function XS(e,t){var n=new ut(2);return n[0]=e,n[1]=t,n}function KS(e,t){return e[0]=t[0],e[1]=t[1],e}function QS(e,t,n){return e[0]=t,e[1]=n,e}function ZS(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function Wp(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function Jp(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e}function jp(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e}function $S(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}function tC(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}function eC(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e}function nC(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e}function rC(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}function sC(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function iC(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e}function Xp(e,t){var n=t[0]-e[0],r=t[1]-e[1];return Math.hypot(n,r)}function Kp(e,t){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function Qp(e){var t=e[0],n=e[1];return Math.hypot(t,n)}function Zp(e){var t=e[0],n=e[1];return t*t+n*n}function oC(e,t){return e[0]=-t[0],e[1]=-t[1],e}function cC(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}function aC(e,t){var n=t[0],r=t[1],s=n*n+r*r;return s>0&&(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e}function hC(e,t){return e[0]*t[0]+e[1]*t[1]}function lC(e,t,n){var r=t[0]*n[1]-t[1]*n[0];return e[0]=e[1]=0,e[2]=r,e}function fC(e,t,n,r){var s=t[0],i=t[1];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e}function pC(e,t){t=t||1;var n=On()*2*Math.PI;return e[0]=Math.cos(n)*t,e[1]=Math.sin(n)*t,e}function uC(e,t,n){var r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e}function dC(e,t,n){var r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s+n[4],e[1]=n[1]*r+n[3]*s+n[5],e}function mC(e,t,n){var r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}function gC(e,t,n){var r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}function xC(e,t,n,r){var s=t[0]-n[0],i=t[1]-n[1],o=Math.sin(r),c=Math.cos(r);return e[0]=s*c-i*o+n[0],e[1]=s*o+i*c+n[1],e}function MC(e,t){var n=e[0],r=e[1],s=t[0],i=t[1],o=Math.sqrt(n*n+r*r)*Math.sqrt(s*s+i*i),c=o&&(n*s+r*i)/o;return Math.acos(Math.min(Math.max(c,-1),1))}function AC(e){return e[0]=0,e[1]=0,e}function yC(e){return"vec2("+e[0]+", "+e[1]+")"}function EC(e,t){return e[0]===t[0]&&e[1]===t[1]}function TC(e,t){var n=e[0],r=e[1],s=t[0],i=t[1];return Math.abs(n-s)<=Rt*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(r-i)<=Rt*Math.max(1,Math.abs(r),Math.abs(i))}var _C=Qp,SC=Wp,CC=Jp,BC=jp,LC=Xp,RC=Kp,bC=Zp,wC=function(){var e=Yp();return function(t,n,r,s,i,o){var c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}(),ho=(1+Math.sqrt(5))/2,_U=2*Math.PI,oo=2*Math.PI/5,Ee=Math.PI/5,sp=Math.PI/10,IC=2*Math.atan(ho),lh=Math.PI-IC,SU=-.5*Math.PI+Math.acos(-1/Math.sqrt(3-ho)),lo=(Math.sqrt(5)-1)/2,PC=3-Math.sqrt(5),OC=Math.sqrt(3-ho),CU=Math.sqrt(3)*OC/ho;qt.setMatrixArrayType(Float64Array);var Ah=class fh{constructor(t){this.vertices=t,this.isWindingCorrect()||this.vertices.reverse()}getArea(){let t=0,n=this.vertices.length;for(let r=0;r<n;r++){let s=(r+1)%n;t+=(this.vertices[s][0]-this.vertices[r][0])*(this.vertices[s][1]+this.vertices[r][1])}return t}isWindingCorrect(){return this.getArea()>=0}getVertices(){return this.vertices}scale(t){for(let n of this.vertices)D.scale(n,n,t);return this}rotate180(){for(let t of this.vertices)D.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 n of this.vertices)D.add(n,n,t);return this}transform(t){for(let n of this.vertices)D.transformMat2(n,n,t);return this}transform2d(t){for(let n of this.vertices)D.transformMat2d(n,n,t);return this}clone(){return new fh(this.vertices.map(n=>D.clone(n)))}getCenter(){let t=this.vertices.length;return this.vertices.reduce((r,s)=>[r[0]+s[0]/t,r[1]+s[1]/t],[0,0])}containsPoint(t){if(!this.isWindingCorrect())throw new Error("Pentagon is not counter-clockwise");let n=this.vertices.length,r=1;for(let s=0;s<n;s++){let i=this.vertices[s],o=this.vertices[(s+1)%n],c=i[0]-o[0],a=i[1]-o[1],h=t[0]-i[0],l=t[1]-i[1],f=c*l-a*h;if(f<0){let p=Math.sqrt(h*h+l*l);r=Math.min(r,f/p)}}return r}splitEdges(t){if(t<=1)return this;let n=[],r=this.vertices.length;for(let s=0;s<r;s++){let i=this.vertices[s],o=this.vertices[(s+1)%r];n.push(D.clone(i));for(let c=1;c<t;c++){let a=c/t,h=D.create();D.lerp(h,i,o,a),n.push(h)}}return new fh(n)}};qt.setMatrixArrayType(Float64Array);var $p=[0,0],tu=[0,1],Nn=[.7885966681787006,1.6149108024237764],eu=[1.6171013659387945,1.054928690397459],nu=[Math.cos(sp),Math.sin(sp)],vC=2*D.length(Nn)*Math.cos(Ee),NC=Ee-Math.atan2(Nn[1],Nn[0]),FC=2*lo/vC;[$p,tu,Nn,eu,nu].forEach(e=>{D.scale(e,e,FC),D.rotate(e,e,[0,0],NC)});var DC=new Ah([$p,tu,Nn,eu,nu]),ru=Math.atan2(Nn[1],Nn[0])-Ee,UC=[0,0],co=lo/Math.cos(Ee),ip=ru+Ee,ao=[co*Math.cos(ip),co*Math.sin(ip)],op=ru-Ee,Ps=[co*Math.cos(op),co*Math.sin(op)],su=new Ah([UC,ao,Ps]),iu=vn.fromValues(ao[0],ao[1],Ps[0],Ps[1]),BU=vn.invert(vn.create(),iu),GC=new Float64Array([-.0022392098386786394,21308606513250217e-22,-2559257686421274e-24,33701965267802837e-28,-4667545312611249e-30,667492870384816e-32]),zC=new Float64Array([.0022392089963541657,28831978048607556e-22,508622073997266e-23,102018123778161e-25,21912872306767718e-30,49284235482523806e-33]),VC=class{applyCoefficients(e,t){let n=Math.sin(e),r=Math.cos(e),s=2*(r-n)*(r+n),i,o;return i=s*t[5]+t[4],o=s*i+t[3],i=s*o-i+t[2],o=s*i-o+t[1],i=s*o-i+t[0],e+2*n*r*i}forward(e){return this.applyCoefficients(e,GC)}inverse(e){return this.applyCoefficients(e,zC)}};qt.setMatrixArrayType(Float64Array);var ou=new VC;function cp(e){return e*(Math.PI/180)}function ap(e){return e*(180/Math.PI)}function hp(e){let t=D.length(e),n=Math.atan2(e[1],e[0]);return[t,n]}function qC([e,t]){let n=e*Math.cos(t),r=e*Math.sin(t);return[n,r]}function kC(e,[t,n,r]){let s=[t[0]-r[0],t[1]-r[1]],i=[r[0]-n[0],r[1]-n[1]],o=[e[0]-r[0],e[1]-r[1]],c=i[0]*s[1]-i[1]*s[0],a=(i[0]*o[1]-i[1]*o[0])/c,h=(s[0]*o[1]-s[1]*o[0])/c,l=1-(a+h);return[a,h,l]}function HC(e,[t,n,r]){return[e[0]*t[0]+e[1]*n[0]+e[2]*r[0],e[0]*t[1]+e[1]*n[1]+e[2]*r[1]]}function ph(e){let t=Math.atan2(e[1],e[0]),n=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),r=Math.acos(e[2]/n);return[t,r]}function Ar([e,t]){let n=Math.sin(t),r=n*Math.cos(e),s=n*Math.sin(e),i=Math.cos(t);return[r,s,i]}var cu=93;function YC([e,t]){let n=cp(e+cu),r=cp(t),s=ou.forward(r),i=Math.PI/2-s;return[n,i]}function au([e,t]){let n=ap(e)-cu,r=Math.PI/2-t,s=ou.inverse(r),i=ap(s);return[n,i]}function WC(e){let t=e.map(i=>Ar(YC(i))),n=P.create();for(let i of t)P.add(n,n,i);P.normalize(n,n);let[r,s]=au(ph(n));return(s>89.99||s<-89.99)&&(r=e[0][0]),r=((r+180)%360+360)%360-180,e.map(i=>{let[o,c]=i;for(;o-r>180;)o=o-360;for(;o-r<-180;)o=o+360;return[o,c]})}qt.setMatrixArrayType(Float64Array);var fo=Math.sqrt(5),po=Math.sqrt(.2),hu=Math.sqrt((1-po)/2),lu=Math.sqrt((1+po)/2),Ki=.5,lp=Math.sqrt((2.5-fo)/10),fp=Math.sqrt((2.5+fo)/10),pp=Math.sqrt((1+po)/8),up=Math.sqrt((1-po)/8),dp=Math.sqrt((3-fo)/8),mp=Math.sqrt((3+fo)/8),JC=[[0,0],[hu,0],[lp,Ki],[-pp,dp],[-pp,-dp],[lp,-Ki],[-lu,0],[-up,-mp],[fp,-Ki],[fp,Ki],[-up,mp],[0,0]],jC=JC.map(([e,t])=>[-t,e]),Qi=jC.map((e,t)=>t===0?[0,0,0,1]:t===11?[0,-1,0,0]:[...e,0,t<6?lu:hu]);qt.setMatrixArrayType(Float64Array);var fu=["vu","uw","vw","vw","vw"],ws=["wu","uw","vw","vu","uw"],sh=["wu","uv","wv","wu","uw"],Zi=["vu","uv","wv","wu","uw"],XC=[fu,Zi,sh,ws,sh,Zi,sh,ws,ws,ws,Zi,Zi],KC=[4,2,3,2,0,4,3,2,2,0,3,0],gp=[0,1,2,4,3,5,7,8,6,11,10,9],fe=[];function QC(){$i([0,0],0,Qi[0]);for(let e=0;e<5;e++){let t=e*oo,n=t+Ee;$i([t,lh],Ee,Qi[e+1]),$i([n,Math.PI-lh],Ee,Qi[(e+3)%5+6])}$i([0,Math.PI],0,Qi[11])}var gr=0;function $i(e,t,n){if(gr>11)throw new Error(`Too many origins: ${gr}`);let r=ch.create();ch.conjugate(r,n);let s={id:gr,axis:e,quat:n,inverseQuat:r,angle:t,orientation:XC[gr],firstQuintant:KC[gr]};fe.push(s),gr++}QC();fe.sort((e,t)=>gp.indexOf(e.id)-gp.indexOf(t.id));fe.forEach((e,t)=>e.id=t);function ZC(e,t){let n=t.orientation,r=n===fu||n===ws?-1:1,s=(e-t.firstQuintant+5)%5,i=n[s];return{quintant:(t.firstQuintant+r*s+5)%5,orientation:i}}var $C=class{forward([e,t]){return[Math.tan(t),e]}inverse([e,t]){return[t,Math.atan(e)]}},xr=P.create(),Is=P.create(),xp=P.create(),Mp=P.create();function ih(e,t){P.lerp(xr,e,t,.5),P.normalize(xr,xr),P.cross(xr,e,xr);let n=P.length(xr);if(n<1e-8){let r=P.subtract(P.create(),e,t);return .5*P.length(r)}return n}function tB(e,t,n){return P.cross(Is,t,n),P.dot(e,Is)}function eB(e,t,n,r,s){P.cross(Is,r,s);let i=P.dot(t,Is),o=P.dot(n,Is);return P.scale(xp,t,o),P.scale(Mp,n,i),P.sub(e,Mp,xp)}function uh(e,t,n,r){let s=P.angle(t,n);if(s<1e-12)return P.lerp(e,t,n,r);let i=Math.sin((1-r)*s)/Math.sin(s),o=Math.sin(r*s)/Math.sin(s),c=P.scale(P.create(),t,i),a=P.scale(P.create(),n,o);return P.add(e,c,a)}qt.setMatrixArrayType(Float64Array);var to=P.create(),eo=P.create(),no=P.create(),Mr=P.create(),nB=class{constructor(e){this._area=null,this.vertices=e,Object.freeze(this.vertices)}getBoundary(e=1,t=!0){let n=[],r=this.vertices.length;for(let s=0;s<r*e;s++){let i=s/e;n.push(this.slerp(i))}return t&&n.push(n[0]),n}slerp(e){let t=this.vertices.length,n=e%1,r=Math.floor(e%t),s=(r+1)%t;return uh(P.create(),this.vertices[r],this.vertices[s],n)}getTransformedVertices(e){let t=this.vertices.length,n=Math.floor(e%t),r=(n+1)%t,s=(n+t-1)%t,i=P.clone(this.vertices[n]),o=P.clone(this.vertices[r]),c=P.clone(this.vertices[s]);return P.sub(o,o,i),P.sub(c,c,i),[i,o,c]}containsPoint(e){let t=this.vertices.length,n=1/0;for(let r=0;r<t;r++){let[s,i,o]=this.getTransformedVertices(r),c=P.sub(P.create(),e,s);P.normalize(c,c),P.normalize(i,i),P.normalize(o,o);let a=P.cross(P.create(),i,c),h=P.cross(P.create(),c,o),l=P.dot(s,a),f=P.dot(s,h);n=Math.min(n,l,f)}return n}getTriangleArea(e,t,n){P.lerp(to,t,n,.5),P.lerp(eo,n,e,.5),P.lerp(no,e,t,.5),P.normalize(to,to),P.normalize(eo,eo),P.normalize(no,no);let r=tB(to,eo,no),s=Math.max(-1,Math.min(1,r));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;P.set(Mr,0,0,0);for(let t of this.vertices)P.add(Mr,Mr,t);P.normalize(Mr,Mr);let e=0;for(let t=0;t<this.vertices.length;t++){let n=this.vertices[t],r=this.vertices[(t+1)%this.vertices.length],s=this.getTriangleArea(Mr,n,r);isNaN(s)||(e+=s)}return this._area=e,this._area}isWindingCorrect(){if(!(this.getArea()>0))debugger}};qt.setMatrixArrayType(Float64Array);var ro=class extends nB{constructor(e){if(e.length!==3)throw new Error("SphericalTriangleShape requires exactly 3 vertices");super(e)}};qt.setMatrixArrayType(Float64Array);var rB=class{forward(e,t,n){let[r,s,i]=t,o=new ro([r,s,i]),c=P.subtract(P.create(),e,r);P.normalize(c,c);let a=eB(P.create(),r,c,s,i);P.normalize(a,a);let h=ih(r,e)/ih(r,a),l=o.getArea(),f=h/l,p=[1-h,f*new ro([r,a,i]).getArea(),f*new ro([r,s,a]).getArea()];return HC(p,n)}inverse(e,t,n){let[r,s,i]=n,o=new ro([r,s,i]),c=kC(e,t),a=1-1e-14;if(c[0]>a)return r;if(c[1]>a)return s;if(c[2]>a)return i;let h=P.create();P.cross(h,s,i);let l=o.getArea(),f=1-c[0],u=c[2]/f*l,d=Math.sin(u),g=Math.sin(u/2),m=2*g*g,M=P.dot(r,s),E=P.dot(s,i),A=P.dot(i,r),y=P.length(h),T=P.dot(r,h),_=d*T+m*(M*E-A),L=m*y*(1+M),C=2/Math.acos(E)*Math.atan2(L,_),S=uh(P.create(),s,i,C),x=ih(r,S),R=this.safeAcos(f*x)/this.safeAcos(x);return uh([0,0,0],r,S,R)}safeAcos(e){return e<.001?2*e+e*e*e/3:Math.acos(1-2*e*e)}};qt.setMatrixArrayType(Float64Array);var Kt=-1,Vt=1,sB=([e,t])=>D.fromValues(e-t,t),dh=D.fromValues(1,0),mh=D.fromValues(0,1),Ap=D.negate(D.create(),dh),yp=D.negate(D.create(),mh),oh=D.fromValues(0,0),iB=(e,[t,n])=>{let r=oh,s=oh;switch(t===Vt&&n===Vt?(r=dh,s=mh):t===Kt&&n===Vt?(r=yp,s=Ap):t===Vt&&n===Kt?(r=mh,s=dh):t===Kt&&n===Kt&&(r=Ap,s=yp),e){case 0:return oh;case 1:return r;case 2:return D.add(D.create(),s,r);case 3:return D.scaleAndAdd(D.create(),s,r,2);default:throw new Error(`Invalid Quaternary value: ${e}`)}},Ep=e=>[[Vt,Vt],[Vt,Kt],[Vt,Vt],[Kt,Vt]][e],Tp=D.fromValues(-1,1);function pu(e){return Array.from({length:e.length},(t,n)=>e.indexOf(n))}var uu=[0,1,3,4,5,6,7,2],du=[0,1,2,7,3,4,5,6],LU=pu(uu),RU=pu(du),oB=(e,t,n,r,s)=>{if(t<=0)return;let i=e[t]||0,o=e[t-1],c=n[0]+n[1],a=!0,h=!0;if(r!==(c===0)?(a=i===1||i===2,h=i===1):(a=i<2,h=i===0),!a)return;let l=h?o:o+4,f=s[l];e[t-1]=f%4,e[t]=(i+4+Math.floor(f/4)-Math.floor(l/4))%4},cB=(e,t,n)=>{let r=BigInt(e),s=n==="vu"||n==="wu"||n==="vw",i=n==="wv"||n==="vw",o=n==="wu"||n==="uw";s&&(r=(1n<<BigInt(2*t))-r-1n);let c=aB(r,t,i,o);if(o){let{offset:[a,h],flips:[l,f]}=c;c.offset=[h,a],l===Kt&&D.add(c.offset,c.offset,Tp),f===Kt&&D.subtract(c.offset,c.offset,Tp)}if(i){let{offset:[a,h],flips:l}=c,f=(1<<t)-(a+h);l[0]=-l[0],c.offset[1]=f,c.flips=l}return c},aB=(e,t,n,r)=>{let s=D.create(),i=[Vt,Vt],o=BigInt(e),c=[];for(;o>0n||c.length<t;)c.push(Number(o%4n)),o=o>>2n;let a=r?du:uu;for(let l=c.length-1;l>=0;l--)oB(c,l,i,n,a),D.multiply(i,i,Ep(c[l]));i[0]=Vt,i[1]=Vt;for(let l=c.length-1;l>=0;l--){D.scale(s,s,2);let f=iB(c[l],i);D.add(s,s,f),D.multiply(i,i,Ep(c[l]))}let h=c[0]||0;return{flips:i,k:h,offset:sB(s)}};qt.setMatrixArrayType(Float64Array);var hB=!1,lB=D.clone(Ps),fB=D.negate(D.create(),Ps),yh=[0,1,2,3,4].map(e=>{let t=vn.create();return vn.fromRotation(t,oo*e),t}),_p=D.create();function pB(e,t,n){let r=(hB?su:DC).clone();D.transformMat2(_p,n.offset,iu),n.flips[0]===Vt&&n.flips[1]===Kt&&r.rotate180();let{k:s}=n,i=n.flips[0]+n.flips[1];return((i===-2||i===2)&&s>1||i===0&&(s===0||s===3))&&r.reflectY(),n.flips[0]===Kt&&n.flips[1]===Kt?r.rotate180():n.flips[0]===Kt?r.translate(fB):n.flips[1]===Kt&&r.translate(lB),r.translate(_p),r.scale(1/2**e),r.transform(yh[t]),r}function mu(e){let t=su.clone();return t.transform(yh[e]),t}function uB(){let e=[];for(let t of yh)e.push(D.transformMat2(D.create(),ao,t));return e.reverse(),new Ah(e)}qt.setMatrixArrayType(Float64Array);var dB=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(P.distance(e,t)<1e-5)return t;throw new Error("Failed to find vertex in CRS")}addFaceCenters(){fe.forEach(e=>this.add(Ar(e.axis)))}addVertices(){let e=Math.atan(PC);for(let t of fe)for(let n=0;n<5;n++){let r=(2*n+1)*Math.PI/5,s=Ar([r+t.angle,e]);P.transformQuat(s,s,t.quat),this.add(s)}}addMidpoints(){let e=Math.atan(lo);for(let t of fe)for(let n=0;n<5;n++){let r=2*n*Math.PI/5,s=Ar([r+t.angle,e]);P.transformQuat(s,s,t.quat),this.add(s)}}add(e){let t=P.normalize(P.create(),e);return this.vertices.find(r=>P.distance(t,r)<1e-5)?!1:(this.vertices.push(t),!0)}};qt.setMatrixArrayType(Float64Array);var mB=new dB,gB=class{constructor(){this.faceTriangles=[],this.sphericalTriangles=[],this.polyhedral=new rB,this.gnomonic=new $C}forward(e,t){let n=fe[t],r=Ar(e),s=P.create();P.transformQuat(s,r,n.inverseQuat);let i=ph(s),o=this.gnomonic.forward(i);o[1]=o[1]-n.angle;let c=this.getFaceTriangleIndex(o),a=this.shouldReflect(o),h=this.getFaceTriangle(c,a,!1),l=this.getSphericalTriangle(c,t,a);return this.polyhedral.forward(r,l,h)}inverse(e,t){let n=hp(e),r=this.getFaceTriangleIndex(n),s=this.shouldReflect(n),i=this.getFaceTriangle(r,s,!1),o=this.getSphericalTriangle(r,t,s),c=this.polyhedral.inverse(e,i,o);return ph(c)}shouldReflect(e){let[t,n]=e;return qC([t,this.normalizeGamma(n)])[0]>lo}getFaceTriangleIndex([e,t]){return(Math.floor(t/Ee)+10)%10}getFaceTriangle(e,t=!1,n=!1){let r=e;return t&&(r+=n?20:10),this.faceTriangles[r]?this.faceTriangles[r]:(this.faceTriangles[r]=t?this._getReflectedFaceTriangle(e,n):this._getFaceTriangle(e),Object.freeze(this.faceTriangles[r]),this.faceTriangles[r])}_getFaceTriangle(e){let t=Math.floor((e+1)/2)%5,[n,r,s]=mu(t).getVertices(),i=D.create();return D.lerp(i,r,s,.5),e%2===0?[n,i,r]:[n,s,i]}_getReflectedFaceTriangle(e,t=!1){let[n,r,s]=this._getFaceTriangle(e).map(c=>D.clone(c)),i=e%2===0;D.negate(n,n);let o=i?r:s;return D.scaleAndAdd(n,n,o,t?1+1/Math.cos(lh):2),[n,s,r]}getSphericalTriangle(e,t,n=!1){let r=10*t+e;return n&&(r+=120),this.sphericalTriangles[r]?this.sphericalTriangles[r]:(this.sphericalTriangles[r]=this._getSphericalTriangle(e,t,n),Object.freeze(this.sphericalTriangles[r]),this.sphericalTriangles[r])}_getSphericalTriangle(e,t,n=!1){let r=fe[t];return this.getFaceTriangle(e,n,!0).map(o=>{let[c,a]=hp(o),h=[c,a+r.angle],l=Ar(this.gnomonic.inverse(h));return P.transformQuat(l,l,r.quat),mB.getVertex(l)})}normalizeGamma(e){let t=e/oo,n=Math.round(t);return(t-n)*oo}},yr=2,xB=30,MB=58n,AB=0x3ffffffffffffffn;function yB(e){let t=xB-1,n=e>>1n;for(;t>-1&&(n&0b1n)===0n;)t-=1,n=n>>(t<yr?1n:2n);return t}function EB(e){let t=yB(e);if(t===-1)return{origin:fe[0],segment:0,S:0n,resolution:t};let n=Number(e>>58n),r,s;if(t===0)r=fe[n],s=0;else{let h=Math.floor(n/5);r=fe[h],s=(n+r.firstQuintant)%5}if(!r)throw new Error(`Could not parse origin: ${n}`);if(t<yr)return{origin:r,segment:s,S:0n,resolution:t};let i=t-yr+1,o=BigInt(2*i),c=MB-o,a=(e&AB)>>c;return{origin:r,segment:s,S:a,resolution:t}}qt.setMatrixArrayType(Float64Array);var bU=vn.create(),TB=new gB;function _B({S:e,segment:t,origin:n,resolution:r}){let{quintant:s,orientation:i}=ZC(t,n);if(r===yr-1)return mu(s);if(r===yr-2)return uB();let o=r-yr+1,c=cB(e,o,i);return pB(o,s,c)}function gu(e,{closedRing:t=!0,segments:n="auto"}={closedRing:!0,segments:"auto"}){let{S:r,segment:s,origin:i,resolution:o}=EB(e);n==="auto"&&(n=Math.max(1,Math.pow(2,6-o)));let f=_B({S:r,segment:s,origin:i,resolution:o}).splitEdges(n).getVertices().map(u=>TB.inverse(u,i.id)).map(u=>au(u)),p=WC(f);return t&&p.push(p[0]),p.reverse(),p}function xu(e){return BigInt(`0x${e}`)}var Sp=63710072e-1,wU=4*Math.PI*Sp*Sp;qt.setMatrixArrayType(Float64Array);var Ds=G(uo(),1);var zU=1/Math.PI*180,VU=1/180*Math.PI,SB={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...SB}};var dt=globalThis.mathgl.config;function Eh(e,{precision:t=dt.precision}={}){return e=CB(e),`${parseFloat(e.toPrecision(t))}`}function Te(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function en(e,t,n){return Te(e)?e.map((r,s)=>en(r,t[s],n)):n*t+(1-n)*e}function _e(e,t,n){let r=dt.EPSILON;n&&(dt.EPSILON=n);try{if(e===t)return!0;if(Te(e)&&Te(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!_e(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)<=dt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{dt.EPSILON=r}}function CB(e){return Math.round(e/dt.EPSILON)*dt.EPSILON}var nn=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Te(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(dt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+Eh(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!_e(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(dt.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function BB(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function W(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function rn(e,t,n=""){if(dt.debug&&!BB(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function Se(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var Er=class extends nn{get x(){return this[0]}set x(t){this[0]=W(t)}get y(){return this[1]}set y(t){this[1]=W(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return W(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return W(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return Se(t>=0&&t<this.ELEMENTS,"index is out of range"),W(this[t])}setComponent(t,n){return Se(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var at=typeof Float32Array<"u"?Float32Array:Array;var ZU=Math.PI/180;function LB(){let e=new at(2);return at!=Float32Array&&(e[0]=0,e[1]=0),e}function Eu(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}function Tu(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var $U=function(){let e=LB();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function _u(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function mo(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function Su(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function Cu(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function go(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function Th(){let e=new at(3);return at!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function RB(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function _h(e,t,n){let r=new at(3);return r[0]=e,r[1]=t,r[2]=n,r}function Bu(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function Sh(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function _r(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function Sr(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function xo(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function Mo(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function Lu(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Ru(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function bu(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function wu(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&Sh(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var Iu=RB;var nG=function(){let e=Th();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var Ch=[0,0,0],Ao,O=class extends Er{static get ZERO(){return Ao||(Ao=new O(0,0,0),Object.freeze(Ao)),Ao}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&Te(t)?this.copy(t):(dt.debug&&(W(t),W(n),W(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return dt.debug&&(W(t.x),W(t.y),W(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]=W(t)}angle(t){return wu(this,t)}cross(t){return _r(this,this,t),this.check()}rotateX({radians:t,origin:n=Ch}){return Lu(this,this,n,t),this.check()}rotateY({radians:t,origin:n=Ch}){return Ru(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=Ch}){return bu(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Sr(this,this,t),this.check()}transformAsVector(t){return mo(this,this,t),this.check()}transformByMatrix3(t){return xo(this,this,t),this.check()}transformByMatrix2(t){return Su(this,this,t),this.check()}transformByQuaternion(t){return Mo(this,this,t),this.check()}};var yo,Cr=class extends Er{static get ZERO(){return yo||(yo=new Cr(0,0,0,0),Object.freeze(yo)),yo}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),Te(t)&&arguments.length===1?this.copy(t):(dt.debug&&(W(t),W(n),W(r),W(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return dt.debug&&(W(t.x),W(t.y),W(t.z),W(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]=W(t)}get w(){return this[3]}set w(t){this[3]=W(t)}transform(t){return Sr(this,this,t),this.check()}transformByMatrix3(t){return go(this,this,t),this.check()}transformByMatrix2(t){return Cu(this,this,t),this.check()}transformByQuaternion(t){return Mo(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Br=class extends nn{toString(){let t="[";if(dt.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=W(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function Pu(){let e=new at(9);return at!=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 Ou(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=s}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function vu(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=l*o-c*h,p=-l*i+c*a,u=h*i-o*a,d=n*f+r*p+s*u;return d?(d=1/d,e[0]=f*d,e[1]=(-l*r+s*h)*d,e[2]=(c*r-s*o)*d,e[3]=p*d,e[4]=(l*n-s*a)*d,e[5]=(-c*n+s*i)*d,e[6]=u*d,e[7]=(-h*n+r*a)*d,e[8]=(o*n-r*i)*d,e):null}function Nu(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8];return t*(h*i-o*a)+n*(-h*s+o*c)+r*(a*s-i*c)}function Bh(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1],d=n[2],g=n[3],m=n[4],M=n[5],E=n[6],A=n[7],y=n[8];return e[0]=p*r+u*o+d*h,e[1]=p*s+u*c+d*l,e[2]=p*i+u*a+d*f,e[3]=g*r+m*o+M*h,e[4]=g*s+m*c+M*l,e[5]=g*i+m*a+M*f,e[6]=E*r+A*o+y*h,e[7]=E*s+A*c+y*l,e[8]=E*i+A*a+y*f,e}function Fu(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=p*r+u*o+h,e[7]=p*s+u*c+l,e[8]=p*i+u*a+f,e}function Du(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=Math.sin(n),u=Math.cos(n);return e[0]=u*r+p*o,e[1]=u*s+p*c,e[2]=u*i+p*a,e[3]=u*o-p*r,e[4]=u*c-p*s,e[5]=u*a-p*i,e[6]=h,e[7]=l,e[8]=f,e}function Lh(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=s*t[3],e[4]=s*t[4],e[5]=s*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Uu(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[3]=l-M,e[6]=p+m,e[1]=l+M,e[4]=1-h-d,e[7]=u-g,e[2]=p-m,e[5]=u+g,e[8]=1-h-f,e}var Rh;(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"})(Rh||(Rh={}));var IB=Object.freeze([1,0,0,0,1,0,0,0,1]),ht=class extends Br{static get IDENTITY(){return OB()}static get ZERO(){return PB()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Rh}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(IB)}fromObject(t){return this.check()}fromQuaternion(t){return Uu(this,t),this.check()}set(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=h,this.check()}determinant(){return Nu(this)}transpose(){return Ou(this,this),this.check()}invert(){return vu(this,this),this.check()}multiplyLeft(t){return Bh(this,t,this),this.check()}multiplyRight(t){return Bh(this,this,t),this.check()}rotate(t){return Du(this,this,t),this.check()}scale(t){return Array.isArray(t)?Lh(this,this,t):Lh(this,this,[t,t]),this.check()}translate(t){return Fu(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=Eu(n||[-0,-0],t,this);break;case 3:r=xo(n||[-0,-0,-0],t,this);break;case 4:r=go(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return rn(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},Eo,To=null;function PB(){return Eo||(Eo=new ht([0,0,0,0,0,0,0,0,0]),Object.freeze(Eo)),Eo}function OB(){return To||(To=new ht,Object.freeze(To)),To}var Ns={};Tt(Ns,{add:()=>sL,adjoint:()=>GB,clone:()=>NB,copy:()=>FB,create:()=>vB,decompose:()=>XB,determinant:()=>Ih,equals:()=>aL,exactEquals:()=>cL,frob:()=>rL,fromQuat:()=>Uh,fromQuat2:()=>WB,fromRotation:()=>qB,fromRotationTranslation:()=>zu,fromRotationTranslationScale:()=>KB,fromRotationTranslationScaleOrigin:()=>QB,fromScaling:()=>VB,fromTranslation:()=>zB,fromValues:()=>DB,fromXRotation:()=>kB,fromYRotation:()=>HB,fromZRotation:()=>YB,frustum:()=>Gh,getRotation:()=>jB,getScaling:()=>Vu,getTranslation:()=>JB,identity:()=>Gu,invert:()=>wh,lookAt:()=>qh,mul:()=>hL,multiply:()=>vs,multiplyScalar:()=>iL,multiplyScalarAndAdd:()=>oL,ortho:()=>Vh,orthoNO:()=>ku,orthoZO:()=>tL,perspective:()=>zh,perspectiveFromFieldOfView:()=>$B,perspectiveNO:()=>qu,perspectiveZO:()=>ZB,rotate:()=>vh,rotateX:()=>Nh,rotateY:()=>Fh,rotateZ:()=>Dh,scale:()=>Oh,set:()=>UB,str:()=>nL,sub:()=>lL,subtract:()=>Hu,targetTo:()=>eL,translate:()=>Ph,transpose:()=>bh});function vB(){let e=new at(16);return at!=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 NB(e){let t=new at(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 FB(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 DB(e,t,n,r,s,i,o,c,a,h,l,f,p,u,d,g){let m=new at(16);return m[0]=e,m[1]=t,m[2]=n,m[3]=r,m[4]=s,m[5]=i,m[6]=o,m[7]=c,m[8]=a,m[9]=h,m[10]=l,m[11]=f,m[12]=p,m[13]=u,m[14]=d,m[15]=g,m}function UB(e,t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=i,e[5]=o,e[6]=c,e[7]=a,e[8]=h,e[9]=l,e[10]=f,e[11]=p,e[12]=u,e[13]=d,e[14]=g,e[15]=m,e}function Gu(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 bh(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}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 wh(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,C=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,b=f*M-u*g,w=p*M-u*m,B=E*w-A*b+y*R+T*x-_*S+L*C;return B?(B=1/B,e[0]=(c*w-a*b+h*R)*B,e[1]=(s*b-r*w-i*R)*B,e[2]=(g*L-m*_+M*T)*B,e[3]=(p*_-f*L-u*T)*B,e[4]=(a*x-o*w-h*S)*B,e[5]=(n*w-s*x+i*S)*B,e[6]=(m*y-d*L-M*A)*B,e[7]=(l*L-p*y+u*A)*B,e[8]=(o*b-c*x+h*C)*B,e[9]=(r*x-n*b-i*C)*B,e[10]=(d*_-g*y+M*E)*B,e[11]=(f*y-l*_-u*E)*B,e[12]=(c*S-o*R-a*C)*B,e[13]=(n*R-r*S+s*C)*B,e[14]=(g*A-d*T-m*E)*B,e[15]=(l*T-f*A+p*E)*B,e):null}function GB(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,C=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,b=f*M-u*g,w=p*M-u*m;return e[0]=c*w-a*b+h*R,e[1]=s*b-r*w-i*R,e[2]=g*L-m*_+M*T,e[3]=p*_-f*L-u*T,e[4]=a*x-o*w-h*S,e[5]=n*w-s*x+i*S,e[6]=m*y-d*L-M*A,e[7]=l*L-p*y+u*A,e[8]=o*b-c*x+h*C,e[9]=r*x-n*b-i*C,e[10]=d*_-g*y+M*E,e[11]=f*y-l*_-u*E,e[12]=c*S-o*R-a*C,e[13]=n*R-r*S+s*C,e[14]=g*A-d*T-m*E,e[15]=l*T-f*A+p*E,e}function Ih(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8],l=e[9],f=e[10],p=e[11],u=e[12],d=e[13],g=e[14],m=e[15],M=t*o-n*i,E=t*c-r*i,A=n*c-r*o,y=h*d-l*u,T=h*g-f*u,_=l*g-f*d,L=t*_-n*T+r*y,C=i*_-o*T+c*y,S=h*A-l*E+f*M,x=u*A-d*E+g*M;return a*L-s*C+m*S-p*x}function vs(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=t[9],u=t[10],d=t[11],g=t[12],m=t[13],M=t[14],E=t[15],A=n[0],y=n[1],T=n[2],_=n[3];return e[0]=A*r+y*c+T*f+_*g,e[1]=A*s+y*a+T*p+_*m,e[2]=A*i+y*h+T*u+_*M,e[3]=A*o+y*l+T*d+_*E,A=n[4],y=n[5],T=n[6],_=n[7],e[4]=A*r+y*c+T*f+_*g,e[5]=A*s+y*a+T*p+_*m,e[6]=A*i+y*h+T*u+_*M,e[7]=A*o+y*l+T*d+_*E,A=n[8],y=n[9],T=n[10],_=n[11],e[8]=A*r+y*c+T*f+_*g,e[9]=A*s+y*a+T*p+_*m,e[10]=A*i+y*h+T*u+_*M,e[11]=A*o+y*l+T*d+_*E,A=n[12],y=n[13],T=n[14],_=n[15],e[12]=A*r+y*c+T*f+_*g,e[13]=A*s+y*a+T*p+_*m,e[14]=A*i+y*h+T*u+_*M,e[15]=A*o+y*l+T*d+_*E,e}function Ph(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,h,l,f,p,u,d,g,m,M;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],h=t[3],l=t[4],f=t[5],p=t[6],u=t[7],d=t[8],g=t[9],m=t[10],M=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=p,e[7]=u,e[8]=d,e[9]=g,e[10]=m,e[11]=M,e[12]=o*r+l*s+d*i+t[12],e[13]=c*r+f*s+g*i+t[13],e[14]=a*r+p*s+m*i+t[14],e[15]=h*r+u*s+M*i+t[15]),e}function Oh(e,t,n){let r=n[0],s=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function vh(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,h,l,f,p,u,d,g,m,M,E,A,y,T,_,L,C,S,x,R,b,w,B,v;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,h=Math.sin(n),a=Math.cos(n),l=1-a,f=t[0],p=t[1],u=t[2],d=t[3],g=t[4],m=t[5],M=t[6],E=t[7],A=t[8],y=t[9],T=t[10],_=t[11],L=s*s*l+a,C=i*s*l+o*h,S=o*s*l-i*h,x=s*i*l-o*h,R=i*i*l+a,b=o*i*l+s*h,w=s*o*l+i*h,B=i*o*l-s*h,v=o*o*l+a,e[0]=f*L+g*C+A*S,e[1]=p*L+m*C+y*S,e[2]=u*L+M*C+T*S,e[3]=d*L+E*C+_*S,e[4]=f*x+g*R+A*b,e[5]=p*x+m*R+y*b,e[6]=u*x+M*R+T*b,e[7]=d*x+E*R+_*b,e[8]=f*w+g*B+A*v,e[9]=p*w+m*B+y*v,e[10]=u*w+M*B+T*v,e[11]=d*w+E*B+_*v,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function Nh(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],h=t[8],l=t[9],f=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=i*s+h*r,e[5]=o*s+l*r,e[6]=c*s+f*r,e[7]=a*s+p*r,e[8]=h*s-i*r,e[9]=l*s-o*r,e[10]=f*s-c*r,e[11]=p*s-a*r,e}function Fh(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[8],l=t[9],f=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s-h*r,e[1]=o*s-l*r,e[2]=c*s-f*r,e[3]=a*s-p*r,e[8]=i*r+h*s,e[9]=o*r+l*s,e[10]=c*r+f*s,e[11]=a*r+p*s,e}function Dh(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[4],l=t[5],f=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s+h*r,e[1]=o*s+l*r,e[2]=c*s+f*r,e[3]=a*s+p*r,e[4]=h*s-i*r,e[5]=l*s-o*r,e[6]=f*s-c*r,e[7]=p*s-a*r,e}function zB(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 VB(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 qB(e,t,n){let r=n[0],s=n[1],i=n[2],o=Math.sqrt(r*r+s*s+i*i),c,a,h;return o<1e-6?null:(o=1/o,r*=o,s*=o,i*=o,a=Math.sin(t),c=Math.cos(t),h=1-c,e[0]=r*r*h+c,e[1]=s*r*h+i*a,e[2]=i*r*h-s*a,e[3]=0,e[4]=r*s*h-i*a,e[5]=s*s*h+c,e[6]=i*s*h+r*a,e[7]=0,e[8]=r*i*h+s*a,e[9]=s*i*h-r*a,e[10]=i*i*h+c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function kB(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=n,e[7]=0,e[8]=0,e[9]=-n,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function HB(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function YB(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=0,e[4]=-n,e[5]=r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function zu(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=r+r,a=s+s,h=i+i,l=r*c,f=r*a,p=r*h,u=s*a,d=s*h,g=i*h,m=o*c,M=o*a,E=o*h;return e[0]=1-(u+g),e[1]=f+E,e[2]=p-M,e[3]=0,e[4]=f-E,e[5]=1-(l+g),e[6]=d+m,e[7]=0,e[8]=p+M,e[9]=d-m,e[10]=1-(l+u),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function WB(e,t){let n=new at(3),r=-t[0],s=-t[1],i=-t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=r*r+s*s+i*i+o*o;return f>0?(n[0]=(c*o+l*r+a*i-h*s)*2/f,n[1]=(a*o+l*s+h*r-c*i)*2/f,n[2]=(h*o+l*i+c*s-a*r)*2/f):(n[0]=(c*o+l*r+a*i-h*s)*2,n[1]=(a*o+l*s+h*r-c*i)*2,n[2]=(h*o+l*i+c*s-a*r)*2),zu(e,t,n),e}function JB(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Vu(e,t){let n=t[0],r=t[1],s=t[2],i=t[4],o=t[5],c=t[6],a=t[8],h=t[9],l=t[10];return e[0]=Math.sqrt(n*n+r*r+s*s),e[1]=Math.sqrt(i*i+o*o+c*c),e[2]=Math.sqrt(a*a+h*h+l*l),e}function jB(e,t){let n=new at(3);Vu(n,t);let r=1/n[0],s=1/n[1],i=1/n[2],o=t[0]*r,c=t[1]*s,a=t[2]*i,h=t[4]*r,l=t[5]*s,f=t[6]*i,p=t[8]*r,u=t[9]*s,d=t[10]*i,g=o+l+d,m=0;return g>0?(m=Math.sqrt(g+1)*2,e[3]=.25*m,e[0]=(f-u)/m,e[1]=(p-a)/m,e[2]=(c-h)/m):o>l&&o>d?(m=Math.sqrt(1+o-l-d)*2,e[3]=(f-u)/m,e[0]=.25*m,e[1]=(c+h)/m,e[2]=(p+a)/m):l>d?(m=Math.sqrt(1+l-o-d)*2,e[3]=(p-a)/m,e[0]=(c+h)/m,e[1]=.25*m,e[2]=(f+u)/m):(m=Math.sqrt(1+d-o-l)*2,e[3]=(c-h)/m,e[0]=(p+a)/m,e[1]=(f+u)/m,e[2]=.25*m),e}function XB(e,t,n,r){t[0]=r[12],t[1]=r[13],t[2]=r[14];let s=r[0],i=r[1],o=r[2],c=r[4],a=r[5],h=r[6],l=r[8],f=r[9],p=r[10];n[0]=Math.sqrt(s*s+i*i+o*o),n[1]=Math.sqrt(c*c+a*a+h*h),n[2]=Math.sqrt(l*l+f*f+p*p);let u=1/n[0],d=1/n[1],g=1/n[2],m=s*u,M=i*d,E=o*g,A=c*u,y=a*d,T=h*g,_=l*u,L=f*d,C=p*g,S=m+y+C,x=0;return S>0?(x=Math.sqrt(S+1)*2,e[3]=.25*x,e[0]=(T-L)/x,e[1]=(_-E)/x,e[2]=(M-A)/x):m>y&&m>C?(x=Math.sqrt(1+m-y-C)*2,e[3]=(T-L)/x,e[0]=.25*x,e[1]=(M+A)/x,e[2]=(_+E)/x):y>C?(x=Math.sqrt(1+y-m-C)*2,e[3]=(_-E)/x,e[0]=(M+A)/x,e[1]=.25*x,e[2]=(T+L)/x):(x=Math.sqrt(1+C-m-y)*2,e[3]=(M-A)/x,e[0]=(_+E)/x,e[1]=(T+L)/x,e[2]=.25*x),e}function KB(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=s+s,h=i+i,l=o+o,f=s*a,p=s*h,u=s*l,d=i*h,g=i*l,m=o*l,M=c*a,E=c*h,A=c*l,y=r[0],T=r[1],_=r[2];return e[0]=(1-(d+m))*y,e[1]=(p+A)*y,e[2]=(u-E)*y,e[3]=0,e[4]=(p-A)*T,e[5]=(1-(f+m))*T,e[6]=(g+M)*T,e[7]=0,e[8]=(u+E)*_,e[9]=(g-M)*_,e[10]=(1-(f+d))*_,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function QB(e,t,n,r,s){let i=t[0],o=t[1],c=t[2],a=t[3],h=i+i,l=o+o,f=c+c,p=i*h,u=i*l,d=i*f,g=o*l,m=o*f,M=c*f,E=a*h,A=a*l,y=a*f,T=r[0],_=r[1],L=r[2],C=s[0],S=s[1],x=s[2],R=(1-(g+M))*T,b=(u+y)*T,w=(d-A)*T,B=(u-y)*_,v=(1-(p+M))*_,H=(m+E)*_,V=(d+A)*L,tt=(m-E)*L,Y=(1-(p+g))*L;return e[0]=R,e[1]=b,e[2]=w,e[3]=0,e[4]=B,e[5]=v,e[6]=H,e[7]=0,e[8]=V,e[9]=tt,e[10]=Y,e[11]=0,e[12]=n[0]+C-(R*C+B*S+V*x),e[13]=n[1]+S-(b*C+v*S+tt*x),e[14]=n[2]+x-(w*C+H*S+Y*x),e[15]=1,e}function Uh(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[1]=l+M,e[2]=p-m,e[3]=0,e[4]=l-M,e[5]=1-h-d,e[6]=u+g,e[7]=0,e[8]=p+m,e[9]=u-g,e[10]=1-h-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Gh(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),h=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*h,e[15]=0,e}function qu(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var zh=qu;function ZB(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let o=1/(r-s);e[10]=s*o,e[14]=s*r*o}else e[10]=-1,e[14]=-r;return e}function $B(e,t,n,r){let s=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),c=Math.tan(t.rightDegrees*Math.PI/180),a=2/(o+c),h=2/(s+i);return e[0]=a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=h,e[6]=0,e[7]=0,e[8]=-((o-c)*a*.5),e[9]=(s-i)*h*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function ku(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*h,e[15]=1,e}var Vh=ku;function tL(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=i*h,e[15]=1,e}function qh(e,t,n,r){let s,i,o,c,a,h,l,f,p,u,d=t[0],g=t[1],m=t[2],M=r[0],E=r[1],A=r[2],y=n[0],T=n[1],_=n[2];return Math.abs(d-y)<1e-6&&Math.abs(g-T)<1e-6&&Math.abs(m-_)<1e-6?Gu(e):(f=d-y,p=g-T,u=m-_,s=1/Math.sqrt(f*f+p*p+u*u),f*=s,p*=s,u*=s,i=E*u-A*p,o=A*f-M*u,c=M*p-E*f,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-u*o,h=u*i-f*c,l=f*o-p*i,s=Math.sqrt(a*a+h*h+l*l),s?(s=1/s,a*=s,h*=s,l*=s):(a=0,h=0,l=0),e[0]=i,e[1]=a,e[2]=f,e[3]=0,e[4]=o,e[5]=h,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=0,e[12]=-(i*d+o*g+c*m),e[13]=-(a*d+h*g+l*m),e[14]=-(f*d+p*g+u*m),e[15]=1,e)}function eL(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=r[0],a=r[1],h=r[2],l=s-n[0],f=i-n[1],p=o-n[2],u=l*l+f*f+p*p;u>0&&(u=1/Math.sqrt(u),l*=u,f*=u,p*=u);let d=a*p-h*f,g=h*l-c*p,m=c*f-a*l;return u=d*d+g*g+m*m,u>0&&(u=1/Math.sqrt(u),d*=u,g*=u,m*=u),e[0]=d,e[1]=g,e[2]=m,e[3]=0,e[4]=f*m-p*g,e[5]=p*d-l*m,e[6]=l*g-f*d,e[7]=0,e[8]=l,e[9]=f,e[10]=p,e[11]=0,e[12]=s,e[13]=i,e[14]=o,e[15]=1,e}function nL(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 rL(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 sL(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function Hu(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function iL(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function oL(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function cL(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 aL(e,t){let n=e[0],r=e[1],s=e[2],i=e[3],o=e[4],c=e[5],a=e[6],h=e[7],l=e[8],f=e[9],p=e[10],u=e[11],d=e[12],g=e[13],m=e[14],M=e[15],E=t[0],A=t[1],y=t[2],T=t[3],_=t[4],L=t[5],C=t[6],S=t[7],x=t[8],R=t[9],b=t[10],w=t[11],B=t[12],v=t[13],H=t[14],V=t[15];return Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(r-A)<=1e-6*Math.max(1,Math.abs(r),Math.abs(A))&&Math.abs(s-y)<=1e-6*Math.max(1,Math.abs(s),Math.abs(y))&&Math.abs(i-T)<=1e-6*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(o-_)<=1e-6*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(c-L)<=1e-6*Math.max(1,Math.abs(c),Math.abs(L))&&Math.abs(a-C)<=1e-6*Math.max(1,Math.abs(a),Math.abs(C))&&Math.abs(h-S)<=1e-6*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(l-x)<=1e-6*Math.max(1,Math.abs(l),Math.abs(x))&&Math.abs(f-R)<=1e-6*Math.max(1,Math.abs(f),Math.abs(R))&&Math.abs(p-b)<=1e-6*Math.max(1,Math.abs(p),Math.abs(b))&&Math.abs(u-w)<=1e-6*Math.max(1,Math.abs(u),Math.abs(w))&&Math.abs(d-B)<=1e-6*Math.max(1,Math.abs(d),Math.abs(B))&&Math.abs(g-v)<=1e-6*Math.max(1,Math.abs(g),Math.abs(v))&&Math.abs(m-H)<=1e-6*Math.max(1,Math.abs(m),Math.abs(H))&&Math.abs(M-V)<=1e-6*Math.max(1,Math.abs(M),Math.abs(V))}var hL=vs,lL=Hu;function fL(){let e=new at(4);return at!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Yu(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function Wu(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function Ju(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function ju(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function Xu(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function Ku(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Qu(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function Zu(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*s+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*s+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*s+n[11]*i+n[15]*o,e}function $u(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2],h=n[3],l=h*r+c*i-a*s,f=h*s+a*r-o*i,p=h*i+o*s-c*r,u=-o*r-c*s-a*i;return e[0]=l*h+u*-o+f*-a-p*-c,e[1]=f*h+u*-c+p*-o-l*-a,e[2]=p*h+u*-a+l*-c-f*-o,e[3]=t[3],e}var BG=function(){let e=fL();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var Yh;(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"})(Yh||(Yh={}));var uL=45*Math.PI/180,dL=1,kh=.1,Hh=500,mL=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),It=class extends Br{static get IDENTITY(){return xL()}static get ZERO(){return gL()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Yh}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this[9]=l,this[10]=f,this[11]=p,this[12]=u,this[13]=d,this[14]=g,this[15]=m,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=i,this[2]=h,this[3]=u,this[4]=n,this[5]=o,this[6]=l,this[7]=d,this[8]=r,this[9]=c,this[10]=f,this[11]=g,this[12]=s,this[13]=a,this[14]=p,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(mL)}fromObject(t){return this.check()}fromQuaternion(t){return Uh(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=kh,far:c=Hh}=t;return c===1/0?ML(this,n,r,s,i,o):Gh(this,n,r,s,i,o,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return qh(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=kh,far:c=Hh}=t;return Vh(this,n,r,s,i,o,c),this.check()}orthographic(t){let{fovy:n=uL,aspect:r=dL,focalDistance:s=1,near:i=kh,far:o=Hh}=t;td(n);let c=n/2,a=s*Math.tan(c),h=a*r;return this.ortho({left:-h,right:h,bottom:-a,top:a,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return td(n),zh(this,n,r,s,i),this.check()}determinant(){return Ih(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*s,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*s,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return bh(this,this),this.check()}invert(){return wh(this,this),this.check()}multiplyLeft(t){return vs(this,t,this),this.check()}multiplyRight(t){return vs(this,this,t),this.check()}rotateX(t){return Nh(this,this,t),this.check()}rotateY(t){return Fh(this,this,t),this.check()}rotateZ(t){return Dh(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return vh(this,this,t,n),this.check()}scale(t){return Oh(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Ph(this,this,t),this.check()}transform(t,n){return t.length===4?(n=Zu(n||[-0,-0,-0,-0],t,this),rn(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=Tu(n||[-0,-0],t,this);break;case 3:s=Sr(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return rn(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=_u(n||[-0,-0],t,this);break;case 3:r=mo(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return rn(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},_o,So;function gL(){return _o||(_o=new It([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(_o)),_o}function xL(){return So||(So=new It,Object.freeze(So)),So}function td(e){if(e>Math.PI*2)throw Error("expected radians")}function ML(e,t,n,r,s,i){let o=2*i/(n-t),c=2*i/(s-r),a=(n+t)/(n-t),h=(s+r)/(s-r),l=-1,f=-1,p=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=h,e[10]=l,e[11]=f,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function ed(){let e=new at(4);return at!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function nd(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Wh(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function Jh(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*l+o*c+s*h-i*a,e[1]=s*l+o*a+i*c-r*h,e[2]=i*l+o*h+r*a-s*c,e[3]=o*l-r*c-s*a-i*h,e}function rd(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function sd(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function id(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function od(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function Fs(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],h=n[1],l=n[2],f=n[3],p,u,d,g,m;return p=s*a+i*h+o*l+c*f,p<0&&(p=-p,a=-a,h=-h,l=-l,f=-f),1-p>1e-6?(u=Math.acos(p),m=Math.sin(u),d=Math.sin((1-r)*u)/m,g=Math.sin(r*u)/m):(d=1-r,g=r),e[0]=d*s+g*a,e[1]=d*i+g*h,e[2]=d*o+g*l,e[3]=d*c+g*f,e}function cd(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function ad(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function jh(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}var hd=Yu;var ld=Wu,fd=Ku,pd=Qu,ud=Ju;var dd=ju;var md=Xu;var gd=function(){let e=Th(),t=_h(1,0,0),n=_h(0,1,0);return function(r,s,i){let o=Sh(s,i);return o<-.999999?(_r(e,t,s),Iu(e)<1e-6&&_r(e,n,s),Bu(e,e),Wh(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(_r(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,md(r,r))}}(),zG=function(){let e=ed(),t=ed();return function(n,r,s,i,o,c){return Fs(e,r,o,c),Fs(t,s,i,c),Fs(n,e,t,2*c*(1-c)),n}}(),VG=function(){let e=Pu();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],md(t,jh(t,e))}}();var AL=[0,0,0,1],Lr=class extends nn{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return jh(this,t),this.check()}fromAxisRotation(t,n){return Wh(this,t,n),this.check()}identity(){return nd(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=W(t)}get y(){return this[1]}set y(t){this[1]=W(t)}get z(){return this[2]}set z(t){this[2]=W(t)}get w(){return this[3]}set w(t){this[3]=W(t)}len(){return ud(this)}lengthSquared(){return dd(this)}dot(t){return fd(this,t)}rotationTo(t,n){return gd(this,t,n),this.check()}add(t){return hd(this,this,t),this.check()}calculateW(){return od(this,this),this.check()}conjugate(){return ad(this,this),this.check()}invert(){return cd(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(pd(this,t,n,r),this.check())}multiplyRight(t){return Jh(this,this,t),this.check()}multiplyLeft(t){return Jh(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return rd(this,this,t),this.check()}rotateY(t){return sd(this,this,t),this.check()}rotateZ(t){return id(this,this,t),this.check()}scale(t){return ld(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=AL,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return Fs(this,s,i,o),this.check()}transformVector4(t,n=new Cr){return $u(n,t,this),rn(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Rr={};Tt(Rr,{EPSILON1:()=>yL,EPSILON10:()=>bL,EPSILON11:()=>wL,EPSILON12:()=>IL,EPSILON13:()=>PL,EPSILON14:()=>OL,EPSILON15:()=>vL,EPSILON16:()=>NL,EPSILON17:()=>FL,EPSILON18:()=>DL,EPSILON19:()=>UL,EPSILON2:()=>EL,EPSILON20:()=>zL,EPSILON3:()=>TL,EPSILON4:()=>_L,EPSILON5:()=>SL,EPSILON6:()=>CL,EPSILON7:()=>BL,EPSILON8:()=>LL,EPSILON9:()=>RL,PI_OVER_FOUR:()=>qL,PI_OVER_SIX:()=>kL,PI_OVER_TWO:()=>VL,TWO_PI:()=>HL});var yL=.1,EL=.01,TL=.001,_L=1e-4,SL=1e-5,CL=1e-6,BL=1e-7,LL=1e-8,RL=1e-9,bL=1e-10,wL=1e-11,IL=1e-12,PL=1e-13,OL=1e-14,vL=1e-15,NL=1e-16,FL=1e-17,DL=1e-18,UL=1e-19,zL=1e-20,VL=Math.PI/2,qL=Math.PI/4,kL=Math.PI/6,HL=Math.PI*2;function Co(e,t){t=t===void 0?e[0][0]:t;for(let n of e){let r=n[0]-t;r>180?n[0]-=360:r<-180&&(n[0]+=360)}}function YL(e,t,n){let[r,s]=(0,Ds.cellToLatLng)(e),i=t.length;Co(t,s);let o=t[0]===t[i-1]?i-1:i;for(let c=0;c<o;c++)t[c][0]=en(s,t[c][0],n),t[c][1]=en(r,t[c][1],n)}function xd(e,t,n){let r=e(t,n),[s,i]=(0,Ds.cellToLatLng)(r);return[i,s]}function Xh(e,t=1){let n=(0,Ds.cellToBoundary)(e,!0);return t!==1?YL(e,n,t):Co(n),n}function Bo(e){let t=new Float64Array(e.length*2),n=0;for(let r of e)t[n++]=r[0],t[n++]=r[1];return t}var WL={getPentagon:{type:"accessor",value:e=>e.pentagon}},Us=class extends $t{indexToBounds(){let{data:t,getPentagon:n}=this.props;return{data:t,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(r,s)=>{let i=n(r,s),o=gu(typeof i=="string"?xu(i):i,{closedRing:!0,segments:"auto"});return Bo(o)}}}};Us.layerName="A5Layer";Us.defaultProps=WL;var Md=Us;var Hn=G(le(),1),Vm=G(he(),1);function JL(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function Lo(e){if(Array.isArray(e))return e.map(t=>Lo(t));if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[JL(n)]=Lo(r);return t}return e}var Qd=G(Kd(),1);function sl(e,t){if(t?._parser&&t._parser!=="fast-xml-parser")throw new Error(t?._parser);let n={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:t?.removeNSPrefix,textNodeName:t?.textNodeName,isArray:(s,i,o,c)=>Boolean(t?.arrayPaths?.some(h=>i===h)),...t?._fastXML},r=nb(e,n);return t?.uncapitalizeKeys?Lo(r):r}function nb(e,t){return new Qd.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var rb="4.2.1",pe={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:rb,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:sb,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>sl(new TextDecoder().decode(e),{...pe.options.xml,...t?.xml}),parseTextSync:(e,t)=>sl(e,{...pe.options.xml,...t?.xml})};function sb(e){return e.startsWith("<?xml")}async function Qt(e,t,n,r){return r._parse(e,t,n,r)}function q(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var Ce={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},ib=Ce.self||Ce.window||Ce.global||{},ob=Ce.window||Ce.self||Ce.global||{},cb=Ce.global||Ce.self||Ce.window||{},ab=Ce.document||{};var Vs=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Zd=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),hb=Zd&&parseFloat(Zd[1])||0;var bo=globalThis,lb=globalThis.document||{},wo=globalThis.process||{},fb=globalThis.console,k9=globalThis.navigator||{};function $d(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,n=e||t;return Boolean(n&&n.indexOf("Electron")>=0)}function Dn(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||$d()}var il="4.1.0";function ub(e){try{let t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch{return null}}var Io=class{constructor(t,n,r="sessionStorage"){this.storage=ub(r),this.id=t,this.config=n,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let n=JSON.stringify(this.config);this.storage.setItem(this.id,n)}}_loadConfiguration(){let t={};if(this.storage){let n=this.storage.getItem(this.id);t=n?JSON.parse(n):{}}return Object.assign(this.config,t),this}};function tm(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 em(e,t=8){let n=Math.max(t-e.length,0);return`${" ".repeat(n)}${e}`}var Po;(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"})(Po||(Po={}));var db=10;function nm(e){return typeof e!="string"?e:(e=e.toUpperCase(),Po[e]||Po.WHITE)}function rm(e,t,n){return!Dn&&typeof e=="string"&&(t&&(e=`\x1B[${nm(t)}m${e}\x1B[39m`),n&&(e=`\x1B[${nm(n)+db}m${e}\x1B[49m`)),e}function sm(e,t=["constructor"]){let n=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(n),s=e;for(let i of r){let o=s[i];typeof o=="function"&&(t.find(c=>i===c)||(s[i]=o.bind(e)))}}function qs(e,t){if(!e)throw new Error(t||"Assertion failed")}function Un(){let e;if(Dn()&&bo.performance)e=bo?.performance?.now?.();else if("hrtime"in wo){let t=wo?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var br={debug:Dn()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},mb={enabled:!0,level:0};function wr(){}var im={},om={once:!0},ks=class{constructor({id:t}={id:""}){this.VERSION=il,this._startTs=Un(),this._deltaTs=Un(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Io(`__probe-${this.id}__`,mb),this.timeStamp(`${this.id} started`),sm(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Un()-this._startTs).toPrecision(10))}getDelta(){return Number((Un()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,n){this._storage.setConfiguration({[t]:n})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,n){if(!t)throw new Error(n||"Assertion failed")}warn(t){return this._getLogFunction(0,t,br.warn,arguments,om)}error(t){return this._getLogFunction(0,t,br.error,arguments)}deprecated(t,n){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${n}\` instead`)}removed(t,n){return this.error(`\`${t}\` has been removed. Use \`${n}\` instead`)}probe(t,n){return this._getLogFunction(t,n,br.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,br.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,br.debug||br.info,arguments,om)}table(t,n,r){return n?this._getLogFunction(t,n,console.table||wr,r&&[r],{tag:xb(n)}):wr}time(t,n){return this._getLogFunction(t,n,console.time?console.time:console.info)}timeEnd(t,n){return this._getLogFunction(t,n,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,n){return this._getLogFunction(t,n,console.timeStamp||wr)}group(t,n,r={collapsed:!1}){let s=cm({logLevel:t,message:n,opts:r}),{collapsed:i}=r;return s.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(t,n,r={}){return this.group(t,n,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||wr)}withGroup(t,n,r){this.group(t,n)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=am(t)}_getLogFunction(t,n,r,s,i){if(this._shouldLog(t)){i=cm({logLevel:t,message:n,args:s,opts:i}),r=r||i.method,qs(r),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=Un();let o=i.tag||i.message;if(i.once&&o)if(!im[o])im[o]=Un();else return wr;return n=gb(this.id,i.message,i),r.bind(console,n,...i.args)}return wr}};ks.VERSION=il;function am(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 qs(Number.isFinite(t)&&t>=0),t}function cm(e){let{logLevel:t,message:n}=e;e.logLevel=am(t);let r=e.args?Array.from(e.args):[];for(;r.length&&r.shift()!==n;);switch(typeof t){case"string":case"function":n!==void 0&&r.unshift(n),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let s=typeof e.message;return qs(s==="string"||s==="object"),Object.assign(e,{args:r},e.opts)}function gb(e,t,n){if(typeof t=="string"){let r=n.time?em(tm(n.total)):"";t=n.time?`${e}: ${r} ${t}`:`${e}: ${t}`,t=rm(t,n.color,n.background)}return t}function xb(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}globalThis.probe={};var ol=new ks({id:"@probe.gl/log"});function cl(e,t){return hm(e||{},t)}function hm(e,t,n=0){if(n>3)return t;let r={...e};for(let[s,i]of Object.entries(t))i&&typeof i=="object"&&!Array.isArray(i)?r[s]=hm(r[s]||{},t[s],n+1):r[s]=t[s];return r}function al(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function hl(e){return globalThis.loaders?.modules?.[e]||null}function Mb(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.1"),globalThis._loadersgl_.version}var lm=Mb();function fm(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var Be={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},yz=Be.self||Be.window||Be.global||{},Ez=Be.window||Be.self||Be.global||{},Tz=Be.global||Be.self||Be.window||{},_z=Be.document||{};var Ir=typeof process!="object"||String(process)!=="[object process]"||process.browser,Oo=typeof importScripts=="function",Sz=typeof window<"u"&&typeof window.orientation<"u",pm=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Cz=pm&&parseFloat(pm[1])||0;var ll={};async function Le(e,t=null,n={},r=null){return t&&(e=um(e,t,n,r)),ll[e]=ll[e]||Ab(e),await ll[e]}function um(e,t,n={},r=null){if(!n.useLocalLibraries&&e.startsWith("http"))return e;r=r||e;let s=n.modules||{};return s[r]?s[r]:Ir?n.CDN?(fm(n.CDN.startsWith("http")),`${n.CDN}/${t}@${lm}/dist/libs/${r}`):Oo?`../src/libs/${r}`:`modules/${t}/src/libs/${r}`:`modules/${t}/dist/libs/${r}`}async function Ab(e){if(e.endsWith("wasm"))return await Eb(e);if(!Ir)try{let{requireFromFile:n}=globalThis.loaders||{};return await n?.(e)}catch(n){return console.error(n),null}if(Oo)return importScripts(e);let t=await Tb(e);return yb(t,e)}function yb(e,t){if(!Ir){let{requireFromString:r}=globalThis.loaders||{};return r?.(e,t)}if(Oo)return eval.call(globalThis,e),null;let n=document.createElement("script");n.id=t;try{n.appendChild(document.createTextNode(e))}catch{n.text=e}return document.body.appendChild(n),null}async function Eb(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return Ir||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function Tb(e){let{readFileAsText:t}=globalThis.loaders||{};return Ir||!t||e.startsWith("http")?await(await fetch(e)).text():await t(e)}function mm(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?dm(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?dm(e,0,t):""}function dm(e,t,n){if(e.byteLength<=t+n)return"";let r=new DataView(e),s="";for(let i=0;i<n;i++)s+=String.fromCharCode(r.getUint8(t+i));return s}function fl(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${mm(e)}"`)}}function Hs(...e){let t=e,n=t&&t.length>1&&t[0].constructor||null;if(!n)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let r=t.reduce((o,c)=>o+c.length,0),s=new n(r),i=0;for(let o of t)s.set(o,i),i+=o.length;return s}function Gn(e,t,n){let r=n!==void 0?new Uint8Array(e).subarray(t,t+n):new Uint8Array(e).subarray(t);return new Uint8Array(r).buffer}function on(e,t){return q(e>=0),q(t>0),e+(t-1)&~(t-1)}function pl(e,t,n){let r;if(e instanceof ArrayBuffer)r=new Uint8Array(e);else{let s=e.byteOffset,i=e.byteLength;r=new Uint8Array(e.buffer||e.arrayBuffer,s,i)}return t.set(r,n),n+on(r.byteLength,4)}function Ys(){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 zn=class{constructor(t,n){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=n,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Ys(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Ys()-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 cn=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,n="count"){return this._getOrCreate({name:t,type:n})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let n of Object.values(this.stats))t(n)}getTable(){let t={};return this.forEach(n=>{t[n.name]={time:n.time||0,count:n.count||0,average:n.getAverageTime()||0,hz:n.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(n=>this._getOrCreate(n))}_getOrCreate(t){let{name:n,type:r}=t,s=this.stats[n];return s||(t instanceof zn?s=t:s=new zn(n,r),this.stats[n]=s),s}};var _b="Queued Requests",Sb="Active Requests",Cb="Cancelled Requests",Bb="Queued Requests Ever",Lb="Active Requests Ever",Rb={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},an=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...Rb,...t},this.stats=new cn({id:this.props.id}),this.stats.get(_b),this.stats.get(Sb),this.stats.get(Cb),this.stats.get(Bb),this.stats.get(Lb)}scheduleRequest(t,n=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let r={handle:t,priority:0,getPriority:n},s=new Promise(i=>(r.resolve=i,r));return this.requestQueue.push(r),this.requestMap.set(t,s),this._issueNewRequests(),s}_issueRequest(t){let{handle:n,resolve:r}=t,s=!1,i=()=>{s||(s=!0,this.requestMap.delete(n),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:i}):Promise.resolve({done:i})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let n=0;n<t;++n){let r=this.requestQueue.shift();r&&this._issueRequest(r)}}}_updateAllRequests(){let t=this.requestQueue;for(let n=0;n<t.length;++n){let r=t[n];this._updateRequest(r)||(t.splice(n,1),this.requestMap.delete(r.handle),n--)}t.sort((n,r)=>n.priority-r.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var hn={};Tt(hn,{dirname:()=>wb,filename:()=>bb,join:()=>Ib,resolve:()=>Pb});function gm(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function bb(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function wb(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function Ib(...e){let t="/";return e=e.map((n,r)=>(r&&(n=n.replace(new RegExp(`^${t}`),"")),r!==e.length-1&&(n=n.replace(new RegExp(`${t}$`),"")),n)),e.join(t)}function Pb(...e){let t=[];for(let i=0;i<e.length;i++)t[i]=e[i];let n="",r=!1,s;for(let i=t.length-1;i>=-1&&!r;i--){let o;i>=0?o=t[i]:(s===void 0&&(s=gm()),o=s),o.length!==0&&(n=`${o}/${n}`,r=o.charCodeAt(0)===Ws)}return n=Ob(n,!r),r?`/${n}`:n.length>0?n:"."}var Ws=47,ul=46;function Ob(e,t){let n="",r=-1,s=0,i,o=!1;for(let c=0;c<=e.length;++c){if(c<e.length)i=e.charCodeAt(c);else{if(i===Ws)break;i=Ws}if(i===Ws){if(!(r===c-1||s===1))if(r!==c-1&&s===2){if(n.length<2||!o||n.charCodeAt(n.length-1)!==ul||n.charCodeAt(n.length-2)!==ul){if(n.length>2){let a=n.length-1,h=a;for(;h>=0&&n.charCodeAt(h)!==Ws;--h);if(h!==a){n=h===-1?"":n.slice(0,h),r=c,s=0,o=!1;continue}}else if(n.length===2||n.length===1){n="",r=c,s=0,o=!1;continue}}t&&(n.length>0?n+="/..":n="..",o=!0)}else{let a=e.slice(r+1,c);n.length>0?n+=`/${a}`:n=a,o=!1}r=c,s=0}else i===ul&&s!==-1?++s:s=-1}return n}var vo=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=vb(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function vb(e){let t=e?.fetch;if(t&&typeof t=="function")return(r,s)=>t(r,s);let n=e?.fetch;return n&&typeof n!="function"?r=>fetch(r,n):r=>fetch(r)}var te=class extends vo{};mr(te,"type","template"),mr(te,"testURL",t=>!1);function xm(e,t){let n=pe.parseTextSync?.(e,t),r=n?.ServiceExceptionReport?.ServiceException||n?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof r=="string"?r:r.value||r.code||"Unknown error"}var Nb="4.2.1",Js={dataType:null,batchType:null,id:"wms-error",name:"WMS Error",module:"wms",version:Nb,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:Fb,options:{wms:{throwOnError:!1}},parse:async(e,t)=>dl(new TextDecoder().decode(e),t),parseSync:(e,t)=>dl(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>dl(e,t)};function Fb(e){return e.startsWith("<?xml")}function dl(e,t){let n={...Js.options.wms,...t?.wms},r=xm(e,n),s=n.minimalErrors?r:`WMS Service error: ${r}`;if(n.throwOnError)throw new Error(s);return s}function Vn(e){return Array.isArray(e)?e:e?[e]:[]}function js(e){let t=Vn(e);return t.length>0&&t.every(n=>typeof n=="string")?t:[]}function Xs(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseFloat(e);default:return}}function No(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseInt(e,10);default:return}}function qn(e){switch(e){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function ml(e,t){let n=pe.parseTextSync?.(e,t),r=n.WMT_MS_Capabilities||n.WMS_Capabilities||n,s=Db(r);if(t?.inheritedLayerProps)for(let i of s.layers)Am(i,null);return t?.includeRawJSON&&(s.json=r),t?.includeXMLText&&(s.xml=e),s}function Db(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:js(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:No(e.Service?.LayerLimit),maxWidth:No(e.Service?.maxWidth),maxHeight:No(e.Service?.maxHeight),layers:[],requests:Ub(e.Capability?.Request),exceptions:Gb(e.Exception)},n=Vn(e.Capability?.Layer);for(let r of n)t.layers.push(Mm(r));for(let[r,s]of Object.entries(t))s===void 0&&delete t[r];return t}function Ub(e){let t={};for(let[n,r]of Object.entries(e||{})){let s=js(r?.Format);t[n]={mimeTypes:s}}return t}function Gb(e){if(Vn(e?.Format).length>0)return{mimeTypes:js(e)}}function Mm(e){let t={title:String(e?.Title||""),name:e?.Name&&String(e?.Name),abstract:e?.Name&&String(e?.Abstract),keywords:js(e.KeywordList?.Keyword)},n=e?.CRS||e?.SRS;n&&Array.isArray(n)&&n.every(h=>typeof h=="string")&&(t.crs=n);let r=e?.EX_GeographicBoundingBox&&zb(e?.EX_GeographicBoundingBox);r&&(t.geographicBoundingBox=r),r=e?.LatLonBoundingBox&&Vb(e?.LatLonBoundingBox),r&&(t.geographicBoundingBox=r);let s=e?.BoundingBox&&qb(e?.BoundingBox);s&&s.length>0&&(t.boundingBoxes=s);let o=Vn(e?.Dimension).map(h=>Hb(h));o.length&&(t.dimensions=o),e?.opaque&&(t.opaque=qn(e?.opaque)),e?.cascaded&&(t.cascaded=qn(e?.cascaded)),e?.queryable&&(t.queryable=qn(e?.queryable));let c=Vn(e?.Layer),a=[];for(let h of c)a.push(Mm(h));a.length>0&&(t.layers=a);for(let[h,l]of Object.entries(t))l===void 0&&delete t[h];return t}function zb(e){let{westBoundLongitude:t,northBoundLatitude:n,eastBoundLongitude:r,southBoundLatitude:s}=e;return[[t,s],[r,n]]}function Vb(e){let{minx:t,miny:n,maxx:r,maxy:s}=e;return[[t,n],[r,s]]}function qb(e){return Vn(e).map(n=>kb(n))}function kb(e){let{CRS:t,SRS:n,minx:r,miny:s,maxx:i,maxy:o,resx:c,resy:a}=e,h={crs:t||n,boundingBox:[[Xs(r),Xs(s)],[Xs(i),Xs(o)]]};return c&&(h.xResolution=c),a&&(h.yResolution=a),h}function Hb(e){let{name:t,units:n,value:r}=e,s={name:t,units:n,extent:r};return e.unitSymbol&&(s.unitSymbol=e.unitSymbol),e.default&&(s.defaultValue=e.default),e.multipleValues&&(s.multipleValues=qn(e.multipleValues)),e.nearestValue&&(s.nearestValue=qn(e.nearestValue)),e.current&&(s.current=qn(e.current)),s}function Am(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 n of e.layers||[])Am(n,e)}var Yb="4.2.1",Pr={dataType:null,batchType:null,id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:Yb,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:Wb,options:{wms:{}},parse:async(e,t)=>ml(new TextDecoder().decode(e),t?.wms),parseTextSync:(e,t)=>ml(e,t?.wms)};function Wb(e){return e.startsWith("<?xml")}function gl(e,t){let r=(pe.parseTextSync?.(e,t)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(r)?r:[r]).map(i=>Jb(i))}}function Jb(e){return{attributes:e||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var ym={...Pr,dataType:null,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(e,t)=>gl(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>gl(e,t)};function xl(e,t){return pe.parseTextSync?.(e,t)}var Em={...Pr,dataType:null,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(e,t)=>xl(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>xl(e,t)};function Tm(e,t){let{type:n="auto"}=e,r=n==="auto"?Xb(e.url,t):jb(n,t);if(!r)throw new Error("Not a valid image source type");return r.create(e)}function jb(e,t){for(let n of t)if(n.type===e)return n;return null}function Xb(e,t){for(let n of t)if(n.testURL&&n.testURL(e))return n;return null}var _m="4.2.1";var Kb=globalThis.loaders?.parseImageNode,Ml=typeof Image<"u",Al=typeof ImageBitmap<"u",Qb=Boolean(Kb),yl=Vs?!0:Qb;function Sm(e){switch(e){case"auto":return Al||Ml||yl;case"imagebitmap":return Al;case"image":return Ml;case"data":return yl;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Cm(){if(Al)return"imagebitmap";if(Ml)return"image";if(yl)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Bm(e){let t=Zb(e);if(!t)throw new Error("Not an image");return t}function Ks(e){switch(Bm(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Zb(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 $b=/^data:image\/svg\+xml/,tw=/\.svg((\?|#).*)?$/;function Fo(e){return e&&($b.test(e)||tw.test(e))}function Lm(e,t){if(Fo(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return El(e,t)}function El(e,t){if(Fo(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Do(e,t,n){let r=Lm(e,n),s=self.URL||self.webkitURL,i=typeof r!="string"&&s.createObjectURL(r);try{return await ew(i||r,t)}finally{i&&s.revokeObjectURL(i)}}async function ew(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,s)=>{try{n.onload=()=>r(n),n.onerror=i=>{let o=i instanceof Error?i.message:"error";s(new Error(o))}}catch(i){s(i)}})}var nw={},Rm=!0;async function bm(e,t,n){let r;Fo(n)?r=await Do(e,t,n):r=El(e,n);let s=t&&t.imagebitmap;return await rw(r,s)}async function rw(e,t=null){if((sw(t)||!Rm)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),Rm=!1}return await createImageBitmap(e)}function sw(e){for(let t in e||nw)return!1;return!0}function wm(e){return!aw(e,"ftyp",4)||!(e[8]&96)?null:iw(e)}function iw(e){switch(ow(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function ow(e,t,n){return String.fromCharCode(...e.slice(t,n))}function cw(e){return[...e].map(t=>t.charCodeAt(0))}function aw(e,t,n=0){let r=cw(t);for(let s=0;s<r.length;++s)if(r[s]!==e[s+n])return!1;return!0}var Re=!1,Qs=!0;function kn(e){let t=Zs(e);return lw(t)||uw(t)||fw(t)||pw(t)||hw(t)}function hw(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=wm(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function lw(e){let t=Zs(e);return t.byteLength>=24&&t.getUint32(0,Re)===2303741511?{mimeType:"image/png",width:t.getUint32(16,Re),height:t.getUint32(20,Re)}:null}function fw(e){let t=Zs(e);return t.byteLength>=10&&t.getUint32(0,Re)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,Qs),height:t.getUint16(8,Qs)}:null}function pw(e){let t=Zs(e);return t.byteLength>=14&&t.getUint16(0,Re)===16973&&t.getUint32(2,Qs)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,Qs),height:t.getUint32(22,Qs)}:null}function uw(e){let t=Zs(e);if(!(t.byteLength>=3&&t.getUint16(0,Re)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:s}=dw(),i=2;for(;i+9<t.byteLength;){let o=t.getUint16(i,Re);if(s.has(o))return{mimeType:"image/jpeg",height:t.getUint16(i+5,Re),width:t.getUint16(i+7,Re)};if(!r.has(o))return null;i+=2,i+=t.getUint16(i,Re)}return null}function dw(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Zs(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 Im(e,t){let{mimeType:n}=kn(e)||{},r=globalThis.loaders?.parseImageNode;return q(r),await r(e,n)}async function Pm(e,t,n){t=t||{};let s=(t.image||{}).type||"auto",{url:i}=n||{},o=mw(s),c;switch(o){case"imagebitmap":c=await bm(e,t,i);break;case"image":c=await Do(e,t,i);break;case"data":c=await Im(e,t);break;default:q(!1)}return s==="data"&&(c=Ks(c)),c}function mw(e){switch(e){case"auto":case"data":return Cm();default:return Sm(e),e}}var gw=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],xw=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Mw={image:{type:"auto",decode:!0}},ln={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:_m,mimeTypes:xw,extensions:gw,parse:Pm,tests:[e=>Boolean(kn(new DataView(e)))],options:Mw};var Tl={};function _l(e){if(Tl[e]===void 0){let t=Vs?yw(e):Aw(e);Tl[e]=t}return Tl[e]}function Aw(e){let t=["image/png","image/jpeg","image/gif"],n=globalThis.loaders?.imageFormatsNode||t,r=globalThis.loaders?.parseImageNode;return Boolean(r)&&n.includes(e)}function yw(e){switch(e){case"image/avif":case"image/webp":return Ew(e);default:return!0}}function Ew(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var Om={type:"wms",testURL:e=>e.toLowerCase().includes("wms"),create:e=>new Sl(e)},Sl=class extends te{url;data;substituteCRS84;flipCRS;wmsParameters;vendorParameters;capabilities=null;constructor(t){super(t),this.url=t.url,this.data=t.url,this.substituteCRS84=t.substituteCRS84??!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...t.wmsParameters},this.vendorParameters=t.vendorParameters||{}}async getMetadata(){let t=await this.getCapabilities();return this.normalizeMetadata(t)}async getImage(t){let{boundingBox:n,bbox:r,...s}=t,i={bbox:n?[...n[0],...n[1]]:r,...s};return await this.getMap(i)}normalizeMetadata(t){return t}async getCapabilities(t,n){let r=this.getCapabilitiesURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);let o=await Pr.parse(i,this.loadOptions);return this.capabilities=o,o}async getMap(t,n){let r=this.getMapURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);try{return await ln.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}async getFeatureInfo(t,n){let r=this.getFeatureInfoURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();return this._checkResponse(s,i),await ym.parse(i,this.loadOptions)}async getFeatureInfoText(t,n){let r=this.getFeatureInfoURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();return this._checkResponse(s,i),new TextDecoder().decode(i)}async describeLayer(t,n){let r=this.describeLayerURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();return this._checkResponse(s,i),await Em.parse(i,this.loadOptions)}async getLegendGraphic(t,n){let r=this.getLegendGraphicURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);try{return await ln.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}getCapabilitiesURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetCapabilities",r,n)}getMapURL(t,n){t=this._getWMS130Parameters(t);let r={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetMap",r,n)}getFeatureInfoURL(t,n){t=this._getWMS130Parameters(t);let{boundingBox:r,bbox:s}=t;t.bbox=r?[...r[0],...r[1]]:s;let i={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",i,n)}describeLayerURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("DescribeLayer",r,n)}getLegendGraphicURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetLegendGraphic",r,n)}_parseWMSUrl(t){let[n,r]=t.split("?"),s=r.split("&"),i={};for(let o of s){let[c,a]=o.split("=");i[c]=a}return{url:n,parameters:i}}_getWMSUrl(t,n,r){let s=this.url,i=!0,o={service:"WMS",version:n.version,request:t,...n,...this.vendorParameters,...r},c=["transparent","time","elevation"];for(let[a,h]of Object.entries(o))(!c.includes(a)||h)&&(s+=i?"?":"&",i=!1,s+=this._getURLParameter(a,h,n));return encodeURI(s)}_getWMS130Parameters(t){let n={...t};return n.srs&&(n.crs=n.crs||n.srs,delete n.srs),n}_getURLParameter(t,n,r){switch(t){case"crs":r.version!=="1.3.0"?t="srs":this.substituteCRS84&&n==="EPSG:4326"&&(n="CRS:84");break;case"srs":r.version==="1.3.0"&&(t="crs");break;case"bbox":let s=this._flipBoundingBox(n,r);s&&(n=s);break;case"x":r.version==="1.3.0"&&(t="i");break;case"y":r.version==="1.3.0"&&(t="j");break;default:}return t=t.toUpperCase(),Array.isArray(n)?`${t}=${n.join(",")}`:`${t}=${n?String(n):""}`}_flipBoundingBox(t,n){if(!Array.isArray(t)||t.length!==4)return null;let r=n.version==="1.3.0"&&this.flipCRS.includes(n.crs||"")&&!(this.substituteCRS84&&n.crs==="EPSG:4326"),s=t;return r?[s[1],s[0],s[3],s[2]]:s}async _fetchArrayBuffer(t){let n=await this.fetch(t),r=await n.arrayBuffer();return this._checkResponse(n,r),r}_checkResponse(t,n){let r=t.headers["content-type"];if(!t.ok||Js.mimeTypes.includes(r)){let s=cl(this.loadOptions,{wms:{throwOnError:!0}}),i=Js.parseSync?.(n,s);throw new Error(i)}}_parseError(t){let n=Js.parseSync?.(t,this.loadOptions);return new Error(n)}};var Or=class extends te{constructor(t){super(t)}async getMetadata(){throw new Error("ImageSource.getMetadata not implemented")}async getImage(t){let n=this.getGranularParameters(t),r=this.getURLFromTemplate(n),i=await(await this.fetch(r)).arrayBuffer();return await ln.parse(i)}getGranularParameters(t){let[[n,r],[s,i]]=t.boundingBox;return{...t,east:n,north:r,south:i,west:s}}getURLFromTemplate(t){let n=this.props.url;for(let[r,s]of Object.entries(t))n=n.replace(`\${${r}}`,String(s)),n=n.replace(`{${r}}`,String(s));return n}};mr(Or,"type","template"),mr(Or,"testURL",t=>t.toLowerCase().includes("{"));var Cl=class extends Or{data;constructor(t){super(t),this.data=t.url}async getMetadata(){return await this.metadata()}async getImage(t){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(t){throw new Error("not implemented")}metadataURL(t){return`${this.props.url}?f=pjson`}exportImageURL(t){let n=`bbox=${t.bbox[0]},${t.bbox[1]},${t.bbox[2]},${t.bbox[3]}`,r=`size=${t.width},${t.height}`,s={...t,bbox:n,size:r};return delete s.width,delete s.height,this.getUrl("exportImage",s)}getUrl(t,n,r){let s=`${this.props.url}/${t}`,i=!0;for(let[o,c]of Object.entries(n))s+=i?"?":"&",i=!1,Array.isArray(c)?s+=`${o.toUpperCase()}=${c.join(",")}`:s+=`${o.toUpperCase()}=${c?String(c):""}`;return s}async checkResponse(t){if(!t.ok)throw new Error("error")}},vm={type:"arcgis-image-server",testURL:e=>e.toLowerCase().includes("ImageServer"),create:e=>new Cl(e)};var Tw=[Om,vm];function Bl(e){return Tm(e,Tw)}function Uo(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var ue=Math.PI,Um=ue/4,Nm=ue/180,Fm=180/ue,Go=512;function Ue(e){let[t,n]=e;Uo(Number.isFinite(t)),Uo(Number.isFinite(n)&&n>=-90&&n<=90,"invalid latitude");let r=t*Nm,s=n*Nm,i=Go*(r+ue)/(2*ue),o=Go*(ue+Math.log(Math.tan(Um+s*.5)))/(2*ue);return[i,o]}function Ge(e){let[t,n]=e,r=t/Go*(2*ue)-ue,s=2*(Math.atan(Math.exp(n/Go*(2*ue)-ue))-Um);return[r*Fm,s*Fm]}var ok=Math.PI/180;var zm=6378137*Math.PI;function Ll(e){let t=Ue(e);return t[0]=(t[0]/256-1)*zm,t[1]=(t[1]/256-1)*zm,t}var Uw={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)}},vr=class extends Hn.CompositeLayer{get isLoaded(){return this.state?.loadCounter===0&&super.isLoaded}shouldUpdateState(){return!0}initializeState(){this.state._nextRequestId=0,this.state.lastRequestId=-1,this.state.loadCounter=0}updateState({changeFlags:t,props:n,oldProps:r}){let{viewport:s}=this.context;t.dataChanged||n.serviceType!==r.serviceType?(this.state.imageSource=this._createImageSource(n),this._loadMetadata(),this.debounce(()=>this.loadImage(s,"image source changed"),0)):(0,Hn._deepEqual)(n.layers,r.layers,1)?t.viewportChanged&&this.debounce(()=>this.loadImage(s,"viewport changed")):this.debounce(()=>this.loadImage(s,"layers changed"),0)}finalizeState(){}renderLayers(){let{bounds:t,image:n,lastRequestParameters:r}=this.state;return n&&new Vm.BitmapLayer({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:r.srs==="EPSG:4326"?Hn.COORDINATE_SYSTEM.LNGLAT:Hn.COORDINATE_SYSTEM.CARTESIAN,bounds:t,image:n})}async getFeatureInfoText(t,n){let{lastRequestParameters:r}=this.state;return r?await this.state.imageSource.getFeatureInfoText?.({...r,query_layers:r.layers,x:t,y:n,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(t){if(t.data instanceof te)return t.data;if(typeof t.data=="string")return Bl({url:t.data,loadOptions:t.loadOptions,type:t.serviceType});throw new Error("invalid image source in props.data")}async _loadMetadata(){let{imageSource:t}=this.state;try{this.state.loadCounter++;let n=await t.getMetadata();this.state.imageSource===t&&this.getCurrentLayer()?.props.onMetadataLoad(n)}catch(n){this.getCurrentLayer()?.props.onMetadataLoadError(n)}finally{this.state.loadCounter--}}async loadImage(t,n){let{layers:r,serviceType:s}=this.props;if(s==="wms"&&r.length===0)return;let i=t.getBounds(),{width:o,height:c}=t,a=this.getRequestId(),{srs:h}=this.props;h==="auto"&&(h=t.resolution?"EPSG:4326":"EPSG:3857");let l={width:o,height:c,boundingBox:[[i[0],i[1]],[i[2],i[3]]],layers:r,crs:h};if(h==="EPSG:3857"){let f=Ll([i[0],i[1]]),p=Ll([i[2],i[3]]);l.boundingBox=[f,p]}try{this.state.loadCounter++,this.props.onImageLoadStart(a);let f=await this.state.imageSource.getImage(l);this.state.lastRequestId<a&&(this.getCurrentLayer()?.props.onImageLoad(a),this.setState({image:f,bounds:i,lastRequestParameters:l,lastRequestId:a}))}catch(f){this.raiseError(f,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(a,f)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(t,n=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>t(),n)}};vr.layerName="WMSLayer";vr.defaultProps=Uw;var qm=G(he(),1),Gw={getHeight:{type:"accessor",value:0},greatCircle:!0},$s=class extends qm.ArcLayer{};$s.layerName="GreatCircleLayer";$s.defaultProps=Gw;var km=$s;var zo=G(Rl(),1),zw=3,Vw=30,qw=2*Vw+1,Ym=180/Math.PI;function Jm(e,t,n){let r=1<<t;return[(e[0]+n[0])/r,(e[1]+n[1])/r]}function Wm(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function jm(e){return[Wm(e[0]),Wm(e[1])]}function Xm(e,[t,n]){switch(e){case 0:return[1,t,n];case 1:return[-t,1,n];case 2:return[-t,-n,1];case 3:return[-1,-n,-t];case 4:return[n,-1,-t];case 5:return[n,t,-1];default:throw new Error("Invalid face")}}function Km([e,t,n]){let r=Math.atan2(n,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*Ym,r*Ym]}function Qm(e){let t=zo.default.fromString(e,!0,10).toString(2);for(;t.length<zw+qw;)t="0"+t;let n=t.lastIndexOf("1"),r=t.substring(0,3),s=t.substring(3,n),i=s.length/2,o=zo.default.fromString(r,!0,2).toString(10),c=zo.default.fromString(s,!0,2).toString(4);for(;c.length<i;)c="0"+c;return`${o}/${c}`}function kw(e,t,n,r){if(r===0){n===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let s=t[0];t[0]=t[1],t[1]=s}}function Zm(e){let t=e.split("/"),n=parseInt(t[0],10),r=t[1],s=r.length,i=[0,0],o;for(let c=s-1;c>=0;c--){o=s-c;let a=r[c],h=0,l=0;a==="1"?l=1:a==="2"?(h=1,l=1):a==="3"&&(h=1);let f=Math.pow(2,o-1);kw(f,i,h,l),i[0]+=f*h,i[1]+=f*l}if(n%2===1){let c=i[0];i[0]=i[1],i[1]=c}return{face:n,ij:i,level:o}}var $m=G(Rl(),1);function Hw(e){let t=e.padEnd(16,"0");return $m.default.fromString(t,16)}var Yw=100;function Ww({face:e,ij:t,level:n}){let r=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(Yw*Math.pow(2,-n))),i=new Float64Array(4*s*2+2),o=0,c=0;for(let a=0;a<4;a++){let h=r[a].slice(0),l=r[a+1],f=(l[0]-h[0])/s,p=(l[1]-h[1])/s;for(let u=0;u<s;u++){h[0]+=f,h[1]+=p;let d=Jm(t,n,h),g=jm(d),m=Xm(e,g),M=Km(m);Math.abs(M[1])>89.999&&(M[0]=c);let E=M[0]-c;M[0]+=E>180?-360:E<-180?360:0,i[o++]=M[0],i[o++]=M[1],c=M[0]}}return i[o++]=i[0],i[o++]=i[1],i}function Jw(e){if(typeof e=="string"){if(e.indexOf("/")>0)return e;e=Hw(e)}return Qm(e.toString())}function tg(e){let t=Jw(e),n=Zm(t);return Ww(n)}var jw={getS2Token:{type:"accessor",value:e=>e.token}},ei=class extends $t{indexToBounds(){let{data:t,getS2Token:n}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(r,s)=>tg(n(r,s))}}};ei.layerName="S2Layer";ei.defaultProps=jw;var eg=ei;var bl=512;function Xw(e,t){let n=0,r=0,s=1<<e.length,i=s/bl;for(let o=0;o<e.length;o++){s>>=1;let c=parseInt(e[o]);c%2&&(n|=s),c>1&&(r|=s)}return[[n/i,bl-r/i],[(n+t)/i,bl-(r+t)/i]]}function ng(e,t=1){let[n,r]=Xw(e,t),[s,i]=Ge(n),[o,c]=Ge(r);return[o,i,o,c,s,c,s,i,o,i]}var Kw={getQuadkey:{type:"accessor",value:e=>e.quadkey}},ni=class extends $t{indexToBounds(){let{data:t,extruded:n,getQuadkey:r}=this.props,s=n?.99:1;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(i,o)=>ng(r(i,o),s),updateTriggers:{getPolygon:s}}}};ni.layerName="QuadkeyLayer";ni.defaultProps=Kw;var rg=ni;var jo=G(le(),1),yg=G(he(),1);var Yn=class{constructor(t){this.index=t,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(t){this._bbox||(this._bbox=t,"west"in t?this.boundingBox=[[t.west,t.south],[t.east,t.north]]:this.boundingBox=[[t.left,t.top],[t.right,t.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error("byteLength not defined in tile data"),t}async _loadData({getData:t,requestScheduler:n,onLoad:r,onError:s}){let{index:i,id:o,bbox:c,userData:a,zoom:h}=this,l=this._loaderId;this._abortController=new AbortController;let{signal:f}=this._abortController,p=await n.scheduleRequest(this,g=>g.isSelected?1:-1);if(!p){this._isCancelled=!0;return}if(this._isCancelled){p.done();return}let u=null,d;try{u=await t({index:i,id:o,bbox:c,userData:a,zoom:h,signal:f})}catch(g){d=g||!0}finally{p.done()}if(l===this._loaderId){if(this._loader=void 0,this.content=u,this._isCancelled&&!u){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,d?s(d,this):r(this)}}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var si=G(le(),1);var gt={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var sg=new O,Qw=new O,fn=class{constructor(t=[0,0,0],n=[0,0,0],r){r=r||sg.copy(t).add(n).scale(.5),this.center=new O(r),this.halfDiagonal=new O(n).subtract(this.center),this.minimum=new O(t),this.maximum=new O(n)}clone(){return new fn(this.minimum,this.maximum,this.center)}equals(t){return this===t||Boolean(t)&&this.minimum.equals(t.minimum)&&this.maximum.equals(t.maximum)}transform(t){return this.center.transformAsPoint(t),this.halfDiagonal.transform(t),this.minimum.transform(t),this.maximum.transform(t),this}intersectPlane(t){let{halfDiagonal:n}=this,r=Qw.from(t.normal),s=n.x*Math.abs(r.x)+n.y*Math.abs(r.y)+n.z*Math.abs(r.z),i=this.center.dot(r)+t.distance;return i-s>0?gt.INSIDE:i+s<0?gt.OUTSIDE:gt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=sg.from(t).subtract(this.center),{halfDiagonal:r}=this,s=0,i;return i=Math.abs(n.x)-r.x,i>0&&(s+=i*i),i=Math.abs(n.y)-r.y,i>0&&(s+=i*i),i=Math.abs(n.z)-r.z,i>0&&(s+=i*i),s}};var ri=new O,ig=new O,pn=class{constructor(t=[0,0,0],n=0){this.radius=-0,this.center=new O,this.fromCenterRadius(t,n)}fromCenterRadius(t,n){return this.center.from(t),this.radius=n,this}fromCornerPoints(t,n){return n=ri.from(n),this.center=new O().from(t).add(n).scale(.5),this.radius=this.center.distance(n),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new pn(this.center,this.radius)}union(t){let n=this.center,r=this.radius,s=t.center,i=t.radius,o=ri.copy(s).subtract(n),c=o.magnitude();if(r>=c+i)return this.clone();if(i>=c+r)return t.clone();let a=(r+c+i)*.5;return ig.copy(o).scale((-r+a)/c).add(n),this.center.copy(ig),this.radius=a,this}expand(t){let r=ri.from(t).subtract(this.center).magnitude();return r>this.radius&&(this.radius=r),this}transform(t){this.center.transform(t);let n=Ns.getScaling(ri,t);return this.radius=Math.max(n[0],Math.max(n[1],n[2]))*this.radius,this}distanceSquaredTo(t){let n=this.distanceTo(t);return n*n}distanceTo(t){let r=ri.from(t).subtract(this.center);return Math.max(0,r.len()-this.radius)}intersectPlane(t){let n=this.center,r=this.radius,i=t.normal.dot(n)+t.distance;return i<-r?gt.OUTSIDE:i<r?gt.INTERSECTING:gt.INSIDE}};var Zw=new O,$w=new O,Vo=new O,qo=new O,ko=new O,tI=new O,eI=new O,ze={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Wn=class{constructor(t=[0,0,0],n=[0,0,0,0,0,0,0,0,0]){this.center=new O().from(t),this.halfAxes=new ht(n)}get halfSize(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new O(t).len(),new O(n).len(),new O(r).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),s=new O(t).normalize(),i=new O(n).normalize(),o=new O(r).normalize();return new Lr().fromMatrix3(new ht([...s,...i,...o]))}fromCenterHalfSizeQuaternion(t,n,r){let s=new Lr(r),i=new ht().fromQuaternion(s);return i[0]=i[0]*n[0],i[1]=i[1]*n[0],i[2]=i[2]*n[0],i[3]=i[3]*n[1],i[4]=i[4]*n[1],i[5]=i[5]*n[1],i[6]=i[6]*n[2],i[7]=i[7]*n[2],i[8]=i[8]*n[2],this.center=new O().from(t),this.halfAxes=i,this}clone(){return new Wn(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new pn){let n=this.halfAxes,r=n.getColumn(0,Vo),s=n.getColumn(1,qo),i=n.getColumn(2,ko),o=Zw.copy(r).add(s).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let n=this.center,r=t.normal,s=this.halfAxes,i=r.x,o=r.y,c=r.z,a=Math.abs(i*s[ze.COLUMN0ROW0]+o*s[ze.COLUMN0ROW1]+c*s[ze.COLUMN0ROW2])+Math.abs(i*s[ze.COLUMN1ROW0]+o*s[ze.COLUMN1ROW1]+c*s[ze.COLUMN1ROW2])+Math.abs(i*s[ze.COLUMN2ROW0]+o*s[ze.COLUMN2ROW1]+c*s[ze.COLUMN2ROW2]),h=r.dot(n)+t.distance;return h<=-a?gt.OUTSIDE:h>=a?gt.INSIDE:gt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=$w.from(t).subtract(this.center),r=this.halfAxes,s=r.getColumn(0,Vo),i=r.getColumn(1,qo),o=r.getColumn(2,ko),c=s.magnitude(),a=i.magnitude(),h=o.magnitude();s.normalize(),i.normalize(),o.normalize();let l=0,f;return f=Math.abs(n.dot(s))-c,f>0&&(l+=f*f),f=Math.abs(n.dot(i))-a,f>0&&(l+=f*f),f=Math.abs(n.dot(o))-h,f>0&&(l+=f*f),l}computePlaneDistances(t,n,r=[-0,-0]){let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=this.center,c=this.halfAxes,a=c.getColumn(0,Vo),h=c.getColumn(1,qo),l=c.getColumn(2,ko),f=tI.copy(a).add(h).add(l).add(o),p=eI.copy(f).subtract(t),u=n.dot(p);return s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).add(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).subtract(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).subtract(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).add(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).add(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).subtract(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).subtract(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),r[0]=s,r[1]=i,r}transform(t){this.center.transformAsPoint(t);let n=this.halfAxes.getColumn(0,Vo);n.transformAsPoint(t);let r=this.halfAxes.getColumn(1,qo);r.transformAsPoint(t);let s=this.halfAxes.getColumn(2,ko);return s.transformAsPoint(t),this.halfAxes=new ht([...n,...r,...s]),this}getTransform(){throw new Error("not implemented")}};var og=new O,cg=new O,de=class{constructor(t=[0,0,1],n=0){this.normal=new O,this.distance=-0,this.fromNormalDistance(t,n)}fromNormalDistance(t,n){return Se(Number.isFinite(n)),this.normal.from(t).normalize(),this.distance=n,this}fromPointNormal(t,n){t=og.from(t),this.normal.from(n).normalize();let r=-this.normal.dot(t);return this.distance=r,this}fromCoefficients(t,n,r,s){return this.normal.set(t,n,r),Se(_e(this.normal.len(),1)),this.distance=s,this}clone(){return new de(this.normal,this.distance)}equals(t){return _e(this.distance,t.distance)&&_e(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let n=cg.copy(this.normal).transformAsVector(t).normalize(),r=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(r,n)}projectPointOntoPlane(t,n=[0,0,0]){let r=og.from(t),s=this.getPointDistance(r),i=cg.copy(this.normal).scale(s);return r.subtract(i).to(n)}};var ag=[new O([1,0,0]),new O([0,1,0]),new O([0,0,1])],hg=new O,nI=new O,Wt=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*ag.length;let n=t.center,r=t.radius,s=0;for(let i of ag){let o=this.planes[s],c=this.planes[s+1];o||(o=this.planes[s]=new de),c||(c=this.planes[s+1]=new de);let a=hg.copy(i).scale(-r).add(n);o.fromPointNormal(a,i);let h=hg.copy(i).scale(r).add(n),l=nI.copy(i).negate();c.fromPointNormal(h,l),s+=2}return this}computeVisibility(t){let n=gt.INSIDE;for(let r of this.planes)switch(t.intersectPlane(r)){case gt.OUTSIDE:return gt.OUTSIDE;case gt.INTERSECTING:n=gt.INTERSECTING;break;default:}return n}computeVisibilityWithPlaneMask(t,n){if(Se(Number.isFinite(n),"parentPlaneMask is required."),n===Wt.MASK_OUTSIDE||n===Wt.MASK_INSIDE)return n;let r=Wt.MASK_INSIDE,s=this.planes;for(let i=0;i<this.planes.length;++i){let o=i<31?1<<i:0;if(i<31&&!(n&o))continue;let c=s[i],a=t.intersectPlane(c);if(a===gt.OUTSIDE)return Wt.MASK_OUTSIDE;a===gt.INTERSECTING&&(r|=o)}return r}};Wt.MASK_OUTSIDE=4294967295;Wt.MASK_INSIDE=0;Wt.MASK_INDETERMINATE=2147483647;var T7=new O,_7=new O,S7=new O,C7=new O,B7=new O;var P7=new O,O7=new O,v7=new O,N7=new O,F7=new O,D7=new O,U7=new O,G7=new O,z7=new O,V7=new O,q7=new O,k7=new O;var be=new ht,sI=new ht,iI=new ht,Ho=new ht,lg=new ht;function Pl(e,t={}){let n=Rr.EPSILON20,r=10,s=0,i=0,o=sI,c=iI;o.identity(),c.copy(e);let a=n*oI(c);for(;i<r&&cI(c)>a;)aI(c,Ho),lg.copy(Ho).transpose(),c.multiplyRight(Ho),c.multiplyLeft(lg),o.multiplyRight(Ho),++s>2&&(++i,s=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=c.toTarget(t.diagonal),t}function oI(e){let t=0;for(let n=0;n<9;++n){let r=e[n];t+=r*r}return Math.sqrt(t)}var wl=[1,0,0],Il=[2,2,1];function cI(e){let t=0;for(let n=0;n<3;++n){let r=e[be.getElementIndex(Il[n],wl[n])];t+=2*r*r}return Math.sqrt(t)}function aI(e,t){let n=Rr.EPSILON15,r=0,s=1;for(let h=0;h<3;++h){let l=Math.abs(e[be.getElementIndex(Il[h],wl[h])]);l>r&&(s=h,r=l)}let i=wl[s],o=Il[s],c=1,a=0;if(Math.abs(e[be.getElementIndex(o,i)])>n){let h=e[be.getElementIndex(o,o)],l=e[be.getElementIndex(i,i)],f=e[be.getElementIndex(o,i)],p=(h-l)/2/f,u;p<0?u=-1/(-p+Math.sqrt(1+p*p)):u=1/(p+Math.sqrt(1+p*p)),c=1/Math.sqrt(1+u*u),a=u*c}return ht.IDENTITY.to(t),t[be.getElementIndex(i,i)]=t[be.getElementIndex(o,o)]=c,t[be.getElementIndex(o,i)]=a,t[be.getElementIndex(i,o)]=-a,t}var un=new O,hI=new O,lI=new O,fI=new O,pI=new O,uI=new ht,dI={diagonal:new ht,unitary:new ht};function Ol(e,t=new Wn){if(!e||e.length===0)return t.halfAxes=new ht([0,0,0,0,0,0,0,0,0]),t.center=new O,t;let n=e.length,r=new O(0,0,0);for(let S of e)r.add(S);let s=1/n;r.multiplyByScalar(s);let i=0,o=0,c=0,a=0,h=0,l=0;for(let S of e){let x=un.copy(S).subtract(r);i+=x.x*x.x,o+=x.x*x.y,c+=x.x*x.z,a+=x.y*x.y,h+=x.y*x.z,l+=x.z*x.z}i*=s,o*=s,c*=s,a*=s,h*=s,l*=s;let f=uI;f[0]=i,f[1]=o,f[2]=c,f[3]=o,f[4]=a,f[5]=h,f[6]=c,f[7]=h,f[8]=l;let{unitary:p}=Pl(f,dI),u=t.halfAxes.copy(p),d=u.getColumn(0,lI),g=u.getColumn(1,fI),m=u.getColumn(2,pI),M=-Number.MAX_VALUE,E=-Number.MAX_VALUE,A=-Number.MAX_VALUE,y=Number.MAX_VALUE,T=Number.MAX_VALUE,_=Number.MAX_VALUE;for(let S of e)un.copy(S),M=Math.max(un.dot(d),M),E=Math.max(un.dot(g),E),A=Math.max(un.dot(m),A),y=Math.min(un.dot(d),y),T=Math.min(un.dot(g),T),_=Math.min(un.dot(m),_);d=d.multiplyByScalar(.5*(y+M)),g=g.multiplyByScalar(.5*(T+E)),m=m.multiplyByScalar(.5*(_+A)),t.center.copy(d).add(g).add(m);let L=hI.set(M-y,E-T,A-_).multiplyByScalar(.5),C=new ht([L[0],0,0,0,L[1],0,0,0,L[2]]);return t.halfAxes.multiplyRight(C),t}var Nr=512,fg=3,pg=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],ug=pg.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),mI=ug.concat([[.25,.5],[.75,.5]]),dn=class{constructor(t,n,r){this.x=t,this.y=n,this.z=r}get children(){if(!this._children){let t=this.x*2,n=this.y*2,r=this.z+1;this._children=[new dn(t,n,r),new dn(t,n+1,r),new dn(t+1,n,r),new dn(t+1,n+1,r)]}return this._children}update(t){let{viewport:n,cullingVolume:r,elevationBounds:s,minZ:i,maxZ:o,bounds:c,offset:a,project:h}=t,l=this.getBoundingVolume(s,a,h);if(c&&!this.insideBounds(c)||r.computeVisibility(l)<0)return!1;if(!this.childVisible){let{z:p}=this;if(p<o&&p>=i){let u=l.distanceTo(n.cameraPosition)*n.scale/n.height;p+=Math.floor(Math.log2(u))}if(p>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let p of this.children)p.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(let n of this._children)n.getSelected(t);return t}insideBounds([t,n,r,s]){let i=Math.pow(2,this.z),o=Nr/i;return this.x*o<r&&this.y*o<s&&(this.x+1)*o>t&&(this.y+1)*o>n}getBoundingVolume(t,n,r){if(r){let a=this.z<1?mI:this.z<2?ug:pg,h=[];for(let l of a){let f=Yo(this.x+l[0],this.y+l[1],this.z);f[2]=t[0],h.push(r(f)),t[0]!==t[1]&&(f[2]=t[1],h.push(r(f)))}return Ol(h)}let s=Math.pow(2,this.z),i=Nr/s,o=this.x*i+n*Nr,c=Nr-(this.y+1)*i;return new fn([o,c,t[0]],[o+i,c+i,t[1]])}};function dg(e,t,n,r){let s=e instanceof si._GlobeViewport&&e.resolution?e.projectPosition:null,i=Object.values(e.getFrustumPlanes()).map(({normal:u,distance:d})=>new de(u.clone().negate(),d)),o=new Wt(i),c=e.distanceScales.unitsPerMeter[2],a=n&&n[0]*c||0,h=n&&n[1]*c||0,l=e instanceof si.WebMercatorViewport&&e.pitch<=60?t:0;if(r){let[u,d,g,m]=r,M=Ue([u,m]),E=Ue([g,d]);r=[M[0],Nr-M[1],E[0],Nr-E[1]]}let f=new dn(0,0,0),p={viewport:e,project:s,cullingVolume:o,elevationBounds:[a,h],minZ:l,maxZ:t,bounds:r,offset:0};if(f.update(p),e instanceof si.WebMercatorViewport&&e.subViewports&&e.subViewports.length>1){for(p.offset=-1;f.update(p)&&!(--p.offset<-fg););for(p.offset=1;f.update(p)&&!(++p.offset>fg););}return f.getSelected()}var Ve=512,gI=[-1/0,-1/0,1/0,1/0],mn={type:"object",value:null,validate:(e,t)=>t.optional&&e===null||typeof e=="string"||Array.isArray(e)&&e.every(n=>typeof n=="string"),equal:(e,t)=>{if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}};function Wo(e,t){let n=[t.transformAsPoint([e[0],e[1]]),t.transformAsPoint([e[2],e[1]]),t.transformAsPoint([e[0],e[3]]),t.transformAsPoint([e[2],e[3]])];return[Math.min(...n.map(s=>s[0])),Math.min(...n.map(s=>s[1])),Math.max(...n.map(s=>s[0])),Math.max(...n.map(s=>s[1]))]}function xI(e){return Math.abs(e.split("").reduce((t,n)=>(t<<5)-t+n.charCodeAt(0)|0,0))}function we(e,t){if(!e||!e.length)return null;let{index:n,id:r}=t;if(Array.isArray(e)){let i=xI(r)%e.length;e=e[i]}let s=e;for(let i of Object.keys(n)){let o=new RegExp(`{${i}}`,"g");s=s.replace(o,String(n[i]))}return Number.isInteger(n.y)&&Number.isInteger(n.z)&&(s=s.replace(/\{-y\}/g,String(Math.pow(2,n.z)-n.y-1))),s}function MI(e,t,n){let r;if(t&&t.length===2){let[s,i]=t,o=e.getBounds({z:s}),c=e.getBounds({z:i});r=[Math.min(o[0],c[0]),Math.min(o[1],c[1]),Math.max(o[2],c[2]),Math.max(o[3],c[3])]}else r=e.getBounds();return e.isGeospatial?[Math.max(r[0],n[0]),Math.max(r[1],n[1]),Math.min(r[2],n[2]),Math.min(r[3],n[3])]:[Math.max(Math.min(r[0],n[2]),n[0]),Math.max(Math.min(r[1],n[3]),n[1]),Math.min(Math.max(r[2],n[0]),n[2]),Math.min(Math.max(r[3],n[1]),n[3])]}function gg({viewport:e,z:t,cullRect:n}){return(e.subViewports||[e]).map(s=>vl(s,t||0,n))}function vl(e,t,n){if(!Array.isArray(t)){let i=n.x-e.x,o=n.y-e.y,{width:c,height:a}=n,h={targetZ:t},l=e.unproject([i,o],h),f=e.unproject([i+c,o],h),p=e.unproject([i,o+a],h),u=e.unproject([i+c,o+a],h);return[Math.min(l[0],f[0],p[0],u[0]),Math.min(l[1],f[1],p[1],u[1]),Math.max(l[0],f[0],p[0],u[0]),Math.max(l[1],f[1],p[1],u[1])]}let r=vl(e,t[0],n),s=vl(e,t[1],n);return[Math.min(r[0],s[0]),Math.min(r[1],s[1]),Math.max(r[2],s[2]),Math.max(r[3],s[3])]}function AI(e,t,n){return n?Wo(e,n).map(s=>s*t/Ve):e.map(r=>r*t/Ve)}function Nl(e,t){return Math.pow(2,e)*Ve/t}function Yo(e,t,n){let r=Nl(n,Ve),s=e/r*360-180,i=Math.PI-2*Math.PI*t/r,o=180/Math.PI*Math.atan(.5*(Math.exp(i)-Math.exp(-i)));return[s,o]}function mg(e,t,n,r){let s=Nl(n,r);return[e/s*Ve,t/s*Ve]}function Fl(e,t,n,r,s=Ve){if(e.isGeospatial){let[h,l]=Yo(t,n,r),[f,p]=Yo(t+1,n+1,r);return{west:h,north:l,east:f,south:p}}let[i,o]=mg(t,n,r,s),[c,a]=mg(t+1,n+1,r,s);return{left:i,top:o,right:c,bottom:a}}function yI(e,t,n,r,s){let i=MI(e,null,r),o=Nl(t,n),[c,a,h,l]=AI(i,o,s),f=[];for(let p=Math.floor(c);p<h;p++)for(let u=Math.floor(a);u<l;u++)f.push({x:p,y:u,z:t});return f}function Dl({viewport:e,maxZoom:t,minZoom:n,zRange:r,extent:s,tileSize:i=Ve,modelMatrix:o,modelMatrixInverse:c,zoomOffset:a=0}){let h=e.isGeospatial?Math.round(e.zoom+Math.log2(Ve/i))+a:Math.ceil(e.zoom)+a;if(typeof n=="number"&&Number.isFinite(n)&&h<n){if(!s)return[];h=n}typeof t=="number"&&Number.isFinite(t)&&h>t&&(h=t);let l=s;return o&&c&&s&&!e.isGeospatial&&(l=Wo(s,o)),e.isGeospatial?dg(e,h,r,s):yI(e,h,i,l||gI,c)}function Ul(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(e)}function Gl(e){return Number.isFinite(e.west)&&Number.isFinite(e.north)&&Number.isFinite(e.east)&&Number.isFinite(e.south)}function xg(e){let t={},n;return r=>{for(let s in r)if(!EI(r[s],t[s])){n=e(r),t=r;break}return n}}function EI(e,t){if(e===t)return!0;if(Array.isArray(e)){let n=e.length;if(!t||t.length!==n)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}return!1}var Mg=1,Jo=2,TI="never",_I="no-overlap",ii="best-available",SI=5,CI={[ii]:LI,[_I]:RI,[TI]:()=>{}},BI={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:()=>{}},Jn=class{constructor(t){this._getCullBounds=xg(gg),this.opts={...BI,...t},this.setOptions(this.opts),this.onTileLoad=n=>{this.opts.onTileLoad?.(n),this.opts.maxCacheByteSize!==null&&(this._cacheByteSize+=n.byteLength,this._resizeCache())},this._requestScheduler=new an({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 It,this._modelMatrixInverse=new It}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(t=>t.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(t=>t.needsReload)}setOptions(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom))}finalize(){for(let t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let t of this._cache.keys()){let n=this._cache.get(t);!this._selectedTiles||!this._selectedTiles.includes(n)?this._cache.delete(t):n.setNeedsReload()}}update(t,{zRange:n,modelMatrix:r}={zRange:null,modelMatrix:null}){let s=r?new It(r):new It,i=!s.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!_e(this._zRange,n)||i){i&&(this._modelMatrixInverse=s.clone().invert(),this._modelMatrix=s),this._viewport=t,this._zRange=n;let c=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:n,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=c.map(a=>this._getTile(a,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(c=>this._getTile(c.index,!0)));let o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(t,n,r){if(!t.isVisible)return!1;if(n&&this._viewport){let s=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:n}),{bbox:i}=t;for(let[o,c,a,h]of s){let l;if("west"in i)l=i.west<a&&i.east>o&&i.south<h&&i.north>c;else{if(r&&!It.IDENTITY.equals(r)){let[u,d,g,m]=Wo([i.left,i.top,i.right,i.bottom],r);i={left:u,top:d,right:g,bottom:m}}let f=Math.min(i.top,i.bottom),p=Math.max(i.top,i.bottom);l=i.left<a&&i.right>o&&f<h&&p>c}if(l)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:n,minZoom:r,zRange:s,modelMatrix:i,modelMatrixInverse:o}){let{tileSize:c,extent:a,zoomOffset:h}=this.opts;return Dl({viewport:t,maxZoom:n,minZoom:r,zRange:s,tileSize:c,extent:a,modelMatrix:i,modelMatrixInverse:o,zoomOffset:h})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){let{tileSize:n}=this.opts;return{bbox:Fl(this._viewport,t.x,t.y,t.z,n)}}getParentIndex(t){let n=Math.floor(t.x/2),r=Math.floor(t.y/2),s=t.z-1;return{x:n,y:r,z:s}}updateTileStates(){let t=this.opts.refinementStrategy||ii,n=new Array(this._cache.size),r=0;for(let s of this._cache.values())n[r++]=s.isVisible,s.isSelected=!1,s.isVisible=!1;for(let s of this._selectedTiles)s.isSelected=!0,s.isVisible=!0;(typeof t=="function"?t:CI[t])(Array.from(this._cache.values())),r=0;for(let s of this._cache.values())if(n[r++]!==s.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:t=0}=this.opts,n=[],r=0;for(let s of this._cache.values())s.isLoading&&(r++,!s.isSelected&&!s.isVisible&&n.push(s));for(;t>0&&r>t&&n.length>0;)n.shift().abort(),r--}_rebuildTree(){let{_cache:t}=this;for(let n of t.values())n.parent=null,n.children&&(n.children.length=0);for(let n of t.values()){let r=this._getNearestAncestor(n);n.parent=r,r?.children&&r.children.push(n)}}_resizeCache(){let{_cache:t,opts:n}=this,r=n.maxCacheSize??(n.maxCacheByteSize!==null?1/0:SI*this.selectedTiles.length),s=n.maxCacheByteSize??1/0;if(t.size>r||this._cacheByteSize>s){for(let[o,c]of t)if(!c.isVisible&&!c.isSelected&&(this._cacheByteSize-=n.maxCacheByteSize!==null?c.byteLength:0,t.delete(o),this.opts.onTileUnload?.(c)),t.size<=r&&this._cacheByteSize<=s)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((o,c)=>o.zoom-c.zoom),this._dirty=!1)}_getTile(t,n){let r=this.getTileId(t),s=this._cache.get(r),i=!1;return!s&&n?(s=new Yn(t),Object.assign(s,this.getTileMetadata(s.index)),Object.assign(s,{id:r,zoom:this.getTileZoom(s.index)}),i=!0,this._cache.set(r,s),this._dirty=!0):s&&s.needsReload&&(i=!0),s&&i&&s.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),s}_getNearestAncestor(t){let{_minZoom:n=0}=this,r=t.index;for(;this.getTileZoom(r)>n;){r=this.getParentIndex(r);let s=this._getTile(r);if(s)return s}return null}};function LI(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!Ag(t)&&zl(t);for(let t of e)t.isVisible=Boolean(t.state&Jo)}function RI(e){for(let n of e)n.state=0;for(let n of e)n.isSelected&&Ag(n);let t=Array.from(e).sort((n,r)=>n.zoom-r.zoom);for(let n of t)if(n.isVisible=Boolean(n.state&Jo),n.children&&(n.isVisible||n.state&Mg))for(let r of n.children)r.state=Mg;else n.isSelected&&zl(n)}function Ag(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=Jo,!0;t=t.parent}return!1}function zl(e){for(let t of e.children)t.isLoaded||t.content?t.state|=Jo:zl(t)}var bI={TilesetClass:Jn,data:{type:"data",value:[]},dataComparator:mn.equal,renderSubLayers:{type:"function",value:e=>new yg.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:ii,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},oi=class extends jo.CompositeLayer{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every(t=>t.isLoaded&&t.layers&&t.layers.every(n=>n.isLoaded)))}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:n}=this.state,r=t.propsOrDataChanged||t.updateTriggersChanged,s=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);n?r&&(n.setOptions(this._getTilesetOptions()),s?n.reloadAll():n.tiles.forEach(i=>{i.layers=null})):(n=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:n})),this._updateTileset()}_getTilesetOptions(){let{tileSize:t,maxCacheSize:n,maxCacheByteSize:r,refinementStrategy:s,extent:i,maxZoom:o,minZoom:c,maxRequests:a,debounceTime:h,zoomOffset:l}=this.props;return{maxCacheSize:n,maxCacheByteSize:r,maxZoom:o,minZoom:c,tileSize:t,refinementStrategy:s,extent:i,maxRequests:a,debounceTime:h,zoomOffset:l,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let t=this.state.tileset,{zRange:n,modelMatrix:r}=this.props,s=t.update(this.context.viewport,{zRange:n,modelMatrix:r}),{isLoaded:i}=t,o=this.state.isLoaded!==i,c=this.state.frameNumber!==s;i&&(o||c)&&this._onViewportLoad(),c&&this.setState({frameNumber:s}),this.state.isLoaded=i}_onViewportLoad(){let{tileset:t}=this.state,{onViewportLoad:n}=this.props;n&&n(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,n){this.props.onTileError(t),n.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){let{data:n,getTileData:r,fetch:s}=this.props,{signal:i}=t;return t.url=typeof n=="string"||Array.isArray(n)?we(n,t):null,r?r(t):s&&t.url?s(t.url,{propName:"data",layer:this,signal:i}):null}renderSubLayers(t){return this.props.renderSubLayers(t)}getSubLayerPropsByTile(t){return null}getPickingInfo(t){let n=t.sourceLayer,r=n.props.tile,s=t.info;return s.picked&&(s.tile=r),s.sourceTile=r,s.sourceTileSubLayer=n,s}_updateAutoHighlight(t){t.sourceTileSubLayer.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map(t=>{let n=this.getSubLayerPropsByTile(t);if(!(!t.isLoaded&&!t.content))if(t.layers)n&&t.layers[0]&&Object.keys(n).some(r=>t.layers[0].props[r]!==n[r])&&(t.layers=t.layers.map(r=>r.clone(n)));else{let r=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=(0,jo._flatten)(r,Boolean).map(s=>s.clone({tile:t,...n}))}return t.layers})}filterSubLayer({layer:t,cullRect:n}){let{tile:r}=t.props,{modelMatrix:s}=this.props;return this.state.tileset.isTileVisible(r,n,s?new It(s):null)}};oi.defaultProps=bI;oi.layerName="TileLayer";var jn=oi;var _g=G(he(),1);var Eg=`uniform tripsUniforms {
13
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Me.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)};Me.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}};Me.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)}Me.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}};Me.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};Me.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}};Me.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}nd.exports=Me});var id=rt((TR,od)=>{"use strict";var $_=wa(),tM=Qh(),eM=sd();od.exports={XMLParser:tM,XMLValidator:$_,XMLBuilder:eM}});var cc=rt(($d,Pn)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof ff=="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 Tc=rt((BG,Dp)=>{Dp.exports=globalThis.luma});var Bo=rt((CG,Gp)=>{Gp.exports=globalThis.deck});var Ec=rt((SG,Up)=>{Up.exports=globalThis.luma});var Or=rt((nU,nm)=>{nm.exports=globalThis.loaders});var L0=rt((_z,w0)=>{w0.exports=globalThis.deck});var V0=rt(Ql=>{Ql.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)};Ql.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((l5,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 Zl=(1<<16)*(1<<16),H0=1/Zl,h3=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=Bi(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=Bi(this.buf,this.pos)+Bi(this.buf,this.pos+4)*Zl;return this.pos+=8,e},readSFixed64:function(){var e=Bi(this.buf,this.pos)+q0(this.buf,this.pos+4)*Zl;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,d3(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>=h3&&k0?S3(this.buf,t,e):C3(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=Ae(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=Ae(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=Ae(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=Ae(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=Ae(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=Ae(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=Ae(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=Ae(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=Ae(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),rn(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),rn(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),rn(this.buf,e&-1,this.pos),rn(this.buf,Math.floor(e*H0),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),rn(this.buf,e&-1,this.pos),rn(this.buf,Math.floor(e*H0),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){p3(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=I3(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,A3,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,x3,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,E3,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,y3,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,T3,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,_3,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,M3,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,b3,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 d3(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 en(e,s,t);throw new Error("Expected varint not more than 10 bytes")}function Ae(e){return e.type===j.Bytes?e.readVarint()+e.pos:e.pos+1}function en(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function p3(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),m3(r,n,t),g3(n,t)}function m3(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 g3(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 A3(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function x3(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function y3(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function T3(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function E3(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function _3(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function M3(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function b3(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 Bi(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function rn(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 C3(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 S3(e,t,r){return k0.decode(e.subarray(t,r))}function I3(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:()=>Ih,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:()=>Fr,_getURLFromTemplate:()=>oe});var Qt={},hf=D(zt(),1);xe(Qt,D(zt(),1));if(!hf.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");xe(xs,Qt);var pf=D(qt(),1),wi=D(zt(),1),T1={...wi.PolygonLayer.defaultProps},on=class extends pf.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",wi.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)}};on.layerName="GeoCellLayer";on.defaultProps=T1;var Ft=on;var E1=Object.defineProperty,fn=(e,t)=>{for(var r in t)E1(e,r,{get:t[r],enumerable:!0})},Tt={};fn(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={};fn(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:()=>Nf,multiplyScalar:()=>j1,multiplyScalarAndAdd:()=>X1,rotate:()=>N1,scale:()=>D1,set:()=>v1,str:()=>V1,sub:()=>Y1,subtract:()=>Df,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 Nf(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 Df(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=Nf,Y1=Df;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 Fi={};fn(Fi,{add:()=>lx,calculateW:()=>ZA,clone:()=>ox,conjugate:()=>rx,copy:()=>ax,create:()=>Oi,dot:()=>$f,equals:()=>mx,exactEquals:()=>px,exp:()=>Yf,fromEuler:()=>nx,fromMat3:()=>Qf,fromValues:()=>ix,getAngle:()=>WA,getAxisAngle:()=>XA,identity:()=>jA,invert:()=>ex,len:()=>hx,length:()=>tu,lerp:()=>ux,ln:()=>Kf,mul:()=>fx,multiply:()=>Wf,normalize:()=>ki,pow:()=>$A,random:()=>tx,rotateX:()=>YA,rotateY:()=>KA,rotateZ:()=>QA,rotationTo:()=>gx,scale:()=>Zf,set:()=>cx,setAxes:()=>xx,setAxisAngle:()=>Xf,slerp:()=>ws,sqlerp:()=>Ax,sqrLen:()=>dx,squaredLength:()=>eu,str:()=>sx});var w={};fn(w,{add:()=>tA,angle:()=>TA,bezier:()=>hA,ceil:()=>eA,clone:()=>Q1,copy:()=>Z1,create:()=>zi,cross:()=>Is,dist:()=>IA,distance:()=>zf,div:()=>SA,divide:()=>Hf,dot:()=>qi,equals:()=>bA,exactEquals:()=>MA,floor:()=>rA,forEach:()=>vA,fromValues:()=>Pi,hermite:()=>uA,inverse:()=>lA,len:()=>jf,length:()=>Gf,lerp:()=>fA,max:()=>sA,min:()=>nA,mul:()=>CA,multiply:()=>Vf,negate:()=>cA,normalize:()=>Jf,random:()=>dA,rotateX:()=>AA,rotateY:()=>xA,rotateZ:()=>yA,round:()=>oA,scale:()=>iA,scaleAndAdd:()=>aA,set:()=>$1,sqrDist:()=>wA,sqrLen:()=>LA,squaredDistance:()=>qf,squaredLength:()=>kf,str:()=>_A,sub:()=>BA,subtract:()=>Uf,transformMat3:()=>mA,transformMat4:()=>pA,transformQuat:()=>gA,zero:()=>EA});function zi(){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 Gf(e){var t=e[0],r=e[1],n=e[2];return Math.hypot(t,r,n)}function Pi(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 Uf(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],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}function Hf(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 zf(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 qf(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 kf(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 Jf(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 qi(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&&qi(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=Uf,CA=Vf,SA=Hf,IA=zf,wA=qf,jf=Gf,LA=kf,vA=function(){var e=zi();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 aL=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 Oi(){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 Xf(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=$f(e,t);return Math.acos(2*r*r-1)}function Wf(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 Yf(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 Kf(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 Kf(e,t),Zf(e,e,r),Yf(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 Qf(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=Wf,Zf=GA,$f=zA,ux=qA,tu=UA,hx=tu,eu=VA,dx=eu,ki=HA,px=kA,mx=JA,gx=function(){var e=zi(),t=Pi(1,0,0),r=Pi(0,1,0);return function(n,s,o){var i=qi(s,o);return i<-.999999?(Is(e,t,s),jf(e)<1e-6&&Is(e,r,s),Jf(e,e),Xf(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,ki(n,n))}}(),Ax=function(){var e=Oi(),t=Oi();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],ki(t,Qf(t,e))}}(),P={};fn(P,{add:()=>Mx,angle:()=>qx,ceil:()=>bx,clone:()=>yx,copy:()=>Ex,create:()=>ru,cross:()=>Ox,dist:()=>Zx,distance:()=>iu,div:()=>Qx,divide:()=>ou,dot:()=>Px,equals:()=>Xx,exactEquals:()=>jx,floor:()=>Bx,forEach:()=>ey,fromValues:()=>Tx,inverse:()=>Rx,len:()=>Wx,length:()=>cu,lerp:()=>Nx,max:()=>Sx,min:()=>Cx,mul:()=>Kx,multiply:()=>su,negate:()=>vx,normalize:()=>Fx,random:()=>Dx,rotate:()=>zx,round:()=>Ix,scale:()=>wx,scaleAndAdd:()=>Lx,set:()=>_x,sqrDist:()=>$x,sqrLen:()=>ty,squaredDistance:()=>au,squaredLength:()=>lu,str:()=>Jx,sub:()=>Yx,subtract:()=>nu,transformMat2:()=>Gx,transformMat2d:()=>Ux,transformMat3:()=>Vx,transformMat4:()=>Hx,zero:()=>kx});function ru(){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 nu(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}function su(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e}function ou(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 iu(e,t){var r=t[0]-e[0],n=t[1]-e[1];return Math.hypot(r,n)}function au(e,t){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n}function cu(e){var t=e[0],r=e[1];return Math.hypot(t,r)}function lu(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=cu,Yx=nu,Kx=su,Qx=ou,Zx=iu,$x=au,ty=lu,ey=function(){var e=ru();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,cL=2*Math.PI,Ls=2*Math.PI/5,Zt=Math.PI/5,mf=Math.PI/10,ry=2*Math.atan(Fs),Ni=Math.PI-ry,lL=-.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),fL=Math.sqrt(3)*sy/Fs;Tt.setMatrixArrayType(Float64Array);var Ji=class Di{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 Di(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 Di(r)}};Tt.setMatrixArrayType(Float64Array);var fu=[0,0],uu=[0,1],He=[.7885966681787006,1.6149108024237764],hu=[1.6171013659387945,1.054928690397459],du=[Math.cos(mf),Math.sin(mf)],oy=2*P.length(He)*Math.cos(Zt),iy=Zt-Math.atan2(He[1],He[0]),ay=2*Ps/oy;[fu,uu,He,hu,du].forEach(e=>{P.scale(e,e,ay),P.rotate(e,e,[0,0],iy)});var cy=new Ji([fu,uu,He,hu,du]),pu=Math.atan2(He[1],He[0])-Zt,ly=[0,0],vs=Ps/Math.cos(Zt),gf=pu+Zt,Rs=[vs*Math.cos(gf),vs*Math.sin(gf)],Af=pu-Zt,ln=[vs*Math.cos(Af),vs*Math.sin(Af)],mu=new Ji([ly,Rs,ln]),gu=Ve.fromValues(Rs[0],Rs[1],ln[0],ln[1]),uL=Ve.invert(Ve.create(),gu),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 Au=new hy;function xf(e){return e*(Math.PI/180)}function yf(e){return e*(180/Math.PI)}function Tf(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 Gi(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 xu=93;function gy([e,t]){let r=xf(e+xu),n=xf(t),s=Au.forward(n),o=Math.PI/2-s;return[r,o]}function yu([e,t]){let r=yf(e)-xu,n=Math.PI/2-t,s=Au.inverse(n),o=yf(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]=yu(Gi(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),Tu=Math.sqrt((1-Ns)/2),Eu=Math.sqrt((1+Ns)/2),Ts=.5,Ef=Math.sqrt((2.5-Os)/10),_f=Math.sqrt((2.5+Os)/10),Mf=Math.sqrt((1+Ns)/8),bf=Math.sqrt((1-Ns)/8),Bf=Math.sqrt((3-Os)/8),Cf=Math.sqrt((3+Os)/8),xy=[[0,0],[Tu,0],[Ef,Ts],[-Mf,Bf],[-Mf,-Bf],[Ef,-Ts],[-Eu,0],[-bf,-Cf],[_f,-Ts],[_f,Ts],[-bf,Cf],[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?Eu:Tu]);Tt.setMatrixArrayType(Float64Array);var _u=["vu","uw","vw","vw","vw"],an=["wu","uw","vw","vu","uw"],Li=["wu","uv","wv","wu","uw"],_s=["vu","uv","wv","wu","uw"],Ty=[_u,_s,Li,an,Li,_s,Li,an,an,an,_s,_s],Ey=[4,2,3,2,0,4,3,2,2,0,3,0],Sf=[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,Ni],Zt,Es[e+1]),Ms([r,Math.PI-Ni],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=Fi.create();Fi.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)=>Sf.indexOf(e.id)-Sf.indexOf(t.id));kt.forEach((e,t)=>e.id=t);function My(e,t){let r=t.orientation,n=r===_u||r===an?-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(),cn=w.create(),If=w.create(),wf=w.create();function vi(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(cn,t,r),w.dot(e,cn)}function Cy(e,t,r,n,s){w.cross(cn,n,s);let o=w.dot(t,cn),i=w.dot(r,cn);return w.scale(If,t,i),w.scale(wf,r,o),w.sub(e,wf,If)}function Ui(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 Ui(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=vi(n,e)/vi(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=Ui(w.create(),s,o,b),g=vi(n,T),S=this.safeAcos(u*g)/this.safeAcos(g);return Ui([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),Vi=P.fromValues(1,0),Hi=P.fromValues(0,1),Lf=P.negate(P.create(),Vi),vf=P.negate(P.create(),Hi),Ri=P.fromValues(0,0),Ly=(e,[t,r])=>{let n=Ri,s=Ri;switch(t===yt&&r===yt?(n=Vi,s=Hi):t===It&&r===yt?(n=vf,s=Lf):t===yt&&r===It?(n=Hi,s=Vi):t===It&&r===It&&(n=Lf,s=vf),e){case 0:return Ri;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}`)}},Rf=e=>[[yt,yt],[yt,It],[yt,yt],[It,yt]][e],Ff=P.fromValues(-1,1);function Mu(e){return Array.from({length:e.length},(t,r)=>e.indexOf(r))}var bu=[0,1,3,4,5,6,7,2],Bu=[0,1,2,7,3,4,5,6],hL=Mu(bu),dL=Mu(Bu),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,Ff),u===It&&P.subtract(a.offset,a.offset,Ff)}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?Bu:bu;for(let f=a.length-1;f>=0;f--)vy(a,f,o,r,c),P.multiply(o,o,Rf(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,Rf(a[f]))}let l=a[0]||0;return{flips:o,k:l,offset:wy(s)}};Tt.setMatrixArrayType(Float64Array);var Py=!1,Oy=P.clone(ln),Ny=P.negate(P.create(),ln),ji=[0,1,2,3,4].map(e=>{let t=Ve.create();return Ve.fromRotation(t,Ls*e),t}),Pf=P.create();function Dy(e,t,r){let n=(Py?mu:cy).clone();P.transformMat2(Pf,r.offset,gu),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(Pf),n.scale(1/2**e),n.transform(ji[t]),n}function Cu(e){let t=mu.clone();return t.transform(ji[e]),t}function Gy(){let e=[];for(let t of ji)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=Gi(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=Tf(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 Gi(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]=Cu(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(Ni):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]=Tf(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 pL=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 Cu(s);if(n===Mr-2)return Gy();let i=n-Mr+1,a=Ry(e,i,o);return Dy(i,s,a)}function Su(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=>yu(d)),h=Ay(u);return t&&h.push(h[0]),h.reverse(),h}function Iu(e){return BigInt(`0x${e}`)}var Of=63710072e-1,mL=4*Math.PI*Of*Of;Tt.setMatrixArrayType(Float64Array);var xn=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 Xi(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 Wi(e){return Lu(e)}function Yi(e){return Lt(e)}function Lu(e,t){return Ki(e,r=>r*Ky,t)}function Lt(e,t){return Ki(e,r=>r*Yy,t)}function Gs(e,t,r){return Ki(e,n=>Math.max(t,Math.min(r,n)))}function ye(e,t,r){return wt(e)?e.map((n,s)=>ye(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 Ki(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 Te=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?", ":"")+Xi(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 Ee(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 _e=class extends Te{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,un=Math.random;function br(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var OL=Math.PI/180;function eT(){let e=new tt(2);return tt!=Float32Array&&(e[0]=0,e[1]=0),e}function vu(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s,e[1]=r[1]*n+r[3]*s,e}function Ru(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 NL=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 Fu(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s,e[1]=r[1]*n+r[3]*s,e[2]=t[2],e}function 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[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 _e{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 Ru(this,this,t),this.check()}transformByMatrix2(t){return vu(this,this,t),this.check()}};var Je={};pt(Je,{add:()=>oT,angle:()=>ea,bezier:()=>xT,ceil:()=>iT,clone:()=>rT,copy:()=>nT,create:()=>ks,cross:()=>qe,dist:()=>ST,distance:()=>Uu,div:()=>CT,divide:()=>Gu,dot:()=>hn,equals:()=>MT,exactEquals:()=>_T,floor:()=>aT,forEach:()=>LT,fromValues:()=>Js,hermite:()=>AT,inverse:()=>pT,len:()=>ra,length:()=>Ou,lerp:()=>mT,max:()=>lT,min:()=>cT,mul:()=>BT,multiply:()=>Du,negate:()=>dT,normalize:()=>Qi,random:()=>yT,rotateX:()=>Zi,rotateY:()=>$i,rotateZ:()=>ta,round:()=>fT,scale:()=>uT,scaleAndAdd:()=>hT,set:()=>sT,slerp:()=>gT,sqrDist:()=>IT,sqrLen:()=>wT,squaredDistance:()=>Vu,squaredLength:()=>Hu,str:()=>ET,sub:()=>bT,subtract:()=>Nu,transformMat3:()=>dn,transformMat4:()=>ke,transformQuat:()=>pn,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 Ou(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 Nu(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function Du(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function Gu(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 Uu(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 Vu(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 Hu(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 Qi(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 hn(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(hn(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=un()*2*Math.PI,n=un()*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 dn(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 pn(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 Zi(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 $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[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 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[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 ea(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&&hn(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=Nu,BT=Du,CT=Gu,ST=Uu,IT=Vu,ra=Ou,wT=Hu,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 na=[0,0,0],js,x=class extends _e{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 ea(this,t)}cross(t){return qe(this,this,t),this.check()}rotateX({radians:t,origin:r=na}){return Zi(this,this,r,t),this.check()}rotateY({radians:t,origin:r=na}){return $i(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=na}){return ta(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 dn(this,this,t),this.check()}transformByMatrix2(t){return Fu(this,this,t),this.check()}transformByQuaternion(t){return pn(this,this,t),this.check()}};var Xs,Cr=class extends _e{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 Pu(this,this,t),this.check()}transformByQuaternion(t){return pn(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Sr=class extends Te{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 zu(){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 qu(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 ku(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 Ju(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 sa(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 ju(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=t[4],c=t[5],l=t[6],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 Xu(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 oa(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 Wu(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 ia;(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"})(ia||(ia={}));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 ia}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 Wu(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 Ju(this)}transpose(){return qu(this,this),this.check()}invert(){return ku(this,this),this.check()}multiplyLeft(t){return sa(this,t,this),this.check()}multiplyRight(t){return sa(this,this,t),this.check()}rotate(t){return Xu(this,this,t),this.check()}scale(t){return Array.isArray(t)?oa(this,this,t):oa(this,this,[t,t]),this.check()}translate(t){return ju(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=Us(r||[-0,-0],t,this);break;case 3:n=dn(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 Ee(n,t.length),n}transformVector(t,r){return this.transform(t,r)}transformVector2(t,r){return this.transform(t,r)}transformVector3(t,r){return this.transform(t,r)}},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 gn={};pt(gn,{add:()=>oE,adjoint:()=>VT,clone:()=>NT,copy:()=>DT,create:()=>OT,decompose:()=>KT,determinant:()=>la,equals:()=>lE,exactEquals:()=>cE,frob:()=>sE,fromQuat:()=>ga,fromQuat2:()=>XT,fromRotation:()=>qT,fromRotationTranslation:()=>Ku,fromRotationTranslationScale:()=>QT,fromRotationTranslationScaleOrigin:()=>ZT,fromScaling:()=>zT,fromTranslation:()=>HT,fromValues:()=>GT,fromXRotation:()=>kT,fromYRotation:()=>JT,fromZRotation:()=>jT,frustum:()=>Aa,getRotation:()=>YT,getScaling:()=>Qu,getTranslation:()=>WT,identity:()=>Yu,invert:()=>ca,lookAt:()=>Ta,mul:()=>fE,multiply:()=>mn,multiplyScalar:()=>iE,multiplyScalarAndAdd:()=>aE,ortho:()=>ya,orthoNO:()=>$u,orthoZO:()=>eE,perspective:()=>xa,perspectiveFromFieldOfView:()=>tE,perspectiveNO:()=>Zu,perspectiveZO:()=>$T,rotate:()=>ha,rotateX:()=>da,rotateY:()=>pa,rotateZ:()=>ma,scale:()=>ua,set:()=>UT,str:()=>nE,sub:()=>uE,subtract:()=>th,targetTo:()=>rE,translate:()=>fa,transpose:()=>aa});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 Yu(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function aa(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 ca(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 la(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 mn(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 fa(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 ua(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 ha(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 da(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 pa(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 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[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 Ku(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),Ku(e,t,r),e}function WT(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Qu(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);Qu(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 ga(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 Aa(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 Zu(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 xa=Zu;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 $u(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 ya=$u;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 Ta(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?Yu(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 th(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=mn,uE=th;function hE(){let e=new tt(4);return tt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function eh(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 rh(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 nh(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 sh(e){let t=e[0],r=e[1],n=e[2],s=e[3];return t*t+r*r+n*n+s*s}function oh(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 ih(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function ah(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 ch(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 lh(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 mv=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 Ma;(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"})(Ma||(Ma={}));var pE=45*Math.PI/180,mE=1,Ea=.1,_a=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 Ma}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 ga(this,t),this.check()}frustum(t){let{left:r,right:n,bottom:s,top:o,near:i=Ea,far:a=_a}=t;return a===1/0?yE(this,r,n,s,o,i):Aa(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 Ta(this,r,n,s),this.check()}ortho(t){let{left:r,right:n,bottom:s,top:o,near:i=Ea,far:a=_a}=t;return ya(this,r,n,s,o,i,a),this.check()}orthographic(t){let{fovy:r=pE,aspect:n=mE,focalDistance:s=1,near:o=Ea,far:i=_a}=t;fh(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 fh(r),xa(this,r,n,s,o),this.check()}determinant(){return la(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 aa(this,this),this.check()}invert(){return ca(this,this),this.check()}multiplyLeft(t){return mn(this,t,this),this.check()}multiplyRight(t){return mn(this,this,t),this.check()}rotateX(t){return da(this,this,t),this.check()}rotateY(t){return pa(this,this,t),this.check()}rotateZ(t){return ma(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return ha(this,this,t,r),this.check()}scale(t){return ua(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return fa(this,this,t),this.check()}transform(t,r){return t.length===4?(r=ch(r||[-0,-0,-0,-0],t,this),Ee(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,s;switch(n){case 2:s=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 Ee(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 Ee(n,t.length),n}transformPoint(t,r){return this.transformAsPoint(t,r)}transformVector(t,r){return this.transformAsPoint(t,r)}transformDirection(t,r){return this.transformAsVector(t,r)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,r,n){return this.identity().translate([t,r,n])}},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 fh(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 uh(){let e=new tt(4);return tt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function hh(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 Ba(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 dh(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 ph(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 mh(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 gh(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 An(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 Ah(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 xh(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Ca(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 yh=eh;var Th=rh,Eh=ih,_h=ah,Mh=nh;var bh=sh;var Bh=oh;var Ch=function(){let e=ks(),t=Js(1,0,0),r=Js(0,1,0);return function(n,s,o){let i=hn(s,o);return i<-.999999?(qe(e,t,s),ra(e)<1e-6&&qe(e,r,s),Qi(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,Bh(n,n))}}(),wv=function(){let e=uh(),t=uh();return function(r,n,s,o,i,a){return An(e,n,i,a),An(t,s,o,a),An(r,e,t,2*a*(1-a)),r}}(),Lv=function(){let e=zu();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],Bh(t,Ca(t,e))}}();var TE=[0,0,0,1],$t=class extends Te{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 Ca(this,t),this.check()}fromAxisRotation(t,r){return ba(this,t,r),this.check()}identity(){return hh(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 Mh(this)}lengthSquared(){return bh(this)}dot(t){return Eh(this,t)}rotationTo(t,r){return Ch(this,t,r),this.check()}add(t){return yh(this,this,t),this.check()}calculateW(){return gh(this,this),this.check()}conjugate(){return xh(this,this),this.check()}invert(){return Ah(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(_h(this,t,r,n),this.check())}multiplyRight(t){return Ba(this,this,t),this.check()}multiplyLeft(t){return Ba(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 dh(this,this,t),this.check()}rotateY(t){return ph(this,this,t),this.check()}rotateZ(t){return mh(this,this,t),this.check()}scale(t){return Th(this,this,t),this.check()}slerp(t,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 An(this,s,o,i),this.check()}transformVector4(t,r=new Cr){return lh(r,t,this),Ee(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,r){return this.setAxisAngle(t,r)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var 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,xn.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]=ye(s,t[a][0],r),t[a][1]=ye(n,t[a][1],r)}function Sh(e,t,r){let n=e(t,r),[s,o]=(0,xn.cellToLatLng)(n);return[o,s]}function Sa(e,t=1){let r=(0,xn.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}},yn=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=Su(typeof o=="string"?Iu(o):o,{closedRing:!0,segments:"auto"});return $s(i)}}}};yn.layerName="A5Layer";yn.defaultProps=jE;var Ih=yn;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 ad=D(id(),1);function Na(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 ad.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)=>Na(new TextDecoder().decode(e),{...Jt.options.xml,...t?.xml}),parseTextSync:(e,t)=>Na(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 _n=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var cd=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),lM=cd&&parseFloat(cd[1])||0;var ro=globalThis,fM=globalThis.document||{},no=globalThis.process||{},uM=globalThis.console,IR=globalThis.navigator||{};function ld(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)||ld()}var Da="4.1.0";function dM(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var so=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 fd(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 ud(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var oo;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(oo||(oo={}));var pM=10;function hd(e){return typeof e!="string"?e:(e=e.toUpperCase(),oo[e]||oo.WHITE)}function dd(e,t,r){return!Xe&&typeof e=="string"&&(t&&(e=`\x1B[${hd(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${hd(r)+pM}m${e}\x1B[49m`)),e}function pd(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 Mn(e,t){if(!e)throw new Error(t||"Assertion failed")}function We(){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 Ir={debug:Xe()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},mM={enabled:!0,level:0};function wr(){}var md={},gd={once:!0},be=class{constructor({id:t}={id:""}){this.VERSION=Da,this._startTs=We(),this._deltaTs=We(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new so(`__probe-${this.id}__`,mM),this.timeStamp(`${this.id} started`),pd(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((We()-this._startTs).toPrecision(10))}getDelta(){return Number((We()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t){return this._getLogFunction(0,t,Ir.warn,arguments,gd)}error(t){return this._getLogFunction(0,t,Ir.error,arguments)}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r){return this._getLogFunction(t,r,Ir.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,Ir.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,Ir.debug||Ir.info,arguments,gd)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||wr,n&&[n],{tag:AM(r)}):wr}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||wr)}group(t,r,n={collapsed:!1}){let s=Ad({logLevel:t,message:r,opts:n}),{collapsed:o}=n;return s.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||wr)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=xd(t)}_getLogFunction(t,r,n,s,o){if(this._shouldLog(t)){o=Ad({logLevel:t,message:r,args:s,opts:o}),n=n||o.method,Mn(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=We();let i=o.tag||o.message;if(o.once&&i)if(!md[i])md[i]=We();else return wr;return r=gM(this.id,o.message,o),n.bind(console,r,...o.args)}return wr}};be.VERSION=Da;function xd(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 Mn(Number.isFinite(t)&&t>=0),t}function Ad(e){let{logLevel:t,message:r}=e;e.logLevel=xd(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 Mn(s==="string"||s==="object"),Object.assign(e,{args:n},e.opts)}function gM(e,t,r){if(typeof t=="string"){let n=r.time?ud(fd(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=dd(t,r.color,r.background)}return t}function AM(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}globalThis.probe={};var Ga=new be({id:"@probe.gl/log"});var Ua="4.3.3",xM=Ua[0]>="0"&&Ua[0]<="9"?`v${Ua}`:"";function yM(){let e=new be({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=xM,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var Va=yM();function Ha(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 za(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function qa(e){return globalThis.loaders?.modules?.[e]||null}function TM(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.3"),globalThis._loadersgl_.version}var Td=TM();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},cF=ee.self||ee.window||ee.global||{},lF=ee.window||ee.self||ee.global||{},fF=ee.global||ee.self||ee.window||{},uF=ee.document||{};var Lr=typeof process!="object"||String(process)!=="[object process]"||process.browser,io=typeof importScripts=="function",hF=typeof window<"u"&&typeof window.orientation<"u",_d=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),dF=_d&&parseFloat(_d[1])||0;var ka={};async function re(e,t=null,r={},n=null){return t&&(e=Md(e,t,r,n)),ka[e]=ka[e]||EM(e),await ka[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]:Lr?r.CDN?(Ed(r.CDN.startsWith("http")),`${r.CDN}/${t}@${Td}/dist/libs/${n}`):io?`../src/libs/${n}`:`modules/${t}/src/libs/${n}`:`modules/${t}/dist/libs/${n}`}async function EM(e){if(e.endsWith("wasm"))return await MM(e);if(!Lr)try{let{requireFromFile:r}=globalThis.loaders||{};return await r?.(e)}catch(r){return console.error(r),null}if(io)return importScripts(e);let t=await bM(e);return _M(t,e)}function _M(e,t){if(!Lr){let{requireFromString:n}=globalThis.loaders||{};return n?.(e,t)}if(io)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 MM(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return Lr||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function bM(e){let{readFileAsText:t}=globalThis.loaders||{};return Lr||!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 Ja(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 ja(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",CM="Active Requests",SM="Cancelled Requests",IM="Queued Requests Ever",wM="Active Requests Ever",LM={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={...LM,...t},this.stats=new Ce({id:this.props.id}),this.stats.get(BM),this.stats.get(CM),this.stats.get(SM),this.stats.get(IM),this.stats.get(wM)}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:()=>RM,filename:()=>vM,join:()=>FM,resolve:()=>PM});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 vM(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function RM(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function FM(...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 PM(...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=OM(r,!n),n?`/${r}`:r.length>0?r:"."}var Cn=47,Xa=46;function OM(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)!==Xa||r.charCodeAt(r.length-2)!==Xa){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===Xa&&s!==-1?++s:s=-1}return r}var ao=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=NM(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 NM(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 ao{};sn(Ot,"type","template"),sn(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 DM="4.3.3",Sn={dataType:null,batchType:null,id:"wms-error",name:"WMS Error",module:"wms",version:DM,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:GM,options:{wms:{throwOnError:!1}},parse:async(e,t)=>Wa(new TextDecoder().decode(e),t),parseSync:(e,t)=>Wa(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Wa(e,t)};function GM(e){return e.startsWith("<?xml")}function Wa(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 co(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 Ya(e,t){let r=Jt.parseTextSync?.(e,t),n=r.WMT_MS_Capabilities||r.WMS_Capabilities||r,s=UM(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 UM(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:co(e.Service?.LayerLimit),maxWidth:co(e.Service?.maxWidth),maxHeight:co(e.Service?.maxHeight),layers:[],requests:VM(e.Capability?.Request),exceptions:HM(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 VM(e){let t={};for(let[r,n]of Object.entries(e||{})){let s=In(n?.Format);t[r]={mimeTypes:s}}return t}function HM(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&&zM(e?.EX_GeographicBoundingBox);n&&(t.geographicBoundingBox=n),n=e?.LatLonBoundingBox&&qM(e?.LatLonBoundingBox),n&&(t.geographicBoundingBox=n);let s=e?.BoundingBox&&kM(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 zM(e){let{westBoundLongitude:t,northBoundLatitude:r,eastBoundLongitude:n,southBoundLatitude:s}=e;return[[t,s],[n,r]]}function qM(e){let{minx:t,miny:r,maxx:n,maxy:s}=e;return[[t,r],[n,s]]}function kM(e){return Qe(e).map(r=>JM(r))}function JM(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 XM="4.3.3",vr={dataType:null,batchType:null,id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:XM,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:WM,options:{wms:{}},parse:async(e,t)=>Ya(new TextDecoder().decode(e),t?.wms),parseTextSync:(e,t)=>Ya(e,t?.wms)};function WM(e){return e.startsWith("<?xml")}function Ka(e,t){let n=(Jt.parseTextSync?.(e,t)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(n)?n:[n]).map(o=>YM(o))}}function YM(e){return{attributes:e||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var Ld={...vr,dataType:null,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(e,t)=>Ka(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Ka(e,t)};function Qa(e,t){return Jt.parseTextSync?.(e,t)}var vd={...vr,dataType:null,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(e,t)=>Qa(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Qa(e,t)};var Rd="4.3.3";var KM=globalThis.loaders?.parseImageNode,Za=typeof Image<"u",$a=typeof ImageBitmap<"u",QM=Boolean(KM),tc=_n?!0:QM;function Fd(e){switch(e){case"auto":return $a||Za||tc;case"imagebitmap":return $a;case"image":return Za;case"data":return tc;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Pd(){if($a)return"imagebitmap";if(Za)return"image";if(tc)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Od(e){let t=ZM(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 ZM(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 $M=/^data:image\/svg\+xml/,tb=/\.svg((\?|#).*)?$/;function lo(e){return e&&($M.test(e)||tb.test(e))}function Nd(e,t){if(lo(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 ec(e,t)}function ec(e,t){if(lo(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function fo(e,t,r){let n=Nd(e,r),s=self.URL||self.webkitURL,o=typeof n!="string"&&s.createObjectURL(n);try{return await eb(o||n,t)}finally{o&&s.revokeObjectURL(o)}}async function eb(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 rb={},Dd=!0;async function Gd(e,t,r){let n;lo(r)?n=await fo(e,t,r):n=ec(e,r);let s=t&&t.imagebitmap;return await nb(n,s)}async function nb(e,t=null){if((sb(t)||!Dd)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),Dd=!1}return await createImageBitmap(e)}function sb(e){for(let t in e||rb)return!1;return!0}function Ud(e){return!cb(e,"ftyp",4)||!(e[8]&96)?null:ob(e)}function ob(e){switch(ib(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function ib(e,t,r){return String.fromCharCode(...e.slice(t,r))}function ab(e){return[...e].map(t=>t.charCodeAt(0))}function cb(e,t,r=0){let n=ab(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 fb(t)||db(t)||ub(t)||hb(t)||lb(t)}function lb(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 fb(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 ub(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 hb(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 db(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}=pb(),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 pb(){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=mb(s),a;switch(i){case"imagebitmap":a=await Gd(e,t,o);break;case"image":a=await fo(e,t,o);break;case"data":a=await Vd(e,t);break;default:H(!1)}return s==="data"&&(a=Ln(a)),a}function mb(e){switch(e){case"auto":case"data":return Pd();default:return Fd(e),e}}var gb=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Ab=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],xb={image:{type:"auto",decode:!0}},Rr={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:Rd,mimeTypes:Ab,extensions:gb,parse:Hd,tests:[e=>Boolean($e(new DataView(e)))],options:xb};var rc={};function nc(e){if(rc[e]===void 0){let t=_n?Tb(e):yb(e);rc[e]=t}return rc[e]}function yb(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 Tb(e){switch(e){case"image/avif":case"image/webp":return Eb(e);default:return!0}}function Eb(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 sc(e,t)},sc=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 vr.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 Rr.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 Rr.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=Ha(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 oc(e,t)},oc=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 _b=[zd,qd];function ic(e,t=_b){let{type:r="auto"}=e,n=r==="auto"?bb(e.url,t):Mb(r,t);if(!n)throw new Error("Not a valid image source type");return n.createDataSource(e.url,e)}function Mb(e,t){for(let r of t)if(r.type===e)return r;return null}function bb(e,t){for(let r of t)if(r.testURL&&r.testURL(e))return r;return null}function uo(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,ho=512;function le(e){let[t,r]=e;uo(Number.isFinite(t)),uo(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let n=t*kd,s=r*kd,o=ho*(n+jt)/(2*jt),i=ho*(jt+Math.log(Math.tan(Xd+s*.5)))/(2*jt);return[o,i]}function fe(e){let[t,r]=e,n=t/ho*(2*jt)-jt,s=2*(Math.atan(Math.exp(r/ho*(2*jt)-jt))-Xd);return[n*Jd,s*Jd]}var zO=Math.PI/180;var Yd=6378137*Math.PI;function ac(e){let t=le(e);return t[0]=(t[0]/256-1)*Yd,t[1]=(t[1]/256-1)*Yd,t}var Vb={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)}},Fr=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 ic({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=ac([o[0],o[1]]),h=ac([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)}};Fr.layerName="WMSLayer";Fr.defaultProps=Vb;var Qd=D(zt(),1),Hb={getHeight:{type:"accessor",value:0},greatCircle:!0},Fn=class extends Qd.ArcLayer{};Fn.layerName="GreatCircleLayer";Fn.defaultProps=Hb;var Zd=Fn;var po=D(cc(),1),zb=3,qb=30,kb=2*qb+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=po.default.fromString(e,!0,10).toString(2);for(;t.length<zb+kb;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),s=t.substring(3,r),o=s.length/2,i=po.default.fromString(n,!0,2).toString(10),a=po.default.fromString(s,!0,2).toString(4);for(;a.length<o;)a="0"+a;return`${i}/${a}`}function Jb(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);Jb(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(cc(),1);function jb(e){let t=e.padEnd(16,"0");return cp.default.fromString(t,16)}var Xb=100;function Wb({face:e,ij:t,level:r}){let n=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(Xb*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 Yb(e){if(typeof e=="string"){if(e.indexOf("/")>0)return e;e=jb(e)}return ip(e.toString())}function lp(e){let t=Yb(e),r=ap(t);return Wb(r)}var Kb={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=Kb;var fp=On;var lc=512;function Qb(e,t){let r=0,n=0,s=1<<e.length,o=s/lc;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,lc-n/o],[(r+t)/o,lc-(n+t)/o]]}function up(e,t=1){let[r,n]=Qb(e,t),[s,o]=fe(r),[i,a]=fe(n);return[i,o,i,a,s,a,s,o,i,o]}var Zb={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=Zb;var hp=Nn;var _o=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,$b=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=$b.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=gn.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 tB=new x,eB=new x,mo=new x,go=new x,Ao=new x,rB=new x,nB=new x,ue={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,mo),s=r.getColumn(1,go),o=r.getColumn(2,Ao),i=tB.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[ue.COLUMN0ROW0]+i*s[ue.COLUMN0ROW1]+a*s[ue.COLUMN0ROW2])+Math.abs(o*s[ue.COLUMN1ROW0]+i*s[ue.COLUMN1ROW1]+a*s[ue.COLUMN1ROW2])+Math.abs(o*s[ue.COLUMN2ROW0]+i*s[ue.COLUMN2ROW1]+a*s[ue.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=eB.from(t).subtract(this.center),n=this.halfAxes,s=n.getColumn(0,mo),o=n.getColumn(1,go),i=n.getColumn(2,Ao),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,mo),l=a.getColumn(1,go),f=a.getColumn(2,Ao),u=rB.copy(c).add(l).add(f).add(i),h=nB.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,mo);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,go);n.transformAsPoint(t);let s=this.halfAxes.getColumn(2,Ao);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,sB=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=sB.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 sD=new x,oD=new x,iD=new x,aD=new x,cD=new x;var pD=new x,mD=new x,gD=new x,AD=new x,xD=new x,yD=new x,TD=new x,ED=new x,_D=new x,MD=new x,bD=new x,BD=new x;var se=new J,iB=new J,aB=new J,xo=new J,yp=new J;function hc(e,t={}){let r=Pt.EPSILON20,n=10,s=0,o=0,i=iB,a=aB;i.identity(),a.copy(e);let c=r*cB(a);for(;o<n&&lB(a)>c;)fB(a,xo),yp.copy(xo).transpose(),a.multiplyRight(xo),a.multiplyLeft(yp),i.multiplyRight(xo),++s>2&&(++o,s=0);return t.unitary=i.toTarget(t.unitary),t.diagonal=a.toTarget(t.diagonal),t}function cB(e){let t=0;for(let r=0;r<9;++r){let n=e[r];t+=n*n}return Math.sqrt(t)}var fc=[1,0,0],uc=[2,2,1];function lB(e){let t=0;for(let r=0;r<3;++r){let n=e[se.getElementIndex(uc[r],fc[r])];t+=2*n*n}return Math.sqrt(t)}function fB(e,t){let r=Pt.EPSILON15,n=0,s=1;for(let l=0;l<3;++l){let f=Math.abs(e[se.getElementIndex(uc[l],fc[l])]);f>n&&(s=l,n=f)}let o=fc[s],i=uc[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,uB=new x,hB=new x,dB=new x,pB=new x,mB=new J,gB={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=mB;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}=hc(u,gB),d=t.halfAxes.copy(h),p=d.getColumn(0,hB),A=d.getColumn(1,dB),m=d.getColumn(2,pB),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=uB.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 Pr=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]]),AB=_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=Pr/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?AB:this.z<2?_p:Ep,l=[];for(let f of c){let u=yo(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=Pr/s,i=this.x*o+r*Pr,a=Pr-(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=le([d,m]),_=le([A,p]);n=[y[0],Pr-y[1],_[0],Pr-_[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 he=512,xB=[-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 To(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 yB(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=yB(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 TB(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=>dc(s,t||0,r))}function dc(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=dc(e,t[0],r),s=dc(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 EB(e,t,r){return r?To(e,r).map(s=>s*t/he):e.map(n=>n*t/he)}function pc(e,t){return Math.pow(2,e)*he/t}function yo(e,t,r){let n=pc(r,he),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=pc(r,n);return[e/s*he,t/s*he]}function mc(e,t,r,n,s=he){if(e.isGeospatial){let[l,f]=yo(t,r,n),[u,h]=yo(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 _B(e,t,r,n,s){let o=TB(e,null,n),i=pc(t,r),[a,c,l,f]=EB(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 gc({viewport:e,maxZoom:t,minZoom:r,zRange:n,extent:s,tileSize:o=he,modelMatrix:i,modelMatrixInverse:a,zoomOffset:c=0}){let l=e.isGeospatial?Math.round(e.zoom+Math.log2(he/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=To(s,i)),e.isGeospatial?Mp(e,l,n,s):_B(e,l,o,f||xB,a)}function Ac(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(e)}function xc(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(!MB(n[s],t[s])){r=e(n),t=n;break}return r}}function MB(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,Eo=2,bB="never",BB="no-overlap",Vn="best-available",CB=5,SB={[Vn]:wB,[BB]:LB,[bB]:()=>{}},IB={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={...IB,...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]=To([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 gc({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:mc(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:SB[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:CB*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 wB(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!Ip(t)&&yc(t);for(let t of e)t.isVisible=Boolean(t.state&Eo)}function LB(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&Eo),r.children&&(r.isVisible||r.state&Sp))for(let n of r.children)n.state=Sp;else r.isSelected&&yc(r)}function Ip(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=Eo,!0;t=t.parent}return!1}function yc(e){for(let t of e.children)t.isLoaded||t.content?t.state|=Eo:yc(t)}var vB={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 _o.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,_o._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=vB;Hn.layerName="TileLayer";var nr=Hn;var Rp=D(zt(),1);var Lp=`uniform tripsUniforms {
14
14
  bool fadeTrail;
15
15
  float trailLength;
16
16
  float currentTime;
17
17
  } trips;
18
- `,Tg={name:"trips",vs:Eg,fs:Eg,uniformTypes:{fadeTrail:"f32",trailLength:"f32",currentTime:"f32"}};var wI={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:e=>e.timestamps}},ci=class extends _g.PathLayer{getShaders(){let t=super.getShaders();return t.inject={"vs:#decl":`in float instanceTimestamps;
18
+ `,vp={name:"trips",vs:Lp,fs:Lp,uniformTypes:{fadeTrail:"f32",trailLength:"f32",currentTime:"f32"}};var RB={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:e=>e.timestamps}},zn=class extends Rp.PathLayer{getShaders(){let t=super.getShaders();return t.inject={"vs:#decl":`in float instanceTimestamps;
19
19
  in float instanceNextTimestamps;
20
20
  out float vTime;
21
21
  `,"vs:#main-end":`vTime = instanceTimestamps + (instanceNextTimestamps - instanceTimestamps) * vPathPosition.y / vPathLength;
@@ -26,7 +26,7 @@ out float vTime;
26
26
  `,"fs:DECKGL_FILTER_COLOR":`if(trips.fadeTrail) {
27
27
  color.a *= 1.0 - (trips.currentTime - vTime) / trips.trailLength;
28
28
  }
29
- `},t.modules=[...t.modules,Tg],t}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})}draw(t){let{fadeTrail:n,trailLength:r,currentTime:s}=this.props,i={fadeTrail:n,trailLength:r,currentTime:s};this.state.model.shaderInputs.setProps({trips:i}),super.draw(t)}};ci.layerName="TripsLayer";ci.defaultProps=wI;var Sg=ci;var Cg=G(uo(),1),Bg=G(le(),1);var ee=G(uo(),1),Xo=G(le(),1),ai=G(he(),1);var II=10;function PI(e,t){let n;return e==null?n=t:typeof e=="object"?n={...e,coverage:t}:n={getHexagon:e,coverage:t},n}var OI={...ai.PolygonLayer.defaultProps,highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:e=>e.hexagon},extruded:!0},gn=class extends Xo.CompositeLayer{initializeState(){gn._checkH3Lib(),this.state={edgeLengthKM:0,resolution:-1}}shouldUpdateState({changeFlags:t}){return this._shouldUseHighPrecision()?t.propsOrDataChanged:t.somethingChanged}updateState({props:t,changeFlags:n}){if(t.highPrecision!==!0&&(n.dataChanged||n.updateTriggersChanged&&n.updateTriggersChanged.getHexagon)){let r=this._calculateH3DataProps();this.setState(r)}this._updateVertices(this.context.viewport)}_calculateH3DataProps(){let t=-1,n=!1,r=!1,{iterable:s,objectInfo:i}=(0,Xo.createIterable)(this.props.data);for(let o of s){i.index++;let c=this.props.getHexagon(o,i),a=(0,ee.getResolution)(c);if(t<0){if(t=a,!this.props.highPrecision)break}else if(t!==a){r=!0;break}if((0,ee.isPentagon)(c)){n=!0;break}}return{resolution:t,edgeLengthKM:t>=0?(0,ee.getHexagonEdgeLengthAvg)(t,"km"):0,hasMultipleRes:r,hasPentagon:n}}_shouldUseHighPrecision(){if(this.props.highPrecision==="auto"){let{resolution:t,hasPentagon:n,hasMultipleRes:r}=this.state,{viewport:s}=this.context;return Boolean(s?.resolution)||r||n||t>=0&&t<=5}return this.props.highPrecision}_updateVertices(t){if(this._shouldUseHighPrecision())return;let{resolution:n,edgeLengthKM:r,centerHex:s}=this.state;if(n<0)return;let i=this.props.centerHexagon||(0,ee.latLngToCell)(t.latitude,t.longitude,n);if(s===i)return;if(s)try{if((0,ee.gridDistance)(s,i)*r<II)return}catch{}let{unitsPerMeter:o}=t.distanceScales,c=Xh(i),[a,h]=(0,ee.cellToLatLng)(i),[l,f]=t.projectFlat([h,a]);c=c.map(p=>{let u=t.projectFlat(p);return[(u[0]-l)/o[0],(u[1]-f)/o[1]]}),this.setState({centerHex:i,vertices:c})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){let{elevationScale:t,material:n,coverage:r,extruded:s,wireframe:i,stroked:o,filled:c,lineWidthUnits:a,lineWidthScale:h,lineWidthMinPixels:l,lineWidthMaxPixels:f,getFillColor:p,getElevation:u,getLineColor:d,getLineWidth:g,transitions:m,updateTriggers:M}=this.props;return{elevationScale:t,extruded:s,coverage:r,wireframe:i,stroked:o,filled:c,lineWidthUnits:a,lineWidthScale:h,lineWidthMinPixels:l,lineWidthMaxPixels:f,material:n,getElevation:u,getFillColor:p,getLineColor:d,getLineWidth:g,transitions:m,updateTriggers:{getFillColor:M.getFillColor,getElevation:M.getElevation,getLineColor:M.getLineColor,getLineWidth:M.getLineWidth}}}_renderPolygonLayer(){let{data:t,getHexagon:n,updateTriggers:r,coverage:s}=this.props,i=this.getSubLayerClass("hexagon-cell-hifi",ai.PolygonLayer),o=this._getForwardProps();return o.updateTriggers.getPolygon=PI(r.getHexagon,s),new i(o,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:o.updateTriggers}),{data:t,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(c,a)=>{let h=n(c,a);return Bo(Xh(h,s))}})}_renderColumnLayer(){let{data:t,getHexagon:n,updateTriggers:r}=this.props,s=this.getSubLayerClass("hexagon-cell",ai.ColumnLayer),i=this._getForwardProps();return i.updateTriggers.getPosition=r.getHexagon,new s(i,this.getSubLayerProps({id:"hexagon-cell",flatShading:!0,updateTriggers:i.updateTriggers}),{data:t,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:xd.bind(null,n)})}};gn.defaultProps=OI;gn.layerName="H3HexagonLayer";gn._checkH3Lib=()=>{};var Ko=gn;var vI={getHexagons:{type:"accessor",value:e=>e.hexagons}},hi=class extends $t{initializeState(){Ko._checkH3Lib()}updateState({props:t,changeFlags:n}){if(n.dataChanged||n.updateTriggersChanged&&n.updateTriggersChanged.getHexagons){let{data:r,getHexagons:s}=t,i=[],{iterable:o,objectInfo:c}=(0,Bg.createIterable)(r);for(let a of o){c.index++;let h=s(a,c),l=(0,Cg.cellsToMultiPolygon)(h,!0);for(let f of l){for(let p of f)Co(p);i.push(this.getSubLayerRow({polygon:f},a,c.index))}}this.setState({polygons:i})}}indexToBounds(){let{getElevation:t,getFillColor:n,getLineColor:r,getLineWidth:s}=this.props;return{data:this.state.polygons,getPolygon:i=>i.polygon,getElevation:this.getSubLayerAccessor(t),getFillColor:this.getSubLayerAccessor(n),getLineColor:this.getSubLayerAccessor(r),getLineWidth:this.getSubLayerAccessor(s)}}};hi.layerName="H3ClusterLayer";hi.defaultProps=vI;var Lg=hi;var qE=G(Vl(),1),Pn=G(le(),1),kE=G(he(),1),HE=G(Qo(),1);var wg="4.2.1";var Zo={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},Ig;async function kl(e){al(e.modules);let t=hl("basis");return t||(Ig||=NI(e),await Ig)}async function NI(e){let t=null,n=null;return[t,n]=await Promise.all([await Le(Zo.TRANSCODER,"textures",e),await Le(Zo.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await FI(t,n)}function FI(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e(n).then(s=>{let{BasisFile:i,initializeBasis:o}=s;o(),r({BasisFile:i})})})}var ql;async function Hl(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(ql=ql||DI(e),await ql)}async function DI(e){let t=null,n=null;return[t,n]=await Promise.all([await Le(Zo.ENCODER,"textures",e),await Le(Zo.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await UI(t,n)}function UI(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e(n).then(s=>{let{BasisFile:i,KTX2File:o,initializeBasis:c,BasisEncoder:a}=s;c(),r({BasisFile:i,KTX2File:o,BasisEncoder:a})})})}var Xn={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 GI=["","WEBKIT_","MOZ_"],Pg={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"},$o=null;function Og(e){if(!$o){e=e||zI()||void 0,$o=new Set;for(let t of GI)for(let n in Pg)if(e&&e.getExtension(`${t}${n}`)){let r=Pg[n];$o.add(r)}}return $o}function zI(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var QH=new Uint8Array([0]);var vg,Ng,Fg,Dg,Ug,Gg,zg,Vg;(function(e){e[e.NONE=0]="NONE",e[e.BASISLZ=1]="BASISLZ",e[e.ZSTD=2]="ZSTD",e[e.ZLIB=3]="ZLIB"})(vg||(vg={})),function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(Ng||(Ng={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(Fg||(Fg={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(Dg||(Dg={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(Ug||(Ug={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(Gg||(Gg={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(zg||(zg={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(Vg||(Vg={}));var Zt=[171,75,84,88,32,50,48,187,13,10,26,10];function qg(e){let t=new Uint8Array(e);return!(t.byteLength<Zt.length||t[0]!==Zt[0]||t[1]!==Zt[1]||t[2]!==Zt[2]||t[3]!==Zt[3]||t[4]!==Zt[4]||t[5]!==Zt[5]||t[6]!==Zt[6]||t[7]!==Zt[7]||t[8]!==Zt[8]||t[9]!==Zt[9]||t[10]!==Zt[10]||t[11]!==Zt[11])}var VI={etc1:{basisFormat:0,compressed:!0,format:Xn.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Xn.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:Xn.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:Xn.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Xn.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:Xn.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 Wl(e,t){if(t.basis.containerFormat==="auto"){if(qg(e)){let r=await Hl(t);return kg(r.KTX2File,e,t)}let{BasisFile:n}=await kl(t);return Yl(n,e,t)}switch(t.basis.module){case"encoder":let n=await Hl(t);switch(t.basis.containerFormat){case"ktx2":return kg(n.KTX2File,e,t);case"basis":default:return Yl(n.BasisFile,e,t)}case"transcoder":default:let{BasisFile:r}=await kl(t);return Yl(r,e,t)}}function Yl(e,t,n){let r=new e(new Uint8Array(t));try{if(!r.startTranscoding())throw new Error("Failed to start basis transcoding");let s=r.getNumImages(),i=[];for(let o=0;o<s;o++){let c=r.getNumLevels(o),a=[];for(let h=0;h<c;h++)a.push(qI(r,o,h,n));i.push(a)}return i}finally{r.close(),r.delete()}}function qI(e,t,n,r){let s=e.getImageWidth(t,n),i=e.getImageHeight(t,n),o=e.getHasAlpha(),{compressed:c,format:a,basisFormat:h}=Hg(r,o),l=e.getImageTranscodedSizeInBytes(t,n,h),f=new Uint8Array(l);if(!e.transcodeImage(f,t,n,h,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:i,data:f,compressed:c,format:a,hasAlpha:o}}function kg(e,t,n){let r=new e(new Uint8Array(t));try{if(!r.startTranscoding())throw new Error("failed to start KTX2 transcoding");let s=r.getLevels(),i=[];for(let o=0;o<s;o++){i.push(kI(r,o,n));break}return[i]}finally{r.close(),r.delete()}}function kI(e,t,n){let{alphaFlag:r,height:s,width:i}=e.getImageLevelInfo(t,0,0),{compressed:o,format:c,basisFormat:a}=Hg(n,r),h=e.getImageTranscodedSizeInBytes(t,0,0,a),l=new Uint8Array(h);if(!e.transcodeImage(l,t,0,0,a,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:i,height:s,data:l,compressed:o,levelSize:h,hasAlpha:r,format:c}}function Hg(e,t){let n=e&&e.basis&&e.basis.format;return n==="auto"&&(n=tc()),typeof n=="object"&&(n=t?n.alpha:n.noAlpha),n=n.toLowerCase(),VI[n]}function tc(){let e=Og();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 Yg={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:wg,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"}}},Jl={...Yg,parse:Wl};var Xg=G(jl(),1);function jg(e){return{addressModeU:Jg(e.wrapS),addressModeV:Jg(e.wrapT),magFilter:HI(e.magFilter),...YI(e.minFilter)}}function Jg(e){switch(e){case 33071:return"clamp-to-edge";case 10497:return"repeat";case 33648:return"mirror-repeat";default:return}}function HI(e){switch(e){case 9728:return"nearest";case 9729:return"linear";default:return}}function YI(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 Xl(e,t,n,r){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:i}=r;return i&&(s.bindings.pbr_diffuseEnvSampler=i.diffuseEnvSampler.texture,s.bindings.pbr_specularEnvSampler=i.specularEnvSampler.texture,s.bindings.pbr_BrdfLUT=i.brdfLutTexture.texture,s.uniforms.scaleIBLAmbient=[1,1]),r?.pbrDebug&&(s.defines.PBR_DEBUG=!0,s.uniforms.scaleDiffBaseMR=[0,0,0,0],s.uniforms.scaleFGDSpec=[0,0,0,0]),n.NORMAL&&(s.defines.HAS_NORMALS=!0),n.TANGENT&&r?.useTangents&&(s.defines.HAS_TANGENTS=!0),n.TEXCOORD_0&&(s.defines.HAS_UV=!0),r?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=!0),r?.lights&&(s.defines.USE_LIGHTS=!0),t&&WI(e,t,s),s}function WI(e,t,n){if(n.uniforms.unlit=Boolean(t.unlit),t.pbrMetallicRoughness&&JI(e,t.pbrMetallicRoughness,n),t.normalTexture){li(e,t.normalTexture,"pbr_normalSampler","HAS_NORMALMAP",n);let{scale:r=1}=t.normalTexture;n.uniforms.normalScale=r}if(t.occlusionTexture){li(e,t.occlusionTexture,"pbr_occlusionSampler","HAS_OCCLUSIONMAP",n);let{strength:r=1}=t.occlusionTexture;n.uniforms.occlusionStrength=r}switch(t.emissiveTexture&&(li(e,t.emissiveTexture,"pbr_emissiveSampler","HAS_EMISSIVEMAP",n),n.uniforms.emissiveFactor=t.emissiveFactor||[0,0,0]),t.alphaMode||"MASK"){case"MASK":let{alphaCutoff:r=.5}=t;n.defines.ALPHA_CUTOFF=!0,n.uniforms.alphaCutoff=r;break;case"BLEND":Xg.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),n.parameters.blend=!0,n.parameters.blendColorOperation="add",n.parameters.blendColorSrcFactor="src-alpha",n.parameters.blendColorDstFactor="one-minus-src-alpha",n.parameters.blendAlphaOperation="add",n.parameters.blendAlphaSrcFactor="one",n.parameters.blendAlphaDstFactor="one-minus-src-alpha",n.glParameters.blend=!0,n.glParameters.blendEquation=32774,n.glParameters.blendFunc=[770,771,1,771];break}}function JI(e,t,n){t.baseColorTexture&&li(e,t.baseColorTexture,"pbr_baseColorSampler","HAS_BASECOLORMAP",n),n.uniforms.baseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&li(e,t.metallicRoughnessTexture,"pbr_metallicRoughnessSampler","HAS_METALROUGHNESSMAP",n);let{metallicFactor:r=1,roughnessFactor:s=1}=t;n.uniforms.metallicRoughnessValues=[r,s]}function li(e,t,n,r,s){let i=t.texture.source.image,o;i.compressed?o=i:o={data:i};let c={wrapS:10497,wrapT:10497,...t?.texture?.sampler},a=e.createTexture({id:t.uniformName||t.id,sampler:jg(c),...o});s.bindings[n]=a,r&&(s.defines[r]=!0),s.generatedTextures.push(a)}var Qg=G(jl(),1);var Kl=`precision highp int;
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=RB;var Fp=zn;var Pp=D(Ds(),1),Op=D(qt(),1);var Dt=D(Ds(),1),Mo=D(qt(),1),qn=D(zt(),1);var FB=10;function PB(e,t){let r;return e==null?r=t:typeof e=="object"?r={...e,coverage:t}:r={getHexagon:e,coverage:t},r}var OB={...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 Mo.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,Mo.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<FB)return}catch{}let{unitsPerMeter:i}=t.distanceScales,a=Sa(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=PB(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(Sa(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:Sh.bind(null,r)})}};Fe.defaultProps=OB;Fe.layerName="H3HexagonLayer";Fe._checkH3Lib=()=>{};var bo=Fe;var NB={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=NB;var Np=kn;var g0=D(Tc(),1),Ge=D(qt(),1),A0=D(zt(),1),x0=D(Bo(),1);var zp=D(Ec(),1);function Hp(e){return{addressModeU:Vp(e.wrapS),addressModeV:Vp(e.wrapT),magFilter:DB(e.magFilter),...GB(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 DB(e){switch(e){case 9728:return"nearest";case 9729:return"linear";default:return}}function GB(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 _c(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&&UB(e,t,s),s}function UB(e,t,r){if(r.uniforms.unlit=Boolean(t.unlit),t.pbrMetallicRoughness&&VB(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 VB(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(Ec(),1);var Mc=`precision highp int;
30
30
 
31
31
  // #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
32
32
  struct AmbientLight {
@@ -100,7 +100,7 @@ float getPointLightAttenuation(PointLight pointLight, float distance) {
100
100
  }
101
101
 
102
102
  // #endif
103
- `;var Kg=`// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
103
+ `;var qp=`// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
104
104
  struct AmbientLight {
105
105
  color: vec3<f32>,
106
106
  };
@@ -151,7 +151,7 @@ fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 {
151
151
  + pointLight.attenuation.y * distance
152
152
  + pointLight.attenuation.z * distance * distance;
153
153
  }
154
- `;var jI=5,XI=255,pi;(function(e){e[e.POINT=0]="POINT",e[e.DIRECTIONAL=1]="DIRECTIONAL"})(pi||(pi={}));var fi={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>"},defaultUniforms:{enabled:1,lightType:pi.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]},source:Kg,vs:Kl,fs:Kl,getUniforms:KI};function KI(e,t={}){if(e=e&&{...e},!e)return{...fi.defaultUniforms};e.lights&&(e={...e,...ZI(e.lights),lights:void 0});let{ambientLight:n,pointLights:r,directionalLights:s}=e||{};if(!(n||r&&r.length>0||s&&s.length>0))return{...fi.defaultUniforms,enabled:0};let o={...fi.defaultUniforms,...t,...QI({ambientLight:n,pointLights:r,directionalLights:s})};return e.enabled!==void 0&&(o.enabled=e.enabled?1:0),o}function QI({ambientLight:e,pointLights:t=[],directionalLights:n=[]}){let r={};r.ambientColor=Ql(e);let s=0;for(let i of t){r.lightType=pi.POINT;let o=s;r[`lightColor${o}`]=Ql(i),r[`lightPosition${o}`]=i.position,r[`lightAttenuation${o}`]=i.attenuation||[1,0,0],s++}for(let i of n){r.lightType=pi.DIRECTIONAL;let o=s;r[`lightColor${o}`]=Ql(i),r[`lightDirection${o}`]=i.direction,s++}return s>jI&&Qg.log.warn("MAX_LIGHTS exceeded")(),r.directionalLightCount=n.length,r.pointLightCount=t.length,r}function ZI(e){let t={pointLights:[],directionalLights:[]};for(let n of e||[])switch(n.type){case"ambient":t.ambientLight=n;break;case"directional":t.directionalLights?.push(n);break;case"point":t.pointLights?.push(n);break;default:}return t}function Ql(e={}){let{color:t=[0,0,0],intensity:n=1}=e;return t.map(r=>r*n/XI)}var Zg=`out vec3 pbr_vPosition;
154
+ `;var HB=5,zB=255,Xn;(function(e){e[e.POINT=0]="POINT",e[e.DIRECTIONAL=1]="DIRECTIONAL"})(Xn||(Xn={}));var jn={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>"},defaultUniforms:{enabled:1,lightType:Xn.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]},source:qp,vs:Mc,fs:Mc,getUniforms:qB};function qB(e,t={}){if(e=e&&{...e},!e)return{...jn.defaultUniforms};e.lights&&(e={...e,...JB(e.lights),lights:void 0});let{ambientLight:r,pointLights:n,directionalLights:s}=e||{};if(!(r||n&&n.length>0||s&&s.length>0))return{...jn.defaultUniforms,enabled:0};let i={...jn.defaultUniforms,...t,...kB({ambientLight:r,pointLights:n,directionalLights:s})};return e.enabled!==void 0&&(i.enabled=e.enabled?1:0),i}function kB({ambientLight:e,pointLights:t=[],directionalLights:r=[]}){let n={};n.ambientColor=bc(e);let s=0;for(let o of t){n.lightType=Xn.POINT;let i=s;n[`lightColor${i}`]=bc(o),n[`lightPosition${i}`]=o.position,n[`lightAttenuation${i}`]=o.attenuation||[1,0,0],s++}for(let o of r){n.lightType=Xn.DIRECTIONAL;let i=s;n[`lightColor${i}`]=bc(o),n[`lightDirection${i}`]=o.direction,s++}return s>HB&&kp.log.warn("MAX_LIGHTS exceeded")(),n.directionalLightCount=r.length,n.pointLightCount=t.length,n}function JB(e){let t={pointLights:[],directionalLights:[]};for(let r of e||[])switch(r.type){case"ambient":t.ambientLight=r;break;case"directional":t.directionalLights?.push(r);break;case"point":t.pointLights?.push(r);break;default:}return t}function bc(e={}){let{color:t=[0,0,0],intensity:r=1}=e;return t.map(n=>n*r/zB)}var Jp=`out vec3 pbr_vPosition;
155
155
  out vec2 pbr_vUV;
156
156
 
157
157
  #ifdef HAS_NORMALS
@@ -184,7 +184,7 @@ void pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, ve
184
184
  pbr_vUV = vec2(0.,0.);
185
185
  #endif
186
186
  }
187
- `,$g=`precision highp float;
187
+ `,jp=`precision highp float;
188
188
 
189
189
  uniform pbrMaterialUniforms {
190
190
  // Material is unlit
@@ -585,7 +585,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
585
585
 
586
586
  return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
587
587
  }
588
- `;var tx=`struct PBRFragmentInputs {
588
+ `;var Xp=`struct PBRFragmentInputs {
589
589
  pbr_vPosition: vec3f,
590
590
  pbr_vUV: vec2f,
591
591
  pbr_vTBN: mat3f,
@@ -998,16 +998,16 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
998
998
 
999
999
  return vec4<f32>(pow(color, vec3<f32>(1.0 / 2.2)), baseColor.a);
1000
1000
  }
1001
- `;var ex=`uniform pbrProjectionUniforms {
1001
+ `;var Wp=`uniform pbrProjectionUniforms {
1002
1002
  mat4 modelViewProjectionMatrix;
1003
1003
  mat4 modelMatrix;
1004
1004
  mat4 normalMatrix;
1005
1005
  vec3 camera;
1006
1006
  } pbrProjection;
1007
- `,nx={name:"pbrProjection",vs:ex,fs:ex,getUniforms:e=>e,uniformTypes:{modelViewProjectionMatrix:"mat4x4<f32>",modelMatrix:"mat4x4<f32>",normalMatrix:"mat4x4<f32>",camera:"vec3<i32>"}};var Zl={props:{},uniforms:{},name:"pbrMaterial",dependencies:[fi,nx],source:tx,vs:Zg,fs:$g,defines:{LIGHTING_FRAGMENT:!0,HAS_NORMALMAP:!1,HAS_EMISSIVEMAP:!1,HAS_OCCLUSIONMAP:!1,HAS_BASECOLORMAP:!1,HAS_METALROUGHNESSMAP:!1,ALPHA_CUTOFF:!1,USE_IBL:!1,PBR_DEBUG:!1},getUniforms:e=>e,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>"}};var cx=G(Vl(),1),ax=G(Qo(),1);var rx=`uniform meshUniforms {
1007
+ `,Yp={name:"pbrProjection",vs:Wp,fs:Wp,getUniforms:e=>e,uniformTypes:{modelViewProjectionMatrix:"mat4x4<f32>",modelMatrix:"mat4x4<f32>",normalMatrix:"mat4x4<f32>",camera:"vec3<i32>"}};var Bc={props:{},uniforms:{},name:"pbrMaterial",dependencies:[jn,Yp],source:Xp,vs:Jp,fs:jp,defines:{LIGHTING_FRAGMENT:!0,HAS_NORMALMAP:!1,HAS_EMISSIVEMAP:!1,HAS_OCCLUSIONMAP:!1,HAS_BASECOLORMAP:!1,HAS_METALROUGHNESSMAP:!1,ALPHA_CUTOFF:!1,USE_IBL:!1,PBR_DEBUG:!1},getUniforms:e=>e,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>"}};var tm=D(Tc(),1),em=D(Bo(),1);var Kp=`uniform meshUniforms {
1008
1008
  bool pickFeatureIds;
1009
1009
  } mesh;
1010
- `,sx={name:"mesh",vs:rx,fs:rx,uniformTypes:{pickFeatureIds:"f32"}};var ix=`#version 300 es
1010
+ `,Qp={name:"mesh",vs:Kp,fs:Kp,uniformTypes:{pickFeatureIds:"f32"}};var Zp=`#version 300 es
1011
1011
  #define SHADER_NAME simple-mesh-layer-vs
1012
1012
  in vec3 positions;
1013
1013
  in vec3 normals;
@@ -1066,7 +1066,7 @@ geometry.uv = pbr_vUV;
1066
1066
  #endif
1067
1067
  DECKGL_FILTER_COLOR(vColor, geometry);
1068
1068
  }
1069
- `;var ox=`#version 300 es
1069
+ `;var $p=`#version 300 es
1070
1070
  #define SHADER_NAME simple-mesh-layer-fs
1071
1071
  precision highp float;
1072
1072
  uniform sampler2D sampler;
@@ -1095,7 +1095,7 @@ fragColor = vec4(lightColor, color.a * layer.opacity);
1095
1095
  #endif
1096
1096
  DECKGL_FILTER_COLOR(fragColor, geometry);
1097
1097
  }
1098
- `;function $I(e){let t=e.positions||e.POSITION,n=t.value.length/t.size;e.COLOR_0||e.colors||(e.colors={size:4,value:new Uint8Array(n*4).fill(255),normalized:!0})}var tP={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},ui=class extends ax.SimpleMeshLayer{getShaders(){let t=super.getShaders();return t.modules.push(Zl,sx),{...t,vs:ix,fs:ox}}initializeState(){let{featureIds:t}=this.props;super.initializeState();let n=this.getAttributeManager();t&&n.add({featureIdsPickingColors:{type:"uint8",size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})}updateState(t){super.updateState(t);let{props:n,oldProps:r}=t;n.pbrMaterial!==r.pbrMaterial&&this.updatePbrMaterialUniforms(n.pbrMaterial)}draw(t){let{featureIds:n}=this.props,{model:r}=this.state;if(!r)return;let s={pickFeatureIds:Boolean(n)},i={camera:this.context.viewport.cameraPosition};r.shaderInputs.setProps({pbrProjection:i,mesh:s}),super.draw(t)}getModel(t){let{id:n}=this.props,r=this.parseMaterial(this.props.pbrMaterial,t);this.setState({parsedPBRMaterial:r});let s=this.getShaders();return $I(t.attributes),new cx.Model(this.context.device,{...this.getShaders(),id:n,geometry:t,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:{...s.defines,...r?.defines,HAS_UV_REGIONS:t.attributes.uvRegions?1:0},parameters:r?.parameters,isInstanced:!0})}updatePbrMaterialUniforms(t){let{model:n}=this.state;if(n){let{mesh:r}=this.props,s=this.parseMaterial(t,r);this.setState({parsedPBRMaterial:s});let{pbr_baseColorSampler:i}=s.bindings,{emptyTexture:o}=this.state,c={sampler:i||o,hasTexture:Boolean(i)},{camera:a,...h}={...s.bindings,...s.uniforms};n.shaderInputs.setProps({simpleMesh:c,pbrMaterial:h})}}parseMaterial(t,n){let r=Boolean(t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture);return Xl(this.context.device,{unlit:r,...t},{NORMAL:n.attributes.normals,TEXCOORD_0:n.attributes.texCoords},{pbrDebug:!1,lights:!0,useTangents:!1})}calculateFeatureIdsPickingColors(t){let n=this.props.featureIds,r=new Uint8ClampedArray(n.length*t.size),s=[];for(let i=0;i<n.length;i++)this.encodePickingColor(n[i],s),r[i*3]=s[0],r[i*3+1]=s[1],r[i*3+2]=s[2];t.value=r}finalizeState(t){super.finalizeState(t),this.state.parsedPBRMaterial?.generatedTextures.forEach(n=>n.destroy()),this.setState({parsedPBRMaterial:null})}};ui.layerName="MeshLayer";ui.defaultProps=tP;var hx=ui;var YE=G(Fr(),1);var eP=1/Math.PI*180,HY=1/180*Math.PI,nP={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...nP}};var xt=globalThis.mathgl.config;function $l(e,{precision:t=xt.precision}={}){return e=rP(e),`${parseFloat(e.toPrecision(t))}`}function Ie(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ne(e,t){return iP(e,n=>n*eP,t)}function ec(e,t,n){let r=xt.EPSILON;n&&(xt.EPSILON=n);try{if(e===t)return!0;if(Ie(e)&&Ie(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!ec(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)<=xt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{xt.EPSILON=r}}function rP(e){return Math.round(e/xt.EPSILON)*xt.EPSILON}function sP(e){return e.clone?e.clone():new Array(e.length)}function iP(e,t,n){if(Ie(e)){let r=e;n=n||sP(r);for(let s=0;s<n.length&&s<r.length;++s){let i=typeof e=="number"?e:e[s];n[s]=t(i,s,n)}return n}return t(e)}var xn=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Ie(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(xt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+$l(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!ec(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(xt.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function oP(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function J(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function Mn(e,t,n=""){if(xt.debug&&!oP(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function tf(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var Dr=class extends xn{get x(){return this[0]}set x(t){this[0]=J(t)}get y(){return this[1]}set y(t){this[1]=J(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return J(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return J(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return tf(t>=0&&t<this.ELEMENTS,"index is out of range"),J(this[t])}setComponent(t,n){return tf(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var Pt=typeof Float32Array<"u"?Float32Array:Array;var eW=Math.PI/180;function cP(){let e=new Pt(2);return Pt!=Float32Array&&(e[0]=0,e[1]=0),e}function ux(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}function dx(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var nW=function(){let e=cP();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function mx(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function nc(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function gx(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function xx(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function rc(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function ef(){let e=new Pt(3);return Pt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function aP(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function nf(e,t,n){let r=new Pt(3);return r[0]=e,r[1]=t,r[2]=n,r}function Mx(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function rf(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Ur(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function Gr(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function sc(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function ic(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function Ax(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function yx(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Ex(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Tx(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&rf(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var _x=aP;var iW=function(){let e=ef();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var sf=[0,0,0],oc,F=class extends Dr{static get ZERO(){return oc||(oc=new F(0,0,0),Object.freeze(oc)),oc}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&Ie(t)?this.copy(t):(xt.debug&&(J(t),J(n),J(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return xt.debug&&(J(t.x),J(t.y),J(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]=J(t)}angle(t){return Tx(this,t)}cross(t){return Ur(this,this,t),this.check()}rotateX({radians:t,origin:n=sf}){return Ax(this,this,n,t),this.check()}rotateY({radians:t,origin:n=sf}){return yx(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=sf}){return Ex(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Gr(this,this,t),this.check()}transformAsVector(t){return nc(this,this,t),this.check()}transformByMatrix3(t){return sc(this,this,t),this.check()}transformByMatrix2(t){return gx(this,this,t),this.check()}transformByQuaternion(t){return ic(this,this,t),this.check()}};var cc,zr=class extends Dr{static get ZERO(){return cc||(cc=new zr(0,0,0,0),Object.freeze(cc)),cc}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),Ie(t)&&arguments.length===1?this.copy(t):(xt.debug&&(J(t),J(n),J(r),J(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return xt.debug&&(J(t.x),J(t.y),J(t.z),J(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]=J(t)}get w(){return this[3]}set w(t){this[3]=J(t)}transform(t){return Gr(this,this,t),this.check()}transformByMatrix3(t){return rc(this,this,t),this.check()}transformByMatrix2(t){return xx(this,this,t),this.check()}transformByQuaternion(t){return ic(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Vr=class extends xn{toString(){let t="[";if(xt.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=J(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function Sx(){let e=new Pt(9);return Pt!=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 Cx(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=s}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function Bx(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=l*o-c*h,p=-l*i+c*a,u=h*i-o*a,d=n*f+r*p+s*u;return d?(d=1/d,e[0]=f*d,e[1]=(-l*r+s*h)*d,e[2]=(c*r-s*o)*d,e[3]=p*d,e[4]=(l*n-s*a)*d,e[5]=(-c*n+s*i)*d,e[6]=u*d,e[7]=(-h*n+r*a)*d,e[8]=(o*n-r*i)*d,e):null}function Lx(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8];return t*(h*i-o*a)+n*(-h*s+o*c)+r*(a*s-i*c)}function of(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1],d=n[2],g=n[3],m=n[4],M=n[5],E=n[6],A=n[7],y=n[8];return e[0]=p*r+u*o+d*h,e[1]=p*s+u*c+d*l,e[2]=p*i+u*a+d*f,e[3]=g*r+m*o+M*h,e[4]=g*s+m*c+M*l,e[5]=g*i+m*a+M*f,e[6]=E*r+A*o+y*h,e[7]=E*s+A*c+y*l,e[8]=E*i+A*a+y*f,e}function Rx(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=p*r+u*o+h,e[7]=p*s+u*c+l,e[8]=p*i+u*a+f,e}function bx(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=Math.sin(n),u=Math.cos(n);return e[0]=u*r+p*o,e[1]=u*s+p*c,e[2]=u*i+p*a,e[3]=u*o-p*r,e[4]=u*c-p*s,e[5]=u*a-p*i,e[6]=h,e[7]=l,e[8]=f,e}function cf(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=s*t[3],e[4]=s*t[4],e[5]=s*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function wx(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[3]=l-M,e[6]=p+m,e[1]=l+M,e[4]=1-h-d,e[7]=u-g,e[2]=p-m,e[5]=u+g,e[8]=1-h-f,e}var af;(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"})(af||(af={}));var fP=Object.freeze([1,0,0,0,1,0,0,0,1]),Kn=class extends Vr{static get IDENTITY(){return uP()}static get ZERO(){return pP()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return af}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(fP)}fromObject(t){return this.check()}fromQuaternion(t){return wx(this,t),this.check()}set(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=h,this.check()}determinant(){return Lx(this)}transpose(){return Cx(this,this),this.check()}invert(){return Bx(this,this),this.check()}multiplyLeft(t){return of(this,t,this),this.check()}multiplyRight(t){return of(this,this,t),this.check()}rotate(t){return bx(this,this,t),this.check()}scale(t){return Array.isArray(t)?cf(this,this,t):cf(this,this,[t,t]),this.check()}translate(t){return Rx(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=ux(n||[-0,-0],t,this);break;case 3:r=sc(n||[-0,-0,-0],t,this);break;case 4:r=rc(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Mn(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},ac,hc=null;function pP(){return ac||(ac=new Kn([0,0,0,0,0,0,0,0,0]),Object.freeze(ac)),ac}function uP(){return hc||(hc=new Kn,Object.freeze(hc)),hc}function dP(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 Ix(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}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 Px(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,C=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,b=f*M-u*g,w=p*M-u*m,B=E*w-A*b+y*R+T*x-_*S+L*C;return B?(B=1/B,e[0]=(c*w-a*b+h*R)*B,e[1]=(s*b-r*w-i*R)*B,e[2]=(g*L-m*_+M*T)*B,e[3]=(p*_-f*L-u*T)*B,e[4]=(a*x-o*w-h*S)*B,e[5]=(n*w-s*x+i*S)*B,e[6]=(m*y-d*L-M*A)*B,e[7]=(l*L-p*y+u*A)*B,e[8]=(o*b-c*x+h*C)*B,e[9]=(r*x-n*b-i*C)*B,e[10]=(d*_-g*y+M*E)*B,e[11]=(f*y-l*_-u*E)*B,e[12]=(c*S-o*R-a*C)*B,e[13]=(n*R-r*S+s*C)*B,e[14]=(g*A-d*T-m*E)*B,e[15]=(l*T-f*A+p*E)*B,e):null}function Ox(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8],l=e[9],f=e[10],p=e[11],u=e[12],d=e[13],g=e[14],m=e[15],M=t*o-n*i,E=t*c-r*i,A=n*c-r*o,y=h*d-l*u,T=h*g-f*u,_=l*g-f*d,L=t*_-n*T+r*y,C=i*_-o*T+c*y,S=h*A-l*E+f*M,x=u*A-d*E+g*M;return a*L-s*C+m*S-p*x}function hf(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=t[9],u=t[10],d=t[11],g=t[12],m=t[13],M=t[14],E=t[15],A=n[0],y=n[1],T=n[2],_=n[3];return e[0]=A*r+y*c+T*f+_*g,e[1]=A*s+y*a+T*p+_*m,e[2]=A*i+y*h+T*u+_*M,e[3]=A*o+y*l+T*d+_*E,A=n[4],y=n[5],T=n[6],_=n[7],e[4]=A*r+y*c+T*f+_*g,e[5]=A*s+y*a+T*p+_*m,e[6]=A*i+y*h+T*u+_*M,e[7]=A*o+y*l+T*d+_*E,A=n[8],y=n[9],T=n[10],_=n[11],e[8]=A*r+y*c+T*f+_*g,e[9]=A*s+y*a+T*p+_*m,e[10]=A*i+y*h+T*u+_*M,e[11]=A*o+y*l+T*d+_*E,A=n[12],y=n[13],T=n[14],_=n[15],e[12]=A*r+y*c+T*f+_*g,e[13]=A*s+y*a+T*p+_*m,e[14]=A*i+y*h+T*u+_*M,e[15]=A*o+y*l+T*d+_*E,e}function vx(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,h,l,f,p,u,d,g,m,M;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],h=t[3],l=t[4],f=t[5],p=t[6],u=t[7],d=t[8],g=t[9],m=t[10],M=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=p,e[7]=u,e[8]=d,e[9]=g,e[10]=m,e[11]=M,e[12]=o*r+l*s+d*i+t[12],e[13]=c*r+f*s+g*i+t[13],e[14]=a*r+p*s+m*i+t[14],e[15]=h*r+u*s+M*i+t[15]),e}function Nx(e,t,n){let r=n[0],s=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Fx(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,h,l,f,p,u,d,g,m,M,E,A,y,T,_,L,C,S,x,R,b,w,B,v;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,h=Math.sin(n),a=Math.cos(n),l=1-a,f=t[0],p=t[1],u=t[2],d=t[3],g=t[4],m=t[5],M=t[6],E=t[7],A=t[8],y=t[9],T=t[10],_=t[11],L=s*s*l+a,C=i*s*l+o*h,S=o*s*l-i*h,x=s*i*l-o*h,R=i*i*l+a,b=o*i*l+s*h,w=s*o*l+i*h,B=i*o*l-s*h,v=o*o*l+a,e[0]=f*L+g*C+A*S,e[1]=p*L+m*C+y*S,e[2]=u*L+M*C+T*S,e[3]=d*L+E*C+_*S,e[4]=f*x+g*R+A*b,e[5]=p*x+m*R+y*b,e[6]=u*x+M*R+T*b,e[7]=d*x+E*R+_*b,e[8]=f*w+g*B+A*v,e[9]=p*w+m*B+y*v,e[10]=u*w+M*B+T*v,e[11]=d*w+E*B+_*v,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function Dx(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],h=t[8],l=t[9],f=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=i*s+h*r,e[5]=o*s+l*r,e[6]=c*s+f*r,e[7]=a*s+p*r,e[8]=h*s-i*r,e[9]=l*s-o*r,e[10]=f*s-c*r,e[11]=p*s-a*r,e}function Ux(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[8],l=t[9],f=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s-h*r,e[1]=o*s-l*r,e[2]=c*s-f*r,e[3]=a*s-p*r,e[8]=i*r+h*s,e[9]=o*r+l*s,e[10]=c*r+f*s,e[11]=a*r+p*s,e}function Gx(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[4],l=t[5],f=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s+h*r,e[1]=o*s+l*r,e[2]=c*s+f*r,e[3]=a*s+p*r,e[4]=h*s-i*r,e[5]=l*s-o*r,e[6]=f*s-c*r,e[7]=p*s-a*r,e}function zx(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[1]=l+M,e[2]=p-m,e[3]=0,e[4]=l-M,e[5]=1-h-d,e[6]=u+g,e[7]=0,e[8]=p+m,e[9]=u-g,e[10]=1-h-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Vx(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),h=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*h,e[15]=0,e}function mP(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var qx=mP;function gP(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*h,e[15]=1,e}var kx=gP;function Hx(e,t,n,r){let s,i,o,c,a,h,l,f,p,u,d=t[0],g=t[1],m=t[2],M=r[0],E=r[1],A=r[2],y=n[0],T=n[1],_=n[2];return Math.abs(d-y)<1e-6&&Math.abs(g-T)<1e-6&&Math.abs(m-_)<1e-6?dP(e):(f=d-y,p=g-T,u=m-_,s=1/Math.sqrt(f*f+p*p+u*u),f*=s,p*=s,u*=s,i=E*u-A*p,o=A*f-M*u,c=M*p-E*f,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-u*o,h=u*i-f*c,l=f*o-p*i,s=Math.sqrt(a*a+h*h+l*l),s?(s=1/s,a*=s,h*=s,l*=s):(a=0,h=0,l=0),e[0]=i,e[1]=a,e[2]=f,e[3]=0,e[4]=o,e[5]=h,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=0,e[12]=-(i*d+o*g+c*m),e[13]=-(a*d+h*g+l*m),e[14]=-(f*d+p*g+u*m),e[15]=1,e)}function xP(){let e=new Pt(4);return Pt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Yx(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function Wx(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function Jx(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function jx(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function Xx(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function Kx(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Qx(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function Zx(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*s+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*s+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*s+n[11]*i+n[15]*o,e}function $x(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2],h=n[3],l=h*r+c*i-a*s,f=h*s+a*r-o*i,p=h*i+o*s-c*r,u=-o*r-c*s-a*i;return e[0]=l*h+u*-o+f*-a-p*-c,e[1]=f*h+u*-c+p*-o-l*-a,e[2]=p*h+u*-a+l*-c-f*-o,e[3]=t[3],e}var wW=function(){let e=xP();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var pf;(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"})(pf||(pf={}));var AP=45*Math.PI/180,yP=1,lf=.1,ff=500,EP=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),rt=class extends Vr{static get IDENTITY(){return _P()}static get ZERO(){return TP()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return pf}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this[9]=l,this[10]=f,this[11]=p,this[12]=u,this[13]=d,this[14]=g,this[15]=m,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=i,this[2]=h,this[3]=u,this[4]=n,this[5]=o,this[6]=l,this[7]=d,this[8]=r,this[9]=c,this[10]=f,this[11]=g,this[12]=s,this[13]=a,this[14]=p,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(EP)}fromObject(t){return this.check()}fromQuaternion(t){return zx(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=lf,far:c=ff}=t;return c===1/0?SP(this,n,r,s,i,o):Vx(this,n,r,s,i,o,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return Hx(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=lf,far:c=ff}=t;return kx(this,n,r,s,i,o,c),this.check()}orthographic(t){let{fovy:n=AP,aspect:r=yP,focalDistance:s=1,near:i=lf,far:o=ff}=t;t2(n);let c=n/2,a=s*Math.tan(c),h=a*r;return this.ortho({left:-h,right:h,bottom:-a,top:a,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return t2(n),qx(this,n,r,s,i),this.check()}determinant(){return Ox(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*s,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*s,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return Ix(this,this),this.check()}invert(){return Px(this,this),this.check()}multiplyLeft(t){return hf(this,t,this),this.check()}multiplyRight(t){return hf(this,this,t),this.check()}rotateX(t){return Dx(this,this,t),this.check()}rotateY(t){return Ux(this,this,t),this.check()}rotateZ(t){return Gx(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return Fx(this,this,t,n),this.check()}scale(t){return Nx(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return vx(this,this,t),this.check()}transform(t,n){return t.length===4?(n=Zx(n||[-0,-0,-0,-0],t,this),Mn(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=dx(n||[-0,-0],t,this);break;case 3:s=Gr(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Mn(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=mx(n||[-0,-0],t,this);break;case 3:r=nc(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Mn(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},lc,fc;function TP(){return lc||(lc=new rt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(lc)),lc}function _P(){return fc||(fc=new rt,Object.freeze(fc)),fc}function t2(e){if(e>Math.PI*2)throw Error("expected radians")}function SP(e,t,n,r,s,i){let o=2*i/(n-t),c=2*i/(s-r),a=(n+t)/(n-t),h=(s+r)/(s-r),l=-1,f=-1,p=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=h,e[10]=l,e[11]=f,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function e2(){let e=new Pt(4);return Pt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function n2(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function uf(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function df(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*l+o*c+s*h-i*a,e[1]=s*l+o*a+i*c-r*h,e[2]=i*l+o*h+r*a-s*c,e[3]=o*l-r*c-s*a-i*h,e}function r2(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function s2(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function i2(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function o2(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function mi(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],h=n[1],l=n[2],f=n[3],p,u,d,g,m;return p=s*a+i*h+o*l+c*f,p<0&&(p=-p,a=-a,h=-h,l=-l,f=-f),1-p>1e-6?(u=Math.acos(p),m=Math.sin(u),d=Math.sin((1-r)*u)/m,g=Math.sin(r*u)/m):(d=1-r,g=r),e[0]=d*s+g*a,e[1]=d*i+g*h,e[2]=d*o+g*l,e[3]=d*c+g*f,e}function c2(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function a2(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function mf(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}var h2=Yx;var l2=Wx,f2=Kx,p2=Qx,u2=Jx;var d2=jx;var m2=Xx;var g2=function(){let e=ef(),t=nf(1,0,0),n=nf(0,1,0);return function(r,s,i){let o=rf(s,i);return o<-.999999?(Ur(e,t,s),_x(e)<1e-6&&Ur(e,n,s),Mx(e,e),uf(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Ur(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,m2(r,r))}}(),HW=function(){let e=e2(),t=e2();return function(n,r,s,i,o,c){return mi(e,r,o,c),mi(t,s,i,c),mi(n,e,t,2*c*(1-c)),n}}(),YW=function(){let e=Sx();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],m2(t,mf(t,e))}}();var CP=[0,0,0,1],gi=class extends xn{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return mf(this,t),this.check()}fromAxisRotation(t,n){return uf(this,t,n),this.check()}identity(){return n2(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=J(t)}get y(){return this[1]}set y(t){this[1]=J(t)}get z(){return this[2]}set z(t){this[2]=J(t)}get w(){return this[3]}set w(t){this[3]=J(t)}len(){return u2(this)}lengthSquared(){return d2(this)}dot(t){return f2(this,t)}rotationTo(t,n){return g2(this,t,n),this.check()}add(t){return h2(this,this,t),this.check()}calculateW(){return o2(this,this),this.check()}conjugate(){return a2(this,this),this.check()}invert(){return c2(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(p2(this,t,n,r),this.check())}multiplyRight(t){return df(this,this,t),this.check()}multiplyLeft(t){return df(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return r2(this,this,t),this.check()}rotateY(t){return s2(this,this,t),this.check()}rotateZ(t){return i2(this,this,t),this.check()}scale(t){return l2(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=CP,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return mi(this,s,i,o),this.check()}transformVector4(t,n=new zr){return $x(n,t,this),Mn(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var LP=1/Math.PI*180,RP=1/180*Math.PI,bP={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...bP}};var Mt=globalThis.mathgl.config;function gf(e,{precision:t=Mt.precision}={}){return e=wP(e),`${parseFloat(e.toPrecision(t))}`}function An(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function xf(e){return x2(e)}function Mf(e){return M2(e)}function x2(e,t){return A2(e,n=>n*RP,t)}function M2(e,t){return A2(e,n=>n*LP,t)}function ke(e,t,n){let r=Mt.EPSILON;n&&(Mt.EPSILON=n);try{if(e===t)return!0;if(An(e)&&An(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!ke(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)<=Mt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{Mt.EPSILON=r}}function wP(e){return Math.round(e/Mt.EPSILON)*Mt.EPSILON}function IP(e){return e.clone?e.clone():new Array(e.length)}function A2(e,t,n){if(An(e)){let r=e;n=n||IP(r);for(let s=0;s<n.length&&s<r.length;++s){let i=typeof e=="number"?e:e[s];n[s]=t(i,s,n)}return n}return t(e)}var qr=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:An(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Mt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+gf(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!ke(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(Mt.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function PP(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function Ot(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function pc(e,t,n=""){if(Mt.debug&&!PP(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function re(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var uc=class extends qr{get x(){return this[0]}set x(t){this[0]=Ot(t)}get y(){return this[1]}set y(t){this[1]=Ot(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return Ot(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return Ot(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return re(t>=0&&t<this.ELEMENTS,"index is out of range"),Ot(this[t])}setComponent(t,n){return re(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var me=typeof Float32Array<"u"?Float32Array:Array,xi=Math.random;function kr(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var bJ=Math.PI/180;function OP(){let e=new me(2);return me!=Float32Array&&(e[0]=0,e[1]=0),e}function y2(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var wJ=function(){let e=OP();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function E2(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function dc(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function T2(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}var Hr={};Tt(Hr,{add:()=>UP,angle:()=>Lf,bezier:()=>ZP,ceil:()=>GP,clone:()=>vP,copy:()=>FP,create:()=>_2,cross:()=>Ef,dist:()=>cO,distance:()=>R2,div:()=>oO,divide:()=>L2,dot:()=>yf,equals:()=>rO,exactEquals:()=>nO,floor:()=>zP,forEach:()=>fO,fromValues:()=>NP,hermite:()=>QP,inverse:()=>JP,len:()=>hO,length:()=>S2,lerp:()=>XP,max:()=>qP,min:()=>VP,mul:()=>iO,multiply:()=>B2,negate:()=>WP,normalize:()=>jP,random:()=>$P,rotateX:()=>Sf,rotateY:()=>Cf,rotateZ:()=>Bf,round:()=>kP,scale:()=>HP,scaleAndAdd:()=>YP,set:()=>DP,slerp:()=>KP,sqrDist:()=>aO,sqrLen:()=>lO,squaredDistance:()=>b2,squaredLength:()=>w2,str:()=>eO,sub:()=>sO,subtract:()=>C2,transformMat3:()=>Tf,transformMat4:()=>Mi,transformQuat:()=>_f,zero:()=>tO});function _2(){let e=new me(3);return me!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function vP(e){let t=new me(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function S2(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function NP(e,t,n){let r=new me(3);return r[0]=e,r[1]=t,r[2]=n,r}function FP(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function DP(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function UP(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function C2(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function B2(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}function L2(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}function GP(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function zP(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function VP(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}function qP(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}function kP(e,t){return e[0]=kr(t[0]),e[1]=kr(t[1]),e[2]=kr(t[2]),e}function HP(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function YP(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e}function R2(e,t){let n=t[0]-e[0],r=t[1]-e[1],s=t[2]-e[2];return Math.sqrt(n*n+r*r+s*s)}function b2(e,t){let n=t[0]-e[0],r=t[1]-e[1],s=t[2]-e[2];return n*n+r*r+s*s}function w2(e){let t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r}function WP(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function JP(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function jP(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function yf(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Ef(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function XP(e,t,n,r){let s=t[0],i=t[1],o=t[2];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e}function KP(e,t,n,r){let s=Math.acos(Math.min(Math.max(yf(t,n),-1),1)),i=Math.sin(s),o=Math.sin((1-r)*s)/i,c=Math.sin(r*s)/i;return e[0]=o*t[0]+c*n[0],e[1]=o*t[1]+c*n[1],e[2]=o*t[2]+c*n[2],e}function QP(e,t,n,r,s,i){let o=i*i,c=o*(2*i-3)+1,a=o*(i-2)+i,h=o*(i-1),l=o*(3-2*i);return e[0]=t[0]*c+n[0]*a+r[0]*h+s[0]*l,e[1]=t[1]*c+n[1]*a+r[1]*h+s[1]*l,e[2]=t[2]*c+n[2]*a+r[2]*h+s[2]*l,e}function ZP(e,t,n,r,s,i){let o=1-i,c=o*o,a=i*i,h=c*o,l=3*i*c,f=3*a*o,p=a*i;return e[0]=t[0]*h+n[0]*l+r[0]*f+s[0]*p,e[1]=t[1]*h+n[1]*l+r[1]*f+s[1]*p,e[2]=t[2]*h+n[2]*l+r[2]*f+s[2]*p,e}function $P(e,t){t=t===void 0?1:t;let n=xi()*2*Math.PI,r=xi()*2-1,s=Math.sqrt(1-r*r)*t;return e[0]=Math.cos(n)*s,e[1]=Math.sin(n)*s,e[2]=r*t,e}function Mi(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function Tf(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function _f(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function Sf(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Cf(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Bf(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Lf(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&yf(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}function tO(e){return e[0]=0,e[1]=0,e[2]=0,e}function eO(e){return`vec3(${e[0]}, ${e[1]}, ${e[2]})`}function nO(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function rO(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-o)<=1e-6*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))}var sO=C2,iO=B2,oO=L2,cO=R2,aO=b2,hO=S2,lO=w2,fO=function(){let e=_2();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var Rf=[0,0,0],mc,k=class extends uc{static get ZERO(){return mc||(mc=new k(0,0,0),Object.freeze(mc)),mc}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&An(t)?this.copy(t):(Mt.debug&&(Ot(t),Ot(n),Ot(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Mt.debug&&(Ot(t.x),Ot(t.y),Ot(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]=Ot(t)}angle(t){return Lf(this,t)}cross(t){return Ef(this,this,t),this.check()}rotateX({radians:t,origin:n=Rf}){return Sf(this,this,n,t),this.check()}rotateY({radians:t,origin:n=Rf}){return Cf(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=Rf}){return Bf(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Mi(this,this,t),this.check()}transformAsVector(t){return dc(this,this,t),this.check()}transformByMatrix3(t){return Tf(this,this,t),this.check()}transformByMatrix2(t){return T2(this,this,t),this.check()}transformByQuaternion(t){return _f(this,this,t),this.check()}};var gc=class extends qr{toString(){let t="[";if(Mt.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=Ot(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function pO(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 I2(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}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 P2(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,C=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,b=f*M-u*g,w=p*M-u*m,B=E*w-A*b+y*R+T*x-_*S+L*C;return B?(B=1/B,e[0]=(c*w-a*b+h*R)*B,e[1]=(s*b-r*w-i*R)*B,e[2]=(g*L-m*_+M*T)*B,e[3]=(p*_-f*L-u*T)*B,e[4]=(a*x-o*w-h*S)*B,e[5]=(n*w-s*x+i*S)*B,e[6]=(m*y-d*L-M*A)*B,e[7]=(l*L-p*y+u*A)*B,e[8]=(o*b-c*x+h*C)*B,e[9]=(r*x-n*b-i*C)*B,e[10]=(d*_-g*y+M*E)*B,e[11]=(f*y-l*_-u*E)*B,e[12]=(c*S-o*R-a*C)*B,e[13]=(n*R-r*S+s*C)*B,e[14]=(g*A-d*T-m*E)*B,e[15]=(l*T-f*A+p*E)*B,e):null}function O2(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8],l=e[9],f=e[10],p=e[11],u=e[12],d=e[13],g=e[14],m=e[15],M=t*o-n*i,E=t*c-r*i,A=n*c-r*o,y=h*d-l*u,T=h*g-f*u,_=l*g-f*d,L=t*_-n*T+r*y,C=i*_-o*T+c*y,S=h*A-l*E+f*M,x=u*A-d*E+g*M;return a*L-s*C+m*S-p*x}function bf(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=t[9],u=t[10],d=t[11],g=t[12],m=t[13],M=t[14],E=t[15],A=n[0],y=n[1],T=n[2],_=n[3];return e[0]=A*r+y*c+T*f+_*g,e[1]=A*s+y*a+T*p+_*m,e[2]=A*i+y*h+T*u+_*M,e[3]=A*o+y*l+T*d+_*E,A=n[4],y=n[5],T=n[6],_=n[7],e[4]=A*r+y*c+T*f+_*g,e[5]=A*s+y*a+T*p+_*m,e[6]=A*i+y*h+T*u+_*M,e[7]=A*o+y*l+T*d+_*E,A=n[8],y=n[9],T=n[10],_=n[11],e[8]=A*r+y*c+T*f+_*g,e[9]=A*s+y*a+T*p+_*m,e[10]=A*i+y*h+T*u+_*M,e[11]=A*o+y*l+T*d+_*E,A=n[12],y=n[13],T=n[14],_=n[15],e[12]=A*r+y*c+T*f+_*g,e[13]=A*s+y*a+T*p+_*m,e[14]=A*i+y*h+T*u+_*M,e[15]=A*o+y*l+T*d+_*E,e}function v2(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,h,l,f,p,u,d,g,m,M;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],h=t[3],l=t[4],f=t[5],p=t[6],u=t[7],d=t[8],g=t[9],m=t[10],M=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=p,e[7]=u,e[8]=d,e[9]=g,e[10]=m,e[11]=M,e[12]=o*r+l*s+d*i+t[12],e[13]=c*r+f*s+g*i+t[13],e[14]=a*r+p*s+m*i+t[14],e[15]=h*r+u*s+M*i+t[15]),e}function N2(e,t,n){let r=n[0],s=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function F2(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,h,l,f,p,u,d,g,m,M,E,A,y,T,_,L,C,S,x,R,b,w,B,v;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,h=Math.sin(n),a=Math.cos(n),l=1-a,f=t[0],p=t[1],u=t[2],d=t[3],g=t[4],m=t[5],M=t[6],E=t[7],A=t[8],y=t[9],T=t[10],_=t[11],L=s*s*l+a,C=i*s*l+o*h,S=o*s*l-i*h,x=s*i*l-o*h,R=i*i*l+a,b=o*i*l+s*h,w=s*o*l+i*h,B=i*o*l-s*h,v=o*o*l+a,e[0]=f*L+g*C+A*S,e[1]=p*L+m*C+y*S,e[2]=u*L+M*C+T*S,e[3]=d*L+E*C+_*S,e[4]=f*x+g*R+A*b,e[5]=p*x+m*R+y*b,e[6]=u*x+M*R+T*b,e[7]=d*x+E*R+_*b,e[8]=f*w+g*B+A*v,e[9]=p*w+m*B+y*v,e[10]=u*w+M*B+T*v,e[11]=d*w+E*B+_*v,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function D2(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],h=t[8],l=t[9],f=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=i*s+h*r,e[5]=o*s+l*r,e[6]=c*s+f*r,e[7]=a*s+p*r,e[8]=h*s-i*r,e[9]=l*s-o*r,e[10]=f*s-c*r,e[11]=p*s-a*r,e}function U2(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[8],l=t[9],f=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s-h*r,e[1]=o*s-l*r,e[2]=c*s-f*r,e[3]=a*s-p*r,e[8]=i*r+h*s,e[9]=o*r+l*s,e[10]=c*r+f*s,e[11]=a*r+p*s,e}function G2(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[4],l=t[5],f=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s+h*r,e[1]=o*s+l*r,e[2]=c*s+f*r,e[3]=a*s+p*r,e[4]=h*s-i*r,e[5]=l*s-o*r,e[6]=f*s-c*r,e[7]=p*s-a*r,e}function z2(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[1]=l+M,e[2]=p-m,e[3]=0,e[4]=l-M,e[5]=1-h-d,e[6]=u+g,e[7]=0,e[8]=p+m,e[9]=u-g,e[10]=1-h-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function V2(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),h=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*h,e[15]=0,e}function uO(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var q2=uO;function dO(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*h,e[15]=1,e}var k2=dO;function H2(e,t,n,r){let s,i,o,c,a,h,l,f,p,u,d=t[0],g=t[1],m=t[2],M=r[0],E=r[1],A=r[2],y=n[0],T=n[1],_=n[2];return Math.abs(d-y)<1e-6&&Math.abs(g-T)<1e-6&&Math.abs(m-_)<1e-6?pO(e):(f=d-y,p=g-T,u=m-_,s=1/Math.sqrt(f*f+p*p+u*u),f*=s,p*=s,u*=s,i=E*u-A*p,o=A*f-M*u,c=M*p-E*f,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-u*o,h=u*i-f*c,l=f*o-p*i,s=Math.sqrt(a*a+h*h+l*l),s?(s=1/s,a*=s,h*=s,l*=s):(a=0,h=0,l=0),e[0]=i,e[1]=a,e[2]=f,e[3]=0,e[4]=o,e[5]=h,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=0,e[12]=-(i*d+o*g+c*m),e[13]=-(a*d+h*g+l*m),e[14]=-(f*d+p*g+u*m),e[15]=1,e)}function mO(){let e=new me(4);return me!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Y2(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*s+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*s+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*s+n[11]*i+n[15]*o,e}var HJ=function(){let e=mO();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var Pf;(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"})(Pf||(Pf={}));var gO=45*Math.PI/180,xO=1,wf=.1,If=500,MO=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),yn=class extends gc{static get IDENTITY(){return yO()}static get ZERO(){return AO()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Pf}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this[9]=l,this[10]=f,this[11]=p,this[12]=u,this[13]=d,this[14]=g,this[15]=m,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=i,this[2]=h,this[3]=u,this[4]=n,this[5]=o,this[6]=l,this[7]=d,this[8]=r,this[9]=c,this[10]=f,this[11]=g,this[12]=s,this[13]=a,this[14]=p,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(MO)}fromObject(t){return this.check()}fromQuaternion(t){return z2(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=wf,far:c=If}=t;return c===1/0?EO(this,n,r,s,i,o):V2(this,n,r,s,i,o,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return H2(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=wf,far:c=If}=t;return k2(this,n,r,s,i,o,c),this.check()}orthographic(t){let{fovy:n=gO,aspect:r=xO,focalDistance:s=1,near:i=wf,far:o=If}=t;W2(n);let c=n/2,a=s*Math.tan(c),h=a*r;return this.ortho({left:-h,right:h,bottom:-a,top:a,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return W2(n),q2(this,n,r,s,i),this.check()}determinant(){return O2(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*s,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*s,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return I2(this,this),this.check()}invert(){return P2(this,this),this.check()}multiplyLeft(t){return bf(this,t,this),this.check()}multiplyRight(t){return bf(this,this,t),this.check()}rotateX(t){return D2(this,this,t),this.check()}rotateY(t){return U2(this,this,t),this.check()}rotateZ(t){return G2(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return F2(this,this,t,n),this.check()}scale(t){return N2(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return v2(this,this,t),this.check()}transform(t,n){return t.length===4?(n=Y2(n||[-0,-0,-0,-0],t,this),pc(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=y2(n||[-0,-0],t,this);break;case 3:s=Mi(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return pc(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=E2(n||[-0,-0],t,this);break;case 3:r=dc(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return pc(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},xc,Mc;function AO(){return xc||(xc=new yn([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(xc)),xc}function yO(){return Mc||(Mc=new yn,Object.freeze(Mc)),Mc}function W2(e){if(e>Math.PI*2)throw Error("expected radians")}function EO(e,t,n,r,s,i){let o=2*i/(n-t),c=2*i/(s-r),a=(n+t)/(n-t),h=(s+r)/(s-r),l=-1,f=-1,p=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=h,e[10]=l,e[11]=f,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}var En={};Tt(En,{EPSILON1:()=>TO,EPSILON10:()=>IO,EPSILON11:()=>PO,EPSILON12:()=>OO,EPSILON13:()=>vO,EPSILON14:()=>NO,EPSILON15:()=>FO,EPSILON16:()=>DO,EPSILON17:()=>UO,EPSILON18:()=>GO,EPSILON19:()=>zO,EPSILON2:()=>_O,EPSILON20:()=>VO,EPSILON3:()=>SO,EPSILON4:()=>CO,EPSILON5:()=>BO,EPSILON6:()=>LO,EPSILON7:()=>RO,EPSILON8:()=>bO,EPSILON9:()=>wO,PI_OVER_FOUR:()=>kO,PI_OVER_SIX:()=>HO,PI_OVER_TWO:()=>qO,TWO_PI:()=>YO});var TO=.1,_O=.01,SO=.001,CO=1e-4,BO=1e-5,LO=1e-6,RO=1e-7,bO=1e-8,wO=1e-9,IO=1e-10,PO=1e-11,OO=1e-12,vO=1e-13,NO=1e-14,FO=1e-15,DO=1e-16,UO=1e-17,GO=1e-18,zO=1e-19,VO=1e-20,qO=Math.PI/2,kO=Math.PI/4,HO=Math.PI/6,YO=Math.PI*2;var Ye=6356752314245179e-9,WO={radii:[6378137,6378137,Ye],radiiSquared:[6378137*6378137,6378137*6378137,Ye*Ye],oneOverRadii:[1/6378137,1/6378137,1/Ye],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(Ye*Ye)],maximumRadius:Math.max(6378137,6378137,Ye),centerToleranceSquared:.1};function Ac(e){return e}var yj=new k;function JO(e,t=[],n=Ac){return"longitude"in e?(t[0]=n(e.longitude),t[1]=n(e.latitude),t[2]=e.height):"x"in e?(t[0]=n(e.x),t[1]=n(e.y),t[2]=e.z):(t[0]=n(e[0]),t[1]=n(e[1]),t[2]=e[2]),t}function J2(e,t=[]){return JO(e,t,Mt._cartographicRadians?Ac:xf)}function jO(e,t,n=Ac){return"longitude"in t?(t.longitude=n(e[0]),t.latitude=n(e[1]),t.height=e[2]):"x"in t?(t.x=n(e[0]),t.y=n(e[1]),t.z=e[2]):(t[0]=n(e[0]),t[1]=n(e[1]),t[2]=e[2]),t}function j2(e,t){return jO(e,t,Mt._cartographicRadians?Ac:Mf)}var X2=1e-14,XO=new k,K2={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"}},Of={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Ai={east:new k,north:new k,up:new k,west:new k,south:new k,down:new k},KO=new k,QO=new k,ZO=new k;function vf(e,t,n,r,s,i){let o=K2[t]&&K2[t][n];re(o&&(!r||r===o));let c,a,h,l=XO.copy(s);if(ke(l.x,0,X2)&&ke(l.y,0,X2)){let p=Math.sign(l.z);c=KO.fromArray(Of[t]),t!=="east"&&t!=="west"&&c.scale(p),a=QO.fromArray(Of[n]),n!=="east"&&n!=="west"&&a.scale(p),h=ZO.fromArray(Of[r]),r!=="east"&&r!=="west"&&h.scale(p)}else{let{up:p,east:u,north:d}=Ai;u.set(-l.y,l.x,0).normalize(),e.geodeticSurfaceNormal(l,p),d.copy(p).cross(u);let{down:g,west:m,south:M}=Ai;g.copy(p).scale(-1),m.copy(u).scale(-1),M.copy(d).scale(-1),c=Ai[t],a=Ai[n],h=Ai[r]}return i[0]=c.x,i[1]=c.y,i[2]=c.z,i[3]=0,i[4]=a.x,i[5]=a.y,i[6]=a.z,i[7]=0,i[8]=h.x,i[9]=h.y,i[10]=h.z,i[11]=0,i[12]=l.x,i[13]=l.y,i[14]=l.z,i[15]=1,i}var Yr=new k,$O=new k,tv=new k;function Q2(e,t,n=[]){let{oneOverRadii:r,oneOverRadiiSquared:s,centerToleranceSquared:i}=t;Yr.from(e);let o=Yr.x,c=Yr.y,a=Yr.z,h=r.x,l=r.y,f=r.z,p=o*o*h*h,u=c*c*l*l,d=a*a*f*f,g=p+u+d,m=Math.sqrt(1/g);if(!Number.isFinite(m))return;let M=$O;if(M.copy(e).scale(m),g<i)return M.to(n);let E=s.x,A=s.y,y=s.z,T=tv;T.set(M.x*E*2,M.y*A*2,M.z*y*2);let _=(1-m)*Yr.len()/(.5*T.len()),L=0,C,S,x,R;do{_-=L,C=1/(1+_*E),S=1/(1+_*A),x=1/(1+_*y);let b=C*C,w=S*S,B=x*x,v=b*C,H=w*S,V=B*x;R=p*b+u*w+d*B-1;let Y=-2*(p*v*E+u*H*A+d*V*y);L=R/Y}while(Math.abs(R)>En.EPSILON12);return Yr.scale([C,S,x]).to(n)}var yc=new k,Z2=new k,rv=new k,ge=new k,sv=new k,Ec=new k,z=class{constructor(t=0,n=0,r=0){this.centerToleranceSquared=En.EPSILON1,re(t>=0),re(n>=0),re(r>=0),this.radii=new k(t,n,r),this.radiiSquared=new k(t*t,n*n,r*r),this.radiiToTheFourth=new k(t*t*t*t,n*n*n*n,r*r*r*r),this.oneOverRadii=new k(t===0?0:1/t,n===0?0:1/n,r===0?0:1/r),this.oneOverRadiiSquared=new k(t===0?0:1/(t*t),n===0?0:1/(n*n),r===0?0:1/(r*r)),this.minimumRadius=Math.min(t,n,r),this.maximumRadius=Math.max(t,n,r),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,n=[0,0,0]){let r=Z2,s=rv,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,r),s.copy(this.radiiSquared).scale(r);let o=Math.sqrt(r.dot(s));return s.scale(1/o),r.scale(i),s.add(r),s.to(n)}cartesianToCartographic(t,n=[0,0,0]){Ec.from(t);let r=this.scaleToGeodeticSurface(Ec,ge);if(!r)return;let s=this.geodeticSurfaceNormal(r,Z2),i=sv;i.copy(Ec).subtract(r);let o=Math.atan2(s.y,s.x),c=Math.asin(s.z),a=Math.sign(Hr.dot(i,Ec))*Hr.length(i);return j2([o,c,a],n)}eastNorthUpToFixedFrame(t,n=new yn){return vf(this,"east","north","up",t,n)}localFrameToFixedFrame(t,n,r,s,i=new yn){return vf(this,t,n,r,s,i)}geocentricSurfaceNormal(t,n=[0,0,0]){return yc.from(t).normalize().to(n)}geodeticSurfaceNormalCartographic(t,n=[0,0,0]){let r=J2(t),s=r[0],i=r[1],o=Math.cos(i);return yc.set(o*Math.cos(s),o*Math.sin(s),Math.sin(i)).normalize(),yc.to(n)}geodeticSurfaceNormal(t,n=[0,0,0]){return yc.from(t).scale(this.oneOverRadiiSquared).normalize().to(n)}scaleToGeodeticSurface(t,n){return Q2(t,this,n)}scaleToGeocentricSurface(t,n=[0,0,0]){ge.from(t);let r=ge.x,s=ge.y,i=ge.z,o=this.oneOverRadiiSquared,c=1/Math.sqrt(r*r*o.x+s*s*o.y+i*i*o.z);return ge.multiplyScalar(c).to(n)}transformPositionToScaledSpace(t,n=[0,0,0]){return ge.from(t).scale(this.oneOverRadii).to(n)}transformPositionFromScaledSpace(t,n=[0,0,0]){return ge.from(t).scale(this.radii).to(n)}getSurfaceNormalIntersectionWithZAxis(t,n=0,r=[0,0,0]){re(ke(this.radii.x,this.radii.y,En.EPSILON15)),re(this.radii.z>0),ge.from(t);let s=ge.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(s)>=this.radii.z-n))return ge.set(0,0,s).to(r)}};z.WGS84=new z(6378137,6378137,Ye);var Tc=class{item;previous;next;constructor(t,n,r){this.item=t,this.previous=n,this.next=r}};var _c=class{head=null;tail=null;_length=0;get length(){return this._length}add(t){let n=new Tc(t,this.tail,null);return this.tail?(this.tail.next=n,this.tail=n):(this.head=n,this.tail=n),++this._length,n}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,n){t!==n&&(this.remove(n),this._insert(t,n))}_insert(t,n){let r=t.next;t.next=n,this.tail===t?this.tail=n:r.previous=n,n.next=r,n.previous=t,++this._length}};var Sc=class{_list;_sentinel;_trimTiles;constructor(){this._list=new _c,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let n=t._cacheNode;n&&this._list.splice(this._sentinel,n)}add(t,n,r){n._cacheNode||(n._cacheNode=this._list.add(n),r&&r(t,n))}unloadTile(t,n,r){let s=n._cacheNode;s&&(this._list.remove(s),n._cacheNode=null,r&&r(t,n))}unloadTiles(t,n){let r=this._trimTiles;this._trimTiles=!1;let s=this._list,i=t.maximumMemoryUsage*1024*1024,o=this._sentinel,c=s.head;for(;c!==o&&(t.gpuMemoryUsageInBytes>i||r);){let a=c.item;c=c.next,this.unloadTile(t,a,n)}}trim(){this._trimTiles=!0}};function $2(e,t){q(e),q(t);let{rtcCenter:n,gltfUpAxis:r}=t,{computedTransform:s,boundingVolume:{center:i}}=e,o=new rt(s);switch(n&&o.translate(n),r){case"Z":break;case"Y":let f=new rt().rotateX(Math.PI/2);o=o.multiplyRight(f);break;case"X":let p=new rt().rotateY(-Math.PI/2);o=o.multiplyRight(p);break;default:break}t.isQuantized&&o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let c=new F(i);t.cartesianModelMatrix=o,t.cartesianOrigin=c;let a=z.WGS84.cartesianToCartographic(c,new F),l=z.WGS84.eastNorthUpToFixedFrame(c).invert();t.cartographicModelMatrix=l.multiplyRight(o),t.cartographicOrigin=a,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var Ct={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var Wj=1/Math.PI*180,Jj=1/180*Math.PI,iv={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...iv}};var At=globalThis.mathgl.config;function Nf(e,{precision:t=At.precision}={}){return e=ov(e),`${parseFloat(e.toPrecision(t))}`}function We(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Tn(e,t,n){let r=At.EPSILON;n&&(At.EPSILON=n);try{if(e===t)return!0;if(We(e)&&We(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Tn(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)<=At.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{At.EPSILON=r}}function ov(e){return Math.round(e/At.EPSILON)*At.EPSILON}var _n=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:We(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(At)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+Nf(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!Tn(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(At.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function cv(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function j(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function Cc(e,t,n=""){if(At.debug&&!cv(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function Pe(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var Wr=class extends _n{get x(){return this[0]}set x(t){this[0]=j(t)}get y(){return this[1]}set y(t){this[1]=j(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return j(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return j(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return Pe(t>=0&&t<this.ELEMENTS,"index is out of range"),j(this[t])}setComponent(t,n){return Pe(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var lt=typeof Float32Array<"u"?Float32Array:Array;var sX=Math.PI/180;function av(){let e=new lt(2);return lt!=Float32Array&&(e[0]=0,e[1]=0),e}function nM(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}var iX=function(){let e=av();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function rM(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function sM(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function iM(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function Bc(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function Ff(){let e=new lt(3);return lt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function hv(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function Df(e,t,n){let r=new lt(3);return r[0]=e,r[1]=t,r[2]=n,r}function oM(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function Uf(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function jr(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function Lc(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function Rc(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function bc(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function cM(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function aM(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function hM(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function lM(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&Uf(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var fM=hv;var aX=function(){let e=Ff();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var Gf=[0,0,0],wc,N=class extends Wr{static get ZERO(){return wc||(wc=new N(0,0,0),Object.freeze(wc)),wc}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&We(t)?this.copy(t):(At.debug&&(j(t),j(n),j(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return At.debug&&(j(t.x),j(t.y),j(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]=j(t)}angle(t){return lM(this,t)}cross(t){return jr(this,this,t),this.check()}rotateX({radians:t,origin:n=Gf}){return cM(this,this,n,t),this.check()}rotateY({radians:t,origin:n=Gf}){return aM(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=Gf}){return hM(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Lc(this,this,t),this.check()}transformAsVector(t){return rM(this,this,t),this.check()}transformByMatrix3(t){return Rc(this,this,t),this.check()}transformByMatrix2(t){return sM(this,this,t),this.check()}transformByQuaternion(t){return bc(this,this,t),this.check()}};var Ic,Xr=class extends Wr{static get ZERO(){return Ic||(Ic=new Xr(0,0,0,0),Object.freeze(Ic)),Ic}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),We(t)&&arguments.length===1?this.copy(t):(At.debug&&(j(t),j(n),j(r),j(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return At.debug&&(j(t.x),j(t.y),j(t.z),j(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]=j(t)}get w(){return this[3]}set w(t){this[3]=j(t)}transform(t){return Lc(this,this,t),this.check()}transformByMatrix3(t){return Bc(this,this,t),this.check()}transformByMatrix2(t){return iM(this,this,t),this.check()}transformByQuaternion(t){return bc(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Pc=class extends _n{toString(){let t="[";if(At.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=j(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function pM(){let e=new lt(9);return lt!=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 uM(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=s}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function dM(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=l*o-c*h,p=-l*i+c*a,u=h*i-o*a,d=n*f+r*p+s*u;return d?(d=1/d,e[0]=f*d,e[1]=(-l*r+s*h)*d,e[2]=(c*r-s*o)*d,e[3]=p*d,e[4]=(l*n-s*a)*d,e[5]=(-c*n+s*i)*d,e[6]=u*d,e[7]=(-h*n+r*a)*d,e[8]=(o*n-r*i)*d,e):null}function mM(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8];return t*(h*i-o*a)+n*(-h*s+o*c)+r*(a*s-i*c)}function zf(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1],d=n[2],g=n[3],m=n[4],M=n[5],E=n[6],A=n[7],y=n[8];return e[0]=p*r+u*o+d*h,e[1]=p*s+u*c+d*l,e[2]=p*i+u*a+d*f,e[3]=g*r+m*o+M*h,e[4]=g*s+m*c+M*l,e[5]=g*i+m*a+M*f,e[6]=E*r+A*o+y*h,e[7]=E*s+A*c+y*l,e[8]=E*i+A*a+y*f,e}function gM(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=p*r+u*o+h,e[7]=p*s+u*c+l,e[8]=p*i+u*a+f,e}function xM(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=Math.sin(n),u=Math.cos(n);return e[0]=u*r+p*o,e[1]=u*s+p*c,e[2]=u*i+p*a,e[3]=u*o-p*r,e[4]=u*c-p*s,e[5]=u*a-p*i,e[6]=h,e[7]=l,e[8]=f,e}function Vf(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=s*t[3],e[4]=s*t[4],e[5]=s*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function MM(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[3]=l-M,e[6]=p+m,e[1]=l+M,e[4]=1-h-d,e[7]=u-g,e[2]=p-m,e[5]=u+g,e[8]=1-h-f,e}var qf;(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"})(qf||(qf={}));var pv=Object.freeze([1,0,0,0,1,0,0,0,1]),ft=class extends Pc{static get IDENTITY(){return dv()}static get ZERO(){return uv()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return qf}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(pv)}fromObject(t){return this.check()}fromQuaternion(t){return MM(this,t),this.check()}set(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=h,this.check()}determinant(){return mM(this)}transpose(){return uM(this,this),this.check()}invert(){return dM(this,this),this.check()}multiplyLeft(t){return zf(this,t,this),this.check()}multiplyRight(t){return zf(this,this,t),this.check()}rotate(t){return xM(this,this,t),this.check()}scale(t){return Array.isArray(t)?Vf(this,this,t):Vf(this,this,[t,t]),this.check()}translate(t){return gM(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=nM(n||[-0,-0],t,this);break;case 3:r=Rc(n||[-0,-0,-0],t,this);break;case 4:r=Bc(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Cc(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},Oc,vc=null;function uv(){return Oc||(Oc=new ft([0,0,0,0,0,0,0,0,0]),Object.freeze(Oc)),Oc}function dv(){return vc||(vc=new ft,Object.freeze(vc)),vc}var yi={};Tt(yi,{add:()=>$v,adjoint:()=>Tv,clone:()=>gv,copy:()=>xv,create:()=>mv,decompose:()=>Gv,determinant:()=>_v,equals:()=>r4,exactEquals:()=>n4,frob:()=>Zv,fromQuat:()=>qv,fromQuat2:()=>Fv,fromRotation:()=>Pv,fromRotationTranslation:()=>EM,fromRotationTranslationScale:()=>zv,fromRotationTranslationScaleOrigin:()=>Vv,fromScaling:()=>Iv,fromTranslation:()=>wv,fromValues:()=>Mv,fromXRotation:()=>Ov,fromYRotation:()=>vv,fromZRotation:()=>Nv,frustum:()=>kv,getRotation:()=>Uv,getScaling:()=>TM,getTranslation:()=>Dv,identity:()=>AM,invert:()=>Ev,lookAt:()=>Xv,mul:()=>s4,multiply:()=>yM,multiplyScalar:()=>t4,multiplyScalarAndAdd:()=>e4,ortho:()=>Jv,orthoNO:()=>SM,orthoZO:()=>jv,perspective:()=>Hv,perspectiveFromFieldOfView:()=>Wv,perspectiveNO:()=>_M,perspectiveZO:()=>Yv,rotate:()=>Bv,rotateX:()=>Lv,rotateY:()=>Rv,rotateZ:()=>bv,scale:()=>Cv,set:()=>Av,str:()=>Qv,sub:()=>i4,subtract:()=>CM,targetTo:()=>Kv,translate:()=>Sv,transpose:()=>yv});function mv(){let e=new lt(16);return lt!=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 gv(e){let t=new lt(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 xv(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 Mv(e,t,n,r,s,i,o,c,a,h,l,f,p,u,d,g){let m=new lt(16);return m[0]=e,m[1]=t,m[2]=n,m[3]=r,m[4]=s,m[5]=i,m[6]=o,m[7]=c,m[8]=a,m[9]=h,m[10]=l,m[11]=f,m[12]=p,m[13]=u,m[14]=d,m[15]=g,m}function Av(e,t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=i,e[5]=o,e[6]=c,e[7]=a,e[8]=h,e[9]=l,e[10]=f,e[11]=p,e[12]=u,e[13]=d,e[14]=g,e[15]=m,e}function AM(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 yv(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}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 Ev(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,C=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,b=f*M-u*g,w=p*M-u*m,B=E*w-A*b+y*R+T*x-_*S+L*C;return B?(B=1/B,e[0]=(c*w-a*b+h*R)*B,e[1]=(s*b-r*w-i*R)*B,e[2]=(g*L-m*_+M*T)*B,e[3]=(p*_-f*L-u*T)*B,e[4]=(a*x-o*w-h*S)*B,e[5]=(n*w-s*x+i*S)*B,e[6]=(m*y-d*L-M*A)*B,e[7]=(l*L-p*y+u*A)*B,e[8]=(o*b-c*x+h*C)*B,e[9]=(r*x-n*b-i*C)*B,e[10]=(d*_-g*y+M*E)*B,e[11]=(f*y-l*_-u*E)*B,e[12]=(c*S-o*R-a*C)*B,e[13]=(n*R-r*S+s*C)*B,e[14]=(g*A-d*T-m*E)*B,e[15]=(l*T-f*A+p*E)*B,e):null}function Tv(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,C=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,b=f*M-u*g,w=p*M-u*m;return e[0]=c*w-a*b+h*R,e[1]=s*b-r*w-i*R,e[2]=g*L-m*_+M*T,e[3]=p*_-f*L-u*T,e[4]=a*x-o*w-h*S,e[5]=n*w-s*x+i*S,e[6]=m*y-d*L-M*A,e[7]=l*L-p*y+u*A,e[8]=o*b-c*x+h*C,e[9]=r*x-n*b-i*C,e[10]=d*_-g*y+M*E,e[11]=f*y-l*_-u*E,e[12]=c*S-o*R-a*C,e[13]=n*R-r*S+s*C,e[14]=g*A-d*T-m*E,e[15]=l*T-f*A+p*E,e}function _v(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8],l=e[9],f=e[10],p=e[11],u=e[12],d=e[13],g=e[14],m=e[15],M=t*o-n*i,E=t*c-r*i,A=n*c-r*o,y=h*d-l*u,T=h*g-f*u,_=l*g-f*d,L=t*_-n*T+r*y,C=i*_-o*T+c*y,S=h*A-l*E+f*M,x=u*A-d*E+g*M;return a*L-s*C+m*S-p*x}function yM(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=t[9],u=t[10],d=t[11],g=t[12],m=t[13],M=t[14],E=t[15],A=n[0],y=n[1],T=n[2],_=n[3];return e[0]=A*r+y*c+T*f+_*g,e[1]=A*s+y*a+T*p+_*m,e[2]=A*i+y*h+T*u+_*M,e[3]=A*o+y*l+T*d+_*E,A=n[4],y=n[5],T=n[6],_=n[7],e[4]=A*r+y*c+T*f+_*g,e[5]=A*s+y*a+T*p+_*m,e[6]=A*i+y*h+T*u+_*M,e[7]=A*o+y*l+T*d+_*E,A=n[8],y=n[9],T=n[10],_=n[11],e[8]=A*r+y*c+T*f+_*g,e[9]=A*s+y*a+T*p+_*m,e[10]=A*i+y*h+T*u+_*M,e[11]=A*o+y*l+T*d+_*E,A=n[12],y=n[13],T=n[14],_=n[15],e[12]=A*r+y*c+T*f+_*g,e[13]=A*s+y*a+T*p+_*m,e[14]=A*i+y*h+T*u+_*M,e[15]=A*o+y*l+T*d+_*E,e}function Sv(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,h,l,f,p,u,d,g,m,M;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],h=t[3],l=t[4],f=t[5],p=t[6],u=t[7],d=t[8],g=t[9],m=t[10],M=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=p,e[7]=u,e[8]=d,e[9]=g,e[10]=m,e[11]=M,e[12]=o*r+l*s+d*i+t[12],e[13]=c*r+f*s+g*i+t[13],e[14]=a*r+p*s+m*i+t[14],e[15]=h*r+u*s+M*i+t[15]),e}function Cv(e,t,n){let r=n[0],s=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Bv(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,h,l,f,p,u,d,g,m,M,E,A,y,T,_,L,C,S,x,R,b,w,B,v;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,h=Math.sin(n),a=Math.cos(n),l=1-a,f=t[0],p=t[1],u=t[2],d=t[3],g=t[4],m=t[5],M=t[6],E=t[7],A=t[8],y=t[9],T=t[10],_=t[11],L=s*s*l+a,C=i*s*l+o*h,S=o*s*l-i*h,x=s*i*l-o*h,R=i*i*l+a,b=o*i*l+s*h,w=s*o*l+i*h,B=i*o*l-s*h,v=o*o*l+a,e[0]=f*L+g*C+A*S,e[1]=p*L+m*C+y*S,e[2]=u*L+M*C+T*S,e[3]=d*L+E*C+_*S,e[4]=f*x+g*R+A*b,e[5]=p*x+m*R+y*b,e[6]=u*x+M*R+T*b,e[7]=d*x+E*R+_*b,e[8]=f*w+g*B+A*v,e[9]=p*w+m*B+y*v,e[10]=u*w+M*B+T*v,e[11]=d*w+E*B+_*v,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function Lv(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],h=t[8],l=t[9],f=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=i*s+h*r,e[5]=o*s+l*r,e[6]=c*s+f*r,e[7]=a*s+p*r,e[8]=h*s-i*r,e[9]=l*s-o*r,e[10]=f*s-c*r,e[11]=p*s-a*r,e}function Rv(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[8],l=t[9],f=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s-h*r,e[1]=o*s-l*r,e[2]=c*s-f*r,e[3]=a*s-p*r,e[8]=i*r+h*s,e[9]=o*r+l*s,e[10]=c*r+f*s,e[11]=a*r+p*s,e}function bv(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[4],l=t[5],f=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s+h*r,e[1]=o*s+l*r,e[2]=c*s+f*r,e[3]=a*s+p*r,e[4]=h*s-i*r,e[5]=l*s-o*r,e[6]=f*s-c*r,e[7]=p*s-a*r,e}function wv(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 Iv(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 Pv(e,t,n){let r=n[0],s=n[1],i=n[2],o=Math.sqrt(r*r+s*s+i*i),c,a,h;return o<1e-6?null:(o=1/o,r*=o,s*=o,i*=o,a=Math.sin(t),c=Math.cos(t),h=1-c,e[0]=r*r*h+c,e[1]=s*r*h+i*a,e[2]=i*r*h-s*a,e[3]=0,e[4]=r*s*h-i*a,e[5]=s*s*h+c,e[6]=i*s*h+r*a,e[7]=0,e[8]=r*i*h+s*a,e[9]=s*i*h-r*a,e[10]=i*i*h+c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function Ov(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=n,e[7]=0,e[8]=0,e[9]=-n,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function vv(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Nv(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=0,e[4]=-n,e[5]=r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function EM(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=r+r,a=s+s,h=i+i,l=r*c,f=r*a,p=r*h,u=s*a,d=s*h,g=i*h,m=o*c,M=o*a,E=o*h;return e[0]=1-(u+g),e[1]=f+E,e[2]=p-M,e[3]=0,e[4]=f-E,e[5]=1-(l+g),e[6]=d+m,e[7]=0,e[8]=p+M,e[9]=d-m,e[10]=1-(l+u),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function Fv(e,t){let n=new lt(3),r=-t[0],s=-t[1],i=-t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=r*r+s*s+i*i+o*o;return f>0?(n[0]=(c*o+l*r+a*i-h*s)*2/f,n[1]=(a*o+l*s+h*r-c*i)*2/f,n[2]=(h*o+l*i+c*s-a*r)*2/f):(n[0]=(c*o+l*r+a*i-h*s)*2,n[1]=(a*o+l*s+h*r-c*i)*2,n[2]=(h*o+l*i+c*s-a*r)*2),EM(e,t,n),e}function Dv(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function TM(e,t){let n=t[0],r=t[1],s=t[2],i=t[4],o=t[5],c=t[6],a=t[8],h=t[9],l=t[10];return e[0]=Math.sqrt(n*n+r*r+s*s),e[1]=Math.sqrt(i*i+o*o+c*c),e[2]=Math.sqrt(a*a+h*h+l*l),e}function Uv(e,t){let n=new lt(3);TM(n,t);let r=1/n[0],s=1/n[1],i=1/n[2],o=t[0]*r,c=t[1]*s,a=t[2]*i,h=t[4]*r,l=t[5]*s,f=t[6]*i,p=t[8]*r,u=t[9]*s,d=t[10]*i,g=o+l+d,m=0;return g>0?(m=Math.sqrt(g+1)*2,e[3]=.25*m,e[0]=(f-u)/m,e[1]=(p-a)/m,e[2]=(c-h)/m):o>l&&o>d?(m=Math.sqrt(1+o-l-d)*2,e[3]=(f-u)/m,e[0]=.25*m,e[1]=(c+h)/m,e[2]=(p+a)/m):l>d?(m=Math.sqrt(1+l-o-d)*2,e[3]=(p-a)/m,e[0]=(c+h)/m,e[1]=.25*m,e[2]=(f+u)/m):(m=Math.sqrt(1+d-o-l)*2,e[3]=(c-h)/m,e[0]=(p+a)/m,e[1]=(f+u)/m,e[2]=.25*m),e}function Gv(e,t,n,r){t[0]=r[12],t[1]=r[13],t[2]=r[14];let s=r[0],i=r[1],o=r[2],c=r[4],a=r[5],h=r[6],l=r[8],f=r[9],p=r[10];n[0]=Math.sqrt(s*s+i*i+o*o),n[1]=Math.sqrt(c*c+a*a+h*h),n[2]=Math.sqrt(l*l+f*f+p*p);let u=1/n[0],d=1/n[1],g=1/n[2],m=s*u,M=i*d,E=o*g,A=c*u,y=a*d,T=h*g,_=l*u,L=f*d,C=p*g,S=m+y+C,x=0;return S>0?(x=Math.sqrt(S+1)*2,e[3]=.25*x,e[0]=(T-L)/x,e[1]=(_-E)/x,e[2]=(M-A)/x):m>y&&m>C?(x=Math.sqrt(1+m-y-C)*2,e[3]=(T-L)/x,e[0]=.25*x,e[1]=(M+A)/x,e[2]=(_+E)/x):y>C?(x=Math.sqrt(1+y-m-C)*2,e[3]=(_-E)/x,e[0]=(M+A)/x,e[1]=.25*x,e[2]=(T+L)/x):(x=Math.sqrt(1+C-m-y)*2,e[3]=(M-A)/x,e[0]=(_+E)/x,e[1]=(T+L)/x,e[2]=.25*x),e}function zv(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=s+s,h=i+i,l=o+o,f=s*a,p=s*h,u=s*l,d=i*h,g=i*l,m=o*l,M=c*a,E=c*h,A=c*l,y=r[0],T=r[1],_=r[2];return e[0]=(1-(d+m))*y,e[1]=(p+A)*y,e[2]=(u-E)*y,e[3]=0,e[4]=(p-A)*T,e[5]=(1-(f+m))*T,e[6]=(g+M)*T,e[7]=0,e[8]=(u+E)*_,e[9]=(g-M)*_,e[10]=(1-(f+d))*_,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function Vv(e,t,n,r,s){let i=t[0],o=t[1],c=t[2],a=t[3],h=i+i,l=o+o,f=c+c,p=i*h,u=i*l,d=i*f,g=o*l,m=o*f,M=c*f,E=a*h,A=a*l,y=a*f,T=r[0],_=r[1],L=r[2],C=s[0],S=s[1],x=s[2],R=(1-(g+M))*T,b=(u+y)*T,w=(d-A)*T,B=(u-y)*_,v=(1-(p+M))*_,H=(m+E)*_,V=(d+A)*L,tt=(m-E)*L,Y=(1-(p+g))*L;return e[0]=R,e[1]=b,e[2]=w,e[3]=0,e[4]=B,e[5]=v,e[6]=H,e[7]=0,e[8]=V,e[9]=tt,e[10]=Y,e[11]=0,e[12]=n[0]+C-(R*C+B*S+V*x),e[13]=n[1]+S-(b*C+v*S+tt*x),e[14]=n[2]+x-(w*C+H*S+Y*x),e[15]=1,e}function qv(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[1]=l+M,e[2]=p-m,e[3]=0,e[4]=l-M,e[5]=1-h-d,e[6]=u+g,e[7]=0,e[8]=p+m,e[9]=u-g,e[10]=1-h-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function kv(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),h=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*h,e[15]=0,e}function _M(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var Hv=_M;function Yv(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let o=1/(r-s);e[10]=s*o,e[14]=s*r*o}else e[10]=-1,e[14]=-r;return e}function Wv(e,t,n,r){let s=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),c=Math.tan(t.rightDegrees*Math.PI/180),a=2/(o+c),h=2/(s+i);return e[0]=a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=h,e[6]=0,e[7]=0,e[8]=-((o-c)*a*.5),e[9]=(s-i)*h*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function SM(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*h,e[15]=1,e}var Jv=SM;function jv(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=i*h,e[15]=1,e}function Xv(e,t,n,r){let s,i,o,c,a,h,l,f,p,u,d=t[0],g=t[1],m=t[2],M=r[0],E=r[1],A=r[2],y=n[0],T=n[1],_=n[2];return Math.abs(d-y)<1e-6&&Math.abs(g-T)<1e-6&&Math.abs(m-_)<1e-6?AM(e):(f=d-y,p=g-T,u=m-_,s=1/Math.sqrt(f*f+p*p+u*u),f*=s,p*=s,u*=s,i=E*u-A*p,o=A*f-M*u,c=M*p-E*f,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-u*o,h=u*i-f*c,l=f*o-p*i,s=Math.sqrt(a*a+h*h+l*l),s?(s=1/s,a*=s,h*=s,l*=s):(a=0,h=0,l=0),e[0]=i,e[1]=a,e[2]=f,e[3]=0,e[4]=o,e[5]=h,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=0,e[12]=-(i*d+o*g+c*m),e[13]=-(a*d+h*g+l*m),e[14]=-(f*d+p*g+u*m),e[15]=1,e)}function Kv(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=r[0],a=r[1],h=r[2],l=s-n[0],f=i-n[1],p=o-n[2],u=l*l+f*f+p*p;u>0&&(u=1/Math.sqrt(u),l*=u,f*=u,p*=u);let d=a*p-h*f,g=h*l-c*p,m=c*f-a*l;return u=d*d+g*g+m*m,u>0&&(u=1/Math.sqrt(u),d*=u,g*=u,m*=u),e[0]=d,e[1]=g,e[2]=m,e[3]=0,e[4]=f*m-p*g,e[5]=p*d-l*m,e[6]=l*g-f*d,e[7]=0,e[8]=l,e[9]=f,e[10]=p,e[11]=0,e[12]=s,e[13]=i,e[14]=o,e[15]=1,e}function Qv(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 Zv(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 $v(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function CM(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function t4(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function e4(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function n4(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 r4(e,t){let n=e[0],r=e[1],s=e[2],i=e[3],o=e[4],c=e[5],a=e[6],h=e[7],l=e[8],f=e[9],p=e[10],u=e[11],d=e[12],g=e[13],m=e[14],M=e[15],E=t[0],A=t[1],y=t[2],T=t[3],_=t[4],L=t[5],C=t[6],S=t[7],x=t[8],R=t[9],b=t[10],w=t[11],B=t[12],v=t[13],H=t[14],V=t[15];return Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(r-A)<=1e-6*Math.max(1,Math.abs(r),Math.abs(A))&&Math.abs(s-y)<=1e-6*Math.max(1,Math.abs(s),Math.abs(y))&&Math.abs(i-T)<=1e-6*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(o-_)<=1e-6*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(c-L)<=1e-6*Math.max(1,Math.abs(c),Math.abs(L))&&Math.abs(a-C)<=1e-6*Math.max(1,Math.abs(a),Math.abs(C))&&Math.abs(h-S)<=1e-6*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(l-x)<=1e-6*Math.max(1,Math.abs(l),Math.abs(x))&&Math.abs(f-R)<=1e-6*Math.max(1,Math.abs(f),Math.abs(R))&&Math.abs(p-b)<=1e-6*Math.max(1,Math.abs(p),Math.abs(b))&&Math.abs(u-w)<=1e-6*Math.max(1,Math.abs(u),Math.abs(w))&&Math.abs(d-B)<=1e-6*Math.max(1,Math.abs(d),Math.abs(B))&&Math.abs(g-v)<=1e-6*Math.max(1,Math.abs(g),Math.abs(v))&&Math.abs(m-H)<=1e-6*Math.max(1,Math.abs(m),Math.abs(H))&&Math.abs(M-V)<=1e-6*Math.max(1,Math.abs(M),Math.abs(V))}var s4=yM,i4=CM;function o4(){let e=new lt(4);return lt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function BM(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function LM(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function RM(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function bM(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function wM(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function IM(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function PM(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function OM(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2],h=n[3],l=h*r+c*i-a*s,f=h*s+a*r-o*i,p=h*i+o*s-c*r,u=-o*r-c*s-a*i;return e[0]=l*h+u*-o+f*-a-p*-c,e[1]=f*h+u*-c+p*-o-l*-a,e[2]=p*h+u*-a+l*-c-f*-o,e[3]=t[3],e}var PX=function(){let e=o4();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();function vM(){let e=new lt(4);return lt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function NM(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function kf(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function Hf(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*l+o*c+s*h-i*a,e[1]=s*l+o*a+i*c-r*h,e[2]=i*l+o*h+r*a-s*c,e[3]=o*l-r*c-s*a-i*h,e}function FM(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function DM(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function UM(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function GM(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function Ei(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],h=n[1],l=n[2],f=n[3],p,u,d,g,m;return p=s*a+i*h+o*l+c*f,p<0&&(p=-p,a=-a,h=-h,l=-l,f=-f),1-p>1e-6?(u=Math.acos(p),m=Math.sin(u),d=Math.sin((1-r)*u)/m,g=Math.sin(r*u)/m):(d=1-r,g=r),e[0]=d*s+g*a,e[1]=d*i+g*h,e[2]=d*o+g*l,e[3]=d*c+g*f,e}function zM(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function VM(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Yf(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}var qM=BM;var kM=LM,HM=IM,YM=PM,WM=RM;var JM=bM;var jM=wM;var XM=function(){let e=Ff(),t=Df(1,0,0),n=Df(0,1,0);return function(r,s,i){let o=Uf(s,i);return o<-.999999?(jr(e,t,s),fM(e)<1e-6&&jr(e,n,s),oM(e,e),kf(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(jr(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,jM(r,r))}}(),UX=function(){let e=vM(),t=vM();return function(n,r,s,i,o,c){return Ei(e,r,o,c),Ei(t,s,i,c),Ei(n,e,t,2*c*(1-c)),n}}(),GX=function(){let e=pM();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],jM(t,Yf(t,e))}}();var a4=[0,0,0,1],Kr=class extends _n{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return Yf(this,t),this.check()}fromAxisRotation(t,n){return kf(this,t,n),this.check()}identity(){return NM(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=j(t)}get y(){return this[1]}set y(t){this[1]=j(t)}get z(){return this[2]}set z(t){this[2]=j(t)}get w(){return this[3]}set w(t){this[3]=j(t)}len(){return WM(this)}lengthSquared(){return JM(this)}dot(t){return HM(this,t)}rotationTo(t,n){return XM(this,t,n),this.check()}add(t){return qM(this,this,t),this.check()}calculateW(){return GM(this,this),this.check()}conjugate(){return VM(this,this),this.check()}invert(){return zM(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(YM(this,t,n,r),this.check())}multiplyRight(t){return Hf(this,this,t),this.check()}multiplyLeft(t){return Hf(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return FM(this,this,t),this.check()}rotateY(t){return DM(this,this,t),this.check()}rotateZ(t){return UM(this,this,t),this.check()}scale(t){return kM(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=a4,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return Ei(this,s,i,o),this.check()}transformVector4(t,n=new Xr){return OM(n,t,this),Cc(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Qr={};Tt(Qr,{EPSILON1:()=>h4,EPSILON10:()=>M4,EPSILON11:()=>A4,EPSILON12:()=>y4,EPSILON13:()=>E4,EPSILON14:()=>T4,EPSILON15:()=>_4,EPSILON16:()=>S4,EPSILON17:()=>C4,EPSILON18:()=>B4,EPSILON19:()=>L4,EPSILON2:()=>l4,EPSILON20:()=>R4,EPSILON3:()=>f4,EPSILON4:()=>p4,EPSILON5:()=>u4,EPSILON6:()=>d4,EPSILON7:()=>m4,EPSILON8:()=>g4,EPSILON9:()=>x4,PI_OVER_FOUR:()=>w4,PI_OVER_SIX:()=>I4,PI_OVER_TWO:()=>b4,TWO_PI:()=>P4});var h4=.1,l4=.01,f4=.001,p4=1e-4,u4=1e-5,d4=1e-6,m4=1e-7,g4=1e-8,x4=1e-9,M4=1e-10,A4=1e-11,y4=1e-12,E4=1e-13,T4=1e-14,_4=1e-15,S4=1e-16,C4=1e-17,B4=1e-18,L4=1e-19,R4=1e-20,b4=Math.PI/2,w4=Math.PI/4,I4=Math.PI/6,P4=Math.PI*2;var xK=new N,MK=new N;var Ti=new N,KM=new N,se=class{constructor(t=[0,0,0],n=0){this.radius=-0,this.center=new N,this.fromCenterRadius(t,n)}fromCenterRadius(t,n){return this.center.from(t),this.radius=n,this}fromCornerPoints(t,n){return n=Ti.from(n),this.center=new N().from(t).add(n).scale(.5),this.radius=this.center.distance(n),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new se(this.center,this.radius)}union(t){let n=this.center,r=this.radius,s=t.center,i=t.radius,o=Ti.copy(s).subtract(n),c=o.magnitude();if(r>=c+i)return this.clone();if(i>=c+r)return t.clone();let a=(r+c+i)*.5;return KM.copy(o).scale((-r+a)/c).add(n),this.center.copy(KM),this.radius=a,this}expand(t){let r=Ti.from(t).subtract(this.center).magnitude();return r>this.radius&&(this.radius=r),this}transform(t){this.center.transform(t);let n=yi.getScaling(Ti,t);return this.radius=Math.max(n[0],Math.max(n[1],n[2]))*this.radius,this}distanceSquaredTo(t){let n=this.distanceTo(t);return n*n}distanceTo(t){let r=Ti.from(t).subtract(this.center);return Math.max(0,r.len()-this.radius)}intersectPlane(t){let n=this.center,r=this.radius,i=t.normal.dot(n)+t.distance;return i<-r?Ct.OUTSIDE:i<r?Ct.INTERSECTING:Ct.INSIDE}};var O4=new N,v4=new N,Nc=new N,Fc=new N,Dc=new N,N4=new N,F4=new N,Je={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},xe=class{constructor(t=[0,0,0],n=[0,0,0,0,0,0,0,0,0]){this.center=new N().from(t),this.halfAxes=new ft(n)}get halfSize(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new N(t).len(),new N(n).len(),new N(r).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),s=new N(t).normalize(),i=new N(n).normalize(),o=new N(r).normalize();return new Kr().fromMatrix3(new ft([...s,...i,...o]))}fromCenterHalfSizeQuaternion(t,n,r){let s=new Kr(r),i=new ft().fromQuaternion(s);return i[0]=i[0]*n[0],i[1]=i[1]*n[0],i[2]=i[2]*n[0],i[3]=i[3]*n[1],i[4]=i[4]*n[1],i[5]=i[5]*n[1],i[6]=i[6]*n[2],i[7]=i[7]*n[2],i[8]=i[8]*n[2],this.center=new N().from(t),this.halfAxes=i,this}clone(){return new xe(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new se){let n=this.halfAxes,r=n.getColumn(0,Nc),s=n.getColumn(1,Fc),i=n.getColumn(2,Dc),o=O4.copy(r).add(s).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let n=this.center,r=t.normal,s=this.halfAxes,i=r.x,o=r.y,c=r.z,a=Math.abs(i*s[Je.COLUMN0ROW0]+o*s[Je.COLUMN0ROW1]+c*s[Je.COLUMN0ROW2])+Math.abs(i*s[Je.COLUMN1ROW0]+o*s[Je.COLUMN1ROW1]+c*s[Je.COLUMN1ROW2])+Math.abs(i*s[Je.COLUMN2ROW0]+o*s[Je.COLUMN2ROW1]+c*s[Je.COLUMN2ROW2]),h=r.dot(n)+t.distance;return h<=-a?Ct.OUTSIDE:h>=a?Ct.INSIDE:Ct.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=v4.from(t).subtract(this.center),r=this.halfAxes,s=r.getColumn(0,Nc),i=r.getColumn(1,Fc),o=r.getColumn(2,Dc),c=s.magnitude(),a=i.magnitude(),h=o.magnitude();s.normalize(),i.normalize(),o.normalize();let l=0,f;return f=Math.abs(n.dot(s))-c,f>0&&(l+=f*f),f=Math.abs(n.dot(i))-a,f>0&&(l+=f*f),f=Math.abs(n.dot(o))-h,f>0&&(l+=f*f),l}computePlaneDistances(t,n,r=[-0,-0]){let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=this.center,c=this.halfAxes,a=c.getColumn(0,Nc),h=c.getColumn(1,Fc),l=c.getColumn(2,Dc),f=N4.copy(a).add(h).add(l).add(o),p=F4.copy(f).subtract(t),u=n.dot(p);return s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).add(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).subtract(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).subtract(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).add(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).add(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).subtract(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).subtract(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),r[0]=s,r[1]=i,r}transform(t){this.center.transformAsPoint(t);let n=this.halfAxes.getColumn(0,Nc);n.transformAsPoint(t);let r=this.halfAxes.getColumn(1,Fc);r.transformAsPoint(t);let s=this.halfAxes.getColumn(2,Dc);return s.transformAsPoint(t),this.halfAxes=new ft([...n,...r,...s]),this}getTransform(){throw new Error("not implemented")}};var QM=new N,ZM=new N,vt=class{constructor(t=[0,0,1],n=0){this.normal=new N,this.distance=-0,this.fromNormalDistance(t,n)}fromNormalDistance(t,n){return Pe(Number.isFinite(n)),this.normal.from(t).normalize(),this.distance=n,this}fromPointNormal(t,n){t=QM.from(t),this.normal.from(n).normalize();let r=-this.normal.dot(t);return this.distance=r,this}fromCoefficients(t,n,r,s){return this.normal.set(t,n,r),Pe(Tn(this.normal.len(),1)),this.distance=s,this}clone(){return new vt(this.normal,this.distance)}equals(t){return Tn(this.distance,t.distance)&&Tn(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let n=ZM.copy(this.normal).transformAsVector(t).normalize(),r=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(r,n)}projectPointOntoPlane(t,n=[0,0,0]){let r=QM.from(t),s=this.getPointDistance(r),i=ZM.copy(this.normal).scale(s);return r.subtract(i).to(n)}};var $M=[new N([1,0,0]),new N([0,1,0]),new N([0,0,1])],tA=new N,D4=new N,Bt=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*$M.length;let n=t.center,r=t.radius,s=0;for(let i of $M){let o=this.planes[s],c=this.planes[s+1];o||(o=this.planes[s]=new vt),c||(c=this.planes[s+1]=new vt);let a=tA.copy(i).scale(-r).add(n);o.fromPointNormal(a,i);let h=tA.copy(i).scale(r).add(n),l=D4.copy(i).negate();c.fromPointNormal(h,l),s+=2}return this}computeVisibility(t){let n=Ct.INSIDE;for(let r of this.planes)switch(t.intersectPlane(r)){case Ct.OUTSIDE:return Ct.OUTSIDE;case Ct.INTERSECTING:n=Ct.INTERSECTING;break;default:}return n}computeVisibilityWithPlaneMask(t,n){if(Pe(Number.isFinite(n),"parentPlaneMask is required."),n===Bt.MASK_OUTSIDE||n===Bt.MASK_INSIDE)return n;let r=Bt.MASK_INSIDE,s=this.planes;for(let i=0;i<this.planes.length;++i){let o=i<31?1<<i:0;if(i<31&&!(n&o))continue;let c=s[i],a=t.intersectPlane(c);if(a===Ct.OUTSIDE)return Bt.MASK_OUTSIDE;a===Ct.INTERSECTING&&(r|=o)}return r}};Bt.MASK_OUTSIDE=4294967295;Bt.MASK_INSIDE=0;Bt.MASK_INDETERMINATE=2147483647;var DK=new N,UK=new N,GK=new N,zK=new N,VK=new N;var JK=new N,jK=new N,XK=new N,KK=new N,QK=new N,ZK=new N,$K=new N,tQ=new N,eQ=new N,nQ=new N,rQ=new N,sQ=new N;var Oe=new ft,G4=new ft,z4=new ft,Uc=new ft,eA=new ft;function jf(e,t={}){let n=Qr.EPSILON20,r=10,s=0,i=0,o=G4,c=z4;o.identity(),c.copy(e);let a=n*V4(c);for(;i<r&&q4(c)>a;)k4(c,Uc),eA.copy(Uc).transpose(),c.multiplyRight(Uc),c.multiplyLeft(eA),o.multiplyRight(Uc),++s>2&&(++i,s=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=c.toTarget(t.diagonal),t}function V4(e){let t=0;for(let n=0;n<9;++n){let r=e[n];t+=r*r}return Math.sqrt(t)}var Wf=[1,0,0],Jf=[2,2,1];function q4(e){let t=0;for(let n=0;n<3;++n){let r=e[Oe.getElementIndex(Jf[n],Wf[n])];t+=2*r*r}return Math.sqrt(t)}function k4(e,t){let n=Qr.EPSILON15,r=0,s=1;for(let h=0;h<3;++h){let l=Math.abs(e[Oe.getElementIndex(Jf[h],Wf[h])]);l>r&&(s=h,r=l)}let i=Wf[s],o=Jf[s],c=1,a=0;if(Math.abs(e[Oe.getElementIndex(o,i)])>n){let h=e[Oe.getElementIndex(o,o)],l=e[Oe.getElementIndex(i,i)],f=e[Oe.getElementIndex(o,i)],p=(h-l)/2/f,u;p<0?u=-1/(-p+Math.sqrt(1+p*p)):u=1/(p+Math.sqrt(1+p*p)),c=1/Math.sqrt(1+u*u),a=u*c}return ft.IDENTITY.to(t),t[Oe.getElementIndex(i,i)]=t[Oe.getElementIndex(o,o)]=c,t[Oe.getElementIndex(o,i)]=a,t[Oe.getElementIndex(i,o)]=-a,t}var Sn=new N,Y4=new N,W4=new N,J4=new N,j4=new N,X4=new ft,K4={diagonal:new ft,unitary:new ft};function Xf(e,t=new xe){if(!e||e.length===0)return t.halfAxes=new ft([0,0,0,0,0,0,0,0,0]),t.center=new N,t;let n=e.length,r=new N(0,0,0);for(let S of e)r.add(S);let s=1/n;r.multiplyByScalar(s);let i=0,o=0,c=0,a=0,h=0,l=0;for(let S of e){let x=Sn.copy(S).subtract(r);i+=x.x*x.x,o+=x.x*x.y,c+=x.x*x.z,a+=x.y*x.y,h+=x.y*x.z,l+=x.z*x.z}i*=s,o*=s,c*=s,a*=s,h*=s,l*=s;let f=X4;f[0]=i,f[1]=o,f[2]=c,f[3]=o,f[4]=a,f[5]=h,f[6]=c,f[7]=h,f[8]=l;let{unitary:p}=jf(f,K4),u=t.halfAxes.copy(p),d=u.getColumn(0,W4),g=u.getColumn(1,J4),m=u.getColumn(2,j4),M=-Number.MAX_VALUE,E=-Number.MAX_VALUE,A=-Number.MAX_VALUE,y=Number.MAX_VALUE,T=Number.MAX_VALUE,_=Number.MAX_VALUE;for(let S of e)Sn.copy(S),M=Math.max(Sn.dot(d),M),E=Math.max(Sn.dot(g),E),A=Math.max(Sn.dot(m),A),y=Math.min(Sn.dot(d),y),T=Math.min(Sn.dot(g),T),_=Math.min(Sn.dot(m),_);d=d.multiplyByScalar(.5*(y+M)),g=g.multiplyByScalar(.5*(T+E)),m=m.multiplyByScalar(.5*(_+A)),t.center.copy(d).add(g).add(m);let L=Y4.set(M-y,E-T,A-_).multiplyByScalar(.5),C=new ft([L[0],0,0,0,L[1],0,0,0,L[2]]);return t.halfAxes.multiplyRight(C),t}var nA=new F,Kf=new F,Qf=new Bt([new vt,new vt,new vt,new vt,new vt,new vt]);function sA(e,t){let{cameraDirection:n,cameraUp:r,height:s}=e,{metersPerUnit:i}=e.distanceScales,o=Gc(e,e.center),c=z.WGS84.eastNorthUpToFixedFrame(o),a=e.unprojectPosition(e.cameraPosition),h=z.WGS84.cartographicToCartesian(a,new F),l=new F(c.transformAsVector(new F(n).scale(i))).normalize(),f=new F(c.transformAsVector(new F(r).scale(i))).normalize();Q4(e);let p=e.constructor,{longitude:u,latitude:d,width:g,bearing:m,zoom:M}=e,E=new p({longitude:u,latitude:d,height:s,width:g,bearing:m,zoom:M,pitch:0});return{camera:{position:h,direction:l,up:f},viewport:e,topDownViewport:E,height:s,cullingVolume:Qf,frameNumber:t,sseDenominator:1.15}}function iA(e,t,n){if(n===0||e.length<=n)return[e,[]];let r=[],{longitude:s,latitude:i}=t.viewport;for(let[h,l]of e.entries()){let[f,p]=l.header.mbs,u=Math.abs(s-f),d=Math.abs(i-p),g=Math.sqrt(d*d+u*u);r.push([h,g])}let o=r.sort((h,l)=>h[1]-l[1]),c=[];for(let h=0;h<n;h++)c.push(e[o[h][0]]);let a=[];for(let h=n;h<o.length;h++)a.push(e[o[h][0]]);return[c,a]}function Q4(e){let t=e.getFrustumPlanes(),n=rA(t.near,e.cameraPosition),r=Gc(e,n),s=Gc(e,e.cameraPosition,Kf),i=0;Qf.planes[i++].fromPointNormal(r,nA.copy(r).subtract(s));for(let o in t){if(o==="near")continue;let c=t[o],a=rA(c,n,Kf),h=Gc(e,a,Kf);Qf.planes[i++].fromPointNormal(h,nA.copy(r).subtract(h))}}function rA(e,t,n=new F){let r=e.normal.dot(t);return n.copy(e.normal).scale(e.distance-r).add(t),n}function Gc(e,t,n=new F){let r=e.unprojectPosition(t);return z.WGS84.cartographicToCartesian(r,n)}var Z4=6378137,$4=6378137,Zf=6356752314245179e-9,Zr=new F;function oA(e,t){if(e instanceof xe){let{halfAxes:n}=e,r=tN(n);return Math.log2(Zf/(r+t[2]))}else if(e instanceof se){let{radius:n}=e;return Math.log2(Zf/(n+t[2]))}else if(e.width&&e.height){let{width:n,height:r}=e,s=Math.log2(Z4/n),i=Math.log2($4/r);return(s+i)/2}return 1}function $f(e,t,n){z.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],Zr);let r=Math.sqrt(Math.pow(Zr[0]-n[0],2)+Math.pow(Zr[1]-n[1],2)+Math.pow(Zr[2]-n[2],2));return Math.log2(Zf/(r+t[2]))}function cA(e,t,n){let[r,s,i,o]=e;return $f({xmin:r,xmax:i,ymin:s,ymax:o,zmin:0,zmax:0},t,n)}function tN(e){e.getColumn(0,Zr);let t=e.getColumn(1),n=e.getColumn(2);return Zr.add(t).add(n).len()}var SA=G(Fr(),1);var Ht={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Nt;(function(e){e[e.ADD=1]="ADD",e[e.REPLACE=2]="REPLACE"})(Nt||(Nt={}));var ie;(function(e){e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh"})(ie||(ie={}));var Lt;(function(e){e.I3S="I3S",e.TILES3D="TILES3D"})(Lt||(Lt={}));var je;(function(e){e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(je||(je={}));var aA={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function pA(e){return e!=null}var Ft=new F,zc=new F,eN=new F,nN=new F,Qn=new F,hA=new F,lA=new F,fA=new F;function Vc(e,t,n){if(q(e,"3D Tile: boundingVolume must be defined"),e.box)return dA(e.box,t,n);if(e.region)return sN(e.region);if(e.sphere)return rN(e.sphere,t,n);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function uA(e,t){if(e.box)return iN(t);if(e.region){let[n,r,s,i,o,c]=e.region;return[[ne(n),ne(r),o],[ne(s),ne(i),c]]}if(e.sphere)return oN(t);throw new Error("Unkown boundingVolume type")}function dA(e,t,n){let r=new F(e[0],e[1],e[2]);t.transform(r,r);let s=[];if(e.length===10){let h=e.slice(3,6),l=new gi;l.fromArray(e,6);let f=new F([1,0,0]),p=new F([0,1,0]),u=new F([0,0,1]);f.transformByQuaternion(l),f.scale(h[0]),p.transformByQuaternion(l),p.scale(h[1]),u.transformByQuaternion(l),u.scale(h[2]),s=[...f.toArray(),...p.toArray(),...u.toArray()]}else s=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let i=t.transformAsVector(s.slice(0,3)),o=t.transformAsVector(s.slice(3,6)),c=t.transformAsVector(s.slice(6,9)),a=new Kn([i[0],i[1],i[2],o[0],o[1],o[2],c[0],c[1],c[2]]);return pA(n)?(n.center=r,n.halfAxes=a,n):new xe(r,a)}function rN(e,t,n){let r=new F(e[0],e[1],e[2]);t.transform(r,r);let s=t.getScale(zc),i=Math.max(Math.max(s[0],s[1]),s[2]),o=e[3]*i;return pA(n)?(n.center=r,n.radius=o,n):new se(r,o)}function sN(e){let[t,n,r,s,i,o]=e,c=z.WGS84.cartographicToCartesian([ne(t),ne(s),i],eN),a=z.WGS84.cartographicToCartesian([ne(r),ne(n),o],nN),h=new F().addVectors(c,a).multiplyByScalar(.5);return z.WGS84.cartesianToCartographic(h,Qn),z.WGS84.cartographicToCartesian([ne(r),Qn[1],Qn[2]],hA),z.WGS84.cartographicToCartesian([Qn[0],ne(s),Qn[2]],lA),z.WGS84.cartographicToCartesian([Qn[0],Qn[1],o],fA),dA([...h,...hA.subtract(h),...lA.subtract(h),...fA.subtract(h)],new rt)}function iN(e){let t=mA(),{halfAxes:n}=e,r=new F(n.getColumn(0)),s=new F(n.getColumn(1)),i=new F(n.getColumn(2));for(let o=0;o<2;o++){for(let c=0;c<2;c++){for(let a=0;a<2;a++)Ft.copy(e.center),Ft.add(r),Ft.add(s),Ft.add(i),gA(t,Ft),i.negate();s.negate()}r.negate()}return t}function oN(e){let t=mA(),{center:n,radius:r}=e,s=z.WGS84.scaleToGeodeticSurface(n,Ft),i;s?i=z.WGS84.geodeticSurfaceNormal(s):i=new F(0,0,1);let o=new F(i[2],-i[1],0);o.len()>0?o.normalize():o=new F(0,1,0);let c=o.clone().cross(i);for(let a of[o,c,i]){zc.copy(a).scale(r);for(let h=0;h<2;h++)Ft.copy(n),Ft.add(zc),gA(t,Ft),zc.negate()}return t}function mA(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function gA(e,t){z.WGS84.cartesianToCartographic(t,Ft),e[0][0]=Math.min(e[0][0],Ft[0]),e[0][1]=Math.min(e[0][1],Ft[1]),e[0][2]=Math.min(e[0][2],Ft[2]),e[1][0]=Math.max(e[1][0],Ft[0]),e[1][1]=Math.max(e[1][1],Ft[1]),e[1][2]=Math.max(e[1][2],Ft[2])}var kQ=new F,HQ=new F,YQ=new rt,WQ=new F,JQ=new F,jQ=new F;function cN(e,t){let n=e*t;return 1-Math.exp(-(n*n))}function aN(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){let n=e.dynamicScreenSpaceErrorComputedDensity,r=e.dynamicScreenSpaceErrorFactor;return cN(t,n)*r}return 0}function xA(e,t,n){let r=e.tileset,s=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,i=n?s:e.lodMetricValue;if(i===0)return 0;let o=Math.max(e._distanceToCamera,1e-7),{height:c,sseDenominator:a}=t,{viewDistanceScale:h}=r.options,l=i*c*(h||1)/(o*a);return l-=aN(r,o),l}var t0=new F,MA=new F,Cn=new F,AA=new F,hN=new F,e0=new rt,yA=new rt;function EA(e,t){if(e.lodMetricValue===0||isNaN(e.lodMetricValue))return"DIG";let n=2*n0(e,t);return n<2?"OUT":!e.header.children||n<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}function n0(e,t){let{topDownViewport:n}=t,r=e.header.mbs[1],s=e.header.mbs[0],i=e.header.mbs[2],o=e.header.mbs[3],c=[...e.boundingVolume.center],a=n.unprojectPosition(n.cameraPosition);z.WGS84.cartographicToCartesian(a,t0),MA.copy(t0).subtract(c).normalize(),z.WGS84.eastNorthUpToFixedFrame(c,e0),yA.copy(e0).invert(),Cn.copy(t0).transform(yA);let h=Math.sqrt(Cn[0]*Cn[0]+Cn[1]*Cn[1]),l=h*h/Cn[2];AA.copy([Cn[0],Cn[1],l]);let p=AA.transform(e0).subtract(c).normalize(),d=MA.cross(p).normalize().scale(o).add(c),g=z.WGS84.cartesianToCartographic(d),m=n.project([s,r,i]),M=n.project(g);return hN.copy(m).subtract(M).magnitude()}function TA(e){return{assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}}var _i=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 q(t<this._array.length),this._array[t]}set(t,n){q(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=n,this._map.set(n,t)}delete(t){let n=this._map.get(t);n>=0&&(this._array.splice(n,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){let n=this.length++;this._array[n]=t,this._map.set(t,n)}}pop(){let t=this._array[--this.length];return this._map.delete(t),t}reserve(t){q(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){q(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 lN={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},ve=class{options;root=null;selectedTiles={};requestedTiles={};emptyTiles={};lastUpdate=new Date().getTime();updateDebounceTime=1e3;_traversalStack=new _i;_emptyTraversalStack=new _i;_frameNumber=null;traversalFinished(t){return!0}constructor(t){this.options={...lN,...t}}traverse(t,n,r){this.root=t,this.options={...this.options,...r},this.reset(),this.updateTile(t,n),this._frameNumber=n.frameNumber,this.executeTraversal(t,n)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,n){let r=this._traversalStack;for(t._selectionDepth=1,r.push(t);r.length>0;){let i=r.pop(),o=!1;this.canTraverse(i,n)&&(this.updateChildTiles(i,n),o=this.updateAndPushChildren(i,n,r,i.hasRenderContent?i._selectionDepth+1:i._selectionDepth));let c=i.parent,a=Boolean(!c||c._shouldRefine),h=!o;i.hasRenderContent?i.refine===Nt.ADD?(this.loadTile(i,n),this.selectTile(i,n)):i.refine===Nt.REPLACE&&(this.loadTile(i,n),h&&this.selectTile(i,n)):(this.emptyTiles[i.id]=i,this.loadTile(i,n),h&&this.selectTile(i,n)),this.touchTile(i,n),i._shouldRefine=o&&a}let s=new Date().getTime();(this.traversalFinished(n)||s-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=s,this.options.onTraversalEnd(n))}updateChildTiles(t,n){let r=t.children;for(let s of r)this.updateTile(s,n)}updateAndPushChildren(t,n,r,s){let{loadSiblings:i,skipLevelOfDetail:o}=this.options,c=t.children;c.sort(this.compareDistanceToCamera.bind(this));let a=t.refine===Nt.REPLACE&&t.hasRenderContent&&!o,h=!1,l=!0;for(let f of c)if(f._selectionDepth=s,f.isVisibleAndInRequestVolume?(r.find(f)&&r.delete(f),r.push(f),h=!0):(a||i)&&(this.loadTile(f,n),this.touchTile(f,n)),a){let p;if(f._inRequestVolume?f.hasRenderContent?p=f.contentAvailable:p=this.executeEmptyTraversal(f,n):p=!1,l=l&&p,!l)return!1}return h||(l=!1),l}updateTile(t,n){this.updateTileVisibility(t,n)}selectTile(t,n){this.shouldSelectTile(t)&&(t._selectedFrame=n.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,n){this.shouldLoadTile(t)&&(t._requestedFrame=n.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,n){t.tileset._cache.touch(t),t._touchedFrame=n.frameNumber}canTraverse(t,n,r=!1,s=!1){return t.hasChildren?t.hasTilesetContent?!t.contentExpired:!s&&!t.isVisibleAndInRequestVolume?!1:this.shouldRefine(t,n,r):!1}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,n,r=!1){let s=t._screenSpaceError;return r&&(s=t.getScreenSpaceError(n,!0)),s>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,n){let r=[];if(this.options.viewportTraversersMap)for(let s in this.options.viewportTraversersMap)this.options.viewportTraversersMap[s]===n.viewport.id&&r.push(s);else r.push(n.viewport.id);t.updateVisibility(n,r)}compareDistanceToCamera(t,n){return t._distanceToCamera-n._distanceToCamera}anyChildrenVisible(t,n){let r=!1;for(let s of t.children)s.updateVisibility(n),r=r||s.isVisibleAndInRequestVolume;return r}executeEmptyTraversal(t,n){let r=!0,s=this._emptyTraversalStack;for(s.push(t);s.length>0;){let i=s.pop(),o=!i.hasRenderContent&&this.canTraverse(i,n,!1,!1),c=!i.hasRenderContent&&i.children.length===0;if(!o&&!i.contentAvailable&&!c&&(r=!1),this.updateTile(i,n),i.isVisibleAndInRequestVolume||(this.loadTile(i,n),this.touchTile(i,n)),o){let a=i.children;for(let h of a)s.push(h)}}return r}};var _A=new F;function fN(e){return e!=null}var Zn=class{tileset;header;id;url;parent;refine;type;contentUrl;lodMetricType="geometricError";lodMetricValue=0;boundingVolume=null;content=null;contentState=Ht.UNLOADED;gpuMemoryUsageInBytes=0;children=[];depth=0;viewportIds=[];transform=new rt;extensions=null;implicitTiling=null;userData={};computedTransform;hasEmptyContent=!1;hasTilesetContent=!1;traverser=new ve({});_cacheNode=null;_frameNumber=null;_expireDate=null;_expiredContent=null;_boundingBox=void 0;_distanceToCamera=0;_screenSpaceError=0;_visibilityPlaneMask;_visible=void 0;_contentBoundingVolume;_viewerRequestVolume;_initialTransform=new rt;_priority=0;_selectedFrame=0;_requestedFrame=0;_selectionDepth=0;_touchedFrame=0;_centerZDepth=0;_shouldRefine=!1;_stackLength=0;_visitedFrame=0;_inRequestVolume=!1;_lodJudge=null;constructor(t,n,r,s=""){this.header=n,this.tileset=t,this.id=s||n.id,this.url=n.url,this.parent=r,this.refine=this._getRefine(n.refine),this.type=n.type,this.contentUrl=n.contentUrl,this._initializeLodMetric(n),this._initializeTransforms(n),this._initializeBoundingVolumes(n),this._initializeContent(n),this._initializeRenderingState(n),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===Ht.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===Ht.UNLOADED}get contentExpired(){return this.contentState===Ht.EXPIRED}get contentFailed(){return this.contentState===Ht.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=uA(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,n){switch(this.tileset.type){case Lt.I3S:return n0(this,t);case Lt.TILES3D:return xA(this,t,n);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){let t=this.tileset._traverser,{skipLevelOfDetail:n}=t.options,r=this.refine===Nt.ADD||n;if(r&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===Ht.UNLOADED)return-1;let s=this.parent,o=s&&(!r||this._screenSpaceError===0||s.hasTilesetContent)?s._screenSpaceError:this._screenSpaceError,c=t.root?t.root._screenSpaceError:0;return Math.max(c-o,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=Ht.LOADING;let n=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!n)return this.contentState=Ht.UNLOADED,!1;try{let r=this.tileset.getTileUrl(this.contentUrl),s=this.tileset.loader,i={...this.tileset.loadOptions,[s.id]:{...this.tileset.loadOptions[s.id],isTileset:this.type==="json",...this._getLoaderSpecificOptions(s.id)}};return this.content=await(0,SA.load)(r,s,i),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=Ht.READY,this._onContentLoaded(),!0}catch(r){throw this.contentState=Ht.FAILED,r}finally{n.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=Ht.UNLOADED,!0}updateVisibility(t,n){if(this._frameNumber===t.frameNumber)return;let r=this.parent,s=r?r._visibilityPlaneMask:Bt.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let i=r?r.computedTransform:this.tileset.modelMatrix;this._updateTransform(i)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,s),this._visible=this._visibilityPlaneMask!==Bt.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=n}visibility(t,n){let{cullingVolume:r}=t,{boundingVolume:s}=this;return r.computeVisibilityWithPlaneMask(s,n)}contentVisibility(){return!0}distanceToTile(t){let n=this.boundingVolume;return Math.sqrt(Math.max(n.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){let n=this.boundingVolume;return _A.subVectors(n.center,t.position),t.direction.dot(_A)}insideViewerRequestVolume(t){let n=this._viewerRequestVolume;return!n||n.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(fN(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=Ht.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 rt(t.transform):new rt;let n=this.parent,r=this.tileset,s=n&&n.computedTransform?n.computedTransform.clone():r.modelMatrix.clone();this.computedTransform=new rt(s).multiplyRight(this.transform);let i=n&&n._initialTransform?n._initialTransform.clone():new rt;this._initialTransform=new rt(i).multiplyRight(this.transform)}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=Ht.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=Bt.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||Nt.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=Vc(t.boundingVolume,this.computedTransform,this.boundingVolume);let n=t.content;n&&(n.boundingVolume&&(this._contentBoundingVolume=Vc(n.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=Vc(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new rt){let n=t.clone().multiplyRight(this.transform);n.equals(this.computedTransform)||(this.computedTransform=n,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(t){switch(t){case"i3s":return{...this.tileset.options.i3s,_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1};case"3d-tiles":case"cesium-ion":default:return TA(this.tileset.tileset)}}};var qc=class extends ve{compareDistanceToCamera(t,n){return n._distanceToCamera===0&&t._distanceToCamera===0?n._centerZDepth-t._centerZDepth:n._distanceToCamera-t._distanceToCamera}updateTileVisibility(t,n){if(super.updateTileVisibility(t,n),!t.isVisibleAndInRequestVolume)return;let r=t.children.length>0;if(t.hasTilesetContent&&r){let o=t.children[0];this.updateTileVisibility(o,n),t._visible=o._visible;return}if(this.meetsScreenSpaceErrorEarly(t,n)){t._visible=!1;return}let s=t.refine===Nt.REPLACE,i=t._optimChildrenWithinParent===aA.USE_OPTIMIZATION;if(s&&i&&r&&!this.anyChildrenVisible(t,n)){t._visible=!1;return}}meetsScreenSpaceErrorEarly(t,n){let{parent:r}=t;return!r||r.hasTilesetContent||r.refine!==Nt.ADD?!1:!this.shouldRefine(t,n,!0)}};var CA=G(Fr(),1);var kc=class{frameNumberMap=new Map;register(t,n){let r=this.frameNumberMap.get(t)||new Map,s=r.get(n)||0;r.set(n,s+1),this.frameNumberMap.set(t,r)}deregister(t,n){let r=this.frameNumberMap.get(t);if(!r)return;let s=r.get(n)||1;r.set(n,s-1)}isZero(t,n){return(this.frameNumberMap.get(t)?.get(n)||0)===0}};var r0={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},Hc=class{_statusMap;pendingTilesRegister=new kc;constructor(){this._statusMap={}}add(t,n,r,s){if(!this._statusMap[n]){let{frameNumber:i,viewport:{id:o}}=s;this._statusMap[n]={request:t,callback:r,key:n,frameState:s,status:r0.REQUESTED},this.pendingTilesRegister.register(o,i),t().then(c=>{this._statusMap[n].status=r0.COMPLETED;let{frameNumber:a,viewport:{id:h}}=this._statusMap[n].frameState;this.pendingTilesRegister.deregister(h,a),this._statusMap[n].callback(c,s)}).catch(c=>{this._statusMap[n].status=r0.ERROR;let{frameNumber:a,viewport:{id:h}}=this._statusMap[n].frameState;this.pendingTilesRegister.deregister(h,a),r(c)})}}update(t,n){if(this._statusMap[t]){let{frameNumber:r,viewport:{id:s}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(s,r);let{frameNumber:i,viewport:{id:o}}=n;this.pendingTilesRegister.register(o,i),this._statusMap[t].frameState=n}}find(t){return this._statusMap[t]}hasPendingTiles(t,n){return!this.pendingTilesRegister.isZero(t,n)}};var Yc=class extends ve{_tileManager;constructor(t){super(t),this._tileManager=new Hc}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,n){return t._lodJudge=EA(t,n),t._lodJudge==="DIG"}updateChildTiles(t,n){let r=t.header.children||[],s=t.children,i=t.tileset;for(let o of r){let c=`${o.id}-${n.viewport.id}`,a=s&&s.find(h=>h.id===c);if(a)a&&this.updateTile(a,n);else{let h=()=>this._loadTile(o.id,i);this._tileManager.find(c)?this._tileManager.update(c,n):(i.tileset.nodePages&&(h=()=>i.tileset.nodePagesTile.formTileFromNodePages(o.id)),this._tileManager.add(h,c,f=>this._onTileLoad(f,t,c),n))}}return!1}async _loadTile(t,n){let{loader:r}=n,s=n.getTileUrl(`${n.url}/nodes/${t}`),i={...n.loadOptions,i3s:{...n.loadOptions.i3s,isTileHeader:!0}};return await(0,CA.load)(s,r,i)}_onTileLoad(t,n,r){let s=new Zn(n.tileset,t,n,r);n.children.push(s);let i=this._tileManager.find(s.id).frameState;this.updateTile(s,i),this._frameNumber===i.frameNumber&&(this.traversalFinished(i)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(s,i)}};var pN={description:"",ellipsoid:z.WGS84,modelMatrix:new rt,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:{}},Wc="Tiles In Tileset(s)",s0="Tiles In Memory",BA="Tiles In View",LA="Tiles To Render",RA="Tiles Loaded",i0="Tiles Loading",bA="Tiles Unloaded",wA="Failed Tile Loads",IA="Points/Vertices",o0="Tile Memory Use",PA="Maximum Screen Space Error",Si=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 Sc;_requestScheduler;updatePromise=null;tilesetInitializationPromise;constructor(t,n){this.options={...pN,...n},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||hn.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 an({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 cn({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(t){this.options={...this.options,...t}}getTileUrl(t){if(t.startsWith("data:"))return t;let r=t;return this.queryParams.length&&(r=`${t}${t.includes("?")?"&":"?"}${this.queryParams}`),r}hasExtension(t){return Boolean(this._extensionsUsed.indexOf(t)>-1)}update(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(n=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),n(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytes<this._cacheBytes?this.memoryAdjustedScreenSpaceError=Math.max(this.memoryAdjustedScreenSpaceError/1.02,this.options.maximumScreenSpaceError):this.gpuMemoryUsageInBytes>this._cacheBytes+this._cacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let n=t instanceof Array?t:[t];this._cache.reset(),this._frameNumber++,this.traverseCounter=n.length;let r=[];for(let s of n){let i=s.id;this._needTraverse(i)?r.push(i):this.traverseCounter--}for(let s of n){let i=s.id;if(this.roots[i]||(this.roots[i]=this._initializeTileHeaders(this.tileset,null)),!r.includes(i))continue;let o=sA(s,this._frameNumber);this._traverser.traverse(this.roots[i],o,this.options)}}_needTraverse(t){let n=t;return this.options.viewportTraversersMap&&(n=this.options.viewportTraversersMap[t]),n===t}_onTraversalEnd(t){let n=t.viewport.id;this.frameStateData[n]||(this.frameStateData[n]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let r=this.frameStateData[n],s=Object.values(this._traverser.selectedTiles),[i,o]=iA(s,t,this.options.maximumTilesSelected);r.selectedTiles=i;for(let c of o)c.unselect();r._requestedTiles=Object.values(this._traverser.requestedTiles),r._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let t in this.frameStateData){let n=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(n.selectedTiles),this._requestedTiles=this._requestedTiles.concat(n._requestedTiles),this._emptyTiles=this._emptyTiles.concat(n._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(let t of this.selectedTiles)this._tiles[t.id]=t;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(t,n){if(t.length!==n.length)return!0;let r=new Set(t.map(o=>o.id)),s=new Set(n.map(o=>o.id)),i=t.filter(o=>!s.has(o.id)).length>0;return i=i||n.filter(o=>!r.has(o.id)).length>0,i}_loadTiles(){for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,n)=>t._unloadTile(n))}_updateStats(){let t=0,n=0;for(let r of this.selectedTiles)r.contentAvailable&&r.content&&(t++,r.content.pointCount?n+=r.content.pointCount:n+=r.content.vertexCount);this.stats.get(BA).count=this.selectedTiles.length,this.stats.get(LA).count=t,this.stats.get(IA).count=n,this.stats.get(PA).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(t){this.type===Lt.I3S&&(this.calculateViewPropsI3S(),t.root=await t.root),this.root=this._initializeTileHeaders(t,null),this.type===Lt.TILES3D&&(this._initializeTiles3DTileset(t),this.calculateViewPropsTiles3D()),this.type===Lt.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){let t=this.tileset.fullExtent;if(t){let{xmin:r,xmax:s,ymin:i,ymax:o,zmin:c,zmax:a}=t;this.cartographicCenter=new F(r+(s-r)/2,i+(o-i)/2,c+(a-c)/2),this.cartesianCenter=new F,z.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=$f(t,this.cartographicCenter,this.cartesianCenter);return}let n=this.tileset.store?.extent;if(n){let[r,s,i,o]=n;this.cartographicCenter=new F(r+(i-r)/2,s+(o-s)/2,0),this.cartesianCenter=new F,z.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=cA(n,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new F,this.zoom=1}calculateViewPropsTiles3D(){let t=this.root,{center:n}=t.boundingVolume;if(!n){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new F,this.zoom=1;return}n[0]!==0||n[1]!==0||n[2]!==0?(this.cartographicCenter=new F,z.WGS84.cartesianToCartographic(n,this.cartographicCenter)):this.cartographicCenter=new F(0,0,-z.WGS84.radii[0]),this.cartesianCenter=n,this.zoom=oA(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(Wc),this.stats.get(i0),this.stats.get(s0),this.stats.get(BA),this.stats.get(LA),this.stats.get(RA),this.stats.get(bA),this.stats.get(wA),this.stats.get(IA),this.stats.get(o0,"memory"),this.stats.get(PA)}_initializeTileHeaders(t,n){let r=new Zn(this,t.root,n);if(n&&(n.children.push(r),r.depth=n.depth+1),this.type===Lt.TILES3D){let s=[];for(s.push(r);s.length>0;){let i=s.pop();this.stats.get(Wc).incrementCount();let o=i.header.children||[];for(let c of o){let a=new Zn(this,c,i);if(a.contentUrl?.includes("?session=")){let l=new URL(a.contentUrl).searchParams.get("session");l&&(this._queryParams.session=l)}i.children.push(a),a.depth=i.depth+1,s.push(a)}}}return r}_initializeTraverser(){let t;switch(this.type){case Lt.TILES3D:t=qc;break;case Lt.I3S:t=Yc;break;default:t=ve}return new t({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let n;try{this._onStartTileLoading(),n=await t.loadContent()}catch(r){this._onTileLoadError(t,r instanceof Error?r:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(t,n)}}_onTileLoadError(t,n){this.stats.get(wA).incrementCount();let r=n.message||n.toString(),s=t.url;console.error(`A 3D tile failed to load: ${t.url} ${r}`),this.options.onTileError(t,r,s)}_onTileLoad(t,n){if(n){if(this.type===Lt.I3S){let r=this.tileset?.nodePagesTile?.nodesInNodePages||0;this.stats.get(Wc).reset(),this.stats.get(Wc).addCount(r)}t&&t.content&&$2(t,t.content),this.updateContentTypes(t),this._addTileToCache(t),this.options.onTileLoad(t)}}updateContentTypes(t){if(this.type===Lt.I3S)switch(t.header.isDracoGeometry&&(this.contentFormats.draco=!0),t.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}else if(this.type===Lt.TILES3D){let{extensionsRemoved:n=[]}=t.content?.gltf||{};n.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),n.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),n.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(i0).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(i0).decrementCount()}_addTileToCache(t){this._cache.add(this,t,n=>n._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(RA).incrementCount(),this.stats.get(s0).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(o0).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(s0).decrementCount(),this.stats.get(bA).incrementCount(),this.stats.get(o0).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){let t=[];for(this.root&&t.push(this.root);t.length>0;){let n=t.pop();for(let r of n.children)t.push(r);this._destroyTile(n)}this.root=null}_destroySubtree(t){let n=t,r=[];for(r.push(n);r.length>0;){t=r.pop();for(let s of t.children)r.push(s);t!==n&&this._destroyTile(t)}n.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeTiles3DTileset(t){if(t.queryString){let n=new URLSearchParams(t.queryString),r=Object.fromEntries(n.entries());this._queryParams={...this._queryParams,...r}}if(this.asset=t.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=t.properties,this.geometricError=t.geometricError,this._extensionsUsed=t.extensionsUsed||[],this.extras=t.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}};var Jc="4.2.1";var $n={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},kZ=Object.keys($n);function c0(e,t,n){q(e instanceof ArrayBuffer);let r=new TextDecoder("utf8"),s=new Uint8Array(e,t,n);return r.decode(s)}function OA(e,t=0){let n=new DataView(e);return`${String.fromCharCode(n.getUint8(t+0))}${String.fromCharCode(n.getUint8(t+1))}${String.fromCharCode(n.getUint8(t+2))}${String.fromCharCode(n.getUint8(t+3))}`}var vA="4.2.1";var NA={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:vA,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 FA(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 tr(e){let t=1/0,n=1/0,r=1/0,s=-1/0,i=-1/0,o=-1/0,c=e.POSITION?e.POSITION.value:[],a=c&&c.length;for(let h=0;h<a;h+=3){let l=c[h],f=c[h+1],p=c[h+2];t=l<t?l:t,n=f<n?f:n,r=p<r?p:r,s=l>s?l:s,i=f>i?f:i,o=p>o?p:o}return[[t,n,r],[s,i,o]]}function a0(e,t,n){let r=FA(t.value),s=n||DA(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:r}]},nullable:!1,metadata:s}}function DA(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 GA(e,t,n){let r=zA(t.metadata),s=[],i=uN(t.attributes);for(let o in e){let c=e[o],a=UA(o,c,i[o]);s.push(a)}if(n){let o=UA("indices",n);s.push(o)}return{fields:s,metadata:r}}function uN(e){let t={};for(let n in e){let r=e[n];t[r.name||"undefined"]=r}return t}function UA(e,t,n){let r=n?zA(n.metadata):void 0;return a0(e,t,r)}function zA(e){Object.entries(e);let t={};for(let n in e)t[`${n}.string`]=JSON.stringify(e[n]);return t}var VA={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},dN={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},mN=4,Ci=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,n={}){let r=new this.draco.DecoderBuffer;r.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(n);let s=this.decoder.GetEncodedGeometryType(r),i=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(s){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(r,i);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(r,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!i.ptr){let p=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(p)}let c=this._getDracoLoaderData(i,s,n),a=this._getMeshData(i,c,n),h=tr(a.attributes),l=GA(a.attributes,c,a.indices);return{loader:"draco",loaderData:c,header:{vertexCount:i.num_points(),boundingBox:h},...a,schema:l}}finally{this.draco.destroy(r),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,n,r){let s=this._getTopLevelMetadata(t),i=this._getDracoAttributes(t,r);return{geometry_type:n,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:s,attributes:i}}_getDracoAttributes(t,n){let r={};for(let s=0;s<t.num_attributes();s++){let i=this.decoder.GetAttribute(t,s),o=this._getAttributeMetadata(t,s);r[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:s,metadata:o};let c=this._getQuantizationTransform(i,n);c&&(r[i.unique_id()].quantization_transform=c);let a=this._getOctahedronTransform(i,n);a&&(r[i.unique_id()].octahedron_transform=a)}return r}_getMeshData(t,n,r){let s=this._getMeshAttributes(n,t,r);if(!s.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:s,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:s,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:s}}_getMeshAttributes(t,n,r){let s={};for(let i of Object.values(t.attributes)){let o=this._deduceAttributeName(i,r);i.name=o;let c=this._getAttributeValues(n,i);if(c){let{value:a,size:h}=c;s[o]={value:a,size:h,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}}return s}_getTriangleListIndices(t){let r=t.num_faces()*3,s=r*mN,i=this.draco._malloc(s);try{return this.decoder.GetTrianglesUInt32Array(t,s,i),new Uint32Array(this.draco.HEAPF32.buffer,i,r).slice()}finally{this.draco._free(i)}}_getTriangleStripIndices(t){let n=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,n),MN(n)}finally{this.draco.destroy(n)}}_getAttributeValues(t,n){let r=dN[n.data_type];if(!r)return console.warn(`DRACO: Unsupported attribute type ${n.data_type}`),null;let s=n.num_components,o=t.num_points()*s,c=o*r.BYTES_PER_ELEMENT,a=gN(this.draco,r),h,l=this.draco._malloc(c);try{let f=this.decoder.GetAttribute(t,n.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,f,a,c,l),h=new r(this.draco.HEAPF32.buffer,l,o).slice()}finally{this.draco._free(l)}return{value:h,size:s}}_deduceAttributeName(t,n){let r=t.unique_id;for(let[o,c]of Object.entries(n.extraAttributes||{}))if(c===r)return o;let s=t.attribute_type;for(let o in VA)if(this.draco[o]===s)return VA[o];let i=n.attributeNameEntry||"name";return t.metadata[i]?t.metadata[i].string:`CUSTOM_ATTRIBUTE_${r}`}_getTopLevelMetadata(t){let n=this.decoder.GetMetadata(t);return this._getDracoMetadata(n)}_getAttributeMetadata(t,n){let r=this.decoder.GetAttributeMetadata(t,n);return this._getDracoMetadata(r)}_getDracoMetadata(t){if(!t||!t.ptr)return{};let n={},r=this.metadataQuerier.NumEntries(t);for(let s=0;s<r;s++){let i=this.metadataQuerier.GetEntryName(t,s);n[i]=this._getDracoMetadataField(t,i)}return n}_getDracoMetadataField(t,n){let r=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,n,r);let s=xN(r);return{int:this.metadataQuerier.GetIntEntry(t,n),string:this.metadataQuerier.GetStringEntry(t,n),double:this.metadataQuerier.GetDoubleEntry(t,n),intArray:s}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(t){let{quantizedAttributes:n=[],octahedronAttributes:r=[]}=t,s=[...n,...r];for(let i of s)this.decoder.SkipAttributeTransform(this.draco[i])}_getQuantizationTransform(t,n){let{quantizedAttributes:r=[]}=n,s=t.attribute_type();if(r.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:new Float32Array([1,2,3]).map(c=>o.min_value(c))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(t,n){let{octahedronAttributes:r=[]}=n,s=t.attribute_type();if(r.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function gN(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 xN(e){let t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}function MN(e){let t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}var AN="1.5.6",yN="1.4.1",h0=`https://www.gstatic.com/draco/versioned/decoders/${AN}`,Jt={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},l0={[Jt.DECODER]:`${h0}/${Jt.DECODER}`,[Jt.DECODER_WASM]:`${h0}/${Jt.DECODER_WASM}`,[Jt.FALLBACK_DECODER]:`${h0}/${Jt.FALLBACK_DECODER}`,[Jt.ENCODER]:`https://raw.githubusercontent.com/google/draco/${yN}/javascript/${Jt.ENCODER}`},f0;async function qA(e){let t=e.modules||{};return t.draco3d?f0||=t.draco3d.createDecoderModule({}).then(n=>({draco:n})):f0||=EN(e),await f0}async function EN(e){let t,n;switch(e.draco&&e.draco.decoderType){case"js":t=await Le(l0[Jt.FALLBACK_DECODER],"draco",e,Jt.FALLBACK_DECODER);break;case"wasm":default:[t,n]=await Promise.all([await Le(l0[Jt.DECODER],"draco",e,Jt.DECODER),await Le(l0[Jt.DECODER_WASM],"draco",e,Jt.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await TN(t,n)}function TN(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e({...n,onModuleLoaded:s=>r({draco:s})})})}var jc={...NA,parse:_N};async function _N(e,t){let{draco:n}=await qA(t),r=new Ci(n);try{return r.parseSync(e,t?.draco)}finally{r.destroy()}}var SN={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},yt={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},U={...SN,...yt};var p0={[yt.DOUBLE]:Float64Array,[yt.FLOAT]:Float32Array,[yt.UNSIGNED_SHORT]:Uint16Array,[yt.UNSIGNED_INT]:Uint32Array,[yt.UNSIGNED_BYTE]:Uint8Array,[yt.BYTE]:Int8Array,[yt.SHORT]:Int16Array,[yt.INT]:Int32Array},CN={DOUBLE:yt.DOUBLE,FLOAT:yt.FLOAT,UNSIGNED_SHORT:yt.UNSIGNED_SHORT,UNSIGNED_INT:yt.UNSIGNED_INT,UNSIGNED_BYTE:yt.UNSIGNED_BYTE,BYTE:yt.BYTE,SHORT:yt.SHORT,INT:yt.INT},u0="Failed to convert GL type",Dt=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let n in p0)if(p0[n]===t)return n;throw new Error(u0)}static fromName(t){let n=CN[t];if(!n)throw new Error(u0);return n}static getArrayType(t){switch(t){case yt.UNSIGNED_SHORT_5_6_5:case yt.UNSIGNED_SHORT_4_4_4_4:case yt.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let n=p0[t];if(!n)throw new Error(u0);return n}}static getByteSize(t){return Dt.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(Dt.getArrayType(t))}static createTypedArray(t,n,r=0,s){s===void 0&&(s=(n.byteLength-r)/Dt.getByteSize(t));let i=Dt.getArrayType(t);return new i(n,r,s)}};var A$=1/Math.PI*180,y$=1/180*Math.PI,BN={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...BN}};var bt=globalThis.mathgl.config;function d0(e,{precision:t=bt.precision}={}){return e=LN(e),`${parseFloat(e.toPrecision(t))}`}function Ne(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function m0(e,t,n){return bN(e,r=>Math.max(t,Math.min(n,r)))}function Xc(e,t,n){let r=bt.EPSILON;n&&(bt.EPSILON=n);try{if(e===t)return!0;if(Ne(e)&&Ne(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Xc(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)<=bt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{bt.EPSILON=r}}function LN(e){return Math.round(e/bt.EPSILON)*bt.EPSILON}function RN(e){return e.clone?e.clone():new Array(e.length)}function bN(e,t,n){if(Ne(e)){let r=e;n=n||RN(r);for(let s=0;s<n.length&&s<r.length;++s){let i=typeof e=="number"?e:e[s];n[s]=t(i,s,n)}return n}return t(e)}var Kc=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Ne(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(bt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+d0(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!Xc(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(bt.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function _t(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function g0(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var $r=class extends Kc{get x(){return this[0]}set x(t){this[0]=_t(t)}get y(){return this[1]}set y(t){this[1]=_t(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return _t(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return _t(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return g0(t>=0&&t<this.ELEMENTS,"index is out of range"),_t(this[t])}setComponent(t,n){return g0(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var ts=typeof Float32Array<"u"?Float32Array:Array;var w$=Math.PI/180;function ON(){let e=new ts(2);return ts!=Float32Array&&(e[0]=0,e[1]=0),e}function HA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e}function YA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s+n[4],e[1]=n[1]*r+n[3]*s+n[5],e}function WA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}function JA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var I$=function(){let e=ON();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function jA(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function XA(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function KA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}var er=class extends $r{constructor(t=0,n=0){super(2),Ne(t)&&arguments.length===1?this.copy(t):(bt.debug&&(_t(t),_t(n)),this[0]=t,this[1]=n)}set(t,n){return this[0]=t,this[1]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return bt.debug&&(_t(t.x),_t(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 JA(this,this,t),this.check()}transformAsVector(t){return jA(this,this,t),this.check()}transformByMatrix3(t){return WA(this,this,t),this.check()}transformByMatrix2x3(t){return YA(this,this,t),this.check()}transformByMatrix2(t){return HA(this,this,t),this.check()}};function vN(){let e=new ts(3);return ts!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function NN(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function QA(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function ZA(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function $A(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function ty(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function ey(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function ny(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function ry(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function sy(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&NN(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var z$=function(){let e=vN();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var x0=[0,0,0],Qc,nr=class extends $r{static get ZERO(){return Qc||(Qc=new nr(0,0,0),Object.freeze(Qc)),Qc}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&Ne(t)?this.copy(t):(bt.debug&&(_t(t),_t(n),_t(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return bt.debug&&(_t(t.x),_t(t.y),_t(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]=_t(t)}angle(t){return sy(this,t)}cross(t){return QA(this,this,t),this.check()}rotateX({radians:t,origin:n=x0}){return ey(this,this,n,t),this.check()}rotateY({radians:t,origin:n=x0}){return ny(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=x0}){return ry(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return ZA(this,this,t),this.check()}transformAsVector(t){return XA(this,this,t),this.check()}transformByMatrix3(t){return $A(this,this,t),this.check()}transformByMatrix2(t){return KA(this,this,t),this.check()}transformByQuaternion(t){return ty(this,this,t),this.check()}};function iy(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function M0(e,t=[0,0,0]){let n=e>>11&31,r=e>>5&63,s=e&31;return t[0]=n<<3,t[1]=r<<2,t[2]=s<<3,t}var Mtt=1/256;var Att=new er,ytt=new nr,Ett=new er,Ttt=new er,_tt=new Uint8Array(1);function oy(e,t=255){return m0(e,0,t)/t*2-1}function cy(e){return e<0?-1:1}function ay(e,t,n,r){if(iy(r),e<0||e>n||t<0||t>n)throw new Error(`x and y must be unsigned normalized integers between 0 and ${n}`);if(r.x=oy(e,n),r.y=oy(t,n),r.z=1-(Math.abs(r.x)+Math.abs(r.y)),r.z<0){let s=r.x;r.x=(1-Math.abs(r.y))*cy(s),r.y=(1-Math.abs(s))*cy(r.y)}return r.normalize()}function A0(e,t,n){return ay(e,t,255,n)}var ktt=1/Math.PI*180,Htt=1/180*Math.PI,FN={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...FN}};var Et=globalThis.mathgl.config;function hy(e,{precision:t=Et.precision}={}){return e=DN(e),`${parseFloat(e.toPrecision(t))}`}function Bn(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function y0(e,t,n){let r=Et.EPSILON;n&&(Et.EPSILON=n);try{if(e===t)return!0;if(Bn(e)&&Bn(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!y0(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)<=Et.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{Et.EPSILON=r}}function DN(e){return Math.round(e/Et.EPSILON)*Et.EPSILON}var Ln=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Bn(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Et)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+hy(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!y0(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(Et.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function UN(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function X(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function Rn(e,t,n=""){if(Et.debug&&!UN(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function E0(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var es=class extends Ln{get x(){return this[0]}set x(t){this[0]=X(t)}get y(){return this[1]}set y(t){this[1]=X(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return X(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return X(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return E0(t>=0&&t<this.ELEMENTS,"index is out of range"),X(this[t])}setComponent(t,n){return E0(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var Ut=typeof Float32Array<"u"?Float32Array:Array;var eet=Math.PI/180;function GN(){let e=new Ut(2);return Ut!=Float32Array&&(e[0]=0,e[1]=0),e}function py(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}function uy(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var net=function(){let e=GN();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function dy(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function Zc(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function my(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function gy(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function $c(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function T0(){let e=new Ut(3);return Ut!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function zN(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function _0(e,t,n){let r=new Ut(3);return r[0]=e,r[1]=t,r[2]=n,r}function xy(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function S0(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function ns(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function rs(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function ta(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function ea(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function My(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Ay(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function yy(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Ey(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&S0(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var Ty=zN;var iet=function(){let e=T0();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var C0=[0,0,0],na,$=class extends es{static get ZERO(){return na||(na=new $(0,0,0),Object.freeze(na)),na}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&Bn(t)?this.copy(t):(Et.debug&&(X(t),X(n),X(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Et.debug&&(X(t.x),X(t.y),X(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]=X(t)}angle(t){return Ey(this,t)}cross(t){return ns(this,this,t),this.check()}rotateX({radians:t,origin:n=C0}){return My(this,this,n,t),this.check()}rotateY({radians:t,origin:n=C0}){return Ay(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=C0}){return yy(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return rs(this,this,t),this.check()}transformAsVector(t){return Zc(this,this,t),this.check()}transformByMatrix3(t){return ta(this,this,t),this.check()}transformByMatrix2(t){return my(this,this,t),this.check()}transformByQuaternion(t){return ea(this,this,t),this.check()}};var ra,ss=class extends es{static get ZERO(){return ra||(ra=new ss(0,0,0,0),Object.freeze(ra)),ra}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),Bn(t)&&arguments.length===1?this.copy(t):(Et.debug&&(X(t),X(n),X(r),X(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return Et.debug&&(X(t.x),X(t.y),X(t.z),X(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]=X(t)}get w(){return this[3]}set w(t){this[3]=X(t)}transform(t){return rs(this,this,t),this.check()}transformByMatrix3(t){return $c(this,this,t),this.check()}transformByMatrix2(t){return gy(this,this,t),this.check()}transformByQuaternion(t){return ea(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var is=class extends Ln{toString(){let t="[";if(Et.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=X(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function _y(){let e=new Ut(9);return Ut!=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 Sy(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=s}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function Cy(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=l*o-c*h,p=-l*i+c*a,u=h*i-o*a,d=n*f+r*p+s*u;return d?(d=1/d,e[0]=f*d,e[1]=(-l*r+s*h)*d,e[2]=(c*r-s*o)*d,e[3]=p*d,e[4]=(l*n-s*a)*d,e[5]=(-c*n+s*i)*d,e[6]=u*d,e[7]=(-h*n+r*a)*d,e[8]=(o*n-r*i)*d,e):null}function By(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8];return t*(h*i-o*a)+n*(-h*s+o*c)+r*(a*s-i*c)}function B0(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1],d=n[2],g=n[3],m=n[4],M=n[5],E=n[6],A=n[7],y=n[8];return e[0]=p*r+u*o+d*h,e[1]=p*s+u*c+d*l,e[2]=p*i+u*a+d*f,e[3]=g*r+m*o+M*h,e[4]=g*s+m*c+M*l,e[5]=g*i+m*a+M*f,e[6]=E*r+A*o+y*h,e[7]=E*s+A*c+y*l,e[8]=E*i+A*a+y*f,e}function Ly(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=p*r+u*o+h,e[7]=p*s+u*c+l,e[8]=p*i+u*a+f,e}function Ry(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=Math.sin(n),u=Math.cos(n);return e[0]=u*r+p*o,e[1]=u*s+p*c,e[2]=u*i+p*a,e[3]=u*o-p*r,e[4]=u*c-p*s,e[5]=u*a-p*i,e[6]=h,e[7]=l,e[8]=f,e}function L0(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=s*t[3],e[4]=s*t[4],e[5]=s*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function by(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[3]=l-M,e[6]=p+m,e[1]=l+M,e[4]=1-h-d,e[7]=u-g,e[2]=p-m,e[5]=u+g,e[8]=1-h-f,e}var R0;(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"})(R0||(R0={}));var kN=Object.freeze([1,0,0,0,1,0,0,0,1]),rr=class extends is{static get IDENTITY(){return YN()}static get ZERO(){return HN()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return R0}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(kN)}fromObject(t){return this.check()}fromQuaternion(t){return by(this,t),this.check()}set(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=h,this.check()}determinant(){return By(this)}transpose(){return Sy(this,this),this.check()}invert(){return Cy(this,this),this.check()}multiplyLeft(t){return B0(this,t,this),this.check()}multiplyRight(t){return B0(this,this,t),this.check()}rotate(t){return Ry(this,this,t),this.check()}scale(t){return Array.isArray(t)?L0(this,this,t):L0(this,this,[t,t]),this.check()}translate(t){return Ly(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=py(n||[-0,-0],t,this);break;case 3:r=ta(n||[-0,-0,-0],t,this);break;case 4:r=$c(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Rn(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},sa,ia=null;function HN(){return sa||(sa=new rr([0,0,0,0,0,0,0,0,0]),Object.freeze(sa)),sa}function YN(){return ia||(ia=new rr,Object.freeze(ia)),ia}function WN(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 wy(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}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 Iy(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,C=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,b=f*M-u*g,w=p*M-u*m,B=E*w-A*b+y*R+T*x-_*S+L*C;return B?(B=1/B,e[0]=(c*w-a*b+h*R)*B,e[1]=(s*b-r*w-i*R)*B,e[2]=(g*L-m*_+M*T)*B,e[3]=(p*_-f*L-u*T)*B,e[4]=(a*x-o*w-h*S)*B,e[5]=(n*w-s*x+i*S)*B,e[6]=(m*y-d*L-M*A)*B,e[7]=(l*L-p*y+u*A)*B,e[8]=(o*b-c*x+h*C)*B,e[9]=(r*x-n*b-i*C)*B,e[10]=(d*_-g*y+M*E)*B,e[11]=(f*y-l*_-u*E)*B,e[12]=(c*S-o*R-a*C)*B,e[13]=(n*R-r*S+s*C)*B,e[14]=(g*A-d*T-m*E)*B,e[15]=(l*T-f*A+p*E)*B,e):null}function Py(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8],l=e[9],f=e[10],p=e[11],u=e[12],d=e[13],g=e[14],m=e[15],M=t*o-n*i,E=t*c-r*i,A=n*c-r*o,y=h*d-l*u,T=h*g-f*u,_=l*g-f*d,L=t*_-n*T+r*y,C=i*_-o*T+c*y,S=h*A-l*E+f*M,x=u*A-d*E+g*M;return a*L-s*C+m*S-p*x}function b0(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=t[9],u=t[10],d=t[11],g=t[12],m=t[13],M=t[14],E=t[15],A=n[0],y=n[1],T=n[2],_=n[3];return e[0]=A*r+y*c+T*f+_*g,e[1]=A*s+y*a+T*p+_*m,e[2]=A*i+y*h+T*u+_*M,e[3]=A*o+y*l+T*d+_*E,A=n[4],y=n[5],T=n[6],_=n[7],e[4]=A*r+y*c+T*f+_*g,e[5]=A*s+y*a+T*p+_*m,e[6]=A*i+y*h+T*u+_*M,e[7]=A*o+y*l+T*d+_*E,A=n[8],y=n[9],T=n[10],_=n[11],e[8]=A*r+y*c+T*f+_*g,e[9]=A*s+y*a+T*p+_*m,e[10]=A*i+y*h+T*u+_*M,e[11]=A*o+y*l+T*d+_*E,A=n[12],y=n[13],T=n[14],_=n[15],e[12]=A*r+y*c+T*f+_*g,e[13]=A*s+y*a+T*p+_*m,e[14]=A*i+y*h+T*u+_*M,e[15]=A*o+y*l+T*d+_*E,e}function Oy(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,h,l,f,p,u,d,g,m,M;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],h=t[3],l=t[4],f=t[5],p=t[6],u=t[7],d=t[8],g=t[9],m=t[10],M=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=p,e[7]=u,e[8]=d,e[9]=g,e[10]=m,e[11]=M,e[12]=o*r+l*s+d*i+t[12],e[13]=c*r+f*s+g*i+t[13],e[14]=a*r+p*s+m*i+t[14],e[15]=h*r+u*s+M*i+t[15]),e}function vy(e,t,n){let r=n[0],s=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Ny(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,h,l,f,p,u,d,g,m,M,E,A,y,T,_,L,C,S,x,R,b,w,B,v;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,h=Math.sin(n),a=Math.cos(n),l=1-a,f=t[0],p=t[1],u=t[2],d=t[3],g=t[4],m=t[5],M=t[6],E=t[7],A=t[8],y=t[9],T=t[10],_=t[11],L=s*s*l+a,C=i*s*l+o*h,S=o*s*l-i*h,x=s*i*l-o*h,R=i*i*l+a,b=o*i*l+s*h,w=s*o*l+i*h,B=i*o*l-s*h,v=o*o*l+a,e[0]=f*L+g*C+A*S,e[1]=p*L+m*C+y*S,e[2]=u*L+M*C+T*S,e[3]=d*L+E*C+_*S,e[4]=f*x+g*R+A*b,e[5]=p*x+m*R+y*b,e[6]=u*x+M*R+T*b,e[7]=d*x+E*R+_*b,e[8]=f*w+g*B+A*v,e[9]=p*w+m*B+y*v,e[10]=u*w+M*B+T*v,e[11]=d*w+E*B+_*v,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function Fy(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],h=t[8],l=t[9],f=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=i*s+h*r,e[5]=o*s+l*r,e[6]=c*s+f*r,e[7]=a*s+p*r,e[8]=h*s-i*r,e[9]=l*s-o*r,e[10]=f*s-c*r,e[11]=p*s-a*r,e}function Dy(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[8],l=t[9],f=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s-h*r,e[1]=o*s-l*r,e[2]=c*s-f*r,e[3]=a*s-p*r,e[8]=i*r+h*s,e[9]=o*r+l*s,e[10]=c*r+f*s,e[11]=a*r+p*s,e}function Uy(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[4],l=t[5],f=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s+h*r,e[1]=o*s+l*r,e[2]=c*s+f*r,e[3]=a*s+p*r,e[4]=h*s-i*r,e[5]=l*s-o*r,e[6]=f*s-c*r,e[7]=p*s-a*r,e}function Gy(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[1]=l+M,e[2]=p-m,e[3]=0,e[4]=l-M,e[5]=1-h-d,e[6]=u+g,e[7]=0,e[8]=p+m,e[9]=u-g,e[10]=1-h-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function zy(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),h=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*h,e[15]=0,e}function JN(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var Vy=JN;function jN(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*h,e[15]=1,e}var qy=jN;function ky(e,t,n,r){let s,i,o,c,a,h,l,f,p,u,d=t[0],g=t[1],m=t[2],M=r[0],E=r[1],A=r[2],y=n[0],T=n[1],_=n[2];return Math.abs(d-y)<1e-6&&Math.abs(g-T)<1e-6&&Math.abs(m-_)<1e-6?WN(e):(f=d-y,p=g-T,u=m-_,s=1/Math.sqrt(f*f+p*p+u*u),f*=s,p*=s,u*=s,i=E*u-A*p,o=A*f-M*u,c=M*p-E*f,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-u*o,h=u*i-f*c,l=f*o-p*i,s=Math.sqrt(a*a+h*h+l*l),s?(s=1/s,a*=s,h*=s,l*=s):(a=0,h=0,l=0),e[0]=i,e[1]=a,e[2]=f,e[3]=0,e[4]=o,e[5]=h,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=0,e[12]=-(i*d+o*g+c*m),e[13]=-(a*d+h*g+l*m),e[14]=-(f*d+p*g+u*m),e[15]=1,e)}function XN(){let e=new Ut(4);return Ut!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Hy(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function Yy(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function Wy(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function Jy(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function jy(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function Xy(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Ky(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function Qy(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*s+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*s+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*s+n[11]*i+n[15]*o,e}function Zy(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2],h=n[3],l=h*r+c*i-a*s,f=h*s+a*r-o*i,p=h*i+o*s-c*r,u=-o*r-c*s-a*i;return e[0]=l*h+u*-o+f*-a-p*-c,e[1]=f*h+u*-c+p*-o-l*-a,e[2]=p*h+u*-a+l*-c-f*-o,e[3]=t[3],e}var Pet=function(){let e=XN();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var P0;(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"})(P0||(P0={}));var QN=45*Math.PI/180,ZN=1,w0=.1,I0=500,$N=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),bn=class extends is{static get IDENTITY(){return eF()}static get ZERO(){return tF()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return P0}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this[9]=l,this[10]=f,this[11]=p,this[12]=u,this[13]=d,this[14]=g,this[15]=m,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=i,this[2]=h,this[3]=u,this[4]=n,this[5]=o,this[6]=l,this[7]=d,this[8]=r,this[9]=c,this[10]=f,this[11]=g,this[12]=s,this[13]=a,this[14]=p,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($N)}fromObject(t){return this.check()}fromQuaternion(t){return Gy(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=w0,far:c=I0}=t;return c===1/0?nF(this,n,r,s,i,o):zy(this,n,r,s,i,o,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return ky(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=w0,far:c=I0}=t;return qy(this,n,r,s,i,o,c),this.check()}orthographic(t){let{fovy:n=QN,aspect:r=ZN,focalDistance:s=1,near:i=w0,far:o=I0}=t;$y(n);let c=n/2,a=s*Math.tan(c),h=a*r;return this.ortho({left:-h,right:h,bottom:-a,top:a,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return $y(n),Vy(this,n,r,s,i),this.check()}determinant(){return Py(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*s,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*s,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return wy(this,this),this.check()}invert(){return Iy(this,this),this.check()}multiplyLeft(t){return b0(this,t,this),this.check()}multiplyRight(t){return b0(this,this,t),this.check()}rotateX(t){return Fy(this,this,t),this.check()}rotateY(t){return Dy(this,this,t),this.check()}rotateZ(t){return Uy(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return Ny(this,this,t,n),this.check()}scale(t){return vy(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Oy(this,this,t),this.check()}transform(t,n){return t.length===4?(n=Qy(n||[-0,-0,-0,-0],t,this),Rn(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=uy(n||[-0,-0],t,this);break;case 3:s=rs(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Rn(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=dy(n||[-0,-0],t,this);break;case 3:r=Zc(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Rn(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},oa,ca;function tF(){return oa||(oa=new bn([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(oa)),oa}function eF(){return ca||(ca=new bn,Object.freeze(ca)),ca}function $y(e){if(e>Math.PI*2)throw Error("expected radians")}function nF(e,t,n,r,s,i){let o=2*i/(n-t),c=2*i/(s-r),a=(n+t)/(n-t),h=(s+r)/(s-r),l=-1,f=-1,p=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=h,e[10]=l,e[11]=f,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function t3(){let e=new Ut(4);return Ut!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function e3(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function O0(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function v0(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*l+o*c+s*h-i*a,e[1]=s*l+o*a+i*c-r*h,e[2]=i*l+o*h+r*a-s*c,e[3]=o*l-r*c-s*a-i*h,e}function n3(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function r3(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function s3(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function i3(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function Li(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],h=n[1],l=n[2],f=n[3],p,u,d,g,m;return p=s*a+i*h+o*l+c*f,p<0&&(p=-p,a=-a,h=-h,l=-l,f=-f),1-p>1e-6?(u=Math.acos(p),m=Math.sin(u),d=Math.sin((1-r)*u)/m,g=Math.sin(r*u)/m):(d=1-r,g=r),e[0]=d*s+g*a,e[1]=d*i+g*h,e[2]=d*o+g*l,e[3]=d*c+g*f,e}function o3(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function c3(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function N0(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}var a3=Hy;var h3=Yy,l3=Xy,f3=Ky,p3=Wy;var u3=Jy;var d3=jy;var m3=function(){let e=T0(),t=_0(1,0,0),n=_0(0,1,0);return function(r,s,i){let o=S0(s,i);return o<-.999999?(ns(e,t,s),Ty(e)<1e-6&&ns(e,n,s),xy(e,e),O0(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(ns(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,d3(r,r))}}(),Wet=function(){let e=t3(),t=t3();return function(n,r,s,i,o,c){return Li(e,r,o,c),Li(t,s,i,c),Li(n,e,t,2*c*(1-c)),n}}(),Jet=function(){let e=_y();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],d3(t,N0(t,e))}}();var rF=[0,0,0,1],Ri=class extends Ln{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return N0(this,t),this.check()}fromAxisRotation(t,n){return O0(this,t,n),this.check()}identity(){return e3(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=X(t)}get y(){return this[1]}set y(t){this[1]=X(t)}get z(){return this[2]}set z(t){this[2]=X(t)}get w(){return this[3]}set w(t){this[3]=X(t)}len(){return p3(this)}lengthSquared(){return u3(this)}dot(t){return l3(this,t)}rotationTo(t,n){return m3(this,t,n),this.check()}add(t){return a3(this,this,t),this.check()}calculateW(){return i3(this,this),this.check()}conjugate(){return c3(this,this),this.check()}invert(){return o3(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(f3(this,t,n,r),this.check())}multiplyRight(t){return v0(this,this,t),this.check()}multiplyLeft(t){return v0(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return n3(this,this,t),this.check()}rotateY(t){return r3(this,this,t),this.check()}rotateZ(t){return s3(this,this,t),this.check()}scale(t){return h3(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=rF,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return Li(this,s,i,o),this.check()}transformVector4(t,n=new ss){return Zy(n,t,this),Rn(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Ke=class{json;buffer;featuresLength=0;_cachedTypedArrays={};constructor(t,n){this.json=t,this.buffer=n}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t,n=U.UNSIGNED_INT,r=1){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?this._getTypedArrayFromBinary(t,n,r,1,s.byteOffset):s}getPropertyArray(t,n,r){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?("componentType"in s&&(n=Dt.fromName(s.componentType)),this._getTypedArrayFromBinary(t,n,r,this.featuresLength,s.byteOffset)):this._getTypedArrayFromArray(t,n,s)}getProperty(t,n,r,s,i){let o=this.json[t];if(!o)return o;let c=this.getPropertyArray(t,n,r);if(r===1)return c[s];for(let a=0;a<r;++a)i[a]=c[r*s+a];return i}_getTypedArrayFromBinary(t,n,r,s,i){let o=this._cachedTypedArrays,c=o[t];return c||(c=Dt.createTypedArray(n,this.buffer.buffer,this.buffer.byteOffset+i,s*r),o[t]=c),c}_getTypedArrayFromArray(t,n,r){let s=this._cachedTypedArrays,i=s[t];return i||(i=Dt.createTypedArray(n,r),s[t]=i),i}};var sF={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},iF={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]]},oF={SCALAR:(e,t,n)=>{t[n]=e},VEC2:(e,t,n)=>{t[2*n+0]=e[0],t[2*n+1]=e[1]},VEC3:(e,t,n)=>{t[3*n+0]=e[0],t[3*n+1]=e[1],t[3*n+2]=e[2]},VEC4:(e,t,n)=>{t[4*n+0]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]},MAT2:(e,t,n)=>{t[4*n+0]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]},MAT3:(e,t,n)=>{t[9*n+0]=e[0],t[9*n+1]=e[1],t[9*n+2]=e[2],t[9*n+3]=e[3],t[9*n+4]=e[4],t[9*n+5]=e[5],t[9*n+6]=e[6],t[9*n+7]=e[7],t[9*n+8]=e[8],t[9*n+9]=e[9]},MAT4:(e,t,n)=>{t[16*n+0]=e[0],t[16*n+1]=e[1],t[16*n+2]=e[2],t[16*n+3]=e[3],t[16*n+4]=e[4],t[16*n+5]=e[5],t[16*n+6]=e[6],t[16*n+7]=e[7],t[16*n+8]=e[8],t[16*n+9]=e[9],t[16*n+10]=e[10],t[16*n+11]=e[11],t[16*n+12]=e[12],t[16*n+13]=e[13],t[16*n+14]=e[14],t[16*n+15]=e[15]}};function g3(e,t,n,r){let{componentType:s}=e;q(e.componentType);let i=typeof s=="string"?Dt.fromName(s):s,o=sF[e.type],c=iF[e.type],a=oF[e.type];return n+=e.byteOffset,{values:Dt.createTypedArray(i,t,n,o*r),type:i,size:o,unpacker:c,packer:a}}var Fe=e=>e!==void 0;function x3(e,t,n){if(!t)return null;let r=e.getExtension("3DTILES_batch_table_hierarchy"),s=t.HIERARCHY;return s&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=s,r=s),r?cF(r,n):null}function cF(e,t){let n,r,s,i=e.instancesLength,o=e.classes,c=e.classIds,a=e.parentCounts,h=e.parentIds,l=i;Fe(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,s=getBinaryAccessor(c),c=s.createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,i));let f;if(Fe(a))for(Fe(a.byteOffset)&&(a.componentType=defaultValue(a.componentType,GL.UNSIGNED_SHORT),a.type=AttributeType.SCALAR,s=getBinaryAccessor(a),a=s.createArrayBufferView(t.buffer,t.byteOffset+a.byteOffset,i)),f=new Uint16Array(i),l=0,n=0;n<i;++n)f[n]=l,l+=a[n];Fe(h)&&Fe(h.byteOffset)&&(h.componentType=defaultValue(h.componentType,GL.UNSIGNED_SHORT),h.type=AttributeType.SCALAR,s=getBinaryAccessor(h),h=s.createArrayBufferView(t.buffer,t.byteOffset+h.byteOffset,l));let p=o.length;for(n=0;n<p;++n){let m=o[n].length,M=o[n].instances,E=getBinaryProperties(m,M,t);o[n].instances=combine(E,M)}let u=new Array(p).fill(0),d=new Uint16Array(i);for(n=0;n<i;++n)r=c[n],d[n]=u[r],++u[r];let g={classes:o,classIds:c,classIndexes:d,parentCounts:a,parentIndexes:f,parentIds:h};return lF(g),g}function os(e,t,n){if(!e)return;let r=e.parentCounts;return e.parentIds?n(e,t):r>0?aF(e,t,n):hF(e,t,n)}function aF(e,t,n){let r=e.classIds,s=e.parentCounts,i=e.parentIds,o=e.parentIndexes,c=r.length,a=scratchVisited;a.length=Math.max(a.length,c);let h=++marker,l=scratchStack;for(l.length=0,l.push(t);l.length>0;){if(t=l.pop(),a[t]===h)continue;a[t]=h;let f=n(e,t);if(Fe(f))return f;let p=s[t],u=o[t];for(let d=0;d<p;++d){let g=i[u+d];g!==t&&l.push(g)}}return null}function hF(e,t,n){let r=!0;for(;r;){let s=n(e,t);if(Fe(s))return s;let i=e.parentIds[t];r=i!==t,t=i}throw new Error("traverseHierarchySingleParent")}function lF(e){let t=[],r=e.classIds.length;for(let s=0;s<r;++s)M3(e,s,stack)}function M3(e,t,n){let r=e.parentCounts,s=e.parentIds,i=e.parentIndexes,c=e.classIds.length;if(!Fe(s))return;assert(t<c,`Parent index ${t} exceeds the total number of instances: ${c}`),assert(n.indexOf(t)===-1,"Circular dependency detected in the batch table hierarchy."),n.push(t);let a=Fe(r)?r[t]:1,h=Fe(r)?i[t]:t;for(let l=0;l<a;++l){let f=s[h+l];f!==t&&M3(e,f,n)}n.pop(t)}function jt(e){return e!=null}var aa=(e,t)=>e,fF={HIERARCHY:!0,extensions:!0,extras:!0},sr=class{json;binary;featureCount;_extensions;_properties;_binaryProperties;_hierarchy;constructor(t,n,r,s={}){q(r>=0),this.json=t||{},this.binary=n,this.featureCount=r,this._extensions=this.json?.extensions||{},this._properties={};for(let i in this.json)fF[i]||(this._properties[i]=this.json[i]);this._binaryProperties=this._initializeBinaryProperties(),s["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=x3(this,this.json,this.binary))}getExtension(t){return this.json&&this.json.extensions&&this.json.extensions[t]}memorySizeInBytes(){return 0}isClass(t,n){if(this._checkBatchId(t),q(typeof n=="string",n),this._hierarchy){let r=os(this._hierarchy,t,(s,i)=>{let o=s.classIds[i];return s.classes[o].name===n});return jt(r)}return!1}isExactClass(t,n){return q(typeof n=="string",n),this.getExactClassName(t)===n}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){let n=this._hierarchy.classIds[t];return this._hierarchy.classes[n].name}}hasProperty(t,n){return this._checkBatchId(t),q(typeof n=="string",n),jt(this._properties[n])||this._hasPropertyInHierarchy(t,n)}getPropertyNames(t,n){this._checkBatchId(t),n=jt(n)?n:[],n.length=0;let r=Object.keys(this._properties);return n.push(...r),this._hierarchy&&this._getPropertyNamesInHierarchy(t,n),n}getProperty(t,n){if(this._checkBatchId(t),q(typeof n=="string",n),this._binaryProperties){let s=this._binaryProperties[n];if(jt(s))return this._getBinaryProperty(s,t)}let r=this._properties[n];if(jt(r))return aa(r[t],!0);if(this._hierarchy){let s=this._getHierarchyProperty(t,n);if(jt(s))return s}}setProperty(t,n,r){let s=this.featureCount;if(this._checkBatchId(t),q(typeof n=="string",n),this._binaryProperties){let o=this._binaryProperties[n];if(o){this._setBinaryProperty(o,t,r);return}}if(this._hierarchy&&this._setHierarchyProperty(this,t,n,r))return;let i=this._properties[n];jt(i)||(this._properties[n]=new Array(s),i=this._properties[n]),i[t]=aa(r,!0)}_checkBatchId(t){if(!(t>=0&&t<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(t,n){return t.unpack(t.typedArray,n)}_setBinaryProperty(t,n,r){t.pack(r,t.typedArray,n)}_initializeBinaryProperties(){let t=null;for(let n in this._properties){let r=this._properties[n],s=this._initializeBinaryProperty(n,r);s&&(t=t||{},t[n]=s)}return t}_initializeBinaryProperty(t,n){if("byteOffset"in n){let r=n;q(this.binary,`Property ${t} requires a batch table binary.`),q(r.type,`Property ${t} requires a type.`);let s=g3(r,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:s.values,componentCount:s.size,unpack:s.unpacker,pack:s.packer}}return null}_hasPropertyInHierarchy(t,n){if(!this._hierarchy)return!1;let r=os(this._hierarchy,t,(s,i)=>{let o=s.classIds[i],c=s.classes[o].instances;return jt(c[n])});return jt(r)}_getPropertyNamesInHierarchy(t,n){os(this._hierarchy,t,(r,s)=>{let i=r.classIds[s],o=r.classes[i].instances;for(let c in o)o.hasOwnProperty(c)&&n.indexOf(c)===-1&&n.push(c)})}_getHierarchyProperty(t,n){return os(this._hierarchy,t,(r,s)=>{let i=r.classIds[s],o=r.classes[i],c=r.classIndexes[s],a=o.instances[n];return jt(a)?jt(a.typedArray)?this._getBinaryProperty(a,c):aa(a[c],!0):null})}_setHierarchyProperty(t,n,r,s){let i=os(this._hierarchy,n,(o,c)=>{let a=o.classIds[c],h=o.classes[a],l=o.classIndexes[c],f=h.instances[r];return jt(f)?(q(c===n,`Inherited property "${r}" is read-only.`),jt(f.typedArray)?this._setBinaryProperty(f,l,s):f[l]=aa(s,!0),!0):!1});return jt(i)}};function wn(e,t,n=0){let r=new DataView(t);if(e.magic=r.getUint32(n,!0),n+=4,e.version=r.getUint32(n,!0),n+=4,e.byteLength=r.getUint32(n,!0),n+=4,e.version!==1)throw new Error(`3D Tile Version ${e.version} not supported`);return n}var cs=4,A3="b3dm tile in legacy format.";function as(e,t,n){let r=new DataView(t),s;e.header=e.header||{};let i=r.getUint32(n,!0);n+=cs;let o=r.getUint32(n,!0);n+=cs;let c=r.getUint32(n,!0);n+=cs;let a=r.getUint32(n,!0);return n+=cs,c>=570425344?(n-=cs*2,s=i,c=o,a=0,i=0,o=0,console.warn(A3)):a>=570425344&&(n-=cs,s=c,c=i,a=o,i=0,o=0,console.warn(A3)),e.header.featureTableJsonByteLength=i,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=c,e.header.batchTableBinaryByteLength=a,e.header.batchLength=s,n}function hs(e,t,n,r){return n=pF(e,t,n,r),n=uF(e,t,n,r),n}function pF(e,t,n,r){let{featureTableJsonByteLength:s,featureTableBinaryByteLength:i,batchLength:o}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:o||0},s&&s>0){let c=c0(t,n,s);e.featureTableJson=JSON.parse(c)}return n+=s||0,e.featureTableBinary=new Uint8Array(t,n,i),n+=i||0,n}function uF(e,t,n,r){let{batchTableJsonByteLength:s,batchTableBinaryByteLength:i}=e.header||{};if(s&&s>0){let o=c0(t,n,s);e.batchTableJson=JSON.parse(o),n+=s,i&&i>0&&(e.batchTableBinary=new Uint8Array(t,n,i),e.batchTableBinary=new Uint8Array(e.batchTableBinary),n+=i)}return n}function F0(e,t,n){if(!t&&(!e||!e.batchIds||!n))return null;let{batchIds:r,isRGB565:s,pointCount:i=0}=e;if(r&&n){let o=new Uint8ClampedArray(i*3);for(let c=0;c<i;c++){let a=r[c],l=n.getProperty(a,"dimensions").map(f=>f*255);o[c*3]=l[0],o[c*3+1]=l[1],o[c*3+2]=l[2]}return{type:U.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}if(t&&s){let o=new Uint8ClampedArray(i*3);for(let c=0;c<i;c++){let a=M0(t[c]);o[c*3]=a[0],o[c*3+1]=a[1],o[c*3+2]=a[2]}return{type:U.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}return t&&t.length===i*3?{type:U.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:U.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var y3=new $;function E3(e,t){if(!t)return null;if(e.isOctEncoded16P){let n=new Float32Array((e.pointsLength||0)*3);for(let r=0;r<(e.pointsLength||0);r++)A0(t[r*2],t[r*2+1],y3),y3.toArray(n,r*3);return{type:U.FLOAT,size:2,value:n}}return{type:U.FLOAT,size:2,value:t}}function T3(e,t,n){return e.isQuantized?n["3d-tiles"]&&n["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,dF(e,t)):{type:U.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function dF(e,t){let n=new $,r=new Float32Array(e.pointCount*3);for(let s=0;s<e.pointCount;s++)n.set(t[s*3],t[s*3+1],t[s*3+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(r,s*3);return r}async function _3(e,t,n,r,s){n=wn(e,t,n),n=as(e,t,n),n=hs(e,t,n,r),mF(e);let{featureTable:i,batchTable:o}=gF(e);return await EF(e,i,o,r,s),xF(e,i,r),MF(e,i,o),AF(e,i),n}function mF(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function gF(e){let t=new Ke(e.featureTableJson,e.featureTableBinary),n=t.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(n))throw new Error("POINTS_LENGTH must be defined");t.featuresLength=n,e.featuresLength=n,e.pointsLength=n,e.pointCount=n,e.rtcCenter=t.getGlobalProperty("RTC_CENTER",U.FLOAT,3);let r=yF(e,t);return{featureTable:t,batchTable:r}}function xF(e,t,n){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.positions){if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",U.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let r=t.getPropertyArray("POSITION_QUANTIZED",U.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",U.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",U.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=T3(e,r,n)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function MF(e,t,n){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.colors){let r=null;t.hasProperty("RGBA")?(r=t.getPropertyArray("RGBA",U.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?r=t.getPropertyArray("RGB",U.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(r=t.getPropertyArray("RGB565",U.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=F0(e,r,n)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",U.UNSIGNED_BYTE,4))}function AF(e,t){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.normals){let n=null;t.hasProperty("NORMAL")?n=t.getPropertyArray("NORMAL",U.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(n=t.getPropertyArray("NORMAL_OCT16P",U.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=E3(e,n)}}function yF(e,t){let n=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",U.UNSIGNED_SHORT,1),e.batchIds)){let r=t.getGlobalProperty("BATCH_LENGTH");if(!r)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:s,batchTableBinary:i}=e;n=new sr(s,i,r)}return n}async function EF(e,t,n,r,s){let i,o,c,a=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];a&&(c=a.properties);let h=t.getExtension("3DTILES_draco_point_compression");if(h){o=h.properties;let f=h.byteOffset,p=h.byteLength;if(!o||!Number.isFinite(f)||!p)throw new Error("Draco properties, byteOffset, and byteLength must be defined");i=(e.featureTableBinary||[]).slice(f,f+p),e.hasPositions=Number.isFinite(o.POSITION),e.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),e.hasNormals=Number.isFinite(o.NORMAL),e.hasBatchIds=Number.isFinite(o.BATCH_ID),e.isTranslucent=Number.isFinite(o.RGBA)}if(!i)return!0;let l={buffer:i,properties:{...o,...c},featureTableProperties:o,batchTableProperties:c,dequantizeInShader:!1};return await TF(e,l,r,s)}async function TF(e,t,n,r){if(!r)return;let s={...n,draco:{...n?.draco,extraAttributes:t.batchTableProperties||{}}};delete s["3d-tiles"];let i=await Qt(t.buffer,jc,s,r),o=i.attributes.POSITION&&i.attributes.POSITION.value,c=i.attributes.COLOR_0&&i.attributes.COLOR_0.value,a=i.attributes.NORMAL&&i.attributes.NORMAL.value,h=i.attributes.BATCH_ID&&i.attributes.BATCH_ID.value,l=o&&i.attributes.POSITION.value.quantization,f=a&&i.attributes.NORMAL.value.quantization;if(l){let u=i.POSITION.data.quantization,d=u.range;e.quantizedVolumeScale=new $(d,d,d),e.quantizedVolumeOffset=new $(u.minValues),e.quantizedRange=(1<<u.quantizationBits)-1,e.isQuantizedDraco=!0}f&&(e.octEncodedRange=(1<<i.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let p={};if(t.batchTableProperties)for(let u of Object.keys(t.batchTableProperties))i.attributes[u]&&i.attributes[u].value&&(p[u.toLowerCase()]=i.attributes[u].value);e.attributes={positions:o,colors:F0(e,c,void 0),normals:a,batchIds:h,...p}}var D0={};Tt(D0,{decode:()=>vF,name:()=>OF});function St(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var ha={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},la={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var _F=1.33,S3=["SCALAR","VEC2","VEC3","VEC4"],SF=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],CF=new Map(SF),BF={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},LF={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},RF={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function fa(e){return S3[e-1]||S3[0]}function ls(e){let t=CF.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function fs(e,t){let n=RF[e.componentType],r=BF[e.type],s=LF[e.componentType],i=e.count*r,o=e.count*r*s;St(o>=0&&o<=t.byteLength);let c=la[e.componentType],a=ha[e.type];return{ArrayType:n,length:i,byteLength:o,componentByteSize:c,numberOfComponentsInElement:a}}function bi(e){let{images:t,bufferViews:n}=e;t=t||[],n=n||[];let r=t.map(o=>o.bufferView);n=n.filter(o=>!r.includes(o));let s=n.reduce((o,c)=>o+c.byteLength,0),i=t.reduce((o,c)=>{let{width:a,height:h}=c.image;return o+a*h},0);return s+Math.ceil(4*i*_F)}function C3(e,t,n){let r=e.bufferViews[n];St(r);let s=r.buffer,i=t[s];St(i);let o=(r.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,o,r.byteLength)}function B3(e,t,n){let r=typeof n=="number"?e.accessors?.[n]:n;if(!r)throw new Error(`No gltf accessor ${JSON.stringify(n)}`);let s=e.bufferViews?.[r.bufferView||0];if(!s)throw new Error(`No gltf buffer view for accessor ${s}`);let{arrayBuffer:i,byteOffset:o}=t[s.buffer],c=(o||0)+(r.byteOffset||0)+(s.byteOffset||0),{ArrayType:a,length:h,componentByteSize:l,numberOfComponentsInElement:f}=fs(r,s),p=l*f,u=s.byteStride||p;if(typeof s.byteStride>"u"||s.byteStride===p)return new a(i,c,h);let d=new a(h);for(let g=0;g<r.count;g++){let m=new a(i,c+g*u,f);d.set(m,g*f)}return d}function bF(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var Z=class{gltf;sourceBuffers;byteLength;constructor(t){this.gltf={json:t?.json||bF(),buffers:t?.buffers||[],images:t?.images||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}hasExtension(t){let n=this.getUsedExtensions().find(s=>s===t),r=this.getRequiredExtensions().find(s=>s===t);return typeof n=="string"||typeof r=="string"}getExtension(t){let n=this.getUsedExtensions().find(s=>s===t),r=this.json.extensions||{};return n?r[t]:null}getRequiredExtension(t){return this.getRequiredExtensions().find(r=>r===t)?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(t,n){return(t.extensions||{})[n]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,n){if(typeof n=="object")return n;let r=this.json[t]&&this.json[t][n];if(!r)throw new Error(`glTF file error: Could not find ${t}[${n}]`);return r}getTypedArrayForBufferView(t){t=this.getBufferView(t);let n=t.buffer,r=this.gltf.buffers[n];St(r);let s=(t.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,s,t.byteLength)}getTypedArrayForAccessor(t){let n=this.getAccessor(t);return B3(this.gltf.json,this.gltf.buffers,n)}getTypedArrayForImageData(t){t=this.getAccessor(t);let n=this.getBufferView(t.bufferView),s=this.getBuffer(n.buffer).data,i=n.byteOffset||0;return new Uint8Array(s,i,n.byteLength)}addApplicationData(t,n){return this.json[t]=n,this}addExtraData(t,n){return this.json.extras=this.json.extras||{},this.json.extras[t]=n,this}addObjectExtension(t,n,r){return t.extensions=t.extensions||{},t.extensions[n]=r,this.registerUsedExtension(n),this}setObjectExtension(t,n,r){let s=t.extensions||{};s[n]=r}removeObjectExtension(t,n){let r=t?.extensions||{};if(r[n]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(n)||s.push(n)}delete r[n]}addExtension(t,n={}){return St(n),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=n,this.registerUsedExtension(t),n}addRequiredExtension(t,n={}){return St(n),this.addExtension(t,n),this.registerRequiredExtension(t),n}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(n=>n===t)||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(n=>n===t)||this.json.extensionsRequired.push(t)}removeExtension(t){if(this.json.extensions?.[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let n=this.json.extensionsRemoved;n.includes(t)||n.push(t)}this.json.extensions&&delete this.json.extensions[t],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t)}setDefaultScene(t){this.json.scene=t}addScene(t){let{nodeIndices:n}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:n}),this.json.scenes.length-1}addNode(t){let{meshIndex:n,matrix:r}=t;this.json.nodes=this.json.nodes||[];let s={mesh:n};return r&&(s.matrix=r),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(t){let{attributes:n,indices:r,material:s,mode:i=4}=t,c={primitives:[{attributes:this._addAttributes(n),mode:i}]};if(r){let a=this._addIndices(r);c.primitives[0].indices=a}return Number.isFinite(s)&&(c.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(c),this.json.meshes.length-1}addPointCloud(t){let r={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(r),this.json.meshes.length-1}addImage(t,n){let r=kn(t),s=n||r?.mimeType,o={bufferView:this.addBufferView(t),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(t,n=0,r=this.byteLength){let s=t.byteLength;St(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let i={buffer:n,byteOffset:r,byteLength:s};return this.byteLength+=on(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(t,n){let r={bufferView:t,type:fa(n.size),componentType:n.componentType,count:n.count,max:n.max,min:n.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}addBinaryBuffer(t,n={size:3}){let r=this.addBufferView(t),s={min:n.min,max:n.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(t,n.size));let i={size:n.size,componentType:ls(t),count:Math.round(t.length/n.size),min:s.min,max:s.max};return this.addAccessor(r,Object.assign(i,n))}addTexture(t){let{imageIndex:n}=t,r={source:n};return this.json.textures=this.json.textures||[],this.json.textures.push(r),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){this.gltf.buffers=[];let t=this.byteLength,n=new ArrayBuffer(t),r=new Uint8Array(n),s=0;for(let i of this.sourceBuffers||[])s=pl(i,r,s);this.json?.buffers?.[0]?this.json.buffers[0].byteLength=t:this.json.buffers=[{byteLength:t}],this.gltf.binary=n,this.sourceBuffers=[n]}_removeStringFromArray(t,n){let r=!0;for(;r;){let s=t.indexOf(n);s>-1?t.splice(s,1):r=!1}}_addAttributes(t={}){let n={};for(let r in t){let s=t[r],i=this._getGltfAttributeName(r),o=this.addBinaryBuffer(s.value,s);n[i]=o}return n}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return t}}_getAccessorMinMax(t,n){let r={min:null,max:null};if(t.length<n)return r;r.min=[],r.max=[];let s=t.subarray(0,n);for(let i of s)r.min.push(i),r.max.push(i);for(let i=n;i<t.length;i+=n)for(let o=0;o<n;o++)r.min[0+o]=Math.min(r.min[0+o],t[i+o]),r.max[0+o]=Math.max(r.max[0+o],t[i+o]);return r}};function L3(e){return(e%1+1)%1}var R3={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},wF={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},b3={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function wi(e,t){return b3[t]*R3[e]}function ps(e,t,n,r){if(n!=="UINT8"&&n!=="UINT16"&&n!=="UINT32"&&n!=="UINT64")return null;let s=e.getTypedArrayForBufferView(t),i=us(s,"SCALAR",n,r+1);return i instanceof BigInt64Array||i instanceof BigUint64Array?null:i}function us(e,t,n,r=1){let s=R3[t],i=wF[n],o=b3[n],c=r*s,a=c*o,h=e.buffer,l=e.byteOffset;return l%o!==0&&(h=new Uint8Array(h).slice(l,l+a).buffer,l=0),new i(h,l,c)}function ds(e,t,n){let r=`TEXCOORD_${t.texCoord||0}`,s=n.attributes[r],i=e.getTypedArrayForAccessor(s),o=e.gltf.json,c=t.index,a=o.textures?.[c]?.source;if(typeof a<"u"){let h=o.images?.[a]?.mimeType,l=e.gltf.images?.[a];if(l&&typeof l.width<"u"){let f=[];for(let p=0;p<i.length;p+=2){let u=IF(l,h,i,p,t.channels);f.push(u)}return f}}return[]}function pa(e,t,n,r,s){if(!n?.length)return;let i=[];for(let l of n){let f=r.findIndex(p=>p===l);f===-1&&(f=r.push(l)-1),i.push(f)}let o=new Uint32Array(i),c=e.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,a=e.addBufferView(o,c,0),h=e.addAccessor(a,{size:1,componentType:ls(o),count:o.length});s.attributes[t]=h}function IF(e,t,n,r,s=[0]){let i={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=n[r],c=n[r+1],a=1;t&&(t.indexOf("image/jpeg")!==-1||t.indexOf("image/png")!==-1)&&(a=4);let h=PF(o,c,e,a),l=0;for(let f of s){let p=typeof f=="number"?Object.values(i)[f]:i[f],u=h+p.offset,d=Ks(e);if(d.data.length<=u)throw new Error(`${d.data.length} <= ${u}`);let g=d.data[u];l|=g<<p.shift}return l}function PF(e,t,n,r=1){let s=n.width,i=L3(e)*(s-1),o=Math.round(i),c=n.height,a=L3(t)*(c-1),h=Math.round(a),l=n.components?n.components:r;return(h*s+o)*l}function ua(e,t,n,r,s){let i=[];for(let o=0;o<t;o++){let c=n[o],a=n[o+1]-n[o];if(a+c>r)break;let h=c/s,l=a/s;i.push(e.slice(h,h+l))}return i}function da(e,t,n){let r=[];for(let s=0;s<t;s++){let i=s*n;r.push(e.slice(i,i+n))}return r}function ma(e,t,n,r){if(n)throw new Error("Not implemented - arrayOffsets for strings is specified");if(r){let s=[],i=new TextDecoder("utf8"),o=0;for(let c=0;c<e;c++){let a=r[c+1]-r[c];if(a+o<=t.length){let h=t.subarray(o,a+o),l=i.decode(h);s.push(l),o+=a}}return s}return[]}var w3="EXT_mesh_features",OF=w3;async function vF(e,t){let n=new Z(e);NF(n,t)}function NF(e,t){let n=e.gltf.json;if(n.meshes)for(let r of n.meshes)for(let s of r.primitives)FF(e,s,t)}function FF(e,t,n){if(!n?.gltf?.loadBuffers)return;let s=t.extensions?.[w3]?.featureIds;if(s)for(let i of s){let o;if(typeof i.attribute<"u"){let c=`_FEATURE_ID_${i.attribute}`,a=t.attributes[c];o=e.getTypedArrayForAccessor(a)}else typeof i.texture<"u"&&n?.gltf?.loadImages?o=ds(e,i.texture,t):o=[];i.data=o}}var z0={};Tt(z0,{decode:()=>UF,name:()=>DF});var U0="EXT_structural_metadata",DF=U0;async function UF(e,t){let n=new Z(e);GF(n,t)}function GF(e,t){if(!t.gltf?.loadBuffers)return;let n=e.getExtension(U0);n&&(t.gltf?.loadImages&&zF(e,n),VF(e,n))}function zF(e,t){let n=t.propertyTextures,r=e.gltf.json;if(n&&r.meshes)for(let s of r.meshes)for(let i of s.primitives)kF(e,n,i,t)}function VF(e,t){let n=t.schema;if(!n)return;let r=n.classes,s=t.propertyTables;if(r&&s)for(let i in r){let o=qF(s,i);o&&YF(e,n,o)}}function qF(e,t){for(let n of e)if(n.class===t)return n;return null}function kF(e,t,n,r){if(!t)return;let i=n.extensions?.[U0]?.propertyTextures;if(i)for(let o of i){let c=t[o];HF(e,c,n,r)}}function HF(e,t,n,r){if(!t.properties)return;r.dataAttributeNames||(r.dataAttributeNames=[]);let s=t.class;for(let i in t.properties){let o=`${s}_${i}`,c=t.properties?.[i];if(!c)continue;c.data||(c.data=[]);let a=c.data,h=ds(e,c,n);h!==null&&(pa(e,o,h,a,n),c.data=a,r.dataAttributeNames.push(o))}}function YF(e,t,n){let r=t.classes?.[n.class];if(!r)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);let s=n.count;for(let i in r.properties){let o=r.properties[i],c=n.properties?.[i];if(c){let a=WF(e,t,o,s,c);c.data=a}}}function WF(e,t,n,r,s){let i=[],o=s.values,c=e.getTypedArrayForBufferView(o),a=JF(e,n,s,r),h=jF(e,s,r);switch(n.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{i=XF(n,r,c,a);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${n.type}`);case"STRING":{i=ma(r,c,a,h);break}case"ENUM":{i=KF(t,n,r,c,a);break}default:throw new Error(`Unknown classProperty type ${n.type}`)}return i}function JF(e,t,n,r){return t.array&&typeof t.count>"u"&&typeof n.arrayOffsets<"u"?ps(e,n.arrayOffsets,n.arrayOffsetType||"UINT32",r):null}function jF(e,t,n){return typeof t.stringOffsets<"u"?ps(e,t.stringOffsets,t.stringOffsetType||"UINT32",n):null}function XF(e,t,n,r){let s=e.array,i=e.count,o=wi(e.type,e.componentType),c=n.byteLength/o,a;return e.componentType?a=us(n,e.type,e.componentType,c):a=n,s?r?ua(a,t,r,n.length,o):i?da(a,t,i):[]:a}function KF(e,t,n,r,s){let i=t.enumType;if(!i)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let o=e.enums?.[i];if(!o)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${i}`);let c=o.valueType||"UINT16",a=wi(t.type,c),h=r.byteLength/a,l=us(r,t.type,c,h);if(l||(l=r),t.array){if(s)return QF({valuesData:l,numberOfElements:n,arrayOffsets:s,valuesDataBytesLength:r.length,elementSize:a,enumEntry:o});let f=t.count;return f?ZF(l,n,f,o):[]}return G0(l,0,n,o)}function QF(e){let{valuesData:t,numberOfElements:n,arrayOffsets:r,valuesDataBytesLength:s,elementSize:i,enumEntry:o}=e,c=[];for(let a=0;a<n;a++){let h=r[a],l=r[a+1]-r[a];if(l+h>s)break;let f=h/i,p=l/i,u=G0(t,f,p,o);c.push(u)}return c}function ZF(e,t,n,r){let s=[];for(let i=0;i<t;i++){let o=n*i,c=G0(e,o,n,r);s.push(c)}return s}function G0(e,t,n,r){let s=[];for(let i=0;i<n;i++)if(e instanceof BigInt64Array||e instanceof BigUint64Array)s.push("");else{let o=e[t+i],c=$F(r,o);c?s.push(c.name):s.push("")}return s}function $F(e,t){for(let n of e.values)if(n.value===t)return n;return null}var V0={};Tt(V0,{decode:()=>e5,name:()=>t5});var I3="EXT_feature_metadata",t5=I3;async function e5(e,t){let n=new Z(e);n5(n,t)}function n5(e,t){if(!t.gltf?.loadBuffers)return;let n=e.getExtension(I3);n&&(t.gltf?.loadImages&&r5(e,n),s5(e,n))}function r5(e,t){let n=t.schema;if(!n)return;let r=n.classes,{featureTextures:s}=t;if(r&&s)for(let i in r){let o=r[i],c=o5(s,i);c&&a5(e,c,o)}}function s5(e,t){let n=t.schema;if(!n)return;let r=n.classes,s=t.featureTables;if(r&&s)for(let i in r){let o=i5(s,i);o&&c5(e,n,o)}}function i5(e,t){for(let n in e){let r=e[n];if(r.class===t)return r}return null}function o5(e,t){for(let n in e){let r=e[n];if(r.class===t)return r}return null}function c5(e,t,n){if(!n.class)return;let r=t.classes?.[n.class];if(!r)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);let s=n.count;for(let i in r.properties){let o=r.properties[i],c=n.properties?.[i];if(c){let a=h5(e,t,o,s,c);c.data=a}}}function a5(e,t,n){let r=t.class;for(let s in n.properties){let i=t?.properties?.[s];if(i){let o=d5(e,i,r);i.data=o}}}function h5(e,t,n,r,s){let i=[],o=s.bufferView,c=e.getTypedArrayForBufferView(o),a=l5(e,n,s,r),h=f5(e,n,s,r);return n.type==="STRING"||n.componentType==="STRING"?i=ma(r,c,a,h):p5(n)&&(i=u5(n,r,c,a)),i}function l5(e,t,n,r){return t.type==="ARRAY"&&typeof t.componentCount>"u"&&typeof n.arrayOffsetBufferView<"u"?ps(e,n.arrayOffsetBufferView,n.offsetType||"UINT32",r):null}function f5(e,t,n,r){return typeof n.stringOffsetBufferView<"u"?ps(e,n.stringOffsetBufferView,n.offsetType||"UINT32",r):null}function p5(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 u5(e,t,n,r){let s=e.type==="ARRAY",i=e.componentCount,o="SCALAR",c=e.componentType||e.type,a=wi(o,c),h=n.byteLength/a,l=us(n,o,c,h);return s?r?ua(l,t,r,n.length,a):i?da(l,t,i):[]:l}function d5(e,t,n){let r=e.gltf.json;if(!r.meshes)return[];let s=[];for(let i of r.meshes)for(let o of i.primitives)m5(e,n,t,s,o);return s}function m5(e,t,n,r,s){let i={channels:n.channels,...n.texture},o=ds(e,i,s);o&&pa(e,t,o,r,s)}var P3="4.2.1";var ms=!0,O3=1735152710,H0=12,ga=8,g5=1313821514,x5=5130562,M5=0,A5=0,y5=1;function E5(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 v3(e,t=0,n={}){let r=new DataView(e),{magic:s=O3}=n,i=r.getUint32(t,!1);return i===s||i===O3}function N3(e,t,n=0,r={}){let s=new DataView(t),i=E5(s,n+0),o=s.getUint32(n+4,ms),c=s.getUint32(n+8,ms);switch(Object.assign(e,{header:{byteOffset:n,byteLength:c,hasBinChunk:!1},type:i,version:o,json:{},binChunks:[]}),n+=H0,e.version){case 1:return T5(e,s,n);case 2:return _5(e,s,n,r={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function T5(e,t,n){q(e.header.byteLength>H0+ga);let r=t.getUint32(n+0,ms),s=t.getUint32(n+4,ms);return n+=ga,q(s===M5),q0(e,t,n,r),n+=r,n+=k0(e,t,n,e.header.byteLength),n}function _5(e,t,n,r){return q(e.header.byteLength>H0+ga),S5(e,t,n,r),n+e.header.byteLength}function S5(e,t,n,r){for(;n+8<=e.header.byteLength;){let s=t.getUint32(n+0,ms),i=t.getUint32(n+4,ms);switch(n+=ga,i){case g5:q0(e,t,n,s);break;case x5:k0(e,t,n,s);break;case A5:r.strict||q0(e,t,n,s);break;case y5:r.strict||k0(e,t,n,s);break;default:break}n+=on(s,4)}return n}function q0(e,t,n,r){let s=new Uint8Array(t.buffer,n,r),o=new TextDecoder("utf8").decode(s);return e.json=JSON.parse(o),on(r,4)}function k0(e,t,n,r){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:n,byteLength:r,arrayBuffer:t.buffer}),on(r,4)}function Y0(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;let r=t.baseUri||t.uri;if(!r)throw new Error(`'baseUri' must be provided to resolve relative url ${e}`);return r.substr(0,r.lastIndexOf("/")+1)+e}var J0={};Tt(J0,{decode:()=>F5,name:()=>N5});var C5="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",B5="B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",L5=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]),R5=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]),b5={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},w5={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function F3(e,t,n,r,s,i="NONE"){let o=await I5();v5(o,o.exports[w5[s]],e,t,n,r,o.exports[b5[i||"NONE"]])}var W0;async function I5(){return W0||(W0=P5()),W0}async function P5(){let e=C5;WebAssembly.validate(L5)&&(e=B5,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(O5(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function O5(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r){let s=e.charCodeAt(r);t[r]=s>96?s-71:s>64?s-65:s>47?s+4:s>46?63:62}let n=0;for(let r=0;r<e.length;++r)t[n++]=t[r]<60?R5[t[r]]:(t[r]-60)*64+t[++r];return t.buffer.slice(0,n)}function v5(e,t,n,r,s,i,o){let c=e.exports.sbrk,a=r+3&-4,h=c(a*s),l=c(i.length),f=new Uint8Array(e.exports.memory.buffer);f.set(i,l);let p=t(h,r,s,l,i.length);if(p===0&&o&&o(h,a,s),n.set(f.subarray(h,h+r*s)),c(h-c(0)),p!==0)throw new Error(`Malformed buffer data: ${p}`)}var xa="EXT_meshopt_compression",N5=xa;async function F5(e,t){let n=new Z(e);if(!t?.gltf?.decompressMeshes||!t.gltf?.loadBuffers)return;let r=[];for(let s of e.json.bufferViews||[])r.push(D5(n,s));await Promise.all(r),n.removeExtension(xa)}async function D5(e,t){let n=e.getObjectExtension(t,xa);if(n){let{byteOffset:r=0,byteLength:s=0,byteStride:i,count:o,mode:c,filter:a="NONE",buffer:h}=n,l=e.gltf.buffers[h],f=new Uint8Array(l.arrayBuffer,l.byteOffset+r,s),p=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await F3(p,o,i,f,c,a),e.removeObjectExtension(t,xa)}}var j0={};Tt(j0,{name:()=>U5,preprocess:()=>G5});var gs="EXT_texture_webp",U5=gs;function G5(e,t){let n=new Z(e);if(!_l("image/webp")){if(n.getRequiredExtensions().includes(gs))throw new Error(`gltf: Required extension ${gs} not supported by browser`);return}let{json:r}=n;for(let s of r.textures||[]){let i=n.getObjectExtension(s,gs);i&&(s.source=i.source),n.removeObjectExtension(s,gs)}n.removeExtension(gs)}var X0={};Tt(X0,{name:()=>z5,preprocess:()=>V5});var Ma="KHR_texture_basisu",z5=Ma;function V5(e,t){let n=new Z(e),{json:r}=n;for(let s of r.textures||[]){let i=n.getObjectExtension(s,Ma);i&&(s.source=i.source,n.removeObjectExtension(s,Ma))}n.removeExtension(Ma)}var Q0={};Tt(Q0,{decode:()=>W5,encode:()=>J5,name:()=>H5,preprocess:()=>Y5});function D3(e){let t={};for(let n in e){let r=e[n];if(n!=="indices"){let s=K0(r);t[n]=s}}return t}function K0(e){let{buffer:t,size:n,count:r}=q5(e);return{value:t,size:n,byteOffset:0,count:r,type:fa(n),componentType:ls(t)}}function q5(e){let t=e,n=1,r=0;return e&&e.value&&(t=e.value,n=e.size||1),t&&(ArrayBuffer.isView(t)||(t=k5(t,Float32Array)),r=t.length/n),{buffer:t,size:n,count:r}}function k5(e,t,n=!1){return e?Array.isArray(e)?new t(e):n&&!(e instanceof t)?new t(e):e:null}var In="KHR_draco_mesh_compression",H5=In;function Y5(e,t,n){let r=new Z(e);for(let s of U3(r))r.getObjectExtension(s,In)}async function W5(e,t,n){if(!t?.gltf?.decompressMeshes)return;let r=new Z(e),s=[];for(let i of U3(r))r.getObjectExtension(i,In)&&s.push(j5(r,i,t,n));await Promise.all(s),r.removeExtension(In)}function J5(e,t={}){let n=new Z(e);for(let r of n.json.meshes||[])X5(r,t),n.addRequiredExtension(In)}async function j5(e,t,n,r){let s=e.getObjectExtension(t,In);if(!s)return;let i=e.getTypedArrayForBufferView(s.bufferView),o=Gn(i.buffer,i.byteOffset),c={...n};delete c["3d-tiles"];let a=await Qt(o,jc,c,r),h=D3(a.attributes);for(let[l,f]of Object.entries(h))if(l in t.attributes){let p=t.attributes[l],u=e.getAccessor(p);u?.min&&u?.max&&(f.min=u.min,f.max=u.max)}t.attributes=h,a.indices&&(t.indices=K0(a.indices)),e.removeObjectExtension(t,In),K5(t)}function X5(e,t,n=4,r,s){if(!r.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let i=r.DracoWriter.encodeSync({attributes:e}),o=s?.parseSync?.({attributes:e}),c=r._addFauxAttributes(o.attributes),a=r.addBufferView(i);return{primitives:[{attributes:c,mode:n,extensions:{[In]:{bufferView:a,attributes:c}}}]}}function K5(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*U3(e){for(let t of e.json.meshes||[])for(let n of t.primitives)yield n}var s1={};Tt(s1,{decode:()=>p8,name:()=>h8});var Srt=1/Math.PI*180,Crt=1/180*Math.PI,Q5={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Q5}};var wt=globalThis.mathgl.config;function G3(e,{precision:t=wt.precision}={}){return e=Z5(e),`${parseFloat(e.toPrecision(t))}`}function xs(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Z0(e,t,n){let r=wt.EPSILON;n&&(wt.EPSILON=n);try{if(e===t)return!0;if(xs(e)&&xs(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Z0(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)<=wt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{wt.EPSILON=r}}function Z5(e){return Math.round(e/wt.EPSILON)*wt.EPSILON}var Ms=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:xs(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(wt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+G3(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!Z0(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(wt.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function $5(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function Gt(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function z3(e,t,n=""){if(wt.debug&&!$5(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function $0(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var Aa=class extends Ms{get x(){return this[0]}set x(t){this[0]=Gt(t)}get y(){return this[1]}set y(t){this[1]=Gt(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return Gt(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return Gt(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return $0(t>=0&&t<this.ELEMENTS,"index is out of range"),Gt(this[t])}setComponent(t,n){return $0(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var As=typeof Float32Array<"u"?Float32Array:Array;var Frt=Math.PI/180;function r8(){let e=new As(2);return As!=Float32Array&&(e[0]=0,e[1]=0),e}function q3(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}var Drt=function(){let e=r8();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function k3(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function H3(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function Y3(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function s8(){let e=new As(3);return As!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function i8(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function W3(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function J3(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function ya(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function j3(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function X3(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function K3(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Q3(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Z3(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&i8(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var zrt=function(){let e=s8();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var t1=[0,0,0],Ea,ir=class extends Aa{static get ZERO(){return Ea||(Ea=new ir(0,0,0),Object.freeze(Ea)),Ea}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&xs(t)?this.copy(t):(wt.debug&&(Gt(t),Gt(n),Gt(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return wt.debug&&(Gt(t.x),Gt(t.y),Gt(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]=Gt(t)}angle(t){return Z3(this,t)}cross(t){return W3(this,this,t),this.check()}rotateX({radians:t,origin:n=t1}){return X3(this,this,n,t),this.check()}rotateY({radians:t,origin:n=t1}){return K3(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=t1}){return Q3(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return J3(this,this,t),this.check()}transformAsVector(t){return k3(this,this,t),this.check()}transformByMatrix3(t){return ya(this,this,t),this.check()}transformByMatrix2(t){return H3(this,this,t),this.check()}transformByQuaternion(t){return j3(this,this,t),this.check()}};var Ta=class extends Ms{toString(){let t="[";if(wt.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=Gt(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function $3(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=s}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function tE(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=l*o-c*h,p=-l*i+c*a,u=h*i-o*a,d=n*f+r*p+s*u;return d?(d=1/d,e[0]=f*d,e[1]=(-l*r+s*h)*d,e[2]=(c*r-s*o)*d,e[3]=p*d,e[4]=(l*n-s*a)*d,e[5]=(-c*n+s*i)*d,e[6]=u*d,e[7]=(-h*n+r*a)*d,e[8]=(o*n-r*i)*d,e):null}function eE(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8];return t*(h*i-o*a)+n*(-h*s+o*c)+r*(a*s-i*c)}function e1(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1],d=n[2],g=n[3],m=n[4],M=n[5],E=n[6],A=n[7],y=n[8];return e[0]=p*r+u*o+d*h,e[1]=p*s+u*c+d*l,e[2]=p*i+u*a+d*f,e[3]=g*r+m*o+M*h,e[4]=g*s+m*c+M*l,e[5]=g*i+m*a+M*f,e[6]=E*r+A*o+y*h,e[7]=E*s+A*c+y*l,e[8]=E*i+A*a+y*f,e}function nE(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=p*r+u*o+h,e[7]=p*s+u*c+l,e[8]=p*i+u*a+f,e}function rE(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=Math.sin(n),u=Math.cos(n);return e[0]=u*r+p*o,e[1]=u*s+p*c,e[2]=u*i+p*a,e[3]=u*o-p*r,e[4]=u*c-p*s,e[5]=u*a-p*i,e[6]=h,e[7]=l,e[8]=f,e}function n1(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=s*t[3],e[4]=s*t[4],e[5]=s*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function sE(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[3]=l-M,e[6]=p+m,e[1]=l+M,e[4]=1-h-d,e[7]=u-g,e[2]=p-m,e[5]=u+g,e[8]=1-h-f,e}var r1;(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"})(r1||(r1={}));var o8=Object.freeze([1,0,0,0,1,0,0,0,1]),Qe=class extends Ta{static get IDENTITY(){return a8()}static get ZERO(){return c8()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return r1}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(o8)}fromObject(t){return this.check()}fromQuaternion(t){return sE(this,t),this.check()}set(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=h,this.check()}determinant(){return eE(this)}transpose(){return $3(this,this),this.check()}invert(){return tE(this,this),this.check()}multiplyLeft(t){return e1(this,t,this),this.check()}multiplyRight(t){return e1(this,this,t),this.check()}rotate(t){return rE(this,this,t),this.check()}scale(t){return Array.isArray(t)?n1(this,this,t):n1(this,this,[t,t]),this.check()}translate(t){return nE(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=q3(n||[-0,-0],t,this);break;case 3:r=ya(n||[-0,-0,-0],t,this);break;case 4:r=Y3(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return z3(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},_a,Sa=null;function c8(){return _a||(_a=new Qe([0,0,0,0,0,0,0,0,0]),Object.freeze(_a)),_a}function a8(){return Sa||(Sa=new Qe,Object.freeze(Sa)),Sa}var Ba="KHR_texture_transform",h8=Ba,Ca=new ir,l8=new Qe,f8=new Qe;async function p8(e,t){if(!new Z(e).hasExtension(Ba)||!t.gltf?.loadBuffers)return;let s=e.json.materials||[];for(let i=0;i<s.length;i++)u8(i,e)}function u8(e,t){let n=t.json.materials?.[e],r=[n?.pbrMetallicRoughness?.baseColorTexture,n?.emissiveTexture,n?.normalTexture,n?.occlusionTexture,n?.pbrMetallicRoughness?.metallicRoughnessTexture],s=[];for(let i of r)i&&i?.extensions?.[Ba]&&d8(t,e,i,s)}function d8(e,t,n,r){let s=m8(n,r);if(!s)return;let i=e.json.meshes||[];for(let o of i)for(let c of o.primitives){let a=c.material;Number.isFinite(a)&&t===a&&g8(e,c,s)}}function m8(e,t){let n=e.extensions?.[Ba],{texCoord:r=0}=e,{texCoord:s=r}=n;if(!(t.findIndex(([o,c])=>o===r&&c===s)!==-1)){let o=A8(n);return r!==s&&(e.texCoord=s),t.push([r,s]),{originalTexCoord:r,texCoord:s,matrix:o}}return null}function g8(e,t,n){let{originalTexCoord:r,texCoord:s,matrix:i}=n,o=t.attributes[`TEXCOORD_${r}`];if(Number.isFinite(o)){let c=e.json.accessors?.[o];if(c&&c.bufferView){let a=e.json.bufferViews?.[c.bufferView];if(a){let{arrayBuffer:h,byteOffset:l}=e.buffers[a.buffer],f=(l||0)+(c.byteOffset||0)+(a.byteOffset||0),{ArrayType:p,length:u}=fs(c,a),d=la[c.componentType],g=ha[c.type],m=a.byteStride||d*g,M=new Float32Array(u);for(let E=0;E<c.count;E++){let A=new p(h,f+E*m,2);Ca.set(A[0],A[1],1),Ca.transformByMatrix3(i),M.set([Ca[0],Ca[1]],E*g)}r===s?x8(c,a,e.buffers,M):M8(s,c,t,e,M)}}}}function x8(e,t,n,r){e.componentType=5126,n.push({arrayBuffer:r.buffer,byteOffset:0,byteLength:r.buffer.byteLength}),t.buffer=n.length-1,t.byteLength=r.buffer.byteLength,t.byteOffset=0,delete t.byteStride}function M8(e,t,n,r,s){r.buffers.push({arrayBuffer:s.buffer,byteOffset:0,byteLength:s.buffer.byteLength});let i=r.json.bufferViews;if(!i)return;i.push({buffer:r.buffers.length-1,byteLength:s.buffer.byteLength,byteOffset:0});let o=r.json.accessors;o&&(o.push({bufferView:i?.length-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),n.attributes[`TEXCOORD_${e}`]=o.length-1)}function A8(e){let{offset:t=[0,0],rotation:n=0,scale:r=[1,1]}=e,s=new Qe().set(1,0,0,0,1,0,t[0],t[1],1),i=l8.set(Math.cos(n),Math.sin(n),0,-Math.sin(n),Math.cos(n),0,0,0,1),o=f8.set(r[0],0,0,0,r[1],0,0,0,1);return s.multiplyRight(i).multiplyRight(o)}var i1={};Tt(i1,{decode:()=>E8,encode:()=>T8,name:()=>y8});var or="KHR_lights_punctual",y8=or;async function E8(e){let t=new Z(e),{json:n}=t,r=t.getExtension(or);r&&(t.json.lights=r.lights,t.removeExtension(or));for(let s of n.nodes||[]){let i=t.getObjectExtension(s,or);i&&(s.light=i.light),t.removeObjectExtension(s,or)}}async function T8(e){let t=new Z(e),{json:n}=t;if(n.lights){let r=t.addExtension(or);St(!r.lights),r.lights=n.lights,delete n.lights}if(t.json.lights){for(let r of t.json.lights){let s=r.node;t.addObjectExtension(s,or,r)}delete t.json.lights}}var o1={};Tt(o1,{decode:()=>S8,encode:()=>C8,name:()=>_8});var Ii="KHR_materials_unlit",_8=Ii;async function S8(e){let t=new Z(e),{json:n}=t;for(let r of n.materials||[])r.extensions&&r.extensions.KHR_materials_unlit&&(r.unlit=!0),t.removeObjectExtension(r,Ii);t.removeExtension(Ii)}function C8(e){let t=new Z(e),{json:n}=t;if(t.materials)for(let r of n.materials||[])r.unlit&&(delete r.unlit,t.addObjectExtension(r,Ii,{}),t.addExtension(Ii))}var c1={};Tt(c1,{decode:()=>L8,encode:()=>R8,name:()=>B8});var Pi="KHR_techniques_webgl",B8=Pi;async function L8(e){let t=new Z(e),{json:n}=t,r=t.getExtension(Pi);if(r){let s=b8(r,t);for(let i of n.materials||[]){let o=t.getObjectExtension(i,Pi);o&&(i.technique=Object.assign({},o,s[o.technique]),i.technique.values=w8(i.technique,t)),t.removeObjectExtension(i,Pi)}t.removeExtension(Pi)}}async function R8(e,t){}function b8(e,t){let{programs:n=[],shaders:r=[],techniques:s=[]}=e,i=new TextDecoder;return r.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=i.decode(t.getTypedArrayForBufferView(o.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),n.forEach(o=>{o.fragmentShader=r[o.fragmentShader],o.vertexShader=r[o.vertexShader]}),s.forEach(o=>{o.program=n[o.program]}),s}function w8(e,t){let n=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(r=>{e.uniforms[r].value&&!(r in n)&&(n[r]=e.uniforms[r].value)}),Object.keys(n).forEach(r=>{typeof n[r]=="object"&&n[r].index!==void 0&&(n[r].texture=t.getTexture(n[r].index))}),n}var iE=[z0,D0,J0,j0,X0,Q0,i1,o1,c1,s1,V0];function oE(e,t={},n){let r=iE.filter(s=>aE(s.name,t));for(let s of r)s.preprocess?.(e,t,n)}async function cE(e,t={},n){let r=iE.filter(s=>aE(s.name,t));for(let s of r)await s.decode?.(e,t,n)}function aE(e,t){let n=t?.gltf?.excludeExtensions||{};return!(e in n&&!n[e])}var a1="KHR_binary_glTF";function hE(e){let t=new Z(e),{json:n}=t;for(let r of n.images||[]){let s=t.getObjectExtension(r,a1);s&&Object.assign(r,s),t.removeObjectExtension(r,a1)}n.buffers&&n.buffers[0]&&delete n.buffers[0].uri,t.removeExtension(a1)}var lE={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},P8={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},h1=class{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;normalize(t,n){this.json=t.json;let r=t.json;switch(r.asset&&r.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${r.asset.version}`);return}if(!n.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(r),this._convertTopLevelObjectsToArrays(r),hE(t),this._convertObjectIdsToArrayIndices(r),this._updateObjects(r),this._updateMaterial(r)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(let n in lE)this._convertTopLevelObjectToArray(t,n)}_convertTopLevelObjectToArray(t,n){let r=t[n];if(!(!r||Array.isArray(r))){t[n]=[];for(let s in r){let i=r[s];i.id=i.id||s;let o=t[n].length;t[n].push(i),this.idToIndexMap[n][s]=o}}}_convertObjectIdsToArrayIndices(t){for(let n in lE)this._convertIdsToIndices(t,n);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(let n of t.textures)this._convertTextureIds(n);for(let n of t.meshes)this._convertMeshIds(n);for(let n of t.nodes)this._convertNodeIds(n);for(let n of t.scenes)this._convertSceneIds(n)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(let n of t.primitives){let{attributes:r,indices:s,material:i}=n;for(let o in r)r[o]=this._convertIdToIndex(r[o],"accessor");s&&(n.indices=this._convertIdToIndex(s,"accessor")),i&&(n.material=this._convertIdToIndex(i,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map(n=>this._convertIdToIndex(n,"node"))),t.meshes&&(t.meshes=t.meshes.map(n=>this._convertIdToIndex(n,"mesh")))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map(n=>this._convertIdToIndex(n,"node")))}_convertIdsToIndices(t,n){t[n]||(console.warn(`gltf v1: json doesn't contain attribute ${n}`),t[n]=[]);for(let r of t[n])for(let s in r){let i=r[s],o=this._convertIdToIndex(i,s);r[s]=o}}_convertIdToIndex(t,n){let r=P8[n];if(r in this.idToIndexMap){let s=this.idToIndexMap[r][t];if(!Number.isFinite(s))throw new Error(`gltf v1: failed to resolve ${n} with id ${t}`);return s}return t}_updateObjects(t){for(let n of this.json.buffers)delete n.type}_updateMaterial(t){for(let n of t.materials){n.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let r=n.values?.tex||n.values?.texture2d_0||n.values?.diffuseTex,s=t.textures.findIndex(i=>i.id===r);s!==-1&&(n.pbrMetallicRoughness.baseColorTexture={index:s})}}};function fE(e,t={}){return new h1().normalize(e,t)}async function pE(e,t,n=0,r,s){return O8(e,t,n,r),fE(e,{normalize:r?.gltf?.normalize}),oE(e,r,s),r?.gltf?.loadBuffers&&e.json.buffers&&await v8(e,r,s),r?.gltf?.loadImages&&await N8(e,r,s),await cE(e,r,s),e}function O8(e,t,n,r){if(r.uri&&(e.baseUri=r.uri),t instanceof ArrayBuffer&&!v3(t,n,r)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=fl(t);else if(t instanceof ArrayBuffer){let o={};n=N3(o,t,n,r.glb),St(o.type==="glTF",`Invalid GLB magic string ${o.type}`),e._glb=o,e.json=o.json}else St(!1,"GLTF: must be ArrayBuffer or string");let s=e.json.buffers||[];if(e.buffers=new Array(s.length).fill(null),e._glb&&e._glb.header.hasBinChunk){let{binChunks:o}=e._glb;e.buffers[0]={arrayBuffer:o[0].arrayBuffer,byteOffset:o[0].byteOffset,byteLength:o[0].byteLength}}let i=e.json.images||[];e.images=new Array(i.length).fill({})}async function v8(e,t,n){let r=e.json.buffers||[];for(let s=0;s<r.length;++s){let i=r[s];if(i.uri){let{fetch:o}=n;St(o);let c=Y0(i.uri,t),h=await(await n?.fetch?.(c))?.arrayBuffer?.();e.buffers[s]={arrayBuffer:h,byteOffset:0,byteLength:h.byteLength},delete i.uri}else e.buffers[s]===null&&(e.buffers[s]={arrayBuffer:new ArrayBuffer(i.byteLength),byteOffset:0,byteLength:i.byteLength})}}async function N8(e,t,n){let r=F8(e),s=e.json.images||[],i=[];for(let o of r)i.push(D8(e,s[o],o,t,n));return await Promise.all(i)}function F8(e){let t=new Set,n=e.json.textures||[];for(let r of n)r.source!==void 0&&t.add(r.source);return Array.from(t).sort()}async function D8(e,t,n,r,s){let i;if(t.uri&&!t.hasOwnProperty("bufferView")){let c=Y0(t.uri,r),{fetch:a}=s;i=await(await a(c)).arrayBuffer(),t.bufferView={data:i}}if(Number.isFinite(t.bufferView)){let c=C3(e.json,e.buffers,t.bufferView);i=Gn(c.buffer,c.byteOffset,c.byteLength)}St(i,"glTF image has no data");let o=await Qt(i,[ln,Jl],{...r,mimeType:t.mimeType,basis:r.basis||{format:tc()}},s);o&&o[0]&&(o={compressed:!0,mipmaps:!1,width:o[0].width,height:o[0].height,data:o[0]}),e.images=e.images||[],e.images[n]=o}var cr={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:P3,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:U8,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function U8(e,t={},n){t={...cr.options,...t},t.gltf={...cr.options.gltf,...t.gltf};let{byteOffset:r=0}=t;return await pE({},e,r,t,n)}var G8={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},z8={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},oe={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},V8={magFilter:oe.TEXTURE_MAG_FILTER,minFilter:oe.TEXTURE_MIN_FILTER,wrapS:oe.TEXTURE_WRAP_S,wrapT:oe.TEXTURE_WRAP_T},q8={[oe.TEXTURE_MAG_FILTER]:oe.LINEAR,[oe.TEXTURE_MIN_FILTER]:oe.NEAREST_MIPMAP_LINEAR,[oe.TEXTURE_WRAP_S]:oe.REPEAT,[oe.TEXTURE_WRAP_T]:oe.REPEAT};function k8(){return{id:"default-sampler",parameters:q8}}function H8(e){return z8[e]}function Y8(e){return G8[e]}var l1=class{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(t,n={}){let{json:r,buffers:s=[],images:i=[]}=t,{baseUri:o=""}=t;return St(r),this.baseUri=o,this.buffers=s,this.images=i,this.jsonUnprocessed=r,this.json=this._resolveTree(t.json,n),this.json}_resolveTree(t,n={}){let r={...t};return this.json=r,t.bufferViews&&(r.bufferViews=t.bufferViews.map((s,i)=>this._resolveBufferView(s,i))),t.images&&(r.images=t.images.map((s,i)=>this._resolveImage(s,i))),t.samplers&&(r.samplers=t.samplers.map((s,i)=>this._resolveSampler(s,i))),t.textures&&(r.textures=t.textures.map((s,i)=>this._resolveTexture(s,i))),t.accessors&&(r.accessors=t.accessors.map((s,i)=>this._resolveAccessor(s,i))),t.materials&&(r.materials=t.materials.map((s,i)=>this._resolveMaterial(s,i))),t.meshes&&(r.meshes=t.meshes.map((s,i)=>this._resolveMesh(s,i))),t.nodes&&(r.nodes=t.nodes.map((s,i)=>this._resolveNode(s,i)),r.nodes=r.nodes.map((s,i)=>this._resolveNodeChildren(s))),t.skins&&(r.skins=t.skins.map((s,i)=>this._resolveSkin(s,i))),t.scenes&&(r.scenes=t.scenes.map((s,i)=>this._resolveScene(s,i))),typeof this.json.scene=="number"&&r.scenes&&(r.scene=r.scenes[this.json.scene]),r}getScene(t){return this._get(this.json.scenes,t)}getNode(t){return this._get(this.json.nodes,t)}getSkin(t){return this._get(this.json.skins,t)}getMesh(t){return this._get(this.json.meshes,t)}getMaterial(t){return this._get(this.json.materials,t)}getAccessor(t){return this._get(this.json.accessors,t)}getCamera(t){return this._get(this.json.cameras,t)}getTexture(t){return this._get(this.json.textures,t)}getSampler(t){return this._get(this.json.samplers,t)}getImage(t){return this._get(this.json.images,t)}getBufferView(t){return this._get(this.json.bufferViews,t)}getBuffer(t){return this._get(this.json.buffers,t)}_get(t,n){if(typeof n=="object")return n;let r=t&&t[n];return r||console.warn(`glTF file error: Could not find ${t}[${n}]`),r}_resolveScene(t,n){return{...t,id:t.id||`scene-${n}`,nodes:(t.nodes||[]).map(r=>this.getNode(r))}}_resolveNode(t,n){let r={...t,id:t?.id||`node-${n}`};return t.mesh!==void 0&&(r.mesh=this.getMesh(t.mesh)),t.camera!==void 0&&(r.camera=this.getCamera(t.camera)),t.skin!==void 0&&(r.skin=this.getSkin(t.skin)),t.meshes!==void 0&&t.meshes.length&&(r.mesh=t.meshes.reduce((s,i)=>{let o=this.getMesh(i);return s.id=o.id,s.primitives=s.primitives.concat(o.primitives),s},{primitives:[]})),r}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map(n=>this.getNode(n))),t}_resolveSkin(t,n){let r=typeof t.inverseBindMatrices=="number"?this.getAccessor(t.inverseBindMatrices):void 0;return{...t,id:t.id||`skin-${n}`,inverseBindMatrices:r}}_resolveMesh(t,n){let r={...t,id:t.id||`mesh-${n}`,primitives:[]};return t.primitives&&(r.primitives=t.primitives.map(s=>{let i={...s,attributes:{},indices:void 0,material:void 0},o=s.attributes;for(let c in o)i.attributes[c]=this.getAccessor(o[c]);return s.indices!==void 0&&(i.indices=this.getAccessor(s.indices)),s.material!==void 0&&(i.material=this.getMaterial(s.material)),i})),r}_resolveMaterial(t,n){let r={...t,id:t.id||`material-${n}`};if(r.normalTexture&&(r.normalTexture={...r.normalTexture},r.normalTexture.texture=this.getTexture(r.normalTexture.index)),r.occlusionTexture&&(r.occlusionTexture={...r.occlusionTexture},r.occlusionTexture.texture=this.getTexture(r.occlusionTexture.index)),r.emissiveTexture&&(r.emissiveTexture={...r.emissiveTexture},r.emissiveTexture.texture=this.getTexture(r.emissiveTexture.index)),r.emissiveFactor||(r.emissiveFactor=r.emissiveTexture?[1,1,1]:[0,0,0]),r.pbrMetallicRoughness){r.pbrMetallicRoughness={...r.pbrMetallicRoughness};let s=r.pbrMetallicRoughness;s.baseColorTexture&&(s.baseColorTexture={...s.baseColorTexture},s.baseColorTexture.texture=this.getTexture(s.baseColorTexture.index)),s.metallicRoughnessTexture&&(s.metallicRoughnessTexture={...s.metallicRoughnessTexture},s.metallicRoughnessTexture.texture=this.getTexture(s.metallicRoughnessTexture.index))}return r}_resolveAccessor(t,n){let r=H8(t.componentType),s=Y8(t.type),i=r*s,o={...t,id:t.id||`accessor-${n}`,bytesPerComponent:r,components:s,bytesPerElement:i,value:void 0,bufferView:void 0,sparse:void 0};if(t.bufferView!==void 0&&(o.bufferView=this.getBufferView(t.bufferView)),o.bufferView){let c=o.bufferView.buffer,{ArrayType:a,byteLength:h}=fs(o,o.bufferView),l=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+c.byteOffset,f=c.arrayBuffer.slice(l,l+h);o.bufferView.byteStride&&(f=this._getValueFromInterleavedBuffer(c,l,o.bufferView.byteStride,o.bytesPerElement,o.count)),o.value=new a(f)}return o}_getValueFromInterleavedBuffer(t,n,r,s,i){let o=new Uint8Array(i*s);for(let c=0;c<i;c++){let a=n+c*r;o.set(new Uint8Array(t.arrayBuffer.slice(a,a+s)),c*s)}return o.buffer}_resolveTexture(t,n){return{...t,id:t.id||`texture-${n}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):k8(),source:typeof t.source=="number"?this.getImage(t.source):void 0}}_resolveSampler(t,n){let r={id:t.id||`sampler-${n}`,...t,parameters:{}};for(let s in r){let i=this._enumSamplerParameter(s);i!==void 0&&(r.parameters[i]=r[s])}return r}_enumSamplerParameter(t){return V8[t]}_resolveImage(t,n){let r={...t,id:t.id||`image-${n}`,image:null,bufferView:t.bufferView!==void 0?this.getBufferView(t.bufferView):void 0},s=this.images[n];return s&&(r.image=s),r}_resolveBufferView(t,n){let r=t.buffer,s=this.buffers[r].arrayBuffer,i=this.buffers[r].byteOffset||0;return t.byteOffset&&(i+=t.byteOffset),{id:`bufferView-${n}`,...t,buffer:this.buffers[r],data:new Uint8Array(s,i,t.byteLength)}}_resolveCamera(t,n){let r={...t,id:t.id||`camera-${n}`};return r.perspective,r.orthographic,r}};function Oi(e,t){return new l1().postProcess(e,t)}var La={URI:0,EMBEDDED:1};function Ra(e,t,n,r){e.rotateYtoZ=!0;let s=(e.byteOffset||0)+(e.byteLength||0)-n;if(s===0)throw new Error("glTF byte length must be greater than 0.");return e.gltfUpAxis=r?.["3d-tiles"]&&r["3d-tiles"].assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",e.gltfArrayBuffer=Gn(t,n,s),e.gltfByteOffset=0,e.gltfByteLength=s,n%4===0||console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`),(e.byteOffset||0)+(e.byteLength||0)}async function ba(e,t,n,r){let s=n?.["3d-tiles"]||{};if(W8(e,t,n),s.loadGLTF){if(!r)return;if(e.gltfUrl){let{fetch:i}=r,o=await i(e.gltfUrl,n);e.gltfArrayBuffer=await o.arrayBuffer(),e.gltfByteOffset=0}if(e.gltfArrayBuffer){let i=await Qt(e.gltfArrayBuffer,cr,n,r);e.gltf=Oi(i),e.gpuMemoryUsageInBytes=bi(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function W8(e,t,n){switch(t){case La.URI:if(e.gltfArrayBuffer){let r=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),i=new TextDecoder().decode(r);e.gltfUrl=i.replace(/[\s\0]+$/,"")}delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case La.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function uE(e,t,n,r,s){n=J8(e,t,n,r,s),await ba(e,La.EMBEDDED,r,s);let i=e?.gltf?.extensions;return i&&i.CESIUM_RTC&&(e.rtcCenter=i.CESIUM_RTC.center),n}function J8(e,t,n,r,s){n=wn(e,t,n),n=as(e,t,n),n=hs(e,t,n,r),n=Ra(e,t,n,r);let i=new Ke(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=i.getGlobalProperty("RTC_CENTER",U.FLOAT,3),n}async function dE(e,t,n,r,s){return n=j8(e,t,n,r,s),await ba(e,e.gltfFormat||0,r,s),n}function j8(e,t,n,r,s){if(n=wn(e,t,n),e.version!==1)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);n=as(e,t,n);let i=new DataView(t);if(e.gltfFormat=i.getUint32(n,!0),n+=4,n=hs(e,t,n,r),n=Ra(e,t,n,r),!e?.header?.featureTableJsonByteLength||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let o=new Ke(e.featureTableJson,e.featureTableBinary),c=o.getGlobalProperty("INSTANCES_LENGTH");if(o.featuresLength=c,!Number.isFinite(c))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=o.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=o.getGlobalProperty("RTC_CENTER",U.FLOAT,3);let a=new sr(e.batchTableJson,e.batchTableBinary,c);return X8(e,o,a,c),n}function X8(e,t,n,r){let s=new Array(r),i=new $,o=new $,c=new $,a=new $,h=new rr,l=new Ri,f=new $,p={},u=new bn,d=[],g=[],m=[],M=[];for(let E=0;E<r;E++){let A;if(t.hasProperty("POSITION"))A=t.getProperty("POSITION",U.FLOAT,3,E,i);else if(t.hasProperty("POSITION_QUANTIZED")){A=t.getProperty("POSITION_QUANTIZED",U.UNSIGNED_SHORT,3,E,i);let x=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",U.FLOAT,3);if(!x)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let R=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",U.FLOAT,3);if(!R)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let b=65535;for(let w=0;w<3;w++)A[w]=A[w]/b*R[w]+x[w]}if(!A)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");i.copy(A),p.translation=i,e.normalUp=t.getProperty("NORMAL_UP",U.FLOAT,3,E,d),e.normalRight=t.getProperty("NORMAL_RIGHT",U.FLOAT,3,E,g);let y=!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",U.UNSIGNED_SHORT,2,E,d),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",U.UNSIGNED_SHORT,2,E,g),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?(z.WGS84.eastNorthUpToFixedFrame(i,u),u.getRotationMatrix3(h)):h.identity()}y&&(a.copy(o).cross(c).normalize(),h.setColumn(0,o),h.setColumn(1,c),h.setColumn(2,a)),l.fromMatrix3(h),p.rotation=l,f.set(1,1,1);let T=t.getProperty("SCALE",U.FLOAT,1,E,m);Number.isFinite(T)&&f.multiplyByScalar(T);let _=t.getProperty("SCALE_NON_UNIFORM",U.FLOAT,3,E,d);_&&f.scale(_),p.scale=f;let L=t.getProperty("BATCH_ID",U.UNSIGNED_SHORT,1,E,M);L===void 0&&(L=E);let C=new bn().fromQuaternion(p.rotation);u.identity(),u.translate(p.translation),u.multiplyRight(C),u.scale(p.scale);let S=u.clone();s[E]={modelMatrix:S,batchId:L}}e.instances=s}async function mE(e,t,n,r,s,i){n=wn(e,t,n);let o=new DataView(t);for(e.tilesLength=o.getUint32(n,!0),n+=4,e.tiles=[];e.tiles.length<e.tilesLength&&(e.byteLength||0)-n>12;){let c={shape:"tile3d"};e.tiles.push(c),n=await i(t,n,r,s,c)}return n}async function gE(e,t,n,r){if(e.rotateYtoZ=!0,e.gltfUpAxis=n?.["3d-tiles"]?.assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",n?.["3d-tiles"]?.loadGLTF){if(!r)return t.byteLength;let s=await Qt(t,cr,n,r);e.gltf=Oi(s),e.gpuMemoryUsageInBytes=bi(e.gltf)}else e.gltfArrayBuffer=t;return t.byteLength}async function f1(e,t=0,n,r,s={shape:"tile3d"}){switch(s.byteOffset=t,s.type=OA(e,t),s.type){case $n.COMPOSITE:return await mE(s,e,t,n,r,f1);case $n.BATCHED_3D_MODEL:return await uE(s,e,t,n,r);case $n.GLTF:return await gE(s,e,n,r);case $n.INSTANCED_3D_MODEL:return await dE(s,e,t,n,r);case $n.POINT_CLOUD:return await _3(s,e,t,n,r);default:throw new Error(`3DTileLoader: unknown type ${s.type}`)}}async function p1(e,t,n){if(new Uint32Array(e.slice(0,4))[0]!==1952609651)throw new Error("Wrong subtree file magic number");if(new Uint32Array(e.slice(4,8))[0]!==1)throw new Error("Wrong subtree file verson, must be 1");let i=xE(e.slice(8,16)),o=new Uint8Array(e,24,i),a=new TextDecoder("utf8").decode(o),h=JSON.parse(a),l=xE(e.slice(16,24)),f=new ArrayBuffer(0);if(l&&(f=e.slice(24+i)),await wa(h,h.tileAvailability,f,n),Array.isArray(h.contentAvailability))for(let p of h.contentAvailability)await wa(h,p,f,n);else await wa(h,h.contentAvailability,f,n);return await wa(h,h.childSubtreeAvailability,f,n),h}async function wa(e,t,n,r){let s=Number.isFinite(t.bitstream)?t.bitstream:t.bufferView;if(typeof s!="number")return;let i=e.bufferViews[s],o=e.buffers[i.buffer];if(!r?.baseUrl)throw new Error("Url is not provided");if(!r.fetch)throw new Error("fetch is not provided");if(o.uri){let a=`${r?.baseUrl||""}/${o.uri}`,l=await(await r.fetch(a)).arrayBuffer();t.explicitBitstream=new Uint8Array(l,i.byteOffset,i.byteLength);return}let c=e.buffers.slice(0,i.buffer).reduce((a,h)=>a+h.byteLength,0);t.explicitBitstream=new Uint8Array(n.slice(c,c+o.byteLength),i.byteOffset,i.byteLength)}function xE(e){let t=new DataView(e),n=t.getUint32(0,!0),r=t.getUint32(4,!0);return n+2**32*r}var Ia={dataType:null,batchType:null,id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Jc,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:p1,options:{}};var GE=G(Fr(),1);var NE=G(Fr(),1);var ce=null;try{ce=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 it(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}it.prototype.__isLong__;Object.defineProperty(it.prototype,"__isLong__",{value:!0});function zt(e){return(e&&e.__isLong__)===!0}function ME(e){var t=Math.clz32(e&-e);return e?31-t:t}it.isLong=zt;var AE={},yE={};function ar(e,t){var n,r,s;return t?(e>>>=0,(s=0<=e&&e<256)&&(r=yE[e],r)?r:(n=K(e,0,!0),s&&(yE[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(r=AE[e],r)?r:(n=K(e,e<0?-1:0,!1),s&&(AE[e]=n),n))}it.fromInt=ar;function ae(e,t){if(isNaN(e))return t?Ze:Me;if(t){if(e<0)return Ze;if(e>=SE)return LE}else{if(e<=-TE)return Xt;if(e+1>=TE)return BE}return e<0?ae(-e,t).neg():K(e%Es|0,e/Es|0,t)}it.fromNumber=ae;function K(e,t,n){return new it(e,t,n)}it.fromBits=K;var Pa=Math.pow;function d1(e,t,n){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(n=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?Ze:Me;if(n=n||10,n<2||36<n)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(r===0)return d1(e.substring(1),t,n).neg();for(var s=ae(Pa(n,8)),i=Me,o=0;o<e.length;o+=8){var c=Math.min(8,e.length-o),a=parseInt(e.substring(o,o+c),n);if(c<8){var h=ae(Pa(n,c));i=i.mul(h).add(ae(a))}else i=i.mul(s),i=i.add(ae(a))}return i.unsigned=t,i}it.fromString=d1;function Ae(e,t){return typeof e=="number"?ae(e,t):typeof e=="string"?d1(e,t):K(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}it.fromValue=Ae;var EE=1<<16,K8=1<<24,Es=EE*EE,SE=Es*Es,TE=SE/2,_E=ar(K8),Me=ar(0);it.ZERO=Me;var Ze=ar(0,!0);it.UZERO=Ze;var ys=ar(1);it.ONE=ys;var CE=ar(1,!0);it.UONE=CE;var u1=ar(-1);it.NEG_ONE=u1;var BE=K(-1,2147483647,!1);it.MAX_VALUE=BE;var LE=K(-1,-1,!0);it.MAX_UNSIGNED_VALUE=LE;var Xt=K(0,-2147483648,!1);it.MIN_VALUE=Xt;var I=it.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low};I.toNumber=function(){return this.unsigned?(this.high>>>0)*Es+(this.low>>>0):this.high*Es+(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(Xt)){var n=ae(t),r=this.div(n),s=r.mul(n).sub(this);return r.toString(t)+s.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var i=ae(Pa(t,6),this.unsigned),o=this,c="";;){var a=o.div(i),h=o.sub(a.mul(i)).toInt()>>>0,l=h.toString(t);if(o=a,o.isZero())return l+c;for(;l.length<6;)l="0"+l;c=""+l+c}};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(Xt)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,n=31;n>0&&!(t&1<<n);n--);return this.high!=0?n+33:n+1};I.isZero=function(){return this.high===0&&this.low===0};I.eqz=I.isZero;I.isNegative=function(){return!this.unsigned&&this.high<0};I.isPositive=function(){return this.unsigned||this.high>=0};I.isOdd=function(){return(this.low&1)===1};I.isEven=function(){return(this.low&1)===0};I.equals=function(t){return zt(t)||(t=Ae(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(zt(t)||(t=Ae(t)),this.eq(t))return 0;var n=this.isNegative(),r=t.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};I.comp=I.compare;I.negate=function(){return!this.unsigned&&this.eq(Xt)?Xt:this.not().add(ys)};I.neg=I.negate;I.add=function(t){zt(t)||(t=Ae(t));var n=this.high>>>16,r=this.high&65535,s=this.low>>>16,i=this.low&65535,o=t.high>>>16,c=t.high&65535,a=t.low>>>16,h=t.low&65535,l=0,f=0,p=0,u=0;return u+=i+h,p+=u>>>16,u&=65535,p+=s+a,f+=p>>>16,p&=65535,f+=r+c,l+=f>>>16,f&=65535,l+=n+o,l&=65535,K(p<<16|u,l<<16|f,this.unsigned)};I.subtract=function(t){return zt(t)||(t=Ae(t)),this.add(t.neg())};I.sub=I.subtract;I.multiply=function(t){if(this.isZero())return this;if(zt(t)||(t=Ae(t)),ce){var n=ce.mul(this.low,this.high,t.low,t.high);return K(n,ce.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?Ze:Me;if(this.eq(Xt))return t.isOdd()?Xt:Me;if(t.eq(Xt))return this.isOdd()?Xt:Me;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(_E)&&t.lt(_E))return ae(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16,s=this.high&65535,i=this.low>>>16,o=this.low&65535,c=t.high>>>16,a=t.high&65535,h=t.low>>>16,l=t.low&65535,f=0,p=0,u=0,d=0;return d+=o*l,u+=d>>>16,d&=65535,u+=i*l,p+=u>>>16,u&=65535,u+=o*h,p+=u>>>16,u&=65535,p+=s*l,f+=p>>>16,p&=65535,p+=i*h,f+=p>>>16,p&=65535,p+=o*a,f+=p>>>16,p&=65535,f+=r*l+s*h+i*a+o*c,f&=65535,K(u<<16|d,f<<16|p,this.unsigned)};I.mul=I.multiply;I.divide=function(t){if(zt(t)||(t=Ae(t)),t.isZero())throw Error("division by zero");if(ce){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var n=(this.unsigned?ce.div_u:ce.div_s)(this.low,this.high,t.low,t.high);return K(n,ce.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Ze:Me;var r,s,i;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return Ze;if(t.gt(this.shru(1)))return CE;i=Ze}else{if(this.eq(Xt)){if(t.eq(ys)||t.eq(u1))return Xt;if(t.eq(Xt))return ys;var o=this.shr(1);return r=o.div(t).shl(1),r.eq(Me)?t.isNegative()?ys:u1:(s=this.sub(t.mul(r)),i=r.add(s.div(t)),i)}else if(t.eq(Xt))return this.unsigned?Ze:Me;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();i=Me}for(s=this;s.gte(t);){r=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var c=Math.ceil(Math.log(r)/Math.LN2),a=c<=48?1:Pa(2,c-48),h=ae(r),l=h.mul(t);l.isNegative()||l.gt(s);)r-=a,h=ae(r,this.unsigned),l=h.mul(t);h.isZero()&&(h=ys),i=i.add(h),s=s.sub(l)}return i};I.div=I.divide;I.modulo=function(t){if(zt(t)||(t=Ae(t)),ce){var n=(this.unsigned?ce.rem_u:ce.rem_s)(this.low,this.high,t.low,t.high);return K(n,ce.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?ME(this.low):ME(this.high)+32};I.ctz=I.countTrailingZeros;I.and=function(t){return zt(t)||(t=Ae(t)),K(this.low&t.low,this.high&t.high,this.unsigned)};I.or=function(t){return zt(t)||(t=Ae(t)),K(this.low|t.low,this.high|t.high,this.unsigned)};I.xor=function(t){return zt(t)||(t=Ae(t)),K(this.low^t.low,this.high^t.high,this.unsigned)};I.shiftLeft=function(t){return zt(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 zt(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 zt(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 n;return zt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?K(this.high,this.low,this.unsigned):t<32?(n=32-t,K(this.low<<t|this.high>>>n,this.high<<t|this.low>>>n,this.unsigned)):(t-=32,n=32-t,K(this.high<<t|this.low>>>n,this.low<<t|this.high>>>n,this.unsigned))};I.rotl=I.rotateLeft;I.rotateRight=function(t){var n;return zt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?K(this.high,this.low,this.unsigned):t<32?(n=32-t,K(this.high<<n|this.low>>>t,this.low<<n|this.high>>>t,this.unsigned)):(t-=32,n=32-t,K(this.low<<n|this.high>>>t,this.high<<n|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,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};I.toBytesBE=function(){var t=this.high,n=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};it.fromBytes=function(t,n,r){return r?it.fromBytesLE(t,n):it.fromBytesBE(t,n)};it.fromBytesLE=function(t,n){return new it(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};it.fromBytesBE=function(t,n){return new it(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)};var Ts=it;var Q8=16;function vi(e){e==="X"&&(e="");let t=e.padEnd(Q8,"0");return Ts.fromString(t,!0,16)}function m1(e){if(e.isZero())return"X";let t=e.countTrailingZeros(),n=t%4;t=(t-n)/4;let r=t;t*=4;let i=e.shiftRightUnsigned(t).toString(16).replace(/0+$/,"");return Array(17-r-i.length).join("0")+i}function g1(e,t){let n=Z8(e).shiftRightUnsigned(2);return e.add(Ts.fromNumber(2*t+1-4).multiply(n))}function Z8(e){return e.and(e.not().add(1))}var $8=3,tD=30,eD=2*tD+1,RE=180/Math.PI;function wE(e){if(e.length===0)throw new Error(`Invalid Hilbert quad key ${e}`);let t=e.split("/"),n=parseInt(t[0],10),r=t[1],s=r.length,i=0,o=[0,0];for(let c=s-1;c>=0;c--){i=s-c;let a=r[c],h=0,l=0;a==="1"?l=1:a==="2"?(h=1,l=1):a==="3"&&(h=1);let f=Math.pow(2,i-1);nD(f,o,h,l),o[0]+=f*h,o[1]+=f*l}if(n%2===1){let c=o[0];o[0]=o[1],o[1]=c}return{face:n,ij:o,level:i}}function IE(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<$8+eD;)t="0"+t;let n=t.lastIndexOf("1"),r=t.substring(0,3),s=t.substring(3,n),i=s.length/2,o=Ts.fromString(r,!0,2).toString(10),c="";if(i!==0)for(c=Ts.fromString(s,!0,2).toString(4);c.length<i;)c="0"+c;return`${o}/${c}`}function x1(e,t,n){let r=1<<t;return[(e[0]+n[0])/r,(e[1]+n[1])/r]}function bE(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function M1(e){return[bE(e[0]),bE(e[1])]}function A1(e,[t,n]){switch(e){case 0:return[1,t,n];case 1:return[-t,1,n];case 2:return[-t,-n,1];case 3:return[-1,-n,-t];case 4:return[n,-1,-t];case 5:return[n,t,-1];default:throw new Error("Invalid face")}}function y1([e,t,n]){let r=Math.atan2(n,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*RE,r*RE]}function nD(e,t,n,r){if(r===0){n===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let s=t[0];t[0]=t[1],t[1]=s}}function PE(e){let t=x1(e.ij,e.level,[.5,.5]),n=M1(t),r=A1(e.face,n);return y1(r)}var rD=100;function E1(e){let{face:t,ij:n,level:r}=e,s=[[0,0],[0,1],[1,1],[1,0],[0,0]],i=Math.max(1,Math.ceil(rD*Math.pow(2,-r))),o=new Float64Array(4*i*2+2),c=0,a=0;for(let h=0;h<4;h++){let l=s[h].slice(0),f=s[h+1],p=(f[0]-l[0])/i,u=(f[1]-l[1])/i;for(let d=0;d<i;d++){l[0]+=p,l[1]+=u;let g=x1(n,r,l),m=M1(g),M=A1(t,m),E=y1(M);Math.abs(E[1])>89.999&&(E[0]=a);let A=E[0]-a;E[0]+=A>180?-360:A<-180?360:0,o[c++]=E[0],o[c++]=E[1],a=E[0]}}return o[c++]=o[0],o[c++]=o[1],o}function _s(e){let t=sD(e);return wE(t)}function sD(e){if(e.indexOf("/")>0)return e;let t=vi(e);return IE(t)}function T1(e){let t=_s(e);return PE(t)}function vE(e){let t;if(e.face===2||e.face===5){let n=null,r=0;for(let s=0;s<4;s++){let i=`${e.face}/${s}`,o=_s(i),c=E1(o);(typeof n>"u"||n===null)&&(n=new Float64Array(4*c.length)),n.set(c,r),r+=c.length}t=OE(n)}else{let n=E1(e);t=OE(n)}return t}function OE(e){if(e.length%2!==0)throw new Error("Invalid corners");let t=[],n=[];for(let r=0;r<e.length;r+=2)t.push(e[r]),n.push(e[r+1]);return t.sort((r,s)=>r-s),n.sort((r,s)=>r-s),{west:t[0],east:t[t.length-1],north:n[n.length-1],south:n[0]}}function _1(e,t){let n=t?.minimumHeight||0,r=t?.maximumHeight||0,s=_s(e),i=vE(s),o=i.west,c=i.south,a=i.east,h=i.north,l=[];return l.push(new $(o,h,n)),l.push(new $(a,h,n)),l.push(new $(a,c,n)),l.push(new $(o,c,n)),l.push(new $(o,h,r)),l.push(new $(a,h,r)),l.push(new $(a,c,r)),l.push(new $(o,c,r)),l}function Oa(e){let t=e.token,n={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},r=_1(t,n),s=T1(t),i=s[0],o=s[1],c=z.WGS84.cartographicToCartesian([i,o,n.maximumHeight]),a=new $(c[0],c[1],c[2]);r.push(a);let h=Xf(r);return[...h.center,...h.halfAxes]}var iD=4,oD=8,cD={QUADTREE:iD,OCTREE:oD};function aD(e,t,n){if(e?.box){let r=vi(e.s2VolumeInfo.token),s=g1(r,t),i=m1(s),o={...e.s2VolumeInfo};switch(o.token=i,n){case"OCTREE":let h=e.s2VolumeInfo,l=h.maximumHeight-h.minimumHeight,f=l/2,p=h.minimumHeight+l/2;h.minimumHeight=p-f,h.maximumHeight=p+f;break;default:break}return{box:Oa(o),s2VolumeInfo:o}}}async function C1(e){let{implicitOptions:t,parentData:n={mortonIndex:0,x:0,y:0,z:0},childIndex:r=0,s2VolumeBox:s,loaderOptions:i}=e,{subtree:o,level:c=0,globalData:a={level:0,mortonIndex:0,x:0,y:0,z:0}}=e,{subdivisionScheme:h,subtreeLevels:l,maximumLevel:f,contentUrlTemplate:p,subtreesUriTemplate:u,basePath:d}=t,g={children:[],lodMetricValue:0,contentUrl:""};if(!f)return ol.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${p} won't be loaded...`),g;let m=c+a.level;if(m>f)return g;let M=cD[h],E=Math.log2(M),A=r&1,y=r>>1&1,T=r>>2&1,_=(M**c-1)/(M-1),L=hr(n.mortonIndex,r,E),C=_+L,S=hr(n.x,A,1),x=hr(n.y,y,1),R=hr(n.z,T,1),b=!1;c>=l&&(b=S1(o.childSubtreeAvailability,L));let w=hr(a.x,S,c),B=hr(a.y,x,c),v=hr(a.z,R,c);if(b){let et=`${d}/${u}`,ot=va(et,m,w,B,v);o=await(0,NE.load)(ot,Ia,i),a={mortonIndex:L,x:S,y:x,z:R,level:c},L=0,C=0,S=0,x=0,R=0,c=0}if(!S1(o.tileAvailability,C))return g;S1(o.contentAvailability,C)&&(g.contentUrl=va(p,m,w,B,v));let tt=c+1,Y={mortonIndex:L,x:S,y:x,z:R};for(let et=0;et<M;et++){let ot=aD(s,et,h),Yt=await C1({subtree:o,implicitOptions:t,loaderOptions:i,parentData:Y,childIndex:et,level:tt,globalData:{...a},s2VolumeBox:ot});if(Yt.contentUrl||Yt.children.length){let zT=m+1,VT=hD(Yt,zT,{childTileX:S,childTileY:x,childTileZ:R},t,s);g.children.push(VT)}}return g}function S1(e,t){let n;return Array.isArray(e)?(n=e[0],e.length>1&&ol.once('Not supported extension "3DTILES_multiple_contents" has been detected')):n=e,"constant"in n?Boolean(n.constant):n.explicitBitstream?pD(t,n.explicitBitstream):!1}function hD(e,t,n,r,s){let{basePath:i,refine:o,getRefine:c,lodMetricType:a,getTileType:h,rootLodMetricValue:l,rootBoundingVolume:f}=r,p=e.contentUrl&&e.contentUrl.replace(`${i}/`,""),u=l/2**t,d=s?.box?{box:s.box}:f,g=lD(t,d,n);return{children:e.children,contentUrl:e.contentUrl,content:{uri:p},id:e.contentUrl,refine:c(o),type:h(e),lodMetricType:a,lodMetricValue:u,geometricError:u,transform:e.transform,boundingVolume:g}}function lD(e,t,n){if(t.region){let{childTileX:r,childTileY:s,childTileZ:i}=n,[o,c,a,h,l,f]=t.region,p=2**e,u=(a-o)/p,d=(h-c)/p,g=(f-l)/p,[m,M]=[o+u*r,o+u*(r+1)],[E,A]=[c+d*s,c+d*(s+1)],[y,T]=[l+g*i,l+g*(i+1)];return{region:[m,E,M,A,y,T]}}if(t.box)return t;throw new Error(`Unsupported bounding volume type ${JSON.stringify(t)}`)}function hr(e,t,n){return(e<<n)+t}function va(e,t,n,r,s){let i=fD({level:t,x:n,y:r,z:s});return e.replace(/{level}|{x}|{y}|{z}/gi,o=>i[o])}function fD(e){let t={};for(let n in e)t[`{${n}}`]=e[n];return t}function pD(e,t){let n=Math.floor(e/8),r=e%8;return(t[n]>>r&1)===1}function L1(e,t=""){if(!t)return ie.EMPTY;let r=t.split("?")[0].split(".").pop();switch(r){case"pnts":return ie.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return ie.SCENEGRAPH;default:return r||ie.EMPTY}}function R1(e){switch(e){case"REPLACE":case"replace":return Nt.REPLACE;case"ADD":case"add":return Nt.ADD;default:return e}}function B1(e,t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){let r=new URL(e,`${t}/`);return decodeURI(r.toString())}else if(e.startsWith("/"))return e;return hn.resolve(t,e)}function FE(e,t){if(!e)return null;let n;if(e.content){let s=e.content.uri||e.content?.url;typeof s<"u"&&(n=B1(s,t))}return{...e,id:n,contentUrl:n,lodMetricType:je.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:L1(e,n),refine:R1(e.refine)}}async function zE(e,t,n){let r=null,s=UE(e.root);s&&e.root?r=await DE(e.root,e,t,s,n):r=FE(e.root,t);let i=[];for(i.push(r);i.length>0;){let o=i.pop()||{},c=o.children||[],a=[];for(let h of c){let l=UE(h),f;l?f=await DE(h,e,t,l,n):f=FE(h,t),f&&(a.push(f),i.push(f))}o.children=a}return r}async function DE(e,t,n,r,s){let{subdivisionScheme:i,maximumLevel:o,availableLevels:c,subtreeLevels:a,subtrees:{uri:h}}=r,l=va(h,0,0,0,0),f=B1(l,n),p=await(0,GE.load)(f,Ia,s),u=e.content?.uri,d=u?B1(u,n):"",g=t?.root?.refine,m=e.geometricError,M=e.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];if(M){let T={box:Oa(M),s2VolumeInfo:M};e.boundingVolume=T}let E=e.boundingVolume,A={contentUrlTemplate:d,subtreesUriTemplate:h,subdivisionScheme:i,subtreeLevels:a,maximumLevel:Number.isFinite(c)?c-1:o,refine:g,basePath:n,lodMetricType:je.GEOMETRIC_ERROR,rootLodMetricValue:m,rootBoundingVolume:E,getTileType:L1,getRefine:R1};return await uD(e,n,p,A,s)}async function uD(e,t,n,r,s){if(!e)return null;let{children:i,contentUrl:o}=await C1({subtree:n,implicitOptions:r,loaderOptions:s}),c,a=null;return o&&(c=o,a={uri:o.replace(`${t}/`,"")}),{...e,id:c,contentUrl:c,lodMetricType:je.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:L1(e,c),refine:R1(e.refine),content:a||e.content,children:i}}function UE(e){return e?.extensions?.["3DTILES_implicit_tiling"]||e?.implicitTiling}var Na={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Jc,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:dD,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function dD(e,t={},n){let r=t["3d-tiles"]||{},s;return r.isTileset==="auto"?s=n?.url&&n.url.indexOf(".json")!==-1:s=r.isTileset,s?mD(e,t,n):gD(e,t,n)}async function mD(e,t,n){let r=JSON.parse(new TextDecoder().decode(e)),s=n?.url||"",i=xD(s),o=await zE(r,i,t||{});return{...r,shape:"tileset3d",loader:Na,url:s,queryString:n?.queryString||"",basePath:i,root:o||r.root,type:Lt.TILES3D,lodMetricType:je.GEOMETRIC_ERROR,lodMetricValue:r.root?.geometricError||0}}async function gD(e,t,n){let r={content:{shape:"tile3d",featureIds:null}};return await f1(e,0,t,n,r.content),r.content}function xD(e){return hn.dirname(e)}var VE=[0],MD={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:Na,onTilesetLoad:{type:"function",value:e=>{}},onTileLoad:{type:"function",value:e=>{}},onTileUnload:{type:"function",value:e=>{}},onTileError:{type:"function",value:(e,t,n)=>{}},_getMeshColor:{type:"function",value:e=>[255,255,255]}},Ni=class extends Pn.CompositeLayer{initializeState(){"onTileLoadFail"in this.props&&Pn.log.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}}get isLoaded(){return Boolean(this.state?.tileset3d?.isLoaded()&&super.isLoaded)}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({props:t,oldProps:n,changeFlags:r}){if(t.data&&t.data!==n.data&&this._loadTileset(t.data),r.viewportChanged){let{activeViewports:s}=this.state;Object.keys(s).length&&(this._updateTileset(s),this.state.lastUpdatedViewports=s,this.state.activeViewports={})}if(r.propsChanged){let{layerMap:s}=this.state;for(let i in s)s[i].needsUpdate=!0}}activateViewport(t){let{activeViewports:n,lastUpdatedViewports:r}=this.state;this.internalState.viewport=t,n[t.id]=t;let s=r?.[t.id];(!s||!t.equals(s))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:t,sourceLayer:n}){let r=n&&n.props.tile;return t.picked&&(t.object=r),t.sourceTile=r,t}filterSubLayer({layer:t,viewport:n}){let{tile:r}=t.props,{id:s}=n;return r.selected&&r.viewportIds.includes(s)}_updateAutoHighlight(t){let n=t.sourceTile,r=this.state.layerMap[n?.id];r&&r.layer&&r.layer.updateAutoHighlight(t)}async _loadTileset(t){let{loadOptions:n={}}=this.props,r=this.props.loader||this.props.loaders,s=Array.isArray(r)?r[0]:r,i={loadOptions:{...n}},o=t;if(s.preload){let h=await s.preload(t,n);h.url&&(o=h.url),h.headers&&(i.loadOptions.fetch={...i.loadOptions.fetch,headers:h.headers}),Object.assign(i,h)}let c=await(0,YE.load)(o,s,i.loadOptions),a=new Si(c,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,...i});this.setState({tileset3d:a,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(a)}_onTileLoad(t){let{lastUpdatedViewports:n}=this.state;this.props.onTileLoad(t),this._updateTileset(n),this.setNeedsUpdate()}_onTileUnload(t){delete this.state.layerMap[t.id],this.props.onTileUnload(t)}_updateTileset(t){if(!t)return;let{tileset3d:n}=this.state,{timeline:r}=this.context,s=Object.keys(t).length;!r||!s||!n||n.selectTiles(Object.values(t)).then(i=>{this.state.frameNumber!==i&&this.setState({frameNumber:i})})}_getSubLayer(t,n){if(!t.content)return null;switch(t.type){case ie.POINTCLOUD:return this._makePointCloudLayer(t,n);case ie.SCENEGRAPH:return this._make3DModelLayer(t);case ie.MESH:return this._makeSimpleMeshLayer(t,n);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${t.content.type}`)}}_makePointCloudLayer(t,n){let{attributes:r,pointCount:s,constantRGBA:i,cartographicOrigin:o,modelMatrix:c}=t.content,{positions:a,normals:h,colors:l}=r;if(!a)return null;let f=n&&n.props.data||{header:{vertexCount:s},attributes:{POSITION:a,NORMAL:h,COLOR_0:l}},{pointSize:p,getPointColor:u}=this.props,d=this.getSubLayerClass("pointcloud",kE.PointCloudLayer);return new d({pointSize:p},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${t.id}`,tile:t,data:f,coordinateSystem:Pn.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:o,modelMatrix:c,getColor:i||u,_offset:0})}_make3DModelLayer(t){let{gltf:n,instances:r,cartographicOrigin:s,modelMatrix:i}=t.content,o=this.getSubLayerClass("scenegraph",HE.ScenegraphLayer);return new o({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${t.id}`,tile:t,data:r||VE,scenegraph:n,coordinateSystem:Pn.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:s,modelMatrix:i,getTransformMatrix:c=>c.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(t,n){let r=t.content,{attributes:s,indices:i,modelMatrix:o,cartographicOrigin:c,coordinateSystem:a=Pn.COORDINATE_SYSTEM.METER_OFFSETS,material:h,featureIds:l}=r,{_getMeshColor:f}=this.props,p=n&&n.props.mesh||new qE.Geometry({topology:"triangle-list",attributes:AD(s),indices:i}),u=this.getSubLayerClass("mesh",hx);return new u(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${t.id}`,tile:t,mesh:p,data:VE,getColor:f(t),pbrMaterial:h,modelMatrix:o,coordinateOrigin:c,coordinateSystem:a,featureIds:l,_offset:0})}renderLayers(){let{tileset3d:t,layerMap:n}=this.state;return t?t.tiles.map(r=>{let s=n[r.id]=n[r.id]||{tile:r},{layer:i}=s;return r.selected&&(i?s.needsUpdate&&(i=this._getSubLayer(r,i),s.needsUpdate=!1):i=this._getSubLayer(r)),s.layer=i,i}).filter(Boolean):null}};Ni.defaultProps=MD;Ni.layerName="Tile3DLayer";var WE=Ni;function AD(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 za=G(le(),1),O1=G(Qo(),1),$E=G(le(),1);var yD=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 b1(e){return e>>1^-(e&1)}function ED(e){let t=0,n={};for(let[r,s]of yD){let i=s===8?e.getFloat64:e.getFloat32;n[r]=i.call(e,t,!0),t+=s}return{header:n,headerEndPosition:t}}function TD(e,t){let n=t,r=3,s=e.getUint32(n,!0),i=new Uint16Array(s*r);n+=Uint32Array.BYTES_PER_ELEMENT;let o=Uint16Array.BYTES_PER_ELEMENT,c=s*o,a=n,h=a+c,l=h+c,f=0,p=0,u=0;for(let d=0;d<s;d++)f+=b1(e.getUint16(a+o*d,!0)),p+=b1(e.getUint16(h+o*d,!0)),u+=b1(e.getUint16(l+o*d,!0)),i[d]=f,i[d+s]=p,i[d+s*2]=u;return n+=c*3,{vertexData:i,vertexDataEndPosition:n}}function Fi(e,t,n,r,s=!0){let i;if(r===2?i=new Uint16Array(e,t,n):i=new Uint32Array(e,t,n),!s)return i;let o=0;for(let c=0;c<i.length;++c){let a=i[c];i[c]=o-a,a===0&&++o}return i}function _D(e,t,n){let r=n,s=3,o=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;r%o!==0&&(r+=o-r%o);let c=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let a=c*3,h=Fi(e.buffer,r,a,o);return r+=a*o,{triangleIndicesEndPosition:r,triangleIndices:h}}function SD(e,t,n){let r=n,s=3,o=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,c=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let a=Fi(e.buffer,r,c,o,!1);r+=c*o;let h=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let l=Fi(e.buffer,r,h,o,!1);r+=h*o;let f=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let p=Fi(e.buffer,r,f,o,!1);r+=f*o;let u=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let d=Fi(e.buffer,r,u,o,!1);return r+=u*o,{edgeIndicesEndPosition:r,westIndices:a,southIndices:l,eastIndices:p,northIndices:d}}function CD(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function BD(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function LD(e,t){let n={};if(e.byteLength<=t)return{extensions:n,extensionsEndPosition:t};let r=t;for(;r<e.byteLength;){let s=e.getUint8(r,!0);r+=Uint8Array.BYTES_PER_ELEMENT;let i=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let o=new DataView(e.buffer,r,i);switch(s){case 1:{n.vertexNormals=CD(o);break}case 2:{n.waterMask=BD(o);break}default:}r+=i}return{extensions:n,extensionsEndPosition:r}}var lr={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},RD={maxDecodingStep:lr.extensions};function w1(e,t){let n=Object.assign({},RD,t),r=new DataView(e),{header:s,headerEndPosition:i}=ED(r);if(n.maxDecodingStep<lr.vertices)return{header:s};let{vertexData:o,vertexDataEndPosition:c}=TD(r,i);if(n.maxDecodingStep<lr.triangleIndices)return{header:s,vertexData:o};let{triangleIndices:a,triangleIndicesEndPosition:h}=_D(r,o,c);if(n.maxDecodingStep<lr.edgeIndices)return{header:s,vertexData:o,triangleIndices:a};let{westIndices:l,southIndices:f,eastIndices:p,northIndices:u,edgeIndicesEndPosition:d}=SD(r,o,h);if(n.maxDecodingStep<lr.extensions)return{header:s,vertexData:o,triangleIndices:a,westIndices:l,northIndices:u,eastIndices:p,southIndices:f};let{extensions:g}=LD(r,d);return{header:s,vertexData:o,triangleIndices:a,westIndices:l,northIndices:u,eastIndices:p,southIndices:f,extensions:g}}function Fa(e,t,n,r){let s=r?wD(r,e.POSITION.value):bD(t),i=new e.POSITION.value.constructor(s.length*6),o=new e.TEXCOORD_0.value.constructor(s.length*4),c=new t.constructor(s.length*6);for(let h=0;h<s.length;h++){let l=s[h];ID({edge:l,edgeIndex:h,attributes:e,skirtHeight:n,newPosition:i,newTexcoord0:o,newTriangles:c})}e.POSITION.value=Hs(e.POSITION.value,i),e.TEXCOORD_0.value=Hs(e.TEXCOORD_0.value,o);let a=t instanceof Array?t.concat(c):Hs(t,c);return{attributes:e,triangles:a}}function bD(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,i)=>Math.min(...s)-Math.min(...i)||Math.max(...s)-Math.max(...i));let n=[],r=0;for(;r<t.length;)t[r][0]===t[r+1]?.[1]&&t[r][1]===t[r+1]?.[0]?r+=2:(n.push(t[r]),r++);return n}function wD(e,t){e.westIndices.sort((r,s)=>t[3*r+1]-t[3*s+1]),e.eastIndices.sort((r,s)=>t[3*s+1]-t[3*r+1]),e.southIndices.sort((r,s)=>t[3*s]-t[3*r]),e.northIndices.sort((r,s)=>t[3*r]-t[3*s]);let n=[];for(let r in e){let s=e[r];for(let i=0;i<s.length-1;i++)n.push([s[i],s[i+1]])}return n}function ID({edge:e,edgeIndex:t,attributes:n,skirtHeight:r,newPosition:s,newTexcoord0:i,newTriangles:o}){let c=n.POSITION.value.length,a=t*2,h=t*2+1;s.set(n.POSITION.value.subarray(e[0]*3,e[0]*3+3),a*3),s[a*3+2]=s[a*3+2]-r,s.set(n.POSITION.value.subarray(e[1]*3,e[1]*3+3),h*3),s[h*3+2]=s[h*3+2]-r,i.set(n.TEXCOORD_0.value.subarray(e[0]*2,e[0]*2+2),a*2),i.set(n.TEXCOORD_0.value.subarray(e[1]*2,e[1]*2+2),h*2);let l=t*2*3;o[l]=e[0],o[l+1]=c/3+h,o[l+2]=e[1],o[l+3]=c/3+h,o[l+4]=e[0],o[l+5]=c/3+a}function I1(e,t={}){let{bounds:n}=t,{header:r,vertexData:s,triangleIndices:i,westIndices:o,northIndices:c,eastIndices:a,southIndices:h}=w1(e,lr.triangleIndices),l=i,f=PD(s,r,n),p=tr(f);if(t?.skirtHeight){let{attributes:u,triangles:d}=Fa(f,l,t.skirtHeight,{westIndices:o,northIndices:c,eastIndices:a,southIndices:h});f=u,l=d}return{loaderData:{header:{}},header:{vertexCount:l.length,boundingBox:p},schema:void 0,topology:"triangle-list",mode:4,indices:{value:l,size:1},attributes:f}}function PD(e,t,n){let{minHeight:r,maxHeight:s}=t,[i,o,c,a]=n||[0,0,1,1],h=c-i,l=a-o,f=s-r,p=e.length/3,u=new Float32Array(p*3),d=new Float32Array(p*2);for(let g=0;g<p;g++){let m=e[g]/32767,M=e[g+p]/32767,E=e[g+p*2]/32767;u[3*g+0]=m*h+i,u[3*g+1]=M*l+o,u[3*g+2]=E*f+r,d[2*g+0]=m,d[2*g+1]=M}return{POSITION:{value:u,size:3},TEXCOORD_0:{value:d,size:2}}}var Di=class{constructor(t=257){this.gridSize=t;let n=t-1;if(n&n-1)throw new Error(`Expected grid size to be 2^n+1, got ${t}.`);this.numTriangles=n*n*2-2,this.numParentTriangles=this.numTriangles-n*n,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let r=0;r<this.numTriangles;r++){let s=r+2,i=0,o=0,c=0,a=0,h=0,l=0;for(s&1?c=a=h=n:i=o=l=n;(s>>=1)>1;){let p=i+c>>1,u=o+a>>1;s&1?(c=i,a=o,i=h,o=l):(i=c,o=a,c=h,a=l),h=p,l=u}let f=r*4;this.coords[f+0]=i,this.coords[f+1]=o,this.coords[f+2]=c,this.coords[f+3]=a}}createTile(t){return new P1(t,this)}},P1=class{constructor(t,n){let r=n.gridSize;if(t.length!==r*r)throw new Error(`Expected terrain data of length ${r*r} (${r} x ${r}), got ${t.length}.`);this.terrain=t,this.martini=n,this.errors=new Float32Array(t.length),this.update()}update(){let{numTriangles:t,numParentTriangles:n,coords:r,gridSize:s}=this.martini,{terrain:i,errors:o}=this;for(let c=t-1;c>=0;c--){let a=c*4,h=r[a+0],l=r[a+1],f=r[a+2],p=r[a+3],u=h+f>>1,d=l+p>>1,g=u+d-l,m=d+h-u,M=(i[l*s+h]+i[p*s+f])/2,E=d*s+u,A=Math.abs(M-i[E]);if(o[E]=Math.max(o[E],A),c<n){let y=(l+m>>1)*s+(h+g>>1),T=(p+m>>1)*s+(f+g>>1);o[E]=Math.max(o[E],o[y],o[T])}}}getMesh(t=0){let{gridSize:n,indices:r}=this.martini,{errors:s}=this,i=0,o=0,c=n-1;r.fill(0);function a(u,d,g,m,M,E){let A=u+g>>1,y=d+m>>1;Math.abs(u-M)+Math.abs(d-E)>1&&s[y*n+A]>t?(a(M,E,u,d,A,y),a(g,m,M,E,A,y)):(r[d*n+u]=r[d*n+u]||++i,r[m*n+g]=r[m*n+g]||++i,r[E*n+M]=r[E*n+M]||++i,o++)}a(0,0,c,c,c,0),a(c,c,0,0,0,c);let h=new Uint16Array(i*2),l=new Uint32Array(o*3),f=0;function p(u,d,g,m,M,E){let A=u+g>>1,y=d+m>>1;if(Math.abs(u-M)+Math.abs(d-E)>1&&s[y*n+A]>t)p(M,E,u,d,A,y),p(g,m,M,E,A,y);else{let T=r[d*n+u]-1,_=r[m*n+g]-1,L=r[E*n+M]-1;h[2*T]=u,h[2*T+1]=d,h[2*_]=g,h[2*_+1]=m,h[2*L]=M,h[2*L+1]=E,l[f++]=T,l[f++]=_,l[f++]=L}}return p(0,0,c,c,c,0),p(c,c,0,0,0,c),{vertices:h,triangles:l}}};var Ui=class{constructor(t,n,r=n){this.data=t,this.width=n,this.height=r,this.coords=[],this.triangles=[],this._halfedges=[],this._candidates=[],this._queueIndices=[],this._queue=[],this._errors=[],this._rms=[],this._pending=[],this._pendingLen=0,this._rmsSum=0;let s=n-1,i=r-1,o=this._addPoint(0,0),c=this._addPoint(s,0),a=this._addPoint(0,i),h=this._addPoint(s,i),l=this._addTriangle(h,o,a,-1,-1,-1);this._addTriangle(o,h,c,l,-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,n){return this.data[this.width*n+t]}_flush(){let t=this.coords;for(let n=0;n<this._pendingLen;n++){let r=this._pending[n],s=2*this.triangles[r*3+0],i=2*this.triangles[r*3+1],o=2*this.triangles[r*3+2];this._findCandidate(t[s],t[s+1],t[i],t[i+1],t[o],t[o+1],r)}this._pendingLen=0}_findCandidate(t,n,r,s,i,o,c){let a=Math.min(t,r,i),h=Math.min(n,s,o),l=Math.max(t,r,i),f=Math.max(n,s,o),p=fr(r,s,i,o,a,h),u=fr(i,o,t,n,a,h),d=fr(t,n,r,s,a,h),g=s-n,m=t-r,M=o-s,E=r-i,A=n-o,y=i-t,T=fr(t,n,r,s,i,o),_=this.heightAt(t,n)/T,L=this.heightAt(r,s)/T,C=this.heightAt(i,o)/T,S=0,x=0,R=0,b=0;for(let w=h;w<=f;w++){let B=0;p<0&&M!==0&&(B=Math.max(B,Math.floor(-p/M))),u<0&&A!==0&&(B=Math.max(B,Math.floor(-u/A))),d<0&&g!==0&&(B=Math.max(B,Math.floor(-d/g)));let v=p+M*B,H=u+A*B,V=d+g*B,tt=!1;for(let Y=a+B;Y<=l;Y++){if(v>=0&&H>=0&&V>=0){tt=!0;let et=_*v+L*H+C*V,ot=Math.abs(et-this.heightAt(Y,w));b+=ot*ot,ot>S&&(S=ot,x=Y,R=w)}else if(tt)break;v+=M,H+=A,V+=g}p+=E,u+=y,d+=m}(x===t&&R===n||x===r&&R===s||x===i&&R===o)&&(S=0),this._candidates[2*c]=x,this._candidates[2*c+1]=R,this._rms[c]=b,this._queuePush(c,S,b)}_step(){let t=this._queuePop(),n=t*3+0,r=t*3+1,s=t*3+2,i=this.triangles[n],o=this.triangles[r],c=this.triangles[s],a=this.coords[2*i],h=this.coords[2*i+1],l=this.coords[2*o],f=this.coords[2*o+1],p=this.coords[2*c],u=this.coords[2*c+1],d=this._candidates[2*t],g=this._candidates[2*t+1],m=this._addPoint(d,g);if(fr(a,h,l,f,d,g)===0)this._handleCollinear(m,n);else if(fr(l,f,p,u,d,g)===0)this._handleCollinear(m,r);else if(fr(p,u,a,h,d,g)===0)this._handleCollinear(m,s);else{let M=this._halfedges[n],E=this._halfedges[r],A=this._halfedges[s],y=this._addTriangle(i,o,m,M,-1,-1,n),T=this._addTriangle(o,c,m,E,-1,y+1),_=this._addTriangle(c,i,m,A,y+2,T+1);this._legalize(y),this._legalize(T),this._legalize(_)}}_addPoint(t,n){let r=this.coords.length>>1;return this.coords.push(t,n),r}_addTriangle(t,n,r,s,i,o,c=this.triangles.length){let a=c/3;return this.triangles[c+0]=t,this.triangles[c+1]=n,this.triangles[c+2]=r,this._halfedges[c+0]=s,this._halfedges[c+1]=i,this._halfedges[c+2]=o,s>=0&&(this._halfedges[s]=c+0),i>=0&&(this._halfedges[i]=c+1),o>=0&&(this._halfedges[o]=c+2),this._candidates[2*a+0]=0,this._candidates[2*a+1]=0,this._queueIndices[a]=-1,this._rms[a]=0,this._pending[this._pendingLen++]=a,c}_legalize(t){let n=this._halfedges[t];if(n<0)return;let r=t-t%3,s=n-n%3,i=r+(t+1)%3,o=r+(t+2)%3,c=s+(n+2)%3,a=s+(n+1)%3,h=this.triangles[o],l=this.triangles[t],f=this.triangles[i],p=this.triangles[c],u=this.coords;if(!OD(u[2*h],u[2*h+1],u[2*l],u[2*l+1],u[2*f],u[2*f+1],u[2*p],u[2*p+1]))return;let d=this._halfedges[i],g=this._halfedges[o],m=this._halfedges[c],M=this._halfedges[a];this._queueRemove(r/3),this._queueRemove(s/3);let E=this._addTriangle(h,p,f,-1,m,d,r),A=this._addTriangle(p,h,l,E,g,M,s);this._legalize(E+1),this._legalize(A+2)}_handleCollinear(t,n){let r=n-n%3,s=r+(n+1)%3,i=r+(n+2)%3,o=this.triangles[i],c=this.triangles[n],a=this.triangles[s],h=this._halfedges[s],l=this._halfedges[i],f=this._halfedges[n];if(f<0){let _=this._addTriangle(t,o,c,-1,l,-1,r),L=this._addTriangle(o,t,a,_,-1,h);this._legalize(_+1),this._legalize(L+2);return}let p=f-f%3,u=p+(f+2)%3,d=p+(f+1)%3,g=this.triangles[u],m=this._halfedges[u],M=this._halfedges[d];this._queueRemove(p/3);let E=this._addTriangle(o,c,t,l,-1,-1,r),A=this._addTriangle(c,g,t,M,-1,E+1,p),y=this._addTriangle(g,a,t,m,-1,A+1),T=this._addTriangle(a,o,t,h,E+2,y+1);this._legalize(E),this._legalize(A),this._legalize(y),this._legalize(T)}_queuePush(t,n,r){let s=this._queue.length;this._queueIndices[t]=s,this._queue.push(t),this._errors.push(n),this._rmsSum+=r,this._queueUp(s)}_queuePop(){let t=this._queue.length-1;return this._queueSwap(0,t),this._queueDown(0,t),this._queuePopBack()}_queuePopBack(){let t=this._queue.pop();return this._errors.pop(),this._rmsSum-=this._rms[t],this._queueIndices[t]=-1,t}_queueRemove(t){let n=this._queueIndices[t];if(n<0){let s=this._pending.indexOf(t);if(s!==-1)this._pending[s]=this._pending[--this._pendingLen];else throw new Error("Broken triangulation (something went wrong).");return}let r=this._queue.length-1;r!==n&&(this._queueSwap(n,r),this._queueDown(n,r)||this._queueUp(n)),this._queuePopBack()}_queueLess(t,n){return this._errors[t]>this._errors[n]}_queueSwap(t,n){let r=this._queue[t],s=this._queue[n];this._queue[t]=s,this._queue[n]=r,this._queueIndices[r]=n,this._queueIndices[s]=t;let i=this._errors[t];this._errors[t]=this._errors[n],this._errors[n]=i}_queueUp(t){let n=t;for(;;){let r=n-1>>1;if(r===n||!this._queueLess(n,r))break;this._queueSwap(r,n),n=r}}_queueDown(t,n){let r=t;for(;;){let s=2*r+1;if(s>=n||s<0)break;let i=s+1,o=s;if(i<n&&this._queueLess(i,s)&&(o=i),!this._queueLess(o,r))break;this._queueSwap(r,o),r=o}return r>t}};function fr(e,t,n,r,s,i){return(n-s)*(t-i)-(r-i)*(e-s)}function OD(e,t,n,r,s,i,o,c){let a=e-o,h=t-c,l=n-o,f=r-c,p=s-o,u=i-c,d=a*a+h*h,g=l*l+f*f,m=p*p+u*u;return a*(f*m-g*u)-h*(l*m-g*p)+d*(l*u-f*p)<0}function XE(e,t){let{meshMaxError:n,bounds:r,elevationDecoder:s}=t,{data:i,width:o,height:c}=e,a,h;switch(t.tesselator){case"martini":a=Da(i,o,c,s,t.tesselator),h=JE(n,o,a);break;case"delatin":a=Da(i,o,c,s,t.tesselator),h=jE(n,o,c,a);break;default:o===c&&!(c&o-1)?(a=Da(i,o,c,s,"martini"),h=JE(n,o,a)):(a=Da(i,o,c,s,"delatin"),h=jE(n,o,c,a));break}let{vertices:l}=h,{triangles:f}=h,p=vD(l,a,o,c,r),u=tr(p);if(t.skirtHeight){let{attributes:d,triangles:g}=Fa(p,f,t.skirtHeight);p=d,f=g}return{loaderData:{header:{}},header:{vertexCount:f.length,boundingBox:u},mode:4,indices:{value:Uint32Array.from(f),size:1},attributes:p}}function JE(e,t,n){let r=t+1,i=new Di(r).createTile(n),{vertices:o,triangles:c}=i.getMesh(e);return{vertices:o,triangles:c}}function jE(e,t,n,r){let s=new Ui(r,t+1,n+1);s.run(e);let{coords:i,triangles:o}=s;return{vertices:i,triangles:o}}function Da(e,t,n,r,s){let{rScaler:i,bScaler:o,gScaler:c,offset:a}=r,h=new Float32Array((t+1)*(n+1));for(let l=0,f=0;f<n;f++)for(let p=0;p<t;p++,l++){let u=l*4,d=e[u+0],g=e[u+1],m=e[u+2];h[l+f]=d*i+g*c+m*o+a}if(s==="martini"){for(let l=(t+1)*t,f=0;f<t;f++,l++)h[l]=h[l-t-1];for(let l=n,f=0;f<n+1;f++,l+=n+1)h[l]=h[l-1]}return h}function vD(e,t,n,r,s){let i=n+1,o=e.length/2,c=new Float32Array(o*3),a=new Float32Array(o*2),[h,l,f,p]=s||[0,0,n,r],u=(f-h)/n,d=(p-l)/r;for(let g=0;g<o;g++){let m=e[g*2],M=e[g*2+1],E=M*i+m;c[3*g+0]=m*u+h,c[3*g+1]=-M*d+p,c[3*g+2]=t[E],a[2*g+0]=m/n,a[2*g+1]=M/r}return{POSITION:{value:c,size:3},TEXCOORD_0:{value:a,size:2}}}var Ua="4.2.1";var Ga={dataType:null,batchType:null,name:"Terrain",id:"terrain",module:"terrain",version:Ua,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 KE={dataType:null,batchType:null,name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:Ua,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var ND={...Ga,parse:FD};async function FD(e,t,n){let r={...t,mimeType:"application/x.image",image:{...t?.image,type:"data"}},s=await Qt(e,[],r,n),i={...ND.options.terrain,...t?.terrain};return XE(s,i)}var Yot={...KE,parseSync:(e,t)=>I1(e,t?.["quantized-mesh"]),parse:async(e,t)=>I1(e,t?.["quantized-mesh"])};var QE=[1],DD={...jn.defaultProps,elevationData:mn,texture:{...mn,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:[Ga]};function ZE(e){return Array.isArray(e)?e.join(";"):e||""}var Gi=class extends za.CompositeLayer{updateState({props:t,oldProps:n}){let r=t.elevationData!==n.elevationData;if(r){let{elevationData:i}=t,o=i&&(Array.isArray(i)||UD(i));this.setState({isTiled:o})}let s=r||t.meshMaxError!==n.meshMaxError||t.elevationDecoder!==n.elevationDecoder||t.bounds!==n.bounds;if(!this.state.isTiled&&s){let i=this.loadTerrain(t);this.setState({terrain:i})}t.workerUrl&&za.log.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain({elevationData:t,bounds:n,elevationDecoder:r,meshMaxError:s,signal:i}){if(!t)return null;let o=this.getLoadOptions();o={...o,terrain:{skirtHeight:this.state.isTiled?s*2:0,...o?.terrain,bounds:n,meshMaxError:s,elevationDecoder:r}};let{fetch:c}=this.props;return c(t,{propName:"elevationData",layer:this,loadOptions:o,signal:i})}getTiledTerrainData(t){let{elevationData:n,fetch:r,texture:s,elevationDecoder:i,meshMaxError:o}=this.props,{viewport:c}=this.context,a=we(n,t),h=s&&we(s,t),{signal:l}=t,f=[0,0],p=[0,0];if(c.isGeospatial){let m=t.bbox;f=c.projectFlat([m.west,m.south]),p=c.projectFlat([m.east,m.north])}else{let m=t.bbox;f=[m.left,m.bottom],p=[m.right,m.top]}let u=[f[0],f[1],p[0],p[1]],d=this.loadTerrain({elevationData:a,bounds:u,elevationDecoder:i,meshMaxError:o,signal:l}),g=h?r(h,{propName:"texture",layer:this,loaders:[],signal:l}).catch(m=>null):Promise.resolve(null);return Promise.all([d,g])}renderSubLayers(t){let n=this.getSubLayerClass("mesh",O1.SimpleMeshLayer),{color:r,wireframe:s,material:i}=this.props,{data:o}=t;if(!o)return null;let[c,a]=o;return new n(t,{data:QE,mesh:c,texture:a,_instanced:!1,coordinateSystem:$E.COORDINATE_SYSTEM.CARTESIAN,getPosition:h=>[0,0,0],getColor:r,wireframe:s,material:i})}onViewportLoad(t){if(!t)return;let{zRange:n}=this.state,r=t.map(o=>o.content).filter(Boolean).map(o=>o[0].header.boundingBox.map(a=>a[2]));if(r.length===0)return;let s=Math.min(...r.map(o=>o[0])),i=Math.max(...r.map(o=>o[1]));(!n||s<n[0]||i>n[1])&&this.setState({zRange:[s,i]})}renderLayers(){let{color:t,material:n,elevationData:r,texture:s,wireframe:i,meshMaxError:o,elevationDecoder:c,tileSize:a,maxZoom:h,minZoom:l,extent:f,maxRequests:p,onTileLoad:u,onTileUnload:d,onTileError:g,maxCacheSize:m,maxCacheByteSize:M,refinementStrategy:E}=this.props;if(this.state.isTiled)return new jn(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:ZE(r),texture:ZE(s),meshMaxError:o,elevationDecoder:c}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:a,maxZoom:h,minZoom:l,extent:f,maxRequests:p,onTileLoad:u,onTileUnload:d,onTileError:g,maxCacheSize:m,maxCacheByteSize:M,refinementStrategy:E});if(!r)return null;let A=this.getSubLayerClass("mesh",O1.SimpleMeshLayer);return new A(this.getSubLayerProps({id:"mesh"}),{data:QE,mesh:this.state.terrain,texture:s,_instanced:!1,getPosition:y=>[0,0,0],getColor:t,material:n,wireframe:i})}};Gi.defaultProps=DD;Gi.layerName="TerrainLayer";var tT=Gi,UD=e=>e.includes("{x}")&&(e.includes("{y}")||e.includes("{-y}"));var nh=G(le(),1),Z1=G(he(),1),vT=G(nT(),1);var zi={x:0,y:1,z:2};function pr(e,t={}){let{start:n=0,end:r=e.length,plane:s="xy"}=t,i=t.size||2,o=0,c=zi[s[0]],a=zi[s[1]];for(let h=n,l=r-i;h<r;h+=i)o+=(e[h+c]-e[l+c])*(e[h+a]+e[l+a]),l=h;return o/2}function N1(e,t,n=2,r,s="xy"){let i=t&&t.length,o=i?t[0]*n:e.length,c=sT(e,0,o,n,!0,r&&r[0],s),a=[];if(!c||c.next===c.prev)return a;let h,l,f,p,u,d,g;if(i&&(c=YD(e,t,c,n,r,s)),e.length>80*n){p=l=e[0],u=f=e[1];for(let m=n;m<o;m+=n)d=e[m],g=e[m+1],d<p&&(p=d),g<u&&(u=g),d>l&&(l=d),g>f&&(f=g);h=Math.max(l-p,f-u),h=h!==0?32767/h:0}return Vi(c,a,n,p,u,h,0),a}function sT(e,t,n,r,s,i,o){let c,a;i===void 0&&(i=pr(e,{start:t,end:n,size:r,plane:o}));let h=zi[o[0]],l=zi[o[1]];if(s===i<0)for(c=t;c<n;c+=r)a=rT(c,e[c+h],e[c+l],a);else for(c=n-r;c>=t;c-=r)a=rT(c,e[c+h],e[c+l],a);return a&&ka(a,a.next)&&(ki(a),a=a.next),a}function ur(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(ka(n,n.next)||pt(n.prev,n,n.next)===0)){if(ki(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function Vi(e,t,n,r,s,i,o){if(!e)return;!o&&i&&KD(e,r,s,i);let c=e,a,h;for(;e.prev!==e.next;){if(a=e.prev,h=e.next,i?qD(e,r,s,i):VD(e)){t.push(a.i/n|0),t.push(e.i/n|0),t.push(h.i/n|0),ki(e),e=h.next,c=h.next;continue}if(e=h,e===c){o?o===1?(e=kD(ur(e),t,n),Vi(e,t,n,r,s,i,2)):o===2&&HD(e,t,n,r,s,i):Vi(ur(e),t,n,r,s,i,1);break}}}function VD(e){let t=e.prev,n=e,r=e.next;if(pt(t,n,r)>=0)return!1;let s=t.x,i=n.x,o=r.x,c=t.y,a=n.y,h=r.y,l=s<i?s<o?s:o:i<o?i:o,f=c<a?c<h?c:h:a<h?a:h,p=s>i?s>o?s:o:i>o?i:o,u=c>a?c>h?c:h:a>h?a:h,d=r.next;for(;d!==t;){if(d.x>=l&&d.x<=p&&d.y>=f&&d.y<=u&&Ss(s,c,i,a,o,h,d.x,d.y)&&pt(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function qD(e,t,n,r){let s=e.prev,i=e,o=e.next;if(pt(s,i,o)>=0)return!1;let c=s.x,a=i.x,h=o.x,l=s.y,f=i.y,p=o.y,u=c<a?c<h?c:h:a<h?a:h,d=l<f?l<p?l:p:f<p?f:p,g=c>a?c>h?c:h:a>h?a:h,m=l>f?l>p?l:p:f>p?f:p,M=v1(u,d,t,n,r),E=v1(g,m,t,n,r),A=e.prevZ,y=e.nextZ;for(;A&&A.z>=M&&y&&y.z<=E;){if(A.x>=u&&A.x<=g&&A.y>=d&&A.y<=m&&A!==s&&A!==o&&Ss(c,l,a,f,h,p,A.x,A.y)&&pt(A.prev,A,A.next)>=0||(A=A.prevZ,y.x>=u&&y.x<=g&&y.y>=d&&y.y<=m&&y!==s&&y!==o&&Ss(c,l,a,f,h,p,y.x,y.y)&&pt(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;A&&A.z>=M;){if(A.x>=u&&A.x<=g&&A.y>=d&&A.y<=m&&A!==s&&A!==o&&Ss(c,l,a,f,h,p,A.x,A.y)&&pt(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;y&&y.z<=E;){if(y.x>=u&&y.x<=g&&y.y>=d&&y.y<=m&&y!==s&&y!==o&&Ss(c,l,a,f,h,p,y.x,y.y)&&pt(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function kD(e,t,n){let r=e;do{let s=r.prev,i=r.next.next;!ka(s,i)&&iT(s,r,r.next,i)&&qi(s,i)&&qi(i,s)&&(t.push(s.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),ki(r),ki(r.next),r=e=i),r=r.next}while(r!==e);return ur(r)}function HD(e,t,n,r,s,i){let o=e;do{let c=o.next.next;for(;c!==o.prev;){if(o.i!==c.i&&$D(o,c)){let a=oT(o,c);o=ur(o,o.next),a=ur(a,a.next),Vi(o,t,n,r,s,i,0),Vi(a,t,n,r,s,i,0);return}c=c.next}o=o.next}while(o!==e)}function YD(e,t,n,r,s,i){let o=[],c,a,h,l,f;for(c=0,a=t.length;c<a;c++)h=t[c]*r,l=c<a-1?t[c+1]*r:e.length,f=sT(e,h,l,r,!1,s&&s[c+1],i),f===f.next&&(f.steiner=!0),o.push(ZD(f));for(o.sort(WD),c=0;c<o.length;c++)n=JD(o[c],n);return n}function WD(e,t){return e.x-t.x}function JD(e,t){let n=jD(e,t);if(!n)return t;let r=oT(n,e);return ur(r,r.next),ur(n,n.next)}function jD(e,t){let n=t,r=e.x,s=e.y,i=-1/0,o;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){let p=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(p<=r&&p>i&&(i=p,o=n.x<n.next.x?n:n.next,p===r))return o}n=n.next}while(n!==t);if(!o)return null;let c=o,a=o.x,h=o.y,l=1/0,f;n=o;do r>=n.x&&n.x>=a&&r!==n.x&&Ss(s<h?r:i,s,a,h,s<h?i:r,s,n.x,n.y)&&(f=Math.abs(s-n.y)/(r-n.x),qi(n,e)&&(f<l||f===l&&(n.x>o.x||n.x===o.x&&XD(o,n)))&&(o=n,l=f)),n=n.next;while(n!==c);return o}function XD(e,t){return pt(e.prev,e,t.prev)<0&&pt(t.next,e,e.next)<0}function KD(e,t,n,r){let s=e;do s.z===0&&(s.z=v1(s.x,s.y,t,n,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,QD(s)}function QD(e){let t,n,r=1,s,i,o,c,a,h;do{for(i=e,e=null,h=null,s=0;i;){for(s++,c=i,o=0,n=0;n<r&&(o++,c=c.nextZ,!!c);n++);for(a=r;o>0||a>0&&c;)o!==0&&(a===0||!c||i.z<=c.z)?(t=i,i=i.nextZ,o--):(t=c,c=c.nextZ,a--),h?h.nextZ=t:e=t,t.prevZ=h,h=t;i=c}h.nextZ=null,r*=2}while(s>1);return e}function v1(e,t,n,r,s){return e=(e-n)*s|0,t=(t-r)*s|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function ZD(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Ss(e,t,n,r,s,i,o,c){return(s-o)*(t-c)>=(e-o)*(i-c)&&(e-o)*(r-c)>=(n-o)*(t-c)&&(n-o)*(i-c)>=(s-o)*(r-c)}function $D(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!t6(e,t)&&(qi(e,t)&&qi(t,e)&&e6(e,t)&&(pt(e.prev,e,t.prev)||pt(e,t.prev,t))||ka(e,t)&&pt(e.prev,e,e.next)>0&&pt(t.prev,t,t.next)>0)}function pt(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function ka(e,t){return e.x===t.x&&e.y===t.y}function iT(e,t,n,r){let s=qa(pt(e,t,n)),i=qa(pt(e,t,r)),o=qa(pt(n,r,e)),c=qa(pt(n,r,t));return!!(s!==i&&o!==c||s===0&&Va(e,n,t)||i===0&&Va(e,r,t)||o===0&&Va(n,e,r)||c===0&&Va(n,t,r))}function Va(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function qa(e){return e>0?1:e<0?-1:0}function t6(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&iT(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function qi(e,t){return pt(e.prev,e,e.next)<0?pt(e,t,e.next)>=0&&pt(e,e.prev,t)>=0:pt(e,t,e.prev)<0||pt(e,e.next,t)<0}function e6(e,t){let n=e,r=!1,s=(e.x+t.x)/2,i=(e.y+t.y)/2;do n.y>i!=n.next.y>i&&n.next.y!==n.y&&s<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function oT(e,t){let n=new Hi(e.i,e.x,e.y),r=new Hi(t.i,t.x,t.y),s=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=s,s.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function rT(e,t,n,r){let s=new Hi(e,t,n);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function ki(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 Hi=class{constructor(t,n,r){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=n,this.y=r}};function U1(e,t,n){let r=o6(e),s=Object.keys(r).filter(i=>r[i]!==Array);return c6(e,{propArrayTypes:r,...t},{numericPropKeys:n&&n.numericPropKeys||s,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function o6(e){let t={};for(let n of e)if(n.properties)for(let r in n.properties){let s=n.properties[r];t[r]=u6(s,t[r])}return t}function c6(e,t,n){let{pointPositionsCount:r,pointFeaturesCount:s,linePositionsCount:i,linePathsCount:o,lineFeaturesCount:c,polygonPositionsCount:a,polygonObjectsCount:h,polygonRingsCount:l,polygonFeaturesCount:f,propArrayTypes:p,coordLength:u}=t,{numericPropKeys:d=[],PositionDataType:g=Float32Array,triangulate:m=!0}=n,M=e[0]&&"id"in e[0],E=e.length>65535?Uint32Array:Uint16Array,A={type:"Point",positions:new g(r*u),globalFeatureIds:new E(r),featureIds:s>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},y={type:"LineString",pathIndices:i>65535?new Uint32Array(o+1):new Uint16Array(o+1),positions:new g(i*u),globalFeatureIds:new E(i),featureIds:c>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},T={type:"Polygon",polygonIndices:a>65535?new Uint32Array(h+1):new Uint16Array(h+1),primitivePolygonIndices:a>65535?new Uint32Array(l+1):new Uint16Array(l+1),positions:new g(a*u),globalFeatureIds:new E(a),featureIds:f>65535?new Uint32Array(a):new Uint16Array(a),numericProps:{},properties:[],fields:[]};m&&(T.triangles=[]);for(let L of[A,y,T])for(let C of d){let S=p[C];L.numericProps[C]=new S(L.positions.length/u)}y.pathIndices[o]=i,T.polygonIndices[h]=a,T.primitivePolygonIndices[l]=a;let _={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 C=L.geometry,S=L.properties||{};switch(C.type){case"Point":a6(C,A,_,u,S),A.properties.push(D1(S,d)),M&&A.fields.push({id:L.id}),_.pointFeature++;break;case"LineString":h6(C,y,_,u,S),y.properties.push(D1(S,d)),M&&y.fields.push({id:L.id}),_.lineFeature++;break;case"Polygon":l6(C,T,_,u,S),T.properties.push(D1(S,d)),M&&T.fields.push({id:L.id}),_.polygonFeature++;break;default:throw new Error("Invalid geometry type")}_.feature++}return p6(A,y,T,u)}function a6(e,t,n,r,s){t.positions.set(e.data,n.pointPosition*r);let i=e.data.length/r;G1(t,s,n.pointPosition,i),t.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+i),t.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+i),n.pointPosition+=i}function h6(e,t,n,r,s){t.positions.set(e.data,n.linePosition*r);let i=e.data.length/r;G1(t,s,n.linePosition,i),t.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+i),t.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+i);for(let o=0,c=e.indices.length;o<c;++o){let a=e.indices[o],h=o===c-1?e.data.length:e.indices[o+1];t.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(h-a)/r}}function l6(e,t,n,r,s){t.positions.set(e.data,n.polygonPosition*r);let i=e.data.length/r;G1(t,s,n.polygonPosition,i),t.globalFeatureIds.fill(n.feature,n.polygonPosition,n.polygonPosition+i),t.featureIds.fill(n.polygonFeature,n.polygonPosition,n.polygonPosition+i);for(let o=0,c=e.indices.length;o<c;++o){let a=n.polygonPosition;t.polygonIndices[n.polygonObject++]=a;let h=e.areas[o],l=e.indices[o],f=e.indices[o+1];for(let u=0,d=l.length;u<d;++u){let g=l[u],m=u===d-1?f===void 0?e.data.length:f[0]:l[u+1];t.primitivePolygonIndices[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(m-g)/r}let p=n.polygonPosition;f6(t,h,l,{startPosition:a,endPosition:p,coordLength:r})}}function f6(e,t,n,{startPosition:r,endPosition:s,coordLength:i}){if(!e.triangles)return;let o=r*i,c=s*i,a=e.positions.subarray(o,c),h=n[0],l=n.slice(1).map(p=>(p-h)/i),f=N1(a,l,i,t);for(let p=0,u=f.length;p<u;++p)e.triangles.push(r+f[p])}function F1(e,t){let n={};for(let r in e)n[r]={value:e[r],size:t};return n}function p6(e,t,n,r){let s={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:r},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:F1(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:r},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:F1(t.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:r},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:F1(n.numericProps,1)}};return s.polygons&&n.triangles&&(s.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),s}function G1(e,t,n,r){for(let s in e.numericProps)if(s in t){let i=t[s];e.numericProps[s].fill(i,n,n+r)}}function D1(e,t){let n={};for(let r in e)t.includes(r)||(n[r]=e[r]);return n}function u6(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function Wa(e,t){let n=t?.globalFeatureId;return n!==void 0?d6(e,n):m6(e,t?.type)}function d6(e,t){let n=lT(e);for(let r of n){let s=0,i=r.featureIds.value[0];for(let o=0;o<r.featureIds.value.length;o++){let c=r.featureIds.value[o];if(c!==i){if(t===r.globalFeatureIds.value[s])return Ha(r,s,o);s=o,i=c}}if(t===r.globalFeatureIds.value[s])return Ha(r,s,r.featureIds.value.length)}throw new Error(`featureId:${t} not found`)}function m6(e,t){let n=lT(e,t);return g6(n)}function hT(e,t,n){switch(e.type){case"Point":return y6(e,t,n);case"LineString":return A6(e,t,n);case"Polygon":return fT(e,t,n);default:let r=e;throw new Error(`Unsupported geometry type: ${r?.type}`)}}function lT(e,t){let n=[];return e.points&&(e.points.type="Point",n.push(e.points)),e.lines&&(e.lines.type="LineString",n.push(e.lines)),e.polygons&&(e.polygons.type="Polygon",n.push(e.polygons)),n}function g6(e){let t=[];for(let n of e){if(n.featureIds.value.length===0)continue;let r=0,s=n.featureIds.value[0];for(let i=0;i<n.featureIds.value.length;i++){let o=n.featureIds.value[i];o!==s&&(t.push(Ha(n,r,i)),r=i,s=o)}t.push(Ha(n,r,n.featureIds.value.length))}return t}function Ha(e,t,n){let r=hT(e,t,n),s=M6(e,t,n),i=x6(e,t,n);return{type:"Feature",geometry:r,properties:s,...i}}function x6(e,t=0,n){return e.fields&&e.fields[e.featureIds.value[t]]}function M6(e,t=0,n){let r=Object.assign({},e.properties[e.featureIds.value[t]]);for(let s in e.numericProps)r[s]=e.numericProps[s].value[t];return r}function fT(e,t=-1/0,n=1/0){let{positions:r}=e,s=e.polygonIndices.value.filter(a=>a>=t&&a<=n),i=e.primitivePolygonIndices.value.filter(a=>a>=t&&a<=n);if(!(s.length>2)){let a=[];for(let h=0;h<i.length-1;h++){let l=i[h],f=i[h+1],p=Ya(r,l,f);a.push(p)}return{type:"Polygon",coordinates:a}}let c=[];for(let a=0;a<s.length-1;a++){let h=s[a],l=s[a+1],f=fT(e,h,l).coordinates;c.push(f)}return{type:"MultiPolygon",coordinates:c}}function A6(e,t=-1/0,n=1/0){let{positions:r}=e,s=e.pathIndices.value.filter(c=>c>=t&&c<=n);if(!(s.length>2))return{type:"LineString",coordinates:Ya(r,s[0],s[1])};let o=[];for(let c=0;c<s.length-1;c++){let a=Ya(r,s[c],s[c+1]);o.push(a)}return{type:"MultiLineString",coordinates:o}}function y6(e,t,n){let{positions:r}=e,s=Ya(r,t,n);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function Ya(e,t,n){t=t||0,n=n||e.value.length/e.size;let r=[];for(let s=t;s<n;s++){let i=Array();for(let o=s*e.size;o<(s+1)*e.size;o++)i.push(Number(e.value[o]));r.push(i)}return r}var W1=G(MT(),1);function AT(e){let t=e.length;if(t<=1)return[e];let n=[],r,s;for(let i=0;i<t;i++){let o=U6(e[i]);o!==0&&(s===void 0&&(s=o<0),s===o<0?(r&&n.push(r),r=[e[i]]):r&&r.push(e[i]))}return r&&n.push(r),n}function U6(e){let t=0;for(let n=0,r=e.length-1,s,i;n<e.length;r=n++)s=e[n],i=e[r],t+=(i[0]-s[0])*(s[1]+i[1]);return t}function yT(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?G6(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function G6(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],s=t._values[e.readVarint()];t.properties[r]=s}}var Ls=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(t,n,r,s,i){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=i,t.readFields(yT,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,s=0,i=0,o=0,c=[],a;for(;t.pos<n;){if(s<=0){let h=t.readVarint();r=h&7,s=h>>3}if(s--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),r===1&&(a&&c.push(a),a=[]),a&&a.push([i,o]);else if(r===7)a&&a.push(a[0].slice());else throw new Error(`unknown command ${r}`)}return a&&c.push(a),c}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,s=0,i=0,o=0,c=1/0,a=-1/0,h=1/0,l=-1/0;for(;t.pos<n;){if(s<=0){let f=t.readVarint();r=f&7,s=f>>3}if(s--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),i<c&&(c=i),i>a&&(a=i),o<h&&(h=o),o>l&&(l=o);else if(r!==7)throw new Error(`unknown command ${r}`)}return[c,h,a,l]}_toGeoJSON(t){let n=this.loadGeometry(),r=Ls.types[this.type],s,i;switch(this.type){case 1:let c=[];for(s=0;s<n.length;s++)c[s]=n[s][0];n=c,t(n,this);break;case 2:for(s=0;s<n.length;s++)t(n[s],this);break;case 3:for(n=AT(n),s=0;s<n.length;s++)for(i=0;i<n[s].length;i++)t(n[s][i],this);break}n.length===1?n=n[0]:r=`Multi${r}`;let o={type:"Feature",geometry:{type:r,coordinates:n},properties:this.properties};return this.id!==null&&(o.id=this.id),o}toGeoJSON(t){if(typeof t=="function")return this._toGeoJSON(t);let{x:n,y:r,z:s}=t,i=this.extent*Math.pow(2,s),o=this.extent*n,c=this.extent*r;function a(h){for(let l=0;l<h.length;l++){let f=h[l];f[0]=(f[0]+o)*360/i-180;let p=180-(f[1]+c)*360/i;f[1]=360/Math.PI*Math.atan(Math.exp(p*Math.PI/180))-90}}return this._toGeoJSON(a)}};var Xa=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(z6,this,n),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let n=this._pbf.readVarint()+this._pbf.pos;return new Ls(this._pbf,n,this.extent,this._keys,this._values)}};function z6(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(V6(n)))}function V6(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var Ka=class{layers;constructor(t,n){this.layers=t.readFields(q6,{},n)}};function q6(e,t,n){if(e===3&&n){let r=new Xa(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function ET(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[pr(e.data)]],indices:[e.indices]};let r=[],s=[],i=[],o=[],c,a=0;for(let h,l=0,f;l<t;l++){f=e.indices[l]-a,h=e.indices[l+1]-a||e.data.length;let p=e.data.slice(f,h),u=pr(p);if(u===0){let d=e.data.slice(0,f),g=e.data.slice(h);e.data=d.concat(g),a+=h-f;continue}c===void 0&&(c=u<0),c===u<0?(o.length&&(r.push(i),s.push(o)),o=[f],i=[u]):(i.push(u),o.push(f))}return i&&r.push(i),o.length&&s.push(o),{type:n,areas:r,indices:s,data:e.data}}function TT(e,t,n,r){for(let s=0,i=e.length;s<i;s+=2){e[s]=(e[s]+t)*360/r-180;let o=180-(e[s+1]+n)*360/r;e[s+1]=360/Math.PI*Math.atan(Math.exp(o*Math.PI/180))-90}}function _T(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?k6(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function k6(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],s=t._values[e.readVarint()];t.properties[r]=s}}var ST,dr,q1,Qa,k1,H1,Yi;var Za=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,n,r,s,i,o){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=i,this._geometryInfo=o,t.readFields(_T,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry,ST=t.readVarint()+t.pos,dr=1,Qa=0,k1=0,H1=0,Yi=0;let n=[],r=[];for(;t.pos<ST;)if(Qa<=0&&(q1=t.readVarint(),dr=q1&7,Qa=q1>>3),Qa--,dr===1||dr===2)k1+=t.readSVarint(),H1+=t.readSVarint(),dr===1&&n.push(Yi),r.push(k1,H1),Yi+=2;else if(dr===7){if(Yi>0){let s=n[n.length-1];r.push(r[s],r[s+1]),Yi+=2}}else throw new Error(`unknown command ${dr}`);return{data:r,indices:n}}_toBinaryCoordinates(t){let n=this.loadGeometry(),r;t(n.data,this);let s=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=n.indices.length,r={type:"Point",...n};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=n.indices.length,this._geometryInfo.linePositionsCount+=n.data.length/s,r={type:"LineString",...n};break;case 3:r=ET(n),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=r.indices.length;for(let o of r.indices)this._geometryInfo.polygonRingsCount+=o.length;this._geometryInfo.polygonPositionsCount+=r.data.length/s;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:r,properties:this.properties};return this.id!==null&&(i.id=this.id),i}toBinaryCoordinates(t){if(typeof t=="function")return this._toBinaryCoordinates(t);let{x:n,y:r,z:s}=t,i=this.extent*Math.pow(2,s),o=this.extent*n,c=this.extent*r;return this._toBinaryCoordinates(a=>TT(a,o,c,i))}};var $a=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(H6,this,n),this.length=this._features.length}feature(t,n){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let r=this._pbf.readVarint()+this._pbf.pos;return new Za(this._pbf,r,this.extent,this._keys,this._values,n)}};function H6(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(Y6(n)))}function Y6(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var th=class{layers;constructor(t,n){this.layers=t.readFields(W6,{},n)}};function W6(e,t,n){if(e===3&&n){let r=new $a(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function J1(e,t){let n=j6(t),r=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(r){case"columnar-table":return{shape:"columnar-table",data:Y1(e,n)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:CT(e,n)};case"geojson":return CT(e,n);case"binary-geometry":return Y1(e,n);case"binary":return Y1(e,n);default:throw new Error(r||"undefined shape")}}function Y1(e,t){let[n,r]=J6(e,t),s=U1(n,r);return s.byteLength=e.byteLength,s}function J6(e,t){let n=[],r={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[n,r];let s=new th(new W1.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(s.layers)).forEach(o=>{let c=s.layers[o];if(c)for(let a=0;a<c.length;a++){let h=c.feature(a,r),l=K6(h,t,o);n.push(l)}}),[n,r]}function CT(e,t){if(e.byteLength<=0)return[];let n=[],r=new Ka(new W1.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(r.layers)).forEach(i=>{let o=r.layers[i];if(o)for(let c=0;c<o.length;c++){let a=o.feature(c),h=X6(a,t,i);n.push(h)}}),n}function j6(e){if(!e?.mvt)throw new Error("mvt options required");let t=e.mvt?.coordinates==="wgs84",{tileIndex:n}=e.mvt,r=n&&Number.isFinite(n.x)&&Number.isFinite(n.y)&&Number.isFinite(n.z);if(t&&!r)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.mvt}function X6(e,t,n){let r=e.toGeoJSON(t.coordinates==="wgs84"?t.tileIndex:Q6);return t.layerProperty&&(r.properties[t.layerProperty]=n),r}function K6(e,t,n){let r=e.toBinaryCoordinates(t.coordinates==="wgs84"?t.tileIndex:Z6);return t.layerProperty&&r.properties&&(r.properties[t.layerProperty]=n),r}function Q6(e,t){let{extent:n}=t;for(let r=0;r<e.length;r++){let s=e[r];s[0]/=n,s[1]/=n}}function Z6(e,t){let{extent:n}=t;for(let r=0,s=e.length;r<s;++r)e[r]/=n}var $6="4.2.1",eh={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:$6,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:null}}},tU={...eh,parse:async(e,t)=>J1(e,t),parseSync:J1,binary:!0};var eU={Point:BT,MultiPoint:nU,LineString:LT,MultiLineString:rU,Polygon:RT,MultiPolygon:sU};function BT([e,t],[n,r],s){let i=en(n[0],r[0],e),o=en(n[1],r[1],t);return s.unprojectFlat([i,o])}function j1(e,t,n){return e.map(r=>BT(r,t,n))}function nU(e,t,n){return j1(e,t,n)}function LT(e,t,n){return j1(e,t,n)}function rU(e,t,n){return e.map(r=>LT(r,t,n))}function RT(e,t,n){return e.map(r=>j1(r,t,n))}function sU(e,t,n){return e.map(r=>RT(r,t,n))}function bT(e,t,n){let r=n.projectFlat([t.west,t.north]),s=n.projectFlat([t.east,t.south]),i=[r,s];return{...e,coordinates:eU[e.type](e.coordinates,i,n)}}var iU=["points","lines","polygons"];function X1(e,t,n,r){for(let s of iU){let i=e[s]&&oU(e[s],t,n,r);if(i>=0)return i}return-1}function oU(e,t,n,r){let s=e.featureIds.value;if(!s.length)return-1;let i=0,o=s[s.length-1]+1;if(r){let a=cU(e,r);if(a)i=a[0],o=a[1]+1;else return-1}let c=-1;if(t in e.numericProps){let a=e.numericProps[t].value.findIndex((h,l)=>h===n&&s[l]>=i&&s[l]<o);return a>=0?e.globalFeatureIds.value[a]:-1}else t?c=wT(e.properties,a=>a[t]===n,i,o):e.fields&&(c=wT(e.fields,a=>a.id===n,i,o));return c>=0?aU(e,c):-1}function cU(e,t){if(!e.__layers){let n={},{properties:r}=e;for(let s=0;s<r.length;s++){let{layerName:i}=r[s];i&&(n[i]?n[i][1]=s:n[i]=[s,s])}e.__layers=n}return e.__layers[t]}function aU(e,t){if(!e.__ids){let n=[],r=e.featureIds.value,s=e.globalFeatureIds.value;for(let i=0;i<r.length;i++)n[r[i]]=s[i];e.__ids=n}return e.__ids[t]}function wT(e,t,n,r){for(let s=n;s<r;s++)if(t(e[s],s))return s;return-1}var K1=512,hU={...Z1.GeoJsonLayer.defaultProps,data:mn,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[eh],binary:!0},Wi=class extends jn{initializeState(){super.initializeState();let t=this.context.viewport.resolution!==void 0?!1:this.props.binary;this.setState({binary:t,data:null,tileJSON:null,hoveredFeatureId:null,hoveredFeatureLayerName:null})}get isLoaded(){return Boolean(this.state?.data&&super.isLoaded)}updateState({props:t,oldProps:n,context:r,changeFlags:s}){s.dataChanged&&this._updateTileData(),this.state?.data&&(super.updateState({props:t,oldProps:n,context:r,changeFlags:s}),this._setWGS84PropertyForTiles());let{highlightColor:i}=t;i!==n.highlightColor&&Array.isArray(i)&&this.setState({highlightColor:i})}async _updateTileData(){let t=this.props.data,n=null;if(typeof t=="string"&&!Ul(t)){let{onDataLoad:r,fetch:s}=this.props;this.setState({data:null,tileJSON:null});try{n=await s(t,{propName:"data",layer:this,loaders:[]})}catch(i){this.raiseError(i,"loading TileJSON"),t=null}r&&r(n,{propName:"data",layer:this})}else t&&typeof t=="object"&&"tilejson"in t&&(n=t);n&&(t=n.tiles),this.setState({data:t,tileJSON:n})}_getTilesetOptions(){let t=super._getTilesetOptions(),n=this.state.tileJSON,{minZoom:r,maxZoom:s}=this.props;return n&&(Number.isFinite(n.minzoom)&&n.minzoom>r&&(t.minZoom=n.minzoom),Number.isFinite(n.maxzoom)&&(!Number.isFinite(s)||n.maxzoom<s)&&(t.maxZoom=n.maxzoom)),t}renderLayers(){return this.state?.data?super.renderLayers():null}getTileData(t){let{data:n,binary:r}=this.state,{index:s,signal:i}=t,o=we(n,t);if(!o)return Promise.reject("Invalid URL");let c=this.getLoadOptions(),{fetch:a}=this.props;return c={...c,mimeType:"application/x-protobuf",mvt:{...c?.mvt,coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:s},gis:r?{format:"binary"}:{}},a(o,{propName:"data",layer:this,loadOptions:c,signal:i})}renderSubLayers(t){let{x:n,y:r,z:s}=t.tile.index,i=Math.pow(2,s),o=K1/i,c=-o,a=K1*n/i,h=K1*(1-r/i),l=new It().scale([o,c,1]);t.autoHighlight=!1,this.context.viewport.resolution||(t.modelMatrix=l,t.coordinateOrigin=[a,h,0],t.coordinateSystem=nh.COORDINATE_SYSTEM.CARTESIAN,t.extensions=[...t.extensions||[],new vT.ClipExtension]);let f=super.renderSubLayers(t);return this.state.binary&&!(f instanceof Z1.GeoJsonLayer)&&nh.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),f}_updateAutoHighlight(t){let{uniqueIdProperty:n}=this.props,{hoveredFeatureId:r,hoveredFeatureLayerName:s}=this.state,i=t.object,o=null,c=null;i&&(o=Q1(i,n),c=IT(i));let{highlightColor:a}=this.props;typeof a=="function"&&(a=a(t)),(r!==o||s!==c)&&this.setState({highlightColor:a,hoveredFeatureId:o,hoveredFeatureLayerName:c})}_isWGS84(){return Boolean(this.context.viewport.resolution)}getPickingInfo(t){let n=super.getPickingInfo(t);if(this.state.binary&&n.index!==-1){let{data:r}=t.sourceLayer.props;n.object=Wa(r,{globalFeatureId:n.index})}return n.object&&!this._isWGS84()&&(n.object=OT(n.object,n.tile.bbox,this.context.viewport)),n}getSubLayerPropsByTile(t){return{highlightedObjectIndex:this.getHighlightedObjectIndex(t),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(t){let{hoveredFeatureId:n,hoveredFeatureLayerName:r,binary:s}=this.state,{uniqueIdProperty:i,highlightedFeatureId:o}=this.props,c=t.content,a=PT(o);if(!(PT(n)||a))return-1;let l=a?o:n;return Array.isArray(c)?c.findIndex(f=>{let p=Q1(f,i)===l,u=a||IT(f)===r;return p&&u}):c&&s?X1(c,i,l,a?"":r):-1}_pickObjects(t){let{deck:n,viewport:r}=this.context,s=r.width,i=r.height,o=r.x,c=r.y,a=[this.id];return n.pickObjects({x:o,y:c,width:s,height:i,layerIds:a,maxObjects:t})}getRenderedFeatures(t=null){let n=this._pickObjects(t),r=new Set,s=[];for(let i of n){let o=Q1(i.object,this.props.uniqueIdProperty);o===void 0?s.push(i.object):r.has(o)||(r.add(o),s.push(i.object))}return s}_setWGS84PropertyForTiles(){let t="dataInWGS84";this.state.tileset.selectedTiles.forEach(r=>{r.hasOwnProperty(t)||Object.defineProperty(r,t,{get:()=>{if(!r.content)return null;if(this.state.binary&&Array.isArray(r.content)&&!r.content.length)return[];let{bbox:s}=r;if(r._contentWGS84===void 0&&Gl(s)){let i=this.state.binary?Wa(r.content):r.content;r._contentWGS84=i.map(o=>OT(o,s,this.context.viewport))}return r._contentWGS84}})})}};Wi.layerName="MVTLayer";Wi.defaultProps=hU;var NT=Wi;function Q1(e,t){if(e.properties&&t)return e.properties[t];if("id"in e)return e.id}function IT(e){return e.properties?.layerName||null}function PT(e){return e!=null&&e!==""}function OT(e,t,n){let r={...e,geometry:{type:e.geometry.type}};return Object.defineProperty(r.geometry,"coordinates",{get:()=>bT(e.geometry,t,n).coordinates}),r}var FT="0123456789bcdefghjkmnpqrstuvwxyz",DT={};for(let e=0;e<FT.length;e++)DT[FT.charAt(e)]=e;var lU=-90,fU=90,pU=-180,uU=180;function dU(e){let t=!0,n=fU,r=lU,s=uU,i=pU,o,c=0;for(let a=0,h=e.length;a<h;a++){let l=e[a].toLowerCase();c=DT[l];for(let f=4;f>=0;f--){let p=c>>f&1;t?(o=(s+i)/2,p===1?i=o:s=o):(o=(n+r)/2,p===1?r=o:n=o),t=!t}}return[r,i,n,s]}function UT(e){let[t,n,r,s]=dU(e);return[s,r,s,t,n,t,n,r,s,r]}var mU={getGeohash:{type:"accessor",value:e=>e.geohash}},Ji=class extends $t{indexToBounds(){let{data:t,getGeohash:n}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(r,s)=>UT(n(r,s))}}};Ji.layerName="GeohashLayer";Ji.defaultProps=mU;var GT=Ji;return jT(ji);})();
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 XB={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(Bc,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 _c(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=XB;var rm=Wn;var y0=D(Or(),1);var de=6356752314245179e-9,WB={radii:[6378137,6378137,de],radiiSquared:[6378137*6378137,6378137*6378137,de*de],oneOverRadii:[1/6378137,1/6378137,1/de],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(de*de)],maximumRadius:Math.max(6378137,6378137,de),centerToleranceSquared:.1};function Co(e){return e}var aU=new x;function YB(e,t=[],r=Co){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 YB(e,t,Q._cartographicRadians?Co:Wi)}function KB(e,t,r=Co){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 KB(e,t,Q._cartographicRadians?Co:Yi)}var im=1e-14,QB=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"}},Cc={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},ZB=new x,$B=new x,tC=new x;function Sc(e,t,r,n,s,o){let i=am[t]&&am[t][r];ft(i&&(!n||n===i));let a,c,l,f=QB.copy(s);if(Et(f.x,0,im)&&Et(f.y,0,im)){let h=Math.sign(f.z);a=ZB.fromArray(Cc[t]),t!=="east"&&t!=="west"&&a.scale(h),c=$B.fromArray(Cc[r]),r!=="east"&&r!=="west"&&c.scale(h),l=tC.fromArray(Cc[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 Nr=new x,eC=new x,rC=new x;function cm(e,t,r=[]){let{oneOverRadii:n,oneOverRadiiSquared:s,centerToleranceSquared:o}=t;Nr.from(e);let i=Nr.x,a=Nr.y,c=Nr.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=eC;if(y.copy(e).scale(m),A<o)return y.to(r);let _=s.x,E=s.y,M=s.z,B=rC;B.set(y.x*_*2,y.y*E*2,y.z*M*2);let C=(1-m)*Nr.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 Nr.scale([b,T,g]).to(r)}var So=new x,lm=new x,oC=new x,Wt=new x,iC=new x,Io=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=oC,[,,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]){Io.from(t);let n=this.scaleToGeodeticSurface(Io,Wt);if(!n)return;let s=this.geodeticSurfaceNormal(n,lm),o=iC;o.copy(Io).subtract(n);let i=Math.atan2(s.y,s.x),a=Math.asin(s.z),c=Math.sign(Je.dot(o,Io))*Je.length(o);return om([i,a,c],r)}eastNorthUpToFixedFrame(t,r=new O){return Sc(this,"east","north","up",t,r)}localFrameToFixedFrame(t,r,n,s,o=new O){return Sc(this,t,r,n,s,o)}geocentricSurfaceNormal(t,r=[0,0,0]){return So.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 So.set(i*Math.cos(s),i*Math.sin(s),Math.sin(o)).normalize(),So.to(r)}geodeticSurfaceNormal(t,r=[0,0,0]){return So.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,de);var wo=class{item;previous;next;constructor(t,r,n){this.item=t,this.previous=r,this.next=n}};var Lo=class{head=null;tail=null;_length=0;get length(){return this._length}add(t){let r=new wo(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 vo=class{_list;_sentinel;_trimTiles;constructor(){this._list=new Lo,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,Ic=new x,wc=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=Ro(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();aC(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:wc,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 aC(e){let t=e.getFrustumPlanes(),r=hm(t.near,e.cameraPosition),n=Ro(e,r),s=Ro(e,e.cameraPosition,Ic),o=0;wc.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,Ic),l=Ro(e,c,Ic);wc.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 Ro(e,t,r=new x){let n=e.unprojectPosition(t);return U.WGS84.cartographicToCartesian(n,r)}var cC=6378137,lC=6378137,Lc=6356752314245179e-9,Dr=new x;function mm(e,t){if(e instanceof Xt){let{halfAxes:r}=e,n=fC(r);return Math.log2(Lc/(n+t[2]))}else if(e instanceof Nt){let{radius:r}=e;return Math.log2(Lc/(r+t[2]))}else if(e.width&&e.height){let{width:r,height:n}=e,s=Math.log2(cC/r),o=Math.log2(lC/n);return(s+o)/2}return 1}function vc(e,t,r){U.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],Dr);let n=Math.sqrt(Math.pow(Dr[0]-r[0],2)+Math.pow(Dr[1]-r[1],2)+Math.pow(Dr[2]-r[2],2));return Math.log2(Lc/(n+t[2]))}function gm(e,t,r){let[n,s,o,i]=e;return vc({xmin:n,xmax:o,ymin:s,ymax:i,zmin:0,zmax:0},t,r)}function fC(e){e.getColumn(0,Dr);let t=e.getColumn(1),r=e.getColumn(2);return Dr.add(t).add(r).len()}var Fm=D(Or(),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 pe;(function(e){e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(pe||(pe={}));var Am={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function Em(e){return e!=null}var gt=new x,Fo=new x,uC=new x,hC=new x,sr=new x,xm=new x,ym=new x,Tm=new x;function Po(e,t,r){if(H(e,"3D Tile: boundingVolume must be defined"),e.box)return Mm(e.box,t,r);if(e.region)return pC(e.region);if(e.sphere)return dC(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 mC(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 gC(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 dC(e,t,r){let n=new x(e[0],e[1],e[2]);t.transform(n,n);let s=t.getScale(Fo),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 pC(e){let[t,r,n,s,o,i]=e,a=U.WGS84.cartographicToCartesian([Lt(t),Lt(s),o],uC),c=U.WGS84.cartographicToCartesian([Lt(n),Lt(r),i],hC),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 mC(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 gC(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]){Fo.copy(c).scale(n);for(let l=0;l<2;l++)gt.copy(r),gt.add(Fo),Bm(t,gt),Fo.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 XU=new x,WU=new x,YU=new O,KU=new x,QU=new x,ZU=new x;function AC(e,t){let r=e*t;return 1-Math.exp(-(r*r))}function xC(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){let r=e.dynamicScreenSpaceErrorComputedDensity,n=e.dynamicScreenSpaceErrorFactor;return AC(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-=xC(n,i),f}var Rc=new x,Sm=new x,Pe=new x,Im=new x,yC=new x,Fc=new O,wm=new O;function Lm(e,t){if(e.lodMetricValue===0||isNaN(e.lodMetricValue))return"DIG";let r=2*Pc(e,t);return r<2?"OUT":!e.header.children||r<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}function Pc(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,Rc),Sm.copy(Rc).subtract(a).normalize(),U.WGS84.eastNorthUpToFixedFrame(a,Fc),wm.copy(Fc).invert(),Pe.copy(Rc).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(Fc).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 yC.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 TC={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={...TC,...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 EC(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 Pc(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(EC(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=Po(t.boundingVolume,this.computedTransform,this.boundingVolume);let r=t.content;r&&(r.boundingVolume&&(this._contentBoundingVolume=Po(r.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=Po(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 Oo=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(Or(),1);var No=class{frameNumberMap=new Map;register(t,r){let n=this.frameNumberMap.get(t)||new Map,s=n.get(r)||0;n.set(r,s+1),this.frameNumberMap.set(t,n)}deregister(t,r){let n=this.frameNumberMap.get(t);if(!n)return;let s=n.get(r)||1;n.set(r,s-1)}isZero(t,r){return(this.frameNumberMap.get(t)?.get(r)||0)===0}};var Oc={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},Do=class{_statusMap;pendingTilesRegister=new No;constructor(){this._statusMap={}}add(t,r,n,s){if(!this._statusMap[r]){let{frameNumber:o,viewport:{id:i}}=s;this._statusMap[r]={request:t,callback:n,key:r,frameState:s,status:Oc.REQUESTED},this.pendingTilesRegister.register(i,o),t().then(a=>{this._statusMap[r].status=Oc.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=Oc.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 Go=class extends ie{_tileManager;constructor(t){super(t),this._tileManager=new Do}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 _C={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:{}},Uo="Tiles In Tileset(s)",Nc="Tiles In Memory",Om="Tiles In View",Nm="Tiles To Render",Dm="Tiles Loaded",Dc="Tiles Loading",Gm="Tiles Unloaded",Um="Failed Tile Loads",Vm="Points/Vertices",Gc="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 vo;_requestScheduler;updatePromise=null;tilesetInitializationPromise;constructor(t,r){this.options={..._C,...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=vc(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(Uo),this.stats.get(Dc),this.stats.get(Nc),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(Gc,"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(Uo).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=Oo;break;case ht.I3S:t=Go;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(Uo).reset(),this.stats.get(Uo).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(Dc).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(Dc).decrementCount()}_addTileToCache(t){this._cache.add(this,t,r=>r._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(Dm).incrementCount(),this.stats.get(Nc).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(Gc).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(Nc).decrementCount(),this.stats.get(Gm).incrementCount(),this.stats.get(Gc).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 Vo="4.3.3";var ir={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},X4=Object.keys(ir);function Uc(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 Vc(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=MC(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 MC(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 Vc(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"},bC={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),IC(r)}finally{this.draco.destroy(r)}}_getAttributeValues(t,r){let n=bC[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=CC(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=SC(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 CC(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 SC(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}function IC(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}var wC="1.5.6",LC="1.4.1",Hc=`https://www.gstatic.com/draco/versioned/decoders/${wC}`,Bt={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},zc={[Bt.DECODER]:`${Hc}/${Bt.DECODER}`,[Bt.DECODER_WASM]:`${Hc}/${Bt.DECODER_WASM}`,[Bt.FALLBACK_DECODER]:`${Hc}/${Bt.FALLBACK_DECODER}`,[Bt.ENCODER]:`https://raw.githubusercontent.com/google/draco/${LC}/javascript/${Bt.ENCODER}`},qc;async function Qm(e){let t=e.modules||{};return t.draco3d?qc||=t.draco3d.createDecoderModule({}).then(r=>({draco:r})):qc||=vC(e),await qc}async function vC(e){let t,r;switch(e.draco&&e.draco.decoderType){case"js":t=await re(zc[Bt.FALLBACK_DECODER],"draco",e,Bt.FALLBACK_DECODER);break;case"wasm":default:[t,r]=await Promise.all([await re(zc[Bt.DECODER],"draco",e,Bt.DECODER),await re(zc[Bt.DECODER_WASM],"draco",e,Bt.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await RC(t,r)}function RC(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e({...r,onModuleLoaded:s=>n({draco:s})})})}var Ho={...km,parse:FC};async function FC(e,t){let{draco:r}=await Qm(t),n=new Zn(r);try{return n.parseSync(e,t?.draco)}finally{n.destroy()}}var PC={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={...PC,...at};var kc={[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},OC={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},Jc="Failed to convert GL type",At=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let r in kc)if(kc[r]===t)return r;throw new Error(Jc)}static fromName(t){let r=OC[t];if(!r)throw new Error(Jc);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=kc[t];if(!r)throw new Error(Jc);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 jc(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 S9=1/256;var I9=new ze,w9=new x,L9=new ze,v9=new ze,R9=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 Xc(e,t,r){return eg(e,t,255,r)}var me=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 NC={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},DC={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]]},GC={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=NC[e.type],a=DC[e.type],c=GC[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?UC(n,r):null}function UC(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 zC(A),A}function Gr(e,t,r){if(!e)return;let n=e.parentCounts;return e.parentIds?r(e,t):n>0?VC(e,t,r):HC(e,t,r)}function VC(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 HC(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 zC(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 zo=(e,t)=>e,qC={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)qC[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=Gr(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 zo(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]=zo(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=Gr(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){Gr(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 Gr(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):zo(c[a],!0):null})}_setHierarchyProperty(t,r,n,s){let o=Gr(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]=zo(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 Ur=4,og="b3dm tile in legacy format.";function Vr(e,t,r){let n=new DataView(t),s;e.header=e.header||{};let o=n.getUint32(r,!0);r+=Ur;let i=n.getUint32(r,!0);r+=Ur;let a=n.getUint32(r,!0);r+=Ur;let c=n.getUint32(r,!0);return r+=Ur,a>=570425344?(r-=Ur*2,s=o,a=i,c=0,o=0,i=0,console.warn(og)):c>=570425344&&(r-=Ur,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 Hr(e,t,r,n){return r=kC(e,t,r,n),r=JC(e,t,r,n),r}function kC(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=Uc(t,r,s);e.featureTableJson=JSON.parse(a)}return r+=s||0,e.featureTableBinary=new Uint8Array(t,r,o),r+=o||0,r}function JC(e,t,r,n){let{batchTableJsonByteLength:s,batchTableBinaryByteLength:o}=e.header||{};if(s&&s>0){let i=Uc(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 Wc(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=jc(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++)Xc(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=Vr(e,t,r),r=Hr(e,t,r,n),XC(e);let{featureTable:o,batchTable:i}=WC(e);return await $C(e,o,i,n,s),YC(e,o,n),KC(e,o,i),QC(e,o),r}function XC(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function WC(e){let t=new me(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=ZC(e,t);return{featureTable:t,batchTable:n}}function YC(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 KC(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=Wc(e,n,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",N.UNSIGNED_BYTE,4))}function QC(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 ZC(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 $C(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 tS(e,f,n,s)}async function tS(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,Ho,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:Wc(e,a,void 0),normals:c,batchIds:l,...h}}var Yc={};pt(Yc,{createExtMeshFeatures:()=>AS,decode:()=>hS,encode:()=>dS,name:()=>uS});function lt(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var qo={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ko={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var eS=1.33,fg=["SCALAR","VEC2","VEC3","VEC4"],rS=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],nS=new Map(rS),sS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},oS={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},iS={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=nS.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function zr(e,t){let r=iS[e.componentType],n=sS[e.type],s=oS[e.componentType],o=e.count*n,i=e.count*n*s;lt(i>=0&&i<=t.byteLength);let a=ko[e.componentType],c=qo[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*eS)}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}=zr(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 aS(){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||aS(),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=ja(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},cS={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 qr(e,t,r,n){if(r!=="UINT8"&&r!=="UINT16"&&r!=="UINT32"&&r!=="UINT64")return null;let s=e.getTypedArrayForBufferView(t),o=kr(s,"SCALAR",r,n+1);return o instanceof BigInt64Array||o instanceof BigUint64Array?null:o}function kr(e,t,r,n=1){let s=pg[t],o=cS[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=lS(f,l,o,h,t.channels);u.push(d)}return u}}return[]}function jo(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 lS(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=fS(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 fS(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 Xo(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 Wo(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 Yo(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 jr="EXT_mesh_features",uS=jr;async function hS(e,t){let r=new q(e);pS(r,t)}function dS(e,t){let r=new q(e);return gS(r,t),r.createBinaryChunk(),r.gltf}function pS(e,t){let r=e.gltf.json;if(r.meshes)for(let n of r.meshes)for(let s of n.primitives)mS(e,s,t)}function mS(e,t,r){if(!r?.gltf?.loadBuffers)return;let s=t.extensions?.[jr]?.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 gS(e,t){let r=e.gltf.json.meshes;if(r)for(let n of r)for(let s of n.primitives)xS(e,s)}function AS(e,t,r,n){t.extensions||(t.extensions={});let s=t.extensions[jr];s||(s={featureIds:[]},t.extensions[jr]=s);let{featureIds:o}=s,i={featureCount:r.length,propertyTable:n,data:r};o.push(i),e.addObjectExtension(t,jr,s)}function xS(e,t){let r=t.extensions?.[jr];if(!r)return;let n=r.featureIds;n.forEach((s,o)=>{if(s.data){let{accessorKey:i,index:a}=yS(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 yS(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 Zc={};pt(Zc,{createExtStructuralMetadata:()=>HS,decode:()=>ES,encode:()=>_S,name:()=>TS});var Xr="EXT_structural_metadata",TS=Xr;async function ES(e,t){let r=new q(e);MS(r,t)}function _S(e,t){let r=new q(e);return US(r,t),r.createBinaryChunk(),r.gltf}function MS(e,t){if(!t.gltf?.loadBuffers)return;let r=e.getExtension(Xr);r&&(t.gltf?.loadImages&&bS(e,r),BS(e,r))}function bS(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)SS(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=CS(s,o);i&&wS(e,r,i)}}function CS(e,t){for(let r of e)if(r.class===t)return r;return null}function SS(e,t,r,n){if(!t)return;let o=r.extensions?.[Xr]?.propertyTextures;if(o)for(let i of o){let a=t[i];IS(e,a,r,n)}}function IS(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&&(jo(e,i,l,c,r),a.data=c,n.dataAttributeNames.push(i))}}function wS(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=LS(e,t,i,s,a);a.data=c}}}function LS(e,t,r,n,s){let o=[],i=s.values,a=e.getTypedArrayForBufferView(i),c=vS(e,r,s,n),l=RS(e,s,n);switch(r.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{o=FS(r,n,a,c);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${r.type}`);case"STRING":{o=Yo(n,a,c,l);break}case"ENUM":{o=PS(t,r,n,a,c);break}default:throw new Error(`Unknown classProperty type ${r.type}`)}return o}function vS(e,t,r,n){return t.array&&typeof t.count>"u"&&typeof r.arrayOffsets<"u"?qr(e,r.arrayOffsets,r.arrayOffsetType||"UINT32",n):null}function RS(e,t,r){return typeof t.stringOffsets<"u"?qr(e,t.stringOffsets,t.stringOffsetType||"UINT32",r):null}function FS(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=kr(r,e.type,e.componentType,a):c=r,s?n?Xo(c,t,n,r.length,i):o?Wo(c,t,o):[]:c}function PS(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=kr(n,t.type,a,l);if(f||(f=n),t.array){if(s)return OS({valuesData:f,numberOfElements:r,arrayOffsets:s,valuesDataBytesLength:n.length,elementSize:c,enumEntry:i});let u=t.count;return u?NS(f,r,u,i):[]}return Qc(f,0,r,i)}function OS(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=Qc(t,u,h,i);a.push(d)}return a}function NS(e,t,r,n){let s=[];for(let o=0;o<t;o++){let i=r*o,a=Qc(e,i,r,n);s.push(a)}return s}function Qc(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=DS(n,i);a?s.push(a.name):s.push("")}return s}function DS(e,t){for(let r of e.values)if(r.value===t)return r;return null}var GS="schemaClassId";function US(e,t){let r=e.getExtension(Xr);if(r&&r.propertyTables)for(let n of r.propertyTables){let s=n.class,o=r.schema?.classes?.[s];n.properties&&o&&VS(n,o,e)}}function VS(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=kS(s,o,r);e.properties[n]=i}}}}function HS(e,t,r=GS){let n=e.getExtension(Xr);n||(n=e.addExtension(Xr)),n.schema=zS(t,r,n.schema);let s=qS(t,r,n.schema);return n.propertyTables||(n.propertyTables=[]),n.propertyTables.push(s)-1}function zS(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 qS(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 kS(e,t,r){let n={values:0};if(t.type==="STRING"){let{stringData:s,stringOffsets:o}=XS(e);n.stringOffsets=Kc(o,r),n.values=Kc(s,r)}else if(t.type==="SCALAR"&&t.componentType){let s=jS(e,t.componentType);n.values=Kc(s,r)}return n}var JS={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=JS[t];if(!n)throw new Error("Illegal component type");return new n(r)}function XS(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 Kc(e,t){return t.gltf.buffers.push({arrayBuffer:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength}),t.addBufferView(e)}var $c={};pt($c,{decode:()=>YS,name:()=>WS});var gg="EXT_feature_metadata",WS=gg;async function YS(e,t){let r=new q(e);KS(r,t)}function KS(e,t){if(!t.gltf?.loadBuffers)return;let r=e.getExtension(gg);r&&(t.gltf?.loadImages&&QS(e,r),ZS(e,r))}function QS(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=tI(s,o);a&&rI(e,a,i)}}function ZS(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=$S(s,o);i&&eI(e,r,i)}}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){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function eI(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=nI(e,t,i,s,a);a.data=c}}}function rI(e,t,r){let n=t.class;for(let s in r.properties){let o=t?.properties?.[s];if(o){let i=cI(e,o,n);o.data=i}}}function nI(e,t,r,n,s){let o=[],i=s.bufferView,a=e.getTypedArrayForBufferView(i),c=sI(e,r,s,n),l=oI(e,r,s,n);return r.type==="STRING"||r.componentType==="STRING"?o=Yo(n,a,c,l):iI(r)&&(o=aI(r,n,a,c)),o}function sI(e,t,r,n){return t.type==="ARRAY"&&typeof t.componentCount>"u"&&typeof r.arrayOffsetBufferView<"u"?qr(e,r.arrayOffsetBufferView,r.offsetType||"UINT32",n):null}function oI(e,t,r,n){return typeof r.stringOffsetBufferView<"u"?qr(e,r.stringOffsetBufferView,r.offsetType||"UINT32",n):null}function iI(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 aI(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=kr(r,i,a,l);return s?n?Xo(f,t,n,r.length,c):o?Wo(f,t,o):[]:f}function cI(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)lI(e,r,t,s,i);return s}function lI(e,t,r,n,s){let o={channels:r.channels,...r.texture},i=Jr(e,o,s);i&&jo(e,t,i,n,s)}var Ag="4.3.3";var xg="4.3.3";var Ko={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},yg;async function el(e){za(e.modules);let t=qa("basis");return t||(yg||=fI(e),await yg)}async function fI(e){let t=null,r=null;return[t,r]=await Promise.all([await re(Ko.TRANSCODER,"textures",e),await re(Ko.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await uI(t,r)}function uI(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 tl;async function rl(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(tl=tl||hI(e),await tl)}async function hI(e){let t=null,r=null;return[t,r]=await Promise.all([await re(Ko.ENCODER,"textures",e),await re(Ko.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await dI(t,r)}function dI(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 pI=["","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"},Qo=null;function Eg(e){if(!Qo){e=e||mI()||void 0,Qo=new Set;for(let t of pI)for(let r in Tg)if(e&&e.getExtension(`${t}${r}`)){let n=Tg[r];Qo.add(n)}}return Qo}function mI(){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 gI={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 rl(t);return Mg(n.KTX2File,e,t)}let{BasisFile:r}=await el(t);return nl(r,e,t)}switch(t.basis.module){case"encoder":let r=await rl(t);switch(t.basis.containerFormat){case"ktx2":return Mg(r.KTX2File,e,t);case"basis":default:return nl(r.BasisFile,e,t)}case"transcoder":default:let{BasisFile:n}=await el(t);return nl(n,e,t)}}function nl(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(AI(n,i,l,r));o.push(c)}return o}finally{n.close(),n.delete()}}function AI(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(xI(n,i,r));return[o]}finally{n.close(),n.delete()}}function xI(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=Zo()),typeof r=="object"&&(r=t?r.alpha:r.noAlpha),r=r.toLowerCase(),gI[r]}function Zo(){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"}}},sl={...Cg,parse:bg};var Wr=!0,Sg=1735152710,al=12,$o=8,yI=1313821514,TI=5130562,EI=0,_I=0,MI=1;function bI(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=bI(s,r+0),i=s.getUint32(r+4,Wr),a=s.getUint32(r+8,Wr);switch(Object.assign(e,{header:{byteOffset:r,byteLength:a,hasBinChunk:!1},type:o,version:i,json:{},binChunks:[]}),r+=al,e.version){case 1:return BI(e,s,r);case 2:return CI(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>al+$o);let n=t.getUint32(r+0,Wr),s=t.getUint32(r+4,Wr);return r+=$o,H(s===EI),ol(e,t,r,n),r+=n,r+=il(e,t,r,e.header.byteLength),r}function CI(e,t,r,n){return H(e.header.byteLength>al+$o),SI(e,t,r,n),r+e.header.byteLength}function SI(e,t,r,n){for(;r+8<=e.header.byteLength;){let s=t.getUint32(r+0,Wr),o=t.getUint32(r+4,Wr);switch(r+=$o,o){case yI:ol(e,t,r,s);break;case TI:il(e,t,r,s);break;case _I:n.strict||ol(e,t,r,s);break;case MI:n.strict||il(e,t,r,s);break;default:break}r+=Be(s,4)}return r}function ol(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 il(e,t,r,n){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:t.buffer}),Be(n,4)}function cl(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 fl={};pt(fl,{decode:()=>UI,name:()=>GI});var II="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",wI="B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",LI=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]),vI=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]),RI={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},FI={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 PI();DI(i,i.exports[FI[s]],e,t,r,n,i.exports[RI[o||"NONE"]])}var ll;async function PI(){return ll||(ll=OI()),ll}async function OI(){let e=II;WebAssembly.validate(LI)&&(e=wI,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(NI(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function NI(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?vI[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,r)}function DI(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 ti="EXT_meshopt_compression",GI=ti;async function UI(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(VI(r,s));await Promise.all(n),r.removeExtension(ti)}async function VI(e,t){let r=e.getObjectExtension(t,ti);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,ti)}}var ul={};pt(ul,{name:()=>HI,preprocess:()=>zI});var Yr="EXT_texture_webp",HI=Yr;function zI(e,t){let r=new q(e);if(!nc("image/webp")){if(r.getRequiredExtensions().includes(Yr))throw new Error(`gltf: Required extension ${Yr} not supported by browser`);return}let{json:n}=r;for(let s of n.textures||[]){let o=r.getObjectExtension(s,Yr);o&&(s.source=o.source),r.removeObjectExtension(s,Yr)}r.removeExtension(Yr)}var hl={};pt(hl,{name:()=>qI,preprocess:()=>kI});var ei="KHR_texture_basisu",qI=ei;function kI(e,t){let r=new q(e),{json:n}=r;for(let s of n.textures||[]){let o=r.getObjectExtension(s,ei);o&&(s.source=o.source,r.removeObjectExtension(s,ei))}r.removeExtension(ei)}var pl={};pt(pl,{decode:()=>YI,encode:()=>KI,name:()=>XI,preprocess:()=>WI});function vg(e){let t={};for(let r in e){let n=e[r];if(r!=="indices"){let s=dl(n);t[r]=s}}return t}function dl(e){let{buffer:t,size:r,count:n}=JI(e);return{value:t,size:r,byteOffset:0,count:n,type:Jo(r),componentType:Ne(t)}}function JI(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",XI=De;function WI(e,t,r){let n=new q(e);for(let s of Rg(n))n.getObjectExtension(s,De)}async function YI(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(QI(n,o,t,r));await Promise.all(s),n.removeExtension(De)}function KI(e,t={}){let r=new q(e);for(let n of r.json.meshes||[])ZI(n,t),r.addRequiredExtension(De)}async function QI(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,Ho,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=dl(c.indices)),e.removeObjectExtension(t,De),$I(t)}function ZI(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 $I(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 ml={};pt(ml,{decode:()=>n2,name:()=>t2});var ni="KHR_texture_transform",t2=ni,ri=new x,e2=new J,r2=new J;async function n2(e,t){if(!new q(e).hasExtension(ni)||!t.gltf?.loadBuffers)return;let s=e.json.materials||[];for(let o=0;o<s.length;o++)s2(o,e)}function s2(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?.[ni]&&o2(t,e,o,s)}function o2(e,t,r,n){let s=i2(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&&a2(e,a,s)}}function i2(e,t){let r=e.extensions?.[ni],{texCoord:n=0}=e,{texCoord:s=n}=r;if(!(t.findIndex(([i,a])=>i===n&&a===s)!==-1)){let i=f2(r);return n!==s&&(e.texCoord=s),t.push([n,s]),{originalTexCoord:n,texCoord:s,matrix:i}}return null}function a2(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}=zr(a,c),p=ko[a.componentType],A=qo[a.type],m=c.byteStride||p*A,y=new Float32Array(d);for(let _=0;_<a.count;_++){let E=new h(l,u+_*m,2);ri.set(E[0],E[1],1),ri.transformByMatrix3(o),y.set([ri[0],ri[1]],_*A)}n===s?c2(a,c,e.buffers,y):l2(s,a,t,e,y)}}}}function c2(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 l2(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 f2(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=e2.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),i=r2.set(n[0],0,0,0,n[1],0,0,0,1);return s.multiplyRight(o).multiplyRight(i)}var gl={};pt(gl,{decode:()=>h2,encode:()=>d2,name:()=>u2});var fr="KHR_lights_punctual",u2=fr;async function h2(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 d2(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 Al={};pt(Al,{decode:()=>m2,encode:()=>g2,name:()=>p2});var es="KHR_materials_unlit",p2=es;async function m2(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 g2(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 xl={};pt(xl,{decode:()=>x2,encode:()=>y2,name:()=>A2});var rs="KHR_techniques_webgl",A2=rs;async function x2(e){let t=new q(e),{json:r}=t,n=t.getExtension(rs);if(n){let s=T2(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=E2(o.technique,t)),t.removeObjectExtension(o,rs)}t.removeExtension(rs)}}async function y2(e,t){}function T2(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 E2(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=[Zc,Yc,fl,ul,hl,pl,gl,Al,xl,ml,$c];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 yl="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,yl);s&&Object.assign(n,s),t.removeObjectExtension(n,yl)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,t.removeExtension(yl)}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"},M2={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},Tl=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=M2[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 Tl().normalize(e,t)}async function Vg(e,t,r=0,n,s){return b2(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 C2(e,n,s),await Og(e,n,s),e}function b2(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=Ja(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=cl(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 C2(e,t,r){let n=S2(e),s=e.json.images||[],o=[];for(let i of n)o.push(I2(e,s[i],i,t,r));return await Promise.all(o)}function S2(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 I2(e,t,r,n,s){let o;if(t.uri&&!t.hasOwnProperty("bufferView")){let a=cl(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,[Rr,sl],{...n,mimeType:t.mimeType,basis:n.basis||{format:Zo()}},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:w2,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function w2(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 L2={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},v2={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},R2={magFilter:Ut.TEXTURE_MAG_FILTER,minFilter:Ut.TEXTURE_MIN_FILTER,wrapS:Ut.TEXTURE_WRAP_S,wrapT:Ut.TEXTURE_WRAP_T},F2={[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 P2(){return{id:"default-sampler",parameters:F2}}function O2(e){return v2[e]}function N2(e){return L2[e]}var El=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=O2(t.componentType),s=N2(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}=zr(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):P2(),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 R2[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 El().postProcess(e,t)}var si={URI:0,EMBEDDED:1};function oi(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 ii(e,t,r,n){let s=r?.["3d-tiles"]||{};if(D2(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 D2(e,t,r){switch(t){case si.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 si.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function Hg(e,t,r,n,s){r=G2(e,t,r,n,s),await ii(e,si.EMBEDDED,n,s);let o=e?.gltf?.extensions;return o&&o.CESIUM_RTC&&(e.rtcCenter=o.CESIUM_RTC.center),r}function G2(e,t,r,n,s){r=Oe(e,t,r),r=Vr(e,t,r),r=Hr(e,t,r,n),r=oi(e,t,r,n);let o=new me(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=U2(e,t,r,n,s),await ii(e,e.gltfFormat||0,n,s),r}function U2(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=Vr(e,t,r);let o=new DataView(t);if(e.gltfFormat=o.getUint32(r,!0),r+=4,r=Hr(e,t,r,n),r=oi(e,t,r,n),!e?.header?.featureTableJsonByteLength||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let i=new me(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 V2(e,i,c,a),r}function V2(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 _l(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,_l);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 Ml(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 ai(l,l.tileAvailability,u,r),Array.isArray(l.contentAvailability))for(let h of l.contentAvailability)await ai(l,h,u,r);else await ai(l,l.contentAvailability,u,r);return await ai(l,l.childSubtreeAvailability,u,r),l}async function ai(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 ci={dataType:null,batchType:null,id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Vo,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:Ml,options:{}};var d0=D(Or(),1);var l0=D(Or(),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?ge:Yt;if(t){if(e<0)return ge;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%Qr|0,e/Qr|0,t)}Z.fromNumber=Ht;function k(e,t,r){return new Z(e,t,r)}Z.fromBits=k;var li=Math.pow;function Bl(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?ge: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 Bl(e.substring(1),t,r).neg();for(var s=Ht(li(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(li(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=Bl;function Kt(e,t){return typeof e=="number"?Ht(e,t):typeof e=="string"?Bl(e,t):k(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}Z.fromValue=Kt;var Yg=1<<16,H2=1<<24,Qr=Yg*Yg,Zg=Qr*Qr,Kg=Zg/2,Qg=hr(H2),Yt=hr(0);Z.ZERO=Yt;var ge=hr(0,!0);Z.UZERO=ge;var Kr=hr(1);Z.ONE=Kr;var $g=hr(1,!0);Z.UONE=$g;var bl=hr(-1);Z.NEG_ONE=bl;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)*Qr+(this.low>>>0):this.high*Qr+(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(li(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(Kr)};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?ge: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?ge:Yt;var n,s,o;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return ge;if(t.gt(this.shru(1)))return $g;o=ge}else{if(this.eq(St)){if(t.eq(Kr)||t.eq(bl))return St;if(t.eq(St))return Kr;var i=this.shr(1);return n=i.div(t).shl(1),n.eq(Yt)?t.isNegative()?Kr:bl:(s=this.sub(t.mul(n)),o=n.add(s.div(t)),o)}else if(t.eq(St))return this.unsigned?ge: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:li(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=Kr),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 Zr=Z;var z2=16;function ss(e){e==="X"&&(e="");let t=e.padEnd(z2,"0");return Zr.fromString(t,!0,16)}function Cl(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 Sl(e,t){let r=q2(e).shiftRightUnsigned(2);return e.add(Zr.fromNumber(2*t+1-4).multiply(r))}function q2(e){return e.and(e.not().add(1))}var k2=3,J2=30,j2=2*J2+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);X2(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<k2+j2;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),s=t.substring(3,r),o=s.length/2,i=Zr.fromString(n,!0,2).toString(10),a="";if(o!==0)for(a=Zr.fromString(s,!0,2).toString(4);a.length<o;)a="0"+a;return`${i}/${a}`}function Il(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 wl(e){return[n0(e[0]),n0(e[1])]}function Ll(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 vl([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*r0,n*r0]}function X2(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=Il(e.ij,e.level,[.5,.5]),r=wl(t),n=Ll(e.face,r);return vl(n)}var W2=100;function Rl(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(W2*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=Il(r,n,f),m=wl(A),y=Ll(t,m),_=vl(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 $r(e){let t=Y2(e);return s0(t)}function Y2(e){if(e.indexOf("/")>0)return e;let t=ss(e);return o0(t)}function Fl(e){let t=$r(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=$r(o),a=Rl(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=Rl(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 Pl(e,t){let r=t?.minimumHeight||0,n=t?.maximumHeight||0,s=$r(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 fi(e){let t=e.token,r={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},n=Pl(t,r),s=Fl(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 K2=4,Q2=8,Z2={QUADTREE:K2,OCTREE:Q2};function $2(e,t,r){if(e?.box){let n=ss(e.s2VolumeInfo.token),s=Sl(n,t),o=Cl(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:fi(i),s2VolumeInfo:i}}}async function Nl(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 Ga.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=Z2[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&&Ol(t.childSubtreeAvailability,R),v,G,X,z;if(F){let Y=`${d}/${h}`,$=ui(Y,m,T,g,S);v=await(0,l0.load)($,ci,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(!Ol(v.tileAvailability,z))return p;Ol(v.contentAvailability,z)&&(p.contentUrl=ui(u,m,T,g,S));for(let Y=0;Y<y;Y++){let $=$2(a,Y,c),bt=await Nl({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?tw(p,{level:m,x:T,y:g,z:S},o,a):p}function Ol(e,t){let r;return Array.isArray(e)?(r=e[0],e.length>1&&Ga.once('Not supported extension "3DTILES_multiple_contents" has been detected')):r=e,"constant"in r?Boolean(r.constant):r.explicitBitstream?nw(t,r.explicitBitstream):!1}function tw(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=ew(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 ew(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 ui(e,t,r,n,s){let o=rw({level:t,x:r,y:n,z:s});return e.replace(/{level}|{x}|{y}|{z}/gi,i=>o[i])}function rw(e){let t={};for(let r in e)t[`{${r}}`]=e[r];return t}function nw(e,t){let r=Math.floor(e/8),n=e%8;return(t[r]>>n&1)===1}function Gl(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 Ul(e){switch(e){case"REPLACE":case"replace":return mt.REPLACE;case"ADD":case"add":return mt.ADD;default:return e}}function Dl(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=Dl(s,t))}return{...e,id:r,contentUrl:r,lodMetricType:pe.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Gl(e,r),refine:Ul(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=ui(l,0,0,0,0),u=Dl(f,r),h=await(0,d0.load)(u,ci,s),d=e.content?.uri,p=d?Dl(d,r):"",A=t?.root?.refine,m=e.geometricError,y=e.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];if(y){let B={box:fi(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:pe.GEOMETRIC_ERROR,rootLodMetricValue:m,rootBoundingVolume:_,getTileType:Gl,getRefine:Ul};return await sw(e,r,h,E,s)}async function sw(e,t,r,n,s){if(!e)return null;let{children:o,contentUrl:i}=await Nl({subtree:r,implicitOptions:n,loaderOptions:s}),a,c=null;return i&&(a=i,c={uri:i.replace(`${t}/`,"")}),{...e,id:a,contentUrl:a,lodMetricType:pe.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Gl(e,a),refine:Ul(e.refine),content:c||e.content,children:o}}function h0(e){return e?.extensions?.["3DTILES_implicit_tiling"]||e?.implicitTiling}var hi={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Vo,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:ow,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function ow(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?iw(e,t,r):aw(e,t,r)}async function iw(e,t,r){let n=JSON.parse(new TextDecoder().decode(e)),s=r?.url||"",o=cw(s),i=await p0(n,o,t||{});return{...n,shape:"tileset3d",loader:hi,url:s,queryString:r?.queryString||"",basePath:o,root:i||n.root,type:ht.TILES3D,lodMetricType:pe.GEOMETRIC_ERROR,lodMetricValue:n.root?.geometricError||0}}async function aw(e,t,r){let n={content:{shape:"tile3d",featureIds:null}};return await _l(e,0,t,r,n.content),n.content}function cw(e){return Ie.dirname(e)}var m0=[0],lw={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:hi,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:fw(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=lw;os.layerName="Tile3DLayer";var T0=os;function fw(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 Ai=D(qt(),1),kl=D(Bo(),1),S0=D(qt(),1);var uw=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 Vl(e){return e>>1^-(e&1)}function hw(e){let t=0,r={};for(let[n,s]of uw){let o=s===8?e.getFloat64:e.getFloat32;r[n]=o.call(e,t,!0),t+=s}return{header:r,headerEndPosition:t}}function dw(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+=Vl(e.getUint16(c+i*p,!0)),h+=Vl(e.getUint16(l+i*p,!0)),d+=Vl(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 pw(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 mw(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 gw(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function Aw(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function xw(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=gw(i);break}case 2:{r.waterMask=Aw(i);break}default:}n+=o}return{extensions:r,extensionsEndPosition:n}}var pr={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},yw={maxDecodingStep:pr.extensions};function Hl(e,t){let r=Object.assign({},yw,t),n=new DataView(e),{header:s,headerEndPosition:o}=hw(n);if(r.maxDecodingStep<pr.vertices)return{header:s};let{vertexData:i,vertexDataEndPosition:a}=dw(n,o);if(r.maxDecodingStep<pr.triangleIndices)return{header:s,vertexData:i};let{triangleIndices:c,triangleIndicesEndPosition:l}=pw(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}=mw(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}=xw(n,p);return{header:s,vertexData:i,triangleIndices:c,westIndices:f,northIndices:d,eastIndices:h,southIndices:u,extensions:A}}function di(e,t,r,n){let s=n?Ew(n,e.POSITION.value):Tw(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];_w({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 Tw(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 Ew(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 _w({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 zl(e,t={}){let{bounds:r}=t,{header:n,vertexData:s,triangleIndices:o,westIndices:i,northIndices:a,eastIndices:c,southIndices:l}=Hl(e,pr.triangleIndices),f=o,u=Mw(s,n,r),h=ar(u);if(t?.skirtHeight){let{attributes:d,triangles:p}=di(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 Mw(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 ql(t,this)}},ql=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(!bw(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 bw(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=pi(o,i,a,s,t.tesselator),l=E0(r,i,c);break;case"delatin":c=pi(o,i,a,s,t.tesselator),l=_0(r,i,a,c);break;default:i===a&&!(a&i-1)?(c=pi(o,i,a,s,"martini"),l=E0(r,i,c)):(c=pi(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}=di(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 pi(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 mi="4.3.3";var gi={dataType:null,batchType:null,name:"Terrain",id:"terrain",module:"terrain",version:mi,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:mi,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var Cw={...gi,parse:Sw};async function Sw(e,t,r){let n={...t,mimeType:"application/x.image",image:{...t?.image,type:"data"}},s=await vt(e,[],n,r),o={...Cw.options.terrain,...t?.terrain};return M0(s,o)}var gz={...b0,parseSync:(e,t)=>zl(e,t?.["quantized-mesh"]),parse:async(e,t)=>zl(e,t?.["quantized-mesh"])};var B0=[1],Iw={...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:[gi]};function C0(e){return Array.isArray(e)?e.join(";"):e||""}var ls=class extends Ai.CompositeLayer{updateState({props:t,oldProps:r}){let n=t.elevationData!==r.elevationData;if(n){let{elevationData:o}=t,i=o&&(Array.isArray(o)||ww(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&&Ai.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",kl.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",kl.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=Iw;ls.layerName="TerrainLayer";var I0=ls,ww=e=>e.includes("{x}")&&(e.includes("{y}")||e.includes("{-y}"));var Ii=D(qt(),1),lf=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 jl(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=Nw(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&&Ti(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&&(Ti(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&&Hw(e,n,s,o);let a=e,c,l;for(;e.prev!==e.next;){if(c=e.prev,l=e.next,o?Fw(e,n,s,o):Rw(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=Pw(Ar(e),t,r),us(e,t,r,n,s,o,2)):i===2&&Ow(e,t,r,n,s,o):us(Ar(e),t,r,n,s,o,1);break}}}function Rw(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&&tn(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 Fw(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=Jl(d,p,t,r,n),_=Jl(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&&tn(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&&tn(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&&tn(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&&tn(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 Pw(e,t,r){let n=e;do{let s=n.prev,o=n.next.next;!Ti(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 Ow(e,t,r,n,s,o){let i=e;do{let a=i.next.next;for(;a!==i.prev;){if(i.i!==a.i&&kw(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 Nw(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(qw(u));for(i.sort(Dw),a=0;a<i.length;a++)r=Gw(i[a],r);return r}function Dw(e,t){return e.x-t.x}function Gw(e,t){let r=Uw(e,t);if(!r)return t;let n=P0(r,e);return Ar(n,n.next),Ar(r,r.next)}function Uw(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&&tn(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&&Vw(i,r)))&&(i=r,f=u)),r=r.next;while(r!==a);return i}function Vw(e,t){return nt(e.prev,e,t.prev)<0&&nt(t.next,e,e.next)<0}function Hw(e,t,r,n){let s=e;do s.z===0&&(s.z=Jl(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,zw(s)}function zw(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 Jl(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 qw(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 tn(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 kw(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Jw(e,t)&&(hs(e,t)&&hs(t,e)&&jw(e,t)&&(nt(e.prev,e,t.prev)||nt(e,t.prev,t))||Ti(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 Ti(e,t){return e.x===t.x&&e.y===t.y}function F0(e,t,r,n){let s=yi(nt(e,t,r)),o=yi(nt(e,t,n)),i=yi(nt(r,n,e)),a=yi(nt(r,n,t));return!!(s!==o&&i!==a||s===0&&xi(e,r,t)||o===0&&xi(e,n,t)||i===0&&xi(r,e,n)||a===0&&xi(r,t,n))}function xi(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 yi(e){return e>0?1:e<0?-1:0}function Jw(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 Yl(e,t,r){let n=Qw(e),s=Object.keys(n).filter(o=>n[o]!==Array);return Zw(e,{propArrayTypes:n,...t},{numericPropKeys:r&&r.numericPropKeys||s,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function Qw(e){let t={};for(let r of e)if(r.properties)for(let n in r.properties){let s=r.properties[n];t[n]=s3(s,t[n])}return t}function Zw(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":$w(b,E,C,d,T),E.properties.push(Wl(T,p)),y&&E.fields.push({id:L.id}),C.pointFeature++;break;case"LineString":t3(b,M,C,d,T),M.properties.push(Wl(T,p)),y&&M.fields.push({id:L.id}),C.lineFeature++;break;case"Polygon":e3(b,B,C,d,T),B.properties.push(Wl(T,p)),y&&B.fields.push({id:L.id}),C.polygonFeature++;break;default:throw new Error("Invalid geometry type")}C.feature++}return n3(E,M,B,d)}function $w(e,t,r,n,s){t.positions.set(e.data,r.pointPosition*n);let o=e.data.length/n;Kl(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 t3(e,t,r,n,s){t.positions.set(e.data,r.linePosition*n);let o=e.data.length/n;Kl(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 e3(e,t,r,n,s){t.positions.set(e.data,r.polygonPosition*n);let o=e.data.length/n;Kl(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;r3(t,l,f,{startPosition:c,endPosition:h,coordLength:n})}}function r3(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=jl(c,f,o,t);for(let h=0,d=u.length;h<d;++h)e.triangles.push(n+u[h])}function Xl(e,t){let r={};for(let n in e)r[n]={value:e[n],size:t};return r}function n3(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:Xl(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:Xl(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:Xl(r.numericProps,1)}};return s.polygons&&r.triangles&&(s.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),s}function Kl(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 Wl(e,t){let r={};for(let n in e)t.includes(n)||(r[n]=e[n]);return r}function s3(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function Mi(e,t){let r=t?.globalFeatureId;return r!==void 0?o3(e,r):i3(e,t?.type)}function o3(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 Ei(n,s,i);s=i,o=a}}if(t===n.globalFeatureIds.value[s])return Ei(n,s,n.featureIds.value.length)}throw new Error(`featureId:${t} not found`)}function i3(e,t){let r=G0(e,t);return a3(r)}function D0(e,t,r){switch(e.type){case"Point":return u3(e,t,r);case"LineString":return f3(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 a3(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(Ei(r,n,o)),n=o,s=i)}t.push(Ei(r,n,r.featureIds.value.length))}return t}function Ei(e,t,r){let n=D0(e,t,r),s=l3(e,t,r),o=c3(e,t,r);return{type:"Feature",geometry:n,properties:s,...o}}function c3(e,t=0,r){return e.fields&&e.fields[e.featureIds.value[t]]}function l3(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=_i(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 f3(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:_i(n,s[0],s[1])};let i=[];for(let a=0;a<s.length-1;a++){let c=_i(n,s[a],s[a+1]);i.push(c)}return{type:"MultiLineString",coordinates:i}}function u3(e,t,r){let{positions:n}=e,s=_i(n,t,r);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function _i(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 rf=D(j0(),1);function w3(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 $l(e,t){if(Array.isArray(e[0])){for(let n of e)$l(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 tf(e,t,r){if(typeof e[0][0]!="number"){for(let i of e)tf(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=w3(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(L3,this,r)}toGeoJSONFeature(t,r){let n=this.loadGeometry();switch(t){case"wgs84":return Q0(this,n,s=>tf(s,r,this.extent));default:return Q0(this,n,$l)}}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}}};sn(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 L3(e,t,r){t&&r&&(e===1?t.id=r.readVarint():e===2?v3(r,t):e===3?t.type=r.readVarint():e===4&&(t._geometry=r.pos))}function v3(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 Ci=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(R3,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 R3(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(F3(r)))}function F3(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(P3,{},r)}};function P3(e,t,r){if(e===3&&r){let n=new Ci(r,r.readVarint()+r.pos);n.length&&t&&(t[n.name]=n)}}function nf(e,t){let r=N3(t),n=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(n){case"columnar-table":return{shape:"columnar-table",data:ef(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 ef(e,r);case"binary":return ef(e,r);default:throw new Error(n||"undefined shape")}}function ef(e,t){let[r,n]=O3(e,t),s=Yl(r,n);return s.byteLength=e.byteLength,s}function O3(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 rf.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=G3(l,t,i);r.push(f)}}),[r,n]}function Z0(e,t){if(e.byteLength<=0)return[];let r=[],n=new ms(new rf.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=D3(c,t,o);r.push(l)}}),r}function N3(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&&Va.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function D3(e,t,r){let n=e.toGeoJSONFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&(n.properties||={},n.properties[t.layerProperty]=r),n}function G3(e,t,r){let n=e.toBinaryFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&n.properties&&(n.properties[t.layerProperty]=r),n}var U3="4.3.3",Si={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:U3,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}}},V3={...Si,parse:async(e,t)=>nf(e,t),parseSync:nf,binary:!0};var H3={Point:$0,MultiPoint:z3,LineString:t1,MultiLineString:q3,Polygon:e1,MultiPolygon:k3};function $0([e,t],[r,n],s){let o=ye(r[0],n[0],e),i=ye(r[1],n[1],t);return s.unprojectFlat([o,i])}function sf(e,t,r){return e.map(n=>$0(n,t,r))}function z3(e,t,r){return sf(e,t,r)}function t1(e,t,r){return sf(e,t,r)}function q3(e,t,r){return e.map(n=>t1(n,t,r))}function e1(e,t,r){return e.map(n=>sf(n,t,r))}function k3(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:H3[e.type](e.coordinates,o,r)}}var J3=["points","lines","polygons"];function of(e,t,r,n){for(let s of J3){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=X3(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?W3(e,a):-1}function X3(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 W3(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 af=512,Y3={...lf.GeoJsonLayer.defaultProps,data:Re,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[Si],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"&&!Ac(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=af/o,a=-i,c=af*r/o,l=af*(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=Ii.COORDINATE_SYSTEM.CARTESIAN,t.extensions=[...t.extensions||[],new a1.ClipExtension]);let u=super.renderSubLayers(t);return this.state.binary&&!(u instanceof lf.GeoJsonLayer)&&Ii.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=cf(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=Mi(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=cf(u,o)===f,d=c||s1(u)===n;return h&&d}):a&&s?of(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=cf(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&&xc(s)){let o=this.state.binary?Mi(n.content):n.content;n._contentWGS84=o.map(i=>i1(i,s,this.context.viewport))}return n._contentWGS84}})})}};gs.layerName="MVTLayer";gs.defaultProps=Y3;var c1=gs;function cf(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 K3=-90,Q3=90,Z3=-180,$3=180;function tL(e){let t=!0,r=Q3,n=K3,s=$3,o=Z3,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]=tL(e);return[s,n,s,t,r,t,r,n,s,n]}var eL={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=eL;var h1=As;return y1(xs);})();
1099
1099
  /*! Bundled license information:
1100
1100
 
1101
1101
  long/dist/long.js: