@deck.gl/geo-layers 9.0.0-beta.6 → 9.0.0-beta.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/dist.dev.js +801 -935
- package/dist.min.js +191 -322
- package/package.json +10 -17
package/dist.min.js
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['deck'] = factory();
|
|
6
6
|
else root['deck'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var
|
|
8
|
-
`&&e[i]!=="\r";i++)c+=e[i];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),i--),!
|
|
9
|
-
`||e==="\r"}function
|
|
10
|
-
`);let t=new
|
|
11
|
-
`;function
|
|
7
|
+
"use strict";var __exports__=(()=>{var og=Object.create;var rs=Object.defineProperty;var ag=Object.getOwnPropertyDescriptor;var cg=Object.getOwnPropertyNames;var lg=Object.getPrototypeOf,ug=Object.prototype.hasOwnProperty;var Cl=(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 et=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ut=(e,t)=>{for(var n in t)rs(e,n,{get:t[n],enumerable:!0})},ns=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of cg(t))!ug.call(e,s)&&s!==n&&rs(e,s,{get:()=>t[s],enumerable:!(r=ag(t,s))||r.enumerable});return e},pe=(e,t,n)=>(ns(e,t,"default"),n&&ns(n,t,"default")),N=(e,t,n)=>(n=e!=null?og(lg(e)):{},ns(t||!e||!e.__esModule?rs(n,"default",{value:e,enumerable:!0}):n,e)),hg=e=>ns(rs({},"__esModule",{value:!0}),e);var Dt=et((sS,bl)=>{bl.exports=globalThis.deck});var Ut=et((oS,Ml)=>{Ml.exports=globalThis.deck});var is=et(ie=>{"use strict";var Il=":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",dg=Il+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",wl="["+Il+"]["+dg+"]*",pg=new RegExp("^"+wl+"$"),mg=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},gg=function(e){let t=pg.exec(e);return!(t===null||typeof t>"u")};ie.isExist=function(e){return typeof e<"u"};ie.isEmptyObject=function(e){return Object.keys(e).length===0};ie.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]]}};ie.getValue=function(e){return ie.isExist(e)?e:""};ie.isName=gg;ie.getAllMatches=mg;ie.nameRegexp=wl});var co=et(Pl=>{"use strict";var ao=is(),Ag={allowBooleanAttributes:!1,unpairedTags:[]};Pl.validate=function(e,t){t=Object.assign({},Ag,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=Fl(e,i),i.err)return i}else if(e[i]==="<"){let o=i;if(i++,e[i]==="!"){i=Rl(e,i);continue}else{let a=!1;e[i]==="/"&&(a=!0,i++);let c="";for(;i<e.length&&e[i]!==">"&&e[i]!==" "&&e[i]!==" "&&e[i]!==`
|
|
8
|
+
`&&e[i]!=="\r";i++)c+=e[i];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),i--),!bg(c)){let h;return c.trim().length===0?h="Invalid space after '<'.":h="Tag '"+c+"' is an invalid name.",it("InvalidTag",h,yt(e,i))}let l=Tg(e,i);if(l===!1)return it("InvalidAttr","Attributes for '"+c+"' have open quote.",yt(e,i));let u=l.value;if(i=l.index,u[u.length-1]==="/"){let h=i-u.length;u=u.substring(0,u.length-1);let f=Ll(u,t);if(f===!0)r=!0;else return it(f.err.code,f.err.msg,yt(e,h+f.err.line))}else if(a)if(l.tagClosed){if(u.trim().length>0)return it("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",yt(e,o));{let h=n.pop();if(c!==h.tagName){let f=yt(e,h.tagStartPos);return it("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+c+"'.",yt(e,o))}n.length==0&&(s=!0)}}else return it("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",yt(e,i));else{let h=Ll(u,t);if(h!==!0)return it(h.err.code,h.err.msg,yt(e,i-u.length+h.err.line));if(s===!0)return it("InvalidXml","Multiple possible root nodes found.",yt(e,i));t.unpairedTags.indexOf(c)!==-1||n.push({tagName:c,tagStartPos:o}),r=!0}for(i++;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="!"){i++,i=Rl(e,i);continue}else if(e[i+1]==="?"){if(i=Fl(e,++i),i.err)return i}else break;else if(e[i]==="&"){let h=Bg(e,i);if(h==-1)return it("InvalidChar","char '&' is not expected.",yt(e,i));i=h}else if(s===!0&&!vl(e[i]))return it("InvalidXml","Extra text at the end",yt(e,i));e[i]==="<"&&i--}}else{if(vl(e[i]))continue;return it("InvalidChar","char '"+e[i]+"' is not expected.",yt(e,i))}if(r){if(n.length==1)return it("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",yt(e,n[0].tagStartPos));if(n.length>0)return it("InvalidXml","Invalid '"+JSON.stringify(n.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return it("InvalidXml","Start tag expected.",1);return!0};function vl(e){return e===" "||e===" "||e===`
|
|
9
|
+
`||e==="\r"}function Fl(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 it("InvalidXml","XML declaration allowed only at the start of the document.",yt(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function Rl(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 xg='"',yg="'";function Tg(e,t){let n="",r="",s=!1;for(;t<e.length;t++){if(e[t]===xg||e[t]===yg)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 _g=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Ll(e,t){let n=ao.getAllMatches(e,_g),r={};for(let s=0;s<n.length;s++){if(n[s][1].length===0)return it("InvalidAttr","Attribute '"+n[s][2]+"' has no space in starting.",Xn(n[s]));if(n[s][3]!==void 0&&n[s][4]===void 0)return it("InvalidAttr","Attribute '"+n[s][2]+"' is without value.",Xn(n[s]));if(n[s][3]===void 0&&!t.allowBooleanAttributes)return it("InvalidAttr","boolean attribute '"+n[s][2]+"' is not allowed.",Xn(n[s]));let i=n[s][2];if(!Cg(i))return it("InvalidAttr","Attribute '"+i+"' is an invalid name.",Xn(n[s]));if(!r.hasOwnProperty(i))r[i]=1;else return it("InvalidAttr","Attribute '"+i+"' is repeated.",Xn(n[s]))}return!0}function Eg(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 Bg(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,Eg(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 it(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function Cg(e){return ao.isName(e)}function bg(e){return ao.isName(e)}function yt(e,t){let n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Xn(e){return e.startIndex+e[1].length}});var Nl=et(lo=>{var Ol={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}},Sg=function(e){return Object.assign({},Ol,e)};lo.buildOptions=Sg;lo.defaultOptions=Ol});var Ul=et((hS,Dl)=>{"use strict";var uo=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})}};Dl.exports=uo});var Vl=et((fS,Gl)=>{var Mg=is();function Ig(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&&Fg(e,t))t+=7,[entityName,val,t]=wg(e,t+1),val.indexOf("&")===-1&&(n[Og(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(s&&Rg(e,t))t+=8;else if(s&&Lg(e,t))t+=8;else if(s&&Pg(e,t))t+=9;else if(vg)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 wg(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 vg(e,t){return e[t+1]==="!"&&e[t+2]==="-"&&e[t+3]==="-"}function Fg(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 Rg(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 Lg(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 Pg(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 Og(e){if(Mg.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}Gl.exports=Ig});var zl=et((dS,Hl)=>{var Ng=/^[-+]?0x[a-fA-F0-9]+$/,Dg=/^([\-\+])?(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 Ug={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Gg(e,t={}){if(t=Object.assign({},Ug,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&&Ng.test(n))return Number.parseInt(n,16);{let r=Dg.exec(n);if(r){let s=r[1],i=r[2],o=Vg(r[3]),a=r[4]||r[6];if(!t.leadingZeros&&i.length>0&&s&&n[2]!==".")return e;if(!t.leadingZeros&&i.length>0&&!s&&n[1]!==".")return e;{let c=Number(n),l=""+c;return l.search(/[eE]/)!==-1||a?t.eNotation?c:e:n.indexOf(".")!==-1?l==="0"&&o===""||l===o||s&&l==="-"+o?c:e:i?o===l||s+o===l?c:e:n===l||n===s+l?c:e}}else return e}}function Vg(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}Hl.exports=Gg});var Jl=et((mS,kl)=>{"use strict";var mo=is(),Wn=Ul(),Hg=Vl(),zg=zl(),pS="<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g,mo.nameRegexp),ho=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"}},this.addExternalEntities=kg,this.parseXml=Wg,this.parseTextData=Jg,this.resolveNameSpace=qg,this.buildAttributesMap=Xg,this.isItStopNode=Zg,this.replaceEntitiesValue=Kg,this.readStopNodeData=t0,this.saveTextToParentTag=Qg,this.addChild=Yg}};function kg(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 Jg(e,t,n,r,s,i,o){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e));let a=this.options.tagValueProcessor(t,e,n,s,i);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?po(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?po(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function qg(e){if(this.options.removeNSPrefix){let t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}var jg=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Xg(e,t,n){if(!this.options.ignoreAttributes&&typeof e=="string"){let r=mo.getAllMatches(e,jg),s=r.length,i={};for(let o=0;o<s;o++){let a=this.resolveNameSpace(r[o][1]),c=r[o][4],l=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c);let u=this.options.attributeValueProcessor(a,c,t);u==null?i[l]=c:typeof u!=typeof c||u!==c?i[l]=u:i[l]=po(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[l]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){let o={};return o[this.options.attributesGroupName]=i,o}return i}}var Wg=function(e){e=e.replace(/\r\n?/g,`
|
|
10
|
+
`);let t=new Wn("!xml"),n=t,r="",s="";for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){let a=Le(e,">",i,"Closing Tag is not closed."),c=e.substring(i+2,a).trim();if(this.options.removeNSPrefix){let h=c.indexOf(":");h!==-1&&(c=c.substr(h+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&(r=this.saveTextToParentTag(r,n,s));let l=s.substring(s.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);let u=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(u=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):u=s.lastIndexOf("."),s=s.substring(0,u),n=this.tagsNodeStack.pop(),r="",i=a}else if(e[i+1]==="?"){let a=fo(e,i,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,s),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){let c=new Wn(a.tagName);c.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(c[":@"]=this.buildAttributesMap(a.tagExp,s,a.tagName)),this.addChild(n,c,s)}i=a.closeIndex+1}else if(e.substr(i+1,3)==="!--"){let a=Le(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){let c=e.substring(i+4,a-2);r=this.saveTextToParentTag(r,n,s),n.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}i=a}else if(e.substr(i+1,2)==="!D"){let a=Hg(e,i);this.docTypeEntities=a.entities,i=a.i}else if(e.substr(i+1,2)==="!["){let a=Le(e,"]]>",i,"CDATA is not closed.")-2,c=e.substring(i+9,a);if(r=this.saveTextToParentTag(r,n,s),this.options.cdataPropName)n.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]);else{let l=this.parseTextData(c,n.tagname,s,!0,!1,!0);l==null&&(l=""),n.add(this.options.textNodeName,l)}i=a+2}else{let a=fo(e,i,this.options.removeNSPrefix),c=a.tagName,l=a.tagExp,u=a.attrExpPresent,h=a.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,s,!1));let f=n;if(f&&this.options.unpairedTags.indexOf(f.tagname)!==-1&&(n=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),c!==t.tagname&&(s+=s?"."+c:c),this.isItStopNode(this.options.stopNodes,s,c)){let d="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)i=a.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)i=a.closeIndex;else{let A=this.readStopNodeData(e,c,h+1);if(!A)throw new Error(`Unexpected end of ${c}`);i=A.i,d=A.tagContent}let p=new Wn(c);c!==l&&u&&(p[":@"]=this.buildAttributesMap(l,s,c)),d&&(d=this.parseTextData(d,c,s,!0,u,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),p.add(this.options.textNodeName,d),this.addChild(n,p,s)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){c[c.length-1]==="/"?(c=c.substr(0,c.length-1),s=s.substr(0,s.length-1),l=c):l=l.substr(0,l.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));let d=new Wn(c);c!==l&&u&&(d[":@"]=this.buildAttributesMap(l,s,c)),this.addChild(n,d,s),s=s.substr(0,s.lastIndexOf("."))}else{let d=new Wn(c);this.tagsNodeStack.push(n),c!==l&&u&&(d[":@"]=this.buildAttributesMap(l,s,c)),this.addChild(n,d,s),n=d}r="",i=h}}else r+=e[i];return t.child};function Yg(e,t,n){let r=this.options.updateTag(t.tagname,n,t[":@"]);r===!1||(typeof r=="string"&&(t.tagname=r),e.addChild(t))}var Kg=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 Qg(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 Zg(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 $g(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 Le(e,t,n,r){let s=e.indexOf(t,n);if(s===-1)throw new Error(r);return s+t.length-1}function fo(e,t,n,r=">"){let s=$g(e,t+1,r);if(!s)return;let i=s.data,o=s.index,a=i.search(/\s/),c=i,l=!0;if(a!==-1&&(c=i.substr(0,a).replace(/\s\s*$/,""),i=i.substr(a+1)),n){let u=c.indexOf(":");u!==-1&&(c=c.substr(u+1),l=c!==s.data.substr(u+1))}return{tagName:c,tagExp:i,closeIndex:o,attrExpPresent:l}}function t0(e,t,n){let r=n,s=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){let i=Le(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=Le(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=Le(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=Le(e,"]]>",n,"StopNode is not closed.")-2;else{let i=fo(e,n,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&s++,n=i.closeIndex)}}function po(e,t,n){if(t&&typeof e=="string"){let r=e.trim();return r==="true"?!0:r==="false"?!1:zg(e,n)}else return mo.isExist(e)?e:""}kl.exports=ho});var Xl=et(jl=>{"use strict";function e0(e,t){return ql(e,t)}function ql(e,t,n){let r,s={};for(let i=0;i<e.length;i++){let o=e[i],a=n0(o),c="";if(n===void 0?c=a:c=n+"."+a,a===t.textNodeName)r===void 0?r=o[a]:r+=""+o[a];else{if(a===void 0)continue;if(o[a]){let l=ql(o[a],t,c),u=s0(l,t);o[":@"]?r0(l,o[":@"],c,t):Object.keys(l).length===1&&l[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?l=l[t.textNodeName]:Object.keys(l).length===0&&(t.alwaysCreateTextNode?l[t.textNodeName]="":l=""),s[a]!==void 0&&s.hasOwnProperty(a)?(Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(l)):t.isArray(a,c,u)?s[a]=[l]:s[a]=l}}}return typeof r=="string"?r.length>0&&(s[t.textNodeName]=r):r!==void 0&&(s[t.textNodeName]=r),s}function n0(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(r!==":@")return r}}function r0(e,t,n,r){if(t){let s=Object.keys(t),i=s.length;for(let o=0;o<i;o++){let a=s[o];r.isArray(a,n+"."+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function s0(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))}jl.prettify=e0});var Yl=et((AS,Wl)=>{var{buildOptions:i0}=Nl(),o0=Jl(),{prettify:a0}=Xl(),c0=co(),go=class{constructor(t){this.externalEntities={},this.options=i0(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=c0.validate(t,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let r=new o0(this.options);r.addExternalEntities(this.externalEntities);let s=r.parseXml(t);return this.options.preserveOrder||s===void 0?s:a0(s,this.options)}addEntity(t,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}};Wl.exports=go});var tu=et((xS,$l)=>{var l0=`
|
|
11
|
+
`;function u0(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=l0),Ql(e,t,"",n)}function Ql(e,t,n,r){let s="",i=!1;for(let o=0;o<e.length;o++){let a=e[o],c=h0(a),l="";if(n.length===0?l=c:l=`${n}.${c}`,c===t.textNodeName){let p=a[c];f0(l,t)||(p=t.tagValueProcessor(c,p),p=Zl(p,t)),i&&(s+=r),s+=p,i=!1;continue}else if(c===t.cdataPropName){i&&(s+=r),s+=`<![CDATA[${a[c][0][t.textNodeName]}]]>`,i=!1;continue}else if(c===t.commentPropName){s+=r+`<!--${a[c][0][t.textNodeName]}-->`,i=!0;continue}else if(c[0]==="?"){let p=Kl(a[":@"],t),A=c==="?xml"?"":r,g=a[c][0][t.textNodeName];g=g.length!==0?" "+g:"",s+=A+`<${c}${g}${p}?>`,i=!0;continue}let u=r;u!==""&&(u+=t.indentBy);let h=Kl(a[":@"],t),f=r+`<${c}${h}`,d=Ql(a[c],t,l,u);t.unpairedTags.indexOf(c)!==-1?t.suppressUnpairedNode?s+=f+">":s+=f+"/>":(!d||d.length===0)&&t.suppressEmptyNode?s+=f+"/>":d&&d.endsWith(">")?s+=f+`>${d}${r}</${c}>`:(s+=f+">",d&&r!==""&&(d.includes("/>")||d.includes("</"))?s+=r+t.indentBy+d+r:s+=d,s+=`</${c}>`),i=!0}return s}function h0(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(r!==":@")return r}}function Kl(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){let s=t.attributeValueProcessor(r,e[r]);s=Zl(s,t),s===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${s}"`}return n}function f0(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 Zl(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}$l.exports=u0});var nu=et((yS,eu)=>{"use strict";var d0=tu(),p0={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function me(e){this.options=Object.assign({},p0,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=A0),this.processTextOrObjNode=m0,this.options.format?(this.indentate=g0,this.tagEndChar=`>
|
|
12
12
|
`,this.newLine=`
|
|
13
|
-
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}pe.prototype.build=function(e){return this.options.preserveOrder?m0(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)};pe.prototype.j2x=function(e,t){let n="",r="";for(let s in e)if(typeof e[s]>"u")this.isAttribute(s)&&(r+="");else if(e[s]===null)this.isAttribute(s)?r+="":s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)r+=this.buildTextValNode(e[s],s,"",t);else if(typeof e[s]!="object"){let i=this.isAttribute(s);if(i)n+=this.buildAttrPairStr(i,""+e[s]);else if(s===this.options.textNodeName){let o=this.options.tagValueProcessor(s,""+e[s]);r+=this.replaceEntitiesValue(o)}else r+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){let i=e[s].length,o="";for(let a=0;a<i;a++){let c=e[s][a];typeof c>"u"||(c===null?s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar:typeof c=="object"?this.options.oneListGroup?o+=this.j2x(c,t+1).val:o+=this.processTextOrObjNode(c,s,t):o+=this.buildTextValNode(c,s,"",t))}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,"",t)),r+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){let i=Object.keys(e[s]),o=i.length;for(let a=0;a<o;a++)n+=this.buildAttrPairStr(i[a],""+e[s][i[a]])}else r+=this.processTextOrObjNode(e[s],s,t);return{attrStr:n,val:r}};pe.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function g0(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)}pe.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}};pe.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};pe.prototype.buildTextValNode=function(e,t,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}};pe.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 A0(e){return this.options.indentBy.repeat(e)}function x0(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}nu.exports=pe});var iu=et((_S,su)=>{"use strict";var y0=lo(),T0=Kl(),_0=ru();su.exports={XMLParser:T0,XMLValidator:y0,XMLBuilder:_0}});var Ta=et((Vh,fr)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof bl=="function"&&typeof fr=="object"&&fr&&fr.exports?fr.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(Vh,function(){"use strict";function e(T,p,M){this.low=T|0,this.high=p|0,this.unsigned=!!M}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function t(T){return(T&&T.__isLong__)===!0}e.isLong=t;var n={},r={};function s(T,p){var M,F,R;return p?(T>>>=0,(R=0<=T&&T<256)&&(F=r[T],F)?F:(M=o(T,(T|0)<0?-1:0,!0),R&&(r[T]=M),M)):(T|=0,(R=-128<=T&&T<128)&&(F=n[T],F)?F:(M=o(T,T<0?-1:0,!1),R&&(n[T]=M),M))}e.fromInt=s;function i(T,p){if(isNaN(T)||!isFinite(T))return p?y:g;if(p){if(T<0)return y;if(T>=d)return S}else{if(T<=-m)return w;if(T+1>=m)return b}return T<0?i(-T,p).neg():o(T%f|0,T/f|0,p)}e.fromNumber=i;function o(T,p,M){return new e(T,p,M)}e.fromBits=o;var a=Math.pow;function c(T,p,M){if(T.length===0)throw Error("empty string");if(T==="NaN"||T==="Infinity"||T==="+Infinity"||T==="-Infinity")return g;if(typeof p=="number"?(M=p,p=!1):p=!!p,M=M||10,M<2||36<M)throw RangeError("radix");var F;if((F=T.indexOf("-"))>0)throw Error("interior hyphen");if(F===0)return c(T.substring(1),p,M).neg();for(var R=i(a(M,8)),v=g,D=0;D<T.length;D+=8){var W=Math.min(8,T.length-D),z=parseInt(T.substring(D,D+W),M);if(W<8){var Z=i(a(M,W));v=v.mul(Z).add(i(z))}else v=v.mul(R),v=v.add(i(z))}return v.unsigned=p,v}e.fromString=c;function l(T){return T instanceof e?T:typeof T=="number"?i(T):typeof T=="string"?c(T):o(T.low,T.high,T.unsigned)}e.fromValue=l;var u=1<<16,h=1<<24,f=u*u,d=f*f,m=d/2,A=s(h),g=s(0);e.ZERO=g;var y=s(0,!0);e.UZERO=y;var E=s(1);e.ONE=E;var _=s(1,!0);e.UONE=_;var B=s(-1);e.NEG_ONE=B;var b=o(-1,2147483647,!1);e.MAX_VALUE=b;var S=o(-1,-1,!0);e.MAX_UNSIGNED_VALUE=S;var w=o(0,-2147483648,!1);e.MIN_VALUE=w;var C=e.prototype;return C.toInt=function(){return this.unsigned?this.low>>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},C.toString=function(p){if(p=p||10,p<2||36<p)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(w)){var M=i(p),F=this.div(M),R=F.mul(M).sub(this);return F.toString(p)+R.toInt().toString(p)}else return"-"+this.neg().toString(p);for(var v=i(a(p,6),this.unsigned),D=this,W="";;){var z=D.div(v),Z=D.sub(z.mul(v)).toInt()>>>0,X=Z.toString(p);if(D=z,D.isZero())return X+W;for(;X.length<6;)X="0"+X;W=""+X+W}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var p=this.high!=0?this.high:this.low,M=31;M>0&&!(p&1<<M);M--);return this.high!=0?M+33:M+1},C.isZero=function(){return this.high===0&&this.low===0},C.isNegative=function(){return!this.unsigned&&this.high<0},C.isPositive=function(){return this.unsigned||this.high>=0},C.isOdd=function(){return(this.low&1)===1},C.isEven=function(){return(this.low&1)===0},C.equals=function(p){return t(p)||(p=l(p)),this.unsigned!==p.unsigned&&this.high>>>31===1&&p.high>>>31===1?!1:this.high===p.high&&this.low===p.low},C.eq=C.equals,C.notEquals=function(p){return!this.eq(p)},C.neq=C.notEquals,C.lessThan=function(p){return this.comp(p)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(p){return this.comp(p)<=0},C.lte=C.lessThanOrEqual,C.greaterThan=function(p){return this.comp(p)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(p){return this.comp(p)>=0},C.gte=C.greaterThanOrEqual,C.compare=function(p){if(t(p)||(p=l(p)),this.eq(p))return 0;var M=this.isNegative(),F=p.isNegative();return M&&!F?-1:!M&&F?1:this.unsigned?p.high>>>0>this.high>>>0||p.high===this.high&&p.low>>>0>this.low>>>0?-1:1:this.sub(p).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(E)},C.neg=C.negate,C.add=function(p){t(p)||(p=l(p));var M=this.high>>>16,F=this.high&65535,R=this.low>>>16,v=this.low&65535,D=p.high>>>16,W=p.high&65535,z=p.low>>>16,Z=p.low&65535,X=0,Y=0,tt=0,xt=0;return xt+=v+Z,tt+=xt>>>16,xt&=65535,tt+=R+z,Y+=tt>>>16,tt&=65535,Y+=F+W,X+=Y>>>16,Y&=65535,X+=M+D,X&=65535,o(tt<<16|xt,X<<16|Y,this.unsigned)},C.subtract=function(p){return t(p)||(p=l(p)),this.add(p.neg())},C.sub=C.subtract,C.multiply=function(p){if(this.isZero()||(t(p)||(p=l(p)),p.isZero()))return g;if(this.eq(w))return p.isOdd()?w:g;if(p.eq(w))return this.isOdd()?w:g;if(this.isNegative())return p.isNegative()?this.neg().mul(p.neg()):this.neg().mul(p).neg();if(p.isNegative())return this.mul(p.neg()).neg();if(this.lt(A)&&p.lt(A))return i(this.toNumber()*p.toNumber(),this.unsigned);var M=this.high>>>16,F=this.high&65535,R=this.low>>>16,v=this.low&65535,D=p.high>>>16,W=p.high&65535,z=p.low>>>16,Z=p.low&65535,X=0,Y=0,tt=0,xt=0;return xt+=v*Z,tt+=xt>>>16,xt&=65535,tt+=R*Z,Y+=tt>>>16,tt&=65535,tt+=v*z,Y+=tt>>>16,tt&=65535,Y+=F*Z,X+=Y>>>16,Y&=65535,Y+=R*z,X+=Y>>>16,Y&=65535,Y+=v*W,X+=Y>>>16,Y&=65535,X+=M*Z+F*z+R*W+v*D,X&=65535,o(tt<<16|xt,X<<16|Y,this.unsigned)},C.mul=C.multiply,C.divide=function(p){if(t(p)||(p=l(p)),p.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?y:g;var M,F,R;if(this.unsigned){if(p.unsigned||(p=p.toUnsigned()),p.gt(this))return y;if(p.gt(this.shru(1)))return _;R=y}else{if(this.eq(w)){if(p.eq(E)||p.eq(B))return w;if(p.eq(w))return E;var v=this.shr(1);return M=v.div(p).shl(1),M.eq(g)?p.isNegative()?E:B:(F=this.sub(p.mul(M)),R=M.add(F.div(p)),R)}else if(p.eq(w))return this.unsigned?y:g;if(this.isNegative())return p.isNegative()?this.neg().div(p.neg()):this.neg().div(p).neg();if(p.isNegative())return this.div(p.neg()).neg();R=g}for(F=this;F.gte(p);){M=Math.max(1,Math.floor(F.toNumber()/p.toNumber()));for(var D=Math.ceil(Math.log(M)/Math.LN2),W=D<=48?1:a(2,D-48),z=i(M),Z=z.mul(p);Z.isNegative()||Z.gt(F);)M-=W,z=i(M,this.unsigned),Z=z.mul(p);z.isZero()&&(z=E),R=R.add(z),F=F.sub(Z)}return R},C.div=C.divide,C.modulo=function(p){return t(p)||(p=l(p)),this.sub(this.div(p).mul(p))},C.mod=C.modulo,C.not=function(){return o(~this.low,~this.high,this.unsigned)},C.and=function(p){return t(p)||(p=l(p)),o(this.low&p.low,this.high&p.high,this.unsigned)},C.or=function(p){return t(p)||(p=l(p)),o(this.low|p.low,this.high|p.high,this.unsigned)},C.xor=function(p){return t(p)||(p=l(p)),o(this.low^p.low,this.high^p.high,this.unsigned)},C.shiftLeft=function(p){return t(p)&&(p=p.toInt()),(p&=63)===0?this:p<32?o(this.low<<p,this.high<<p|this.low>>>32-p,this.unsigned):o(0,this.low<<p-32,this.unsigned)},C.shl=C.shiftLeft,C.shiftRight=function(p){return t(p)&&(p=p.toInt()),(p&=63)===0?this:p<32?o(this.low>>>p|this.high<<32-p,this.high>>p,this.unsigned):o(this.high>>p-32,this.high>=0?0:-1,this.unsigned)},C.shr=C.shiftRight,C.shiftRightUnsigned=function(p){if(t(p)&&(p=p.toInt()),p&=63,p===0)return this;var M=this.high;if(p<32){var F=this.low;return o(F>>>p|M<<32-p,M>>>p,this.unsigned)}else return p===32?o(M,0,this.unsigned):o(M>>>p-32,0,this.unsigned)},C.shru=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},C.toBytes=function(T){return T?this.toBytesLE():this.toBytesBE()},C.toBytesLE=function(){var T=this.high,p=this.low;return[p&255,p>>>8&255,p>>>16&255,p>>>24&255,T&255,T>>>8&255,T>>>16&255,T>>>24&255]},C.toBytesBE=function(){var T=this.high,p=this.low;return[T>>>24&255,T>>>16&255,T>>>8&255,T&255,p>>>24&255,p>>>16&255,p>>>8&255,p&255]},e})});var qs=et((SR,xf)=>{xf.exports=globalThis.h3||{}});var La=et((OR,Bf)=>{Bf.exports=globalThis.luma});var Ys=et((NR,Cf)=>{Cf.exports=globalThis.deck});var Sf=et((DR,bf)=>{bf.exports=globalThis.luma});var bn=et((qL,Qf)=>{Qf.exports=globalThis.loaders});var Bp=et((f4,Ep)=>{Ep.exports=globalThis.deck});var Lp=et(dl=>{dl.read=function(e,t,n,r,s){var i,o,a=s*8-r-1,c=(1<<a)-1,l=c>>1,u=-7,h=n?s-1:0,f=n?-1:1,d=e[t+h];for(h+=f,i=d&(1<<-u)-1,d>>=-u,u+=a;u>0;i=i*256+e[t+h],h+=f,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=r;u>0;o=o*256+e[t+h],h+=f,u-=8);if(i===0)i=1-l;else{if(i===c)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-l}return(d?-1:1)*o*Math.pow(2,i-r)};dl.write=function(e,t,n,r,s,i){var o,a,c,l=i*8-s-1,u=(1<<l)-1,h=u>>1,f=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,m=r?1:-1,A=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+h>=1?t+=f/c:t+=f*Math.pow(2,1-h),t*c>=2&&(o++,c/=2),o+h>=u?(a=0,o=u):o+h>=1?(a=(t*c-1)*Math.pow(2,s),o=o+h):(a=t*Math.pow(2,h-1)*Math.pow(2,s),o=0));s>=8;e[n+d]=a&255,d+=m,a/=256,s-=8);for(o=o<<s|a,l+=s;l>0;e[n+d]=o&255,d+=m,o/=256,l-=8);e[n+d-m]|=A*128}});var Gp=et((e8,Up)=>{"use strict";Up.exports=J;var to=Lp();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 ml=(1<<16)*(1<<16),Pp=1/ml,cb=12,Dp=typeof TextDecoder>"u"?null:new TextDecoder("utf8");J.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=eo(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Np(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=eo(this.buf,this.pos)+eo(this.buf,this.pos+4)*ml;return this.pos+=8,e},readSFixed64:function(){var e=eo(this.buf,this.pos)+Np(this.buf,this.pos+4)*ml;return this.pos+=8,e},readFloat:function(){var e=to.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=to.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,lb(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>=cb&&Dp?Bb(this.buf,t,e):Eb(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 n=de(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==J.Bytes)return e.push(this.readSVarint());var t=de(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=de(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=de(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=de(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=de(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=de(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=de(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=de(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 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),Xn(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),Xn(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),Xn(this.buf,e&-1,this.pos),Xn(this.buf,Math.floor(e*Pp),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),Xn(this.buf,e&-1,this.pos),Xn(this.buf,Math.floor(e*Pp),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){ub(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=Cb(this.buf,e,this.pos);var n=this.pos-t;n>=128&&Op(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),to.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),to.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&&Op(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,J.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,db,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,mb,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,Ab,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,pb,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,gb,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,xb,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,yb,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,Tb,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,_b,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 lb(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 jn(e,s,t);throw new Error("Expected varint not more than 10 bytes")}function de(e){return e.type===J.Bytes?e.readVarint()+e.pos:e.pos+1}function jn(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function ub(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),hb(n,r,t),fb(r,t)}function hb(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 fb(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 Op(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 db(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function mb(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function pb(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function gb(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function Ab(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function xb(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function yb(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function Tb(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function _b(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function eo(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function Xn(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function Np(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function Eb(e,t,n){for(var r="",s=t;s<n;){var i=e[s],o=null,a=i>239?4:i>223?3:i>191?2:1;if(s+a>n)break;var c,l,u;a===1?i<128&&(o=i):a===2?(c=e[s+1],(c&192)===128&&(o=(i&31)<<6|c&63,o<=127&&(o=null))):a===3?(c=e[s+1],l=e[s+2],(c&192)===128&&(l&192)===128&&(o=(i&15)<<12|(c&63)<<6|l&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):a===4&&(c=e[s+1],l=e[s+2],u=e[s+3],(c&192)===128&&(l&192)===128&&(u&192)===128&&(o=(i&15)<<18|(c&63)<<12|(l&63)<<6|u&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,a=1):o>65535&&(o-=65536,r+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),r+=String.fromCharCode(o),s+=a}return r}function Bb(e,t,n){return Dp.decode(e.subarray(t,n))}function Cb(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 ns={};ut(ns,{GeohashLayer:()=>es,GreatCircleLayer:()=>hr,H3ClusterLayer:()=>Er,H3HexagonLayer:()=>je,MVTLayer:()=>ts,QuadkeyLayer:()=>mr,S2Layer:()=>dr,TerrainLayer:()=>zr,Tile3DLayer:()=>Ur,TileLayer:()=>ee,TripsLayer:()=>yr,_GeoCellLayer:()=>It,_Tile2DHeader:()=>Je,_Tileset2D:()=>qe,_WMSLayer:()=>ws,_getURLFromTemplate:()=>te});var Xt={},Ml=N(Dt(),1);me(Xt,N(Dt(),1));if(!Ml.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");me(ns,Xt);var ke=N(Ut(),1),Dh=N(Dt(),1);function dg(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function is(e){if(Array.isArray(e))return e.map(t=>is(t));if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[dg(n)]=is(r);return t}return e}var ou=N(iu(),1);function xo(e,t){if(t!=null&&t._parser&&t._parser!=="fast-xml-parser")throw new Error(t?._parser);let n={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:t?.removeNSPrefix,textNodeName:t?.textNodeName,isArray:(s,i,o,a)=>{var c;return Boolean(t==null||(c=t.arrayPaths)===null||c===void 0?void 0:c.some(u=>i===u))},...t?._fastXML},r=E0(e,n);return t!=null&&t.uncapitalizeKeys?is(r):r}function E0(e,t){return new ou.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var B0="4.1.0",pt={name:"XML",id:"xml",module:"xml",version:B0,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:C0,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>xo(new TextDecoder().decode(e),{...pt.options.xml,...t?.xml}),parseTextSync:(e,t)=>xo(e,{...pt.options.xml,...t?.xml})};function C0(e){return e.startsWith("<?xml")}async function Ct(e,t,n,r){return r._parse(e,t,n,r)}function V(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var Wt={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},b0=Wt.self||Wt.window||Wt.global||{},S0=Wt.window||Wt.self||Wt.global||{},M0=Wt.global||Wt.self||Wt.window||{},I0=Wt.document||{};var Kn=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var au=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),w0=au&&parseFloat(au[1])||0;function yo(e,t){return cu(e||{},t)}function cu(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(n>3)return t;let r={...e};for(let[s,i]of Object.entries(t))i&&typeof i=="object"&&!Array.isArray(i)?r[s]=cu(r[s]||{},t[s],n+1):r[s]=t[s];return r}function v0(){var e;return(e=globalThis._loadersgl_)!==null&&e!==void 0&&e.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.1.0"),globalThis._loadersgl_.version}var lu=v0();function uu(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var Yt={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},RS=Yt.self||Yt.window||Yt.global||{},LS=Yt.window||Yt.self||Yt.global||{},PS=Yt.global||Yt.self||Yt.window||{},OS=Yt.document||{};var dn=typeof process!="object"||String(process)!=="[object process]"||process.browser,as=typeof importScripts=="function",NS=typeof window<"u"&&typeof window.orientation<"u",hu=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),DS=hu&&parseFloat(hu[1])||0;var To={};async function Kt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return t&&(e=fu(e,t,n,r)),To[e]=To[e]||F0(e),await To[e]}function fu(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(!n.useLocalLibraries&&e.startsWith("http"))return e;r=r||e;let s=n.modules||{};return s[r]?s[r]:dn?n.CDN?(uu(n.CDN.startsWith("http")),`${n.CDN}/${t}@${lu}/dist/libs/${r}`):as?`../src/libs/${r}`:`modules/${t}/src/libs/${r}`:`modules/${t}/dist/libs/${r}`}async function F0(e){if(e.endsWith("wasm"))return await L0(e);if(!dn)try{return bt&&bt.requireFromFile&&await bt.requireFromFile(e)}catch(n){return console.error(n),null}if(as)return importScripts(e);let t=await P0(e);return R0(t,e)}function R0(e,t){if(!dn)return bt.requireFromString&&bt.requireFromString(e,t);if(as)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 L0(e){return dn||!bt.readFileAsArrayBuffer||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await bt.readFileAsArrayBuffer(e)}async function P0(e){return dn||!bt.readFileAsText||e.startsWith("http")?await(await fetch(e)).text():await bt.readFileAsText(e)}function mu(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:5;return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?du(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?du(e,0,t):""}function du(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 _o(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${mu(e)}"`)}}function Qn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let r=t,s=r&&r.length>1&&r[0].constructor||null;if(!s)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let i=r.reduce((c,l)=>c+l.length,0),o=new s(i),a=0;for(let c of r)o.set(c,a),a+=c.length;return o}function Pe(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 ge(e,t){return V(e>=0),V(t>0),e+(t-1)&~(t-1)}function Eo(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+ge(r.byteLength,4)}function Zn(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Oe=class{constructor(t,n){this.name=void 0,this.type=void 0,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=Zn(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Zn()-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 Ae=class{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"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(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(n=>this._getOrCreate(n))}_getOrCreate(t){let{name:n,type:r}=t,s=this.stats[n];return s||(t instanceof Oe?s=t:s=new Oe(n,r),this.stats[n]=s),s}};var O0="Queued Requests",N0="Active Requests",D0="Cancelled Requests",U0="Queued Requests Ever",G0="Active Requests Ever",V0={id:"request-scheduler",throttleRequests:!0,maxRequests:6},xe=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.props=void 0,this.stats=void 0,this.activeRequestCount=0,this.requestQueue=[],this.requestMap=new Map,this.deferredUpdate=null,this.props={...V0,...t},this.stats=new Ae({id:this.props.id}),this.stats.get(O0),this.stats.get(N0),this.stats.get(D0),this.stats.get(U0),this.stats.get(G0)}scheduleRequest(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:()=>0;if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let r={handle:t,priority:0,getPriority:n},s=new Promise(i=>(r.resolve=i,r));return this.requestQueue.push(r),this.requestMap.set(t,s),this._issueNewRequests(),s}_issueRequest(t){let{handle:n,resolve:r}=t,s=!1,i=()=>{s||(s=!0,this.requestMap.delete(n),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:i}):Promise.resolve({done:i})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequestsAsync(){this.deferredUpdate=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 ye={};ut(ye,{dirname:()=>z0,filename:()=>H0,join:()=>k0,resolve:()=>J0});function pu(){var e;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let t=(e=window.location)===null||e===void 0?void 0:e.pathname;return t?.slice(0,t.lastIndexOf("/")+1)||""}function H0(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function z0(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function k0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let r="/";return t=t.map((s,i)=>(i&&(s=s.replace(new RegExp(`^${r}`),"")),i!==t.length-1&&(s=s.replace(new RegExp(`${r}$`),"")),s)),t.join(r)}function J0(){let e=[];for(let s=0;s<arguments.length;s++)e[s]=s<0||arguments.length<=s?void 0:arguments[s];let t="",n=!1,r;for(let s=e.length-1;s>=-1&&!n;s--){let i;s>=0?i=e[s]:(r===void 0&&(r=pu()),i=r),i.length!==0&&(t=`${i}/${t}`,n=i.charCodeAt(0)===$n)}return t=q0(t,!n),n?`/${t}`:t.length>0?t:"."}var $n=47,Bo=46;function q0(e,t){let n="",r=-1,s=0,i,o=!1;for(let a=0;a<=e.length;++a){if(a<e.length)i=e.charCodeAt(a);else{if(i===$n)break;i=$n}if(i===$n){if(!(r===a-1||s===1))if(r!==a-1&&s===2){if(n.length<2||!o||n.charCodeAt(n.length-1)!==Bo||n.charCodeAt(n.length-2)!==Bo){if(n.length>2){let c=n.length-1,l=c;for(;l>=0&&n.charCodeAt(l)!==$n;--l);if(l!==c){n=l===-1?"":n.slice(0,l),r=a,s=0,o=!1;continue}}else if(n.length===2||n.length===1){n="",r=a,s=0,o=!1;continue}}t&&(n.length>0?n+="/..":n="..",o=!0)}else{let c=e.slice(r+1,a);n.length>0?n+=`/${c}`:n=c,o=!1}r=a,s=0}else i===Bo&&s!==-1?++s:s=-1}return n}var cs=class{constructor(t){this.data=void 0,this.fetch=void 0,this.loadOptions=void 0,this._needsRefresh=!0,this.props=void 0,this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=j0(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function j0(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 vt=class extends cs{};vt.type="template";vt.testURL=e=>!1;function gu(e,t){var n,r,s;let i=(n=pt.parseTextSync)===null||n===void 0?void 0:n.call(pt,e,t),o=(i==null||(r=i.ServiceExceptionReport)===null||r===void 0?void 0:r.ServiceException)||(i==null||(s=i["ogc:ServiceExceptionReport"])===null||s===void 0?void 0:s["ogc:ServiceException"]);return typeof o=="string"?o:o.value||o.code||"Unknown error"}var X0="4.1.0",Ne={id:"wms-error",name:"WMS Error",module:"wms",version:X0,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:W0,options:{wms:{throwOnError:!1}},parse:async(e,t)=>Co(new TextDecoder().decode(e),t),parseSync:(e,t)=>Co(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Co(e,t)};function W0(e){return e.startsWith("<?xml")}function Co(e,t){let n={...Ne.options.wms,...t?.wms},r=gu(e,n),s=n.minimalErrors?r:`WMS Service error: ${r}`;if(n.throwOnError)throw new Error(s);return s}function De(e){return Array.isArray(e)?e:e?[e]:[]}function tr(e){let t=De(e);return t.length>0&&t.every(n=>typeof n=="string")?t:[]}function er(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;switch(typeof e){case"number":return e;case"string":return parseFloat(e);default:return}}function ls(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;switch(typeof e){case"number":return e;case"string":return parseInt(e,10);default:return}}function Ue(e){switch(e){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function bo(e,t){var n;let r=(n=pt.parseTextSync)===null||n===void 0?void 0:n.call(pt,e,t),s=r.WMT_MS_Capabilities||r.WMS_Capabilities||r,i=Y0(s);if(t!=null&&t.inheritedLayerProps)for(let o of i.layers)xu(o,null);return t!=null&&t.includeRawJSON&&(i.json=s),t!=null&&t.includeXMLText&&(i.xml=e),i}function Y0(e){var t,n,r,s,i,o,a,c,l,u,h,f,d,m,A,g;let y={version:String(e.version||""),name:String(((t=e.Service)===null||t===void 0?void 0:t.Name)||"unnamed"),title:(n=e.Service)!==null&&n!==void 0&&n.Title?String((r=e.Service)===null||r===void 0?void 0:r.Title):void 0,abstract:(s=e.Service)!==null&&s!==void 0&&s.Abstract?String((i=e.Service)===null||i===void 0?void 0:i.Abstract):void 0,keywords:tr((o=e.Service)===null||o===void 0||(a=o.KeywordList)===null||a===void 0?void 0:a.Keyword),fees:(c=e.Service)!==null&&c!==void 0&&c.Fees?JSON.stringify((l=e.Service)===null||l===void 0?void 0:l.Fees):void 0,accessConstraints:(u=e.Service)!==null&&u!==void 0&&u.AccessConstraints?JSON.stringify((h=e.Service)===null||h===void 0?void 0:h.AccessConstraints):void 0,layerLimit:ls((f=e.Service)===null||f===void 0?void 0:f.LayerLimit),maxWidth:ls((d=e.Service)===null||d===void 0?void 0:d.maxWidth),maxHeight:ls((m=e.Service)===null||m===void 0?void 0:m.maxHeight),layers:[],requests:K0((A=e.Capability)===null||A===void 0?void 0:A.Request),exceptions:Q0(e.Exception)},E=De((g=e.Capability)===null||g===void 0?void 0:g.Layer);for(let _ of E)y.layers.push(Au(_));for(let[_,B]of Object.entries(y))B===void 0&&delete y[_];return y}function K0(e){let t={};for(let[n,r]of Object.entries(e||{})){let s=tr(r?.Format);t[n]={mimeTypes:s}}return t}function Q0(e){if(De(e?.Format).length>0)return{mimeTypes:tr(e)}}function Au(e){var t;let n={title:String(e?.Title||""),name:e?.Name&&String(e?.Name),abstract:e?.Name&&String(e?.Abstract),keywords:tr((t=e.KeywordList)===null||t===void 0?void 0:t.Keyword)},r=e?.CRS||e?.SRS;r&&Array.isArray(r)&&r.every(u=>typeof u=="string")&&(n.crs=r);let s=e?.EX_GeographicBoundingBox&&Z0(e?.EX_GeographicBoundingBox);s&&(n.geographicBoundingBox=s),s=e?.LatLonBoundingBox&&$0(e?.LatLonBoundingBox),s&&(n.geographicBoundingBox=s);let i=e?.BoundingBox&&tA(e?.BoundingBox);i&&i.length>0&&(n.boundingBoxes=i);let a=De(e?.Dimension).map(u=>nA(u));a.length&&(n.dimensions=a),e!=null&&e.opaque&&(n.opaque=Ue(e?.opaque)),e!=null&&e.cascaded&&(n.cascaded=Ue(e?.cascaded)),e!=null&&e.queryable&&(n.queryable=Ue(e?.queryable));let c=De(e?.Layer),l=[];for(let u of c)l.push(Au(u));l.length>0&&(n.layers=l);for(let[u,h]of Object.entries(n))h===void 0&&delete n[u];return n}function Z0(e){let{westBoundLongitude:t,northBoundLatitude:n,eastBoundLongitude:r,southBoundLatitude:s}=e;return[[t,s],[r,n]]}function $0(e){let{minx:t,miny:n,maxx:r,maxy:s}=e;return[[t,n],[r,s]]}function tA(e){return De(e).map(n=>eA(n))}function eA(e){let{CRS:t,SRS:n,minx:r,miny:s,maxx:i,maxy:o,resx:a,resy:c}=e,l={crs:t||n,boundingBox:[[er(r),er(s)],[er(i),er(o)]]};return a&&(l.xResolution=a),c&&(l.yResolution=c),l}function nA(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=Ue(e.multipleValues)),e.nearestValue&&(s.nearestValue=Ue(e.nearestValue)),e.current&&(s.current=Ue(e.current)),s}function xu(e,t){t!=null&&t.geographicBoundingBox&&!e.geographicBoundingBox&&(e.geographicBoundingBox=[...t.geographicBoundingBox]),t!=null&&t.crs&&!e.crs&&(e.crs=[...t.crs]),t!=null&&t.boundingBoxes&&!e.boundingBoxes&&(e.boundingBoxes=[...t.boundingBoxes]),t!=null&&t.dimensions&&!e.dimensions&&(e.dimensions=[...t.dimensions]);for(let n of e.layers||[])xu(n,e)}var rA="4.1.0",mn={id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:rA,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:sA,options:{wms:{}},parse:async(e,t)=>bo(new TextDecoder().decode(e),t?.wms),parseTextSync:(e,t)=>bo(e,t?.wms)};function sA(e){return e.startsWith("<?xml")}function So(e,t){var n,r;let i=((r=((n=pt.parseTextSync)===null||n===void 0?void 0:n.call(pt,e,t)).FeatureInfoResponse)===null||r===void 0?void 0:r.FIELDS)||[];return{features:(Array.isArray(i)?i:[i]).map(a=>iA(a))}}function iA(e){return{attributes:e||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var yu={...mn,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(e,t)=>So(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>So(e,t)};function Mo(e,t){var n;return(n=pt.parseTextSync)===null||n===void 0?void 0:n.call(pt,e,t)}var Tu={...mn,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(e,t)=>Mo(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Mo(e,t)};function _u(e,t){let{type:n="auto"}=e,r=n==="auto"?aA(e.url,t):oA(n,t);if(!r)throw new Error("Not a valid image source type");return r.create(e)}function oA(e,t){for(let n of t)if(n.type===e)return n;return null}function aA(e,t){for(let n of t)if(n.testURL&&n.testURL(e))return n;return null}var Eu="4.1.0";var Io,cA=(Io=globalThis.loaders)===null||Io===void 0?void 0:Io.parseImageNode,wo=typeof Image<"u",vo=typeof ImageBitmap<"u",lA=Boolean(cA),Fo=Kn?!0:lA;function Bu(e){switch(e){case"auto":return vo||wo||Fo;case"imagebitmap":return vo;case"image":return wo;case"data":return Fo;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Cu(){if(vo)return"imagebitmap";if(wo)return"image";if(Fo)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function bu(e){let t=uA(e);if(!t)throw new Error("Not an image");return t}function nr(e){switch(bu(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 uA(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 hA=/^data:image\/svg\+xml/,fA=/\.svg((\?|#).*)?$/;function us(e){return e&&(hA.test(e)||fA.test(e))}function Su(e,t){if(us(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 Ro(e,t)}function Ro(e,t){if(us(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function hs(e,t,n){let r=Su(e,n),s=self.URL||self.webkitURL,i=typeof r!="string"&&s.createObjectURL(r);try{return await dA(i||r,t)}finally{i&&s.revokeObjectURL(i)}}async function dA(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 mA={},Mu=!0;async function Iu(e,t,n){let r;us(n)?r=await hs(e,t,n):r=Ro(e,n);let s=t&&t.imagebitmap;return await pA(r,s)}async function pA(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if((gA(t)||!Mu)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),Mu=!1}return await createImageBitmap(e)}function gA(e){for(let t in e||mA)return!1;return!0}function wu(e){return!TA(e,"ftyp",4)||!(e[8]&96)?null:AA(e)}function AA(e){switch(xA(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function xA(e,t,n){return String.fromCharCode(...e.slice(t,n))}function yA(e){return[...e].map(t=>t.charCodeAt(0))}function TA(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=yA(t);for(let s=0;s<r.length;++s)if(r[s]!==e[s+n])return!1;return!0}var Qt=!1,rr=!0;function Ge(e){let t=sr(e);return EA(t)||bA(t)||BA(t)||CA(t)||_A(t)}function _A(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=wu(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function EA(e){let t=sr(e);return t.byteLength>=24&&t.getUint32(0,Qt)===2303741511?{mimeType:"image/png",width:t.getUint32(16,Qt),height:t.getUint32(20,Qt)}:null}function BA(e){let t=sr(e);return t.byteLength>=10&&t.getUint32(0,Qt)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,rr),height:t.getUint16(8,rr)}:null}function CA(e){let t=sr(e);return t.byteLength>=14&&t.getUint16(0,Qt)===16973&&t.getUint32(2,rr)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,rr),height:t.getUint32(22,rr)}:null}function bA(e){let t=sr(e);if(!(t.byteLength>=3&&t.getUint16(0,Qt)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:s}=SA(),i=2;for(;i+9<t.byteLength;){let o=t.getUint16(i,Qt);if(s.has(o))return{mimeType:"image/jpeg",height:t.getUint16(i+5,Qt),width:t.getUint16(i+7,Qt)};if(!r.has(o))return null;i+=2,i+=t.getUint16(i,Qt)}return null}function SA(){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 sr(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 vu(e,t){var n;let{mimeType:r}=Ge(e)||{},s=(n=globalThis.loaders)===null||n===void 0?void 0:n.parseImageNode;return V(s),await s(e,r)}async function Fu(e,t,n){t=t||{};let s=(t.image||{}).type||"auto",{url:i}=n||{},o=MA(s),a;switch(o){case"imagebitmap":a=await Iu(e,t,i);break;case"image":a=await hs(e,t,i);break;case"data":a=await vu(e,t);break;default:V(!1)}return s==="data"&&(a=nr(a)),a}function MA(e){switch(e){case"auto":case"data":return Cu();default:return Bu(e),e}}var IA=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],wA=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],vA={image:{type:"auto",decode:!0}},Te={id:"image",module:"images",name:"Images",version:Eu,mimeTypes:wA,extensions:IA,parse:Fu,tests:[e=>Boolean(Ge(new DataView(e)))],options:vA};var Lo={};function Po(e){if(Lo[e]===void 0){let t=Kn?RA(e):FA(e);Lo[e]=t}return Lo[e]}function FA(e){var t,n;let r=["image/png","image/jpeg","image/gif"],s=((t=globalThis.loaders)===null||t===void 0?void 0:t.imageFormatsNode)||r,i=(n=globalThis.loaders)===null||n===void 0?void 0:n.parseImageNode;return Boolean(i)&&s.includes(e)}function RA(e){switch(e){case"image/avif":case"image/webp":return LA(e);default:return!0}}function LA(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var Ru={type:"wms",testURL:e=>e.toLowerCase().includes("wms"),create:e=>new Oo(e)},Oo=class extends vt{constructor(t){var n;super(t),this.url=void 0,this.data=void 0,this.substituteCRS84=void 0,this.flipCRS=void 0,this.wmsParameters=void 0,this.vendorParameters=void 0,this.capabilities=null,this.url=t.url,this.data=t.url,this.substituteCRS84=(n=t.substituteCRS84)!==null&&n!==void 0?n:!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...t.wmsParameters},this.vendorParameters=t.vendorParameters||{}}async getMetadata(){let t=await this.getCapabilities();return this.normalizeMetadata(t)}async getImage(t){let{boundingBox:n,bbox:r,...s}=t,i={bbox:n?[...n[0],...n[1]]:r,...s};return await this.getMap(i)}normalizeMetadata(t){return t}async getCapabilities(t,n){let r=this.getCapabilitiesURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);let o=await mn.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 Te.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 yu.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 Tu.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 Te.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}getCapabilitiesURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetCapabilities",r,n)}getMapURL(t,n){t=this._getWMS130Parameters(t);let r={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetMap",r,n)}getFeatureInfoURL(t,n){t=this._getWMS130Parameters(t);let r={version:this.wmsParameters.version,info_format:this.wmsParameters.info_format,layers:this.wmsParameters.layers,query_layers:this.wmsParameters.query_layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetFeatureInfo",r,n)}describeLayerURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("DescribeLayer",r,n)}getLegendGraphicURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetLegendGraphic",r,n)}_parseWMSUrl(t){let[n,r]=t.split("?"),s=r.split("&"),i={};for(let o of s){let[a,c]=o.split("=");i[a]=c}return{url:n,parameters:i}}_getWMSUrl(t,n,r){let s=this.url,i=!0,o={service:"WMS",version:n.version,request:t,...n,...this.vendorParameters,...r},a=["transparent","time","elevation"];for(let[c,l]of Object.entries(o))(!a.includes(c)||l)&&(s+=i?"?":"&",i=!1,s+=this._getURLParameter(c,l,n));return encodeURI(s)}_getWMS130Parameters(t){let n={...t};return n.srs&&(n.crs=n.crs||n.srs,delete n.srs),n}_getURLParameter(t,n,r){switch(t){case"crs":r.version!=="1.3.0"?t="srs":this.substituteCRS84&&n==="EPSG:4326"&&(n="CRS:84");break;case"srs":r.version==="1.3.0"&&(t="crs");break;case"bbox":let s=this._flipBoundingBox(n,r);s&&(n=s);break;default:}return t=t.toUpperCase(),Array.isArray(n)?`${t}=${n.join(",")}`:`${t}=${n?String(n):""}`}_flipBoundingBox(t,n){if(!Array.isArray(t)||t.length!==4)return null;let r=n.version==="1.3.0"&&this.flipCRS.includes(n.crs||"")&&!(this.substituteCRS84&&n.crs==="EPSG:4326"),s=t;return r?[s[1],s[0],s[3],s[2]]:s}async _fetchArrayBuffer(t){let n=await this.fetch(t),r=await n.arrayBuffer();return this._checkResponse(n,r),r}_checkResponse(t,n){let r=t.headers["content-type"];if(!t.ok||Ne.mimeTypes.includes(r)){var s;let i=yo(this.loadOptions,{wms:{throwOnError:!0}}),o=(s=Ne.parseSync)===null||s===void 0?void 0:s.call(Ne,n,i);throw new Error(o)}}_parseError(t){var n;let r=(n=Ne.parseSync)===null||n===void 0?void 0:n.call(Ne,t,this.loadOptions);return new Error(r)}};var pn=class extends vt{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 Te.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}};pn.type="template";pn.testURL=e=>e.toLowerCase().includes("{");var No=class extends pn{constructor(t){super(t),this.data=void 0,this.data=t.url}async getMetadata(){return await this.metadata()}async getImage(t){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(t){throw new Error("not implemented")}metadataURL(t){return`${this.props.url}?f=pjson`}exportImageURL(t){let n=`bbox=${t.bbox[0]},${t.bbox[1]},${t.bbox[2]},${t.bbox[3]}`,r=`size=${t.width},${t.height}`,s={...t,bbox:n,size:r};return delete s.width,delete s.height,this.getUrl("exportImage",s)}getUrl(t,n,r){let s=`${this.props.url}/${t}`,i=!0;for(let[o,a]of Object.entries(n))s+=i?"?":"&",i=!1,Array.isArray(a)?s+=`${o.toUpperCase()}=${a.join(",")}`:s+=`${o.toUpperCase()}=${a?String(a):""}`;return s}async checkResponse(t){if(!t.ok)throw new Error("error")}},Lu={type:"arcgis-image-server",testURL:e=>e.toLowerCase().includes("ImageServer"),create:e=>new No(e)};var PA=[Ru,Lu];function Do(e){return _u(e,PA)}function L(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var OA=1/Math.PI*180,NA=1/180*Math.PI,DA={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...DA}};var K=globalThis.mathgl.config;function Uo(e,{precision:t=K.precision}={}){return e=UA(e),"".concat(parseFloat(e.toPrecision(t)))}function St(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Go(e){return Pu(e)}function Vo(e){return Mt(e)}function Pu(e,t){return Ho(e,n=>n*NA,t)}function Mt(e,t){return Ho(e,n=>n*OA,t)}function fs(e,t,n){return Ho(e,r=>Math.max(t,Math.min(n,r)))}function _e(e,t,n){return St(e)?e.map((r,s)=>_e(r,t[s],n)):n*t+(1-n)*e}function gt(e,t,n){let r=K.EPSILON;n&&(K.EPSILON=n);try{if(e===t)return!0;if(St(e)&&St(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!gt(e[s],t[s]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=K.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{K.EPSILON=r}}function UA(e){return Math.round(e/K.EPSILON)*K.EPSILON}function GA(e){return e.clone?e.clone():new Array(e.length)}function Ho(e,t,n){if(St(e)){let r=e;n=n||GA(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)}function VA(e){function t(){var n=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(n,Object.getPrototypeOf(this)),n}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}var Ee=class extends VA(Array){clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:St(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(K)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+Uo(this[r],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(n,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!gt(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(K.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let 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 HA(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 G(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(JSON.stringify(e)));return e}function Be(e,t,n=""){if(K.debug&&!HA(e,t))throw new Error("math.gl: ".concat(n," some fields set to invalid numbers'"));return e}function ct(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}var Ce=class extends Ee{get x(){return this[0]}set x(t){this[0]=G(t)}get y(){return this[1]}set y(t){this[1]=G(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let 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 G(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return G(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 ct(t>=0&&t<this.ELEMENTS,"index is out of range"),G(this[t])}setComponent(t,n){return ct(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 $=typeof Float32Array<"u"?Float32Array:Array,ir=Math.random;function gn(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var f2=Math.PI/180;function zA(){let e=new $(2);return $!=Float32Array&&(e[0]=0,e[1]=0),e}function Ou(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 Nu(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 ds(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 ms(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 d2=function(){let e=zA();return function(t,n,r,s,i,o){let a,c;for(n||(n=2),r||(r=0),s?c=Math.min(s*n+r,t.length):c=t.length,a=r;a<c;a+=n)e[0]=t[a],e[1]=t[a+1],i(e,e,o),t[a]=e[0],t[a+1]=e[1];return t}}();function ps(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 gs(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 Du(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 Uu(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 As(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}var Ve=class extends Ce{constructor(t=0,n=0){super(2),St(t)&&arguments.length===1?this.copy(t):(K.debug&&(G(t),G(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 K.debug&&(G(t.x),G(t.y)),this[0]=t.x,this[1]=t.y,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return ms(this,this,t),this.check()}transformAsVector(t){return ps(this,this,t),this.check()}transformByMatrix3(t){return ds(this,this,t),this.check()}transformByMatrix2x3(t){return Nu(this,this,t),this.check()}transformByMatrix2(t){return Ou(this,this,t),this.check()}};var xn={};ut(xn,{add:()=>jA,angle:()=>jo,bezier:()=>i1,ceil:()=>XA,clone:()=>kA,copy:()=>JA,create:()=>xs,cross:()=>He,dist:()=>m1,distance:()=>ku,div:()=>d1,divide:()=>zu,dot:()=>or,equals:()=>u1,exactEquals:()=>l1,floor:()=>WA,forEach:()=>A1,fromValues:()=>ys,hermite:()=>s1,inverse:()=>e1,len:()=>Xo,length:()=>Gu,lerp:()=>n1,max:()=>KA,min:()=>YA,mul:()=>f1,multiply:()=>Hu,negate:()=>t1,normalize:()=>zo,random:()=>o1,rotateX:()=>ko,rotateY:()=>Jo,rotateZ:()=>qo,round:()=>QA,scale:()=>ZA,scaleAndAdd:()=>$A,set:()=>qA,slerp:()=>r1,sqrDist:()=>p1,sqrLen:()=>g1,squaredDistance:()=>Ju,squaredLength:()=>qu,str:()=>c1,sub:()=>h1,subtract:()=>Vu,transformMat3:()=>ar,transformMat4:()=>ze,transformQuat:()=>cr,zero:()=>a1});function xs(){let e=new $(3);return $!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function kA(e){let t=new $(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Gu(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function ys(e,t,n){let r=new $(3);return r[0]=e,r[1]=t,r[2]=n,r}function JA(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function qA(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function jA(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function Vu(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],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}function zu(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}function XA(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function WA(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function YA(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 KA(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 QA(e,t){return e[0]=gn(t[0]),e[1]=gn(t[1]),e[2]=gn(t[2]),e}function ZA(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function $A(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 ku(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 Ju(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 qu(e){let t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r}function t1(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function e1(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function zo(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 or(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function He(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],a=n[1],c=n[2];return e[0]=s*c-i*a,e[1]=i*o-r*c,e[2]=r*a-s*o,e}function n1(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 r1(e,t,n,r){let s=Math.acos(Math.min(Math.max(or(t,n),-1),1)),i=Math.sin(s),o=Math.sin((1-r)*s)/i,a=Math.sin(r*s)/i;return e[0]=o*t[0]+a*n[0],e[1]=o*t[1]+a*n[1],e[2]=o*t[2]+a*n[2],e}function s1(e,t,n,r,s,i){let o=i*i,a=o*(2*i-3)+1,c=o*(i-2)+i,l=o*(i-1),u=o*(3-2*i);return e[0]=t[0]*a+n[0]*c+r[0]*l+s[0]*u,e[1]=t[1]*a+n[1]*c+r[1]*l+s[1]*u,e[2]=t[2]*a+n[2]*c+r[2]*l+s[2]*u,e}function i1(e,t,n,r,s,i){let o=1-i,a=o*o,c=i*i,l=a*o,u=3*i*a,h=3*c*o,f=c*i;return e[0]=t[0]*l+n[0]*u+r[0]*h+s[0]*f,e[1]=t[1]*l+n[1]*u+r[1]*h+s[1]*f,e[2]=t[2]*l+n[2]*u+r[2]*h+s[2]*f,e}function o1(e,t){t=t===void 0?1:t;let n=ir()*2*Math.PI,r=ir()*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 ze(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 ar(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 cr(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],a=t[0],c=t[1],l=t[2],u=s*l-i*c,h=i*a-r*l,f=r*c-s*a,d=s*f-i*h,m=i*u-r*f,A=r*h-s*u,g=o*2;return u*=g,h*=g,f*=g,d*=2,m*=2,A*=2,e[0]=a+u+d,e[1]=c+h+m,e[2]=l+f+A,e}function ko(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 Jo(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 qo(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 jo(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],a=t[2],c=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+a*a)),l=c&&or(e,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}function a1(e){return e[0]=0,e[1]=0,e[2]=0,e}function c1(e){return"vec3(".concat(e[0],", ").concat(e[1],", ").concat(e[2],")")}function l1(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function u1(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],a=t[2];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-o)<=1e-6*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}var h1=Vu,f1=Hu,d1=zu,m1=ku,p1=Ju,Xo=Gu,g1=qu,A1=function(){let e=xs();return function(t,n,r,s,i,o){let a,c;for(n||(n=3),r||(r=0),s?c=Math.min(s*n+r,t.length):c=t.length,a=r;a<c;a+=n)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],i(e,e,o),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2];return t}}();var Wo=[0,0,0],Ts,x=class extends Ce{static get ZERO(){return Ts||(Ts=new x(0,0,0),Object.freeze(Ts)),Ts}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&St(t)?this.copy(t):(K.debug&&(G(t),G(n),G(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 K.debug&&(G(t.x),G(t.y),G(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=G(t)}angle(t){return jo(this,t)}cross(t){return He(this,this,t),this.check()}rotateX({radians:t,origin:n=Wo}){return ko(this,this,n,t),this.check()}rotateY({radians:t,origin:n=Wo}){return Jo(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=Wo}){return qo(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return ze(this,this,t),this.check()}transformAsVector(t){return gs(this,this,t),this.check()}transformByMatrix3(t){return ar(this,this,t),this.check()}transformByMatrix2(t){return Du(this,this,t),this.check()}transformByQuaternion(t){return cr(this,this,t),this.check()}};var _s,yn=class extends Ce{static get ZERO(){return _s||(_s=new yn(0,0,0,0),Object.freeze(_s)),_s}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),St(t)&&arguments.length===1?this.copy(t):(K.debug&&(G(t),G(n),G(r),G(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 K.debug&&(G(t.x),G(t.y),G(t.z),G(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=G(t)}get w(){return this[3]}set w(t){this[3]=G(t)}transform(t){return ze(this,this,t),this.check()}transformByMatrix3(t){return As(this,this,t),this.check()}transformByMatrix2(t){return Uu(this,this,t),this.check()}transformByQuaternion(t){return cr(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Tn=class extends Ee{toString(){let t="[";if(K.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=" ".concat(this[r*this.RANK+n])}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=" ".concat(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]=G(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 ju(){let e=new $(9);return $!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function Xu(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 Wu(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],a=t[5],c=t[6],l=t[7],u=t[8],h=u*o-a*l,f=-u*i+a*c,d=l*i-o*c,m=n*h+r*f+s*d;return m?(m=1/m,e[0]=h*m,e[1]=(-u*r+s*l)*m,e[2]=(a*r-s*o)*m,e[3]=f*m,e[4]=(u*n-s*c)*m,e[5]=(-a*n+s*i)*m,e[6]=d*m,e[7]=(-l*n+r*c)*m,e[8]=(o*n-r*i)*m,e):null}function Yu(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],a=e[6],c=e[7],l=e[8];return t*(l*i-o*c)+n*(-l*s+o*a)+r*(c*s-i*a)}function Yo(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=t[8],f=n[0],d=n[1],m=n[2],A=n[3],g=n[4],y=n[5],E=n[6],_=n[7],B=n[8];return e[0]=f*r+d*o+m*l,e[1]=f*s+d*a+m*u,e[2]=f*i+d*c+m*h,e[3]=A*r+g*o+y*l,e[4]=A*s+g*a+y*u,e[5]=A*i+g*c+y*h,e[6]=E*r+_*o+B*l,e[7]=E*s+_*a+B*u,e[8]=E*i+_*c+B*h,e}function Ku(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=t[8],f=n[0],d=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=a,e[5]=c,e[6]=f*r+d*o+l,e[7]=f*s+d*a+u,e[8]=f*i+d*c+h,e}function Qu(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=t[8],f=Math.sin(n),d=Math.cos(n);return e[0]=d*r+f*o,e[1]=d*s+f*a,e[2]=d*i+f*c,e[3]=d*o-f*r,e[4]=d*a-f*s,e[5]=d*c-f*i,e[6]=l,e[7]=u,e[8]=h,e}function Ko(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 Zu(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,a=r+r,c=s+s,l=n*o,u=r*o,h=r*a,f=s*o,d=s*a,m=s*c,A=i*o,g=i*a,y=i*c;return e[0]=1-h-m,e[3]=u-y,e[6]=f+g,e[1]=u+y,e[4]=1-l-m,e[7]=d-A,e[2]=f-g,e[5]=d+A,e[8]=1-l-h,e}var Qo;(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"})(Qo||(Qo={}));var y1=Object.freeze([1,0,0,0,1,0,0,0,1]),k=class extends Tn{static get IDENTITY(){return _1()}static get ZERO(){return T1()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Qo}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(y1)}fromObject(t){return this.check()}fromQuaternion(t){return Zu(this,t),this.check()}set(t,n,r,s,i,o,a,c,l){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=l,this.check()}setRowMajor(t,n,r,s,i,o,a,c,l){return this[0]=t,this[1]=s,this[2]=a,this[3]=n,this[4]=i,this[5]=c,this[6]=r,this[7]=o,this[8]=l,this.check()}determinant(){return Yu(this)}transpose(){return Xu(this,this),this.check()}invert(){return Wu(this,this),this.check()}multiplyLeft(t){return Yo(this,t,this),this.check()}multiplyRight(t){return Yo(this,this,t),this.check()}rotate(t){return Qu(this,this,t),this.check()}scale(t){return Array.isArray(t)?Ko(this,this,t):Ko(this,this,[t,t]),this.check()}translate(t){return Ku(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=ds(n||[-0,-0],t,this);break;case 3:r=ar(n||[-0,-0,-0],t,this);break;case 4:r=As(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Be(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)}},Es,Bs=null;function T1(){return Es||(Es=new k([0,0,0,0,0,0,0,0,0]),Object.freeze(Es)),Es}function _1(){return Bs||(Bs=new k,Object.freeze(Bs)),Bs}var Cs={};ut(Cs,{add:()=>j1,adjoint:()=>M1,clone:()=>B1,copy:()=>C1,create:()=>E1,decompose:()=>D1,determinant:()=>ta,equals:()=>K1,exactEquals:()=>Y1,frob:()=>q1,fromQuat:()=>aa,fromQuat2:()=>P1,fromRotation:()=>v1,fromRotationTranslation:()=>th,fromRotationTranslationScale:()=>U1,fromRotationTranslationScaleOrigin:()=>G1,fromScaling:()=>w1,fromTranslation:()=>I1,fromValues:()=>b1,fromXRotation:()=>F1,fromYRotation:()=>R1,fromZRotation:()=>L1,frustum:()=>ca,getRotation:()=>N1,getScaling:()=>eh,getTranslation:()=>O1,identity:()=>$u,invert:()=>$o,lookAt:()=>ha,mul:()=>Q1,multiply:()=>lr,multiplyScalar:()=>X1,multiplyScalarAndAdd:()=>W1,ortho:()=>ua,orthoNO:()=>rh,orthoZO:()=>z1,perspective:()=>la,perspectiveFromFieldOfView:()=>H1,perspectiveNO:()=>nh,perspectiveZO:()=>V1,rotate:()=>ra,rotateX:()=>sa,rotateY:()=>ia,rotateZ:()=>oa,scale:()=>na,set:()=>S1,str:()=>J1,sub:()=>Z1,subtract:()=>sh,targetTo:()=>k1,translate:()=>ea,transpose:()=>Zo});function E1(){let e=new $(16);return $!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function B1(e){let t=new $(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function C1(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 b1(e,t,n,r,s,i,o,a,c,l,u,h,f,d,m,A){let g=new $(16);return g[0]=e,g[1]=t,g[2]=n,g[3]=r,g[4]=s,g[5]=i,g[6]=o,g[7]=a,g[8]=c,g[9]=l,g[10]=u,g[11]=h,g[12]=f,g[13]=d,g[14]=m,g[15]=A,g}function S1(e,t,n,r,s,i,o,a,c,l,u,h,f,d,m,A,g){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=i,e[5]=o,e[6]=a,e[7]=c,e[8]=l,e[9]=u,e[10]=h,e[11]=f,e[12]=d,e[13]=m,e[14]=A,e[15]=g,e}function $u(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 Zo(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function $o(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],a=t[5],c=t[6],l=t[7],u=t[8],h=t[9],f=t[10],d=t[11],m=t[12],A=t[13],g=t[14],y=t[15],E=n*a-r*o,_=n*c-s*o,B=n*l-i*o,b=r*c-s*a,S=r*l-i*a,w=s*l-i*c,C=u*A-h*m,T=u*g-f*m,p=u*y-d*m,M=h*g-f*A,F=h*y-d*A,R=f*y-d*g,v=E*R-_*F+B*M+b*p-S*T+w*C;return v?(v=1/v,e[0]=(a*R-c*F+l*M)*v,e[1]=(s*F-r*R-i*M)*v,e[2]=(A*w-g*S+y*b)*v,e[3]=(f*S-h*w-d*b)*v,e[4]=(c*p-o*R-l*T)*v,e[5]=(n*R-s*p+i*T)*v,e[6]=(g*B-m*w-y*_)*v,e[7]=(u*w-f*B+d*_)*v,e[8]=(o*F-a*p+l*C)*v,e[9]=(r*p-n*F-i*C)*v,e[10]=(m*S-A*B+y*E)*v,e[11]=(h*B-u*S-d*E)*v,e[12]=(a*T-o*M-c*C)*v,e[13]=(n*M-r*T+s*C)*v,e[14]=(A*_-m*b-g*E)*v,e[15]=(u*b-h*_+f*E)*v,e):null}function M1(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],a=t[5],c=t[6],l=t[7],u=t[8],h=t[9],f=t[10],d=t[11],m=t[12],A=t[13],g=t[14],y=t[15],E=n*a-r*o,_=n*c-s*o,B=n*l-i*o,b=r*c-s*a,S=r*l-i*a,w=s*l-i*c,C=u*A-h*m,T=u*g-f*m,p=u*y-d*m,M=h*g-f*A,F=h*y-d*A,R=f*y-d*g;return e[0]=a*R-c*F+l*M,e[1]=s*F-r*R-i*M,e[2]=A*w-g*S+y*b,e[3]=f*S-h*w-d*b,e[4]=c*p-o*R-l*T,e[5]=n*R-s*p+i*T,e[6]=g*B-m*w-y*_,e[7]=u*w-f*B+d*_,e[8]=o*F-a*p+l*C,e[9]=r*p-n*F-i*C,e[10]=m*S-A*B+y*E,e[11]=h*B-u*S-d*E,e[12]=a*T-o*M-c*C,e[13]=n*M-r*T+s*C,e[14]=A*_-m*b-g*E,e[15]=u*b-h*_+f*E,e}function ta(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],a=e[6],c=e[7],l=e[8],u=e[9],h=e[10],f=e[11],d=e[12],m=e[13],A=e[14],g=e[15],y=t*o-n*i,E=t*a-r*i,_=n*a-r*o,B=l*m-u*d,b=l*A-h*d,S=u*A-h*m,w=t*S-n*b+r*B,C=i*S-o*b+a*B,T=l*_-u*E+h*y,p=d*_-m*E+A*y;return c*w-s*C+g*T-f*p}function lr(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=t[8],f=t[9],d=t[10],m=t[11],A=t[12],g=t[13],y=t[14],E=t[15],_=n[0],B=n[1],b=n[2],S=n[3];return e[0]=_*r+B*a+b*h+S*A,e[1]=_*s+B*c+b*f+S*g,e[2]=_*i+B*l+b*d+S*y,e[3]=_*o+B*u+b*m+S*E,_=n[4],B=n[5],b=n[6],S=n[7],e[4]=_*r+B*a+b*h+S*A,e[5]=_*s+B*c+b*f+S*g,e[6]=_*i+B*l+b*d+S*y,e[7]=_*o+B*u+b*m+S*E,_=n[8],B=n[9],b=n[10],S=n[11],e[8]=_*r+B*a+b*h+S*A,e[9]=_*s+B*c+b*f+S*g,e[10]=_*i+B*l+b*d+S*y,e[11]=_*o+B*u+b*m+S*E,_=n[12],B=n[13],b=n[14],S=n[15],e[12]=_*r+B*a+b*h+S*A,e[13]=_*s+B*c+b*f+S*g,e[14]=_*i+B*l+b*d+S*y,e[15]=_*o+B*u+b*m+S*E,e}function ea(e,t,n){let r=n[0],s=n[1],i=n[2],o,a,c,l,u,h,f,d,m,A,g,y;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],a=t[1],c=t[2],l=t[3],u=t[4],h=t[5],f=t[6],d=t[7],m=t[8],A=t[9],g=t[10],y=t[11],e[0]=o,e[1]=a,e[2]=c,e[3]=l,e[4]=u,e[5]=h,e[6]=f,e[7]=d,e[8]=m,e[9]=A,e[10]=g,e[11]=y,e[12]=o*r+u*s+m*i+t[12],e[13]=a*r+h*s+A*i+t[13],e[14]=c*r+f*s+g*i+t[14],e[15]=l*r+d*s+y*i+t[15]),e}function na(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 ra(e,t,n,r){let s=r[0],i=r[1],o=r[2],a=Math.sqrt(s*s+i*i+o*o),c,l,u,h,f,d,m,A,g,y,E,_,B,b,S,w,C,T,p,M,F,R,v,D;return a<1e-6?null:(a=1/a,s*=a,i*=a,o*=a,l=Math.sin(n),c=Math.cos(n),u=1-c,h=t[0],f=t[1],d=t[2],m=t[3],A=t[4],g=t[5],y=t[6],E=t[7],_=t[8],B=t[9],b=t[10],S=t[11],w=s*s*u+c,C=i*s*u+o*l,T=o*s*u-i*l,p=s*i*u-o*l,M=i*i*u+c,F=o*i*u+s*l,R=s*o*u+i*l,v=i*o*u-s*l,D=o*o*u+c,e[0]=h*w+A*C+_*T,e[1]=f*w+g*C+B*T,e[2]=d*w+y*C+b*T,e[3]=m*w+E*C+S*T,e[4]=h*p+A*M+_*F,e[5]=f*p+g*M+B*F,e[6]=d*p+y*M+b*F,e[7]=m*p+E*M+S*F,e[8]=h*R+A*v+_*D,e[9]=f*R+g*v+B*D,e[10]=d*R+y*v+b*D,e[11]=m*R+E*v+S*D,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function sa(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],a=t[6],c=t[7],l=t[8],u=t[9],h=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=i*s+l*r,e[5]=o*s+u*r,e[6]=a*s+h*r,e[7]=c*s+f*r,e[8]=l*s-i*r,e[9]=u*s-o*r,e[10]=h*s-a*r,e[11]=f*s-c*r,e}function ia(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],a=t[2],c=t[3],l=t[8],u=t[9],h=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s-l*r,e[1]=o*s-u*r,e[2]=a*s-h*r,e[3]=c*s-f*r,e[8]=i*r+l*s,e[9]=o*r+u*s,e[10]=a*r+h*s,e[11]=c*r+f*s,e}function oa(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],a=t[2],c=t[3],l=t[4],u=t[5],h=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s+l*r,e[1]=o*s+u*r,e[2]=a*s+h*r,e[3]=c*s+f*r,e[4]=l*s-i*r,e[5]=u*s-o*r,e[6]=h*s-a*r,e[7]=f*s-c*r,e}function I1(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 w1(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 v1(e,t,n){let r=n[0],s=n[1],i=n[2],o=Math.sqrt(r*r+s*s+i*i),a,c,l;return o<1e-6?null:(o=1/o,r*=o,s*=o,i*=o,c=Math.sin(t),a=Math.cos(t),l=1-a,e[0]=r*r*l+a,e[1]=s*r*l+i*c,e[2]=i*r*l-s*c,e[3]=0,e[4]=r*s*l-i*c,e[5]=s*s*l+a,e[6]=i*s*l+r*c,e[7]=0,e[8]=r*i*l+s*c,e[9]=s*i*l-r*c,e[10]=i*i*l+a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function F1(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 R1(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 L1(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 th(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=r+r,c=s+s,l=i+i,u=r*a,h=r*c,f=r*l,d=s*c,m=s*l,A=i*l,g=o*a,y=o*c,E=o*l;return e[0]=1-(d+A),e[1]=h+E,e[2]=f-y,e[3]=0,e[4]=h-E,e[5]=1-(u+A),e[6]=m+g,e[7]=0,e[8]=f+y,e[9]=m-g,e[10]=1-(u+d),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function P1(e,t){let n=new $(3),r=-t[0],s=-t[1],i=-t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=r*r+s*s+i*i+o*o;return h>0?(n[0]=(a*o+u*r+c*i-l*s)*2/h,n[1]=(c*o+u*s+l*r-a*i)*2/h,n[2]=(l*o+u*i+a*s-c*r)*2/h):(n[0]=(a*o+u*r+c*i-l*s)*2,n[1]=(c*o+u*s+l*r-a*i)*2,n[2]=(l*o+u*i+a*s-c*r)*2),th(e,t,n),e}function O1(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function eh(e,t){let n=t[0],r=t[1],s=t[2],i=t[4],o=t[5],a=t[6],c=t[8],l=t[9],u=t[10];return e[0]=Math.sqrt(n*n+r*r+s*s),e[1]=Math.sqrt(i*i+o*o+a*a),e[2]=Math.sqrt(c*c+l*l+u*u),e}function N1(e,t){let n=new $(3);eh(n,t);let r=1/n[0],s=1/n[1],i=1/n[2],o=t[0]*r,a=t[1]*s,c=t[2]*i,l=t[4]*r,u=t[5]*s,h=t[6]*i,f=t[8]*r,d=t[9]*s,m=t[10]*i,A=o+u+m,g=0;return A>0?(g=Math.sqrt(A+1)*2,e[3]=.25*g,e[0]=(h-d)/g,e[1]=(f-c)/g,e[2]=(a-l)/g):o>u&&o>m?(g=Math.sqrt(1+o-u-m)*2,e[3]=(h-d)/g,e[0]=.25*g,e[1]=(a+l)/g,e[2]=(f+c)/g):u>m?(g=Math.sqrt(1+u-o-m)*2,e[3]=(f-c)/g,e[0]=(a+l)/g,e[1]=.25*g,e[2]=(h+d)/g):(g=Math.sqrt(1+m-o-u)*2,e[3]=(a-l)/g,e[0]=(f+c)/g,e[1]=(h+d)/g,e[2]=.25*g),e}function D1(e,t,n,r){t[0]=r[12],t[1]=r[13],t[2]=r[14];let s=r[0],i=r[1],o=r[2],a=r[4],c=r[5],l=r[6],u=r[8],h=r[9],f=r[10];n[0]=Math.sqrt(s*s+i*i+o*o),n[1]=Math.sqrt(a*a+c*c+l*l),n[2]=Math.sqrt(u*u+h*h+f*f);let d=1/n[0],m=1/n[1],A=1/n[2],g=s*d,y=i*m,E=o*A,_=a*d,B=c*m,b=l*A,S=u*d,w=h*m,C=f*A,T=g+B+C,p=0;return T>0?(p=Math.sqrt(T+1)*2,e[3]=.25*p,e[0]=(b-w)/p,e[1]=(S-E)/p,e[2]=(y-_)/p):g>B&&g>C?(p=Math.sqrt(1+g-B-C)*2,e[3]=(b-w)/p,e[0]=.25*p,e[1]=(y+_)/p,e[2]=(S+E)/p):B>C?(p=Math.sqrt(1+B-g-C)*2,e[3]=(S-E)/p,e[0]=(y+_)/p,e[1]=.25*p,e[2]=(b+w)/p):(p=Math.sqrt(1+C-g-B)*2,e[3]=(y-_)/p,e[0]=(S+E)/p,e[1]=(b+w)/p,e[2]=.25*p),e}function U1(e,t,n,r){let s=t[0],i=t[1],o=t[2],a=t[3],c=s+s,l=i+i,u=o+o,h=s*c,f=s*l,d=s*u,m=i*l,A=i*u,g=o*u,y=a*c,E=a*l,_=a*u,B=r[0],b=r[1],S=r[2];return e[0]=(1-(m+g))*B,e[1]=(f+_)*B,e[2]=(d-E)*B,e[3]=0,e[4]=(f-_)*b,e[5]=(1-(h+g))*b,e[6]=(A+y)*b,e[7]=0,e[8]=(d+E)*S,e[9]=(A-y)*S,e[10]=(1-(h+m))*S,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function G1(e,t,n,r,s){let i=t[0],o=t[1],a=t[2],c=t[3],l=i+i,u=o+o,h=a+a,f=i*l,d=i*u,m=i*h,A=o*u,g=o*h,y=a*h,E=c*l,_=c*u,B=c*h,b=r[0],S=r[1],w=r[2],C=s[0],T=s[1],p=s[2],M=(1-(A+y))*b,F=(d+B)*b,R=(m-_)*b,v=(d-B)*S,D=(1-(f+y))*S,W=(g+E)*S,z=(m+_)*w,Z=(g-E)*w,X=(1-(f+A))*w;return e[0]=M,e[1]=F,e[2]=R,e[3]=0,e[4]=v,e[5]=D,e[6]=W,e[7]=0,e[8]=z,e[9]=Z,e[10]=X,e[11]=0,e[12]=n[0]+C-(M*C+v*T+z*p),e[13]=n[1]+T-(F*C+D*T+Z*p),e[14]=n[2]+p-(R*C+W*T+X*p),e[15]=1,e}function aa(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,a=r+r,c=s+s,l=n*o,u=r*o,h=r*a,f=s*o,d=s*a,m=s*c,A=i*o,g=i*a,y=i*c;return e[0]=1-h-m,e[1]=u+y,e[2]=f-g,e[3]=0,e[4]=u-y,e[5]=1-l-m,e[6]=d+A,e[7]=0,e[8]=f+g,e[9]=d-A,e[10]=1-l-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ca(e,t,n,r,s,i,o){let a=1/(n-t),c=1/(s-r),l=1/(i-o);return e[0]=i*2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*c,e[6]=0,e[7]=0,e[8]=(n+t)*a,e[9]=(s+r)*c,e[10]=(o+i)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*l,e[15]=0,e}function nh(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 la=nh;function V1(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 H1(e,t,n,r){let s=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),a=Math.tan(t.rightDegrees*Math.PI/180),c=2/(o+a),l=2/(s+i);return e[0]=c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=l,e[6]=0,e[7]=0,e[8]=-((o-a)*c*.5),e[9]=(s-i)*l*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function rh(e,t,n,r,s,i,o){let a=1/(t-n),c=1/(r-s),l=1/(i-o);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+n)*a,e[13]=(s+r)*c,e[14]=(o+i)*l,e[15]=1,e}var ua=rh;function z1(e,t,n,r,s,i,o){let a=1/(t-n),c=1/(r-s),l=1/(i-o);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=l,e[11]=0,e[12]=(t+n)*a,e[13]=(s+r)*c,e[14]=i*l,e[15]=1,e}function ha(e,t,n,r){let s,i,o,a,c,l,u,h,f,d,m=t[0],A=t[1],g=t[2],y=r[0],E=r[1],_=r[2],B=n[0],b=n[1],S=n[2];return Math.abs(m-B)<1e-6&&Math.abs(A-b)<1e-6&&Math.abs(g-S)<1e-6?$u(e):(h=m-B,f=A-b,d=g-S,s=1/Math.sqrt(h*h+f*f+d*d),h*=s,f*=s,d*=s,i=E*d-_*f,o=_*h-y*d,a=y*f-E*h,s=Math.sqrt(i*i+o*o+a*a),s?(s=1/s,i*=s,o*=s,a*=s):(i=0,o=0,a=0),c=f*a-d*o,l=d*i-h*a,u=h*o-f*i,s=Math.sqrt(c*c+l*l+u*u),s?(s=1/s,c*=s,l*=s,u*=s):(c=0,l=0,u=0),e[0]=i,e[1]=c,e[2]=h,e[3]=0,e[4]=o,e[5]=l,e[6]=f,e[7]=0,e[8]=a,e[9]=u,e[10]=d,e[11]=0,e[12]=-(i*m+o*A+a*g),e[13]=-(c*m+l*A+u*g),e[14]=-(h*m+f*A+d*g),e[15]=1,e)}function k1(e,t,n,r){let s=t[0],i=t[1],o=t[2],a=r[0],c=r[1],l=r[2],u=s-n[0],h=i-n[1],f=o-n[2],d=u*u+h*h+f*f;d>0&&(d=1/Math.sqrt(d),u*=d,h*=d,f*=d);let m=c*f-l*h,A=l*u-a*f,g=a*h-c*u;return d=m*m+A*A+g*g,d>0&&(d=1/Math.sqrt(d),m*=d,A*=d,g*=d),e[0]=m,e[1]=A,e[2]=g,e[3]=0,e[4]=h*g-f*A,e[5]=f*m-u*g,e[6]=u*A-h*m,e[7]=0,e[8]=u,e[9]=h,e[10]=f,e[11]=0,e[12]=s,e[13]=i,e[14]=o,e[15]=1,e}function J1(e){return"mat4(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(e[3],", ").concat(e[4],", ").concat(e[5],", ").concat(e[6],", ").concat(e[7],", ").concat(e[8],", ").concat(e[9],", ").concat(e[10],", ").concat(e[11],", ").concat(e[12],", ").concat(e[13],", ").concat(e[14],", ").concat(e[15],")")}function q1(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 j1(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 sh(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 X1(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 W1(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 Y1(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 K1(e,t){let n=e[0],r=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],f=e[10],d=e[11],m=e[12],A=e[13],g=e[14],y=e[15],E=t[0],_=t[1],B=t[2],b=t[3],S=t[4],w=t[5],C=t[6],T=t[7],p=t[8],M=t[9],F=t[10],R=t[11],v=t[12],D=t[13],W=t[14],z=t[15];return Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(r-_)<=1e-6*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(s-B)<=1e-6*Math.max(1,Math.abs(s),Math.abs(B))&&Math.abs(i-b)<=1e-6*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(o-S)<=1e-6*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(a-w)<=1e-6*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(c-C)<=1e-6*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(l-T)<=1e-6*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(u-p)<=1e-6*Math.max(1,Math.abs(u),Math.abs(p))&&Math.abs(h-M)<=1e-6*Math.max(1,Math.abs(h),Math.abs(M))&&Math.abs(f-F)<=1e-6*Math.max(1,Math.abs(f),Math.abs(F))&&Math.abs(d-R)<=1e-6*Math.max(1,Math.abs(d),Math.abs(R))&&Math.abs(m-v)<=1e-6*Math.max(1,Math.abs(m),Math.abs(v))&&Math.abs(A-D)<=1e-6*Math.max(1,Math.abs(A),Math.abs(D))&&Math.abs(g-W)<=1e-6*Math.max(1,Math.abs(g),Math.abs(W))&&Math.abs(y-z)<=1e-6*Math.max(1,Math.abs(y),Math.abs(z))}var Q1=lr,Z1=sh;function $1(){let e=new $(4);return $!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function ih(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 oh(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 ah(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 ch(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function lh(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 uh(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function hh(e,t,n,r){let s=t[0],i=t[1],o=t[2],a=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=a+r*(n[3]-a),e}function fh(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 dh(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],a=n[1],c=n[2],l=n[3],u=l*r+a*i-c*s,h=l*s+c*r-o*i,f=l*i+o*s-a*r,d=-o*r-a*s-c*i;return e[0]=u*l+d*-o+h*-c-f*-a,e[1]=h*l+d*-a+f*-o-u*-c,e[2]=f*l+d*-c+u*-a-h*-o,e[3]=t[3],e}var q2=function(){let e=$1();return function(t,n,r,s,i,o){let a,c;for(n||(n=4),r||(r=0),s?c=Math.min(s*n+r,t.length):c=t.length,a=r;a<c;a+=n)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],e[3]=t[a+3],i(e,e,o),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2],t[a+3]=e[3];return t}}();var 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 ex=45*Math.PI/180,nx=1,fa=.1,da=500,rx=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),P=class extends Tn{static get IDENTITY(){return ix()}static get ZERO(){return sx()}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,n,r,s,i,o,a,c,l,u,h,f,d,m,A,g){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=l,this[9]=u,this[10]=h,this[11]=f,this[12]=d,this[13]=m,this[14]=A,this[15]=g,this.check()}setRowMajor(t,n,r,s,i,o,a,c,l,u,h,f,d,m,A,g){return this[0]=t,this[1]=i,this[2]=l,this[3]=d,this[4]=n,this[5]=o,this[6]=u,this[7]=m,this[8]=r,this[9]=a,this[10]=h,this[11]=A,this[12]=s,this[13]=c,this[14]=f,this[15]=g,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(rx)}fromObject(t){return this.check()}fromQuaternion(t){return aa(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=fa,far:a=da}=t;return a===1/0?ox(this,n,r,s,i,o):ca(this,n,r,s,i,o,a),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return ha(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=fa,far:a=da}=t;return ua(this,n,r,s,i,o,a),this.check()}orthographic(t){let{fovy:n=ex,aspect:r=nx,focalDistance:s=1,near:i=fa,far:o=da}=t;mh(n);let a=n/2,c=s*Math.tan(a),l=c*r;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return mh(n),la(this,n,r,s,i),this.check()}determinant(){return ta(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 Zo(this,this),this.check()}invert(){return $o(this,this),this.check()}multiplyLeft(t){return lr(this,t,this),this.check()}multiplyRight(t){return lr(this,this,t),this.check()}rotateX(t){return sa(this,this,t),this.check()}rotateY(t){return ia(this,this,t),this.check()}rotateZ(t){return oa(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return ra(this,this,t,n),this.check()}scale(t){return na(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return ea(this,this,t),this.check()}transform(t,n){return t.length===4?(n=fh(n||[-0,-0,-0,-0],t,this),Be(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=ms(n||[-0,-0],t,this);break;case 3:s=ze(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Be(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=ps(n||[-0,-0],t,this);break;case 3:r=gs(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Be(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])}},bs,Ss;function sx(){return bs||(bs=new P([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(bs)),bs}function ix(){return Ss||(Ss=new P,Object.freeze(Ss)),Ss}function mh(e){if(e>Math.PI*2)throw Error("expected radians")}function ox(e,t,n,r,s,i){let o=2*i/(n-t),a=2*i/(s-r),c=(n+t)/(n-t),l=(s+r)/(s-r),u=-1,h=-1,f=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=h,e[12]=0,e[13]=0,e[14]=f,e[15]=0,e}function ph(){let e=new $(4);return $!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function gh(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function pa(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 ga(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=n[0],c=n[1],l=n[2],u=n[3];return e[0]=r*u+o*a+s*l-i*c,e[1]=s*u+o*c+i*a-r*l,e[2]=i*u+o*l+r*c-s*a,e[3]=o*u-r*a-s*c-i*l,e}function Ah(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(n),c=Math.cos(n);return e[0]=r*c+o*a,e[1]=s*c+i*a,e[2]=i*c-s*a,e[3]=o*c-r*a,e}function xh(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(n),c=Math.cos(n);return e[0]=r*c-i*a,e[1]=s*c+o*a,e[2]=i*c+r*a,e[3]=o*c-s*a,e}function yh(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(n),c=Math.cos(n);return e[0]=r*c+s*a,e[1]=s*c-r*a,e[2]=i*c+o*a,e[3]=o*c-i*a,e}function Th(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 ur(e,t,n,r){let s=t[0],i=t[1],o=t[2],a=t[3],c=n[0],l=n[1],u=n[2],h=n[3],f,d,m,A,g;return f=s*c+i*l+o*u+a*h,f<0&&(f=-f,c=-c,l=-l,u=-u,h=-h),1-f>1e-6?(d=Math.acos(f),g=Math.sin(d),m=Math.sin((1-r)*d)/g,A=Math.sin(r*d)/g):(m=1-r,A=r),e[0]=m*s+A*c,e[1]=m*i+A*l,e[2]=m*o+A*u,e[3]=m*a+A*h,e}function _h(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,a=o?1/o:0;return e[0]=-n*a,e[1]=-r*a,e[2]=-s*a,e[3]=i*a,e}function Eh(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Aa(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 Bh=ih;var Ch=oh,bh=uh,Sh=hh,Mh=ah;var Ih=ch;var wh=lh;var vh=function(){let e=xs(),t=ys(1,0,0),n=ys(0,1,0);return function(r,s,i){let o=or(s,i);return o<-.999999?(He(e,t,s),Xo(e)<1e-6&&He(e,n,s),zo(e,e),pa(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(He(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,wh(r,r))}}(),iw=function(){let e=ph(),t=ph();return function(n,r,s,i,o,a){return ur(e,r,o,a),ur(t,s,i,a),ur(n,e,t,2*a*(1-a)),n}}(),ow=function(){let e=ju();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],wh(t,Aa(t,e))}}();var ax=[0,0,0,1],Zt=class extends Ee{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 Aa(this,t),this.check()}fromAxisRotation(t,n){return pa(this,t,n),this.check()}identity(){return gh(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]=G(t)}get y(){return this[1]}set y(t){this[1]=G(t)}get z(){return this[2]}set z(t){this[2]=G(t)}get w(){return this[3]}set w(t){this[3]=G(t)}len(){return Mh(this)}lengthSquared(){return Ih(this)}dot(t){return bh(this,t)}rotationTo(t,n){return vh(this,t,n),this.check()}add(t){return Bh(this,this,t),this.check()}calculateW(){return Th(this,this),this.check()}conjugate(){return Eh(this,this),this.check()}invert(){return _h(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(Sh(this,t,n,r),this.check())}multiplyRight(t){return ga(this,this,t),this.check()}multiplyLeft(t){return ga(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 Ah(this,this,t),this.check()}rotateY(t){return xh(this,this,t),this.check()}rotateZ(t){return yh(this,this,t),this.check()}scale(t){return Ch(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=ax,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return ur(this,s,i,o),this.check()}transformVector4(t,n=new yn){return dh(n,t,this),Be(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 Gt={};ut(Gt,{EPSILON1:()=>cx,EPSILON10:()=>Ax,EPSILON11:()=>xx,EPSILON12:()=>yx,EPSILON13:()=>Tx,EPSILON14:()=>_x,EPSILON15:()=>Ex,EPSILON16:()=>Bx,EPSILON17:()=>Cx,EPSILON18:()=>bx,EPSILON19:()=>Sx,EPSILON2:()=>lx,EPSILON20:()=>Mx,EPSILON3:()=>ux,EPSILON4:()=>hx,EPSILON5:()=>fx,EPSILON6:()=>dx,EPSILON7:()=>mx,EPSILON8:()=>px,EPSILON9:()=>gx,PI_OVER_FOUR:()=>wx,PI_OVER_SIX:()=>vx,PI_OVER_TWO:()=>Ix,TWO_PI:()=>Fx});var cx=.1,lx=.01,ux=.001,hx=1e-4,fx=1e-5,dx=1e-6,mx=1e-7,px=1e-8,gx=1e-9,Ax=1e-10,xx=1e-11,yx=1e-12,Tx=1e-13,_x=1e-14,Ex=1e-15,Bx=1e-16,Cx=1e-17,bx=1e-18,Sx=1e-19,Mx=1e-20,Ix=Math.PI/2,wx=Math.PI/4,vx=Math.PI/6,Fx=Math.PI*2;function Ms(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var Vt=Math.PI,Ph=Vt/4,Fh=Vt/180,Rh=180/Vt,Is=512;function oe(e){let[t,n]=e;Ms(Number.isFinite(t)),Ms(Number.isFinite(n)&&n>=-90&&n<=90,"invalid latitude");let r=t*Fh,s=n*Fh,i=Is*(r+Vt)/(2*Vt),o=Is*(Vt+Math.log(Math.tan(Ph+s*.5)))/(2*Vt);return[i,o]}function ae(e){let[t,n]=e,r=t/Is*(2*Vt)-Vt,s=2*(Math.atan(Math.exp(n/Is*(2*Vt)-Vt))-Ph);return[r*Rh,s*Rh]}var kw=Math.PI/180;var Nh=6378137*Math.PI;function xa(e){let t=oe(e);return t[0]=(t[0]/256-1)*Nh,t[1]=(t[1]/256-1)*Nh,t}var Xx={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)}},vs=class extends ke.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,ke._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 Dh.BitmapLayer({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:r.srs==="EPSG:4326"?ke.COORDINATE_SYSTEM.LNGLAT:ke.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 vt)return t.data;if(typeof t.data=="string")return Do({url:t.data,loadOptions:t.loadOptions,type:t.serviceType});throw new Error("invalid image source in props.data")}async _loadMetadata(){let{imageSource:t}=this.state;try{this.state.loadCounter++;let n=await t.getMetadata();this.state.imageSource===t&&this.getCurrentLayer()?.props.onMetadataLoad(n)}catch(n){this.getCurrentLayer()?.props.onMetadataLoadError(n)}finally{this.state.loadCounter--}}async loadImage(t,n){let{layers:r,serviceType:s}=this.props;if(s==="wms"&&r.length===0)return;let i=t.getBounds(),{width:o,height:a}=t,c=this.getRequestId(),{srs:l}=this.props;l==="auto"&&(l=t.resolution?"EPSG:4326":"EPSG:3857");let u={width:o,height:a,boundingBox:[[i[0],i[1]],[i[2],i[3]]],layers:r,crs:l};if(l==="EPSG:3857"){let h=xa([i[0],i[1]]),f=xa([i[2],i[3]]);u.boundingBox=[h,f]}try{this.state.loadCounter++,this.props.onImageLoadStart(c);let h=await this.state.imageSource.getImage(u);this.state.lastRequestId<c&&(this.getCurrentLayer()?.props.onImageLoad(c),this.setState({image:h,bounds:i,lastRequestParameters:u,lastRequestId:c}))}catch(h){this.raiseError(h,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(c,h)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(t,n=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>t(),n)}},ws=vs;(()=>{vs.layerName="WMSLayer"})(),(()=>{vs.defaultProps=Xx})();var Uh=N(Dt(),1),Wx={getHeight:{type:"accessor",value:0},greatCircle:!0},Fs=class extends Uh.ArcLayer{},hr=Fs;(()=>{Fs.layerName="GreatCircleLayer"})(),(()=>{Fs.defaultProps=Wx})();var Gh=N(Ut(),1),ya=N(Dt(),1),Yx={...ya.PolygonLayer.defaultProps},Rs=class extends Gh.CompositeLayer{indexToBounds(){return null}renderLayers(){let{elevationScale:t,extruded:n,wireframe:r,filled:s,stroked:i,lineWidthUnits:o,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:u,lineMiterLimit:h,lineDashJustified:f,getElevation:d,getFillColor:m,getLineColor:A,getLineWidth:g}=this.props,{updateTriggers:y,material:E,transitions:_}=this.props,B=this.getSubLayerClass("cell",ya.PolygonLayer),{updateTriggers:b,...S}=this.indexToBounds()||{};return new B({filled:s,wireframe:r,extruded:n,elevationScale:t,stroked:i,lineWidthUnits:o,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:u,lineMiterLimit:h,lineDashJustified:f,material:E,transitions:_,getElevation:d,getFillColor:m,getLineColor:A,getLineWidth:g},this.getSubLayerProps({id:"cell",updateTriggers:y&&{...b,getElevation:y.getElevation,getFillColor:y.getFillColor,getLineColor:y.getLineColor,getLineWidth:y.getLineWidth}}),S)}},It=Rs;(()=>{Rs.layerName="GeoCellLayer"})(),(()=>{Rs.defaultProps=Yx})();var Ls=N(Ta(),1),Kx=3,Qx=30,Zx=2*Qx+1,Hh=180/Math.PI;function kh(e,t,n){let r=1<<t;return[(e[0]+n[0])/r,(e[1]+n[1])/r]}function zh(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Jh(e){return[zh(e[0]),zh(e[1])]}function qh(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 jh([e,t,n]){let r=Math.atan2(n,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*Hh,r*Hh]}function Xh(e){let t=Ls.default.fromString(e,!0,10).toString(2);for(;t.length<Kx+Zx;)t="0"+t;let n=t.lastIndexOf("1"),r=t.substring(0,3),s=t.substring(3,n),i=s.length/2,o=Ls.default.fromString(r,!0,2).toString(10),a=Ls.default.fromString(s,!0,2).toString(4);for(;a.length<i;)a="0"+a;return`${o}/${a}`}function $x(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 Wh(e){let t=e.split("/"),n=parseInt(t[0],10),r=t[1],s=r.length,i=[0,0],o;for(let a=s-1;a>=0;a--){o=s-a;let c=r[a],l=0,u=0;c==="1"?u=1:c==="2"?(l=1,u=1):c==="3"&&(l=1);let h=Math.pow(2,o-1);$x(h,i,l,u),i[0]+=h*l,i[1]+=h*u}if(n%2===1){let a=i[0];i[0]=i[1],i[1]=a}return{face:n,ij:i,level:o}}var Yh=N(Ta(),1);function ty(e){let t=e.padEnd(16,"0");return Yh.default.fromString(t,16)}var ey=100;function ny({face:e,ij:t,level:n}){let r=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(ey*Math.pow(2,-n))),i=new Float64Array(4*s*2+2),o=0,a=0;for(let c=0;c<4;c++){let l=r[c].slice(0),u=r[c+1],h=(u[0]-l[0])/s,f=(u[1]-l[1])/s;for(let d=0;d<s;d++){l[0]+=h,l[1]+=f;let m=kh(t,n,l),A=Jh(m),g=qh(e,A),y=jh(g);Math.abs(y[1])>89.999&&(y[0]=a);let E=y[0]-a;y[0]+=E>180?-360:E<-180?360:0,i[o++]=y[0],i[o++]=y[1],a=y[0]}}return i[o++]=i[0],i[o++]=i[1],i}function ry(e){if(typeof e=="string"){if(e.indexOf("/")>0)return e;e=ty(e)}return Xh(e.toString())}function Kh(e){let t=ry(e),n=Wh(t);return ny(n)}var sy={getS2Token:{type:"accessor",value:e=>e.token}},Ps=class extends It{indexToBounds(){let{data:t,getS2Token:n}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(r,s)=>Kh(n(r,s))}}},dr=Ps;(()=>{Ps.layerName="S2Layer"})(),(()=>{Ps.defaultProps=sy})();var _a=512;function iy(e,t){let n=0,r=0,s=1<<e.length,i=s/_a;for(let o=0;o<e.length;o++){s>>=1;let a=parseInt(e[o]);a%2&&(n|=s),a>1&&(r|=s)}return[[n/i,_a-r/i],[(n+t)/i,_a-(r+t)/i]]}function Qh(e,t=1){let[n,r]=iy(e,t),[s,i]=ae(n),[o,a]=ae(r);return[o,i,o,a,s,a,s,i,o,i]}var oy={getQuadkey:{type:"accessor",value:e=>e.quadkey}},Os=class extends It{indexToBounds(){let{data:t,extruded:n,getQuadkey:r}=this.props,s=n?.99:1;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(i,o)=>Qh(r(i,o),s),updateTriggers:{getPolygon:s}}}},mr=Os;(()=>{Os.layerName="QuadkeyLayer"})(),(()=>{Os.defaultProps=oy})();var ks=N(Ut(),1),gf=N(Dt(),1);var Je=class{constructor(t){this.index=t,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(t){this._bbox||(this._bbox=t,"west"in t?this.boundingBox=[[t.west,t.south],[t.east,t.north]]:this.boundingBox=[[t.left,t.top],[t.right,t.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error("byteLength not defined in tile data"),t}async _loadData({getData:t,requestScheduler:n,onLoad:r,onError:s}){let{index:i,id:o,bbox:a,userData:c,zoom:l}=this,u=this._loaderId;this._abortController=new AbortController;let{signal:h}=this._abortController,f=await n.scheduleRequest(this,A=>A.isSelected?1:-1);if(!f){this._isCancelled=!0;return}if(this._isCancelled){f.done();return}let d=null,m;try{d=await t({index:i,id:o,bbox:a,userData:c,zoom:l,signal:h})}catch(A){m=A||!0}finally{f.done()}if(u===this._loaderId){if(this._loader=void 0,this.content=d,this._isCancelled&&!d){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,m?s(m,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 Ar=N(Ut(),1);var rt={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var Zh=new x,ay=new x,be=class{constructor(t=[0,0,0],n=[0,0,0],r){L(this,"center",void 0),L(this,"halfDiagonal",void 0),L(this,"minimum",void 0),L(this,"maximum",void 0),r=r||Zh.copy(t).add(n).scale(.5),this.center=new x(r),this.halfDiagonal=new x(n).subtract(this.center),this.minimum=new x(t),this.maximum=new x(n)}clone(){return new be(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=ay.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?rt.INSIDE:i+s<0?rt.OUTSIDE:rt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=Zh.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 pr=new x,$h=new x,Ft=class{constructor(t=[0,0,0],n=0){L(this,"center",void 0),L(this,"radius",void 0),this.radius=-0,this.center=new x,this.fromCenterRadius(t,n)}fromCenterRadius(t,n){return this.center.from(t),this.radius=n,this}fromCornerPoints(t,n){return n=pr.from(n),this.center=new x().from(t).add(n).scale(.5),this.radius=this.center.distance(n),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new Ft(this.center,this.radius)}union(t){let n=this.center,r=this.radius,s=t.center,i=t.radius,o=pr.copy(s).subtract(n),a=o.magnitude();if(r>=a+i)return this.clone();if(i>=a+r)return t.clone();let c=(r+a+i)*.5;return $h.copy(o).scale((-r+c)/a).add(n),this.center.copy($h),this.radius=c,this}expand(t){let r=pr.from(t).subtract(this.center).magnitude();return r>this.radius&&(this.radius=r),this}transform(t){this.center.transform(t);let n=Cs.getScaling(pr,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=pr.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?rt.OUTSIDE:i<r?rt.INTERSECTING:rt.INSIDE}};var cy=new x,ly=new x,Ns=new x,Ds=new x,Us=new x,uy=new x,hy=new x,ce={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Ht=class{constructor(t=[0,0,0],n=[0,0,0,0,0,0,0,0,0]){L(this,"center",void 0),L(this,"halfAxes",void 0),this.center=new x().from(t),this.halfAxes=new k(n)}get halfSize(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new x(t).len(),new x(n).len(),new x(r).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),s=new x(t).normalize(),i=new x(n).normalize(),o=new x(r).normalize();return new Zt().fromMatrix3(new k([...s,...i,...o]))}fromCenterHalfSizeQuaternion(t,n,r){let s=new Zt(r),i=new k().fromQuaternion(s);return i[0]=i[0]*n[0],i[1]=i[1]*n[0],i[2]=i[2]*n[0],i[3]=i[3]*n[1],i[4]=i[4]*n[1],i[5]=i[5]*n[1],i[6]=i[6]*n[2],i[7]=i[7]*n[2],i[8]=i[8]*n[2],this.center=new x().from(t),this.halfAxes=i,this}clone(){return new Ht(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new Ft){let n=this.halfAxes,r=n.getColumn(0,Ns),s=n.getColumn(1,Ds),i=n.getColumn(2,Us),o=cy.copy(r).add(s).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let n=this.center,r=t.normal,s=this.halfAxes,i=r.x,o=r.y,a=r.z,c=Math.abs(i*s[ce.COLUMN0ROW0]+o*s[ce.COLUMN0ROW1]+a*s[ce.COLUMN0ROW2])+Math.abs(i*s[ce.COLUMN1ROW0]+o*s[ce.COLUMN1ROW1]+a*s[ce.COLUMN1ROW2])+Math.abs(i*s[ce.COLUMN2ROW0]+o*s[ce.COLUMN2ROW1]+a*s[ce.COLUMN2ROW2]),l=r.dot(n)+t.distance;return l<=-c?rt.OUTSIDE:l>=c?rt.INSIDE:rt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=ly.from(t).subtract(this.center),r=this.halfAxes,s=r.getColumn(0,Ns),i=r.getColumn(1,Ds),o=r.getColumn(2,Us),a=s.magnitude(),c=i.magnitude(),l=o.magnitude();s.normalize(),i.normalize(),o.normalize();let u=0,h;return h=Math.abs(n.dot(s))-a,h>0&&(u+=h*h),h=Math.abs(n.dot(i))-c,h>0&&(u+=h*h),h=Math.abs(n.dot(o))-l,h>0&&(u+=h*h),u}computePlaneDistances(t,n,r=[-0,-0]){let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=this.center,a=this.halfAxes,c=a.getColumn(0,Ns),l=a.getColumn(1,Ds),u=a.getColumn(2,Us),h=uy.copy(c).add(l).add(u).add(o),f=hy.copy(h).subtract(t),d=n.dot(f);return s=Math.min(d,s),i=Math.max(d,i),h.copy(o).add(c).add(l).subtract(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),h.copy(o).add(c).subtract(l).add(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),h.copy(o).add(c).subtract(l).subtract(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),o.copy(h).subtract(c).add(l).add(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),o.copy(h).subtract(c).add(l).subtract(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),o.copy(h).subtract(c).subtract(l).add(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),o.copy(h).subtract(c).subtract(l).subtract(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),r[0]=s,r[1]=i,r}transform(t){this.center.transformAsPoint(t);let n=this.halfAxes.getColumn(0,Ns);n.transformAsPoint(t);let r=this.halfAxes.getColumn(1,Ds);r.transformAsPoint(t);let s=this.halfAxes.getColumn(2,Us);return s.transformAsPoint(t),this.halfAxes=new k([...n,...r,...s]),this}getTransform(){throw new Error("not implemented")}};var tf=new x,ef=new x,lt=class{constructor(t=[0,0,1],n=0){L(this,"normal",void 0),L(this,"distance",void 0),this.normal=new x,this.distance=-0,this.fromNormalDistance(t,n)}fromNormalDistance(t,n){return ct(Number.isFinite(n)),this.normal.from(t).normalize(),this.distance=n,this}fromPointNormal(t,n){t=tf.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),ct(gt(this.normal.len(),1)),this.distance=s,this}clone(){return new lt(this.normal,this.distance)}equals(t){return gt(this.distance,t.distance)&>(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let n=ef.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=tf.from(t),s=this.getPointDistance(r),i=ef.copy(this.normal).scale(s);return r.subtract(i).to(n)}};var nf=[new x([1,0,0]),new x([0,1,0]),new x([0,0,1])],rf=new x,fy=new x,ot=class{constructor(t=[]){L(this,"planes",void 0),this.planes=t}fromBoundingSphere(t){this.planes.length=2*nf.length;let n=t.center,r=t.radius,s=0;for(let i of nf){let o=this.planes[s],a=this.planes[s+1];o||(o=this.planes[s]=new lt),a||(a=this.planes[s+1]=new lt);let c=rf.copy(i).scale(-r).add(n);o.fromPointNormal(c,i);let l=rf.copy(i).scale(r).add(n),u=fy.copy(i).negate();a.fromPointNormal(l,u),s+=2}return this}computeVisibility(t){let n=rt.INSIDE;for(let r of this.planes)switch(t.intersectPlane(r)){case rt.OUTSIDE:return rt.OUTSIDE;case rt.INTERSECTING:n=rt.INTERSECTING;break;default:}return n}computeVisibilityWithPlaneMask(t,n){if(ct(Number.isFinite(n),"parentPlaneMask is required."),n===ot.MASK_OUTSIDE||n===ot.MASK_INSIDE)return n;let r=ot.MASK_INSIDE,s=this.planes;for(let i=0;i<this.planes.length;++i){let o=i<31?1<<i:0;if(i<31&&!(n&o))continue;let a=s[i],c=t.intersectPlane(a);if(c===rt.OUTSIDE)return ot.MASK_OUTSIDE;c===rt.INTERSECTING&&(r|=o)}return r}};L(ot,"MASK_OUTSIDE",4294967295);L(ot,"MASK_INSIDE",0);L(ot,"MASK_INDETERMINATE",2147483647);var dF=new x,mF=new x,pF=new x,gF=new x,AF=new x;var CF=new x,bF=new x,SF=new x,MF=new x,IF=new x,wF=new x,vF=new x,FF=new x,RF=new x,LF=new x,PF=new x,OF=new x;var $t=new k,my=new k,py=new k,Gs=new k,sf=new k;function Ca(e,t={}){let n=Gt.EPSILON20,r=10,s=0,i=0,o=my,a=py;o.identity(),a.copy(e);let c=n*gy(a);for(;i<r&&Ay(a)>c;)xy(a,Gs),sf.copy(Gs).transpose(),a.multiplyRight(Gs),a.multiplyLeft(sf),o.multiplyRight(Gs),++s>2&&(++i,s=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=a.toTarget(t.diagonal),t}function gy(e){let t=0;for(let n=0;n<9;++n){let r=e[n];t+=r*r}return Math.sqrt(t)}var Ea=[1,0,0],Ba=[2,2,1];function Ay(e){let t=0;for(let n=0;n<3;++n){let r=e[$t.getElementIndex(Ba[n],Ea[n])];t+=2*r*r}return Math.sqrt(t)}function xy(e,t){let n=Gt.EPSILON15,r=0,s=1;for(let l=0;l<3;++l){let u=Math.abs(e[$t.getElementIndex(Ba[l],Ea[l])]);u>r&&(s=l,r=u)}let i=Ea[s],o=Ba[s],a=1,c=0;if(Math.abs(e[$t.getElementIndex(o,i)])>n){let l=e[$t.getElementIndex(o,o)],u=e[$t.getElementIndex(i,i)],h=e[$t.getElementIndex(o,i)],f=(l-u)/2/h,d;f<0?d=-1/(-f+Math.sqrt(1+f*f)):d=1/(f+Math.sqrt(1+f*f)),a=1/Math.sqrt(1+d*d),c=d*a}return k.IDENTITY.to(t),t[$t.getElementIndex(i,i)]=t[$t.getElementIndex(o,o)]=a,t[$t.getElementIndex(o,i)]=c,t[$t.getElementIndex(i,o)]=-c,t}var Se=new x,yy=new x,Ty=new x,_y=new x,Ey=new x,By=new k,Cy={diagonal:new k,unitary:new k};function gr(e,t=new Ht){if(!e||e.length===0)return t.halfAxes=new k([0,0,0,0,0,0,0,0,0]),t.center=new x,t;let n=e.length,r=new x(0,0,0);for(let T of e)r.add(T);let s=1/n;r.multiplyByScalar(s);let i=0,o=0,a=0,c=0,l=0,u=0;for(let T of e){let p=Se.copy(T).subtract(r);i+=p.x*p.x,o+=p.x*p.y,a+=p.x*p.z,c+=p.y*p.y,l+=p.y*p.z,u+=p.z*p.z}i*=s,o*=s,a*=s,c*=s,l*=s,u*=s;let h=By;h[0]=i,h[1]=o,h[2]=a,h[3]=o,h[4]=c,h[5]=l,h[6]=a,h[7]=l,h[8]=u;let{unitary:f}=Ca(h,Cy),d=t.halfAxes.copy(f),m=d.getColumn(0,Ty),A=d.getColumn(1,_y),g=d.getColumn(2,Ey),y=-Number.MAX_VALUE,E=-Number.MAX_VALUE,_=-Number.MAX_VALUE,B=Number.MAX_VALUE,b=Number.MAX_VALUE,S=Number.MAX_VALUE;for(let T of e)Se.copy(T),y=Math.max(Se.dot(m),y),E=Math.max(Se.dot(A),E),_=Math.max(Se.dot(g),_),B=Math.min(Se.dot(m),B),b=Math.min(Se.dot(A),b),S=Math.min(Se.dot(g),S);m=m.multiplyByScalar(.5*(B+y)),A=A.multiplyByScalar(.5*(b+E)),g=g.multiplyByScalar(.5*(S+_)),t.center.copy(m).add(A).add(g);let w=yy.set(y-B,E-b,_-S).multiplyByScalar(.5),C=new k([w[0],0,0,0,w[1],0,0,0,w[2]]);return t.halfAxes.multiplyRight(C),t}var _n=512,of=3,af=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],cf=af.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),by=cf.concat([[.25,.5],[.75,.5]]),Me=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 Me(t,n,r),new Me(t,n+1,r),new Me(t+1,n,r),new Me(t+1,n+1,r)]}return this._children}update(t){let{viewport:n,cullingVolume:r,elevationBounds:s,minZ:i,maxZ:o,bounds:a,offset:c,project:l}=t,u=this.getBoundingVolume(s,c,l);if(a&&!this.insideBounds(a)||r.computeVisibility(u)<0)return!1;if(!this.childVisible){let{z:f}=this;if(f<o&&f>=i){let d=u.distanceTo(n.cameraPosition)*n.scale/n.height;f+=Math.floor(Math.log2(d))}if(f>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let f of this.children)f.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(let n of this._children)n.getSelected(t);return t}insideBounds([t,n,r,s]){let i=Math.pow(2,this.z),o=_n/i;return this.x*o<r&&this.y*o<s&&(this.x+1)*o>t&&(this.y+1)*o>n}getBoundingVolume(t,n,r){if(r){let c=this.z<1?by:this.z<2?cf:af,l=[];for(let u of c){let h=Vs(this.x+u[0],this.y+u[1],this.z);h[2]=t[0],l.push(r(h)),t[0]!==t[1]&&(h[2]=t[1],l.push(r(h)))}return gr(l)}let s=Math.pow(2,this.z),i=_n/s,o=this.x*i+n*_n,a=_n-(this.y+1)*i;return new be([o,a,t[0]],[o+i,a+i,t[1]])}};function lf(e,t,n,r){let s=e instanceof Ar._GlobeViewport&&e.resolution?e.projectPosition:null,i=Object.values(e.getFrustumPlanes()).map(({normal:d,distance:m})=>new lt(d.clone().negate(),m)),o=new ot(i),a=e.distanceScales.unitsPerMeter[2],c=n&&n[0]*a||0,l=n&&n[1]*a||0,u=e instanceof Ar.WebMercatorViewport&&e.pitch<=60?t:0;if(r){let[d,m,A,g]=r,y=oe([d,g]),E=oe([A,m]);r=[y[0],_n-y[1],E[0],_n-E[1]]}let h=new Me(0,0,0),f={viewport:e,project:s,cullingVolume:o,elevationBounds:[c,l],minZ:u,maxZ:t,bounds:r,offset:0};if(h.update(f),e instanceof Ar.WebMercatorViewport&&e.subViewports&&e.subViewports.length>1){for(f.offset=-1;h.update(f)&&!(--f.offset<-of););for(f.offset=1;h.update(f)&&!(++f.offset>of););}return h.getSelected()}var le=512,Sy=[-1/0,-1/0,1/0,1/0],Ie={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 hf(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 My(e){return Math.abs(e.split("").reduce((t,n)=>(t<<5)-t+n.charCodeAt(0)|0,0))}function te(e,t){if(!e||!e.length)return null;let{index:n,id:r}=t;if(Array.isArray(e)){let i=My(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 Iy(e,t,n){let r;if(t&&t.length===2){let[s,i]=t,o=e.getBounds({z:s}),a=e.getBounds({z:i});r=[Math.min(o[0],a[0]),Math.min(o[1],a[1]),Math.max(o[2],a[2]),Math.max(o[3],a[3])]}else r=e.getBounds();return e.isGeospatial?[Math.max(r[0],n[0]),Math.max(r[1],n[1]),Math.min(r[2],n[2]),Math.min(r[3],n[3])]:[Math.max(Math.min(r[0],n[2]),n[0]),Math.max(Math.min(r[1],n[3]),n[1]),Math.min(Math.max(r[2],n[0]),n[2]),Math.min(Math.max(r[3],n[1]),n[3])]}function ff({viewport:e,z:t,cullRect:n}){return(e.subViewports||[e]).map(s=>ba(s,t||0,n))}function ba(e,t,n){if(!Array.isArray(t)){let i=n.x-e.x,o=n.y-e.y,{width:a,height:c}=n,l={targetZ:t},u=e.unproject([i,o],l),h=e.unproject([i+a,o],l),f=e.unproject([i,o+c],l),d=e.unproject([i+a,o+c],l);return[Math.min(u[0],h[0],f[0],d[0]),Math.min(u[1],h[1],f[1],d[1]),Math.max(u[0],h[0],f[0],d[0]),Math.max(u[1],h[1],f[1],d[1])]}let r=ba(e,t[0],n),s=ba(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 wy(e,t,n){return n?hf(e,n).map(s=>s*t/le):e.map(r=>r*t/le)}function Sa(e,t){return Math.pow(2,e)*le/t}function Vs(e,t,n){let r=Sa(n,le),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 uf(e,t,n,r){let s=Sa(n,r);return[e/s*le,t/s*le]}function Ma(e,t,n,r,s=le){if(e.isGeospatial){let[l,u]=Vs(t,n,r),[h,f]=Vs(t+1,n+1,r);return{west:l,north:u,east:h,south:f}}let[i,o]=uf(t,n,r,s),[a,c]=uf(t+1,n+1,r,s);return{left:i,top:o,right:a,bottom:c}}function vy(e,t,n,r,s){let i=Iy(e,null,r),o=Sa(t,n),[a,c,l,u]=wy(i,o,s),h=[];for(let f=Math.floor(a);f<l;f++)for(let d=Math.floor(c);d<u;d++)h.push({x:f,y:d,z:t});return h}function Ia({viewport:e,maxZoom:t,minZoom:n,zRange:r,extent:s,tileSize:i=le,modelMatrix:o,modelMatrixInverse:a,zoomOffset:c=0}){let l=e.isGeospatial?Math.round(e.zoom+Math.log2(le/i))+c:Math.ceil(e.zoom)+c;if(typeof n=="number"&&Number.isFinite(n)&&l<n){if(!s)return[];l=n}typeof t=="number"&&Number.isFinite(t)&&l>t&&(l=t);let u=s;return o&&a&&s&&!e.isGeospatial&&(u=hf(s,o)),e.isGeospatial?lf(e,l,r,s):vy(e,l,i,u||Sy,a)}function wa(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(e)}function va(e){return Number.isFinite(e.west)&&Number.isFinite(e.north)&&Number.isFinite(e.east)&&Number.isFinite(e.south)}function df(e){let t={},n;return r=>{for(let s in r)if(!Fy(r[s],t[s])){n=e(r),t=r;break}return n}}function Fy(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 mf=1,Hs=2,Ry="never",Ly="no-overlap",xr="best-available",Py=5,Oy={[xr]:Dy,[Ly]:Uy,[Ry]:()=>{}},Ny={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},qe=class{constructor(t){this._getCullBounds=df(ff),this.opts={...Ny,...t},this.onTileLoad=n=>{this.opts.onTileLoad?.(n),this.opts.maxCacheByteSize&&(this._cacheByteSize+=n.byteLength,this._resizeCache())},this._requestScheduler=new xe({maxRequests:t.maxRequests,throttleRequests:Boolean(t.maxRequests&&t.maxRequests>0)}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new P,this._modelMatrixInverse=new P,this.setOptions(t)}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(t=>t.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(t=>t.needsReload)}setOptions(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom))}finalize(){for(let t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let t of this._cache.keys()){let 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 P(r):new P,i=!s.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!gt(this._zRange,n)||i){i&&(this._modelMatrixInverse=s.clone().invert(),this._modelMatrix=s),this._viewport=t,this._zRange=n;let a=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:n,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=a.map(c=>this._getTile(c,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(a=>this._getTile(a.index,!0)));let o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(t,n){if(!t.isVisible)return!1;if(n&&this._viewport){let r=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:n}),{bbox:s}=t;for(let[i,o,a,c]of r){let l;if("west"in s)l=s.west<a&&s.east>i&&s.south<c&&s.north>o;else{let u=Math.min(s.top,s.bottom),h=Math.max(s.top,s.bottom);l=s.left<a&&s.right>i&&u<c&&h>o}if(l)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:n,minZoom:r,zRange:s,modelMatrix:i,modelMatrixInverse:o}){let{tileSize:a,extent:c,zoomOffset:l}=this.opts;return Ia({viewport:t,maxZoom:n,minZoom:r,zRange:s,tileSize:a,extent:c,modelMatrix:i,modelMatrixInverse:o,zoomOffset:l})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){let{tileSize:n}=this.opts;return{bbox:Ma(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||xr,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:Oy[t])(Array.from(this._cache.values())),r=0;for(let s of this._cache.values())if(n[r++]!==s.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:t=0}=this.opts,n=[],r=0;for(let s of this._cache.values())s.isLoading&&(r++,!s.isSelected&&!s.isVisible&&n.push(s));for(;t>0&&r>t&&n.length>0;)n.shift().abort(),r--}_rebuildTree(){let{_cache:t}=this;for(let n of t.values())n.parent=null,n.children&&(n.children.length=0);for(let n of t.values()){let r=this._getNearestAncestor(n);n.parent=r,r?.children&&r.children.push(n)}}_resizeCache(){let{_cache:t,opts:n}=this,r=n.maxCacheSize||(n.maxCacheByteSize?1/0:Py*this.selectedTiles.length),s=n.maxCacheByteSize||1/0;if(t.size>r||this._cacheByteSize>s){for(let[o,a]of t)if(!a.isVisible&&!a.isSelected&&(this._cacheByteSize-=n.maxCacheByteSize?a.byteLength:0,t.delete(o),this.opts.onTileUnload?.(a)),t.size<=r&&this._cacheByteSize<=s)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((o,a)=>o.zoom-a.zoom),this._dirty=!1)}_getTile(t,n){let r=this.getTileId(t),s=this._cache.get(r),i=!1;return!s&&n?(s=new Je(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 Dy(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!pf(t)&&Fa(t);for(let t of e)t.isVisible=Boolean(t.state&Hs)}function Uy(e){for(let n of e)n.state=0;for(let n of e)n.isSelected&&pf(n);let t=Array.from(e).sort((n,r)=>n.zoom-r.zoom);for(let n of t)if(n.isVisible=Boolean(n.state&Hs),n.children&&(n.isVisible||n.state&mf))for(let r of n.children)r.state=mf;else n.isSelected&&Fa(n)}function pf(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=Hs,!0;t=t.parent}return!1}function Fa(e){for(let t of e.children)t.isLoaded||t.content?t.state|=Hs:Fa(t)}var Gy={TilesetClass:qe,data:{type:"data",value:[]},dataComparator:Ie.equal,renderSubLayers:{type:"function",value:e=>new gf.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:xr,zRange:null,maxRequests:6,zoomOffset:0},zs=class extends ks.CompositeLayer{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every(t=>t.isLoaded&&t.layers&&t.layers.every(n=>n.isLoaded)))}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:n}=this.state,r=t.propsOrDataChanged||t.updateTriggersChanged,s=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);n?r&&(n.setOptions(this._getTilesetOptions()),s?n.reloadAll():n.tiles.forEach(i=>{i.layers=null})):(n=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:n})),this._updateTileset()}_getTilesetOptions(){let{tileSize:t,maxCacheSize:n,maxCacheByteSize:r,refinementStrategy:s,extent:i,maxZoom:o,minZoom:a,maxRequests:c,zoomOffset:l}=this.props;return{maxCacheSize:n,maxCacheByteSize:r,maxZoom:o,minZoom:a,tileSize:t,refinementStrategy:s,extent:i,maxRequests:c,zoomOffset:l,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let t=this.state.tileset,{zRange:n,modelMatrix:r}=this.props,s=t.update(this.context.viewport,{zRange:n,modelMatrix:r}),{isLoaded:i}=t,o=this.state.isLoaded!==i,a=this.state.frameNumber!==s;i&&(o||a)&&this._onViewportLoad(),a&&this.setState({frameNumber:s}),this.state.isLoaded=i}_onViewportLoad(){let{tileset:t}=this.state,{onViewportLoad:n}=this.props;n&&n(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,n){this.props.onTileError(t),n.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){let{data:n,getTileData:r,fetch:s}=this.props,{signal:i}=t;return t.url=typeof n=="string"||Array.isArray(n)?te(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({info:t,sourceLayer:n}){let r=n.props.tile;return t.picked&&(t.tile=r),t.sourceTile=r,t}_updateAutoHighlight(t){let n=t.sourceTile;if(n&&n.layers)for(let r of n.layers)r.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map(t=>{let n=this.getSubLayerPropsByTile(t);if(!(!t.isLoaded&&!t.content))if(t.layers)n&&t.layers[0]&&Object.keys(n).some(r=>t.layers[0].props[r]!==n[r])&&(t.layers=t.layers.map(r=>r.clone(n)));else{let r=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=(0,ks._flatten)(r,Boolean).map(s=>s.clone({tile:t,...n}))}return t.layers})}filterSubLayer({layer:t,cullRect:n}){let{tile:r}=t.props;return this.state.tileset.isTileVisible(r,n)}},ee=zs;(()=>{zs.defaultProps=Gy})(),(()=>{zs.layerName="TileLayer"})();var Af=N(Dt(),1),Vy={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:e=>e.timestamps}},Js=class extends Af.PathLayer{getShaders(){let t=super.getShaders();return t.inject={"vs:#decl":`uniform float trailLength;
|
|
13
|
+
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}me.prototype.build=function(e){return this.options.preserveOrder?d0(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 n="",r="";for(let s in e)if(typeof e[s]>"u")this.isAttribute(s)&&(r+="");else if(e[s]===null)this.isAttribute(s)?r+="":s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)r+=this.buildTextValNode(e[s],s,"",t);else if(typeof e[s]!="object"){let i=this.isAttribute(s);if(i)n+=this.buildAttrPairStr(i,""+e[s]);else if(s===this.options.textNodeName){let o=this.options.tagValueProcessor(s,""+e[s]);r+=this.replaceEntitiesValue(o)}else r+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){let i=e[s].length,o="";for(let a=0;a<i;a++){let c=e[s][a];typeof c>"u"||(c===null?s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar:typeof c=="object"?this.options.oneListGroup?o+=this.j2x(c,t+1).val:o+=this.processTextOrObjNode(c,s,t):o+=this.buildTextValNode(c,s,"",t))}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,"",t)),r+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){let i=Object.keys(e[s]),o=i.length;for(let a=0;a<o;a++)n+=this.buildAttrPairStr(i[a],""+e[s][i[a]])}else r+=this.processTextOrObjNode(e[s],s,t);return{attrStr:n,val:r}};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 m0(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)}me.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}};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,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}};me.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 g0(e){return this.options.indentBy.repeat(e)}function A0(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}eu.exports=me});var su=et((TS,ru)=>{"use strict";var x0=co(),y0=Yl(),T0=nu();ru.exports={XMLParser:y0,XMLValidator:x0,XMLBuilder:T0}});var ya=et((Gh,hr)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof Cl=="function"&&typeof hr=="object"&&hr&&hr.exports?hr.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(Gh,function(){"use strict";function e(T,m,M){this.low=T|0,this.high=m|0,this.unsigned=!!M}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function t(T){return(T&&T.__isLong__)===!0}e.isLong=t;var n={},r={};function s(T,m){var M,F,R;return m?(T>>>=0,(R=0<=T&&T<256)&&(F=r[T],F)?F:(M=o(T,(T|0)<0?-1:0,!0),R&&(r[T]=M),M)):(T|=0,(R=-128<=T&&T<128)&&(F=n[T],F)?F:(M=o(T,T<0?-1:0,!1),R&&(n[T]=M),M))}e.fromInt=s;function i(T,m){if(isNaN(T)||!isFinite(T))return m?y:g;if(m){if(T<0)return y;if(T>=d)return S}else{if(T<=-p)return w;if(T+1>=p)return b}return T<0?i(-T,m).neg():o(T%f|0,T/f|0,m)}e.fromNumber=i;function o(T,m,M){return new e(T,m,M)}e.fromBits=o;var a=Math.pow;function c(T,m,M){if(T.length===0)throw Error("empty string");if(T==="NaN"||T==="Infinity"||T==="+Infinity"||T==="-Infinity")return g;if(typeof m=="number"?(M=m,m=!1):m=!!m,M=M||10,M<2||36<M)throw RangeError("radix");var F;if((F=T.indexOf("-"))>0)throw Error("interior hyphen");if(F===0)return c(T.substring(1),m,M).neg();for(var R=i(a(M,8)),v=g,D=0;D<T.length;D+=8){var W=Math.min(8,T.length-D),z=parseInt(T.substring(D,D+W),M);if(W<8){var Z=i(a(M,W));v=v.mul(Z).add(i(z))}else v=v.mul(R),v=v.add(i(z))}return v.unsigned=m,v}e.fromString=c;function l(T){return T instanceof e?T:typeof T=="number"?i(T):typeof T=="string"?c(T):o(T.low,T.high,T.unsigned)}e.fromValue=l;var u=1<<16,h=1<<24,f=u*u,d=f*f,p=d/2,A=s(h),g=s(0);e.ZERO=g;var y=s(0,!0);e.UZERO=y;var E=s(1);e.ONE=E;var _=s(1,!0);e.UONE=_;var B=s(-1);e.NEG_ONE=B;var b=o(-1,2147483647,!1);e.MAX_VALUE=b;var S=o(-1,-1,!0);e.MAX_UNSIGNED_VALUE=S;var w=o(0,-2147483648,!1);e.MIN_VALUE=w;var C=e.prototype;return C.toInt=function(){return this.unsigned?this.low>>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},C.toString=function(m){if(m=m||10,m<2||36<m)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(w)){var M=i(m),F=this.div(M),R=F.mul(M).sub(this);return F.toString(m)+R.toInt().toString(m)}else return"-"+this.neg().toString(m);for(var v=i(a(m,6),this.unsigned),D=this,W="";;){var z=D.div(v),Z=D.sub(z.mul(v)).toInt()>>>0,X=Z.toString(m);if(D=z,D.isZero())return X+W;for(;X.length<6;)X="0"+X;W=""+X+W}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var m=this.high!=0?this.high:this.low,M=31;M>0&&!(m&1<<M);M--);return this.high!=0?M+33:M+1},C.isZero=function(){return this.high===0&&this.low===0},C.isNegative=function(){return!this.unsigned&&this.high<0},C.isPositive=function(){return this.unsigned||this.high>=0},C.isOdd=function(){return(this.low&1)===1},C.isEven=function(){return(this.low&1)===0},C.equals=function(m){return t(m)||(m=l(m)),this.unsigned!==m.unsigned&&this.high>>>31===1&&m.high>>>31===1?!1:this.high===m.high&&this.low===m.low},C.eq=C.equals,C.notEquals=function(m){return!this.eq(m)},C.neq=C.notEquals,C.lessThan=function(m){return this.comp(m)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(m){return this.comp(m)<=0},C.lte=C.lessThanOrEqual,C.greaterThan=function(m){return this.comp(m)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(m){return this.comp(m)>=0},C.gte=C.greaterThanOrEqual,C.compare=function(m){if(t(m)||(m=l(m)),this.eq(m))return 0;var M=this.isNegative(),F=m.isNegative();return M&&!F?-1:!M&&F?1:this.unsigned?m.high>>>0>this.high>>>0||m.high===this.high&&m.low>>>0>this.low>>>0?-1:1:this.sub(m).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(E)},C.neg=C.negate,C.add=function(m){t(m)||(m=l(m));var M=this.high>>>16,F=this.high&65535,R=this.low>>>16,v=this.low&65535,D=m.high>>>16,W=m.high&65535,z=m.low>>>16,Z=m.low&65535,X=0,Y=0,tt=0,xt=0;return xt+=v+Z,tt+=xt>>>16,xt&=65535,tt+=R+z,Y+=tt>>>16,tt&=65535,Y+=F+W,X+=Y>>>16,Y&=65535,X+=M+D,X&=65535,o(tt<<16|xt,X<<16|Y,this.unsigned)},C.subtract=function(m){return t(m)||(m=l(m)),this.add(m.neg())},C.sub=C.subtract,C.multiply=function(m){if(this.isZero()||(t(m)||(m=l(m)),m.isZero()))return g;if(this.eq(w))return m.isOdd()?w:g;if(m.eq(w))return this.isOdd()?w:g;if(this.isNegative())return m.isNegative()?this.neg().mul(m.neg()):this.neg().mul(m).neg();if(m.isNegative())return this.mul(m.neg()).neg();if(this.lt(A)&&m.lt(A))return i(this.toNumber()*m.toNumber(),this.unsigned);var M=this.high>>>16,F=this.high&65535,R=this.low>>>16,v=this.low&65535,D=m.high>>>16,W=m.high&65535,z=m.low>>>16,Z=m.low&65535,X=0,Y=0,tt=0,xt=0;return xt+=v*Z,tt+=xt>>>16,xt&=65535,tt+=R*Z,Y+=tt>>>16,tt&=65535,tt+=v*z,Y+=tt>>>16,tt&=65535,Y+=F*Z,X+=Y>>>16,Y&=65535,Y+=R*z,X+=Y>>>16,Y&=65535,Y+=v*W,X+=Y>>>16,Y&=65535,X+=M*Z+F*z+R*W+v*D,X&=65535,o(tt<<16|xt,X<<16|Y,this.unsigned)},C.mul=C.multiply,C.divide=function(m){if(t(m)||(m=l(m)),m.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?y:g;var M,F,R;if(this.unsigned){if(m.unsigned||(m=m.toUnsigned()),m.gt(this))return y;if(m.gt(this.shru(1)))return _;R=y}else{if(this.eq(w)){if(m.eq(E)||m.eq(B))return w;if(m.eq(w))return E;var v=this.shr(1);return M=v.div(m).shl(1),M.eq(g)?m.isNegative()?E:B:(F=this.sub(m.mul(M)),R=M.add(F.div(m)),R)}else if(m.eq(w))return this.unsigned?y:g;if(this.isNegative())return m.isNegative()?this.neg().div(m.neg()):this.neg().div(m).neg();if(m.isNegative())return this.div(m.neg()).neg();R=g}for(F=this;F.gte(m);){M=Math.max(1,Math.floor(F.toNumber()/m.toNumber()));for(var D=Math.ceil(Math.log(M)/Math.LN2),W=D<=48?1:a(2,D-48),z=i(M),Z=z.mul(m);Z.isNegative()||Z.gt(F);)M-=W,z=i(M,this.unsigned),Z=z.mul(m);z.isZero()&&(z=E),R=R.add(z),F=F.sub(Z)}return R},C.div=C.divide,C.modulo=function(m){return t(m)||(m=l(m)),this.sub(this.div(m).mul(m))},C.mod=C.modulo,C.not=function(){return o(~this.low,~this.high,this.unsigned)},C.and=function(m){return t(m)||(m=l(m)),o(this.low&m.low,this.high&m.high,this.unsigned)},C.or=function(m){return t(m)||(m=l(m)),o(this.low|m.low,this.high|m.high,this.unsigned)},C.xor=function(m){return t(m)||(m=l(m)),o(this.low^m.low,this.high^m.high,this.unsigned)},C.shiftLeft=function(m){return t(m)&&(m=m.toInt()),(m&=63)===0?this:m<32?o(this.low<<m,this.high<<m|this.low>>>32-m,this.unsigned):o(0,this.low<<m-32,this.unsigned)},C.shl=C.shiftLeft,C.shiftRight=function(m){return t(m)&&(m=m.toInt()),(m&=63)===0?this:m<32?o(this.low>>>m|this.high<<32-m,this.high>>m,this.unsigned):o(this.high>>m-32,this.high>=0?0:-1,this.unsigned)},C.shr=C.shiftRight,C.shiftRightUnsigned=function(m){if(t(m)&&(m=m.toInt()),m&=63,m===0)return this;var M=this.high;if(m<32){var F=this.low;return o(F>>>m|M<<32-m,M>>>m,this.unsigned)}else return m===32?o(M,0,this.unsigned):o(M>>>m-32,0,this.unsigned)},C.shru=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},C.toBytes=function(T){return T?this.toBytesLE():this.toBytesBE()},C.toBytesLE=function(){var T=this.high,m=this.low;return[m&255,m>>>8&255,m>>>16&255,m>>>24&255,T&255,T>>>8&255,T>>>16&255,T>>>24&255]},C.toBytesBE=function(){var T=this.high,m=this.low;return[T>>>24&255,T>>>16&255,T>>>8&255,T&255,m>>>24&255,m>>>16&255,m>>>8&255,m&255]},e})});var Js=et((bR,Af)=>{Af.exports=globalThis.h3||{}});var Ra=et((PR,Ef)=>{Ef.exports=globalThis.luma});var Ws=et((OR,Bf)=>{Bf.exports=globalThis.deck});var bf=et((NR,Cf)=>{Cf.exports=globalThis.luma});var Bn=et((oL,kf)=>{kf.exports=globalThis.loaders});var Em=et((a4,_m)=>{_m.exports=globalThis.deck});var Rm=et(fl=>{fl.read=function(e,t,n,r,s){var i,o,a=s*8-r-1,c=(1<<a)-1,l=c>>1,u=-7,h=n?s-1:0,f=n?-1:1,d=e[t+h];for(h+=f,i=d&(1<<-u)-1,d>>=-u,u+=a;u>0;i=i*256+e[t+h],h+=f,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=r;u>0;o=o*256+e[t+h],h+=f,u-=8);if(i===0)i=1-l;else{if(i===c)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-l}return(d?-1:1)*o*Math.pow(2,i-r)};fl.write=function(e,t,n,r,s,i){var o,a,c,l=i*8-s-1,u=(1<<l)-1,h=u>>1,f=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,p=r?1:-1,A=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+h>=1?t+=f/c:t+=f*Math.pow(2,1-h),t*c>=2&&(o++,c/=2),o+h>=u?(a=0,o=u):o+h>=1?(a=(t*c-1)*Math.pow(2,s),o=o+h):(a=t*Math.pow(2,h-1)*Math.pow(2,s),o=0));s>=8;e[n+d]=a&255,d+=p,a/=256,s-=8);for(o=o<<s|a,l+=s;l>0;e[n+d]=o&255,d+=p,o/=256,l-=8);e[n+d-p]|=A*128}});var Um=et((K4,Dm)=>{"use strict";Dm.exports=J;var $i=Rm();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 dl=(1<<16)*(1<<16),Lm=1/dl,ab=12,Nm=typeof TextDecoder>"u"?null:new TextDecoder("utf8");J.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=to(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Om(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=to(this.buf,this.pos)+to(this.buf,this.pos+4)*dl;return this.pos+=8,e},readSFixed64:function(){var e=to(this.buf,this.pos)+Om(this.buf,this.pos+4)*dl;return this.pos+=8,e},readFloat:function(){var e=$i.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=$i.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,cb(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>=ab&&Nm?Eb(this.buf,t,e):_b(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 n=de(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==J.Bytes)return e.push(this.readSVarint());var t=de(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=de(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=de(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=de(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=de(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=de(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=de(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=de(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 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),jn(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),jn(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),jn(this.buf,e&-1,this.pos),jn(this.buf,Math.floor(e*Lm),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),jn(this.buf,e&-1,this.pos),jn(this.buf,Math.floor(e*Lm),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){lb(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=Bb(this.buf,e,this.pos);var n=this.pos-t;n>=128&&Pm(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),$i.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),$i.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&&Pm(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,J.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,fb,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,db,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,gb,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,pb,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,mb,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,Ab,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,xb,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,yb,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,Tb,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 cb(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 qn(e,s,t);throw new Error("Expected varint not more than 10 bytes")}function de(e){return e.type===J.Bytes?e.readVarint()+e.pos:e.pos+1}function qn(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function lb(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),ub(n,r,t),hb(r,t)}function ub(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 hb(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 Pm(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 fb(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function db(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function pb(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function mb(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function gb(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function Ab(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function xb(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function yb(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function Tb(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function to(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function jn(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function Om(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function _b(e,t,n){for(var r="",s=t;s<n;){var i=e[s],o=null,a=i>239?4:i>223?3:i>191?2:1;if(s+a>n)break;var c,l,u;a===1?i<128&&(o=i):a===2?(c=e[s+1],(c&192)===128&&(o=(i&31)<<6|c&63,o<=127&&(o=null))):a===3?(c=e[s+1],l=e[s+2],(c&192)===128&&(l&192)===128&&(o=(i&15)<<12|(c&63)<<6|l&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):a===4&&(c=e[s+1],l=e[s+2],u=e[s+3],(c&192)===128&&(l&192)===128&&(u&192)===128&&(o=(i&15)<<18|(c&63)<<12|(l&63)<<6|u&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,a=1):o>65535&&(o-=65536,r+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),r+=String.fromCharCode(o),s+=a}return r}function Eb(e,t,n){return Nm.decode(e.subarray(t,n))}function Bb(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 es={};ut(es,{GeohashLayer:()=>ts,GreatCircleLayer:()=>ur,H3ClusterLayer:()=>_r,H3HexagonLayer:()=>je,MVTLayer:()=>$r,QuadkeyLayer:()=>dr,S2Layer:()=>fr,TerrainLayer:()=>Hr,Tile3DLayer:()=>Dr,TileLayer:()=>ee,TripsLayer:()=>xr,_GeoCellLayer:()=>It,_Tile2DHeader:()=>Je,_Tileset2D:()=>qe,_WMSLayer:()=>Is,_getURLFromTemplate:()=>te});var Xt={},Sl=N(Dt(),1);pe(Xt,N(Dt(),1));if(!Sl.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");pe(es,Xt);var ke=N(Ut(),1),Nh=N(Dt(),1);function fg(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function ss(e){if(Array.isArray(e))return e.map(t=>ss(t));if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[fg(n)]=ss(r);return t}return e}var iu=N(su(),1);function Ao(e,t){if(t!=null&&t._parser&&t._parser!=="fast-xml-parser")throw new Error(t?._parser);let n={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:t?.removeNSPrefix,textNodeName:t?.textNodeName,isArray:(s,i,o,a)=>{var c;return Boolean(t==null||(c=t.arrayPaths)===null||c===void 0?void 0:c.some(u=>i===u))},...t?._fastXML},r=_0(e,n);return t!=null&&t.uncapitalizeKeys?ss(r):r}function _0(e,t){return new iu.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var E0="4.1.0",mt={name:"XML",id:"xml",module:"xml",version:E0,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:B0,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>Ao(new TextDecoder().decode(e),{...mt.options.xml,...t?.xml}),parseTextSync:(e,t)=>Ao(e,{...mt.options.xml,...t?.xml})};function B0(e){return e.startsWith("<?xml")}async function Ct(e,t,n,r){return r._parse(e,t,n,r)}function V(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var Wt={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},C0=Wt.self||Wt.window||Wt.global||{},b0=Wt.window||Wt.self||Wt.global||{},S0=Wt.global||Wt.self||Wt.window||{},M0=Wt.document||{};var Yn=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var ou=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),I0=ou&&parseFloat(ou[1])||0;function xo(e,t){return au(e||{},t)}function au(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(n>3)return t;let r={...e};for(let[s,i]of Object.entries(t))i&&typeof i=="object"&&!Array.isArray(i)?r[s]=au(r[s]||{},t[s],n+1):r[s]=t[s];return r}function w0(){var e;return(e=globalThis._loadersgl_)!==null&&e!==void 0&&e.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.1.0"),globalThis._loadersgl_.version}var cu=w0();function lu(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var Yt={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},FS=Yt.self||Yt.window||Yt.global||{},RS=Yt.window||Yt.self||Yt.global||{},LS=Yt.global||Yt.self||Yt.window||{},PS=Yt.document||{};var dn=typeof process!="object"||String(process)!=="[object process]"||process.browser,os=typeof importScripts=="function",OS=typeof window<"u"&&typeof window.orientation<"u",uu=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),NS=uu&&parseFloat(uu[1])||0;var yo={};async function Kt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return t&&(e=hu(e,t,n,r)),yo[e]=yo[e]||v0(e),await yo[e]}function hu(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(!n.useLocalLibraries&&e.startsWith("http"))return e;r=r||e;let s=n.modules||{};return s[r]?s[r]:dn?n.CDN?(lu(n.CDN.startsWith("http")),`${n.CDN}/${t}@${cu}/dist/libs/${r}`):os?`../src/libs/${r}`:`modules/${t}/src/libs/${r}`:`modules/${t}/dist/libs/${r}`}async function v0(e){if(e.endsWith("wasm"))return await R0(e);if(!dn)try{return bt&&bt.requireFromFile&&await bt.requireFromFile(e)}catch(n){return console.error(n),null}if(os)return importScripts(e);let t=await L0(e);return F0(t,e)}function F0(e,t){if(!dn)return bt.requireFromString&&bt.requireFromString(e,t);if(os)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 R0(e){return dn||!bt.readFileAsArrayBuffer||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await bt.readFileAsArrayBuffer(e)}async function L0(e){return dn||!bt.readFileAsText||e.startsWith("http")?await(await fetch(e)).text():await bt.readFileAsText(e)}function du(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:5;return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?fu(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?fu(e,0,t):""}function fu(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 To(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${du(e)}"`)}}function Kn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let r=t,s=r&&r.length>1&&r[0].constructor||null;if(!s)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let i=r.reduce((c,l)=>c+l.length,0),o=new s(i),a=0;for(let c of r)o.set(c,a),a+=c.length;return o}function Pe(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 ge(e,t){return V(e>=0),V(t>0),e+(t-1)&~(t-1)}function _o(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+ge(r.byteLength,4)}function Qn(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Oe=class{constructor(t,n){this.name=void 0,this.type=void 0,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=Qn(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Qn()-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 Ae=class{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"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(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(n=>this._getOrCreate(n))}_getOrCreate(t){let{name:n,type:r}=t,s=this.stats[n];return s||(t instanceof Oe?s=t:s=new Oe(n,r),this.stats[n]=s),s}};var P0="Queued Requests",O0="Active Requests",N0="Cancelled Requests",D0="Queued Requests Ever",U0="Active Requests Ever",G0={id:"request-scheduler",throttleRequests:!0,maxRequests:6},xe=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.props=void 0,this.stats=void 0,this.activeRequestCount=0,this.requestQueue=[],this.requestMap=new Map,this.deferredUpdate=null,this.props={...G0,...t},this.stats=new Ae({id:this.props.id}),this.stats.get(P0),this.stats.get(O0),this.stats.get(N0),this.stats.get(D0),this.stats.get(U0)}scheduleRequest(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:()=>0;if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let r={handle:t,priority:0,getPriority:n},s=new Promise(i=>(r.resolve=i,r));return this.requestQueue.push(r),this.requestMap.set(t,s),this._issueNewRequests(),s}_issueRequest(t){let{handle:n,resolve:r}=t,s=!1,i=()=>{s||(s=!0,this.requestMap.delete(n),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:i}):Promise.resolve({done:i})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequestsAsync(){this.deferredUpdate=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 ye={};ut(ye,{dirname:()=>H0,filename:()=>V0,join:()=>z0,resolve:()=>k0});function pu(){var e;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let t=(e=window.location)===null||e===void 0?void 0:e.pathname;return t?.slice(0,t.lastIndexOf("/")+1)||""}function V0(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function H0(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function z0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let r="/";return t=t.map((s,i)=>(i&&(s=s.replace(new RegExp(`^${r}`),"")),i!==t.length-1&&(s=s.replace(new RegExp(`${r}$`),"")),s)),t.join(r)}function k0(){let e=[];for(let s=0;s<arguments.length;s++)e[s]=s<0||arguments.length<=s?void 0:arguments[s];let t="",n=!1,r;for(let s=e.length-1;s>=-1&&!n;s--){let i;s>=0?i=e[s]:(r===void 0&&(r=pu()),i=r),i.length!==0&&(t=`${i}/${t}`,n=i.charCodeAt(0)===Zn)}return t=J0(t,!n),n?`/${t}`:t.length>0?t:"."}var Zn=47,Eo=46;function J0(e,t){let n="",r=-1,s=0,i,o=!1;for(let a=0;a<=e.length;++a){if(a<e.length)i=e.charCodeAt(a);else{if(i===Zn)break;i=Zn}if(i===Zn){if(!(r===a-1||s===1))if(r!==a-1&&s===2){if(n.length<2||!o||n.charCodeAt(n.length-1)!==Eo||n.charCodeAt(n.length-2)!==Eo){if(n.length>2){let c=n.length-1,l=c;for(;l>=0&&n.charCodeAt(l)!==Zn;--l);if(l!==c){n=l===-1?"":n.slice(0,l),r=a,s=0,o=!1;continue}}else if(n.length===2||n.length===1){n="",r=a,s=0,o=!1;continue}}t&&(n.length>0?n+="/..":n="..",o=!0)}else{let c=e.slice(r+1,a);n.length>0?n+=`/${c}`:n=c,o=!1}r=a,s=0}else i===Eo&&s!==-1?++s:s=-1}return n}var as=class{constructor(t){this.data=void 0,this.fetch=void 0,this.loadOptions=void 0,this._needsRefresh=!0,this.props=void 0,this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=q0(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function q0(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 vt=class extends as{};vt.type="template";vt.testURL=e=>!1;function mu(e,t){var n,r,s;let i=(n=mt.parseTextSync)===null||n===void 0?void 0:n.call(mt,e,t),o=(i==null||(r=i.ServiceExceptionReport)===null||r===void 0?void 0:r.ServiceException)||(i==null||(s=i["ogc:ServiceExceptionReport"])===null||s===void 0?void 0:s["ogc:ServiceException"]);return typeof o=="string"?o:o.value||o.code||"Unknown error"}var j0="4.1.0",Ne={id:"wms-error",name:"WMS Error",module:"wms",version:j0,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:X0,options:{wms:{throwOnError:!1}},parse:async(e,t)=>Bo(new TextDecoder().decode(e),t),parseSync:(e,t)=>Bo(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Bo(e,t)};function X0(e){return e.startsWith("<?xml")}function Bo(e,t){let n={...Ne.options.wms,...t?.wms},r=mu(e,n),s=n.minimalErrors?r:`WMS Service error: ${r}`;if(n.throwOnError)throw new Error(s);return s}function De(e){return Array.isArray(e)?e:e?[e]:[]}function $n(e){let t=De(e);return t.length>0&&t.every(n=>typeof n=="string")?t:[]}function tr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;switch(typeof e){case"number":return e;case"string":return parseFloat(e);default:return}}function cs(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;switch(typeof e){case"number":return e;case"string":return parseInt(e,10);default:return}}function Ue(e){switch(e){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function Co(e,t){var n;let r=(n=mt.parseTextSync)===null||n===void 0?void 0:n.call(mt,e,t),s=r.WMT_MS_Capabilities||r.WMS_Capabilities||r,i=W0(s);if(t!=null&&t.inheritedLayerProps)for(let o of i.layers)Au(o,null);return t!=null&&t.includeRawJSON&&(i.json=s),t!=null&&t.includeXMLText&&(i.xml=e),i}function W0(e){var t,n,r,s,i,o,a,c,l,u,h,f,d,p,A,g;let y={version:String(e.version||""),name:String(((t=e.Service)===null||t===void 0?void 0:t.Name)||"unnamed"),title:(n=e.Service)!==null&&n!==void 0&&n.Title?String((r=e.Service)===null||r===void 0?void 0:r.Title):void 0,abstract:(s=e.Service)!==null&&s!==void 0&&s.Abstract?String((i=e.Service)===null||i===void 0?void 0:i.Abstract):void 0,keywords:$n((o=e.Service)===null||o===void 0||(a=o.KeywordList)===null||a===void 0?void 0:a.Keyword),fees:(c=e.Service)!==null&&c!==void 0&&c.Fees?JSON.stringify((l=e.Service)===null||l===void 0?void 0:l.Fees):void 0,accessConstraints:(u=e.Service)!==null&&u!==void 0&&u.AccessConstraints?JSON.stringify((h=e.Service)===null||h===void 0?void 0:h.AccessConstraints):void 0,layerLimit:cs((f=e.Service)===null||f===void 0?void 0:f.LayerLimit),maxWidth:cs((d=e.Service)===null||d===void 0?void 0:d.maxWidth),maxHeight:cs((p=e.Service)===null||p===void 0?void 0:p.maxHeight),layers:[],requests:Y0((A=e.Capability)===null||A===void 0?void 0:A.Request),exceptions:K0(e.Exception)},E=De((g=e.Capability)===null||g===void 0?void 0:g.Layer);for(let _ of E)y.layers.push(gu(_));for(let[_,B]of Object.entries(y))B===void 0&&delete y[_];return y}function Y0(e){let t={};for(let[n,r]of Object.entries(e||{})){let s=$n(r?.Format);t[n]={mimeTypes:s}}return t}function K0(e){if(De(e?.Format).length>0)return{mimeTypes:$n(e)}}function gu(e){var t;let n={title:String(e?.Title||""),name:e?.Name&&String(e?.Name),abstract:e?.Name&&String(e?.Abstract),keywords:$n((t=e.KeywordList)===null||t===void 0?void 0:t.Keyword)},r=e?.CRS||e?.SRS;r&&Array.isArray(r)&&r.every(u=>typeof u=="string")&&(n.crs=r);let s=e?.EX_GeographicBoundingBox&&Q0(e?.EX_GeographicBoundingBox);s&&(n.geographicBoundingBox=s),s=e?.LatLonBoundingBox&&Z0(e?.LatLonBoundingBox),s&&(n.geographicBoundingBox=s);let i=e?.BoundingBox&&$0(e?.BoundingBox);i&&i.length>0&&(n.boundingBoxes=i);let a=De(e?.Dimension).map(u=>eA(u));a.length&&(n.dimensions=a),e!=null&&e.opaque&&(n.opaque=Ue(e?.opaque)),e!=null&&e.cascaded&&(n.cascaded=Ue(e?.cascaded)),e!=null&&e.queryable&&(n.queryable=Ue(e?.queryable));let c=De(e?.Layer),l=[];for(let u of c)l.push(gu(u));l.length>0&&(n.layers=l);for(let[u,h]of Object.entries(n))h===void 0&&delete n[u];return n}function Q0(e){let{westBoundLongitude:t,northBoundLatitude:n,eastBoundLongitude:r,southBoundLatitude:s}=e;return[[t,s],[r,n]]}function Z0(e){let{minx:t,miny:n,maxx:r,maxy:s}=e;return[[t,n],[r,s]]}function $0(e){return De(e).map(n=>tA(n))}function tA(e){let{CRS:t,SRS:n,minx:r,miny:s,maxx:i,maxy:o,resx:a,resy:c}=e,l={crs:t||n,boundingBox:[[tr(r),tr(s)],[tr(i),tr(o)]]};return a&&(l.xResolution=a),c&&(l.yResolution=c),l}function eA(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=Ue(e.multipleValues)),e.nearestValue&&(s.nearestValue=Ue(e.nearestValue)),e.current&&(s.current=Ue(e.current)),s}function Au(e,t){t!=null&&t.geographicBoundingBox&&!e.geographicBoundingBox&&(e.geographicBoundingBox=[...t.geographicBoundingBox]),t!=null&&t.crs&&!e.crs&&(e.crs=[...t.crs]),t!=null&&t.boundingBoxes&&!e.boundingBoxes&&(e.boundingBoxes=[...t.boundingBoxes]),t!=null&&t.dimensions&&!e.dimensions&&(e.dimensions=[...t.dimensions]);for(let n of e.layers||[])Au(n,e)}var nA="4.1.0",pn={id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:nA,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:rA,options:{wms:{}},parse:async(e,t)=>Co(new TextDecoder().decode(e),t?.wms),parseTextSync:(e,t)=>Co(e,t?.wms)};function rA(e){return e.startsWith("<?xml")}function bo(e,t){var n,r;let i=((r=((n=mt.parseTextSync)===null||n===void 0?void 0:n.call(mt,e,t)).FeatureInfoResponse)===null||r===void 0?void 0:r.FIELDS)||[];return{features:(Array.isArray(i)?i:[i]).map(a=>sA(a))}}function sA(e){return{attributes:e||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var xu={...pn,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(e,t)=>bo(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>bo(e,t)};function So(e,t){var n;return(n=mt.parseTextSync)===null||n===void 0?void 0:n.call(mt,e,t)}var yu={...pn,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(e,t)=>So(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>So(e,t)};function Tu(e,t){let{type:n="auto"}=e,r=n==="auto"?oA(e.url,t):iA(n,t);if(!r)throw new Error("Not a valid image source type");return r.create(e)}function iA(e,t){for(let n of t)if(n.type===e)return n;return null}function oA(e,t){for(let n of t)if(n.testURL&&n.testURL(e))return n;return null}var _u="4.1.0";var Mo,aA=(Mo=globalThis.loaders)===null||Mo===void 0?void 0:Mo.parseImageNode,Io=typeof Image<"u",wo=typeof ImageBitmap<"u",cA=Boolean(aA),vo=Yn?!0:cA;function Eu(e){switch(e){case"auto":return wo||Io||vo;case"imagebitmap":return wo;case"image":return Io;case"data":return vo;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Bu(){if(wo)return"imagebitmap";if(Io)return"image";if(vo)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Cu(e){let t=lA(e);if(!t)throw new Error("Not an image");return t}function er(e){switch(Cu(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 lA(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 uA=/^data:image\/svg\+xml/,hA=/\.svg((\?|#).*)?$/;function ls(e){return e&&(uA.test(e)||hA.test(e))}function bu(e,t){if(ls(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 Fo(e,t)}function Fo(e,t){if(ls(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function us(e,t,n){let r=bu(e,n),s=self.URL||self.webkitURL,i=typeof r!="string"&&s.createObjectURL(r);try{return await fA(i||r,t)}finally{i&&s.revokeObjectURL(i)}}async function fA(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 dA={},Su=!0;async function Mu(e,t,n){let r;ls(n)?r=await us(e,t,n):r=Fo(e,n);let s=t&&t.imagebitmap;return await pA(r,s)}async function pA(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if((mA(t)||!Su)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),Su=!1}return await createImageBitmap(e)}function mA(e){for(let t in e||dA)return!1;return!0}function Iu(e){return!yA(e,"ftyp",4)||!(e[8]&96)?null:gA(e)}function gA(e){switch(AA(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function AA(e,t,n){return String.fromCharCode(...e.slice(t,n))}function xA(e){return[...e].map(t=>t.charCodeAt(0))}function yA(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=xA(t);for(let s=0;s<r.length;++s)if(r[s]!==e[s+n])return!1;return!0}var Qt=!1,nr=!0;function Ge(e){let t=rr(e);return _A(t)||CA(t)||EA(t)||BA(t)||TA(t)}function TA(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=Iu(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function _A(e){let t=rr(e);return t.byteLength>=24&&t.getUint32(0,Qt)===2303741511?{mimeType:"image/png",width:t.getUint32(16,Qt),height:t.getUint32(20,Qt)}:null}function EA(e){let t=rr(e);return t.byteLength>=10&&t.getUint32(0,Qt)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,nr),height:t.getUint16(8,nr)}:null}function BA(e){let t=rr(e);return t.byteLength>=14&&t.getUint16(0,Qt)===16973&&t.getUint32(2,nr)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,nr),height:t.getUint32(22,nr)}:null}function CA(e){let t=rr(e);if(!(t.byteLength>=3&&t.getUint16(0,Qt)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:s}=bA(),i=2;for(;i+9<t.byteLength;){let o=t.getUint16(i,Qt);if(s.has(o))return{mimeType:"image/jpeg",height:t.getUint16(i+5,Qt),width:t.getUint16(i+7,Qt)};if(!r.has(o))return null;i+=2,i+=t.getUint16(i,Qt)}return null}function bA(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function rr(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 wu(e,t){var n;let{mimeType:r}=Ge(e)||{},s=(n=globalThis.loaders)===null||n===void 0?void 0:n.parseImageNode;return V(s),await s(e,r)}async function vu(e,t,n){t=t||{};let s=(t.image||{}).type||"auto",{url:i}=n||{},o=SA(s),a;switch(o){case"imagebitmap":a=await Mu(e,t,i);break;case"image":a=await us(e,t,i);break;case"data":a=await wu(e,t);break;default:V(!1)}return s==="data"&&(a=er(a)),a}function SA(e){switch(e){case"auto":case"data":return Bu();default:return Eu(e),e}}var MA=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],IA=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],wA={image:{type:"auto",decode:!0}},Te={id:"image",module:"images",name:"Images",version:_u,mimeTypes:IA,extensions:MA,parse:vu,tests:[e=>Boolean(Ge(new DataView(e)))],options:wA};var Ro={};function Lo(e){if(Ro[e]===void 0){let t=Yn?FA(e):vA(e);Ro[e]=t}return Ro[e]}function vA(e){var t,n;let r=["image/png","image/jpeg","image/gif"],s=((t=globalThis.loaders)===null||t===void 0?void 0:t.imageFormatsNode)||r,i=(n=globalThis.loaders)===null||n===void 0?void 0:n.parseImageNode;return Boolean(i)&&s.includes(e)}function FA(e){switch(e){case"image/avif":case"image/webp":return RA(e);default:return!0}}function RA(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var Fu={type:"wms",testURL:e=>e.toLowerCase().includes("wms"),create:e=>new Po(e)},Po=class extends vt{constructor(t){var n;super(t),this.url=void 0,this.data=void 0,this.substituteCRS84=void 0,this.flipCRS=void 0,this.wmsParameters=void 0,this.vendorParameters=void 0,this.capabilities=null,this.url=t.url,this.data=t.url,this.substituteCRS84=(n=t.substituteCRS84)!==null&&n!==void 0?n:!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...t.wmsParameters},this.vendorParameters=t.vendorParameters||{}}async getMetadata(){let t=await this.getCapabilities();return this.normalizeMetadata(t)}async getImage(t){let{boundingBox:n,bbox:r,...s}=t,i={bbox:n?[...n[0],...n[1]]:r,...s};return await this.getMap(i)}normalizeMetadata(t){return t}async getCapabilities(t,n){let r=this.getCapabilitiesURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);let o=await pn.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 Te.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 xu.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 yu.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 Te.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}getCapabilitiesURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetCapabilities",r,n)}getMapURL(t,n){t=this._getWMS130Parameters(t);let r={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetMap",r,n)}getFeatureInfoURL(t,n){t=this._getWMS130Parameters(t);let r={version:this.wmsParameters.version,info_format:this.wmsParameters.info_format,layers:this.wmsParameters.layers,query_layers:this.wmsParameters.query_layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetFeatureInfo",r,n)}describeLayerURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("DescribeLayer",r,n)}getLegendGraphicURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetLegendGraphic",r,n)}_parseWMSUrl(t){let[n,r]=t.split("?"),s=r.split("&"),i={};for(let o of s){let[a,c]=o.split("=");i[a]=c}return{url:n,parameters:i}}_getWMSUrl(t,n,r){let s=this.url,i=!0,o={service:"WMS",version:n.version,request:t,...n,...this.vendorParameters,...r},a=["transparent","time","elevation"];for(let[c,l]of Object.entries(o))(!a.includes(c)||l)&&(s+=i?"?":"&",i=!1,s+=this._getURLParameter(c,l,n));return encodeURI(s)}_getWMS130Parameters(t){let n={...t};return n.srs&&(n.crs=n.crs||n.srs,delete n.srs),n}_getURLParameter(t,n,r){switch(t){case"crs":r.version!=="1.3.0"?t="srs":this.substituteCRS84&&n==="EPSG:4326"&&(n="CRS:84");break;case"srs":r.version==="1.3.0"&&(t="crs");break;case"bbox":let s=this._flipBoundingBox(n,r);s&&(n=s);break;default:}return t=t.toUpperCase(),Array.isArray(n)?`${t}=${n.join(",")}`:`${t}=${n?String(n):""}`}_flipBoundingBox(t,n){if(!Array.isArray(t)||t.length!==4)return null;let r=n.version==="1.3.0"&&this.flipCRS.includes(n.crs||"")&&!(this.substituteCRS84&&n.crs==="EPSG:4326"),s=t;return r?[s[1],s[0],s[3],s[2]]:s}async _fetchArrayBuffer(t){let n=await this.fetch(t),r=await n.arrayBuffer();return this._checkResponse(n,r),r}_checkResponse(t,n){let r=t.headers["content-type"];if(!t.ok||Ne.mimeTypes.includes(r)){var s;let i=xo(this.loadOptions,{wms:{throwOnError:!0}}),o=(s=Ne.parseSync)===null||s===void 0?void 0:s.call(Ne,n,i);throw new Error(o)}}_parseError(t){var n;let r=(n=Ne.parseSync)===null||n===void 0?void 0:n.call(Ne,t,this.loadOptions);return new Error(r)}};var mn=class extends vt{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 Te.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}};mn.type="template";mn.testURL=e=>e.toLowerCase().includes("{");var Oo=class extends mn{constructor(t){super(t),this.data=void 0,this.data=t.url}async getMetadata(){return await this.metadata()}async getImage(t){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(t){throw new Error("not implemented")}metadataURL(t){return`${this.props.url}?f=pjson`}exportImageURL(t){let n=`bbox=${t.bbox[0]},${t.bbox[1]},${t.bbox[2]},${t.bbox[3]}`,r=`size=${t.width},${t.height}`,s={...t,bbox:n,size:r};return delete s.width,delete s.height,this.getUrl("exportImage",s)}getUrl(t,n,r){let s=`${this.props.url}/${t}`,i=!0;for(let[o,a]of Object.entries(n))s+=i?"?":"&",i=!1,Array.isArray(a)?s+=`${o.toUpperCase()}=${a.join(",")}`:s+=`${o.toUpperCase()}=${a?String(a):""}`;return s}async checkResponse(t){if(!t.ok)throw new Error("error")}},Ru={type:"arcgis-image-server",testURL:e=>e.toLowerCase().includes("ImageServer"),create:e=>new Oo(e)};var LA=[Fu,Ru];function No(e){return Tu(e,LA)}function L(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var PA=1/Math.PI*180,OA=1/180*Math.PI,NA={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...NA}};var K=globalThis.mathgl.config;function Do(e,{precision:t=K.precision}={}){return e=DA(e),"".concat(parseFloat(e.toPrecision(t)))}function St(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Uo(e){return Lu(e)}function Go(e){return Mt(e)}function Lu(e,t){return Vo(e,n=>n*OA,t)}function Mt(e,t){return Vo(e,n=>n*PA,t)}function hs(e,t,n){return Vo(e,r=>Math.max(t,Math.min(n,r)))}function _e(e,t,n){return St(e)?e.map((r,s)=>_e(r,t[s],n)):n*t+(1-n)*e}function gt(e,t,n){let r=K.EPSILON;n&&(K.EPSILON=n);try{if(e===t)return!0;if(St(e)&&St(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!gt(e[s],t[s]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=K.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{K.EPSILON=r}}function DA(e){return Math.round(e/K.EPSILON)*K.EPSILON}function UA(e){return e.clone?e.clone():new Array(e.length)}function Vo(e,t,n){if(St(e)){let r=e;n=n||UA(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)}function GA(e){function t(){var n=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(n,Object.getPrototypeOf(this)),n}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}var Ee=class extends GA(Array){clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:St(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(K)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+Do(this[r],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(n,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!gt(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(K.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let 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 VA(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 G(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(JSON.stringify(e)));return e}function Be(e,t,n=""){if(K.debug&&!VA(e,t))throw new Error("math.gl: ".concat(n," some fields set to invalid numbers'"));return e}function ct(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}var Ce=class extends Ee{get x(){return this[0]}set x(t){this[0]=G(t)}get y(){return this[1]}set y(t){this[1]=G(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let 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 G(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return G(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 ct(t>=0&&t<this.ELEMENTS,"index is out of range"),G(this[t])}setComponent(t,n){return ct(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 $=typeof Float32Array<"u"?Float32Array:Array,sr=Math.random;function gn(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var h2=Math.PI/180;function HA(){let e=new $(2);return $!=Float32Array&&(e[0]=0,e[1]=0),e}function Pu(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e}function Ou(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 fs(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 ds(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 f2=function(){let e=HA();return function(t,n,r,s,i,o){let a,c;for(n||(n=2),r||(r=0),s?c=Math.min(s*n+r,t.length):c=t.length,a=r;a<c;a+=n)e[0]=t[a],e[1]=t[a+1],i(e,e,o),t[a]=e[0],t[a+1]=e[1];return t}}();function ps(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 ms(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 Nu(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 Du(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 gs(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}var Ve=class extends Ce{constructor(t=0,n=0){super(2),St(t)&&arguments.length===1?this.copy(t):(K.debug&&(G(t),G(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 K.debug&&(G(t.x),G(t.y)),this[0]=t.x,this[1]=t.y,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return ds(this,this,t),this.check()}transformAsVector(t){return ps(this,this,t),this.check()}transformByMatrix3(t){return fs(this,this,t),this.check()}transformByMatrix2x3(t){return Ou(this,this,t),this.check()}transformByMatrix2(t){return Pu(this,this,t),this.check()}};var xn={};ut(xn,{add:()=>qA,angle:()=>qo,bezier:()=>s1,ceil:()=>jA,clone:()=>zA,copy:()=>kA,create:()=>As,cross:()=>He,dist:()=>d1,distance:()=>zu,div:()=>f1,divide:()=>Hu,dot:()=>ir,equals:()=>l1,exactEquals:()=>c1,floor:()=>XA,forEach:()=>g1,fromValues:()=>xs,hermite:()=>r1,inverse:()=>t1,len:()=>jo,length:()=>Uu,lerp:()=>e1,max:()=>YA,min:()=>WA,mul:()=>h1,multiply:()=>Vu,negate:()=>$A,normalize:()=>Ho,random:()=>i1,rotateX:()=>zo,rotateY:()=>ko,rotateZ:()=>Jo,round:()=>KA,scale:()=>QA,scaleAndAdd:()=>ZA,set:()=>JA,slerp:()=>n1,sqrDist:()=>p1,sqrLen:()=>m1,squaredDistance:()=>ku,squaredLength:()=>Ju,str:()=>a1,sub:()=>u1,subtract:()=>Gu,transformMat3:()=>or,transformMat4:()=>ze,transformQuat:()=>ar,zero:()=>o1});function As(){let e=new $(3);return $!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function zA(e){let t=new $(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Uu(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function xs(e,t,n){let r=new $(3);return r[0]=e,r[1]=t,r[2]=n,r}function kA(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function JA(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function qA(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function Gu(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function Vu(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],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}function jA(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function XA(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function WA(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 YA(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 KA(e,t){return e[0]=gn(t[0]),e[1]=gn(t[1]),e[2]=gn(t[2]),e}function QA(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function ZA(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 zu(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 ku(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 Ju(e){let t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r}function $A(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function t1(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Ho(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 ir(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function He(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],a=n[1],c=n[2];return e[0]=s*c-i*a,e[1]=i*o-r*c,e[2]=r*a-s*o,e}function e1(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 n1(e,t,n,r){let s=Math.acos(Math.min(Math.max(ir(t,n),-1),1)),i=Math.sin(s),o=Math.sin((1-r)*s)/i,a=Math.sin(r*s)/i;return e[0]=o*t[0]+a*n[0],e[1]=o*t[1]+a*n[1],e[2]=o*t[2]+a*n[2],e}function r1(e,t,n,r,s,i){let o=i*i,a=o*(2*i-3)+1,c=o*(i-2)+i,l=o*(i-1),u=o*(3-2*i);return e[0]=t[0]*a+n[0]*c+r[0]*l+s[0]*u,e[1]=t[1]*a+n[1]*c+r[1]*l+s[1]*u,e[2]=t[2]*a+n[2]*c+r[2]*l+s[2]*u,e}function s1(e,t,n,r,s,i){let o=1-i,a=o*o,c=i*i,l=a*o,u=3*i*a,h=3*c*o,f=c*i;return e[0]=t[0]*l+n[0]*u+r[0]*h+s[0]*f,e[1]=t[1]*l+n[1]*u+r[1]*h+s[1]*f,e[2]=t[2]*l+n[2]*u+r[2]*h+s[2]*f,e}function i1(e,t){t=t===void 0?1:t;let n=sr()*2*Math.PI,r=sr()*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 ze(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 or(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 ar(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],a=t[0],c=t[1],l=t[2],u=s*l-i*c,h=i*a-r*l,f=r*c-s*a,d=s*f-i*h,p=i*u-r*f,A=r*h-s*u,g=o*2;return u*=g,h*=g,f*=g,d*=2,p*=2,A*=2,e[0]=a+u+d,e[1]=c+h+p,e[2]=l+f+A,e}function zo(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 ko(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 Jo(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 qo(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],a=t[2],c=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+a*a)),l=c&&ir(e,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}function o1(e){return e[0]=0,e[1]=0,e[2]=0,e}function a1(e){return"vec3(".concat(e[0],", ").concat(e[1],", ").concat(e[2],")")}function c1(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function l1(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],a=t[2];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-o)<=1e-6*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}var u1=Gu,h1=Vu,f1=Hu,d1=zu,p1=ku,jo=Uu,m1=Ju,g1=function(){let e=As();return function(t,n,r,s,i,o){let a,c;for(n||(n=3),r||(r=0),s?c=Math.min(s*n+r,t.length):c=t.length,a=r;a<c;a+=n)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],i(e,e,o),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2];return t}}();var Xo=[0,0,0],ys,x=class extends Ce{static get ZERO(){return ys||(ys=new x(0,0,0),Object.freeze(ys)),ys}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&St(t)?this.copy(t):(K.debug&&(G(t),G(n),G(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 K.debug&&(G(t.x),G(t.y),G(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=G(t)}angle(t){return qo(this,t)}cross(t){return He(this,this,t),this.check()}rotateX({radians:t,origin:n=Xo}){return zo(this,this,n,t),this.check()}rotateY({radians:t,origin:n=Xo}){return ko(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=Xo}){return Jo(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return ze(this,this,t),this.check()}transformAsVector(t){return ms(this,this,t),this.check()}transformByMatrix3(t){return or(this,this,t),this.check()}transformByMatrix2(t){return Nu(this,this,t),this.check()}transformByQuaternion(t){return ar(this,this,t),this.check()}};var Ts,yn=class extends Ce{static get ZERO(){return Ts||(Ts=new yn(0,0,0,0),Object.freeze(Ts)),Ts}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),St(t)&&arguments.length===1?this.copy(t):(K.debug&&(G(t),G(n),G(r),G(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 K.debug&&(G(t.x),G(t.y),G(t.z),G(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=G(t)}get w(){return this[3]}set w(t){this[3]=G(t)}transform(t){return ze(this,this,t),this.check()}transformByMatrix3(t){return gs(this,this,t),this.check()}transformByMatrix2(t){return Du(this,this,t),this.check()}transformByQuaternion(t){return ar(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Tn=class extends Ee{toString(){let t="[";if(K.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=" ".concat(this[r*this.RANK+n])}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=" ".concat(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]=G(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 qu(){let e=new $(9);return $!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function ju(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 Xu(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],a=t[5],c=t[6],l=t[7],u=t[8],h=u*o-a*l,f=-u*i+a*c,d=l*i-o*c,p=n*h+r*f+s*d;return p?(p=1/p,e[0]=h*p,e[1]=(-u*r+s*l)*p,e[2]=(a*r-s*o)*p,e[3]=f*p,e[4]=(u*n-s*c)*p,e[5]=(-a*n+s*i)*p,e[6]=d*p,e[7]=(-l*n+r*c)*p,e[8]=(o*n-r*i)*p,e):null}function Wu(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],a=e[6],c=e[7],l=e[8];return t*(l*i-o*c)+n*(-l*s+o*a)+r*(c*s-i*a)}function Wo(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=t[8],f=n[0],d=n[1],p=n[2],A=n[3],g=n[4],y=n[5],E=n[6],_=n[7],B=n[8];return e[0]=f*r+d*o+p*l,e[1]=f*s+d*a+p*u,e[2]=f*i+d*c+p*h,e[3]=A*r+g*o+y*l,e[4]=A*s+g*a+y*u,e[5]=A*i+g*c+y*h,e[6]=E*r+_*o+B*l,e[7]=E*s+_*a+B*u,e[8]=E*i+_*c+B*h,e}function Yu(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=t[8],f=n[0],d=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=a,e[5]=c,e[6]=f*r+d*o+l,e[7]=f*s+d*a+u,e[8]=f*i+d*c+h,e}function Ku(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=t[8],f=Math.sin(n),d=Math.cos(n);return e[0]=d*r+f*o,e[1]=d*s+f*a,e[2]=d*i+f*c,e[3]=d*o-f*r,e[4]=d*a-f*s,e[5]=d*c-f*i,e[6]=l,e[7]=u,e[8]=h,e}function Yo(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 Qu(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,a=r+r,c=s+s,l=n*o,u=r*o,h=r*a,f=s*o,d=s*a,p=s*c,A=i*o,g=i*a,y=i*c;return e[0]=1-h-p,e[3]=u-y,e[6]=f+g,e[1]=u+y,e[4]=1-l-p,e[7]=d-A,e[2]=f-g,e[5]=d+A,e[8]=1-l-h,e}var Ko;(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"})(Ko||(Ko={}));var x1=Object.freeze([1,0,0,0,1,0,0,0,1]),k=class extends Tn{static get IDENTITY(){return T1()}static get ZERO(){return y1()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Ko}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(x1)}fromObject(t){return this.check()}fromQuaternion(t){return Qu(this,t),this.check()}set(t,n,r,s,i,o,a,c,l){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=l,this.check()}setRowMajor(t,n,r,s,i,o,a,c,l){return this[0]=t,this[1]=s,this[2]=a,this[3]=n,this[4]=i,this[5]=c,this[6]=r,this[7]=o,this[8]=l,this.check()}determinant(){return Wu(this)}transpose(){return ju(this,this),this.check()}invert(){return Xu(this,this),this.check()}multiplyLeft(t){return Wo(this,t,this),this.check()}multiplyRight(t){return Wo(this,this,t),this.check()}rotate(t){return Ku(this,this,t),this.check()}scale(t){return Array.isArray(t)?Yo(this,this,t):Yo(this,this,[t,t]),this.check()}translate(t){return Yu(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=fs(n||[-0,-0],t,this);break;case 3:r=or(n||[-0,-0,-0],t,this);break;case 4:r=gs(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Be(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)}},_s,Es=null;function y1(){return _s||(_s=new k([0,0,0,0,0,0,0,0,0]),Object.freeze(_s)),_s}function T1(){return Es||(Es=new k,Object.freeze(Es)),Es}var Bs={};ut(Bs,{add:()=>q1,adjoint:()=>S1,clone:()=>E1,copy:()=>B1,create:()=>_1,decompose:()=>N1,determinant:()=>$o,equals:()=>Y1,exactEquals:()=>W1,frob:()=>J1,fromQuat:()=>oa,fromQuat2:()=>L1,fromRotation:()=>w1,fromRotationTranslation:()=>$u,fromRotationTranslationScale:()=>D1,fromRotationTranslationScaleOrigin:()=>U1,fromScaling:()=>I1,fromTranslation:()=>M1,fromValues:()=>C1,fromXRotation:()=>v1,fromYRotation:()=>F1,fromZRotation:()=>R1,frustum:()=>aa,getRotation:()=>O1,getScaling:()=>th,getTranslation:()=>P1,identity:()=>Zu,invert:()=>Zo,lookAt:()=>ua,mul:()=>K1,multiply:()=>cr,multiplyScalar:()=>j1,multiplyScalarAndAdd:()=>X1,ortho:()=>la,orthoNO:()=>nh,orthoZO:()=>H1,perspective:()=>ca,perspectiveFromFieldOfView:()=>V1,perspectiveNO:()=>eh,perspectiveZO:()=>G1,rotate:()=>na,rotateX:()=>ra,rotateY:()=>sa,rotateZ:()=>ia,scale:()=>ea,set:()=>b1,str:()=>k1,sub:()=>Q1,subtract:()=>rh,targetTo:()=>z1,translate:()=>ta,transpose:()=>Qo});function _1(){let e=new $(16);return $!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function E1(e){let t=new $(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function B1(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 C1(e,t,n,r,s,i,o,a,c,l,u,h,f,d,p,A){let g=new $(16);return g[0]=e,g[1]=t,g[2]=n,g[3]=r,g[4]=s,g[5]=i,g[6]=o,g[7]=a,g[8]=c,g[9]=l,g[10]=u,g[11]=h,g[12]=f,g[13]=d,g[14]=p,g[15]=A,g}function b1(e,t,n,r,s,i,o,a,c,l,u,h,f,d,p,A,g){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=i,e[5]=o,e[6]=a,e[7]=c,e[8]=l,e[9]=u,e[10]=h,e[11]=f,e[12]=d,e[13]=p,e[14]=A,e[15]=g,e}function Zu(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Qo(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function Zo(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],a=t[5],c=t[6],l=t[7],u=t[8],h=t[9],f=t[10],d=t[11],p=t[12],A=t[13],g=t[14],y=t[15],E=n*a-r*o,_=n*c-s*o,B=n*l-i*o,b=r*c-s*a,S=r*l-i*a,w=s*l-i*c,C=u*A-h*p,T=u*g-f*p,m=u*y-d*p,M=h*g-f*A,F=h*y-d*A,R=f*y-d*g,v=E*R-_*F+B*M+b*m-S*T+w*C;return v?(v=1/v,e[0]=(a*R-c*F+l*M)*v,e[1]=(s*F-r*R-i*M)*v,e[2]=(A*w-g*S+y*b)*v,e[3]=(f*S-h*w-d*b)*v,e[4]=(c*m-o*R-l*T)*v,e[5]=(n*R-s*m+i*T)*v,e[6]=(g*B-p*w-y*_)*v,e[7]=(u*w-f*B+d*_)*v,e[8]=(o*F-a*m+l*C)*v,e[9]=(r*m-n*F-i*C)*v,e[10]=(p*S-A*B+y*E)*v,e[11]=(h*B-u*S-d*E)*v,e[12]=(a*T-o*M-c*C)*v,e[13]=(n*M-r*T+s*C)*v,e[14]=(A*_-p*b-g*E)*v,e[15]=(u*b-h*_+f*E)*v,e):null}function S1(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],a=t[5],c=t[6],l=t[7],u=t[8],h=t[9],f=t[10],d=t[11],p=t[12],A=t[13],g=t[14],y=t[15],E=n*a-r*o,_=n*c-s*o,B=n*l-i*o,b=r*c-s*a,S=r*l-i*a,w=s*l-i*c,C=u*A-h*p,T=u*g-f*p,m=u*y-d*p,M=h*g-f*A,F=h*y-d*A,R=f*y-d*g;return e[0]=a*R-c*F+l*M,e[1]=s*F-r*R-i*M,e[2]=A*w-g*S+y*b,e[3]=f*S-h*w-d*b,e[4]=c*m-o*R-l*T,e[5]=n*R-s*m+i*T,e[6]=g*B-p*w-y*_,e[7]=u*w-f*B+d*_,e[8]=o*F-a*m+l*C,e[9]=r*m-n*F-i*C,e[10]=p*S-A*B+y*E,e[11]=h*B-u*S-d*E,e[12]=a*T-o*M-c*C,e[13]=n*M-r*T+s*C,e[14]=A*_-p*b-g*E,e[15]=u*b-h*_+f*E,e}function $o(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],a=e[6],c=e[7],l=e[8],u=e[9],h=e[10],f=e[11],d=e[12],p=e[13],A=e[14],g=e[15],y=t*o-n*i,E=t*a-r*i,_=n*a-r*o,B=l*p-u*d,b=l*A-h*d,S=u*A-h*p,w=t*S-n*b+r*B,C=i*S-o*b+a*B,T=l*_-u*E+h*y,m=d*_-p*E+A*y;return c*w-s*C+g*T-f*m}function cr(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=t[8],f=t[9],d=t[10],p=t[11],A=t[12],g=t[13],y=t[14],E=t[15],_=n[0],B=n[1],b=n[2],S=n[3];return e[0]=_*r+B*a+b*h+S*A,e[1]=_*s+B*c+b*f+S*g,e[2]=_*i+B*l+b*d+S*y,e[3]=_*o+B*u+b*p+S*E,_=n[4],B=n[5],b=n[6],S=n[7],e[4]=_*r+B*a+b*h+S*A,e[5]=_*s+B*c+b*f+S*g,e[6]=_*i+B*l+b*d+S*y,e[7]=_*o+B*u+b*p+S*E,_=n[8],B=n[9],b=n[10],S=n[11],e[8]=_*r+B*a+b*h+S*A,e[9]=_*s+B*c+b*f+S*g,e[10]=_*i+B*l+b*d+S*y,e[11]=_*o+B*u+b*p+S*E,_=n[12],B=n[13],b=n[14],S=n[15],e[12]=_*r+B*a+b*h+S*A,e[13]=_*s+B*c+b*f+S*g,e[14]=_*i+B*l+b*d+S*y,e[15]=_*o+B*u+b*p+S*E,e}function ta(e,t,n){let r=n[0],s=n[1],i=n[2],o,a,c,l,u,h,f,d,p,A,g,y;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],a=t[1],c=t[2],l=t[3],u=t[4],h=t[5],f=t[6],d=t[7],p=t[8],A=t[9],g=t[10],y=t[11],e[0]=o,e[1]=a,e[2]=c,e[3]=l,e[4]=u,e[5]=h,e[6]=f,e[7]=d,e[8]=p,e[9]=A,e[10]=g,e[11]=y,e[12]=o*r+u*s+p*i+t[12],e[13]=a*r+h*s+A*i+t[13],e[14]=c*r+f*s+g*i+t[14],e[15]=l*r+d*s+y*i+t[15]),e}function ea(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 na(e,t,n,r){let s=r[0],i=r[1],o=r[2],a=Math.sqrt(s*s+i*i+o*o),c,l,u,h,f,d,p,A,g,y,E,_,B,b,S,w,C,T,m,M,F,R,v,D;return a<1e-6?null:(a=1/a,s*=a,i*=a,o*=a,l=Math.sin(n),c=Math.cos(n),u=1-c,h=t[0],f=t[1],d=t[2],p=t[3],A=t[4],g=t[5],y=t[6],E=t[7],_=t[8],B=t[9],b=t[10],S=t[11],w=s*s*u+c,C=i*s*u+o*l,T=o*s*u-i*l,m=s*i*u-o*l,M=i*i*u+c,F=o*i*u+s*l,R=s*o*u+i*l,v=i*o*u-s*l,D=o*o*u+c,e[0]=h*w+A*C+_*T,e[1]=f*w+g*C+B*T,e[2]=d*w+y*C+b*T,e[3]=p*w+E*C+S*T,e[4]=h*m+A*M+_*F,e[5]=f*m+g*M+B*F,e[6]=d*m+y*M+b*F,e[7]=p*m+E*M+S*F,e[8]=h*R+A*v+_*D,e[9]=f*R+g*v+B*D,e[10]=d*R+y*v+b*D,e[11]=p*R+E*v+S*D,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function ra(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],a=t[6],c=t[7],l=t[8],u=t[9],h=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=i*s+l*r,e[5]=o*s+u*r,e[6]=a*s+h*r,e[7]=c*s+f*r,e[8]=l*s-i*r,e[9]=u*s-o*r,e[10]=h*s-a*r,e[11]=f*s-c*r,e}function sa(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],a=t[2],c=t[3],l=t[8],u=t[9],h=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s-l*r,e[1]=o*s-u*r,e[2]=a*s-h*r,e[3]=c*s-f*r,e[8]=i*r+l*s,e[9]=o*r+u*s,e[10]=a*r+h*s,e[11]=c*r+f*s,e}function ia(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],a=t[2],c=t[3],l=t[4],u=t[5],h=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s+l*r,e[1]=o*s+u*r,e[2]=a*s+h*r,e[3]=c*s+f*r,e[4]=l*s-i*r,e[5]=u*s-o*r,e[6]=h*s-a*r,e[7]=f*s-c*r,e}function M1(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 I1(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 w1(e,t,n){let r=n[0],s=n[1],i=n[2],o=Math.sqrt(r*r+s*s+i*i),a,c,l;return o<1e-6?null:(o=1/o,r*=o,s*=o,i*=o,c=Math.sin(t),a=Math.cos(t),l=1-a,e[0]=r*r*l+a,e[1]=s*r*l+i*c,e[2]=i*r*l-s*c,e[3]=0,e[4]=r*s*l-i*c,e[5]=s*s*l+a,e[6]=i*s*l+r*c,e[7]=0,e[8]=r*i*l+s*c,e[9]=s*i*l-r*c,e[10]=i*i*l+a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function v1(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 F1(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 R1(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 $u(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=r+r,c=s+s,l=i+i,u=r*a,h=r*c,f=r*l,d=s*c,p=s*l,A=i*l,g=o*a,y=o*c,E=o*l;return e[0]=1-(d+A),e[1]=h+E,e[2]=f-y,e[3]=0,e[4]=h-E,e[5]=1-(u+A),e[6]=p+g,e[7]=0,e[8]=f+y,e[9]=p-g,e[10]=1-(u+d),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function L1(e,t){let n=new $(3),r=-t[0],s=-t[1],i=-t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=r*r+s*s+i*i+o*o;return h>0?(n[0]=(a*o+u*r+c*i-l*s)*2/h,n[1]=(c*o+u*s+l*r-a*i)*2/h,n[2]=(l*o+u*i+a*s-c*r)*2/h):(n[0]=(a*o+u*r+c*i-l*s)*2,n[1]=(c*o+u*s+l*r-a*i)*2,n[2]=(l*o+u*i+a*s-c*r)*2),$u(e,t,n),e}function P1(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function th(e,t){let n=t[0],r=t[1],s=t[2],i=t[4],o=t[5],a=t[6],c=t[8],l=t[9],u=t[10];return e[0]=Math.sqrt(n*n+r*r+s*s),e[1]=Math.sqrt(i*i+o*o+a*a),e[2]=Math.sqrt(c*c+l*l+u*u),e}function O1(e,t){let n=new $(3);th(n,t);let r=1/n[0],s=1/n[1],i=1/n[2],o=t[0]*r,a=t[1]*s,c=t[2]*i,l=t[4]*r,u=t[5]*s,h=t[6]*i,f=t[8]*r,d=t[9]*s,p=t[10]*i,A=o+u+p,g=0;return A>0?(g=Math.sqrt(A+1)*2,e[3]=.25*g,e[0]=(h-d)/g,e[1]=(f-c)/g,e[2]=(a-l)/g):o>u&&o>p?(g=Math.sqrt(1+o-u-p)*2,e[3]=(h-d)/g,e[0]=.25*g,e[1]=(a+l)/g,e[2]=(f+c)/g):u>p?(g=Math.sqrt(1+u-o-p)*2,e[3]=(f-c)/g,e[0]=(a+l)/g,e[1]=.25*g,e[2]=(h+d)/g):(g=Math.sqrt(1+p-o-u)*2,e[3]=(a-l)/g,e[0]=(f+c)/g,e[1]=(h+d)/g,e[2]=.25*g),e}function N1(e,t,n,r){t[0]=r[12],t[1]=r[13],t[2]=r[14];let s=r[0],i=r[1],o=r[2],a=r[4],c=r[5],l=r[6],u=r[8],h=r[9],f=r[10];n[0]=Math.sqrt(s*s+i*i+o*o),n[1]=Math.sqrt(a*a+c*c+l*l),n[2]=Math.sqrt(u*u+h*h+f*f);let d=1/n[0],p=1/n[1],A=1/n[2],g=s*d,y=i*p,E=o*A,_=a*d,B=c*p,b=l*A,S=u*d,w=h*p,C=f*A,T=g+B+C,m=0;return T>0?(m=Math.sqrt(T+1)*2,e[3]=.25*m,e[0]=(b-w)/m,e[1]=(S-E)/m,e[2]=(y-_)/m):g>B&&g>C?(m=Math.sqrt(1+g-B-C)*2,e[3]=(b-w)/m,e[0]=.25*m,e[1]=(y+_)/m,e[2]=(S+E)/m):B>C?(m=Math.sqrt(1+B-g-C)*2,e[3]=(S-E)/m,e[0]=(y+_)/m,e[1]=.25*m,e[2]=(b+w)/m):(m=Math.sqrt(1+C-g-B)*2,e[3]=(y-_)/m,e[0]=(S+E)/m,e[1]=(b+w)/m,e[2]=.25*m),e}function D1(e,t,n,r){let s=t[0],i=t[1],o=t[2],a=t[3],c=s+s,l=i+i,u=o+o,h=s*c,f=s*l,d=s*u,p=i*l,A=i*u,g=o*u,y=a*c,E=a*l,_=a*u,B=r[0],b=r[1],S=r[2];return e[0]=(1-(p+g))*B,e[1]=(f+_)*B,e[2]=(d-E)*B,e[3]=0,e[4]=(f-_)*b,e[5]=(1-(h+g))*b,e[6]=(A+y)*b,e[7]=0,e[8]=(d+E)*S,e[9]=(A-y)*S,e[10]=(1-(h+p))*S,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function U1(e,t,n,r,s){let i=t[0],o=t[1],a=t[2],c=t[3],l=i+i,u=o+o,h=a+a,f=i*l,d=i*u,p=i*h,A=o*u,g=o*h,y=a*h,E=c*l,_=c*u,B=c*h,b=r[0],S=r[1],w=r[2],C=s[0],T=s[1],m=s[2],M=(1-(A+y))*b,F=(d+B)*b,R=(p-_)*b,v=(d-B)*S,D=(1-(f+y))*S,W=(g+E)*S,z=(p+_)*w,Z=(g-E)*w,X=(1-(f+A))*w;return e[0]=M,e[1]=F,e[2]=R,e[3]=0,e[4]=v,e[5]=D,e[6]=W,e[7]=0,e[8]=z,e[9]=Z,e[10]=X,e[11]=0,e[12]=n[0]+C-(M*C+v*T+z*m),e[13]=n[1]+T-(F*C+D*T+Z*m),e[14]=n[2]+m-(R*C+W*T+X*m),e[15]=1,e}function oa(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,a=r+r,c=s+s,l=n*o,u=r*o,h=r*a,f=s*o,d=s*a,p=s*c,A=i*o,g=i*a,y=i*c;return e[0]=1-h-p,e[1]=u+y,e[2]=f-g,e[3]=0,e[4]=u-y,e[5]=1-l-p,e[6]=d+A,e[7]=0,e[8]=f+g,e[9]=d-A,e[10]=1-l-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function aa(e,t,n,r,s,i,o){let a=1/(n-t),c=1/(s-r),l=1/(i-o);return e[0]=i*2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*c,e[6]=0,e[7]=0,e[8]=(n+t)*a,e[9]=(s+r)*c,e[10]=(o+i)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*l,e[15]=0,e}function eh(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 ca=eh;function G1(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 V1(e,t,n,r){let s=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),a=Math.tan(t.rightDegrees*Math.PI/180),c=2/(o+a),l=2/(s+i);return e[0]=c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=l,e[6]=0,e[7]=0,e[8]=-((o-a)*c*.5),e[9]=(s-i)*l*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function nh(e,t,n,r,s,i,o){let a=1/(t-n),c=1/(r-s),l=1/(i-o);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+n)*a,e[13]=(s+r)*c,e[14]=(o+i)*l,e[15]=1,e}var la=nh;function H1(e,t,n,r,s,i,o){let a=1/(t-n),c=1/(r-s),l=1/(i-o);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=l,e[11]=0,e[12]=(t+n)*a,e[13]=(s+r)*c,e[14]=i*l,e[15]=1,e}function ua(e,t,n,r){let s,i,o,a,c,l,u,h,f,d,p=t[0],A=t[1],g=t[2],y=r[0],E=r[1],_=r[2],B=n[0],b=n[1],S=n[2];return Math.abs(p-B)<1e-6&&Math.abs(A-b)<1e-6&&Math.abs(g-S)<1e-6?Zu(e):(h=p-B,f=A-b,d=g-S,s=1/Math.sqrt(h*h+f*f+d*d),h*=s,f*=s,d*=s,i=E*d-_*f,o=_*h-y*d,a=y*f-E*h,s=Math.sqrt(i*i+o*o+a*a),s?(s=1/s,i*=s,o*=s,a*=s):(i=0,o=0,a=0),c=f*a-d*o,l=d*i-h*a,u=h*o-f*i,s=Math.sqrt(c*c+l*l+u*u),s?(s=1/s,c*=s,l*=s,u*=s):(c=0,l=0,u=0),e[0]=i,e[1]=c,e[2]=h,e[3]=0,e[4]=o,e[5]=l,e[6]=f,e[7]=0,e[8]=a,e[9]=u,e[10]=d,e[11]=0,e[12]=-(i*p+o*A+a*g),e[13]=-(c*p+l*A+u*g),e[14]=-(h*p+f*A+d*g),e[15]=1,e)}function z1(e,t,n,r){let s=t[0],i=t[1],o=t[2],a=r[0],c=r[1],l=r[2],u=s-n[0],h=i-n[1],f=o-n[2],d=u*u+h*h+f*f;d>0&&(d=1/Math.sqrt(d),u*=d,h*=d,f*=d);let p=c*f-l*h,A=l*u-a*f,g=a*h-c*u;return d=p*p+A*A+g*g,d>0&&(d=1/Math.sqrt(d),p*=d,A*=d,g*=d),e[0]=p,e[1]=A,e[2]=g,e[3]=0,e[4]=h*g-f*A,e[5]=f*p-u*g,e[6]=u*A-h*p,e[7]=0,e[8]=u,e[9]=h,e[10]=f,e[11]=0,e[12]=s,e[13]=i,e[14]=o,e[15]=1,e}function k1(e){return"mat4(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(e[3],", ").concat(e[4],", ").concat(e[5],", ").concat(e[6],", ").concat(e[7],", ").concat(e[8],", ").concat(e[9],", ").concat(e[10],", ").concat(e[11],", ").concat(e[12],", ").concat(e[13],", ").concat(e[14],", ").concat(e[15],")")}function J1(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8]+e[9]*e[9]+e[10]*e[10]+e[11]*e[11]+e[12]*e[12]+e[13]*e[13]+e[14]*e[14]+e[15]*e[15])}function q1(e,t,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 rh(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 j1(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 X1(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 W1(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function Y1(e,t){let n=e[0],r=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],f=e[10],d=e[11],p=e[12],A=e[13],g=e[14],y=e[15],E=t[0],_=t[1],B=t[2],b=t[3],S=t[4],w=t[5],C=t[6],T=t[7],m=t[8],M=t[9],F=t[10],R=t[11],v=t[12],D=t[13],W=t[14],z=t[15];return Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(r-_)<=1e-6*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(s-B)<=1e-6*Math.max(1,Math.abs(s),Math.abs(B))&&Math.abs(i-b)<=1e-6*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(o-S)<=1e-6*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(a-w)<=1e-6*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(c-C)<=1e-6*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(l-T)<=1e-6*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(u-m)<=1e-6*Math.max(1,Math.abs(u),Math.abs(m))&&Math.abs(h-M)<=1e-6*Math.max(1,Math.abs(h),Math.abs(M))&&Math.abs(f-F)<=1e-6*Math.max(1,Math.abs(f),Math.abs(F))&&Math.abs(d-R)<=1e-6*Math.max(1,Math.abs(d),Math.abs(R))&&Math.abs(p-v)<=1e-6*Math.max(1,Math.abs(p),Math.abs(v))&&Math.abs(A-D)<=1e-6*Math.max(1,Math.abs(A),Math.abs(D))&&Math.abs(g-W)<=1e-6*Math.max(1,Math.abs(g),Math.abs(W))&&Math.abs(y-z)<=1e-6*Math.max(1,Math.abs(y),Math.abs(z))}var K1=cr,Q1=rh;function Z1(){let e=new $(4);return $!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function sh(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 ih(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 oh(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 ah(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function ch(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 lh(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function uh(e,t,n,r){let s=t[0],i=t[1],o=t[2],a=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=a+r*(n[3]-a),e}function hh(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 fh(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],a=n[1],c=n[2],l=n[3],u=l*r+a*i-c*s,h=l*s+c*r-o*i,f=l*i+o*s-a*r,d=-o*r-a*s-c*i;return e[0]=u*l+d*-o+h*-c-f*-a,e[1]=h*l+d*-a+f*-o-u*-c,e[2]=f*l+d*-c+u*-a-h*-o,e[3]=t[3],e}var J2=function(){let e=Z1();return function(t,n,r,s,i,o){let a,c;for(n||(n=4),r||(r=0),s?c=Math.min(s*n+r,t.length):c=t.length,a=r;a<c;a+=n)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],e[3]=t[a+3],i(e,e,o),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2],t[a+3]=e[3];return t}}();var da;(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"})(da||(da={}));var tx=45*Math.PI/180,ex=1,ha=.1,fa=500,nx=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),P=class extends Tn{static get IDENTITY(){return sx()}static get ZERO(){return rx()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return da}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,n,r,s,i,o,a,c,l,u,h,f,d,p,A,g){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=l,this[9]=u,this[10]=h,this[11]=f,this[12]=d,this[13]=p,this[14]=A,this[15]=g,this.check()}setRowMajor(t,n,r,s,i,o,a,c,l,u,h,f,d,p,A,g){return this[0]=t,this[1]=i,this[2]=l,this[3]=d,this[4]=n,this[5]=o,this[6]=u,this[7]=p,this[8]=r,this[9]=a,this[10]=h,this[11]=A,this[12]=s,this[13]=c,this[14]=f,this[15]=g,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(nx)}fromObject(t){return this.check()}fromQuaternion(t){return oa(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=ha,far:a=fa}=t;return a===1/0?ix(this,n,r,s,i,o):aa(this,n,r,s,i,o,a),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return ua(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=ha,far:a=fa}=t;return la(this,n,r,s,i,o,a),this.check()}orthographic(t){let{fovy:n=tx,aspect:r=ex,focalDistance:s=1,near:i=ha,far:o=fa}=t;dh(n);let a=n/2,c=s*Math.tan(a),l=c*r;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return dh(n),ca(this,n,r,s,i),this.check()}determinant(){return $o(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 Qo(this,this),this.check()}invert(){return Zo(this,this),this.check()}multiplyLeft(t){return cr(this,t,this),this.check()}multiplyRight(t){return cr(this,this,t),this.check()}rotateX(t){return ra(this,this,t),this.check()}rotateY(t){return sa(this,this,t),this.check()}rotateZ(t){return ia(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return na(this,this,t,n),this.check()}scale(t){return ea(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return ta(this,this,t),this.check()}transform(t,n){return t.length===4?(n=hh(n||[-0,-0,-0,-0],t,this),Be(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=ds(n||[-0,-0],t,this);break;case 3:s=ze(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Be(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=ps(n||[-0,-0],t,this);break;case 3:r=ms(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Be(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])}},Cs,bs;function rx(){return Cs||(Cs=new P([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Cs)),Cs}function sx(){return bs||(bs=new P,Object.freeze(bs)),bs}function dh(e){if(e>Math.PI*2)throw Error("expected radians")}function ix(e,t,n,r,s,i){let o=2*i/(n-t),a=2*i/(s-r),c=(n+t)/(n-t),l=(s+r)/(s-r),u=-1,h=-1,f=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=h,e[12]=0,e[13]=0,e[14]=f,e[15]=0,e}function ph(){let e=new $(4);return $!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function mh(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function pa(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 ma(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=n[0],c=n[1],l=n[2],u=n[3];return e[0]=r*u+o*a+s*l-i*c,e[1]=s*u+o*c+i*a-r*l,e[2]=i*u+o*l+r*c-s*a,e[3]=o*u-r*a-s*c-i*l,e}function gh(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(n),c=Math.cos(n);return e[0]=r*c+o*a,e[1]=s*c+i*a,e[2]=i*c-s*a,e[3]=o*c-r*a,e}function Ah(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(n),c=Math.cos(n);return e[0]=r*c-i*a,e[1]=s*c+o*a,e[2]=i*c+r*a,e[3]=o*c-s*a,e}function xh(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(n),c=Math.cos(n);return e[0]=r*c+s*a,e[1]=s*c-r*a,e[2]=i*c+o*a,e[3]=o*c-i*a,e}function yh(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 lr(e,t,n,r){let s=t[0],i=t[1],o=t[2],a=t[3],c=n[0],l=n[1],u=n[2],h=n[3],f,d,p,A,g;return f=s*c+i*l+o*u+a*h,f<0&&(f=-f,c=-c,l=-l,u=-u,h=-h),1-f>1e-6?(d=Math.acos(f),g=Math.sin(d),p=Math.sin((1-r)*d)/g,A=Math.sin(r*d)/g):(p=1-r,A=r),e[0]=p*s+A*c,e[1]=p*i+A*l,e[2]=p*o+A*u,e[3]=p*a+A*h,e}function Th(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,a=o?1/o:0;return e[0]=-n*a,e[1]=-r*a,e[2]=-s*a,e[3]=i*a,e}function _h(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function ga(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 Eh=sh;var Bh=ih,Ch=lh,bh=uh,Sh=oh;var Mh=ah;var Ih=ch;var wh=function(){let e=As(),t=xs(1,0,0),n=xs(0,1,0);return function(r,s,i){let o=ir(s,i);return o<-.999999?(He(e,t,s),jo(e)<1e-6&&He(e,n,s),Ho(e,e),pa(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(He(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,Ih(r,r))}}(),sw=function(){let e=ph(),t=ph();return function(n,r,s,i,o,a){return lr(e,r,o,a),lr(t,s,i,a),lr(n,e,t,2*a*(1-a)),n}}(),iw=function(){let e=qu();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],Ih(t,ga(t,e))}}();var ox=[0,0,0,1],Zt=class extends Ee{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 ga(this,t),this.check()}fromAxisRotation(t,n){return pa(this,t,n),this.check()}identity(){return mh(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]=G(t)}get y(){return this[1]}set y(t){this[1]=G(t)}get z(){return this[2]}set z(t){this[2]=G(t)}get w(){return this[3]}set w(t){this[3]=G(t)}len(){return Sh(this)}lengthSquared(){return Mh(this)}dot(t){return Ch(this,t)}rotationTo(t,n){return wh(this,t,n),this.check()}add(t){return Eh(this,this,t),this.check()}calculateW(){return yh(this,this),this.check()}conjugate(){return _h(this,this),this.check()}invert(){return Th(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(bh(this,t,n,r),this.check())}multiplyRight(t){return ma(this,this,t),this.check()}multiplyLeft(t){return ma(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 gh(this,this,t),this.check()}rotateY(t){return Ah(this,this,t),this.check()}rotateZ(t){return xh(this,this,t),this.check()}scale(t){return Bh(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=ox,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return lr(this,s,i,o),this.check()}transformVector4(t,n=new yn){return fh(n,t,this),Be(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 Gt={};ut(Gt,{EPSILON1:()=>ax,EPSILON10:()=>gx,EPSILON11:()=>Ax,EPSILON12:()=>xx,EPSILON13:()=>yx,EPSILON14:()=>Tx,EPSILON15:()=>_x,EPSILON16:()=>Ex,EPSILON17:()=>Bx,EPSILON18:()=>Cx,EPSILON19:()=>bx,EPSILON2:()=>cx,EPSILON20:()=>Sx,EPSILON3:()=>lx,EPSILON4:()=>ux,EPSILON5:()=>hx,EPSILON6:()=>fx,EPSILON7:()=>dx,EPSILON8:()=>px,EPSILON9:()=>mx,PI_OVER_FOUR:()=>Ix,PI_OVER_SIX:()=>wx,PI_OVER_TWO:()=>Mx,TWO_PI:()=>vx});var ax=.1,cx=.01,lx=.001,ux=1e-4,hx=1e-5,fx=1e-6,dx=1e-7,px=1e-8,mx=1e-9,gx=1e-10,Ax=1e-11,xx=1e-12,yx=1e-13,Tx=1e-14,_x=1e-15,Ex=1e-16,Bx=1e-17,Cx=1e-18,bx=1e-19,Sx=1e-20,Mx=Math.PI/2,Ix=Math.PI/4,wx=Math.PI/6,vx=Math.PI*2;function Ss(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var Vt=Math.PI,Lh=Vt/4,vh=Vt/180,Fh=180/Vt,Ms=512;function oe(e){let[t,n]=e;Ss(Number.isFinite(t)),Ss(Number.isFinite(n)&&n>=-90&&n<=90,"invalid latitude");let r=t*vh,s=n*vh,i=Ms*(r+Vt)/(2*Vt),o=Ms*(Vt+Math.log(Math.tan(Lh+s*.5)))/(2*Vt);return[i,o]}function ae(e){let[t,n]=e,r=t/Ms*(2*Vt)-Vt,s=2*(Math.atan(Math.exp(n/Ms*(2*Vt)-Vt))-Lh);return[r*Fh,s*Fh]}var zw=Math.PI/180;var Oh=6378137*Math.PI;function Aa(e){let t=oe(e);return t[0]=(t[0]/256-1)*Oh,t[1]=(t[1]/256-1)*Oh,t}var jx={id:"imagery-layer",data:"",serviceType:"auto",srs:"auto",layers:{type:"array",compare:!0,value:[]},onMetadataLoad:{type:"function",value:()=>{}},onMetadataLoadError:{type:"function",value:console.error},onImageLoadStart:{type:"function",value:()=>{}},onImageLoad:{type:"function",value:()=>{}},onImageLoadError:{type:"function",compare:!1,value:(e,t)=>console.error(t,e)}},ws=class extends ke.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,ke._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 Nh.BitmapLayer({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:r.srs==="EPSG:4326"?ke.COORDINATE_SYSTEM.LNGLAT:ke.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 vt)return t.data;if(typeof t.data=="string")return No({url:t.data,loadOptions:t.loadOptions,type:t.serviceType});throw new Error("invalid image source in props.data")}async _loadMetadata(){let{imageSource:t}=this.state;try{this.state.loadCounter++;let n=await t.getMetadata();this.state.imageSource===t&&this.getCurrentLayer()?.props.onMetadataLoad(n)}catch(n){this.getCurrentLayer()?.props.onMetadataLoadError(n)}finally{this.state.loadCounter--}}async loadImage(t,n){let{layers:r,serviceType:s}=this.props;if(s==="wms"&&r.length===0)return;let i=t.getBounds(),{width:o,height:a}=t,c=this.getRequestId(),{srs:l}=this.props;l==="auto"&&(l=t.resolution?"EPSG:4326":"EPSG:3857");let u={width:o,height:a,boundingBox:[[i[0],i[1]],[i[2],i[3]]],layers:r,crs:l};if(l==="EPSG:3857"){let h=Aa([i[0],i[1]]),f=Aa([i[2],i[3]]);u.boundingBox=[h,f]}try{this.state.loadCounter++,this.props.onImageLoadStart(c);let h=await this.state.imageSource.getImage(u);this.state.lastRequestId<c&&(this.getCurrentLayer()?.props.onImageLoad(c),this.setState({image:h,bounds:i,lastRequestParameters:u,lastRequestId:c}))}catch(h){this.raiseError(h,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(c,h)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(t,n=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>t(),n)}},Is=ws;(()=>{ws.layerName="WMSLayer"})(),(()=>{ws.defaultProps=jx})();var Dh=N(Dt(),1),Xx={getHeight:{type:"accessor",value:0},greatCircle:!0},vs=class extends Dh.ArcLayer{},ur=vs;(()=>{vs.layerName="GreatCircleLayer"})(),(()=>{vs.defaultProps=Xx})();var Uh=N(Ut(),1),xa=N(Dt(),1),Wx={...xa.PolygonLayer.defaultProps},Fs=class extends Uh.CompositeLayer{indexToBounds(){return null}renderLayers(){let{elevationScale:t,extruded:n,wireframe:r,filled:s,stroked:i,lineWidthUnits:o,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:u,lineMiterLimit:h,lineDashJustified:f,getElevation:d,getFillColor:p,getLineColor:A,getLineWidth:g}=this.props,{updateTriggers:y,material:E,transitions:_}=this.props,B=this.getSubLayerClass("cell",xa.PolygonLayer),{updateTriggers:b,...S}=this.indexToBounds()||{};return new B({filled:s,wireframe:r,extruded:n,elevationScale:t,stroked:i,lineWidthUnits:o,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:u,lineMiterLimit:h,lineDashJustified:f,material:E,transitions:_,getElevation:d,getFillColor:p,getLineColor:A,getLineWidth:g},this.getSubLayerProps({id:"cell",updateTriggers:y&&{...b,getElevation:y.getElevation,getFillColor:y.getFillColor,getLineColor:y.getLineColor,getLineWidth:y.getLineWidth}}),S)}},It=Fs;(()=>{Fs.layerName="GeoCellLayer"})(),(()=>{Fs.defaultProps=Wx})();var Rs=N(ya(),1),Yx=3,Kx=30,Qx=2*Kx+1,Vh=180/Math.PI;function zh(e,t,n){let r=1<<t;return[(e[0]+n[0])/r,(e[1]+n[1])/r]}function Hh(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function kh(e){return[Hh(e[0]),Hh(e[1])]}function Jh(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 qh([e,t,n]){let r=Math.atan2(n,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*Vh,r*Vh]}function jh(e){let t=Rs.default.fromString(e,!0,10).toString(2);for(;t.length<Yx+Qx;)t="0"+t;let n=t.lastIndexOf("1"),r=t.substring(0,3),s=t.substring(3,n),i=s.length/2,o=Rs.default.fromString(r,!0,2).toString(10),a=Rs.default.fromString(s,!0,2).toString(4);for(;a.length<i;)a="0"+a;return`${o}/${a}`}function Zx(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 Xh(e){let t=e.split("/"),n=parseInt(t[0],10),r=t[1],s=r.length,i=[0,0],o;for(let a=s-1;a>=0;a--){o=s-a;let c=r[a],l=0,u=0;c==="1"?u=1:c==="2"?(l=1,u=1):c==="3"&&(l=1);let h=Math.pow(2,o-1);Zx(h,i,l,u),i[0]+=h*l,i[1]+=h*u}if(n%2===1){let a=i[0];i[0]=i[1],i[1]=a}return{face:n,ij:i,level:o}}var Wh=N(ya(),1);function $x(e){let t=e.padEnd(16,"0");return Wh.default.fromString(t,16)}var ty=100;function ey({face:e,ij:t,level:n}){let r=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(ty*Math.pow(2,-n))),i=new Float64Array(4*s*2+2),o=0,a=0;for(let c=0;c<4;c++){let l=r[c].slice(0),u=r[c+1],h=(u[0]-l[0])/s,f=(u[1]-l[1])/s;for(let d=0;d<s;d++){l[0]+=h,l[1]+=f;let p=zh(t,n,l),A=kh(p),g=Jh(e,A),y=qh(g);Math.abs(y[1])>89.999&&(y[0]=a);let E=y[0]-a;y[0]+=E>180?-360:E<-180?360:0,i[o++]=y[0],i[o++]=y[1],a=y[0]}}return i[o++]=i[0],i[o++]=i[1],i}function ny(e){if(typeof e=="string"){if(e.indexOf("/")>0)return e;e=$x(e)}return jh(e.toString())}function Yh(e){let t=ny(e),n=Xh(t);return ey(n)}var ry={getS2Token:{type:"accessor",value:e=>e.token}},Ls=class extends It{indexToBounds(){let{data:t,getS2Token:n}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(r,s)=>Yh(n(r,s))}}},fr=Ls;(()=>{Ls.layerName="S2Layer"})(),(()=>{Ls.defaultProps=ry})();var Ta=512;function sy(e,t){let n=0,r=0,s=1<<e.length,i=s/Ta;for(let o=0;o<e.length;o++){s>>=1;let a=parseInt(e[o]);a%2&&(n|=s),a>1&&(r|=s)}return[[n/i,Ta-r/i],[(n+t)/i,Ta-(r+t)/i]]}function Kh(e,t=1){let[n,r]=sy(e,t),[s,i]=ae(n),[o,a]=ae(r);return[o,i,o,a,s,a,s,i,o,i]}var iy={getQuadkey:{type:"accessor",value:e=>e.quadkey}},Ps=class extends It{indexToBounds(){let{data:t,extruded:n,getQuadkey:r}=this.props,s=n?.99:1;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(i,o)=>Kh(r(i,o),s),updateTriggers:{getPolygon:s}}}},dr=Ps;(()=>{Ps.layerName="QuadkeyLayer"})(),(()=>{Ps.defaultProps=iy})();var zs=N(Ut(),1),mf=N(Dt(),1);var Je=class{constructor(t){this.index=t,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(t){this._bbox||(this._bbox=t,"west"in t?this.boundingBox=[[t.west,t.south],[t.east,t.north]]:this.boundingBox=[[t.left,t.top],[t.right,t.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error("byteLength not defined in tile data"),t}async _loadData({getData:t,requestScheduler:n,onLoad:r,onError:s}){let{index:i,id:o,bbox:a,userData:c,zoom:l}=this,u=this._loaderId;this._abortController=new AbortController;let{signal:h}=this._abortController,f=await n.scheduleRequest(this,A=>A.isSelected?1:-1);if(!f){this._isCancelled=!0;return}if(this._isCancelled){f.done();return}let d=null,p;try{d=await t({index:i,id:o,bbox:a,userData:c,zoom:l,signal:h})}catch(A){p=A||!0}finally{f.done()}if(u===this._loaderId){if(this._loader=void 0,this.content=d,this._isCancelled&&!d){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,p?s(p,this):r(this)}}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var gr=N(Ut(),1);var rt={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var Qh=new x,oy=new x,be=class{constructor(t=[0,0,0],n=[0,0,0],r){L(this,"center",void 0),L(this,"halfDiagonal",void 0),L(this,"minimum",void 0),L(this,"maximum",void 0),r=r||Qh.copy(t).add(n).scale(.5),this.center=new x(r),this.halfDiagonal=new x(n).subtract(this.center),this.minimum=new x(t),this.maximum=new x(n)}clone(){return new be(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=oy.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?rt.INSIDE:i+s<0?rt.OUTSIDE:rt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=Qh.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 pr=new x,Zh=new x,Ft=class{constructor(t=[0,0,0],n=0){L(this,"center",void 0),L(this,"radius",void 0),this.radius=-0,this.center=new x,this.fromCenterRadius(t,n)}fromCenterRadius(t,n){return this.center.from(t),this.radius=n,this}fromCornerPoints(t,n){return n=pr.from(n),this.center=new x().from(t).add(n).scale(.5),this.radius=this.center.distance(n),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new Ft(this.center,this.radius)}union(t){let n=this.center,r=this.radius,s=t.center,i=t.radius,o=pr.copy(s).subtract(n),a=o.magnitude();if(r>=a+i)return this.clone();if(i>=a+r)return t.clone();let c=(r+a+i)*.5;return Zh.copy(o).scale((-r+c)/a).add(n),this.center.copy(Zh),this.radius=c,this}expand(t){let r=pr.from(t).subtract(this.center).magnitude();return r>this.radius&&(this.radius=r),this}transform(t){this.center.transform(t);let n=Bs.getScaling(pr,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=pr.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?rt.OUTSIDE:i<r?rt.INTERSECTING:rt.INSIDE}};var ay=new x,cy=new x,Os=new x,Ns=new x,Ds=new x,ly=new x,uy=new x,ce={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Ht=class{constructor(t=[0,0,0],n=[0,0,0,0,0,0,0,0,0]){L(this,"center",void 0),L(this,"halfAxes",void 0),this.center=new x().from(t),this.halfAxes=new k(n)}get halfSize(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new x(t).len(),new x(n).len(),new x(r).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),s=new x(t).normalize(),i=new x(n).normalize(),o=new x(r).normalize();return new Zt().fromMatrix3(new k([...s,...i,...o]))}fromCenterHalfSizeQuaternion(t,n,r){let s=new Zt(r),i=new k().fromQuaternion(s);return i[0]=i[0]*n[0],i[1]=i[1]*n[0],i[2]=i[2]*n[0],i[3]=i[3]*n[1],i[4]=i[4]*n[1],i[5]=i[5]*n[1],i[6]=i[6]*n[2],i[7]=i[7]*n[2],i[8]=i[8]*n[2],this.center=new x().from(t),this.halfAxes=i,this}clone(){return new Ht(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new Ft){let n=this.halfAxes,r=n.getColumn(0,Os),s=n.getColumn(1,Ns),i=n.getColumn(2,Ds),o=ay.copy(r).add(s).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let n=this.center,r=t.normal,s=this.halfAxes,i=r.x,o=r.y,a=r.z,c=Math.abs(i*s[ce.COLUMN0ROW0]+o*s[ce.COLUMN0ROW1]+a*s[ce.COLUMN0ROW2])+Math.abs(i*s[ce.COLUMN1ROW0]+o*s[ce.COLUMN1ROW1]+a*s[ce.COLUMN1ROW2])+Math.abs(i*s[ce.COLUMN2ROW0]+o*s[ce.COLUMN2ROW1]+a*s[ce.COLUMN2ROW2]),l=r.dot(n)+t.distance;return l<=-c?rt.OUTSIDE:l>=c?rt.INSIDE:rt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=cy.from(t).subtract(this.center),r=this.halfAxes,s=r.getColumn(0,Os),i=r.getColumn(1,Ns),o=r.getColumn(2,Ds),a=s.magnitude(),c=i.magnitude(),l=o.magnitude();s.normalize(),i.normalize(),o.normalize();let u=0,h;return h=Math.abs(n.dot(s))-a,h>0&&(u+=h*h),h=Math.abs(n.dot(i))-c,h>0&&(u+=h*h),h=Math.abs(n.dot(o))-l,h>0&&(u+=h*h),u}computePlaneDistances(t,n,r=[-0,-0]){let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=this.center,a=this.halfAxes,c=a.getColumn(0,Os),l=a.getColumn(1,Ns),u=a.getColumn(2,Ds),h=ly.copy(c).add(l).add(u).add(o),f=uy.copy(h).subtract(t),d=n.dot(f);return s=Math.min(d,s),i=Math.max(d,i),h.copy(o).add(c).add(l).subtract(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),h.copy(o).add(c).subtract(l).add(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),h.copy(o).add(c).subtract(l).subtract(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),o.copy(h).subtract(c).add(l).add(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),o.copy(h).subtract(c).add(l).subtract(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),o.copy(h).subtract(c).subtract(l).add(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),o.copy(h).subtract(c).subtract(l).subtract(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),r[0]=s,r[1]=i,r}transform(t){this.center.transformAsPoint(t);let n=this.halfAxes.getColumn(0,Os);n.transformAsPoint(t);let r=this.halfAxes.getColumn(1,Ns);r.transformAsPoint(t);let s=this.halfAxes.getColumn(2,Ds);return s.transformAsPoint(t),this.halfAxes=new k([...n,...r,...s]),this}getTransform(){throw new Error("not implemented")}};var $h=new x,tf=new x,lt=class{constructor(t=[0,0,1],n=0){L(this,"normal",void 0),L(this,"distance",void 0),this.normal=new x,this.distance=-0,this.fromNormalDistance(t,n)}fromNormalDistance(t,n){return ct(Number.isFinite(n)),this.normal.from(t).normalize(),this.distance=n,this}fromPointNormal(t,n){t=$h.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),ct(gt(this.normal.len(),1)),this.distance=s,this}clone(){return new lt(this.normal,this.distance)}equals(t){return gt(this.distance,t.distance)&>(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let n=tf.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=$h.from(t),s=this.getPointDistance(r),i=tf.copy(this.normal).scale(s);return r.subtract(i).to(n)}};var ef=[new x([1,0,0]),new x([0,1,0]),new x([0,0,1])],nf=new x,hy=new x,ot=class{constructor(t=[]){L(this,"planes",void 0),this.planes=t}fromBoundingSphere(t){this.planes.length=2*ef.length;let n=t.center,r=t.radius,s=0;for(let i of ef){let o=this.planes[s],a=this.planes[s+1];o||(o=this.planes[s]=new lt),a||(a=this.planes[s+1]=new lt);let c=nf.copy(i).scale(-r).add(n);o.fromPointNormal(c,i);let l=nf.copy(i).scale(r).add(n),u=hy.copy(i).negate();a.fromPointNormal(l,u),s+=2}return this}computeVisibility(t){let n=rt.INSIDE;for(let r of this.planes)switch(t.intersectPlane(r)){case rt.OUTSIDE:return rt.OUTSIDE;case rt.INTERSECTING:n=rt.INTERSECTING;break;default:}return n}computeVisibilityWithPlaneMask(t,n){if(ct(Number.isFinite(n),"parentPlaneMask is required."),n===ot.MASK_OUTSIDE||n===ot.MASK_INSIDE)return n;let r=ot.MASK_INSIDE,s=this.planes;for(let i=0;i<this.planes.length;++i){let o=i<31?1<<i:0;if(i<31&&!(n&o))continue;let a=s[i],c=t.intersectPlane(a);if(c===rt.OUTSIDE)return ot.MASK_OUTSIDE;c===rt.INTERSECTING&&(r|=o)}return r}};L(ot,"MASK_OUTSIDE",4294967295);L(ot,"MASK_INSIDE",0);L(ot,"MASK_INDETERMINATE",2147483647);var fF=new x,dF=new x,pF=new x,mF=new x,gF=new x;var BF=new x,CF=new x,bF=new x,SF=new x,MF=new x,IF=new x,wF=new x,vF=new x,FF=new x,RF=new x,LF=new x,PF=new x;var $t=new k,dy=new k,py=new k,Us=new k,rf=new k;function Ba(e,t={}){let n=Gt.EPSILON20,r=10,s=0,i=0,o=dy,a=py;o.identity(),a.copy(e);let c=n*my(a);for(;i<r&&gy(a)>c;)Ay(a,Us),rf.copy(Us).transpose(),a.multiplyRight(Us),a.multiplyLeft(rf),o.multiplyRight(Us),++s>2&&(++i,s=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=a.toTarget(t.diagonal),t}function my(e){let t=0;for(let n=0;n<9;++n){let r=e[n];t+=r*r}return Math.sqrt(t)}var _a=[1,0,0],Ea=[2,2,1];function gy(e){let t=0;for(let n=0;n<3;++n){let r=e[$t.getElementIndex(Ea[n],_a[n])];t+=2*r*r}return Math.sqrt(t)}function Ay(e,t){let n=Gt.EPSILON15,r=0,s=1;for(let l=0;l<3;++l){let u=Math.abs(e[$t.getElementIndex(Ea[l],_a[l])]);u>r&&(s=l,r=u)}let i=_a[s],o=Ea[s],a=1,c=0;if(Math.abs(e[$t.getElementIndex(o,i)])>n){let l=e[$t.getElementIndex(o,o)],u=e[$t.getElementIndex(i,i)],h=e[$t.getElementIndex(o,i)],f=(l-u)/2/h,d;f<0?d=-1/(-f+Math.sqrt(1+f*f)):d=1/(f+Math.sqrt(1+f*f)),a=1/Math.sqrt(1+d*d),c=d*a}return k.IDENTITY.to(t),t[$t.getElementIndex(i,i)]=t[$t.getElementIndex(o,o)]=a,t[$t.getElementIndex(o,i)]=c,t[$t.getElementIndex(i,o)]=-c,t}var Se=new x,xy=new x,yy=new x,Ty=new x,_y=new x,Ey=new k,By={diagonal:new k,unitary:new k};function mr(e,t=new Ht){if(!e||e.length===0)return t.halfAxes=new k([0,0,0,0,0,0,0,0,0]),t.center=new x,t;let n=e.length,r=new x(0,0,0);for(let T of e)r.add(T);let s=1/n;r.multiplyByScalar(s);let i=0,o=0,a=0,c=0,l=0,u=0;for(let T of e){let m=Se.copy(T).subtract(r);i+=m.x*m.x,o+=m.x*m.y,a+=m.x*m.z,c+=m.y*m.y,l+=m.y*m.z,u+=m.z*m.z}i*=s,o*=s,a*=s,c*=s,l*=s,u*=s;let h=Ey;h[0]=i,h[1]=o,h[2]=a,h[3]=o,h[4]=c,h[5]=l,h[6]=a,h[7]=l,h[8]=u;let{unitary:f}=Ba(h,By),d=t.halfAxes.copy(f),p=d.getColumn(0,yy),A=d.getColumn(1,Ty),g=d.getColumn(2,_y),y=-Number.MAX_VALUE,E=-Number.MAX_VALUE,_=-Number.MAX_VALUE,B=Number.MAX_VALUE,b=Number.MAX_VALUE,S=Number.MAX_VALUE;for(let T of e)Se.copy(T),y=Math.max(Se.dot(p),y),E=Math.max(Se.dot(A),E),_=Math.max(Se.dot(g),_),B=Math.min(Se.dot(p),B),b=Math.min(Se.dot(A),b),S=Math.min(Se.dot(g),S);p=p.multiplyByScalar(.5*(B+y)),A=A.multiplyByScalar(.5*(b+E)),g=g.multiplyByScalar(.5*(S+_)),t.center.copy(p).add(A).add(g);let w=xy.set(y-B,E-b,_-S).multiplyByScalar(.5),C=new k([w[0],0,0,0,w[1],0,0,0,w[2]]);return t.halfAxes.multiplyRight(C),t}var _n=512,sf=3,of=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],af=of.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),Cy=af.concat([[.25,.5],[.75,.5]]),Me=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 Me(t,n,r),new Me(t,n+1,r),new Me(t+1,n,r),new Me(t+1,n+1,r)]}return this._children}update(t){let{viewport:n,cullingVolume:r,elevationBounds:s,minZ:i,maxZ:o,bounds:a,offset:c,project:l}=t,u=this.getBoundingVolume(s,c,l);if(a&&!this.insideBounds(a)||r.computeVisibility(u)<0)return!1;if(!this.childVisible){let{z:f}=this;if(f<o&&f>=i){let d=u.distanceTo(n.cameraPosition)*n.scale/n.height;f+=Math.floor(Math.log2(d))}if(f>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let f of this.children)f.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(let n of this._children)n.getSelected(t);return t}insideBounds([t,n,r,s]){let i=Math.pow(2,this.z),o=_n/i;return this.x*o<r&&this.y*o<s&&(this.x+1)*o>t&&(this.y+1)*o>n}getBoundingVolume(t,n,r){if(r){let c=this.z<1?Cy:this.z<2?af:of,l=[];for(let u of c){let h=Gs(this.x+u[0],this.y+u[1],this.z);h[2]=t[0],l.push(r(h)),t[0]!==t[1]&&(h[2]=t[1],l.push(r(h)))}return mr(l)}let s=Math.pow(2,this.z),i=_n/s,o=this.x*i+n*_n,a=_n-(this.y+1)*i;return new be([o,a,t[0]],[o+i,a+i,t[1]])}};function cf(e,t,n,r){let s=e instanceof gr._GlobeViewport&&e.resolution?e.projectPosition:null,i=Object.values(e.getFrustumPlanes()).map(({normal:d,distance:p})=>new lt(d.clone().negate(),p)),o=new ot(i),a=e.distanceScales.unitsPerMeter[2],c=n&&n[0]*a||0,l=n&&n[1]*a||0,u=e instanceof gr.WebMercatorViewport&&e.pitch<=60?t:0;if(r){let[d,p,A,g]=r,y=oe([d,g]),E=oe([A,p]);r=[y[0],_n-y[1],E[0],_n-E[1]]}let h=new Me(0,0,0),f={viewport:e,project:s,cullingVolume:o,elevationBounds:[c,l],minZ:u,maxZ:t,bounds:r,offset:0};if(h.update(f),e instanceof gr.WebMercatorViewport&&e.subViewports&&e.subViewports.length>1){for(f.offset=-1;h.update(f)&&!(--f.offset<-sf););for(f.offset=1;h.update(f)&&!(++f.offset>sf););}return h.getSelected()}var le=512,by=[-1/0,-1/0,1/0,1/0],Ie={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 uf(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 Sy(e){return Math.abs(e.split("").reduce((t,n)=>(t<<5)-t+n.charCodeAt(0)|0,0))}function te(e,t){if(!e||!e.length)return null;let{index:n,id:r}=t;if(Array.isArray(e)){let i=Sy(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 My(e,t,n){let r;if(t&&t.length===2){let[s,i]=t,o=e.getBounds({z:s}),a=e.getBounds({z:i});r=[Math.min(o[0],a[0]),Math.min(o[1],a[1]),Math.max(o[2],a[2]),Math.max(o[3],a[3])]}else r=e.getBounds();return e.isGeospatial?[Math.max(r[0],n[0]),Math.max(r[1],n[1]),Math.min(r[2],n[2]),Math.min(r[3],n[3])]:[Math.max(Math.min(r[0],n[2]),n[0]),Math.max(Math.min(r[1],n[3]),n[1]),Math.min(Math.max(r[2],n[0]),n[2]),Math.min(Math.max(r[3],n[1]),n[3])]}function hf({viewport:e,z:t,cullRect:n}){return(e.subViewports||[e]).map(s=>Ca(s,t||0,n))}function Ca(e,t,n){if(!Array.isArray(t)){let i=n.x-e.x,o=n.y-e.y,{width:a,height:c}=n,l={targetZ:t},u=e.unproject([i,o],l),h=e.unproject([i+a,o],l),f=e.unproject([i,o+c],l),d=e.unproject([i+a,o+c],l);return[Math.min(u[0],h[0],f[0],d[0]),Math.min(u[1],h[1],f[1],d[1]),Math.max(u[0],h[0],f[0],d[0]),Math.max(u[1],h[1],f[1],d[1])]}let r=Ca(e,t[0],n),s=Ca(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 Iy(e,t,n){return n?uf(e,n).map(s=>s*t/le):e.map(r=>r*t/le)}function ba(e,t){return Math.pow(2,e)*le/t}function Gs(e,t,n){let r=ba(n,le),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 lf(e,t,n,r){let s=ba(n,r);return[e/s*le,t/s*le]}function Sa(e,t,n,r,s=le){if(e.isGeospatial){let[l,u]=Gs(t,n,r),[h,f]=Gs(t+1,n+1,r);return{west:l,north:u,east:h,south:f}}let[i,o]=lf(t,n,r,s),[a,c]=lf(t+1,n+1,r,s);return{left:i,top:o,right:a,bottom:c}}function wy(e,t,n,r,s){let i=My(e,null,r),o=ba(t,n),[a,c,l,u]=Iy(i,o,s),h=[];for(let f=Math.floor(a);f<l;f++)for(let d=Math.floor(c);d<u;d++)h.push({x:f,y:d,z:t});return h}function Ma({viewport:e,maxZoom:t,minZoom:n,zRange:r,extent:s,tileSize:i=le,modelMatrix:o,modelMatrixInverse:a,zoomOffset:c=0}){let l=e.isGeospatial?Math.round(e.zoom+Math.log2(le/i))+c:Math.ceil(e.zoom)+c;if(typeof n=="number"&&Number.isFinite(n)&&l<n){if(!s)return[];l=n}typeof t=="number"&&Number.isFinite(t)&&l>t&&(l=t);let u=s;return o&&a&&s&&!e.isGeospatial&&(u=uf(s,o)),e.isGeospatial?cf(e,l,r,s):wy(e,l,i,u||by,a)}function Ia(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(e)}function wa(e){return Number.isFinite(e.west)&&Number.isFinite(e.north)&&Number.isFinite(e.east)&&Number.isFinite(e.south)}function ff(e){let t={},n;return r=>{for(let s in r)if(!vy(r[s],t[s])){n=e(r),t=r;break}return n}}function vy(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 df=1,Vs=2,Fy="never",Ry="no-overlap",Ar="best-available",Ly=5,Py={[Ar]:Ny,[Ry]:Dy,[Fy]:()=>{}},Oy={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},qe=class{constructor(t){this._getCullBounds=ff(hf),this.opts={...Oy,...t},this.onTileLoad=n=>{this.opts.onTileLoad?.(n),this.opts.maxCacheByteSize&&(this._cacheByteSize+=n.byteLength,this._resizeCache())},this._requestScheduler=new xe({maxRequests:t.maxRequests,throttleRequests:Boolean(t.maxRequests&&t.maxRequests>0)}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new P,this._modelMatrixInverse=new P,this.setOptions(t)}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(t=>t.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(t=>t.needsReload)}setOptions(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom))}finalize(){for(let t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let t of this._cache.keys()){let 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 P(r):new P,i=!s.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!gt(this._zRange,n)||i){i&&(this._modelMatrixInverse=s.clone().invert(),this._modelMatrix=s),this._viewport=t,this._zRange=n;let a=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:n,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=a.map(c=>this._getTile(c,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(a=>this._getTile(a.index,!0)));let o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(t,n){if(!t.isVisible)return!1;if(n&&this._viewport){let r=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:n}),{bbox:s}=t;for(let[i,o,a,c]of r){let l;if("west"in s)l=s.west<a&&s.east>i&&s.south<c&&s.north>o;else{let u=Math.min(s.top,s.bottom),h=Math.max(s.top,s.bottom);l=s.left<a&&s.right>i&&u<c&&h>o}if(l)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:n,minZoom:r,zRange:s,modelMatrix:i,modelMatrixInverse:o}){let{tileSize:a,extent:c,zoomOffset:l}=this.opts;return Ma({viewport:t,maxZoom:n,minZoom:r,zRange:s,tileSize:a,extent:c,modelMatrix:i,modelMatrixInverse:o,zoomOffset:l})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){let{tileSize:n}=this.opts;return{bbox:Sa(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||Ar,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:Py[t])(Array.from(this._cache.values())),r=0;for(let s of this._cache.values())if(n[r++]!==s.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:t=0}=this.opts,n=[],r=0;for(let s of this._cache.values())s.isLoading&&(r++,!s.isSelected&&!s.isVisible&&n.push(s));for(;t>0&&r>t&&n.length>0;)n.shift().abort(),r--}_rebuildTree(){let{_cache:t}=this;for(let n of t.values())n.parent=null,n.children&&(n.children.length=0);for(let n of t.values()){let r=this._getNearestAncestor(n);n.parent=r,r?.children&&r.children.push(n)}}_resizeCache(){let{_cache:t,opts:n}=this,r=n.maxCacheSize||(n.maxCacheByteSize?1/0:Ly*this.selectedTiles.length),s=n.maxCacheByteSize||1/0;if(t.size>r||this._cacheByteSize>s){for(let[o,a]of t)if(!a.isVisible&&!a.isSelected&&(this._cacheByteSize-=n.maxCacheByteSize?a.byteLength:0,t.delete(o),this.opts.onTileUnload?.(a)),t.size<=r&&this._cacheByteSize<=s)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((o,a)=>o.zoom-a.zoom),this._dirty=!1)}_getTile(t,n){let r=this.getTileId(t),s=this._cache.get(r),i=!1;return!s&&n?(s=new Je(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 Ny(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!pf(t)&&va(t);for(let t of e)t.isVisible=Boolean(t.state&Vs)}function Dy(e){for(let n of e)n.state=0;for(let n of e)n.isSelected&&pf(n);let t=Array.from(e).sort((n,r)=>n.zoom-r.zoom);for(let n of t)if(n.isVisible=Boolean(n.state&Vs),n.children&&(n.isVisible||n.state&df))for(let r of n.children)r.state=df;else n.isSelected&&va(n)}function pf(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=Vs,!0;t=t.parent}return!1}function va(e){for(let t of e.children)t.isLoaded||t.content?t.state|=Vs:va(t)}var Uy={TilesetClass:qe,data:{type:"data",value:[]},dataComparator:Ie.equal,renderSubLayers:{type:"function",value:e=>new mf.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:Ar,zRange:null,maxRequests:6,zoomOffset:0},Hs=class extends zs.CompositeLayer{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every(t=>t.isLoaded&&t.layers&&t.layers.every(n=>n.isLoaded)))}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:n}=this.state,r=t.propsOrDataChanged||t.updateTriggersChanged,s=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);n?r&&(n.setOptions(this._getTilesetOptions()),s?n.reloadAll():n.tiles.forEach(i=>{i.layers=null})):(n=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:n})),this._updateTileset()}_getTilesetOptions(){let{tileSize:t,maxCacheSize:n,maxCacheByteSize:r,refinementStrategy:s,extent:i,maxZoom:o,minZoom:a,maxRequests:c,zoomOffset:l}=this.props;return{maxCacheSize:n,maxCacheByteSize:r,maxZoom:o,minZoom:a,tileSize:t,refinementStrategy:s,extent:i,maxRequests:c,zoomOffset:l,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let t=this.state.tileset,{zRange:n,modelMatrix:r}=this.props,s=t.update(this.context.viewport,{zRange:n,modelMatrix:r}),{isLoaded:i}=t,o=this.state.isLoaded!==i,a=this.state.frameNumber!==s;i&&(o||a)&&this._onViewportLoad(),a&&this.setState({frameNumber:s}),this.state.isLoaded=i}_onViewportLoad(){let{tileset:t}=this.state,{onViewportLoad:n}=this.props;n&&n(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,n){this.props.onTileError(t),n.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){let{data:n,getTileData:r,fetch:s}=this.props,{signal:i}=t;return t.url=typeof n=="string"||Array.isArray(n)?te(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({info:t,sourceLayer:n}){let r=n.props.tile;return t.picked&&(t.tile=r),t.sourceTile=r,t}_updateAutoHighlight(t){let n=t.sourceTile;if(n&&n.layers)for(let r of n.layers)r.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map(t=>{let n=this.getSubLayerPropsByTile(t);if(!(!t.isLoaded&&!t.content))if(t.layers)n&&t.layers[0]&&Object.keys(n).some(r=>t.layers[0].props[r]!==n[r])&&(t.layers=t.layers.map(r=>r.clone(n)));else{let r=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=(0,zs._flatten)(r,Boolean).map(s=>s.clone({tile:t,...n}))}return t.layers})}filterSubLayer({layer:t,cullRect:n}){let{tile:r}=t.props;return this.state.tileset.isTileVisible(r,n)}},ee=Hs;(()=>{Hs.defaultProps=Uy})(),(()=>{Hs.layerName="TileLayer"})();var gf=N(Dt(),1),Gy={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:e=>e.timestamps}},ks=class extends gf.PathLayer{getShaders(){let t=super.getShaders();return t.inject={"vs:#decl":`uniform float trailLength;
|
|
14
14
|
in float instanceTimestamps;
|
|
15
15
|
in float instanceNextTimestamps;
|
|
16
16
|
out float vTime;
|
|
@@ -25,49 +25,36 @@ in float vTime;
|
|
|
25
25
|
`,"fs:DECKGL_FILTER_COLOR":`if(fadeTrail) {
|
|
26
26
|
color.a *= 1.0 - (currentTime - vTime) / trailLength;
|
|
27
27
|
}
|
|
28
|
-
`},t}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})}draw(t){let{fadeTrail:n,trailLength:r,currentTime:s}=this.props;t.uniforms={...t.uniforms,fadeTrail:n,trailLength:r,currentTime:s},super.draw(t)}},yr=Js;(()=>{Js.layerName="TripsLayer"})(),(()=>{Js.defaultProps=Vy})();var _f=N(qs(),1),Ef=N(Ut(),1);var Rt=N(qs(),1),Xs=N(Ut(),1),_r=N(Dt(),1);var Tr=N(qs(),1);function js(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 Hy(e,t,n){let[r,s]=(0,Tr.cellToLatLng)(e),i=t.length;js(t,s);let o=t[0]===t[i-1]?i-1:i;for(let a=0;a<o;a++)t[a][0]=_e(s,t[a][0],n),t[a][1]=_e(r,t[a][1],n)}function yf(e,t,n){let r=e(t,n),[s,i]=(0,Tr.cellToLatLng)(r);return[i,s]}function Ra(e,t=1){let n=(0,Tr.cellToBoundary)(e,!0);return t!==1?Hy(e,n,t):js(n),n}function Tf(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 zy=10;function ky(e,t){let n;return e==null?n=t:typeof e=="object"?n={...e,coverage:t}:n={getHexagon:e,coverage:t},n}var Jy={..._r.PolygonLayer.defaultProps,highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:e=>e.hexagon},extruded:!0},En=class extends Xs.CompositeLayer{initializeState(){En._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,Xs.createIterable)(this.props.data);for(let o of s){i.index++;let a=this.props.getHexagon(o,i),c=(0,Rt.getResolution)(a);if(t<0){if(t=c,!this.props.highPrecision)break}else if(t!==c){r=!0;break}if((0,Rt.isPentagon)(a)){n=!0;break}}return{resolution:t,edgeLengthKM:t>=0?(0,Rt.getHexagonEdgeLengthAvg)(t,"km"):0,hasMultipleRes:r,hasPentagon:n}}_shouldUseHighPrecision(){if(this.props.highPrecision==="auto"){let{resolution:t,hasPentagon:n,hasMultipleRes:r}=this.state,{viewport:s}=this.context;return Boolean(s?.resolution)||r||n||t>=0&&t<=5}return this.props.highPrecision}_updateVertices(t){if(this._shouldUseHighPrecision())return;let{resolution:n,edgeLengthKM:r,centerHex:s}=this.state;if(n<0)return;let i=this.props.centerHexagon||(0,Rt.latLngToCell)(t.latitude,t.longitude,n);if(s===i)return;if(s)try{if((0,Rt.gridDistance)(s,i)*r<zy)return}catch{}let{unitsPerMeter:o}=t.distanceScales,a=Ra(i),[c,l]=(0,Rt.cellToLatLng)(i),[u,h]=t.projectFlat([l,c]);a=a.map(f=>{let d=t.projectFlat(f);return[(d[0]-u)/o[0],(d[1]-h)/o[1]]}),this.setState({centerHex:i,vertices:a})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){let{elevationScale:t,material:n,coverage:r,extruded:s,wireframe:i,stroked:o,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:h,getFillColor:f,getElevation:d,getLineColor:m,getLineWidth:A,transitions:g,updateTriggers:y}=this.props;return{elevationScale:t,extruded:s,coverage:r,wireframe:i,stroked:o,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:h,material:n,getElevation:d,getFillColor:f,getLineColor:m,getLineWidth:A,transitions:g,updateTriggers:{getFillColor:y.getFillColor,getElevation:y.getElevation,getLineColor:y.getLineColor,getLineWidth:y.getLineWidth}}}_renderPolygonLayer(){let{data:t,getHexagon:n,updateTriggers:r,coverage:s}=this.props,i=this.getSubLayerClass("hexagon-cell-hifi",_r.PolygonLayer),o=this._getForwardProps();return o.updateTriggers.getPolygon=ky(r.getHexagon,s),new i(o,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:o.updateTriggers}),{data:t,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(a,c)=>{let l=n(a,c);return Tf(Ra(l,s))}})}_renderColumnLayer(){let{data:t,getHexagon:n,updateTriggers:r}=this.props,s=this.getSubLayerClass("hexagon-cell",_r.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:yf.bind(null,n)})}},je=En;(()=>{En.defaultProps=Jy})(),(()=>{En.layerName="H3HexagonLayer"})(),(()=>{En._checkH3Lib=()=>{}})();var qy={getHexagons:{type:"accessor",value:e=>e.hexagons}},Ws=class extends It{initializeState(){je._checkH3Lib()}updateState({props:t,changeFlags:n}){if(n.dataChanged||n.updateTriggersChanged&&n.updateTriggersChanged.getHexagons){let{data:r,getHexagons:s}=t,i=[],{iterable:o,objectInfo:a}=(0,Ef.createIterable)(r);for(let c of o){a.index++;let l=s(c,a),u=(0,_f.cellsToMultiPolygon)(l,!0);for(let h of u){for(let f of h)js(f);i.push(this.getSubLayerRow({polygon:h},c,a.index))}}this.setState({polygons:i})}}indexToBounds(){let{getElevation:t,getFillColor:n,getLineColor:r,getLineWidth:s}=this.props;return{data:this.state.polygons,getPolygon:i=>i.polygon,getElevation:this.getSubLayerAccessor(t),getFillColor:this.getSubLayerAccessor(n),getLineColor:this.getSubLayerAccessor(r),getLineWidth:this.getSubLayerAccessor(s)}}},Er=Ws;(()=>{Ws.layerName="H3ClusterLayer"})(),(()=>{Ws.defaultProps=qy})();var hp=N(La(),1),Re=N(Ut(),1),fp=N(Dt(),1),dp=N(Ys(),1);var Mf=N(Sf(),1),zt;(function(e){e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.ONE=1]="ONE",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.LINEAR=9729]="LINEAR",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL"})(zt||(zt={}));function Pa(e,t,n,r){let s={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{u_Camera:[0,0,0],u_MetallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=1;let{imageBasedLightingEnvironment:i}=r;return i&&(s.bindings.u_DiffuseEnvSampler=i.diffuseEnvSampler,s.bindings.u_SpecularEnvSampler=i.specularEnvSampler,s.bindings.u_brdfLUT=i.brdfLutTexture,s.uniforms.u_ScaleIBLAmbient=[1,1]),r?.pbrDebug&&(s.defines.PBR_DEBUG=1,s.uniforms.u_ScaleDiffBaseMR=[0,0,0,0],s.uniforms.u_ScaleFGDSpec=[0,0,0,0]),n.NORMAL&&(s.defines.HAS_NORMALS=1),n.TANGENT&&r?.useTangents&&(s.defines.HAS_TANGENTS=1),n.TEXCOORD_0&&(s.defines.HAS_UV=1),r?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=1),r?.lights&&(s.defines.USE_LIGHTS=1),t&&jy(e,t,s),s}function jy(e,t,n){if(n.uniforms.pbr_uUnlit=Boolean(t.unlit),t.pbrMetallicRoughness&&Xy(e,t.pbrMetallicRoughness,n),t.normalTexture){Br(e,t.normalTexture,"u_NormalSampler","HAS_NORMALMAP",n);let{scale:r=1}=t.normalTexture;n.uniforms.u_NormalScale=r}if(t.occlusionTexture){Br(e,t.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP",n);let{strength:r=1}=t.occlusionTexture;n.uniforms.u_OcclusionStrength=r}switch(t.emissiveTexture&&(Br(e,t.emissiveTexture,"u_EmissiveSampler","HAS_EMISSIVEMAP",n),n.uniforms.u_EmissiveFactor=t.emissiveFactor||[0,0,0]),t.alphaMode){case"MASK":let{alphaCutoff:r=.5}=t;n.defines.ALPHA_CUTOFF=1,n.uniforms.u_AlphaCutoff=r;break;case"BLEND":Mf.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),n.parameters.blendColorOperation="add",n.parameters.blendColorSrcFactor="src-alpha",n.parameters.blendColorDstFactor="one-minus-src-alpha",n.parameters.blendAlphaOperation="add",n.parameters.blendAlphaSrcFactor="one",n.parameters.blendAlphaDstFactor="one-minus-src-alpha",n.glParameters.blend=!0,n.glParameters.blendEquation=zt.FUNC_ADD,n.glParameters.blendFunc=[zt.SRC_ALPHA,zt.ONE_MINUS_SRC_ALPHA,zt.ONE,zt.ONE_MINUS_SRC_ALPHA];break}}function Xy(e,t,n){t.baseColorTexture&&Br(e,t.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP",n),n.uniforms.u_BaseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&Br(e,t.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP",n);let{metallicFactor:r=1,roughnessFactor:s=1}=t;n.uniforms.u_MetallicRoughnessValues=[r,s]}function Br(e,t,n,r=null,s){let i=t?.texture?.sampler?.parameters||{},o=t.texture.source.image,a,c={};o.compressed?(a=o,c={[zt.TEXTURE_MIN_FILTER]:o.data.length>1?zt.LINEAR_MIPMAP_NEAREST:zt.LINEAR}):a={data:o};let l=e.createTexture({id:t.uniformName||t.id,parameters:{...i,...c},pixelStore:{[zt.UNPACK_FLIP_Y_WEBGL]:!1},...a});s.bindings[n]=l,r&&(s.defines[r]=1),s.generatedTextures.push(l)}var If="4.1.0";var Ks={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},Oa;async function Da(e){let t=e.modules||{};return t.basis?t.basis:(Oa=Oa||Wy(e),await Oa)}async function Wy(e){let t=null,n=null;return[t,n]=await Promise.all([await Kt(Ks.TRANSCODER,"textures",e),await Kt(Ks.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await Yy(t,n)}function Yy(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 Na;async function Ua(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(Na=Na||Ky(e),await Na)}async function Ky(e){let t=null,n=null;return[t,n]=await Promise.all([await Kt(Ks.ENCODER,"textures",e),await Kt(Ks.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await Qy(t,n)}function Qy(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e(n).then(s=>{let{BasisFile:i,KTX2File:o,initializeBasis:a,BasisEncoder:c}=s;a(),r({BasisFile:i,KTX2File:o,BasisEncoder:c})})})}var Xe={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 Zy=["","WEBKIT_","MOZ_"],wf={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"},Qs=null;function vf(e){if(!Qs){e=e||$y()||void 0,Qs=new Set;for(let t of Zy)for(let n in wf)if(e&&e.getExtension(`${t}${n}`)){let r=wf[n];Qs.add(r)}}return Qs}function $y(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var JR=new Uint8Array([0]);var Ff,Rf,Lf,Pf,Of,Nf,Df,Uf;(function(e){e[e.NONE=0]="NONE",e[e.BASISLZ=1]="BASISLZ",e[e.ZSTD=2]="ZSTD",e[e.ZLIB=3]="ZLIB"})(Ff||(Ff={})),function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(Rf||(Rf={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(Lf||(Lf={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(Pf||(Pf={})),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"}(Of||(Of={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(Nf||(Nf={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(Df||(Df={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(Uf||(Uf={}));var wt=[171,75,84,88,32,50,48,187,13,10,26,10];function Gf(e){let t=new Uint8Array(e);return!(t.byteLength<wt.length||t[0]!==wt[0]||t[1]!==wt[1]||t[2]!==wt[2]||t[3]!==wt[3]||t[4]!==wt[4]||t[5]!==wt[5]||t[6]!==wt[6]||t[7]!==wt[7]||t[8]!==wt[8]||t[9]!==wt[9]||t[10]!==wt[10]||t[11]!==wt[11])}var tT={etc1:{basisFormat:0,compressed:!0,format:Xe.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Xe.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:Xe.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:Xe.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Xe.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:Xe.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 Va(e,t){if(t.basis.containerFormat==="auto"){if(Gf(e)){let r=await Ua(t);return Vf(r.KTX2File,e,t)}let{BasisFile:n}=await Da(t);return Ga(n,e,t)}switch(t.basis.module){case"encoder":let n=await Ua(t);switch(t.basis.containerFormat){case"ktx2":return Vf(n.KTX2File,e,t);case"basis":default:return Ga(n.BasisFile,e,t)}case"transcoder":default:let{BasisFile:r}=await Da(t);return Ga(r,e,t)}}function Ga(e,t,n){let r=new e(new Uint8Array(t));try{if(!r.startTranscoding())throw new Error("Failed to start basis transcoding");let s=r.getNumImages(),i=[];for(let o=0;o<s;o++){let a=r.getNumLevels(o),c=[];for(let l=0;l<a;l++)c.push(eT(r,o,l,n));i.push(c)}return i}finally{r.close(),r.delete()}}function eT(e,t,n,r){let s=e.getImageWidth(t,n),i=e.getImageHeight(t,n),o=e.getHasAlpha(),{compressed:a,format:c,basisFormat:l}=Hf(r,o),u=e.getImageTranscodedSizeInBytes(t,n,l),h=new Uint8Array(u);if(!e.transcodeImage(h,t,n,l,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:i,data:h,compressed:a,format:c,hasAlpha:o}}function Vf(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(nT(r,o,n));break}return[i]}finally{r.close(),r.delete()}}function nT(e,t,n){let{alphaFlag:r,height:s,width:i}=e.getImageLevelInfo(t,0,0),{compressed:o,format:a,basisFormat:c}=Hf(n,r),l=e.getImageTranscodedSizeInBytes(t,0,0,c),u=new Uint8Array(l);if(!e.transcodeImage(u,t,0,0,c,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:i,height:s,data:u,compressed:o,levelSize:l,hasAlpha:r,format:a}}function Hf(e,t){let n=e&&e.basis&&e.basis.format;return n==="auto"&&(n=Zs()),typeof n=="object"&&(n=t?n.alpha:n.noAlpha),n=n.toLowerCase(),tT[n]}function Zs(){let e=vf();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 zf={name:"Basis",id:"basis",module:"textures",version:If,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"}}},Ha={...zf,parse:Va};function za(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,n=e||t;return!!(n&&n.indexOf("Electron")>=0)}function kt(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||za()}var rT=globalThis.self||globalThis.window||globalThis.global,Bn=globalThis.window||globalThis.self||globalThis.global,sT=globalThis.document||{},We=globalThis.process||{},iT=globalThis.console,lL=globalThis.navigator||{};var $s=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",fL=kt();var Cn=e=>`${e}`;var ka=Cn`\
|
|
29
|
-
#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
|
|
30
|
-
|
|
28
|
+
`},t}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})}draw(t){let{fadeTrail:n,trailLength:r,currentTime:s}=this.props;t.uniforms={...t.uniforms,fadeTrail:n,trailLength:r,currentTime:s},super.draw(t)}},xr=ks;(()=>{ks.layerName="TripsLayer"})(),(()=>{ks.defaultProps=Gy})();var Tf=N(Js(),1),_f=N(Ut(),1);var Rt=N(Js(),1),js=N(Ut(),1),Tr=N(Dt(),1);var yr=N(Js(),1);function qs(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 Vy(e,t,n){let[r,s]=(0,yr.cellToLatLng)(e),i=t.length;qs(t,s);let o=t[0]===t[i-1]?i-1:i;for(let a=0;a<o;a++)t[a][0]=_e(s,t[a][0],n),t[a][1]=_e(r,t[a][1],n)}function xf(e,t,n){let r=e(t,n),[s,i]=(0,yr.cellToLatLng)(r);return[i,s]}function Fa(e,t=1){let n=(0,yr.cellToBoundary)(e,!0);return t!==1?Vy(e,n,t):qs(n),n}function yf(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 Hy=10;function zy(e,t){let n;return e==null?n=t:typeof e=="object"?n={...e,coverage:t}:n={getHexagon:e,coverage:t},n}var ky={...Tr.PolygonLayer.defaultProps,highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:e=>e.hexagon},extruded:!0},En=class extends js.CompositeLayer{initializeState(){En._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,js.createIterable)(this.props.data);for(let o of s){i.index++;let a=this.props.getHexagon(o,i),c=(0,Rt.getResolution)(a);if(t<0){if(t=c,!this.props.highPrecision)break}else if(t!==c){r=!0;break}if((0,Rt.isPentagon)(a)){n=!0;break}}return{resolution:t,edgeLengthKM:t>=0?(0,Rt.getHexagonEdgeLengthAvg)(t,"km"):0,hasMultipleRes:r,hasPentagon:n}}_shouldUseHighPrecision(){if(this.props.highPrecision==="auto"){let{resolution:t,hasPentagon:n,hasMultipleRes:r}=this.state,{viewport:s}=this.context;return Boolean(s?.resolution)||r||n||t>=0&&t<=5}return this.props.highPrecision}_updateVertices(t){if(this._shouldUseHighPrecision())return;let{resolution:n,edgeLengthKM:r,centerHex:s}=this.state;if(n<0)return;let i=this.props.centerHexagon||(0,Rt.latLngToCell)(t.latitude,t.longitude,n);if(s===i)return;if(s)try{if((0,Rt.gridDistance)(s,i)*r<Hy)return}catch{}let{unitsPerMeter:o}=t.distanceScales,a=Fa(i),[c,l]=(0,Rt.cellToLatLng)(i),[u,h]=t.projectFlat([l,c]);a=a.map(f=>{let d=t.projectFlat(f);return[(d[0]-u)/o[0],(d[1]-h)/o[1]]}),this.setState({centerHex:i,vertices:a})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){let{elevationScale:t,material:n,coverage:r,extruded:s,wireframe:i,stroked:o,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:h,getFillColor:f,getElevation:d,getLineColor:p,getLineWidth:A,transitions:g,updateTriggers:y}=this.props;return{elevationScale:t,extruded:s,coverage:r,wireframe:i,stroked:o,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:h,material:n,getElevation:d,getFillColor:f,getLineColor:p,getLineWidth:A,transitions:g,updateTriggers:{getFillColor:y.getFillColor,getElevation:y.getElevation,getLineColor:y.getLineColor,getLineWidth:y.getLineWidth}}}_renderPolygonLayer(){let{data:t,getHexagon:n,updateTriggers:r,coverage:s}=this.props,i=this.getSubLayerClass("hexagon-cell-hifi",Tr.PolygonLayer),o=this._getForwardProps();return o.updateTriggers.getPolygon=zy(r.getHexagon,s),new i(o,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:o.updateTriggers}),{data:t,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(a,c)=>{let l=n(a,c);return yf(Fa(l,s))}})}_renderColumnLayer(){let{data:t,getHexagon:n,updateTriggers:r}=this.props,s=this.getSubLayerClass("hexagon-cell",Tr.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:xf.bind(null,n)})}},je=En;(()=>{En.defaultProps=ky})(),(()=>{En.layerName="H3HexagonLayer"})(),(()=>{En._checkH3Lib=()=>{}})();var Jy={getHexagons:{type:"accessor",value:e=>e.hexagons}},Xs=class extends It{initializeState(){je._checkH3Lib()}updateState({props:t,changeFlags:n}){if(n.dataChanged||n.updateTriggersChanged&&n.updateTriggersChanged.getHexagons){let{data:r,getHexagons:s}=t,i=[],{iterable:o,objectInfo:a}=(0,_f.createIterable)(r);for(let c of o){a.index++;let l=s(c,a),u=(0,Tf.cellsToMultiPolygon)(l,!0);for(let h of u){for(let f of h)qs(f);i.push(this.getSubLayerRow({polygon:h},c,a.index))}}this.setState({polygons:i})}}indexToBounds(){let{getElevation:t,getFillColor:n,getLineColor:r,getLineWidth:s}=this.props;return{data:this.state.polygons,getPolygon:i=>i.polygon,getElevation:this.getSubLayerAccessor(t),getFillColor:this.getSubLayerAccessor(n),getLineColor:this.getSubLayerAccessor(r),getLineWidth:this.getSubLayerAccessor(s)}}},_r=Xs;(()=>{Xs.layerName="H3ClusterLayer"})(),(()=>{Xs.defaultProps=Jy})();var um=N(Ra(),1),Re=N(Ut(),1),hm=N(Dt(),1),fm=N(Ws(),1);var Sf=N(bf(),1),zt;(function(e){e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.ONE=1]="ONE",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.LINEAR=9729]="LINEAR",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL"})(zt||(zt={}));function La(e,t,n,r){let s={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{u_Camera:[0,0,0],u_MetallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=1;let{imageBasedLightingEnvironment:i}=r;return i&&(s.bindings.u_DiffuseEnvSampler=i.diffuseEnvSampler,s.bindings.u_SpecularEnvSampler=i.specularEnvSampler,s.bindings.u_brdfLUT=i.brdfLutTexture,s.uniforms.u_ScaleIBLAmbient=[1,1]),r?.pbrDebug&&(s.defines.PBR_DEBUG=1,s.uniforms.u_ScaleDiffBaseMR=[0,0,0,0],s.uniforms.u_ScaleFGDSpec=[0,0,0,0]),n.NORMAL&&(s.defines.HAS_NORMALS=1),n.TANGENT&&r?.useTangents&&(s.defines.HAS_TANGENTS=1),n.TEXCOORD_0&&(s.defines.HAS_UV=1),r?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=1),r?.lights&&(s.defines.USE_LIGHTS=1),t&&qy(e,t,s),s}function qy(e,t,n){if(n.uniforms.pbr_uUnlit=Boolean(t.unlit),t.pbrMetallicRoughness&&jy(e,t.pbrMetallicRoughness,n),t.normalTexture){Er(e,t.normalTexture,"u_NormalSampler","HAS_NORMALMAP",n);let{scale:r=1}=t.normalTexture;n.uniforms.u_NormalScale=r}if(t.occlusionTexture){Er(e,t.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP",n);let{strength:r=1}=t.occlusionTexture;n.uniforms.u_OcclusionStrength=r}switch(t.emissiveTexture&&(Er(e,t.emissiveTexture,"u_EmissiveSampler","HAS_EMISSIVEMAP",n),n.uniforms.u_EmissiveFactor=t.emissiveFactor||[0,0,0]),t.alphaMode){case"MASK":let{alphaCutoff:r=.5}=t;n.defines.ALPHA_CUTOFF=1,n.uniforms.u_AlphaCutoff=r;break;case"BLEND":Sf.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),n.parameters.blendColorOperation="add",n.parameters.blendColorSrcFactor="src-alpha",n.parameters.blendColorDstFactor="one-minus-src-alpha",n.parameters.blendAlphaOperation="add",n.parameters.blendAlphaSrcFactor="one",n.parameters.blendAlphaDstFactor="one-minus-src-alpha",n.glParameters.blend=!0,n.glParameters.blendEquation=zt.FUNC_ADD,n.glParameters.blendFunc=[zt.SRC_ALPHA,zt.ONE_MINUS_SRC_ALPHA,zt.ONE,zt.ONE_MINUS_SRC_ALPHA];break}}function jy(e,t,n){t.baseColorTexture&&Er(e,t.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP",n),n.uniforms.u_BaseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&Er(e,t.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP",n);let{metallicFactor:r=1,roughnessFactor:s=1}=t;n.uniforms.u_MetallicRoughnessValues=[r,s]}function Er(e,t,n,r=null,s){let i=t?.texture?.sampler?.parameters||{},o=t.texture.source.image,a,c={};o.compressed?(a=o,c={[zt.TEXTURE_MIN_FILTER]:o.data.length>1?zt.LINEAR_MIPMAP_NEAREST:zt.LINEAR}):a={data:o};let l=e.createTexture({id:t.uniformName||t.id,parameters:{...i,...c},pixelStore:{[zt.UNPACK_FLIP_Y_WEBGL]:!1},...a});s.bindings[n]=l,r&&(s.defines[r]=1),s.generatedTextures.push(l)}var UR=new Uint8Array([0]);var Mf,If,wf,vf,Ff,Rf,Lf,Pf;(function(e){e[e.NONE=0]="NONE",e[e.BASISLZ=1]="BASISLZ",e[e.ZSTD=2]="ZSTD",e[e.ZLIB=3]="ZLIB"})(Mf||(Mf={})),function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(If||(If={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(wf||(wf={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(vf||(vf={})),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"}(Ff||(Ff={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(Rf||(Rf={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(Lf||(Lf={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(Pf||(Pf={}));var Pa=`#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
|
|
31
29
|
struct AmbientLight {
|
|
32
|
-
|
|
30
|
+
vec3 color;
|
|
33
31
|
};
|
|
34
|
-
|
|
35
32
|
struct PointLight {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// Constant-Linear-Exponential
|
|
40
|
-
vec3 attenuation;
|
|
33
|
+
vec3 color;
|
|
34
|
+
vec3 position;
|
|
35
|
+
vec3 attenuation;
|
|
41
36
|
};
|
|
42
|
-
|
|
43
37
|
struct DirectionalLight {
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
vec3 color;
|
|
39
|
+
vec3 direction;
|
|
46
40
|
};
|
|
47
|
-
|
|
48
41
|
uniform AmbientLight lighting_uAmbientLight;
|
|
49
42
|
uniform PointLight lighting_uPointLight[MAX_LIGHTS];
|
|
50
43
|
uniform DirectionalLight lighting_uDirectionalLight[MAX_LIGHTS];
|
|
51
44
|
uniform int lighting_uPointLightCount;
|
|
52
45
|
uniform int lighting_uDirectionalLightCount;
|
|
53
|
-
|
|
54
46
|
uniform bool lighting_uEnabled;
|
|
55
|
-
|
|
56
47
|
float getPointLightAttenuation(PointLight pointLight, float distance) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
48
|
+
return pointLight.attenuation.x
|
|
49
|
+
+ pointLight.attenuation.y * distance
|
|
50
|
+
+ pointLight.attenuation.z * distance * distance;
|
|
60
51
|
}
|
|
61
|
-
|
|
62
52
|
#endif
|
|
63
|
-
`;var
|
|
64
|
-
uniform mat4 u_MVPMatrix;
|
|
53
|
+
`;var Xy={lightSources:{}};function Oa(e={}){let{color:t=[0,0,0],intensity:n=1}=e;return t.map(r=>r*n/255)}function Wy({ambientLight:e,pointLights:t=[],directionalLights:n=[]}){let r={};return e?r["lighting_uAmbientLight.color"]=Oa(e):r["lighting_uAmbientLight.color"]=[0,0,0],t.forEach((s,i)=>{r[`lighting_uPointLight[${i}].color`]=Oa(s),r[`lighting_uPointLight[${i}].position`]=s.position,r[`lighting_uPointLight[${i}].attenuation`]=s.attenuation||[1,0,0]}),r.lighting_uPointLightCount=t.length,n.forEach((s,i)=>{r[`lighting_uDirectionalLight[${i}].color`]=Oa(s),r[`lighting_uDirectionalLight[${i}].direction`]=s.direction}),r.lighting_uDirectionalLightCount=n.length,r}function Of(e=Xy){if("lightSources"in e){let{ambientLight:t,pointLights:n,directionalLights:r}=e.lightSources||{};return t||n&&n.length>0||r&&r.length>0?Object.assign({},Wy({ambientLight:t,pointLights:n,directionalLights:r}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in e){let t={pointLights:[],directionalLights:[]};for(let n of e.lights||[])switch(n.type){case"ambient":t.ambientLight=n;break;case"directional":t.directionalLights?.push(n);break;case"point":t.pointLights?.push(n);break;default:}return Of({lightSources:t})}return{}}var Nf={name:"lights",vs:Pa,fs:Pa,getUniforms:Of,defines:{MAX_LIGHTS:3}};var Df=`uniform mat4 u_MVPMatrix;
|
|
65
54
|
uniform mat4 u_ModelMatrix;
|
|
66
55
|
uniform mat4 u_NormalMatrix;
|
|
67
|
-
|
|
68
56
|
out vec3 pbr_vPosition;
|
|
69
57
|
out vec2 pbr_vUV;
|
|
70
|
-
|
|
71
58
|
#ifdef HAS_NORMALS
|
|
72
59
|
# ifdef HAS_TANGENTS
|
|
73
60
|
out mat3 pbr_vTBN;
|
|
@@ -75,49 +62,40 @@ out mat3 pbr_vTBN;
|
|
|
75
62
|
out vec3 pbr_vNormal;
|
|
76
63
|
# endif
|
|
77
64
|
#endif
|
|
78
|
-
|
|
79
65
|
void pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, vec2 uv)
|
|
80
66
|
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
67
|
+
vec4 pos = u_ModelMatrix * position;
|
|
68
|
+
pbr_vPosition = vec3(pos.xyz) / pos.w;
|
|
84
69
|
#ifdef HAS_NORMALS
|
|
85
70
|
#ifdef HAS_TANGENTS
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
#else
|
|
91
|
-
|
|
71
|
+
vec3 normalW = normalize(vec3(u_NormalMatrix * vec4(normal.xyz, 0.0)));
|
|
72
|
+
vec3 tangentW = normalize(vec3(u_ModelMatrix * vec4(tangent.xyz, 0.0)));
|
|
73
|
+
vec3 bitangentW = cross(normalW, tangentW) * tangent.w;
|
|
74
|
+
pbr_vTBN = mat3(tangentW, bitangentW, normalW);
|
|
75
|
+
#else
|
|
76
|
+
pbr_vNormal = normalize(vec3(u_ModelMatrix * vec4(normal.xyz, 0.0)));
|
|
92
77
|
#endif
|
|
93
78
|
#endif
|
|
94
|
-
|
|
95
79
|
#ifdef HAS_UV
|
|
96
|
-
|
|
80
|
+
pbr_vUV = uv;
|
|
97
81
|
#else
|
|
98
|
-
|
|
82
|
+
pbr_vUV = vec2(0.,0.);
|
|
99
83
|
#endif
|
|
100
84
|
}
|
|
101
|
-
`;var
|
|
102
|
-
#if defined(USE_TEX_LOD) && !defined(FEATURE_GLSL_TEXTURE_LOD)
|
|
85
|
+
`;var Uf=`#if defined(USE_TEX_LOD) && !defined(FEATURE_GLSL_TEXTURE_LOD)
|
|
103
86
|
# error PBR fragment shader: Texture LOD is not available
|
|
104
87
|
#endif
|
|
105
|
-
|
|
106
88
|
#if !defined(HAS_TANGENTS) && !defined(FEATURE_GLSL_DERIVATIVES)
|
|
107
89
|
# error PBR fragment shader: Derivatives are not available
|
|
108
90
|
#endif
|
|
109
|
-
|
|
110
91
|
precision highp float;
|
|
111
|
-
|
|
112
92
|
uniform bool pbr_uUnlit;
|
|
113
|
-
|
|
114
93
|
#ifdef USE_IBL
|
|
115
94
|
uniform samplerCube u_DiffuseEnvSampler;
|
|
116
95
|
uniform samplerCube u_SpecularEnvSampler;
|
|
117
96
|
uniform sampler2D u_brdfLUT;
|
|
118
97
|
uniform vec2 u_ScaleIBLAmbient;
|
|
119
98
|
#endif
|
|
120
|
-
|
|
121
99
|
#ifdef HAS_BASECOLORMAP
|
|
122
100
|
uniform sampler2D u_BaseColorSampler;
|
|
123
101
|
#endif
|
|
@@ -136,26 +114,18 @@ uniform sampler2D u_MetallicRoughnessSampler;
|
|
|
136
114
|
uniform sampler2D u_OcclusionSampler;
|
|
137
115
|
uniform float u_OcclusionStrength;
|
|
138
116
|
#endif
|
|
139
|
-
|
|
140
117
|
#ifdef ALPHA_CUTOFF
|
|
141
118
|
uniform float u_AlphaCutoff;
|
|
142
119
|
#endif
|
|
143
|
-
|
|
144
120
|
uniform vec2 u_MetallicRoughnessValues;
|
|
145
121
|
uniform vec4 u_BaseColorFactor;
|
|
146
|
-
|
|
147
122
|
uniform vec3 u_Camera;
|
|
148
|
-
|
|
149
|
-
// debugging flags used for shader output of intermediate PBR variables
|
|
150
123
|
#ifdef PBR_DEBUG
|
|
151
124
|
uniform vec4 u_ScaleDiffBaseMR;
|
|
152
125
|
uniform vec4 u_ScaleFGDSpec;
|
|
153
126
|
#endif
|
|
154
|
-
|
|
155
127
|
in vec3 pbr_vPosition;
|
|
156
|
-
|
|
157
128
|
in vec2 pbr_vUV;
|
|
158
|
-
|
|
159
129
|
#ifdef HAS_NORMALS
|
|
160
130
|
#ifdef HAS_TANGENTS
|
|
161
131
|
in mat3 pbr_vTBN;
|
|
@@ -163,332 +133,231 @@ in mat3 pbr_vTBN;
|
|
|
163
133
|
in vec3 pbr_vNormal;
|
|
164
134
|
#endif
|
|
165
135
|
#endif
|
|
166
|
-
|
|
167
|
-
// Encapsulate the various inputs used by the various functions in the shading equation
|
|
168
|
-
// We store values in this struct to simplify the integration of alternative implementations
|
|
169
|
-
// of the shading terms, outlined in the Readme.MD Appendix.
|
|
170
136
|
struct PBRInfo
|
|
171
137
|
{
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
138
|
+
float NdotL;
|
|
139
|
+
float NdotV;
|
|
140
|
+
float NdotH;
|
|
141
|
+
float LdotH;
|
|
142
|
+
float VdotH;
|
|
143
|
+
float perceptualRoughness;
|
|
144
|
+
float metalness;
|
|
145
|
+
vec3 reflectance0;
|
|
146
|
+
vec3 reflectance90;
|
|
147
|
+
float alphaRoughness;
|
|
148
|
+
vec3 diffuseColor;
|
|
149
|
+
vec3 specularColor;
|
|
150
|
+
vec3 n;
|
|
151
|
+
vec3 v;
|
|
186
152
|
};
|
|
187
|
-
|
|
188
153
|
const float M_PI = 3.141592653589793;
|
|
189
154
|
const float c_MinRoughness = 0.04;
|
|
190
|
-
|
|
191
155
|
vec4 SRGBtoLINEAR(vec4 srgbIn)
|
|
192
156
|
{
|
|
193
157
|
#ifdef MANUAL_SRGB
|
|
194
158
|
#ifdef SRGB_FAST_APPROXIMATION
|
|
195
|
-
|
|
196
|
-
#else
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
#endif
|
|
200
|
-
|
|
201
|
-
#else
|
|
202
|
-
|
|
203
|
-
#endif
|
|
159
|
+
vec3 linOut = pow(srgbIn.xyz,vec3(2.2));
|
|
160
|
+
#else
|
|
161
|
+
vec3 bLess = step(vec3(0.04045),srgbIn.xyz);
|
|
162
|
+
vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );
|
|
163
|
+
#endif
|
|
164
|
+
return vec4(linOut,srgbIn.w);;
|
|
165
|
+
#else
|
|
166
|
+
return srgbIn;
|
|
167
|
+
#endif
|
|
204
168
|
}
|
|
205
|
-
|
|
206
|
-
// Find the normal for this fragment, pulling either from a predefined normal map
|
|
207
|
-
// or from the interpolated mesh normal and tangent attributes.
|
|
208
169
|
vec3 getNormal()
|
|
209
170
|
{
|
|
210
|
-
// Retrieve the tangent space matrix
|
|
211
171
|
#ifndef HAS_TANGENTS
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
172
|
+
vec3 pos_dx = dFdx(pbr_vPosition);
|
|
173
|
+
vec3 pos_dy = dFdy(pbr_vPosition);
|
|
174
|
+
vec3 tex_dx = dFdx(vec3(pbr_vUV, 0.0));
|
|
175
|
+
vec3 tex_dy = dFdy(vec3(pbr_vUV, 0.0));
|
|
176
|
+
vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
|
|
218
177
|
#ifdef HAS_NORMALS
|
|
219
|
-
|
|
178
|
+
vec3 ng = normalize(pbr_vNormal);
|
|
220
179
|
#else
|
|
221
|
-
|
|
180
|
+
vec3 ng = cross(pos_dx, pos_dy);
|
|
222
181
|
#endif
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
mat3 tbn = pbr_vTBN;
|
|
182
|
+
t = normalize(t - ng * dot(ng, t));
|
|
183
|
+
vec3 b = normalize(cross(ng, t));
|
|
184
|
+
mat3 tbn = mat3(t, b, ng);
|
|
185
|
+
#else
|
|
186
|
+
mat3 tbn = pbr_vTBN;
|
|
229
187
|
#endif
|
|
230
|
-
|
|
231
188
|
#ifdef HAS_NORMALMAP
|
|
232
|
-
|
|
233
|
-
|
|
189
|
+
vec3 n = texture(u_NormalSampler, pbr_vUV).rgb;
|
|
190
|
+
n = normalize(tbn * ((2.0 * n - 1.0) * vec3(u_NormalScale, u_NormalScale, 1.0)));
|
|
234
191
|
#else
|
|
235
|
-
|
|
236
|
-
vec3 n = normalize(tbn[2].xyz);
|
|
192
|
+
vec3 n = normalize(tbn[2].xyz);
|
|
237
193
|
#endif
|
|
238
|
-
|
|
239
|
-
return n;
|
|
194
|
+
return n;
|
|
240
195
|
}
|
|
241
|
-
|
|
242
|
-
// Calculation of the lighting contribution from an optional Image Based Light source.
|
|
243
|
-
// Precomputed Environment Maps are required uniform inputs and are computed as outlined in [1].
|
|
244
|
-
// See our README.md on Environment Maps [3] for additional discussion.
|
|
245
196
|
#ifdef USE_IBL
|
|
246
197
|
vec3 getIBLContribution(PBRInfo pbrInputs, vec3 n, vec3 reflection)
|
|
247
198
|
{
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
vec3 diffuseLight = SRGBtoLINEAR(textureCube(u_DiffuseEnvSampler, n)).rgb;
|
|
254
|
-
|
|
199
|
+
float mipCount = 9.0;
|
|
200
|
+
float lod = (pbrInputs.perceptualRoughness * mipCount);
|
|
201
|
+
vec3 brdf = SRGBtoLINEAR(texture(u_brdfLUT,
|
|
202
|
+
vec2(pbrInputs.NdotV, 1.0 - pbrInputs.perceptualRoughness))).rgb;
|
|
203
|
+
vec3 diffuseLight = SRGBtoLINEAR(textureCube(u_DiffuseEnvSampler, n)).rgb;
|
|
255
204
|
#ifdef USE_TEX_LOD
|
|
256
|
-
|
|
205
|
+
vec3 specularLight = SRGBtoLINEAR(textureCubeLod(u_SpecularEnvSampler, reflection, lod)).rgb;
|
|
257
206
|
#else
|
|
258
|
-
|
|
259
|
-
#endif
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
diffuse *= u_ScaleIBLAmbient.x;
|
|
266
|
-
specular *= u_ScaleIBLAmbient.y;
|
|
267
|
-
|
|
268
|
-
return diffuse + specular;
|
|
207
|
+
vec3 specularLight = SRGBtoLINEAR(textureCube(u_SpecularEnvSampler, reflection)).rgb;
|
|
208
|
+
#endif
|
|
209
|
+
vec3 diffuse = diffuseLight * pbrInputs.diffuseColor;
|
|
210
|
+
vec3 specular = specularLight * (pbrInputs.specularColor * brdf.x + brdf.y);
|
|
211
|
+
diffuse *= u_ScaleIBLAmbient.x;
|
|
212
|
+
specular *= u_ScaleIBLAmbient.y;
|
|
213
|
+
return diffuse + specular;
|
|
269
214
|
}
|
|
270
215
|
#endif
|
|
271
|
-
|
|
272
|
-
// Basic Lambertian diffuse
|
|
273
|
-
// Implementation from Lambert's Photometria https://archive.org/details/lambertsphotome00lambgoog
|
|
274
|
-
// See also [1], Equation 1
|
|
275
216
|
vec3 diffuse(PBRInfo pbrInputs)
|
|
276
217
|
{
|
|
277
|
-
|
|
218
|
+
return pbrInputs.diffuseColor / M_PI;
|
|
278
219
|
}
|
|
279
|
-
|
|
280
|
-
// The following equation models the Fresnel reflectance term of the spec equation (aka F())
|
|
281
|
-
// Implementation of fresnel from [4], Equation 15
|
|
282
220
|
vec3 specularReflection(PBRInfo pbrInputs)
|
|
283
221
|
{
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
222
|
+
return pbrInputs.reflectance0 +
|
|
223
|
+
(pbrInputs.reflectance90 - pbrInputs.reflectance0) *
|
|
224
|
+
pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0);
|
|
287
225
|
}
|
|
288
|
-
|
|
289
|
-
// This calculates the specular geometric attenuation (aka G()),
|
|
290
|
-
// where rougher material will reflect less light back to the viewer.
|
|
291
|
-
// This implementation is based on [1] Equation 4, and we adopt their modifications to
|
|
292
|
-
// alphaRoughness as input as originally proposed in [2].
|
|
293
226
|
float geometricOcclusion(PBRInfo pbrInputs)
|
|
294
227
|
{
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
return attenuationL * attenuationV;
|
|
228
|
+
float NdotL = pbrInputs.NdotL;
|
|
229
|
+
float NdotV = pbrInputs.NdotV;
|
|
230
|
+
float r = pbrInputs.alphaRoughness;
|
|
231
|
+
float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));
|
|
232
|
+
float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));
|
|
233
|
+
return attenuationL * attenuationV;
|
|
302
234
|
}
|
|
303
|
-
|
|
304
|
-
// The following equation(s) model the distribution of microfacet normals across
|
|
305
|
-
// the area being drawn (aka D())
|
|
306
|
-
// Implementation from "Average Irregularity Representation of a Roughened Surface
|
|
307
|
-
// for Ray Reflection" by T. S. Trowbridge, and K. P. Reitz
|
|
308
|
-
// Follows the distribution function recommended in the SIGGRAPH 2013 course notes
|
|
309
|
-
// from EPIC Games [1], Equation 3.
|
|
310
235
|
float microfacetDistribution(PBRInfo pbrInputs)
|
|
311
236
|
{
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
237
|
+
float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;
|
|
238
|
+
float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;
|
|
239
|
+
return roughnessSq / (M_PI * f * f);
|
|
315
240
|
}
|
|
316
|
-
|
|
317
241
|
void PBRInfo_setAmbientLight(inout PBRInfo pbrInputs) {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
242
|
+
pbrInputs.NdotL = 1.0;
|
|
243
|
+
pbrInputs.NdotH = 0.0;
|
|
244
|
+
pbrInputs.LdotH = 0.0;
|
|
245
|
+
pbrInputs.VdotH = 1.0;
|
|
322
246
|
}
|
|
323
|
-
|
|
324
247
|
void PBRInfo_setDirectionalLight(inout PBRInfo pbrInputs, vec3 lightDirection) {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
pbrInputs.VdotH = clamp(dot(v, h), 0.0, 1.0);
|
|
248
|
+
vec3 n = pbrInputs.n;
|
|
249
|
+
vec3 v = pbrInputs.v;
|
|
250
|
+
vec3 l = normalize(lightDirection);
|
|
251
|
+
vec3 h = normalize(l+v);
|
|
252
|
+
pbrInputs.NdotL = clamp(dot(n, l), 0.001, 1.0);
|
|
253
|
+
pbrInputs.NdotH = clamp(dot(n, h), 0.0, 1.0);
|
|
254
|
+
pbrInputs.LdotH = clamp(dot(l, h), 0.0, 1.0);
|
|
255
|
+
pbrInputs.VdotH = clamp(dot(v, h), 0.0, 1.0);
|
|
334
256
|
}
|
|
335
|
-
|
|
336
257
|
void PBRInfo_setPointLight(inout PBRInfo pbrInputs, PointLight pointLight) {
|
|
337
|
-
|
|
338
|
-
|
|
258
|
+
vec3 light_direction = normalize(pointLight.position - pbr_vPosition);
|
|
259
|
+
PBRInfo_setDirectionalLight(pbrInputs, light_direction);
|
|
339
260
|
}
|
|
340
|
-
|
|
341
261
|
vec3 calculateFinalColor(PBRInfo pbrInputs, vec3 lightColor) {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);
|
|
349
|
-
vec3 specContrib = F * G * D / (4.0 * pbrInputs.NdotL * pbrInputs.NdotV);
|
|
350
|
-
// Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)
|
|
351
|
-
return pbrInputs.NdotL * lightColor * (diffuseContrib + specContrib);
|
|
262
|
+
vec3 F = specularReflection(pbrInputs);
|
|
263
|
+
float G = geometricOcclusion(pbrInputs);
|
|
264
|
+
float D = microfacetDistribution(pbrInputs);
|
|
265
|
+
vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);
|
|
266
|
+
vec3 specContrib = F * G * D / (4.0 * pbrInputs.NdotL * pbrInputs.NdotV);
|
|
267
|
+
return pbrInputs.NdotL * lightColor * (diffuseContrib + specContrib);
|
|
352
268
|
}
|
|
353
|
-
|
|
354
269
|
vec4 pbr_filterColor(vec4 colorUnused)
|
|
355
270
|
{
|
|
356
|
-
// The albedo may be defined from a base texture or a flat color
|
|
357
271
|
#ifdef HAS_BASECOLORMAP
|
|
358
|
-
|
|
272
|
+
vec4 baseColor = SRGBtoLINEAR(texture(u_BaseColorSampler, pbr_vUV)) * u_BaseColorFactor;
|
|
359
273
|
#else
|
|
360
|
-
|
|
274
|
+
vec4 baseColor = u_BaseColorFactor;
|
|
361
275
|
#endif
|
|
362
|
-
|
|
363
276
|
#ifdef ALPHA_CUTOFF
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
#endif
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
// Metallic and Roughness material properties are packed together
|
|
376
|
-
// In glTF, these factors can be specified by fixed scalar values
|
|
377
|
-
// or from a metallic-roughness map
|
|
378
|
-
float perceptualRoughness = u_MetallicRoughnessValues.y;
|
|
379
|
-
float metallic = u_MetallicRoughnessValues.x;
|
|
277
|
+
if (baseColor.a < u_AlphaCutoff) {
|
|
278
|
+
discard;
|
|
279
|
+
}
|
|
280
|
+
#endif
|
|
281
|
+
vec3 color = vec3(0, 0, 0);
|
|
282
|
+
if(pbr_uUnlit){
|
|
283
|
+
color.rgb = baseColor.rgb;
|
|
284
|
+
}
|
|
285
|
+
else{
|
|
286
|
+
float perceptualRoughness = u_MetallicRoughnessValues.y;
|
|
287
|
+
float metallic = u_MetallicRoughnessValues.x;
|
|
380
288
|
#ifdef HAS_METALROUGHNESSMAP
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
0.0, // NdotL
|
|
417
|
-
NdotV,
|
|
418
|
-
0.0, // NdotH
|
|
419
|
-
0.0, // LdotH
|
|
420
|
-
0.0, // VdotH
|
|
421
|
-
perceptualRoughness,
|
|
422
|
-
metallic,
|
|
423
|
-
specularEnvironmentR0,
|
|
424
|
-
specularEnvironmentR90,
|
|
425
|
-
alphaRoughness,
|
|
426
|
-
diffuseColor,
|
|
427
|
-
specularColor,
|
|
428
|
-
n,
|
|
429
|
-
v
|
|
430
|
-
);
|
|
431
|
-
|
|
289
|
+
vec4 mrSample = texture(u_MetallicRoughnessSampler, pbr_vUV);
|
|
290
|
+
perceptualRoughness = mrSample.g * perceptualRoughness;
|
|
291
|
+
metallic = mrSample.b * metallic;
|
|
292
|
+
#endif
|
|
293
|
+
perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);
|
|
294
|
+
metallic = clamp(metallic, 0.0, 1.0);
|
|
295
|
+
float alphaRoughness = perceptualRoughness * perceptualRoughness;
|
|
296
|
+
vec3 f0 = vec3(0.04);
|
|
297
|
+
vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);
|
|
298
|
+
diffuseColor *= 1.0 - metallic;
|
|
299
|
+
vec3 specularColor = mix(f0, baseColor.rgb, metallic);
|
|
300
|
+
float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
|
|
301
|
+
float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);
|
|
302
|
+
vec3 specularEnvironmentR0 = specularColor.rgb;
|
|
303
|
+
vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;
|
|
304
|
+
vec3 n = getNormal();
|
|
305
|
+
vec3 v = normalize(u_Camera - pbr_vPosition);
|
|
306
|
+
float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
|
|
307
|
+
vec3 reflection = -normalize(reflect(v, n));
|
|
308
|
+
PBRInfo pbrInputs = PBRInfo(
|
|
309
|
+
0.0,
|
|
310
|
+
NdotV,
|
|
311
|
+
0.0,
|
|
312
|
+
0.0,
|
|
313
|
+
0.0,
|
|
314
|
+
perceptualRoughness,
|
|
315
|
+
metallic,
|
|
316
|
+
specularEnvironmentR0,
|
|
317
|
+
specularEnvironmentR90,
|
|
318
|
+
alphaRoughness,
|
|
319
|
+
diffuseColor,
|
|
320
|
+
specularColor,
|
|
321
|
+
n,
|
|
322
|
+
v
|
|
323
|
+
);
|
|
432
324
|
#ifdef USE_LIGHTS
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
float attenuation = getPointLightAttenuation(lighting_uPointLight[i], distance(lighting_uPointLight[i].position, pbr_vPosition));
|
|
450
|
-
color += calculateFinalColor(pbrInputs, lighting_uPointLight[i].color / attenuation);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
#endif
|
|
454
|
-
|
|
455
|
-
// Calculate lighting contribution from image based lighting source (IBL)
|
|
325
|
+
PBRInfo_setAmbientLight(pbrInputs);
|
|
326
|
+
color += calculateFinalColor(pbrInputs, lighting_uAmbientLight.color);
|
|
327
|
+
for(int i = 0, i < lighting_uDirectionalLightCount, i++) {
|
|
328
|
+
if (i < lighting_uDirectionalLightCount) {
|
|
329
|
+
PBRInfo_setDirectionalLight(pbrInputs, lighting_uDirectionalLight[i].direction);
|
|
330
|
+
color += calculateFinalColor(pbrInputs, lighting_uDirectionalLight[i].color);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
for(int i = 0, i < lighting_uPointLightCount, i++) {
|
|
334
|
+
if (i < lighting_uPointLightCount) {
|
|
335
|
+
PBRInfo_setPointLight(pbrInputs, lighting_uPointLight[i]);
|
|
336
|
+
float attenuation = getPointLightAttenuation(lighting_uPointLight[i], distance(lighting_uPointLight[i].position, pbr_vPosition));
|
|
337
|
+
color += calculateFinalColor(pbrInputs, lighting_uPointLight[i].color / attenuation);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
#endif
|
|
456
341
|
#ifdef USE_IBL
|
|
457
|
-
|
|
342
|
+
color += getIBLContribution(pbrInputs, n, reflection);
|
|
458
343
|
#endif
|
|
459
|
-
|
|
460
|
-
// Apply optional PBR terms for additional (optional) shading
|
|
461
344
|
#ifdef HAS_OCCLUSIONMAP
|
|
462
|
-
|
|
463
|
-
|
|
345
|
+
float ao = texture(u_OcclusionSampler, pbr_vUV).r;
|
|
346
|
+
color = mix(color, color * ao, u_OcclusionStrength);
|
|
464
347
|
#endif
|
|
465
|
-
|
|
466
348
|
#ifdef HAS_EMISSIVEMAP
|
|
467
|
-
|
|
468
|
-
|
|
349
|
+
vec3 emissive = SRGBtoLINEAR(texture(u_EmissiveSampler, pbr_vUV)).rgb * u_EmissiveFactor;
|
|
350
|
+
color += emissive;
|
|
469
351
|
#endif
|
|
470
|
-
|
|
471
|
-
// This section uses mix to override final color for reference app visualization
|
|
472
|
-
// of various parameters in the lighting equation.
|
|
473
352
|
#ifdef PBR_DEBUG
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
// color = mix(color, diffuseContrib, u_ScaleDiffBaseMR.x);
|
|
482
|
-
color = mix(color, baseColor.rgb, u_ScaleDiffBaseMR.y);
|
|
483
|
-
color = mix(color, vec3(metallic), u_ScaleDiffBaseMR.z);
|
|
484
|
-
color = mix(color, vec3(perceptualRoughness), u_ScaleDiffBaseMR.w);
|
|
485
|
-
#endif
|
|
486
|
-
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
|
|
353
|
+
color = mix(color, baseColor.rgb, u_ScaleDiffBaseMR.y);
|
|
354
|
+
color = mix(color, vec3(metallic), u_ScaleDiffBaseMR.z);
|
|
355
|
+
color = mix(color, vec3(perceptualRoughness), u_ScaleDiffBaseMR.w);
|
|
356
|
+
#endif
|
|
357
|
+
}
|
|
358
|
+
return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
|
|
490
359
|
}
|
|
491
|
-
`;var
|
|
360
|
+
`;var Na={name:"pbr",vs:Df,fs:Uf,defines:{LIGHTING_FRAGMENT:1},dependencies:[Nf]};var Hf=N(Ra(),1),zf=N(Ws(),1);var Gf=`#version 300 es
|
|
492
361
|
#define SHADER_NAME simple-mesh-layer-vs
|
|
493
362
|
uniform float sizeScale;
|
|
494
363
|
uniform bool composeModelMatrix;
|
|
@@ -550,7 +419,7 @@ geometry.uv = pbr_vUV;
|
|
|
550
419
|
#endif
|
|
551
420
|
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
552
421
|
}
|
|
553
|
-
`;var
|
|
422
|
+
`;var Vf=`#version 300 es
|
|
554
423
|
#define SHADER_NAME simple-mesh-layer-fs
|
|
555
424
|
precision highp float;
|
|
556
425
|
uniform bool hasTexture;
|
|
@@ -582,6 +451,6 @@ fragColor = vec4(lightColor, color.a * opacity);
|
|
|
582
451
|
#endif
|
|
583
452
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
584
453
|
}
|
|
585
|
-
`;function cT(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 lT={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},ti=class extends Kf.SimpleMeshLayer{getShaders(){let t=super.getShaders();return t.modules.push(qa),{...t,vs:Xf,fs:Wf}}initializeState(){let{featureIds:t}=this.props;super.initializeState();let n=this.getAttributeManager();t&&n.add({featureIdsPickingColors:{type:"uint8",size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})}updateState(t){super.updateState(t);let{props:n,oldProps:r}=t;n.pbrMaterial!==r.pbrMaterial&&this.updatePbrMaterialUniforms(n.pbrMaterial)}draw(t){let{featureIds:n}=this.props;this.state.model&&(this.state.model.setUniforms({u_Camera:this.state.model.uniforms.project_uCameraPosition,pickFeatureIds:Boolean(n)}),super.draw(t))}getModel(t){let{id:n,pbrMaterial:r}=this.props,s=this.parseMaterial(r,t);this.setState({parsedPBRMaterial:s});let i=this.getShaders();return cT(t.attributes),new Yf.Model(this.context.device,{...this.getShaders(),id:n,geometry:t,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:{...i.defines,...s?.defines,HAS_UV_REGIONS:t.attributes.uvRegions?1:0},parameters:s?.parameters,isInstanced:!0})}updatePbrMaterialUniforms(t){let{model:n}=this.state;if(n){let{mesh:r}=this.props,s=this.parseMaterial(t,r);this.setState({parsedPBRMaterial:s}),n.setBindings(s.bindings),n.setUniforms(s.uniforms)}}parseMaterial(t,n){let r=Boolean(t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture);return Pa(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})}},Cr=ti;(()=>{ti.layerName="MeshLayer"})(),(()=>{ti.defaultProps=lT})();var mp=N(bn(),1);var ue=6356752314245179e-9,uT={radii:[6378137,6378137,ue],radiiSquared:[6378137*6378137,6378137*6378137,ue*ue],oneOverRadii:[1/6378137,1/6378137,1/ue],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(ue*ue)],maximumRadius:Math.max(6378137,6378137,ue),centerToleranceSquared:.1};function ei(e){return e}var YL=new x;function hT(e,t=[],n=ei){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 Zf(e,t=[]){return hT(e,t,K._cartographicRadians?ei:Go)}function fT(e,t,n=ei){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 $f(e,t){return fT(e,t,K._cartographicRadians?ei:Vo)}var td=1e-14,dT=new x,ed={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"}},ja={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},br={east:new x,north:new x,up:new x,west:new x,south:new x,down:new x},mT=new x,pT=new x,gT=new x;function Xa(e,t,n,r,s,i){let o=ed[t]&&ed[t][n];ct(o&&(!r||r===o));let a,c,l,u=dT.copy(s);if(gt(u.x,0,td)&>(u.y,0,td)){let f=Math.sign(u.z);a=mT.fromArray(ja[t]),t!=="east"&&t!=="west"&&a.scale(f),c=pT.fromArray(ja[n]),n!=="east"&&n!=="west"&&c.scale(f),l=gT.fromArray(ja[r]),r!=="east"&&r!=="west"&&l.scale(f)}else{let{up:f,east:d,north:m}=br;d.set(-u.y,u.x,0).normalize(),e.geodeticSurfaceNormal(u,f),m.copy(f).cross(d);let{down:A,west:g,south:y}=br;A.copy(f).scale(-1),g.copy(d).scale(-1),y.copy(m).scale(-1),a=br[t],c=br[n],l=br[r]}return i[0]=a.x,i[1]=a.y,i[2]=a.z,i[3]=0,i[4]=c.x,i[5]=c.y,i[6]=c.z,i[7]=0,i[8]=l.x,i[9]=l.y,i[10]=l.z,i[11]=0,i[12]=u.x,i[13]=u.y,i[14]=u.z,i[15]=1,i}var Sn=new x,AT=new x,xT=new x;function nd(e,t,n=[]){let{oneOverRadii:r,oneOverRadiiSquared:s,centerToleranceSquared:i}=t;Sn.from(e);let o=Sn.x,a=Sn.y,c=Sn.z,l=r.x,u=r.y,h=r.z,f=o*o*l*l,d=a*a*u*u,m=c*c*h*h,A=f+d+m,g=Math.sqrt(1/A);if(!Number.isFinite(g))return;let y=AT;if(y.copy(e).scale(g),A<i)return y.to(n);let E=s.x,_=s.y,B=s.z,b=xT;b.set(y.x*E*2,y.y*_*2,y.z*B*2);let S=(1-g)*Sn.len()/(.5*b.len()),w=0,C,T,p,M;do{S-=w,C=1/(1+S*E),T=1/(1+S*_),p=1/(1+S*B);let F=C*C,R=T*T,v=p*p,D=F*C,W=R*T,z=v*p;M=f*F+d*R+m*v-1;let X=-2*(f*D*E+d*W*_+m*z*B);w=M/X}while(Math.abs(M)>Gt.EPSILON12);return Sn.scale([C,T,p]).to(n)}var ni=new x,rd=new x,_T=new x,Jt=new x,ET=new x,ri=new x,U=class{constructor(t=0,n=0,r=0){L(this,"radii",void 0),L(this,"radiiSquared",void 0),L(this,"radiiToTheFourth",void 0),L(this,"oneOverRadii",void 0),L(this,"oneOverRadiiSquared",void 0),L(this,"minimumRadius",void 0),L(this,"maximumRadius",void 0),L(this,"centerToleranceSquared",Gt.EPSILON1),L(this,"squaredXOverSquaredZ",void 0),ct(t>=0),ct(n>=0),ct(r>=0),this.radii=new x(t,n,r),this.radiiSquared=new x(t*t,n*n,r*r),this.radiiToTheFourth=new x(t*t*t*t,n*n*n*n,r*r*r*r),this.oneOverRadii=new x(t===0?0:1/t,n===0?0:1/n,r===0?0:1/r),this.oneOverRadiiSquared=new x(t===0?0:1/(t*t),n===0?0:1/(n*n),r===0?0:1/(r*r)),this.minimumRadius=Math.min(t,n,r),this.maximumRadius=Math.max(t,n,r),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,n=[0,0,0]){let r=rd,s=_T,[,,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]){ri.from(t);let r=this.scaleToGeodeticSurface(ri,Jt);if(!r)return;let s=this.geodeticSurfaceNormal(r,rd),i=ET;i.copy(ri).subtract(r);let o=Math.atan2(s.y,s.x),a=Math.asin(s.z),c=Math.sign(xn.dot(i,ri))*xn.length(i);return $f([o,a,c],n)}eastNorthUpToFixedFrame(t,n=new P){return Xa(this,"east","north","up",t,n)}localFrameToFixedFrame(t,n,r,s,i=new P){return Xa(this,t,n,r,s,i)}geocentricSurfaceNormal(t,n=[0,0,0]){return ni.from(t).normalize().to(n)}geodeticSurfaceNormalCartographic(t,n=[0,0,0]){let r=Zf(t),s=r[0],i=r[1],o=Math.cos(i);return ni.set(o*Math.cos(s),o*Math.sin(s),Math.sin(i)).normalize(),ni.to(n)}geodeticSurfaceNormal(t,n=[0,0,0]){return ni.from(t).scale(this.oneOverRadiiSquared).normalize().to(n)}scaleToGeodeticSurface(t,n){return nd(t,this,n)}scaleToGeocentricSurface(t,n=[0,0,0]){Jt.from(t);let r=Jt.x,s=Jt.y,i=Jt.z,o=this.oneOverRadiiSquared,a=1/Math.sqrt(r*r*o.x+s*s*o.y+i*i*o.z);return Jt.multiplyScalar(a).to(n)}transformPositionToScaledSpace(t,n=[0,0,0]){return Jt.from(t).scale(this.oneOverRadii).to(n)}transformPositionFromScaledSpace(t,n=[0,0,0]){return Jt.from(t).scale(this.radii).to(n)}getSurfaceNormalIntersectionWithZAxis(t,n=0,r=[0,0,0]){ct(gt(this.radii.x,this.radii.y,Gt.EPSILON15)),ct(this.radii.z>0),Jt.from(t);let s=Jt.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(s)>=this.radii.z-n))return Jt.set(0,0,s).to(r)}};L(U,"WGS84",new U(6378137,6378137,ue));var si=class{constructor(t,n,r){this.item=void 0,this.previous=void 0,this.next=void 0,this.item=t,this.previous=n,this.next=r}};var ii=class{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(t){let n=new si(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 oi=class{constructor(){this._list=void 0,this._sentinel=void 0,this._trimTiles=void 0,this._list=new ii,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let n=t._cacheNode;n&&this._list.splice(this._sentinel,n)}add(t,n,r){n._cacheNode||(n._cacheNode=this._list.add(n),r&&r(t,n))}unloadTile(t,n,r){let s=n._cacheNode;s&&(this._list.remove(s),n._cacheNode=null,r&&r(t,n))}unloadTiles(t,n){let r=this._trimTiles;this._trimTiles=!1;let s=this._list,i=t.maximumMemoryUsage*1024*1024,o=this._sentinel,a=s.head;for(;a!==o&&(t.gpuMemoryUsageInBytes>i||r);){let c=a.item;a=a.next,this.unloadTile(t,c,n)}}trim(){this._trimTiles=!0}};function sd(e,t){V(e),V(t);let{rtcCenter:n,gltfUpAxis:r}=t,{computedTransform:s,boundingVolume:{center:i}}=e,o=new P(s);switch(n&&o.translate(n),r){case"Z":break;case"Y":let h=new P().rotateX(Math.PI/2);o=o.multiplyRight(h);break;case"X":let f=new P().rotateY(-Math.PI/2);o=o.multiplyRight(f);break;default:break}t.isQuantized&&o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let a=new x(i);t.cartesianModelMatrix=o,t.cartesianOrigin=a;let c=U.WGS84.cartesianToCartographic(a,new x),u=U.WGS84.eastNorthUpToFixedFrame(a).invert();t.cartographicModelMatrix=u.multiplyRight(o),t.cartographicOrigin=c,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var id=new x,Wa=new x,Ya=new ot([new lt,new lt,new lt,new lt,new lt,new lt]);function ad(e,t){let{cameraDirection:n,cameraUp:r,height:s}=e,{metersPerUnit:i}=e.distanceScales,o=ai(e,e.center),a=U.WGS84.eastNorthUpToFixedFrame(o),c=e.unprojectPosition(e.cameraPosition),l=U.WGS84.cartographicToCartesian(c,new x),u=new x(a.transformAsVector(new x(n).scale(i))).normalize(),h=new x(a.transformAsVector(new x(r).scale(i))).normalize();BT(e);let f=e.constructor,{longitude:d,latitude:m,width:A,bearing:g,zoom:y}=e,E=new f({longitude:d,latitude:m,height:s,width:A,bearing:g,zoom:y,pitch:0});return{camera:{position:l,direction:u,up:h},viewport:e,topDownViewport:E,height:s,cullingVolume:Ya,frameNumber:t,sseDenominator:1.15}}function cd(e,t,n){if(n===0||e.length<=n)return[e,[]];let r=[],{longitude:s,latitude:i}=t.viewport;for(let[l,u]of e.entries()){let[h,f]=u.header.mbs,d=Math.abs(s-h),m=Math.abs(i-f),A=Math.sqrt(m*m+d*d);r.push([l,A])}let o=r.sort((l,u)=>l[1]-u[1]),a=[];for(let l=0;l<n;l++)a.push(e[o[l][0]]);let c=[];for(let l=n;l<o.length;l++)c.push(e[o[l][0]]);return[a,c]}function BT(e){let t=e.getFrustumPlanes(),n=od(t.near,e.cameraPosition),r=ai(e,n),s=ai(e,e.cameraPosition,Wa),i=0;Ya.planes[i++].fromPointNormal(r,id.copy(r).subtract(s));for(let o in t){if(o==="near")continue;let a=t[o],c=od(a,n,Wa),l=ai(e,c,Wa);Ya.planes[i++].fromPointNormal(l,id.copy(r).subtract(l))}}function od(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new x,r=e.normal.dot(t);return n.copy(e.normal).scale(e.distance-r).add(t),n}function ai(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new x,r=e.unprojectPosition(t);return U.WGS84.cartographicToCartesian(r,n)}var CT=6378137,bT=6378137,Ka=6356752314245179e-9,Mn=new x;function ld(e,t){if(e instanceof Ht){let{halfAxes:n}=e,r=ST(n);return Math.log2(Ka/(r+t[2]))}else if(e instanceof Ft){let{radius:n}=e;return Math.log2(Ka/(n+t[2]))}else if(e.width&&e.height){let{width:n,height:r}=e,s=Math.log2(CT/n),i=Math.log2(bT/r);return(s+i)/2}return 1}function Qa(e,t,n){U.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],Mn);let r=Math.sqrt(Math.pow(Mn[0]-n[0],2)+Math.pow(Mn[1]-n[1],2)+Math.pow(Mn[2]-n[2],2));return Math.log2(Ka/(r+t[2]))}function ud(e,t,n){let[r,s,i,o]=e;return Qa({xmin:r,xmax:i,ymin:s,ymax:o,zmin:0,zmax:0},t,n)}function ST(e){e.getColumn(0,Mn);let t=e.getColumn(1),n=e.getColumn(2);return Mn.add(t).add(n).len()}var Md=N(bn(),1);var At={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Tt=function(e){return e[e.ADD=1]="ADD",e[e.REPLACE=2]="REPLACE",e}({}),ne=function(e){return e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh",e}({}),ht=function(e){return e.I3S="I3S",e.TILES3D="TILES3D",e}({}),Ye=function(e){return e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold",e}({}),hd={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function pd(e){return e!=null}var ft=new x,ci=new x,MT=new x,IT=new x,Ke=new x,fd=new x,dd=new x,md=new x;function li(e,t,n){if(V(e,"3D Tile: boundingVolume must be defined"),e.box)return Ad(e.box,t,n);if(e.region)return vT(e.region);if(e.sphere)return wT(e.sphere,t,n);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function gd(e,t){if(e.box)return FT(t);if(e.region){let[n,r,s,i,o,a]=e.region;return[[Mt(n),Mt(r),o],[Mt(s),Mt(i),a]]}if(e.sphere)return RT(t);throw new Error("Unkown boundingVolume type")}function Ad(e,t,n){let r=new x(e[0],e[1],e[2]);t.transform(r,r);let s=[];if(e.length===10){let l=e.slice(3,6),u=new Zt;u.fromArray(e,6);let h=new x([1,0,0]),f=new x([0,1,0]),d=new x([0,0,1]);h.transformByQuaternion(u),h.scale(l[0]),f.transformByQuaternion(u),f.scale(l[1]),d.transformByQuaternion(u),d.scale(l[2]),s=[...h.toArray(),...f.toArray(),...d.toArray()]}else s=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let i=t.transformAsVector(s.slice(0,3)),o=t.transformAsVector(s.slice(3,6)),a=t.transformAsVector(s.slice(6,9)),c=new k([i[0],i[1],i[2],o[0],o[1],o[2],a[0],a[1],a[2]]);return pd(n)?(n.center=r,n.halfAxes=c,n):new Ht(r,c)}function wT(e,t,n){let r=new x(e[0],e[1],e[2]);t.transform(r,r);let s=t.getScale(ci),i=Math.max(Math.max(s[0],s[1]),s[2]),o=e[3]*i;return pd(n)?(n.center=r,n.radius=o,n):new Ft(r,o)}function vT(e){let[t,n,r,s,i,o]=e,a=U.WGS84.cartographicToCartesian([Mt(t),Mt(s),i],MT),c=U.WGS84.cartographicToCartesian([Mt(r),Mt(n),o],IT),l=new x().addVectors(a,c).multiplyByScalar(.5);return U.WGS84.cartesianToCartographic(l,Ke),U.WGS84.cartographicToCartesian([Mt(r),Ke[1],Ke[2]],fd),U.WGS84.cartographicToCartesian([Ke[0],Mt(s),Ke[2]],dd),U.WGS84.cartographicToCartesian([Ke[0],Ke[1],o],md),Ad([...l,...fd.subtract(l),...dd.subtract(l),...md.subtract(l)],new P)}function FT(e){let t=xd(),{halfAxes:n}=e,r=new x(n.getColumn(0)),s=new x(n.getColumn(1)),i=new x(n.getColumn(2));for(let o=0;o<2;o++){for(let a=0;a<2;a++){for(let c=0;c<2;c++)ft.copy(e.center),ft.add(r),ft.add(s),ft.add(i),yd(t,ft),i.negate();s.negate()}r.negate()}return t}function RT(e){let t=xd(),{center:n,radius:r}=e,s=U.WGS84.scaleToGeodeticSurface(n,ft),i;s?i=U.WGS84.geodeticSurfaceNormal(s):i=new x(0,0,1);let o=new x(i[2],-i[1],0);o.len()>0?o.normalize():o=new x(0,1,0);let a=o.clone().cross(i);for(let c of[o,a,i]){ci.copy(c).scale(r);for(let l=0;l<2;l++)ft.copy(n),ft.add(ci),yd(t,ft),ci.negate()}return t}function xd(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function yd(e,t){U.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 N3=new x,D3=new x,U3=new P,G3=new x,V3=new x,H3=new x;function LT(e,t){let n=e*t;return 1-Math.exp(-(n*n))}function PT(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){let n=e.dynamicScreenSpaceErrorComputedDensity,r=e.dynamicScreenSpaceErrorFactor;return LT(t,n)*r}return 0}function Td(e,t,n){let r=e.tileset,s=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,i=n?s:e.lodMetricValue;if(i===0)return 0;let o=Math.max(e._distanceToCamera,1e-7),{height:a,sseDenominator:c}=t,{viewDistanceScale:l}=r.options,u=i*a*(l||1)/(o*c);return u-=PT(r,o),u}var Za=new x,_d=new x,we=new x,Ed=new x,OT=new x,$a=new P,Bd=new P;function Cd(e,t){if(e.lodMetricValue===0||isNaN(e.lodMetricValue))return"DIG";let n=2*tc(e,t);return n<2?"OUT":!e.header.children||n<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}function tc(e,t){let{topDownViewport:n}=t,r=e.header.mbs[1],s=e.header.mbs[0],i=e.header.mbs[2],o=e.header.mbs[3],a=[...e.boundingVolume.center],c=n.unprojectPosition(n.cameraPosition);U.WGS84.cartographicToCartesian(c,Za),_d.copy(Za).subtract(a).normalize(),U.WGS84.eastNorthUpToFixedFrame(a,$a),Bd.copy($a).invert(),we.copy(Za).transform(Bd);let l=Math.sqrt(we[0]*we[0]+we[1]*we[1]),u=l*l/we[2];Ed.copy([we[0],we[1],u]);let f=Ed.transform($a).subtract(a).normalize(),m=_d.cross(f).normalize().scale(o).add(a),A=U.WGS84.cartesianToCartographic(m),g=n.project([s,r,i]),y=n.project(A);return OT.copy(g).subtract(y).magnitude()}function bd(e){return{assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}}var Sr=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;this._map=new Map,this._array=void 0,this._length=void 0,this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return V(t<this._array.length),this._array[t]}set(t,n){V(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=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){V(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){V(t>=0),this.length=t}trim(t){t==null&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}};var NT={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},re=class{traversalFinished(t){return!0}constructor(t){this.options=void 0,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={},this.lastUpdate=new Date().getTime(),this.updateDebounceTime=1e3,this._traversalStack=new Sr,this._emptyTraversalStack=new Sr,this._frameNumber=null,this.options={...NT,...t}}traverse(t,n,r){this.root=t,this.options={...this.options,...r},this.reset(),this.updateTile(t,n),this._frameNumber=n.frameNumber,this.executeTraversal(t,n)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,n){let r=this._traversalStack;for(t._selectionDepth=1,r.push(t);r.length>0;){let i=r.pop(),o=!1;this.canTraverse(i,n)&&(this.updateChildTiles(i,n),o=this.updateAndPushChildren(i,n,r,i.hasRenderContent?i._selectionDepth+1:i._selectionDepth));let a=i.parent,c=Boolean(!a||a._shouldRefine),l=!o;i.hasRenderContent?i.refine===Tt.ADD?(this.loadTile(i,n),this.selectTile(i,n)):i.refine===Tt.REPLACE&&(this.loadTile(i,n),l&&this.selectTile(i,n)):(this.emptyTiles[i.id]=i,this.loadTile(i,n),l&&this.selectTile(i,n)),this.touchTile(i,n),i._shouldRefine=o&&c}let s=new Date().getTime();(this.traversalFinished(n)||s-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=s,this.options.onTraversalEnd(n))}updateChildTiles(t,n){let r=t.children;for(let s of r)this.updateTile(s,n)}updateAndPushChildren(t,n,r,s){let{loadSiblings:i,skipLevelOfDetail:o}=this.options,a=t.children;a.sort(this.compareDistanceToCamera.bind(this));let c=t.refine===Tt.REPLACE&&t.hasRenderContent&&!o,l=!1,u=!0;for(let h of a)if(h._selectionDepth=s,h.isVisibleAndInRequestVolume?(r.find(h)&&r.delete(h),r.push(h),l=!0):(c||i)&&(this.loadTile(h,n),this.touchTile(h,n)),c){let f;if(h._inRequestVolume?h.hasRenderContent?f=h.contentAvailable:f=this.executeEmptyTraversal(h,n):f=!1,u=u&&f,!u)return!1}return l||(u=!1),u}updateTile(t,n){this.updateTileVisibility(t,n)}selectTile(t,n){this.shouldSelectTile(t)&&(t._selectedFrame=n.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,n){this.shouldLoadTile(t)&&(t._requestedFrame=n.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,n){t.tileset._cache.touch(t),t._touchedFrame=n.frameNumber}canTraverse(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return t.hasChildren?t.hasTilesetContent?!t.contentExpired:!s&&!t.isVisibleAndInRequestVolume?!1:this.shouldRefine(t,n,r):!1}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=t._screenSpaceError;return r&&(s=t.getScreenSpaceError(n,!0)),s>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,n){let r=[];if(this.options.viewportTraversersMap)for(let s in this.options.viewportTraversersMap)this.options.viewportTraversersMap[s]===n.viewport.id&&r.push(s);else r.push(n.viewport.id);t.updateVisibility(n,r)}compareDistanceToCamera(t,n){return t._distanceToCamera-n._distanceToCamera}anyChildrenVisible(t,n){let r=!1;for(let s of t.children)s.updateVisibility(n),r=r||s.isVisibleAndInRequestVolume;return r}executeEmptyTraversal(t,n){let r=!0,s=this._emptyTraversalStack;for(s.push(t);s.length>0;){let i=s.pop(),o=!i.hasRenderContent&&this.canTraverse(i,n,!1,!1),a=!i.hasRenderContent&&i.children.length===0;if(!o&&!i.contentAvailable&&!a&&(r=!1),this.updateTile(i,n),i.isVisibleAndInRequestVolume||(this.loadTile(i,n),this.touchTile(i,n)),o){let c=i.children;for(let l of c)s.push(l)}}return r}};var Sd=new x;function DT(e){return e!=null}var Qe=class{constructor(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"";this.tileset=void 0,this.header=void 0,this.id=void 0,this.url=void 0,this.parent=void 0,this.refine=void 0,this.type=void 0,this.contentUrl=void 0,this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=At.UNLOADED,this.gpuMemoryUsageInBytes=0,this.children=[],this.depth=0,this.viewportIds=[],this.transform=new P,this.extensions=null,this.implicitTiling=null,this.userData={},this.computedTransform=void 0,this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.traverser=new re({}),this._cacheNode=null,this._frameNumber=null,this._expireDate=null,this._expiredContent=null,this._boundingBox=void 0,this._distanceToCamera=0,this._screenSpaceError=0,this._visibilityPlaneMask=void 0,this._visible=void 0,this._contentBoundingVolume=void 0,this._viewerRequestVolume=void 0,this._initialTransform=new P,this._priority=0,this._selectedFrame=0,this._requestedFrame=0,this._selectionDepth=0,this._touchedFrame=0,this._centerZDepth=0,this._shouldRefine=!1,this._stackLength=0,this._visitedFrame=0,this._inRequestVolume=!1,this._lodJudge=null,this.header=n,this.tileset=t,this.id=s||n.id,this.url=n.url,this.parent=r,this.refine=this._getRefine(n.refine),this.type=n.type,this.contentUrl=n.contentUrl,this._initializeLodMetric(n),this._initializeTransforms(n),this._initializeBoundingVolumes(n),this._initializeContent(n),this._initializeRenderingState(n),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===At.READY||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===At.UNLOADED}get contentExpired(){return this.contentState===At.EXPIRED}get contentFailed(){return this.contentState===At.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=gd(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,n){switch(this.tileset.type){case ht.I3S:return tc(this,t);case ht.TILES3D:return Td(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===Tt.ADD||n;if(r&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===At.UNLOADED)return-1;let s=this.parent,o=s&&(!r||this._screenSpaceError===0||s.hasTilesetContent)?s._screenSpaceError:this._screenSpaceError,a=t.root?t.root._screenSpaceError:0;return Math.max(a-o,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=At.LOADING;let n=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!n)return this.contentState=At.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,Md.load)(r,s,i),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=At.READY,this._onContentLoaded(),!0}catch(r){throw this.contentState=At.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=At.UNLOADED,!0}updateVisibility(t,n){if(this._frameNumber===t.frameNumber)return;let r=this.parent,s=r?r._visibilityPlaneMask:ot.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!==ot.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=n}visibility(t,n){let{cullingVolume:r}=t,{boundingVolume:s}=this;return r.computeVisibilityWithPlaneMask(s,n)}contentVisibility(){return!0}distanceToTile(t){let n=this.boundingVolume;return Math.sqrt(Math.max(n.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth(t){let{camera:n}=t,r=this.boundingVolume;return Sd.subVectors(r.center,n.position),n.direction.dot(Sd)}insideViewerRequestVolume(t){let n=this._viewerRequestVolume;return!n||n.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(DT(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=At.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in t?this.lodMetricValue=t.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(t){this.transform=t.transform?new P(t.transform):new P;let n=this.parent,r=this.tileset,s=n&&n.computedTransform?n.computedTransform.clone():r.modelMatrix.clone();this.computedTransform=new P(s).multiplyRight(this.transform);let i=n&&n._initialTransform?n._initialTransform.clone():new P;this._initialTransform=new P(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=At.UNLOADED,this.hasTilesetContent=!1,t.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=ot.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(t){return t||this.parent&&this.parent.refine||Tt.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=li(t.boundingVolume,this.computedTransform,this.boundingVolume);let n=t.content;n&&(n.boundingVolume&&(this._contentBoundingVolume=li(n.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=li(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(){let n=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:new P).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 bd(this.tileset.tileset)}}};var ui=class extends re{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===Tt.REPLACE,i=t._optimChildrenWithinParent===hd.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!==Tt.ADD?!1:!this.shouldRefine(t,n,!0)}};var Id=N(bn(),1);var hi=class{constructor(){this.frameNumberMap=new Map}register(t,n){let r=this.frameNumberMap.get(t)||new Map,s=r.get(n)||0;r.set(n,s+1),this.frameNumberMap.set(t,r)}deregister(t,n){let r=this.frameNumberMap.get(t);if(!r)return;let s=r.get(n)||1;r.set(n,s-1)}isZero(t,n){var r;return(((r=this.frameNumberMap.get(t))===null||r===void 0?void 0:r.get(n))||0)===0}};var ec={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},fi=class{constructor(){this._statusMap=void 0,this.pendingTilesRegister=new hi,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:ec.REQUESTED},this.pendingTilesRegister.register(o,i),t().then(a=>{this._statusMap[n].status=ec.COMPLETED;let{frameNumber:c,viewport:{id:l}}=this._statusMap[n].frameState;this.pendingTilesRegister.deregister(l,c),this._statusMap[n].callback(a,s)}).catch(a=>{this._statusMap[n].status=ec.ERROR;let{frameNumber:c,viewport:{id:l}}=this._statusMap[n].frameState;this.pendingTilesRegister.deregister(l,c),r(a)})}}update(t,n){if(this._statusMap[t]){let{frameNumber:r,viewport:{id:s}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(s,r);let{frameNumber:i,viewport:{id:o}}=n;this.pendingTilesRegister.register(o,i),this._statusMap[t].frameState=n}}find(t){return this._statusMap[t]}hasPendingTiles(t,n){return!this.pendingTilesRegister.isZero(t,n)}};var di=class extends re{constructor(t){super(t),this._tileManager=void 0,this._tileManager=new fi}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,n){return t._lodJudge=Cd(t,n),t._lodJudge==="DIG"}updateChildTiles(t,n){let r=t.header.children||[],s=t.children,i=t.tileset;for(let o of r){let a=`${o.id}-${n.viewport.id}`,c=s&&s.find(l=>l.id===a);if(c)c&&this.updateTile(c,n);else{let l=()=>this._loadTile(o.id,i);this._tileManager.find(a)?this._tileManager.update(a,n):(i.tileset.nodePages&&(l=()=>i.tileset.nodePagesTile.formTileFromNodePages(o.id)),this._tileManager.add(l,a,h=>this._onTileLoad(h,t,a),n))}}return!1}async _loadTile(t,n){let{loader:r}=n,s=n.getTileUrl(`${n.url}/nodes/${t}`),i={...n.loadOptions,i3s:{...n.loadOptions.i3s,isTileHeader:!0}};return await(0,Id.load)(s,r,i)}_onTileLoad(t,n,r){let s=new Qe(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 UT={description:"",ellipsoid:U.WGS84,modelMatrix:new P,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,memoryCacheOverflow:1,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,memoryAdjustedScreenSpaceError:!1,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},mi="Tiles In Tileset(s)",nc="Tiles In Memory",wd="Tiles In View",vd="Tiles To Render",Fd="Tiles Loaded",rc="Tiles Loading",Rd="Tiles Unloaded",Ld="Failed Tile Loads",Pd="Points/Vertices",sc="Tile Memory Use",Od="Maximum Screen Space Error",Mr=class{constructor(t,n){this.options=void 0,this.loadOptions=void 0,this.type=void 0,this.tileset=void 0,this.loader=void 0,this.url=void 0,this.basePath=void 0,this.modelMatrix=void 0,this.ellipsoid=void 0,this.lodMetricType=void 0,this.lodMetricValue=void 0,this.refine=void 0,this.root=null,this.roots={},this.asset={},this.description="",this.properties=void 0,this.extras=null,this.attributions={},this.credits={},this.stats=void 0,this.contentFormats={draco:!1,meshopt:!1,dds:!1,ktx2:!1},this.cartographicCenter=null,this.cartesianCenter=null,this.zoom=1,this.boundingVolume=null,this.dynamicScreenSpaceErrorComputedDensity=0,this.maximumMemoryUsage=32,this.gpuMemoryUsageInBytes=0,this.memoryAdjustedScreenSpaceError=0,this._cacheBytes=0,this._cacheOverflowBytes=0,this._frameNumber=0,this._queryParams={},this._extensionsUsed=[],this._tiles={},this._pendingCount=0,this.selectedTiles=[],this.traverseCounter=0,this.geometricError=0,this.lastUpdatedVieports=null,this._requestedTiles=[],this._emptyTiles=[],this.frameStateData={},this._traverser=void 0,this._cache=new oi,this._requestScheduler=void 0,this.updatePromise=null,this.tilesetInitializationPromise=void 0,this.options={...UT,...n},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||ye.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 xe({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 Ae({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(t){this.options={...this.options,...t}}getTileUrl(t){if(t.startsWith("data:"))return t;let r=t;return this.queryParams.length&&(r=`${t}${t.includes("?")?"&":"?"}${this.queryParams}`),r}hasExtension(t){return Boolean(this._extensionsUsed.indexOf(t)>-1)}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;this.tilesetInitializationPromise.then(()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)})}async selectTiles(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise(n=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),n(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytes<this._cacheBytes?this.memoryAdjustedScreenSpaceError=Math.max(this.memoryAdjustedScreenSpaceError/1.02,this.options.maximumScreenSpaceError):this.gpuMemoryUsageInBytes>this._cacheBytes+this._cacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let n=t instanceof Array?t:[t];this._cache.reset(),this._frameNumber++,this.traverseCounter=n.length;let r=[];for(let s of n){let i=s.id;this._needTraverse(i)?r.push(i):this.traverseCounter--}for(let s of n){let i=s.id;if(this.roots[i]||(this.roots[i]=this._initializeTileHeaders(this.tileset,null)),!r.includes(i))continue;let o=ad(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]=cd(s,t,this.options.maximumTilesSelected);r.selectedTiles=i;for(let a of o)a.unselect();r._requestedTiles=Object.values(this._traverser.requestedTiles),r._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let t in this.frameStateData){let n=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(n.selectedTiles),this._requestedTiles=this._requestedTiles.concat(n._requestedTiles),this._emptyTiles=this._emptyTiles.concat(n._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(let t of this.selectedTiles)this._tiles[t.id]=t;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(t,n){if(t.length!==n.length)return!0;let r=new Set(t.map(o=>o.id)),s=new Set(n.map(o=>o.id)),i=t.filter(o=>!s.has(o.id)).length>0;return i=i||n.filter(o=>!r.has(o.id)).length>0,i}_loadTiles(){for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,n)=>t._unloadTile(n))}_updateStats(){let t=0,n=0;for(let r of this.selectedTiles)r.contentAvailable&&r.content&&(t++,r.content.pointCount?n+=r.content.pointCount:n+=r.content.vertexCount);this.stats.get(wd).count=this.selectedTiles.length,this.stats.get(vd).count=t,this.stats.get(Pd).count=n,this.stats.get(Od).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(){var t;let n=this.tileset.fullExtent;if(n){let{xmin:s,xmax:i,ymin:o,ymax:a,zmin:c,zmax:l}=n;this.cartographicCenter=new x(s+(i-s)/2,o+(a-o)/2,c+(l-c)/2),this.cartesianCenter=new x,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=Qa(n,this.cartographicCenter,this.cartesianCenter);return}let r=(t=this.tileset.store)===null||t===void 0?void 0:t.extent;if(r){let[s,i,o,a]=r;this.cartographicCenter=new x(s+(o-s)/2,i+(a-i)/2,0),this.cartesianCenter=new x,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=ud(r,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new x,this.zoom=1}calculateViewPropsTiles3D(){let t=this.root,{center:n}=t.boundingVolume;if(!n){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new x,this.zoom=1;return}n[0]!==0||n[1]!==0||n[2]!==0?(this.cartographicCenter=new x,U.WGS84.cartesianToCartographic(n,this.cartographicCenter)):this.cartographicCenter=new x(0,0,-U.WGS84.radii[0]),this.cartesianCenter=n,this.zoom=ld(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(mi),this.stats.get(rc),this.stats.get(nc),this.stats.get(wd),this.stats.get(vd),this.stats.get(Fd),this.stats.get(Rd),this.stats.get(Ld),this.stats.get(Pd),this.stats.get(sc,"memory"),this.stats.get(Od)}_initializeTileHeaders(t,n){let r=new Qe(this,t.root,n);if(n&&(n.children.push(r),r.depth=n.depth+1),this.type===ht.TILES3D){let i=[];for(i.push(r);i.length>0;){let o=i.pop();this.stats.get(mi).incrementCount();let a=o.header.children||[];for(let c of a){var s;let l=new Qe(this,c,o);if((s=l.contentUrl)!==null&&s!==void 0&&s.includes("?session=")){let h=new URL(l.contentUrl).searchParams.get("session");h&&(this._queryParams.session=h)}o.children.push(l),l.depth=o.depth+1,i.push(l)}}}return r}_initializeTraverser(){let t;switch(this.type){case ht.TILES3D:t=ui;break;case ht.I3S:t=di;break;default:t=re}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(Ld).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===ht.I3S){var r,s;let i=((r=this.tileset)===null||r===void 0||(s=r.nodePagesTile)===null||s===void 0?void 0:s.nodesInNodePages)||0;this.stats.get(mi).reset(),this.stats.get(mi).addCount(i)}t&&t.content&&sd(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){var n;let{extensionsRemoved:r=[]}=((n=t.content)===null||n===void 0?void 0:n.gltf)||{};r.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),r.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),r.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(rc).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(rc).decrementCount()}_addTileToCache(t){this._cache.add(this,t,n=>n._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(Fd).incrementCount(),this.stats.get(nc).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(sc).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(nc).decrementCount(),this.stats.get(Rd).incrementCount(),this.stats.get(sc).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 pi="4.1.0";var Ze={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},NP=Object.keys(Ze);function ic(e,t,n){V(e instanceof ArrayBuffer);let r=new TextDecoder("utf8"),s=new Uint8Array(e,t,n);return r.decode(s)}function Nd(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=new DataView(e);return`${String.fromCharCode(n.getUint8(t+0))}${String.fromCharCode(n.getUint8(t+1))}${String.fromCharCode(n.getUint8(t+2))}${String.fromCharCode(n.getUint8(t+3))}`}var Dd="4.1.0";var Ud={name:"Draco",id:"draco",module:"draco",version:Dd,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 Gd(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 $e(e){let t=1/0,n=1/0,r=1/0,s=-1/0,i=-1/0,o=-1/0,a=e.POSITION?e.POSITION.value:[],c=a&&a.length;for(let l=0;l<c;l+=3){let u=a[l],h=a[l+1],f=a[l+2];t=u<t?u:t,n=h<n?h:n,r=f<r?f:r,s=u>s?u:s,i=h>i?h:i,o=f>o?f:o}return[[t,n,r],[s,i,o]]}function oc(e,t,n){let r=Gd(t.value),s=n||Vd(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:r}]},nullable:!1,metadata:s}}function Vd(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 zd(e,t,n){let r=kd(t.metadata),s=[],i=GT(t.attributes);for(let o in e){let a=e[o],c=Hd(o,a,i[o]);s.push(c)}if(n){let o=Hd("indices",n);s.push(o)}return{fields:s,metadata:r}}function GT(e){let t={};for(let n in e){let r=e[n];t[r.name||"undefined"]=r}return t}function Hd(e,t,n){let r=n?kd(n.metadata):void 0;return oc(e,t,r)}function kd(e){Object.entries(e);let t={};for(let n in e)t[`${n}.string`]=JSON.stringify(e[n]);return t}var Jd={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},VT={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},HT=4,Ir=class{constructor(t){this.draco=void 0,this.decoder=void 0,this.metadataQuerier=void 0,this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=new this.draco.DecoderBuffer;r.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(n);let s=this.decoder.GetEncodedGeometryType(r),i=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(s){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(r,i);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(r,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!i.ptr){let f=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(f)}let a=this._getDracoLoaderData(i,s,n),c=this._getMeshData(i,a,n),l=$e(c.attributes),u=zd(c.attributes,a,c.indices);return{loader:"draco",loaderData:a,header:{vertexCount:i.num_points(),boundingBox:l},...c,schema:u}}finally{this.draco.destroy(r),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,n,r){let s=this._getTopLevelMetadata(t),i=this._getDracoAttributes(t,r);return{geometry_type:n,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:s,attributes:i}}_getDracoAttributes(t,n){let r={};for(let s=0;s<t.num_attributes();s++){let i=this.decoder.GetAttribute(t,s),o=this._getAttributeMetadata(t,s);r[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:s,metadata:o};let a=this._getQuantizationTransform(i,n);a&&(r[i.unique_id()].quantization_transform=a);let c=this._getOctahedronTransform(i,n);c&&(r[i.unique_id()].octahedron_transform=c)}return r}_getMeshData(t,n,r){let s=this._getMeshAttributes(n,t,r);if(!s.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:s,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:s,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:s}}_getMeshAttributes(t,n,r){let s={};for(let i of Object.values(t.attributes)){let o=this._deduceAttributeName(i,r);i.name=o;let{value:a,size:c}=this._getAttributeValues(n,i);s[o]={value:a,size:c,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}return s}_getTriangleListIndices(t){let r=t.num_faces()*3,s=r*HT,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),JT(n)}finally{this.draco.destroy(n)}}_getAttributeValues(t,n){let r=VT[n.data_type],s=n.num_components,o=t.num_points()*s,a=o*r.BYTES_PER_ELEMENT,c=zT(this.draco,r),l,u=this.draco._malloc(a);try{let h=this.decoder.GetAttribute(t,n.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,h,c,a,u),l=new r(this.draco.HEAPF32.buffer,u,o).slice()}finally{this.draco._free(u)}return{value:l,size:s}}_deduceAttributeName(t,n){let r=t.unique_id;for(let[o,a]of Object.entries(n.extraAttributes||{}))if(a===r)return o;let s=t.attribute_type;for(let o in Jd)if(this.draco[o]===s)return Jd[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=kT(r);return{int:this.metadataQuerier.GetIntEntry(t,n),string:this.metadataQuerier.GetStringEntry(t,n),double:this.metadataQuerier.GetDoubleEntry(t,n),intArray:s}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(t){let{quantizedAttributes:n=[],octahedronAttributes:r=[]}=t,s=[...n,...r];for(let i of s)this.decoder.SkipAttributeTransform(this.draco[i])}_getQuantizationTransform(t,n){let{quantizedAttributes:r=[]}=n,s=t.attribute_type();if(r.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:new Float32Array([1,2,3]).map(a=>o.min_value(a))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(t,n){let{octahedronAttributes:r=[]}=n,s=t.attribute_type();if(r.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function zT(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 kT(e){let t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}function JT(e){let t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}var qT="1.5.6",jT="1.4.1",ac=`https://www.gstatic.com/draco/versioned/decoders/${qT}`,_t={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},cc={[_t.DECODER]:`${ac}/${_t.DECODER}`,[_t.DECODER_WASM]:`${ac}/${_t.DECODER_WASM}`,[_t.FALLBACK_DECODER]:`${ac}/${_t.FALLBACK_DECODER}`,[_t.ENCODER]:`https://raw.githubusercontent.com/google/draco/${jT}/javascript/${_t.ENCODER}`},wr;async function qd(e){let t=e.modules||{};return t.draco3d?wr=wr||t.draco3d.createDecoderModule({}).then(n=>({draco:n})):wr=wr||XT(e),await wr}async function XT(e){let t,n;switch(e.draco&&e.draco.decoderType){case"js":t=await Kt(cc[_t.FALLBACK_DECODER],"draco",e,_t.FALLBACK_DECODER);break;case"wasm":default:[t,n]=await Promise.all([await Kt(cc[_t.DECODER],"draco",e,_t.DECODER),await Kt(cc[_t.DECODER_WASM],"draco",e,_t.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await WT(t,n)}function WT(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e({...n,onModuleLoaded:s=>r({draco:s})})})}var gi={...Ud,parse:YT};async function YT(e,t){let{draco:n}=await qd(t),r=new Ir(n);try{return r.parseSync(e,t?.draco)}finally{r.destroy()}}var KT={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},st={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},O={...KT,...st};var lc={[st.DOUBLE]:Float64Array,[st.FLOAT]:Float32Array,[st.UNSIGNED_SHORT]:Uint16Array,[st.UNSIGNED_INT]:Uint32Array,[st.UNSIGNED_BYTE]:Uint8Array,[st.BYTE]:Int8Array,[st.SHORT]:Int16Array,[st.INT]:Int32Array},QT={DOUBLE:st.DOUBLE,FLOAT:st.FLOAT,UNSIGNED_SHORT:st.UNSIGNED_SHORT,UNSIGNED_INT:st.UNSIGNED_INT,UNSIGNED_BYTE:st.UNSIGNED_BYTE,BYTE:st.BYTE,SHORT:st.SHORT,INT:st.INT},uc="Failed to convert GL type",dt=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let n in lc)if(lc[n]===t)return n;throw new Error(uc)}static fromName(t){let n=QT[t];if(!n)throw new Error(uc);return n}static getArrayType(t){switch(t){case st.UNSIGNED_SHORT_5_6_5:case st.UNSIGNED_SHORT_4_4_4_4:case st.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let n=lc[t];if(!n)throw new Error(uc);return n}}static getByteSize(t){return dt.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(dt.getArrayType(t))}static createTypedArray(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;s===void 0&&(s=(n.byteLength-r)/dt.getByteSize(t));let i=dt.getArrayType(t);return new i(n,r,s)}};function jd(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function hc(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0],n=e>>11&31,r=e>>5&63,s=e&31;return t[0]=n<<3,t[1]=r<<2,t[2]=s<<3,t}var gO=1/256;var AO=new Ve,xO=new x,yO=new Ve,TO=new Ve,_O=new Uint8Array(1);function Xd(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:255;return fs(e,0,t)/t*2-1}function Wd(e){return e<0?-1:1}function Yd(e,t,n,r){if(jd(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=Xd(e,n),r.y=Xd(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))*Wd(s),r.y=(1-Math.abs(s))*Wd(r.y)}return r.normalize()}function fc(e,t,n){return Yd(e,t,255,n)}var he=class{constructor(t,n){this.json=void 0,this.buffer=void 0,this.featuresLength=0,this._cachedTypedArrays={},this.json=t,this.buffer=n}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:O.UNSIGNED_INT,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,s=this.json[t];return s&&Number.isFinite(s.byteOffset)?this._getTypedArrayFromBinary(t,n,r,1,s.byteOffset):s}getPropertyArray(t,n,r){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?("componentType"in s&&(n=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 a=this.getPropertyArray(t,n,r);if(r===1)return a[s];for(let c=0;c<r;++c)i[c]=a[r*s+c];return i}_getTypedArrayFromBinary(t,n,r,s,i){let o=this._cachedTypedArrays,a=o[t];return a||(a=dt.createTypedArray(n,this.buffer.buffer,this.buffer.byteOffset+i,s*r),o[t]=a),a}_getTypedArrayFromArray(t,n,r){let s=this._cachedTypedArrays,i=s[t];return i||(i=dt.createTypedArray(n,r),s[t]=i),i}};var ZT={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},$T={SCALAR:(e,t)=>e[t],VEC2:(e,t)=>[e[2*t+0],e[2*t+1]],VEC3:(e,t)=>[e[3*t+0],e[3*t+1],e[3*t+2]],VEC4:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT2:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT3:(e,t)=>[e[9*t+0],e[9*t+1],e[9*t+2],e[9*t+3],e[9*t+4],e[9*t+5],e[9*t+6],e[9*t+7],e[9*t+8]],MAT4:(e,t)=>[e[16*t+0],e[16*t+1],e[16*t+2],e[16*t+3],e[16*t+4],e[16*t+5],e[16*t+6],e[16*t+7],e[16*t+8],e[16*t+9],e[16*t+10],e[16*t+11],e[16*t+12],e[16*t+13],e[16*t+14],e[16*t+15]]},t_={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 Kd(e,t,n,r){let{componentType:s}=e;V(e.componentType);let i=typeof s=="string"?dt.fromName(s):s,o=ZT[e.type],a=$T[e.type],c=t_[e.type];return n+=e.byteOffset,{values:dt.createTypedArray(i,t,n,o*r),type:i,size:o,unpacker:a,packer:c}}var se=e=>e!==void 0;function Qd(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?e_(r,n):null}function e_(e,t){let n,r,s,i=e.instancesLength,o=e.classes,a=e.classIds,c=e.parentCounts,l=e.parentIds,u=i;se(a.byteOffset)&&(a.componentType=defaultValue(a.componentType,GL.UNSIGNED_SHORT),a.type=AttributeType.SCALAR,s=getBinaryAccessor(a),a=s.createArrayBufferView(t.buffer,t.byteOffset+a.byteOffset,i));let h;if(se(c))for(se(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,s=getBinaryAccessor(c),c=s.createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,i)),h=new Uint16Array(i),u=0,n=0;n<i;++n)h[n]=u,u+=c[n];se(l)&&se(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,s=getBinaryAccessor(l),l=s.createArrayBufferView(t.buffer,t.byteOffset+l.byteOffset,u));let f=o.length;for(n=0;n<f;++n){let g=o[n].length,y=o[n].instances,E=getBinaryProperties(g,y,t);o[n].instances=combine(E,y)}let d=new Array(f).fill(0),m=new Uint16Array(i);for(n=0;n<i;++n)r=a[n],m[n]=d[r],++d[r];let A={classes:o,classIds:a,classIndexes:m,parentCounts:c,parentIndexes:h,parentIds:l};return s_(A),A}function In(e,t,n){if(!e)return;let r=e.parentCounts;return e.parentIds?n(e,t):r>0?n_(e,t,n):r_(e,t,n)}function n_(e,t,n){let r=e.classIds,s=e.parentCounts,i=e.parentIds,o=e.parentIndexes,a=r.length,c=scratchVisited;c.length=Math.max(c.length,a);let l=++marker,u=scratchStack;for(u.length=0,u.push(t);u.length>0;){if(t=u.pop(),c[t]===l)continue;c[t]=l;let h=n(e,t);if(se(h))return h;let f=s[t],d=o[t];for(let m=0;m<f;++m){let A=i[d+m];A!==t&&u.push(A)}}return null}function r_(e,t,n){let r=!0;for(;r;){let s=n(e,t);if(se(s))return s;let i=e.parentIds[t];r=i!==t,t=i}throw new Error("traverseHierarchySingleParent")}function s_(e){let t=[],r=e.classIds.length;for(let s=0;s<r;++s)Zd(e,s,stack)}function Zd(e,t,n){let r=e.parentCounts,s=e.parentIds,i=e.parentIndexes,a=e.classIds.length;if(!se(s))return;assert(t<a,`Parent index ${t} exceeds the total number of instances: ${a}`),assert(n.indexOf(t)===-1,"Circular dependency detected in the batch table hierarchy."),n.push(t);let c=se(r)?r[t]:1,l=se(r)?i[t]:t;for(let u=0;u<c;++u){let h=s[l+u];h!==t&&Zd(e,h,n)}n.pop(t)}function Et(e){return e!=null}var Ai=(e,t)=>e,i_={HIERARCHY:!0,extensions:!0,extras:!0},tn=class{constructor(t,n,r){var s;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};this.json=void 0,this.binary=void 0,this.featureCount=void 0,this._extensions=void 0,this._properties=void 0,this._binaryProperties=void 0,this._hierarchy=void 0,V(r>=0),this.json=t||{},this.binary=n,this.featureCount=r,this._extensions=((s=this.json)===null||s===void 0?void 0:s.extensions)||{},this._properties={};for(let o in this.json)i_[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),i["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=Qd(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),V(typeof n=="string",n),this._hierarchy){let r=In(this._hierarchy,t,(s,i)=>{let o=s.classIds[i];return s.classes[o].name===n});return Et(r)}return!1}isExactClass(t,n){return V(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),V(typeof n=="string",n),Et(this._properties[n])||this._hasPropertyInHierarchy(t,n)}getPropertyNames(t,n){this._checkBatchId(t),n=Et(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),V(typeof n=="string",n),this._binaryProperties){let s=this._binaryProperties[n];if(Et(s))return this._getBinaryProperty(s,t)}let r=this._properties[n];if(Et(r))return Ai(r[t],!0);if(this._hierarchy){let s=this._getHierarchyProperty(t,n);if(Et(s))return s}}setProperty(t,n,r){let s=this.featureCount;if(this._checkBatchId(t),V(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];Et(i)||(this._properties[n]=new Array(s),i=this._properties[n]),i[t]=Ai(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;V(this.binary,`Property ${t} requires a batch table binary.`),V(r.type,`Property ${t} requires a type.`);let s=Kd(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=In(this._hierarchy,t,(s,i)=>{let o=s.classIds[i],a=s.classes[o].instances;return Et(a[n])});return Et(r)}_getPropertyNamesInHierarchy(t,n){In(this._hierarchy,t,(r,s)=>{let i=r.classIds[s],o=r.classes[i].instances;for(let a in o)o.hasOwnProperty(a)&&n.indexOf(a)===-1&&n.push(a)})}_getHierarchyProperty(t,n){return In(this._hierarchy,t,(r,s)=>{let i=r.classIds[s],o=r.classes[i],a=r.classIndexes[s],c=o.instances[n];return Et(c)?Et(c.typedArray)?this._getBinaryProperty(c,a):Ai(c[a],!0):null})}_setHierarchyProperty(t,n,r,s){let i=In(this._hierarchy,n,(o,a)=>{let c=o.classIds[a],l=o.classes[c],u=o.classIndexes[a],h=l.instances[r];return Et(h)?(V(a===n,`Inherited property "${r}" is read-only.`),Et(h.typedArray)?this._setBinaryProperty(h,u,s):h[u]=Ai(s,!0),!0):!1});return Et(i)}};function ve(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=new DataView(t);if(e.magic=r.getUint32(n,!0),n+=4,e.version=r.getUint32(n,!0),n+=4,e.byteLength=r.getUint32(n,!0),n+=4,e.version!==1)throw new Error(`3D Tile Version ${e.version} not supported`);return n}var wn=4,$d="b3dm tile in legacy format.";function vn(e,t,n){let r=new DataView(t),s;e.header=e.header||{};let i=r.getUint32(n,!0);n+=wn;let o=r.getUint32(n,!0);n+=wn;let a=r.getUint32(n,!0);n+=wn;let c=r.getUint32(n,!0);return n+=wn,a>=570425344?(n-=wn*2,s=i,a=o,c=0,i=0,o=0,console.warn($d)):c>=570425344&&(n-=wn,s=a,a=i,c=o,i=0,o=0,console.warn($d)),e.header.featureTableJsonByteLength=i,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=a,e.header.batchTableBinaryByteLength=c,e.header.batchLength=s,n}function Fn(e,t,n,r){return n=o_(e,t,n,r),n=a_(e,t,n,r),n}function o_(e,t,n,r){let{featureTableJsonByteLength:s,featureTableBinaryByteLength:i,batchLength:o}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:o||0},s&&s>0){let a=ic(t,n,s);e.featureTableJson=JSON.parse(a)}return n+=s||0,e.featureTableBinary=new Uint8Array(t,n,i),n+=i||0,n}function a_(e,t,n,r){let{batchTableJsonByteLength:s,batchTableBinaryByteLength:i}=e.header||{};if(s&&s>0){let o=ic(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 dc(e,t,n){if(!t&&(!e||!e.batchIds||!n))return null;let{batchIds:r,isRGB565:s,pointCount:i=0}=e;if(r&&n){let o=new Uint8ClampedArray(i*3);for(let a=0;a<i;a++){let c=r[a],u=n.getProperty(c,"dimensions").map(h=>h*255);o[a*3]=u[0],o[a*3+1]=u[1],o[a*3+2]=u[2]}return{type:O.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}if(t&&s){let o=new Uint8ClampedArray(i*3);for(let a=0;a<i;a++){let c=hc(t[a]);o[a*3]=c[0],o[a*3+1]=c[1],o[a*3+2]=c[2]}return{type:O.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}return t&&t.length===i*3?{type:O.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:O.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var tm=new x;function em(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++)fc(t[r*2],t[r*2+1],tm),tm.toArray(n,r*3);return{type:O.FLOAT,size:2,value:n}}return{type:O.FLOAT,size:2,value:t}}function nm(e,t,n){return e.isQuantized?n["3d-tiles"]&&n["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,c_(e,t)):{type:O.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function c_(e,t){let n=new x,r=new Float32Array(e.pointCount*3);for(let s=0;s<e.pointCount;s++)n.set(t[s*3],t[s*3+1],t[s*3+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(r,s*3);return r}async function rm(e,t,n,r,s){n=ve(e,t,n),n=vn(e,t,n),n=Fn(e,t,n,r),l_(e);let{featureTable:i,batchTable:o}=u_(e);return await p_(e,i,o,r,s),h_(e,i,r),f_(e,i,o),d_(e,i),n}function l_(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function u_(e){let t=new he(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",O.FLOAT,3);let r=m_(e,t);return{featureTable:t,batchTable:r}}function h_(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",O.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let r=t.getPropertyArray("POSITION_QUANTIZED",O.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",O.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",O.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=nm(e,r,n)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function f_(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",O.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?r=t.getPropertyArray("RGB",O.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(r=t.getPropertyArray("RGB565",O.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=dc(e,r,n)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",O.UNSIGNED_BYTE,4))}function d_(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",O.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(n=t.getPropertyArray("NORMAL_OCT16P",O.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=em(e,n)}}function m_(e,t){let n=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",O.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 tn(s,i,r)}return n}async function p_(e,t,n,r,s){let i,o,a,c=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];c&&(a=c.properties);let l=t.getExtension("3DTILES_draco_point_compression");if(l){o=l.properties;let h=l.byteOffset,f=l.byteLength;if(!o||!Number.isFinite(h)||!f)throw new Error("Draco properties, byteOffset, and byteLength must be defined");i=(e.featureTableBinary||[]).slice(h,h+f),e.hasPositions=Number.isFinite(o.POSITION),e.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),e.hasNormals=Number.isFinite(o.NORMAL),e.hasBatchIds=Number.isFinite(o.BATCH_ID),e.isTranslucent=Number.isFinite(o.RGBA)}if(!i)return!0;let u={buffer:i,properties:{...o,...a},featureTableProperties:o,batchTableProperties:a,dequantizeInShader:!1};return await g_(e,u,r,s)}async function g_(e,t,n,r){if(!r)return;let s={...n,draco:{...n?.draco,extraAttributes:t.batchTableProperties||{}}};delete s["3d-tiles"];let i=await Ct(t.buffer,gi,s,r),o=i.attributes.POSITION&&i.attributes.POSITION.value,a=i.attributes.COLOR_0&&i.attributes.COLOR_0.value,c=i.attributes.NORMAL&&i.attributes.NORMAL.value,l=i.attributes.BATCH_ID&&i.attributes.BATCH_ID.value,u=o&&i.attributes.POSITION.value.quantization,h=c&&i.attributes.NORMAL.value.quantization;if(u){let d=i.POSITION.data.quantization,m=d.range;e.quantizedVolumeScale=new x(m,m,m),e.quantizedVolumeOffset=new x(d.minValues),e.quantizedRange=(1<<d.quantizationBits)-1,e.isQuantizedDraco=!0}h&&(e.octEncodedRange=(1<<i.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let f={};if(t.batchTableProperties)for(let d of Object.keys(t.batchTableProperties))i.attributes[d]&&i.attributes[d].value&&(f[d.toLowerCase()]=i.attributes[d].value);e.attributes={positions:o,colors:dc(e,a,void 0),normals:c,batchIds:l,...f}}var mc={};ut(mc,{decode:()=>I_,name:()=>M_});function at(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var xi={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},yi={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var A_=1.33,sm=["SCALAR","VEC2","VEC3","VEC4"],x_=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],y_=new Map(x_),T_={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},__={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},E_={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function Ti(e){return sm[e-1]||sm[0]}function Rn(e){let t=y_.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function Ln(e,t){let n=E_[e.componentType],r=T_[e.type],s=__[e.componentType],i=e.count*r,o=e.count*r*s;at(o>=0&&o<=t.byteLength);let a=yi[e.componentType],c=xi[e.type];return{ArrayType:n,length:i,byteLength:o,componentByteSize:a,numberOfComponentsInElement:c}}function vr(e){let{images:t,bufferViews:n}=e;t=t||[],n=n||[];let r=t.map(o=>o.bufferView);n=n.filter(o=>!r.includes(o));let s=n.reduce((o,a)=>o+a.byteLength,0),i=t.reduce((o,a)=>{let{width:c,height:l}=a.image;return o+c*l},0);return s+Math.ceil(4*i*A_)}function im(e,t,n){let r=e.bufferViews[n];at(r);let s=r.buffer,i=t[s];at(i);let o=(r.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,o,r.byteLength)}function om(e,t,n){var r,s;let i=typeof n=="number"?(r=e.accessors)===null||r===void 0?void 0:r[n]:n;if(!i)throw new Error(`No gltf accessor ${JSON.stringify(n)}`);let o=(s=e.bufferViews)===null||s===void 0?void 0:s[i.bufferView||0];if(!o)throw new Error(`No gltf buffer view for accessor ${o}`);let{arrayBuffer:a,byteOffset:c}=t[o.buffer],l=(c||0)+(i.byteOffset||0)+(o.byteOffset||0),{ArrayType:u,length:h,componentByteSize:f,numberOfComponentsInElement:d}=Ln(i,o),m=f*d,A=o.byteStride||m;if(typeof o.byteStride>"u"||o.byteStride===m)return new u(a,l,h);let g=new u(h);for(let y=0;y<i.count;y++){let E=new u(a,l+y*A,d);g.set(E,y*d)}return g}function B_(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var j=class{constructor(t){this.gltf=void 0,this.sourceBuffers=void 0,this.byteLength=void 0,this.gltf={json:t?.json||B_(),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];at(r);let s=(t.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,s,t.byteLength)}getTypedArrayForAccessor(t){let n=this.getAccessor(t);return om(this.gltf.json,this.gltf.buffers,n)}getTypedArrayForImageData(t){t=this.getAccessor(t);let n=this.getBufferView(t.bufferView),s=this.getBuffer(n.buffer).data,i=n.byteOffset||0;return new Uint8Array(s,i,n.byteLength)}addApplicationData(t,n){return this.json[t]=n,this}addExtraData(t,n){return this.json.extras=this.json.extras||{},this.json.extras[t]=n,this}addObjectExtension(t,n,r){return t.extensions=t.extensions||{},t.extensions[n]=r,this.registerUsedExtension(n),this}setObjectExtension(t,n,r){let s=t.extensions||{};s[n]=r}removeObjectExtension(t,n){let r=t?.extensions||{};if(r[n]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(n)||s.push(n)}delete r[n]}addExtension(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return at(n),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=n,this.registerUsedExtension(t),n}addRequiredExtension(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return at(n),this.addExtension(t,n),this.registerRequiredExtension(t),n}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(n=>n===t)||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(n=>n===t)||this.json.extensionsRequired.push(t)}removeExtension(t){var n;if((n=this.json.extensions)!==null&&n!==void 0&&n[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let r=this.json.extensionsRemoved;r.includes(t)||r.push(t)}this.json.extensions&&delete this.json.extensions[t],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t)}setDefaultScene(t){this.json.scene=t}addScene(t){let{nodeIndices:n}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:n}),this.json.scenes.length-1}addNode(t){let{meshIndex:n,matrix:r}=t;this.json.nodes=this.json.nodes||[];let s={mesh:n};return r&&(s.matrix=r),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(t){let{attributes:n,indices:r,material:s,mode:i=4}=t,a={primitives:[{attributes:this._addAttributes(n),mode:i}]};if(r){let c=this._addIndices(r);a.primitives[0].indices=c}return Number.isFinite(s)&&(a.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(t){let r={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(r),this.json.meshes.length-1}addImage(t,n){let r=Ge(t),s=n||r?.mimeType,o={bufferView:this.addBufferView(t),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.byteLength,s=t.byteLength;at(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let i={buffer:n,byteOffset:r,byteLength:s};return this.byteLength+=ge(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:Ti(n.size),componentType:n.componentType,count:n.count,max:n.max,min:n.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}addBinaryBuffer(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{size:3},r=this.addBufferView(t),s={min:n.min,max:n.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(t,n.size));let i={size:n.size,componentType:Rn(t),count:Math.round(t.length/n.size),min:s.min,max:s.max};return this.addAccessor(r,Object.assign(i,n))}addTexture(t){let{imageIndex:n}=t,r={source:n};return this.json.textures=this.json.textures||[],this.json.textures.push(r),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){var t,n;this.gltf.buffers=[];let r=this.byteLength,s=new ArrayBuffer(r),i=new Uint8Array(s),o=0;for(let a of this.sourceBuffers||[])o=Eo(a,i,o);(t=this.json)!==null&&t!==void 0&&(n=t.buffers)!==null&&n!==void 0&&n[0]?this.json.buffers[0].byteLength=r:this.json.buffers=[{byteLength:r}],this.gltf.binary=s,this.sourceBuffers=[s]}_removeStringFromArray(t,n){let r=!0;for(;r;){let s=t.indexOf(n);s>-1?t.splice(s,1):r=!1}}_addAttributes(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n={};for(let r in t){let s=t[r],i=this._getGltfAttributeName(r),o=this.addBinaryBuffer(s.value,s);n[i]=o}return n}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return t}}_getAccessorMinMax(t,n){let r={min:null,max:null};if(t.length<n)return r;r.min=[],r.max=[];let s=t.subarray(0,n);for(let i of s)r.min.push(i),r.max.push(i);for(let i=n;i<t.length;i+=n)for(let o=0;o<n;o++)r.min[0+o]=Math.min(r.min[0+o],t[i+o]),r.max[0+o]=Math.max(r.max[0+o],t[i+o]);return r}};function am(e){return(e%1+1)%1}var cm={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},C_={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},lm={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function Fr(e,t){return lm[t]*cm[e]}function Pn(e,t,n,r){if(n!=="UINT8"&&n!=="UINT16"&&n!=="UINT32"&&n!=="UINT64")return null;let s=e.getTypedArrayForBufferView(t),i=On(s,"SCALAR",n,r+1);return i instanceof BigInt64Array||i instanceof BigUint64Array?null:i}function On(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,s=cm[t],i=C_[n],o=lm[n],a=r*s,c=a*o,l=e.buffer,u=e.byteOffset;return u%o!==0&&(l=new Uint8Array(l).slice(u,u+c).buffer,u=0),new i(l,u,a)}function Nn(e,t,n){var r,s;let i=`TEXCOORD_${t.texCoord||0}`,o=n.attributes[i],a=e.getTypedArrayForAccessor(o),c=e.gltf.json,l=t.index,u=(r=c.textures)===null||r===void 0||(s=r[l])===null||s===void 0?void 0:s.source;if(typeof u<"u"){var h,f,d;let m=(h=c.images)===null||h===void 0||(f=h[u])===null||f===void 0?void 0:f.mimeType,A=(d=e.gltf.images)===null||d===void 0?void 0:d[u];if(A&&typeof A.width<"u"){let g=[];for(let y=0;y<a.length;y+=2){let E=b_(A,m,a,y,t.channels);g.push(E)}return g}}return[]}function _i(e,t,n,r,s){if(!(n!=null&&n.length))return;let i=[];for(let u of n){let h=r.findIndex(f=>f===u);h===-1&&(h=r.push(u)-1),i.push(h)}let o=new Uint32Array(i),a=e.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,c=e.addBufferView(o,a,0),l=e.addAccessor(c,{size:1,componentType:Rn(o),count:o.length});s.attributes[t]=l}function b_(e,t,n,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[0],i={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=n[r],a=n[r+1],c=1;t&&(t.indexOf("image/jpeg")!==-1||t.indexOf("image/png")!==-1)&&(c=4);let l=S_(o,a,e,c),u=0;for(let h of s){let f=typeof h=="number"?Object.values(i)[h]:i[h],d=l+f.offset,m=nr(e);if(m.data.length<=d)throw new Error(`${m.data.length} <= ${d}`);let A=m.data[d];u|=A<<f.shift}return u}function S_(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,s=n.width,i=am(e)*(s-1),o=Math.round(i),a=n.height,c=am(t)*(a-1),l=Math.round(c),u=n.components?n.components:r;return(l*s+o)*u}function Ei(e,t,n,r,s){let i=[];for(let o=0;o<t;o++){let a=n[o],c=n[o+1]-n[o];if(c+a>r)break;let l=a/s,u=c/s;i.push(e.slice(l,l+u))}return i}function Bi(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 Ci(e,t,n,r){if(n)throw new Error("Not implemented - arrayOffsets for strings is specified");if(r){let s=[],i=new TextDecoder("utf8"),o=0;for(let a=0;a<e;a++){let c=r[a+1]-r[a];if(c+o<=t.length){let l=t.subarray(o,c+o),u=i.decode(l);s.push(u),o+=c}}return s}return[]}var um="EXT_mesh_features",M_=um;async function I_(e,t){let n=new j(e);w_(n,t)}function w_(e,t){let n=e.gltf.json;if(n.meshes)for(let r of n.meshes)for(let s of r.primitives)v_(e,s,t)}function v_(e,t,n){var r,s;if(!(n!=null&&(r=n.gltf)!==null&&r!==void 0&&r.loadBuffers))return;let i=(s=t.extensions)===null||s===void 0?void 0:s[um],o=i?.featureIds;if(o)for(let c of o){var a;let l;if(typeof c.attribute<"u"){let u=`_FEATURE_ID_${c.attribute}`,h=t.attributes[u];l=e.getTypedArrayForAccessor(h)}else typeof c.texture<"u"&&n!==null&&n!==void 0&&(a=n.gltf)!==null&&a!==void 0&&a.loadImages?l=Nn(e,c.texture,t):l=[];c.data=l}}var Ac={};ut(Ac,{decode:()=>R_,name:()=>F_});var pc="EXT_structural_metadata",F_=pc;async function R_(e,t){let n=new j(e);L_(n,t)}function L_(e,t){var n,r;if(!((n=t.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let s=e.getExtension(pc);s&&((r=t.gltf)!==null&&r!==void 0&&r.loadImages&&P_(e,s),O_(e,s))}function P_(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)D_(e,n,i,t)}function O_(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=N_(s,i);o&&G_(e,n,o)}}function N_(e,t){for(let n of e)if(n.class===t)return n;return null}function D_(e,t,n,r){var s;if(!t)return;let i=(s=n.extensions)===null||s===void 0?void 0:s[pc],o=i?.propertyTextures;if(o)for(let a of o){let c=t[a];U_(e,c,n,r)}}function U_(e,t,n,r){if(!t.properties)return;r.dataAttributeNames||(r.dataAttributeNames=[]);let s=t.class;for(let o in t.properties){var i;let a=`${s}_${o}`,c=(i=t.properties)===null||i===void 0?void 0:i[o];if(!c)continue;c.data||(c.data=[]);let l=c.data,u=Nn(e,c,n);u!==null&&(_i(e,a,u,l,n),c.data=l,r.dataAttributeNames.push(a))}}function G_(e,t,n){var r;let s=(r=t.classes)===null||r===void 0?void 0:r[n.class];if(!s)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);let i=n.count;for(let a in s.properties){var o;let c=s.properties[a],l=(o=n.properties)===null||o===void 0?void 0:o[a];if(l){let u=V_(e,t,c,i,l);l.data=u}}}function V_(e,t,n,r,s){let i=[],o=s.values,a=e.getTypedArrayForBufferView(o),c=H_(e,n,s,r),l=z_(e,s,r);switch(n.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{i=k_(n,r,a,c);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${n.type}`);case"STRING":{i=Ci(r,a,c,l);break}case"ENUM":{i=J_(t,n,r,a,c);break}default:throw new Error(`Unknown classProperty type ${n.type}`)}return i}function H_(e,t,n,r){return t.array&&typeof t.count>"u"&&typeof n.arrayOffsets<"u"?Pn(e,n.arrayOffsets,n.arrayOffsetType||"UINT32",r):null}function z_(e,t,n){return typeof t.stringOffsets<"u"?Pn(e,t.stringOffsets,t.stringOffsetType||"UINT32",n):null}function k_(e,t,n,r){let s=e.array,i=e.count,o=Fr(e.type,e.componentType),a=n.byteLength/o,c;return e.componentType?c=On(n,e.type,e.componentType,a):c=n,s?r?Ei(c,t,r,n.length,o):i?Bi(c,t,i):[]:c}function J_(e,t,n,r,s){var i;let o=t.enumType;if(!o)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let a=(i=e.enums)===null||i===void 0?void 0:i[o];if(!a)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`);let c=a.valueType||"UINT16",l=Fr(t.type,c),u=r.byteLength/l,h=On(r,t.type,c,u);if(h||(h=r),t.array){if(s)return q_({valuesData:h,numberOfElements:n,arrayOffsets:s,valuesDataBytesLength:r.length,elementSize:l,enumEntry:a});let f=t.count;return f?j_(h,n,f,a):[]}return gc(h,0,n,a)}function q_(e){let{valuesData:t,numberOfElements:n,arrayOffsets:r,valuesDataBytesLength:s,elementSize:i,enumEntry:o}=e,a=[];for(let c=0;c<n;c++){let l=r[c],u=r[c+1]-r[c];if(u+l>s)break;let h=l/i,f=u/i,d=gc(t,h,f,o);a.push(d)}return a}function j_(e,t,n,r){let s=[];for(let i=0;i<t;i++){let o=n*i,a=gc(e,o,n,r);s.push(a)}return s}function gc(e,t,n,r){let s=[];for(let i=0;i<n;i++)if(e instanceof BigInt64Array||e instanceof BigUint64Array)s.push("");else{let o=e[t+i],a=X_(r,o);a?s.push(a.name):s.push("")}return s}function X_(e,t){for(let n of e.values)if(n.value===t)return n;return null}var xc={};ut(xc,{decode:()=>Y_,name:()=>W_});var hm="EXT_feature_metadata",W_=hm;async function Y_(e,t){let n=new j(e);K_(n,t)}function K_(e,t){var n,r;if(!((n=t.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let s=e.getExtension(hm);s&&((r=t.gltf)!==null&&r!==void 0&&r.loadImages&&Q_(e,s),Z_(e,s))}function Q_(e,t){let n=t.schema;if(!n)return;let r=n.classes,{featureTextures:s}=t;if(r&&s)for(let i in r){let o=r[i],a=tE(s,i);a&&nE(e,a,o)}}function Z_(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=$_(s,i);o&&eE(e,n,o)}}function $_(e,t){for(let n in e){let r=e[n];if(r.class===t)return r}return null}function tE(e,t){for(let n in e){let r=e[n];if(r.class===t)return r}return null}function eE(e,t,n){var r;if(!n.class)return;let s=(r=t.classes)===null||r===void 0?void 0:r[n.class];if(!s)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);let i=n.count;for(let a in s.properties){var o;let c=s.properties[a],l=(o=n.properties)===null||o===void 0?void 0:o[a];if(l){let u=rE(e,t,c,i,l);l.data=u}}}function nE(e,t,n){let r=t.class;for(let i in n.properties){var s;let o=t==null||(s=t.properties)===null||s===void 0?void 0:s[i];if(o){let a=cE(e,o,r);o.data=a}}}function rE(e,t,n,r,s){let i=[],o=s.bufferView,a=e.getTypedArrayForBufferView(o),c=sE(e,n,s,r),l=iE(e,n,s,r);return n.type==="STRING"||n.componentType==="STRING"?i=Ci(r,a,c,l):oE(n)&&(i=aE(n,r,a,c)),i}function sE(e,t,n,r){return t.type==="ARRAY"&&typeof t.componentCount>"u"&&typeof n.arrayOffsetBufferView<"u"?Pn(e,n.arrayOffsetBufferView,n.offsetType||"UINT32",r):null}function iE(e,t,n,r){return typeof n.stringOffsetBufferView<"u"?Pn(e,n.stringOffsetBufferView,n.offsetType||"UINT32",r):null}function oE(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 aE(e,t,n,r){let s=e.type==="ARRAY",i=e.componentCount,o="SCALAR",a=e.componentType||e.type,c=Fr(o,a),l=n.byteLength/c,u=On(n,o,a,l);return s?r?Ei(u,t,r,n.length,c):i?Bi(u,t,i):[]:u}function cE(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)lE(e,n,t,s,o);return s}function lE(e,t,n,r,s){let i={channels:n.channels,...n.texture},o=Nn(e,i,s);o&&_i(e,t,o,r,s)}var fm="4.1.0";var Dn=!0,dm=1735152710,_c=12,bi=8,uE=1313821514,hE=5130562,fE=0,dE=0,mE=1;function pE(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return`${String.fromCharCode(e.getUint8(t+0))}${String.fromCharCode(e.getUint8(t+1))}${String.fromCharCode(e.getUint8(t+2))}${String.fromCharCode(e.getUint8(t+3))}`}function mm(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=new DataView(e),{magic:s=dm}=n,i=r.getUint32(t,!1);return i===s||i===dm}function pm(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},s=new DataView(t),i=pE(s,n+0),o=s.getUint32(n+4,Dn),a=s.getUint32(n+8,Dn);switch(Object.assign(e,{header:{byteOffset:n,byteLength:a,hasBinChunk:!1},type:i,version:o,json:{},binChunks:[]}),n+=_c,e.version){case 1:return gE(e,s,n);case 2:return AE(e,s,n,r={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function gE(e,t,n){V(e.header.byteLength>_c+bi);let r=t.getUint32(n+0,Dn),s=t.getUint32(n+4,Dn);return n+=bi,V(s===fE),yc(e,t,n,r),n+=r,n+=Tc(e,t,n,e.header.byteLength),n}function AE(e,t,n,r){return V(e.header.byteLength>_c+bi),xE(e,t,n,r),n+e.header.byteLength}function xE(e,t,n,r){for(;n+8<=e.header.byteLength;){let s=t.getUint32(n+0,Dn),i=t.getUint32(n+4,Dn);switch(n+=bi,i){case uE:yc(e,t,n,s);break;case hE:Tc(e,t,n,s);break;case dE:r.strict||yc(e,t,n,s);break;case mE:r.strict||Tc(e,t,n,s);break;default:break}n+=ge(s,4)}return n}function yc(e,t,n,r){let s=new Uint8Array(t.buffer,n,r),o=new TextDecoder("utf8").decode(s);return e.json=JSON.parse(o),ge(r,4)}function Tc(e,t,n,r){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:n,byteLength:r,arrayBuffer:t.buffer}),ge(r,4)}function Ec(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 Cc={};ut(Cc,{decode:()=>vE,name:()=>wE});var yE="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",TE="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",_E=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]),EE=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]),BE={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},CE={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function gm(e,t,n,r,s){let i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"NONE",o=await bE();IE(o,o.exports[CE[s]],e,t,n,r,o.exports[BE[i||"NONE"]])}var Bc;async function bE(){return Bc||(Bc=SE()),Bc}async function SE(){let e=yE;WebAssembly.validate(_E)&&(e=TE,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(ME(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function ME(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?EE[t[r]]:(t[r]-60)*64+t[++r];return t.buffer.slice(0,n)}function IE(e,t,n,r,s,i,o){let a=e.exports.sbrk,c=r+3&-4,l=a(c*s),u=a(i.length),h=new Uint8Array(e.exports.memory.buffer);h.set(i,u);let f=t(l,r,s,u,i.length);if(f===0&&o&&o(l,c,s),n.set(h.subarray(l,l+r*s)),a(l-a(0)),f!==0)throw new Error(`Malformed buffer data: ${f}`)}var Si="EXT_meshopt_compression",wE=Si;async function vE(e,t){var n,r;let s=new j(e);if(!(t!=null&&(n=t.gltf)!==null&&n!==void 0&&n.decompressMeshes)||!((r=t.gltf)!==null&&r!==void 0&&r.loadBuffers))return;let i=[];for(let o of e.json.bufferViews||[])i.push(FE(s,o));await Promise.all(i),s.removeExtension(Si)}async function FE(e,t){let n=e.getObjectExtension(t,Si);if(n){let{byteOffset:r=0,byteLength:s=0,byteStride:i,count:o,mode:a,filter:c="NONE",buffer:l}=n,u=e.gltf.buffers[l],h=new Uint8Array(u.arrayBuffer,u.byteOffset+r,s),f=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await gm(f,o,i,h,a,c),e.removeObjectExtension(t,Si)}}var bc={};ut(bc,{name:()=>RE,preprocess:()=>LE});var Un="EXT_texture_webp",RE=Un;function LE(e,t){let n=new j(e);if(!Po("image/webp")){if(n.getRequiredExtensions().includes(Un))throw new Error(`gltf: Required extension ${Un} not supported by browser`);return}let{json:r}=n;for(let s of r.textures||[]){let i=n.getObjectExtension(s,Un);i&&(s.source=i.source),n.removeObjectExtension(s,Un)}n.removeExtension(Un)}var Sc={};ut(Sc,{name:()=>PE,preprocess:()=>OE});var Mi="KHR_texture_basisu",PE=Mi;function OE(e,t){let n=new j(e),{json:r}=n;for(let s of r.textures||[]){let i=n.getObjectExtension(s,Mi);i&&(s.source=i.source,n.removeObjectExtension(s,Mi))}n.removeExtension(Mi)}var Ic={};ut(Ic,{decode:()=>VE,encode:()=>HE,name:()=>UE,preprocess:()=>GE});function Am(e){let t={};for(let n in e){let r=e[n];if(n!=="indices"){let s=Mc(r);t[n]=s}}return t}function Mc(e){let{buffer:t,size:n,count:r}=NE(e);return{value:t,size:n,byteOffset:0,count:r,type:Ti(n),componentType:Rn(t)}}function NE(e){let t=e,n=1,r=0;return e&&e.value&&(t=e.value,n=e.size||1),t&&(ArrayBuffer.isView(t)||(t=DE(t,Float32Array)),r=t.length/n),{buffer:t,size:n,count:r}}function DE(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return e?Array.isArray(e)?new t(e):n&&!(e instanceof t)?new t(e):e:null}var Fe="KHR_draco_mesh_compression",UE=Fe;function GE(e,t,n){let r=new j(e);for(let s of xm(r))r.getObjectExtension(s,Fe)}async function VE(e,t,n){var r;if(!(t!=null&&(r=t.gltf)!==null&&r!==void 0&&r.decompressMeshes))return;let s=new j(e),i=[];for(let o of xm(s))s.getObjectExtension(o,Fe)&&i.push(zE(s,o,t,n));await Promise.all(i),s.removeExtension(Fe)}function HE(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=new j(e);for(let r of n.json.meshes||[])kE(r,t),n.addRequiredExtension(Fe)}async function zE(e,t,n,r){let s=e.getObjectExtension(t,Fe);if(!s)return;let i=e.getTypedArrayForBufferView(s.bufferView),o=Pe(i.buffer,i.byteOffset),a={...n};delete a["3d-tiles"];let c=await Ct(o,gi,a,r),l=Am(c.attributes);for(let[u,h]of Object.entries(l))if(u in t.attributes){let f=t.attributes[u],d=e.getAccessor(f);d!=null&&d.min&&d!==null&&d!==void 0&&d.max&&(h.min=d.min,h.max=d.max)}t.attributes=l,c.indices&&(t.indices=Mc(c.indices)),e.removeObjectExtension(t,Fe),JE(t)}function kE(e,t){var n;let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:4,s=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(!s.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let o=s.DracoWriter.encodeSync({attributes:e}),a=i==null||(n=i.parseSync)===null||n===void 0?void 0:n.call(i,{attributes:e}),c=s._addFauxAttributes(a.attributes),l=s.addBufferView(o);return{primitives:[{attributes:c,mode:r,extensions:{[Fe]:{bufferView:l,attributes:c}}}]}}function JE(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*xm(e){for(let t of e.json.meshes||[])for(let n of t.primitives)yield n}var vc={};ut(vc,{decode:()=>WE,name:()=>qE});var wc="KHR_texture_transform",qE=wc,Ii=new x,jE=new k,XE=new k;async function WE(e,t){var n;if(!new j(e).hasExtension(wc)||!((n=t.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let i=e.json.materials||[];for(let o=0;o<i.length;o++)YE(o,e)}function YE(e,t){var n,r,s;let i=[],o=(n=t.json.materials)===null||n===void 0?void 0:n[e],a=o==null||(r=o.pbrMetallicRoughness)===null||r===void 0?void 0:r.baseColorTexture;a&&Rr(t,e,a,i);let c=o?.emissiveTexture;c&&Rr(t,e,c,i);let l=o?.normalTexture;l&&Rr(t,e,l,i);let u=o?.occlusionTexture;u&&Rr(t,e,u,i);let h=o==null||(s=o.pbrMetallicRoughness)===null||s===void 0?void 0:s.metallicRoughnessTexture;h&&Rr(t,e,h,i)}function Rr(e,t,n,r){let s=KE(n,r);if(!s)return;let i=e.json.meshes||[];for(let o of i)for(let a of o.primitives){let c=a.material;Number.isFinite(c)&&t===c&&QE(e,a,s)}}function KE(e,t){var n;let r=(n=e.extensions)===null||n===void 0?void 0:n[wc],{texCoord:s=0}=e,{texCoord:i=s}=r;if(!(t.findIndex(a=>{let[c,l]=a;return c===s&&l===i})!==-1)){let a=tB(r);return s!==i&&(e.texCoord=i),t.push([s,i]),{originalTexCoord:s,texCoord:i,matrix:a}}return null}function QE(e,t,n){let{originalTexCoord:r,texCoord:s,matrix:i}=n,o=t.attributes[`TEXCOORD_${r}`];if(Number.isFinite(o)){var a;let l=(a=e.json.accessors)===null||a===void 0?void 0:a[o];if(l&&l.bufferView){var c;let u=(c=e.json.bufferViews)===null||c===void 0?void 0:c[l.bufferView];if(u){let{arrayBuffer:h,byteOffset:f}=e.buffers[u.buffer],d=(f||0)+(l.byteOffset||0)+(u.byteOffset||0),{ArrayType:m,length:A}=Ln(l,u),g=yi[l.componentType],y=xi[l.type],E=u.byteStride||g*y,_=new Float32Array(A);for(let B=0;B<l.count;B++){let b=new m(h,d+B*E,2);Ii.set(b[0],b[1],1),Ii.transformByMatrix3(i),_.set([Ii[0],Ii[1]],B*y)}r===s?ZE(l,u,e.buffers,_):$E(s,l,t,e,_)}}}}function ZE(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 $E(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 tB(e){let{offset:t=[0,0],rotation:n=0,scale:r=[1,1]}=e,s=new k().set(1,0,0,0,1,0,t[0],t[1],1),i=jE.set(Math.cos(n),Math.sin(n),0,-Math.sin(n),Math.cos(n),0,0,0,1),o=XE.set(r[0],0,0,0,r[1],0,0,0,1);return s.multiplyRight(i).multiplyRight(o)}var Fc={};ut(Fc,{decode:()=>nB,encode:()=>rB,name:()=>eB});var en="KHR_lights_punctual",eB=en;async function nB(e){let t=new j(e),{json:n}=t,r=t.getExtension(en);r&&(t.json.lights=r.lights,t.removeExtension(en));for(let s of n.nodes||[]){let i=t.getObjectExtension(s,en);i&&(s.light=i.light),t.removeObjectExtension(s,en)}}async function rB(e){let t=new j(e),{json:n}=t;if(n.lights){let r=t.addExtension(en);at(!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,en,r)}delete t.json.lights}}var Rc={};ut(Rc,{decode:()=>iB,encode:()=>oB,name:()=>sB});var Lr="KHR_materials_unlit",sB=Lr;async function iB(e){let t=new j(e),{json:n}=t;for(let r of n.materials||[])r.extensions&&r.extensions.KHR_materials_unlit&&(r.unlit=!0),t.removeObjectExtension(r,Lr);t.removeExtension(Lr)}function oB(e){let t=new j(e),{json:n}=t;if(t.materials)for(let r of n.materials||[])r.unlit&&(delete r.unlit,t.addObjectExtension(r,Lr,{}),t.addExtension(Lr))}var Lc={};ut(Lc,{decode:()=>cB,encode:()=>lB,name:()=>aB});var Pr="KHR_techniques_webgl",aB=Pr;async function cB(e){let t=new j(e),{json:n}=t,r=t.getExtension(Pr);if(r){let s=uB(r,t);for(let i of n.materials||[]){let o=t.getObjectExtension(i,Pr);o&&(i.technique=Object.assign({},o,s[o.technique]),i.technique.values=hB(i.technique,t)),t.removeObjectExtension(i,Pr)}t.removeExtension(Pr)}}async function lB(e,t){}function uB(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 hB(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 ym=[Ac,mc,Cc,bc,Sc,Ic,Fc,Rc,Lc,vc,xc];function Tm(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=ym.filter(i=>Em(i.name,t));for(let i of r){var s;(s=i.preprocess)===null||s===void 0||s.call(i,e,t,n)}}async function _m(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=ym.filter(i=>Em(i.name,t));for(let i of r){var s;await((s=i.decode)===null||s===void 0?void 0:s.call(i,e,t,n))}}function Em(e,t){var n;let r=(t==null||(n=t.gltf)===null||n===void 0?void 0:n.excludeExtensions)||{};return!(e in r&&!r[e])}var Pc="KHR_binary_glTF";function Bm(e){let t=new j(e),{json:n}=t;for(let r of n.images||[]){let s=t.getObjectExtension(r,Pc);s&&Object.assign(r,s),t.removeObjectExtension(r,Pc)}n.buffers&&n.buffers[0]&&delete n.buffers[0].uri,t.removeExtension(Pc)}var Cm={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},dB={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},Oc=class{constructor(){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}},this.json=void 0}normalize(t,n){this.json=t.json;let r=t.json;switch(r.asset&&r.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${r.asset.version}`);return}if(!n.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(r),this._convertTopLevelObjectsToArrays(r),Bm(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 Cm)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 Cm)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=dB[n];if(r in this.idToIndexMap){let s=this.idToIndexMap[r][t];if(!Number.isFinite(s))throw new Error(`gltf v1: failed to resolve ${n} with id ${t}`);return s}return t}_updateObjects(t){for(let n of this.json.buffers)delete n.type}_updateMaterial(t){for(let i of t.materials){var n,r,s;i.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let o=((n=i.values)===null||n===void 0?void 0:n.tex)||((r=i.values)===null||r===void 0?void 0:r.texture2d_0)||((s=i.values)===null||s===void 0?void 0:s.diffuseTex),a=t.textures.findIndex(c=>c.id===o);a!==-1&&(i.pbrMetallicRoughness.baseColorTexture={index:a})}}};function bm(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Oc().normalize(e,t)}async function Sm(e,t){var n,r,s;let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return mB(e,t,i,o),bm(e,{normalize:o==null||(n=o.gltf)===null||n===void 0?void 0:n.normalize}),Tm(e,o,a),o!=null&&(r=o.gltf)!==null&&r!==void 0&&r.loadBuffers&&e.json.buffers&&await pB(e,o,a),o!=null&&(s=o.gltf)!==null&&s!==void 0&&s.loadImages&&await gB(e,o,a),await _m(e,o,a),e}function mB(e,t,n,r){if(r.uri&&(e.baseUri=r.uri),t instanceof ArrayBuffer&&!mm(t,n,r)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=_o(t);else if(t instanceof ArrayBuffer){let o={};n=pm(o,t,n,r.glb),at(o.type==="glTF",`Invalid GLB magic string ${o.type}`),e._glb=o,e.json=o.json}else at(!1,"GLTF: must be ArrayBuffer or string");let s=e.json.buffers||[];if(e.buffers=new Array(s.length).fill(null),e._glb&&e._glb.header.hasBinChunk){let{binChunks: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 pB(e,t,n){let r=e.json.buffers||[];for(let o=0;o<r.length;++o){let a=r[o];if(a.uri){var s,i;let{fetch:c}=n;at(c);let l=Ec(a.uri,t),u=await(n==null||(s=n.fetch)===null||s===void 0?void 0:s.call(n,l)),h=await(u==null||(i=u.arrayBuffer)===null||i===void 0?void 0:i.call(u));e.buffers[o]={arrayBuffer:h,byteOffset:0,byteLength:h.byteLength},delete a.uri}else e.buffers[o]===null&&(e.buffers[o]={arrayBuffer:new ArrayBuffer(a.byteLength),byteOffset:0,byteLength:a.byteLength})}}async function gB(e,t,n){let r=AB(e),s=e.json.images||[],i=[];for(let o of r)i.push(xB(e,s[o],o,t,n));return await Promise.all(i)}function AB(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 xB(e,t,n,r,s){let i;if(t.uri&&!t.hasOwnProperty("bufferView")){let a=Ec(t.uri,r),{fetch:c}=s;i=await(await c(a)).arrayBuffer(),t.bufferView={data:i}}if(Number.isFinite(t.bufferView)){let a=im(e.json,e.buffers,t.bufferView);i=Pe(a.buffer,a.byteOffset,a.byteLength)}at(i,"glTF image has no data");let o=await Ct(i,[Te,Ha],{...r,mimeType:t.mimeType,basis:r.basis||{format:Zs()}},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 nn={name:"glTF",id:"gltf",module:"gltf",version:fm,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:yB,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function yB(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;t={...nn.options,...t},t.gltf={...nn.options.gltf,...t.gltf};let{byteOffset:r=0}=t;return await Sm({},e,r,t,n)}var TB={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},_B={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Lt={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},EB={magFilter:Lt.TEXTURE_MAG_FILTER,minFilter:Lt.TEXTURE_MIN_FILTER,wrapS:Lt.TEXTURE_WRAP_S,wrapT:Lt.TEXTURE_WRAP_T},BB={[Lt.TEXTURE_MAG_FILTER]:Lt.LINEAR,[Lt.TEXTURE_MIN_FILTER]:Lt.NEAREST_MIPMAP_LINEAR,[Lt.TEXTURE_WRAP_S]:Lt.REPEAT,[Lt.TEXTURE_WRAP_T]:Lt.REPEAT};function CB(){return{id:"default-sampler",parameters:BB}}function bB(e){return _B[e]}function SB(e){return TB[e]}var Nc=class{constructor(){this.baseUri="",this.jsonUnprocessed=void 0,this.json=void 0,this.buffers=[],this.images=[]}postProcess(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{json:r,buffers:s=[],images:i=[]}=t,{baseUri:o=""}=t;return at(r),this.baseUri=o,this.buffers=s,this.images=i,this.jsonUnprocessed=r,this.json=this._resolveTree(t.json,n),this.json}_resolveTree(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={...t};return this.json=r,t.bufferViews&&(r.bufferViews=t.bufferViews.map((s,i)=>this._resolveBufferView(s,i))),t.images&&(r.images=t.images.map((s,i)=>this._resolveImage(s,i))),t.samplers&&(r.samplers=t.samplers.map((s,i)=>this._resolveSampler(s,i))),t.textures&&(r.textures=t.textures.map((s,i)=>this._resolveTexture(s,i))),t.accessors&&(r.accessors=t.accessors.map((s,i)=>this._resolveAccessor(s,i))),t.materials&&(r.materials=t.materials.map((s,i)=>this._resolveMaterial(s,i))),t.meshes&&(r.meshes=t.meshes.map((s,i)=>this._resolveMesh(s,i))),t.nodes&&(r.nodes=t.nodes.map((s,i)=>this._resolveNode(s,i)),r.nodes=r.nodes.map((s,i)=>this._resolveNodeChildren(s))),t.skins&&(r.skins=t.skins.map((s,i)=>this._resolveSkin(s,i))),t.scenes&&(r.scenes=t.scenes.map((s,i)=>this._resolveScene(s,i))),typeof this.json.scene=="number"&&r.scenes&&(r.scene=r.scenes[this.json.scene]),r}getScene(t){return this._get(this.json.scenes,t)}getNode(t){return this._get(this.json.nodes,t)}getSkin(t){return this._get(this.json.skins,t)}getMesh(t){return this._get(this.json.meshes,t)}getMaterial(t){return this._get(this.json.materials,t)}getAccessor(t){return this._get(this.json.accessors,t)}getCamera(t){return this._get(this.json.cameras,t)}getTexture(t){return this._get(this.json.textures,t)}getSampler(t){return this._get(this.json.samplers,t)}getImage(t){return this._get(this.json.images,t)}getBufferView(t){return this._get(this.json.bufferViews,t)}getBuffer(t){return this._get(this.json.buffers,t)}_get(t,n){if(typeof n=="object")return n;let r=t&&t[n];return r||console.warn(`glTF file error: Could not find ${t}[${n}]`),r}_resolveScene(t,n){return{...t,id:t.id||`scene-${n}`,nodes:(t.nodes||[]).map(r=>this.getNode(r))}}_resolveNode(t,n){let r={...t,id:t?.id||`node-${n}`};return t.mesh!==void 0&&(r.mesh=this.getMesh(t.mesh)),t.camera!==void 0&&(r.camera=this.getCamera(t.camera)),t.skin!==void 0&&(r.skin=this.getSkin(t.skin)),t.meshes!==void 0&&t.meshes.length&&(r.mesh=t.meshes.reduce((s,i)=>{let o=this.getMesh(i);return s.id=o.id,s.primitives=s.primitives.concat(o.primitives),s},{primitives:[]})),r}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map(n=>this.getNode(n))),t}_resolveSkin(t,n){let r=typeof t.inverseBindMatrices=="number"?this.getAccessor(t.inverseBindMatrices):void 0;return{...t,id:t.id||`skin-${n}`,inverseBindMatrices:r}}_resolveMesh(t,n){let r={...t,id:t.id||`mesh-${n}`,primitives:[]};return t.primitives&&(r.primitives=t.primitives.map(s=>{let i={...s,attributes:{},indices:void 0,material:void 0},o=s.attributes;for(let a in o)i.attributes[a]=this.getAccessor(o[a]);return s.indices!==void 0&&(i.indices=this.getAccessor(s.indices)),s.material!==void 0&&(i.material=this.getMaterial(s.material)),i})),r}_resolveMaterial(t,n){let r={...t,id:t.id||`material-${n}`};if(r.normalTexture&&(r.normalTexture={...r.normalTexture},r.normalTexture.texture=this.getTexture(r.normalTexture.index)),r.occlusionTexture&&(r.occlusionTexture={...r.occlusionTexture},r.occlusionTexture.texture=this.getTexture(r.occlusionTexture.index)),r.emissiveTexture&&(r.emissiveTexture={...r.emissiveTexture},r.emissiveTexture.texture=this.getTexture(r.emissiveTexture.index)),r.emissiveFactor||(r.emissiveFactor=r.emissiveTexture?[1,1,1]:[0,0,0]),r.pbrMetallicRoughness){r.pbrMetallicRoughness={...r.pbrMetallicRoughness};let s=r.pbrMetallicRoughness;s.baseColorTexture&&(s.baseColorTexture={...s.baseColorTexture},s.baseColorTexture.texture=this.getTexture(s.baseColorTexture.index)),s.metallicRoughnessTexture&&(s.metallicRoughnessTexture={...s.metallicRoughnessTexture},s.metallicRoughnessTexture.texture=this.getTexture(s.metallicRoughnessTexture.index))}return r}_resolveAccessor(t,n){let r=bB(t.componentType),s=SB(t.type),i=r*s,o={...t,id:t.id||`accessor-${n}`,bytesPerComponent:r,components:s,bytesPerElement:i,value:void 0,bufferView:void 0,sparse:void 0};if(t.bufferView!==void 0&&(o.bufferView=this.getBufferView(t.bufferView)),o.bufferView){let a=o.bufferView.buffer,{ArrayType:c,byteLength:l}=Ln(o,o.bufferView),u=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+a.byteOffset,h=a.arrayBuffer.slice(u,u+l);o.bufferView.byteStride&&(h=this._getValueFromInterleavedBuffer(a,u,o.bufferView.byteStride,o.bytesPerElement,o.count)),o.value=new c(h)}return o}_getValueFromInterleavedBuffer(t,n,r,s,i){let o=new Uint8Array(i*s);for(let a=0;a<i;a++){let c=n+a*r;o.set(new Uint8Array(t.arrayBuffer.slice(c,c+s)),a*s)}return o.buffer}_resolveTexture(t,n){return{...t,id:t.id||`texture-${n}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):CB(),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 EB[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 Or(e,t){return new Nc().postProcess(e,t)}var wi={URI:0,EMBEDDED:1};function vi(e,t,n,r){e.rotateYtoZ=!0;let s=(e.byteOffset||0)+(e.byteLength||0)-n;if(s===0)throw new Error("glTF byte length must be greater than 0.");return e.gltfUpAxis=r!=null&&r["3d-tiles"]&&r["3d-tiles"].assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",e.gltfArrayBuffer=Pe(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 Fi(e,t,n,r){let s=n?.["3d-tiles"]||{};if(MB(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 Ct(e.gltfArrayBuffer,nn,n,r);e.gltf=Or(i),e.gpuMemoryUsageInBytes=vr(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function MB(e,t,n){switch(t){case wi.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 wi.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function Mm(e,t,n,r,s){var i;n=IB(e,t,n,r,s),await Fi(e,wi.EMBEDDED,r,s);let o=e==null||(i=e.gltf)===null||i===void 0?void 0:i.extensions;return o&&o.CESIUM_RTC&&(e.rtcCenter=o.CESIUM_RTC.center),n}function IB(e,t,n,r,s){n=ve(e,t,n),n=vn(e,t,n),n=Fn(e,t,n,r),n=vi(e,t,n,r);let i=new he(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=i.getGlobalProperty("RTC_CENTER",O.FLOAT,3),n}async function Im(e,t,n,r,s){return n=wB(e,t,n,r,s),await Fi(e,e.gltfFormat||0,r,s),n}function wB(e,t,n,r,s){var i;if(n=ve(e,t,n),e.version!==1)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);n=vn(e,t,n);let o=new DataView(t);if(e.gltfFormat=o.getUint32(n,!0),n+=4,n=Fn(e,t,n,r),n=vi(e,t,n,r),!(e!=null&&(i=e.header)!==null&&i!==void 0&&i.featureTableJsonByteLength)||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let a=new he(e.featureTableJson,e.featureTableBinary),c=a.getGlobalProperty("INSTANCES_LENGTH");if(a.featuresLength=c,!Number.isFinite(c))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=a.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=a.getGlobalProperty("RTC_CENTER",O.FLOAT,3);let l=new tn(e.batchTableJson,e.batchTableBinary,c);return vB(e,a,l,c),n}function vB(e,t,n,r){let s=new Array(r),i=new x,o=new x,a=new x,c=new x,l=new k,u=new Zt,h=new x,f={},d=new P,m=[],A=[],g=[],y=[];for(let E=0;E<r;E++){let _;if(t.hasProperty("POSITION"))_=t.getProperty("POSITION",O.FLOAT,3,E,i);else if(t.hasProperty("POSITION_QUANTIZED")){_=t.getProperty("POSITION_QUANTIZED",O.UNSIGNED_SHORT,3,E,i);let p=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",O.FLOAT,3);if(!p)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let M=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",O.FLOAT,3);if(!M)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let F=65535;for(let R=0;R<3;R++)_[R]=_[R]/F*M[R]+p[R]}if(!_)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");i.copy(_),f.translation=i,e.normalUp=t.getProperty("NORMAL_UP",O.FLOAT,3,E,m),e.normalRight=t.getProperty("NORMAL_RIGHT",O.FLOAT,3,E,A);let B=!1;if(e.normalUp){if(!e.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");e.hasCustomOrientation=!0}else{if(e.octNormalUp=t.getProperty("NORMAL_UP_OCT32P",O.UNSIGNED_SHORT,2,E,m),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",O.UNSIGNED_SHORT,2,E,A),e.octNormalUp)throw e.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");e.eastNorthUp?(U.WGS84.eastNorthUpToFixedFrame(i,d),d.getRotationMatrix3(l)):l.identity()}B&&(c.copy(o).cross(a).normalize(),l.setColumn(0,o),l.setColumn(1,a),l.setColumn(2,c)),u.fromMatrix3(l),f.rotation=u,h.set(1,1,1);let b=t.getProperty("SCALE",O.FLOAT,1,E,g);Number.isFinite(b)&&h.multiplyByScalar(b);let S=t.getProperty("SCALE_NON_UNIFORM",O.FLOAT,3,E,m);S&&h.scale(S),f.scale=h;let w=t.getProperty("BATCH_ID",O.UNSIGNED_SHORT,1,E,y);w===void 0&&(w=E);let C=new P().fromQuaternion(f.rotation);d.identity(),d.translate(f.translation),d.multiplyRight(C),d.scale(f.scale);let T=d.clone();s[E]={modelMatrix:T,batchId:w}}e.instances=s}async function wm(e,t,n,r,s,i){n=ve(e,t,n);let o=new DataView(t);for(e.tilesLength=o.getUint32(n,!0),n+=4,e.tiles=[];e.tiles.length<e.tilesLength&&(e.byteLength||0)-n>12;){let a={shape:"tile3d"};e.tiles.push(a),n=await i(t,n,r,s,a)}return n}async function vm(e,t,n,r){var s,i;if(e.rotateYtoZ=!0,e.gltfUpAxis=n!=null&&(s=n["3d-tiles"])!==null&&s!==void 0&&s.assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",n!=null&&(i=n["3d-tiles"])!==null&&i!==void 0&&i.loadGLTF){if(!r)return t.byteLength;let o=await Ct(t,nn,n,r);e.gltf=Or(o),e.gpuMemoryUsageInBytes=vr(e.gltf)}else e.gltfArrayBuffer=t;return t.byteLength}async function Dc(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{shape:"tile3d"};switch(s.byteOffset=t,s.type=Nd(e,t),s.type){case Ze.COMPOSITE:return await wm(s,e,t,n,r,Dc);case Ze.BATCHED_3D_MODEL:return await Mm(s,e,t,n,r);case Ze.GLTF:return await vm(s,e,n,r);case Ze.INSTANCED_3D_MODEL:return await Im(s,e,t,n,r);case Ze.POINT_CLOUD:return await rm(s,e,t,n,r);default:throw new Error(`3DTileLoader: unknown type ${s.type}`)}}async function Uc(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=Fm(e.slice(8,16)),o=new Uint8Array(e,24,i),c=new TextDecoder("utf8").decode(o),l=JSON.parse(c),u=Fm(e.slice(16,24)),h=new ArrayBuffer(0);if(u&&(h=e.slice(24+i)),await Ri(l,l.tileAvailability,h,n),Array.isArray(l.contentAvailability))for(let f of l.contentAvailability)await Ri(l,f,h,n);else await Ri(l,l.contentAvailability,h,n);return await Ri(l,l.childSubtreeAvailability,h,n),l}async function Ri(e,t,n,r){let s=Number.isFinite(t.bitstream)?t.bitstream:t.bufferView;if(typeof s!="number")return;let i=e.bufferViews[s],o=e.buffers[i.buffer];if(!(r!=null&&r.baseUrl))throw new Error("Url is not provided");if(!r.fetch)throw new Error("fetch is not provided");if(o.uri){let c=`${r?.baseUrl||""}/${o.uri}`,u=await(await r.fetch(c)).arrayBuffer();t.explicitBitstream=new Uint8Array(u,i.byteOffset,i.byteLength);return}let a=e.buffers.slice(0,i.buffer).reduce((c,l)=>c+l.byteLength,0);t.explicitBitstream=new Uint8Array(n.slice(a,a+o.byteLength),i.byteOffset,i.byteLength)}function Fm(e){let t=new DataView(e),n=t.getUint32(0,!0),r=t.getUint32(4,!0);return n+2**32*r}var Li={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:pi,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:Uc,options:{}};var cp=N(bn(),1);var sp=N(bn(),1);function FB(e){try{let t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch{return null}}var Pi=class{constructor(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=FB(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 Rm(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 Lm(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,n=Math.max(t-e.length,0);return`${" ".repeat(n)}${e}`}function Oi(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,s=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>r&&(n=Math.min(n,r/e.width));let i=e.width*n,o=e.height*n,a=["font-size:1px;",`padding:${Math.floor(o/2)}px ${Math.floor(i/2)}px;`,`line-height:${o}px;`,`background:url(${s});`,`background-size:${i}px ${o}px;`,"color:transparent;"].join("");return[`${t} %c+`,a]}var Ni;(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"})(Ni||(Ni={}));var RB=10;function Pm(e){return typeof e!="string"?e:(e=e.toUpperCase(),Ni[e]||Ni.WHITE)}function Om(e,t,n){return!kt&&typeof e=="string"&&(t&&(e=`\x1B[${Pm(t)}m${e}\x1B[39m`),n&&(e=`\x1B[${Pm(n)+RB}m${e}\x1B[49m`)),e}function Nm(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],n=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(n),s=e;for(let i of r){let o=s[i];typeof o=="function"&&(t.find(a=>i===a)||(s[i]=o.bind(e)))}}function Gn(e,t){if(!e)throw new Error(t||"Assertion failed")}function rn(){let e;if(kt()&&Bn.performance){var t,n;e=Bn===null||Bn===void 0||(t=Bn.performance)===null||t===void 0||(n=t.now)===null||n===void 0?void 0:n.call(t)}else if("hrtime"in We){var r;let s=We===null||We===void 0||(r=We.hrtime)===null||r===void 0?void 0:r.call(We);e=s[0]*1e3+s[1]/1e6}else e=Date.now();return e}var Vn={debug:kt()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},LB={enabled:!0,level:0};function Pt(){}var Dm={},Um={once:!0},Nr=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=$s,this._startTs=rn(),this._deltaTs=rn(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Pi(`__probe-${this.id}__`,LB),this.timeStamp(`${this.id} started`),Nm(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((rn()-this._startTs).toPrecision(10))}getDelta(){return Number((rn()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!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){Gn(t,n)}warn(t){return this._getLogFunction(0,t,Vn.warn,arguments,Um)}error(t){return this._getLogFunction(0,t,Vn.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,Vn.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,Vn.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,Vn.debug||Vn.info,arguments,Um)}table(t,n,r){return n?this._getLogFunction(t,n,console.table||Pt,r&&[r],{tag:DB(n)}):Pt}image(t){let{logLevel:n,priority:r,image:s,message:i="",scale:o=1}=t;return this._shouldLog(n||r)?kt()?NB({image:s,message:i,scale:o}):OB({image:s,message:i,scale:o}):Pt}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||Pt)}group(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},s=Gm({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){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,n,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Pt)}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()>=Vm(t)}_getLogFunction(t,n,r,s,i){if(this._shouldLog(t)){i=Gm({logLevel:t,message:n,args:s,opts:i}),r=r||i.method,Gn(r),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=rn();let o=i.tag||i.message;if(i.once&&o)if(!Dm[o])Dm[o]=rn();else return Pt;return n=PB(this.id,i.message,i),r.bind(console,n,...i.args)}return Pt}};Nr.VERSION=$s;function Vm(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 Gn(Number.isFinite(t)&&t>=0),t}function Gm(e){let{logLevel:t,message:n}=e;e.logLevel=Vm(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 Gn(s==="string"||s==="object"),Object.assign(e,{args:r},e.opts)}function PB(e,t,n){if(typeof t=="string"){let r=n.time?Lm(Rm(n.total)):"";t=n.time?`${e}: ${r} ${t}`:`${e}: ${t}`,t=Om(t,n.color,n.background)}return t}function OB(e){let{image:t,message:n="",scale:r=1}=e;return console.warn("removed"),Pt}function NB(e){let{image:t,message:n="",scale:r=1}=e;if(typeof t=="string"){let i=new Image;return i.onload=()=>{let o=Oi(i,n,r);console.log(...o)},i.src=t,Pt}let s=t.nodeName||"";if(s.toLowerCase()==="img")return console.log(...Oi(t,n,r)),Pt;if(s.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(...Oi(i,n,r)),i.src=t.toDataURL(),Pt}return Pt}function DB(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}globalThis.probe={};var Gc=new Nr({id:"@probe.gl/log"});var Ot=null;try{Ot=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Q(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}Q.prototype.__isLong__;Object.defineProperty(Q.prototype,"__isLong__",{value:!0});function mt(e){return(e&&e.__isLong__)===!0}function Hm(e){var t=Math.clz32(e&-e);return e?31-t:t}Q.isLong=mt;var zm={},km={};function sn(e,t){var n,r,s;return t?(e>>>=0,(s=0<=e&&e<256)&&(r=km[e],r)?r:(n=H(e,0,!0),s&&(km[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(r=zm[e],r)?r:(n=H(e,e<0?-1:0,!1),s&&(zm[e]=n),n))}Q.fromInt=sn;function Nt(e,t){if(isNaN(e))return t?fe:qt;if(t){if(e<0)return fe;if(e>=Xm)return Km}else{if(e<=-qm)return Bt;if(e+1>=qm)return Ym}return e<0?Nt(-e,t).neg():H(e%zn|0,e/zn|0,t)}Q.fromNumber=Nt;function H(e,t,n){return new Q(e,t,n)}Q.fromBits=H;var Di=Math.pow;function Hc(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?fe:qt;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 Hc(e.substring(1),t,n).neg();for(var s=Nt(Di(n,8)),i=qt,o=0;o<e.length;o+=8){var a=Math.min(8,e.length-o),c=parseInt(e.substring(o,o+a),n);if(a<8){var l=Nt(Di(n,a));i=i.mul(l).add(Nt(c))}else i=i.mul(s),i=i.add(Nt(c))}return i.unsigned=t,i}Q.fromString=Hc;function jt(e,t){return typeof e=="number"?Nt(e,t):typeof e=="string"?Hc(e,t):H(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}Q.fromValue=jt;var Jm=1<<16,UB=1<<24,zn=Jm*Jm,Xm=zn*zn,qm=Xm/2,jm=sn(UB),qt=sn(0);Q.ZERO=qt;var fe=sn(0,!0);Q.UZERO=fe;var Hn=sn(1);Q.ONE=Hn;var Wm=sn(1,!0);Q.UONE=Wm;var Vc=sn(-1);Q.NEG_ONE=Vc;var Ym=H(-1,2147483647,!1);Q.MAX_VALUE=Ym;var Km=H(-1,-1,!0);Q.MAX_UNSIGNED_VALUE=Km;var Bt=H(0,-2147483648,!1);Q.MIN_VALUE=Bt;var I=Q.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low};I.toNumber=function(){return this.unsigned?(this.high>>>0)*zn+(this.low>>>0):this.high*zn+(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(Bt)){var n=Nt(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=Nt(Di(t,6),this.unsigned),o=this,a="";;){var c=o.div(i),l=o.sub(c.mul(i)).toInt()>>>0,u=l.toString(t);if(o=c,o.isZero())return u+a;for(;u.length<6;)u="0"+u;a=""+u+a}};I.getHighBits=function(){return this.high};I.getHighBitsUnsigned=function(){return this.high>>>0};I.getLowBits=function(){return this.low};I.getLowBitsUnsigned=function(){return this.low>>>0};I.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Bt)?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 mt(t)||(t=jt(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};I.eq=I.equals;I.notEquals=function(t){return!this.eq(t)};I.neq=I.notEquals;I.ne=I.notEquals;I.lessThan=function(t){return this.comp(t)<0};I.lt=I.lessThan;I.lessThanOrEqual=function(t){return this.comp(t)<=0};I.lte=I.lessThanOrEqual;I.le=I.lessThanOrEqual;I.greaterThan=function(t){return this.comp(t)>0};I.gt=I.greaterThan;I.greaterThanOrEqual=function(t){return this.comp(t)>=0};I.gte=I.greaterThanOrEqual;I.ge=I.greaterThanOrEqual;I.compare=function(t){if(mt(t)||(t=jt(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(Bt)?Bt:this.not().add(Hn)};I.neg=I.negate;I.add=function(t){mt(t)||(t=jt(t));var n=this.high>>>16,r=this.high&65535,s=this.low>>>16,i=this.low&65535,o=t.high>>>16,a=t.high&65535,c=t.low>>>16,l=t.low&65535,u=0,h=0,f=0,d=0;return d+=i+l,f+=d>>>16,d&=65535,f+=s+c,h+=f>>>16,f&=65535,h+=r+a,u+=h>>>16,h&=65535,u+=n+o,u&=65535,H(f<<16|d,u<<16|h,this.unsigned)};I.subtract=function(t){return mt(t)||(t=jt(t)),this.add(t.neg())};I.sub=I.subtract;I.multiply=function(t){if(this.isZero())return this;if(mt(t)||(t=jt(t)),Ot){var n=Ot.mul(this.low,this.high,t.low,t.high);return H(n,Ot.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?fe:qt;if(this.eq(Bt))return t.isOdd()?Bt:qt;if(t.eq(Bt))return this.isOdd()?Bt:qt;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(jm)&&t.lt(jm))return Nt(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16,s=this.high&65535,i=this.low>>>16,o=this.low&65535,a=t.high>>>16,c=t.high&65535,l=t.low>>>16,u=t.low&65535,h=0,f=0,d=0,m=0;return m+=o*u,d+=m>>>16,m&=65535,d+=i*u,f+=d>>>16,d&=65535,d+=o*l,f+=d>>>16,d&=65535,f+=s*u,h+=f>>>16,f&=65535,f+=i*l,h+=f>>>16,f&=65535,f+=o*c,h+=f>>>16,f&=65535,h+=r*u+s*l+i*c+o*a,h&=65535,H(d<<16|m,h<<16|f,this.unsigned)};I.mul=I.multiply;I.divide=function(t){if(mt(t)||(t=jt(t)),t.isZero())throw Error("division by zero");if(Ot){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var n=(this.unsigned?Ot.div_u:Ot.div_s)(this.low,this.high,t.low,t.high);return H(n,Ot.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?fe:qt;var r,s,i;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return fe;if(t.gt(this.shru(1)))return Wm;i=fe}else{if(this.eq(Bt)){if(t.eq(Hn)||t.eq(Vc))return Bt;if(t.eq(Bt))return Hn;var o=this.shr(1);return r=o.div(t).shl(1),r.eq(qt)?t.isNegative()?Hn:Vc:(s=this.sub(t.mul(r)),i=r.add(s.div(t)),i)}else if(t.eq(Bt))return this.unsigned?fe:qt;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=qt}for(s=this;s.gte(t);){r=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),c=a<=48?1:Di(2,a-48),l=Nt(r),u=l.mul(t);u.isNegative()||u.gt(s);)r-=c,l=Nt(r,this.unsigned),u=l.mul(t);l.isZero()&&(l=Hn),i=i.add(l),s=s.sub(u)}return i};I.div=I.divide;I.modulo=function(t){if(mt(t)||(t=jt(t)),Ot){var n=(this.unsigned?Ot.rem_u:Ot.rem_s)(this.low,this.high,t.low,t.high);return H(n,Ot.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};I.mod=I.modulo;I.rem=I.modulo;I.not=function(){return H(~this.low,~this.high,this.unsigned)};I.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};I.clz=I.countLeadingZeros;I.countTrailingZeros=function(){return this.low?Hm(this.low):Hm(this.high)+32};I.ctz=I.countTrailingZeros;I.and=function(t){return mt(t)||(t=jt(t)),H(this.low&t.low,this.high&t.high,this.unsigned)};I.or=function(t){return mt(t)||(t=jt(t)),H(this.low|t.low,this.high|t.high,this.unsigned)};I.xor=function(t){return mt(t)||(t=jt(t)),H(this.low^t.low,this.high^t.high,this.unsigned)};I.shiftLeft=function(t){return mt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?H(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):H(0,this.low<<t-32,this.unsigned)};I.shl=I.shiftLeft;I.shiftRight=function(t){return mt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?H(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):H(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};I.shr=I.shiftRight;I.shiftRightUnsigned=function(t){return mt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?H(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?H(this.high,0,this.unsigned):H(this.high>>>t-32,0,this.unsigned)};I.shru=I.shiftRightUnsigned;I.shr_u=I.shiftRightUnsigned;I.rotateLeft=function(t){var n;return mt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?H(this.high,this.low,this.unsigned):t<32?(n=32-t,H(this.low<<t|this.high>>>n,this.high<<t|this.low>>>n,this.unsigned)):(t-=32,n=32-t,H(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 mt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?H(this.high,this.low,this.unsigned):t<32?(n=32-t,H(this.high<<n|this.low>>>t,this.low<<n|this.high>>>t,this.unsigned)):(t-=32,n=32-t,H(this.low<<n|this.high>>>t,this.high<<n|this.low>>>t,this.unsigned))};I.rotr=I.rotateRight;I.toSigned=function(){return this.unsigned?H(this.low,this.high,!1):this};I.toUnsigned=function(){return this.unsigned?this:H(this.low,this.high,!0)};I.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};I.toBytesLE=function(){var t=this.high,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]};Q.fromBytes=function(t,n,r){return r?Q.fromBytesLE(t,n):Q.fromBytesBE(t,n)};Q.fromBytesLE=function(t,n){return new Q(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};Q.fromBytesBE=function(t,n){return new Q(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)};var kn=Q;var GB=16;function Dr(e){e==="X"&&(e="");let t=e.padEnd(GB,"0");return kn.fromString(t,!0,16)}function zc(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 kc(e,t){let n=VB(e).shiftRightUnsigned(2);return e.add(kn.fromNumber(2*t+1-4).multiply(n))}function VB(e){return e.and(e.not().add(1))}var HB=3,zB=30,kB=2*zB+1,Qm=180/Math.PI;function $m(e){if(e.length===0)throw new Error(`Invalid Hilbert quad key ${e}`);let t=e.split("/"),n=parseInt(t[0],10),r=t[1],s=r.length,i=0,o=[0,0];for(let a=s-1;a>=0;a--){i=s-a;let c=r[a],l=0,u=0;c==="1"?u=1:c==="2"?(l=1,u=1):c==="3"&&(l=1);let h=Math.pow(2,i-1);JB(h,o,l,u),o[0]+=h*l,o[1]+=h*u}if(n%2===1){let a=o[0];o[0]=o[1],o[1]=a}return{face:n,ij:o,level:i}}function tp(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<HB+kB;)t="0"+t;let n=t.lastIndexOf("1"),r=t.substring(0,3),s=t.substring(3,n),i=s.length/2,o=kn.fromString(r,!0,2).toString(10),a="";if(i!==0)for(a=kn.fromString(s,!0,2).toString(4);a.length<i;)a="0"+a;return`${o}/${a}`}function Jc(e,t,n){let r=1<<t;return[(e[0]+n[0])/r,(e[1]+n[1])/r]}function Zm(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function qc(e){return[Zm(e[0]),Zm(e[1])]}function jc(e,t){let[n,r]=t;switch(e){case 0:return[1,n,r];case 1:return[-n,1,r];case 2:return[-n,-r,1];case 3:return[-1,-r,-n];case 4:return[r,-1,-n];case 5:return[r,n,-1];default:throw new Error("Invalid face")}}function Xc(e){let[t,n,r]=e,s=Math.atan2(r,Math.sqrt(t*t+n*n));return[Math.atan2(n,t)*Qm,s*Qm]}function JB(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 ep(e){let t=Jc(e.ij,e.level,[.5,.5]),n=qc(t),r=jc(e.face,n);return Xc(r)}var qB=100;function Wc(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(qB*Math.pow(2,-r))),o=new Float64Array(4*i*2+2),a=0,c=0;for(let l=0;l<4;l++){let u=s[l].slice(0),h=s[l+1],f=(h[0]-u[0])/i,d=(h[1]-u[1])/i;for(let m=0;m<i;m++){u[0]+=f,u[1]+=d;let A=Jc(n,r,u),g=qc(A),y=jc(t,g),E=Xc(y);Math.abs(E[1])>89.999&&(E[0]=c);let _=E[0]-c;E[0]+=_>180?-360:_<-180?360:0,o[a++]=E[0],o[a++]=E[1],c=E[0]}}return o[a++]=o[0],o[a++]=o[1],o}function Jn(e){let t=jB(e);return $m(t)}function jB(e){if(e.indexOf("/")>0)return e;let t=Dr(e);return tp(t)}function Yc(e){let t=Jn(e);return ep(t)}function rp(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=Jn(i),a=Wc(o);(typeof n>"u"||n===null)&&(n=new Float64Array(4*a.length)),n.set(a,r),r+=a.length}t=np(n)}else{let n=Wc(e);t=np(n)}return t}function np(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 Kc(e,t){let n=t?.minimumHeight||0,r=t?.maximumHeight||0,s=Jn(e),i=rp(s),o=i.west,a=i.south,c=i.east,l=i.north,u=[];return u.push(new x(o,l,n)),u.push(new x(c,l,n)),u.push(new x(c,a,n)),u.push(new x(o,a,n)),u.push(new x(o,l,r)),u.push(new x(c,l,r)),u.push(new x(c,a,r)),u.push(new x(o,a,r)),u}function Ui(e){let t=e.token,n={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},r=Kc(t,n),s=Yc(t),i=s[0],o=s[1],a=U.WGS84.cartographicToCartesian([i,o,n.maximumHeight]),c=new x(a[0],a[1],a[2]);r.push(c);let l=gr(r);return[...l.center,...l.halfAxes]}var XB=4,WB=8,YB={QUADTREE:XB,OCTREE:WB};function KB(e,t,n){if(e!=null&&e.box){let r=Dr(e.s2VolumeInfo.token),s=kc(r,t),i=zc(s),o={...e.s2VolumeInfo};switch(o.token=i,n){case"OCTREE":let l=e.s2VolumeInfo,u=l.maximumHeight-l.minimumHeight,h=u/2,f=l.minimumHeight+u/2;l.minimumHeight=f-h,l.maximumHeight=f+h;break;default:break}return{box:Ui(o),s2VolumeInfo:o}}}async function Zc(e){let{implicitOptions:t,parentData:n={mortonIndex:0,x:0,y:0,z:0},childIndex:r=0,s2VolumeBox:s,loaderOptions:i}=e,{subtree:o,level:a=0,globalData:c={level:0,mortonIndex:0,x:0,y:0,z:0}}=e,{subdivisionScheme:l,subtreeLevels:u,maximumLevel:h,contentUrlTemplate:f,subtreesUriTemplate:d,basePath:m}=t,A={children:[],lodMetricValue:0,contentUrl:""};if(!h)return Gc.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${f} won't be loaded...`),A;let g=a+c.level;if(g>h)return A;let y=YB[l],E=Math.log2(y),_=r&1,B=r>>1&1,b=r>>2&1,S=(y**a-1)/(y-1),w=on(n.mortonIndex,r,E),C=S+w,T=on(n.x,_,1),p=on(n.y,B,1),M=on(n.z,b,1),F=!1;a>=u&&(F=Qc(o.childSubtreeAvailability,w));let R=on(c.x,T,a),v=on(c.y,p,a),D=on(c.z,M,a);if(F){let Y=`${m}/${d}`,tt=Gi(Y,g,R,v,D);o=await(0,sp.load)(tt,Li,i),c={mortonIndex:w,x:T,y:p,z:M,level:a},w=0,C=0,T=0,p=0,M=0,a=0}if(!Qc(o.tileAvailability,C))return A;Qc(o.contentAvailability,C)&&(A.contentUrl=Gi(f,g,R,v,D));let Z=a+1,X={mortonIndex:w,x:T,y:p,z:M};for(let Y=0;Y<y;Y++){let tt=KB(s,Y,l),xt=await Zc({subtree:o,implicitOptions:t,loaderOptions:i,parentData:X,childIndex:Y,level:Z,globalData:{...c},s2VolumeBox:tt});if(xt.contentUrl||xt.children.length){let ig=g+1,og=QB(xt,ig,{childTileX:T,childTileY:p,childTileZ:M},t,s);A.children.push(og)}}return A}function Qc(e,t){let n;return Array.isArray(e)?(n=e[0],e.length>1&&Gc.once('Not supported extension "3DTILES_multiple_contents" has been detected')):n=e,"constant"in n?Boolean(n.constant):n.explicitBitstream?tC(t,n.explicitBitstream):!1}function QB(e,t,n,r,s){let{basePath:i,refine:o,getRefine:a,lodMetricType:c,getTileType:l,rootLodMetricValue:u,rootBoundingVolume:h}=r,f=e.contentUrl&&e.contentUrl.replace(`${i}/`,""),d=u/2**t,m=s!=null&&s.box?{box:s.box}:h,A=ZB(t,m,n);return{children:e.children,contentUrl:e.contentUrl,content:{uri:f},id:e.contentUrl,refine:a(o),type:l(e),lodMetricType:c,lodMetricValue:d,geometricError:d,transform:e.transform,boundingVolume:A}}function ZB(e,t,n){if(t.region){let{childTileX:r,childTileY:s,childTileZ:i}=n,[o,a,c,l,u,h]=t.region,f=2**e,d=(c-o)/f,m=(l-a)/f,A=(h-u)/f,[g,y]=[o+d*r,o+d*(r+1)],[E,_]=[a+m*s,a+m*(s+1)],[B,b]=[u+A*i,u+A*(i+1)];return{region:[g,E,y,_,B,b]}}if(t.box)return t;throw new Error(`Unsupported bounding volume type ${t}`)}function on(e,t,n){return(e<<n)+t}function Gi(e,t,n,r,s){let i=$B({level:t,x:n,y:r,z:s});return e.replace(/{level}|{x}|{y}|{z}/gi,o=>i[o])}function $B(e){let t={};for(let n in e)t[`{${n}}`]=e[n];return t}function tC(e,t){let n=Math.floor(e/8),r=e%8;return(t[n]>>r&1)===1}function tl(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(!t)return ne.EMPTY;let r=t.split("?")[0].split(".").pop();switch(r){case"pnts":return ne.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return ne.SCENEGRAPH;default:return r||ne.EMPTY}}function el(e){switch(e){case"REPLACE":case"replace":return Tt.REPLACE;case"ADD":case"add":return Tt.ADD;default:return e}}function $c(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 ye.resolve(t,e)}function ip(e,t){if(!e)return null;let n;if(e.content){var r;let i=e.content.uri||((r=e.content)===null||r===void 0?void 0:r.url);typeof i<"u"&&(n=$c(i,t))}return{...e,id:n,contentUrl:n,lodMetricType:Ye.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:tl(e,n),refine:el(e.refine)}}async function lp(e,t,n){let r=null,s=ap(e.root);s&&e.root?r=await op(e.root,e,t,s,n):r=ip(e.root,t);let i=[];for(i.push(r);i.length>0;){let o=i.pop()||{},a=o.children||[],c=[];for(let l of a){let u=ap(l),h;u?h=await op(l,e,t,u,n):h=ip(l,t),h&&(c.push(h),i.push(h))}o.children=c}return r}async function op(e,t,n,r,s){var i,o,a;let{subdivisionScheme:c,maximumLevel:l,availableLevels:u,subtreeLevels:h,subtrees:{uri:f}}=r,d=Gi(f,0,0,0,0),m=$c(d,n),A=await(0,cp.load)(m,Li,s),g=(i=e.content)===null||i===void 0?void 0:i.uri,y=g?$c(g,n):"",E=t==null||(o=t.root)===null||o===void 0?void 0:o.refine,_=e.geometricError,B=(a=e.boundingVolume.extensions)===null||a===void 0?void 0:a["3DTILES_bounding_volume_S2"];if(B){let C={box:Ui(B),s2VolumeInfo:B};e.boundingVolume=C}let b=e.boundingVolume,S={contentUrlTemplate:y,subtreesUriTemplate:f,subdivisionScheme:c,subtreeLevels:h,maximumLevel:Number.isFinite(u)?u-1:l,refine:E,basePath:n,lodMetricType:Ye.GEOMETRIC_ERROR,rootLodMetricValue:_,rootBoundingVolume:b,getTileType:tl,getRefine:el};return await eC(e,n,A,S,s)}async function eC(e,t,n,r,s){if(!e)return null;let{children:i,contentUrl:o}=await Zc({subtree:n,implicitOptions:r,loaderOptions:s}),a,c=null;return o&&(a=o,c={uri:o.replace(`${t}/`,"")}),{...e,id:a,contentUrl:a,lodMetricType:Ye.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:tl(e,a),refine:el(e.refine),content:c||e.content,children:i}}function ap(e){var t;return(e==null||(t=e.extensions)===null||t===void 0?void 0:t["3DTILES_implicit_tiling"])||e?.implicitTiling}var Vi={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:pi,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:nC,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function nC(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=t["3d-tiles"]||{},s;return r.isTileset==="auto"?s=n?.url&&n.url.indexOf(".json")!==-1:s=r.isTileset,s?rC(e,t,n):sC(e,t,n)}async function rC(e,t,n){var r;let s=JSON.parse(new TextDecoder().decode(e)),i=n?.url||"",o=iC(i),a=await lp(s,o,t||{});return{...s,shape:"tileset3d",loader:Vi,url:i,queryString:n?.queryString||"",basePath:o,root:a||s.root,type:ht.TILES3D,lodMetricType:Ye.GEOMETRIC_ERROR,lodMetricValue:((r=s.root)===null||r===void 0?void 0:r.geometricError)||0}}async function sC(e,t,n){let r={content:{shape:"tile3d",featureIds:null}};return await Dc(e,0,t,n,r.content),r.content}function iC(e){return ye.dirname(e)}var up=[0],oC={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:Vi,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]}},Hi=class extends Re.CompositeLayer{initializeState(){"onTileLoadFail"in this.props&&Re.log.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}}get isLoaded(){return Boolean(this.state?.tileset3d?.isLoaded()&&super.isLoaded)}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({props:t,oldProps:n,changeFlags:r}){if(t.data&&t.data!==n.data&&this._loadTileset(t.data),r.viewportChanged){let{activeViewports:s}=this.state;Object.keys(s).length&&(this._updateTileset(s),this.state.lastUpdatedViewports=s,this.state.activeViewports={})}if(r.propsChanged){let{layerMap:s}=this.state;for(let i in s)s[i].needsUpdate=!0}}activateViewport(t){let{activeViewports:n,lastUpdatedViewports:r}=this.state;this.internalState.viewport=t,n[t.id]=t;let s=r?.[t.id];(!s||!t.equals(s))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:t,sourceLayer:n}){let r=n&&n.props.tile;return t.picked&&(t.object=r),t.sourceTile=r,t}filterSubLayer({layer:t,viewport:n}){let{tile:r}=t.props,{id:s}=n;return r.selected&&r.viewportIds.includes(s)}_updateAutoHighlight(t){let n=t.sourceTile,r=this.state.layerMap[n?.id];r&&r.layer&&r.layer.updateAutoHighlight(t)}async _loadTileset(t){let{loadOptions:n={}}=this.props,r=this.props.loader||this.props.loaders,s=Array.isArray(r)?r[0]:r,i={loadOptions:{...n}},o=t;if(s.preload){let l=await s.preload(t,n);l.url&&(o=l.url),l.headers&&(i.loadOptions.fetch={...i.loadOptions.fetch,headers:l.headers}),Object.assign(i,l)}let a=await(0,mp.load)(o,s,i.loadOptions),c=new Mr(a,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,...i});this.setState({tileset3d:c,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(c)}_onTileLoad(t){let{lastUpdatedViewports:n}=this.state;this.props.onTileLoad(t),this._updateTileset(n),this.setNeedsUpdate()}_onTileUnload(t){delete this.state.layerMap[t.id],this.props.onTileUnload(t)}_updateTileset(t){if(!t)return;let{tileset3d:n}=this.state,{timeline:r}=this.context,s=Object.keys(t).length;!r||!s||!n||n.selectTiles(Object.values(t)).then(i=>{this.state.frameNumber!==i&&this.setState({frameNumber:i})})}_getSubLayer(t,n){if(!t.content)return null;switch(t.type){case ne.POINTCLOUD:return this._makePointCloudLayer(t,n);case ne.SCENEGRAPH:return this._make3DModelLayer(t);case ne.MESH:return this._makeSimpleMeshLayer(t,n);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${t.content.type}`)}}_makePointCloudLayer(t,n){let{attributes:r,pointCount:s,constantRGBA:i,cartographicOrigin:o,modelMatrix:a}=t.content,{positions:c,normals:l,colors:u}=r;if(!c)return null;let h=n&&n.props.data||{header:{vertexCount:s},attributes:{POSITION:c,NORMAL:l,COLOR_0:u}},{pointSize:f,getPointColor:d}=this.props,m=this.getSubLayerClass("pointcloud",fp.PointCloudLayer);return new m({pointSize:f},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${t.id}`,tile:t,data:h,coordinateSystem:Re.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:o,modelMatrix:a,getColor:i||d,_offset:0})}_make3DModelLayer(t){let{gltf:n,instances:r,cartographicOrigin:s,modelMatrix:i}=t.content,o=this.getSubLayerClass("scenegraph",dp.ScenegraphLayer);return new o({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${t.id}`,tile:t,data:r||up,scenegraph:n,coordinateSystem:Re.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:s,modelMatrix:i,getTransformMatrix:a=>a.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(t,n){let r=t.content,{attributes:s,indices:i,modelMatrix:o,cartographicOrigin:a,coordinateSystem:c=Re.COORDINATE_SYSTEM.METER_OFFSETS,material:l,featureIds:u}=r,{_getMeshColor:h}=this.props,f=n&&n.props.mesh||new hp.Geometry({topology:"triangle-list",attributes:aC(s),indices:i}),d=this.getSubLayerClass("mesh",Cr);return new d(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${t.id}`,tile:t,mesh:f,data:up,getColor:h(t),pbrMaterial:l,modelMatrix:o,coordinateOrigin:a,coordinateSystem:c,featureIds:u,_offset:0})}renderLayers(){let{tileset3d:t,layerMap:n}=this.state;return t?t.tiles.map(r=>{let s=n[r.id]=n[r.id]||{tile:r},{layer:i}=s;return r.selected&&(i?s.needsUpdate&&(i=this._getSubLayer(r,i),s.needsUpdate=!1):i=this._getSubLayer(r)),s.layer=i,i}).filter(Boolean):null}},Ur=Hi;(()=>{Hi.defaultProps=oC})(),(()=>{Hi.layerName="Tile3DLayer"})();function aC(e){let t={};return t.positions={...e.positions,value:new Float32Array(e.positions.value)},e.normals&&(t.normals=e.normals),e.texCoords&&(t.texCoords=e.texCoords),e.colors&&(t.colors=e.colors),e.uvRegions&&(t.uvRegions=e.uvRegions),t}var Xi=N(Ut(),1),ol=N(Ys(),1),_p=N(Ut(),1);var cC=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 nl(e){return e>>1^-(e&1)}function lC(e){let t=0,n={};for(let[r,s]of cC){let i=s===8?e.getFloat64:e.getFloat32;n[r]=i.call(e,t,!0),t+=s}return{header:n,headerEndPosition:t}}function uC(e,t){let n=t,r=3,s=e.getUint32(n,!0),i=new Uint16Array(s*r);n+=Uint32Array.BYTES_PER_ELEMENT;let o=Uint16Array.BYTES_PER_ELEMENT,a=s*o,c=n,l=c+a,u=l+a,h=0,f=0,d=0;for(let m=0;m<s;m++)h+=nl(e.getUint16(c+o*m,!0)),f+=nl(e.getUint16(l+o*m,!0)),d+=nl(e.getUint16(u+o*m,!0)),i[m]=h,i[m+s]=f,i[m+s*2]=d;return n+=a*3,{vertexData:i,vertexDataEndPosition:n}}function Gr(e,t,n,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i;if(r===2?i=new Uint16Array(e,t,n):i=new Uint32Array(e,t,n),!s)return i;let o=0;for(let a=0;a<i.length;++a){let c=i[a];i[a]=o-c,c===0&&++o}return i}function hC(e,t,n){let r=n,s=3,o=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;r%o!==0&&(r+=o-r%o);let a=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let c=a*3,l=Gr(e.buffer,r,c,o);return r+=c*o,{triangleIndicesEndPosition:r,triangleIndices:l}}function fC(e,t,n){let r=n,s=3,o=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,a=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let c=Gr(e.buffer,r,a,o,!1);r+=a*o;let l=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let u=Gr(e.buffer,r,l,o,!1);r+=l*o;let h=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let f=Gr(e.buffer,r,h,o,!1);r+=h*o;let d=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let m=Gr(e.buffer,r,d,o,!1);return r+=d*o,{edgeIndicesEndPosition:r,westIndices:c,southIndices:u,eastIndices:f,northIndices:m}}function dC(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function mC(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function pC(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=dC(o);break}case 2:{n.waterMask=mC(o);break}default:}r+=i}return{extensions:n,extensionsEndPosition:r}}var an={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},gC={maxDecodingStep:an.extensions};function rl(e,t){let n=Object.assign({},gC,t),r=new DataView(e),{header:s,headerEndPosition:i}=lC(r);if(n.maxDecodingStep<an.vertices)return{header:s};let{vertexData:o,vertexDataEndPosition:a}=uC(r,i);if(n.maxDecodingStep<an.triangleIndices)return{header:s,vertexData:o};let{triangleIndices:c,triangleIndicesEndPosition:l}=hC(r,o,a);if(n.maxDecodingStep<an.edgeIndices)return{header:s,vertexData:o,triangleIndices:c};let{westIndices:u,southIndices:h,eastIndices:f,northIndices:d,edgeIndicesEndPosition:m}=fC(r,o,l);if(n.maxDecodingStep<an.extensions)return{header:s,vertexData:o,triangleIndices:c,westIndices:u,northIndices:d,eastIndices:f,southIndices:h};let{extensions:A}=pC(r,m);return{header:s,vertexData:o,triangleIndices:c,westIndices:u,northIndices:d,eastIndices:f,southIndices:h,extensions:A}}function zi(e,t,n,r){let s=r?xC(r,e.POSITION.value):AC(t),i=new e.POSITION.value.constructor(s.length*6),o=new e.TEXCOORD_0.value.constructor(s.length*4),a=new t.constructor(s.length*6);for(let l=0;l<s.length;l++){let u=s[l];yC({edge:u,edgeIndex:l,attributes:e,skirtHeight:n,newPosition:i,newTexcoord0:o,newTriangles:a})}e.POSITION.value=Qn(e.POSITION.value,i),e.TEXCOORD_0.value=Qn(e.TEXCOORD_0.value,o);let c=t instanceof Array?t.concat(a):Qn(t,a);return{attributes:e,triangles:c}}function AC(e){let t=[];for(let o=0;o<e.length;o+=3)t.push([e[o],e[o+1]]),t.push([e[o+1],e[o+2]]),t.push([e[o+2],e[o]]);t.sort((o,a)=>Math.min(...o)-Math.min(...a)||Math.max(...o)-Math.max(...a));let n=[],r=0;for(;r<t.length;){var s,i;t[r][0]===((s=t[r+1])===null||s===void 0?void 0:s[1])&&t[r][1]===((i=t[r+1])===null||i===void 0?void 0:i[0])?r+=2:(n.push(t[r]),r++)}return n}function xC(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 yC(e){let{edge:t,edgeIndex:n,attributes:r,skirtHeight:s,newPosition:i,newTexcoord0:o,newTriangles:a}=e,c=r.POSITION.value.length,l=n*2,u=n*2+1;i.set(r.POSITION.value.subarray(t[0]*3,t[0]*3+3),l*3),i[l*3+2]=i[l*3+2]-s,i.set(r.POSITION.value.subarray(t[1]*3,t[1]*3+3),u*3),i[u*3+2]=i[u*3+2]-s,o.set(r.TEXCOORD_0.value.subarray(t[0]*2,t[0]*2+2),l*2),o.set(r.TEXCOORD_0.value.subarray(t[1]*2,t[1]*2+2),u*2);let h=n*2*3;a[h]=t[0],a[h+1]=c/3+u,a[h+2]=t[1],a[h+3]=c/3+u,a[h+4]=t[0],a[h+5]=c/3+l}function sl(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{bounds:n}=t,{header:r,vertexData:s,triangleIndices:i,westIndices:o,northIndices:a,eastIndices:c,southIndices:l}=rl(e,an.triangleIndices),u=i,h=TC(s,r,n),f=$e(h);if(t!=null&&t.skirtHeight){let{attributes:d,triangles:m}=zi(h,u,t.skirtHeight,{westIndices:o,northIndices:a,eastIndices:c,southIndices:l});h=d,u=m}return{loaderData:{header:{}},header:{vertexCount:u.length,boundingBox:f},schema:void 0,topology:"triangle-list",mode:4,indices:{value:u,size:1},attributes:h}}function TC(e,t,n){let{minHeight:r,maxHeight:s}=t,[i,o,a,c]=n||[0,0,1,1],l=a-i,u=c-o,h=s-r,f=e.length/3,d=new Float32Array(f*3),m=new Float32Array(f*2);for(let A=0;A<f;A++){let g=e[A]/32767,y=e[A+f]/32767,E=e[A+f*2]/32767;d[3*A+0]=g*l+i,d[3*A+1]=y*u+o,d[3*A+2]=E*h+r,m[2*A+0]=g,m[2*A+1]=y}return{POSITION:{value:d,size:3},TEXCOORD_0:{value:m,size:2}}}var Vr=class{constructor(t=257){this.gridSize=t;let n=t-1;if(n&n-1)throw new Error(`Expected grid size to be 2^n+1, got ${t}.`);this.numTriangles=n*n*2-2,this.numParentTriangles=this.numTriangles-n*n,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let r=0;r<this.numTriangles;r++){let s=r+2,i=0,o=0,a=0,c=0,l=0,u=0;for(s&1?a=c=l=n:i=o=u=n;(s>>=1)>1;){let f=i+a>>1,d=o+c>>1;s&1?(a=i,c=o,i=l,o=u):(i=a,o=c,a=l,c=u),l=f,u=d}let h=r*4;this.coords[h+0]=i,this.coords[h+1]=o,this.coords[h+2]=a,this.coords[h+3]=c}}createTile(t){return new il(t,this)}},il=class{constructor(t,n){let r=n.gridSize;if(t.length!==r*r)throw new Error(`Expected terrain data of length ${r*r} (${r} x ${r}), got ${t.length}.`);this.terrain=t,this.martini=n,this.errors=new Float32Array(t.length),this.update()}update(){let{numTriangles:t,numParentTriangles:n,coords:r,gridSize:s}=this.martini,{terrain:i,errors:o}=this;for(let a=t-1;a>=0;a--){let c=a*4,l=r[c+0],u=r[c+1],h=r[c+2],f=r[c+3],d=l+h>>1,m=u+f>>1,A=d+m-u,g=m+l-d,y=(i[u*s+l]+i[f*s+h])/2,E=m*s+d,_=Math.abs(y-i[E]);if(o[E]=Math.max(o[E],_),a<n){let B=(u+g>>1)*s+(l+A>>1),b=(f+g>>1)*s+(h+A>>1);o[E]=Math.max(o[E],o[B],o[b])}}}getMesh(t=0){let{gridSize:n,indices:r}=this.martini,{errors:s}=this,i=0,o=0,a=n-1;r.fill(0);function c(d,m,A,g,y,E){let _=d+A>>1,B=m+g>>1;Math.abs(d-y)+Math.abs(m-E)>1&&s[B*n+_]>t?(c(y,E,d,m,_,B),c(A,g,y,E,_,B)):(r[m*n+d]=r[m*n+d]||++i,r[g*n+A]=r[g*n+A]||++i,r[E*n+y]=r[E*n+y]||++i,o++)}c(0,0,a,a,a,0),c(a,a,0,0,0,a);let l=new Uint16Array(i*2),u=new Uint32Array(o*3),h=0;function f(d,m,A,g,y,E){let _=d+A>>1,B=m+g>>1;if(Math.abs(d-y)+Math.abs(m-E)>1&&s[B*n+_]>t)f(y,E,d,m,_,B),f(A,g,y,E,_,B);else{let b=r[m*n+d]-1,S=r[g*n+A]-1,w=r[E*n+y]-1;l[2*b]=d,l[2*b+1]=m,l[2*S]=A,l[2*S+1]=g,l[2*w]=y,l[2*w+1]=E,u[h++]=b,u[h++]=S,u[h++]=w}}return f(0,0,a,a,a,0),f(a,a,0,0,0,a),{vertices:l,triangles:u}}};var Hr=class{constructor(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:n;this.data=t,this.width=n,this.height=r,this.coords=[],this.triangles=[],this._halfedges=[],this._candidates=[],this._queueIndices=[],this._queue=[],this._errors=[],this._rms=[],this._pending=[],this._pendingLen=0,this._rmsSum=0;let s=n-1,i=r-1,o=this._addPoint(0,0),a=this._addPoint(s,0),c=this._addPoint(0,i),l=this._addPoint(s,i),u=this._addTriangle(l,o,c,-1,-1,-1);this._addTriangle(o,l,a,u,-1,-1),this._flush()}run(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;for(;this.getMaxError()>t;)this.refine()}refine(){this._step(),this._flush()}getMaxError(){return this._errors[0]}getRMSD(){return this._rmsSum>0?Math.sqrt(this._rmsSum/(this.width*this.height)):0}heightAt(t,n){return this.data[this.width*n+t]}_flush(){let t=this.coords;for(let n=0;n<this._pendingLen;n++){let r=this._pending[n],s=2*this.triangles[r*3+0],i=2*this.triangles[r*3+1],o=2*this.triangles[r*3+2];this._findCandidate(t[s],t[s+1],t[i],t[i+1],t[o],t[o+1],r)}this._pendingLen=0}_findCandidate(t,n,r,s,i,o,a){let c=Math.min(t,r,i),l=Math.min(n,s,o),u=Math.max(t,r,i),h=Math.max(n,s,o),f=cn(r,s,i,o,c,l),d=cn(i,o,t,n,c,l),m=cn(t,n,r,s,c,l),A=s-n,g=t-r,y=o-s,E=r-i,_=n-o,B=i-t,b=cn(t,n,r,s,i,o),S=this.heightAt(t,n)/b,w=this.heightAt(r,s)/b,C=this.heightAt(i,o)/b,T=0,p=0,M=0,F=0;for(let R=l;R<=h;R++){let v=0;f<0&&y!==0&&(v=Math.max(v,Math.floor(-f/y))),d<0&&_!==0&&(v=Math.max(v,Math.floor(-d/_))),m<0&&A!==0&&(v=Math.max(v,Math.floor(-m/A)));let D=f+y*v,W=d+_*v,z=m+A*v,Z=!1;for(let X=c+v;X<=u;X++){if(D>=0&&W>=0&&z>=0){Z=!0;let Y=S*D+w*W+C*z,tt=Math.abs(Y-this.heightAt(X,R));F+=tt*tt,tt>T&&(T=tt,p=X,M=R)}else if(Z)break;D+=y,W+=_,z+=A}f+=E,d+=B,m+=g}(p===t&&M===n||p===r&&M===s||p===i&&M===o)&&(T=0),this._candidates[2*a]=p,this._candidates[2*a+1]=M,this._rms[a]=F,this._queuePush(a,T,F)}_step(){let t=this._queuePop(),n=t*3+0,r=t*3+1,s=t*3+2,i=this.triangles[n],o=this.triangles[r],a=this.triangles[s],c=this.coords[2*i],l=this.coords[2*i+1],u=this.coords[2*o],h=this.coords[2*o+1],f=this.coords[2*a],d=this.coords[2*a+1],m=this._candidates[2*t],A=this._candidates[2*t+1],g=this._addPoint(m,A);if(cn(c,l,u,h,m,A)===0)this._handleCollinear(g,n);else if(cn(u,h,f,d,m,A)===0)this._handleCollinear(g,r);else if(cn(f,d,c,l,m,A)===0)this._handleCollinear(g,s);else{let y=this._halfedges[n],E=this._halfedges[r],_=this._halfedges[s],B=this._addTriangle(i,o,g,y,-1,-1,n),b=this._addTriangle(o,a,g,E,-1,B+1),S=this._addTriangle(a,i,g,_,B+2,b+1);this._legalize(B),this._legalize(b),this._legalize(S)}}_addPoint(t,n){let r=this.coords.length>>1;return this.coords.push(t,n),r}_addTriangle(t,n,r,s,i,o){let a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this.triangles.length,c=a/3;return this.triangles[a+0]=t,this.triangles[a+1]=n,this.triangles[a+2]=r,this._halfedges[a+0]=s,this._halfedges[a+1]=i,this._halfedges[a+2]=o,s>=0&&(this._halfedges[s]=a+0),i>=0&&(this._halfedges[i]=a+1),o>=0&&(this._halfedges[o]=a+2),this._candidates[2*c+0]=0,this._candidates[2*c+1]=0,this._queueIndices[c]=-1,this._rms[c]=0,this._pending[this._pendingLen++]=c,a}_legalize(t){let n=this._halfedges[t];if(n<0)return;let r=t-t%3,s=n-n%3,i=r+(t+1)%3,o=r+(t+2)%3,a=s+(n+2)%3,c=s+(n+1)%3,l=this.triangles[o],u=this.triangles[t],h=this.triangles[i],f=this.triangles[a],d=this.coords;if(!_C(d[2*l],d[2*l+1],d[2*u],d[2*u+1],d[2*h],d[2*h+1],d[2*f],d[2*f+1]))return;let m=this._halfedges[i],A=this._halfedges[o],g=this._halfedges[a],y=this._halfedges[c];this._queueRemove(r/3),this._queueRemove(s/3);let E=this._addTriangle(l,f,h,-1,g,m,r),_=this._addTriangle(f,l,u,E,A,y,s);this._legalize(E+1),this._legalize(_+2)}_handleCollinear(t,n){let r=n-n%3,s=r+(n+1)%3,i=r+(n+2)%3,o=this.triangles[i],a=this.triangles[n],c=this.triangles[s],l=this._halfedges[s],u=this._halfedges[i],h=this._halfedges[n];if(h<0){let S=this._addTriangle(t,o,a,-1,u,-1,r),w=this._addTriangle(o,t,c,S,-1,l);this._legalize(S+1),this._legalize(w+2);return}let f=h-h%3,d=f+(h+2)%3,m=f+(h+1)%3,A=this.triangles[d],g=this._halfedges[d],y=this._halfedges[m];this._queueRemove(f/3);let E=this._addTriangle(o,a,t,u,-1,-1,r),_=this._addTriangle(a,A,t,y,-1,E+1,f),B=this._addTriangle(A,c,t,g,-1,_+1),b=this._addTriangle(c,o,t,l,E+2,B+1);this._legalize(E),this._legalize(_),this._legalize(B),this._legalize(b)}_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 cn(e,t,n,r,s,i){return(n-s)*(t-i)-(r-i)*(e-s)}function _C(e,t,n,r,s,i,o,a){let c=e-o,l=t-a,u=n-o,h=r-a,f=s-o,d=i-a,m=c*c+l*l,A=u*u+h*h,g=f*f+d*d;return c*(h*g-A*d)-l*(u*g-A*f)+m*(u*d-h*f)<0}function Ap(e,t){let{meshMaxError:n,bounds:r,elevationDecoder:s}=t,{data:i,width:o,height:a}=e,c,l;switch(t.tesselator){case"martini":c=ki(i,o,a,s,t.tesselator),l=pp(n,o,c);break;case"delatin":c=ki(i,o,a,s,t.tesselator),l=gp(n,o,a,c);break;default:o===a&&!(a&o-1)?(c=ki(i,o,a,s,"martini"),l=pp(n,o,c)):(c=ki(i,o,a,s,"delatin"),l=gp(n,o,a,c));break}let{vertices:u}=l,{triangles:h}=l,f=EC(u,c,o,a,r),d=$e(f);if(t.skirtHeight){let{attributes:m,triangles:A}=zi(f,h,t.skirtHeight);f=m,h=A}return{loaderData:{header:{}},header:{vertexCount:h.length,boundingBox:d},mode:4,indices:{value:Uint32Array.from(h),size:1},attributes:f}}function pp(e,t,n){let r=t+1,i=new Vr(r).createTile(n),{vertices:o,triangles:a}=i.getMesh(e);return{vertices:o,triangles:a}}function gp(e,t,n,r){let s=new Hr(r,t+1,n+1);s.run(e);let{coords:i,triangles:o}=s;return{vertices:i,triangles:o}}function ki(e,t,n,r,s){let{rScaler:i,bScaler:o,gScaler:a,offset:c}=r,l=new Float32Array((t+1)*(n+1));for(let u=0,h=0;h<n;h++)for(let f=0;f<t;f++,u++){let d=u*4,m=e[d+0],A=e[d+1],g=e[d+2];l[u+h]=m*i+A*a+g*o+c}if(s==="martini"){for(let u=(t+1)*t,h=0;h<t;h++,u++)l[u]=l[u-t-1];for(let u=n,h=0;h<n+1;h++,u+=n+1)l[u]=l[u-1]}return l}function EC(e,t,n,r,s){let i=n+1,o=e.length/2,a=new Float32Array(o*3),c=new Float32Array(o*2),[l,u,h,f]=s||[0,0,n,r],d=(h-l)/n,m=(f-u)/r;for(let A=0;A<o;A++){let g=e[A*2],y=e[A*2+1],E=y*i+g;a[3*A+0]=g*d+l,a[3*A+1]=-y*m+f,a[3*A+2]=t[E],c[2*A+0]=g/n,c[2*A+1]=y/r}return{POSITION:{value:a,size:3},TEXCOORD_0:{value:c,size:2}}}var Ji="4.1.0";var qi={name:"Terrain",id:"terrain",module:"terrain",version:Ji,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 xp={name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:Ji,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var BC={...qi,parse:CC};async function CC(e,t,n){let r={...t,mimeType:"application/x.image",image:{...t?.image,type:"data"}},s=await Ct(e,[],r,n),i={...BC.options.terrain,...t?.terrain};return Ap(s,i)}var o4={...xp,parseSync:(e,t)=>sl(e,t?.["quantized-mesh"]),parse:async(e,t)=>sl(e,t?.["quantized-mesh"])};var yp=[1],bC={...ee.defaultProps,elevationData:Ie,texture:{...Ie,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:[qi]};function Tp(e){return Array.isArray(e)?e.join(";"):e||""}var ji=class extends Xi.CompositeLayer{updateState({props:t,oldProps:n}){let r=t.elevationData!==n.elevationData;if(r){let{elevationData:i}=t,o=i&&(Array.isArray(i)||i.includes("{x}")&&i.includes("{y}"));this.setState({isTiled:o})}let s=r||t.meshMaxError!==n.meshMaxError||t.elevationDecoder!==n.elevationDecoder||t.bounds!==n.bounds;if(!this.state.isTiled&&s){let i=this.loadTerrain(t);this.setState({terrain:i})}t.workerUrl&&Xi.log.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain({elevationData:t,bounds:n,elevationDecoder:r,meshMaxError:s,signal:i}){if(!t)return null;let o=this.getLoadOptions();o={...o,terrain:{skirtHeight:this.state.isTiled?s*2:0,...o?.terrain,bounds:n,meshMaxError:s,elevationDecoder:r}};let{fetch:a}=this.props;return a(t,{propName:"elevationData",layer:this,loadOptions:o,signal:i})}getTiledTerrainData(t){let{elevationData:n,fetch:r,texture:s,elevationDecoder:i,meshMaxError:o}=this.props,{viewport:a}=this.context,c=te(n,t),l=s&&te(s,t),{signal:u}=t,h=[0,0],f=[0,0];if(a.isGeospatial){let g=t.bbox;h=a.projectFlat([g.west,g.south]),f=a.projectFlat([g.east,g.north])}else{let g=t.bbox;h=[g.left,g.bottom],f=[g.right,g.top]}let d=[h[0],h[1],f[0],f[1]],m=this.loadTerrain({elevationData:c,bounds:d,elevationDecoder:i,meshMaxError:o,signal:u}),A=l?r(l,{propName:"texture",layer:this,loaders:[],signal:u}).catch(g=>null):Promise.resolve(null);return Promise.all([m,A])}renderSubLayers(t){let n=this.getSubLayerClass("mesh",ol.SimpleMeshLayer),{color:r,wireframe:s,material:i}=this.props,{data:o}=t;if(!o)return null;let[a,c]=o;return new n(t,{data:yp,mesh:a,texture:c,_instanced:!1,coordinateSystem:_p.COORDINATE_SYSTEM.CARTESIAN,getPosition:l=>[0,0,0],getColor:r,wireframe:s,material:i})}onViewportLoad(t){if(!t)return;let{zRange:n}=this.state,r=t.map(o=>o.content).filter(Boolean).map(o=>o[0].header.boundingBox.map(c=>c[2]));if(r.length===0)return;let s=Math.min(...r.map(o=>o[0])),i=Math.max(...r.map(o=>o[1]));(!n||s<n[0]||i>n[1])&&this.setState({zRange:[s,i]})}renderLayers(){let{color:t,material:n,elevationData:r,texture:s,wireframe:i,meshMaxError:o,elevationDecoder:a,tileSize:c,maxZoom:l,minZoom:u,extent:h,maxRequests:f,onTileLoad:d,onTileUnload:m,onTileError:A,maxCacheSize:g,maxCacheByteSize:y,refinementStrategy:E}=this.props;if(this.state.isTiled)return new ee(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:Tp(r),texture:Tp(s),meshMaxError:o,elevationDecoder:a}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:c,maxZoom:l,minZoom:u,extent:h,maxRequests:f,onTileLoad:d,onTileUnload:m,onTileError:A,maxCacheSize:g,maxCacheByteSize:y,refinementStrategy:E});if(!r)return null;let _=this.getSubLayerClass("mesh",ol.SimpleMeshLayer);return new _(this.getSubLayerProps({id:"mesh"}),{data:yp,mesh:this.state.terrain,texture:s,_instanced:!1,getPosition:B=>[0,0,0],getColor:t,material:n,wireframe:i})}},zr=ji;(()=>{ji.defaultProps=bC})(),(()=>{ji.layerName="TerrainLayer"})();var oo=N(Ut(),1),Cl=N(Dt(),1),eg=N(Bp(),1);var kr={x:0,y:1,z:2};function ln(e,t={}){let{start:n=0,end:r=e.length,plane:s="xy"}=t,i=t.size||2,o=0,a=kr[s[0]],c=kr[s[1]];for(let l=n,u=r-i;l<r;l+=i)o+=(e[l+a]-e[u+a])*(e[l+c]+e[u+c]),u=l;return o/2}function cl(e,t,n=2,r,s="xy"){let i=t&&t.length,o=i?t[0]*n:e.length,a=bp(e,0,o,n,!0,r&&r[0],s),c=[];if(!a||a.next===a.prev)return c;let l,u,h,f,d,m,A;if(i&&(a=RC(e,t,a,n,r,s)),e.length>80*n){f=u=e[0],d=h=e[1];for(let g=n;g<o;g+=n)m=e[g],A=e[g+1],m<f&&(f=m),A<d&&(d=A),m>u&&(u=m),A>h&&(h=A);l=Math.max(u-f,h-d),l=l!==0?32767/l:0}return Jr(a,c,n,f,d,l,0),c}function bp(e,t,n,r,s,i,o){let a,c;i===void 0&&(i=ln(e,{start:t,end:n,size:r,plane:o}));let l=kr[o[0]],u=kr[o[1]];if(s===i<0)for(a=t;a<n;a+=r)c=Cp(a,e[a+l],e[a+u],c);else for(a=n-r;a>=t;a-=r)c=Cp(a,e[a+l],e[a+u],c);return c&&Ki(c,c.next)&&(jr(c),c=c.next),c}function un(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(Ki(n,n.next)||nt(n.prev,n,n.next)===0)){if(jr(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function Jr(e,t,n,r,s,i,o){if(!e)return;!o&&i&&DC(e,r,s,i);let a=e,c,l;for(;e.prev!==e.next;){if(c=e.prev,l=e.next,i?wC(e,r,s,i):IC(e)){t.push(c.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),jr(e),e=l.next,a=l.next;continue}if(e=l,e===a){o?o===1?(e=vC(un(e),t,n),Jr(e,t,n,r,s,i,2)):o===2&&FC(e,t,n,r,s,i):Jr(un(e),t,n,r,s,i,1);break}}}function IC(e){let t=e.prev,n=e,r=e.next;if(nt(t,n,r)>=0)return!1;let s=t.x,i=n.x,o=r.x,a=t.y,c=n.y,l=r.y,u=s<i?s<o?s:o:i<o?i:o,h=a<c?a<l?a:l:c<l?c:l,f=s>i?s>o?s:o:i>o?i:o,d=a>c?a>l?a:l:c>l?c:l,m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=h&&m.y<=d&&qn(s,a,i,c,o,l,m.x,m.y)&&nt(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function wC(e,t,n,r){let s=e.prev,i=e,o=e.next;if(nt(s,i,o)>=0)return!1;let a=s.x,c=i.x,l=o.x,u=s.y,h=i.y,f=o.y,d=a<c?a<l?a:l:c<l?c:l,m=u<h?u<f?u:f:h<f?h:f,A=a>c?a>l?a:l:c>l?c:l,g=u>h?u>f?u:f:h>f?h:f,y=al(d,m,t,n,r),E=al(A,g,t,n,r),_=e.prevZ,B=e.nextZ;for(;_&&_.z>=y&&B&&B.z<=E;){if(_.x>=d&&_.x<=A&&_.y>=m&&_.y<=g&&_!==s&&_!==o&&qn(a,u,c,h,l,f,_.x,_.y)&&nt(_.prev,_,_.next)>=0||(_=_.prevZ,B.x>=d&&B.x<=A&&B.y>=m&&B.y<=g&&B!==s&&B!==o&&qn(a,u,c,h,l,f,B.x,B.y)&&nt(B.prev,B,B.next)>=0))return!1;B=B.nextZ}for(;_&&_.z>=y;){if(_.x>=d&&_.x<=A&&_.y>=m&&_.y<=g&&_!==s&&_!==o&&qn(a,u,c,h,l,f,_.x,_.y)&&nt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;B&&B.z<=E;){if(B.x>=d&&B.x<=A&&B.y>=m&&B.y<=g&&B!==s&&B!==o&&qn(a,u,c,h,l,f,B.x,B.y)&&nt(B.prev,B,B.next)>=0)return!1;B=B.nextZ}return!0}function vC(e,t,n){let r=e;do{let s=r.prev,i=r.next.next;!Ki(s,i)&&Sp(s,r,r.next,i)&&qr(s,i)&&qr(i,s)&&(t.push(s.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),jr(r),jr(r.next),r=e=i),r=r.next}while(r!==e);return un(r)}function FC(e,t,n,r,s,i){let o=e;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&VC(o,a)){let c=Mp(o,a);o=un(o,o.next),c=un(c,c.next),Jr(o,t,n,r,s,i,0),Jr(c,t,n,r,s,i,0);return}a=a.next}o=o.next}while(o!==e)}function RC(e,t,n,r,s,i){let o=[],a,c,l,u,h;for(a=0,c=t.length;a<c;a++)l=t[a]*r,u=a<c-1?t[a+1]*r:e.length,h=bp(e,l,u,r,!1,s&&s[a+1],i),h===h.next&&(h.steiner=!0),o.push(GC(h));for(o.sort(LC),a=0;a<o.length;a++)n=PC(o[a],n);return n}function LC(e,t){return e.x-t.x}function PC(e,t){let n=OC(e,t);if(!n)return t;let r=Mp(n,e);return un(r,r.next),un(n,n.next)}function OC(e,t){let n=t,r=e.x,s=e.y,i=-1/0,o;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){let f=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(f<=r&&f>i&&(i=f,o=n.x<n.next.x?n:n.next,f===r))return o}n=n.next}while(n!==t);if(!o)return null;let a=o,c=o.x,l=o.y,u=1/0,h;n=o;do r>=n.x&&n.x>=c&&r!==n.x&&qn(s<l?r:i,s,c,l,s<l?i:r,s,n.x,n.y)&&(h=Math.abs(s-n.y)/(r-n.x),qr(n,e)&&(h<u||h===u&&(n.x>o.x||n.x===o.x&&NC(o,n)))&&(o=n,u=h)),n=n.next;while(n!==a);return o}function NC(e,t){return nt(e.prev,e,t.prev)<0&&nt(t.next,e,e.next)<0}function DC(e,t,n,r){let s=e;do s.z===0&&(s.z=al(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,UC(s)}function UC(e){let t,n,r=1,s,i,o,a,c,l;do{for(i=e,e=null,l=null,s=0;i;){for(s++,a=i,o=0,n=0;n<r&&(o++,a=a.nextZ,!!a);n++);for(c=r;o>0||c>0&&a;)o!==0&&(c===0||!a||i.z<=a.z)?(t=i,i=i.nextZ,o--):(t=a,a=a.nextZ,c--),l?l.nextZ=t:e=t,t.prevZ=l,l=t;i=a}l.nextZ=null,r*=2}while(s>1);return e}function al(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 GC(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 qn(e,t,n,r,s,i,o,a){return(s-o)*(t-a)>=(e-o)*(i-a)&&(e-o)*(r-a)>=(n-o)*(t-a)&&(n-o)*(i-a)>=(s-o)*(r-a)}function VC(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!HC(e,t)&&(qr(e,t)&&qr(t,e)&&zC(e,t)&&(nt(e.prev,e,t.prev)||nt(e,t.prev,t))||Ki(e,t)&&nt(e.prev,e,e.next)>0&&nt(t.prev,t,t.next)>0)}function nt(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Ki(e,t){return e.x===t.x&&e.y===t.y}function Sp(e,t,n,r){let s=Yi(nt(e,t,n)),i=Yi(nt(e,t,r)),o=Yi(nt(n,r,e)),a=Yi(nt(n,r,t));return!!(s!==i&&o!==a||s===0&&Wi(e,n,t)||i===0&&Wi(e,r,t)||o===0&&Wi(n,e,r)||a===0&&Wi(n,t,r))}function Wi(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 Yi(e){return e>0?1:e<0?-1:0}function HC(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&&Sp(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function qr(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 zC(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 Mp(e,t){let n=new Xr(e.i,e.x,e.y),r=new Xr(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 Cp(e,t,n,r){let s=new Xr(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 jr(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 Xr=class{constructor(t,n,r){L(this,"i",void 0),L(this,"x",void 0),L(this,"y",void 0),L(this,"prev",null),L(this,"next",null),L(this,"z",0),L(this,"prevZ",null),L(this,"nextZ",null),L(this,"steiner",!1),this.i=t,this.x=n,this.y=r}};function hl(e,t,n){let r=XC(e),s=Object.keys(r).filter(i=>r[i]!==Array);return WC(e,{propArrayTypes:r,...t},{numericPropKeys:n&&n.numericPropKeys||s,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function XC(e){let t={};for(let n of e)if(n.properties)for(let r in n.properties){let s=n.properties[r];t[r]=tb(s,t[r])}return t}function WC(e,t,n){let{pointPositionsCount:r,pointFeaturesCount:s,linePositionsCount:i,linePathsCount:o,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:u,polygonFeaturesCount:h,propArrayTypes:f,coordLength:d}=t,{numericPropKeys:m=[],PositionDataType:A=Float32Array,triangulate:g=!0}=n,y=e[0]&&"id"in e[0],E=e.length>65535?Uint32Array:Uint16Array,_={type:"Point",positions:new A(r*d),globalFeatureIds:new E(r),featureIds:s>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},B={type:"LineString",pathIndices:i>65535?new Uint32Array(o+1):new Uint16Array(o+1),positions:new A(i*d),globalFeatureIds:new E(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},b={type:"Polygon",polygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),primitivePolygonIndices:c>65535?new Uint32Array(u+1):new Uint16Array(u+1),positions:new A(c*d),globalFeatureIds:new E(c),featureIds:h>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};g&&(b.triangles=[]);for(let w of[_,B,b])for(let C of m){let T=f[C];w.numericProps[C]=new T(w.positions.length/d)}B.pathIndices[o]=i,b.polygonIndices[l]=c,b.primitivePolygonIndices[u]=c;let S={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let w of e){let C=w.geometry,T=w.properties||{};switch(C.type){case"Point":YC(C,_,S,d,T),_.properties.push(ul(T,m)),y&&_.fields.push({id:w.id}),S.pointFeature++;break;case"LineString":KC(C,B,S,d,T),B.properties.push(ul(T,m)),y&&B.fields.push({id:w.id}),S.lineFeature++;break;case"Polygon":QC(C,b,S,d,T),b.properties.push(ul(T,m)),y&&b.fields.push({id:w.id}),S.polygonFeature++;break;default:throw new Error("Invalid geometry type")}S.feature++}return $C(_,B,b,d)}function YC(e,t,n,r,s){t.positions.set(e.data,n.pointPosition*r);let i=e.data.length/r;fl(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 KC(e,t,n,r,s){t.positions.set(e.data,n.linePosition*r);let i=e.data.length/r;fl(t,s,n.linePosition,i),t.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+i),t.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+i);for(let o=0,a=e.indices.length;o<a;++o){let c=e.indices[o],l=o===a-1?e.data.length:e.indices[o+1];t.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(l-c)/r}}function QC(e,t,n,r,s){t.positions.set(e.data,n.polygonPosition*r);let i=e.data.length/r;fl(t,s,n.polygonPosition,i),t.globalFeatureIds.fill(n.feature,n.polygonPosition,n.polygonPosition+i),t.featureIds.fill(n.polygonFeature,n.polygonPosition,n.polygonPosition+i);for(let o=0,a=e.indices.length;o<a;++o){let c=n.polygonPosition;t.polygonIndices[n.polygonObject++]=c;let l=e.areas[o],u=e.indices[o],h=e.indices[o+1];for(let d=0,m=u.length;d<m;++d){let A=u[d],g=d===m-1?h===void 0?e.data.length:h[0]:u[d+1];t.primitivePolygonIndices[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(g-A)/r}let f=n.polygonPosition;ZC(t,l,u,{startPosition:c,endPosition:f,coordLength:r})}}function ZC(e,t,n,r){let{startPosition:s,endPosition:i,coordLength:o}=r;if(!e.triangles)return;let a=s*o,c=i*o,l=e.positions.subarray(a,c),u=n[0],h=n.slice(1).map(d=>(d-u)/o),f=cl(l,h,o,t);for(let d=0,m=f.length;d<m;++d)e.triangles.push(s+f[d])}function ll(e,t){let n={};for(let r in e)n[r]={value:e[r],size:t};return n}function $C(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:ll(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:ll(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:ll(n.numericProps,1)}};return s.polygons&&n.triangles&&(s.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),s}function fl(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 ul(e,t){let n={};for(let r in e)t.includes(r)||(n[r]=e[r]);return n}function tb(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function $i(e,t){let n=t?.globalFeatureId;return n!==void 0?eb(e,n):nb(e,t?.type)}function eb(e,t){let n=Fp(e);for(let r of n){let s=0,i=r.featureIds.value[0];for(let o=0;o<r.featureIds.value.length;o++){let a=r.featureIds.value[o];if(a!==i){if(t===r.globalFeatureIds.value[s])return Qi(r,s,o);s=o,i=a}}if(t===r.globalFeatureIds.value[s])return Qi(r,s,r.featureIds.value.length)}throw new Error(`featureId:${t} not found`)}function nb(e,t){let n=Fp(e,t);return rb(n)}function vp(e,t,n){switch(e.type){case"Point":return ab(e,t,n);case"LineString":return ob(e,t,n);case"Polygon":return Rp(e,t,n);default:let r=e;throw new Error(`Unsupported geometry type: ${r?.type}`)}}function Fp(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 rb(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(Qi(n,r,i)),r=i,s=o)}t.push(Qi(n,r,n.featureIds.value.length))}return t}function Qi(e,t,n){let r=vp(e,t,n),s=ib(e,t,n),i=sb(e,t,n);return{type:"Feature",geometry:r,properties:s,...i}}function sb(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0;return e.fields&&e.fields[e.featureIds.value[t]]}function ib(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=Object.assign({},e.properties[e.featureIds.value[t]]);for(let s in e.numericProps)r[s]=e.numericProps[s].value[t];return r}function Rp(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1/0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1/0,{positions:r}=e,s=e.polygonIndices.value.filter(c=>c>=t&&c<=n),i=e.primitivePolygonIndices.value.filter(c=>c>=t&&c<=n);if(!(s.length>2)){let c=[];for(let l=0;l<i.length-1;l++){let u=i[l],h=i[l+1],f=Zi(r,u,h);c.push(f)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<s.length-1;c++){let l=s[c],u=s[c+1],h=Rp(e,l,u).coordinates;a.push(h)}return{type:"MultiPolygon",coordinates:a}}function ob(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1/0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1/0,{positions:r}=e,s=e.pathIndices.value.filter(a=>a>=t&&a<=n);if(!(s.length>2))return{type:"LineString",coordinates:Zi(r,s[0],s[1])};let o=[];for(let a=0;a<s.length-1;a++){let c=Zi(r,s[a],s[a+1]);o.push(c)}return{type:"MultiLineString",coordinates:o}}function ab(e,t,n){let{positions:r}=e,s=Zi(r,t,n);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function Zi(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 yl=N(Gp(),1);function Vp(e){let t=e.length;if(t<=1)return[e];let n=[],r,s;for(let i=0;i<t;i++){let o=bb(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 bb(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 Hp(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?Sb(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function Sb(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 hn=class{static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(t,n,r,s,i){this.properties=void 0,this.extent=void 0,this.type=void 0,this.id=void 0,this._pbf=void 0,this._geometry=void 0,this._keys=void 0,this._values=void 0,this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=i,t.readFields(Hp,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,s=0,i=0,o=0,a=[],c;for(;t.pos<n;){if(s<=0){let l=t.readVarint();r=l&7,s=l>>3}if(s--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),r===1&&(c&&a.push(c),c=[]),c&&c.push([i,o]);else if(r===7)c&&c.push(c[0].slice());else throw new Error(`unknown command ${r}`)}return c&&a.push(c),a}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,s=0,i=0,o=0,a=1/0,c=-1/0,l=1/0,u=-1/0;for(;t.pos<n;){if(s<=0){let h=t.readVarint();r=h&7,s=h>>3}if(s--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),i<a&&(a=i),i>c&&(c=i),o<l&&(l=o),o>u&&(u=o);else if(r!==7)throw new Error(`unknown command ${r}`)}return[a,l,c,u]}_toGeoJSON(t){let n=this.loadGeometry(),r=hn.types[this.type],s,i;switch(this.type){case 1:let a=[];for(s=0;s<n.length;s++)a[s]=n[s][0];n=a,t(n,this);break;case 2:for(s=0;s<n.length;s++)t(n[s],this);break;case 3:for(n=Vp(n),s=0;s<n.length;s++)for(i=0;i<n[s].length;i++)t(n[s][i],this);break}n.length===1?n=n[0]:r=`Multi${r}`;let o={type:"Feature",geometry:{type:r,coordinates:n},properties:this.properties};return this.id!==null&&(o.id=this.id),o}toGeoJSON(t){if(typeof t=="function")return this._toGeoJSON(t);let{x:n,y:r,z:s}=t,i=this.extent*Math.pow(2,s),o=this.extent*n,a=this.extent*r;function c(l){for(let u=0;u<l.length;u++){let h=l[u];h[0]=(h[0]+o)*360/i-180;let f=180-(h[1]+a)*360/i;h[1]=360/Math.PI*Math.atan(Math.exp(f*Math.PI/180))-90}}return this._toGeoJSON(c)}};var Wr=class{constructor(t,n){this.version=void 0,this.name=void 0,this.extent=void 0,this.length=void 0,this._pbf=void 0,this._keys=void 0,this._values=void 0,this._features=void 0,this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Mb,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 hn(this._pbf,n,this.extent,this._keys,this._values)}};function Mb(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(Ib(n)))}function Ib(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 Yr=class{constructor(t,n){this.layers=void 0,this.layers=t.readFields(wb,{},n)}};function wb(e,t,n){if(e===3&&n){let r=new Wr(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function zp(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[ln(e.data)]],indices:[e.indices]};let r=[],s=[],i=[],o=[],a,c=0;for(let l,u=0,h;u<t;u++){h=e.indices[u]-c,l=e.indices[u+1]-c||e.data.length;let f=e.data.slice(h,l),d=ln(f);if(d===0){let m=e.data.slice(0,h),A=e.data.slice(l);e.data=m.concat(A),c+=l-h;continue}a===void 0&&(a=d<0),a===d<0?(o.length&&(r.push(i),s.push(o)),o=[h],i=[d]):(i.push(d),o.push(h))}return i&&r.push(i),o.length&&s.push(o),{type:n,areas:r,indices:s,data:e.data}}function kp(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 Jp(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?vb(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function vb(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 qp,fn,pl,no,gl,Al,Kr;var Qr=class{constructor(t,n,r,s,i,o){this.properties=void 0,this.extent=void 0,this.type=void 0,this.id=void 0,this._pbf=void 0,this._geometry=void 0,this._keys=void 0,this._values=void 0,this._geometryInfo=void 0,this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=i,this._geometryInfo=o,t.readFields(Jp,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry,qp=t.readVarint()+t.pos,fn=1,no=0,gl=0,Al=0,Kr=0;let n=[],r=[];for(;t.pos<qp;)if(no<=0&&(pl=t.readVarint(),fn=pl&7,no=pl>>3),no--,fn===1||fn===2)gl+=t.readSVarint(),Al+=t.readSVarint(),fn===1&&n.push(Kr),r.push(gl,Al),Kr+=2;else if(fn===7){if(Kr>0){let s=n[n.length-1];r.push(r[s],r[s+1]),Kr+=2}}else throw new Error(`unknown command ${fn}`);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=zp(n),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=r.indices.length;for(let o of r.indices)this._geometryInfo.polygonRingsCount+=o.length;this._geometryInfo.polygonPositionsCount+=r.data.length/s;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:r,properties:this.properties};return this.id!==null&&(i.id=this.id),i}toBinaryCoordinates(t){if(typeof t=="function")return this._toBinaryCoordinates(t);let{x:n,y:r,z:s}=t,i=this.extent*Math.pow(2,s),o=this.extent*n,a=this.extent*r;return this._toBinaryCoordinates(c=>kp(c,o,a,i))}};var Zr=class{constructor(t,n){this.version=void 0,this.name=void 0,this.extent=void 0,this.length=void 0,this._pbf=void 0,this._keys=void 0,this._values=void 0,this._features=void 0,this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Fb,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 Qr(this._pbf,r,this.extent,this._keys,this._values,n)}};function Fb(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(Rb(n)))}function Rb(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 $r=class{constructor(t,n){this.layers=void 0,this.layers=t.readFields(Lb,{},n)}};function Lb(e,t,n){if(e===3&&n){let r=new Zr(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function ro(e,t){var n,r;let s=Ob(t),i=(t==null||(n=t.gis)===null||n===void 0?void 0:n.format)||(t==null||(r=t.mvt)===null||r===void 0?void 0:r.shape)||t?.shape;switch(i){case"columnar-table":return{shape:"columnar-table",data:xl(e,s)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:jp(e,s)};case"geojson":return jp(e,s);case"binary-geometry":return xl(e,s);case"binary":return xl(e,s);default:throw new Error(i||"undefined shape")}}function xl(e,t){let[n,r]=Pb(e,t),s=hl(n,r);return s.byteLength=e.byteLength,s}function Pb(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 $r(new yl.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(s.layers)).forEach(o=>{let a=s.layers[o];if(a)for(let c=0;c<a.length;c++){let l=a.feature(c,r),u=Db(l,t,o);n.push(u)}}),[n,r]}function jp(e,t){if(e.byteLength<=0)return[];let n=[],r=new Yr(new yl.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(r.layers)).forEach(i=>{let o=r.layers[i];if(o)for(let a=0;a<o.length;a++){let c=o.feature(a),l=Nb(c,t,i);n.push(l)}}),n}function Ob(e){var t;if(!(e!=null&&e.mvt))throw new Error("mvt options required");let n=((t=e.mvt)===null||t===void 0?void 0:t.coordinates)==="wgs84",{tileIndex:r}=e.mvt,s=r&&Number.isFinite(r.x)&&Number.isFinite(r.y)&&Number.isFinite(r.z);if(n&&!s)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.mvt}function Nb(e,t,n){let r=e.toGeoJSON(t.coordinates==="wgs84"?t.tileIndex:Ub);return t.layerProperty&&(r.properties[t.layerProperty]=n),r}function Db(e,t,n){let r=e.toBinaryCoordinates(t.coordinates==="wgs84"?t.tileIndex:Gb);return t.layerProperty&&r.properties&&(r.properties[t.layerProperty]=n),r}function Ub(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 Gb(e,t){let{extent:n}=t;for(let r=0,s=e.length;r<s;++r)e[r]/=n}var Vb="4.1.0",so={name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:Vb,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}}},Hb={...so,parse:async(e,t)=>ro(e,t),parseSync:ro,binary:!0};var zb={Point:Xp,MultiPoint:kb,LineString:Wp,MultiLineString:Jb,Polygon:Yp,MultiPolygon:qb};function Xp([e,t],[n,r],s){let i=_e(n[0],r[0],e),o=_e(n[1],r[1],t);return s.unprojectFlat([i,o])}function Tl(e,t,n){return e.map(r=>Xp(r,t,n))}function kb(e,t,n){return Tl(e,t,n)}function Wp(e,t,n){return Tl(e,t,n)}function Jb(e,t,n){return e.map(r=>Wp(r,t,n))}function Yp(e,t,n){return e.map(r=>Tl(r,t,n))}function qb(e,t,n){return e.map(r=>Yp(r,t,n))}function Kp(e,t,n){let r=n.projectFlat([t.west,t.north]),s=n.projectFlat([t.east,t.south]),i=[r,s];return{...e,coordinates:zb[e.type](e.coordinates,i,n)}}var jb=["points","lines","polygons"];function _l(e,t,n,r){for(let s of jb){let i=e[s]&&Xb(e[s],t,n,r);if(i>=0)return i}return-1}function Xb(e,t,n,r){let s=e.featureIds.value;if(!s.length)return-1;let i=0,o=s[s.length-1]+1;if(r){let c=Wb(e,r);if(c)i=c[0],o=c[1]+1;else return-1}let a=-1;if(t in e.numericProps){let c=e.numericProps[t].value.findIndex((l,u)=>l===n&&s[u]>=i&&s[u]<o);return c>=0?e.globalFeatureIds.value[c]:-1}else t?a=Qp(e.properties,c=>c[t]===n,i,o):e.fields&&(a=Qp(e.fields,c=>c.id===n,i,o));return a>=0?Yb(e,a):-1}function Wb(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 Yb(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 Qp(e,t,n,r){for(let s=n;s<r;s++)if(t(e[s],s))return s;return-1}var El=512,Kb={...Cl.GeoJsonLayer.defaultProps,data:Ie,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[so],binary:!0},io=class extends ee{constructor(...t){super(...t)}initializeState(){super.initializeState();let t=this.context.viewport.resolution!==void 0?!1:this.props.binary;this.setState({binary:t,data:null,tileJSON:null,hoveredFeatureId:null,hoveredFeatureLayerName:null})}get isLoaded(){return Boolean(this.state?.data&&super.isLoaded)}updateState({props:t,oldProps: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"&&!wa(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=te(n,t);if(!o)return Promise.reject("Invalid URL");let a=this.getLoadOptions(),{fetch:c}=this.props;return a={...a,mimeType:"application/x-protobuf",mvt:{...a?.mvt,coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:s},gis:r?{format:"binary"}:{}},c(o,{propName:"data",layer:this,loadOptions:a,signal:i})}renderSubLayers(t){let{x:n,y:r,z:s}=t.tile.index,i=Math.pow(2,s),o=El/i,a=-o,c=El*n/i,l=El*(1-r/i),u=new P().scale([o,a,1]);t.autoHighlight=!1,this.context.viewport.resolution||(t.modelMatrix=u,t.coordinateOrigin=[c,l,0],t.coordinateSystem=oo.COORDINATE_SYSTEM.CARTESIAN,t.extensions=[...t.extensions||[],new eg.ClipExtension]);let h=super.renderSubLayers(t);return this.state.binary&&!(h instanceof Cl.GeoJsonLayer)&&oo.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),h}_updateAutoHighlight(t){let{uniqueIdProperty:n}=this.props,{hoveredFeatureId:r,hoveredFeatureLayerName:s}=this.state,i=t.object,o=null,a=null;i&&(o=Bl(i,n),a=Zp(i));let{highlightColor:c}=this.props;typeof c=="function"&&(c=c(t)),(r!==o||s!==a)&&this.setState({highlightColor:c,hoveredFeatureId:o,hoveredFeatureLayerName:a})}getPickingInfo(t){let n=super.getPickingInfo(t),r=Boolean(this.context.viewport.resolution);if(this.state.binary&&n.index!==-1){let{data:s}=t.sourceLayer.props;n.object=$i(s,{globalFeatureId:n.index})}return n.object&&!r&&(n.object=tg(n.object,n.tile.bbox,this.context.viewport)),n}getSubLayerPropsByTile(t){return{highlightedObjectIndex:this.getHighlightedObjectIndex(t),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(t){let{hoveredFeatureId:n,hoveredFeatureLayerName:r,binary:s}=this.state,{uniqueIdProperty:i,highlightedFeatureId:o}=this.props,a=t.content,c=$p(o);if(!($p(n)||c))return-1;let u=c?o:n;return Array.isArray(a)?a.findIndex(h=>{let f=Bl(h,i)===u,d=c||Zp(h)===r;return f&&d}):a&&s?_l(a,i,u,c?"":r):-1}_pickObjects(t){let{deck:n,viewport:r}=this.context,s=r.width,i=r.height,o=r.x,a=r.y,c=[this.id];return n.pickObjects({x:o,y:a,width:s,height:i,layerIds:c,maxObjects:t})}getRenderedFeatures(t=null){let n=this._pickObjects(t),r=new Set,s=[];for(let i of n){let o=Bl(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&&va(s)){let i=this.state.binary?$i(r.content):r.content;r._contentWGS84=i.map(o=>tg(o,s,this.context.viewport))}return r._contentWGS84}})})}},ts=io;(()=>{io.layerName="MVTLayer"})(),(()=>{io.defaultProps=Kb})();function Bl(e,t){if(e.properties&&t)return e.properties[t];if("id"in e)return e.id}function Zp(e){return e.properties?.layerName||null}function $p(e){return e!=null&&e!==""}function tg(e,t,n){let r={...e,geometry:{type:e.geometry.type}};return Object.defineProperty(r.geometry,"coordinates",{get:()=>Kp(e.geometry,t,n).coordinates}),r}var ng="0123456789bcdefghjkmnpqrstuvwxyz",rg={};for(let e=0;e<ng.length;e++)rg[ng.charAt(e)]=e;var Qb=-90,Zb=90,$b=-180,tS=180;function eS(e){let t=!0,n=Zb,r=Qb,s=tS,i=$b,o,a=0;for(let c=0,l=e.length;c<l;c++){let u=e[c].toLowerCase();a=rg[u];for(let h=4;h>=0;h--){let f=a>>h&1;t?(o=(s+i)/2,f===1?i=o:s=o):(o=(n+r)/2,f===1?r=o:n=o),t=!t}}return[r,i,n,s]}function sg(e){let[t,n,r,s]=eS(e);return[s,r,s,t,n,t,n,r,s,r]}var nS={getGeohash:{type:"accessor",value:e=>e.geohash}},ao=class extends It{indexToBounds(){let{data:t,getGeohash:n}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(r,s)=>sg(n(r,s))}}},es=ao;(()=>{ao.layerName="GeohashLayer"})(),(()=>{ao.defaultProps=nS})();return fg(ns);})();
|
|
454
|
+
`;function Yy(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 Ky={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},Ys=class extends zf.SimpleMeshLayer{getShaders(){let t=super.getShaders();return t.modules.push(Na),{...t,vs:Gf,fs:Vf}}initializeState(){let{featureIds:t}=this.props;super.initializeState();let n=this.getAttributeManager();t&&n.add({featureIdsPickingColors:{type:"uint8",size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})}updateState(t){super.updateState(t);let{props:n,oldProps:r}=t;n.pbrMaterial!==r.pbrMaterial&&this.updatePbrMaterialUniforms(n.pbrMaterial)}draw(t){let{featureIds:n}=this.props;this.state.model&&(this.state.model.setUniforms({u_Camera:this.state.model.uniforms.project_uCameraPosition,pickFeatureIds:Boolean(n)}),super.draw(t))}getModel(t){let{id:n,pbrMaterial:r}=this.props,s=this.parseMaterial(r,t);this.setState({parsedPBRMaterial:s});let i=this.getShaders();return Yy(t.attributes),new Hf.Model(this.context.device,{...this.getShaders(),id:n,geometry:t,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:{...i.defines,...s?.defines,HAS_UV_REGIONS:t.attributes.uvRegions?1:0},parameters:s?.parameters,isInstanced:!0})}updatePbrMaterialUniforms(t){let{model:n}=this.state;if(n){let{mesh:r}=this.props,s=this.parseMaterial(t,r);this.setState({parsedPBRMaterial:s}),n.setBindings(s.bindings),n.setUniforms(s.uniforms)}}parseMaterial(t,n){let r=Boolean(t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture);return La(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})}},Br=Ys;(()=>{Ys.layerName="MeshLayer"})(),(()=>{Ys.defaultProps=Ky})();var dm=N(Bn(),1);var ue=6356752314245179e-9,Qy={radii:[6378137,6378137,ue],radiiSquared:[6378137*6378137,6378137*6378137,ue*ue],oneOverRadii:[1/6378137,1/6378137,1/ue],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(ue*ue)],maximumRadius:Math.max(6378137,6378137,ue),centerToleranceSquared:.1};function Ks(e){return e}var uL=new x;function Zy(e,t=[],n=Ks){return"longitude"in e?(t[0]=n(e.longitude),t[1]=n(e.latitude),t[2]=e.height):"x"in e?(t[0]=n(e.x),t[1]=n(e.y),t[2]=e.z):(t[0]=n(e[0]),t[1]=n(e[1]),t[2]=e[2]),t}function Jf(e,t=[]){return Zy(e,t,K._cartographicRadians?Ks:Uo)}function $y(e,t,n=Ks){return"longitude"in t?(t.longitude=n(e[0]),t.latitude=n(e[1]),t.height=e[2]):"x"in t?(t.x=n(e[0]),t.y=n(e[1]),t.z=e[2]):(t[0]=n(e[0]),t[1]=n(e[1]),t[2]=e[2]),t}function qf(e,t){return $y(e,t,K._cartographicRadians?Ks:Go)}var jf=1e-14,tT=new x,Xf={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"}},Da={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Cr={east:new x,north:new x,up:new x,west:new x,south:new x,down:new x},eT=new x,nT=new x,rT=new x;function Ua(e,t,n,r,s,i){let o=Xf[t]&&Xf[t][n];ct(o&&(!r||r===o));let a,c,l,u=tT.copy(s);if(gt(u.x,0,jf)&>(u.y,0,jf)){let f=Math.sign(u.z);a=eT.fromArray(Da[t]),t!=="east"&&t!=="west"&&a.scale(f),c=nT.fromArray(Da[n]),n!=="east"&&n!=="west"&&c.scale(f),l=rT.fromArray(Da[r]),r!=="east"&&r!=="west"&&l.scale(f)}else{let{up:f,east:d,north:p}=Cr;d.set(-u.y,u.x,0).normalize(),e.geodeticSurfaceNormal(u,f),p.copy(f).cross(d);let{down:A,west:g,south:y}=Cr;A.copy(f).scale(-1),g.copy(d).scale(-1),y.copy(p).scale(-1),a=Cr[t],c=Cr[n],l=Cr[r]}return i[0]=a.x,i[1]=a.y,i[2]=a.z,i[3]=0,i[4]=c.x,i[5]=c.y,i[6]=c.z,i[7]=0,i[8]=l.x,i[9]=l.y,i[10]=l.z,i[11]=0,i[12]=u.x,i[13]=u.y,i[14]=u.z,i[15]=1,i}var Cn=new x,sT=new x,iT=new x;function Wf(e,t,n=[]){let{oneOverRadii:r,oneOverRadiiSquared:s,centerToleranceSquared:i}=t;Cn.from(e);let o=Cn.x,a=Cn.y,c=Cn.z,l=r.x,u=r.y,h=r.z,f=o*o*l*l,d=a*a*u*u,p=c*c*h*h,A=f+d+p,g=Math.sqrt(1/A);if(!Number.isFinite(g))return;let y=sT;if(y.copy(e).scale(g),A<i)return y.to(n);let E=s.x,_=s.y,B=s.z,b=iT;b.set(y.x*E*2,y.y*_*2,y.z*B*2);let S=(1-g)*Cn.len()/(.5*b.len()),w=0,C,T,m,M;do{S-=w,C=1/(1+S*E),T=1/(1+S*_),m=1/(1+S*B);let F=C*C,R=T*T,v=m*m,D=F*C,W=R*T,z=v*m;M=f*F+d*R+p*v-1;let X=-2*(f*D*E+d*W*_+p*z*B);w=M/X}while(Math.abs(M)>Gt.EPSILON12);return Cn.scale([C,T,m]).to(n)}var Qs=new x,Yf=new x,cT=new x,kt=new x,lT=new x,Zs=new x,U=class{constructor(t=0,n=0,r=0){L(this,"radii",void 0),L(this,"radiiSquared",void 0),L(this,"radiiToTheFourth",void 0),L(this,"oneOverRadii",void 0),L(this,"oneOverRadiiSquared",void 0),L(this,"minimumRadius",void 0),L(this,"maximumRadius",void 0),L(this,"centerToleranceSquared",Gt.EPSILON1),L(this,"squaredXOverSquaredZ",void 0),ct(t>=0),ct(n>=0),ct(r>=0),this.radii=new x(t,n,r),this.radiiSquared=new x(t*t,n*n,r*r),this.radiiToTheFourth=new x(t*t*t*t,n*n*n*n,r*r*r*r),this.oneOverRadii=new x(t===0?0:1/t,n===0?0:1/n,r===0?0:1/r),this.oneOverRadiiSquared=new x(t===0?0:1/(t*t),n===0?0:1/(n*n),r===0?0:1/(r*r)),this.minimumRadius=Math.min(t,n,r),this.maximumRadius=Math.max(t,n,r),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,n=[0,0,0]){let r=Yf,s=cT,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,r),s.copy(this.radiiSquared).scale(r);let o=Math.sqrt(r.dot(s));return s.scale(1/o),r.scale(i),s.add(r),s.to(n)}cartesianToCartographic(t,n=[0,0,0]){Zs.from(t);let r=this.scaleToGeodeticSurface(Zs,kt);if(!r)return;let s=this.geodeticSurfaceNormal(r,Yf),i=lT;i.copy(Zs).subtract(r);let o=Math.atan2(s.y,s.x),a=Math.asin(s.z),c=Math.sign(xn.dot(i,Zs))*xn.length(i);return qf([o,a,c],n)}eastNorthUpToFixedFrame(t,n=new P){return Ua(this,"east","north","up",t,n)}localFrameToFixedFrame(t,n,r,s,i=new P){return Ua(this,t,n,r,s,i)}geocentricSurfaceNormal(t,n=[0,0,0]){return Qs.from(t).normalize().to(n)}geodeticSurfaceNormalCartographic(t,n=[0,0,0]){let r=Jf(t),s=r[0],i=r[1],o=Math.cos(i);return Qs.set(o*Math.cos(s),o*Math.sin(s),Math.sin(i)).normalize(),Qs.to(n)}geodeticSurfaceNormal(t,n=[0,0,0]){return Qs.from(t).scale(this.oneOverRadiiSquared).normalize().to(n)}scaleToGeodeticSurface(t,n){return Wf(t,this,n)}scaleToGeocentricSurface(t,n=[0,0,0]){kt.from(t);let r=kt.x,s=kt.y,i=kt.z,o=this.oneOverRadiiSquared,a=1/Math.sqrt(r*r*o.x+s*s*o.y+i*i*o.z);return kt.multiplyScalar(a).to(n)}transformPositionToScaledSpace(t,n=[0,0,0]){return kt.from(t).scale(this.oneOverRadii).to(n)}transformPositionFromScaledSpace(t,n=[0,0,0]){return kt.from(t).scale(this.radii).to(n)}getSurfaceNormalIntersectionWithZAxis(t,n=0,r=[0,0,0]){ct(gt(this.radii.x,this.radii.y,Gt.EPSILON15)),ct(this.radii.z>0),kt.from(t);let s=kt.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(s)>=this.radii.z-n))return kt.set(0,0,s).to(r)}};L(U,"WGS84",new U(6378137,6378137,ue));var $s=class{constructor(t,n,r){this.item=void 0,this.previous=void 0,this.next=void 0,this.item=t,this.previous=n,this.next=r}};var ti=class{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(t){let n=new $s(t,this.tail,null);return this.tail?(this.tail.next=n,this.tail=n):(this.head=n,this.tail=n),++this._length,n}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,n){t!==n&&(this.remove(n),this._insert(t,n))}_insert(t,n){let r=t.next;t.next=n,this.tail===t?this.tail=n:r.previous=n,n.next=r,n.previous=t,++this._length}};var ei=class{constructor(){this._list=void 0,this._sentinel=void 0,this._trimTiles=void 0,this._list=new ti,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let n=t._cacheNode;n&&this._list.splice(this._sentinel,n)}add(t,n,r){n._cacheNode||(n._cacheNode=this._list.add(n),r&&r(t,n))}unloadTile(t,n,r){let s=n._cacheNode;s&&(this._list.remove(s),n._cacheNode=null,r&&r(t,n))}unloadTiles(t,n){let r=this._trimTiles;this._trimTiles=!1;let s=this._list,i=t.maximumMemoryUsage*1024*1024,o=this._sentinel,a=s.head;for(;a!==o&&(t.gpuMemoryUsageInBytes>i||r);){let c=a.item;a=a.next,this.unloadTile(t,c,n)}}trim(){this._trimTiles=!0}};function Kf(e,t){V(e),V(t);let{rtcCenter:n,gltfUpAxis:r}=t,{computedTransform:s,boundingVolume:{center:i}}=e,o=new P(s);switch(n&&o.translate(n),r){case"Z":break;case"Y":let h=new P().rotateX(Math.PI/2);o=o.multiplyRight(h);break;case"X":let f=new P().rotateY(-Math.PI/2);o=o.multiplyRight(f);break;default:break}t.isQuantized&&o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let a=new x(i);t.cartesianModelMatrix=o,t.cartesianOrigin=a;let c=U.WGS84.cartesianToCartographic(a,new x),u=U.WGS84.eastNorthUpToFixedFrame(a).invert();t.cartographicModelMatrix=u.multiplyRight(o),t.cartographicOrigin=c,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var Qf=new x,Ga=new x,Va=new ot([new lt,new lt,new lt,new lt,new lt,new lt]);function $f(e,t){let{cameraDirection:n,cameraUp:r,height:s}=e,{metersPerUnit:i}=e.distanceScales,o=ni(e,e.center),a=U.WGS84.eastNorthUpToFixedFrame(o),c=e.unprojectPosition(e.cameraPosition),l=U.WGS84.cartographicToCartesian(c,new x),u=new x(a.transformAsVector(new x(n).scale(i))).normalize(),h=new x(a.transformAsVector(new x(r).scale(i))).normalize();uT(e);let f=e.constructor,{longitude:d,latitude:p,width:A,bearing:g,zoom:y}=e,E=new f({longitude:d,latitude:p,height:s,width:A,bearing:g,zoom:y,pitch:0});return{camera:{position:l,direction:u,up:h},viewport:e,topDownViewport:E,height:s,cullingVolume:Va,frameNumber:t,sseDenominator:1.15}}function td(e,t,n){if(n===0||e.length<=n)return[e,[]];let r=[],{longitude:s,latitude:i}=t.viewport;for(let[l,u]of e.entries()){let[h,f]=u.header.mbs,d=Math.abs(s-h),p=Math.abs(i-f),A=Math.sqrt(p*p+d*d);r.push([l,A])}let o=r.sort((l,u)=>l[1]-u[1]),a=[];for(let l=0;l<n;l++)a.push(e[o[l][0]]);let c=[];for(let l=n;l<o.length;l++)c.push(e[o[l][0]]);return[a,c]}function uT(e){let t=e.getFrustumPlanes(),n=Zf(t.near,e.cameraPosition),r=ni(e,n),s=ni(e,e.cameraPosition,Ga),i=0;Va.planes[i++].fromPointNormal(r,Qf.copy(r).subtract(s));for(let o in t){if(o==="near")continue;let a=t[o],c=Zf(a,n,Ga),l=ni(e,c,Ga);Va.planes[i++].fromPointNormal(l,Qf.copy(r).subtract(l))}}function Zf(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new x,r=e.normal.dot(t);return n.copy(e.normal).scale(e.distance-r).add(t),n}function ni(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new x,r=e.unprojectPosition(t);return U.WGS84.cartographicToCartesian(r,n)}var hT=6378137,fT=6378137,Ha=6356752314245179e-9,bn=new x;function ed(e,t){if(e instanceof Ht){let{halfAxes:n}=e,r=dT(n);return Math.log2(Ha/(r+t[2]))}else if(e instanceof Ft){let{radius:n}=e;return Math.log2(Ha/(n+t[2]))}else if(e.width&&e.height){let{width:n,height:r}=e,s=Math.log2(hT/n),i=Math.log2(fT/r);return(s+i)/2}return 1}function za(e,t,n){U.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],bn);let r=Math.sqrt(Math.pow(bn[0]-n[0],2)+Math.pow(bn[1]-n[1],2)+Math.pow(bn[2]-n[2],2));return Math.log2(Ha/(r+t[2]))}function nd(e,t,n){let[r,s,i,o]=e;return za({xmin:r,xmax:i,ymin:s,ymax:o,zmin:0,zmax:0},t,n)}function dT(e){e.getColumn(0,bn);let t=e.getColumn(1),n=e.getColumn(2);return bn.add(t).add(n).len()}var yd=N(Bn(),1);var At={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Tt=function(e){return e[e.ADD=1]="ADD",e[e.REPLACE=2]="REPLACE",e}({}),ne=function(e){return e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh",e}({}),ht=function(e){return e.I3S="I3S",e.TILES3D="TILES3D",e}({}),Xe=function(e){return e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold",e}({}),rd={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function ad(e){return e!=null}var ft=new x,ri=new x,pT=new x,mT=new x,We=new x,sd=new x,id=new x,od=new x;function si(e,t,n){if(V(e,"3D Tile: boundingVolume must be defined"),e.box)return ld(e.box,t,n);if(e.region)return AT(e.region);if(e.sphere)return gT(e.sphere,t,n);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function cd(e,t){if(e.box)return xT(t);if(e.region){let[n,r,s,i,o,a]=e.region;return[[Mt(n),Mt(r),o],[Mt(s),Mt(i),a]]}if(e.sphere)return yT(t);throw new Error("Unkown boundingVolume type")}function ld(e,t,n){let r=new x(e[0],e[1],e[2]);t.transform(r,r);let s=[];if(e.length===10){let l=e.slice(3,6),u=new Zt;u.fromArray(e,6);let h=new x([1,0,0]),f=new x([0,1,0]),d=new x([0,0,1]);h.transformByQuaternion(u),h.scale(l[0]),f.transformByQuaternion(u),f.scale(l[1]),d.transformByQuaternion(u),d.scale(l[2]),s=[...h.toArray(),...f.toArray(),...d.toArray()]}else s=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let i=t.transformAsVector(s.slice(0,3)),o=t.transformAsVector(s.slice(3,6)),a=t.transformAsVector(s.slice(6,9)),c=new k([i[0],i[1],i[2],o[0],o[1],o[2],a[0],a[1],a[2]]);return ad(n)?(n.center=r,n.halfAxes=c,n):new Ht(r,c)}function gT(e,t,n){let r=new x(e[0],e[1],e[2]);t.transform(r,r);let s=t.getScale(ri),i=Math.max(Math.max(s[0],s[1]),s[2]),o=e[3]*i;return ad(n)?(n.center=r,n.radius=o,n):new Ft(r,o)}function AT(e){let[t,n,r,s,i,o]=e,a=U.WGS84.cartographicToCartesian([Mt(t),Mt(s),i],pT),c=U.WGS84.cartographicToCartesian([Mt(r),Mt(n),o],mT),l=new x().addVectors(a,c).multiplyByScalar(.5);return U.WGS84.cartesianToCartographic(l,We),U.WGS84.cartographicToCartesian([Mt(r),We[1],We[2]],sd),U.WGS84.cartographicToCartesian([We[0],Mt(s),We[2]],id),U.WGS84.cartographicToCartesian([We[0],We[1],o],od),ld([...l,...sd.subtract(l),...id.subtract(l),...od.subtract(l)],new P)}function xT(e){let t=ud(),{halfAxes:n}=e,r=new x(n.getColumn(0)),s=new x(n.getColumn(1)),i=new x(n.getColumn(2));for(let o=0;o<2;o++){for(let a=0;a<2;a++){for(let c=0;c<2;c++)ft.copy(e.center),ft.add(r),ft.add(s),ft.add(i),hd(t,ft),i.negate();s.negate()}r.negate()}return t}function yT(e){let t=ud(),{center:n,radius:r}=e,s=U.WGS84.scaleToGeodeticSurface(n,ft),i;s?i=U.WGS84.geodeticSurfaceNormal(s):i=new x(0,0,1);let o=new x(i[2],-i[1],0);o.len()>0?o.normalize():o=new x(0,1,0);let a=o.clone().cross(i);for(let c of[o,a,i]){ri.copy(c).scale(r);for(let l=0;l<2;l++)ft.copy(n),ft.add(ri),hd(t,ft),ri.negate()}return t}function ud(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function hd(e,t){U.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 ZL=new x,$L=new x,t3=new P,e3=new x,n3=new x,r3=new x;function TT(e,t){let n=e*t;return 1-Math.exp(-(n*n))}function _T(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){let n=e.dynamicScreenSpaceErrorComputedDensity,r=e.dynamicScreenSpaceErrorFactor;return TT(t,n)*r}return 0}function fd(e,t,n){let r=e.tileset,s=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,i=n?s:e.lodMetricValue;if(i===0)return 0;let o=Math.max(e._distanceToCamera,1e-7),{height:a,sseDenominator:c}=t,{viewDistanceScale:l}=r.options,u=i*a*(l||1)/(o*c);return u-=_T(r,o),u}var ka=new x,dd=new x,we=new x,pd=new x,ET=new x,Ja=new P,md=new P;function gd(e,t){if(e.lodMetricValue===0||isNaN(e.lodMetricValue))return"DIG";let n=2*qa(e,t);return n<2?"OUT":!e.header.children||n<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}function qa(e,t){let{topDownViewport:n}=t,r=e.header.mbs[1],s=e.header.mbs[0],i=e.header.mbs[2],o=e.header.mbs[3],a=[...e.boundingVolume.center],c=n.unprojectPosition(n.cameraPosition);U.WGS84.cartographicToCartesian(c,ka),dd.copy(ka).subtract(a).normalize(),U.WGS84.eastNorthUpToFixedFrame(a,Ja),md.copy(Ja).invert(),we.copy(ka).transform(md);let l=Math.sqrt(we[0]*we[0]+we[1]*we[1]),u=l*l/we[2];pd.copy([we[0],we[1],u]);let f=pd.transform(Ja).subtract(a).normalize(),p=dd.cross(f).normalize().scale(o).add(a),A=U.WGS84.cartesianToCartographic(p),g=n.project([s,r,i]),y=n.project(A);return ET.copy(g).subtract(y).magnitude()}function Ad(e){return{assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}}var br=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;this._map=new Map,this._array=void 0,this._length=void 0,this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return V(t<this._array.length),this._array[t]}set(t,n){V(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=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){V(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){V(t>=0),this.length=t}trim(t){t==null&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}};var BT={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},re=class{traversalFinished(t){return!0}constructor(t){this.options=void 0,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={},this.lastUpdate=new Date().getTime(),this.updateDebounceTime=1e3,this._traversalStack=new br,this._emptyTraversalStack=new br,this._frameNumber=null,this.options={...BT,...t}}traverse(t,n,r){this.root=t,this.options={...this.options,...r},this.reset(),this.updateTile(t,n),this._frameNumber=n.frameNumber,this.executeTraversal(t,n)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,n){let r=this._traversalStack;for(t._selectionDepth=1,r.push(t);r.length>0;){let i=r.pop(),o=!1;this.canTraverse(i,n)&&(this.updateChildTiles(i,n),o=this.updateAndPushChildren(i,n,r,i.hasRenderContent?i._selectionDepth+1:i._selectionDepth));let a=i.parent,c=Boolean(!a||a._shouldRefine),l=!o;i.hasRenderContent?i.refine===Tt.ADD?(this.loadTile(i,n),this.selectTile(i,n)):i.refine===Tt.REPLACE&&(this.loadTile(i,n),l&&this.selectTile(i,n)):(this.emptyTiles[i.id]=i,this.loadTile(i,n),l&&this.selectTile(i,n)),this.touchTile(i,n),i._shouldRefine=o&&c}let s=new Date().getTime();(this.traversalFinished(n)||s-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=s,this.options.onTraversalEnd(n))}updateChildTiles(t,n){let r=t.children;for(let s of r)this.updateTile(s,n)}updateAndPushChildren(t,n,r,s){let{loadSiblings:i,skipLevelOfDetail:o}=this.options,a=t.children;a.sort(this.compareDistanceToCamera.bind(this));let c=t.refine===Tt.REPLACE&&t.hasRenderContent&&!o,l=!1,u=!0;for(let h of a)if(h._selectionDepth=s,h.isVisibleAndInRequestVolume?(r.find(h)&&r.delete(h),r.push(h),l=!0):(c||i)&&(this.loadTile(h,n),this.touchTile(h,n)),c){let f;if(h._inRequestVolume?h.hasRenderContent?f=h.contentAvailable:f=this.executeEmptyTraversal(h,n):f=!1,u=u&&f,!u)return!1}return l||(u=!1),u}updateTile(t,n){this.updateTileVisibility(t,n)}selectTile(t,n){this.shouldSelectTile(t)&&(t._selectedFrame=n.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,n){this.shouldLoadTile(t)&&(t._requestedFrame=n.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,n){t.tileset._cache.touch(t),t._touchedFrame=n.frameNumber}canTraverse(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return t.hasChildren?t.hasTilesetContent?!t.contentExpired:!s&&!t.isVisibleAndInRequestVolume?!1:this.shouldRefine(t,n,r):!1}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=t._screenSpaceError;return r&&(s=t.getScreenSpaceError(n,!0)),s>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,n){let r=[];if(this.options.viewportTraversersMap)for(let s in this.options.viewportTraversersMap)this.options.viewportTraversersMap[s]===n.viewport.id&&r.push(s);else r.push(n.viewport.id);t.updateVisibility(n,r)}compareDistanceToCamera(t,n){return t._distanceToCamera-n._distanceToCamera}anyChildrenVisible(t,n){let r=!1;for(let s of t.children)s.updateVisibility(n),r=r||s.isVisibleAndInRequestVolume;return r}executeEmptyTraversal(t,n){let r=!0,s=this._emptyTraversalStack;for(s.push(t);s.length>0;){let i=s.pop(),o=!i.hasRenderContent&&this.canTraverse(i,n,!1,!1),a=!i.hasRenderContent&&i.children.length===0;if(!o&&!i.contentAvailable&&!a&&(r=!1),this.updateTile(i,n),i.isVisibleAndInRequestVolume||(this.loadTile(i,n),this.touchTile(i,n)),o){let c=i.children;for(let l of c)s.push(l)}}return r}};var xd=new x;function CT(e){return e!=null}var Ye=class{constructor(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"";this.tileset=void 0,this.header=void 0,this.id=void 0,this.url=void 0,this.parent=void 0,this.refine=void 0,this.type=void 0,this.contentUrl=void 0,this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=At.UNLOADED,this.gpuMemoryUsageInBytes=0,this.children=[],this.depth=0,this.viewportIds=[],this.transform=new P,this.extensions=null,this.implicitTiling=null,this.userData={},this.computedTransform=void 0,this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.traverser=new re({}),this._cacheNode=null,this._frameNumber=null,this._expireDate=null,this._expiredContent=null,this._boundingBox=void 0,this._distanceToCamera=0,this._screenSpaceError=0,this._visibilityPlaneMask=void 0,this._visible=void 0,this._contentBoundingVolume=void 0,this._viewerRequestVolume=void 0,this._initialTransform=new P,this._priority=0,this._selectedFrame=0,this._requestedFrame=0,this._selectionDepth=0,this._touchedFrame=0,this._centerZDepth=0,this._shouldRefine=!1,this._stackLength=0,this._visitedFrame=0,this._inRequestVolume=!1,this._lodJudge=null,this.header=n,this.tileset=t,this.id=s||n.id,this.url=n.url,this.parent=r,this.refine=this._getRefine(n.refine),this.type=n.type,this.contentUrl=n.contentUrl,this._initializeLodMetric(n),this._initializeTransforms(n),this._initializeBoundingVolumes(n),this._initializeContent(n),this._initializeRenderingState(n),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===At.READY||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===At.UNLOADED}get contentExpired(){return this.contentState===At.EXPIRED}get contentFailed(){return this.contentState===At.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=cd(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,n){switch(this.tileset.type){case ht.I3S:return qa(this,t);case ht.TILES3D:return fd(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===Tt.ADD||n;if(r&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===At.UNLOADED)return-1;let s=this.parent,o=s&&(!r||this._screenSpaceError===0||s.hasTilesetContent)?s._screenSpaceError:this._screenSpaceError,a=t.root?t.root._screenSpaceError:0;return Math.max(a-o,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=At.LOADING;let n=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!n)return this.contentState=At.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,yd.load)(r,s,i),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=At.READY,this._onContentLoaded(),!0}catch(r){throw this.contentState=At.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=At.UNLOADED,!0}updateVisibility(t,n){if(this._frameNumber===t.frameNumber)return;let r=this.parent,s=r?r._visibilityPlaneMask:ot.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!==ot.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=n}visibility(t,n){let{cullingVolume:r}=t,{boundingVolume:s}=this;return r.computeVisibilityWithPlaneMask(s,n)}contentVisibility(){return!0}distanceToTile(t){let n=this.boundingVolume;return Math.sqrt(Math.max(n.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth(t){let{camera:n}=t,r=this.boundingVolume;return xd.subVectors(r.center,n.position),n.direction.dot(xd)}insideViewerRequestVolume(t){let n=this._viewerRequestVolume;return!n||n.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(CT(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=At.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in t?this.lodMetricValue=t.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(t){this.transform=t.transform?new P(t.transform):new P;let n=this.parent,r=this.tileset,s=n&&n.computedTransform?n.computedTransform.clone():r.modelMatrix.clone();this.computedTransform=new P(s).multiplyRight(this.transform);let i=n&&n._initialTransform?n._initialTransform.clone():new P;this._initialTransform=new P(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=At.UNLOADED,this.hasTilesetContent=!1,t.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=ot.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(t){return t||this.parent&&this.parent.refine||Tt.REPLACE}_isTileset(){return this.contentUrl.indexOf(".json")!==-1}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(t){this.boundingVolume=si(t.boundingVolume,this.computedTransform,this.boundingVolume);let n=t.content;n&&(n.boundingVolume&&(this._contentBoundingVolume=si(n.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=si(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(){let n=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:new P).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 Ad(this.tileset.tileset)}}};var ii=class extends re{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===Tt.REPLACE,i=t._optimChildrenWithinParent===rd.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!==Tt.ADD?!1:!this.shouldRefine(t,n,!0)}};var Td=N(Bn(),1);var oi=class{constructor(){this.frameNumberMap=new Map}register(t,n){let r=this.frameNumberMap.get(t)||new Map,s=r.get(n)||0;r.set(n,s+1),this.frameNumberMap.set(t,r)}deregister(t,n){let r=this.frameNumberMap.get(t);if(!r)return;let s=r.get(n)||1;r.set(n,s-1)}isZero(t,n){var r;return(((r=this.frameNumberMap.get(t))===null||r===void 0?void 0:r.get(n))||0)===0}};var ja={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},ai=class{constructor(){this._statusMap=void 0,this.pendingTilesRegister=new oi,this._statusMap={}}add(t,n,r,s){if(!this._statusMap[n]){let{frameNumber:i,viewport:{id:o}}=s;this._statusMap[n]={request:t,callback:r,key:n,frameState:s,status:ja.REQUESTED},this.pendingTilesRegister.register(o,i),t().then(a=>{this._statusMap[n].status=ja.COMPLETED;let{frameNumber:c,viewport:{id:l}}=this._statusMap[n].frameState;this.pendingTilesRegister.deregister(l,c),this._statusMap[n].callback(a,s)}).catch(a=>{this._statusMap[n].status=ja.ERROR;let{frameNumber:c,viewport:{id:l}}=this._statusMap[n].frameState;this.pendingTilesRegister.deregister(l,c),r(a)})}}update(t,n){if(this._statusMap[t]){let{frameNumber:r,viewport:{id:s}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(s,r);let{frameNumber:i,viewport:{id:o}}=n;this.pendingTilesRegister.register(o,i),this._statusMap[t].frameState=n}}find(t){return this._statusMap[t]}hasPendingTiles(t,n){return!this.pendingTilesRegister.isZero(t,n)}};var ci=class extends re{constructor(t){super(t),this._tileManager=void 0,this._tileManager=new ai}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,n){return t._lodJudge=gd(t,n),t._lodJudge==="DIG"}updateChildTiles(t,n){let r=t.header.children||[],s=t.children,i=t.tileset;for(let o of r){let a=`${o.id}-${n.viewport.id}`,c=s&&s.find(l=>l.id===a);if(c)c&&this.updateTile(c,n);else{let l=()=>this._loadTile(o.id,i);this._tileManager.find(a)?this._tileManager.update(a,n):(i.tileset.nodePages&&(l=()=>i.tileset.nodePagesTile.formTileFromNodePages(o.id)),this._tileManager.add(l,a,h=>this._onTileLoad(h,t,a),n))}}return!1}async _loadTile(t,n){let{loader:r}=n,s=n.getTileUrl(`${n.url}/nodes/${t}`),i={...n.loadOptions,i3s:{...n.loadOptions.i3s,isTileHeader:!0}};return await(0,Td.load)(s,r,i)}_onTileLoad(t,n,r){let s=new Ye(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 bT={description:"",ellipsoid:U.WGS84,modelMatrix:new P,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,memoryCacheOverflow:1,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,memoryAdjustedScreenSpaceError:!1,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},li="Tiles In Tileset(s)",Xa="Tiles In Memory",_d="Tiles In View",Ed="Tiles To Render",Bd="Tiles Loaded",Wa="Tiles Loading",Cd="Tiles Unloaded",bd="Failed Tile Loads",Sd="Points/Vertices",Ya="Tile Memory Use",Md="Maximum Screen Space Error",Sr=class{constructor(t,n){this.options=void 0,this.loadOptions=void 0,this.type=void 0,this.tileset=void 0,this.loader=void 0,this.url=void 0,this.basePath=void 0,this.modelMatrix=void 0,this.ellipsoid=void 0,this.lodMetricType=void 0,this.lodMetricValue=void 0,this.refine=void 0,this.root=null,this.roots={},this.asset={},this.description="",this.properties=void 0,this.extras=null,this.attributions={},this.credits={},this.stats=void 0,this.contentFormats={draco:!1,meshopt:!1,dds:!1,ktx2:!1},this.cartographicCenter=null,this.cartesianCenter=null,this.zoom=1,this.boundingVolume=null,this.dynamicScreenSpaceErrorComputedDensity=0,this.maximumMemoryUsage=32,this.gpuMemoryUsageInBytes=0,this.memoryAdjustedScreenSpaceError=0,this._cacheBytes=0,this._cacheOverflowBytes=0,this._frameNumber=0,this._queryParams={},this._extensionsUsed=[],this._tiles={},this._pendingCount=0,this.selectedTiles=[],this.traverseCounter=0,this.geometricError=0,this.lastUpdatedVieports=null,this._requestedTiles=[],this._emptyTiles=[],this.frameStateData={},this._traverser=void 0,this._cache=new ei,this._requestScheduler=void 0,this.updatePromise=null,this.tilesetInitializationPromise=void 0,this.options={...bT,...n},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||ye.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 xe({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 Ae({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(t){this.options={...this.options,...t}}getTileUrl(t){if(t.startsWith("data:"))return t;let r=t;return this.queryParams.length&&(r=`${t}${t.includes("?")?"&":"?"}${this.queryParams}`),r}hasExtension(t){return Boolean(this._extensionsUsed.indexOf(t)>-1)}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;this.tilesetInitializationPromise.then(()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)})}async selectTiles(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise(n=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),n(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytes<this._cacheBytes?this.memoryAdjustedScreenSpaceError=Math.max(this.memoryAdjustedScreenSpaceError/1.02,this.options.maximumScreenSpaceError):this.gpuMemoryUsageInBytes>this._cacheBytes+this._cacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let n=t instanceof Array?t:[t];this._cache.reset(),this._frameNumber++,this.traverseCounter=n.length;let r=[];for(let s of n){let i=s.id;this._needTraverse(i)?r.push(i):this.traverseCounter--}for(let s of n){let i=s.id;if(this.roots[i]||(this.roots[i]=this._initializeTileHeaders(this.tileset,null)),!r.includes(i))continue;let o=$f(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]=td(s,t,this.options.maximumTilesSelected);r.selectedTiles=i;for(let a of o)a.unselect();r._requestedTiles=Object.values(this._traverser.requestedTiles),r._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let t in this.frameStateData){let n=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(n.selectedTiles),this._requestedTiles=this._requestedTiles.concat(n._requestedTiles),this._emptyTiles=this._emptyTiles.concat(n._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(let t of this.selectedTiles)this._tiles[t.id]=t;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(t,n){if(t.length!==n.length)return!0;let r=new Set(t.map(o=>o.id)),s=new Set(n.map(o=>o.id)),i=t.filter(o=>!s.has(o.id)).length>0;return i=i||n.filter(o=>!r.has(o.id)).length>0,i}_loadTiles(){for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,n)=>t._unloadTile(n))}_updateStats(){let t=0,n=0;for(let r of this.selectedTiles)r.contentAvailable&&r.content&&(t++,r.content.pointCount?n+=r.content.pointCount:n+=r.content.vertexCount);this.stats.get(_d).count=this.selectedTiles.length,this.stats.get(Ed).count=t,this.stats.get(Sd).count=n,this.stats.get(Md).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(){var t;let n=this.tileset.fullExtent;if(n){let{xmin:s,xmax:i,ymin:o,ymax:a,zmin:c,zmax:l}=n;this.cartographicCenter=new x(s+(i-s)/2,o+(a-o)/2,c+(l-c)/2),this.cartesianCenter=new x,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=za(n,this.cartographicCenter,this.cartesianCenter);return}let r=(t=this.tileset.store)===null||t===void 0?void 0:t.extent;if(r){let[s,i,o,a]=r;this.cartographicCenter=new x(s+(o-s)/2,i+(a-i)/2,0),this.cartesianCenter=new x,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=nd(r,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new x,this.zoom=1}calculateViewPropsTiles3D(){let t=this.root,{center:n}=t.boundingVolume;if(!n){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new x,this.zoom=1;return}n[0]!==0||n[1]!==0||n[2]!==0?(this.cartographicCenter=new x,U.WGS84.cartesianToCartographic(n,this.cartographicCenter)):this.cartographicCenter=new x(0,0,-U.WGS84.radii[0]),this.cartesianCenter=n,this.zoom=ed(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(li),this.stats.get(Wa),this.stats.get(Xa),this.stats.get(_d),this.stats.get(Ed),this.stats.get(Bd),this.stats.get(Cd),this.stats.get(bd),this.stats.get(Sd),this.stats.get(Ya,"memory"),this.stats.get(Md)}_initializeTileHeaders(t,n){let r=new Ye(this,t.root,n);if(n&&(n.children.push(r),r.depth=n.depth+1),this.type===ht.TILES3D){let i=[];for(i.push(r);i.length>0;){let o=i.pop();this.stats.get(li).incrementCount();let a=o.header.children||[];for(let c of a){var s;let l=new Ye(this,c,o);if((s=l.contentUrl)!==null&&s!==void 0&&s.includes("?session=")){let h=new URL(l.contentUrl).searchParams.get("session");h&&(this._queryParams.session=h)}o.children.push(l),l.depth=o.depth+1,i.push(l)}}}return r}_initializeTraverser(){let t;switch(this.type){case ht.TILES3D:t=ii;break;case ht.I3S:t=ci;break;default:t=re}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(bd).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===ht.I3S){var r,s;let i=((r=this.tileset)===null||r===void 0||(s=r.nodePagesTile)===null||s===void 0?void 0:s.nodesInNodePages)||0;this.stats.get(li).reset(),this.stats.get(li).addCount(i)}t&&t.content&&Kf(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){var n;let{extensionsRemoved:r=[]}=((n=t.content)===null||n===void 0?void 0:n.gltf)||{};r.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),r.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),r.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(Wa).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(Wa).decrementCount()}_addTileToCache(t){this._cache.add(this,t,n=>n._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(Bd).incrementCount(),this.stats.get(Xa).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(Ya).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(Xa).decrementCount(),this.stats.get(Cd).incrementCount(),this.stats.get(Ya).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){let t=[];for(this.root&&t.push(this.root);t.length>0;){let n=t.pop();for(let r of n.children)t.push(r);this._destroyTile(n)}this.root=null}_destroySubtree(t){let n=t,r=[];for(r.push(n);r.length>0;){t=r.pop();for(let s of t.children)r.push(s);t!==n&&this._destroyTile(t)}n.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeTiles3DTileset(t){if(t.queryString){let n=new URLSearchParams(t.queryString),r=Object.fromEntries(n.entries());this._queryParams={...this._queryParams,...r}}if(this.asset=t.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=t.properties,this.geometricError=t.geometricError,this._extensionsUsed=t.extensionsUsed||[],this.extras=t.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}};var ui="4.1.0";var Ke={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},Z3=Object.keys(Ke);function Ka(e,t,n){V(e instanceof ArrayBuffer);let r=new TextDecoder("utf8"),s=new Uint8Array(e,t,n);return r.decode(s)}function Id(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=new DataView(e);return`${String.fromCharCode(n.getUint8(t+0))}${String.fromCharCode(n.getUint8(t+1))}${String.fromCharCode(n.getUint8(t+2))}${String.fromCharCode(n.getUint8(t+3))}`}var wd="4.1.0";var vd={name:"Draco",id:"draco",module:"draco",version:wd,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 Fd(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 Qe(e){let t=1/0,n=1/0,r=1/0,s=-1/0,i=-1/0,o=-1/0,a=e.POSITION?e.POSITION.value:[],c=a&&a.length;for(let l=0;l<c;l+=3){let u=a[l],h=a[l+1],f=a[l+2];t=u<t?u:t,n=h<n?h:n,r=f<r?f:r,s=u>s?u:s,i=h>i?h:i,o=f>o?f:o}return[[t,n,r],[s,i,o]]}function Qa(e,t,n){let r=Fd(t.value),s=n||Rd(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:r}]},nullable:!1,metadata:s}}function Rd(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 Pd(e,t,n){let r=Od(t.metadata),s=[],i=ST(t.attributes);for(let o in e){let a=e[o],c=Ld(o,a,i[o]);s.push(c)}if(n){let o=Ld("indices",n);s.push(o)}return{fields:s,metadata:r}}function ST(e){let t={};for(let n in e){let r=e[n];t[r.name||"undefined"]=r}return t}function Ld(e,t,n){let r=n?Od(n.metadata):void 0;return Qa(e,t,r)}function Od(e){Object.entries(e);let t={};for(let n in e)t[`${n}.string`]=JSON.stringify(e[n]);return t}var Nd={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},MT={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},IT=4,Mr=class{constructor(t){this.draco=void 0,this.decoder=void 0,this.metadataQuerier=void 0,this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=new this.draco.DecoderBuffer;r.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(n);let s=this.decoder.GetEncodedGeometryType(r),i=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(s){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(r,i);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(r,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!i.ptr){let f=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(f)}let a=this._getDracoLoaderData(i,s,n),c=this._getMeshData(i,a,n),l=Qe(c.attributes),u=Pd(c.attributes,a,c.indices);return{loader:"draco",loaderData:a,header:{vertexCount:i.num_points(),boundingBox:l},...c,schema:u}}finally{this.draco.destroy(r),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,n,r){let s=this._getTopLevelMetadata(t),i=this._getDracoAttributes(t,r);return{geometry_type:n,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:s,attributes:i}}_getDracoAttributes(t,n){let r={};for(let s=0;s<t.num_attributes();s++){let i=this.decoder.GetAttribute(t,s),o=this._getAttributeMetadata(t,s);r[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:s,metadata:o};let a=this._getQuantizationTransform(i,n);a&&(r[i.unique_id()].quantization_transform=a);let c=this._getOctahedronTransform(i,n);c&&(r[i.unique_id()].octahedron_transform=c)}return r}_getMeshData(t,n,r){let s=this._getMeshAttributes(n,t,r);if(!s.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:s,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:s,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:s}}_getMeshAttributes(t,n,r){let s={};for(let i of Object.values(t.attributes)){let o=this._deduceAttributeName(i,r);i.name=o;let{value:a,size:c}=this._getAttributeValues(n,i);s[o]={value:a,size:c,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}return s}_getTriangleListIndices(t){let r=t.num_faces()*3,s=r*IT,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),FT(n)}finally{this.draco.destroy(n)}}_getAttributeValues(t,n){let r=MT[n.data_type],s=n.num_components,o=t.num_points()*s,a=o*r.BYTES_PER_ELEMENT,c=wT(this.draco,r),l,u=this.draco._malloc(a);try{let h=this.decoder.GetAttribute(t,n.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,h,c,a,u),l=new r(this.draco.HEAPF32.buffer,u,o).slice()}finally{this.draco._free(u)}return{value:l,size:s}}_deduceAttributeName(t,n){let r=t.unique_id;for(let[o,a]of Object.entries(n.extraAttributes||{}))if(a===r)return o;let s=t.attribute_type;for(let o in Nd)if(this.draco[o]===s)return Nd[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=vT(r);return{int:this.metadataQuerier.GetIntEntry(t,n),string:this.metadataQuerier.GetStringEntry(t,n),double:this.metadataQuerier.GetDoubleEntry(t,n),intArray:s}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(t){let{quantizedAttributes:n=[],octahedronAttributes:r=[]}=t,s=[...n,...r];for(let i of s)this.decoder.SkipAttributeTransform(this.draco[i])}_getQuantizationTransform(t,n){let{quantizedAttributes:r=[]}=n,s=t.attribute_type();if(r.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:new Float32Array([1,2,3]).map(a=>o.min_value(a))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(t,n){let{octahedronAttributes:r=[]}=n,s=t.attribute_type();if(r.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function wT(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 vT(e){let t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}function FT(e){let t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}var RT="1.5.6",LT="1.4.1",Za=`https://www.gstatic.com/draco/versioned/decoders/${RT}`,_t={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},$a={[_t.DECODER]:`${Za}/${_t.DECODER}`,[_t.DECODER_WASM]:`${Za}/${_t.DECODER_WASM}`,[_t.FALLBACK_DECODER]:`${Za}/${_t.FALLBACK_DECODER}`,[_t.ENCODER]:`https://raw.githubusercontent.com/google/draco/${LT}/javascript/${_t.ENCODER}`},Ir;async function Dd(e){let t=e.modules||{};return t.draco3d?Ir=Ir||t.draco3d.createDecoderModule({}).then(n=>({draco:n})):Ir=Ir||PT(e),await Ir}async function PT(e){let t,n;switch(e.draco&&e.draco.decoderType){case"js":t=await Kt($a[_t.FALLBACK_DECODER],"draco",e,_t.FALLBACK_DECODER);break;case"wasm":default:[t,n]=await Promise.all([await Kt($a[_t.DECODER],"draco",e,_t.DECODER),await Kt($a[_t.DECODER_WASM],"draco",e,_t.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await OT(t,n)}function OT(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e({...n,onModuleLoaded:s=>r({draco:s})})})}var hi={...vd,parse:NT};async function NT(e,t){let{draco:n}=await Dd(t),r=new Mr(n);try{return r.parseSync(e,t?.draco)}finally{r.destroy()}}var DT={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},st={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},O={...DT,...st};var tc={[st.DOUBLE]:Float64Array,[st.FLOAT]:Float32Array,[st.UNSIGNED_SHORT]:Uint16Array,[st.UNSIGNED_INT]:Uint32Array,[st.UNSIGNED_BYTE]:Uint8Array,[st.BYTE]:Int8Array,[st.SHORT]:Int16Array,[st.INT]:Int32Array},UT={DOUBLE:st.DOUBLE,FLOAT:st.FLOAT,UNSIGNED_SHORT:st.UNSIGNED_SHORT,UNSIGNED_INT:st.UNSIGNED_INT,UNSIGNED_BYTE:st.UNSIGNED_BYTE,BYTE:st.BYTE,SHORT:st.SHORT,INT:st.INT},ec="Failed to convert GL type",dt=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let n in tc)if(tc[n]===t)return n;throw new Error(ec)}static fromName(t){let n=UT[t];if(!n)throw new Error(ec);return n}static getArrayType(t){switch(t){case st.UNSIGNED_SHORT_5_6_5:case st.UNSIGNED_SHORT_4_4_4_4:case st.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let n=tc[t];if(!n)throw new Error(ec);return n}}static getByteSize(t){return dt.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(dt.getArrayType(t))}static createTypedArray(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;s===void 0&&(s=(n.byteLength-r)/dt.getByteSize(t));let i=dt.getArrayType(t);return new i(n,r,s)}};function Ud(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function nc(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0],n=e>>11&31,r=e>>5&63,s=e&31;return t[0]=n<<3,t[1]=r<<2,t[2]=s<<3,t}var RP=1/256;var LP=new Ve,PP=new x,OP=new Ve,NP=new Ve,DP=new Uint8Array(1);function Gd(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:255;return hs(e,0,t)/t*2-1}function Vd(e){return e<0?-1:1}function Hd(e,t,n,r){if(Ud(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=Gd(e,n),r.y=Gd(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))*Vd(s),r.y=(1-Math.abs(s))*Vd(r.y)}return r.normalize()}function rc(e,t,n){return Hd(e,t,255,n)}var he=class{constructor(t,n){this.json=void 0,this.buffer=void 0,this.featuresLength=0,this._cachedTypedArrays={},this.json=t,this.buffer=n}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:O.UNSIGNED_INT,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,s=this.json[t];return s&&Number.isFinite(s.byteOffset)?this._getTypedArrayFromBinary(t,n,r,1,s.byteOffset):s}getPropertyArray(t,n,r){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?("componentType"in s&&(n=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 a=this.getPropertyArray(t,n,r);if(r===1)return a[s];for(let c=0;c<r;++c)i[c]=a[r*s+c];return i}_getTypedArrayFromBinary(t,n,r,s,i){let o=this._cachedTypedArrays,a=o[t];return a||(a=dt.createTypedArray(n,this.buffer.buffer,this.buffer.byteOffset+i,s*r),o[t]=a),a}_getTypedArrayFromArray(t,n,r){let s=this._cachedTypedArrays,i=s[t];return i||(i=dt.createTypedArray(n,r),s[t]=i),i}};var GT={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},VT={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]]},HT={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 zd(e,t,n,r){let{componentType:s}=e;V(e.componentType);let i=typeof s=="string"?dt.fromName(s):s,o=GT[e.type],a=VT[e.type],c=HT[e.type];return n+=e.byteOffset,{values:dt.createTypedArray(i,t,n,o*r),type:i,size:o,unpacker:a,packer:c}}var se=e=>e!==void 0;function kd(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?zT(r,n):null}function zT(e,t){let n,r,s,i=e.instancesLength,o=e.classes,a=e.classIds,c=e.parentCounts,l=e.parentIds,u=i;se(a.byteOffset)&&(a.componentType=defaultValue(a.componentType,GL.UNSIGNED_SHORT),a.type=AttributeType.SCALAR,s=getBinaryAccessor(a),a=s.createArrayBufferView(t.buffer,t.byteOffset+a.byteOffset,i));let h;if(se(c))for(se(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,s=getBinaryAccessor(c),c=s.createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,i)),h=new Uint16Array(i),u=0,n=0;n<i;++n)h[n]=u,u+=c[n];se(l)&&se(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,s=getBinaryAccessor(l),l=s.createArrayBufferView(t.buffer,t.byteOffset+l.byteOffset,u));let f=o.length;for(n=0;n<f;++n){let g=o[n].length,y=o[n].instances,E=getBinaryProperties(g,y,t);o[n].instances=combine(E,y)}let d=new Array(f).fill(0),p=new Uint16Array(i);for(n=0;n<i;++n)r=a[n],p[n]=d[r],++d[r];let A={classes:o,classIds:a,classIndexes:p,parentCounts:c,parentIndexes:h,parentIds:l};return qT(A),A}function Sn(e,t,n){if(!e)return;let r=e.parentCounts;return e.parentIds?n(e,t):r>0?kT(e,t,n):JT(e,t,n)}function kT(e,t,n){let r=e.classIds,s=e.parentCounts,i=e.parentIds,o=e.parentIndexes,a=r.length,c=scratchVisited;c.length=Math.max(c.length,a);let l=++marker,u=scratchStack;for(u.length=0,u.push(t);u.length>0;){if(t=u.pop(),c[t]===l)continue;c[t]=l;let h=n(e,t);if(se(h))return h;let f=s[t],d=o[t];for(let p=0;p<f;++p){let A=i[d+p];A!==t&&u.push(A)}}return null}function JT(e,t,n){let r=!0;for(;r;){let s=n(e,t);if(se(s))return s;let i=e.parentIds[t];r=i!==t,t=i}throw new Error("traverseHierarchySingleParent")}function qT(e){let t=[],r=e.classIds.length;for(let s=0;s<r;++s)Jd(e,s,stack)}function Jd(e,t,n){let r=e.parentCounts,s=e.parentIds,i=e.parentIndexes,a=e.classIds.length;if(!se(s))return;assert(t<a,`Parent index ${t} exceeds the total number of instances: ${a}`),assert(n.indexOf(t)===-1,"Circular dependency detected in the batch table hierarchy."),n.push(t);let c=se(r)?r[t]:1,l=se(r)?i[t]:t;for(let u=0;u<c;++u){let h=s[l+u];h!==t&&Jd(e,h,n)}n.pop(t)}function Et(e){return e!=null}var fi=(e,t)=>e,jT={HIERARCHY:!0,extensions:!0,extras:!0},Ze=class{constructor(t,n,r){var s;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};this.json=void 0,this.binary=void 0,this.featureCount=void 0,this._extensions=void 0,this._properties=void 0,this._binaryProperties=void 0,this._hierarchy=void 0,V(r>=0),this.json=t||{},this.binary=n,this.featureCount=r,this._extensions=((s=this.json)===null||s===void 0?void 0:s.extensions)||{},this._properties={};for(let o in this.json)jT[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),i["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=kd(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),V(typeof n=="string",n),this._hierarchy){let r=Sn(this._hierarchy,t,(s,i)=>{let o=s.classIds[i];return s.classes[o].name===n});return Et(r)}return!1}isExactClass(t,n){return V(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),V(typeof n=="string",n),Et(this._properties[n])||this._hasPropertyInHierarchy(t,n)}getPropertyNames(t,n){this._checkBatchId(t),n=Et(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),V(typeof n=="string",n),this._binaryProperties){let s=this._binaryProperties[n];if(Et(s))return this._getBinaryProperty(s,t)}let r=this._properties[n];if(Et(r))return fi(r[t],!0);if(this._hierarchy){let s=this._getHierarchyProperty(t,n);if(Et(s))return s}}setProperty(t,n,r){let s=this.featureCount;if(this._checkBatchId(t),V(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];Et(i)||(this._properties[n]=new Array(s),i=this._properties[n]),i[t]=fi(r,!0)}_checkBatchId(t){if(!(t>=0&&t<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(t,n){return t.unpack(t.typedArray,n)}_setBinaryProperty(t,n,r){t.pack(r,t.typedArray,n)}_initializeBinaryProperties(){let t=null;for(let n in this._properties){let r=this._properties[n],s=this._initializeBinaryProperty(n,r);s&&(t=t||{},t[n]=s)}return t}_initializeBinaryProperty(t,n){if("byteOffset"in n){let r=n;V(this.binary,`Property ${t} requires a batch table binary.`),V(r.type,`Property ${t} requires a type.`);let s=zd(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=Sn(this._hierarchy,t,(s,i)=>{let o=s.classIds[i],a=s.classes[o].instances;return Et(a[n])});return Et(r)}_getPropertyNamesInHierarchy(t,n){Sn(this._hierarchy,t,(r,s)=>{let i=r.classIds[s],o=r.classes[i].instances;for(let a in o)o.hasOwnProperty(a)&&n.indexOf(a)===-1&&n.push(a)})}_getHierarchyProperty(t,n){return Sn(this._hierarchy,t,(r,s)=>{let i=r.classIds[s],o=r.classes[i],a=r.classIndexes[s],c=o.instances[n];return Et(c)?Et(c.typedArray)?this._getBinaryProperty(c,a):fi(c[a],!0):null})}_setHierarchyProperty(t,n,r,s){let i=Sn(this._hierarchy,n,(o,a)=>{let c=o.classIds[a],l=o.classes[c],u=o.classIndexes[a],h=l.instances[r];return Et(h)?(V(a===n,`Inherited property "${r}" is read-only.`),Et(h.typedArray)?this._setBinaryProperty(h,u,s):h[u]=fi(s,!0),!0):!1});return Et(i)}};function ve(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=new DataView(t);if(e.magic=r.getUint32(n,!0),n+=4,e.version=r.getUint32(n,!0),n+=4,e.byteLength=r.getUint32(n,!0),n+=4,e.version!==1)throw new Error(`3D Tile Version ${e.version} not supported`);return n}var Mn=4,qd="b3dm tile in legacy format.";function In(e,t,n){let r=new DataView(t),s;e.header=e.header||{};let i=r.getUint32(n,!0);n+=Mn;let o=r.getUint32(n,!0);n+=Mn;let a=r.getUint32(n,!0);n+=Mn;let c=r.getUint32(n,!0);return n+=Mn,a>=570425344?(n-=Mn*2,s=i,a=o,c=0,i=0,o=0,console.warn(qd)):c>=570425344&&(n-=Mn,s=a,a=i,c=o,i=0,o=0,console.warn(qd)),e.header.featureTableJsonByteLength=i,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=a,e.header.batchTableBinaryByteLength=c,e.header.batchLength=s,n}function wn(e,t,n,r){return n=XT(e,t,n,r),n=WT(e,t,n,r),n}function XT(e,t,n,r){let{featureTableJsonByteLength:s,featureTableBinaryByteLength:i,batchLength:o}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:o||0},s&&s>0){let a=Ka(t,n,s);e.featureTableJson=JSON.parse(a)}return n+=s||0,e.featureTableBinary=new Uint8Array(t,n,i),n+=i||0,n}function WT(e,t,n,r){let{batchTableJsonByteLength:s,batchTableBinaryByteLength:i}=e.header||{};if(s&&s>0){let o=Ka(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 sc(e,t,n){if(!t&&(!e||!e.batchIds||!n))return null;let{batchIds:r,isRGB565:s,pointCount:i=0}=e;if(r&&n){let o=new Uint8ClampedArray(i*3);for(let a=0;a<i;a++){let c=r[a],u=n.getProperty(c,"dimensions").map(h=>h*255);o[a*3]=u[0],o[a*3+1]=u[1],o[a*3+2]=u[2]}return{type:O.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}if(t&&s){let o=new Uint8ClampedArray(i*3);for(let a=0;a<i;a++){let c=nc(t[a]);o[a*3]=c[0],o[a*3+1]=c[1],o[a*3+2]=c[2]}return{type:O.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}return t&&t.length===i*3?{type:O.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:O.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var jd=new x;function Xd(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++)rc(t[r*2],t[r*2+1],jd),jd.toArray(n,r*3);return{type:O.FLOAT,size:2,value:n}}return{type:O.FLOAT,size:2,value:t}}function Wd(e,t,n){return e.isQuantized?n["3d-tiles"]&&n["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,YT(e,t)):{type:O.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function YT(e,t){let n=new x,r=new Float32Array(e.pointCount*3);for(let s=0;s<e.pointCount;s++)n.set(t[s*3],t[s*3+1],t[s*3+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(r,s*3);return r}async function Yd(e,t,n,r,s){n=ve(e,t,n),n=In(e,t,n),n=wn(e,t,n,r),KT(e);let{featureTable:i,batchTable:o}=QT(e);return await n_(e,i,o,r,s),ZT(e,i,r),$T(e,i,o),t_(e,i),n}function KT(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function QT(e){let t=new he(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",O.FLOAT,3);let r=e_(e,t);return{featureTable:t,batchTable:r}}function ZT(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",O.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let r=t.getPropertyArray("POSITION_QUANTIZED",O.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",O.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",O.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=Wd(e,r,n)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function $T(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",O.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?r=t.getPropertyArray("RGB",O.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(r=t.getPropertyArray("RGB565",O.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=sc(e,r,n)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",O.UNSIGNED_BYTE,4))}function t_(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",O.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(n=t.getPropertyArray("NORMAL_OCT16P",O.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=Xd(e,n)}}function e_(e,t){let n=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",O.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 Ze(s,i,r)}return n}async function n_(e,t,n,r,s){let i,o,a,c=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];c&&(a=c.properties);let l=t.getExtension("3DTILES_draco_point_compression");if(l){o=l.properties;let h=l.byteOffset,f=l.byteLength;if(!o||!Number.isFinite(h)||!f)throw new Error("Draco properties, byteOffset, and byteLength must be defined");i=(e.featureTableBinary||[]).slice(h,h+f),e.hasPositions=Number.isFinite(o.POSITION),e.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),e.hasNormals=Number.isFinite(o.NORMAL),e.hasBatchIds=Number.isFinite(o.BATCH_ID),e.isTranslucent=Number.isFinite(o.RGBA)}if(!i)return!0;let u={buffer:i,properties:{...o,...a},featureTableProperties:o,batchTableProperties:a,dequantizeInShader:!1};return await r_(e,u,r,s)}async function r_(e,t,n,r){if(!r)return;let s={...n,draco:{...n?.draco,extraAttributes:t.batchTableProperties||{}}};delete s["3d-tiles"];let i=await Ct(t.buffer,hi,s,r),o=i.attributes.POSITION&&i.attributes.POSITION.value,a=i.attributes.COLOR_0&&i.attributes.COLOR_0.value,c=i.attributes.NORMAL&&i.attributes.NORMAL.value,l=i.attributes.BATCH_ID&&i.attributes.BATCH_ID.value,u=o&&i.attributes.POSITION.value.quantization,h=c&&i.attributes.NORMAL.value.quantization;if(u){let d=i.POSITION.data.quantization,p=d.range;e.quantizedVolumeScale=new x(p,p,p),e.quantizedVolumeOffset=new x(d.minValues),e.quantizedRange=(1<<d.quantizationBits)-1,e.isQuantizedDraco=!0}h&&(e.octEncodedRange=(1<<i.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let f={};if(t.batchTableProperties)for(let d of Object.keys(t.batchTableProperties))i.attributes[d]&&i.attributes[d].value&&(f[d.toLowerCase()]=i.attributes[d].value);e.attributes={positions:o,colors:sc(e,a,void 0),normals:c,batchIds:l,...f}}var ic={};ut(ic,{decode:()=>m_,name:()=>p_});function at(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var di={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},pi={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var s_=1.33,Kd=["SCALAR","VEC2","VEC3","VEC4"],i_=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],o_=new Map(i_),a_={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},c_={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},l_={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function mi(e){return Kd[e-1]||Kd[0]}function vn(e){let t=o_.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function Fn(e,t){let n=l_[e.componentType],r=a_[e.type],s=c_[e.componentType],i=e.count*r,o=e.count*r*s;at(o>=0&&o<=t.byteLength);let a=pi[e.componentType],c=di[e.type];return{ArrayType:n,length:i,byteLength:o,componentByteSize:a,numberOfComponentsInElement:c}}function wr(e){let{images:t,bufferViews:n}=e;t=t||[],n=n||[];let r=t.map(o=>o.bufferView);n=n.filter(o=>!r.includes(o));let s=n.reduce((o,a)=>o+a.byteLength,0),i=t.reduce((o,a)=>{let{width:c,height:l}=a.image;return o+c*l},0);return s+Math.ceil(4*i*s_)}function Qd(e,t,n){let r=e.bufferViews[n];at(r);let s=r.buffer,i=t[s];at(i);let o=(r.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,o,r.byteLength)}function Zd(e,t,n){var r,s;let i=typeof n=="number"?(r=e.accessors)===null||r===void 0?void 0:r[n]:n;if(!i)throw new Error(`No gltf accessor ${JSON.stringify(n)}`);let o=(s=e.bufferViews)===null||s===void 0?void 0:s[i.bufferView||0];if(!o)throw new Error(`No gltf buffer view for accessor ${o}`);let{arrayBuffer:a,byteOffset:c}=t[o.buffer],l=(c||0)+(i.byteOffset||0)+(o.byteOffset||0),{ArrayType:u,length:h,componentByteSize:f,numberOfComponentsInElement:d}=Fn(i,o),p=f*d,A=o.byteStride||p;if(typeof o.byteStride>"u"||o.byteStride===p)return new u(a,l,h);let g=new u(h);for(let y=0;y<i.count;y++){let E=new u(a,l+y*A,d);g.set(E,y*d)}return g}function u_(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var j=class{constructor(t){this.gltf=void 0,this.sourceBuffers=void 0,this.byteLength=void 0,this.gltf={json:t?.json||u_(),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];at(r);let s=(t.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,s,t.byteLength)}getTypedArrayForAccessor(t){let n=this.getAccessor(t);return Zd(this.gltf.json,this.gltf.buffers,n)}getTypedArrayForImageData(t){t=this.getAccessor(t);let n=this.getBufferView(t.bufferView),s=this.getBuffer(n.buffer).data,i=n.byteOffset||0;return new Uint8Array(s,i,n.byteLength)}addApplicationData(t,n){return this.json[t]=n,this}addExtraData(t,n){return this.json.extras=this.json.extras||{},this.json.extras[t]=n,this}addObjectExtension(t,n,r){return t.extensions=t.extensions||{},t.extensions[n]=r,this.registerUsedExtension(n),this}setObjectExtension(t,n,r){let s=t.extensions||{};s[n]=r}removeObjectExtension(t,n){let r=t?.extensions||{};if(r[n]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(n)||s.push(n)}delete r[n]}addExtension(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return at(n),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=n,this.registerUsedExtension(t),n}addRequiredExtension(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return at(n),this.addExtension(t,n),this.registerRequiredExtension(t),n}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(n=>n===t)||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(n=>n===t)||this.json.extensionsRequired.push(t)}removeExtension(t){var n;if((n=this.json.extensions)!==null&&n!==void 0&&n[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let r=this.json.extensionsRemoved;r.includes(t)||r.push(t)}this.json.extensions&&delete this.json.extensions[t],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t)}setDefaultScene(t){this.json.scene=t}addScene(t){let{nodeIndices:n}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:n}),this.json.scenes.length-1}addNode(t){let{meshIndex:n,matrix:r}=t;this.json.nodes=this.json.nodes||[];let s={mesh:n};return r&&(s.matrix=r),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(t){let{attributes:n,indices:r,material:s,mode:i=4}=t,a={primitives:[{attributes:this._addAttributes(n),mode:i}]};if(r){let c=this._addIndices(r);a.primitives[0].indices=c}return Number.isFinite(s)&&(a.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(t){let r={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(r),this.json.meshes.length-1}addImage(t,n){let r=Ge(t),s=n||r?.mimeType,o={bufferView:this.addBufferView(t),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.byteLength,s=t.byteLength;at(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let i={buffer:n,byteOffset:r,byteLength:s};return this.byteLength+=ge(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(t,n){let r={bufferView:t,type:mi(n.size),componentType:n.componentType,count:n.count,max:n.max,min:n.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}addBinaryBuffer(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{size:3},r=this.addBufferView(t),s={min:n.min,max:n.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(t,n.size));let i={size:n.size,componentType:vn(t),count:Math.round(t.length/n.size),min:s.min,max:s.max};return this.addAccessor(r,Object.assign(i,n))}addTexture(t){let{imageIndex:n}=t,r={source:n};return this.json.textures=this.json.textures||[],this.json.textures.push(r),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){var t,n;this.gltf.buffers=[];let r=this.byteLength,s=new ArrayBuffer(r),i=new Uint8Array(s),o=0;for(let a of this.sourceBuffers||[])o=_o(a,i,o);(t=this.json)!==null&&t!==void 0&&(n=t.buffers)!==null&&n!==void 0&&n[0]?this.json.buffers[0].byteLength=r:this.json.buffers=[{byteLength:r}],this.gltf.binary=s,this.sourceBuffers=[s]}_removeStringFromArray(t,n){let r=!0;for(;r;){let s=t.indexOf(n);s>-1?t.splice(s,1):r=!1}}_addAttributes(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n={};for(let r in t){let s=t[r],i=this._getGltfAttributeName(r),o=this.addBinaryBuffer(s.value,s);n[i]=o}return n}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return t}}_getAccessorMinMax(t,n){let r={min:null,max:null};if(t.length<n)return r;r.min=[],r.max=[];let s=t.subarray(0,n);for(let i of s)r.min.push(i),r.max.push(i);for(let i=n;i<t.length;i+=n)for(let o=0;o<n;o++)r.min[0+o]=Math.min(r.min[0+o],t[i+o]),r.max[0+o]=Math.max(r.max[0+o],t[i+o]);return r}};function $d(e){return(e%1+1)%1}var tp={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},h_={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},ep={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function vr(e,t){return ep[t]*tp[e]}function Rn(e,t,n,r){if(n!=="UINT8"&&n!=="UINT16"&&n!=="UINT32"&&n!=="UINT64")return null;let s=e.getTypedArrayForBufferView(t),i=Ln(s,"SCALAR",n,r+1);return i instanceof BigInt64Array||i instanceof BigUint64Array?null:i}function Ln(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,s=tp[t],i=h_[n],o=ep[n],a=r*s,c=a*o,l=e.buffer,u=e.byteOffset;return u%o!==0&&(l=new Uint8Array(l).slice(u,u+c).buffer,u=0),new i(l,u,a)}function Pn(e,t,n){var r,s;let i=`TEXCOORD_${t.texCoord||0}`,o=n.attributes[i],a=e.getTypedArrayForAccessor(o),c=e.gltf.json,l=t.index,u=(r=c.textures)===null||r===void 0||(s=r[l])===null||s===void 0?void 0:s.source;if(typeof u<"u"){var h,f,d;let p=(h=c.images)===null||h===void 0||(f=h[u])===null||f===void 0?void 0:f.mimeType,A=(d=e.gltf.images)===null||d===void 0?void 0:d[u];if(A&&typeof A.width<"u"){let g=[];for(let y=0;y<a.length;y+=2){let E=f_(A,p,a,y,t.channels);g.push(E)}return g}}return[]}function gi(e,t,n,r,s){if(!(n!=null&&n.length))return;let i=[];for(let u of n){let h=r.findIndex(f=>f===u);h===-1&&(h=r.push(u)-1),i.push(h)}let o=new Uint32Array(i),a=e.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,c=e.addBufferView(o,a,0),l=e.addAccessor(c,{size:1,componentType:vn(o),count:o.length});s.attributes[t]=l}function f_(e,t,n,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[0],i={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=n[r],a=n[r+1],c=1;t&&(t.indexOf("image/jpeg")!==-1||t.indexOf("image/png")!==-1)&&(c=4);let l=d_(o,a,e,c),u=0;for(let h of s){let f=typeof h=="number"?Object.values(i)[h]:i[h],d=l+f.offset,p=er(e);if(p.data.length<=d)throw new Error(`${p.data.length} <= ${d}`);let A=p.data[d];u|=A<<f.shift}return u}function d_(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,s=n.width,i=$d(e)*(s-1),o=Math.round(i),a=n.height,c=$d(t)*(a-1),l=Math.round(c),u=n.components?n.components:r;return(l*s+o)*u}function Ai(e,t,n,r,s){let i=[];for(let o=0;o<t;o++){let a=n[o],c=n[o+1]-n[o];if(c+a>r)break;let l=a/s,u=c/s;i.push(e.slice(l,l+u))}return i}function xi(e,t,n){let r=[];for(let s=0;s<t;s++){let i=s*n;r.push(e.slice(i,i+n))}return r}function yi(e,t,n,r){if(n)throw new Error("Not implemented - arrayOffsets for strings is specified");if(r){let s=[],i=new TextDecoder("utf8"),o=0;for(let a=0;a<e;a++){let c=r[a+1]-r[a];if(c+o<=t.length){let l=t.subarray(o,c+o),u=i.decode(l);s.push(u),o+=c}}return s}return[]}var np="EXT_mesh_features",p_=np;async function m_(e,t){let n=new j(e);g_(n,t)}function g_(e,t){let n=e.gltf.json;if(n.meshes)for(let r of n.meshes)for(let s of r.primitives)A_(e,s,t)}function A_(e,t,n){var r,s;if(!(n!=null&&(r=n.gltf)!==null&&r!==void 0&&r.loadBuffers))return;let i=(s=t.extensions)===null||s===void 0?void 0:s[np],o=i?.featureIds;if(o)for(let c of o){var a;let l;if(typeof c.attribute<"u"){let u=`_FEATURE_ID_${c.attribute}`,h=t.attributes[u];l=e.getTypedArrayForAccessor(h)}else typeof c.texture<"u"&&n!==null&&n!==void 0&&(a=n.gltf)!==null&&a!==void 0&&a.loadImages?l=Pn(e,c.texture,t):l=[];c.data=l}}var cc={};ut(cc,{decode:()=>y_,name:()=>x_});var oc="EXT_structural_metadata",x_=oc;async function y_(e,t){let n=new j(e);T_(n,t)}function T_(e,t){var n,r;if(!((n=t.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let s=e.getExtension(oc);s&&((r=t.gltf)!==null&&r!==void 0&&r.loadImages&&__(e,s),E_(e,s))}function __(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)C_(e,n,i,t)}function E_(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=B_(s,i);o&&S_(e,n,o)}}function B_(e,t){for(let n of e)if(n.class===t)return n;return null}function C_(e,t,n,r){var s;if(!t)return;let i=(s=n.extensions)===null||s===void 0?void 0:s[oc],o=i?.propertyTextures;if(o)for(let a of o){let c=t[a];b_(e,c,n,r)}}function b_(e,t,n,r){if(!t.properties)return;r.dataAttributeNames||(r.dataAttributeNames=[]);let s=t.class;for(let o in t.properties){var i;let a=`${s}_${o}`,c=(i=t.properties)===null||i===void 0?void 0:i[o];if(!c)continue;c.data||(c.data=[]);let l=c.data,u=Pn(e,c,n);u!==null&&(gi(e,a,u,l,n),c.data=l,r.dataAttributeNames.push(a))}}function S_(e,t,n){var r;let s=(r=t.classes)===null||r===void 0?void 0:r[n.class];if(!s)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);let i=n.count;for(let a in s.properties){var o;let c=s.properties[a],l=(o=n.properties)===null||o===void 0?void 0:o[a];if(l){let u=M_(e,t,c,i,l);l.data=u}}}function M_(e,t,n,r,s){let i=[],o=s.values,a=e.getTypedArrayForBufferView(o),c=I_(e,n,s,r),l=w_(e,s,r);switch(n.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{i=v_(n,r,a,c);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${n.type}`);case"STRING":{i=yi(r,a,c,l);break}case"ENUM":{i=F_(t,n,r,a,c);break}default:throw new Error(`Unknown classProperty type ${n.type}`)}return i}function I_(e,t,n,r){return t.array&&typeof t.count>"u"&&typeof n.arrayOffsets<"u"?Rn(e,n.arrayOffsets,n.arrayOffsetType||"UINT32",r):null}function w_(e,t,n){return typeof t.stringOffsets<"u"?Rn(e,t.stringOffsets,t.stringOffsetType||"UINT32",n):null}function v_(e,t,n,r){let s=e.array,i=e.count,o=vr(e.type,e.componentType),a=n.byteLength/o,c;return e.componentType?c=Ln(n,e.type,e.componentType,a):c=n,s?r?Ai(c,t,r,n.length,o):i?xi(c,t,i):[]:c}function F_(e,t,n,r,s){var i;let o=t.enumType;if(!o)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let a=(i=e.enums)===null||i===void 0?void 0:i[o];if(!a)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`);let c=a.valueType||"UINT16",l=vr(t.type,c),u=r.byteLength/l,h=Ln(r,t.type,c,u);if(h||(h=r),t.array){if(s)return R_({valuesData:h,numberOfElements:n,arrayOffsets:s,valuesDataBytesLength:r.length,elementSize:l,enumEntry:a});let f=t.count;return f?L_(h,n,f,a):[]}return ac(h,0,n,a)}function R_(e){let{valuesData:t,numberOfElements:n,arrayOffsets:r,valuesDataBytesLength:s,elementSize:i,enumEntry:o}=e,a=[];for(let c=0;c<n;c++){let l=r[c],u=r[c+1]-r[c];if(u+l>s)break;let h=l/i,f=u/i,d=ac(t,h,f,o);a.push(d)}return a}function L_(e,t,n,r){let s=[];for(let i=0;i<t;i++){let o=n*i,a=ac(e,o,n,r);s.push(a)}return s}function ac(e,t,n,r){let s=[];for(let i=0;i<n;i++)if(e instanceof BigInt64Array||e instanceof BigUint64Array)s.push("");else{let o=e[t+i],a=P_(r,o);a?s.push(a.name):s.push("")}return s}function P_(e,t){for(let n of e.values)if(n.value===t)return n;return null}var lc={};ut(lc,{decode:()=>N_,name:()=>O_});var rp="EXT_feature_metadata",O_=rp;async function N_(e,t){let n=new j(e);D_(n,t)}function D_(e,t){var n,r;if(!((n=t.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let s=e.getExtension(rp);s&&((r=t.gltf)!==null&&r!==void 0&&r.loadImages&&U_(e,s),G_(e,s))}function U_(e,t){let n=t.schema;if(!n)return;let r=n.classes,{featureTextures:s}=t;if(r&&s)for(let i in r){let o=r[i],a=H_(s,i);a&&k_(e,a,o)}}function G_(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=V_(s,i);o&&z_(e,n,o)}}function V_(e,t){for(let n in e){let r=e[n];if(r.class===t)return r}return null}function H_(e,t){for(let n in e){let r=e[n];if(r.class===t)return r}return null}function z_(e,t,n){var r;if(!n.class)return;let s=(r=t.classes)===null||r===void 0?void 0:r[n.class];if(!s)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);let i=n.count;for(let a in s.properties){var o;let c=s.properties[a],l=(o=n.properties)===null||o===void 0?void 0:o[a];if(l){let u=J_(e,t,c,i,l);l.data=u}}}function k_(e,t,n){let r=t.class;for(let i in n.properties){var s;let o=t==null||(s=t.properties)===null||s===void 0?void 0:s[i];if(o){let a=Y_(e,o,r);o.data=a}}}function J_(e,t,n,r,s){let i=[],o=s.bufferView,a=e.getTypedArrayForBufferView(o),c=q_(e,n,s,r),l=j_(e,n,s,r);return n.type==="STRING"||n.componentType==="STRING"?i=yi(r,a,c,l):X_(n)&&(i=W_(n,r,a,c)),i}function q_(e,t,n,r){return t.type==="ARRAY"&&typeof t.componentCount>"u"&&typeof n.arrayOffsetBufferView<"u"?Rn(e,n.arrayOffsetBufferView,n.offsetType||"UINT32",r):null}function j_(e,t,n,r){return typeof n.stringOffsetBufferView<"u"?Rn(e,n.stringOffsetBufferView,n.offsetType||"UINT32",r):null}function X_(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 W_(e,t,n,r){let s=e.type==="ARRAY",i=e.componentCount,o="SCALAR",a=e.componentType||e.type,c=vr(o,a),l=n.byteLength/c,u=Ln(n,o,a,l);return s?r?Ai(u,t,r,n.length,c):i?xi(u,t,i):[]:u}function Y_(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)K_(e,n,t,s,o);return s}function K_(e,t,n,r,s){let i={channels:n.channels,...n.texture},o=Pn(e,i,s);o&&gi(e,t,o,r,s)}var sp="4.1.0";var ip="4.1.0";var Ti={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},uc;async function fc(e){let t=e.modules||{};return t.basis?t.basis:(uc=uc||Q_(e),await uc)}async function Q_(e){let t=null,n=null;return[t,n]=await Promise.all([await Kt(Ti.TRANSCODER,"textures",e),await Kt(Ti.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await Z_(t,n)}function Z_(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 hc;async function dc(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(hc=hc||$_(e),await hc)}async function $_(e){let t=null,n=null;return[t,n]=await Promise.all([await Kt(Ti.ENCODER,"textures",e),await Kt(Ti.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await tE(t,n)}function tE(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e(n).then(s=>{let{BasisFile:i,KTX2File:o,initializeBasis:a,BasisEncoder:c}=s;a(),r({BasisFile:i,KTX2File:o,BasisEncoder:c})})})}var $e={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 eE=["","WEBKIT_","MOZ_"],op={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"},_i=null;function ap(e){if(!_i){e=e||nE()||void 0,_i=new Set;for(let t of eE)for(let n in op)if(e&&e.getExtension(`${t}${n}`)){let r=op[n];_i.add(r)}}return _i}function nE(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var wt=[171,75,84,88,32,50,48,187,13,10,26,10];function cp(e){let t=new Uint8Array(e);return!(t.byteLength<wt.length||t[0]!==wt[0]||t[1]!==wt[1]||t[2]!==wt[2]||t[3]!==wt[3]||t[4]!==wt[4]||t[5]!==wt[5]||t[6]!==wt[6]||t[7]!==wt[7]||t[8]!==wt[8]||t[9]!==wt[9]||t[10]!==wt[10]||t[11]!==wt[11])}var rE={etc1:{basisFormat:0,compressed:!0,format:$e.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:$e.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:$e.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:$e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:$e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:$e.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 mc(e,t){if(t.basis.containerFormat==="auto"){if(cp(e)){let r=await dc(t);return lp(r.KTX2File,e,t)}let{BasisFile:n}=await fc(t);return pc(n,e,t)}switch(t.basis.module){case"encoder":let n=await dc(t);switch(t.basis.containerFormat){case"ktx2":return lp(n.KTX2File,e,t);case"basis":default:return pc(n.BasisFile,e,t)}case"transcoder":default:let{BasisFile:r}=await fc(t);return pc(r,e,t)}}function pc(e,t,n){let r=new e(new Uint8Array(t));try{if(!r.startTranscoding())throw new Error("Failed to start basis transcoding");let s=r.getNumImages(),i=[];for(let o=0;o<s;o++){let a=r.getNumLevels(o),c=[];for(let l=0;l<a;l++)c.push(sE(r,o,l,n));i.push(c)}return i}finally{r.close(),r.delete()}}function sE(e,t,n,r){let s=e.getImageWidth(t,n),i=e.getImageHeight(t,n),o=e.getHasAlpha(),{compressed:a,format:c,basisFormat:l}=up(r,o),u=e.getImageTranscodedSizeInBytes(t,n,l),h=new Uint8Array(u);if(!e.transcodeImage(h,t,n,l,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:i,data:h,compressed:a,format:c,hasAlpha:o}}function lp(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(iE(r,o,n));break}return[i]}finally{r.close(),r.delete()}}function iE(e,t,n){let{alphaFlag:r,height:s,width:i}=e.getImageLevelInfo(t,0,0),{compressed:o,format:a,basisFormat:c}=up(n,r),l=e.getImageTranscodedSizeInBytes(t,0,0,c),u=new Uint8Array(l);if(!e.transcodeImage(u,t,0,0,c,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:i,height:s,data:u,compressed:o,levelSize:l,hasAlpha:r,format:a}}function up(e,t){let n=e&&e.basis&&e.basis.format;return n==="auto"&&(n=Ei()),typeof n=="object"&&(n=t?n.alpha:n.noAlpha),n=n.toLowerCase(),rE[n]}function Ei(){let e=ap();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 hp={name:"Basis",id:"basis",module:"textures",version:ip,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"}}},gc={...hp,parse:mc};var On=!0,fp=1735152710,yc=12,Bi=8,oE=1313821514,aE=5130562,cE=0,lE=0,uE=1;function hE(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return`${String.fromCharCode(e.getUint8(t+0))}${String.fromCharCode(e.getUint8(t+1))}${String.fromCharCode(e.getUint8(t+2))}${String.fromCharCode(e.getUint8(t+3))}`}function dp(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=new DataView(e),{magic:s=fp}=n,i=r.getUint32(t,!1);return i===s||i===fp}function pp(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},s=new DataView(t),i=hE(s,n+0),o=s.getUint32(n+4,On),a=s.getUint32(n+8,On);switch(Object.assign(e,{header:{byteOffset:n,byteLength:a,hasBinChunk:!1},type:i,version:o,json:{},binChunks:[]}),n+=yc,e.version){case 1:return fE(e,s,n);case 2:return dE(e,s,n,r={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function fE(e,t,n){V(e.header.byteLength>yc+Bi);let r=t.getUint32(n+0,On),s=t.getUint32(n+4,On);return n+=Bi,V(s===cE),Ac(e,t,n,r),n+=r,n+=xc(e,t,n,e.header.byteLength),n}function dE(e,t,n,r){return V(e.header.byteLength>yc+Bi),pE(e,t,n,r),n+e.header.byteLength}function pE(e,t,n,r){for(;n+8<=e.header.byteLength;){let s=t.getUint32(n+0,On),i=t.getUint32(n+4,On);switch(n+=Bi,i){case oE:Ac(e,t,n,s);break;case aE:xc(e,t,n,s);break;case lE:r.strict||Ac(e,t,n,s);break;case uE:r.strict||xc(e,t,n,s);break;default:break}n+=ge(s,4)}return n}function Ac(e,t,n,r){let s=new Uint8Array(t.buffer,n,r),o=new TextDecoder("utf8").decode(s);return e.json=JSON.parse(o),ge(r,4)}function xc(e,t,n,r){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:n,byteLength:r,arrayBuffer:t.buffer}),ge(r,4)}function Tc(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 Ec={};ut(Ec,{decode:()=>SE,name:()=>bE});var mE="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",gE="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",AE=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]),xE=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]),yE={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},TE={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function mp(e,t,n,r,s){let i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"NONE",o=await _E();CE(o,o.exports[TE[s]],e,t,n,r,o.exports[yE[i||"NONE"]])}var _c;async function _E(){return _c||(_c=EE()),_c}async function EE(){let e=mE;WebAssembly.validate(AE)&&(e=gE,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(BE(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function BE(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?xE[t[r]]:(t[r]-60)*64+t[++r];return t.buffer.slice(0,n)}function CE(e,t,n,r,s,i,o){let a=e.exports.sbrk,c=r+3&-4,l=a(c*s),u=a(i.length),h=new Uint8Array(e.exports.memory.buffer);h.set(i,u);let f=t(l,r,s,u,i.length);if(f===0&&o&&o(l,c,s),n.set(h.subarray(l,l+r*s)),a(l-a(0)),f!==0)throw new Error(`Malformed buffer data: ${f}`)}var Ci="EXT_meshopt_compression",bE=Ci;async function SE(e,t){var n,r;let s=new j(e);if(!(t!=null&&(n=t.gltf)!==null&&n!==void 0&&n.decompressMeshes)||!((r=t.gltf)!==null&&r!==void 0&&r.loadBuffers))return;let i=[];for(let o of e.json.bufferViews||[])i.push(ME(s,o));await Promise.all(i),s.removeExtension(Ci)}async function ME(e,t){let n=e.getObjectExtension(t,Ci);if(n){let{byteOffset:r=0,byteLength:s=0,byteStride:i,count:o,mode:a,filter:c="NONE",buffer:l}=n,u=e.gltf.buffers[l],h=new Uint8Array(u.arrayBuffer,u.byteOffset+r,s),f=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await mp(f,o,i,h,a,c),e.removeObjectExtension(t,Ci)}}var Bc={};ut(Bc,{name:()=>IE,preprocess:()=>wE});var Nn="EXT_texture_webp",IE=Nn;function wE(e,t){let n=new j(e);if(!Lo("image/webp")){if(n.getRequiredExtensions().includes(Nn))throw new Error(`gltf: Required extension ${Nn} not supported by browser`);return}let{json:r}=n;for(let s of r.textures||[]){let i=n.getObjectExtension(s,Nn);i&&(s.source=i.source),n.removeObjectExtension(s,Nn)}n.removeExtension(Nn)}var Cc={};ut(Cc,{name:()=>vE,preprocess:()=>FE});var bi="KHR_texture_basisu",vE=bi;function FE(e,t){let n=new j(e),{json:r}=n;for(let s of r.textures||[]){let i=n.getObjectExtension(s,bi);i&&(s.source=i.source,n.removeObjectExtension(s,bi))}n.removeExtension(bi)}var Sc={};ut(Sc,{decode:()=>NE,encode:()=>DE,name:()=>PE,preprocess:()=>OE});function gp(e){let t={};for(let n in e){let r=e[n];if(n!=="indices"){let s=bc(r);t[n]=s}}return t}function bc(e){let{buffer:t,size:n,count:r}=RE(e);return{value:t,size:n,byteOffset:0,count:r,type:mi(n),componentType:vn(t)}}function RE(e){let t=e,n=1,r=0;return e&&e.value&&(t=e.value,n=e.size||1),t&&(ArrayBuffer.isView(t)||(t=LE(t,Float32Array)),r=t.length/n),{buffer:t,size:n,count:r}}function LE(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return e?Array.isArray(e)?new t(e):n&&!(e instanceof t)?new t(e):e:null}var Fe="KHR_draco_mesh_compression",PE=Fe;function OE(e,t,n){let r=new j(e);for(let s of Ap(r))r.getObjectExtension(s,Fe)}async function NE(e,t,n){var r;if(!(t!=null&&(r=t.gltf)!==null&&r!==void 0&&r.decompressMeshes))return;let s=new j(e),i=[];for(let o of Ap(s))s.getObjectExtension(o,Fe)&&i.push(UE(s,o,t,n));await Promise.all(i),s.removeExtension(Fe)}function DE(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=new j(e);for(let r of n.json.meshes||[])GE(r,t),n.addRequiredExtension(Fe)}async function UE(e,t,n,r){let s=e.getObjectExtension(t,Fe);if(!s)return;let i=e.getTypedArrayForBufferView(s.bufferView),o=Pe(i.buffer,i.byteOffset),a={...n};delete a["3d-tiles"];let c=await Ct(o,hi,a,r),l=gp(c.attributes);for(let[u,h]of Object.entries(l))if(u in t.attributes){let f=t.attributes[u],d=e.getAccessor(f);d!=null&&d.min&&d!==null&&d!==void 0&&d.max&&(h.min=d.min,h.max=d.max)}t.attributes=l,c.indices&&(t.indices=bc(c.indices)),e.removeObjectExtension(t,Fe),VE(t)}function GE(e,t){var n;let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:4,s=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(!s.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let o=s.DracoWriter.encodeSync({attributes:e}),a=i==null||(n=i.parseSync)===null||n===void 0?void 0:n.call(i,{attributes:e}),c=s._addFauxAttributes(a.attributes),l=s.addBufferView(o);return{primitives:[{attributes:c,mode:r,extensions:{[Fe]:{bufferView:l,attributes:c}}}]}}function VE(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*Ap(e){for(let t of e.json.meshes||[])for(let n of t.primitives)yield n}var Ic={};ut(Ic,{decode:()=>JE,name:()=>HE});var Mc="KHR_texture_transform",HE=Mc,Si=new x,zE=new k,kE=new k;async function JE(e,t){var n;if(!new j(e).hasExtension(Mc)||!((n=t.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let i=e.json.materials||[];for(let o=0;o<i.length;o++)qE(o,e)}function qE(e,t){var n,r,s;let i=[],o=(n=t.json.materials)===null||n===void 0?void 0:n[e],a=o==null||(r=o.pbrMetallicRoughness)===null||r===void 0?void 0:r.baseColorTexture;a&&Fr(t,e,a,i);let c=o?.emissiveTexture;c&&Fr(t,e,c,i);let l=o?.normalTexture;l&&Fr(t,e,l,i);let u=o?.occlusionTexture;u&&Fr(t,e,u,i);let h=o==null||(s=o.pbrMetallicRoughness)===null||s===void 0?void 0:s.metallicRoughnessTexture;h&&Fr(t,e,h,i)}function Fr(e,t,n,r){let s=jE(n,r);if(!s)return;let i=e.json.meshes||[];for(let o of i)for(let a of o.primitives){let c=a.material;Number.isFinite(c)&&t===c&&XE(e,a,s)}}function jE(e,t){var n;let r=(n=e.extensions)===null||n===void 0?void 0:n[Mc],{texCoord:s=0}=e,{texCoord:i=s}=r;if(!(t.findIndex(a=>{let[c,l]=a;return c===s&&l===i})!==-1)){let a=KE(r);return s!==i&&(e.texCoord=i),t.push([s,i]),{originalTexCoord:s,texCoord:i,matrix:a}}return null}function XE(e,t,n){let{originalTexCoord:r,texCoord:s,matrix:i}=n,o=t.attributes[`TEXCOORD_${r}`];if(Number.isFinite(o)){var a;let l=(a=e.json.accessors)===null||a===void 0?void 0:a[o];if(l&&l.bufferView){var c;let u=(c=e.json.bufferViews)===null||c===void 0?void 0:c[l.bufferView];if(u){let{arrayBuffer:h,byteOffset:f}=e.buffers[u.buffer],d=(f||0)+(l.byteOffset||0)+(u.byteOffset||0),{ArrayType:p,length:A}=Fn(l,u),g=pi[l.componentType],y=di[l.type],E=u.byteStride||g*y,_=new Float32Array(A);for(let B=0;B<l.count;B++){let b=new p(h,d+B*E,2);Si.set(b[0],b[1],1),Si.transformByMatrix3(i),_.set([Si[0],Si[1]],B*y)}r===s?WE(l,u,e.buffers,_):YE(s,l,t,e,_)}}}}function WE(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 YE(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 KE(e){let{offset:t=[0,0],rotation:n=0,scale:r=[1,1]}=e,s=new k().set(1,0,0,0,1,0,t[0],t[1],1),i=zE.set(Math.cos(n),Math.sin(n),0,-Math.sin(n),Math.cos(n),0,0,0,1),o=kE.set(r[0],0,0,0,r[1],0,0,0,1);return s.multiplyRight(i).multiplyRight(o)}var wc={};ut(wc,{decode:()=>ZE,encode:()=>$E,name:()=>QE});var tn="KHR_lights_punctual",QE=tn;async function ZE(e){let t=new j(e),{json:n}=t,r=t.getExtension(tn);r&&(t.json.lights=r.lights,t.removeExtension(tn));for(let s of n.nodes||[]){let i=t.getObjectExtension(s,tn);i&&(s.light=i.light),t.removeObjectExtension(s,tn)}}async function $E(e){let t=new j(e),{json:n}=t;if(n.lights){let r=t.addExtension(tn);at(!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,tn,r)}delete t.json.lights}}var vc={};ut(vc,{decode:()=>eB,encode:()=>nB,name:()=>tB});var Rr="KHR_materials_unlit",tB=Rr;async function eB(e){let t=new j(e),{json:n}=t;for(let r of n.materials||[])r.extensions&&r.extensions.KHR_materials_unlit&&(r.unlit=!0),t.removeObjectExtension(r,Rr);t.removeExtension(Rr)}function nB(e){let t=new j(e),{json:n}=t;if(t.materials)for(let r of n.materials||[])r.unlit&&(delete r.unlit,t.addObjectExtension(r,Rr,{}),t.addExtension(Rr))}var Fc={};ut(Fc,{decode:()=>sB,encode:()=>iB,name:()=>rB});var Lr="KHR_techniques_webgl",rB=Lr;async function sB(e){let t=new j(e),{json:n}=t,r=t.getExtension(Lr);if(r){let s=oB(r,t);for(let i of n.materials||[]){let o=t.getObjectExtension(i,Lr);o&&(i.technique=Object.assign({},o,s[o.technique]),i.technique.values=aB(i.technique,t)),t.removeObjectExtension(i,Lr)}t.removeExtension(Lr)}}async function iB(e,t){}function oB(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 aB(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 xp=[cc,ic,Ec,Bc,Cc,Sc,wc,vc,Fc,Ic,lc];function yp(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=xp.filter(i=>_p(i.name,t));for(let i of r){var s;(s=i.preprocess)===null||s===void 0||s.call(i,e,t,n)}}async function Tp(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=xp.filter(i=>_p(i.name,t));for(let i of r){var s;await((s=i.decode)===null||s===void 0?void 0:s.call(i,e,t,n))}}function _p(e,t){var n;let r=(t==null||(n=t.gltf)===null||n===void 0?void 0:n.excludeExtensions)||{};return!(e in r&&!r[e])}var Rc="KHR_binary_glTF";function Ep(e){let t=new j(e),{json:n}=t;for(let r of n.images||[]){let s=t.getObjectExtension(r,Rc);s&&Object.assign(r,s),t.removeObjectExtension(r,Rc)}n.buffers&&n.buffers[0]&&delete n.buffers[0].uri,t.removeExtension(Rc)}var Bp={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},lB={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},Lc=class{constructor(){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}},this.json=void 0}normalize(t,n){this.json=t.json;let r=t.json;switch(r.asset&&r.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${r.asset.version}`);return}if(!n.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(r),this._convertTopLevelObjectsToArrays(r),Ep(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 Bp)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 Bp)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=lB[n];if(r in this.idToIndexMap){let s=this.idToIndexMap[r][t];if(!Number.isFinite(s))throw new Error(`gltf v1: failed to resolve ${n} with id ${t}`);return s}return t}_updateObjects(t){for(let n of this.json.buffers)delete n.type}_updateMaterial(t){for(let i of t.materials){var n,r,s;i.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let o=((n=i.values)===null||n===void 0?void 0:n.tex)||((r=i.values)===null||r===void 0?void 0:r.texture2d_0)||((s=i.values)===null||s===void 0?void 0:s.diffuseTex),a=t.textures.findIndex(c=>c.id===o);a!==-1&&(i.pbrMetallicRoughness.baseColorTexture={index:a})}}};function Cp(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Lc().normalize(e,t)}async function bp(e,t){var n,r,s;let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return uB(e,t,i,o),Cp(e,{normalize:o==null||(n=o.gltf)===null||n===void 0?void 0:n.normalize}),yp(e,o,a),o!=null&&(r=o.gltf)!==null&&r!==void 0&&r.loadBuffers&&e.json.buffers&&await hB(e,o,a),o!=null&&(s=o.gltf)!==null&&s!==void 0&&s.loadImages&&await fB(e,o,a),await Tp(e,o,a),e}function uB(e,t,n,r){if(r.uri&&(e.baseUri=r.uri),t instanceof ArrayBuffer&&!dp(t,n,r)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=To(t);else if(t instanceof ArrayBuffer){let o={};n=pp(o,t,n,r.glb),at(o.type==="glTF",`Invalid GLB magic string ${o.type}`),e._glb=o,e.json=o.json}else at(!1,"GLTF: must be ArrayBuffer or string");let s=e.json.buffers||[];if(e.buffers=new Array(s.length).fill(null),e._glb&&e._glb.header.hasBinChunk){let{binChunks: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 hB(e,t,n){let r=e.json.buffers||[];for(let o=0;o<r.length;++o){let a=r[o];if(a.uri){var s,i;let{fetch:c}=n;at(c);let l=Tc(a.uri,t),u=await(n==null||(s=n.fetch)===null||s===void 0?void 0:s.call(n,l)),h=await(u==null||(i=u.arrayBuffer)===null||i===void 0?void 0:i.call(u));e.buffers[o]={arrayBuffer:h,byteOffset:0,byteLength:h.byteLength},delete a.uri}else e.buffers[o]===null&&(e.buffers[o]={arrayBuffer:new ArrayBuffer(a.byteLength),byteOffset:0,byteLength:a.byteLength})}}async function fB(e,t,n){let r=dB(e),s=e.json.images||[],i=[];for(let o of r)i.push(pB(e,s[o],o,t,n));return await Promise.all(i)}function dB(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 pB(e,t,n,r,s){let i;if(t.uri&&!t.hasOwnProperty("bufferView")){let a=Tc(t.uri,r),{fetch:c}=s;i=await(await c(a)).arrayBuffer(),t.bufferView={data:i}}if(Number.isFinite(t.bufferView)){let a=Qd(e.json,e.buffers,t.bufferView);i=Pe(a.buffer,a.byteOffset,a.byteLength)}at(i,"glTF image has no data");let o=await Ct(i,[Te,gc],{...r,mimeType:t.mimeType,basis:r.basis||{format:Ei()}},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 en={name:"glTF",id:"gltf",module:"gltf",version:sp,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:mB,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function mB(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;t={...en.options,...t},t.gltf={...en.options.gltf,...t.gltf};let{byteOffset:r=0}=t;return await bp({},e,r,t,n)}var gB={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},AB={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Lt={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},xB={magFilter:Lt.TEXTURE_MAG_FILTER,minFilter:Lt.TEXTURE_MIN_FILTER,wrapS:Lt.TEXTURE_WRAP_S,wrapT:Lt.TEXTURE_WRAP_T},yB={[Lt.TEXTURE_MAG_FILTER]:Lt.LINEAR,[Lt.TEXTURE_MIN_FILTER]:Lt.NEAREST_MIPMAP_LINEAR,[Lt.TEXTURE_WRAP_S]:Lt.REPEAT,[Lt.TEXTURE_WRAP_T]:Lt.REPEAT};function TB(){return{id:"default-sampler",parameters:yB}}function _B(e){return AB[e]}function EB(e){return gB[e]}var Pc=class{constructor(){this.baseUri="",this.jsonUnprocessed=void 0,this.json=void 0,this.buffers=[],this.images=[]}postProcess(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{json:r,buffers:s=[],images:i=[]}=t,{baseUri:o=""}=t;return at(r),this.baseUri=o,this.buffers=s,this.images=i,this.jsonUnprocessed=r,this.json=this._resolveTree(t.json,n),this.json}_resolveTree(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={...t};return this.json=r,t.bufferViews&&(r.bufferViews=t.bufferViews.map((s,i)=>this._resolveBufferView(s,i))),t.images&&(r.images=t.images.map((s,i)=>this._resolveImage(s,i))),t.samplers&&(r.samplers=t.samplers.map((s,i)=>this._resolveSampler(s,i))),t.textures&&(r.textures=t.textures.map((s,i)=>this._resolveTexture(s,i))),t.accessors&&(r.accessors=t.accessors.map((s,i)=>this._resolveAccessor(s,i))),t.materials&&(r.materials=t.materials.map((s,i)=>this._resolveMaterial(s,i))),t.meshes&&(r.meshes=t.meshes.map((s,i)=>this._resolveMesh(s,i))),t.nodes&&(r.nodes=t.nodes.map((s,i)=>this._resolveNode(s,i)),r.nodes=r.nodes.map((s,i)=>this._resolveNodeChildren(s))),t.skins&&(r.skins=t.skins.map((s,i)=>this._resolveSkin(s,i))),t.scenes&&(r.scenes=t.scenes.map((s,i)=>this._resolveScene(s,i))),typeof this.json.scene=="number"&&r.scenes&&(r.scene=r.scenes[this.json.scene]),r}getScene(t){return this._get(this.json.scenes,t)}getNode(t){return this._get(this.json.nodes,t)}getSkin(t){return this._get(this.json.skins,t)}getMesh(t){return this._get(this.json.meshes,t)}getMaterial(t){return this._get(this.json.materials,t)}getAccessor(t){return this._get(this.json.accessors,t)}getCamera(t){return this._get(this.json.cameras,t)}getTexture(t){return this._get(this.json.textures,t)}getSampler(t){return this._get(this.json.samplers,t)}getImage(t){return this._get(this.json.images,t)}getBufferView(t){return this._get(this.json.bufferViews,t)}getBuffer(t){return this._get(this.json.buffers,t)}_get(t,n){if(typeof n=="object")return n;let r=t&&t[n];return r||console.warn(`glTF file error: Could not find ${t}[${n}]`),r}_resolveScene(t,n){return{...t,id:t.id||`scene-${n}`,nodes:(t.nodes||[]).map(r=>this.getNode(r))}}_resolveNode(t,n){let r={...t,id:t?.id||`node-${n}`};return t.mesh!==void 0&&(r.mesh=this.getMesh(t.mesh)),t.camera!==void 0&&(r.camera=this.getCamera(t.camera)),t.skin!==void 0&&(r.skin=this.getSkin(t.skin)),t.meshes!==void 0&&t.meshes.length&&(r.mesh=t.meshes.reduce((s,i)=>{let o=this.getMesh(i);return s.id=o.id,s.primitives=s.primitives.concat(o.primitives),s},{primitives:[]})),r}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map(n=>this.getNode(n))),t}_resolveSkin(t,n){let r=typeof t.inverseBindMatrices=="number"?this.getAccessor(t.inverseBindMatrices):void 0;return{...t,id:t.id||`skin-${n}`,inverseBindMatrices:r}}_resolveMesh(t,n){let r={...t,id:t.id||`mesh-${n}`,primitives:[]};return t.primitives&&(r.primitives=t.primitives.map(s=>{let i={...s,attributes:{},indices:void 0,material:void 0},o=s.attributes;for(let a in o)i.attributes[a]=this.getAccessor(o[a]);return s.indices!==void 0&&(i.indices=this.getAccessor(s.indices)),s.material!==void 0&&(i.material=this.getMaterial(s.material)),i})),r}_resolveMaterial(t,n){let r={...t,id:t.id||`material-${n}`};if(r.normalTexture&&(r.normalTexture={...r.normalTexture},r.normalTexture.texture=this.getTexture(r.normalTexture.index)),r.occlusionTexture&&(r.occlusionTexture={...r.occlusionTexture},r.occlusionTexture.texture=this.getTexture(r.occlusionTexture.index)),r.emissiveTexture&&(r.emissiveTexture={...r.emissiveTexture},r.emissiveTexture.texture=this.getTexture(r.emissiveTexture.index)),r.emissiveFactor||(r.emissiveFactor=r.emissiveTexture?[1,1,1]:[0,0,0]),r.pbrMetallicRoughness){r.pbrMetallicRoughness={...r.pbrMetallicRoughness};let s=r.pbrMetallicRoughness;s.baseColorTexture&&(s.baseColorTexture={...s.baseColorTexture},s.baseColorTexture.texture=this.getTexture(s.baseColorTexture.index)),s.metallicRoughnessTexture&&(s.metallicRoughnessTexture={...s.metallicRoughnessTexture},s.metallicRoughnessTexture.texture=this.getTexture(s.metallicRoughnessTexture.index))}return r}_resolveAccessor(t,n){let r=_B(t.componentType),s=EB(t.type),i=r*s,o={...t,id:t.id||`accessor-${n}`,bytesPerComponent:r,components:s,bytesPerElement:i,value:void 0,bufferView:void 0,sparse:void 0};if(t.bufferView!==void 0&&(o.bufferView=this.getBufferView(t.bufferView)),o.bufferView){let a=o.bufferView.buffer,{ArrayType:c,byteLength:l}=Fn(o,o.bufferView),u=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+a.byteOffset,h=a.arrayBuffer.slice(u,u+l);o.bufferView.byteStride&&(h=this._getValueFromInterleavedBuffer(a,u,o.bufferView.byteStride,o.bytesPerElement,o.count)),o.value=new c(h)}return o}_getValueFromInterleavedBuffer(t,n,r,s,i){let o=new Uint8Array(i*s);for(let a=0;a<i;a++){let c=n+a*r;o.set(new Uint8Array(t.arrayBuffer.slice(c,c+s)),a*s)}return o.buffer}_resolveTexture(t,n){return{...t,id:t.id||`texture-${n}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):TB(),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 xB[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 Pr(e,t){return new Pc().postProcess(e,t)}var Mi={URI:0,EMBEDDED:1};function Ii(e,t,n,r){e.rotateYtoZ=!0;let s=(e.byteOffset||0)+(e.byteLength||0)-n;if(s===0)throw new Error("glTF byte length must be greater than 0.");return e.gltfUpAxis=r!=null&&r["3d-tiles"]&&r["3d-tiles"].assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",e.gltfArrayBuffer=Pe(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 wi(e,t,n,r){let s=n?.["3d-tiles"]||{};if(BB(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 Ct(e.gltfArrayBuffer,en,n,r);e.gltf=Pr(i),e.gpuMemoryUsageInBytes=wr(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function BB(e,t,n){switch(t){case Mi.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 Mi.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function Sp(e,t,n,r,s){var i;n=CB(e,t,n,r,s),await wi(e,Mi.EMBEDDED,r,s);let o=e==null||(i=e.gltf)===null||i===void 0?void 0:i.extensions;return o&&o.CESIUM_RTC&&(e.rtcCenter=o.CESIUM_RTC.center),n}function CB(e,t,n,r,s){n=ve(e,t,n),n=In(e,t,n),n=wn(e,t,n,r),n=Ii(e,t,n,r);let i=new he(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=i.getGlobalProperty("RTC_CENTER",O.FLOAT,3),n}async function Mp(e,t,n,r,s){return n=bB(e,t,n,r,s),await wi(e,e.gltfFormat||0,r,s),n}function bB(e,t,n,r,s){var i;if(n=ve(e,t,n),e.version!==1)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);n=In(e,t,n);let o=new DataView(t);if(e.gltfFormat=o.getUint32(n,!0),n+=4,n=wn(e,t,n,r),n=Ii(e,t,n,r),!(e!=null&&(i=e.header)!==null&&i!==void 0&&i.featureTableJsonByteLength)||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let a=new he(e.featureTableJson,e.featureTableBinary),c=a.getGlobalProperty("INSTANCES_LENGTH");if(a.featuresLength=c,!Number.isFinite(c))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=a.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=a.getGlobalProperty("RTC_CENTER",O.FLOAT,3);let l=new Ze(e.batchTableJson,e.batchTableBinary,c);return SB(e,a,l,c),n}function SB(e,t,n,r){let s=new Array(r),i=new x,o=new x,a=new x,c=new x,l=new k,u=new Zt,h=new x,f={},d=new P,p=[],A=[],g=[],y=[];for(let E=0;E<r;E++){let _;if(t.hasProperty("POSITION"))_=t.getProperty("POSITION",O.FLOAT,3,E,i);else if(t.hasProperty("POSITION_QUANTIZED")){_=t.getProperty("POSITION_QUANTIZED",O.UNSIGNED_SHORT,3,E,i);let m=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",O.FLOAT,3);if(!m)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let M=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",O.FLOAT,3);if(!M)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let F=65535;for(let R=0;R<3;R++)_[R]=_[R]/F*M[R]+m[R]}if(!_)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");i.copy(_),f.translation=i,e.normalUp=t.getProperty("NORMAL_UP",O.FLOAT,3,E,p),e.normalRight=t.getProperty("NORMAL_RIGHT",O.FLOAT,3,E,A);let B=!1;if(e.normalUp){if(!e.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");e.hasCustomOrientation=!0}else{if(e.octNormalUp=t.getProperty("NORMAL_UP_OCT32P",O.UNSIGNED_SHORT,2,E,p),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",O.UNSIGNED_SHORT,2,E,A),e.octNormalUp)throw e.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");e.eastNorthUp?(U.WGS84.eastNorthUpToFixedFrame(i,d),d.getRotationMatrix3(l)):l.identity()}B&&(c.copy(o).cross(a).normalize(),l.setColumn(0,o),l.setColumn(1,a),l.setColumn(2,c)),u.fromMatrix3(l),f.rotation=u,h.set(1,1,1);let b=t.getProperty("SCALE",O.FLOAT,1,E,g);Number.isFinite(b)&&h.multiplyByScalar(b);let S=t.getProperty("SCALE_NON_UNIFORM",O.FLOAT,3,E,p);S&&h.scale(S),f.scale=h;let w=t.getProperty("BATCH_ID",O.UNSIGNED_SHORT,1,E,y);w===void 0&&(w=E);let C=new P().fromQuaternion(f.rotation);d.identity(),d.translate(f.translation),d.multiplyRight(C),d.scale(f.scale);let T=d.clone();s[E]={modelMatrix:T,batchId:w}}e.instances=s}async function Ip(e,t,n,r,s,i){n=ve(e,t,n);let o=new DataView(t);for(e.tilesLength=o.getUint32(n,!0),n+=4,e.tiles=[];e.tiles.length<e.tilesLength&&(e.byteLength||0)-n>12;){let a={shape:"tile3d"};e.tiles.push(a),n=await i(t,n,r,s,a)}return n}async function wp(e,t,n,r){var s,i;if(e.rotateYtoZ=!0,e.gltfUpAxis=n!=null&&(s=n["3d-tiles"])!==null&&s!==void 0&&s.assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",n!=null&&(i=n["3d-tiles"])!==null&&i!==void 0&&i.loadGLTF){if(!r)return t.byteLength;let o=await Ct(t,en,n,r);e.gltf=Pr(o),e.gpuMemoryUsageInBytes=wr(e.gltf)}else e.gltfArrayBuffer=t;return t.byteLength}async function Oc(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{shape:"tile3d"};switch(s.byteOffset=t,s.type=Id(e,t),s.type){case Ke.COMPOSITE:return await Ip(s,e,t,n,r,Oc);case Ke.BATCHED_3D_MODEL:return await Sp(s,e,t,n,r);case Ke.GLTF:return await wp(s,e,n,r);case Ke.INSTANCED_3D_MODEL:return await Mp(s,e,t,n,r);case Ke.POINT_CLOUD:return await Yd(s,e,t,n,r);default:throw new Error(`3DTileLoader: unknown type ${s.type}`)}}async function Nc(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=vp(e.slice(8,16)),o=new Uint8Array(e,24,i),c=new TextDecoder("utf8").decode(o),l=JSON.parse(c),u=vp(e.slice(16,24)),h=new ArrayBuffer(0);if(u&&(h=e.slice(24+i)),await vi(l,l.tileAvailability,h,n),Array.isArray(l.contentAvailability))for(let f of l.contentAvailability)await vi(l,f,h,n);else await vi(l,l.contentAvailability,h,n);return await vi(l,l.childSubtreeAvailability,h,n),l}async function vi(e,t,n,r){let s=Number.isFinite(t.bitstream)?t.bitstream:t.bufferView;if(typeof s!="number")return;let i=e.bufferViews[s],o=e.buffers[i.buffer];if(!(r!=null&&r.baseUrl))throw new Error("Url is not provided");if(!r.fetch)throw new Error("fetch is not provided");if(o.uri){let c=`${r?.baseUrl||""}/${o.uri}`,u=await(await r.fetch(c)).arrayBuffer();t.explicitBitstream=new Uint8Array(u,i.byteOffset,i.byteLength);return}let a=e.buffers.slice(0,i.buffer).reduce((c,l)=>c+l.byteLength,0);t.explicitBitstream=new Uint8Array(n.slice(a,a+o.byteLength),i.byteOffset,i.byteLength)}function vp(e){let t=new DataView(e),n=t.getUint32(0,!0),r=t.getUint32(4,!0);return n+2**32*r}var Fi={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:ui,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:Nc,options:{}};var am=N(Bn(),1);var rm=N(Bn(),1);function Dc(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,n=e||t;return!!(n&&n.indexOf("Electron")>=0)}function Jt(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||Dc()}var MB=globalThis.self||globalThis.window||globalThis.global,Dn=globalThis.window||globalThis.self||globalThis.global,IB=globalThis.document||{},nn=globalThis.process||{},wB=globalThis.console,eU=globalThis.navigator||{};var Ri=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",sU=Jt();function vB(e){try{let t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch{return null}}var Li=class{constructor(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=vB(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 Fp(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 Rp(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,n=Math.max(t-e.length,0);return`${" ".repeat(n)}${e}`}function Pi(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,s=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>r&&(n=Math.min(n,r/e.width));let i=e.width*n,o=e.height*n,a=["font-size:1px;",`padding:${Math.floor(o/2)}px ${Math.floor(i/2)}px;`,`line-height:${o}px;`,`background:url(${s});`,`background-size:${i}px ${o}px;`,"color:transparent;"].join("");return[`${t} %c+`,a]}var Oi;(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"})(Oi||(Oi={}));var FB=10;function Lp(e){return typeof e!="string"?e:(e=e.toUpperCase(),Oi[e]||Oi.WHITE)}function Pp(e,t,n){return!Jt&&typeof e=="string"&&(t&&(e=`\x1B[${Lp(t)}m${e}\x1B[39m`),n&&(e=`\x1B[${Lp(n)+FB}m${e}\x1B[49m`)),e}function Op(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],n=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(n),s=e;for(let i of r){let o=s[i];typeof o=="function"&&(t.find(a=>i===a)||(s[i]=o.bind(e)))}}function Un(e,t){if(!e)throw new Error(t||"Assertion failed")}function rn(){let e;if(Jt()&&Dn.performance){var t,n;e=Dn===null||Dn===void 0||(t=Dn.performance)===null||t===void 0||(n=t.now)===null||n===void 0?void 0:n.call(t)}else if("hrtime"in nn){var r;let s=nn===null||nn===void 0||(r=nn.hrtime)===null||r===void 0?void 0:r.call(nn);e=s[0]*1e3+s[1]/1e6}else e=Date.now();return e}var Gn={debug:Jt()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},RB={enabled:!0,level:0};function Pt(){}var Np={},Dp={once:!0},Or=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=Ri,this._startTs=rn(),this._deltaTs=rn(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Li(`__probe-${this.id}__`,RB),this.timeStamp(`${this.id} started`),Op(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((rn()-this._startTs).toPrecision(10))}getDelta(){return Number((rn()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!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){Un(t,n)}warn(t){return this._getLogFunction(0,t,Gn.warn,arguments,Dp)}error(t){return this._getLogFunction(0,t,Gn.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,Gn.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,Gn.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,Gn.debug||Gn.info,arguments,Dp)}table(t,n,r){return n?this._getLogFunction(t,n,console.table||Pt,r&&[r],{tag:NB(n)}):Pt}image(t){let{logLevel:n,priority:r,image:s,message:i="",scale:o=1}=t;return this._shouldLog(n||r)?Jt()?OB({image:s,message:i,scale:o}):PB({image:s,message:i,scale:o}):Pt}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||Pt)}group(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},s=Up({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){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,n,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Pt)}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()>=Gp(t)}_getLogFunction(t,n,r,s,i){if(this._shouldLog(t)){i=Up({logLevel:t,message:n,args:s,opts:i}),r=r||i.method,Un(r),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=rn();let o=i.tag||i.message;if(i.once&&o)if(!Np[o])Np[o]=rn();else return Pt;return n=LB(this.id,i.message,i),r.bind(console,n,...i.args)}return Pt}};Or.VERSION=Ri;function Gp(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 Un(Number.isFinite(t)&&t>=0),t}function Up(e){let{logLevel:t,message:n}=e;e.logLevel=Gp(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 Un(s==="string"||s==="object"),Object.assign(e,{args:r},e.opts)}function LB(e,t,n){if(typeof t=="string"){let r=n.time?Rp(Fp(n.total)):"";t=n.time?`${e}: ${r} ${t}`:`${e}: ${t}`,t=Pp(t,n.color,n.background)}return t}function PB(e){let{image:t,message:n="",scale:r=1}=e;return console.warn("removed"),Pt}function OB(e){let{image:t,message:n="",scale:r=1}=e;if(typeof t=="string"){let i=new Image;return i.onload=()=>{let o=Pi(i,n,r);console.log(...o)},i.src=t,Pt}let s=t.nodeName||"";if(s.toLowerCase()==="img")return console.log(...Pi(t,n,r)),Pt;if(s.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(...Pi(i,n,r)),i.src=t.toDataURL(),Pt}return Pt}function NB(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}globalThis.probe={};var Uc=new Or({id:"@probe.gl/log"});var Ot=null;try{Ot=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Q(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}Q.prototype.__isLong__;Object.defineProperty(Q.prototype,"__isLong__",{value:!0});function pt(e){return(e&&e.__isLong__)===!0}function Vp(e){var t=Math.clz32(e&-e);return e?31-t:t}Q.isLong=pt;var Hp={},zp={};function sn(e,t){var n,r,s;return t?(e>>>=0,(s=0<=e&&e<256)&&(r=zp[e],r)?r:(n=H(e,0,!0),s&&(zp[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(r=Hp[e],r)?r:(n=H(e,e<0?-1:0,!1),s&&(Hp[e]=n),n))}Q.fromInt=sn;function Nt(e,t){if(isNaN(e))return t?fe:qt;if(t){if(e<0)return fe;if(e>=jp)return Yp}else{if(e<=-Jp)return Bt;if(e+1>=Jp)return Wp}return e<0?Nt(-e,t).neg():H(e%Hn|0,e/Hn|0,t)}Q.fromNumber=Nt;function H(e,t,n){return new Q(e,t,n)}Q.fromBits=H;var Ni=Math.pow;function Vc(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?fe:qt;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 Vc(e.substring(1),t,n).neg();for(var s=Nt(Ni(n,8)),i=qt,o=0;o<e.length;o+=8){var a=Math.min(8,e.length-o),c=parseInt(e.substring(o,o+a),n);if(a<8){var l=Nt(Ni(n,a));i=i.mul(l).add(Nt(c))}else i=i.mul(s),i=i.add(Nt(c))}return i.unsigned=t,i}Q.fromString=Vc;function jt(e,t){return typeof e=="number"?Nt(e,t):typeof e=="string"?Vc(e,t):H(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}Q.fromValue=jt;var kp=1<<16,DB=1<<24,Hn=kp*kp,jp=Hn*Hn,Jp=jp/2,qp=sn(DB),qt=sn(0);Q.ZERO=qt;var fe=sn(0,!0);Q.UZERO=fe;var Vn=sn(1);Q.ONE=Vn;var Xp=sn(1,!0);Q.UONE=Xp;var Gc=sn(-1);Q.NEG_ONE=Gc;var Wp=H(-1,2147483647,!1);Q.MAX_VALUE=Wp;var Yp=H(-1,-1,!0);Q.MAX_UNSIGNED_VALUE=Yp;var Bt=H(0,-2147483648,!1);Q.MIN_VALUE=Bt;var I=Q.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low};I.toNumber=function(){return this.unsigned?(this.high>>>0)*Hn+(this.low>>>0):this.high*Hn+(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(Bt)){var n=Nt(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=Nt(Ni(t,6),this.unsigned),o=this,a="";;){var c=o.div(i),l=o.sub(c.mul(i)).toInt()>>>0,u=l.toString(t);if(o=c,o.isZero())return u+a;for(;u.length<6;)u="0"+u;a=""+u+a}};I.getHighBits=function(){return this.high};I.getHighBitsUnsigned=function(){return this.high>>>0};I.getLowBits=function(){return this.low};I.getLowBitsUnsigned=function(){return this.low>>>0};I.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Bt)?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 pt(t)||(t=jt(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};I.eq=I.equals;I.notEquals=function(t){return!this.eq(t)};I.neq=I.notEquals;I.ne=I.notEquals;I.lessThan=function(t){return this.comp(t)<0};I.lt=I.lessThan;I.lessThanOrEqual=function(t){return this.comp(t)<=0};I.lte=I.lessThanOrEqual;I.le=I.lessThanOrEqual;I.greaterThan=function(t){return this.comp(t)>0};I.gt=I.greaterThan;I.greaterThanOrEqual=function(t){return this.comp(t)>=0};I.gte=I.greaterThanOrEqual;I.ge=I.greaterThanOrEqual;I.compare=function(t){if(pt(t)||(t=jt(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(Bt)?Bt:this.not().add(Vn)};I.neg=I.negate;I.add=function(t){pt(t)||(t=jt(t));var n=this.high>>>16,r=this.high&65535,s=this.low>>>16,i=this.low&65535,o=t.high>>>16,a=t.high&65535,c=t.low>>>16,l=t.low&65535,u=0,h=0,f=0,d=0;return d+=i+l,f+=d>>>16,d&=65535,f+=s+c,h+=f>>>16,f&=65535,h+=r+a,u+=h>>>16,h&=65535,u+=n+o,u&=65535,H(f<<16|d,u<<16|h,this.unsigned)};I.subtract=function(t){return pt(t)||(t=jt(t)),this.add(t.neg())};I.sub=I.subtract;I.multiply=function(t){if(this.isZero())return this;if(pt(t)||(t=jt(t)),Ot){var n=Ot.mul(this.low,this.high,t.low,t.high);return H(n,Ot.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?fe:qt;if(this.eq(Bt))return t.isOdd()?Bt:qt;if(t.eq(Bt))return this.isOdd()?Bt:qt;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(qp)&&t.lt(qp))return Nt(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16,s=this.high&65535,i=this.low>>>16,o=this.low&65535,a=t.high>>>16,c=t.high&65535,l=t.low>>>16,u=t.low&65535,h=0,f=0,d=0,p=0;return p+=o*u,d+=p>>>16,p&=65535,d+=i*u,f+=d>>>16,d&=65535,d+=o*l,f+=d>>>16,d&=65535,f+=s*u,h+=f>>>16,f&=65535,f+=i*l,h+=f>>>16,f&=65535,f+=o*c,h+=f>>>16,f&=65535,h+=r*u+s*l+i*c+o*a,h&=65535,H(d<<16|p,h<<16|f,this.unsigned)};I.mul=I.multiply;I.divide=function(t){if(pt(t)||(t=jt(t)),t.isZero())throw Error("division by zero");if(Ot){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var n=(this.unsigned?Ot.div_u:Ot.div_s)(this.low,this.high,t.low,t.high);return H(n,Ot.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?fe:qt;var r,s,i;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return fe;if(t.gt(this.shru(1)))return Xp;i=fe}else{if(this.eq(Bt)){if(t.eq(Vn)||t.eq(Gc))return Bt;if(t.eq(Bt))return Vn;var o=this.shr(1);return r=o.div(t).shl(1),r.eq(qt)?t.isNegative()?Vn:Gc:(s=this.sub(t.mul(r)),i=r.add(s.div(t)),i)}else if(t.eq(Bt))return this.unsigned?fe:qt;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=qt}for(s=this;s.gte(t);){r=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),c=a<=48?1:Ni(2,a-48),l=Nt(r),u=l.mul(t);u.isNegative()||u.gt(s);)r-=c,l=Nt(r,this.unsigned),u=l.mul(t);l.isZero()&&(l=Vn),i=i.add(l),s=s.sub(u)}return i};I.div=I.divide;I.modulo=function(t){if(pt(t)||(t=jt(t)),Ot){var n=(this.unsigned?Ot.rem_u:Ot.rem_s)(this.low,this.high,t.low,t.high);return H(n,Ot.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};I.mod=I.modulo;I.rem=I.modulo;I.not=function(){return H(~this.low,~this.high,this.unsigned)};I.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};I.clz=I.countLeadingZeros;I.countTrailingZeros=function(){return this.low?Vp(this.low):Vp(this.high)+32};I.ctz=I.countTrailingZeros;I.and=function(t){return pt(t)||(t=jt(t)),H(this.low&t.low,this.high&t.high,this.unsigned)};I.or=function(t){return pt(t)||(t=jt(t)),H(this.low|t.low,this.high|t.high,this.unsigned)};I.xor=function(t){return pt(t)||(t=jt(t)),H(this.low^t.low,this.high^t.high,this.unsigned)};I.shiftLeft=function(t){return pt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?H(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):H(0,this.low<<t-32,this.unsigned)};I.shl=I.shiftLeft;I.shiftRight=function(t){return pt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?H(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):H(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};I.shr=I.shiftRight;I.shiftRightUnsigned=function(t){return pt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?H(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?H(this.high,0,this.unsigned):H(this.high>>>t-32,0,this.unsigned)};I.shru=I.shiftRightUnsigned;I.shr_u=I.shiftRightUnsigned;I.rotateLeft=function(t){var n;return pt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?H(this.high,this.low,this.unsigned):t<32?(n=32-t,H(this.low<<t|this.high>>>n,this.high<<t|this.low>>>n,this.unsigned)):(t-=32,n=32-t,H(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 pt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?H(this.high,this.low,this.unsigned):t<32?(n=32-t,H(this.high<<n|this.low>>>t,this.low<<n|this.high>>>t,this.unsigned)):(t-=32,n=32-t,H(this.low<<n|this.high>>>t,this.high<<n|this.low>>>t,this.unsigned))};I.rotr=I.rotateRight;I.toSigned=function(){return this.unsigned?H(this.low,this.high,!1):this};I.toUnsigned=function(){return this.unsigned?this:H(this.low,this.high,!0)};I.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};I.toBytesLE=function(){var t=this.high,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]};Q.fromBytes=function(t,n,r){return r?Q.fromBytesLE(t,n):Q.fromBytesBE(t,n)};Q.fromBytesLE=function(t,n){return new Q(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};Q.fromBytesBE=function(t,n){return new Q(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)};var zn=Q;var UB=16;function Nr(e){e==="X"&&(e="");let t=e.padEnd(UB,"0");return zn.fromString(t,!0,16)}function Hc(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 zc(e,t){let n=GB(e).shiftRightUnsigned(2);return e.add(zn.fromNumber(2*t+1-4).multiply(n))}function GB(e){return e.and(e.not().add(1))}var VB=3,HB=30,zB=2*HB+1,Kp=180/Math.PI;function Zp(e){if(e.length===0)throw new Error(`Invalid Hilbert quad key ${e}`);let t=e.split("/"),n=parseInt(t[0],10),r=t[1],s=r.length,i=0,o=[0,0];for(let a=s-1;a>=0;a--){i=s-a;let c=r[a],l=0,u=0;c==="1"?u=1:c==="2"?(l=1,u=1):c==="3"&&(l=1);let h=Math.pow(2,i-1);kB(h,o,l,u),o[0]+=h*l,o[1]+=h*u}if(n%2===1){let a=o[0];o[0]=o[1],o[1]=a}return{face:n,ij:o,level:i}}function $p(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<VB+zB;)t="0"+t;let n=t.lastIndexOf("1"),r=t.substring(0,3),s=t.substring(3,n),i=s.length/2,o=zn.fromString(r,!0,2).toString(10),a="";if(i!==0)for(a=zn.fromString(s,!0,2).toString(4);a.length<i;)a="0"+a;return`${o}/${a}`}function kc(e,t,n){let r=1<<t;return[(e[0]+n[0])/r,(e[1]+n[1])/r]}function Qp(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Jc(e){return[Qp(e[0]),Qp(e[1])]}function qc(e,t){let[n,r]=t;switch(e){case 0:return[1,n,r];case 1:return[-n,1,r];case 2:return[-n,-r,1];case 3:return[-1,-r,-n];case 4:return[r,-1,-n];case 5:return[r,n,-1];default:throw new Error("Invalid face")}}function jc(e){let[t,n,r]=e,s=Math.atan2(r,Math.sqrt(t*t+n*n));return[Math.atan2(n,t)*Kp,s*Kp]}function kB(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 tm(e){let t=kc(e.ij,e.level,[.5,.5]),n=Jc(t),r=qc(e.face,n);return jc(r)}var JB=100;function Xc(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(JB*Math.pow(2,-r))),o=new Float64Array(4*i*2+2),a=0,c=0;for(let l=0;l<4;l++){let u=s[l].slice(0),h=s[l+1],f=(h[0]-u[0])/i,d=(h[1]-u[1])/i;for(let p=0;p<i;p++){u[0]+=f,u[1]+=d;let A=kc(n,r,u),g=Jc(A),y=qc(t,g),E=jc(y);Math.abs(E[1])>89.999&&(E[0]=c);let _=E[0]-c;E[0]+=_>180?-360:_<-180?360:0,o[a++]=E[0],o[a++]=E[1],c=E[0]}}return o[a++]=o[0],o[a++]=o[1],o}function kn(e){let t=qB(e);return Zp(t)}function qB(e){if(e.indexOf("/")>0)return e;let t=Nr(e);return $p(t)}function Wc(e){let t=kn(e);return tm(t)}function nm(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=kn(i),a=Xc(o);(typeof n>"u"||n===null)&&(n=new Float64Array(4*a.length)),n.set(a,r),r+=a.length}t=em(n)}else{let n=Xc(e);t=em(n)}return t}function em(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 Yc(e,t){let n=t?.minimumHeight||0,r=t?.maximumHeight||0,s=kn(e),i=nm(s),o=i.west,a=i.south,c=i.east,l=i.north,u=[];return u.push(new x(o,l,n)),u.push(new x(c,l,n)),u.push(new x(c,a,n)),u.push(new x(o,a,n)),u.push(new x(o,l,r)),u.push(new x(c,l,r)),u.push(new x(c,a,r)),u.push(new x(o,a,r)),u}function Di(e){let t=e.token,n={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},r=Yc(t,n),s=Wc(t),i=s[0],o=s[1],a=U.WGS84.cartographicToCartesian([i,o,n.maximumHeight]),c=new x(a[0],a[1],a[2]);r.push(c);let l=mr(r);return[...l.center,...l.halfAxes]}var jB=4,XB=8,WB={QUADTREE:jB,OCTREE:XB};function YB(e,t,n){if(e!=null&&e.box){let r=Nr(e.s2VolumeInfo.token),s=zc(r,t),i=Hc(s),o={...e.s2VolumeInfo};switch(o.token=i,n){case"OCTREE":let l=e.s2VolumeInfo,u=l.maximumHeight-l.minimumHeight,h=u/2,f=l.minimumHeight+u/2;l.minimumHeight=f-h,l.maximumHeight=f+h;break;default:break}return{box:Di(o),s2VolumeInfo:o}}}async function Qc(e){let{implicitOptions:t,parentData:n={mortonIndex:0,x:0,y:0,z:0},childIndex:r=0,s2VolumeBox:s,loaderOptions:i}=e,{subtree:o,level:a=0,globalData:c={level:0,mortonIndex:0,x:0,y:0,z:0}}=e,{subdivisionScheme:l,subtreeLevels:u,maximumLevel:h,contentUrlTemplate:f,subtreesUriTemplate:d,basePath:p}=t,A={children:[],lodMetricValue:0,contentUrl:""};if(!h)return Uc.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${f} won't be loaded...`),A;let g=a+c.level;if(g>h)return A;let y=WB[l],E=Math.log2(y),_=r&1,B=r>>1&1,b=r>>2&1,S=(y**a-1)/(y-1),w=on(n.mortonIndex,r,E),C=S+w,T=on(n.x,_,1),m=on(n.y,B,1),M=on(n.z,b,1),F=!1;a>=u&&(F=Kc(o.childSubtreeAvailability,w));let R=on(c.x,T,a),v=on(c.y,m,a),D=on(c.z,M,a);if(F){let Y=`${p}/${d}`,tt=Ui(Y,g,R,v,D);o=await(0,rm.load)(tt,Fi,i),c={mortonIndex:w,x:T,y:m,z:M,level:a},w=0,C=0,T=0,m=0,M=0,a=0}if(!Kc(o.tileAvailability,C))return A;Kc(o.contentAvailability,C)&&(A.contentUrl=Ui(f,g,R,v,D));let Z=a+1,X={mortonIndex:w,x:T,y:m,z:M};for(let Y=0;Y<y;Y++){let tt=YB(s,Y,l),xt=await Qc({subtree:o,implicitOptions:t,loaderOptions:i,parentData:X,childIndex:Y,level:Z,globalData:{...c},s2VolumeBox:tt});if(xt.contentUrl||xt.children.length){let sg=g+1,ig=KB(xt,sg,{childTileX:T,childTileY:m,childTileZ:M},t,s);A.children.push(ig)}}return A}function Kc(e,t){let n;return Array.isArray(e)?(n=e[0],e.length>1&&Uc.once('Not supported extension "3DTILES_multiple_contents" has been detected')):n=e,"constant"in n?Boolean(n.constant):n.explicitBitstream?$B(t,n.explicitBitstream):!1}function KB(e,t,n,r,s){let{basePath:i,refine:o,getRefine:a,lodMetricType:c,getTileType:l,rootLodMetricValue:u,rootBoundingVolume:h}=r,f=e.contentUrl&&e.contentUrl.replace(`${i}/`,""),d=u/2**t,p=s!=null&&s.box?{box:s.box}:h,A=QB(t,p,n);return{children:e.children,contentUrl:e.contentUrl,content:{uri:f},id:e.contentUrl,refine:a(o),type:l(e),lodMetricType:c,lodMetricValue:d,geometricError:d,transform:e.transform,boundingVolume:A}}function QB(e,t,n){if(t.region){let{childTileX:r,childTileY:s,childTileZ:i}=n,[o,a,c,l,u,h]=t.region,f=2**e,d=(c-o)/f,p=(l-a)/f,A=(h-u)/f,[g,y]=[o+d*r,o+d*(r+1)],[E,_]=[a+p*s,a+p*(s+1)],[B,b]=[u+A*i,u+A*(i+1)];return{region:[g,E,y,_,B,b]}}if(t.box)return t;throw new Error(`Unsupported bounding volume type ${t}`)}function on(e,t,n){return(e<<n)+t}function Ui(e,t,n,r,s){let i=ZB({level:t,x:n,y:r,z:s});return e.replace(/{level}|{x}|{y}|{z}/gi,o=>i[o])}function ZB(e){let t={};for(let n in e)t[`{${n}}`]=e[n];return t}function $B(e,t){let n=Math.floor(e/8),r=e%8;return(t[n]>>r&1)===1}function $c(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(!t)return ne.EMPTY;let r=t.split("?")[0].split(".").pop();switch(r){case"pnts":return ne.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return ne.SCENEGRAPH;default:return r||ne.EMPTY}}function tl(e){switch(e){case"REPLACE":case"replace":return Tt.REPLACE;case"ADD":case"add":return Tt.ADD;default:return e}}function Zc(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 ye.resolve(t,e)}function sm(e,t){if(!e)return null;let n;if(e.content){var r;let i=e.content.uri||((r=e.content)===null||r===void 0?void 0:r.url);typeof i<"u"&&(n=Zc(i,t))}return{...e,id:n,contentUrl:n,lodMetricType:Xe.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:$c(e,n),refine:tl(e.refine)}}async function cm(e,t,n){let r=null,s=om(e.root);s&&e.root?r=await im(e.root,e,t,s,n):r=sm(e.root,t);let i=[];for(i.push(r);i.length>0;){let o=i.pop()||{},a=o.children||[],c=[];for(let l of a){let u=om(l),h;u?h=await im(l,e,t,u,n):h=sm(l,t),h&&(c.push(h),i.push(h))}o.children=c}return r}async function im(e,t,n,r,s){var i,o,a;let{subdivisionScheme:c,maximumLevel:l,availableLevels:u,subtreeLevels:h,subtrees:{uri:f}}=r,d=Ui(f,0,0,0,0),p=Zc(d,n),A=await(0,am.load)(p,Fi,s),g=(i=e.content)===null||i===void 0?void 0:i.uri,y=g?Zc(g,n):"",E=t==null||(o=t.root)===null||o===void 0?void 0:o.refine,_=e.geometricError,B=(a=e.boundingVolume.extensions)===null||a===void 0?void 0:a["3DTILES_bounding_volume_S2"];if(B){let C={box:Di(B),s2VolumeInfo:B};e.boundingVolume=C}let b=e.boundingVolume,S={contentUrlTemplate:y,subtreesUriTemplate:f,subdivisionScheme:c,subtreeLevels:h,maximumLevel:Number.isFinite(u)?u-1:l,refine:E,basePath:n,lodMetricType:Xe.GEOMETRIC_ERROR,rootLodMetricValue:_,rootBoundingVolume:b,getTileType:$c,getRefine:tl};return await tC(e,n,A,S,s)}async function tC(e,t,n,r,s){if(!e)return null;let{children:i,contentUrl:o}=await Qc({subtree:n,implicitOptions:r,loaderOptions:s}),a,c=null;return o&&(a=o,c={uri:o.replace(`${t}/`,"")}),{...e,id:a,contentUrl:a,lodMetricType:Xe.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:$c(e,a),refine:tl(e.refine),content:c||e.content,children:i}}function om(e){var t;return(e==null||(t=e.extensions)===null||t===void 0?void 0:t["3DTILES_implicit_tiling"])||e?.implicitTiling}var Gi={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:ui,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:eC,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function eC(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=t["3d-tiles"]||{},s;return r.isTileset==="auto"?s=n?.url&&n.url.indexOf(".json")!==-1:s=r.isTileset,s?nC(e,t,n):rC(e,t,n)}async function nC(e,t,n){var r;let s=JSON.parse(new TextDecoder().decode(e)),i=n?.url||"",o=sC(i),a=await cm(s,o,t||{});return{...s,shape:"tileset3d",loader:Gi,url:i,queryString:n?.queryString||"",basePath:o,root:a||s.root,type:ht.TILES3D,lodMetricType:Xe.GEOMETRIC_ERROR,lodMetricValue:((r=s.root)===null||r===void 0?void 0:r.geometricError)||0}}async function rC(e,t,n){let r={content:{shape:"tile3d",featureIds:null}};return await Oc(e,0,t,n,r.content),r.content}function sC(e){return ye.dirname(e)}var lm=[0],iC={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:Gi,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]}},Vi=class extends Re.CompositeLayer{initializeState(){"onTileLoadFail"in this.props&&Re.log.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}}get isLoaded(){return Boolean(this.state?.tileset3d?.isLoaded()&&super.isLoaded)}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({props:t,oldProps:n,changeFlags:r}){if(t.data&&t.data!==n.data&&this._loadTileset(t.data),r.viewportChanged){let{activeViewports:s}=this.state;Object.keys(s).length&&(this._updateTileset(s),this.state.lastUpdatedViewports=s,this.state.activeViewports={})}if(r.propsChanged){let{layerMap:s}=this.state;for(let i in s)s[i].needsUpdate=!0}}activateViewport(t){let{activeViewports:n,lastUpdatedViewports:r}=this.state;this.internalState.viewport=t,n[t.id]=t;let s=r?.[t.id];(!s||!t.equals(s))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:t,sourceLayer:n}){let r=n&&n.props.tile;return t.picked&&(t.object=r),t.sourceTile=r,t}filterSubLayer({layer:t,viewport:n}){let{tile:r}=t.props,{id:s}=n;return r.selected&&r.viewportIds.includes(s)}_updateAutoHighlight(t){let n=t.sourceTile,r=this.state.layerMap[n?.id];r&&r.layer&&r.layer.updateAutoHighlight(t)}async _loadTileset(t){let{loadOptions:n={}}=this.props,r=this.props.loader||this.props.loaders,s=Array.isArray(r)?r[0]:r,i={loadOptions:{...n}},o=t;if(s.preload){let l=await s.preload(t,n);l.url&&(o=l.url),l.headers&&(i.loadOptions.fetch={...i.loadOptions.fetch,headers:l.headers}),Object.assign(i,l)}let a=await(0,dm.load)(o,s,i.loadOptions),c=new Sr(a,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,...i});this.setState({tileset3d:c,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(c)}_onTileLoad(t){let{lastUpdatedViewports:n}=this.state;this.props.onTileLoad(t),this._updateTileset(n),this.setNeedsUpdate()}_onTileUnload(t){delete this.state.layerMap[t.id],this.props.onTileUnload(t)}_updateTileset(t){if(!t)return;let{tileset3d:n}=this.state,{timeline:r}=this.context,s=Object.keys(t).length;!r||!s||!n||n.selectTiles(Object.values(t)).then(i=>{this.state.frameNumber!==i&&this.setState({frameNumber:i})})}_getSubLayer(t,n){if(!t.content)return null;switch(t.type){case ne.POINTCLOUD:return this._makePointCloudLayer(t,n);case ne.SCENEGRAPH:return this._make3DModelLayer(t);case ne.MESH:return this._makeSimpleMeshLayer(t,n);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${t.content.type}`)}}_makePointCloudLayer(t,n){let{attributes:r,pointCount:s,constantRGBA:i,cartographicOrigin:o,modelMatrix:a}=t.content,{positions:c,normals:l,colors:u}=r;if(!c)return null;let h=n&&n.props.data||{header:{vertexCount:s},attributes:{POSITION:c,NORMAL:l,COLOR_0:u}},{pointSize:f,getPointColor:d}=this.props,p=this.getSubLayerClass("pointcloud",hm.PointCloudLayer);return new p({pointSize:f},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${t.id}`,tile:t,data:h,coordinateSystem:Re.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:o,modelMatrix:a,getColor:i||d,_offset:0})}_make3DModelLayer(t){let{gltf:n,instances:r,cartographicOrigin:s,modelMatrix:i}=t.content,o=this.getSubLayerClass("scenegraph",fm.ScenegraphLayer);return new o({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${t.id}`,tile:t,data:r||lm,scenegraph:n,coordinateSystem:Re.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:s,modelMatrix:i,getTransformMatrix:a=>a.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(t,n){let r=t.content,{attributes:s,indices:i,modelMatrix:o,cartographicOrigin:a,coordinateSystem:c=Re.COORDINATE_SYSTEM.METER_OFFSETS,material:l,featureIds:u}=r,{_getMeshColor:h}=this.props,f=n&&n.props.mesh||new um.Geometry({topology:"triangle-list",attributes:oC(s),indices:i}),d=this.getSubLayerClass("mesh",Br);return new d(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${t.id}`,tile:t,mesh:f,data:lm,getColor:h(t),pbrMaterial:l,modelMatrix:o,coordinateOrigin:a,coordinateSystem:c,featureIds:u,_offset:0})}renderLayers(){let{tileset3d:t,layerMap:n}=this.state;return t?t.tiles.map(r=>{let s=n[r.id]=n[r.id]||{tile:r},{layer:i}=s;return r.selected&&(i?s.needsUpdate&&(i=this._getSubLayer(r,i),s.needsUpdate=!1):i=this._getSubLayer(r)),s.layer=i,i}).filter(Boolean):null}},Dr=Vi;(()=>{Vi.defaultProps=iC})(),(()=>{Vi.layerName="Tile3DLayer"})();function oC(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 ji=N(Ut(),1),il=N(Ws(),1),Tm=N(Ut(),1);var aC=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 el(e){return e>>1^-(e&1)}function cC(e){let t=0,n={};for(let[r,s]of aC){let i=s===8?e.getFloat64:e.getFloat32;n[r]=i.call(e,t,!0),t+=s}return{header:n,headerEndPosition:t}}function lC(e,t){let n=t,r=3,s=e.getUint32(n,!0),i=new Uint16Array(s*r);n+=Uint32Array.BYTES_PER_ELEMENT;let o=Uint16Array.BYTES_PER_ELEMENT,a=s*o,c=n,l=c+a,u=l+a,h=0,f=0,d=0;for(let p=0;p<s;p++)h+=el(e.getUint16(c+o*p,!0)),f+=el(e.getUint16(l+o*p,!0)),d+=el(e.getUint16(u+o*p,!0)),i[p]=h,i[p+s]=f,i[p+s*2]=d;return n+=a*3,{vertexData:i,vertexDataEndPosition:n}}function Ur(e,t,n,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i;if(r===2?i=new Uint16Array(e,t,n):i=new Uint32Array(e,t,n),!s)return i;let o=0;for(let a=0;a<i.length;++a){let c=i[a];i[a]=o-c,c===0&&++o}return i}function uC(e,t,n){let r=n,s=3,o=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;r%o!==0&&(r+=o-r%o);let a=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let c=a*3,l=Ur(e.buffer,r,c,o);return r+=c*o,{triangleIndicesEndPosition:r,triangleIndices:l}}function hC(e,t,n){let r=n,s=3,o=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,a=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let c=Ur(e.buffer,r,a,o,!1);r+=a*o;let l=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let u=Ur(e.buffer,r,l,o,!1);r+=l*o;let h=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let f=Ur(e.buffer,r,h,o,!1);r+=h*o;let d=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let p=Ur(e.buffer,r,d,o,!1);return r+=d*o,{edgeIndicesEndPosition:r,westIndices:c,southIndices:u,eastIndices:f,northIndices:p}}function fC(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function dC(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function pC(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=fC(o);break}case 2:{n.waterMask=dC(o);break}default:}r+=i}return{extensions:n,extensionsEndPosition:r}}var an={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},mC={maxDecodingStep:an.extensions};function nl(e,t){let n=Object.assign({},mC,t),r=new DataView(e),{header:s,headerEndPosition:i}=cC(r);if(n.maxDecodingStep<an.vertices)return{header:s};let{vertexData:o,vertexDataEndPosition:a}=lC(r,i);if(n.maxDecodingStep<an.triangleIndices)return{header:s,vertexData:o};let{triangleIndices:c,triangleIndicesEndPosition:l}=uC(r,o,a);if(n.maxDecodingStep<an.edgeIndices)return{header:s,vertexData:o,triangleIndices:c};let{westIndices:u,southIndices:h,eastIndices:f,northIndices:d,edgeIndicesEndPosition:p}=hC(r,o,l);if(n.maxDecodingStep<an.extensions)return{header:s,vertexData:o,triangleIndices:c,westIndices:u,northIndices:d,eastIndices:f,southIndices:h};let{extensions:A}=pC(r,p);return{header:s,vertexData:o,triangleIndices:c,westIndices:u,northIndices:d,eastIndices:f,southIndices:h,extensions:A}}function Hi(e,t,n,r){let s=r?AC(r,e.POSITION.value):gC(t),i=new e.POSITION.value.constructor(s.length*6),o=new e.TEXCOORD_0.value.constructor(s.length*4),a=new t.constructor(s.length*6);for(let l=0;l<s.length;l++){let u=s[l];xC({edge:u,edgeIndex:l,attributes:e,skirtHeight:n,newPosition:i,newTexcoord0:o,newTriangles:a})}e.POSITION.value=Kn(e.POSITION.value,i),e.TEXCOORD_0.value=Kn(e.TEXCOORD_0.value,o);let c=t instanceof Array?t.concat(a):Kn(t,a);return{attributes:e,triangles:c}}function gC(e){let t=[];for(let o=0;o<e.length;o+=3)t.push([e[o],e[o+1]]),t.push([e[o+1],e[o+2]]),t.push([e[o+2],e[o]]);t.sort((o,a)=>Math.min(...o)-Math.min(...a)||Math.max(...o)-Math.max(...a));let n=[],r=0;for(;r<t.length;){var s,i;t[r][0]===((s=t[r+1])===null||s===void 0?void 0:s[1])&&t[r][1]===((i=t[r+1])===null||i===void 0?void 0:i[0])?r+=2:(n.push(t[r]),r++)}return n}function AC(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 xC(e){let{edge:t,edgeIndex:n,attributes:r,skirtHeight:s,newPosition:i,newTexcoord0:o,newTriangles:a}=e,c=r.POSITION.value.length,l=n*2,u=n*2+1;i.set(r.POSITION.value.subarray(t[0]*3,t[0]*3+3),l*3),i[l*3+2]=i[l*3+2]-s,i.set(r.POSITION.value.subarray(t[1]*3,t[1]*3+3),u*3),i[u*3+2]=i[u*3+2]-s,o.set(r.TEXCOORD_0.value.subarray(t[0]*2,t[0]*2+2),l*2),o.set(r.TEXCOORD_0.value.subarray(t[1]*2,t[1]*2+2),u*2);let h=n*2*3;a[h]=t[0],a[h+1]=c/3+u,a[h+2]=t[1],a[h+3]=c/3+u,a[h+4]=t[0],a[h+5]=c/3+l}function rl(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{bounds:n}=t,{header:r,vertexData:s,triangleIndices:i,westIndices:o,northIndices:a,eastIndices:c,southIndices:l}=nl(e,an.triangleIndices),u=i,h=yC(s,r,n),f=Qe(h);if(t!=null&&t.skirtHeight){let{attributes:d,triangles:p}=Hi(h,u,t.skirtHeight,{westIndices:o,northIndices:a,eastIndices:c,southIndices:l});h=d,u=p}return{loaderData:{header:{}},header:{vertexCount:u.length,boundingBox:f},schema:void 0,topology:"triangle-list",mode:4,indices:{value:u,size:1},attributes:h}}function yC(e,t,n){let{minHeight:r,maxHeight:s}=t,[i,o,a,c]=n||[0,0,1,1],l=a-i,u=c-o,h=s-r,f=e.length/3,d=new Float32Array(f*3),p=new Float32Array(f*2);for(let A=0;A<f;A++){let g=e[A]/32767,y=e[A+f]/32767,E=e[A+f*2]/32767;d[3*A+0]=g*l+i,d[3*A+1]=y*u+o,d[3*A+2]=E*h+r,p[2*A+0]=g,p[2*A+1]=y}return{POSITION:{value:d,size:3},TEXCOORD_0:{value:p,size:2}}}var Gr=class{constructor(t=257){this.gridSize=t;let n=t-1;if(n&n-1)throw new Error(`Expected grid size to be 2^n+1, got ${t}.`);this.numTriangles=n*n*2-2,this.numParentTriangles=this.numTriangles-n*n,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let r=0;r<this.numTriangles;r++){let s=r+2,i=0,o=0,a=0,c=0,l=0,u=0;for(s&1?a=c=l=n:i=o=u=n;(s>>=1)>1;){let f=i+a>>1,d=o+c>>1;s&1?(a=i,c=o,i=l,o=u):(i=a,o=c,a=l,c=u),l=f,u=d}let h=r*4;this.coords[h+0]=i,this.coords[h+1]=o,this.coords[h+2]=a,this.coords[h+3]=c}}createTile(t){return new sl(t,this)}},sl=class{constructor(t,n){let r=n.gridSize;if(t.length!==r*r)throw new Error(`Expected terrain data of length ${r*r} (${r} x ${r}), got ${t.length}.`);this.terrain=t,this.martini=n,this.errors=new Float32Array(t.length),this.update()}update(){let{numTriangles:t,numParentTriangles:n,coords:r,gridSize:s}=this.martini,{terrain:i,errors:o}=this;for(let a=t-1;a>=0;a--){let c=a*4,l=r[c+0],u=r[c+1],h=r[c+2],f=r[c+3],d=l+h>>1,p=u+f>>1,A=d+p-u,g=p+l-d,y=(i[u*s+l]+i[f*s+h])/2,E=p*s+d,_=Math.abs(y-i[E]);if(o[E]=Math.max(o[E],_),a<n){let B=(u+g>>1)*s+(l+A>>1),b=(f+g>>1)*s+(h+A>>1);o[E]=Math.max(o[E],o[B],o[b])}}}getMesh(t=0){let{gridSize:n,indices:r}=this.martini,{errors:s}=this,i=0,o=0,a=n-1;r.fill(0);function c(d,p,A,g,y,E){let _=d+A>>1,B=p+g>>1;Math.abs(d-y)+Math.abs(p-E)>1&&s[B*n+_]>t?(c(y,E,d,p,_,B),c(A,g,y,E,_,B)):(r[p*n+d]=r[p*n+d]||++i,r[g*n+A]=r[g*n+A]||++i,r[E*n+y]=r[E*n+y]||++i,o++)}c(0,0,a,a,a,0),c(a,a,0,0,0,a);let l=new Uint16Array(i*2),u=new Uint32Array(o*3),h=0;function f(d,p,A,g,y,E){let _=d+A>>1,B=p+g>>1;if(Math.abs(d-y)+Math.abs(p-E)>1&&s[B*n+_]>t)f(y,E,d,p,_,B),f(A,g,y,E,_,B);else{let b=r[p*n+d]-1,S=r[g*n+A]-1,w=r[E*n+y]-1;l[2*b]=d,l[2*b+1]=p,l[2*S]=A,l[2*S+1]=g,l[2*w]=y,l[2*w+1]=E,u[h++]=b,u[h++]=S,u[h++]=w}}return f(0,0,a,a,a,0),f(a,a,0,0,0,a),{vertices:l,triangles:u}}};var Vr=class{constructor(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:n;this.data=t,this.width=n,this.height=r,this.coords=[],this.triangles=[],this._halfedges=[],this._candidates=[],this._queueIndices=[],this._queue=[],this._errors=[],this._rms=[],this._pending=[],this._pendingLen=0,this._rmsSum=0;let s=n-1,i=r-1,o=this._addPoint(0,0),a=this._addPoint(s,0),c=this._addPoint(0,i),l=this._addPoint(s,i),u=this._addTriangle(l,o,c,-1,-1,-1);this._addTriangle(o,l,a,u,-1,-1),this._flush()}run(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;for(;this.getMaxError()>t;)this.refine()}refine(){this._step(),this._flush()}getMaxError(){return this._errors[0]}getRMSD(){return this._rmsSum>0?Math.sqrt(this._rmsSum/(this.width*this.height)):0}heightAt(t,n){return this.data[this.width*n+t]}_flush(){let t=this.coords;for(let n=0;n<this._pendingLen;n++){let r=this._pending[n],s=2*this.triangles[r*3+0],i=2*this.triangles[r*3+1],o=2*this.triangles[r*3+2];this._findCandidate(t[s],t[s+1],t[i],t[i+1],t[o],t[o+1],r)}this._pendingLen=0}_findCandidate(t,n,r,s,i,o,a){let c=Math.min(t,r,i),l=Math.min(n,s,o),u=Math.max(t,r,i),h=Math.max(n,s,o),f=cn(r,s,i,o,c,l),d=cn(i,o,t,n,c,l),p=cn(t,n,r,s,c,l),A=s-n,g=t-r,y=o-s,E=r-i,_=n-o,B=i-t,b=cn(t,n,r,s,i,o),S=this.heightAt(t,n)/b,w=this.heightAt(r,s)/b,C=this.heightAt(i,o)/b,T=0,m=0,M=0,F=0;for(let R=l;R<=h;R++){let v=0;f<0&&y!==0&&(v=Math.max(v,Math.floor(-f/y))),d<0&&_!==0&&(v=Math.max(v,Math.floor(-d/_))),p<0&&A!==0&&(v=Math.max(v,Math.floor(-p/A)));let D=f+y*v,W=d+_*v,z=p+A*v,Z=!1;for(let X=c+v;X<=u;X++){if(D>=0&&W>=0&&z>=0){Z=!0;let Y=S*D+w*W+C*z,tt=Math.abs(Y-this.heightAt(X,R));F+=tt*tt,tt>T&&(T=tt,m=X,M=R)}else if(Z)break;D+=y,W+=_,z+=A}f+=E,d+=B,p+=g}(m===t&&M===n||m===r&&M===s||m===i&&M===o)&&(T=0),this._candidates[2*a]=m,this._candidates[2*a+1]=M,this._rms[a]=F,this._queuePush(a,T,F)}_step(){let t=this._queuePop(),n=t*3+0,r=t*3+1,s=t*3+2,i=this.triangles[n],o=this.triangles[r],a=this.triangles[s],c=this.coords[2*i],l=this.coords[2*i+1],u=this.coords[2*o],h=this.coords[2*o+1],f=this.coords[2*a],d=this.coords[2*a+1],p=this._candidates[2*t],A=this._candidates[2*t+1],g=this._addPoint(p,A);if(cn(c,l,u,h,p,A)===0)this._handleCollinear(g,n);else if(cn(u,h,f,d,p,A)===0)this._handleCollinear(g,r);else if(cn(f,d,c,l,p,A)===0)this._handleCollinear(g,s);else{let y=this._halfedges[n],E=this._halfedges[r],_=this._halfedges[s],B=this._addTriangle(i,o,g,y,-1,-1,n),b=this._addTriangle(o,a,g,E,-1,B+1),S=this._addTriangle(a,i,g,_,B+2,b+1);this._legalize(B),this._legalize(b),this._legalize(S)}}_addPoint(t,n){let r=this.coords.length>>1;return this.coords.push(t,n),r}_addTriangle(t,n,r,s,i,o){let a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this.triangles.length,c=a/3;return this.triangles[a+0]=t,this.triangles[a+1]=n,this.triangles[a+2]=r,this._halfedges[a+0]=s,this._halfedges[a+1]=i,this._halfedges[a+2]=o,s>=0&&(this._halfedges[s]=a+0),i>=0&&(this._halfedges[i]=a+1),o>=0&&(this._halfedges[o]=a+2),this._candidates[2*c+0]=0,this._candidates[2*c+1]=0,this._queueIndices[c]=-1,this._rms[c]=0,this._pending[this._pendingLen++]=c,a}_legalize(t){let n=this._halfedges[t];if(n<0)return;let r=t-t%3,s=n-n%3,i=r+(t+1)%3,o=r+(t+2)%3,a=s+(n+2)%3,c=s+(n+1)%3,l=this.triangles[o],u=this.triangles[t],h=this.triangles[i],f=this.triangles[a],d=this.coords;if(!TC(d[2*l],d[2*l+1],d[2*u],d[2*u+1],d[2*h],d[2*h+1],d[2*f],d[2*f+1]))return;let p=this._halfedges[i],A=this._halfedges[o],g=this._halfedges[a],y=this._halfedges[c];this._queueRemove(r/3),this._queueRemove(s/3);let E=this._addTriangle(l,f,h,-1,g,p,r),_=this._addTriangle(f,l,u,E,A,y,s);this._legalize(E+1),this._legalize(_+2)}_handleCollinear(t,n){let r=n-n%3,s=r+(n+1)%3,i=r+(n+2)%3,o=this.triangles[i],a=this.triangles[n],c=this.triangles[s],l=this._halfedges[s],u=this._halfedges[i],h=this._halfedges[n];if(h<0){let S=this._addTriangle(t,o,a,-1,u,-1,r),w=this._addTriangle(o,t,c,S,-1,l);this._legalize(S+1),this._legalize(w+2);return}let f=h-h%3,d=f+(h+2)%3,p=f+(h+1)%3,A=this.triangles[d],g=this._halfedges[d],y=this._halfedges[p];this._queueRemove(f/3);let E=this._addTriangle(o,a,t,u,-1,-1,r),_=this._addTriangle(a,A,t,y,-1,E+1,f),B=this._addTriangle(A,c,t,g,-1,_+1),b=this._addTriangle(c,o,t,l,E+2,B+1);this._legalize(E),this._legalize(_),this._legalize(B),this._legalize(b)}_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 cn(e,t,n,r,s,i){return(n-s)*(t-i)-(r-i)*(e-s)}function TC(e,t,n,r,s,i,o,a){let c=e-o,l=t-a,u=n-o,h=r-a,f=s-o,d=i-a,p=c*c+l*l,A=u*u+h*h,g=f*f+d*d;return c*(h*g-A*d)-l*(u*g-A*f)+p*(u*d-h*f)<0}function gm(e,t){let{meshMaxError:n,bounds:r,elevationDecoder:s}=t,{data:i,width:o,height:a}=e,c,l;switch(t.tesselator){case"martini":c=zi(i,o,a,s,t.tesselator),l=pm(n,o,c);break;case"delatin":c=zi(i,o,a,s,t.tesselator),l=mm(n,o,a,c);break;default:o===a&&!(a&o-1)?(c=zi(i,o,a,s,"martini"),l=pm(n,o,c)):(c=zi(i,o,a,s,"delatin"),l=mm(n,o,a,c));break}let{vertices:u}=l,{triangles:h}=l,f=_C(u,c,o,a,r),d=Qe(f);if(t.skirtHeight){let{attributes:p,triangles:A}=Hi(f,h,t.skirtHeight);f=p,h=A}return{loaderData:{header:{}},header:{vertexCount:h.length,boundingBox:d},mode:4,indices:{value:Uint32Array.from(h),size:1},attributes:f}}function pm(e,t,n){let r=t+1,i=new Gr(r).createTile(n),{vertices:o,triangles:a}=i.getMesh(e);return{vertices:o,triangles:a}}function mm(e,t,n,r){let s=new Vr(r,t+1,n+1);s.run(e);let{coords:i,triangles:o}=s;return{vertices:i,triangles:o}}function zi(e,t,n,r,s){let{rScaler:i,bScaler:o,gScaler:a,offset:c}=r,l=new Float32Array((t+1)*(n+1));for(let u=0,h=0;h<n;h++)for(let f=0;f<t;f++,u++){let d=u*4,p=e[d+0],A=e[d+1],g=e[d+2];l[u+h]=p*i+A*a+g*o+c}if(s==="martini"){for(let u=(t+1)*t,h=0;h<t;h++,u++)l[u]=l[u-t-1];for(let u=n,h=0;h<n+1;h++,u+=n+1)l[u]=l[u-1]}return l}function _C(e,t,n,r,s){let i=n+1,o=e.length/2,a=new Float32Array(o*3),c=new Float32Array(o*2),[l,u,h,f]=s||[0,0,n,r],d=(h-l)/n,p=(f-u)/r;for(let A=0;A<o;A++){let g=e[A*2],y=e[A*2+1],E=y*i+g;a[3*A+0]=g*d+l,a[3*A+1]=-y*p+f,a[3*A+2]=t[E],c[2*A+0]=g/n,c[2*A+1]=y/r}return{POSITION:{value:a,size:3},TEXCOORD_0:{value:c,size:2}}}var ki="4.1.0";var Ji={name:"Terrain",id:"terrain",module:"terrain",version:ki,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 Am={name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:ki,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var EC={...Ji,parse:BC};async function BC(e,t,n){let r={...t,mimeType:"application/x.image",image:{...t?.image,type:"data"}},s=await Ct(e,[],r,n),i={...EC.options.terrain,...t?.terrain};return gm(s,i)}var e4={...Am,parseSync:(e,t)=>rl(e,t?.["quantized-mesh"]),parse:async(e,t)=>rl(e,t?.["quantized-mesh"])};var xm=[1],CC={...ee.defaultProps,elevationData:Ie,texture:{...Ie,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:[Ji]};function ym(e){return Array.isArray(e)?e.join(";"):e||""}var qi=class extends ji.CompositeLayer{updateState({props:t,oldProps:n}){let r=t.elevationData!==n.elevationData;if(r){let{elevationData:i}=t,o=i&&(Array.isArray(i)||i.includes("{x}")&&i.includes("{y}"));this.setState({isTiled:o})}let s=r||t.meshMaxError!==n.meshMaxError||t.elevationDecoder!==n.elevationDecoder||t.bounds!==n.bounds;if(!this.state.isTiled&&s){let i=this.loadTerrain(t);this.setState({terrain:i})}t.workerUrl&&ji.log.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain({elevationData:t,bounds:n,elevationDecoder:r,meshMaxError:s,signal:i}){if(!t)return null;let o=this.getLoadOptions();o={...o,terrain:{skirtHeight:this.state.isTiled?s*2:0,...o?.terrain,bounds:n,meshMaxError:s,elevationDecoder:r}};let{fetch:a}=this.props;return a(t,{propName:"elevationData",layer:this,loadOptions:o,signal:i})}getTiledTerrainData(t){let{elevationData:n,fetch:r,texture:s,elevationDecoder:i,meshMaxError:o}=this.props,{viewport:a}=this.context,c=te(n,t),l=s&&te(s,t),{signal:u}=t,h=[0,0],f=[0,0];if(a.isGeospatial){let g=t.bbox;h=a.projectFlat([g.west,g.south]),f=a.projectFlat([g.east,g.north])}else{let g=t.bbox;h=[g.left,g.bottom],f=[g.right,g.top]}let d=[h[0],h[1],f[0],f[1]],p=this.loadTerrain({elevationData:c,bounds:d,elevationDecoder:i,meshMaxError:o,signal:u}),A=l?r(l,{propName:"texture",layer:this,loaders:[],signal:u}).catch(g=>null):Promise.resolve(null);return Promise.all([p,A])}renderSubLayers(t){let n=this.getSubLayerClass("mesh",il.SimpleMeshLayer),{color:r,wireframe:s,material:i}=this.props,{data:o}=t;if(!o)return null;let[a,c]=o;return new n(t,{data:xm,mesh:a,texture:c,_instanced:!1,coordinateSystem:Tm.COORDINATE_SYSTEM.CARTESIAN,getPosition:l=>[0,0,0],getColor:r,wireframe:s,material:i})}onViewportLoad(t){if(!t)return;let{zRange:n}=this.state,r=t.map(o=>o.content).filter(Boolean).map(o=>o[0].header.boundingBox.map(c=>c[2]));if(r.length===0)return;let s=Math.min(...r.map(o=>o[0])),i=Math.max(...r.map(o=>o[1]));(!n||s<n[0]||i>n[1])&&this.setState({zRange:[s,i]})}renderLayers(){let{color:t,material:n,elevationData:r,texture:s,wireframe:i,meshMaxError:o,elevationDecoder:a,tileSize:c,maxZoom:l,minZoom:u,extent:h,maxRequests:f,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:g,maxCacheByteSize:y,refinementStrategy:E}=this.props;if(this.state.isTiled)return new ee(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:ym(r),texture:ym(s),meshMaxError:o,elevationDecoder:a}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:c,maxZoom:l,minZoom:u,extent:h,maxRequests:f,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:g,maxCacheByteSize:y,refinementStrategy:E});if(!r)return null;let _=this.getSubLayerClass("mesh",il.SimpleMeshLayer);return new _(this.getSubLayerProps({id:"mesh"}),{data:xm,mesh:this.state.terrain,texture:s,_instanced:!1,getPosition:B=>[0,0,0],getColor:t,material:n,wireframe:i})}},Hr=qi;(()=>{qi.defaultProps=CC})(),(()=>{qi.layerName="TerrainLayer"})();var io=N(Ut(),1),Bl=N(Dt(),1),tg=N(Em(),1);var zr={x:0,y:1,z:2};function ln(e,t={}){let{start:n=0,end:r=e.length,plane:s="xy"}=t,i=t.size||2,o=0,a=zr[s[0]],c=zr[s[1]];for(let l=n,u=r-i;l<r;l+=i)o+=(e[l+a]-e[u+a])*(e[l+c]+e[u+c]),u=l;return o/2}function al(e,t,n=2,r,s="xy"){let i=t&&t.length,o=i?t[0]*n:e.length,a=Cm(e,0,o,n,!0,r&&r[0],s),c=[];if(!a||a.next===a.prev)return c;let l,u,h,f,d,p,A;if(i&&(a=FC(e,t,a,n,r,s)),e.length>80*n){f=u=e[0],d=h=e[1];for(let g=n;g<o;g+=n)p=e[g],A=e[g+1],p<f&&(f=p),A<d&&(d=A),p>u&&(u=p),A>h&&(h=A);l=Math.max(u-f,h-d),l=l!==0?32767/l:0}return kr(a,c,n,f,d,l,0),c}function Cm(e,t,n,r,s,i,o){let a,c;i===void 0&&(i=ln(e,{start:t,end:n,size:r,plane:o}));let l=zr[o[0]],u=zr[o[1]];if(s===i<0)for(a=t;a<n;a+=r)c=Bm(a,e[a+l],e[a+u],c);else for(a=n-r;a>=t;a-=r)c=Bm(a,e[a+l],e[a+u],c);return c&&Yi(c,c.next)&&(qr(c),c=c.next),c}function un(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(Yi(n,n.next)||nt(n.prev,n,n.next)===0)){if(qr(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function kr(e,t,n,r,s,i,o){if(!e)return;!o&&i&&NC(e,r,s,i);let a=e,c,l;for(;e.prev!==e.next;){if(c=e.prev,l=e.next,i?IC(e,r,s,i):MC(e)){t.push(c.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),qr(e),e=l.next,a=l.next;continue}if(e=l,e===a){o?o===1?(e=wC(un(e),t,n),kr(e,t,n,r,s,i,2)):o===2&&vC(e,t,n,r,s,i):kr(un(e),t,n,r,s,i,1);break}}}function MC(e){let t=e.prev,n=e,r=e.next;if(nt(t,n,r)>=0)return!1;let s=t.x,i=n.x,o=r.x,a=t.y,c=n.y,l=r.y,u=s<i?s<o?s:o:i<o?i:o,h=a<c?a<l?a:l:c<l?c:l,f=s>i?s>o?s:o:i>o?i:o,d=a>c?a>l?a:l:c>l?c:l,p=r.next;for(;p!==t;){if(p.x>=u&&p.x<=f&&p.y>=h&&p.y<=d&&Jn(s,a,i,c,o,l,p.x,p.y)&&nt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function IC(e,t,n,r){let s=e.prev,i=e,o=e.next;if(nt(s,i,o)>=0)return!1;let a=s.x,c=i.x,l=o.x,u=s.y,h=i.y,f=o.y,d=a<c?a<l?a:l:c<l?c:l,p=u<h?u<f?u:f:h<f?h:f,A=a>c?a>l?a:l:c>l?c:l,g=u>h?u>f?u:f:h>f?h:f,y=ol(d,p,t,n,r),E=ol(A,g,t,n,r),_=e.prevZ,B=e.nextZ;for(;_&&_.z>=y&&B&&B.z<=E;){if(_.x>=d&&_.x<=A&&_.y>=p&&_.y<=g&&_!==s&&_!==o&&Jn(a,u,c,h,l,f,_.x,_.y)&&nt(_.prev,_,_.next)>=0||(_=_.prevZ,B.x>=d&&B.x<=A&&B.y>=p&&B.y<=g&&B!==s&&B!==o&&Jn(a,u,c,h,l,f,B.x,B.y)&&nt(B.prev,B,B.next)>=0))return!1;B=B.nextZ}for(;_&&_.z>=y;){if(_.x>=d&&_.x<=A&&_.y>=p&&_.y<=g&&_!==s&&_!==o&&Jn(a,u,c,h,l,f,_.x,_.y)&&nt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;B&&B.z<=E;){if(B.x>=d&&B.x<=A&&B.y>=p&&B.y<=g&&B!==s&&B!==o&&Jn(a,u,c,h,l,f,B.x,B.y)&&nt(B.prev,B,B.next)>=0)return!1;B=B.nextZ}return!0}function wC(e,t,n){let r=e;do{let s=r.prev,i=r.next.next;!Yi(s,i)&&bm(s,r,r.next,i)&&Jr(s,i)&&Jr(i,s)&&(t.push(s.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),qr(r),qr(r.next),r=e=i),r=r.next}while(r!==e);return un(r)}function vC(e,t,n,r,s,i){let o=e;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&GC(o,a)){let c=Sm(o,a);o=un(o,o.next),c=un(c,c.next),kr(o,t,n,r,s,i,0),kr(c,t,n,r,s,i,0);return}a=a.next}o=o.next}while(o!==e)}function FC(e,t,n,r,s,i){let o=[],a,c,l,u,h;for(a=0,c=t.length;a<c;a++)l=t[a]*r,u=a<c-1?t[a+1]*r:e.length,h=Cm(e,l,u,r,!1,s&&s[a+1],i),h===h.next&&(h.steiner=!0),o.push(UC(h));for(o.sort(RC),a=0;a<o.length;a++)n=LC(o[a],n);return n}function RC(e,t){return e.x-t.x}function LC(e,t){let n=PC(e,t);if(!n)return t;let r=Sm(n,e);return un(r,r.next),un(n,n.next)}function PC(e,t){let n=t,r=e.x,s=e.y,i=-1/0,o;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){let f=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(f<=r&&f>i&&(i=f,o=n.x<n.next.x?n:n.next,f===r))return o}n=n.next}while(n!==t);if(!o)return null;let a=o,c=o.x,l=o.y,u=1/0,h;n=o;do r>=n.x&&n.x>=c&&r!==n.x&&Jn(s<l?r:i,s,c,l,s<l?i:r,s,n.x,n.y)&&(h=Math.abs(s-n.y)/(r-n.x),Jr(n,e)&&(h<u||h===u&&(n.x>o.x||n.x===o.x&&OC(o,n)))&&(o=n,u=h)),n=n.next;while(n!==a);return o}function OC(e,t){return nt(e.prev,e,t.prev)<0&&nt(t.next,e,e.next)<0}function NC(e,t,n,r){let s=e;do s.z===0&&(s.z=ol(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,DC(s)}function DC(e){let t,n,r=1,s,i,o,a,c,l;do{for(i=e,e=null,l=null,s=0;i;){for(s++,a=i,o=0,n=0;n<r&&(o++,a=a.nextZ,!!a);n++);for(c=r;o>0||c>0&&a;)o!==0&&(c===0||!a||i.z<=a.z)?(t=i,i=i.nextZ,o--):(t=a,a=a.nextZ,c--),l?l.nextZ=t:e=t,t.prevZ=l,l=t;i=a}l.nextZ=null,r*=2}while(s>1);return e}function ol(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 UC(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 Jn(e,t,n,r,s,i,o,a){return(s-o)*(t-a)>=(e-o)*(i-a)&&(e-o)*(r-a)>=(n-o)*(t-a)&&(n-o)*(i-a)>=(s-o)*(r-a)}function GC(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!VC(e,t)&&(Jr(e,t)&&Jr(t,e)&&HC(e,t)&&(nt(e.prev,e,t.prev)||nt(e,t.prev,t))||Yi(e,t)&&nt(e.prev,e,e.next)>0&&nt(t.prev,t,t.next)>0)}function nt(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Yi(e,t){return e.x===t.x&&e.y===t.y}function bm(e,t,n,r){let s=Wi(nt(e,t,n)),i=Wi(nt(e,t,r)),o=Wi(nt(n,r,e)),a=Wi(nt(n,r,t));return!!(s!==i&&o!==a||s===0&&Xi(e,n,t)||i===0&&Xi(e,r,t)||o===0&&Xi(n,e,r)||a===0&&Xi(n,t,r))}function Xi(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 Wi(e){return e>0?1:e<0?-1:0}function VC(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&bm(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Jr(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 HC(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 Sm(e,t){let n=new jr(e.i,e.x,e.y),r=new jr(t.i,t.x,t.y),s=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=s,s.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function Bm(e,t,n,r){let s=new jr(e,t,n);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function qr(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}var jr=class{constructor(t,n,r){L(this,"i",void 0),L(this,"x",void 0),L(this,"y",void 0),L(this,"prev",null),L(this,"next",null),L(this,"z",0),L(this,"prevZ",null),L(this,"nextZ",null),L(this,"steiner",!1),this.i=t,this.x=n,this.y=r}};function ul(e,t,n){let r=jC(e),s=Object.keys(r).filter(i=>r[i]!==Array);return XC(e,{propArrayTypes:r,...t},{numericPropKeys:n&&n.numericPropKeys||s,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function jC(e){let t={};for(let n of e)if(n.properties)for(let r in n.properties){let s=n.properties[r];t[r]=$C(s,t[r])}return t}function XC(e,t,n){let{pointPositionsCount:r,pointFeaturesCount:s,linePositionsCount:i,linePathsCount:o,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:u,polygonFeaturesCount:h,propArrayTypes:f,coordLength:d}=t,{numericPropKeys:p=[],PositionDataType:A=Float32Array,triangulate:g=!0}=n,y=e[0]&&"id"in e[0],E=e.length>65535?Uint32Array:Uint16Array,_={type:"Point",positions:new A(r*d),globalFeatureIds:new E(r),featureIds:s>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},B={type:"LineString",pathIndices:i>65535?new Uint32Array(o+1):new Uint16Array(o+1),positions:new A(i*d),globalFeatureIds:new E(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},b={type:"Polygon",polygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),primitivePolygonIndices:c>65535?new Uint32Array(u+1):new Uint16Array(u+1),positions:new A(c*d),globalFeatureIds:new E(c),featureIds:h>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};g&&(b.triangles=[]);for(let w of[_,B,b])for(let C of p){let T=f[C];w.numericProps[C]=new T(w.positions.length/d)}B.pathIndices[o]=i,b.polygonIndices[l]=c,b.primitivePolygonIndices[u]=c;let S={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let w of e){let C=w.geometry,T=w.properties||{};switch(C.type){case"Point":WC(C,_,S,d,T),_.properties.push(ll(T,p)),y&&_.fields.push({id:w.id}),S.pointFeature++;break;case"LineString":YC(C,B,S,d,T),B.properties.push(ll(T,p)),y&&B.fields.push({id:w.id}),S.lineFeature++;break;case"Polygon":KC(C,b,S,d,T),b.properties.push(ll(T,p)),y&&b.fields.push({id:w.id}),S.polygonFeature++;break;default:throw new Error("Invalid geometry type")}S.feature++}return ZC(_,B,b,d)}function WC(e,t,n,r,s){t.positions.set(e.data,n.pointPosition*r);let i=e.data.length/r;hl(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 YC(e,t,n,r,s){t.positions.set(e.data,n.linePosition*r);let i=e.data.length/r;hl(t,s,n.linePosition,i),t.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+i),t.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+i);for(let o=0,a=e.indices.length;o<a;++o){let c=e.indices[o],l=o===a-1?e.data.length:e.indices[o+1];t.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(l-c)/r}}function KC(e,t,n,r,s){t.positions.set(e.data,n.polygonPosition*r);let i=e.data.length/r;hl(t,s,n.polygonPosition,i),t.globalFeatureIds.fill(n.feature,n.polygonPosition,n.polygonPosition+i),t.featureIds.fill(n.polygonFeature,n.polygonPosition,n.polygonPosition+i);for(let o=0,a=e.indices.length;o<a;++o){let c=n.polygonPosition;t.polygonIndices[n.polygonObject++]=c;let l=e.areas[o],u=e.indices[o],h=e.indices[o+1];for(let d=0,p=u.length;d<p;++d){let A=u[d],g=d===p-1?h===void 0?e.data.length:h[0]:u[d+1];t.primitivePolygonIndices[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(g-A)/r}let f=n.polygonPosition;QC(t,l,u,{startPosition:c,endPosition:f,coordLength:r})}}function QC(e,t,n,r){let{startPosition:s,endPosition:i,coordLength:o}=r;if(!e.triangles)return;let a=s*o,c=i*o,l=e.positions.subarray(a,c),u=n[0],h=n.slice(1).map(d=>(d-u)/o),f=al(l,h,o,t);for(let d=0,p=f.length;d<p;++d)e.triangles.push(s+f[d])}function cl(e,t){let n={};for(let r in e)n[r]={value:e[r],size:t};return n}function ZC(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:cl(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:cl(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:cl(n.numericProps,1)}};return s.polygons&&n.triangles&&(s.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),s}function hl(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 ll(e,t){let n={};for(let r in e)t.includes(r)||(n[r]=e[r]);return n}function $C(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function Zi(e,t){let n=t?.globalFeatureId;return n!==void 0?tb(e,n):eb(e,t?.type)}function tb(e,t){let n=vm(e);for(let r of n){let s=0,i=r.featureIds.value[0];for(let o=0;o<r.featureIds.value.length;o++){let a=r.featureIds.value[o];if(a!==i){if(t===r.globalFeatureIds.value[s])return Ki(r,s,o);s=o,i=a}}if(t===r.globalFeatureIds.value[s])return Ki(r,s,r.featureIds.value.length)}throw new Error(`featureId:${t} not found`)}function eb(e,t){let n=vm(e,t);return nb(n)}function wm(e,t,n){switch(e.type){case"Point":return ob(e,t,n);case"LineString":return ib(e,t,n);case"Polygon":return Fm(e,t,n);default:let r=e;throw new Error(`Unsupported geometry type: ${r?.type}`)}}function vm(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 nb(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(Ki(n,r,i)),r=i,s=o)}t.push(Ki(n,r,n.featureIds.value.length))}return t}function Ki(e,t,n){let r=wm(e,t,n),s=sb(e,t,n),i=rb(e,t,n);return{type:"Feature",geometry:r,properties:s,...i}}function rb(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0;return e.fields&&e.fields[e.featureIds.value[t]]}function sb(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=Object.assign({},e.properties[e.featureIds.value[t]]);for(let s in e.numericProps)r[s]=e.numericProps[s].value[t];return r}function Fm(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1/0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1/0,{positions:r}=e,s=e.polygonIndices.value.filter(c=>c>=t&&c<=n),i=e.primitivePolygonIndices.value.filter(c=>c>=t&&c<=n);if(!(s.length>2)){let c=[];for(let l=0;l<i.length-1;l++){let u=i[l],h=i[l+1],f=Qi(r,u,h);c.push(f)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<s.length-1;c++){let l=s[c],u=s[c+1],h=Fm(e,l,u).coordinates;a.push(h)}return{type:"MultiPolygon",coordinates:a}}function ib(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1/0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1/0,{positions:r}=e,s=e.pathIndices.value.filter(a=>a>=t&&a<=n);if(!(s.length>2))return{type:"LineString",coordinates:Qi(r,s[0],s[1])};let o=[];for(let a=0;a<s.length-1;a++){let c=Qi(r,s[a],s[a+1]);o.push(c)}return{type:"MultiLineString",coordinates:o}}function ob(e,t,n){let{positions:r}=e,s=Qi(r,t,n);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function Qi(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 xl=N(Um(),1);function Gm(e){let t=e.length;if(t<=1)return[e];let n=[],r,s;for(let i=0;i<t;i++){let o=Cb(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 Cb(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 Vm(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?bb(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function bb(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 hn=class{static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(t,n,r,s,i){this.properties=void 0,this.extent=void 0,this.type=void 0,this.id=void 0,this._pbf=void 0,this._geometry=void 0,this._keys=void 0,this._values=void 0,this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=i,t.readFields(Vm,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,s=0,i=0,o=0,a=[],c;for(;t.pos<n;){if(s<=0){let l=t.readVarint();r=l&7,s=l>>3}if(s--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),r===1&&(c&&a.push(c),c=[]),c&&c.push([i,o]);else if(r===7)c&&c.push(c[0].slice());else throw new Error(`unknown command ${r}`)}return c&&a.push(c),a}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,s=0,i=0,o=0,a=1/0,c=-1/0,l=1/0,u=-1/0;for(;t.pos<n;){if(s<=0){let h=t.readVarint();r=h&7,s=h>>3}if(s--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),i<a&&(a=i),i>c&&(c=i),o<l&&(l=o),o>u&&(u=o);else if(r!==7)throw new Error(`unknown command ${r}`)}return[a,l,c,u]}_toGeoJSON(t){let n=this.loadGeometry(),r=hn.types[this.type],s,i;switch(this.type){case 1:let a=[];for(s=0;s<n.length;s++)a[s]=n[s][0];n=a,t(n,this);break;case 2:for(s=0;s<n.length;s++)t(n[s],this);break;case 3:for(n=Gm(n),s=0;s<n.length;s++)for(i=0;i<n[s].length;i++)t(n[s][i],this);break}n.length===1?n=n[0]:r=`Multi${r}`;let o={type:"Feature",geometry:{type:r,coordinates:n},properties:this.properties};return this.id!==null&&(o.id=this.id),o}toGeoJSON(t){if(typeof t=="function")return this._toGeoJSON(t);let{x:n,y:r,z:s}=t,i=this.extent*Math.pow(2,s),o=this.extent*n,a=this.extent*r;function c(l){for(let u=0;u<l.length;u++){let h=l[u];h[0]=(h[0]+o)*360/i-180;let f=180-(h[1]+a)*360/i;h[1]=360/Math.PI*Math.atan(Math.exp(f*Math.PI/180))-90}}return this._toGeoJSON(c)}};var Xr=class{constructor(t,n){this.version=void 0,this.name=void 0,this.extent=void 0,this.length=void 0,this._pbf=void 0,this._keys=void 0,this._values=void 0,this._features=void 0,this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Sb,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 hn(this._pbf,n,this.extent,this._keys,this._values)}};function Sb(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(Mb(n)))}function Mb(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 Wr=class{constructor(t,n){this.layers=void 0,this.layers=t.readFields(Ib,{},n)}};function Ib(e,t,n){if(e===3&&n){let r=new Xr(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function Hm(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[ln(e.data)]],indices:[e.indices]};let r=[],s=[],i=[],o=[],a,c=0;for(let l,u=0,h;u<t;u++){h=e.indices[u]-c,l=e.indices[u+1]-c||e.data.length;let f=e.data.slice(h,l),d=ln(f);if(d===0){let p=e.data.slice(0,h),A=e.data.slice(l);e.data=p.concat(A),c+=l-h;continue}a===void 0&&(a=d<0),a===d<0?(o.length&&(r.push(i),s.push(o)),o=[h],i=[d]):(i.push(d),o.push(h))}return i&&r.push(i),o.length&&s.push(o),{type:n,areas:r,indices:s,data:e.data}}function zm(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 km(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?wb(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function wb(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 Jm,fn,pl,eo,ml,gl,Yr;var Kr=class{constructor(t,n,r,s,i,o){this.properties=void 0,this.extent=void 0,this.type=void 0,this.id=void 0,this._pbf=void 0,this._geometry=void 0,this._keys=void 0,this._values=void 0,this._geometryInfo=void 0,this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=i,this._geometryInfo=o,t.readFields(km,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry,Jm=t.readVarint()+t.pos,fn=1,eo=0,ml=0,gl=0,Yr=0;let n=[],r=[];for(;t.pos<Jm;)if(eo<=0&&(pl=t.readVarint(),fn=pl&7,eo=pl>>3),eo--,fn===1||fn===2)ml+=t.readSVarint(),gl+=t.readSVarint(),fn===1&&n.push(Yr),r.push(ml,gl),Yr+=2;else if(fn===7){if(Yr>0){let s=n[n.length-1];r.push(r[s],r[s+1]),Yr+=2}}else throw new Error(`unknown command ${fn}`);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=Hm(n),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=r.indices.length;for(let o of r.indices)this._geometryInfo.polygonRingsCount+=o.length;this._geometryInfo.polygonPositionsCount+=r.data.length/s;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:r,properties:this.properties};return this.id!==null&&(i.id=this.id),i}toBinaryCoordinates(t){if(typeof t=="function")return this._toBinaryCoordinates(t);let{x:n,y:r,z:s}=t,i=this.extent*Math.pow(2,s),o=this.extent*n,a=this.extent*r;return this._toBinaryCoordinates(c=>zm(c,o,a,i))}};var Qr=class{constructor(t,n){this.version=void 0,this.name=void 0,this.extent=void 0,this.length=void 0,this._pbf=void 0,this._keys=void 0,this._values=void 0,this._features=void 0,this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(vb,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 Kr(this._pbf,r,this.extent,this._keys,this._values,n)}};function vb(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(Fb(n)))}function Fb(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 Zr=class{constructor(t,n){this.layers=void 0,this.layers=t.readFields(Rb,{},n)}};function Rb(e,t,n){if(e===3&&n){let r=new Qr(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function no(e,t){var n,r;let s=Pb(t),i=(t==null||(n=t.gis)===null||n===void 0?void 0:n.format)||(t==null||(r=t.mvt)===null||r===void 0?void 0:r.shape)||t?.shape;switch(i){case"columnar-table":return{shape:"columnar-table",data:Al(e,s)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:qm(e,s)};case"geojson":return qm(e,s);case"binary-geometry":return Al(e,s);case"binary":return Al(e,s);default:throw new Error(i||"undefined shape")}}function Al(e,t){let[n,r]=Lb(e,t),s=ul(n,r);return s.byteLength=e.byteLength,s}function Lb(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 Zr(new xl.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(s.layers)).forEach(o=>{let a=s.layers[o];if(a)for(let c=0;c<a.length;c++){let l=a.feature(c,r),u=Nb(l,t,o);n.push(u)}}),[n,r]}function qm(e,t){if(e.byteLength<=0)return[];let n=[],r=new Wr(new xl.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(r.layers)).forEach(i=>{let o=r.layers[i];if(o)for(let a=0;a<o.length;a++){let c=o.feature(a),l=Ob(c,t,i);n.push(l)}}),n}function Pb(e){var t;if(!(e!=null&&e.mvt))throw new Error("mvt options required");let n=((t=e.mvt)===null||t===void 0?void 0:t.coordinates)==="wgs84",{tileIndex:r}=e.mvt,s=r&&Number.isFinite(r.x)&&Number.isFinite(r.y)&&Number.isFinite(r.z);if(n&&!s)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.mvt}function Ob(e,t,n){let r=e.toGeoJSON(t.coordinates==="wgs84"?t.tileIndex:Db);return t.layerProperty&&(r.properties[t.layerProperty]=n),r}function Nb(e,t,n){let r=e.toBinaryCoordinates(t.coordinates==="wgs84"?t.tileIndex:Ub);return t.layerProperty&&r.properties&&(r.properties[t.layerProperty]=n),r}function Db(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 Ub(e,t){let{extent:n}=t;for(let r=0,s=e.length;r<s;++r)e[r]/=n}var Gb="4.1.0",ro={name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:Gb,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}}},Vb={...ro,parse:async(e,t)=>no(e,t),parseSync:no,binary:!0};var Hb={Point:jm,MultiPoint:zb,LineString:Xm,MultiLineString:kb,Polygon:Wm,MultiPolygon:Jb};function jm([e,t],[n,r],s){let i=_e(n[0],r[0],e),o=_e(n[1],r[1],t);return s.unprojectFlat([i,o])}function yl(e,t,n){return e.map(r=>jm(r,t,n))}function zb(e,t,n){return yl(e,t,n)}function Xm(e,t,n){return yl(e,t,n)}function kb(e,t,n){return e.map(r=>Xm(r,t,n))}function Wm(e,t,n){return e.map(r=>yl(r,t,n))}function Jb(e,t,n){return e.map(r=>Wm(r,t,n))}function Ym(e,t,n){let r=n.projectFlat([t.west,t.north]),s=n.projectFlat([t.east,t.south]),i=[r,s];return{...e,coordinates:Hb[e.type](e.coordinates,i,n)}}var qb=["points","lines","polygons"];function Tl(e,t,n,r){for(let s of qb){let i=e[s]&&jb(e[s],t,n,r);if(i>=0)return i}return-1}function jb(e,t,n,r){let s=e.featureIds.value;if(!s.length)return-1;let i=0,o=s[s.length-1]+1;if(r){let c=Xb(e,r);if(c)i=c[0],o=c[1]+1;else return-1}let a=-1;if(t in e.numericProps){let c=e.numericProps[t].value.findIndex((l,u)=>l===n&&s[u]>=i&&s[u]<o);return c>=0?e.globalFeatureIds.value[c]:-1}else t?a=Km(e.properties,c=>c[t]===n,i,o):e.fields&&(a=Km(e.fields,c=>c.id===n,i,o));return a>=0?Wb(e,a):-1}function Xb(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 Wb(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 Km(e,t,n,r){for(let s=n;s<r;s++)if(t(e[s],s))return s;return-1}var _l=512,Yb={...Bl.GeoJsonLayer.defaultProps,data:Ie,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[ro],binary:!0},so=class extends ee{constructor(...t){super(...t)}initializeState(){super.initializeState();let t=this.context.viewport.resolution!==void 0?!1:this.props.binary;this.setState({binary:t,data:null,tileJSON:null,hoveredFeatureId:null,hoveredFeatureLayerName:null})}get isLoaded(){return Boolean(this.state?.data&&super.isLoaded)}updateState({props:t,oldProps: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"&&!Ia(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=te(n,t);if(!o)return Promise.reject("Invalid URL");let a=this.getLoadOptions(),{fetch:c}=this.props;return a={...a,mimeType:"application/x-protobuf",mvt:{...a?.mvt,coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:s},gis:r?{format:"binary"}:{}},c(o,{propName:"data",layer:this,loadOptions:a,signal:i})}renderSubLayers(t){let{x:n,y:r,z:s}=t.tile.index,i=Math.pow(2,s),o=_l/i,a=-o,c=_l*n/i,l=_l*(1-r/i),u=new P().scale([o,a,1]);t.autoHighlight=!1,this.context.viewport.resolution||(t.modelMatrix=u,t.coordinateOrigin=[c,l,0],t.coordinateSystem=io.COORDINATE_SYSTEM.CARTESIAN,t.extensions=[...t.extensions||[],new tg.ClipExtension]);let h=super.renderSubLayers(t);return this.state.binary&&!(h instanceof Bl.GeoJsonLayer)&&io.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),h}_updateAutoHighlight(t){let{uniqueIdProperty:n}=this.props,{hoveredFeatureId:r,hoveredFeatureLayerName:s}=this.state,i=t.object,o=null,a=null;i&&(o=El(i,n),a=Qm(i));let{highlightColor:c}=this.props;typeof c=="function"&&(c=c(t)),(r!==o||s!==a)&&this.setState({highlightColor:c,hoveredFeatureId:o,hoveredFeatureLayerName:a})}getPickingInfo(t){let n=super.getPickingInfo(t),r=Boolean(this.context.viewport.resolution);if(this.state.binary&&n.index!==-1){let{data:s}=t.sourceLayer.props;n.object=Zi(s,{globalFeatureId:n.index})}return n.object&&!r&&(n.object=$m(n.object,n.tile.bbox,this.context.viewport)),n}getSubLayerPropsByTile(t){return{highlightedObjectIndex:this.getHighlightedObjectIndex(t),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(t){let{hoveredFeatureId:n,hoveredFeatureLayerName:r,binary:s}=this.state,{uniqueIdProperty:i,highlightedFeatureId:o}=this.props,a=t.content,c=Zm(o);if(!(Zm(n)||c))return-1;let u=c?o:n;return Array.isArray(a)?a.findIndex(h=>{let f=El(h,i)===u,d=c||Qm(h)===r;return f&&d}):a&&s?Tl(a,i,u,c?"":r):-1}_pickObjects(t){let{deck:n,viewport:r}=this.context,s=r.width,i=r.height,o=r.x,a=r.y,c=[this.id];return n.pickObjects({x:o,y:a,width:s,height:i,layerIds:c,maxObjects:t})}getRenderedFeatures(t=null){let n=this._pickObjects(t),r=new Set,s=[];for(let i of n){let o=El(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&&wa(s)){let i=this.state.binary?Zi(r.content):r.content;r._contentWGS84=i.map(o=>$m(o,s,this.context.viewport))}return r._contentWGS84}})})}},$r=so;(()=>{so.layerName="MVTLayer"})(),(()=>{so.defaultProps=Yb})();function El(e,t){if(e.properties&&t)return e.properties[t];if("id"in e)return e.id}function Qm(e){return e.properties?.layerName||null}function Zm(e){return e!=null&&e!==""}function $m(e,t,n){let r={...e,geometry:{type:e.geometry.type}};return Object.defineProperty(r.geometry,"coordinates",{get:()=>Ym(e.geometry,t,n).coordinates}),r}var eg="0123456789bcdefghjkmnpqrstuvwxyz",ng={};for(let e=0;e<eg.length;e++)ng[eg.charAt(e)]=e;var Kb=-90,Qb=90,Zb=-180,$b=180;function tS(e){let t=!0,n=Qb,r=Kb,s=$b,i=Zb,o,a=0;for(let c=0,l=e.length;c<l;c++){let u=e[c].toLowerCase();a=ng[u];for(let h=4;h>=0;h--){let f=a>>h&1;t?(o=(s+i)/2,f===1?i=o:s=o):(o=(n+r)/2,f===1?r=o:n=o),t=!t}}return[r,i,n,s]}function rg(e){let[t,n,r,s]=tS(e);return[s,r,s,t,n,t,n,r,s,r]}var eS={getGeohash:{type:"accessor",value:e=>e.geohash}},oo=class extends It{indexToBounds(){let{data:t,getGeohash:n}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(r,s)=>rg(n(r,s))}}},ts=oo;(()=>{oo.layerName="GeohashLayer"})(),(()=>{oo.defaultProps=eS})();return hg(es);})();
|
|
586
455
|
return __exports__;
|
|
587
456
|
});
|