@deck.gl/geo-layers 9.1.0-beta.1 → 9.1.0-beta.3

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.
Files changed (74) hide show
  1. package/dist/dist.dev.js +4 -4
  2. package/dist/geo-cell-layer/GeoCellLayer.js +1 -0
  3. package/dist/geo-cell-layer/GeoCellLayer.js.map +1 -0
  4. package/dist/geohash-layer/geohash-layer.js +1 -0
  5. package/dist/geohash-layer/geohash-layer.js.map +1 -0
  6. package/dist/geohash-layer/geohash-utils.js +1 -0
  7. package/dist/geohash-layer/geohash-utils.js.map +1 -0
  8. package/dist/great-circle-layer/great-circle-layer.js +1 -0
  9. package/dist/great-circle-layer/great-circle-layer.js.map +1 -0
  10. package/dist/h3-layers/h3-cluster-layer.js +1 -0
  11. package/dist/h3-layers/h3-cluster-layer.js.map +1 -0
  12. package/dist/h3-layers/h3-hexagon-layer.js +1 -0
  13. package/dist/h3-layers/h3-hexagon-layer.js.map +1 -0
  14. package/dist/h3-layers/h3-utils.js +1 -0
  15. package/dist/h3-layers/h3-utils.js.map +1 -0
  16. package/dist/index.cjs +3 -3
  17. package/dist/index.cjs.map +3 -3
  18. package/dist/index.js +1 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/mesh-layer/mesh-layer-fragment.glsl.js +1 -0
  21. package/dist/mesh-layer/mesh-layer-fragment.glsl.js.map +1 -0
  22. package/dist/mesh-layer/mesh-layer-uniforms.js +1 -0
  23. package/dist/mesh-layer/mesh-layer-uniforms.js.map +1 -0
  24. package/dist/mesh-layer/mesh-layer-vertex.glsl.js +1 -0
  25. package/dist/mesh-layer/mesh-layer-vertex.glsl.js.map +1 -0
  26. package/dist/mesh-layer/mesh-layer.js +1 -0
  27. package/dist/mesh-layer/mesh-layer.js.map +1 -0
  28. package/dist/mvt-layer/coordinate-transform.js +1 -0
  29. package/dist/mvt-layer/coordinate-transform.js.map +1 -0
  30. package/dist/mvt-layer/find-index-binary.js +1 -0
  31. package/dist/mvt-layer/find-index-binary.js.map +1 -0
  32. package/dist/mvt-layer/mvt-layer.js +1 -0
  33. package/dist/mvt-layer/mvt-layer.js.map +1 -0
  34. package/dist/quadkey-layer/quadkey-layer.js +1 -0
  35. package/dist/quadkey-layer/quadkey-layer.js.map +1 -0
  36. package/dist/quadkey-layer/quadkey-utils.js +1 -0
  37. package/dist/quadkey-layer/quadkey-utils.js.map +1 -0
  38. package/dist/s2-layer/s2-geometry.js +1 -0
  39. package/dist/s2-layer/s2-geometry.js.map +1 -0
  40. package/dist/s2-layer/s2-layer.js +1 -0
  41. package/dist/s2-layer/s2-layer.js.map +1 -0
  42. package/dist/s2-layer/s2-utils.js +1 -0
  43. package/dist/s2-layer/s2-utils.js.map +1 -0
  44. package/dist/terrain-layer/terrain-layer.js +1 -0
  45. package/dist/terrain-layer/terrain-layer.js.map +1 -0
  46. package/dist/tile-3d-layer/tile-3d-layer.js +1 -0
  47. package/dist/tile-3d-layer/tile-3d-layer.js.map +1 -0
  48. package/dist/tile-layer/tile-layer.js +1 -0
  49. package/dist/tile-layer/tile-layer.js.map +1 -0
  50. package/dist/tileset-2d/index.js +1 -0
  51. package/dist/tileset-2d/index.js.map +1 -0
  52. package/dist/tileset-2d/memoize.js +1 -0
  53. package/dist/tileset-2d/memoize.js.map +1 -0
  54. package/dist/tileset-2d/tile-2d-header.js +1 -0
  55. package/dist/tileset-2d/tile-2d-header.js.map +1 -0
  56. package/dist/tileset-2d/tile-2d-traversal.js +1 -0
  57. package/dist/tileset-2d/tile-2d-traversal.js.map +1 -0
  58. package/dist/tileset-2d/tileset-2d.js +4 -3
  59. package/dist/tileset-2d/tileset-2d.js.map +1 -0
  60. package/dist/tileset-2d/types.js +1 -0
  61. package/dist/tileset-2d/types.js.map +1 -0
  62. package/dist/tileset-2d/utils.js +1 -0
  63. package/dist/tileset-2d/utils.js.map +1 -0
  64. package/dist/trips-layer/trips-layer-uniforms.js +1 -0
  65. package/dist/trips-layer/trips-layer-uniforms.js.map +1 -0
  66. package/dist/trips-layer/trips-layer.js +1 -0
  67. package/dist/trips-layer/trips-layer.js.map +1 -0
  68. package/dist/wms-layer/utils.js +1 -0
  69. package/dist/wms-layer/utils.js.map +1 -0
  70. package/dist/wms-layer/wms-layer.js +1 -0
  71. package/dist/wms-layer/wms-layer.js.map +1 -0
  72. package/dist.min.js +1 -1
  73. package/package.json +10 -10
  74. package/src/tileset-2d/tileset-2d.ts +3 -3
package/dist.min.js CHANGED
@@ -10,7 +10,7 @@
10
10
  `);let t=new ds("!xml"),n=t,r="",s="";for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){let c=Bn(e,">",i,"Closing Tag is not closed."),a=e.substring(i+2,c).trim();if(this.options.removeNSPrefix){let f=a.indexOf(":");f!==-1&&(a=a.substr(f+1))}this.options.transformTagName&&(a=this.options.transformTagName(a)),n&&(r=this.saveTextToParentTag(r,n,s));let h=s.substring(s.lastIndexOf(".")+1);if(a&&this.options.unpairedTags.indexOf(a)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${a}>`);let l=0;h&&this.options.unpairedTags.indexOf(h)!==-1?(l=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):l=s.lastIndexOf("."),s=s.substring(0,l),n=this.tagsNodeStack.pop(),r="",i=c}else if(e[i+1]==="?"){let c=Ta(e,i,!1,"?>");if(!c)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,s),!(this.options.ignoreDeclaration&&c.tagName==="?xml"||this.options.ignorePiTags)){let a=new ds(c.tagName);a.add(this.options.textNodeName,""),c.tagName!==c.tagExp&&c.attrExpPresent&&(a[":@"]=this.buildAttributesMap(c.tagExp,s,c.tagName)),this.addChild(n,a,s)}i=c.closeIndex+1}else if(e.substr(i+1,3)==="!--"){let c=Bn(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){let a=e.substring(i+4,c-2);r=this.saveTextToParentTag(r,n,s),n.add(this.options.commentPropName,[{[this.options.textNodeName]:a}])}i=c}else if(e.substr(i+1,2)==="!D"){let c=oE(e,i);this.docTypeEntities=c.entities,i=c.i}else if(e.substr(i+1,2)==="!["){let c=Bn(e,"]]>",i,"CDATA is not closed.")-2,a=e.substring(i+9,c);r=this.saveTextToParentTag(r,n,s);let h=this.parseTextData(a,n.tagname,s,!0,!1,!0,!0);h==null&&(h=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:a}]):n.add(this.options.textNodeName,h),i=c+2}else{let c=Ta(e,i,this.options.removeNSPrefix),a=c.tagName,h=c.rawTagName,l=c.tagExp,f=c.attrExpPresent,p=c.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,s,!1));let u=n;if(u&&this.options.unpairedTags.indexOf(u.tagname)!==-1&&(n=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),a!==t.tagname&&(s+=s?"."+a:a),this.isItStopNode(this.options.stopNodes,s,a)){let d="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)a[a.length-1]==="/"?(a=a.substr(0,a.length-1),s=s.substr(0,s.length-1),l=a):l=l.substr(0,l.length-1),i=c.closeIndex;else if(this.options.unpairedTags.indexOf(a)!==-1)i=c.closeIndex;else{let m=this.readStopNodeData(e,h,p+1);if(!m)throw new Error(`Unexpected end of ${h}`);i=m.i,d=m.tagContent}let g=new ds(a);a!==l&&f&&(g[":@"]=this.buildAttributesMap(l,s,a)),d&&(d=this.parseTextData(d,a,s,!0,f,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),g.add(this.options.textNodeName,d),this.addChild(n,g,s)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){a[a.length-1]==="/"?(a=a.substr(0,a.length-1),s=s.substr(0,s.length-1),l=a):l=l.substr(0,l.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));let d=new ds(a);a!==l&&f&&(d[":@"]=this.buildAttributesMap(l,s,a)),this.addChild(n,d,s),s=s.substr(0,s.lastIndexOf("."))}else{let d=new ds(a);this.tagsNodeStack.push(n),a!==l&&f&&(d[":@"]=this.buildAttributesMap(l,s,a)),this.addChild(n,d,s),n=d}r="",i=p}}else r+=e[i];return t.child};function dE(e,t,n){let r=this.options.updateTag(t.tagname,n,t[":@"]);r===!1||(typeof r=="string"&&(t.tagname=r),e.addChild(t))}var mE=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 gE(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 xE(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 ME(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 Bn(e,t,n,r){let s=e.indexOf(t,n);if(s===-1)throw new Error(r);return s+t.length-1}function Ta(e,t,n,r=">"){let s=ME(e,t+1,r);if(!s)return;let i=s.data,o=s.index,c=i.search(/\s/),a=i,h=!0;c!==-1&&(a=i.substring(0,c),i=i.substring(c+1).trimStart());let l=a;if(n){let f=a.indexOf(":");f!==-1&&(a=a.substr(f+1),h=a!==s.data.substr(f+1))}return{tagName:a,tagExp:i,closeIndex:o,attrExpPresent:h,rawTagName:l}}function AE(e,t,n){let r=n,s=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){let i=Bn(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=Bn(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=Bn(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=Bn(e,"]]>",n,"StopNode is not closed.")-2;else{let i=Ta(e,n,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&s++,n=i.closeIndex)}}function _a(e,t,n){if(t&&typeof e=="string"){let r=e.trim();return r==="true"?!0:r==="false"?!1:cE(e,n)}else return m1.isExist(e)?e:""}g1.exports=Ea});var y1=it(A1=>{"use strict";function yE(e,t){return M1(e,t)}function M1(e,t,n){let r,s={};for(let i=0;i<e.length;i++){let o=e[i],c=EE(o),a="";if(n===void 0?a=c:a=n+"."+c,c===t.textNodeName)r===void 0?r=o[c]:r+=""+o[c];else{if(c===void 0)continue;if(o[c]){let h=M1(o[c],t,a),l=_E(h,t);o[":@"]?TE(h,o[":@"],a,t):Object.keys(h).length===1&&h[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?h=h[t.textNodeName]:Object.keys(h).length===0&&(t.alwaysCreateTextNode?h[t.textNodeName]="":h=""),s[c]!==void 0&&s.hasOwnProperty(c)?(Array.isArray(s[c])||(s[c]=[s[c]]),s[c].push(h)):t.isArray(c,a,l)?s[c]=[h]:s[c]=h}}}return typeof r=="string"?r.length>0&&(s[t.textNodeName]=r):r!==void 0&&(s[t.textNodeName]=r),s}function EE(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(r!==":@")return r}}function TE(e,t,n,r){if(t){let s=Object.keys(t),i=s.length;for(let o=0;o<i;o++){let c=s[o];r.isArray(c,n+"."+c,!0,!0)?e[c]=[t[c]]:e[c]=t[c]}}}function _E(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))}A1.prettify=yE});var T1=it((PF,E1)=>{var{buildOptions:SE}=a1(),BE=x1(),{prettify:CE}=y1(),LE=Ma(),Sa=class{constructor(t){this.externalEntities={},this.options=SE(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=LE.validate(t,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let r=new BE(this.options);r.addExternalEntities(this.externalEntities);let s=r.parseXml(t);return this.options.preserveOrder||s===void 0?s:CE(s,this.options)}addEntity(t,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}};E1.exports=Sa});var L1=it((NF,C1)=>{var RE=`
11
11
  `;function wE(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=RE),S1(e,t,"",n)}function S1(e,t,n,r){let s="",i=!1;for(let o=0;o<e.length;o++){let c=e[o],a=IE(c);if(a===void 0)continue;let h="";if(n.length===0?h=a:h=`${n}.${a}`,a===t.textNodeName){let d=c[a];bE(h,t)||(d=t.tagValueProcessor(a,d),d=B1(d,t)),i&&(s+=r),s+=d,i=!1;continue}else if(a===t.cdataPropName){i&&(s+=r),s+=`<![CDATA[${c[a][0][t.textNodeName]}]]>`,i=!1;continue}else if(a===t.commentPropName){s+=r+`<!--${c[a][0][t.textNodeName]}-->`,i=!0;continue}else if(a[0]==="?"){let d=_1(c[":@"],t),g=a==="?xml"?"":r,m=c[a][0][t.textNodeName];m=m.length!==0?" "+m:"",s+=g+`<${a}${m}${d}?>`,i=!0;continue}let l=r;l!==""&&(l+=t.indentBy);let f=_1(c[":@"],t),p=r+`<${a}${f}`,u=S1(c[a],t,h,l);t.unpairedTags.indexOf(a)!==-1?t.suppressUnpairedNode?s+=p+">":s+=p+"/>":(!u||u.length===0)&&t.suppressEmptyNode?s+=p+"/>":u&&u.endsWith(">")?s+=p+`>${u}${r}</${a}>`:(s+=p+">",u&&r!==""&&(u.includes("/>")||u.includes("</"))?s+=r+t.indentBy+u+r:s+=u,s+=`</${a}>`),i=!0}return s}function IE(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(e.hasOwnProperty(r)&&r!==":@")return r}}function _1(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let s=t.attributeValueProcessor(r,e[r]);s=B1(s,t),s===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${s}"`}return n}function bE(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 B1(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}C1.exports=wE});var w1=it((FF,R1)=>{"use strict";var OE=L1(),PE={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Je(e){this.options=Object.assign({},PE,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=vE),this.processTextOrObjNode=NE,this.options.format?(this.indentate=FE,this.tagEndChar=`>
12
12
  `,this.newLine=`
13
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Je.prototype.build=function(e){return this.options.preserveOrder?OE(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)};Je.prototype.j2x=function(e,t){let n="",r="";for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(typeof e[s]>"u")this.isAttribute(s)&&(r+="");else if(e[s]===null)this.isAttribute(s)?r+="":s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)r+=this.buildTextValNode(e[s],s,"",t);else if(typeof e[s]!="object"){let i=this.isAttribute(s);if(i)n+=this.buildAttrPairStr(i,""+e[s]);else if(s===this.options.textNodeName){let o=this.options.tagValueProcessor(s,""+e[s]);r+=this.replaceEntitiesValue(o)}else r+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){let i=e[s].length,o="",c="";for(let a=0;a<i;a++){let h=e[s][a];if(!(typeof h>"u"))if(h===null)s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(typeof h=="object")if(this.options.oneListGroup){let l=this.j2x(h,t+1);o+=l.val,this.options.attributesGroupName&&h.hasOwnProperty(this.options.attributesGroupName)&&(c+=l.attrStr)}else o+=this.processTextOrObjNode(h,s,t);else if(this.options.oneListGroup){let l=this.options.tagValueProcessor(s,h);l=this.replaceEntitiesValue(l),o+=l}else o+=this.buildTextValNode(h,s,"",t)}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,c,t)),r+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){let i=Object.keys(e[s]),o=i.length;for(let c=0;c<o;c++)n+=this.buildAttrPairStr(i[c],""+e[s][i[c]])}else r+=this.processTextOrObjNode(e[s],s,t);return{attrStr:n,val:r}};Je.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 NE(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)}Je.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}};Je.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};Je.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}};Je.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 FE(e){return this.options.indentBy.repeat(e)}function vE(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}R1.exports=Je});var b1=it((vF,I1)=>{"use strict";var DE=Ma(),UE=T1(),GE=w1();I1.exports={XMLParser:UE,XMLValidator:DE,XMLBuilder:GE}});var Sh=it((Su,Os)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof K0=="function"&&typeof Os=="object"&&Os&&Os.exports?Os.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(Su,function(){"use strict";function e(S,x,R){this.low=S|0,this.high=x|0,this.unsigned=!!R}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function t(S){return(S&&S.__isLong__)===!0}e.isLong=t;var n={},r={};function s(S,x){var R,w,I;return x?(S>>>=0,(I=0<=S&&S<256)&&(w=r[S],w)?w:(R=o(S,(S|0)<0?-1:0,!0),I&&(r[S]=R),R)):(S|=0,(I=-128<=S&&S<128)&&(w=n[S],w)?w:(R=o(S,S<0?-1:0,!1),I&&(n[S]=R),R))}e.fromInt=s;function i(S,x){if(isNaN(S)||!isFinite(S))return x?M:m;if(x){if(S<0)return M;if(S>=u)return _}else{if(S<=-d)return L;if(S+1>=d)return T}return S<0?i(-S,x).neg():o(S%p|0,S/p|0,x)}e.fromNumber=i;function o(S,x,R){return new e(S,x,R)}e.fromBits=o;var c=Math.pow;function a(S,x,R){if(S.length===0)throw Error("empty string");if(S==="NaN"||S==="Infinity"||S==="+Infinity"||S==="-Infinity")return m;if(typeof x=="number"?(R=x,x=!1):x=!!x,R=R||10,R<2||36<R)throw RangeError("radix");var w;if((w=S.indexOf("-"))>0)throw Error("interior hyphen");if(w===0)return a(S.substring(1),x,R).neg();for(var I=i(c(R,8)),C=m,P=0;P<S.length;P+=8){var V=Math.min(8,S.length-P),G=parseInt(S.substring(P,P+V),R);if(V<8){var Q=i(c(R,V));C=C.mul(Q).add(i(G))}else C=C.mul(I),C=C.add(i(G))}return C.unsigned=x,C}e.fromString=a;function h(S){return S instanceof e?S:typeof S=="number"?i(S):typeof S=="string"?a(S):o(S.low,S.high,S.unsigned)}e.fromValue=h;var l=1<<16,f=1<<24,p=l*l,u=p*p,d=u/2,g=s(f),m=s(0);e.ZERO=m;var M=s(0,!0);e.UZERO=M;var E=s(1);e.ONE=E;var A=s(1,!0);e.UONE=A;var y=s(-1);e.NEG_ONE=y;var T=o(-1,2147483647,!1);e.MAX_VALUE=T;var _=o(-1,-1,!0);e.MAX_UNSIGNED_VALUE=_;var L=o(0,-2147483648,!1);e.MIN_VALUE=L;var B=e.prototype;return B.toInt=function(){return this.unsigned?this.low>>>0:this.low},B.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},B.toString=function(x){if(x=x||10,x<2||36<x)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(L)){var R=i(x),w=this.div(R),I=w.mul(R).sub(this);return w.toString(x)+I.toInt().toString(x)}else return"-"+this.neg().toString(x);for(var C=i(c(x,6),this.unsigned),P=this,V="";;){var G=P.div(C),Q=P.sub(G.mul(C)).toInt()>>>0,q=Q.toString(x);if(P=G,P.isZero())return q+V;for(;q.length<6;)q="0"+q;V=""+q+V}},B.getHighBits=function(){return this.high},B.getHighBitsUnsigned=function(){return this.high>>>0},B.getLowBits=function(){return this.low},B.getLowBitsUnsigned=function(){return this.low>>>0},B.getNumBitsAbs=function(){if(this.isNegative())return this.eq(L)?64:this.neg().getNumBitsAbs();for(var x=this.high!=0?this.high:this.low,R=31;R>0&&!(x&1<<R);R--);return this.high!=0?R+33:R+1},B.isZero=function(){return this.high===0&&this.low===0},B.isNegative=function(){return!this.unsigned&&this.high<0},B.isPositive=function(){return this.unsigned||this.high>=0},B.isOdd=function(){return(this.low&1)===1},B.isEven=function(){return(this.low&1)===0},B.equals=function(x){return t(x)||(x=h(x)),this.unsigned!==x.unsigned&&this.high>>>31===1&&x.high>>>31===1?!1:this.high===x.high&&this.low===x.low},B.eq=B.equals,B.notEquals=function(x){return!this.eq(x)},B.neq=B.notEquals,B.lessThan=function(x){return this.comp(x)<0},B.lt=B.lessThan,B.lessThanOrEqual=function(x){return this.comp(x)<=0},B.lte=B.lessThanOrEqual,B.greaterThan=function(x){return this.comp(x)>0},B.gt=B.greaterThan,B.greaterThanOrEqual=function(x){return this.comp(x)>=0},B.gte=B.greaterThanOrEqual,B.compare=function(x){if(t(x)||(x=h(x)),this.eq(x))return 0;var R=this.isNegative(),w=x.isNegative();return R&&!w?-1:!R&&w?1:this.unsigned?x.high>>>0>this.high>>>0||x.high===this.high&&x.low>>>0>this.low>>>0?-1:1:this.sub(x).isNegative()?-1:1},B.comp=B.compare,B.negate=function(){return!this.unsigned&&this.eq(L)?L:this.not().add(E)},B.neg=B.negate,B.add=function(x){t(x)||(x=h(x));var R=this.high>>>16,w=this.high&65535,I=this.low>>>16,C=this.low&65535,P=x.high>>>16,V=x.high&65535,G=x.low>>>16,Q=x.low&65535,q=0,$=0,st=0,Ut=0;return Ut+=C+Q,st+=Ut>>>16,Ut&=65535,st+=I+G,$+=st>>>16,st&=65535,$+=w+V,q+=$>>>16,$&=65535,q+=R+P,q&=65535,o(st<<16|Ut,q<<16|$,this.unsigned)},B.subtract=function(x){return t(x)||(x=h(x)),this.add(x.neg())},B.sub=B.subtract,B.multiply=function(x){if(this.isZero()||(t(x)||(x=h(x)),x.isZero()))return m;if(this.eq(L))return x.isOdd()?L:m;if(x.eq(L))return this.isOdd()?L:m;if(this.isNegative())return x.isNegative()?this.neg().mul(x.neg()):this.neg().mul(x).neg();if(x.isNegative())return this.mul(x.neg()).neg();if(this.lt(g)&&x.lt(g))return i(this.toNumber()*x.toNumber(),this.unsigned);var R=this.high>>>16,w=this.high&65535,I=this.low>>>16,C=this.low&65535,P=x.high>>>16,V=x.high&65535,G=x.low>>>16,Q=x.low&65535,q=0,$=0,st=0,Ut=0;return Ut+=C*Q,st+=Ut>>>16,Ut&=65535,st+=I*Q,$+=st>>>16,st&=65535,st+=C*G,$+=st>>>16,st&=65535,$+=w*Q,q+=$>>>16,$&=65535,$+=I*G,q+=$>>>16,$&=65535,$+=C*V,q+=$>>>16,$&=65535,q+=R*Q+w*G+I*V+C*P,q&=65535,o(st<<16|Ut,q<<16|$,this.unsigned)},B.mul=B.multiply,B.divide=function(x){if(t(x)||(x=h(x)),x.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?M:m;var R,w,I;if(this.unsigned){if(x.unsigned||(x=x.toUnsigned()),x.gt(this))return M;if(x.gt(this.shru(1)))return A;I=M}else{if(this.eq(L)){if(x.eq(E)||x.eq(y))return L;if(x.eq(L))return E;var C=this.shr(1);return R=C.div(x).shl(1),R.eq(m)?x.isNegative()?E:y:(w=this.sub(x.mul(R)),I=R.add(w.div(x)),I)}else if(x.eq(L))return this.unsigned?M:m;if(this.isNegative())return x.isNegative()?this.neg().div(x.neg()):this.neg().div(x).neg();if(x.isNegative())return this.div(x.neg()).neg();I=m}for(w=this;w.gte(x);){R=Math.max(1,Math.floor(w.toNumber()/x.toNumber()));for(var P=Math.ceil(Math.log(R)/Math.LN2),V=P<=48?1:c(2,P-48),G=i(R),Q=G.mul(x);Q.isNegative()||Q.gt(w);)R-=V,G=i(R,this.unsigned),Q=G.mul(x);G.isZero()&&(G=E),I=I.add(G),w=w.sub(Q)}return I},B.div=B.divide,B.modulo=function(x){return t(x)||(x=h(x)),this.sub(this.div(x).mul(x))},B.mod=B.modulo,B.not=function(){return o(~this.low,~this.high,this.unsigned)},B.and=function(x){return t(x)||(x=h(x)),o(this.low&x.low,this.high&x.high,this.unsigned)},B.or=function(x){return t(x)||(x=h(x)),o(this.low|x.low,this.high|x.high,this.unsigned)},B.xor=function(x){return t(x)||(x=h(x)),o(this.low^x.low,this.high^x.high,this.unsigned)},B.shiftLeft=function(x){return t(x)&&(x=x.toInt()),(x&=63)===0?this:x<32?o(this.low<<x,this.high<<x|this.low>>>32-x,this.unsigned):o(0,this.low<<x-32,this.unsigned)},B.shl=B.shiftLeft,B.shiftRight=function(x){return t(x)&&(x=x.toInt()),(x&=63)===0?this:x<32?o(this.low>>>x|this.high<<32-x,this.high>>x,this.unsigned):o(this.high>>x-32,this.high>=0?0:-1,this.unsigned)},B.shr=B.shiftRight,B.shiftRightUnsigned=function(x){if(t(x)&&(x=x.toInt()),x&=63,x===0)return this;var R=this.high;if(x<32){var w=this.low;return o(w>>>x|R<<32-x,R>>>x,this.unsigned)}else return x===32?o(R,0,this.unsigned):o(R>>>x-32,0,this.unsigned)},B.shru=B.shiftRightUnsigned,B.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},B.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},B.toBytes=function(S){return S?this.toBytesLE():this.toBytesBE()},B.toBytesLE=function(){var S=this.high,x=this.low;return[x&255,x>>>8&255,x>>>16&255,x>>>24&255,S&255,S>>>8&255,S>>>16&255,S>>>24&255]},B.toBytesBE=function(){var S=this.high,x=this.low;return[S>>>24&255,S>>>16&255,S>>>8&255,S&255,x>>>24&255,x>>>16&255,x>>>8&255,x&255]},e})});var oo=it((m9,od)=>{od.exports=globalThis.h3||{}});var Uh=it((S9,pd)=>{pd.exports=globalThis.luma});var lo=it((B9,ud)=>{ud.exports=globalThis.deck});var Gh=it((C9,dd)=>{dd.exports=globalThis.luma});var yr=it((Tz,Wd)=>{Wd.exports=globalThis.loaders});var Uy=it((Rtt,Dy)=>{Dy.exports=globalThis.deck});var Xy=it(D0=>{D0.read=function(e,t,n,r,s){var i,o,c=s*8-r-1,a=(1<<c)-1,h=a>>1,l=-7,f=n?s-1:0,p=n?-1:1,u=e[t+f];for(f+=p,i=u&(1<<-l)-1,u>>=-l,l+=c;l>0;i=i*256+e[t+f],f+=p,l-=8);for(o=i&(1<<-l)-1,i>>=-l,l+=r;l>0;o=o*256+e[t+f],f+=p,l-=8);if(i===0)i=1-h;else{if(i===a)return o?NaN:(u?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-h}return(u?-1:1)*o*Math.pow(2,i-r)};D0.write=function(e,t,n,r,s,i){var o,c,a,h=i*8-s-1,l=(1<<h)-1,f=l>>1,p=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,u=r?0:i-1,d=r?1:-1,g=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+f>=1?t+=p/a:t+=p*Math.pow(2,1-f),t*a>=2&&(o++,a/=2),o+f>=l?(c=0,o=l):o+f>=1?(c=(t*a-1)*Math.pow(2,s),o=o+f):(c=t*Math.pow(2,f-1)*Math.pow(2,s),o=0));s>=8;e[n+u]=c&255,u+=d,c/=256,s-=8);for(o=o<<s|c,h+=s;h>0;e[n+u]=o&255,u+=d,o/=256,h-=8);e[n+u-d]|=g*128}});var t3=it((get,$y)=>{"use strict";$y.exports=j;var ca=Xy();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 U0=(1<<16)*(1<<16),jy=1/U0,S4=12,Qy=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");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=aa(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Zy(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=aa(this.buf,this.pos)+aa(this.buf,this.pos+4)*U0;return this.pos+=8,e},readSFixed64:function(){var e=aa(this.buf,this.pos)+Zy(this.buf,this.pos+4)*U0;return this.pos+=8,e},readFloat:function(){var e=ca.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=ca.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,B4(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>=S4&&Qy?G4(this.buf,t,e):U4(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=Ye(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=Ye(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=Ye(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=Ye(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=Ye(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=Ye(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=Ye(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=Ye(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=Ye(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),ls(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),ls(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),ls(this.buf,e&-1,this.pos),ls(this.buf,Math.floor(e*jy),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),ls(this.buf,e&-1,this.pos),ls(this.buf,Math.floor(e*jy),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){C4(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=z4(this.buf,e,this.pos);var n=this.pos-t;n>=128&&Ky(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),ca.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),ca.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&&Ky(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,w4,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,I4,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,P4,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,b4,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,O4,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,N4,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,F4,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,v4,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,D4,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 B4(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 hs(e,s,t);throw new Error("Expected varint not more than 10 bytes")}function Ye(e){return e.type===j.Bytes?e.readVarint()+e.pos:e.pos+1}function hs(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function C4(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),L4(n,r,t),R4(r,t)}function L4(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 R4(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 Ky(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 w4(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function I4(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function b4(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function O4(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function P4(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function N4(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function F4(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function v4(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function D4(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function aa(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function ls(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function Zy(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function U4(e,t,n){for(var r="",s=t;s<n;){var i=e[s],o=null,c=i>239?4:i>223?3:i>191?2:1;if(s+c>n)break;var a,h,l;c===1?i<128&&(o=i):c===2?(a=e[s+1],(a&192)===128&&(o=(i&31)<<6|a&63,o<=127&&(o=null))):c===3?(a=e[s+1],h=e[s+2],(a&192)===128&&(h&192)===128&&(o=(i&15)<<12|(a&63)<<6|h&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):c===4&&(a=e[s+1],h=e[s+2],l=e[s+3],(a&192)===128&&(h&192)===128&&(l&192)===128&&(o=(i&15)<<18|(a&63)<<12|(h&63)<<6|l&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,c=1):o>65535&&(o-=65536,r+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),r+=String.fromCharCode(o),s+=c}return r}function G4(e,t,n){return Qy.decode(e.subarray(t,n))}function z4(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 Li={};At(Li,{GeohashLayer:()=>E3,GreatCircleLayer:()=>Tu,H3ClusterLayer:()=>fd,H3HexagonLayer:()=>ho,MVTLayer:()=>x3,QuadkeyLayer:()=>Du,S2Layer:()=>Fu,TerrainLayer:()=>vy,Tile3DLayer:()=>Ry,TileLayer:()=>Dn,TripsLayer:()=>id,_GeoCellLayer:()=>ye,_Tile2DHeader:()=>Nn,_Tileset2D:()=>vn,_WMSLayer:()=>Mr,_getURLFromTemplate:()=>Te});var pe={},Q0=D(ee(),1);We(pe,D(ee(),1));if(!Q0.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");We(Li,pe);var Pn=D(ne(),1),yu=D(ee(),1);function b3(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function wi(e){if(Array.isArray(e))return e.map(t=>wi(t));if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[b3(n)]=wi(r);return t}return e}var O1=D(b1(),1);function Ba(e,t){if(t?._parser&&t._parser!=="fast-xml-parser")throw new Error(t?._parser);let n={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:t?.removeNSPrefix,textNodeName:t?.textNodeName,isArray:(s,i,o,c)=>Boolean(t?.arrayPaths?.some(h=>i===h)),...t?._fastXML},r=zE(e,n);return t?.uncapitalizeKeys?wi(r):r}function zE(e,t){return new O1.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var kE="4.2.1",re={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:kE,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:VE,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>Ba(new TextDecoder().decode(e),{...re.options.xml,...t?.xml}),parseTextSync:(e,t)=>Ba(e,{...re.options.xml,...t?.xml})};function VE(e){return e.startsWith("<?xml")}async function qt(e,t,n,r){return r._parse(e,t,n,r)}function z(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var ue={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},qE=ue.self||ue.window||ue.global||{},HE=ue.window||ue.self||ue.global||{},YE=ue.global||ue.self||ue.window||{},WE=ue.document||{};var ms=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var P1=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),JE=P1&&parseFloat(P1[1])||0;var bi=globalThis,XE=globalThis.document||{},Oi=globalThis.process||{},jE=globalThis.console,HF=globalThis.navigator||{};function N1(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,n=e||t;return Boolean(n&&n.indexOf("Electron")>=0)}function Cn(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||N1()}var Ca="4.0.7";function ZE(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,r="sessionStorage"){this.storage=ZE(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 F1(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 v1(e,t=8){let n=Math.max(t-e.length,0);return`${" ".repeat(n)}${e}`}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 QE=10;function D1(e){return typeof e!="string"?e:(e=e.toUpperCase(),Ni[e]||Ni.WHITE)}function U1(e,t,n){return!Cn&&typeof e=="string"&&(t&&(e=`\x1B[${D1(t)}m${e}\x1B[39m`),n&&(e=`\x1B[${D1(n)+QE}m${e}\x1B[49m`)),e}function G1(e,t=["constructor"]){let n=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(n),s=e;for(let i of r){let o=s[i];typeof o=="function"&&(t.find(c=>i===c)||(s[i]=o.bind(e)))}}function gs(e,t){if(!e)throw new Error(t||"Assertion failed")}function Ln(){let e;if(Cn()&&bi.performance)e=bi?.performance?.now?.();else if("hrtime"in Oi){let t=Oi?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var ir={debug:Cn()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},$E={enabled:!0,level:0};function or(){}var z1={},k1={once:!0},xs=class{constructor({id:t}={id:""}){this.VERSION=Ca,this._startTs=Ln(),this._deltaTs=Ln(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Pi(`__probe-${this.id}__`,$E),this.timeStamp(`${this.id} started`),G1(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((Ln()-this._startTs).toPrecision(10))}getDelta(){return Number((Ln()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,n){this._storage.setConfiguration({[t]:n})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,n){if(!t)throw new Error(n||"Assertion failed")}warn(t){return this._getLogFunction(0,t,ir.warn,arguments,k1)}error(t){return this._getLogFunction(0,t,ir.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,ir.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,ir.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,ir.debug||ir.info,arguments,k1)}table(t,n,r){return n?this._getLogFunction(t,n,console.table||or,r&&[r],{tag:eT(n)}):or}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||or)}group(t,n,r={collapsed:!1}){let s=V1({logLevel:t,message:n,opts:r}),{collapsed:i}=r;return s.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(t,n,r={}){return this.group(t,n,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||or)}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()>=q1(t)}_getLogFunction(t,n,r,s,i){if(this._shouldLog(t)){i=V1({logLevel:t,message:n,args:s,opts:i}),r=r||i.method,gs(r),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=Ln();let o=i.tag||i.message;if(i.once&&o)if(!z1[o])z1[o]=Ln();else return or;return n=tT(this.id,i.message,i),r.bind(console,n,...i.args)}return or}};xs.VERSION=Ca;function q1(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 gs(Number.isFinite(t)&&t>=0),t}function V1(e){let{logLevel:t,message:n}=e;e.logLevel=q1(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 gs(s==="string"||s==="object"),Object.assign(e,{args:r},e.opts)}function tT(e,t,n){if(typeof t=="string"){let r=n.time?v1(F1(n.total)):"";t=n.time?`${e}: ${r} ${t}`:`${e}: ${t}`,t=U1(t,n.color,n.background)}return t}function eT(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}globalThis.probe={};var La=new xs({id:"@probe.gl/log"});function Ra(e,t){return H1(e||{},t)}function H1(e,t,n=0){if(n>3)return t;let r={...e};for(let[s,i]of Object.entries(t))i&&typeof i=="object"&&!Array.isArray(i)?r[s]=H1(r[s]||{},t[s],n+1):r[s]=t[s];return r}function wa(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function Ia(e){return globalThis.loaders?.modules?.[e]||null}function nT(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.1"),globalThis._loadersgl_.version}var Y1=nT();function W1(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var de={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Ev=de.self||de.window||de.global||{},Tv=de.window||de.self||de.global||{},_v=de.global||de.self||de.window||{},Sv=de.document||{};var cr=typeof process!="object"||String(process)!=="[object process]"||process.browser,Fi=typeof importScripts=="function",Bv=typeof window<"u"&&typeof window.orientation<"u",J1=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Cv=J1&&parseFloat(J1[1])||0;var ba={};async function me(e,t=null,n={},r=null){return t&&(e=X1(e,t,n,r)),ba[e]=ba[e]||rT(e),await ba[e]}function X1(e,t,n={},r=null){if(!n.useLocalLibraries&&e.startsWith("http"))return e;r=r||e;let s=n.modules||{};return s[r]?s[r]:cr?n.CDN?(W1(n.CDN.startsWith("http")),`${n.CDN}/${t}@${Y1}/dist/libs/${r}`):Fi?`../src/libs/${r}`:`modules/${t}/src/libs/${r}`:`modules/${t}/dist/libs/${r}`}async function rT(e){if(e.endsWith("wasm"))return await iT(e);if(!cr)try{let{requireFromFile:n}=globalThis.loaders||{};return await n?.(e)}catch(n){return console.error(n),null}if(Fi)return importScripts(e);let t=await oT(e);return sT(t,e)}function sT(e,t){if(!cr){let{requireFromString:r}=globalThis.loaders||{};return r?.(e,t)}if(Fi)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 iT(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return cr||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function oT(e){let{readFileAsText:t}=globalThis.loaders||{};return cr||!t||e.startsWith("http")?await(await fetch(e)).text():await t(e)}function K1(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?j1(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?j1(e,0,t):""}function j1(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 Oa(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${K1(e)}"`)}}function Ms(...e){let t=e,n=t&&t.length>1&&t[0].constructor||null;if(!n)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let r=t.reduce((o,c)=>o+c.length,0),s=new n(r),i=0;for(let o of t)s.set(o,i),i+=o.length;return s}function Rn(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 Xe(e,t){return z(e>=0),z(t>0),e+(t-1)&~(t-1)}function Pa(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+Xe(r.byteLength,4)}function As(){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 wn=class{constructor(t,n){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=n,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=As(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(As()-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 je=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,n="count"){return this._getOrCreate({name:t,type:n})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let n of Object.values(this.stats))t(n)}getTable(){let t={};return this.forEach(n=>{t[n.name]={time:n.time||0,count:n.count||0,average:n.getAverageTime()||0,hz:n.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(n=>this._getOrCreate(n))}_getOrCreate(t){let{name:n,type:r}=t,s=this.stats[n];return s||(t instanceof wn?s=t:s=new wn(n,r),this.stats[n]=s),s}};var cT="Queued Requests",aT="Active Requests",hT="Cancelled Requests",lT="Queued Requests Ever",fT="Active Requests Ever",pT={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},Ke=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...pT,...t},this.stats=new je({id:this.props.id}),this.stats.get(cT),this.stats.get(aT),this.stats.get(hT),this.stats.get(lT),this.stats.get(fT)}scheduleRequest(t,n=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let r={handle:t,priority:0,getPriority:n},s=new Promise(i=>(r.resolve=i,r));return this.requestQueue.push(r),this.requestMap.set(t,s),this._issueNewRequests(),s}_issueRequest(t){let{handle:n,resolve:r}=t,s=!1,i=()=>{s||(s=!0,this.requestMap.delete(n),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:i}):Promise.resolve({done:i})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let n=0;n<t;++n){let r=this.requestQueue.shift();r&&this._issueRequest(r)}}}_updateAllRequests(){let t=this.requestQueue;for(let n=0;n<t.length;++n){let r=t[n];this._updateRequest(r)||(t.splice(n,1),this.requestMap.delete(r.handle),n--)}t.sort((n,r)=>n.priority-r.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var Ze={};At(Ze,{dirname:()=>dT,filename:()=>uT,join:()=>mT,resolve:()=>gT});function Z1(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function uT(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function dT(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function mT(...e){let t="/";return e=e.map((n,r)=>(r&&(n=n.replace(new RegExp(`^${t}`),"")),r!==e.length-1&&(n=n.replace(new RegExp(`${t}$`),"")),n)),e.join(t)}function gT(...e){let t=[];for(let i=0;i<e.length;i++)t[i]=e[i];let n="",r=!1,s;for(let i=t.length-1;i>=-1&&!r;i--){let o;i>=0?o=t[i]:(s===void 0&&(s=Z1()),o=s),o.length!==0&&(n=`${o}/${n}`,r=o.charCodeAt(0)===ys)}return n=xT(n,!r),r?`/${n}`:n.length>0?n:"."}var ys=47,Na=46;function xT(e,t){let n="",r=-1,s=0,i,o=!1;for(let c=0;c<=e.length;++c){if(c<e.length)i=e.charCodeAt(c);else{if(i===ys)break;i=ys}if(i===ys){if(!(r===c-1||s===1))if(r!==c-1&&s===2){if(n.length<2||!o||n.charCodeAt(n.length-1)!==Na||n.charCodeAt(n.length-2)!==Na){if(n.length>2){let a=n.length-1,h=a;for(;h>=0&&n.charCodeAt(h)!==ys;--h);if(h!==a){n=h===-1?"":n.slice(0,h),r=c,s=0,o=!1;continue}}else if(n.length===2||n.length===1){n="",r=c,s=0,o=!1;continue}}t&&(n.length>0?n+="/..":n="..",o=!0)}else{let a=e.slice(r+1,c);n.length>0?n+=`/${a}`:n=a,o=!1}r=c,s=0}else i===Na&&s!==-1?++s:s=-1}return n}var vi=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=MT(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function MT(e){let t=e?.fetch;if(t&&typeof t=="function")return(r,s)=>t(r,s);let n=e?.fetch;return n&&typeof n!="function"?r=>fetch(r,n):r=>fetch(r)}var Wt=class extends vi{};sr(Wt,"type","template"),sr(Wt,"testURL",t=>!1);function Q1(e,t){let n=re.parseTextSync?.(e,t),r=n?.ServiceExceptionReport?.ServiceException||n?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof r=="string"?r:r.value||r.code||"Unknown error"}var AT="4.2.1",Es={dataType:null,batchType:null,id:"wms-error",name:"WMS Error",module:"wms",version:AT,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:yT,options:{wms:{throwOnError:!1}},parse:async(e,t)=>Fa(new TextDecoder().decode(e),t),parseSync:(e,t)=>Fa(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Fa(e,t)};function yT(e){return e.startsWith("<?xml")}function Fa(e,t){let n={...Es.options.wms,...t?.wms},r=Q1(e,n),s=n.minimalErrors?r:`WMS Service error: ${r}`;if(n.throwOnError)throw new Error(s);return s}function In(e){return Array.isArray(e)?e:e?[e]:[]}function Ts(e){let t=In(e);return t.length>0&&t.every(n=>typeof n=="string")?t:[]}function _s(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseFloat(e);default:return}}function Di(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseInt(e,10);default:return}}function bn(e){switch(e){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function va(e,t){let n=re.parseTextSync?.(e,t),r=n.WMT_MS_Capabilities||n.WMS_Capabilities||n,s=ET(r);if(t?.inheritedLayerProps)for(let i of s.layers)tp(i,null);return t?.includeRawJSON&&(s.json=r),t?.includeXMLText&&(s.xml=e),s}function ET(e){let t={version:String(e.version||""),name:String(e.Service?.Name||"unnamed"),title:e.Service?.Title?String(e.Service?.Title):void 0,abstract:e.Service?.Abstract?String(e.Service?.Abstract):void 0,keywords:Ts(e.Service?.KeywordList?.Keyword),fees:e.Service?.Fees?JSON.stringify(e.Service?.Fees):void 0,accessConstraints:e.Service?.AccessConstraints?JSON.stringify(e.Service?.AccessConstraints):void 0,layerLimit:Di(e.Service?.LayerLimit),maxWidth:Di(e.Service?.maxWidth),maxHeight:Di(e.Service?.maxHeight),layers:[],requests:TT(e.Capability?.Request),exceptions:_T(e.Exception)},n=In(e.Capability?.Layer);for(let r of n)t.layers.push($1(r));for(let[r,s]of Object.entries(t))s===void 0&&delete t[r];return t}function TT(e){let t={};for(let[n,r]of Object.entries(e||{})){let s=Ts(r?.Format);t[n]={mimeTypes:s}}return t}function _T(e){if(In(e?.Format).length>0)return{mimeTypes:Ts(e)}}function $1(e){let t={title:String(e?.Title||""),name:e?.Name&&String(e?.Name),abstract:e?.Name&&String(e?.Abstract),keywords:Ts(e.KeywordList?.Keyword)},n=e?.CRS||e?.SRS;n&&Array.isArray(n)&&n.every(h=>typeof h=="string")&&(t.crs=n);let r=e?.EX_GeographicBoundingBox&&ST(e?.EX_GeographicBoundingBox);r&&(t.geographicBoundingBox=r),r=e?.LatLonBoundingBox&&BT(e?.LatLonBoundingBox),r&&(t.geographicBoundingBox=r);let s=e?.BoundingBox&&CT(e?.BoundingBox);s&&s.length>0&&(t.boundingBoxes=s);let o=In(e?.Dimension).map(h=>RT(h));o.length&&(t.dimensions=o),e?.opaque&&(t.opaque=bn(e?.opaque)),e?.cascaded&&(t.cascaded=bn(e?.cascaded)),e?.queryable&&(t.queryable=bn(e?.queryable));let c=In(e?.Layer),a=[];for(let h of c)a.push($1(h));a.length>0&&(t.layers=a);for(let[h,l]of Object.entries(t))l===void 0&&delete t[h];return t}function ST(e){let{westBoundLongitude:t,northBoundLatitude:n,eastBoundLongitude:r,southBoundLatitude:s}=e;return[[t,s],[r,n]]}function BT(e){let{minx:t,miny:n,maxx:r,maxy:s}=e;return[[t,n],[r,s]]}function CT(e){return In(e).map(n=>LT(n))}function LT(e){let{CRS:t,SRS:n,minx:r,miny:s,maxx:i,maxy:o,resx:c,resy:a}=e,h={crs:t||n,boundingBox:[[_s(r),_s(s)],[_s(i),_s(o)]]};return c&&(h.xResolution=c),a&&(h.yResolution=a),h}function RT(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=bn(e.multipleValues)),e.nearestValue&&(s.nearestValue=bn(e.nearestValue)),e.current&&(s.current=bn(e.current)),s}function tp(e,t){t?.geographicBoundingBox&&!e.geographicBoundingBox&&(e.geographicBoundingBox=[...t.geographicBoundingBox]),t?.crs&&!e.crs&&(e.crs=[...t.crs]),t?.boundingBoxes&&!e.boundingBoxes&&(e.boundingBoxes=[...t.boundingBoxes]),t?.dimensions&&!e.dimensions&&(e.dimensions=[...t.dimensions]);for(let n of e.layers||[])tp(n,e)}var wT="4.2.1",ar={dataType:null,batchType:null,id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:wT,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:IT,options:{wms:{}},parse:async(e,t)=>va(new TextDecoder().decode(e),t?.wms),parseTextSync:(e,t)=>va(e,t?.wms)};function IT(e){return e.startsWith("<?xml")}function Da(e,t){let r=(re.parseTextSync?.(e,t)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(r)?r:[r]).map(i=>bT(i))}}function bT(e){return{attributes:e||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var ep={...ar,dataType:null,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(e,t)=>Da(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Da(e,t)};function Ua(e,t){return re.parseTextSync?.(e,t)}var np={...ar,dataType:null,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(e,t)=>Ua(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Ua(e,t)};function rp(e,t){let{type:n="auto"}=e,r=n==="auto"?PT(e.url,t):OT(n,t);if(!r)throw new Error("Not a valid image source type");return r.create(e)}function OT(e,t){for(let n of t)if(n.type===e)return n;return null}function PT(e,t){for(let n of t)if(n.testURL&&n.testURL(e))return n;return null}var sp="4.2.1";var NT=globalThis.loaders?.parseImageNode,Ga=typeof Image<"u",za=typeof ImageBitmap<"u",FT=Boolean(NT),ka=ms?!0:FT;function ip(e){switch(e){case"auto":return za||Ga||ka;case"imagebitmap":return za;case"image":return Ga;case"data":return ka;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function op(){if(za)return"imagebitmap";if(Ga)return"image";if(ka)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function cp(e){let t=vT(e);if(!t)throw new Error("Not an image");return t}function Ss(e){switch(cp(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 vT(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 DT=/^data:image\/svg\+xml/,UT=/\.svg((\?|#).*)?$/;function Ui(e){return e&&(DT.test(e)||UT.test(e))}function ap(e,t){if(Ui(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 Va(e,t)}function Va(e,t){if(Ui(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Gi(e,t,n){let r=ap(e,n),s=self.URL||self.webkitURL,i=typeof r!="string"&&s.createObjectURL(r);try{return await GT(i||r,t)}finally{i&&s.revokeObjectURL(i)}}async function GT(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 zT={},hp=!0;async function lp(e,t,n){let r;Ui(n)?r=await Gi(e,t,n):r=Va(e,n);let s=t&&t.imagebitmap;return await kT(r,s)}async function kT(e,t=null){if((VT(t)||!hp)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),hp=!1}return await createImageBitmap(e)}function VT(e){for(let t in e||zT)return!1;return!0}function fp(e){return!WT(e,"ftyp",4)||!(e[8]&96)?null:qT(e)}function qT(e){switch(HT(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function HT(e,t,n){return String.fromCharCode(...e.slice(t,n))}function YT(e){return[...e].map(t=>t.charCodeAt(0))}function WT(e,t,n=0){let r=YT(t);for(let s=0;s<r.length;++s)if(r[s]!==e[s+n])return!1;return!0}var ge=!1,Bs=!0;function On(e){let t=Cs(e);return XT(t)||ZT(t)||jT(t)||KT(t)||JT(t)}function JT(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=fp(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function XT(e){let t=Cs(e);return t.byteLength>=24&&t.getUint32(0,ge)===2303741511?{mimeType:"image/png",width:t.getUint32(16,ge),height:t.getUint32(20,ge)}:null}function jT(e){let t=Cs(e);return t.byteLength>=10&&t.getUint32(0,ge)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,Bs),height:t.getUint16(8,Bs)}:null}function KT(e){let t=Cs(e);return t.byteLength>=14&&t.getUint16(0,ge)===16973&&t.getUint32(2,Bs)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,Bs),height:t.getUint32(22,Bs)}:null}function ZT(e){let t=Cs(e);if(!(t.byteLength>=3&&t.getUint16(0,ge)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:s}=QT(),i=2;for(;i+9<t.byteLength;){let o=t.getUint16(i,ge);if(s.has(o))return{mimeType:"image/jpeg",height:t.getUint16(i+5,ge),width:t.getUint16(i+7,ge)};if(!r.has(o))return null;i+=2,i+=t.getUint16(i,ge)}return null}function QT(){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 Cs(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 pp(e,t){let{mimeType:n}=On(e)||{},r=globalThis.loaders?.parseImageNode;return z(r),await r(e,n)}async function up(e,t,n){t=t||{};let s=(t.image||{}).type||"auto",{url:i}=n||{},o=$T(s),c;switch(o){case"imagebitmap":c=await lp(e,t,i);break;case"image":c=await Gi(e,t,i);break;case"data":c=await pp(e,t);break;default:z(!1)}return s==="data"&&(c=Ss(c)),c}function $T(e){switch(e){case"auto":case"data":return op();default:return ip(e),e}}var t_=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],e_=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],n_={image:{type:"auto",decode:!0}},Qe={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:sp,mimeTypes:e_,extensions:t_,parse:up,tests:[e=>Boolean(On(new DataView(e)))],options:n_};var qa={};function Ha(e){if(qa[e]===void 0){let t=ms?s_(e):r_(e);qa[e]=t}return qa[e]}function r_(e){let t=["image/png","image/jpeg","image/gif"],n=globalThis.loaders?.imageFormatsNode||t,r=globalThis.loaders?.parseImageNode;return Boolean(r)&&n.includes(e)}function s_(e){switch(e){case"image/avif":case"image/webp":return i_(e);default:return!0}}function i_(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var dp={type:"wms",testURL:e=>e.toLowerCase().includes("wms"),create:e=>new Ya(e)},Ya=class extends Wt{url;data;substituteCRS84;flipCRS;wmsParameters;vendorParameters;capabilities=null;constructor(t){super(t),this.url=t.url,this.data=t.url,this.substituteCRS84=t.substituteCRS84??!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...t.wmsParameters},this.vendorParameters=t.vendorParameters||{}}async getMetadata(){let t=await this.getCapabilities();return this.normalizeMetadata(t)}async getImage(t){let{boundingBox:n,bbox:r,...s}=t,i={bbox:n?[...n[0],...n[1]]:r,...s};return await this.getMap(i)}normalizeMetadata(t){return t}async getCapabilities(t,n){let r=this.getCapabilitiesURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);let o=await ar.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 Qe.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 ep.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 np.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 Qe.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}getCapabilitiesURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetCapabilities",r,n)}getMapURL(t,n){t=this._getWMS130Parameters(t);let r={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetMap",r,n)}getFeatureInfoURL(t,n){t=this._getWMS130Parameters(t);let{boundingBox:r,bbox:s}=t;t.bbox=r?[...r[0],...r[1]]:s;let i={version:this.wmsParameters.version,info_format:this.wmsParameters.info_format,layers:this.wmsParameters.layers,query_layers:this.wmsParameters.query_layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetFeatureInfo",i,n)}describeLayerURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("DescribeLayer",r,n)}getLegendGraphicURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetLegendGraphic",r,n)}_parseWMSUrl(t){let[n,r]=t.split("?"),s=r.split("&"),i={};for(let o of s){let[c,a]=o.split("=");i[c]=a}return{url:n,parameters:i}}_getWMSUrl(t,n,r){let s=this.url,i=!0,o={service:"WMS",version:n.version,request:t,...n,...this.vendorParameters,...r},c=["transparent","time","elevation"];for(let[a,h]of Object.entries(o))(!c.includes(a)||h)&&(s+=i?"?":"&",i=!1,s+=this._getURLParameter(a,h,n));return encodeURI(s)}_getWMS130Parameters(t){let n={...t};return n.srs&&(n.crs=n.crs||n.srs,delete n.srs),n}_getURLParameter(t,n,r){switch(t){case"crs":r.version!=="1.3.0"?t="srs":this.substituteCRS84&&n==="EPSG:4326"&&(n="CRS:84");break;case"srs":r.version==="1.3.0"&&(t="crs");break;case"bbox":let s=this._flipBoundingBox(n,r);s&&(n=s);break;case"x":r.version==="1.3.0"&&(t="i");break;case"y":r.version==="1.3.0"&&(t="j");break;default:}return t=t.toUpperCase(),Array.isArray(n)?`${t}=${n.join(",")}`:`${t}=${n?String(n):""}`}_flipBoundingBox(t,n){if(!Array.isArray(t)||t.length!==4)return null;let r=n.version==="1.3.0"&&this.flipCRS.includes(n.crs||"")&&!(this.substituteCRS84&&n.crs==="EPSG:4326"),s=t;return r?[s[1],s[0],s[3],s[2]]:s}async _fetchArrayBuffer(t){let n=await this.fetch(t),r=await n.arrayBuffer();return this._checkResponse(n,r),r}_checkResponse(t,n){let r=t.headers["content-type"];if(!t.ok||Es.mimeTypes.includes(r)){let s=Ra(this.loadOptions,{wms:{throwOnError:!0}}),i=Es.parseSync?.(n,s);throw new Error(i)}}_parseError(t){let n=Es.parseSync?.(t,this.loadOptions);return new Error(n)}};var hr=class extends Wt{constructor(t){super(t)}async getMetadata(){throw new Error("ImageSource.getMetadata not implemented")}async getImage(t){let n=this.getGranularParameters(t),r=this.getURLFromTemplate(n),i=await(await this.fetch(r)).arrayBuffer();return await Qe.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}};sr(hr,"type","template"),sr(hr,"testURL",t=>t.toLowerCase().includes("{"));var Wa=class extends hr{data;constructor(t){super(t),this.data=t.url}async getMetadata(){return await this.metadata()}async getImage(t){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(t){throw new Error("not implemented")}metadataURL(t){return`${this.props.url}?f=pjson`}exportImageURL(t){let n=`bbox=${t.bbox[0]},${t.bbox[1]},${t.bbox[2]},${t.bbox[3]}`,r=`size=${t.width},${t.height}`,s={...t,bbox:n,size:r};return delete s.width,delete s.height,this.getUrl("exportImage",s)}getUrl(t,n,r){let s=`${this.props.url}/${t}`,i=!0;for(let[o,c]of Object.entries(n))s+=i?"?":"&",i=!1,Array.isArray(c)?s+=`${o.toUpperCase()}=${c.join(",")}`:s+=`${o.toUpperCase()}=${c?String(c):""}`;return s}async checkResponse(t){if(!t.ok)throw new Error("error")}},mp={type:"arcgis-image-server",testURL:e=>e.toLowerCase().includes("ImageServer"),create:e=>new Wa(e)};var o_=[dp,mp];function Ja(e){return rp(e,o_)}var K8=1/Math.PI*180,Z8=1/180*Math.PI,c_={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...c_}};var pt=globalThis.mathgl.config;function Xa(e,{precision:t=pt.precision}={}){return e=a_(e),`${parseFloat(e.toPrecision(t))}`}function xe(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function $e(e,t,n){return xe(e)?e.map((r,s)=>$e(r,t[s],n)):n*t+(1-n)*e}function Me(e,t,n){let r=pt.EPSILON;n&&(pt.EPSILON=n);try{if(e===t)return!0;if(xe(e)&&xe(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Me(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)<=pt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{pt.EPSILON=r}}function a_(e){return Math.round(e/pt.EPSILON)*pt.EPSILON}var tn=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:xe(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(pt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+Xa(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!Me(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(pt.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function h_(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 H(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function en(e,t,n=""){if(pt.debug&&!h_(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function Ae(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var lr=class extends tn{get x(){return this[0]}set x(t){this[0]=H(t)}get y(){return this[1]}set y(t){this[1]=H(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 H(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return H(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 Ae(t>=0&&t<this.ELEMENTS,"index is out of range"),H(this[t])}setComponent(t,n){return Ae(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 ot=typeof Float32Array<"u"?Float32Array:Array;var aD=Math.PI/180;function l_(){let e=new ot(2);return ot!=Float32Array&&(e[0]=0,e[1]=0),e}function Mp(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 Ap(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 hD=function(){let e=l_();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function yp(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 zi(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 Ep(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 Tp(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 ki(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function ja(){let e=new ot(3);return ot!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function f_(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function Ka(e,t,n){let r=new ot(3);return r[0]=e,r[1]=t,r[2]=n,r}function _p(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 Za(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function pr(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function ur(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 Vi(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 qi(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function Sp(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 Bp(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 Cp(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 Lp(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&Za(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var Rp=f_;var pD=function(){let e=ja();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var Qa=[0,0,0],Hi,O=class extends lr{static get ZERO(){return Hi||(Hi=new O(0,0,0),Object.freeze(Hi)),Hi}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&xe(t)?this.copy(t):(pt.debug&&(H(t),H(n),H(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 pt.debug&&(H(t.x),H(t.y),H(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]=H(t)}angle(t){return Lp(this,t)}cross(t){return pr(this,this,t),this.check()}rotateX({radians:t,origin:n=Qa}){return Sp(this,this,n,t),this.check()}rotateY({radians:t,origin:n=Qa}){return Bp(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=Qa}){return Cp(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return ur(this,this,t),this.check()}transformAsVector(t){return zi(this,this,t),this.check()}transformByMatrix3(t){return Vi(this,this,t),this.check()}transformByMatrix2(t){return Ep(this,this,t),this.check()}transformByQuaternion(t){return qi(this,this,t),this.check()}};var Yi,dr=class extends lr{static get ZERO(){return Yi||(Yi=new dr(0,0,0,0),Object.freeze(Yi)),Yi}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),xe(t)&&arguments.length===1?this.copy(t):(pt.debug&&(H(t),H(n),H(r),H(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 pt.debug&&(H(t.x),H(t.y),H(t.z),H(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]=H(t)}get w(){return this[3]}set w(t){this[3]=H(t)}transform(t){return ur(this,this,t),this.check()}transformByMatrix3(t){return ki(this,this,t),this.check()}transformByMatrix2(t){return Tp(this,this,t),this.check()}transformByQuaternion(t){return qi(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var mr=class extends tn{toString(){let t="[";if(pt.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=H(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 wp(){let e=new ot(9);return ot!=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 Ip(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 bp(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=l*o-c*h,p=-l*i+c*a,u=h*i-o*a,d=n*f+r*p+s*u;return d?(d=1/d,e[0]=f*d,e[1]=(-l*r+s*h)*d,e[2]=(c*r-s*o)*d,e[3]=p*d,e[4]=(l*n-s*a)*d,e[5]=(-c*n+s*i)*d,e[6]=u*d,e[7]=(-h*n+r*a)*d,e[8]=(o*n-r*i)*d,e):null}function Op(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8];return t*(h*i-o*a)+n*(-h*s+o*c)+r*(a*s-i*c)}function $a(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1],d=n[2],g=n[3],m=n[4],M=n[5],E=n[6],A=n[7],y=n[8];return e[0]=p*r+u*o+d*h,e[1]=p*s+u*c+d*l,e[2]=p*i+u*a+d*f,e[3]=g*r+m*o+M*h,e[4]=g*s+m*c+M*l,e[5]=g*i+m*a+M*f,e[6]=E*r+A*o+y*h,e[7]=E*s+A*c+y*l,e[8]=E*i+A*a+y*f,e}function Pp(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=p*r+u*o+h,e[7]=p*s+u*c+l,e[8]=p*i+u*a+f,e}function Np(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=Math.sin(n),u=Math.cos(n);return e[0]=u*r+p*o,e[1]=u*s+p*c,e[2]=u*i+p*a,e[3]=u*o-p*r,e[4]=u*c-p*s,e[5]=u*a-p*i,e[6]=h,e[7]=l,e[8]=f,e}function th(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 Fp(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[3]=l-M,e[6]=p+m,e[1]=l+M,e[4]=1-h-d,e[7]=u-g,e[2]=p-m,e[5]=u+g,e[8]=1-h-f,e}var eh;(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"})(eh||(eh={}));var d_=Object.freeze([1,0,0,0,1,0,0,0,1]),ct=class extends mr{static get IDENTITY(){return g_()}static get ZERO(){return m_()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return eh}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(d_)}fromObject(t){return this.check()}fromQuaternion(t){return Fp(this,t),this.check()}set(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=h,this.check()}determinant(){return Op(this)}transpose(){return Ip(this,this),this.check()}invert(){return bp(this,this),this.check()}multiplyLeft(t){return $a(this,t,this),this.check()}multiplyRight(t){return $a(this,this,t),this.check()}rotate(t){return Np(this,this,t),this.check()}scale(t){return Array.isArray(t)?th(this,this,t):th(this,this,[t,t]),this.check()}translate(t){return Pp(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=Mp(n||[-0,-0],t,this);break;case 3:r=Vi(n||[-0,-0,-0],t,this);break;case 4:r=ki(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return en(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)}},Wi,Ji=null;function m_(){return Wi||(Wi=new ct([0,0,0,0,0,0,0,0,0]),Object.freeze(Wi)),Wi}function g_(){return Ji||(Ji=new ct,Object.freeze(Ji)),Ji}var Rs={};At(Rs,{add:()=>k_,adjoint:()=>T_,clone:()=>M_,copy:()=>A_,create:()=>x_,decompose:()=>O_,determinant:()=>sh,equals:()=>Y_,exactEquals:()=>H_,frob:()=>z_,fromQuat:()=>fh,fromQuat2:()=>w_,fromRotation:()=>B_,fromRotationTranslation:()=>Dp,fromRotationTranslationScale:()=>P_,fromRotationTranslationScaleOrigin:()=>N_,fromScaling:()=>S_,fromTranslation:()=>__,fromValues:()=>y_,fromXRotation:()=>C_,fromYRotation:()=>L_,fromZRotation:()=>R_,frustum:()=>ph,getRotation:()=>b_,getScaling:()=>Up,getTranslation:()=>I_,identity:()=>vp,invert:()=>rh,lookAt:()=>mh,mul:()=>W_,multiply:()=>Ls,multiplyScalar:()=>V_,multiplyScalarAndAdd:()=>q_,ortho:()=>dh,orthoNO:()=>zp,orthoZO:()=>D_,perspective:()=>uh,perspectiveFromFieldOfView:()=>v_,perspectiveNO:()=>Gp,perspectiveZO:()=>F_,rotate:()=>ch,rotateX:()=>ah,rotateY:()=>hh,rotateZ:()=>lh,scale:()=>oh,set:()=>E_,str:()=>G_,sub:()=>J_,subtract:()=>kp,targetTo:()=>U_,translate:()=>ih,transpose:()=>nh});function x_(){let e=new ot(16);return ot!=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 M_(e){let t=new ot(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 A_(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 y_(e,t,n,r,s,i,o,c,a,h,l,f,p,u,d,g){let m=new ot(16);return m[0]=e,m[1]=t,m[2]=n,m[3]=r,m[4]=s,m[5]=i,m[6]=o,m[7]=c,m[8]=a,m[9]=h,m[10]=l,m[11]=f,m[12]=p,m[13]=u,m[14]=d,m[15]=g,m}function E_(e,t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=i,e[5]=o,e[6]=c,e[7]=a,e[8]=h,e[9]=l,e[10]=f,e[11]=p,e[12]=u,e[13]=d,e[14]=g,e[15]=m,e}function vp(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 nh(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function rh(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,B=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,w=f*M-u*g,I=p*M-u*m,C=E*I-A*w+y*R+T*x-_*S+L*B;return C?(C=1/C,e[0]=(c*I-a*w+h*R)*C,e[1]=(s*w-r*I-i*R)*C,e[2]=(g*L-m*_+M*T)*C,e[3]=(p*_-f*L-u*T)*C,e[4]=(a*x-o*I-h*S)*C,e[5]=(n*I-s*x+i*S)*C,e[6]=(m*y-d*L-M*A)*C,e[7]=(l*L-p*y+u*A)*C,e[8]=(o*w-c*x+h*B)*C,e[9]=(r*x-n*w-i*B)*C,e[10]=(d*_-g*y+M*E)*C,e[11]=(f*y-l*_-u*E)*C,e[12]=(c*S-o*R-a*B)*C,e[13]=(n*R-r*S+s*B)*C,e[14]=(g*A-d*T-m*E)*C,e[15]=(l*T-f*A+p*E)*C,e):null}function T_(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,B=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,w=f*M-u*g,I=p*M-u*m;return e[0]=c*I-a*w+h*R,e[1]=s*w-r*I-i*R,e[2]=g*L-m*_+M*T,e[3]=p*_-f*L-u*T,e[4]=a*x-o*I-h*S,e[5]=n*I-s*x+i*S,e[6]=m*y-d*L-M*A,e[7]=l*L-p*y+u*A,e[8]=o*w-c*x+h*B,e[9]=r*x-n*w-i*B,e[10]=d*_-g*y+M*E,e[11]=f*y-l*_-u*E,e[12]=c*S-o*R-a*B,e[13]=n*R-r*S+s*B,e[14]=g*A-d*T-m*E,e[15]=l*T-f*A+p*E,e}function sh(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8],l=e[9],f=e[10],p=e[11],u=e[12],d=e[13],g=e[14],m=e[15],M=t*o-n*i,E=t*c-r*i,A=n*c-r*o,y=h*d-l*u,T=h*g-f*u,_=l*g-f*d,L=t*_-n*T+r*y,B=i*_-o*T+c*y,S=h*A-l*E+f*M,x=u*A-d*E+g*M;return a*L-s*B+m*S-p*x}function Ls(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=t[9],u=t[10],d=t[11],g=t[12],m=t[13],M=t[14],E=t[15],A=n[0],y=n[1],T=n[2],_=n[3];return e[0]=A*r+y*c+T*f+_*g,e[1]=A*s+y*a+T*p+_*m,e[2]=A*i+y*h+T*u+_*M,e[3]=A*o+y*l+T*d+_*E,A=n[4],y=n[5],T=n[6],_=n[7],e[4]=A*r+y*c+T*f+_*g,e[5]=A*s+y*a+T*p+_*m,e[6]=A*i+y*h+T*u+_*M,e[7]=A*o+y*l+T*d+_*E,A=n[8],y=n[9],T=n[10],_=n[11],e[8]=A*r+y*c+T*f+_*g,e[9]=A*s+y*a+T*p+_*m,e[10]=A*i+y*h+T*u+_*M,e[11]=A*o+y*l+T*d+_*E,A=n[12],y=n[13],T=n[14],_=n[15],e[12]=A*r+y*c+T*f+_*g,e[13]=A*s+y*a+T*p+_*m,e[14]=A*i+y*h+T*u+_*M,e[15]=A*o+y*l+T*d+_*E,e}function ih(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,h,l,f,p,u,d,g,m,M;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],h=t[3],l=t[4],f=t[5],p=t[6],u=t[7],d=t[8],g=t[9],m=t[10],M=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=p,e[7]=u,e[8]=d,e[9]=g,e[10]=m,e[11]=M,e[12]=o*r+l*s+d*i+t[12],e[13]=c*r+f*s+g*i+t[13],e[14]=a*r+p*s+m*i+t[14],e[15]=h*r+u*s+M*i+t[15]),e}function oh(e,t,n){let r=n[0],s=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function ch(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,h,l,f,p,u,d,g,m,M,E,A,y,T,_,L,B,S,x,R,w,I,C,P;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,h=Math.sin(n),a=Math.cos(n),l=1-a,f=t[0],p=t[1],u=t[2],d=t[3],g=t[4],m=t[5],M=t[6],E=t[7],A=t[8],y=t[9],T=t[10],_=t[11],L=s*s*l+a,B=i*s*l+o*h,S=o*s*l-i*h,x=s*i*l-o*h,R=i*i*l+a,w=o*i*l+s*h,I=s*o*l+i*h,C=i*o*l-s*h,P=o*o*l+a,e[0]=f*L+g*B+A*S,e[1]=p*L+m*B+y*S,e[2]=u*L+M*B+T*S,e[3]=d*L+E*B+_*S,e[4]=f*x+g*R+A*w,e[5]=p*x+m*R+y*w,e[6]=u*x+M*R+T*w,e[7]=d*x+E*R+_*w,e[8]=f*I+g*C+A*P,e[9]=p*I+m*C+y*P,e[10]=u*I+M*C+T*P,e[11]=d*I+E*C+_*P,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function ah(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],h=t[8],l=t[9],f=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=i*s+h*r,e[5]=o*s+l*r,e[6]=c*s+f*r,e[7]=a*s+p*r,e[8]=h*s-i*r,e[9]=l*s-o*r,e[10]=f*s-c*r,e[11]=p*s-a*r,e}function hh(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[8],l=t[9],f=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s-h*r,e[1]=o*s-l*r,e[2]=c*s-f*r,e[3]=a*s-p*r,e[8]=i*r+h*s,e[9]=o*r+l*s,e[10]=c*r+f*s,e[11]=a*r+p*s,e}function lh(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[4],l=t[5],f=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s+h*r,e[1]=o*s+l*r,e[2]=c*s+f*r,e[3]=a*s+p*r,e[4]=h*s-i*r,e[5]=l*s-o*r,e[6]=f*s-c*r,e[7]=p*s-a*r,e}function __(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 S_(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 B_(e,t,n){let r=n[0],s=n[1],i=n[2],o=Math.sqrt(r*r+s*s+i*i),c,a,h;return o<1e-6?null:(o=1/o,r*=o,s*=o,i*=o,a=Math.sin(t),c=Math.cos(t),h=1-c,e[0]=r*r*h+c,e[1]=s*r*h+i*a,e[2]=i*r*h-s*a,e[3]=0,e[4]=r*s*h-i*a,e[5]=s*s*h+c,e[6]=i*s*h+r*a,e[7]=0,e[8]=r*i*h+s*a,e[9]=s*i*h-r*a,e[10]=i*i*h+c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function C_(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 L_(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 R_(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 Dp(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=r+r,a=s+s,h=i+i,l=r*c,f=r*a,p=r*h,u=s*a,d=s*h,g=i*h,m=o*c,M=o*a,E=o*h;return e[0]=1-(u+g),e[1]=f+E,e[2]=p-M,e[3]=0,e[4]=f-E,e[5]=1-(l+g),e[6]=d+m,e[7]=0,e[8]=p+M,e[9]=d-m,e[10]=1-(l+u),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function w_(e,t){let n=new ot(3),r=-t[0],s=-t[1],i=-t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=r*r+s*s+i*i+o*o;return f>0?(n[0]=(c*o+l*r+a*i-h*s)*2/f,n[1]=(a*o+l*s+h*r-c*i)*2/f,n[2]=(h*o+l*i+c*s-a*r)*2/f):(n[0]=(c*o+l*r+a*i-h*s)*2,n[1]=(a*o+l*s+h*r-c*i)*2,n[2]=(h*o+l*i+c*s-a*r)*2),Dp(e,t,n),e}function I_(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Up(e,t){let n=t[0],r=t[1],s=t[2],i=t[4],o=t[5],c=t[6],a=t[8],h=t[9],l=t[10];return e[0]=Math.sqrt(n*n+r*r+s*s),e[1]=Math.sqrt(i*i+o*o+c*c),e[2]=Math.sqrt(a*a+h*h+l*l),e}function b_(e,t){let n=new ot(3);Up(n,t);let r=1/n[0],s=1/n[1],i=1/n[2],o=t[0]*r,c=t[1]*s,a=t[2]*i,h=t[4]*r,l=t[5]*s,f=t[6]*i,p=t[8]*r,u=t[9]*s,d=t[10]*i,g=o+l+d,m=0;return g>0?(m=Math.sqrt(g+1)*2,e[3]=.25*m,e[0]=(f-u)/m,e[1]=(p-a)/m,e[2]=(c-h)/m):o>l&&o>d?(m=Math.sqrt(1+o-l-d)*2,e[3]=(f-u)/m,e[0]=.25*m,e[1]=(c+h)/m,e[2]=(p+a)/m):l>d?(m=Math.sqrt(1+l-o-d)*2,e[3]=(p-a)/m,e[0]=(c+h)/m,e[1]=.25*m,e[2]=(f+u)/m):(m=Math.sqrt(1+d-o-l)*2,e[3]=(c-h)/m,e[0]=(p+a)/m,e[1]=(f+u)/m,e[2]=.25*m),e}function O_(e,t,n,r){t[0]=r[12],t[1]=r[13],t[2]=r[14];let s=r[0],i=r[1],o=r[2],c=r[4],a=r[5],h=r[6],l=r[8],f=r[9],p=r[10];n[0]=Math.sqrt(s*s+i*i+o*o),n[1]=Math.sqrt(c*c+a*a+h*h),n[2]=Math.sqrt(l*l+f*f+p*p);let u=1/n[0],d=1/n[1],g=1/n[2],m=s*u,M=i*d,E=o*g,A=c*u,y=a*d,T=h*g,_=l*u,L=f*d,B=p*g,S=m+y+B,x=0;return S>0?(x=Math.sqrt(S+1)*2,e[3]=.25*x,e[0]=(T-L)/x,e[1]=(_-E)/x,e[2]=(M-A)/x):m>y&&m>B?(x=Math.sqrt(1+m-y-B)*2,e[3]=(T-L)/x,e[0]=.25*x,e[1]=(M+A)/x,e[2]=(_+E)/x):y>B?(x=Math.sqrt(1+y-m-B)*2,e[3]=(_-E)/x,e[0]=(M+A)/x,e[1]=.25*x,e[2]=(T+L)/x):(x=Math.sqrt(1+B-m-y)*2,e[3]=(M-A)/x,e[0]=(_+E)/x,e[1]=(T+L)/x,e[2]=.25*x),e}function P_(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=s+s,h=i+i,l=o+o,f=s*a,p=s*h,u=s*l,d=i*h,g=i*l,m=o*l,M=c*a,E=c*h,A=c*l,y=r[0],T=r[1],_=r[2];return e[0]=(1-(d+m))*y,e[1]=(p+A)*y,e[2]=(u-E)*y,e[3]=0,e[4]=(p-A)*T,e[5]=(1-(f+m))*T,e[6]=(g+M)*T,e[7]=0,e[8]=(u+E)*_,e[9]=(g-M)*_,e[10]=(1-(f+d))*_,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function N_(e,t,n,r,s){let i=t[0],o=t[1],c=t[2],a=t[3],h=i+i,l=o+o,f=c+c,p=i*h,u=i*l,d=i*f,g=o*l,m=o*f,M=c*f,E=a*h,A=a*l,y=a*f,T=r[0],_=r[1],L=r[2],B=s[0],S=s[1],x=s[2],R=(1-(g+M))*T,w=(u+y)*T,I=(d-A)*T,C=(u-y)*_,P=(1-(p+M))*_,V=(m+E)*_,G=(d+A)*L,Q=(m-E)*L,q=(1-(p+g))*L;return e[0]=R,e[1]=w,e[2]=I,e[3]=0,e[4]=C,e[5]=P,e[6]=V,e[7]=0,e[8]=G,e[9]=Q,e[10]=q,e[11]=0,e[12]=n[0]+B-(R*B+C*S+G*x),e[13]=n[1]+S-(w*B+P*S+Q*x),e[14]=n[2]+x-(I*B+V*S+q*x),e[15]=1,e}function fh(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[1]=l+M,e[2]=p-m,e[3]=0,e[4]=l-M,e[5]=1-h-d,e[6]=u+g,e[7]=0,e[8]=p+m,e[9]=u-g,e[10]=1-h-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ph(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),h=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*h,e[15]=0,e}function Gp(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 uh=Gp;function F_(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 v_(e,t,n,r){let s=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),c=Math.tan(t.rightDegrees*Math.PI/180),a=2/(o+c),h=2/(s+i);return e[0]=a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=h,e[6]=0,e[7]=0,e[8]=-((o-c)*a*.5),e[9]=(s-i)*h*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function zp(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*h,e[15]=1,e}var dh=zp;function D_(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=i*h,e[15]=1,e}function mh(e,t,n,r){let s,i,o,c,a,h,l,f,p,u,d=t[0],g=t[1],m=t[2],M=r[0],E=r[1],A=r[2],y=n[0],T=n[1],_=n[2];return Math.abs(d-y)<1e-6&&Math.abs(g-T)<1e-6&&Math.abs(m-_)<1e-6?vp(e):(f=d-y,p=g-T,u=m-_,s=1/Math.sqrt(f*f+p*p+u*u),f*=s,p*=s,u*=s,i=E*u-A*p,o=A*f-M*u,c=M*p-E*f,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-u*o,h=u*i-f*c,l=f*o-p*i,s=Math.sqrt(a*a+h*h+l*l),s?(s=1/s,a*=s,h*=s,l*=s):(a=0,h=0,l=0),e[0]=i,e[1]=a,e[2]=f,e[3]=0,e[4]=o,e[5]=h,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=0,e[12]=-(i*d+o*g+c*m),e[13]=-(a*d+h*g+l*m),e[14]=-(f*d+p*g+u*m),e[15]=1,e)}function U_(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=r[0],a=r[1],h=r[2],l=s-n[0],f=i-n[1],p=o-n[2],u=l*l+f*f+p*p;u>0&&(u=1/Math.sqrt(u),l*=u,f*=u,p*=u);let d=a*p-h*f,g=h*l-c*p,m=c*f-a*l;return u=d*d+g*g+m*m,u>0&&(u=1/Math.sqrt(u),d*=u,g*=u,m*=u),e[0]=d,e[1]=g,e[2]=m,e[3]=0,e[4]=f*m-p*g,e[5]=p*d-l*m,e[6]=l*g-f*d,e[7]=0,e[8]=l,e[9]=f,e[10]=p,e[11]=0,e[12]=s,e[13]=i,e[14]=o,e[15]=1,e}function G_(e){return`mat4(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]}, ${e[4]}, ${e[5]}, ${e[6]}, ${e[7]}, ${e[8]}, ${e[9]}, ${e[10]}, ${e[11]}, ${e[12]}, ${e[13]}, ${e[14]}, ${e[15]})`}function z_(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 k_(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 kp(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 V_(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 q_(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 H_(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 Y_(e,t){let n=e[0],r=e[1],s=e[2],i=e[3],o=e[4],c=e[5],a=e[6],h=e[7],l=e[8],f=e[9],p=e[10],u=e[11],d=e[12],g=e[13],m=e[14],M=e[15],E=t[0],A=t[1],y=t[2],T=t[3],_=t[4],L=t[5],B=t[6],S=t[7],x=t[8],R=t[9],w=t[10],I=t[11],C=t[12],P=t[13],V=t[14],G=t[15];return Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(r-A)<=1e-6*Math.max(1,Math.abs(r),Math.abs(A))&&Math.abs(s-y)<=1e-6*Math.max(1,Math.abs(s),Math.abs(y))&&Math.abs(i-T)<=1e-6*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(o-_)<=1e-6*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(c-L)<=1e-6*Math.max(1,Math.abs(c),Math.abs(L))&&Math.abs(a-B)<=1e-6*Math.max(1,Math.abs(a),Math.abs(B))&&Math.abs(h-S)<=1e-6*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(l-x)<=1e-6*Math.max(1,Math.abs(l),Math.abs(x))&&Math.abs(f-R)<=1e-6*Math.max(1,Math.abs(f),Math.abs(R))&&Math.abs(p-w)<=1e-6*Math.max(1,Math.abs(p),Math.abs(w))&&Math.abs(u-I)<=1e-6*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(d-C)<=1e-6*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(g-P)<=1e-6*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(m-V)<=1e-6*Math.max(1,Math.abs(m),Math.abs(V))&&Math.abs(M-G)<=1e-6*Math.max(1,Math.abs(M),Math.abs(G))}var W_=Ls,J_=kp;function X_(){let e=new ot(4);return ot!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Vp(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 qp(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 Hp(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 Yp(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function Wp(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 Jp(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Xp(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function jp(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 Kp(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2],h=n[3],l=h*r+c*i-a*s,f=h*s+a*r-o*i,p=h*i+o*s-c*r,u=-o*r-c*s-a*i;return e[0]=l*h+u*-o+f*-a-p*-c,e[1]=f*h+u*-c+p*-o-l*-a,e[2]=p*h+u*-a+l*-c-f*-o,e[3]=t[3],e}var vD=function(){let e=X_();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var Mh;(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"})(Mh||(Mh={}));var K_=45*Math.PI/180,Z_=1,gh=.1,xh=500,Q_=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Ht=class extends mr{static get IDENTITY(){return tS()}static get ZERO(){return $_()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Mh}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this[9]=l,this[10]=f,this[11]=p,this[12]=u,this[13]=d,this[14]=g,this[15]=m,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=i,this[2]=h,this[3]=u,this[4]=n,this[5]=o,this[6]=l,this[7]=d,this[8]=r,this[9]=c,this[10]=f,this[11]=g,this[12]=s,this[13]=a,this[14]=p,this[15]=m,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(Q_)}fromObject(t){return this.check()}fromQuaternion(t){return fh(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=gh,far:c=xh}=t;return c===1/0?eS(this,n,r,s,i,o):ph(this,n,r,s,i,o,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return mh(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=gh,far:c=xh}=t;return dh(this,n,r,s,i,o,c),this.check()}orthographic(t){let{fovy:n=K_,aspect:r=Z_,focalDistance:s=1,near:i=gh,far:o=xh}=t;Zp(n);let c=n/2,a=s*Math.tan(c),h=a*r;return this.ortho({left:-h,right:h,bottom:-a,top:a,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return Zp(n),uh(this,n,r,s,i),this.check()}determinant(){return sh(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 nh(this,this),this.check()}invert(){return rh(this,this),this.check()}multiplyLeft(t){return Ls(this,t,this),this.check()}multiplyRight(t){return Ls(this,this,t),this.check()}rotateX(t){return ah(this,this,t),this.check()}rotateY(t){return hh(this,this,t),this.check()}rotateZ(t){return lh(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return ch(this,this,t,n),this.check()}scale(t){return oh(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return ih(this,this,t),this.check()}transform(t,n){return t.length===4?(n=jp(n||[-0,-0,-0,-0],t,this),en(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=Ap(n||[-0,-0],t,this);break;case 3:s=ur(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return en(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=yp(n||[-0,-0],t,this);break;case 3:r=zi(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return en(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])}},Xi,ji;function $_(){return Xi||(Xi=new Ht([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Xi)),Xi}function tS(){return ji||(ji=new Ht,Object.freeze(ji)),ji}function Zp(e){if(e>Math.PI*2)throw Error("expected radians")}function eS(e,t,n,r,s,i){let o=2*i/(n-t),c=2*i/(s-r),a=(n+t)/(n-t),h=(s+r)/(s-r),l=-1,f=-1,p=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=h,e[10]=l,e[11]=f,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function Qp(){let e=new ot(4);return ot!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function $p(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Ah(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 yh(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*l+o*c+s*h-i*a,e[1]=s*l+o*a+i*c-r*h,e[2]=i*l+o*h+r*a-s*c,e[3]=o*l-r*c-s*a-i*h,e}function tu(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function eu(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function nu(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function ru(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 ws(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],h=n[1],l=n[2],f=n[3],p,u,d,g,m;return p=s*a+i*h+o*l+c*f,p<0&&(p=-p,a=-a,h=-h,l=-l,f=-f),1-p>1e-6?(u=Math.acos(p),m=Math.sin(u),d=Math.sin((1-r)*u)/m,g=Math.sin(r*u)/m):(d=1-r,g=r),e[0]=d*s+g*a,e[1]=d*i+g*h,e[2]=d*o+g*l,e[3]=d*c+g*f,e}function su(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function iu(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Eh(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 ou=Vp;var cu=qp,au=Jp,hu=Xp,lu=Hp;var fu=Yp;var pu=Wp;var uu=function(){let e=ja(),t=Ka(1,0,0),n=Ka(0,1,0);return function(r,s,i){let o=Za(s,i);return o<-.999999?(pr(e,t,s),Rp(e)<1e-6&&pr(e,n,s),_p(e,e),Ah(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(pr(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,pu(r,r))}}(),KD=function(){let e=Qp(),t=Qp();return function(n,r,s,i,o,c){return ws(e,r,o,c),ws(t,s,i,c),ws(n,e,t,2*c*(1-c)),n}}(),ZD=function(){let e=wp();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],pu(t,Eh(t,e))}}();var nS=[0,0,0,1],gr=class extends tn{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 Eh(this,t),this.check()}fromAxisRotation(t,n){return Ah(this,t,n),this.check()}identity(){return $p(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]=H(t)}get y(){return this[1]}set y(t){this[1]=H(t)}get z(){return this[2]}set z(t){this[2]=H(t)}get w(){return this[3]}set w(t){this[3]=H(t)}len(){return lu(this)}lengthSquared(){return fu(this)}dot(t){return au(this,t)}rotationTo(t,n){return uu(this,t,n),this.check()}add(t){return ou(this,this,t),this.check()}calculateW(){return ru(this,this),this.check()}conjugate(){return iu(this,this),this.check()}invert(){return su(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(hu(this,t,n,r),this.check())}multiplyRight(t){return yh(this,this,t),this.check()}multiplyLeft(t){return yh(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 tu(this,this,t),this.check()}rotateY(t){return eu(this,this,t),this.check()}rotateZ(t){return nu(this,this,t),this.check()}scale(t){return cu(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=nS,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return ws(this,s,i,o),this.check()}transformVector4(t,n=new dr){return Kp(n,t,this),en(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 xr={};At(xr,{EPSILON1:()=>rS,EPSILON10:()=>pS,EPSILON11:()=>uS,EPSILON12:()=>dS,EPSILON13:()=>mS,EPSILON14:()=>gS,EPSILON15:()=>xS,EPSILON16:()=>MS,EPSILON17:()=>AS,EPSILON18:()=>yS,EPSILON19:()=>ES,EPSILON2:()=>sS,EPSILON20:()=>TS,EPSILON3:()=>iS,EPSILON4:()=>oS,EPSILON5:()=>cS,EPSILON6:()=>aS,EPSILON7:()=>hS,EPSILON8:()=>lS,EPSILON9:()=>fS,PI_OVER_FOUR:()=>SS,PI_OVER_SIX:()=>BS,PI_OVER_TWO:()=>_S,TWO_PI:()=>CS});var rS=.1,sS=.01,iS=.001,oS=1e-4,cS=1e-5,aS=1e-6,hS=1e-7,lS=1e-8,fS=1e-9,pS=1e-10,uS=1e-11,dS=1e-12,mS=1e-13,gS=1e-14,xS=1e-15,MS=1e-16,AS=1e-17,yS=1e-18,ES=1e-19,TS=1e-20,_S=Math.PI/2,SS=Math.PI/4,BS=Math.PI/6,CS=Math.PI*2;function Ki(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var se=Math.PI,xu=se/4,du=se/180,mu=180/se,Zi=512;function Ie(e){let[t,n]=e;Ki(Number.isFinite(t)),Ki(Number.isFinite(n)&&n>=-90&&n<=90,"invalid latitude");let r=t*du,s=n*du,i=Zi*(r+se)/(2*se),o=Zi*(se+Math.log(Math.tan(xu+s*.5)))/(2*se);return[i,o]}function be(e){let[t,n]=e,r=t/Zi*(2*se)-se,s=2*(Math.atan(Math.exp(n/Zi*(2*se)-se))-xu);return[r*mu,s*mu]}var U6=Math.PI/180;var Au=6378137*Math.PI;function Th(e){let t=Ie(e);return t[0]=(t[0]/256-1)*Au,t[1]=(t[1]/256-1)*Au,t}var VS={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)}},Mr=class extends Pn.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,Pn._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 yu.BitmapLayer({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:r.srs==="EPSG:4326"?Pn.COORDINATE_SYSTEM.LNGLAT:Pn.COORDINATE_SYSTEM.CARTESIAN,bounds:t,image:n})}async getFeatureInfoText(t,n){let{lastRequestParameters:r}=this.state;return r?await this.state.imageSource.getFeatureInfoText?.({...r,query_layers:r.layers,x:t,y:n,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(t){if(t.data instanceof Wt)return t.data;if(typeof t.data=="string")return Ja({url:t.data,loadOptions:t.loadOptions,type:t.serviceType});throw new Error("invalid image source in props.data")}async _loadMetadata(){let{imageSource:t}=this.state;try{this.state.loadCounter++;let n=await t.getMetadata();this.state.imageSource===t&&this.getCurrentLayer()?.props.onMetadataLoad(n)}catch(n){this.getCurrentLayer()?.props.onMetadataLoadError(n)}finally{this.state.loadCounter--}}async loadImage(t,n){let{layers:r,serviceType:s}=this.props;if(s==="wms"&&r.length===0)return;let i=t.getBounds(),{width:o,height:c}=t,a=this.getRequestId(),{srs:h}=this.props;h==="auto"&&(h=t.resolution?"EPSG:4326":"EPSG:3857");let l={width:o,height:c,boundingBox:[[i[0],i[1]],[i[2],i[3]]],layers:r,crs:h};if(h==="EPSG:3857"){let f=Th([i[0],i[1]]),p=Th([i[2],i[3]]);l.boundingBox=[f,p]}try{this.state.loadCounter++,this.props.onImageLoadStart(a);let f=await this.state.imageSource.getImage(l);this.state.lastRequestId<a&&(this.getCurrentLayer()?.props.onImageLoad(a),this.setState({image:f,bounds:i,lastRequestParameters:l,lastRequestId:a}))}catch(f){this.raiseError(f,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(a,f)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(t,n=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>t(),n)}};Mr.layerName="WMSLayer";Mr.defaultProps=VS;var Eu=D(ee(),1),qS={getHeight:{type:"accessor",value:0},greatCircle:!0},Is=class extends Eu.ArcLayer{};Is.layerName="GreatCircleLayer";Is.defaultProps=qS;var Tu=Is;var _u=D(ne(),1),_h=D(ee(),1),HS={..._h.PolygonLayer.defaultProps},bs=class extends _u.CompositeLayer{indexToBounds(){return null}renderLayers(){let{elevationScale:t,extruded:n,wireframe:r,filled:s,stroked:i,lineWidthUnits:o,lineWidthScale:c,lineWidthMinPixels:a,lineWidthMaxPixels:h,lineJointRounded:l,lineMiterLimit:f,lineDashJustified:p,getElevation:u,getFillColor:d,getLineColor:g,getLineWidth:m}=this.props,{updateTriggers:M,material:E,transitions:A}=this.props,y=this.getSubLayerClass("cell",_h.PolygonLayer),{updateTriggers:T,..._}=this.indexToBounds()||{};return new y({filled:s,wireframe:r,extruded:n,elevationScale:t,stroked:i,lineWidthUnits:o,lineWidthScale:c,lineWidthMinPixels:a,lineWidthMaxPixels:h,lineJointRounded:l,lineMiterLimit:f,lineDashJustified:p,material:E,transitions:A,getElevation:u,getFillColor:d,getLineColor:g,getLineWidth:m},this.getSubLayerProps({id:"cell",updateTriggers:M&&{...T,getElevation:M.getElevation,getFillColor:M.getFillColor,getLineColor:M.getLineColor,getLineWidth:M.getLineWidth}}),_)}};bs.layerName="GeoCellLayer";bs.defaultProps=HS;var ye=bs;var Qi=D(Sh(),1),YS=3,WS=30,JS=2*WS+1,Bu=180/Math.PI;function Lu(e,t,n){let r=1<<t;return[(e[0]+n[0])/r,(e[1]+n[1])/r]}function Cu(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Ru(e){return[Cu(e[0]),Cu(e[1])]}function wu(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 Iu([e,t,n]){let r=Math.atan2(n,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*Bu,r*Bu]}function bu(e){let t=Qi.default.fromString(e,!0,10).toString(2);for(;t.length<YS+JS;)t="0"+t;let n=t.lastIndexOf("1"),r=t.substring(0,3),s=t.substring(3,n),i=s.length/2,o=Qi.default.fromString(r,!0,2).toString(10),c=Qi.default.fromString(s,!0,2).toString(4);for(;c.length<i;)c="0"+c;return`${o}/${c}`}function XS(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 Ou(e){let t=e.split("/"),n=parseInt(t[0],10),r=t[1],s=r.length,i=[0,0],o;for(let c=s-1;c>=0;c--){o=s-c;let a=r[c],h=0,l=0;a==="1"?l=1:a==="2"?(h=1,l=1):a==="3"&&(h=1);let f=Math.pow(2,o-1);XS(f,i,h,l),i[0]+=f*h,i[1]+=f*l}if(n%2===1){let c=i[0];i[0]=i[1],i[1]=c}return{face:n,ij:i,level:o}}var Pu=D(Sh(),1);function jS(e){let t=e.padEnd(16,"0");return Pu.default.fromString(t,16)}var KS=100;function ZS({face:e,ij:t,level:n}){let r=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(KS*Math.pow(2,-n))),i=new Float64Array(4*s*2+2),o=0,c=0;for(let a=0;a<4;a++){let h=r[a].slice(0),l=r[a+1],f=(l[0]-h[0])/s,p=(l[1]-h[1])/s;for(let u=0;u<s;u++){h[0]+=f,h[1]+=p;let d=Lu(t,n,h),g=Ru(d),m=wu(e,g),M=Iu(m);Math.abs(M[1])>89.999&&(M[0]=c);let E=M[0]-c;M[0]+=E>180?-360:E<-180?360:0,i[o++]=M[0],i[o++]=M[1],c=M[0]}}return i[o++]=i[0],i[o++]=i[1],i}function QS(e){if(typeof e=="string"){if(e.indexOf("/")>0)return e;e=jS(e)}return bu(e.toString())}function Nu(e){let t=QS(e),n=Ou(t);return ZS(n)}var $S={getS2Token:{type:"accessor",value:e=>e.token}},Ps=class extends ye{indexToBounds(){let{data:t,getS2Token:n}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(r,s)=>Nu(n(r,s))}}};Ps.layerName="S2Layer";Ps.defaultProps=$S;var Fu=Ps;var Bh=512;function tB(e,t){let n=0,r=0,s=1<<e.length,i=s/Bh;for(let o=0;o<e.length;o++){s>>=1;let c=parseInt(e[o]);c%2&&(n|=s),c>1&&(r|=s)}return[[n/i,Bh-r/i],[(n+t)/i,Bh-(r+t)/i]]}function vu(e,t=1){let[n,r]=tB(e,t),[s,i]=be(n),[o,c]=be(r);return[o,i,o,c,s,c,s,i,o,i]}var eB={getQuadkey:{type:"accessor",value:e=>e.quadkey}},Ns=class extends ye{indexToBounds(){let{data:t,extruded:n,getQuadkey:r}=this.props,s=n?.99:1;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(i,o)=>vu(r(i,o),s),updateTriggers:{getPolygon:s}}}};Ns.layerName="QuadkeyLayer";Ns.defaultProps=eB;var Du=Ns;var io=D(ne(),1),ed=D(ee(),1);var Nn=class{constructor(t){this.index=t,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(t){this._bbox||(this._bbox=t,"west"in t?this.boundingBox=[[t.west,t.south],[t.east,t.north]]:this.boundingBox=[[t.left,t.top],[t.right,t.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error("byteLength not defined in tile data"),t}async _loadData({getData:t,requestScheduler:n,onLoad:r,onError:s}){let{index:i,id:o,bbox:c,userData:a,zoom:h}=this,l=this._loaderId;this._abortController=new AbortController;let{signal:f}=this._abortController,p=await n.scheduleRequest(this,g=>g.isSelected?1:-1);if(!p){this._isCancelled=!0;return}if(this._isCancelled){p.done();return}let u=null,d;try{u=await t({index:i,id:o,bbox:c,userData:a,zoom:h,signal:f})}catch(g){d=g||!0}finally{p.done()}if(l===this._loaderId){if(this._loader=void 0,this.content=u,this._isCancelled&&!u){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,d?s(d,this):r(this)}}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var vs=D(ne(),1);var ut={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var Uu=new O,nB=new O,nn=class{constructor(t=[0,0,0],n=[0,0,0],r){r=r||Uu.copy(t).add(n).scale(.5),this.center=new O(r),this.halfDiagonal=new O(n).subtract(this.center),this.minimum=new O(t),this.maximum=new O(n)}clone(){return new nn(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=nB.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?ut.INSIDE:i+s<0?ut.OUTSIDE:ut.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=Uu.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 Fs=new O,Gu=new O,rn=class{constructor(t=[0,0,0],n=0){this.radius=-0,this.center=new O,this.fromCenterRadius(t,n)}fromCenterRadius(t,n){return this.center.from(t),this.radius=n,this}fromCornerPoints(t,n){return n=Fs.from(n),this.center=new O().from(t).add(n).scale(.5),this.radius=this.center.distance(n),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new rn(this.center,this.radius)}union(t){let n=this.center,r=this.radius,s=t.center,i=t.radius,o=Fs.copy(s).subtract(n),c=o.magnitude();if(r>=c+i)return this.clone();if(i>=c+r)return t.clone();let a=(r+c+i)*.5;return Gu.copy(o).scale((-r+a)/c).add(n),this.center.copy(Gu),this.radius=a,this}expand(t){let r=Fs.from(t).subtract(this.center).magnitude();return r>this.radius&&(this.radius=r),this}transform(t){this.center.transform(t);let n=Rs.getScaling(Fs,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=Fs.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?ut.OUTSIDE:i<r?ut.INTERSECTING:ut.INSIDE}};var rB=new O,sB=new O,$i=new O,to=new O,eo=new O,iB=new O,oB=new O,Oe={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Fn=class{constructor(t=[0,0,0],n=[0,0,0,0,0,0,0,0,0]){this.center=new O().from(t),this.halfAxes=new ct(n)}get halfSize(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new O(t).len(),new O(n).len(),new O(r).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),s=new O(t).normalize(),i=new O(n).normalize(),o=new O(r).normalize();return new gr().fromMatrix3(new ct([...s,...i,...o]))}fromCenterHalfSizeQuaternion(t,n,r){let s=new gr(r),i=new ct().fromQuaternion(s);return i[0]=i[0]*n[0],i[1]=i[1]*n[0],i[2]=i[2]*n[0],i[3]=i[3]*n[1],i[4]=i[4]*n[1],i[5]=i[5]*n[1],i[6]=i[6]*n[2],i[7]=i[7]*n[2],i[8]=i[8]*n[2],this.center=new O().from(t),this.halfAxes=i,this}clone(){return new Fn(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new rn){let n=this.halfAxes,r=n.getColumn(0,$i),s=n.getColumn(1,to),i=n.getColumn(2,eo),o=rB.copy(r).add(s).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let n=this.center,r=t.normal,s=this.halfAxes,i=r.x,o=r.y,c=r.z,a=Math.abs(i*s[Oe.COLUMN0ROW0]+o*s[Oe.COLUMN0ROW1]+c*s[Oe.COLUMN0ROW2])+Math.abs(i*s[Oe.COLUMN1ROW0]+o*s[Oe.COLUMN1ROW1]+c*s[Oe.COLUMN1ROW2])+Math.abs(i*s[Oe.COLUMN2ROW0]+o*s[Oe.COLUMN2ROW1]+c*s[Oe.COLUMN2ROW2]),h=r.dot(n)+t.distance;return h<=-a?ut.OUTSIDE:h>=a?ut.INSIDE:ut.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=sB.from(t).subtract(this.center),r=this.halfAxes,s=r.getColumn(0,$i),i=r.getColumn(1,to),o=r.getColumn(2,eo),c=s.magnitude(),a=i.magnitude(),h=o.magnitude();s.normalize(),i.normalize(),o.normalize();let l=0,f;return f=Math.abs(n.dot(s))-c,f>0&&(l+=f*f),f=Math.abs(n.dot(i))-a,f>0&&(l+=f*f),f=Math.abs(n.dot(o))-h,f>0&&(l+=f*f),l}computePlaneDistances(t,n,r=[-0,-0]){let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=this.center,c=this.halfAxes,a=c.getColumn(0,$i),h=c.getColumn(1,to),l=c.getColumn(2,eo),f=iB.copy(a).add(h).add(l).add(o),p=oB.copy(f).subtract(t),u=n.dot(p);return s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).add(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).subtract(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).subtract(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).add(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).add(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).subtract(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).subtract(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),r[0]=s,r[1]=i,r}transform(t){this.center.transformAsPoint(t);let n=this.halfAxes.getColumn(0,$i);n.transformAsPoint(t);let r=this.halfAxes.getColumn(1,to);r.transformAsPoint(t);let s=this.halfAxes.getColumn(2,eo);return s.transformAsPoint(t),this.halfAxes=new ct([...n,...r,...s]),this}getTransform(){throw new Error("not implemented")}};var zu=new O,ku=new O,ie=class{constructor(t=[0,0,1],n=0){this.normal=new O,this.distance=-0,this.fromNormalDistance(t,n)}fromNormalDistance(t,n){return Ae(Number.isFinite(n)),this.normal.from(t).normalize(),this.distance=n,this}fromPointNormal(t,n){t=zu.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),Ae(Me(this.normal.len(),1)),this.distance=s,this}clone(){return new ie(this.normal,this.distance)}equals(t){return Me(this.distance,t.distance)&&Me(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let n=ku.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=zu.from(t),s=this.getPointDistance(r),i=ku.copy(this.normal).scale(s);return r.subtract(i).to(n)}};var Vu=[new O([1,0,0]),new O([0,1,0]),new O([0,0,1])],qu=new O,cB=new O,Gt=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*Vu.length;let n=t.center,r=t.radius,s=0;for(let i of Vu){let o=this.planes[s],c=this.planes[s+1];o||(o=this.planes[s]=new ie),c||(c=this.planes[s+1]=new ie);let a=qu.copy(i).scale(-r).add(n);o.fromPointNormal(a,i);let h=qu.copy(i).scale(r).add(n),l=cB.copy(i).negate();c.fromPointNormal(h,l),s+=2}return this}computeVisibility(t){let n=ut.INSIDE;for(let r of this.planes)switch(t.intersectPlane(r)){case ut.OUTSIDE:return ut.OUTSIDE;case ut.INTERSECTING:n=ut.INTERSECTING;break;default:}return n}computeVisibilityWithPlaneMask(t,n){if(Ae(Number.isFinite(n),"parentPlaneMask is required."),n===Gt.MASK_OUTSIDE||n===Gt.MASK_INSIDE)return n;let r=Gt.MASK_INSIDE,s=this.planes;for(let i=0;i<this.planes.length;++i){let o=i<31?1<<i:0;if(i<31&&!(n&o))continue;let c=s[i],a=t.intersectPlane(c);if(a===ut.OUTSIDE)return Gt.MASK_OUTSIDE;a===ut.INTERSECTING&&(r|=o)}return r}};Gt.MASK_OUTSIDE=4294967295;Gt.MASK_INSIDE=0;Gt.MASK_INDETERMINATE=2147483647;var eG=new O,nG=new O,rG=new O,sG=new O,iG=new O;var fG=new O,pG=new O,uG=new O,dG=new O,mG=new O,gG=new O,xG=new O,MG=new O,AG=new O,yG=new O,EG=new O,TG=new O;var Ee=new ct,hB=new ct,lB=new ct,no=new ct,Hu=new ct;function Rh(e,t={}){let n=xr.EPSILON20,r=10,s=0,i=0,o=hB,c=lB;o.identity(),c.copy(e);let a=n*fB(c);for(;i<r&&pB(c)>a;)uB(c,no),Hu.copy(no).transpose(),c.multiplyRight(no),c.multiplyLeft(Hu),o.multiplyRight(no),++s>2&&(++i,s=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=c.toTarget(t.diagonal),t}function fB(e){let t=0;for(let n=0;n<9;++n){let r=e[n];t+=r*r}return Math.sqrt(t)}var Ch=[1,0,0],Lh=[2,2,1];function pB(e){let t=0;for(let n=0;n<3;++n){let r=e[Ee.getElementIndex(Lh[n],Ch[n])];t+=2*r*r}return Math.sqrt(t)}function uB(e,t){let n=xr.EPSILON15,r=0,s=1;for(let h=0;h<3;++h){let l=Math.abs(e[Ee.getElementIndex(Lh[h],Ch[h])]);l>r&&(s=h,r=l)}let i=Ch[s],o=Lh[s],c=1,a=0;if(Math.abs(e[Ee.getElementIndex(o,i)])>n){let h=e[Ee.getElementIndex(o,o)],l=e[Ee.getElementIndex(i,i)],f=e[Ee.getElementIndex(o,i)],p=(h-l)/2/f,u;p<0?u=-1/(-p+Math.sqrt(1+p*p)):u=1/(p+Math.sqrt(1+p*p)),c=1/Math.sqrt(1+u*u),a=u*c}return ct.IDENTITY.to(t),t[Ee.getElementIndex(i,i)]=t[Ee.getElementIndex(o,o)]=c,t[Ee.getElementIndex(o,i)]=a,t[Ee.getElementIndex(i,o)]=-a,t}var sn=new O,dB=new O,mB=new O,gB=new O,xB=new O,MB=new ct,AB={diagonal:new ct,unitary:new ct};function wh(e,t=new Fn){if(!e||e.length===0)return t.halfAxes=new ct([0,0,0,0,0,0,0,0,0]),t.center=new O,t;let n=e.length,r=new O(0,0,0);for(let S of e)r.add(S);let s=1/n;r.multiplyByScalar(s);let i=0,o=0,c=0,a=0,h=0,l=0;for(let S of e){let x=sn.copy(S).subtract(r);i+=x.x*x.x,o+=x.x*x.y,c+=x.x*x.z,a+=x.y*x.y,h+=x.y*x.z,l+=x.z*x.z}i*=s,o*=s,c*=s,a*=s,h*=s,l*=s;let f=MB;f[0]=i,f[1]=o,f[2]=c,f[3]=o,f[4]=a,f[5]=h,f[6]=c,f[7]=h,f[8]=l;let{unitary:p}=Rh(f,AB),u=t.halfAxes.copy(p),d=u.getColumn(0,mB),g=u.getColumn(1,gB),m=u.getColumn(2,xB),M=-Number.MAX_VALUE,E=-Number.MAX_VALUE,A=-Number.MAX_VALUE,y=Number.MAX_VALUE,T=Number.MAX_VALUE,_=Number.MAX_VALUE;for(let S of e)sn.copy(S),M=Math.max(sn.dot(d),M),E=Math.max(sn.dot(g),E),A=Math.max(sn.dot(m),A),y=Math.min(sn.dot(d),y),T=Math.min(sn.dot(g),T),_=Math.min(sn.dot(m),_);d=d.multiplyByScalar(.5*(y+M)),g=g.multiplyByScalar(.5*(T+E)),m=m.multiplyByScalar(.5*(_+A)),t.center.copy(d).add(g).add(m);let L=dB.set(M-y,E-T,A-_).multiplyByScalar(.5),B=new ct([L[0],0,0,0,L[1],0,0,0,L[2]]);return t.halfAxes.multiplyRight(B),t}var Ar=512,Yu=3,Wu=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],Ju=Wu.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),yB=Ju.concat([[.25,.5],[.75,.5]]),on=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 on(t,n,r),new on(t,n+1,r),new on(t+1,n,r),new on(t+1,n+1,r)]}return this._children}update(t){let{viewport:n,cullingVolume:r,elevationBounds:s,minZ:i,maxZ:o,bounds:c,offset:a,project:h}=t,l=this.getBoundingVolume(s,a,h);if(c&&!this.insideBounds(c)||r.computeVisibility(l)<0)return!1;if(!this.childVisible){let{z:p}=this;if(p<o&&p>=i){let u=l.distanceTo(n.cameraPosition)*n.scale/n.height;p+=Math.floor(Math.log2(u))}if(p>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let p of this.children)p.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(let n of this._children)n.getSelected(t);return t}insideBounds([t,n,r,s]){let i=Math.pow(2,this.z),o=Ar/i;return this.x*o<r&&this.y*o<s&&(this.x+1)*o>t&&(this.y+1)*o>n}getBoundingVolume(t,n,r){if(r){let a=this.z<1?yB:this.z<2?Ju:Wu,h=[];for(let l of a){let f=ro(this.x+l[0],this.y+l[1],this.z);f[2]=t[0],h.push(r(f)),t[0]!==t[1]&&(f[2]=t[1],h.push(r(f)))}return wh(h)}let s=Math.pow(2,this.z),i=Ar/s,o=this.x*i+n*Ar,c=Ar-(this.y+1)*i;return new nn([o,c,t[0]],[o+i,c+i,t[1]])}};function Xu(e,t,n,r){let s=e instanceof vs._GlobeViewport&&e.resolution?e.projectPosition:null,i=Object.values(e.getFrustumPlanes()).map(({normal:u,distance:d})=>new ie(u.clone().negate(),d)),o=new Gt(i),c=e.distanceScales.unitsPerMeter[2],a=n&&n[0]*c||0,h=n&&n[1]*c||0,l=e instanceof vs.WebMercatorViewport&&e.pitch<=60?t:0;if(r){let[u,d,g,m]=r,M=Ie([u,m]),E=Ie([g,d]);r=[M[0],Ar-M[1],E[0],Ar-E[1]]}let f=new on(0,0,0),p={viewport:e,project:s,cullingVolume:o,elevationBounds:[a,h],minZ:l,maxZ:t,bounds:r,offset:0};if(f.update(p),e instanceof vs.WebMercatorViewport&&e.subViewports&&e.subViewports.length>1){for(p.offset=-1;f.update(p)&&!(--p.offset<-Yu););for(p.offset=1;f.update(p)&&!(++p.offset>Yu););}return f.getSelected()}var Pe=512,EB=[-1/0,-1/0,1/0,1/0],cn={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 Ku(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 TB(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=TB(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 _B(e,t,n){let r;if(t&&t.length===2){let[s,i]=t,o=e.getBounds({z:s}),c=e.getBounds({z:i});r=[Math.min(o[0],c[0]),Math.min(o[1],c[1]),Math.max(o[2],c[2]),Math.max(o[3],c[3])]}else r=e.getBounds();return e.isGeospatial?[Math.max(r[0],n[0]),Math.max(r[1],n[1]),Math.min(r[2],n[2]),Math.min(r[3],n[3])]:[Math.max(Math.min(r[0],n[2]),n[0]),Math.max(Math.min(r[1],n[3]),n[1]),Math.min(Math.max(r[2],n[0]),n[2]),Math.min(Math.max(r[3],n[1]),n[3])]}function Zu({viewport:e,z:t,cullRect:n}){return(e.subViewports||[e]).map(s=>Ih(s,t||0,n))}function Ih(e,t,n){if(!Array.isArray(t)){let i=n.x-e.x,o=n.y-e.y,{width:c,height:a}=n,h={targetZ:t},l=e.unproject([i,o],h),f=e.unproject([i+c,o],h),p=e.unproject([i,o+a],h),u=e.unproject([i+c,o+a],h);return[Math.min(l[0],f[0],p[0],u[0]),Math.min(l[1],f[1],p[1],u[1]),Math.max(l[0],f[0],p[0],u[0]),Math.max(l[1],f[1],p[1],u[1])]}let r=Ih(e,t[0],n),s=Ih(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 SB(e,t,n){return n?Ku(e,n).map(s=>s*t/Pe):e.map(r=>r*t/Pe)}function bh(e,t){return Math.pow(2,e)*Pe/t}function ro(e,t,n){let r=bh(n,Pe),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 ju(e,t,n,r){let s=bh(n,r);return[e/s*Pe,t/s*Pe]}function Oh(e,t,n,r,s=Pe){if(e.isGeospatial){let[h,l]=ro(t,n,r),[f,p]=ro(t+1,n+1,r);return{west:h,north:l,east:f,south:p}}let[i,o]=ju(t,n,r,s),[c,a]=ju(t+1,n+1,r,s);return{left:i,top:o,right:c,bottom:a}}function BB(e,t,n,r,s){let i=_B(e,null,r),o=bh(t,n),[c,a,h,l]=SB(i,o,s),f=[];for(let p=Math.floor(c);p<h;p++)for(let u=Math.floor(a);u<l;u++)f.push({x:p,y:u,z:t});return f}function Ph({viewport:e,maxZoom:t,minZoom:n,zRange:r,extent:s,tileSize:i=Pe,modelMatrix:o,modelMatrixInverse:c,zoomOffset:a=0}){let h=e.isGeospatial?Math.round(e.zoom+Math.log2(Pe/i))+a:Math.ceil(e.zoom)+a;if(typeof n=="number"&&Number.isFinite(n)&&h<n){if(!s)return[];h=n}typeof t=="number"&&Number.isFinite(t)&&h>t&&(h=t);let l=s;return o&&c&&s&&!e.isGeospatial&&(l=Ku(s,o)),e.isGeospatial?Xu(e,h,r,s):BB(e,h,i,l||EB,c)}function Nh(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(e)}function Fh(e){return Number.isFinite(e.west)&&Number.isFinite(e.north)&&Number.isFinite(e.east)&&Number.isFinite(e.south)}function Qu(e){let t={},n;return r=>{for(let s in r)if(!CB(r[s],t[s])){n=e(r),t=r;break}return n}}function CB(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 $u=1,so=2,LB="never",RB="no-overlap",Ds="best-available",wB=5,IB={[Ds]:OB,[RB]:PB,[LB]:()=>{}},bB={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},vn=class{constructor(t){this._getCullBounds=Qu(Zu),this.opts={...bB,...t},this.setOptions(this.opts),this.onTileLoad=n=>{this.opts.onTileLoad?.(n),this.opts.maxCacheByteSize!=null&&(this._cacheByteSize+=n.byteLength,this._resizeCache())},this._requestScheduler=new Ke({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new Ht,this._modelMatrixInverse=new Ht}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 Ht(r):new Ht,i=!s.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!Me(this._zRange,n)||i){i&&(this._modelMatrixInverse=s.clone().invert(),this._modelMatrix=s),this._viewport=t,this._zRange=n;let c=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:n,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=c.map(a=>this._getTile(a,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(c=>this._getTile(c.index,!0)));let o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(t,n){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,c,a]of r){let h;if("west"in s)h=s.west<c&&s.east>i&&s.south<a&&s.north>o;else{let l=Math.min(s.top,s.bottom),f=Math.max(s.top,s.bottom);h=s.left<c&&s.right>i&&l<a&&f>o}if(h)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:n,minZoom:r,zRange:s,modelMatrix:i,modelMatrixInverse:o}){let{tileSize:c,extent:a,zoomOffset:h}=this.opts;return Ph({viewport:t,maxZoom:n,minZoom:r,zRange:s,tileSize:c,extent:a,modelMatrix:i,modelMatrixInverse:o,zoomOffset:h})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){let{tileSize:n}=this.opts;return{bbox:Oh(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||Ds,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:IB[t])(Array.from(this._cache.values())),r=0;for(let s of this._cache.values())if(n[r++]!==s.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:t=0}=this.opts,n=[],r=0;for(let s of this._cache.values())s.isLoading&&(r++,!s.isSelected&&!s.isVisible&&n.push(s));for(;t>0&&r>t&&n.length>0;)n.shift().abort(),r--}_rebuildTree(){let{_cache:t}=this;for(let n of t.values())n.parent=null,n.children&&(n.children.length=0);for(let n of t.values()){let r=this._getNearestAncestor(n);n.parent=r,r?.children&&r.children.push(n)}}_resizeCache(){let{_cache:t,opts:n}=this,r=n.maxCacheSize??(n.maxCacheByteSize!=null?1/0:wB*this.selectedTiles.length),s=n.maxCacheByteSize??1/0;if(t.size>r||this._cacheByteSize>s){for(let[o,c]of t)if(!c.isVisible&&!c.isSelected&&(this._cacheByteSize-=n.maxCacheByteSize!=null?c.byteLength:0,t.delete(o),this.opts.onTileUnload?.(c)),t.size<=r&&this._cacheByteSize<=s)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((o,c)=>o.zoom-c.zoom),this._dirty=!1)}_getTile(t,n){let r=this.getTileId(t),s=this._cache.get(r),i=!1;return!s&&n?(s=new Nn(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 OB(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!td(t)&&vh(t);for(let t of e)t.isVisible=Boolean(t.state&so)}function PB(e){for(let n of e)n.state=0;for(let n of e)n.isSelected&&td(n);let t=Array.from(e).sort((n,r)=>n.zoom-r.zoom);for(let n of t)if(n.isVisible=Boolean(n.state&so),n.children&&(n.isVisible||n.state&$u))for(let r of n.children)r.state=$u;else n.isSelected&&vh(n)}function td(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=so,!0;t=t.parent}return!1}function vh(e){for(let t of e.children)t.isLoaded||t.content?t.state|=so:vh(t)}var NB={TilesetClass:vn,data:{type:"data",value:[]},dataComparator:cn.equal,renderSubLayers:{type:"function",value:e=>new ed.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:Ds,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},Us=class extends io.CompositeLayer{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every(t=>t.isLoaded&&t.layers&&t.layers.every(n=>n.isLoaded)))}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:n}=this.state,r=t.propsOrDataChanged||t.updateTriggersChanged,s=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);n?r&&(n.setOptions(this._getTilesetOptions()),s?n.reloadAll():n.tiles.forEach(i=>{i.layers=null})):(n=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:n})),this._updateTileset()}_getTilesetOptions(){let{tileSize:t,maxCacheSize:n,maxCacheByteSize:r,refinementStrategy:s,extent:i,maxZoom:o,minZoom:c,maxRequests:a,debounceTime:h,zoomOffset:l}=this.props;return{maxCacheSize:n,maxCacheByteSize:r,maxZoom:o,minZoom:c,tileSize:t,refinementStrategy:s,extent:i,maxRequests:a,debounceTime:h,zoomOffset:l,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let t=this.state.tileset,{zRange:n,modelMatrix:r}=this.props,s=t.update(this.context.viewport,{zRange:n,modelMatrix:r}),{isLoaded:i}=t,o=this.state.isLoaded!==i,c=this.state.frameNumber!==s;i&&(o||c)&&this._onViewportLoad(),c&&this.setState({frameNumber:s}),this.state.isLoaded=i}_onViewportLoad(){let{tileset:t}=this.state,{onViewportLoad:n}=this.props;n&&n(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,n){this.props.onTileError(t),n.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){let{data:n,getTileData:r,fetch:s}=this.props,{signal:i}=t;return t.url=typeof n=="string"||Array.isArray(n)?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(t){let n=t.sourceLayer,r=n.props.tile,s=t.info;return s.picked&&(s.tile=r),s.sourceTile=r,s.sourceTileSubLayer=n,s}_updateAutoHighlight(t){t.sourceTileSubLayer.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map(t=>{let n=this.getSubLayerPropsByTile(t);if(!(!t.isLoaded&&!t.content))if(t.layers)n&&t.layers[0]&&Object.keys(n).some(r=>t.layers[0].props[r]!==n[r])&&(t.layers=t.layers.map(r=>r.clone(n)));else{let r=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=(0,io._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)}};Us.defaultProps=NB;Us.layerName="TileLayer";var Dn=Us;var sd=D(ee(),1);var nd=`uniform tripsUniforms {
13
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Je.prototype.build=function(e){return this.options.preserveOrder?OE(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)};Je.prototype.j2x=function(e,t){let n="",r="";for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(typeof e[s]>"u")this.isAttribute(s)&&(r+="");else if(e[s]===null)this.isAttribute(s)?r+="":s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)r+=this.buildTextValNode(e[s],s,"",t);else if(typeof e[s]!="object"){let i=this.isAttribute(s);if(i)n+=this.buildAttrPairStr(i,""+e[s]);else if(s===this.options.textNodeName){let o=this.options.tagValueProcessor(s,""+e[s]);r+=this.replaceEntitiesValue(o)}else r+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){let i=e[s].length,o="",c="";for(let a=0;a<i;a++){let h=e[s][a];if(!(typeof h>"u"))if(h===null)s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(typeof h=="object")if(this.options.oneListGroup){let l=this.j2x(h,t+1);o+=l.val,this.options.attributesGroupName&&h.hasOwnProperty(this.options.attributesGroupName)&&(c+=l.attrStr)}else o+=this.processTextOrObjNode(h,s,t);else if(this.options.oneListGroup){let l=this.options.tagValueProcessor(s,h);l=this.replaceEntitiesValue(l),o+=l}else o+=this.buildTextValNode(h,s,"",t)}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,c,t)),r+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){let i=Object.keys(e[s]),o=i.length;for(let c=0;c<o;c++)n+=this.buildAttrPairStr(i[c],""+e[s][i[c]])}else r+=this.processTextOrObjNode(e[s],s,t);return{attrStr:n,val:r}};Je.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 NE(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)}Je.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}};Je.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};Je.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}};Je.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 FE(e){return this.options.indentBy.repeat(e)}function vE(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}R1.exports=Je});var b1=it((vF,I1)=>{"use strict";var DE=Ma(),UE=T1(),GE=w1();I1.exports={XMLParser:UE,XMLValidator:DE,XMLBuilder:GE}});var Sh=it((Su,Os)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof K0=="function"&&typeof Os=="object"&&Os&&Os.exports?Os.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(Su,function(){"use strict";function e(S,x,R){this.low=S|0,this.high=x|0,this.unsigned=!!R}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function t(S){return(S&&S.__isLong__)===!0}e.isLong=t;var n={},r={};function s(S,x){var R,w,I;return x?(S>>>=0,(I=0<=S&&S<256)&&(w=r[S],w)?w:(R=o(S,(S|0)<0?-1:0,!0),I&&(r[S]=R),R)):(S|=0,(I=-128<=S&&S<128)&&(w=n[S],w)?w:(R=o(S,S<0?-1:0,!1),I&&(n[S]=R),R))}e.fromInt=s;function i(S,x){if(isNaN(S)||!isFinite(S))return x?M:m;if(x){if(S<0)return M;if(S>=u)return _}else{if(S<=-d)return L;if(S+1>=d)return T}return S<0?i(-S,x).neg():o(S%p|0,S/p|0,x)}e.fromNumber=i;function o(S,x,R){return new e(S,x,R)}e.fromBits=o;var c=Math.pow;function a(S,x,R){if(S.length===0)throw Error("empty string");if(S==="NaN"||S==="Infinity"||S==="+Infinity"||S==="-Infinity")return m;if(typeof x=="number"?(R=x,x=!1):x=!!x,R=R||10,R<2||36<R)throw RangeError("radix");var w;if((w=S.indexOf("-"))>0)throw Error("interior hyphen");if(w===0)return a(S.substring(1),x,R).neg();for(var I=i(c(R,8)),C=m,P=0;P<S.length;P+=8){var V=Math.min(8,S.length-P),G=parseInt(S.substring(P,P+V),R);if(V<8){var Q=i(c(R,V));C=C.mul(Q).add(i(G))}else C=C.mul(I),C=C.add(i(G))}return C.unsigned=x,C}e.fromString=a;function h(S){return S instanceof e?S:typeof S=="number"?i(S):typeof S=="string"?a(S):o(S.low,S.high,S.unsigned)}e.fromValue=h;var l=1<<16,f=1<<24,p=l*l,u=p*p,d=u/2,g=s(f),m=s(0);e.ZERO=m;var M=s(0,!0);e.UZERO=M;var E=s(1);e.ONE=E;var A=s(1,!0);e.UONE=A;var y=s(-1);e.NEG_ONE=y;var T=o(-1,2147483647,!1);e.MAX_VALUE=T;var _=o(-1,-1,!0);e.MAX_UNSIGNED_VALUE=_;var L=o(0,-2147483648,!1);e.MIN_VALUE=L;var B=e.prototype;return B.toInt=function(){return this.unsigned?this.low>>>0:this.low},B.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},B.toString=function(x){if(x=x||10,x<2||36<x)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(L)){var R=i(x),w=this.div(R),I=w.mul(R).sub(this);return w.toString(x)+I.toInt().toString(x)}else return"-"+this.neg().toString(x);for(var C=i(c(x,6),this.unsigned),P=this,V="";;){var G=P.div(C),Q=P.sub(G.mul(C)).toInt()>>>0,q=Q.toString(x);if(P=G,P.isZero())return q+V;for(;q.length<6;)q="0"+q;V=""+q+V}},B.getHighBits=function(){return this.high},B.getHighBitsUnsigned=function(){return this.high>>>0},B.getLowBits=function(){return this.low},B.getLowBitsUnsigned=function(){return this.low>>>0},B.getNumBitsAbs=function(){if(this.isNegative())return this.eq(L)?64:this.neg().getNumBitsAbs();for(var x=this.high!=0?this.high:this.low,R=31;R>0&&!(x&1<<R);R--);return this.high!=0?R+33:R+1},B.isZero=function(){return this.high===0&&this.low===0},B.isNegative=function(){return!this.unsigned&&this.high<0},B.isPositive=function(){return this.unsigned||this.high>=0},B.isOdd=function(){return(this.low&1)===1},B.isEven=function(){return(this.low&1)===0},B.equals=function(x){return t(x)||(x=h(x)),this.unsigned!==x.unsigned&&this.high>>>31===1&&x.high>>>31===1?!1:this.high===x.high&&this.low===x.low},B.eq=B.equals,B.notEquals=function(x){return!this.eq(x)},B.neq=B.notEquals,B.lessThan=function(x){return this.comp(x)<0},B.lt=B.lessThan,B.lessThanOrEqual=function(x){return this.comp(x)<=0},B.lte=B.lessThanOrEqual,B.greaterThan=function(x){return this.comp(x)>0},B.gt=B.greaterThan,B.greaterThanOrEqual=function(x){return this.comp(x)>=0},B.gte=B.greaterThanOrEqual,B.compare=function(x){if(t(x)||(x=h(x)),this.eq(x))return 0;var R=this.isNegative(),w=x.isNegative();return R&&!w?-1:!R&&w?1:this.unsigned?x.high>>>0>this.high>>>0||x.high===this.high&&x.low>>>0>this.low>>>0?-1:1:this.sub(x).isNegative()?-1:1},B.comp=B.compare,B.negate=function(){return!this.unsigned&&this.eq(L)?L:this.not().add(E)},B.neg=B.negate,B.add=function(x){t(x)||(x=h(x));var R=this.high>>>16,w=this.high&65535,I=this.low>>>16,C=this.low&65535,P=x.high>>>16,V=x.high&65535,G=x.low>>>16,Q=x.low&65535,q=0,$=0,st=0,Ut=0;return Ut+=C+Q,st+=Ut>>>16,Ut&=65535,st+=I+G,$+=st>>>16,st&=65535,$+=w+V,q+=$>>>16,$&=65535,q+=R+P,q&=65535,o(st<<16|Ut,q<<16|$,this.unsigned)},B.subtract=function(x){return t(x)||(x=h(x)),this.add(x.neg())},B.sub=B.subtract,B.multiply=function(x){if(this.isZero()||(t(x)||(x=h(x)),x.isZero()))return m;if(this.eq(L))return x.isOdd()?L:m;if(x.eq(L))return this.isOdd()?L:m;if(this.isNegative())return x.isNegative()?this.neg().mul(x.neg()):this.neg().mul(x).neg();if(x.isNegative())return this.mul(x.neg()).neg();if(this.lt(g)&&x.lt(g))return i(this.toNumber()*x.toNumber(),this.unsigned);var R=this.high>>>16,w=this.high&65535,I=this.low>>>16,C=this.low&65535,P=x.high>>>16,V=x.high&65535,G=x.low>>>16,Q=x.low&65535,q=0,$=0,st=0,Ut=0;return Ut+=C*Q,st+=Ut>>>16,Ut&=65535,st+=I*Q,$+=st>>>16,st&=65535,st+=C*G,$+=st>>>16,st&=65535,$+=w*Q,q+=$>>>16,$&=65535,$+=I*G,q+=$>>>16,$&=65535,$+=C*V,q+=$>>>16,$&=65535,q+=R*Q+w*G+I*V+C*P,q&=65535,o(st<<16|Ut,q<<16|$,this.unsigned)},B.mul=B.multiply,B.divide=function(x){if(t(x)||(x=h(x)),x.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?M:m;var R,w,I;if(this.unsigned){if(x.unsigned||(x=x.toUnsigned()),x.gt(this))return M;if(x.gt(this.shru(1)))return A;I=M}else{if(this.eq(L)){if(x.eq(E)||x.eq(y))return L;if(x.eq(L))return E;var C=this.shr(1);return R=C.div(x).shl(1),R.eq(m)?x.isNegative()?E:y:(w=this.sub(x.mul(R)),I=R.add(w.div(x)),I)}else if(x.eq(L))return this.unsigned?M:m;if(this.isNegative())return x.isNegative()?this.neg().div(x.neg()):this.neg().div(x).neg();if(x.isNegative())return this.div(x.neg()).neg();I=m}for(w=this;w.gte(x);){R=Math.max(1,Math.floor(w.toNumber()/x.toNumber()));for(var P=Math.ceil(Math.log(R)/Math.LN2),V=P<=48?1:c(2,P-48),G=i(R),Q=G.mul(x);Q.isNegative()||Q.gt(w);)R-=V,G=i(R,this.unsigned),Q=G.mul(x);G.isZero()&&(G=E),I=I.add(G),w=w.sub(Q)}return I},B.div=B.divide,B.modulo=function(x){return t(x)||(x=h(x)),this.sub(this.div(x).mul(x))},B.mod=B.modulo,B.not=function(){return o(~this.low,~this.high,this.unsigned)},B.and=function(x){return t(x)||(x=h(x)),o(this.low&x.low,this.high&x.high,this.unsigned)},B.or=function(x){return t(x)||(x=h(x)),o(this.low|x.low,this.high|x.high,this.unsigned)},B.xor=function(x){return t(x)||(x=h(x)),o(this.low^x.low,this.high^x.high,this.unsigned)},B.shiftLeft=function(x){return t(x)&&(x=x.toInt()),(x&=63)===0?this:x<32?o(this.low<<x,this.high<<x|this.low>>>32-x,this.unsigned):o(0,this.low<<x-32,this.unsigned)},B.shl=B.shiftLeft,B.shiftRight=function(x){return t(x)&&(x=x.toInt()),(x&=63)===0?this:x<32?o(this.low>>>x|this.high<<32-x,this.high>>x,this.unsigned):o(this.high>>x-32,this.high>=0?0:-1,this.unsigned)},B.shr=B.shiftRight,B.shiftRightUnsigned=function(x){if(t(x)&&(x=x.toInt()),x&=63,x===0)return this;var R=this.high;if(x<32){var w=this.low;return o(w>>>x|R<<32-x,R>>>x,this.unsigned)}else return x===32?o(R,0,this.unsigned):o(R>>>x-32,0,this.unsigned)},B.shru=B.shiftRightUnsigned,B.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},B.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},B.toBytes=function(S){return S?this.toBytesLE():this.toBytesBE()},B.toBytesLE=function(){var S=this.high,x=this.low;return[x&255,x>>>8&255,x>>>16&255,x>>>24&255,S&255,S>>>8&255,S>>>16&255,S>>>24&255]},B.toBytesBE=function(){var S=this.high,x=this.low;return[S>>>24&255,S>>>16&255,S>>>8&255,S&255,x>>>24&255,x>>>16&255,x>>>8&255,x&255]},e})});var oo=it((m9,od)=>{od.exports=globalThis.h3||{}});var Uh=it((S9,pd)=>{pd.exports=globalThis.luma});var lo=it((B9,ud)=>{ud.exports=globalThis.deck});var Gh=it((C9,dd)=>{dd.exports=globalThis.luma});var yr=it((Tz,Wd)=>{Wd.exports=globalThis.loaders});var Uy=it((Rtt,Dy)=>{Dy.exports=globalThis.deck});var Xy=it(D0=>{D0.read=function(e,t,n,r,s){var i,o,c=s*8-r-1,a=(1<<c)-1,h=a>>1,l=-7,f=n?s-1:0,p=n?-1:1,u=e[t+f];for(f+=p,i=u&(1<<-l)-1,u>>=-l,l+=c;l>0;i=i*256+e[t+f],f+=p,l-=8);for(o=i&(1<<-l)-1,i>>=-l,l+=r;l>0;o=o*256+e[t+f],f+=p,l-=8);if(i===0)i=1-h;else{if(i===a)return o?NaN:(u?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-h}return(u?-1:1)*o*Math.pow(2,i-r)};D0.write=function(e,t,n,r,s,i){var o,c,a,h=i*8-s-1,l=(1<<h)-1,f=l>>1,p=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,u=r?0:i-1,d=r?1:-1,g=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+f>=1?t+=p/a:t+=p*Math.pow(2,1-f),t*a>=2&&(o++,a/=2),o+f>=l?(c=0,o=l):o+f>=1?(c=(t*a-1)*Math.pow(2,s),o=o+f):(c=t*Math.pow(2,f-1)*Math.pow(2,s),o=0));s>=8;e[n+u]=c&255,u+=d,c/=256,s-=8);for(o=o<<s|c,h+=s;h>0;e[n+u]=o&255,u+=d,o/=256,h-=8);e[n+u-d]|=g*128}});var t3=it((get,$y)=>{"use strict";$y.exports=j;var ca=Xy();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 U0=(1<<16)*(1<<16),jy=1/U0,S4=12,Qy=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");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=aa(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Zy(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=aa(this.buf,this.pos)+aa(this.buf,this.pos+4)*U0;return this.pos+=8,e},readSFixed64:function(){var e=aa(this.buf,this.pos)+Zy(this.buf,this.pos+4)*U0;return this.pos+=8,e},readFloat:function(){var e=ca.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=ca.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,B4(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>=S4&&Qy?G4(this.buf,t,e):U4(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=Ye(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=Ye(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=Ye(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=Ye(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=Ye(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=Ye(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=Ye(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=Ye(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=Ye(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),ls(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),ls(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),ls(this.buf,e&-1,this.pos),ls(this.buf,Math.floor(e*jy),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),ls(this.buf,e&-1,this.pos),ls(this.buf,Math.floor(e*jy),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){C4(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=z4(this.buf,e,this.pos);var n=this.pos-t;n>=128&&Ky(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),ca.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),ca.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&&Ky(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,w4,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,I4,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,P4,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,b4,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,O4,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,N4,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,F4,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,v4,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,D4,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 B4(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 hs(e,s,t);throw new Error("Expected varint not more than 10 bytes")}function Ye(e){return e.type===j.Bytes?e.readVarint()+e.pos:e.pos+1}function hs(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function C4(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),L4(n,r,t),R4(r,t)}function L4(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 R4(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 Ky(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 w4(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function I4(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function b4(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function O4(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function P4(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function N4(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function F4(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function v4(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function D4(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function aa(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function ls(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function Zy(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function U4(e,t,n){for(var r="",s=t;s<n;){var i=e[s],o=null,c=i>239?4:i>223?3:i>191?2:1;if(s+c>n)break;var a,h,l;c===1?i<128&&(o=i):c===2?(a=e[s+1],(a&192)===128&&(o=(i&31)<<6|a&63,o<=127&&(o=null))):c===3?(a=e[s+1],h=e[s+2],(a&192)===128&&(h&192)===128&&(o=(i&15)<<12|(a&63)<<6|h&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):c===4&&(a=e[s+1],h=e[s+2],l=e[s+3],(a&192)===128&&(h&192)===128&&(l&192)===128&&(o=(i&15)<<18|(a&63)<<12|(h&63)<<6|l&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,c=1):o>65535&&(o-=65536,r+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),r+=String.fromCharCode(o),s+=c}return r}function G4(e,t,n){return Qy.decode(e.subarray(t,n))}function z4(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 Li={};At(Li,{GeohashLayer:()=>E3,GreatCircleLayer:()=>Tu,H3ClusterLayer:()=>fd,H3HexagonLayer:()=>ho,MVTLayer:()=>x3,QuadkeyLayer:()=>Du,S2Layer:()=>Fu,TerrainLayer:()=>vy,Tile3DLayer:()=>Ry,TileLayer:()=>Dn,TripsLayer:()=>id,_GeoCellLayer:()=>ye,_Tile2DHeader:()=>Nn,_Tileset2D:()=>vn,_WMSLayer:()=>Mr,_getURLFromTemplate:()=>Te});var pe={},Q0=D(ee(),1);We(pe,D(ee(),1));if(!Q0.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");We(Li,pe);var Pn=D(ne(),1),yu=D(ee(),1);function b3(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function wi(e){if(Array.isArray(e))return e.map(t=>wi(t));if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[b3(n)]=wi(r);return t}return e}var O1=D(b1(),1);function Ba(e,t){if(t?._parser&&t._parser!=="fast-xml-parser")throw new Error(t?._parser);let n={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:t?.removeNSPrefix,textNodeName:t?.textNodeName,isArray:(s,i,o,c)=>Boolean(t?.arrayPaths?.some(h=>i===h)),...t?._fastXML},r=zE(e,n);return t?.uncapitalizeKeys?wi(r):r}function zE(e,t){return new O1.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var kE="4.2.1",re={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:kE,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:VE,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>Ba(new TextDecoder().decode(e),{...re.options.xml,...t?.xml}),parseTextSync:(e,t)=>Ba(e,{...re.options.xml,...t?.xml})};function VE(e){return e.startsWith("<?xml")}async function qt(e,t,n,r){return r._parse(e,t,n,r)}function z(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var ue={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},qE=ue.self||ue.window||ue.global||{},HE=ue.window||ue.self||ue.global||{},YE=ue.global||ue.self||ue.window||{},WE=ue.document||{};var ms=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var P1=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),JE=P1&&parseFloat(P1[1])||0;var bi=globalThis,XE=globalThis.document||{},Oi=globalThis.process||{},jE=globalThis.console,HF=globalThis.navigator||{};function N1(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,n=e||t;return Boolean(n&&n.indexOf("Electron")>=0)}function Cn(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||N1()}var Ca="4.1.0-alpha.2";function ZE(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,r="sessionStorage"){this.storage=ZE(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 F1(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 v1(e,t=8){let n=Math.max(t-e.length,0);return`${" ".repeat(n)}${e}`}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 QE=10;function D1(e){return typeof e!="string"?e:(e=e.toUpperCase(),Ni[e]||Ni.WHITE)}function U1(e,t,n){return!Cn&&typeof e=="string"&&(t&&(e=`\x1B[${D1(t)}m${e}\x1B[39m`),n&&(e=`\x1B[${D1(n)+QE}m${e}\x1B[49m`)),e}function G1(e,t=["constructor"]){let n=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(n),s=e;for(let i of r){let o=s[i];typeof o=="function"&&(t.find(c=>i===c)||(s[i]=o.bind(e)))}}function gs(e,t){if(!e)throw new Error(t||"Assertion failed")}function Ln(){let e;if(Cn()&&bi.performance)e=bi?.performance?.now?.();else if("hrtime"in Oi){let t=Oi?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var ir={debug:Cn()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},$E={enabled:!0,level:0};function or(){}var z1={},k1={once:!0},xs=class{constructor({id:t}={id:""}){this.VERSION=Ca,this._startTs=Ln(),this._deltaTs=Ln(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Pi(`__probe-${this.id}__`,$E),this.timeStamp(`${this.id} started`),G1(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((Ln()-this._startTs).toPrecision(10))}getDelta(){return Number((Ln()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,n){this._storage.setConfiguration({[t]:n})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,n){if(!t)throw new Error(n||"Assertion failed")}warn(t){return this._getLogFunction(0,t,ir.warn,arguments,k1)}error(t){return this._getLogFunction(0,t,ir.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,ir.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,ir.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,ir.debug||ir.info,arguments,k1)}table(t,n,r){return n?this._getLogFunction(t,n,console.table||or,r&&[r],{tag:eT(n)}):or}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||or)}group(t,n,r={collapsed:!1}){let s=V1({logLevel:t,message:n,opts:r}),{collapsed:i}=r;return s.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(t,n,r={}){return this.group(t,n,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||or)}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()>=q1(t)}_getLogFunction(t,n,r,s,i){if(this._shouldLog(t)){i=V1({logLevel:t,message:n,args:s,opts:i}),r=r||i.method,gs(r),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=Ln();let o=i.tag||i.message;if(i.once&&o)if(!z1[o])z1[o]=Ln();else return or;return n=tT(this.id,i.message,i),r.bind(console,n,...i.args)}return or}};xs.VERSION=Ca;function q1(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 gs(Number.isFinite(t)&&t>=0),t}function V1(e){let{logLevel:t,message:n}=e;e.logLevel=q1(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 gs(s==="string"||s==="object"),Object.assign(e,{args:r},e.opts)}function tT(e,t,n){if(typeof t=="string"){let r=n.time?v1(F1(n.total)):"";t=n.time?`${e}: ${r} ${t}`:`${e}: ${t}`,t=U1(t,n.color,n.background)}return t}function eT(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}globalThis.probe={};var La=new xs({id:"@probe.gl/log"});function Ra(e,t){return H1(e||{},t)}function H1(e,t,n=0){if(n>3)return t;let r={...e};for(let[s,i]of Object.entries(t))i&&typeof i=="object"&&!Array.isArray(i)?r[s]=H1(r[s]||{},t[s],n+1):r[s]=t[s];return r}function wa(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function Ia(e){return globalThis.loaders?.modules?.[e]||null}function nT(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.1"),globalThis._loadersgl_.version}var Y1=nT();function W1(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var de={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Ev=de.self||de.window||de.global||{},Tv=de.window||de.self||de.global||{},_v=de.global||de.self||de.window||{},Sv=de.document||{};var cr=typeof process!="object"||String(process)!=="[object process]"||process.browser,Fi=typeof importScripts=="function",Bv=typeof window<"u"&&typeof window.orientation<"u",J1=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Cv=J1&&parseFloat(J1[1])||0;var ba={};async function me(e,t=null,n={},r=null){return t&&(e=X1(e,t,n,r)),ba[e]=ba[e]||rT(e),await ba[e]}function X1(e,t,n={},r=null){if(!n.useLocalLibraries&&e.startsWith("http"))return e;r=r||e;let s=n.modules||{};return s[r]?s[r]:cr?n.CDN?(W1(n.CDN.startsWith("http")),`${n.CDN}/${t}@${Y1}/dist/libs/${r}`):Fi?`../src/libs/${r}`:`modules/${t}/src/libs/${r}`:`modules/${t}/dist/libs/${r}`}async function rT(e){if(e.endsWith("wasm"))return await iT(e);if(!cr)try{let{requireFromFile:n}=globalThis.loaders||{};return await n?.(e)}catch(n){return console.error(n),null}if(Fi)return importScripts(e);let t=await oT(e);return sT(t,e)}function sT(e,t){if(!cr){let{requireFromString:r}=globalThis.loaders||{};return r?.(e,t)}if(Fi)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 iT(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return cr||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function oT(e){let{readFileAsText:t}=globalThis.loaders||{};return cr||!t||e.startsWith("http")?await(await fetch(e)).text():await t(e)}function K1(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?j1(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?j1(e,0,t):""}function j1(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 Oa(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${K1(e)}"`)}}function Ms(...e){let t=e,n=t&&t.length>1&&t[0].constructor||null;if(!n)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let r=t.reduce((o,c)=>o+c.length,0),s=new n(r),i=0;for(let o of t)s.set(o,i),i+=o.length;return s}function Rn(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 Xe(e,t){return z(e>=0),z(t>0),e+(t-1)&~(t-1)}function Pa(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+Xe(r.byteLength,4)}function As(){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 wn=class{constructor(t,n){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=n,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=As(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(As()-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 je=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,n="count"){return this._getOrCreate({name:t,type:n})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let n of Object.values(this.stats))t(n)}getTable(){let t={};return this.forEach(n=>{t[n.name]={time:n.time||0,count:n.count||0,average:n.getAverageTime()||0,hz:n.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(n=>this._getOrCreate(n))}_getOrCreate(t){let{name:n,type:r}=t,s=this.stats[n];return s||(t instanceof wn?s=t:s=new wn(n,r),this.stats[n]=s),s}};var cT="Queued Requests",aT="Active Requests",hT="Cancelled Requests",lT="Queued Requests Ever",fT="Active Requests Ever",pT={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},Ke=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...pT,...t},this.stats=new je({id:this.props.id}),this.stats.get(cT),this.stats.get(aT),this.stats.get(hT),this.stats.get(lT),this.stats.get(fT)}scheduleRequest(t,n=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let r={handle:t,priority:0,getPriority:n},s=new Promise(i=>(r.resolve=i,r));return this.requestQueue.push(r),this.requestMap.set(t,s),this._issueNewRequests(),s}_issueRequest(t){let{handle:n,resolve:r}=t,s=!1,i=()=>{s||(s=!0,this.requestMap.delete(n),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:i}):Promise.resolve({done:i})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let n=0;n<t;++n){let r=this.requestQueue.shift();r&&this._issueRequest(r)}}}_updateAllRequests(){let t=this.requestQueue;for(let n=0;n<t.length;++n){let r=t[n];this._updateRequest(r)||(t.splice(n,1),this.requestMap.delete(r.handle),n--)}t.sort((n,r)=>n.priority-r.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var Ze={};At(Ze,{dirname:()=>dT,filename:()=>uT,join:()=>mT,resolve:()=>gT});function Z1(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function uT(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function dT(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function mT(...e){let t="/";return e=e.map((n,r)=>(r&&(n=n.replace(new RegExp(`^${t}`),"")),r!==e.length-1&&(n=n.replace(new RegExp(`${t}$`),"")),n)),e.join(t)}function gT(...e){let t=[];for(let i=0;i<e.length;i++)t[i]=e[i];let n="",r=!1,s;for(let i=t.length-1;i>=-1&&!r;i--){let o;i>=0?o=t[i]:(s===void 0&&(s=Z1()),o=s),o.length!==0&&(n=`${o}/${n}`,r=o.charCodeAt(0)===ys)}return n=xT(n,!r),r?`/${n}`:n.length>0?n:"."}var ys=47,Na=46;function xT(e,t){let n="",r=-1,s=0,i,o=!1;for(let c=0;c<=e.length;++c){if(c<e.length)i=e.charCodeAt(c);else{if(i===ys)break;i=ys}if(i===ys){if(!(r===c-1||s===1))if(r!==c-1&&s===2){if(n.length<2||!o||n.charCodeAt(n.length-1)!==Na||n.charCodeAt(n.length-2)!==Na){if(n.length>2){let a=n.length-1,h=a;for(;h>=0&&n.charCodeAt(h)!==ys;--h);if(h!==a){n=h===-1?"":n.slice(0,h),r=c,s=0,o=!1;continue}}else if(n.length===2||n.length===1){n="",r=c,s=0,o=!1;continue}}t&&(n.length>0?n+="/..":n="..",o=!0)}else{let a=e.slice(r+1,c);n.length>0?n+=`/${a}`:n=a,o=!1}r=c,s=0}else i===Na&&s!==-1?++s:s=-1}return n}var vi=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=MT(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function MT(e){let t=e?.fetch;if(t&&typeof t=="function")return(r,s)=>t(r,s);let n=e?.fetch;return n&&typeof n!="function"?r=>fetch(r,n):r=>fetch(r)}var Wt=class extends vi{};sr(Wt,"type","template"),sr(Wt,"testURL",t=>!1);function Q1(e,t){let n=re.parseTextSync?.(e,t),r=n?.ServiceExceptionReport?.ServiceException||n?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof r=="string"?r:r.value||r.code||"Unknown error"}var AT="4.2.1",Es={dataType:null,batchType:null,id:"wms-error",name:"WMS Error",module:"wms",version:AT,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:yT,options:{wms:{throwOnError:!1}},parse:async(e,t)=>Fa(new TextDecoder().decode(e),t),parseSync:(e,t)=>Fa(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Fa(e,t)};function yT(e){return e.startsWith("<?xml")}function Fa(e,t){let n={...Es.options.wms,...t?.wms},r=Q1(e,n),s=n.minimalErrors?r:`WMS Service error: ${r}`;if(n.throwOnError)throw new Error(s);return s}function In(e){return Array.isArray(e)?e:e?[e]:[]}function Ts(e){let t=In(e);return t.length>0&&t.every(n=>typeof n=="string")?t:[]}function _s(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseFloat(e);default:return}}function Di(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseInt(e,10);default:return}}function bn(e){switch(e){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function va(e,t){let n=re.parseTextSync?.(e,t),r=n.WMT_MS_Capabilities||n.WMS_Capabilities||n,s=ET(r);if(t?.inheritedLayerProps)for(let i of s.layers)tp(i,null);return t?.includeRawJSON&&(s.json=r),t?.includeXMLText&&(s.xml=e),s}function ET(e){let t={version:String(e.version||""),name:String(e.Service?.Name||"unnamed"),title:e.Service?.Title?String(e.Service?.Title):void 0,abstract:e.Service?.Abstract?String(e.Service?.Abstract):void 0,keywords:Ts(e.Service?.KeywordList?.Keyword),fees:e.Service?.Fees?JSON.stringify(e.Service?.Fees):void 0,accessConstraints:e.Service?.AccessConstraints?JSON.stringify(e.Service?.AccessConstraints):void 0,layerLimit:Di(e.Service?.LayerLimit),maxWidth:Di(e.Service?.maxWidth),maxHeight:Di(e.Service?.maxHeight),layers:[],requests:TT(e.Capability?.Request),exceptions:_T(e.Exception)},n=In(e.Capability?.Layer);for(let r of n)t.layers.push($1(r));for(let[r,s]of Object.entries(t))s===void 0&&delete t[r];return t}function TT(e){let t={};for(let[n,r]of Object.entries(e||{})){let s=Ts(r?.Format);t[n]={mimeTypes:s}}return t}function _T(e){if(In(e?.Format).length>0)return{mimeTypes:Ts(e)}}function $1(e){let t={title:String(e?.Title||""),name:e?.Name&&String(e?.Name),abstract:e?.Name&&String(e?.Abstract),keywords:Ts(e.KeywordList?.Keyword)},n=e?.CRS||e?.SRS;n&&Array.isArray(n)&&n.every(h=>typeof h=="string")&&(t.crs=n);let r=e?.EX_GeographicBoundingBox&&ST(e?.EX_GeographicBoundingBox);r&&(t.geographicBoundingBox=r),r=e?.LatLonBoundingBox&&BT(e?.LatLonBoundingBox),r&&(t.geographicBoundingBox=r);let s=e?.BoundingBox&&CT(e?.BoundingBox);s&&s.length>0&&(t.boundingBoxes=s);let o=In(e?.Dimension).map(h=>RT(h));o.length&&(t.dimensions=o),e?.opaque&&(t.opaque=bn(e?.opaque)),e?.cascaded&&(t.cascaded=bn(e?.cascaded)),e?.queryable&&(t.queryable=bn(e?.queryable));let c=In(e?.Layer),a=[];for(let h of c)a.push($1(h));a.length>0&&(t.layers=a);for(let[h,l]of Object.entries(t))l===void 0&&delete t[h];return t}function ST(e){let{westBoundLongitude:t,northBoundLatitude:n,eastBoundLongitude:r,southBoundLatitude:s}=e;return[[t,s],[r,n]]}function BT(e){let{minx:t,miny:n,maxx:r,maxy:s}=e;return[[t,n],[r,s]]}function CT(e){return In(e).map(n=>LT(n))}function LT(e){let{CRS:t,SRS:n,minx:r,miny:s,maxx:i,maxy:o,resx:c,resy:a}=e,h={crs:t||n,boundingBox:[[_s(r),_s(s)],[_s(i),_s(o)]]};return c&&(h.xResolution=c),a&&(h.yResolution=a),h}function RT(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=bn(e.multipleValues)),e.nearestValue&&(s.nearestValue=bn(e.nearestValue)),e.current&&(s.current=bn(e.current)),s}function tp(e,t){t?.geographicBoundingBox&&!e.geographicBoundingBox&&(e.geographicBoundingBox=[...t.geographicBoundingBox]),t?.crs&&!e.crs&&(e.crs=[...t.crs]),t?.boundingBoxes&&!e.boundingBoxes&&(e.boundingBoxes=[...t.boundingBoxes]),t?.dimensions&&!e.dimensions&&(e.dimensions=[...t.dimensions]);for(let n of e.layers||[])tp(n,e)}var wT="4.2.1",ar={dataType:null,batchType:null,id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:wT,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:IT,options:{wms:{}},parse:async(e,t)=>va(new TextDecoder().decode(e),t?.wms),parseTextSync:(e,t)=>va(e,t?.wms)};function IT(e){return e.startsWith("<?xml")}function Da(e,t){let r=(re.parseTextSync?.(e,t)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(r)?r:[r]).map(i=>bT(i))}}function bT(e){return{attributes:e||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var ep={...ar,dataType:null,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(e,t)=>Da(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Da(e,t)};function Ua(e,t){return re.parseTextSync?.(e,t)}var np={...ar,dataType:null,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(e,t)=>Ua(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Ua(e,t)};function rp(e,t){let{type:n="auto"}=e,r=n==="auto"?PT(e.url,t):OT(n,t);if(!r)throw new Error("Not a valid image source type");return r.create(e)}function OT(e,t){for(let n of t)if(n.type===e)return n;return null}function PT(e,t){for(let n of t)if(n.testURL&&n.testURL(e))return n;return null}var sp="4.2.1";var NT=globalThis.loaders?.parseImageNode,Ga=typeof Image<"u",za=typeof ImageBitmap<"u",FT=Boolean(NT),ka=ms?!0:FT;function ip(e){switch(e){case"auto":return za||Ga||ka;case"imagebitmap":return za;case"image":return Ga;case"data":return ka;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function op(){if(za)return"imagebitmap";if(Ga)return"image";if(ka)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function cp(e){let t=vT(e);if(!t)throw new Error("Not an image");return t}function Ss(e){switch(cp(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 vT(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 DT=/^data:image\/svg\+xml/,UT=/\.svg((\?|#).*)?$/;function Ui(e){return e&&(DT.test(e)||UT.test(e))}function ap(e,t){if(Ui(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 Va(e,t)}function Va(e,t){if(Ui(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Gi(e,t,n){let r=ap(e,n),s=self.URL||self.webkitURL,i=typeof r!="string"&&s.createObjectURL(r);try{return await GT(i||r,t)}finally{i&&s.revokeObjectURL(i)}}async function GT(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 zT={},hp=!0;async function lp(e,t,n){let r;Ui(n)?r=await Gi(e,t,n):r=Va(e,n);let s=t&&t.imagebitmap;return await kT(r,s)}async function kT(e,t=null){if((VT(t)||!hp)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),hp=!1}return await createImageBitmap(e)}function VT(e){for(let t in e||zT)return!1;return!0}function fp(e){return!WT(e,"ftyp",4)||!(e[8]&96)?null:qT(e)}function qT(e){switch(HT(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function HT(e,t,n){return String.fromCharCode(...e.slice(t,n))}function YT(e){return[...e].map(t=>t.charCodeAt(0))}function WT(e,t,n=0){let r=YT(t);for(let s=0;s<r.length;++s)if(r[s]!==e[s+n])return!1;return!0}var ge=!1,Bs=!0;function On(e){let t=Cs(e);return XT(t)||ZT(t)||jT(t)||KT(t)||JT(t)}function JT(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=fp(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function XT(e){let t=Cs(e);return t.byteLength>=24&&t.getUint32(0,ge)===2303741511?{mimeType:"image/png",width:t.getUint32(16,ge),height:t.getUint32(20,ge)}:null}function jT(e){let t=Cs(e);return t.byteLength>=10&&t.getUint32(0,ge)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,Bs),height:t.getUint16(8,Bs)}:null}function KT(e){let t=Cs(e);return t.byteLength>=14&&t.getUint16(0,ge)===16973&&t.getUint32(2,Bs)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,Bs),height:t.getUint32(22,Bs)}:null}function ZT(e){let t=Cs(e);if(!(t.byteLength>=3&&t.getUint16(0,ge)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:s}=QT(),i=2;for(;i+9<t.byteLength;){let o=t.getUint16(i,ge);if(s.has(o))return{mimeType:"image/jpeg",height:t.getUint16(i+5,ge),width:t.getUint16(i+7,ge)};if(!r.has(o))return null;i+=2,i+=t.getUint16(i,ge)}return null}function QT(){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 Cs(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 pp(e,t){let{mimeType:n}=On(e)||{},r=globalThis.loaders?.parseImageNode;return z(r),await r(e,n)}async function up(e,t,n){t=t||{};let s=(t.image||{}).type||"auto",{url:i}=n||{},o=$T(s),c;switch(o){case"imagebitmap":c=await lp(e,t,i);break;case"image":c=await Gi(e,t,i);break;case"data":c=await pp(e,t);break;default:z(!1)}return s==="data"&&(c=Ss(c)),c}function $T(e){switch(e){case"auto":case"data":return op();default:return ip(e),e}}var t_=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],e_=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],n_={image:{type:"auto",decode:!0}},Qe={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:sp,mimeTypes:e_,extensions:t_,parse:up,tests:[e=>Boolean(On(new DataView(e)))],options:n_};var qa={};function Ha(e){if(qa[e]===void 0){let t=ms?s_(e):r_(e);qa[e]=t}return qa[e]}function r_(e){let t=["image/png","image/jpeg","image/gif"],n=globalThis.loaders?.imageFormatsNode||t,r=globalThis.loaders?.parseImageNode;return Boolean(r)&&n.includes(e)}function s_(e){switch(e){case"image/avif":case"image/webp":return i_(e);default:return!0}}function i_(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var dp={type:"wms",testURL:e=>e.toLowerCase().includes("wms"),create:e=>new Ya(e)},Ya=class extends Wt{url;data;substituteCRS84;flipCRS;wmsParameters;vendorParameters;capabilities=null;constructor(t){super(t),this.url=t.url,this.data=t.url,this.substituteCRS84=t.substituteCRS84??!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...t.wmsParameters},this.vendorParameters=t.vendorParameters||{}}async getMetadata(){let t=await this.getCapabilities();return this.normalizeMetadata(t)}async getImage(t){let{boundingBox:n,bbox:r,...s}=t,i={bbox:n?[...n[0],...n[1]]:r,...s};return await this.getMap(i)}normalizeMetadata(t){return t}async getCapabilities(t,n){let r=this.getCapabilitiesURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);let o=await ar.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 Qe.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 ep.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 np.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 Qe.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}getCapabilitiesURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetCapabilities",r,n)}getMapURL(t,n){t=this._getWMS130Parameters(t);let r={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetMap",r,n)}getFeatureInfoURL(t,n){t=this._getWMS130Parameters(t);let{boundingBox:r,bbox:s}=t;t.bbox=r?[...r[0],...r[1]]:s;let i={version:this.wmsParameters.version,info_format:this.wmsParameters.info_format,layers:this.wmsParameters.layers,query_layers:this.wmsParameters.query_layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetFeatureInfo",i,n)}describeLayerURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("DescribeLayer",r,n)}getLegendGraphicURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetLegendGraphic",r,n)}_parseWMSUrl(t){let[n,r]=t.split("?"),s=r.split("&"),i={};for(let o of s){let[c,a]=o.split("=");i[c]=a}return{url:n,parameters:i}}_getWMSUrl(t,n,r){let s=this.url,i=!0,o={service:"WMS",version:n.version,request:t,...n,...this.vendorParameters,...r},c=["transparent","time","elevation"];for(let[a,h]of Object.entries(o))(!c.includes(a)||h)&&(s+=i?"?":"&",i=!1,s+=this._getURLParameter(a,h,n));return encodeURI(s)}_getWMS130Parameters(t){let n={...t};return n.srs&&(n.crs=n.crs||n.srs,delete n.srs),n}_getURLParameter(t,n,r){switch(t){case"crs":r.version!=="1.3.0"?t="srs":this.substituteCRS84&&n==="EPSG:4326"&&(n="CRS:84");break;case"srs":r.version==="1.3.0"&&(t="crs");break;case"bbox":let s=this._flipBoundingBox(n,r);s&&(n=s);break;case"x":r.version==="1.3.0"&&(t="i");break;case"y":r.version==="1.3.0"&&(t="j");break;default:}return t=t.toUpperCase(),Array.isArray(n)?`${t}=${n.join(",")}`:`${t}=${n?String(n):""}`}_flipBoundingBox(t,n){if(!Array.isArray(t)||t.length!==4)return null;let r=n.version==="1.3.0"&&this.flipCRS.includes(n.crs||"")&&!(this.substituteCRS84&&n.crs==="EPSG:4326"),s=t;return r?[s[1],s[0],s[3],s[2]]:s}async _fetchArrayBuffer(t){let n=await this.fetch(t),r=await n.arrayBuffer();return this._checkResponse(n,r),r}_checkResponse(t,n){let r=t.headers["content-type"];if(!t.ok||Es.mimeTypes.includes(r)){let s=Ra(this.loadOptions,{wms:{throwOnError:!0}}),i=Es.parseSync?.(n,s);throw new Error(i)}}_parseError(t){let n=Es.parseSync?.(t,this.loadOptions);return new Error(n)}};var hr=class extends Wt{constructor(t){super(t)}async getMetadata(){throw new Error("ImageSource.getMetadata not implemented")}async getImage(t){let n=this.getGranularParameters(t),r=this.getURLFromTemplate(n),i=await(await this.fetch(r)).arrayBuffer();return await Qe.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}};sr(hr,"type","template"),sr(hr,"testURL",t=>t.toLowerCase().includes("{"));var Wa=class extends hr{data;constructor(t){super(t),this.data=t.url}async getMetadata(){return await this.metadata()}async getImage(t){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(t){throw new Error("not implemented")}metadataURL(t){return`${this.props.url}?f=pjson`}exportImageURL(t){let n=`bbox=${t.bbox[0]},${t.bbox[1]},${t.bbox[2]},${t.bbox[3]}`,r=`size=${t.width},${t.height}`,s={...t,bbox:n,size:r};return delete s.width,delete s.height,this.getUrl("exportImage",s)}getUrl(t,n,r){let s=`${this.props.url}/${t}`,i=!0;for(let[o,c]of Object.entries(n))s+=i?"?":"&",i=!1,Array.isArray(c)?s+=`${o.toUpperCase()}=${c.join(",")}`:s+=`${o.toUpperCase()}=${c?String(c):""}`;return s}async checkResponse(t){if(!t.ok)throw new Error("error")}},mp={type:"arcgis-image-server",testURL:e=>e.toLowerCase().includes("ImageServer"),create:e=>new Wa(e)};var o_=[dp,mp];function Ja(e){return rp(e,o_)}var K8=1/Math.PI*180,Z8=1/180*Math.PI,c_={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...c_}};var pt=globalThis.mathgl.config;function Xa(e,{precision:t=pt.precision}={}){return e=a_(e),`${parseFloat(e.toPrecision(t))}`}function xe(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function $e(e,t,n){return xe(e)?e.map((r,s)=>$e(r,t[s],n)):n*t+(1-n)*e}function Me(e,t,n){let r=pt.EPSILON;n&&(pt.EPSILON=n);try{if(e===t)return!0;if(xe(e)&&xe(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Me(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)<=pt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{pt.EPSILON=r}}function a_(e){return Math.round(e/pt.EPSILON)*pt.EPSILON}var tn=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:xe(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(pt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+Xa(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!Me(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(pt.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function h_(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 H(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function en(e,t,n=""){if(pt.debug&&!h_(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function Ae(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var lr=class extends tn{get x(){return this[0]}set x(t){this[0]=H(t)}get y(){return this[1]}set y(t){this[1]=H(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 H(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return H(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 Ae(t>=0&&t<this.ELEMENTS,"index is out of range"),H(this[t])}setComponent(t,n){return Ae(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 ot=typeof Float32Array<"u"?Float32Array:Array;var aD=Math.PI/180;function l_(){let e=new ot(2);return ot!=Float32Array&&(e[0]=0,e[1]=0),e}function Mp(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 Ap(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 hD=function(){let e=l_();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function yp(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 zi(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 Ep(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 Tp(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 ki(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function ja(){let e=new ot(3);return ot!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function f_(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function Ka(e,t,n){let r=new ot(3);return r[0]=e,r[1]=t,r[2]=n,r}function _p(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 Za(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function pr(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function ur(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 Vi(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 qi(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function Sp(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 Bp(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 Cp(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 Lp(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&Za(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var Rp=f_;var pD=function(){let e=ja();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var Qa=[0,0,0],Hi,O=class extends lr{static get ZERO(){return Hi||(Hi=new O(0,0,0),Object.freeze(Hi)),Hi}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&xe(t)?this.copy(t):(pt.debug&&(H(t),H(n),H(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 pt.debug&&(H(t.x),H(t.y),H(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]=H(t)}angle(t){return Lp(this,t)}cross(t){return pr(this,this,t),this.check()}rotateX({radians:t,origin:n=Qa}){return Sp(this,this,n,t),this.check()}rotateY({radians:t,origin:n=Qa}){return Bp(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=Qa}){return Cp(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return ur(this,this,t),this.check()}transformAsVector(t){return zi(this,this,t),this.check()}transformByMatrix3(t){return Vi(this,this,t),this.check()}transformByMatrix2(t){return Ep(this,this,t),this.check()}transformByQuaternion(t){return qi(this,this,t),this.check()}};var Yi,dr=class extends lr{static get ZERO(){return Yi||(Yi=new dr(0,0,0,0),Object.freeze(Yi)),Yi}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),xe(t)&&arguments.length===1?this.copy(t):(pt.debug&&(H(t),H(n),H(r),H(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 pt.debug&&(H(t.x),H(t.y),H(t.z),H(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]=H(t)}get w(){return this[3]}set w(t){this[3]=H(t)}transform(t){return ur(this,this,t),this.check()}transformByMatrix3(t){return ki(this,this,t),this.check()}transformByMatrix2(t){return Tp(this,this,t),this.check()}transformByQuaternion(t){return qi(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var mr=class extends tn{toString(){let t="[";if(pt.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=H(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 wp(){let e=new ot(9);return ot!=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 Ip(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 bp(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=l*o-c*h,p=-l*i+c*a,u=h*i-o*a,d=n*f+r*p+s*u;return d?(d=1/d,e[0]=f*d,e[1]=(-l*r+s*h)*d,e[2]=(c*r-s*o)*d,e[3]=p*d,e[4]=(l*n-s*a)*d,e[5]=(-c*n+s*i)*d,e[6]=u*d,e[7]=(-h*n+r*a)*d,e[8]=(o*n-r*i)*d,e):null}function Op(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8];return t*(h*i-o*a)+n*(-h*s+o*c)+r*(a*s-i*c)}function $a(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1],d=n[2],g=n[3],m=n[4],M=n[5],E=n[6],A=n[7],y=n[8];return e[0]=p*r+u*o+d*h,e[1]=p*s+u*c+d*l,e[2]=p*i+u*a+d*f,e[3]=g*r+m*o+M*h,e[4]=g*s+m*c+M*l,e[5]=g*i+m*a+M*f,e[6]=E*r+A*o+y*h,e[7]=E*s+A*c+y*l,e[8]=E*i+A*a+y*f,e}function Pp(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=p*r+u*o+h,e[7]=p*s+u*c+l,e[8]=p*i+u*a+f,e}function Np(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=Math.sin(n),u=Math.cos(n);return e[0]=u*r+p*o,e[1]=u*s+p*c,e[2]=u*i+p*a,e[3]=u*o-p*r,e[4]=u*c-p*s,e[5]=u*a-p*i,e[6]=h,e[7]=l,e[8]=f,e}function th(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 Fp(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[3]=l-M,e[6]=p+m,e[1]=l+M,e[4]=1-h-d,e[7]=u-g,e[2]=p-m,e[5]=u+g,e[8]=1-h-f,e}var eh;(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"})(eh||(eh={}));var d_=Object.freeze([1,0,0,0,1,0,0,0,1]),ct=class extends mr{static get IDENTITY(){return g_()}static get ZERO(){return m_()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return eh}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(d_)}fromObject(t){return this.check()}fromQuaternion(t){return Fp(this,t),this.check()}set(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=h,this.check()}determinant(){return Op(this)}transpose(){return Ip(this,this),this.check()}invert(){return bp(this,this),this.check()}multiplyLeft(t){return $a(this,t,this),this.check()}multiplyRight(t){return $a(this,this,t),this.check()}rotate(t){return Np(this,this,t),this.check()}scale(t){return Array.isArray(t)?th(this,this,t):th(this,this,[t,t]),this.check()}translate(t){return Pp(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=Mp(n||[-0,-0],t,this);break;case 3:r=Vi(n||[-0,-0,-0],t,this);break;case 4:r=ki(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return en(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)}},Wi,Ji=null;function m_(){return Wi||(Wi=new ct([0,0,0,0,0,0,0,0,0]),Object.freeze(Wi)),Wi}function g_(){return Ji||(Ji=new ct,Object.freeze(Ji)),Ji}var Rs={};At(Rs,{add:()=>k_,adjoint:()=>T_,clone:()=>M_,copy:()=>A_,create:()=>x_,decompose:()=>O_,determinant:()=>sh,equals:()=>Y_,exactEquals:()=>H_,frob:()=>z_,fromQuat:()=>fh,fromQuat2:()=>w_,fromRotation:()=>B_,fromRotationTranslation:()=>Dp,fromRotationTranslationScale:()=>P_,fromRotationTranslationScaleOrigin:()=>N_,fromScaling:()=>S_,fromTranslation:()=>__,fromValues:()=>y_,fromXRotation:()=>C_,fromYRotation:()=>L_,fromZRotation:()=>R_,frustum:()=>ph,getRotation:()=>b_,getScaling:()=>Up,getTranslation:()=>I_,identity:()=>vp,invert:()=>rh,lookAt:()=>mh,mul:()=>W_,multiply:()=>Ls,multiplyScalar:()=>V_,multiplyScalarAndAdd:()=>q_,ortho:()=>dh,orthoNO:()=>zp,orthoZO:()=>D_,perspective:()=>uh,perspectiveFromFieldOfView:()=>v_,perspectiveNO:()=>Gp,perspectiveZO:()=>F_,rotate:()=>ch,rotateX:()=>ah,rotateY:()=>hh,rotateZ:()=>lh,scale:()=>oh,set:()=>E_,str:()=>G_,sub:()=>J_,subtract:()=>kp,targetTo:()=>U_,translate:()=>ih,transpose:()=>nh});function x_(){let e=new ot(16);return ot!=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 M_(e){let t=new ot(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 A_(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 y_(e,t,n,r,s,i,o,c,a,h,l,f,p,u,d,g){let m=new ot(16);return m[0]=e,m[1]=t,m[2]=n,m[3]=r,m[4]=s,m[5]=i,m[6]=o,m[7]=c,m[8]=a,m[9]=h,m[10]=l,m[11]=f,m[12]=p,m[13]=u,m[14]=d,m[15]=g,m}function E_(e,t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=i,e[5]=o,e[6]=c,e[7]=a,e[8]=h,e[9]=l,e[10]=f,e[11]=p,e[12]=u,e[13]=d,e[14]=g,e[15]=m,e}function vp(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 nh(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function rh(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,B=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,w=f*M-u*g,I=p*M-u*m,C=E*I-A*w+y*R+T*x-_*S+L*B;return C?(C=1/C,e[0]=(c*I-a*w+h*R)*C,e[1]=(s*w-r*I-i*R)*C,e[2]=(g*L-m*_+M*T)*C,e[3]=(p*_-f*L-u*T)*C,e[4]=(a*x-o*I-h*S)*C,e[5]=(n*I-s*x+i*S)*C,e[6]=(m*y-d*L-M*A)*C,e[7]=(l*L-p*y+u*A)*C,e[8]=(o*w-c*x+h*B)*C,e[9]=(r*x-n*w-i*B)*C,e[10]=(d*_-g*y+M*E)*C,e[11]=(f*y-l*_-u*E)*C,e[12]=(c*S-o*R-a*B)*C,e[13]=(n*R-r*S+s*B)*C,e[14]=(g*A-d*T-m*E)*C,e[15]=(l*T-f*A+p*E)*C,e):null}function T_(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,B=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,w=f*M-u*g,I=p*M-u*m;return e[0]=c*I-a*w+h*R,e[1]=s*w-r*I-i*R,e[2]=g*L-m*_+M*T,e[3]=p*_-f*L-u*T,e[4]=a*x-o*I-h*S,e[5]=n*I-s*x+i*S,e[6]=m*y-d*L-M*A,e[7]=l*L-p*y+u*A,e[8]=o*w-c*x+h*B,e[9]=r*x-n*w-i*B,e[10]=d*_-g*y+M*E,e[11]=f*y-l*_-u*E,e[12]=c*S-o*R-a*B,e[13]=n*R-r*S+s*B,e[14]=g*A-d*T-m*E,e[15]=l*T-f*A+p*E,e}function sh(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8],l=e[9],f=e[10],p=e[11],u=e[12],d=e[13],g=e[14],m=e[15],M=t*o-n*i,E=t*c-r*i,A=n*c-r*o,y=h*d-l*u,T=h*g-f*u,_=l*g-f*d,L=t*_-n*T+r*y,B=i*_-o*T+c*y,S=h*A-l*E+f*M,x=u*A-d*E+g*M;return a*L-s*B+m*S-p*x}function Ls(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=t[9],u=t[10],d=t[11],g=t[12],m=t[13],M=t[14],E=t[15],A=n[0],y=n[1],T=n[2],_=n[3];return e[0]=A*r+y*c+T*f+_*g,e[1]=A*s+y*a+T*p+_*m,e[2]=A*i+y*h+T*u+_*M,e[3]=A*o+y*l+T*d+_*E,A=n[4],y=n[5],T=n[6],_=n[7],e[4]=A*r+y*c+T*f+_*g,e[5]=A*s+y*a+T*p+_*m,e[6]=A*i+y*h+T*u+_*M,e[7]=A*o+y*l+T*d+_*E,A=n[8],y=n[9],T=n[10],_=n[11],e[8]=A*r+y*c+T*f+_*g,e[9]=A*s+y*a+T*p+_*m,e[10]=A*i+y*h+T*u+_*M,e[11]=A*o+y*l+T*d+_*E,A=n[12],y=n[13],T=n[14],_=n[15],e[12]=A*r+y*c+T*f+_*g,e[13]=A*s+y*a+T*p+_*m,e[14]=A*i+y*h+T*u+_*M,e[15]=A*o+y*l+T*d+_*E,e}function ih(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,h,l,f,p,u,d,g,m,M;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],h=t[3],l=t[4],f=t[5],p=t[6],u=t[7],d=t[8],g=t[9],m=t[10],M=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=p,e[7]=u,e[8]=d,e[9]=g,e[10]=m,e[11]=M,e[12]=o*r+l*s+d*i+t[12],e[13]=c*r+f*s+g*i+t[13],e[14]=a*r+p*s+m*i+t[14],e[15]=h*r+u*s+M*i+t[15]),e}function oh(e,t,n){let r=n[0],s=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function ch(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,h,l,f,p,u,d,g,m,M,E,A,y,T,_,L,B,S,x,R,w,I,C,P;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,h=Math.sin(n),a=Math.cos(n),l=1-a,f=t[0],p=t[1],u=t[2],d=t[3],g=t[4],m=t[5],M=t[6],E=t[7],A=t[8],y=t[9],T=t[10],_=t[11],L=s*s*l+a,B=i*s*l+o*h,S=o*s*l-i*h,x=s*i*l-o*h,R=i*i*l+a,w=o*i*l+s*h,I=s*o*l+i*h,C=i*o*l-s*h,P=o*o*l+a,e[0]=f*L+g*B+A*S,e[1]=p*L+m*B+y*S,e[2]=u*L+M*B+T*S,e[3]=d*L+E*B+_*S,e[4]=f*x+g*R+A*w,e[5]=p*x+m*R+y*w,e[6]=u*x+M*R+T*w,e[7]=d*x+E*R+_*w,e[8]=f*I+g*C+A*P,e[9]=p*I+m*C+y*P,e[10]=u*I+M*C+T*P,e[11]=d*I+E*C+_*P,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function ah(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],h=t[8],l=t[9],f=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=i*s+h*r,e[5]=o*s+l*r,e[6]=c*s+f*r,e[7]=a*s+p*r,e[8]=h*s-i*r,e[9]=l*s-o*r,e[10]=f*s-c*r,e[11]=p*s-a*r,e}function hh(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[8],l=t[9],f=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s-h*r,e[1]=o*s-l*r,e[2]=c*s-f*r,e[3]=a*s-p*r,e[8]=i*r+h*s,e[9]=o*r+l*s,e[10]=c*r+f*s,e[11]=a*r+p*s,e}function lh(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[4],l=t[5],f=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s+h*r,e[1]=o*s+l*r,e[2]=c*s+f*r,e[3]=a*s+p*r,e[4]=h*s-i*r,e[5]=l*s-o*r,e[6]=f*s-c*r,e[7]=p*s-a*r,e}function __(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 S_(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 B_(e,t,n){let r=n[0],s=n[1],i=n[2],o=Math.sqrt(r*r+s*s+i*i),c,a,h;return o<1e-6?null:(o=1/o,r*=o,s*=o,i*=o,a=Math.sin(t),c=Math.cos(t),h=1-c,e[0]=r*r*h+c,e[1]=s*r*h+i*a,e[2]=i*r*h-s*a,e[3]=0,e[4]=r*s*h-i*a,e[5]=s*s*h+c,e[6]=i*s*h+r*a,e[7]=0,e[8]=r*i*h+s*a,e[9]=s*i*h-r*a,e[10]=i*i*h+c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function C_(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 L_(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 R_(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 Dp(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=r+r,a=s+s,h=i+i,l=r*c,f=r*a,p=r*h,u=s*a,d=s*h,g=i*h,m=o*c,M=o*a,E=o*h;return e[0]=1-(u+g),e[1]=f+E,e[2]=p-M,e[3]=0,e[4]=f-E,e[5]=1-(l+g),e[6]=d+m,e[7]=0,e[8]=p+M,e[9]=d-m,e[10]=1-(l+u),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function w_(e,t){let n=new ot(3),r=-t[0],s=-t[1],i=-t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=r*r+s*s+i*i+o*o;return f>0?(n[0]=(c*o+l*r+a*i-h*s)*2/f,n[1]=(a*o+l*s+h*r-c*i)*2/f,n[2]=(h*o+l*i+c*s-a*r)*2/f):(n[0]=(c*o+l*r+a*i-h*s)*2,n[1]=(a*o+l*s+h*r-c*i)*2,n[2]=(h*o+l*i+c*s-a*r)*2),Dp(e,t,n),e}function I_(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Up(e,t){let n=t[0],r=t[1],s=t[2],i=t[4],o=t[5],c=t[6],a=t[8],h=t[9],l=t[10];return e[0]=Math.sqrt(n*n+r*r+s*s),e[1]=Math.sqrt(i*i+o*o+c*c),e[2]=Math.sqrt(a*a+h*h+l*l),e}function b_(e,t){let n=new ot(3);Up(n,t);let r=1/n[0],s=1/n[1],i=1/n[2],o=t[0]*r,c=t[1]*s,a=t[2]*i,h=t[4]*r,l=t[5]*s,f=t[6]*i,p=t[8]*r,u=t[9]*s,d=t[10]*i,g=o+l+d,m=0;return g>0?(m=Math.sqrt(g+1)*2,e[3]=.25*m,e[0]=(f-u)/m,e[1]=(p-a)/m,e[2]=(c-h)/m):o>l&&o>d?(m=Math.sqrt(1+o-l-d)*2,e[3]=(f-u)/m,e[0]=.25*m,e[1]=(c+h)/m,e[2]=(p+a)/m):l>d?(m=Math.sqrt(1+l-o-d)*2,e[3]=(p-a)/m,e[0]=(c+h)/m,e[1]=.25*m,e[2]=(f+u)/m):(m=Math.sqrt(1+d-o-l)*2,e[3]=(c-h)/m,e[0]=(p+a)/m,e[1]=(f+u)/m,e[2]=.25*m),e}function O_(e,t,n,r){t[0]=r[12],t[1]=r[13],t[2]=r[14];let s=r[0],i=r[1],o=r[2],c=r[4],a=r[5],h=r[6],l=r[8],f=r[9],p=r[10];n[0]=Math.sqrt(s*s+i*i+o*o),n[1]=Math.sqrt(c*c+a*a+h*h),n[2]=Math.sqrt(l*l+f*f+p*p);let u=1/n[0],d=1/n[1],g=1/n[2],m=s*u,M=i*d,E=o*g,A=c*u,y=a*d,T=h*g,_=l*u,L=f*d,B=p*g,S=m+y+B,x=0;return S>0?(x=Math.sqrt(S+1)*2,e[3]=.25*x,e[0]=(T-L)/x,e[1]=(_-E)/x,e[2]=(M-A)/x):m>y&&m>B?(x=Math.sqrt(1+m-y-B)*2,e[3]=(T-L)/x,e[0]=.25*x,e[1]=(M+A)/x,e[2]=(_+E)/x):y>B?(x=Math.sqrt(1+y-m-B)*2,e[3]=(_-E)/x,e[0]=(M+A)/x,e[1]=.25*x,e[2]=(T+L)/x):(x=Math.sqrt(1+B-m-y)*2,e[3]=(M-A)/x,e[0]=(_+E)/x,e[1]=(T+L)/x,e[2]=.25*x),e}function P_(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=s+s,h=i+i,l=o+o,f=s*a,p=s*h,u=s*l,d=i*h,g=i*l,m=o*l,M=c*a,E=c*h,A=c*l,y=r[0],T=r[1],_=r[2];return e[0]=(1-(d+m))*y,e[1]=(p+A)*y,e[2]=(u-E)*y,e[3]=0,e[4]=(p-A)*T,e[5]=(1-(f+m))*T,e[6]=(g+M)*T,e[7]=0,e[8]=(u+E)*_,e[9]=(g-M)*_,e[10]=(1-(f+d))*_,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function N_(e,t,n,r,s){let i=t[0],o=t[1],c=t[2],a=t[3],h=i+i,l=o+o,f=c+c,p=i*h,u=i*l,d=i*f,g=o*l,m=o*f,M=c*f,E=a*h,A=a*l,y=a*f,T=r[0],_=r[1],L=r[2],B=s[0],S=s[1],x=s[2],R=(1-(g+M))*T,w=(u+y)*T,I=(d-A)*T,C=(u-y)*_,P=(1-(p+M))*_,V=(m+E)*_,G=(d+A)*L,Q=(m-E)*L,q=(1-(p+g))*L;return e[0]=R,e[1]=w,e[2]=I,e[3]=0,e[4]=C,e[5]=P,e[6]=V,e[7]=0,e[8]=G,e[9]=Q,e[10]=q,e[11]=0,e[12]=n[0]+B-(R*B+C*S+G*x),e[13]=n[1]+S-(w*B+P*S+Q*x),e[14]=n[2]+x-(I*B+V*S+q*x),e[15]=1,e}function fh(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[1]=l+M,e[2]=p-m,e[3]=0,e[4]=l-M,e[5]=1-h-d,e[6]=u+g,e[7]=0,e[8]=p+m,e[9]=u-g,e[10]=1-h-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ph(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),h=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*h,e[15]=0,e}function Gp(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 uh=Gp;function F_(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 v_(e,t,n,r){let s=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),c=Math.tan(t.rightDegrees*Math.PI/180),a=2/(o+c),h=2/(s+i);return e[0]=a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=h,e[6]=0,e[7]=0,e[8]=-((o-c)*a*.5),e[9]=(s-i)*h*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function zp(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*h,e[15]=1,e}var dh=zp;function D_(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=i*h,e[15]=1,e}function mh(e,t,n,r){let s,i,o,c,a,h,l,f,p,u,d=t[0],g=t[1],m=t[2],M=r[0],E=r[1],A=r[2],y=n[0],T=n[1],_=n[2];return Math.abs(d-y)<1e-6&&Math.abs(g-T)<1e-6&&Math.abs(m-_)<1e-6?vp(e):(f=d-y,p=g-T,u=m-_,s=1/Math.sqrt(f*f+p*p+u*u),f*=s,p*=s,u*=s,i=E*u-A*p,o=A*f-M*u,c=M*p-E*f,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-u*o,h=u*i-f*c,l=f*o-p*i,s=Math.sqrt(a*a+h*h+l*l),s?(s=1/s,a*=s,h*=s,l*=s):(a=0,h=0,l=0),e[0]=i,e[1]=a,e[2]=f,e[3]=0,e[4]=o,e[5]=h,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=0,e[12]=-(i*d+o*g+c*m),e[13]=-(a*d+h*g+l*m),e[14]=-(f*d+p*g+u*m),e[15]=1,e)}function U_(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=r[0],a=r[1],h=r[2],l=s-n[0],f=i-n[1],p=o-n[2],u=l*l+f*f+p*p;u>0&&(u=1/Math.sqrt(u),l*=u,f*=u,p*=u);let d=a*p-h*f,g=h*l-c*p,m=c*f-a*l;return u=d*d+g*g+m*m,u>0&&(u=1/Math.sqrt(u),d*=u,g*=u,m*=u),e[0]=d,e[1]=g,e[2]=m,e[3]=0,e[4]=f*m-p*g,e[5]=p*d-l*m,e[6]=l*g-f*d,e[7]=0,e[8]=l,e[9]=f,e[10]=p,e[11]=0,e[12]=s,e[13]=i,e[14]=o,e[15]=1,e}function G_(e){return`mat4(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]}, ${e[4]}, ${e[5]}, ${e[6]}, ${e[7]}, ${e[8]}, ${e[9]}, ${e[10]}, ${e[11]}, ${e[12]}, ${e[13]}, ${e[14]}, ${e[15]})`}function z_(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 k_(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 kp(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 V_(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 q_(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 H_(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 Y_(e,t){let n=e[0],r=e[1],s=e[2],i=e[3],o=e[4],c=e[5],a=e[6],h=e[7],l=e[8],f=e[9],p=e[10],u=e[11],d=e[12],g=e[13],m=e[14],M=e[15],E=t[0],A=t[1],y=t[2],T=t[3],_=t[4],L=t[5],B=t[6],S=t[7],x=t[8],R=t[9],w=t[10],I=t[11],C=t[12],P=t[13],V=t[14],G=t[15];return Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(r-A)<=1e-6*Math.max(1,Math.abs(r),Math.abs(A))&&Math.abs(s-y)<=1e-6*Math.max(1,Math.abs(s),Math.abs(y))&&Math.abs(i-T)<=1e-6*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(o-_)<=1e-6*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(c-L)<=1e-6*Math.max(1,Math.abs(c),Math.abs(L))&&Math.abs(a-B)<=1e-6*Math.max(1,Math.abs(a),Math.abs(B))&&Math.abs(h-S)<=1e-6*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(l-x)<=1e-6*Math.max(1,Math.abs(l),Math.abs(x))&&Math.abs(f-R)<=1e-6*Math.max(1,Math.abs(f),Math.abs(R))&&Math.abs(p-w)<=1e-6*Math.max(1,Math.abs(p),Math.abs(w))&&Math.abs(u-I)<=1e-6*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(d-C)<=1e-6*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(g-P)<=1e-6*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(m-V)<=1e-6*Math.max(1,Math.abs(m),Math.abs(V))&&Math.abs(M-G)<=1e-6*Math.max(1,Math.abs(M),Math.abs(G))}var W_=Ls,J_=kp;function X_(){let e=new ot(4);return ot!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Vp(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 qp(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 Hp(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 Yp(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function Wp(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 Jp(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Xp(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function jp(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 Kp(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2],h=n[3],l=h*r+c*i-a*s,f=h*s+a*r-o*i,p=h*i+o*s-c*r,u=-o*r-c*s-a*i;return e[0]=l*h+u*-o+f*-a-p*-c,e[1]=f*h+u*-c+p*-o-l*-a,e[2]=p*h+u*-a+l*-c-f*-o,e[3]=t[3],e}var vD=function(){let e=X_();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var Mh;(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"})(Mh||(Mh={}));var K_=45*Math.PI/180,Z_=1,gh=.1,xh=500,Q_=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Ht=class extends mr{static get IDENTITY(){return tS()}static get ZERO(){return $_()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Mh}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this[9]=l,this[10]=f,this[11]=p,this[12]=u,this[13]=d,this[14]=g,this[15]=m,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=i,this[2]=h,this[3]=u,this[4]=n,this[5]=o,this[6]=l,this[7]=d,this[8]=r,this[9]=c,this[10]=f,this[11]=g,this[12]=s,this[13]=a,this[14]=p,this[15]=m,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(Q_)}fromObject(t){return this.check()}fromQuaternion(t){return fh(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=gh,far:c=xh}=t;return c===1/0?eS(this,n,r,s,i,o):ph(this,n,r,s,i,o,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return mh(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=gh,far:c=xh}=t;return dh(this,n,r,s,i,o,c),this.check()}orthographic(t){let{fovy:n=K_,aspect:r=Z_,focalDistance:s=1,near:i=gh,far:o=xh}=t;Zp(n);let c=n/2,a=s*Math.tan(c),h=a*r;return this.ortho({left:-h,right:h,bottom:-a,top:a,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return Zp(n),uh(this,n,r,s,i),this.check()}determinant(){return sh(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 nh(this,this),this.check()}invert(){return rh(this,this),this.check()}multiplyLeft(t){return Ls(this,t,this),this.check()}multiplyRight(t){return Ls(this,this,t),this.check()}rotateX(t){return ah(this,this,t),this.check()}rotateY(t){return hh(this,this,t),this.check()}rotateZ(t){return lh(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return ch(this,this,t,n),this.check()}scale(t){return oh(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return ih(this,this,t),this.check()}transform(t,n){return t.length===4?(n=jp(n||[-0,-0,-0,-0],t,this),en(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=Ap(n||[-0,-0],t,this);break;case 3:s=ur(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return en(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=yp(n||[-0,-0],t,this);break;case 3:r=zi(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return en(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])}},Xi,ji;function $_(){return Xi||(Xi=new Ht([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Xi)),Xi}function tS(){return ji||(ji=new Ht,Object.freeze(ji)),ji}function Zp(e){if(e>Math.PI*2)throw Error("expected radians")}function eS(e,t,n,r,s,i){let o=2*i/(n-t),c=2*i/(s-r),a=(n+t)/(n-t),h=(s+r)/(s-r),l=-1,f=-1,p=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=h,e[10]=l,e[11]=f,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function Qp(){let e=new ot(4);return ot!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function $p(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Ah(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 yh(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*l+o*c+s*h-i*a,e[1]=s*l+o*a+i*c-r*h,e[2]=i*l+o*h+r*a-s*c,e[3]=o*l-r*c-s*a-i*h,e}function tu(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function eu(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function nu(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function ru(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 ws(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],h=n[1],l=n[2],f=n[3],p,u,d,g,m;return p=s*a+i*h+o*l+c*f,p<0&&(p=-p,a=-a,h=-h,l=-l,f=-f),1-p>1e-6?(u=Math.acos(p),m=Math.sin(u),d=Math.sin((1-r)*u)/m,g=Math.sin(r*u)/m):(d=1-r,g=r),e[0]=d*s+g*a,e[1]=d*i+g*h,e[2]=d*o+g*l,e[3]=d*c+g*f,e}function su(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function iu(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Eh(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 ou=Vp;var cu=qp,au=Jp,hu=Xp,lu=Hp;var fu=Yp;var pu=Wp;var uu=function(){let e=ja(),t=Ka(1,0,0),n=Ka(0,1,0);return function(r,s,i){let o=Za(s,i);return o<-.999999?(pr(e,t,s),Rp(e)<1e-6&&pr(e,n,s),_p(e,e),Ah(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(pr(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,pu(r,r))}}(),KD=function(){let e=Qp(),t=Qp();return function(n,r,s,i,o,c){return ws(e,r,o,c),ws(t,s,i,c),ws(n,e,t,2*c*(1-c)),n}}(),ZD=function(){let e=wp();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],pu(t,Eh(t,e))}}();var nS=[0,0,0,1],gr=class extends tn{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 Eh(this,t),this.check()}fromAxisRotation(t,n){return Ah(this,t,n),this.check()}identity(){return $p(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]=H(t)}get y(){return this[1]}set y(t){this[1]=H(t)}get z(){return this[2]}set z(t){this[2]=H(t)}get w(){return this[3]}set w(t){this[3]=H(t)}len(){return lu(this)}lengthSquared(){return fu(this)}dot(t){return au(this,t)}rotationTo(t,n){return uu(this,t,n),this.check()}add(t){return ou(this,this,t),this.check()}calculateW(){return ru(this,this),this.check()}conjugate(){return iu(this,this),this.check()}invert(){return su(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(hu(this,t,n,r),this.check())}multiplyRight(t){return yh(this,this,t),this.check()}multiplyLeft(t){return yh(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 tu(this,this,t),this.check()}rotateY(t){return eu(this,this,t),this.check()}rotateZ(t){return nu(this,this,t),this.check()}scale(t){return cu(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=nS,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return ws(this,s,i,o),this.check()}transformVector4(t,n=new dr){return Kp(n,t,this),en(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 xr={};At(xr,{EPSILON1:()=>rS,EPSILON10:()=>pS,EPSILON11:()=>uS,EPSILON12:()=>dS,EPSILON13:()=>mS,EPSILON14:()=>gS,EPSILON15:()=>xS,EPSILON16:()=>MS,EPSILON17:()=>AS,EPSILON18:()=>yS,EPSILON19:()=>ES,EPSILON2:()=>sS,EPSILON20:()=>TS,EPSILON3:()=>iS,EPSILON4:()=>oS,EPSILON5:()=>cS,EPSILON6:()=>aS,EPSILON7:()=>hS,EPSILON8:()=>lS,EPSILON9:()=>fS,PI_OVER_FOUR:()=>SS,PI_OVER_SIX:()=>BS,PI_OVER_TWO:()=>_S,TWO_PI:()=>CS});var rS=.1,sS=.01,iS=.001,oS=1e-4,cS=1e-5,aS=1e-6,hS=1e-7,lS=1e-8,fS=1e-9,pS=1e-10,uS=1e-11,dS=1e-12,mS=1e-13,gS=1e-14,xS=1e-15,MS=1e-16,AS=1e-17,yS=1e-18,ES=1e-19,TS=1e-20,_S=Math.PI/2,SS=Math.PI/4,BS=Math.PI/6,CS=Math.PI*2;function Ki(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var se=Math.PI,xu=se/4,du=se/180,mu=180/se,Zi=512;function Ie(e){let[t,n]=e;Ki(Number.isFinite(t)),Ki(Number.isFinite(n)&&n>=-90&&n<=90,"invalid latitude");let r=t*du,s=n*du,i=Zi*(r+se)/(2*se),o=Zi*(se+Math.log(Math.tan(xu+s*.5)))/(2*se);return[i,o]}function be(e){let[t,n]=e,r=t/Zi*(2*se)-se,s=2*(Math.atan(Math.exp(n/Zi*(2*se)-se))-xu);return[r*mu,s*mu]}var U6=Math.PI/180;var Au=6378137*Math.PI;function Th(e){let t=Ie(e);return t[0]=(t[0]/256-1)*Au,t[1]=(t[1]/256-1)*Au,t}var VS={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)}},Mr=class extends Pn.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,Pn._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 yu.BitmapLayer({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:r.srs==="EPSG:4326"?Pn.COORDINATE_SYSTEM.LNGLAT:Pn.COORDINATE_SYSTEM.CARTESIAN,bounds:t,image:n})}async getFeatureInfoText(t,n){let{lastRequestParameters:r}=this.state;return r?await this.state.imageSource.getFeatureInfoText?.({...r,query_layers:r.layers,x:t,y:n,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(t){if(t.data instanceof Wt)return t.data;if(typeof t.data=="string")return Ja({url:t.data,loadOptions:t.loadOptions,type:t.serviceType});throw new Error("invalid image source in props.data")}async _loadMetadata(){let{imageSource:t}=this.state;try{this.state.loadCounter++;let n=await t.getMetadata();this.state.imageSource===t&&this.getCurrentLayer()?.props.onMetadataLoad(n)}catch(n){this.getCurrentLayer()?.props.onMetadataLoadError(n)}finally{this.state.loadCounter--}}async loadImage(t,n){let{layers:r,serviceType:s}=this.props;if(s==="wms"&&r.length===0)return;let i=t.getBounds(),{width:o,height:c}=t,a=this.getRequestId(),{srs:h}=this.props;h==="auto"&&(h=t.resolution?"EPSG:4326":"EPSG:3857");let l={width:o,height:c,boundingBox:[[i[0],i[1]],[i[2],i[3]]],layers:r,crs:h};if(h==="EPSG:3857"){let f=Th([i[0],i[1]]),p=Th([i[2],i[3]]);l.boundingBox=[f,p]}try{this.state.loadCounter++,this.props.onImageLoadStart(a);let f=await this.state.imageSource.getImage(l);this.state.lastRequestId<a&&(this.getCurrentLayer()?.props.onImageLoad(a),this.setState({image:f,bounds:i,lastRequestParameters:l,lastRequestId:a}))}catch(f){this.raiseError(f,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(a,f)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(t,n=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>t(),n)}};Mr.layerName="WMSLayer";Mr.defaultProps=VS;var Eu=D(ee(),1),qS={getHeight:{type:"accessor",value:0},greatCircle:!0},Is=class extends Eu.ArcLayer{};Is.layerName="GreatCircleLayer";Is.defaultProps=qS;var Tu=Is;var _u=D(ne(),1),_h=D(ee(),1),HS={..._h.PolygonLayer.defaultProps},bs=class extends _u.CompositeLayer{indexToBounds(){return null}renderLayers(){let{elevationScale:t,extruded:n,wireframe:r,filled:s,stroked:i,lineWidthUnits:o,lineWidthScale:c,lineWidthMinPixels:a,lineWidthMaxPixels:h,lineJointRounded:l,lineMiterLimit:f,lineDashJustified:p,getElevation:u,getFillColor:d,getLineColor:g,getLineWidth:m}=this.props,{updateTriggers:M,material:E,transitions:A}=this.props,y=this.getSubLayerClass("cell",_h.PolygonLayer),{updateTriggers:T,..._}=this.indexToBounds()||{};return new y({filled:s,wireframe:r,extruded:n,elevationScale:t,stroked:i,lineWidthUnits:o,lineWidthScale:c,lineWidthMinPixels:a,lineWidthMaxPixels:h,lineJointRounded:l,lineMiterLimit:f,lineDashJustified:p,material:E,transitions:A,getElevation:u,getFillColor:d,getLineColor:g,getLineWidth:m},this.getSubLayerProps({id:"cell",updateTriggers:M&&{...T,getElevation:M.getElevation,getFillColor:M.getFillColor,getLineColor:M.getLineColor,getLineWidth:M.getLineWidth}}),_)}};bs.layerName="GeoCellLayer";bs.defaultProps=HS;var ye=bs;var Qi=D(Sh(),1),YS=3,WS=30,JS=2*WS+1,Bu=180/Math.PI;function Lu(e,t,n){let r=1<<t;return[(e[0]+n[0])/r,(e[1]+n[1])/r]}function Cu(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Ru(e){return[Cu(e[0]),Cu(e[1])]}function wu(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 Iu([e,t,n]){let r=Math.atan2(n,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*Bu,r*Bu]}function bu(e){let t=Qi.default.fromString(e,!0,10).toString(2);for(;t.length<YS+JS;)t="0"+t;let n=t.lastIndexOf("1"),r=t.substring(0,3),s=t.substring(3,n),i=s.length/2,o=Qi.default.fromString(r,!0,2).toString(10),c=Qi.default.fromString(s,!0,2).toString(4);for(;c.length<i;)c="0"+c;return`${o}/${c}`}function XS(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 Ou(e){let t=e.split("/"),n=parseInt(t[0],10),r=t[1],s=r.length,i=[0,0],o;for(let c=s-1;c>=0;c--){o=s-c;let a=r[c],h=0,l=0;a==="1"?l=1:a==="2"?(h=1,l=1):a==="3"&&(h=1);let f=Math.pow(2,o-1);XS(f,i,h,l),i[0]+=f*h,i[1]+=f*l}if(n%2===1){let c=i[0];i[0]=i[1],i[1]=c}return{face:n,ij:i,level:o}}var Pu=D(Sh(),1);function jS(e){let t=e.padEnd(16,"0");return Pu.default.fromString(t,16)}var KS=100;function ZS({face:e,ij:t,level:n}){let r=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(KS*Math.pow(2,-n))),i=new Float64Array(4*s*2+2),o=0,c=0;for(let a=0;a<4;a++){let h=r[a].slice(0),l=r[a+1],f=(l[0]-h[0])/s,p=(l[1]-h[1])/s;for(let u=0;u<s;u++){h[0]+=f,h[1]+=p;let d=Lu(t,n,h),g=Ru(d),m=wu(e,g),M=Iu(m);Math.abs(M[1])>89.999&&(M[0]=c);let E=M[0]-c;M[0]+=E>180?-360:E<-180?360:0,i[o++]=M[0],i[o++]=M[1],c=M[0]}}return i[o++]=i[0],i[o++]=i[1],i}function QS(e){if(typeof e=="string"){if(e.indexOf("/")>0)return e;e=jS(e)}return bu(e.toString())}function Nu(e){let t=QS(e),n=Ou(t);return ZS(n)}var $S={getS2Token:{type:"accessor",value:e=>e.token}},Ps=class extends ye{indexToBounds(){let{data:t,getS2Token:n}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(r,s)=>Nu(n(r,s))}}};Ps.layerName="S2Layer";Ps.defaultProps=$S;var Fu=Ps;var Bh=512;function tB(e,t){let n=0,r=0,s=1<<e.length,i=s/Bh;for(let o=0;o<e.length;o++){s>>=1;let c=parseInt(e[o]);c%2&&(n|=s),c>1&&(r|=s)}return[[n/i,Bh-r/i],[(n+t)/i,Bh-(r+t)/i]]}function vu(e,t=1){let[n,r]=tB(e,t),[s,i]=be(n),[o,c]=be(r);return[o,i,o,c,s,c,s,i,o,i]}var eB={getQuadkey:{type:"accessor",value:e=>e.quadkey}},Ns=class extends ye{indexToBounds(){let{data:t,extruded:n,getQuadkey:r}=this.props,s=n?.99:1;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(i,o)=>vu(r(i,o),s),updateTriggers:{getPolygon:s}}}};Ns.layerName="QuadkeyLayer";Ns.defaultProps=eB;var Du=Ns;var io=D(ne(),1),ed=D(ee(),1);var Nn=class{constructor(t){this.index=t,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(t){this._bbox||(this._bbox=t,"west"in t?this.boundingBox=[[t.west,t.south],[t.east,t.north]]:this.boundingBox=[[t.left,t.top],[t.right,t.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error("byteLength not defined in tile data"),t}async _loadData({getData:t,requestScheduler:n,onLoad:r,onError:s}){let{index:i,id:o,bbox:c,userData:a,zoom:h}=this,l=this._loaderId;this._abortController=new AbortController;let{signal:f}=this._abortController,p=await n.scheduleRequest(this,g=>g.isSelected?1:-1);if(!p){this._isCancelled=!0;return}if(this._isCancelled){p.done();return}let u=null,d;try{u=await t({index:i,id:o,bbox:c,userData:a,zoom:h,signal:f})}catch(g){d=g||!0}finally{p.done()}if(l===this._loaderId){if(this._loader=void 0,this.content=u,this._isCancelled&&!u){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,d?s(d,this):r(this)}}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var vs=D(ne(),1);var ut={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var Uu=new O,nB=new O,nn=class{constructor(t=[0,0,0],n=[0,0,0],r){r=r||Uu.copy(t).add(n).scale(.5),this.center=new O(r),this.halfDiagonal=new O(n).subtract(this.center),this.minimum=new O(t),this.maximum=new O(n)}clone(){return new nn(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=nB.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?ut.INSIDE:i+s<0?ut.OUTSIDE:ut.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=Uu.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 Fs=new O,Gu=new O,rn=class{constructor(t=[0,0,0],n=0){this.radius=-0,this.center=new O,this.fromCenterRadius(t,n)}fromCenterRadius(t,n){return this.center.from(t),this.radius=n,this}fromCornerPoints(t,n){return n=Fs.from(n),this.center=new O().from(t).add(n).scale(.5),this.radius=this.center.distance(n),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new rn(this.center,this.radius)}union(t){let n=this.center,r=this.radius,s=t.center,i=t.radius,o=Fs.copy(s).subtract(n),c=o.magnitude();if(r>=c+i)return this.clone();if(i>=c+r)return t.clone();let a=(r+c+i)*.5;return Gu.copy(o).scale((-r+a)/c).add(n),this.center.copy(Gu),this.radius=a,this}expand(t){let r=Fs.from(t).subtract(this.center).magnitude();return r>this.radius&&(this.radius=r),this}transform(t){this.center.transform(t);let n=Rs.getScaling(Fs,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=Fs.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?ut.OUTSIDE:i<r?ut.INTERSECTING:ut.INSIDE}};var rB=new O,sB=new O,$i=new O,to=new O,eo=new O,iB=new O,oB=new O,Oe={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Fn=class{constructor(t=[0,0,0],n=[0,0,0,0,0,0,0,0,0]){this.center=new O().from(t),this.halfAxes=new ct(n)}get halfSize(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new O(t).len(),new O(n).len(),new O(r).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),s=new O(t).normalize(),i=new O(n).normalize(),o=new O(r).normalize();return new gr().fromMatrix3(new ct([...s,...i,...o]))}fromCenterHalfSizeQuaternion(t,n,r){let s=new gr(r),i=new ct().fromQuaternion(s);return i[0]=i[0]*n[0],i[1]=i[1]*n[0],i[2]=i[2]*n[0],i[3]=i[3]*n[1],i[4]=i[4]*n[1],i[5]=i[5]*n[1],i[6]=i[6]*n[2],i[7]=i[7]*n[2],i[8]=i[8]*n[2],this.center=new O().from(t),this.halfAxes=i,this}clone(){return new Fn(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new rn){let n=this.halfAxes,r=n.getColumn(0,$i),s=n.getColumn(1,to),i=n.getColumn(2,eo),o=rB.copy(r).add(s).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let n=this.center,r=t.normal,s=this.halfAxes,i=r.x,o=r.y,c=r.z,a=Math.abs(i*s[Oe.COLUMN0ROW0]+o*s[Oe.COLUMN0ROW1]+c*s[Oe.COLUMN0ROW2])+Math.abs(i*s[Oe.COLUMN1ROW0]+o*s[Oe.COLUMN1ROW1]+c*s[Oe.COLUMN1ROW2])+Math.abs(i*s[Oe.COLUMN2ROW0]+o*s[Oe.COLUMN2ROW1]+c*s[Oe.COLUMN2ROW2]),h=r.dot(n)+t.distance;return h<=-a?ut.OUTSIDE:h>=a?ut.INSIDE:ut.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=sB.from(t).subtract(this.center),r=this.halfAxes,s=r.getColumn(0,$i),i=r.getColumn(1,to),o=r.getColumn(2,eo),c=s.magnitude(),a=i.magnitude(),h=o.magnitude();s.normalize(),i.normalize(),o.normalize();let l=0,f;return f=Math.abs(n.dot(s))-c,f>0&&(l+=f*f),f=Math.abs(n.dot(i))-a,f>0&&(l+=f*f),f=Math.abs(n.dot(o))-h,f>0&&(l+=f*f),l}computePlaneDistances(t,n,r=[-0,-0]){let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=this.center,c=this.halfAxes,a=c.getColumn(0,$i),h=c.getColumn(1,to),l=c.getColumn(2,eo),f=iB.copy(a).add(h).add(l).add(o),p=oB.copy(f).subtract(t),u=n.dot(p);return s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).add(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).subtract(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).subtract(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).add(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).add(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).subtract(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).subtract(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),r[0]=s,r[1]=i,r}transform(t){this.center.transformAsPoint(t);let n=this.halfAxes.getColumn(0,$i);n.transformAsPoint(t);let r=this.halfAxes.getColumn(1,to);r.transformAsPoint(t);let s=this.halfAxes.getColumn(2,eo);return s.transformAsPoint(t),this.halfAxes=new ct([...n,...r,...s]),this}getTransform(){throw new Error("not implemented")}};var zu=new O,ku=new O,ie=class{constructor(t=[0,0,1],n=0){this.normal=new O,this.distance=-0,this.fromNormalDistance(t,n)}fromNormalDistance(t,n){return Ae(Number.isFinite(n)),this.normal.from(t).normalize(),this.distance=n,this}fromPointNormal(t,n){t=zu.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),Ae(Me(this.normal.len(),1)),this.distance=s,this}clone(){return new ie(this.normal,this.distance)}equals(t){return Me(this.distance,t.distance)&&Me(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let n=ku.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=zu.from(t),s=this.getPointDistance(r),i=ku.copy(this.normal).scale(s);return r.subtract(i).to(n)}};var Vu=[new O([1,0,0]),new O([0,1,0]),new O([0,0,1])],qu=new O,cB=new O,Gt=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*Vu.length;let n=t.center,r=t.radius,s=0;for(let i of Vu){let o=this.planes[s],c=this.planes[s+1];o||(o=this.planes[s]=new ie),c||(c=this.planes[s+1]=new ie);let a=qu.copy(i).scale(-r).add(n);o.fromPointNormal(a,i);let h=qu.copy(i).scale(r).add(n),l=cB.copy(i).negate();c.fromPointNormal(h,l),s+=2}return this}computeVisibility(t){let n=ut.INSIDE;for(let r of this.planes)switch(t.intersectPlane(r)){case ut.OUTSIDE:return ut.OUTSIDE;case ut.INTERSECTING:n=ut.INTERSECTING;break;default:}return n}computeVisibilityWithPlaneMask(t,n){if(Ae(Number.isFinite(n),"parentPlaneMask is required."),n===Gt.MASK_OUTSIDE||n===Gt.MASK_INSIDE)return n;let r=Gt.MASK_INSIDE,s=this.planes;for(let i=0;i<this.planes.length;++i){let o=i<31?1<<i:0;if(i<31&&!(n&o))continue;let c=s[i],a=t.intersectPlane(c);if(a===ut.OUTSIDE)return Gt.MASK_OUTSIDE;a===ut.INTERSECTING&&(r|=o)}return r}};Gt.MASK_OUTSIDE=4294967295;Gt.MASK_INSIDE=0;Gt.MASK_INDETERMINATE=2147483647;var eG=new O,nG=new O,rG=new O,sG=new O,iG=new O;var fG=new O,pG=new O,uG=new O,dG=new O,mG=new O,gG=new O,xG=new O,MG=new O,AG=new O,yG=new O,EG=new O,TG=new O;var Ee=new ct,hB=new ct,lB=new ct,no=new ct,Hu=new ct;function Rh(e,t={}){let n=xr.EPSILON20,r=10,s=0,i=0,o=hB,c=lB;o.identity(),c.copy(e);let a=n*fB(c);for(;i<r&&pB(c)>a;)uB(c,no),Hu.copy(no).transpose(),c.multiplyRight(no),c.multiplyLeft(Hu),o.multiplyRight(no),++s>2&&(++i,s=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=c.toTarget(t.diagonal),t}function fB(e){let t=0;for(let n=0;n<9;++n){let r=e[n];t+=r*r}return Math.sqrt(t)}var Ch=[1,0,0],Lh=[2,2,1];function pB(e){let t=0;for(let n=0;n<3;++n){let r=e[Ee.getElementIndex(Lh[n],Ch[n])];t+=2*r*r}return Math.sqrt(t)}function uB(e,t){let n=xr.EPSILON15,r=0,s=1;for(let h=0;h<3;++h){let l=Math.abs(e[Ee.getElementIndex(Lh[h],Ch[h])]);l>r&&(s=h,r=l)}let i=Ch[s],o=Lh[s],c=1,a=0;if(Math.abs(e[Ee.getElementIndex(o,i)])>n){let h=e[Ee.getElementIndex(o,o)],l=e[Ee.getElementIndex(i,i)],f=e[Ee.getElementIndex(o,i)],p=(h-l)/2/f,u;p<0?u=-1/(-p+Math.sqrt(1+p*p)):u=1/(p+Math.sqrt(1+p*p)),c=1/Math.sqrt(1+u*u),a=u*c}return ct.IDENTITY.to(t),t[Ee.getElementIndex(i,i)]=t[Ee.getElementIndex(o,o)]=c,t[Ee.getElementIndex(o,i)]=a,t[Ee.getElementIndex(i,o)]=-a,t}var sn=new O,dB=new O,mB=new O,gB=new O,xB=new O,MB=new ct,AB={diagonal:new ct,unitary:new ct};function wh(e,t=new Fn){if(!e||e.length===0)return t.halfAxes=new ct([0,0,0,0,0,0,0,0,0]),t.center=new O,t;let n=e.length,r=new O(0,0,0);for(let S of e)r.add(S);let s=1/n;r.multiplyByScalar(s);let i=0,o=0,c=0,a=0,h=0,l=0;for(let S of e){let x=sn.copy(S).subtract(r);i+=x.x*x.x,o+=x.x*x.y,c+=x.x*x.z,a+=x.y*x.y,h+=x.y*x.z,l+=x.z*x.z}i*=s,o*=s,c*=s,a*=s,h*=s,l*=s;let f=MB;f[0]=i,f[1]=o,f[2]=c,f[3]=o,f[4]=a,f[5]=h,f[6]=c,f[7]=h,f[8]=l;let{unitary:p}=Rh(f,AB),u=t.halfAxes.copy(p),d=u.getColumn(0,mB),g=u.getColumn(1,gB),m=u.getColumn(2,xB),M=-Number.MAX_VALUE,E=-Number.MAX_VALUE,A=-Number.MAX_VALUE,y=Number.MAX_VALUE,T=Number.MAX_VALUE,_=Number.MAX_VALUE;for(let S of e)sn.copy(S),M=Math.max(sn.dot(d),M),E=Math.max(sn.dot(g),E),A=Math.max(sn.dot(m),A),y=Math.min(sn.dot(d),y),T=Math.min(sn.dot(g),T),_=Math.min(sn.dot(m),_);d=d.multiplyByScalar(.5*(y+M)),g=g.multiplyByScalar(.5*(T+E)),m=m.multiplyByScalar(.5*(_+A)),t.center.copy(d).add(g).add(m);let L=dB.set(M-y,E-T,A-_).multiplyByScalar(.5),B=new ct([L[0],0,0,0,L[1],0,0,0,L[2]]);return t.halfAxes.multiplyRight(B),t}var Ar=512,Yu=3,Wu=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],Ju=Wu.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),yB=Ju.concat([[.25,.5],[.75,.5]]),on=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 on(t,n,r),new on(t,n+1,r),new on(t+1,n,r),new on(t+1,n+1,r)]}return this._children}update(t){let{viewport:n,cullingVolume:r,elevationBounds:s,minZ:i,maxZ:o,bounds:c,offset:a,project:h}=t,l=this.getBoundingVolume(s,a,h);if(c&&!this.insideBounds(c)||r.computeVisibility(l)<0)return!1;if(!this.childVisible){let{z:p}=this;if(p<o&&p>=i){let u=l.distanceTo(n.cameraPosition)*n.scale/n.height;p+=Math.floor(Math.log2(u))}if(p>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let p of this.children)p.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(let n of this._children)n.getSelected(t);return t}insideBounds([t,n,r,s]){let i=Math.pow(2,this.z),o=Ar/i;return this.x*o<r&&this.y*o<s&&(this.x+1)*o>t&&(this.y+1)*o>n}getBoundingVolume(t,n,r){if(r){let a=this.z<1?yB:this.z<2?Ju:Wu,h=[];for(let l of a){let f=ro(this.x+l[0],this.y+l[1],this.z);f[2]=t[0],h.push(r(f)),t[0]!==t[1]&&(f[2]=t[1],h.push(r(f)))}return wh(h)}let s=Math.pow(2,this.z),i=Ar/s,o=this.x*i+n*Ar,c=Ar-(this.y+1)*i;return new nn([o,c,t[0]],[o+i,c+i,t[1]])}};function Xu(e,t,n,r){let s=e instanceof vs._GlobeViewport&&e.resolution?e.projectPosition:null,i=Object.values(e.getFrustumPlanes()).map(({normal:u,distance:d})=>new ie(u.clone().negate(),d)),o=new Gt(i),c=e.distanceScales.unitsPerMeter[2],a=n&&n[0]*c||0,h=n&&n[1]*c||0,l=e instanceof vs.WebMercatorViewport&&e.pitch<=60?t:0;if(r){let[u,d,g,m]=r,M=Ie([u,m]),E=Ie([g,d]);r=[M[0],Ar-M[1],E[0],Ar-E[1]]}let f=new on(0,0,0),p={viewport:e,project:s,cullingVolume:o,elevationBounds:[a,h],minZ:l,maxZ:t,bounds:r,offset:0};if(f.update(p),e instanceof vs.WebMercatorViewport&&e.subViewports&&e.subViewports.length>1){for(p.offset=-1;f.update(p)&&!(--p.offset<-Yu););for(p.offset=1;f.update(p)&&!(++p.offset>Yu););}return f.getSelected()}var Pe=512,EB=[-1/0,-1/0,1/0,1/0],cn={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 Ku(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 TB(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=TB(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 _B(e,t,n){let r;if(t&&t.length===2){let[s,i]=t,o=e.getBounds({z:s}),c=e.getBounds({z:i});r=[Math.min(o[0],c[0]),Math.min(o[1],c[1]),Math.max(o[2],c[2]),Math.max(o[3],c[3])]}else r=e.getBounds();return e.isGeospatial?[Math.max(r[0],n[0]),Math.max(r[1],n[1]),Math.min(r[2],n[2]),Math.min(r[3],n[3])]:[Math.max(Math.min(r[0],n[2]),n[0]),Math.max(Math.min(r[1],n[3]),n[1]),Math.min(Math.max(r[2],n[0]),n[2]),Math.min(Math.max(r[3],n[1]),n[3])]}function Zu({viewport:e,z:t,cullRect:n}){return(e.subViewports||[e]).map(s=>Ih(s,t||0,n))}function Ih(e,t,n){if(!Array.isArray(t)){let i=n.x-e.x,o=n.y-e.y,{width:c,height:a}=n,h={targetZ:t},l=e.unproject([i,o],h),f=e.unproject([i+c,o],h),p=e.unproject([i,o+a],h),u=e.unproject([i+c,o+a],h);return[Math.min(l[0],f[0],p[0],u[0]),Math.min(l[1],f[1],p[1],u[1]),Math.max(l[0],f[0],p[0],u[0]),Math.max(l[1],f[1],p[1],u[1])]}let r=Ih(e,t[0],n),s=Ih(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 SB(e,t,n){return n?Ku(e,n).map(s=>s*t/Pe):e.map(r=>r*t/Pe)}function bh(e,t){return Math.pow(2,e)*Pe/t}function ro(e,t,n){let r=bh(n,Pe),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 ju(e,t,n,r){let s=bh(n,r);return[e/s*Pe,t/s*Pe]}function Oh(e,t,n,r,s=Pe){if(e.isGeospatial){let[h,l]=ro(t,n,r),[f,p]=ro(t+1,n+1,r);return{west:h,north:l,east:f,south:p}}let[i,o]=ju(t,n,r,s),[c,a]=ju(t+1,n+1,r,s);return{left:i,top:o,right:c,bottom:a}}function BB(e,t,n,r,s){let i=_B(e,null,r),o=bh(t,n),[c,a,h,l]=SB(i,o,s),f=[];for(let p=Math.floor(c);p<h;p++)for(let u=Math.floor(a);u<l;u++)f.push({x:p,y:u,z:t});return f}function Ph({viewport:e,maxZoom:t,minZoom:n,zRange:r,extent:s,tileSize:i=Pe,modelMatrix:o,modelMatrixInverse:c,zoomOffset:a=0}){let h=e.isGeospatial?Math.round(e.zoom+Math.log2(Pe/i))+a:Math.ceil(e.zoom)+a;if(typeof n=="number"&&Number.isFinite(n)&&h<n){if(!s)return[];h=n}typeof t=="number"&&Number.isFinite(t)&&h>t&&(h=t);let l=s;return o&&c&&s&&!e.isGeospatial&&(l=Ku(s,o)),e.isGeospatial?Xu(e,h,r,s):BB(e,h,i,l||EB,c)}function Nh(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(e)}function Fh(e){return Number.isFinite(e.west)&&Number.isFinite(e.north)&&Number.isFinite(e.east)&&Number.isFinite(e.south)}function Qu(e){let t={},n;return r=>{for(let s in r)if(!CB(r[s],t[s])){n=e(r),t=r;break}return n}}function CB(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 $u=1,so=2,LB="never",RB="no-overlap",Ds="best-available",wB=5,IB={[Ds]:OB,[RB]:PB,[LB]:()=>{}},bB={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},vn=class{constructor(t){this._getCullBounds=Qu(Zu),this.opts={...bB,...t},this.setOptions(this.opts),this.onTileLoad=n=>{this.opts.onTileLoad?.(n),this.opts.maxCacheByteSize!==null&&(this._cacheByteSize+=n.byteLength,this._resizeCache())},this._requestScheduler=new Ke({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new Ht,this._modelMatrixInverse=new Ht}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 Ht(r):new Ht,i=!s.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!Me(this._zRange,n)||i){i&&(this._modelMatrixInverse=s.clone().invert(),this._modelMatrix=s),this._viewport=t,this._zRange=n;let c=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:n,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=c.map(a=>this._getTile(a,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(c=>this._getTile(c.index,!0)));let o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(t,n){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,c,a]of r){let h;if("west"in s)h=s.west<c&&s.east>i&&s.south<a&&s.north>o;else{let l=Math.min(s.top,s.bottom),f=Math.max(s.top,s.bottom);h=s.left<c&&s.right>i&&l<a&&f>o}if(h)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:n,minZoom:r,zRange:s,modelMatrix:i,modelMatrixInverse:o}){let{tileSize:c,extent:a,zoomOffset:h}=this.opts;return Ph({viewport:t,maxZoom:n,minZoom:r,zRange:s,tileSize:c,extent:a,modelMatrix:i,modelMatrixInverse:o,zoomOffset:h})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){let{tileSize:n}=this.opts;return{bbox:Oh(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||Ds,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:IB[t])(Array.from(this._cache.values())),r=0;for(let s of this._cache.values())if(n[r++]!==s.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:t=0}=this.opts,n=[],r=0;for(let s of this._cache.values())s.isLoading&&(r++,!s.isSelected&&!s.isVisible&&n.push(s));for(;t>0&&r>t&&n.length>0;)n.shift().abort(),r--}_rebuildTree(){let{_cache:t}=this;for(let n of t.values())n.parent=null,n.children&&(n.children.length=0);for(let n of t.values()){let r=this._getNearestAncestor(n);n.parent=r,r?.children&&r.children.push(n)}}_resizeCache(){let{_cache:t,opts:n}=this,r=n.maxCacheSize??(n.maxCacheByteSize!==null?1/0:wB*this.selectedTiles.length),s=n.maxCacheByteSize??1/0;if(t.size>r||this._cacheByteSize>s){for(let[o,c]of t)if(!c.isVisible&&!c.isSelected&&(this._cacheByteSize-=n.maxCacheByteSize!==null?c.byteLength:0,t.delete(o),this.opts.onTileUnload?.(c)),t.size<=r&&this._cacheByteSize<=s)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((o,c)=>o.zoom-c.zoom),this._dirty=!1)}_getTile(t,n){let r=this.getTileId(t),s=this._cache.get(r),i=!1;return!s&&n?(s=new Nn(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 OB(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!td(t)&&vh(t);for(let t of e)t.isVisible=Boolean(t.state&so)}function PB(e){for(let n of e)n.state=0;for(let n of e)n.isSelected&&td(n);let t=Array.from(e).sort((n,r)=>n.zoom-r.zoom);for(let n of t)if(n.isVisible=Boolean(n.state&so),n.children&&(n.isVisible||n.state&$u))for(let r of n.children)r.state=$u;else n.isSelected&&vh(n)}function td(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=so,!0;t=t.parent}return!1}function vh(e){for(let t of e.children)t.isLoaded||t.content?t.state|=so:vh(t)}var NB={TilesetClass:vn,data:{type:"data",value:[]},dataComparator:cn.equal,renderSubLayers:{type:"function",value:e=>new ed.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:Ds,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},Us=class extends io.CompositeLayer{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every(t=>t.isLoaded&&t.layers&&t.layers.every(n=>n.isLoaded)))}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:n}=this.state,r=t.propsOrDataChanged||t.updateTriggersChanged,s=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);n?r&&(n.setOptions(this._getTilesetOptions()),s?n.reloadAll():n.tiles.forEach(i=>{i.layers=null})):(n=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:n})),this._updateTileset()}_getTilesetOptions(){let{tileSize:t,maxCacheSize:n,maxCacheByteSize:r,refinementStrategy:s,extent:i,maxZoom:o,minZoom:c,maxRequests:a,debounceTime:h,zoomOffset:l}=this.props;return{maxCacheSize:n,maxCacheByteSize:r,maxZoom:o,minZoom:c,tileSize:t,refinementStrategy:s,extent:i,maxRequests:a,debounceTime:h,zoomOffset:l,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let t=this.state.tileset,{zRange:n,modelMatrix:r}=this.props,s=t.update(this.context.viewport,{zRange:n,modelMatrix:r}),{isLoaded:i}=t,o=this.state.isLoaded!==i,c=this.state.frameNumber!==s;i&&(o||c)&&this._onViewportLoad(),c&&this.setState({frameNumber:s}),this.state.isLoaded=i}_onViewportLoad(){let{tileset:t}=this.state,{onViewportLoad:n}=this.props;n&&n(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,n){this.props.onTileError(t),n.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){let{data:n,getTileData:r,fetch:s}=this.props,{signal:i}=t;return t.url=typeof n=="string"||Array.isArray(n)?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(t){let n=t.sourceLayer,r=n.props.tile,s=t.info;return s.picked&&(s.tile=r),s.sourceTile=r,s.sourceTileSubLayer=n,s}_updateAutoHighlight(t){t.sourceTileSubLayer.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map(t=>{let n=this.getSubLayerPropsByTile(t);if(!(!t.isLoaded&&!t.content))if(t.layers)n&&t.layers[0]&&Object.keys(n).some(r=>t.layers[0].props[r]!==n[r])&&(t.layers=t.layers.map(r=>r.clone(n)));else{let r=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=(0,io._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)}};Us.defaultProps=NB;Us.layerName="TileLayer";var Dn=Us;var sd=D(ee(),1);var nd=`uniform tripsUniforms {
14
14
  bool fadeTrail;
15
15
  float trailLength;
16
16
  float currentTime;