@loaders.gl/tile-converter 4.4.0 → 4.4.1

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.
@@ -151,13 +151,13 @@ Calls to async() callback can have unexpected results.`),l=!0,function(h,m){h?c(
151
151
  || ${o} === "boolean" || ${a} === null`).assign(s,(0,Ot._)`[${a}]`)}}}function sBt({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,Ot._)`${t} !== undefined`,()=>e.assign((0,Ot._)`${t}[${r}]`,n))}function iU(e,t,r,n=ob.Correct){let a=n===ob.Correct?Ot.operators.EQ:Ot.operators.NEQ,i;switch(e){case"null":return(0,Ot._)`${t} ${a} null`;case"array":i=(0,Ot._)`Array.isArray(${t})`;break;case"object":i=(0,Ot._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=o((0,Ot._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=o();break;default:return(0,Ot._)`typeof ${t} ${a} ${e}`}return n===ob.Correct?i:(0,Ot.not)(i);function o(s=Ot.nil){return(0,Ot.and)((0,Ot._)`typeof ${t} == "number"`,s,r?(0,Ot._)`isFinite(${t})`:Ot.nil)}}Ya.checkDataType=iU;function oU(e,t,r,n){if(e.length===1)return iU(e[0],t,r,n);let a,i=(0,rTe.toHash)(e);if(i.array&&i.object){let o=(0,Ot._)`typeof ${t} != "object"`;a=i.null?o:(0,Ot._)`!${t} || ${o}`,delete i.null,delete i.array,delete i.object}else a=Ot.nil;i.number&&delete i.integer;for(let o in i)a=(0,Ot.and)(a,iU(o,t,r,n));return a}Ya.checkDataTypes=oU;var uBt={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,Ot._)`{type: ${e}}`:(0,Ot._)`{type: ${t}}`};function sU(e){let t=cBt(e);(0,rBt.reportError)(t,uBt)}Ya.reportTypeError=sU;function cBt(e){let{gen:t,data:r,schema:n}=e,a=(0,rTe.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:a,schemaValue:a,parentSchema:n,params:{},it:e}}});var oTe=b(qk=>{"use strict";Object.defineProperty(qk,"__esModule",{value:!0});qk.assignDefaults=void 0;var sb=Mt(),lBt=ar();function fBt(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let a in r)iTe(e,a,r[a].default);else t==="array"&&Array.isArray(n)&&n.forEach((a,i)=>iTe(e,i,a.default))}qk.assignDefaults=fBt;function iTe(e,t,r){let{gen:n,compositeRule:a,data:i,opts:o}=e;if(r===void 0)return;let s=(0,sb._)`${i}${(0,sb.getProperty)(t)}`;if(a){(0,lBt.checkStrictMode)(e,`default is ignored for: ${s}`);return}let u=(0,sb._)`${s} === undefined`;o.useDefaults==="empty"&&(u=(0,sb._)`${u} || ${s} === null || ${s} === ""`),n.if(u,(0,sb._)`${s} = ${(0,sb.stringify)(r)}`)}});var $o=b(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.validateUnion=kr.validateArray=kr.usePattern=kr.callValidateCode=kr.schemaProperties=kr.allSchemaProperties=kr.noPropertyInData=kr.propertyInData=kr.isOwnProperty=kr.hasPropFunc=kr.reportMissingProp=kr.checkMissingProp=kr.checkReportMissingProp=void 0;var Xr=Mt(),uU=ar(),rp=ml(),pBt=ar();function dBt(e,t){let{gen:r,data:n,it:a}=e;r.if(lU(r,n,t,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,Xr._)`${t}`},!0),e.error()})}kr.checkReportMissingProp=dBt;function hBt({gen:e,data:t,it:{opts:r}},n,a){return(0,Xr.or)(...n.map(i=>(0,Xr.and)(lU(e,t,i,r.ownProperties),(0,Xr._)`${a} = ${i}`)))}kr.checkMissingProp=hBt;function mBt(e,t){e.setParams({missingProperty:t},!0),e.error()}kr.reportMissingProp=mBt;function sTe(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Xr._)`Object.prototype.hasOwnProperty`})}kr.hasPropFunc=sTe;function cU(e,t,r){return(0,Xr._)`${sTe(e)}.call(${t}, ${r})`}kr.isOwnProperty=cU;function gBt(e,t,r,n){let a=(0,Xr._)`${t}${(0,Xr.getProperty)(r)} !== undefined`;return n?(0,Xr._)`${a} && ${cU(e,t,r)}`:a}kr.propertyInData=gBt;function lU(e,t,r,n){let a=(0,Xr._)`${t}${(0,Xr.getProperty)(r)} === undefined`;return n?(0,Xr.or)(a,(0,Xr.not)(cU(e,t,r))):a}kr.noPropertyInData=lU;function uTe(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}kr.allSchemaProperties=uTe;function bBt(e,t){return uTe(t).filter(r=>!(0,uU.alwaysValidSchema)(e,t[r]))}kr.schemaProperties=bBt;function vBt({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:a,errorPath:i},it:o},s,u,c){let l=c?(0,Xr._)`${e}, ${t}, ${n}${a}`:t,f=[[rp.default.instancePath,(0,Xr.strConcat)(rp.default.instancePath,i)],[rp.default.parentData,o.parentData],[rp.default.parentDataProperty,o.parentDataProperty],[rp.default.rootData,rp.default.rootData]];o.opts.dynamicRef&&f.push([rp.default.dynamicAnchors,rp.default.dynamicAnchors]);let p=(0,Xr._)`${l}, ${r.object(...f)}`;return u!==Xr.nil?(0,Xr._)`${s}.call(${u}, ${p})`:(0,Xr._)`${s}(${p})`}kr.callValidateCode=vBt;var xBt=(0,Xr._)`new RegExp`;function yBt({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:a}=t.code,i=a(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,Xr._)`${a.code==="new RegExp"?xBt:(0,pBt.useFunc)(e,a)}(${r}, ${n})`})}kr.usePattern=yBt;function _Bt(e){let{gen:t,data:r,keyword:n,it:a}=e,i=t.name("valid");if(a.allErrors){let s=t.let("valid",!0);return o(()=>t.assign(s,!1)),s}return t.var(i,!0),o(()=>t.break()),i;function o(s){let u=t.const("len",(0,Xr._)`${r}.length`);t.forRange("i",0,u,c=>{e.subschema({keyword:n,dataProp:c,dataPropType:uU.Type.Num},i),t.if((0,Xr.not)(i),s)})}}kr.validateArray=_Bt;function wBt(e){let{gen:t,schema:r,keyword:n,it:a}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(u=>(0,uU.alwaysValidSchema)(a,u))&&!a.opts.unevaluated)return;let o=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((u,c)=>{let l=e.subschema({keyword:n,schemaProp:c,compositeRule:!0},s);t.assign(o,(0,Xr._)`${o} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,Xr.not)(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}kr.validateUnion=wBt});var fTe=b(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.validateKeywordUsage=Yu.validSchemaType=Yu.funcKeywordCode=Yu.macroKeywordCode=void 0;var di=Mt(),ih=ml(),ABt=$o(),EBt=Vy();function TBt(e,t){let{gen:r,keyword:n,schema:a,parentSchema:i,it:o}=e,s=t.macro.call(o.self,a,i,o),u=lTe(r,n,s);o.opts.validateSchema!==!1&&o.self.validateSchema(s,!0);let c=r.name("valid");e.subschema({schema:s,schemaPath:di.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:u,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}Yu.macroKeywordCode=TBt;function SBt(e,t){var r;let{gen:n,keyword:a,schema:i,parentSchema:o,$data:s,it:u}=e;CBt(u,t);let c=!s&&t.compile?t.compile.call(u.self,i,o,u):t.validate,l=lTe(n,a,c),f=n.let("valid");e.block$data(f,p),e.ok((r=t.valid)!==null&&r!==void 0?r:f);function p(){if(t.errors===!1)m(),t.modifying&&cTe(e),g(()=>e.error());else{let x=t.async?d():h();t.modifying&&cTe(e),g(()=>kBt(e,x))}}function d(){let x=n.let("ruleErrs",null);return n.try(()=>m((0,di._)`await `),y=>n.assign(f,!1).if((0,di._)`${y} instanceof ${u.ValidationError}`,()=>n.assign(x,(0,di._)`${y}.errors`),()=>n.throw(y))),x}function h(){let x=(0,di._)`${l}.errors`;return n.assign(x,null),m(di.nil),x}function m(x=t.async?(0,di._)`await `:di.nil){let y=u.opts.passContext?ih.default.this:ih.default.self,w=!("compile"in t&&!s||t.schema===!1);n.assign(f,(0,di._)`${x}${(0,ABt.callValidateCode)(e,l,y,w)}`,t.modifying)}function g(x){var y;n.if((0,di.not)((y=t.valid)!==null&&y!==void 0?y:f),x)}}Yu.funcKeywordCode=SBt;function cTe(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,di._)`${n.parentData}[${n.parentDataProperty}]`))}function kBt(e,t){let{gen:r}=e;r.if((0,di._)`Array.isArray(${t})`,()=>{r.assign(ih.default.vErrors,(0,di._)`${ih.default.vErrors} === null ? ${t} : ${ih.default.vErrors}.concat(${t})`).assign(ih.default.errors,(0,di._)`${ih.default.vErrors}.length`),(0,EBt.extendErrors)(e)},()=>e.error())}function CBt({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function lTe(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,di.stringify)(r)})}function DBt(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}Yu.validSchemaType=DBt;function BBt({schema:e,opts:t,self:r,errSchemaPath:n},a,i){if(Array.isArray(a.keyword)?!a.keyword.includes(i):a.keyword!==i)throw new Error("ajv implementation error");let o=a.dependencies;if(o!=null&&o.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(a.validateSchema&&!a.validateSchema(e[i])){let u=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(a.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(u);else throw new Error(u)}}Yu.validateKeywordUsage=BBt});var dTe=b(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});np.extendSubschemaMode=np.extendSubschemaData=np.getSubschema=void 0;var Qu=Mt(),pTe=ar();function FBt(e,{keyword:t,schemaProp:r,schema:n,schemaPath:a,errSchemaPath:i,topSchemaRef:o}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,Qu._)`${e.schemaPath}${(0,Qu.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,Qu._)`${e.schemaPath}${(0,Qu.getProperty)(t)}${(0,Qu.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,pTe.escapeFragment)(r)}`}}if(n!==void 0){if(a===void 0||i===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:a,topSchemaRef:o,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}np.getSubschema=FBt;function OBt(e,t,{dataProp:r,dataPropType:n,data:a,dataTypes:i,propertyName:o}){if(a!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=t;if(r!==void 0){let{errorPath:c,dataPathArr:l,opts:f}=t,p=s.let("data",(0,Qu._)`${t.data}${(0,Qu.getProperty)(r)}`,!0);u(p),e.errorPath=(0,Qu.str)`${c}${(0,pTe.getErrorPath)(r,n,f.jsPropertySyntax)}`,e.parentDataProperty=(0,Qu._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(a!==void 0){let c=a instanceof Qu.Name?a:s.let("data",a,!0);u(c),o!==void 0&&(e.propertyName=o)}i&&(e.dataTypes=i);function u(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}np.extendSubschemaData=OBt;function IBt(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:a,allErrors:i}){n!==void 0&&(e.compositeRule=n),a!==void 0&&(e.createErrors=a),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}np.extendSubschemaMode=IBt});var mTe=b((ogr,hTe)=>{"use strict";var ap=hTe.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},a=r.post||function(){};Nk(t,n,a,e,"",e)};ap.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ap.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ap.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ap.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Nk(e,t,r,n,a,i,o,s,u,c){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,a,i,o,s,u,c);for(var l in n){var f=n[l];if(Array.isArray(f)){if(l in ap.arrayKeywords)for(var p=0;p<f.length;p++)Nk(e,t,r,f[p],a+"/"+l+"/"+p,i,a,l,n,p)}else if(l in ap.propsKeywords){if(f&&typeof f=="object")for(var d in f)Nk(e,t,r,f[d],a+"/"+l+"/"+PBt(d),i,a,l,n,d)}else(l in ap.keywords||e.allKeys&&!(l in ap.skipKeywords))&&Nk(e,t,r,f,a+"/"+l,i,a,l,n)}r(n,a,i,o,s,u,c)}}function PBt(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Wy=b(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.getSchemaRefs=Ri.resolveUrl=Ri.normalizeId=Ri._getFullPath=Ri.getFullPath=Ri.inlineRef=void 0;var RBt=ar(),jBt=Zh(),LBt=mTe(),MBt=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function qBt(e,t=!0){return typeof e=="boolean"?!0:t===!0?!fU(e):t?gTe(e)<=t:!1}Ri.inlineRef=qBt;var NBt=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function fU(e){for(let t in e){if(NBt.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(fU)||typeof r=="object"&&fU(r))return!0}return!1}function gTe(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!MBt.has(r)&&(typeof e[r]=="object"&&(0,RBt.eachItem)(e[r],n=>t+=gTe(n)),t===1/0))return 1/0}return t}function bTe(e,t="",r){r!==!1&&(t=ub(t));let n=e.parse(t);return vTe(e,n)}Ri.getFullPath=bTe;function vTe(e,t){return e.serialize(t).split("#")[0]+"#"}Ri._getFullPath=vTe;var UBt=/#\/?$/;function ub(e){return e?e.replace(UBt,""):""}Ri.normalizeId=ub;function zBt(e,t,r){return r=ub(r),e.resolve(t,r)}Ri.resolveUrl=zBt;var GBt=/^[a-z_][-a-z0-9._]*$/i;function HBt(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,a=ub(e[r]||t),i={"":a},o=bTe(n,a,!1),s={},u=new Set;return LBt(e,{allKeys:!0},(f,p,d,h)=>{if(h===void 0)return;let m=o+p,g=i[h];typeof f[r]=="string"&&(g=x.call(this,f[r])),y.call(this,f.$anchor),y.call(this,f.$dynamicAnchor),i[p]=g;function x(w){let T=this.opts.uriResolver.resolve;if(w=ub(g?T(g,w):w),u.has(w))throw l(w);u.add(w);let A=this.refs[w];return typeof A=="string"&&(A=this.refs[A]),typeof A=="object"?c(f,A.schema,w):w!==ub(m)&&(w[0]==="#"?(c(f,s[w],w),s[w]=f):this.refs[w]=m),w}function y(w){if(typeof w=="string"){if(!GBt.test(w))throw new Error(`invalid anchor "${w}"`);x.call(this,`#${w}`)}}}),s;function c(f,p,d){if(p!==void 0&&!jBt(f,p))throw l(d)}function l(f){return new Error(`reference "${f}" resolves to more than one schema`)}}Ri.getSchemaRefs=HBt});var Xy=b(ip=>{"use strict";Object.defineProperty(ip,"__esModule",{value:!0});ip.getData=ip.KeywordCxt=ip.validateFunctionCode=void 0;var ATe=ZEe(),xTe=$y(),dU=aU(),Uk=$y(),VBt=oTe(),Jy=fTe(),pU=dTe(),at=Mt(),_t=ml(),$Bt=Wy(),gl=ar(),Ky=Vy();function WBt(e){if(STe(e)&&(kTe(e),TTe(e))){XBt(e);return}ETe(e,()=>(0,ATe.topBoolOrEmptySchema)(e))}ip.validateFunctionCode=WBt;function ETe({gen:e,validateName:t,schema:r,schemaEnv:n,opts:a},i){a.code.es5?e.func(t,(0,at._)`${_t.default.data}, ${_t.default.valCxt}`,n.$async,()=>{e.code((0,at._)`"use strict"; ${yTe(r,a)}`),JBt(e,a),e.code(i)}):e.func(t,(0,at._)`${_t.default.data}, ${KBt(a)}`,n.$async,()=>e.code(yTe(r,a)).code(i))}function KBt(e){return(0,at._)`{${_t.default.instancePath}="", ${_t.default.parentData}, ${_t.default.parentDataProperty}, ${_t.default.rootData}=${_t.default.data}${e.dynamicRef?(0,at._)`, ${_t.default.dynamicAnchors}={}`:at.nil}}={}`}function JBt(e,t){e.if(_t.default.valCxt,()=>{e.var(_t.default.instancePath,(0,at._)`${_t.default.valCxt}.${_t.default.instancePath}`),e.var(_t.default.parentData,(0,at._)`${_t.default.valCxt}.${_t.default.parentData}`),e.var(_t.default.parentDataProperty,(0,at._)`${_t.default.valCxt}.${_t.default.parentDataProperty}`),e.var(_t.default.rootData,(0,at._)`${_t.default.valCxt}.${_t.default.rootData}`),t.dynamicRef&&e.var(_t.default.dynamicAnchors,(0,at._)`${_t.default.valCxt}.${_t.default.dynamicAnchors}`)},()=>{e.var(_t.default.instancePath,(0,at._)`""`),e.var(_t.default.parentData,(0,at._)`undefined`),e.var(_t.default.parentDataProperty,(0,at._)`undefined`),e.var(_t.default.rootData,_t.default.data),t.dynamicRef&&e.var(_t.default.dynamicAnchors,(0,at._)`{}`)})}function XBt(e){let{schema:t,opts:r,gen:n}=e;ETe(e,()=>{r.$comment&&t.$comment&&DTe(e),tFt(e),n.let(_t.default.vErrors,null),n.let(_t.default.errors,0),r.unevaluated&&YBt(e),CTe(e),aFt(e)})}function YBt(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,at._)`${r}.evaluated`),t.if((0,at._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,at._)`${e.evaluated}.props`,(0,at._)`undefined`)),t.if((0,at._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,at._)`${e.evaluated}.items`,(0,at._)`undefined`))}function yTe(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,at._)`/*# sourceURL=${r} */`:at.nil}function QBt(e,t){if(STe(e)&&(kTe(e),TTe(e))){ZBt(e,t);return}(0,ATe.boolOrEmptySchema)(e,t)}function TTe({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function STe(e){return typeof e.schema!="boolean"}function ZBt(e,t){let{schema:r,gen:n,opts:a}=e;a.$comment&&r.$comment&&DTe(e),rFt(e),nFt(e);let i=n.const("_errs",_t.default.errors);CTe(e,i),n.var(t,(0,at._)`${i} === ${_t.default.errors}`)}function kTe(e){(0,gl.checkUnknownRules)(e),eFt(e)}function CTe(e,t){if(e.opts.jtd)return _Te(e,[],!1,t);let r=(0,xTe.getSchemaTypes)(e.schema),n=(0,xTe.coerceAndCheckDataType)(e,r);_Te(e,r,!n,t)}function eFt(e){let{schema:t,errSchemaPath:r,opts:n,self:a}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,gl.schemaHasRulesButRef)(t,a.RULES)&&a.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function tFt(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,gl.checkStrictMode)(e,"default is ignored in the schema root")}function rFt(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,$Bt.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function nFt(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function DTe({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:a}){let i=r.$comment;if(a.$comment===!0)e.code((0,at._)`${_t.default.self}.logger.log(${i})`);else if(typeof a.$comment=="function"){let o=(0,at.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,at._)`${_t.default.self}.opts.$comment(${i}, ${o}, ${s}.schema)`)}}function aFt(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:a,opts:i}=e;r.$async?t.if((0,at._)`${_t.default.errors} === 0`,()=>t.return(_t.default.data),()=>t.throw((0,at._)`new ${a}(${_t.default.vErrors})`)):(t.assign((0,at._)`${n}.errors`,_t.default.vErrors),i.unevaluated&&iFt(e),t.return((0,at._)`${_t.default.errors} === 0`))}function iFt({gen:e,evaluated:t,props:r,items:n}){r instanceof at.Name&&e.assign((0,at._)`${t}.props`,r),n instanceof at.Name&&e.assign((0,at._)`${t}.items`,n)}function _Te(e,t,r,n){let{gen:a,schema:i,data:o,allErrors:s,opts:u,self:c}=e,{RULES:l}=c;if(i.$ref&&(u.ignoreKeywordsWithRef||!(0,gl.schemaHasRulesButRef)(i,l))){a.block(()=>FTe(e,"$ref",l.all.$ref.definition));return}u.jtd||oFt(e,t),a.block(()=>{for(let p of l.rules)f(p);f(l.post)});function f(p){(0,dU.shouldUseGroup)(i,p)&&(p.type?(a.if((0,Uk.checkDataType)(p.type,o,u.strictNumbers)),wTe(e,p),t.length===1&&t[0]===p.type&&r&&(a.else(),(0,Uk.reportTypeError)(e)),a.endIf()):wTe(e,p),s||a.if((0,at._)`${_t.default.errors} === ${n||0}`))}}function wTe(e,t){let{gen:r,schema:n,opts:{useDefaults:a}}=e;a&&(0,VBt.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,dU.shouldUseRule)(n,i)&&FTe(e,i.keyword,i.definition,t.type)})}function oFt(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(sFt(e,t),e.opts.allowUnionTypes||uFt(e,t),cFt(e,e.dataTypes))}function sFt(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{BTe(e.dataTypes,r)||hU(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),fFt(e,t)}}function uFt(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&hU(e,"use allowUnionTypes to allow union type keyword")}function cFt(e,t){let r=e.self.RULES.all;for(let n in r){let a=r[n];if(typeof a=="object"&&(0,dU.shouldUseRule)(e.schema,a)){let{type:i}=a.definition;i.length&&!i.some(o=>lFt(t,o))&&hU(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function lFt(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function BTe(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function fFt(e,t){let r=[];for(let n of e.dataTypes)BTe(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function hU(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,gl.checkStrictMode)(e,t,e.opts.strictTypes)}var zk=class{constructor(t,r,n){if((0,Jy.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,gl.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",OTe(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Jy.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",_t.default.errors))}result(t,r,n){this.failResult((0,at.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,at.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,at._)`${r} !== undefined && (${(0,at.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?Ky.reportExtraError:Ky.reportError)(this,this.def.error,r)}$dataError(){(0,Ky.reportError)(this,this.def.$dataError||Ky.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ky.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=at.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=at.nil,r=at.nil){if(!this.$data)return;let{gen:n,schemaCode:a,schemaType:i,def:o}=this;n.if((0,at.or)((0,at._)`${a} === undefined`,r)),t!==at.nil&&n.assign(t,!0),(i.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==at.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:a,it:i}=this;return(0,at.or)(o(),s());function o(){if(n.length){if(!(r instanceof at.Name))throw new Error("ajv implementation error");let u=Array.isArray(n)?n:[n];return(0,at._)`${(0,Uk.checkDataTypes)(u,r,i.opts.strictNumbers,Uk.DataType.Wrong)}`}return at.nil}function s(){if(a.validateSchema){let u=t.scopeValue("validate$data",{ref:a.validateSchema});return(0,at._)`!${u}(${r})`}return at.nil}}subschema(t,r){let n=(0,pU.getSubschema)(this.it,t);(0,pU.extendSubschemaData)(n,this.it,t),(0,pU.extendSubschemaMode)(n,t);let a={...this.it,...n,items:void 0,props:void 0};return QBt(a,r),a}mergeEvaluated(t,r){let{it:n,gen:a}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=gl.mergeEvaluated.props(a,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=gl.mergeEvaluated.items(a,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:a}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return a.if(r,()=>this.mergeEvaluated(t,at.Name)),!0}};ip.KeywordCxt=zk;function FTe(e,t,r,n){let a=new zk(e,r,t);"code"in r?r.code(a,n):a.$data&&r.validate?(0,Jy.funcKeywordCode)(a,r):"macro"in r?(0,Jy.macroKeywordCode)(a,r):(r.compile||r.validate)&&(0,Jy.funcKeywordCode)(a,r)}var pFt=/^\/(?:[^~]|~0|~1)*$/,dFt=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function OTe(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let a,i;if(e==="")return _t.default.rootData;if(e[0]==="/"){if(!pFt.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);a=e,i=_t.default.rootData}else{let c=dFt.exec(e);if(!c)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+c[1];if(a=c[2],a==="#"){if(l>=t)throw new Error(u("property/index",l));return n[t-l]}if(l>t)throw new Error(u("data",l));if(i=r[t-l],!a)return i}let o=i,s=a.split("/");for(let c of s)c&&(i=(0,at._)`${i}${(0,at.getProperty)((0,gl.unescapeJsonPointer)(c))}`,o=(0,at._)`${o} && ${i}`);return o;function u(c,l){return`Cannot access ${c} ${l} levels up, current level is ${t}`}}ip.getData=OTe});var Gk=b(gU=>{"use strict";Object.defineProperty(gU,"__esModule",{value:!0});var mU=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};gU.default=mU});var Yy=b(xU=>{"use strict";Object.defineProperty(xU,"__esModule",{value:!0});var bU=Wy(),vU=class extends Error{constructor(t,r,n,a){super(a||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,bU.resolveUrl)(t,r,n),this.missingSchema=(0,bU.normalizeId)((0,bU.getFullPath)(t,this.missingRef))}};xU.default=vU});var Vk=b(Wo=>{"use strict";Object.defineProperty(Wo,"__esModule",{value:!0});Wo.resolveSchema=Wo.getCompilingSchema=Wo.resolveRef=Wo.compileSchema=Wo.SchemaEnv=void 0;var Ms=Mt(),hFt=Gk(),oh=ml(),qs=Wy(),ITe=ar(),mFt=Xy(),cb=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,qs.normalizeId)(n==null?void 0:n[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n==null?void 0:n.$async,this.refs={}}};Wo.SchemaEnv=cb;function _U(e){let t=PTe.call(this,e);if(t)return t;let r=(0,qs.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:a}=this.opts.code,{ownProperties:i}=this.opts,o=new Ms.CodeGen(this.scope,{es5:n,lines:a,ownProperties:i}),s;e.$async&&(s=o.scopeValue("Error",{ref:hFt.default,code:(0,Ms._)`require("ajv/dist/runtime/validation_error").default`}));let u=o.scopeName("validate");e.validateName=u;let c={gen:o,allErrors:this.opts.allErrors,data:oh.default.data,parentData:oh.default.parentData,parentDataProperty:oh.default.parentDataProperty,dataNames:[oh.default.data],dataPathArr:[Ms.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Ms.stringify)(e.schema)}:{ref:e.schema}),validateName:u,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Ms.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Ms._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,mFt.validateFunctionCode)(c),o.optimize(this.opts.code.optimize);let f=o.toString();l=`${o.scopeRefs(oh.default.scope)}return ${f}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let d=new Function(`${oh.default.self}`,`${oh.default.scope}`,l)(this,this.scope.get());if(this.scope.value(u,{ref:d}),d.errors=null,d.schema=e.schema,d.schemaEnv=e,e.$async&&(d.$async=!0),this.opts.code.source===!0&&(d.source={validateName:u,validateCode:f,scopeValues:o._values}),this.opts.unevaluated){let{props:h,items:m}=c;d.evaluated={props:h instanceof Ms.Name?void 0:h,items:m instanceof Ms.Name?void 0:m,dynamicProps:h instanceof Ms.Name,dynamicItems:m instanceof Ms.Name},d.source&&(d.source.evaluated=(0,Ms.stringify)(d.evaluated))}return e.validate=d,e}catch(f){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),f}finally{this._compilations.delete(e)}}Wo.compileSchema=_U;function gFt(e,t,r){var n;r=(0,qs.resolveUrl)(this.opts.uriResolver,t,r);let a=e.refs[r];if(a)return a;let i=xFt.call(this,e,r);if(i===void 0){let o=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;o&&(i=new cb({schema:o,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=bFt.call(this,i)}Wo.resolveRef=gFt;function bFt(e){return(0,qs.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:_U.call(this,e)}function PTe(e){for(let t of this._compilations)if(vFt(t,e))return t}Wo.getCompilingSchema=PTe;function vFt(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function xFt(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Hk.call(this,e,t)}function Hk(e,t){let r=this.opts.uriResolver.parse(t),n=(0,qs._getFullPath)(this.opts.uriResolver,r),a=(0,qs.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===a)return yU.call(this,r,e);let i=(0,qs.normalizeId)(n),o=this.refs[i]||this.schemas[i];if(typeof o=="string"){let s=Hk.call(this,e,o);return typeof(s==null?void 0:s.schema)!="object"?void 0:yU.call(this,r,s)}if(typeof(o==null?void 0:o.schema)=="object"){if(o.validate||_U.call(this,o),i===(0,qs.normalizeId)(t)){let{schema:s}=o,{schemaId:u}=this.opts,c=s[u];return c&&(a=(0,qs.resolveUrl)(this.opts.uriResolver,a,c)),new cb({schema:s,schemaId:u,root:e,baseId:a})}return yU.call(this,r,o)}}Wo.resolveSchema=Hk;var yFt=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function yU(e,{baseId:t,schema:r,root:n}){var a;if(((a=e.fragment)===null||a===void 0?void 0:a[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let u=r[(0,ITe.unescapeFragment)(s)];if(u===void 0)return;r=u;let c=typeof r=="object"&&r[this.opts.schemaId];!yFt.has(s)&&c&&(t=(0,qs.resolveUrl)(this.opts.uriResolver,t,c))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,ITe.schemaHasRulesButRef)(r,this.RULES)){let s=(0,qs.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=Hk.call(this,n,s)}let{schemaId:o}=this.opts;if(i=i||new cb({schema:r,schemaId:o,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var RTe=b((pgr,_Ft)=>{_Ft.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var AU=b((dgr,qTe)=>{"use strict";var wFt=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),LTe=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function wU(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var AFt=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function jTe(e){return e.length=0,!0}function EFt(e,t,r){if(e.length){let n=wU(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function TFt(e){let t=0,r={error:!1,address:"",zone:""},n=[],a=[],i=!1,o=!1,s=EFt;for(let u=0;u<e.length;u++){let c=e[u];if(!(c==="["||c==="]"))if(c===":"){if(i===!0&&(o=!0),!s(a,n,r))break;if(++t>7){r.error=!0;break}u>0&&e[u-1]===":"&&(i=!0),n.push(":");continue}else if(c==="%"){if(!s(a,n,r))break;s=jTe}else{a.push(c);continue}}return a.length&&(s===jTe?r.zone=a.join(""):o?n.push(a.join("")):n.push(wU(a))),r.address=n.join(""),r}function MTe(e){if(SFt(e,":")<2)return{host:e,isIPV6:!1};let t=TFt(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:n}}}function SFt(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function kFt(e){let t=e,r=[],n=-1,a=0;for(;a=t.length;){if(a===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(a===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(a===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}function CFt(e,t){let r=t!==!0?escape:unescape;return e.scheme!==void 0&&(e.scheme=r(e.scheme)),e.userinfo!==void 0&&(e.userinfo=r(e.userinfo)),e.host!==void 0&&(e.host=r(e.host)),e.path!==void 0&&(e.path=r(e.path)),e.query!==void 0&&(e.query=r(e.query)),e.fragment!==void 0&&(e.fragment=r(e.fragment)),e}function DFt(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!LTe(r)){let n=MTe(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=e.host}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}qTe.exports={nonSimpleDomain:AFt,recomposeAuthority:DFt,normalizeComponentEncoding:CFt,removeDotSegments:kFt,isIPv4:LTe,isUUID:wFt,normalizeIPv6:MTe,stringArrayToHexStripped:wU}});var HTe=b((hgr,GTe)=>{"use strict";var{isUUID:BFt}=AU(),FFt=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,OFt=["http","https","ws","wss","urn","urn:uuid"];function IFt(e){return OFt.indexOf(e)!==-1}function EU(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function NTe(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function UTe(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function PFt(e){return e.secure=EU(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function RFt(e){if((e.port===(EU(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function jFt(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(FFt);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let a=`${n}:${t.nid||e.nid}`,i=TU(a);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function LFt(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),a=`${r}:${t.nid||n}`,i=TU(a);i&&(e=i.serialize(e,t));let o=e,s=e.nss;return o.path=`${n||t.nid}:${s}`,t.skipEscape=!0,o}function MFt(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!BFt(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function qFt(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var zTe={scheme:"http",domainHost:!0,parse:NTe,serialize:UTe},NFt={scheme:"https",domainHost:zTe.domainHost,parse:NTe,serialize:UTe},$k={scheme:"ws",domainHost:!0,parse:PFt,serialize:RFt},UFt={scheme:"wss",domainHost:$k.domainHost,parse:$k.parse,serialize:$k.serialize},zFt={scheme:"urn",parse:jFt,serialize:LFt,skipNormalize:!0},GFt={scheme:"urn:uuid",parse:MFt,serialize:qFt,skipNormalize:!0},Wk={http:zTe,https:NFt,ws:$k,wss:UFt,urn:zFt,"urn:uuid":GFt};Object.setPrototypeOf(Wk,null);function TU(e){return e&&(Wk[e]||Wk[e.toLowerCase()])||void 0}GTe.exports={wsIsSecure:EU,SCHEMES:Wk,isValidSchemeName:IFt,getSchemeHandler:TU}});var WTe=b((mgr,Jk)=>{"use strict";var{normalizeIPv6:HFt,removeDotSegments:Qy,recomposeAuthority:VFt,normalizeComponentEncoding:Kk,isIPv4:$Ft,nonSimpleDomain:WFt}=AU(),{SCHEMES:KFt,getSchemeHandler:VTe}=HTe();function JFt(e,t){return typeof e=="string"?e=Zu(bl(e,t),t):typeof e=="object"&&(e=bl(Zu(e,t),t)),e}function XFt(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},a=$Te(bl(e,n),bl(t,n),n,!0);return n.skipEscape=!0,Zu(a,n)}function $Te(e,t,r,n){let a={};return n||(e=bl(Zu(e,r),r),t=bl(Zu(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=Qy(t.path||""),a.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=Qy(t.path||""),a.query=t.query):(t.path?(t.path[0]==="/"?a.path=Qy(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?a.path="/"+t.path:e.path?a.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:a.path=t.path,a.path=Qy(a.path)),a.query=t.query):(a.path=e.path,t.query!==void 0?a.query=t.query:a.query=e.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function YFt(e,t,r){return typeof e=="string"?(e=unescape(e),e=Zu(Kk(bl(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Zu(Kk(e,!0),{...r,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=Zu(Kk(bl(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Zu(Kk(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function Zu(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),a=[],i=VTe(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&a.push(r.scheme,":");let o=VFt(r);if(o!==void 0&&(n.reference!=="suffix"&&a.push("//"),a.push(o),r.path&&r.path[0]!=="/"&&a.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(s=Qy(s)),o===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),a.push(s)}return r.query!==void 0&&a.push("?",r.query),r.fragment!==void 0&&a.push("#",r.fragment),a.join("")}var QFt=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function bl(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},a=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let i=e.match(QFt);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if($Ft(n.host)===!1){let u=HFt(n.host);n.host=u.host.toLowerCase(),a=u.isIPV6}else a=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let o=VTe(r.scheme||n.scheme);if(!r.unicodeSupport&&(!o||!o.unicodeSupport)&&n.host&&(r.domainHost||o&&o.domainHost)&&a===!1&&WFt(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!o||o&&!o.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),o&&o.parse&&o.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var SU={SCHEMES:KFt,normalize:JFt,resolve:XFt,resolveComponent:$Te,equal:YFt,serialize:Zu,parse:bl};Jk.exports=SU;Jk.exports.default=SU;Jk.exports.fastUri=SU});var JTe=b(kU=>{"use strict";Object.defineProperty(kU,"__esModule",{value:!0});var KTe=WTe();KTe.code='require("ajv/dist/runtime/uri").default';kU.default=KTe});var n6e=b(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});Da.CodeGen=Da.Name=Da.nil=Da.stringify=Da.str=Da._=Da.KeywordCxt=void 0;var ZFt=Xy();Object.defineProperty(Da,"KeywordCxt",{enumerable:!0,get:function(){return ZFt.KeywordCxt}});var lb=Mt();Object.defineProperty(Da,"_",{enumerable:!0,get:function(){return lb._}});Object.defineProperty(Da,"str",{enumerable:!0,get:function(){return lb.str}});Object.defineProperty(Da,"stringify",{enumerable:!0,get:function(){return lb.stringify}});Object.defineProperty(Da,"nil",{enumerable:!0,get:function(){return lb.nil}});Object.defineProperty(Da,"Name",{enumerable:!0,get:function(){return lb.Name}});Object.defineProperty(Da,"CodeGen",{enumerable:!0,get:function(){return lb.CodeGen}});var eOt=Gk(),e6e=Yy(),tOt=nU(),Zy=Vk(),rOt=Mt(),e_=Wy(),Xk=$y(),DU=ar(),XTe=RTe(),nOt=JTe(),t6e=(e,t)=>new RegExp(e,t);t6e.code="new RegExp";var aOt=["removeAdditional","useDefaults","coerceTypes"],iOt=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),oOt={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},sOt={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},YTe=200;function uOt(e){var t,r,n,a,i,o,s,u,c,l,f,p,d,h,m,g,x,y,w,T,A,B,I,L,C;let k=e.strict,F=(t=e.code)===null||t===void 0?void 0:t.optimize,R=F===!0||F===void 0?1:F||0,G=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:t6e,z=(a=e.uriResolver)!==null&&a!==void 0?a:nOt.default;return{strictSchema:(o=(i=e.strictSchema)!==null&&i!==void 0?i:k)!==null&&o!==void 0?o:!0,strictNumbers:(u=(s=e.strictNumbers)!==null&&s!==void 0?s:k)!==null&&u!==void 0?u:!0,strictTypes:(l=(c=e.strictTypes)!==null&&c!==void 0?c:k)!==null&&l!==void 0?l:"log",strictTuples:(p=(f=e.strictTuples)!==null&&f!==void 0?f:k)!==null&&p!==void 0?p:"log",strictRequired:(h=(d=e.strictRequired)!==null&&d!==void 0?d:k)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:R,regExp:G}:{optimize:R,regExp:G},loopRequired:(m=e.loopRequired)!==null&&m!==void 0?m:YTe,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:YTe,meta:(x=e.meta)!==null&&x!==void 0?x:!0,messages:(y=e.messages)!==null&&y!==void 0?y:!0,inlineRefs:(w=e.inlineRefs)!==null&&w!==void 0?w:!0,schemaId:(T=e.schemaId)!==null&&T!==void 0?T:"$id",addUsedSchema:(A=e.addUsedSchema)!==null&&A!==void 0?A:!0,validateSchema:(B=e.validateSchema)!==null&&B!==void 0?B:!0,validateFormats:(I=e.validateFormats)!==null&&I!==void 0?I:!0,unicodeRegExp:(L=e.unicodeRegExp)!==null&&L!==void 0?L:!0,int32range:(C=e.int32range)!==null&&C!==void 0?C:!0,uriResolver:z}}var t_=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...uOt(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new rOt.ValueScope({scope:{},prefixes:iOt,es5:r,lines:n}),this.logger=hOt(t.logger);let a=t.validateFormats;t.validateFormats=!1,this.RULES=(0,tOt.getRules)(),QTe.call(this,oOt,t,"NOT SUPPORTED"),QTe.call(this,sOt,t,"DEPRECATED","warn"),this._metaOpts=pOt.call(this),t.formats&&lOt.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&fOt.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),cOt.call(this),t.validateFormats=a}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,a=XTe;n==="id"&&(a={...XTe},a.id=a.$id,delete a.$id),r&&t&&this.addMetaSchema(a,a[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let a=n(r);return"$async"in n||(this.errors=n.errors),a}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return a.call(this,t,r);async function a(l,f){await i.call(this,l.$schema);let p=this._addSchema(l,f);return p.validate||o.call(this,p)}async function i(l){l&&!this.getSchema(l)&&await a.call(this,{$ref:l},!0)}async function o(l){try{return this._compileSchemaEnv(l)}catch(f){if(!(f instanceof e6e.default))throw f;return s.call(this,f),await u.call(this,f.missingSchema),o.call(this,l)}}function s({missingSchema:l,missingRef:f}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${f} cannot be resolved`)}async function u(l){let f=await c.call(this,l);this.refs[l]||await i.call(this,f.$schema),this.refs[l]||this.addSchema(f,l,r)}async function c(l){let f=this._loading[l];if(f)return f;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,a=this.opts.validateSchema){if(Array.isArray(t)){for(let o of t)this.addSchema(o,void 0,n,a);return this}let i;if(typeof t=="object"){let{schemaId:o}=this.opts;if(i=t[o],i!==void 0&&typeof i!="string")throw new Error(`schema ${o} must be string`)}return r=(0,e_.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,a,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let a=this.validate(n,t);if(!a&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return a}getSchema(t){let r;for(;typeof(r=ZTe.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,a=new Zy.SchemaEnv({schema:{},schemaId:n});if(r=Zy.resolveSchema.call(this,a,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=ZTe.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,e_.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(gOt.call(this,n,r),!r)return(0,DU.eachItem)(n,i=>CU.call(this,i)),this;vOt.call(this,r);let a={...r,type:(0,Xk.getJSONTypes)(r.type),schemaType:(0,Xk.getJSONTypes)(r.schemaType)};return(0,DU.eachItem)(n,a.type.length===0?i=>CU.call(this,i,a):i=>a.type.forEach(o=>CU.call(this,i,a,o))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let a=n.rules.findIndex(i=>i.keyword===t);a>=0&&n.rules.splice(a,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(a=>`${n}${a.instancePath} ${a.message}`).reduce((a,i)=>a+r+i)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let a of r){let i=a.split("/").slice(1),o=t;for(let s of i)o=o[s];for(let s in n){let u=n[s];if(typeof u!="object")continue;let{$data:c}=u.definition,l=o[s];c&&l&&(o[s]=r6e(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let a=t[n];(!r||r.test(n))&&(typeof a=="string"?delete t[n]:a&&!a.meta&&(this._cache.delete(a.schema),delete t[n]))}}_addSchema(t,r,n,a=this.opts.validateSchema,i=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if(typeof t=="object")o=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let u=this._cache.get(t);if(u!==void 0)return u;n=(0,e_.normalizeId)(o||n);let c=e_.getSchemaRefs.call(this,t,n);return u=new Zy.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:n,localRefs:c}),this._cache.set(u.schema,u),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=u),a&&this.validateSchema(t,!0),u}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):Zy.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{Zy.compileSchema.call(this,t)}finally{this.opts=r}}};t_.ValidationError=eOt.default;t_.MissingRefError=e6e.default;Da.default=t_;function QTe(e,t,r,n="error"){for(let a in e){let i=a;i in t&&this.logger[n](`${r}: option ${a}. ${e[i]}`)}}function ZTe(e){return e=(0,e_.normalizeId)(e),this.schemas[e]||this.refs[e]}function cOt(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function lOt(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function fOt(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function pOt(){let e={...this.opts};for(let t of aOt)delete e[t];return e}var dOt={log(){},warn(){},error(){}};function hOt(e){if(e===!1)return dOt;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var mOt=/^[a-z_$][a-z0-9_$:-]*$/i;function gOt(e,t){let{RULES:r}=this;if((0,DU.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!mOt.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function CU(e,t,r){var n;let a=t==null?void 0:t.post;if(r&&a)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,o=a?i.post:i.rules.find(({type:u})=>u===r);if(o||(o={type:r,rules:[]},i.rules.push(o)),i.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,Xk.getJSONTypes)(t.type),schemaType:(0,Xk.getJSONTypes)(t.schemaType)}};t.before?bOt.call(this,o,s,t.before):o.rules.push(s),i.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(u=>this.addKeyword(u))}function bOt(e,t,r){let n=e.rules.findIndex(a=>a.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function vOt(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=r6e(t)),e.validateSchema=this.compile(t,!0))}var xOt={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function r6e(e){return{anyOf:[e,xOt]}}});var a6e=b(BU=>{"use strict";Object.defineProperty(BU,"__esModule",{value:!0});var yOt={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};BU.default=yOt});var u6e=b(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.callRef=sh.getValidate=void 0;var _Ot=Yy(),i6e=$o(),ji=Mt(),fb=ml(),o6e=Vk(),Yk=ar(),wOt={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:a,schemaEnv:i,validateName:o,opts:s,self:u}=n,{root:c}=i;if((r==="#"||r==="#/")&&a===c.baseId)return f();let l=o6e.resolveRef.call(u,c,a,r);if(l===void 0)throw new _Ot.default(n.opts.uriResolver,a,r);if(l instanceof o6e.SchemaEnv)return p(l);return d(l);function f(){if(i===c)return Qk(e,o,i,i.$async);let h=t.scopeValue("root",{ref:c});return Qk(e,(0,ji._)`${h}.validate`,c,c.$async)}function p(h){let m=s6e(e,h);Qk(e,m,h,h.$async)}function d(h){let m=t.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,ji.stringify)(h)}:{ref:h}),g=t.name("valid"),x=e.subschema({schema:h,dataTypes:[],schemaPath:ji.nil,topSchemaRef:m,errSchemaPath:r},g);e.mergeEvaluated(x),e.ok(g)}}};function s6e(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,ji._)`${r.scopeValue("wrapper",{ref:t})}.validate`}sh.getValidate=s6e;function Qk(e,t,r,n){let{gen:a,it:i}=e,{allErrors:o,schemaEnv:s,opts:u}=i,c=u.passContext?fb.default.this:ji.nil;n?l():f();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=a.let("valid");a.try(()=>{a.code((0,ji._)`await ${(0,i6e.callValidateCode)(e,t,c)}`),d(t),o||a.assign(h,!0)},m=>{a.if((0,ji._)`!(${m} instanceof ${i.ValidationError})`,()=>a.throw(m)),p(m),o||a.assign(h,!1)}),e.ok(h)}function f(){e.result((0,i6e.callValidateCode)(e,t,c),()=>d(t),()=>p(t))}function p(h){let m=(0,ji._)`${h}.errors`;a.assign(fb.default.vErrors,(0,ji._)`${fb.default.vErrors} === null ? ${m} : ${fb.default.vErrors}.concat(${m})`),a.assign(fb.default.errors,(0,ji._)`${fb.default.vErrors}.length`)}function d(h){var m;if(!i.opts.unevaluated)return;let g=(m=r==null?void 0:r.validate)===null||m===void 0?void 0:m.evaluated;if(i.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(i.props=Yk.mergeEvaluated.props(a,g.props,i.props));else{let x=a.var("props",(0,ji._)`${h}.evaluated.props`);i.props=Yk.mergeEvaluated.props(a,x,i.props,ji.Name)}if(i.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(i.items=Yk.mergeEvaluated.items(a,g.items,i.items));else{let x=a.var("items",(0,ji._)`${h}.evaluated.items`);i.items=Yk.mergeEvaluated.items(a,x,i.items,ji.Name)}}}sh.callRef=Qk;sh.default=wOt});var c6e=b(FU=>{"use strict";Object.defineProperty(FU,"__esModule",{value:!0});var AOt=a6e(),EOt=u6e(),TOt=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",AOt.default,EOt.default];FU.default=TOt});var l6e=b(OU=>{"use strict";Object.defineProperty(OU,"__esModule",{value:!0});var Zk=Mt(),op=Zk.operators,e4={maximum:{okStr:"<=",ok:op.LTE,fail:op.GT},minimum:{okStr:">=",ok:op.GTE,fail:op.LT},exclusiveMaximum:{okStr:"<",ok:op.LT,fail:op.GTE},exclusiveMinimum:{okStr:">",ok:op.GT,fail:op.LTE}},SOt={message:({keyword:e,schemaCode:t})=>(0,Zk.str)`must be ${e4[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Zk._)`{comparison: ${e4[e].okStr}, limit: ${t}}`},kOt={keyword:Object.keys(e4),type:"number",schemaType:"number",$data:!0,error:SOt,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,Zk._)`${r} ${e4[t].fail} ${n} || isNaN(${r})`)}};OU.default=kOt});var f6e=b(IU=>{"use strict";Object.defineProperty(IU,"__esModule",{value:!0});var r_=Mt(),COt={message:({schemaCode:e})=>(0,r_.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,r_._)`{multipleOf: ${e}}`},DOt={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:COt,code(e){let{gen:t,data:r,schemaCode:n,it:a}=e,i=a.opts.multipleOfPrecision,o=t.let("res"),s=i?(0,r_._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:(0,r_._)`${o} !== parseInt(${o})`;e.fail$data((0,r_._)`(${n} === 0 || (${o} = ${r}/${n}, ${s}))`)}};IU.default=DOt});var d6e=b(PU=>{"use strict";Object.defineProperty(PU,"__esModule",{value:!0});function p6e(e){let t=e.length,r=0,n=0,a;for(;n<t;)r++,a=e.charCodeAt(n++),a>=55296&&a<=56319&&n<t&&(a=e.charCodeAt(n),(a&64512)===56320&&n++);return r}PU.default=p6e;p6e.code='require("ajv/dist/runtime/ucs2length").default'});var h6e=b(RU=>{"use strict";Object.defineProperty(RU,"__esModule",{value:!0});var uh=Mt(),BOt=ar(),FOt=d6e(),OOt={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,uh.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,uh._)`{limit: ${e}}`},IOt={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:OOt,code(e){let{keyword:t,data:r,schemaCode:n,it:a}=e,i=t==="maxLength"?uh.operators.GT:uh.operators.LT,o=a.opts.unicode===!1?(0,uh._)`${r}.length`:(0,uh._)`${(0,BOt.useFunc)(e.gen,FOt.default)}(${r})`;e.fail$data((0,uh._)`${o} ${i} ${n}`)}};RU.default=IOt});var m6e=b(jU=>{"use strict";Object.defineProperty(jU,"__esModule",{value:!0});var POt=$o(),ROt=ar(),pb=Mt(),jOt={message:({schemaCode:e})=>(0,pb.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,pb._)`{pattern: ${e}}`},LOt={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:jOt,code(e){let{gen:t,data:r,$data:n,schema:a,schemaCode:i,it:o}=e,s=o.opts.unicodeRegExp?"u":"";if(n){let{regExp:u}=o.opts.code,c=u.code==="new RegExp"?(0,pb._)`new RegExp`:(0,ROt.useFunc)(t,u),l=t.let("valid");t.try(()=>t.assign(l,(0,pb._)`${c}(${i}, ${s}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,pb._)`!${l}`)}else{let u=(0,POt.usePattern)(e,a);e.fail$data((0,pb._)`!${u}.test(${r})`)}}};jU.default=LOt});var g6e=b(LU=>{"use strict";Object.defineProperty(LU,"__esModule",{value:!0});var n_=Mt(),MOt={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,n_.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,n_._)`{limit: ${e}}`},qOt={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:MOt,code(e){let{keyword:t,data:r,schemaCode:n}=e,a=t==="maxProperties"?n_.operators.GT:n_.operators.LT;e.fail$data((0,n_._)`Object.keys(${r}).length ${a} ${n}`)}};LU.default=qOt});var b6e=b(MU=>{"use strict";Object.defineProperty(MU,"__esModule",{value:!0});var a_=$o(),i_=Mt(),NOt=ar(),UOt={message:({params:{missingProperty:e}})=>(0,i_.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,i_._)`{missingProperty: ${e}}`},zOt={keyword:"required",type:"object",schemaType:"array",$data:!0,error:UOt,code(e){let{gen:t,schema:r,schemaCode:n,data:a,$data:i,it:o}=e,{opts:s}=o;if(!i&&r.length===0)return;let u=r.length>=s.loopRequired;if(o.allErrors?c():l(),s.strictRequired){let d=e.parentSchema.properties,{definedProperties:h}=e.it;for(let m of r)if((d==null?void 0:d[m])===void 0&&!h.has(m)){let g=o.schemaEnv.baseId+o.errSchemaPath,x=`required property "${m}" is not defined at "${g}" (strictRequired)`;(0,NOt.checkStrictMode)(o,x,o.opts.strictRequired)}}function c(){if(u||i)e.block$data(i_.nil,f);else for(let d of r)(0,a_.checkReportMissingProp)(e,d)}function l(){let d=t.let("missing");if(u||i){let h=t.let("valid",!0);e.block$data(h,()=>p(d,h)),e.ok(h)}else t.if((0,a_.checkMissingProp)(e,r,d)),(0,a_.reportMissingProp)(e,d),t.else()}function f(){t.forOf("prop",n,d=>{e.setParams({missingProperty:d}),t.if((0,a_.noPropertyInData)(t,a,d,s.ownProperties),()=>e.error())})}function p(d,h){e.setParams({missingProperty:d}),t.forOf(d,n,()=>{t.assign(h,(0,a_.propertyInData)(t,a,d,s.ownProperties)),t.if((0,i_.not)(h),()=>{e.error(),t.break()})},i_.nil)}}};MU.default=zOt});var v6e=b(qU=>{"use strict";Object.defineProperty(qU,"__esModule",{value:!0});var o_=Mt(),GOt={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,o_.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,o_._)`{limit: ${e}}`},HOt={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:GOt,code(e){let{keyword:t,data:r,schemaCode:n}=e,a=t==="maxItems"?o_.operators.GT:o_.operators.LT;e.fail$data((0,o_._)`${r}.length ${a} ${n}`)}};qU.default=HOt});var t4=b(NU=>{"use strict";Object.defineProperty(NU,"__esModule",{value:!0});var x6e=Zh();x6e.code='require("ajv/dist/runtime/equal").default';NU.default=x6e});var y6e=b(zU=>{"use strict";Object.defineProperty(zU,"__esModule",{value:!0});var UU=$y(),Ba=Mt(),VOt=ar(),$Ot=t4(),WOt={message:({params:{i:e,j:t}})=>(0,Ba.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Ba._)`{i: ${e}, j: ${t}}`},KOt={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:WOt,code(e){let{gen:t,data:r,$data:n,schema:a,parentSchema:i,schemaCode:o,it:s}=e;if(!n&&!a)return;let u=t.let("valid"),c=i.items?(0,UU.getSchemaTypes)(i.items):[];e.block$data(u,l,(0,Ba._)`${o} === false`),e.ok(u);function l(){let h=t.let("i",(0,Ba._)`${r}.length`),m=t.let("j");e.setParams({i:h,j:m}),t.assign(u,!0),t.if((0,Ba._)`${h} > 1`,()=>(f()?p:d)(h,m))}function f(){return c.length>0&&!c.some(h=>h==="object"||h==="array")}function p(h,m){let g=t.name("item"),x=(0,UU.checkDataTypes)(c,g,s.opts.strictNumbers,UU.DataType.Wrong),y=t.const("indices",(0,Ba._)`{}`);t.for((0,Ba._)`;${h}--;`,()=>{t.let(g,(0,Ba._)`${r}[${h}]`),t.if(x,(0,Ba._)`continue`),c.length>1&&t.if((0,Ba._)`typeof ${g} == "string"`,(0,Ba._)`${g} += "_"`),t.if((0,Ba._)`typeof ${y}[${g}] == "number"`,()=>{t.assign(m,(0,Ba._)`${y}[${g}]`),e.error(),t.assign(u,!1).break()}).code((0,Ba._)`${y}[${g}] = ${h}`)})}function d(h,m){let g=(0,VOt.useFunc)(t,$Ot.default),x=t.name("outer");t.label(x).for((0,Ba._)`;${h}--;`,()=>t.for((0,Ba._)`${m} = ${h}; ${m}--;`,()=>t.if((0,Ba._)`${g}(${r}[${h}], ${r}[${m}])`,()=>{e.error(),t.assign(u,!1).break(x)})))}}};zU.default=KOt});var _6e=b(HU=>{"use strict";Object.defineProperty(HU,"__esModule",{value:!0});var GU=Mt(),JOt=ar(),XOt=t4(),YOt={message:"must be equal to constant",params:({schemaCode:e})=>(0,GU._)`{allowedValue: ${e}}`},QOt={keyword:"const",$data:!0,error:YOt,code(e){let{gen:t,data:r,$data:n,schemaCode:a,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,GU._)`!${(0,JOt.useFunc)(t,XOt.default)}(${r}, ${a})`):e.fail((0,GU._)`${i} !== ${r}`)}};HU.default=QOt});var w6e=b(VU=>{"use strict";Object.defineProperty(VU,"__esModule",{value:!0});var s_=Mt(),ZOt=ar(),eIt=t4(),tIt={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,s_._)`{allowedValues: ${e}}`},rIt={keyword:"enum",schemaType:"array",$data:!0,error:tIt,code(e){let{gen:t,data:r,$data:n,schema:a,schemaCode:i,it:o}=e;if(!n&&a.length===0)throw new Error("enum must have non-empty array");let s=a.length>=o.opts.loopEnum,u,c=()=>u??(u=(0,ZOt.useFunc)(t,eIt.default)),l;if(s||n)l=t.let("valid"),e.block$data(l,f);else{if(!Array.isArray(a))throw new Error("ajv implementation error");let d=t.const("vSchema",i);l=(0,s_.or)(...a.map((h,m)=>p(d,m)))}e.pass(l);function f(){t.assign(l,!1),t.forOf("v",i,d=>t.if((0,s_._)`${c()}(${r}, ${d})`,()=>t.assign(l,!0).break()))}function p(d,h){let m=a[h];return typeof m=="object"&&m!==null?(0,s_._)`${c()}(${r}, ${d}[${h}])`:(0,s_._)`${r} === ${m}`}}};VU.default=rIt});var A6e=b($U=>{"use strict";Object.defineProperty($U,"__esModule",{value:!0});var nIt=l6e(),aIt=f6e(),iIt=h6e(),oIt=m6e(),sIt=g6e(),uIt=b6e(),cIt=v6e(),lIt=y6e(),fIt=_6e(),pIt=w6e(),dIt=[nIt.default,aIt.default,iIt.default,oIt.default,sIt.default,uIt.default,cIt.default,lIt.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},fIt.default,pIt.default];$U.default=dIt});var KU=b(u_=>{"use strict";Object.defineProperty(u_,"__esModule",{value:!0});u_.validateAdditionalItems=void 0;var ch=Mt(),WU=ar(),hIt={message:({params:{len:e}})=>(0,ch.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,ch._)`{limit: ${e}}`},mIt={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:hIt,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,WU.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}E6e(e,n)}};function E6e(e,t){let{gen:r,schema:n,data:a,keyword:i,it:o}=e;o.items=!0;let s=r.const("len",(0,ch._)`${a}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,ch._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,WU.alwaysValidSchema)(o,n)){let c=r.var("valid",(0,ch._)`${s} <= ${t.length}`);r.if((0,ch.not)(c),()=>u(c)),e.ok(c)}function u(c){r.forRange("i",t.length,s,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:WU.Type.Num},c),o.allErrors||r.if((0,ch.not)(c),()=>r.break())})}}u_.validateAdditionalItems=E6e;u_.default=mIt});var JU=b(c_=>{"use strict";Object.defineProperty(c_,"__esModule",{value:!0});c_.validateTuple=void 0;var T6e=Mt(),r4=ar(),gIt=$o(),bIt={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return S6e(e,"additionalItems",t);r.items=!0,!(0,r4.alwaysValidSchema)(r,t)&&e.ok((0,gIt.validateArray)(e))}};function S6e(e,t,r=e.schema){let{gen:n,parentSchema:a,data:i,keyword:o,it:s}=e;l(a),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=r4.mergeEvaluated.items(n,r.length,s.items));let u=n.name("valid"),c=n.const("len",(0,T6e._)`${i}.length`);r.forEach((f,p)=>{(0,r4.alwaysValidSchema)(s,f)||(n.if((0,T6e._)`${c} > ${p}`,()=>e.subschema({keyword:o,schemaProp:p,dataProp:p},u)),e.ok(u))});function l(f){let{opts:p,errSchemaPath:d}=s,h=r.length,m=h===f.minItems&&(h===f.maxItems||f[t]===!1);if(p.strictTuples&&!m){let g=`"${o}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${d}"`;(0,r4.checkStrictMode)(s,g,p.strictTuples)}}}c_.validateTuple=S6e;c_.default=bIt});var k6e=b(XU=>{"use strict";Object.defineProperty(XU,"__esModule",{value:!0});var vIt=JU(),xIt={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,vIt.validateTuple)(e,"items")};XU.default=xIt});var D6e=b(YU=>{"use strict";Object.defineProperty(YU,"__esModule",{value:!0});var C6e=Mt(),yIt=ar(),_It=$o(),wIt=KU(),AIt={message:({params:{len:e}})=>(0,C6e.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,C6e._)`{limit: ${e}}`},EIt={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:AIt,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:a}=r;n.items=!0,!(0,yIt.alwaysValidSchema)(n,t)&&(a?(0,wIt.validateAdditionalItems)(e,a):e.ok((0,_It.validateArray)(e)))}};YU.default=EIt});var B6e=b(QU=>{"use strict";Object.defineProperty(QU,"__esModule",{value:!0});var Ko=Mt(),n4=ar(),TIt={message:({params:{min:e,max:t}})=>t===void 0?(0,Ko.str)`must contain at least ${e} valid item(s)`:(0,Ko.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Ko._)`{minContains: ${e}}`:(0,Ko._)`{minContains: ${e}, maxContains: ${t}}`},SIt={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:TIt,code(e){let{gen:t,schema:r,parentSchema:n,data:a,it:i}=e,o,s,{minContains:u,maxContains:c}=n;i.opts.next?(o=u===void 0?1:u,s=c):o=1;let l=t.const("len",(0,Ko._)`${a}.length`);if(e.setParams({min:o,max:s}),s===void 0&&o===0){(0,n4.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&o>s){(0,n4.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,n4.alwaysValidSchema)(i,r)){let m=(0,Ko._)`${l} >= ${o}`;s!==void 0&&(m=(0,Ko._)`${m} && ${l} <= ${s}`),e.pass(m);return}i.items=!0;let f=t.name("valid");s===void 0&&o===1?d(f,()=>t.if(f,()=>t.break())):o===0?(t.let(f,!0),s!==void 0&&t.if((0,Ko._)`${a}.length > 0`,p)):(t.let(f,!1),p()),e.result(f,()=>e.reset());function p(){let m=t.name("_valid"),g=t.let("count",0);d(m,()=>t.if(m,()=>h(g)))}function d(m,g){t.forRange("i",0,l,x=>{e.subschema({keyword:"contains",dataProp:x,dataPropType:n4.Type.Num,compositeRule:!0},m),g()})}function h(m){t.code((0,Ko._)`${m}++`),s===void 0?t.if((0,Ko._)`${m} >= ${o}`,()=>t.assign(f,!0).break()):(t.if((0,Ko._)`${m} > ${s}`,()=>t.assign(f,!1).break()),o===1?t.assign(f,!0):t.if((0,Ko._)`${m} >= ${o}`,()=>t.assign(f,!0)))}}};QU.default=SIt});var I6e=b(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.validateSchemaDeps=ec.validatePropertyDeps=ec.error=void 0;var ZU=Mt(),kIt=ar(),l_=$o();ec.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,ZU.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,ZU._)`{property: ${e},
152
152
  missingProperty: ${n},
153
153
  depsCount: ${t},
154
- deps: ${r}}`};var CIt={keyword:"dependencies",type:"object",schemaType:"object",error:ec.error,code(e){let[t,r]=DIt(e);F6e(e,t),O6e(e,r)}};function DIt({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let a=Array.isArray(e[n])?t:r;a[n]=e[n]}return[t,r]}function F6e(e,t=e.schema){let{gen:r,data:n,it:a}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let o in t){let s=t[o];if(s.length===0)continue;let u=(0,l_.propertyInData)(r,n,o,a.opts.ownProperties);e.setParams({property:o,depsCount:s.length,deps:s.join(", ")}),a.allErrors?r.if(u,()=>{for(let c of s)(0,l_.checkReportMissingProp)(e,c)}):(r.if((0,ZU._)`${u} && (${(0,l_.checkMissingProp)(e,s,i)})`),(0,l_.reportMissingProp)(e,i),r.else())}}ec.validatePropertyDeps=F6e;function O6e(e,t=e.schema){let{gen:r,data:n,keyword:a,it:i}=e,o=r.name("valid");for(let s in t)(0,kIt.alwaysValidSchema)(i,t[s])||(r.if((0,l_.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let u=e.subschema({keyword:a,schemaProp:s},o);e.mergeValidEvaluated(u,o)},()=>r.var(o,!0)),e.ok(o))}ec.validateSchemaDeps=O6e;ec.default=CIt});var R6e=b(ez=>{"use strict";Object.defineProperty(ez,"__esModule",{value:!0});var P6e=Mt(),BIt=ar(),FIt={message:"property name must be valid",params:({params:e})=>(0,P6e._)`{propertyName: ${e.propertyName}}`},OIt={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:FIt,code(e){let{gen:t,schema:r,data:n,it:a}=e;if((0,BIt.alwaysValidSchema)(a,r))return;let i=t.name("valid");t.forIn("key",n,o=>{e.setParams({propertyName:o}),e.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},i),t.if((0,P6e.not)(i),()=>{e.error(!0),a.allErrors||t.break()})}),e.ok(i)}};ez.default=OIt});var rz=b(tz=>{"use strict";Object.defineProperty(tz,"__esModule",{value:!0});var a4=$o(),Ns=Mt(),IIt=ml(),i4=ar(),PIt={message:"must NOT have additional properties",params:({params:e})=>(0,Ns._)`{additionalProperty: ${e.additionalProperty}}`},RIt={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:PIt,code(e){let{gen:t,schema:r,parentSchema:n,data:a,errsCount:i,it:o}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:u}=o;if(o.props=!0,u.removeAdditional!=="all"&&(0,i4.alwaysValidSchema)(o,r))return;let c=(0,a4.allSchemaProperties)(n.properties),l=(0,a4.allSchemaProperties)(n.patternProperties);f(),e.ok((0,Ns._)`${i} === ${IIt.default.errors}`);function f(){t.forIn("key",a,g=>{!c.length&&!l.length?h(g):t.if(p(g),()=>h(g))})}function p(g){let x;if(c.length>8){let y=(0,i4.schemaRefOrVal)(o,n.properties,"properties");x=(0,a4.isOwnProperty)(t,y,g)}else c.length?x=(0,Ns.or)(...c.map(y=>(0,Ns._)`${g} === ${y}`)):x=Ns.nil;return l.length&&(x=(0,Ns.or)(x,...l.map(y=>(0,Ns._)`${(0,a4.usePattern)(e,y)}.test(${g})`))),(0,Ns.not)(x)}function d(g){t.code((0,Ns._)`delete ${a}[${g}]`)}function h(g){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){d(g);return}if(r===!1){e.setParams({additionalProperty:g}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,i4.alwaysValidSchema)(o,r)){let x=t.name("valid");u.removeAdditional==="failing"?(m(g,x,!1),t.if((0,Ns.not)(x),()=>{e.reset(),d(g)})):(m(g,x),s||t.if((0,Ns.not)(x),()=>t.break()))}}function m(g,x,y){let w={keyword:"additionalProperties",dataProp:g,dataPropType:i4.Type.Str};y===!1&&Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(w,x)}}};tz.default=RIt});var M6e=b(az=>{"use strict";Object.defineProperty(az,"__esModule",{value:!0});var jIt=Xy(),j6e=$o(),nz=ar(),L6e=rz(),LIt={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:a,it:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&L6e.default.code(new jIt.KeywordCxt(i,L6e.default,"additionalProperties"));let o=(0,j6e.allSchemaProperties)(r);for(let f of o)i.definedProperties.add(f);i.opts.unevaluated&&o.length&&i.props!==!0&&(i.props=nz.mergeEvaluated.props(t,(0,nz.toHash)(o),i.props));let s=o.filter(f=>!(0,nz.alwaysValidSchema)(i,r[f]));if(s.length===0)return;let u=t.name("valid");for(let f of s)c(f)?l(f):(t.if((0,j6e.propertyInData)(t,a,f,i.opts.ownProperties)),l(f),i.allErrors||t.else().var(u,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(u);function c(f){return i.opts.useDefaults&&!i.compositeRule&&r[f].default!==void 0}function l(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},u)}}};az.default=LIt});var z6e=b(iz=>{"use strict";Object.defineProperty(iz,"__esModule",{value:!0});var q6e=$o(),o4=Mt(),N6e=ar(),U6e=ar(),MIt={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:a,it:i}=e,{opts:o}=i,s=(0,q6e.allSchemaProperties)(r),u=s.filter(m=>(0,N6e.alwaysValidSchema)(i,r[m]));if(s.length===0||u.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&a.properties,l=t.name("valid");i.props!==!0&&!(i.props instanceof o4.Name)&&(i.props=(0,U6e.evaluatedPropsToName)(t,i.props));let{props:f}=i;p();function p(){for(let m of s)c&&d(m),i.allErrors?h(m):(t.var(l,!0),h(m),t.if(l))}function d(m){for(let g in c)new RegExp(m).test(g)&&(0,N6e.checkStrictMode)(i,`property ${g} matches pattern ${m} (use allowMatchingProperties)`)}function h(m){t.forIn("key",n,g=>{t.if((0,o4._)`${(0,q6e.usePattern)(e,m)}.test(${g})`,()=>{let x=u.includes(m);x||e.subschema({keyword:"patternProperties",schemaProp:m,dataProp:g,dataPropType:U6e.Type.Str},l),i.opts.unevaluated&&f!==!0?t.assign((0,o4._)`${f}[${g}]`,!0):!x&&!i.allErrors&&t.if((0,o4.not)(l),()=>t.break())})})}}};iz.default=MIt});var G6e=b(oz=>{"use strict";Object.defineProperty(oz,"__esModule",{value:!0});var qIt=ar(),NIt={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,qIt.alwaysValidSchema)(n,r)){e.fail();return}let a=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};oz.default=NIt});var H6e=b(sz=>{"use strict";Object.defineProperty(sz,"__esModule",{value:!0});var UIt=$o(),zIt={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:UIt.validateUnion,error:{message:"must match a schema in anyOf"}};sz.default=zIt});var V6e=b(uz=>{"use strict";Object.defineProperty(uz,"__esModule",{value:!0});var s4=Mt(),GIt=ar(),HIt={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,s4._)`{passingSchemas: ${e.passing}}`},VIt={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:HIt,code(e){let{gen:t,schema:r,parentSchema:n,it:a}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(a.opts.discriminator&&n.discriminator)return;let i=r,o=t.let("valid",!1),s=t.let("passing",null),u=t.name("_valid");e.setParams({passing:s}),t.block(c),e.result(o,()=>e.reset(),()=>e.error(!0));function c(){i.forEach((l,f)=>{let p;(0,GIt.alwaysValidSchema)(a,l)?t.var(u,!0):p=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},u),f>0&&t.if((0,s4._)`${u} && ${o}`).assign(o,!1).assign(s,(0,s4._)`[${s}, ${f}]`).else(),t.if(u,()=>{t.assign(o,!0),t.assign(s,f),p&&e.mergeEvaluated(p,s4.Name)})})}}};uz.default=VIt});var $6e=b(cz=>{"use strict";Object.defineProperty(cz,"__esModule",{value:!0});var $It=ar(),WIt={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let a=t.name("valid");r.forEach((i,o)=>{if((0,$It.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:o},a);e.ok(a),e.mergeEvaluated(s)})}};cz.default=WIt});var J6e=b(lz=>{"use strict";Object.defineProperty(lz,"__esModule",{value:!0});var u4=Mt(),K6e=ar(),KIt={message:({params:e})=>(0,u4.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,u4._)`{failingKeyword: ${e.ifClause}}`},JIt={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:KIt,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,K6e.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let a=W6e(n,"then"),i=W6e(n,"else");if(!a&&!i)return;let o=t.let("valid",!0),s=t.name("_valid");if(u(),e.reset(),a&&i){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,c("then",l),c("else",l))}else a?t.if(s,c("then")):t.if((0,u4.not)(s),c("else"));e.pass(o,()=>e.error(!0));function u(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function c(l,f){return()=>{let p=e.subschema({keyword:l},s);t.assign(o,s),e.mergeValidEvaluated(p,o),f?t.assign(f,(0,u4._)`${l}`):e.setParams({ifClause:l})}}}};function W6e(e,t){let r=e.schema[t];return r!==void 0&&!(0,K6e.alwaysValidSchema)(e,r)}lz.default=JIt});var X6e=b(fz=>{"use strict";Object.defineProperty(fz,"__esModule",{value:!0});var XIt=ar(),YIt={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,XIt.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};fz.default=YIt});var Y6e=b(pz=>{"use strict";Object.defineProperty(pz,"__esModule",{value:!0});var QIt=KU(),ZIt=k6e(),ePt=JU(),tPt=D6e(),rPt=B6e(),nPt=I6e(),aPt=R6e(),iPt=rz(),oPt=M6e(),sPt=z6e(),uPt=G6e(),cPt=H6e(),lPt=V6e(),fPt=$6e(),pPt=J6e(),dPt=X6e();function hPt(e=!1){let t=[uPt.default,cPt.default,lPt.default,fPt.default,pPt.default,dPt.default,aPt.default,iPt.default,nPt.default,oPt.default,sPt.default];return e?t.push(ZIt.default,tPt.default):t.push(QIt.default,ePt.default),t.push(rPt.default),t}pz.default=hPt});var Q6e=b(dz=>{"use strict";Object.defineProperty(dz,"__esModule",{value:!0});var kn=Mt(),mPt={message:({schemaCode:e})=>(0,kn.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,kn._)`{format: ${e}}`},gPt={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:mPt,code(e,t){let{gen:r,data:n,$data:a,schema:i,schemaCode:o,it:s}=e,{opts:u,errSchemaPath:c,schemaEnv:l,self:f}=s;if(!u.validateFormats)return;a?p():d();function p(){let h=r.scopeValue("formats",{ref:f.formats,code:u.code.formats}),m=r.const("fDef",(0,kn._)`${h}[${o}]`),g=r.let("fType"),x=r.let("format");r.if((0,kn._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>r.assign(g,(0,kn._)`${m}.type || "string"`).assign(x,(0,kn._)`${m}.validate`),()=>r.assign(g,(0,kn._)`"string"`).assign(x,m)),e.fail$data((0,kn.or)(y(),w()));function y(){return u.strictSchema===!1?kn.nil:(0,kn._)`${o} && !${x}`}function w(){let T=l.$async?(0,kn._)`(${m}.async ? await ${x}(${n}) : ${x}(${n}))`:(0,kn._)`${x}(${n})`,A=(0,kn._)`(typeof ${x} == "function" ? ${T} : ${x}.test(${n}))`;return(0,kn._)`${x} && ${x} !== true && ${g} === ${t} && !${A}`}}function d(){let h=f.formats[i];if(!h){y();return}if(h===!0)return;let[m,g,x]=w(h);m===t&&e.pass(T());function y(){if(u.strictSchema===!1){f.logger.warn(A());return}throw new Error(A());function A(){return`unknown format "${i}" ignored in schema at path "${c}"`}}function w(A){let B=A instanceof RegExp?(0,kn.regexpCode)(A):u.code.formats?(0,kn._)`${u.code.formats}${(0,kn.getProperty)(i)}`:void 0,I=r.scopeValue("formats",{key:i,ref:A,code:B});return typeof A=="object"&&!(A instanceof RegExp)?[A.type||"string",A.validate,(0,kn._)`${I}.validate`]:["string",A,I]}function T(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,kn._)`await ${x}(${n})`}return typeof g=="function"?(0,kn._)`${x}(${n})`:(0,kn._)`${x}.test(${n})`}}}};dz.default=gPt});var Z6e=b(hz=>{"use strict";Object.defineProperty(hz,"__esModule",{value:!0});var bPt=Q6e(),vPt=[bPt.default];hz.default=vPt});var e3e=b(db=>{"use strict";Object.defineProperty(db,"__esModule",{value:!0});db.contentVocabulary=db.metadataVocabulary=void 0;db.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];db.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var r3e=b(mz=>{"use strict";Object.defineProperty(mz,"__esModule",{value:!0});var xPt=c6e(),yPt=A6e(),_Pt=Y6e(),wPt=Z6e(),t3e=e3e(),APt=[xPt.default,yPt.default,(0,_Pt.default)(),wPt.default,t3e.metadataVocabulary,t3e.contentVocabulary];mz.default=APt});var a3e=b(c4=>{"use strict";Object.defineProperty(c4,"__esModule",{value:!0});c4.DiscrError=void 0;var n3e;(function(e){e.Tag="tag",e.Mapping="mapping"})(n3e||(c4.DiscrError=n3e={}))});var o3e=b(bz=>{"use strict";Object.defineProperty(bz,"__esModule",{value:!0});var hb=Mt(),gz=a3e(),i3e=Vk(),EPt=Yy(),TPt=ar(),SPt={message:({params:{discrError:e,tagName:t}})=>e===gz.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,hb._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},kPt={keyword:"discriminator",type:"object",schemaType:"object",error:SPt,code(e){let{gen:t,data:r,schema:n,parentSchema:a,it:i}=e,{oneOf:o}=a;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let u=t.let("valid",!1),c=t.const("tag",(0,hb._)`${r}${(0,hb.getProperty)(s)}`);t.if((0,hb._)`typeof ${c} == "string"`,()=>l(),()=>e.error(!1,{discrError:gz.DiscrError.Tag,tag:c,tagName:s})),e.ok(u);function l(){let d=p();t.if(!1);for(let h in d)t.elseIf((0,hb._)`${c} === ${h}`),t.assign(u,f(d[h]));t.else(),e.error(!1,{discrError:gz.DiscrError.Mapping,tag:c,tagName:s}),t.endIf()}function f(d){let h=t.name("valid"),m=e.subschema({keyword:"oneOf",schemaProp:d},h);return e.mergeEvaluated(m,hb.Name),h}function p(){var d;let h={},m=x(a),g=!0;for(let T=0;T<o.length;T++){let A=o[T];if(A!=null&&A.$ref&&!(0,TPt.schemaHasRulesButRef)(A,i.self.RULES)){let I=A.$ref;if(A=i3e.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,I),A instanceof i3e.SchemaEnv&&(A=A.schema),A===void 0)throw new EPt.default(i.opts.uriResolver,i.baseId,I)}let B=(d=A==null?void 0:A.properties)===null||d===void 0?void 0:d[s];if(typeof B!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);g=g&&(m||x(A)),y(B,T)}if(!g)throw new Error(`discriminator: "${s}" must be required`);return h;function x({required:T}){return Array.isArray(T)&&T.includes(s)}function y(T,A){if(T.const)w(T.const,A);else if(T.enum)for(let B of T.enum)w(B,A);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function w(T,A){if(typeof T!="string"||T in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[T]=A}}}};bz.default=kPt});var s3e=b((nbr,CPt)=>{CPt.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var c3e=b((Yr,vz)=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.MissingRefError=Yr.ValidationError=Yr.CodeGen=Yr.Name=Yr.nil=Yr.stringify=Yr.str=Yr._=Yr.KeywordCxt=Yr.Ajv=void 0;var DPt=n6e(),BPt=r3e(),FPt=o3e(),u3e=s3e(),OPt=["/properties"],l4="http://json-schema.org/draft-07/schema",mb=class extends DPt.default{_addVocabularies(){super._addVocabularies(),BPt.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(FPt.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(u3e,OPt):u3e;this.addMetaSchema(t,l4,!1),this.refs["http://json-schema.org/schema"]=l4}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l4)?l4:void 0)}};Yr.Ajv=mb;vz.exports=Yr=mb;vz.exports.Ajv=mb;Object.defineProperty(Yr,"__esModule",{value:!0});Yr.default=mb;var IPt=Xy();Object.defineProperty(Yr,"KeywordCxt",{enumerable:!0,get:function(){return IPt.KeywordCxt}});var gb=Mt();Object.defineProperty(Yr,"_",{enumerable:!0,get:function(){return gb._}});Object.defineProperty(Yr,"str",{enumerable:!0,get:function(){return gb.str}});Object.defineProperty(Yr,"stringify",{enumerable:!0,get:function(){return gb.stringify}});Object.defineProperty(Yr,"nil",{enumerable:!0,get:function(){return gb.nil}});Object.defineProperty(Yr,"Name",{enumerable:!0,get:function(){return gb.Name}});Object.defineProperty(Yr,"CodeGen",{enumerable:!0,get:function(){return gb.CodeGen}});var PPt=Gk();Object.defineProperty(Yr,"ValidationError",{enumerable:!0,get:function(){return PPt.default}});var RPt=Yy();Object.defineProperty(Yr,"MissingRefError",{enumerable:!0,get:function(){return RPt.default}})});var Cz=typeof process!="object"||String(process)!=="[object process]"||process.browser;var Dz={ibm866:[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1025,1105,1028,1108,1031,1111,1038,1118,176,8729,183,8730,8470,164,9632,160],"iso-8859-2":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,728,321,164,317,346,167,168,352,350,356,377,173,381,379,176,261,731,322,180,318,347,711,184,353,351,357,378,733,382,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],"iso-8859-3":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,294,728,163,164,null,292,167,168,304,350,286,308,173,null,379,176,295,178,179,180,181,293,183,184,305,351,287,309,189,null,380,192,193,194,null,196,266,264,199,200,201,202,203,204,205,206,207,null,209,210,211,212,288,214,215,284,217,218,219,220,364,348,223,224,225,226,null,228,267,265,231,232,233,234,235,236,237,238,239,null,241,242,243,244,289,246,247,285,249,250,251,252,365,349,729],"iso-8859-4":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,312,342,164,296,315,167,168,352,274,290,358,173,381,175,176,261,731,343,180,297,316,711,184,353,275,291,359,330,382,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,298,272,325,332,310,212,213,214,215,216,370,218,219,220,360,362,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,299,273,326,333,311,244,245,246,247,248,371,250,251,252,361,363,729],"iso-8859-5":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,173,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,8470,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,167,1118,1119],"iso-8859-6":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,null,null,164,null,null,null,null,null,null,null,1548,173,null,null,null,null,null,null,null,null,null,null,null,null,null,1563,null,null,null,1567,null,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,null,null,null,null,null,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,null,null,null,null,null,null,null,null,null,null,null,null,null],"iso-8859-7":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8216,8217,163,8364,8367,166,167,168,169,890,171,172,173,null,8213,176,177,178,179,900,901,902,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],"iso-8859-8":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,162,163,164,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,8215,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],"iso-8859-10":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,274,290,298,296,310,167,315,272,352,358,381,173,362,330,176,261,275,291,299,297,311,183,316,273,353,359,382,8213,363,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,207,208,325,332,211,212,213,214,360,216,370,218,219,220,221,222,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,239,240,326,333,243,244,245,246,361,248,371,250,251,252,253,254,312],"iso-8859-13":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8221,162,163,164,8222,166,167,216,169,342,171,172,173,174,198,176,177,178,179,8220,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,8217],"iso-8859-14":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,7682,7683,163,266,267,7690,167,7808,169,7810,7691,7922,173,174,376,7710,7711,288,289,7744,7745,182,7766,7809,7767,7811,7776,7923,7812,7813,7777,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,372,209,210,211,212,213,214,7786,216,217,218,219,220,221,374,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,373,241,242,243,244,245,246,7787,248,249,250,251,252,253,375,255],"iso-8859-15":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,8364,165,352,167,353,169,170,171,172,173,174,175,176,177,178,179,381,181,182,183,382,185,186,187,338,339,376,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],"iso-8859-16":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,261,321,8364,8222,352,167,353,169,536,171,377,173,378,379,176,177,268,322,381,8221,182,183,382,269,537,187,338,339,376,380,192,193,194,258,196,262,198,199,200,201,202,203,204,205,206,207,272,323,210,211,212,336,214,346,368,217,218,219,220,280,538,223,224,225,226,259,228,263,230,231,232,233,234,235,236,237,238,239,273,324,242,243,244,337,246,347,369,249,250,251,252,281,539,255],"koi8-r":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,1025,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],"koi8-u":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,1108,9556,1110,1111,9559,9560,9561,9562,9563,1169,1118,9566,9567,9568,9569,1025,1028,9571,1030,1031,9574,9575,9576,9577,9578,1168,1038,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],macintosh:[196,197,199,201,209,214,220,225,224,226,228,227,229,231,233,232,234,235,237,236,238,239,241,243,242,244,246,245,250,249,251,252,8224,176,162,163,167,8226,182,223,174,169,8482,180,168,8800,198,216,8734,177,8804,8805,165,181,8706,8721,8719,960,8747,170,186,937,230,248,191,161,172,8730,402,8776,8710,171,187,8230,160,192,195,213,338,339,8211,8212,8220,8221,8216,8217,247,9674,255,376,8260,8364,8249,8250,64257,64258,8225,183,8218,8222,8240,194,202,193,203,200,205,206,207,204,211,212,63743,210,218,219,217,305,710,732,175,728,729,730,184,733,731,711],"windows-874":[8364,129,130,131,132,8230,134,135,136,137,138,139,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,153,154,155,156,157,158,159,160,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631,3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,null,null,null,null,3647,3648,3649,3650,3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,null,null,null,null],"windows-1250":[8364,129,8218,131,8222,8230,8224,8225,136,8240,352,8249,346,356,381,377,144,8216,8217,8220,8221,8226,8211,8212,152,8482,353,8250,347,357,382,378,160,711,728,321,164,260,166,167,168,169,350,171,172,173,174,379,176,177,731,322,180,181,182,183,184,261,351,187,317,733,318,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],"windows-1251":[1026,1027,8218,1107,8222,8230,8224,8225,8364,8240,1033,8249,1034,1036,1035,1039,1106,8216,8217,8220,8221,8226,8211,8212,152,8482,1113,8250,1114,1116,1115,1119,160,1038,1118,1032,164,1168,166,167,1025,169,1028,171,172,173,174,1031,176,177,1030,1110,1169,181,182,183,1105,8470,1108,187,1112,1029,1109,1111,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103],"windows-1252":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],"windows-1253":[8364,129,8218,402,8222,8230,8224,8225,136,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,157,158,159,160,901,902,163,164,165,166,167,168,169,null,171,172,173,174,8213,176,177,178,179,900,181,182,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],"windows-1254":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,286,209,210,211,212,213,214,215,216,217,218,219,220,304,350,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,287,241,242,243,244,245,246,247,248,249,250,251,252,305,351,255],"windows-1255":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,156,157,158,159,160,161,162,163,8362,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,191,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1520,1521,1522,1523,1524,null,null,null,null,null,null,null,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],"windows-1256":[8364,1662,8218,402,8222,8230,8224,8225,710,8240,1657,8249,338,1670,1688,1672,1711,8216,8217,8220,8221,8226,8211,8212,1705,8482,1681,8250,339,8204,8205,1722,160,1548,162,163,164,165,166,167,168,169,1726,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,1563,187,188,189,190,1567,1729,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,215,1591,1592,1593,1594,1600,1601,1602,1603,224,1604,226,1605,1606,1607,1608,231,232,233,234,235,1609,1610,238,239,1611,1612,1613,1614,244,1615,1616,247,1617,249,1618,251,252,8206,8207,1746],"windows-1257":[8364,129,8218,131,8222,8230,8224,8225,136,8240,138,8249,140,168,711,184,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,175,731,159,160,null,162,163,164,null,166,167,216,169,342,171,172,173,174,198,176,177,178,179,180,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,729],"windows-1258":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,258,196,197,198,199,200,201,202,203,768,205,206,207,272,209,777,211,212,416,214,215,216,217,218,219,220,431,771,223,224,225,226,259,228,229,230,231,232,233,234,235,769,237,238,239,273,241,803,243,244,417,246,247,248,249,250,251,252,432,8363,255],"x-mac-cyrillic":[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,8224,176,1168,163,167,8226,182,1030,174,169,8482,1026,1106,8800,1027,1107,8734,177,8804,8805,1110,181,1169,1032,1028,1108,1031,1111,1033,1113,1034,1114,1112,1029,172,8730,402,8776,8710,171,187,8230,160,1035,1115,1036,1116,1109,8211,8212,8220,8221,8216,8217,247,8222,1038,1118,1039,1119,8470,1025,1105,1103,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,8364]};globalThis["encoding-indexes"]=Dz||{};function Tt(e,t,r){return t<=e&&e<=r}function rSe(e,t){return e.indexOf(t)!==-1}var nc=Math.floor;function g_(e){if(e===void 0)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function nSe(e){for(var t=String(e),r=t.length,n=0,a=[];n<r;){var i=t.charCodeAt(n);if(i<55296||i>57343)a.push(i);else if(56320<=i&&i<=57343)a.push(65533);else if(55296<=i&&i<=56319)if(n===r-1)a.push(65533);else{var o=t.charCodeAt(n+1);if(56320<=o&&o<=57343){var s=i&1023,u=o&1023;a.push(65536+(s<<10)+u),n+=1}else a.push(65533)}n+=1}return a}function aSe(e){for(var t="",r=0;r<e.length;++r){var n=e[r];n<=65535?t+=String.fromCharCode(n):(n-=65536,t+=String.fromCharCode((n>>10)+55296,(n&1023)+56320))}return t}function uo(e){return 0<=e&&e<=127}var so=uo,Wt=-1;function T4(e){this.tokens=[].slice.call(e),this.tokens.reverse()}T4.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():Wt},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.pop());else this.tokens.push(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.shift());else this.tokens.unshift(e)}};var Br=-1;function $t(e,t){if(e)throw TypeError("Decoder error");return t||65533}function Qo(e){throw TypeError("The code point "+e+" could not be encoded.")}function iSe(){}iSe.prototype={handler:function(e,t){}};function oSe(){}oSe.prototype={handler:function(e,t){}};function A4(e){return e=String(e).trim().toLowerCase(),Object.prototype.hasOwnProperty.call(E4,e)?E4[e]:null}var Bz=[{encodings:[{labels:["unicode-1-1-utf-8","utf-8","utf8"],name:"UTF-8"}],heading:"The Encoding"},{encodings:[{labels:["866","cp866","csibm866","ibm866"],name:"IBM866"},{labels:["csisolatin2","iso-8859-2","iso-ir-101","iso8859-2","iso88592","iso_8859-2","iso_8859-2:1987","l2","latin2"],name:"ISO-8859-2"},{labels:["csisolatin3","iso-8859-3","iso-ir-109","iso8859-3","iso88593","iso_8859-3","iso_8859-3:1988","l3","latin3"],name:"ISO-8859-3"},{labels:["csisolatin4","iso-8859-4","iso-ir-110","iso8859-4","iso88594","iso_8859-4","iso_8859-4:1988","l4","latin4"],name:"ISO-8859-4"},{labels:["csisolatincyrillic","cyrillic","iso-8859-5","iso-ir-144","iso8859-5","iso88595","iso_8859-5","iso_8859-5:1988"],name:"ISO-8859-5"},{labels:["arabic","asmo-708","csiso88596e","csiso88596i","csisolatinarabic","ecma-114","iso-8859-6","iso-8859-6-e","iso-8859-6-i","iso-ir-127","iso8859-6","iso88596","iso_8859-6","iso_8859-6:1987"],name:"ISO-8859-6"},{labels:["csisolatingreek","ecma-118","elot_928","greek","greek8","iso-8859-7","iso-ir-126","iso8859-7","iso88597","iso_8859-7","iso_8859-7:1987","sun_eu_greek"],name:"ISO-8859-7"},{labels:["csiso88598e","csisolatinhebrew","hebrew","iso-8859-8","iso-8859-8-e","iso-ir-138","iso8859-8","iso88598","iso_8859-8","iso_8859-8:1988","visual"],name:"ISO-8859-8"},{labels:["csiso88598i","iso-8859-8-i","logical"],name:"ISO-8859-8-I"},{labels:["csisolatin6","iso-8859-10","iso-ir-157","iso8859-10","iso885910","l6","latin6"],name:"ISO-8859-10"},{labels:["iso-8859-13","iso8859-13","iso885913"],name:"ISO-8859-13"},{labels:["iso-8859-14","iso8859-14","iso885914"],name:"ISO-8859-14"},{labels:["csisolatin9","iso-8859-15","iso8859-15","iso885915","iso_8859-15","l9"],name:"ISO-8859-15"},{labels:["iso-8859-16"],name:"ISO-8859-16"},{labels:["cskoi8r","koi","koi8","koi8-r","koi8_r"],name:"KOI8-R"},{labels:["koi8-ru","koi8-u"],name:"KOI8-U"},{labels:["csmacintosh","mac","macintosh","x-mac-roman"],name:"macintosh"},{labels:["dos-874","iso-8859-11","iso8859-11","iso885911","tis-620","windows-874"],name:"windows-874"},{labels:["cp1250","windows-1250","x-cp1250"],name:"windows-1250"},{labels:["cp1251","windows-1251","x-cp1251"],name:"windows-1251"},{labels:["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"],name:"windows-1252"},{labels:["cp1253","windows-1253","x-cp1253"],name:"windows-1253"},{labels:["cp1254","csisolatin5","iso-8859-9","iso-ir-148","iso8859-9","iso88599","iso_8859-9","iso_8859-9:1989","l5","latin5","windows-1254","x-cp1254"],name:"windows-1254"},{labels:["cp1255","windows-1255","x-cp1255"],name:"windows-1255"},{labels:["cp1256","windows-1256","x-cp1256"],name:"windows-1256"},{labels:["cp1257","windows-1257","x-cp1257"],name:"windows-1257"},{labels:["cp1258","windows-1258","x-cp1258"],name:"windows-1258"},{labels:["x-mac-cyrillic","x-mac-ukrainian"],name:"x-mac-cyrillic"}],heading:"Legacy single-byte encodings"},{encodings:[{labels:["chinese","csgb2312","csiso58gb231280","gb2312","gb_2312","gb_2312-80","gbk","iso-ir-58","x-gbk"],name:"GBK"},{labels:["gb18030"],name:"gb18030"}],heading:"Legacy multi-byte Chinese (simplified) encodings"},{encodings:[{labels:["big5","big5-hkscs","cn-big5","csbig5","x-x-big5"],name:"Big5"}],heading:"Legacy multi-byte Chinese (traditional) encodings"},{encodings:[{labels:["cseucpkdfmtjapanese","euc-jp","x-euc-jp"],name:"EUC-JP"},{labels:["csiso2022jp","iso-2022-jp"],name:"ISO-2022-JP"},{labels:["csshiftjis","ms932","ms_kanji","shift-jis","shift_jis","sjis","windows-31j","x-sjis"],name:"Shift_JIS"}],heading:"Legacy multi-byte Japanese encodings"},{encodings:[{labels:["cseuckr","csksc56011987","euc-kr","iso-ir-149","korean","ks_c_5601-1987","ks_c_5601-1989","ksc5601","ksc_5601","windows-949"],name:"EUC-KR"}],heading:"Legacy multi-byte Korean encodings"},{encodings:[{labels:["csiso2022kr","hz-gb-2312","iso-2022-cn","iso-2022-cn-ext","iso-2022-kr"],name:"replacement"},{labels:["utf-16be"],name:"UTF-16BE"},{labels:["utf-16","utf-16le"],name:"UTF-16LE"},{labels:["x-user-defined"],name:"x-user-defined"}],heading:"Legacy miscellaneous encodings"}],E4={};Bz.forEach(function(e){e.encodings.forEach(function(t){t.labels.forEach(function(r){E4[r]=t})})});var mi={},gi={};function ph(e,t){return t&&t[e]||null}function dh(e,t){var r=t.indexOf(e);return r===-1?null:r}function ei(e){if(!("encoding-indexes"in globalThis))throw Error("Indexes missing. Did you forget to include encoding-indexes.js first?");return globalThis["encoding-indexes"][e]}function sSe(e){if(e>39419&&e<189e3||e>1237575)return null;if(e===7457)return 59335;var t=0,r=0,n=ei("gb18030-ranges"),a;for(a=0;a<n.length;++a){var i=n[a];if(i[0]<=e)t=i[0],r=i[1];else break}return r+e-t}function uSe(e){if(e===59335)return 7457;var t=0,r=0,n=ei("gb18030-ranges"),a;for(a=0;a<n.length;++a){var i=n[a];if(i[1]<=e)t=i[1],r=i[0];else break}return r+e-t}function cSe(e){_4=_4||ei("jis0208").map(function(r,n){return Tt(n,8272,8835)?null:r});var t=_4;return t.indexOf(e)}var _4;function lSe(e){w4=w4||ei("big5").map(function(r,n){return n<(161-129)*157?null:r});var t=w4;return e===9552||e===9566||e===9569||e===9578||e===21313||e===21317?t.lastIndexOf(e):dh(e,t)}var w4,Fz="utf-8";function cp(e,t){if(!(this instanceof cp))throw TypeError("Called as a function. Did you forget 'new'?");e=e!==void 0?String(e):Fz,t=g_(t),this._encoding=null,this._decoder=null,this._ignoreBOM=!1,this._BOMseen=!1,this._error_mode="replacement",this._do_not_flush=!1;var r=A4(e);if(r===null||r.name==="replacement")throw RangeError("Unknown encoding: "+e);if(!gi[r.name])throw Error("Decoder not present. Did you forget to include encoding-indexes.js first?");var n=this;return n._encoding=r,Boolean(t.fatal)&&(n._error_mode="fatal"),Boolean(t.ignoreBOM)&&(n._ignoreBOM=!0),Object.defineProperty||(this.encoding=n._encoding.name.toLowerCase(),this.fatal=n._error_mode==="fatal",this.ignoreBOM=n._ignoreBOM),n}Object.defineProperty&&(Object.defineProperty(cp.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(cp.prototype,"fatal",{get:function(){return this._error_mode==="fatal"}}),Object.defineProperty(cp.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}}));cp.prototype.decode=function(t,r){var n;typeof t=="object"&&t instanceof ArrayBuffer?n=new Uint8Array(t):typeof t=="object"&&"buffer"in t&&t.buffer instanceof ArrayBuffer?n=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):n=new Uint8Array(0),r=g_(r),this._do_not_flush||(this._decoder=gi[this._encoding.name]({fatal:this._error_mode==="fatal"}),this._BOMseen=!1),this._do_not_flush=Boolean(r.stream);for(var a=new T4(n),i=[],o;;){var s=a.read();if(s===Wt||(o=this._decoder.handler(a,s),o===Br))break;o!==null&&(Array.isArray(o)?i.push.apply(i,o):i.push(o))}if(!this._do_not_flush){do{if(o=this._decoder.handler(a,a.read()),o===Br)break;o!==null&&(Array.isArray(o)?i.push.apply(i,o):i.push(o))}while(!a.endOfStream());this._decoder=null}function u(c){return rSe(["UTF-8","UTF-16LE","UTF-16BE"],this._encoding.name)&&!this._ignoreBOM&&!this._BOMseen&&(c.length>0&&c[0]===65279?(this._BOMseen=!0,c.shift()):c.length>0&&(this._BOMseen=!0)),aSe(c)}return u.call(this,i)};function Tb(e,t){if(!(this instanceof Tb))throw TypeError("Called as a function. Did you forget 'new'?");t=g_(t),this._encoding=null,this._encoder=null,this._do_not_flush=!1,this._fatal=Boolean(t.fatal)?"fatal":"replacement";var r=this;if(Boolean(t.NONSTANDARD_allowLegacyEncoding)){e=e!==void 0?String(e):Fz;var n=A4(e);if(n===null||n.name==="replacement")throw RangeError("Unknown encoding: "+e);if(!mi[n.name])throw Error("Encoder not present. Did you forget to include encoding-indexes.js first?");r._encoding=n}else r._encoding=A4("utf-8"),e!==void 0&&"console"in globalThis&&console.warn("TextEncoder constructor called with encoding label, which is ignored.");return Object.defineProperty||(this.encoding=r._encoding.name.toLowerCase()),r}Object.defineProperty&&Object.defineProperty(Tb.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}});Tb.prototype.encode=function(t,r){t=t===void 0?"":String(t),r=g_(r),this._do_not_flush||(this._encoder=mi[this._encoding.name]({fatal:this._fatal==="fatal"})),this._do_not_flush=Boolean(r.stream);for(var n=new T4(nSe(t)),a=[],i;;){var o=n.read();if(o===Wt||(i=this._encoder.handler(n,o),i===Br))break;Array.isArray(i)?a.push.apply(a,i):a.push(i)}if(!this._do_not_flush){for(;i=this._encoder.handler(n,n.read()),i!==Br;)Array.isArray(i)?a.push.apply(a,i):a.push(i);this._encoder=null}return new Uint8Array(a)};function fSe(e){var t=e.fatal,r=0,n=0,a=0,i=128,o=191;this.handler=function(s,u){if(u===Wt&&a!==0)return a=0,$t(t);if(u===Wt)return Br;if(a===0){if(Tt(u,0,127))return u;if(Tt(u,194,223))a=1,r=u&31;else if(Tt(u,224,239))u===224&&(i=160),u===237&&(o=159),a=2,r=u&15;else if(Tt(u,240,244))u===240&&(i=144),u===244&&(o=143),a=3,r=u&7;else return $t(t);return null}if(!Tt(u,i,o))return r=a=n=0,i=128,o=191,s.prepend(u),$t(t);if(i=128,o=191,r=r<<6|u&63,n+=1,n!==a)return null;var c=r;return r=a=n=0,c}}function pSe(e){var t=e.fatal;this.handler=function(r,n){if(n===Wt)return Br;if(so(n))return n;var a,i;Tt(n,128,2047)?(a=1,i=192):Tt(n,2048,65535)?(a=2,i=224):Tt(n,65536,1114111)&&(a=3,i=240);for(var o=[(n>>6*a)+i];a>0;){var s=n>>6*(a-1);o.push(128|s&63),a-=1}return o}}mi["UTF-8"]=function(e){return new pSe(e)};gi["UTF-8"]=function(e){return new fSe(e)};function dSe(e,t){var r=t.fatal;this.handler=function(n,a){if(a===Wt)return Br;if(uo(a))return a;var i=e[a-128];return i===null?$t(r):i}}function hSe(e,t){var r=t.fatal;this.handler=function(n,a){if(a===Wt)return Br;if(so(a))return a;var i=dh(a,e);return i===null&&Qo(a),i+128}}(function(){"encoding-indexes"in globalThis&&Bz.forEach(function(e){e.heading==="Legacy single-byte encodings"&&e.encodings.forEach(function(t){var r=t.name,n=ei(r.toLowerCase());gi[r]=function(a){return new dSe(n,a)},mi[r]=function(a){return new hSe(n,a)}})})})();gi.GBK=function(e){return new Oz(e)};mi.GBK=function(e){return new Iz(e,!0)};function Oz(e){var t=e.fatal,r=0,n=0,a=0;this.handler=function(i,o){if(o===Wt&&r===0&&n===0&&a===0)return Br;o===Wt&&(r!==0||n!==0||a!==0)&&(r=0,n=0,a=0,$t(t));var s;if(a!==0){s=null,Tt(o,48,57)&&(s=sSe((((r-129)*10+n-48)*126+a-129)*10+o-48));var u=[n,a,o];return r=0,n=0,a=0,s===null?(i.prepend(u),$t(t)):s}if(n!==0)return Tt(o,129,254)?(a=o,null):(i.prepend([n,o]),r=0,n=0,$t(t));if(r!==0){if(Tt(o,48,57))return n=o,null;var c=r,l=null;r=0;var f=o<127?64:65;return(Tt(o,64,126)||Tt(o,128,254))&&(l=(c-129)*190+(o-f)),s=l===null?null:ph(l,ei("gb18030")),s===null&&uo(o)&&i.prepend(o),s===null?$t(t):s}return uo(o)?o:o===128?8364:Tt(o,129,254)?(r=o,null):$t(t)}}function Iz(e,t){var r=e.fatal;this.handler=function(n,a){if(a===Wt)return Br;if(so(a))return a;if(a===58853)return Qo(a);if(t&&a===8364)return 128;var i=dh(a,ei("gb18030"));if(i!==null){var o=nc(i/190)+129,s=i%190,u=s<63?64:65;return[o,s+u]}if(t)return Qo(a);i=uSe(a);var c=nc(i/10/126/10);i=i-c*10*126*10;var l=nc(i/10/126);i=i-l*10*126;var f=nc(i/10),p=i-f*10;return[c+129,l+48,f+129,p+48]}}mi.gb18030=function(e){return new Iz(e)};gi.gb18030=function(e){return new Oz(e)};function mSe(e){var t=e.fatal,r=0;this.handler=function(n,a){if(a===Wt&&r!==0)return r=0,$t(t);if(a===Wt&&r===0)return Br;if(r!==0){var i=r,o=null;r=0;var s=a<127?64:98;switch((Tt(a,64,126)||Tt(a,161,254))&&(o=(i-129)*157+(a-s)),o){case 1133:return[202,772];case 1135:return[202,780];case 1164:return[234,772];case 1166:return[234,780]}var u=o===null?null:ph(o,ei("big5"));return u===null&&uo(a)&&n.prepend(a),u===null?$t(t):u}return uo(a)?a:Tt(a,129,254)?(r=a,null):$t(t)}}function gSe(e){var t=e.fatal;this.handler=function(r,n){if(n===Wt)return Br;if(so(n))return n;var a=lSe(n);if(a===null)return Qo(n);var i=nc(a/157)+129;if(i<161)return Qo(n);var o=a%157,s=o<63?64:98;return[i,o+s]}}mi.Big5=function(e){return new gSe(e)};gi.Big5=function(e){return new mSe(e)};function bSe(e){var t=e.fatal,r=!1,n=0;this.handler=function(a,i){if(i===Wt&&n!==0)return n=0,$t(t);if(i===Wt&&n===0)return Br;if(n===142&&Tt(i,161,223))return n=0,65377-161+i;if(n===143&&Tt(i,161,254))return r=!0,n=i,null;if(n!==0){var o=n;n=0;var s=null;return Tt(o,161,254)&&Tt(i,161,254)&&(s=ph((o-161)*94+(i-161),ei(r?"jis0212":"jis0208"))),r=!1,Tt(i,161,254)||a.prepend(i),s===null?$t(t):s}return uo(i)?i:i===142||i===143||Tt(i,161,254)?(n=i,null):$t(t)}}function vSe(e){var t=e.fatal;this.handler=function(r,n){if(n===Wt)return Br;if(so(n))return n;if(n===165)return 92;if(n===8254)return 126;if(Tt(n,65377,65439))return[142,n-65377+161];n===8722&&(n=65293);var a=dh(n,ei("jis0208"));if(a===null)return Qo(n);var i=nc(a/94)+161,o=a%94+161;return[i,o]}}mi["EUC-JP"]=function(e){return new vSe(e)};gi["EUC-JP"]=function(e){return new bSe(e)};function xSe(e){var t=e.fatal,r={ASCII:0,Roman:1,Katakana:2,LeadByte:3,TrailByte:4,EscapeStart:5,Escape:6},n=r.ASCII,a=r.ASCII,i=0,o=!1;this.handler=function(s,u){switch(n){default:case r.ASCII:return u===27?(n=r.EscapeStart,null):Tt(u,0,127)&&u!==14&&u!==15&&u!==27?(o=!1,u):u===Wt?Br:(o=!1,$t(t));case r.Roman:return u===27?(n=r.EscapeStart,null):u===92?(o=!1,165):u===126?(o=!1,8254):Tt(u,0,127)&&u!==14&&u!==15&&u!==27&&u!==92&&u!==126?(o=!1,u):u===Wt?Br:(o=!1,$t(t));case r.Katakana:return u===27?(n=r.EscapeStart,null):Tt(u,33,95)?(o=!1,65377-33+u):u===Wt?Br:(o=!1,$t(t));case r.LeadByte:return u===27?(n=r.EscapeStart,null):Tt(u,33,126)?(o=!1,i=u,n=r.TrailByte,null):u===Wt?Br:(o=!1,$t(t));case r.TrailByte:if(u===27)return n=r.EscapeStart,$t(t);if(Tt(u,33,126)){n=r.LeadByte;var c=(i-33)*94+u-33,l=ph(c,ei("jis0208"));return l===null?$t(t):l}return u===Wt?(n=r.LeadByte,s.prepend(u),$t(t)):(n=r.LeadByte,$t(t));case r.EscapeStart:return u===36||u===40?(i=u,n=r.Escape,null):(s.prepend(u),o=!1,n=a,$t(t));case r.Escape:var f=i;i=0;var p=null;if(f===40&&u===66&&(p=r.ASCII),f===40&&u===74&&(p=r.Roman),f===40&&u===73&&(p=r.Katakana),f===36&&(u===64||u===66)&&(p=r.LeadByte),p!==null){n=n=p;var d=o;return o=!0,d?$t(t):null}return s.prepend([f,u]),o=!1,n=a,$t(t)}}}function ySe(e){var t=e.fatal,r={ASCII:0,Roman:1,jis0208:2},n=r.ASCII;this.handler=function(a,i){if(i===Wt&&n!==r.ASCII)return a.prepend(i),n=r.ASCII,[27,40,66];if(i===Wt&&n===r.ASCII)return Br;if((n===r.ASCII||n===r.Roman)&&(i===14||i===15||i===27))return Qo(65533);if(n===r.ASCII&&so(i))return i;if(n===r.Roman&&(so(i)&&i!==92&&i!==126||i==165||i==8254)){if(so(i))return i;if(i===165)return 92;if(i===8254)return 126}if(so(i)&&n!==r.ASCII)return a.prepend(i),n=r.ASCII,[27,40,66];if((i===165||i===8254)&&n!==r.Roman)return a.prepend(i),n=r.Roman,[27,40,74];i===8722&&(i=65293);var o=dh(i,ei("jis0208"));if(o===null)return Qo(i);if(n!==r.jis0208)return a.prepend(i),n=r.jis0208,[27,36,66];var s=nc(o/94)+33,u=o%94+33;return[s,u]}}mi["ISO-2022-JP"]=function(e){return new ySe(e)};gi["ISO-2022-JP"]=function(e){return new xSe(e)};function _Se(e){var t=e.fatal,r=0;this.handler=function(n,a){if(a===Wt&&r!==0)return r=0,$t(t);if(a===Wt&&r===0)return Br;if(r!==0){var i=r,o=null;r=0;var s=a<127?64:65,u=i<160?129:193;if((Tt(a,64,126)||Tt(a,128,252))&&(o=(i-u)*188+a-s),Tt(o,8836,10715))return 57344-8836+o;var c=o===null?null:ph(o,ei("jis0208"));return c===null&&uo(a)&&n.prepend(a),c===null?$t(t):c}return uo(a)||a===128?a:Tt(a,161,223)?65377-161+a:Tt(a,129,159)||Tt(a,224,252)?(r=a,null):$t(t)}}function wSe(e){var t=e.fatal;this.handler=function(r,n){if(n===Wt)return Br;if(so(n)||n===128)return n;if(n===165)return 92;if(n===8254)return 126;if(Tt(n,65377,65439))return n-65377+161;n===8722&&(n=65293);var a=cSe(n);if(a===null)return Qo(n);var i=nc(a/188),o=i<31?129:193,s=a%188,u=s<63?64:65;return[i+o,s+u]}}mi.Shift_JIS=function(e){return new wSe(e)};gi.Shift_JIS=function(e){return new _Se(e)};function ASe(e){var t=e.fatal,r=0;this.handler=function(n,a){if(a===Wt&&r!==0)return r=0,$t(t);if(a===Wt&&r===0)return Br;if(r!==0){var i=r,o=null;r=0,Tt(a,65,254)&&(o=(i-129)*190+(a-65));var s=o===null?null:ph(o,ei("euc-kr"));return o===null&&uo(a)&&n.prepend(a),s===null?$t(t):s}return uo(a)?a:Tt(a,129,254)?(r=a,null):$t(t)}}function ESe(e){var t=e.fatal;this.handler=function(r,n){if(n===Wt)return Br;if(so(n))return n;var a=dh(n,ei("euc-kr"));if(a===null)return Qo(n);var i=nc(a/190)+129,o=a%190+65;return[i,o]}}mi["EUC-KR"]=function(e){return new ESe(e)};gi["EUC-KR"]=function(e){return new ASe(e)};function m_(e,t){var r=e>>8,n=e&255;return t?[r,n]:[n,r]}function Pz(e,t){var r=t.fatal,n=null,a=null;this.handler=function(i,o){if(o===Wt&&(n!==null||a!==null))return $t(r);if(o===Wt&&n===null&&a===null)return Br;if(n===null)return n=o,null;var s;if(e?s=(n<<8)+o:s=(o<<8)+n,n=null,a!==null){var u=a;return a=null,Tt(s,56320,57343)?65536+(u-55296)*1024+(s-56320):(i.prepend(m_(s,e)),$t(r))}return Tt(s,55296,56319)?(a=s,null):Tt(s,56320,57343)?$t(r):s}}function Rz(e,t){var r=t.fatal;this.handler=function(n,a){if(a===Wt)return Br;if(Tt(a,0,65535))return m_(a,e);var i=m_((a-65536>>10)+55296,e),o=m_((a-65536&1023)+56320,e);return i.concat(o)}}mi["UTF-16BE"]=function(e){return new Rz(!0,e)};gi["UTF-16BE"]=function(e){return new Pz(!0,e)};mi["UTF-16LE"]=function(e){return new Rz(!1,e)};gi["UTF-16LE"]=function(e){return new Pz(!1,e)};function TSe(e){var t=e.fatal;this.handler=function(r,n){return n===Wt?Br:uo(n)?n:63360+n-128}}function SSe(e){var t=e.fatal;this.handler=function(r,n){return n===Wt?Br:so(n)?n:Tt(n,63360,63487)?n-63360+128:Qo(n)}}mi["x-user-defined"]=function(e){return new SSe(e)};gi["x-user-defined"]=function(e){return new TSe(e)};function Sb(e){return Buffer.from(e).toString("base64")}function S4(e){return Buffer.from(e,"base64").toString("ascii")}var FV=Ct(DV(),1),OV=Ct(Ib(),1);function BV(e){return Buffer.isBuffer(e)?new Uint8Array(e).buffer:e}function V4e(e,t){let r=t.type?t.type.replace("image/",""):"jpeg",n=(0,OV.default)(e.data,[e.width,e.height,4],[4,e.width*4,1],0);return(0,FV.default)(n,r,t)}function IV(e,t){let r=V4e(e,t);return new Promise(n=>{let a=[];r.on("data",i=>a.push(i)),r.on("end",()=>{let i=Buffer.concat(a);n(BV(i))})})}var hte=Ct(dte(),1),IB=["image/png","image/jpeg","image/gif"];async function PB(e,t){if(!t)throw new Error("MIMEType is required to parse image under Node.js");let r=e instanceof Buffer?e:Buffer.from(e);return await fMe(r,t)}function fMe(e,t){return new Promise(r=>(0,hte.default)(e,t,(n,a)=>{if(n)throw n;let i=[...a.shape],o=a.shape.length===4?a.shape.shift():1,s=a.data instanceof Buffer?new Uint8Array(a.data):a.data;r({shape:i,data:s,width:a.shape[0],height:a.shape[1],components:a.shape[2],layers:o?[o]:[]})}))}async function Hi(e,t,r,n){return n._parse(e,t,r,n)}function yt(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var uu={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},gte=uu.self||uu.window||uu.global||{},bte=uu.window||uu.self||uu.global||{},vte=uu.global||uu.self||uu.window||{},xte=uu.document||{};var pr=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var mte=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),pMe=mte&&parseFloat(mte[1])||0;var fw=globalThis,dMe=globalThis.document||{},pw=globalThis.process||{},hMe=globalThis.console,jqt=globalThis.navigator||{};function yte(e){var n,a;if(typeof window<"u"&&((n=window.process)==null?void 0:n.type)==="renderer"||typeof process<"u"&&Boolean((a=process.versions)==null?void 0:a.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,r=e||t;return Boolean(r&&r.indexOf("Electron")>=0)}function Bp(){return!(typeof process=="object"&&String(process)==="[object process]"&&!(process!=null&&process.browser))||yte()}var RB="4.1.1";function a0(e,t){if(!e)throw new Error(t||"Assertion failed")}function jB(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 a0(Number.isFinite(t)&&t>=0),t}function _te(e){let{logLevel:t,message:r}=e;e.logLevel=jB(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let a=typeof e.message;return a0(a==="string"||a==="object"),Object.assign(e,{args:n},e.opts)}var Fp=()=>{},dw=class{constructor({level:t=0}={}){this.userData={},this._onceCache=new Set,this._level=t}set level(t){this.setLevel(t)}get level(){return this.getLevel()}setLevel(t){return this._level=t,this}getLevel(){return this._level}warn(t,...r){return this._log("warn",0,t,r,{once:!0})}error(t,...r){return this._log("error",0,t,r)}log(t,r,...n){return this._log("log",t,r,n)}info(t,r,...n){return this._log("info",t,r,n)}once(t,r,...n){return this._log("once",t,r,n,{once:!0})}_log(t,r,n,a,i={}){let o=_te({logLevel:r,message:n,args:this._buildArgs(r,n,a),opts:i});return this._createLogFunction(t,o,i)}_buildArgs(t,r,n){return[t,r,...n]}_createLogFunction(t,r,n){if(!this._shouldLog(r.logLevel))return Fp;let a=this._getOnceTag(n.tag??r.tag??r.message);if((n.once||r.once)&&a!==void 0){if(this._onceCache.has(a))return Fp;this._onceCache.add(a)}return this._emit(t,r)}_shouldLog(t){return this.getLevel()>=jB(t)}_getOnceTag(t){if(t!==void 0)try{return typeof t=="string"?t:String(t)}catch{return}}};function gMe(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var hw=class{constructor(t,r,n="sessionStorage"){this.storage=gMe(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function wte(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 Ate(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var mw;(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"})(mw||(mw={}));var bMe=10;function Ete(e){return typeof e!="string"?e:(e=e.toUpperCase(),mw[e]||mw.WHITE)}function Tte(e,t,r){return!Bp&&typeof e=="string"&&(t&&(e=`\x1B[${Ete(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${Ete(r)+bMe}m${e}\x1B[49m`)),e}function Ste(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),a=e;for(let i of n){let o=a[i];typeof o=="function"&&(t.find(s=>i===s)||(a[i]=o.bind(e)))}}function i0(){var t,r,n,a,i;let e;if(Bp()&&fw.performance)e=(n=(r=(t=fw)==null?void 0:t.performance)==null?void 0:r.now)==null?void 0:n.call(r);else if("hrtime"in pw){let o=(i=(a=pw)==null?void 0:a.hrtime)==null?void 0:i.call(a);e=o[0]*1e3+o[1]/1e6}else e=Date.now();return e}var o0={debug:Bp()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},LB={enabled:!0,level:0},ds=class extends dw{constructor({id:t}={id:""}){super({level:0}),this.VERSION=RB,this._startTs=i0(),this._deltaTs=i0(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new hw(`__probe-${this.id}__`,{[this.id]:LB}),this.timeStamp(`${this.id} started`),Ste(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((i0()-this._startTs).toPrecision(10))}getDelta(){return Number((i0()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._updateConfiguration({enabled:t}),this}setLevel(t){return this._updateConfiguration({level:t}),this}get(t){return this._getConfiguration()[t]}set(t,r){this._updateConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t,...r){return this._log("warn",0,t,r,{method:o0.warn,once:!0})}error(t,...r){return this._log("error",0,t,r,{method:o0.error})}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r,...n){return this._log("log",t,r,n,{method:o0.log,time:!0,once:!0})}log(t,r,...n){return this._log("log",t,r,n,{method:o0.debug})}info(t,r,...n){return this._log("info",t,r,n,{method:console.info})}once(t,r,...n){return this._log("once",t,r,n,{method:o0.debug||o0.info,once:!0})}table(t,r,n){return r?this._log("table",t,r,n&&[n]||[],{method:console.table||Fp,tag:xMe(r)}):Fp}time(t,r){return this._log("time",t,r,[],{method:console.time?console.time:console.info})}timeEnd(t,r){return this._log("time",t,r,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(t,r){return this._log("time",t,r,[],{method:console.timeStamp||Fp})}group(t,r,n={collapsed:!1}){let a=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",t,r,[],{method:a})}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._log("groupEnd",t,"",[],{method:console.groupEnd||Fp})}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&super._shouldLog(t)}_emit(t,r){let n=r.method;a0(n),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=i0();let a=vMe(this.id,r.message,r);return n.bind(console,a,...r.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(LB),this._storage.config[this.id]}_updateConfiguration(t){let r=this._storage.config[this.id]||{...LB};this._storage.setConfiguration({[this.id]:{...r,...t}})}};ds.VERSION=RB;function vMe(e,t,r){if(typeof t=="string"){let n=r.time?Ate(wte(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=Tte(t,r.color,r.background)}return t}function xMe(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}globalThis.probe={};var MB=new ds({id:"@probe.gl/log"});var qB="4.4.0",yMe=qB[0]>="0"&&qB[0]<="9"?`v${qB}`:"";function _Me(){let e=new ds({id:"loaders.gl"});return globalThis.loaders||(globalThis.loaders={}),globalThis.loaders.log=e,globalThis.loaders.version=yMe,globalThis.probe||(globalThis.probe={}),globalThis.probe.loaders=e,e}var Dv=_Me();var wMe=e=>typeof e=="boolean",cu=e=>typeof e=="function",lu=e=>e!==null&&typeof e=="object",gw=e=>lu(e)&&e.constructor==={}.constructor;var NB=e=>typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer,s0=e=>lu(e)&&typeof e.byteLength=="number"&&typeof e.slice=="function";var UB=e=>Boolean(e)&&cu(e[Symbol.iterator]),zB=e=>Boolean(e)&&cu(e[Symbol.asyncIterator]);var Vi=e=>typeof Response<"u"&&e instanceof Response||lu(e)&&cu(e.arrayBuffer)&&cu(e.text)&&cu(e.json);var $i=e=>typeof Blob<"u"&&e instanceof Blob;var kte=e=>typeof ReadableStream<"u"&&e instanceof ReadableStream||lu(e)&&cu(e.tee)&&cu(e.cancel)&&cu(e.getReader);var Cte=e=>lu(e)&&cu(e.read)&&cu(e.pipe)&&wMe(e.readable),Bv=e=>kte(e)||Cte(e);function GB(e,t){return Dte(e||{},t)}function Dte(e,t,r=0){if(r>3)return t;let n={...e};for(let[a,i]of Object.entries(t))i&&typeof i=="object"&&!Array.isArray(i)?n[a]=Dte(n[a]||{},t[a],r+1):n[a]=t[a];return n}function u0(e){var t;globalThis.loaders||(globalThis.loaders={}),(t=globalThis.loaders).modules||(t.modules={}),Object.assign(globalThis.loaders.modules,e)}function HB(e){var r,n;return((n=(r=globalThis.loaders)==null?void 0:r.modules)==null?void 0:n[e])||null}var Bte="beta";function AMe(){var e;return(e=globalThis._loadersgl_)!=null&&e.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.4.0"),globalThis._loadersgl_.version}var Op=AMe();function xa(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var fu={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},ANt=fu.self||fu.window||fu.global||{},ENt=fu.window||fu.self||fu.global||{},TNt=fu.global||fu.self||fu.window||{},SNt=fu.document||{};var Pn=typeof process!="object"||String(process)!=="[object process]"||process.browser,Fv=typeof importScripts=="function",Ote=typeof window<"u"&&typeof window.orientation<"u",Fte=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),kNt=Fte&&parseFloat(Fte[1])||0;var Ov=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(t,r){this.name=t,this.workerThread=r,this.result=new Promise((n,a)=>{this._resolve=n,this._reject=a})}postMessage(t,r){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:r})}done(t){xa(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){xa(this.isRunning),this.isRunning=!1,this._reject(t)}};var Ip={};Fa(Ip,{NodeWorker:()=>Pv,parentPort:()=>EMe});var Iv=Ct(require("worker_threads"),1);Eb(Ip,require("worker_threads"));var EMe=Iv==null?void 0:Iv.parentPort,Pv=Iv.Worker;var VB=new Map;function Ite(e){xa(e.source&&!e.url||!e.source&&e.url);let t=VB.get(e.source||e.url);return t||(e.url&&(t=TMe(e.url),VB.set(e.url,t)),e.source&&(t=Pte(e.source),VB.set(e.source,t))),xa(t),t}function TMe(e){if(!e.startsWith("http"))return e;let t=SMe(e);return Pte(t)}function Pte(e){let t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function SMe(e){return`try {
154
+ deps: ${r}}`};var CIt={keyword:"dependencies",type:"object",schemaType:"object",error:ec.error,code(e){let[t,r]=DIt(e);F6e(e,t),O6e(e,r)}};function DIt({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let a=Array.isArray(e[n])?t:r;a[n]=e[n]}return[t,r]}function F6e(e,t=e.schema){let{gen:r,data:n,it:a}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let o in t){let s=t[o];if(s.length===0)continue;let u=(0,l_.propertyInData)(r,n,o,a.opts.ownProperties);e.setParams({property:o,depsCount:s.length,deps:s.join(", ")}),a.allErrors?r.if(u,()=>{for(let c of s)(0,l_.checkReportMissingProp)(e,c)}):(r.if((0,ZU._)`${u} && (${(0,l_.checkMissingProp)(e,s,i)})`),(0,l_.reportMissingProp)(e,i),r.else())}}ec.validatePropertyDeps=F6e;function O6e(e,t=e.schema){let{gen:r,data:n,keyword:a,it:i}=e,o=r.name("valid");for(let s in t)(0,kIt.alwaysValidSchema)(i,t[s])||(r.if((0,l_.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let u=e.subschema({keyword:a,schemaProp:s},o);e.mergeValidEvaluated(u,o)},()=>r.var(o,!0)),e.ok(o))}ec.validateSchemaDeps=O6e;ec.default=CIt});var R6e=b(ez=>{"use strict";Object.defineProperty(ez,"__esModule",{value:!0});var P6e=Mt(),BIt=ar(),FIt={message:"property name must be valid",params:({params:e})=>(0,P6e._)`{propertyName: ${e.propertyName}}`},OIt={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:FIt,code(e){let{gen:t,schema:r,data:n,it:a}=e;if((0,BIt.alwaysValidSchema)(a,r))return;let i=t.name("valid");t.forIn("key",n,o=>{e.setParams({propertyName:o}),e.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},i),t.if((0,P6e.not)(i),()=>{e.error(!0),a.allErrors||t.break()})}),e.ok(i)}};ez.default=OIt});var rz=b(tz=>{"use strict";Object.defineProperty(tz,"__esModule",{value:!0});var a4=$o(),Ns=Mt(),IIt=ml(),i4=ar(),PIt={message:"must NOT have additional properties",params:({params:e})=>(0,Ns._)`{additionalProperty: ${e.additionalProperty}}`},RIt={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:PIt,code(e){let{gen:t,schema:r,parentSchema:n,data:a,errsCount:i,it:o}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:u}=o;if(o.props=!0,u.removeAdditional!=="all"&&(0,i4.alwaysValidSchema)(o,r))return;let c=(0,a4.allSchemaProperties)(n.properties),l=(0,a4.allSchemaProperties)(n.patternProperties);f(),e.ok((0,Ns._)`${i} === ${IIt.default.errors}`);function f(){t.forIn("key",a,g=>{!c.length&&!l.length?h(g):t.if(p(g),()=>h(g))})}function p(g){let x;if(c.length>8){let y=(0,i4.schemaRefOrVal)(o,n.properties,"properties");x=(0,a4.isOwnProperty)(t,y,g)}else c.length?x=(0,Ns.or)(...c.map(y=>(0,Ns._)`${g} === ${y}`)):x=Ns.nil;return l.length&&(x=(0,Ns.or)(x,...l.map(y=>(0,Ns._)`${(0,a4.usePattern)(e,y)}.test(${g})`))),(0,Ns.not)(x)}function d(g){t.code((0,Ns._)`delete ${a}[${g}]`)}function h(g){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){d(g);return}if(r===!1){e.setParams({additionalProperty:g}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,i4.alwaysValidSchema)(o,r)){let x=t.name("valid");u.removeAdditional==="failing"?(m(g,x,!1),t.if((0,Ns.not)(x),()=>{e.reset(),d(g)})):(m(g,x),s||t.if((0,Ns.not)(x),()=>t.break()))}}function m(g,x,y){let w={keyword:"additionalProperties",dataProp:g,dataPropType:i4.Type.Str};y===!1&&Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(w,x)}}};tz.default=RIt});var M6e=b(az=>{"use strict";Object.defineProperty(az,"__esModule",{value:!0});var jIt=Xy(),j6e=$o(),nz=ar(),L6e=rz(),LIt={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:a,it:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&L6e.default.code(new jIt.KeywordCxt(i,L6e.default,"additionalProperties"));let o=(0,j6e.allSchemaProperties)(r);for(let f of o)i.definedProperties.add(f);i.opts.unevaluated&&o.length&&i.props!==!0&&(i.props=nz.mergeEvaluated.props(t,(0,nz.toHash)(o),i.props));let s=o.filter(f=>!(0,nz.alwaysValidSchema)(i,r[f]));if(s.length===0)return;let u=t.name("valid");for(let f of s)c(f)?l(f):(t.if((0,j6e.propertyInData)(t,a,f,i.opts.ownProperties)),l(f),i.allErrors||t.else().var(u,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(u);function c(f){return i.opts.useDefaults&&!i.compositeRule&&r[f].default!==void 0}function l(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},u)}}};az.default=LIt});var z6e=b(iz=>{"use strict";Object.defineProperty(iz,"__esModule",{value:!0});var q6e=$o(),o4=Mt(),N6e=ar(),U6e=ar(),MIt={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:a,it:i}=e,{opts:o}=i,s=(0,q6e.allSchemaProperties)(r),u=s.filter(m=>(0,N6e.alwaysValidSchema)(i,r[m]));if(s.length===0||u.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&a.properties,l=t.name("valid");i.props!==!0&&!(i.props instanceof o4.Name)&&(i.props=(0,U6e.evaluatedPropsToName)(t,i.props));let{props:f}=i;p();function p(){for(let m of s)c&&d(m),i.allErrors?h(m):(t.var(l,!0),h(m),t.if(l))}function d(m){for(let g in c)new RegExp(m).test(g)&&(0,N6e.checkStrictMode)(i,`property ${g} matches pattern ${m} (use allowMatchingProperties)`)}function h(m){t.forIn("key",n,g=>{t.if((0,o4._)`${(0,q6e.usePattern)(e,m)}.test(${g})`,()=>{let x=u.includes(m);x||e.subschema({keyword:"patternProperties",schemaProp:m,dataProp:g,dataPropType:U6e.Type.Str},l),i.opts.unevaluated&&f!==!0?t.assign((0,o4._)`${f}[${g}]`,!0):!x&&!i.allErrors&&t.if((0,o4.not)(l),()=>t.break())})})}}};iz.default=MIt});var G6e=b(oz=>{"use strict";Object.defineProperty(oz,"__esModule",{value:!0});var qIt=ar(),NIt={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,qIt.alwaysValidSchema)(n,r)){e.fail();return}let a=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};oz.default=NIt});var H6e=b(sz=>{"use strict";Object.defineProperty(sz,"__esModule",{value:!0});var UIt=$o(),zIt={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:UIt.validateUnion,error:{message:"must match a schema in anyOf"}};sz.default=zIt});var V6e=b(uz=>{"use strict";Object.defineProperty(uz,"__esModule",{value:!0});var s4=Mt(),GIt=ar(),HIt={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,s4._)`{passingSchemas: ${e.passing}}`},VIt={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:HIt,code(e){let{gen:t,schema:r,parentSchema:n,it:a}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(a.opts.discriminator&&n.discriminator)return;let i=r,o=t.let("valid",!1),s=t.let("passing",null),u=t.name("_valid");e.setParams({passing:s}),t.block(c),e.result(o,()=>e.reset(),()=>e.error(!0));function c(){i.forEach((l,f)=>{let p;(0,GIt.alwaysValidSchema)(a,l)?t.var(u,!0):p=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},u),f>0&&t.if((0,s4._)`${u} && ${o}`).assign(o,!1).assign(s,(0,s4._)`[${s}, ${f}]`).else(),t.if(u,()=>{t.assign(o,!0),t.assign(s,f),p&&e.mergeEvaluated(p,s4.Name)})})}}};uz.default=VIt});var $6e=b(cz=>{"use strict";Object.defineProperty(cz,"__esModule",{value:!0});var $It=ar(),WIt={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let a=t.name("valid");r.forEach((i,o)=>{if((0,$It.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:o},a);e.ok(a),e.mergeEvaluated(s)})}};cz.default=WIt});var J6e=b(lz=>{"use strict";Object.defineProperty(lz,"__esModule",{value:!0});var u4=Mt(),K6e=ar(),KIt={message:({params:e})=>(0,u4.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,u4._)`{failingKeyword: ${e.ifClause}}`},JIt={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:KIt,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,K6e.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let a=W6e(n,"then"),i=W6e(n,"else");if(!a&&!i)return;let o=t.let("valid",!0),s=t.name("_valid");if(u(),e.reset(),a&&i){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,c("then",l),c("else",l))}else a?t.if(s,c("then")):t.if((0,u4.not)(s),c("else"));e.pass(o,()=>e.error(!0));function u(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function c(l,f){return()=>{let p=e.subschema({keyword:l},s);t.assign(o,s),e.mergeValidEvaluated(p,o),f?t.assign(f,(0,u4._)`${l}`):e.setParams({ifClause:l})}}}};function W6e(e,t){let r=e.schema[t];return r!==void 0&&!(0,K6e.alwaysValidSchema)(e,r)}lz.default=JIt});var X6e=b(fz=>{"use strict";Object.defineProperty(fz,"__esModule",{value:!0});var XIt=ar(),YIt={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,XIt.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};fz.default=YIt});var Y6e=b(pz=>{"use strict";Object.defineProperty(pz,"__esModule",{value:!0});var QIt=KU(),ZIt=k6e(),ePt=JU(),tPt=D6e(),rPt=B6e(),nPt=I6e(),aPt=R6e(),iPt=rz(),oPt=M6e(),sPt=z6e(),uPt=G6e(),cPt=H6e(),lPt=V6e(),fPt=$6e(),pPt=J6e(),dPt=X6e();function hPt(e=!1){let t=[uPt.default,cPt.default,lPt.default,fPt.default,pPt.default,dPt.default,aPt.default,iPt.default,nPt.default,oPt.default,sPt.default];return e?t.push(ZIt.default,tPt.default):t.push(QIt.default,ePt.default),t.push(rPt.default),t}pz.default=hPt});var Q6e=b(dz=>{"use strict";Object.defineProperty(dz,"__esModule",{value:!0});var kn=Mt(),mPt={message:({schemaCode:e})=>(0,kn.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,kn._)`{format: ${e}}`},gPt={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:mPt,code(e,t){let{gen:r,data:n,$data:a,schema:i,schemaCode:o,it:s}=e,{opts:u,errSchemaPath:c,schemaEnv:l,self:f}=s;if(!u.validateFormats)return;a?p():d();function p(){let h=r.scopeValue("formats",{ref:f.formats,code:u.code.formats}),m=r.const("fDef",(0,kn._)`${h}[${o}]`),g=r.let("fType"),x=r.let("format");r.if((0,kn._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>r.assign(g,(0,kn._)`${m}.type || "string"`).assign(x,(0,kn._)`${m}.validate`),()=>r.assign(g,(0,kn._)`"string"`).assign(x,m)),e.fail$data((0,kn.or)(y(),w()));function y(){return u.strictSchema===!1?kn.nil:(0,kn._)`${o} && !${x}`}function w(){let T=l.$async?(0,kn._)`(${m}.async ? await ${x}(${n}) : ${x}(${n}))`:(0,kn._)`${x}(${n})`,A=(0,kn._)`(typeof ${x} == "function" ? ${T} : ${x}.test(${n}))`;return(0,kn._)`${x} && ${x} !== true && ${g} === ${t} && !${A}`}}function d(){let h=f.formats[i];if(!h){y();return}if(h===!0)return;let[m,g,x]=w(h);m===t&&e.pass(T());function y(){if(u.strictSchema===!1){f.logger.warn(A());return}throw new Error(A());function A(){return`unknown format "${i}" ignored in schema at path "${c}"`}}function w(A){let B=A instanceof RegExp?(0,kn.regexpCode)(A):u.code.formats?(0,kn._)`${u.code.formats}${(0,kn.getProperty)(i)}`:void 0,I=r.scopeValue("formats",{key:i,ref:A,code:B});return typeof A=="object"&&!(A instanceof RegExp)?[A.type||"string",A.validate,(0,kn._)`${I}.validate`]:["string",A,I]}function T(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,kn._)`await ${x}(${n})`}return typeof g=="function"?(0,kn._)`${x}(${n})`:(0,kn._)`${x}.test(${n})`}}}};dz.default=gPt});var Z6e=b(hz=>{"use strict";Object.defineProperty(hz,"__esModule",{value:!0});var bPt=Q6e(),vPt=[bPt.default];hz.default=vPt});var e3e=b(db=>{"use strict";Object.defineProperty(db,"__esModule",{value:!0});db.contentVocabulary=db.metadataVocabulary=void 0;db.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];db.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var r3e=b(mz=>{"use strict";Object.defineProperty(mz,"__esModule",{value:!0});var xPt=c6e(),yPt=A6e(),_Pt=Y6e(),wPt=Z6e(),t3e=e3e(),APt=[xPt.default,yPt.default,(0,_Pt.default)(),wPt.default,t3e.metadataVocabulary,t3e.contentVocabulary];mz.default=APt});var a3e=b(c4=>{"use strict";Object.defineProperty(c4,"__esModule",{value:!0});c4.DiscrError=void 0;var n3e;(function(e){e.Tag="tag",e.Mapping="mapping"})(n3e||(c4.DiscrError=n3e={}))});var o3e=b(bz=>{"use strict";Object.defineProperty(bz,"__esModule",{value:!0});var hb=Mt(),gz=a3e(),i3e=Vk(),EPt=Yy(),TPt=ar(),SPt={message:({params:{discrError:e,tagName:t}})=>e===gz.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,hb._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},kPt={keyword:"discriminator",type:"object",schemaType:"object",error:SPt,code(e){let{gen:t,data:r,schema:n,parentSchema:a,it:i}=e,{oneOf:o}=a;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let u=t.let("valid",!1),c=t.const("tag",(0,hb._)`${r}${(0,hb.getProperty)(s)}`);t.if((0,hb._)`typeof ${c} == "string"`,()=>l(),()=>e.error(!1,{discrError:gz.DiscrError.Tag,tag:c,tagName:s})),e.ok(u);function l(){let d=p();t.if(!1);for(let h in d)t.elseIf((0,hb._)`${c} === ${h}`),t.assign(u,f(d[h]));t.else(),e.error(!1,{discrError:gz.DiscrError.Mapping,tag:c,tagName:s}),t.endIf()}function f(d){let h=t.name("valid"),m=e.subschema({keyword:"oneOf",schemaProp:d},h);return e.mergeEvaluated(m,hb.Name),h}function p(){var d;let h={},m=x(a),g=!0;for(let T=0;T<o.length;T++){let A=o[T];if(A!=null&&A.$ref&&!(0,TPt.schemaHasRulesButRef)(A,i.self.RULES)){let I=A.$ref;if(A=i3e.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,I),A instanceof i3e.SchemaEnv&&(A=A.schema),A===void 0)throw new EPt.default(i.opts.uriResolver,i.baseId,I)}let B=(d=A==null?void 0:A.properties)===null||d===void 0?void 0:d[s];if(typeof B!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);g=g&&(m||x(A)),y(B,T)}if(!g)throw new Error(`discriminator: "${s}" must be required`);return h;function x({required:T}){return Array.isArray(T)&&T.includes(s)}function y(T,A){if(T.const)w(T.const,A);else if(T.enum)for(let B of T.enum)w(B,A);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function w(T,A){if(typeof T!="string"||T in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[T]=A}}}};bz.default=kPt});var s3e=b((nbr,CPt)=>{CPt.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var c3e=b((Yr,vz)=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.MissingRefError=Yr.ValidationError=Yr.CodeGen=Yr.Name=Yr.nil=Yr.stringify=Yr.str=Yr._=Yr.KeywordCxt=Yr.Ajv=void 0;var DPt=n6e(),BPt=r3e(),FPt=o3e(),u3e=s3e(),OPt=["/properties"],l4="http://json-schema.org/draft-07/schema",mb=class extends DPt.default{_addVocabularies(){super._addVocabularies(),BPt.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(FPt.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(u3e,OPt):u3e;this.addMetaSchema(t,l4,!1),this.refs["http://json-schema.org/schema"]=l4}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l4)?l4:void 0)}};Yr.Ajv=mb;vz.exports=Yr=mb;vz.exports.Ajv=mb;Object.defineProperty(Yr,"__esModule",{value:!0});Yr.default=mb;var IPt=Xy();Object.defineProperty(Yr,"KeywordCxt",{enumerable:!0,get:function(){return IPt.KeywordCxt}});var gb=Mt();Object.defineProperty(Yr,"_",{enumerable:!0,get:function(){return gb._}});Object.defineProperty(Yr,"str",{enumerable:!0,get:function(){return gb.str}});Object.defineProperty(Yr,"stringify",{enumerable:!0,get:function(){return gb.stringify}});Object.defineProperty(Yr,"nil",{enumerable:!0,get:function(){return gb.nil}});Object.defineProperty(Yr,"Name",{enumerable:!0,get:function(){return gb.Name}});Object.defineProperty(Yr,"CodeGen",{enumerable:!0,get:function(){return gb.CodeGen}});var PPt=Gk();Object.defineProperty(Yr,"ValidationError",{enumerable:!0,get:function(){return PPt.default}});var RPt=Yy();Object.defineProperty(Yr,"MissingRefError",{enumerable:!0,get:function(){return RPt.default}})});var Cz=typeof process!="object"||String(process)!=="[object process]"||process.browser;var Dz={ibm866:[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1025,1105,1028,1108,1031,1111,1038,1118,176,8729,183,8730,8470,164,9632,160],"iso-8859-2":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,728,321,164,317,346,167,168,352,350,356,377,173,381,379,176,261,731,322,180,318,347,711,184,353,351,357,378,733,382,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],"iso-8859-3":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,294,728,163,164,null,292,167,168,304,350,286,308,173,null,379,176,295,178,179,180,181,293,183,184,305,351,287,309,189,null,380,192,193,194,null,196,266,264,199,200,201,202,203,204,205,206,207,null,209,210,211,212,288,214,215,284,217,218,219,220,364,348,223,224,225,226,null,228,267,265,231,232,233,234,235,236,237,238,239,null,241,242,243,244,289,246,247,285,249,250,251,252,365,349,729],"iso-8859-4":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,312,342,164,296,315,167,168,352,274,290,358,173,381,175,176,261,731,343,180,297,316,711,184,353,275,291,359,330,382,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,298,272,325,332,310,212,213,214,215,216,370,218,219,220,360,362,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,299,273,326,333,311,244,245,246,247,248,371,250,251,252,361,363,729],"iso-8859-5":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,173,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,8470,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,167,1118,1119],"iso-8859-6":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,null,null,164,null,null,null,null,null,null,null,1548,173,null,null,null,null,null,null,null,null,null,null,null,null,null,1563,null,null,null,1567,null,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,null,null,null,null,null,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,null,null,null,null,null,null,null,null,null,null,null,null,null],"iso-8859-7":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8216,8217,163,8364,8367,166,167,168,169,890,171,172,173,null,8213,176,177,178,179,900,901,902,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],"iso-8859-8":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,162,163,164,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,8215,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],"iso-8859-10":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,274,290,298,296,310,167,315,272,352,358,381,173,362,330,176,261,275,291,299,297,311,183,316,273,353,359,382,8213,363,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,207,208,325,332,211,212,213,214,360,216,370,218,219,220,221,222,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,239,240,326,333,243,244,245,246,361,248,371,250,251,252,253,254,312],"iso-8859-13":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8221,162,163,164,8222,166,167,216,169,342,171,172,173,174,198,176,177,178,179,8220,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,8217],"iso-8859-14":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,7682,7683,163,266,267,7690,167,7808,169,7810,7691,7922,173,174,376,7710,7711,288,289,7744,7745,182,7766,7809,7767,7811,7776,7923,7812,7813,7777,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,372,209,210,211,212,213,214,7786,216,217,218,219,220,221,374,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,373,241,242,243,244,245,246,7787,248,249,250,251,252,253,375,255],"iso-8859-15":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,8364,165,352,167,353,169,170,171,172,173,174,175,176,177,178,179,381,181,182,183,382,185,186,187,338,339,376,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],"iso-8859-16":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,261,321,8364,8222,352,167,353,169,536,171,377,173,378,379,176,177,268,322,381,8221,182,183,382,269,537,187,338,339,376,380,192,193,194,258,196,262,198,199,200,201,202,203,204,205,206,207,272,323,210,211,212,336,214,346,368,217,218,219,220,280,538,223,224,225,226,259,228,263,230,231,232,233,234,235,236,237,238,239,273,324,242,243,244,337,246,347,369,249,250,251,252,281,539,255],"koi8-r":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,1025,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],"koi8-u":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,1108,9556,1110,1111,9559,9560,9561,9562,9563,1169,1118,9566,9567,9568,9569,1025,1028,9571,1030,1031,9574,9575,9576,9577,9578,1168,1038,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],macintosh:[196,197,199,201,209,214,220,225,224,226,228,227,229,231,233,232,234,235,237,236,238,239,241,243,242,244,246,245,250,249,251,252,8224,176,162,163,167,8226,182,223,174,169,8482,180,168,8800,198,216,8734,177,8804,8805,165,181,8706,8721,8719,960,8747,170,186,937,230,248,191,161,172,8730,402,8776,8710,171,187,8230,160,192,195,213,338,339,8211,8212,8220,8221,8216,8217,247,9674,255,376,8260,8364,8249,8250,64257,64258,8225,183,8218,8222,8240,194,202,193,203,200,205,206,207,204,211,212,63743,210,218,219,217,305,710,732,175,728,729,730,184,733,731,711],"windows-874":[8364,129,130,131,132,8230,134,135,136,137,138,139,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,153,154,155,156,157,158,159,160,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631,3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,null,null,null,null,3647,3648,3649,3650,3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,null,null,null,null],"windows-1250":[8364,129,8218,131,8222,8230,8224,8225,136,8240,352,8249,346,356,381,377,144,8216,8217,8220,8221,8226,8211,8212,152,8482,353,8250,347,357,382,378,160,711,728,321,164,260,166,167,168,169,350,171,172,173,174,379,176,177,731,322,180,181,182,183,184,261,351,187,317,733,318,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],"windows-1251":[1026,1027,8218,1107,8222,8230,8224,8225,8364,8240,1033,8249,1034,1036,1035,1039,1106,8216,8217,8220,8221,8226,8211,8212,152,8482,1113,8250,1114,1116,1115,1119,160,1038,1118,1032,164,1168,166,167,1025,169,1028,171,172,173,174,1031,176,177,1030,1110,1169,181,182,183,1105,8470,1108,187,1112,1029,1109,1111,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103],"windows-1252":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],"windows-1253":[8364,129,8218,402,8222,8230,8224,8225,136,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,157,158,159,160,901,902,163,164,165,166,167,168,169,null,171,172,173,174,8213,176,177,178,179,900,181,182,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],"windows-1254":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,286,209,210,211,212,213,214,215,216,217,218,219,220,304,350,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,287,241,242,243,244,245,246,247,248,249,250,251,252,305,351,255],"windows-1255":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,156,157,158,159,160,161,162,163,8362,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,191,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1520,1521,1522,1523,1524,null,null,null,null,null,null,null,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],"windows-1256":[8364,1662,8218,402,8222,8230,8224,8225,710,8240,1657,8249,338,1670,1688,1672,1711,8216,8217,8220,8221,8226,8211,8212,1705,8482,1681,8250,339,8204,8205,1722,160,1548,162,163,164,165,166,167,168,169,1726,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,1563,187,188,189,190,1567,1729,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,215,1591,1592,1593,1594,1600,1601,1602,1603,224,1604,226,1605,1606,1607,1608,231,232,233,234,235,1609,1610,238,239,1611,1612,1613,1614,244,1615,1616,247,1617,249,1618,251,252,8206,8207,1746],"windows-1257":[8364,129,8218,131,8222,8230,8224,8225,136,8240,138,8249,140,168,711,184,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,175,731,159,160,null,162,163,164,null,166,167,216,169,342,171,172,173,174,198,176,177,178,179,180,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,729],"windows-1258":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,258,196,197,198,199,200,201,202,203,768,205,206,207,272,209,777,211,212,416,214,215,216,217,218,219,220,431,771,223,224,225,226,259,228,229,230,231,232,233,234,235,769,237,238,239,273,241,803,243,244,417,246,247,248,249,250,251,252,432,8363,255],"x-mac-cyrillic":[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,8224,176,1168,163,167,8226,182,1030,174,169,8482,1026,1106,8800,1027,1107,8734,177,8804,8805,1110,181,1169,1032,1028,1108,1031,1111,1033,1113,1034,1114,1112,1029,172,8730,402,8776,8710,171,187,8230,160,1035,1115,1036,1116,1109,8211,8212,8220,8221,8216,8217,247,8222,1038,1118,1039,1119,8470,1025,1105,1103,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,8364]};globalThis["encoding-indexes"]=Dz||{};function Tt(e,t,r){return t<=e&&e<=r}function rSe(e,t){return e.indexOf(t)!==-1}var nc=Math.floor;function g_(e){if(e===void 0)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function nSe(e){for(var t=String(e),r=t.length,n=0,a=[];n<r;){var i=t.charCodeAt(n);if(i<55296||i>57343)a.push(i);else if(56320<=i&&i<=57343)a.push(65533);else if(55296<=i&&i<=56319)if(n===r-1)a.push(65533);else{var o=t.charCodeAt(n+1);if(56320<=o&&o<=57343){var s=i&1023,u=o&1023;a.push(65536+(s<<10)+u),n+=1}else a.push(65533)}n+=1}return a}function aSe(e){for(var t="",r=0;r<e.length;++r){var n=e[r];n<=65535?t+=String.fromCharCode(n):(n-=65536,t+=String.fromCharCode((n>>10)+55296,(n&1023)+56320))}return t}function uo(e){return 0<=e&&e<=127}var so=uo,Wt=-1;function T4(e){this.tokens=[].slice.call(e),this.tokens.reverse()}T4.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():Wt},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.pop());else this.tokens.push(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.shift());else this.tokens.unshift(e)}};var Br=-1;function $t(e,t){if(e)throw TypeError("Decoder error");return t||65533}function Qo(e){throw TypeError("The code point "+e+" could not be encoded.")}function iSe(){}iSe.prototype={handler:function(e,t){}};function oSe(){}oSe.prototype={handler:function(e,t){}};function A4(e){return e=String(e).trim().toLowerCase(),Object.prototype.hasOwnProperty.call(E4,e)?E4[e]:null}var Bz=[{encodings:[{labels:["unicode-1-1-utf-8","utf-8","utf8"],name:"UTF-8"}],heading:"The Encoding"},{encodings:[{labels:["866","cp866","csibm866","ibm866"],name:"IBM866"},{labels:["csisolatin2","iso-8859-2","iso-ir-101","iso8859-2","iso88592","iso_8859-2","iso_8859-2:1987","l2","latin2"],name:"ISO-8859-2"},{labels:["csisolatin3","iso-8859-3","iso-ir-109","iso8859-3","iso88593","iso_8859-3","iso_8859-3:1988","l3","latin3"],name:"ISO-8859-3"},{labels:["csisolatin4","iso-8859-4","iso-ir-110","iso8859-4","iso88594","iso_8859-4","iso_8859-4:1988","l4","latin4"],name:"ISO-8859-4"},{labels:["csisolatincyrillic","cyrillic","iso-8859-5","iso-ir-144","iso8859-5","iso88595","iso_8859-5","iso_8859-5:1988"],name:"ISO-8859-5"},{labels:["arabic","asmo-708","csiso88596e","csiso88596i","csisolatinarabic","ecma-114","iso-8859-6","iso-8859-6-e","iso-8859-6-i","iso-ir-127","iso8859-6","iso88596","iso_8859-6","iso_8859-6:1987"],name:"ISO-8859-6"},{labels:["csisolatingreek","ecma-118","elot_928","greek","greek8","iso-8859-7","iso-ir-126","iso8859-7","iso88597","iso_8859-7","iso_8859-7:1987","sun_eu_greek"],name:"ISO-8859-7"},{labels:["csiso88598e","csisolatinhebrew","hebrew","iso-8859-8","iso-8859-8-e","iso-ir-138","iso8859-8","iso88598","iso_8859-8","iso_8859-8:1988","visual"],name:"ISO-8859-8"},{labels:["csiso88598i","iso-8859-8-i","logical"],name:"ISO-8859-8-I"},{labels:["csisolatin6","iso-8859-10","iso-ir-157","iso8859-10","iso885910","l6","latin6"],name:"ISO-8859-10"},{labels:["iso-8859-13","iso8859-13","iso885913"],name:"ISO-8859-13"},{labels:["iso-8859-14","iso8859-14","iso885914"],name:"ISO-8859-14"},{labels:["csisolatin9","iso-8859-15","iso8859-15","iso885915","iso_8859-15","l9"],name:"ISO-8859-15"},{labels:["iso-8859-16"],name:"ISO-8859-16"},{labels:["cskoi8r","koi","koi8","koi8-r","koi8_r"],name:"KOI8-R"},{labels:["koi8-ru","koi8-u"],name:"KOI8-U"},{labels:["csmacintosh","mac","macintosh","x-mac-roman"],name:"macintosh"},{labels:["dos-874","iso-8859-11","iso8859-11","iso885911","tis-620","windows-874"],name:"windows-874"},{labels:["cp1250","windows-1250","x-cp1250"],name:"windows-1250"},{labels:["cp1251","windows-1251","x-cp1251"],name:"windows-1251"},{labels:["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"],name:"windows-1252"},{labels:["cp1253","windows-1253","x-cp1253"],name:"windows-1253"},{labels:["cp1254","csisolatin5","iso-8859-9","iso-ir-148","iso8859-9","iso88599","iso_8859-9","iso_8859-9:1989","l5","latin5","windows-1254","x-cp1254"],name:"windows-1254"},{labels:["cp1255","windows-1255","x-cp1255"],name:"windows-1255"},{labels:["cp1256","windows-1256","x-cp1256"],name:"windows-1256"},{labels:["cp1257","windows-1257","x-cp1257"],name:"windows-1257"},{labels:["cp1258","windows-1258","x-cp1258"],name:"windows-1258"},{labels:["x-mac-cyrillic","x-mac-ukrainian"],name:"x-mac-cyrillic"}],heading:"Legacy single-byte encodings"},{encodings:[{labels:["chinese","csgb2312","csiso58gb231280","gb2312","gb_2312","gb_2312-80","gbk","iso-ir-58","x-gbk"],name:"GBK"},{labels:["gb18030"],name:"gb18030"}],heading:"Legacy multi-byte Chinese (simplified) encodings"},{encodings:[{labels:["big5","big5-hkscs","cn-big5","csbig5","x-x-big5"],name:"Big5"}],heading:"Legacy multi-byte Chinese (traditional) encodings"},{encodings:[{labels:["cseucpkdfmtjapanese","euc-jp","x-euc-jp"],name:"EUC-JP"},{labels:["csiso2022jp","iso-2022-jp"],name:"ISO-2022-JP"},{labels:["csshiftjis","ms932","ms_kanji","shift-jis","shift_jis","sjis","windows-31j","x-sjis"],name:"Shift_JIS"}],heading:"Legacy multi-byte Japanese encodings"},{encodings:[{labels:["cseuckr","csksc56011987","euc-kr","iso-ir-149","korean","ks_c_5601-1987","ks_c_5601-1989","ksc5601","ksc_5601","windows-949"],name:"EUC-KR"}],heading:"Legacy multi-byte Korean encodings"},{encodings:[{labels:["csiso2022kr","hz-gb-2312","iso-2022-cn","iso-2022-cn-ext","iso-2022-kr"],name:"replacement"},{labels:["utf-16be"],name:"UTF-16BE"},{labels:["utf-16","utf-16le"],name:"UTF-16LE"},{labels:["x-user-defined"],name:"x-user-defined"}],heading:"Legacy miscellaneous encodings"}],E4={};Bz.forEach(function(e){e.encodings.forEach(function(t){t.labels.forEach(function(r){E4[r]=t})})});var mi={},gi={};function ph(e,t){return t&&t[e]||null}function dh(e,t){var r=t.indexOf(e);return r===-1?null:r}function ei(e){if(!("encoding-indexes"in globalThis))throw Error("Indexes missing. Did you forget to include encoding-indexes.js first?");return globalThis["encoding-indexes"][e]}function sSe(e){if(e>39419&&e<189e3||e>1237575)return null;if(e===7457)return 59335;var t=0,r=0,n=ei("gb18030-ranges"),a;for(a=0;a<n.length;++a){var i=n[a];if(i[0]<=e)t=i[0],r=i[1];else break}return r+e-t}function uSe(e){if(e===59335)return 7457;var t=0,r=0,n=ei("gb18030-ranges"),a;for(a=0;a<n.length;++a){var i=n[a];if(i[1]<=e)t=i[1],r=i[0];else break}return r+e-t}function cSe(e){_4=_4||ei("jis0208").map(function(r,n){return Tt(n,8272,8835)?null:r});var t=_4;return t.indexOf(e)}var _4;function lSe(e){w4=w4||ei("big5").map(function(r,n){return n<(161-129)*157?null:r});var t=w4;return e===9552||e===9566||e===9569||e===9578||e===21313||e===21317?t.lastIndexOf(e):dh(e,t)}var w4,Fz="utf-8";function cp(e,t){if(!(this instanceof cp))throw TypeError("Called as a function. Did you forget 'new'?");e=e!==void 0?String(e):Fz,t=g_(t),this._encoding=null,this._decoder=null,this._ignoreBOM=!1,this._BOMseen=!1,this._error_mode="replacement",this._do_not_flush=!1;var r=A4(e);if(r===null||r.name==="replacement")throw RangeError("Unknown encoding: "+e);if(!gi[r.name])throw Error("Decoder not present. Did you forget to include encoding-indexes.js first?");var n=this;return n._encoding=r,Boolean(t.fatal)&&(n._error_mode="fatal"),Boolean(t.ignoreBOM)&&(n._ignoreBOM=!0),Object.defineProperty||(this.encoding=n._encoding.name.toLowerCase(),this.fatal=n._error_mode==="fatal",this.ignoreBOM=n._ignoreBOM),n}Object.defineProperty&&(Object.defineProperty(cp.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(cp.prototype,"fatal",{get:function(){return this._error_mode==="fatal"}}),Object.defineProperty(cp.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}}));cp.prototype.decode=function(t,r){var n;typeof t=="object"&&t instanceof ArrayBuffer?n=new Uint8Array(t):typeof t=="object"&&"buffer"in t&&t.buffer instanceof ArrayBuffer?n=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):n=new Uint8Array(0),r=g_(r),this._do_not_flush||(this._decoder=gi[this._encoding.name]({fatal:this._error_mode==="fatal"}),this._BOMseen=!1),this._do_not_flush=Boolean(r.stream);for(var a=new T4(n),i=[],o;;){var s=a.read();if(s===Wt||(o=this._decoder.handler(a,s),o===Br))break;o!==null&&(Array.isArray(o)?i.push.apply(i,o):i.push(o))}if(!this._do_not_flush){do{if(o=this._decoder.handler(a,a.read()),o===Br)break;o!==null&&(Array.isArray(o)?i.push.apply(i,o):i.push(o))}while(!a.endOfStream());this._decoder=null}function u(c){return rSe(["UTF-8","UTF-16LE","UTF-16BE"],this._encoding.name)&&!this._ignoreBOM&&!this._BOMseen&&(c.length>0&&c[0]===65279?(this._BOMseen=!0,c.shift()):c.length>0&&(this._BOMseen=!0)),aSe(c)}return u.call(this,i)};function Tb(e,t){if(!(this instanceof Tb))throw TypeError("Called as a function. Did you forget 'new'?");t=g_(t),this._encoding=null,this._encoder=null,this._do_not_flush=!1,this._fatal=Boolean(t.fatal)?"fatal":"replacement";var r=this;if(Boolean(t.NONSTANDARD_allowLegacyEncoding)){e=e!==void 0?String(e):Fz;var n=A4(e);if(n===null||n.name==="replacement")throw RangeError("Unknown encoding: "+e);if(!mi[n.name])throw Error("Encoder not present. Did you forget to include encoding-indexes.js first?");r._encoding=n}else r._encoding=A4("utf-8"),e!==void 0&&"console"in globalThis&&console.warn("TextEncoder constructor called with encoding label, which is ignored.");return Object.defineProperty||(this.encoding=r._encoding.name.toLowerCase()),r}Object.defineProperty&&Object.defineProperty(Tb.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}});Tb.prototype.encode=function(t,r){t=t===void 0?"":String(t),r=g_(r),this._do_not_flush||(this._encoder=mi[this._encoding.name]({fatal:this._fatal==="fatal"})),this._do_not_flush=Boolean(r.stream);for(var n=new T4(nSe(t)),a=[],i;;){var o=n.read();if(o===Wt||(i=this._encoder.handler(n,o),i===Br))break;Array.isArray(i)?a.push.apply(a,i):a.push(i)}if(!this._do_not_flush){for(;i=this._encoder.handler(n,n.read()),i!==Br;)Array.isArray(i)?a.push.apply(a,i):a.push(i);this._encoder=null}return new Uint8Array(a)};function fSe(e){var t=e.fatal,r=0,n=0,a=0,i=128,o=191;this.handler=function(s,u){if(u===Wt&&a!==0)return a=0,$t(t);if(u===Wt)return Br;if(a===0){if(Tt(u,0,127))return u;if(Tt(u,194,223))a=1,r=u&31;else if(Tt(u,224,239))u===224&&(i=160),u===237&&(o=159),a=2,r=u&15;else if(Tt(u,240,244))u===240&&(i=144),u===244&&(o=143),a=3,r=u&7;else return $t(t);return null}if(!Tt(u,i,o))return r=a=n=0,i=128,o=191,s.prepend(u),$t(t);if(i=128,o=191,r=r<<6|u&63,n+=1,n!==a)return null;var c=r;return r=a=n=0,c}}function pSe(e){var t=e.fatal;this.handler=function(r,n){if(n===Wt)return Br;if(so(n))return n;var a,i;Tt(n,128,2047)?(a=1,i=192):Tt(n,2048,65535)?(a=2,i=224):Tt(n,65536,1114111)&&(a=3,i=240);for(var o=[(n>>6*a)+i];a>0;){var s=n>>6*(a-1);o.push(128|s&63),a-=1}return o}}mi["UTF-8"]=function(e){return new pSe(e)};gi["UTF-8"]=function(e){return new fSe(e)};function dSe(e,t){var r=t.fatal;this.handler=function(n,a){if(a===Wt)return Br;if(uo(a))return a;var i=e[a-128];return i===null?$t(r):i}}function hSe(e,t){var r=t.fatal;this.handler=function(n,a){if(a===Wt)return Br;if(so(a))return a;var i=dh(a,e);return i===null&&Qo(a),i+128}}(function(){"encoding-indexes"in globalThis&&Bz.forEach(function(e){e.heading==="Legacy single-byte encodings"&&e.encodings.forEach(function(t){var r=t.name,n=ei(r.toLowerCase());gi[r]=function(a){return new dSe(n,a)},mi[r]=function(a){return new hSe(n,a)}})})})();gi.GBK=function(e){return new Oz(e)};mi.GBK=function(e){return new Iz(e,!0)};function Oz(e){var t=e.fatal,r=0,n=0,a=0;this.handler=function(i,o){if(o===Wt&&r===0&&n===0&&a===0)return Br;o===Wt&&(r!==0||n!==0||a!==0)&&(r=0,n=0,a=0,$t(t));var s;if(a!==0){s=null,Tt(o,48,57)&&(s=sSe((((r-129)*10+n-48)*126+a-129)*10+o-48));var u=[n,a,o];return r=0,n=0,a=0,s===null?(i.prepend(u),$t(t)):s}if(n!==0)return Tt(o,129,254)?(a=o,null):(i.prepend([n,o]),r=0,n=0,$t(t));if(r!==0){if(Tt(o,48,57))return n=o,null;var c=r,l=null;r=0;var f=o<127?64:65;return(Tt(o,64,126)||Tt(o,128,254))&&(l=(c-129)*190+(o-f)),s=l===null?null:ph(l,ei("gb18030")),s===null&&uo(o)&&i.prepend(o),s===null?$t(t):s}return uo(o)?o:o===128?8364:Tt(o,129,254)?(r=o,null):$t(t)}}function Iz(e,t){var r=e.fatal;this.handler=function(n,a){if(a===Wt)return Br;if(so(a))return a;if(a===58853)return Qo(a);if(t&&a===8364)return 128;var i=dh(a,ei("gb18030"));if(i!==null){var o=nc(i/190)+129,s=i%190,u=s<63?64:65;return[o,s+u]}if(t)return Qo(a);i=uSe(a);var c=nc(i/10/126/10);i=i-c*10*126*10;var l=nc(i/10/126);i=i-l*10*126;var f=nc(i/10),p=i-f*10;return[c+129,l+48,f+129,p+48]}}mi.gb18030=function(e){return new Iz(e)};gi.gb18030=function(e){return new Oz(e)};function mSe(e){var t=e.fatal,r=0;this.handler=function(n,a){if(a===Wt&&r!==0)return r=0,$t(t);if(a===Wt&&r===0)return Br;if(r!==0){var i=r,o=null;r=0;var s=a<127?64:98;switch((Tt(a,64,126)||Tt(a,161,254))&&(o=(i-129)*157+(a-s)),o){case 1133:return[202,772];case 1135:return[202,780];case 1164:return[234,772];case 1166:return[234,780]}var u=o===null?null:ph(o,ei("big5"));return u===null&&uo(a)&&n.prepend(a),u===null?$t(t):u}return uo(a)?a:Tt(a,129,254)?(r=a,null):$t(t)}}function gSe(e){var t=e.fatal;this.handler=function(r,n){if(n===Wt)return Br;if(so(n))return n;var a=lSe(n);if(a===null)return Qo(n);var i=nc(a/157)+129;if(i<161)return Qo(n);var o=a%157,s=o<63?64:98;return[i,o+s]}}mi.Big5=function(e){return new gSe(e)};gi.Big5=function(e){return new mSe(e)};function bSe(e){var t=e.fatal,r=!1,n=0;this.handler=function(a,i){if(i===Wt&&n!==0)return n=0,$t(t);if(i===Wt&&n===0)return Br;if(n===142&&Tt(i,161,223))return n=0,65377-161+i;if(n===143&&Tt(i,161,254))return r=!0,n=i,null;if(n!==0){var o=n;n=0;var s=null;return Tt(o,161,254)&&Tt(i,161,254)&&(s=ph((o-161)*94+(i-161),ei(r?"jis0212":"jis0208"))),r=!1,Tt(i,161,254)||a.prepend(i),s===null?$t(t):s}return uo(i)?i:i===142||i===143||Tt(i,161,254)?(n=i,null):$t(t)}}function vSe(e){var t=e.fatal;this.handler=function(r,n){if(n===Wt)return Br;if(so(n))return n;if(n===165)return 92;if(n===8254)return 126;if(Tt(n,65377,65439))return[142,n-65377+161];n===8722&&(n=65293);var a=dh(n,ei("jis0208"));if(a===null)return Qo(n);var i=nc(a/94)+161,o=a%94+161;return[i,o]}}mi["EUC-JP"]=function(e){return new vSe(e)};gi["EUC-JP"]=function(e){return new bSe(e)};function xSe(e){var t=e.fatal,r={ASCII:0,Roman:1,Katakana:2,LeadByte:3,TrailByte:4,EscapeStart:5,Escape:6},n=r.ASCII,a=r.ASCII,i=0,o=!1;this.handler=function(s,u){switch(n){default:case r.ASCII:return u===27?(n=r.EscapeStart,null):Tt(u,0,127)&&u!==14&&u!==15&&u!==27?(o=!1,u):u===Wt?Br:(o=!1,$t(t));case r.Roman:return u===27?(n=r.EscapeStart,null):u===92?(o=!1,165):u===126?(o=!1,8254):Tt(u,0,127)&&u!==14&&u!==15&&u!==27&&u!==92&&u!==126?(o=!1,u):u===Wt?Br:(o=!1,$t(t));case r.Katakana:return u===27?(n=r.EscapeStart,null):Tt(u,33,95)?(o=!1,65377-33+u):u===Wt?Br:(o=!1,$t(t));case r.LeadByte:return u===27?(n=r.EscapeStart,null):Tt(u,33,126)?(o=!1,i=u,n=r.TrailByte,null):u===Wt?Br:(o=!1,$t(t));case r.TrailByte:if(u===27)return n=r.EscapeStart,$t(t);if(Tt(u,33,126)){n=r.LeadByte;var c=(i-33)*94+u-33,l=ph(c,ei("jis0208"));return l===null?$t(t):l}return u===Wt?(n=r.LeadByte,s.prepend(u),$t(t)):(n=r.LeadByte,$t(t));case r.EscapeStart:return u===36||u===40?(i=u,n=r.Escape,null):(s.prepend(u),o=!1,n=a,$t(t));case r.Escape:var f=i;i=0;var p=null;if(f===40&&u===66&&(p=r.ASCII),f===40&&u===74&&(p=r.Roman),f===40&&u===73&&(p=r.Katakana),f===36&&(u===64||u===66)&&(p=r.LeadByte),p!==null){n=n=p;var d=o;return o=!0,d?$t(t):null}return s.prepend([f,u]),o=!1,n=a,$t(t)}}}function ySe(e){var t=e.fatal,r={ASCII:0,Roman:1,jis0208:2},n=r.ASCII;this.handler=function(a,i){if(i===Wt&&n!==r.ASCII)return a.prepend(i),n=r.ASCII,[27,40,66];if(i===Wt&&n===r.ASCII)return Br;if((n===r.ASCII||n===r.Roman)&&(i===14||i===15||i===27))return Qo(65533);if(n===r.ASCII&&so(i))return i;if(n===r.Roman&&(so(i)&&i!==92&&i!==126||i==165||i==8254)){if(so(i))return i;if(i===165)return 92;if(i===8254)return 126}if(so(i)&&n!==r.ASCII)return a.prepend(i),n=r.ASCII,[27,40,66];if((i===165||i===8254)&&n!==r.Roman)return a.prepend(i),n=r.Roman,[27,40,74];i===8722&&(i=65293);var o=dh(i,ei("jis0208"));if(o===null)return Qo(i);if(n!==r.jis0208)return a.prepend(i),n=r.jis0208,[27,36,66];var s=nc(o/94)+33,u=o%94+33;return[s,u]}}mi["ISO-2022-JP"]=function(e){return new ySe(e)};gi["ISO-2022-JP"]=function(e){return new xSe(e)};function _Se(e){var t=e.fatal,r=0;this.handler=function(n,a){if(a===Wt&&r!==0)return r=0,$t(t);if(a===Wt&&r===0)return Br;if(r!==0){var i=r,o=null;r=0;var s=a<127?64:65,u=i<160?129:193;if((Tt(a,64,126)||Tt(a,128,252))&&(o=(i-u)*188+a-s),Tt(o,8836,10715))return 57344-8836+o;var c=o===null?null:ph(o,ei("jis0208"));return c===null&&uo(a)&&n.prepend(a),c===null?$t(t):c}return uo(a)||a===128?a:Tt(a,161,223)?65377-161+a:Tt(a,129,159)||Tt(a,224,252)?(r=a,null):$t(t)}}function wSe(e){var t=e.fatal;this.handler=function(r,n){if(n===Wt)return Br;if(so(n)||n===128)return n;if(n===165)return 92;if(n===8254)return 126;if(Tt(n,65377,65439))return n-65377+161;n===8722&&(n=65293);var a=cSe(n);if(a===null)return Qo(n);var i=nc(a/188),o=i<31?129:193,s=a%188,u=s<63?64:65;return[i+o,s+u]}}mi.Shift_JIS=function(e){return new wSe(e)};gi.Shift_JIS=function(e){return new _Se(e)};function ASe(e){var t=e.fatal,r=0;this.handler=function(n,a){if(a===Wt&&r!==0)return r=0,$t(t);if(a===Wt&&r===0)return Br;if(r!==0){var i=r,o=null;r=0,Tt(a,65,254)&&(o=(i-129)*190+(a-65));var s=o===null?null:ph(o,ei("euc-kr"));return o===null&&uo(a)&&n.prepend(a),s===null?$t(t):s}return uo(a)?a:Tt(a,129,254)?(r=a,null):$t(t)}}function ESe(e){var t=e.fatal;this.handler=function(r,n){if(n===Wt)return Br;if(so(n))return n;var a=dh(n,ei("euc-kr"));if(a===null)return Qo(n);var i=nc(a/190)+129,o=a%190+65;return[i,o]}}mi["EUC-KR"]=function(e){return new ESe(e)};gi["EUC-KR"]=function(e){return new ASe(e)};function m_(e,t){var r=e>>8,n=e&255;return t?[r,n]:[n,r]}function Pz(e,t){var r=t.fatal,n=null,a=null;this.handler=function(i,o){if(o===Wt&&(n!==null||a!==null))return $t(r);if(o===Wt&&n===null&&a===null)return Br;if(n===null)return n=o,null;var s;if(e?s=(n<<8)+o:s=(o<<8)+n,n=null,a!==null){var u=a;return a=null,Tt(s,56320,57343)?65536+(u-55296)*1024+(s-56320):(i.prepend(m_(s,e)),$t(r))}return Tt(s,55296,56319)?(a=s,null):Tt(s,56320,57343)?$t(r):s}}function Rz(e,t){var r=t.fatal;this.handler=function(n,a){if(a===Wt)return Br;if(Tt(a,0,65535))return m_(a,e);var i=m_((a-65536>>10)+55296,e),o=m_((a-65536&1023)+56320,e);return i.concat(o)}}mi["UTF-16BE"]=function(e){return new Rz(!0,e)};gi["UTF-16BE"]=function(e){return new Pz(!0,e)};mi["UTF-16LE"]=function(e){return new Rz(!1,e)};gi["UTF-16LE"]=function(e){return new Pz(!1,e)};function TSe(e){var t=e.fatal;this.handler=function(r,n){return n===Wt?Br:uo(n)?n:63360+n-128}}function SSe(e){var t=e.fatal;this.handler=function(r,n){return n===Wt?Br:so(n)?n:Tt(n,63360,63487)?n-63360+128:Qo(n)}}mi["x-user-defined"]=function(e){return new SSe(e)};gi["x-user-defined"]=function(e){return new TSe(e)};function Sb(e){return Buffer.from(e).toString("base64")}function S4(e){return Buffer.from(e,"base64").toString("ascii")}var FV=Ct(DV(),1),OV=Ct(Ib(),1);function BV(e){return Buffer.isBuffer(e)?new Uint8Array(e).buffer:e}function V4e(e,t){let r=t.type?t.type.replace("image/",""):"jpeg",n=(0,OV.default)(e.data,[e.width,e.height,4],[4,e.width*4,1],0);return(0,FV.default)(n,r,t)}function IV(e,t){let r=V4e(e,t);return new Promise(n=>{let a=[];r.on("data",i=>a.push(i)),r.on("end",()=>{let i=Buffer.concat(a);n(BV(i))})})}var hte=Ct(dte(),1),IB=["image/png","image/jpeg","image/gif"];async function PB(e,t){if(!t)throw new Error("MIMEType is required to parse image under Node.js");let r=e instanceof Buffer?e:Buffer.from(e);return await fMe(r,t)}function fMe(e,t){return new Promise(r=>(0,hte.default)(e,t,(n,a)=>{if(n)throw n;let i=[...a.shape],o=a.shape.length===4?a.shape.shift():1,s=a.data instanceof Buffer?new Uint8Array(a.data):a.data;r({shape:i,data:s,width:a.shape[0],height:a.shape[1],components:a.shape[2],layers:o?[o]:[]})}))}async function Hi(e,t,r,n){return n._parse(e,t,r,n)}function yt(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var uu={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},gte=uu.self||uu.window||uu.global||{},bte=uu.window||uu.self||uu.global||{},vte=uu.global||uu.self||uu.window||{},xte=uu.document||{};var pr=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var mte=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),pMe=mte&&parseFloat(mte[1])||0;var fw=globalThis,dMe=globalThis.document||{},pw=globalThis.process||{},hMe=globalThis.console,jqt=globalThis.navigator||{};function yte(e){var n,a;if(typeof window<"u"&&((n=window.process)==null?void 0:n.type)==="renderer"||typeof process<"u"&&Boolean((a=process.versions)==null?void 0:a.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,r=e||t;return Boolean(r&&r.indexOf("Electron")>=0)}function Bp(){return!(typeof process=="object"&&String(process)==="[object process]"&&!(process!=null&&process.browser))||yte()}var RB="4.1.1";function a0(e,t){if(!e)throw new Error(t||"Assertion failed")}function jB(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 a0(Number.isFinite(t)&&t>=0),t}function _te(e){let{logLevel:t,message:r}=e;e.logLevel=jB(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let a=typeof e.message;return a0(a==="string"||a==="object"),Object.assign(e,{args:n},e.opts)}var Fp=()=>{},dw=class{constructor({level:t=0}={}){this.userData={},this._onceCache=new Set,this._level=t}set level(t){this.setLevel(t)}get level(){return this.getLevel()}setLevel(t){return this._level=t,this}getLevel(){return this._level}warn(t,...r){return this._log("warn",0,t,r,{once:!0})}error(t,...r){return this._log("error",0,t,r)}log(t,r,...n){return this._log("log",t,r,n)}info(t,r,...n){return this._log("info",t,r,n)}once(t,r,...n){return this._log("once",t,r,n,{once:!0})}_log(t,r,n,a,i={}){let o=_te({logLevel:r,message:n,args:this._buildArgs(r,n,a),opts:i});return this._createLogFunction(t,o,i)}_buildArgs(t,r,n){return[t,r,...n]}_createLogFunction(t,r,n){if(!this._shouldLog(r.logLevel))return Fp;let a=this._getOnceTag(n.tag??r.tag??r.message);if((n.once||r.once)&&a!==void 0){if(this._onceCache.has(a))return Fp;this._onceCache.add(a)}return this._emit(t,r)}_shouldLog(t){return this.getLevel()>=jB(t)}_getOnceTag(t){if(t!==void 0)try{return typeof t=="string"?t:String(t)}catch{return}}};function gMe(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var hw=class{constructor(t,r,n="sessionStorage"){this.storage=gMe(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function wte(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 Ate(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var mw;(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"})(mw||(mw={}));var bMe=10;function Ete(e){return typeof e!="string"?e:(e=e.toUpperCase(),mw[e]||mw.WHITE)}function Tte(e,t,r){return!Bp&&typeof e=="string"&&(t&&(e=`\x1B[${Ete(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${Ete(r)+bMe}m${e}\x1B[49m`)),e}function Ste(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),a=e;for(let i of n){let o=a[i];typeof o=="function"&&(t.find(s=>i===s)||(a[i]=o.bind(e)))}}function i0(){var t,r,n,a,i;let e;if(Bp()&&fw.performance)e=(n=(r=(t=fw)==null?void 0:t.performance)==null?void 0:r.now)==null?void 0:n.call(r);else if("hrtime"in pw){let o=(i=(a=pw)==null?void 0:a.hrtime)==null?void 0:i.call(a);e=o[0]*1e3+o[1]/1e6}else e=Date.now();return e}var o0={debug:Bp()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},LB={enabled:!0,level:0},ds=class extends dw{constructor({id:t}={id:""}){super({level:0}),this.VERSION=RB,this._startTs=i0(),this._deltaTs=i0(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new hw(`__probe-${this.id}__`,{[this.id]:LB}),this.timeStamp(`${this.id} started`),Ste(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((i0()-this._startTs).toPrecision(10))}getDelta(){return Number((i0()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._updateConfiguration({enabled:t}),this}setLevel(t){return this._updateConfiguration({level:t}),this}get(t){return this._getConfiguration()[t]}set(t,r){this._updateConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t,...r){return this._log("warn",0,t,r,{method:o0.warn,once:!0})}error(t,...r){return this._log("error",0,t,r,{method:o0.error})}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r,...n){return this._log("log",t,r,n,{method:o0.log,time:!0,once:!0})}log(t,r,...n){return this._log("log",t,r,n,{method:o0.debug})}info(t,r,...n){return this._log("info",t,r,n,{method:console.info})}once(t,r,...n){return this._log("once",t,r,n,{method:o0.debug||o0.info,once:!0})}table(t,r,n){return r?this._log("table",t,r,n&&[n]||[],{method:console.table||Fp,tag:xMe(r)}):Fp}time(t,r){return this._log("time",t,r,[],{method:console.time?console.time:console.info})}timeEnd(t,r){return this._log("time",t,r,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(t,r){return this._log("time",t,r,[],{method:console.timeStamp||Fp})}group(t,r,n={collapsed:!1}){let a=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",t,r,[],{method:a})}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._log("groupEnd",t,"",[],{method:console.groupEnd||Fp})}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&super._shouldLog(t)}_emit(t,r){let n=r.method;a0(n),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=i0();let a=vMe(this.id,r.message,r);return n.bind(console,a,...r.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(LB),this._storage.config[this.id]}_updateConfiguration(t){let r=this._storage.config[this.id]||{...LB};this._storage.setConfiguration({[this.id]:{...r,...t}})}};ds.VERSION=RB;function vMe(e,t,r){if(typeof t=="string"){let n=r.time?Ate(wte(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=Tte(t,r.color,r.background)}return t}function xMe(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}globalThis.probe={};var MB=new ds({id:"@probe.gl/log"});var qB="4.4.1",yMe=qB[0]>="0"&&qB[0]<="9"?`v${qB}`:"";function _Me(){let e=new ds({id:"loaders.gl"});return globalThis.loaders||(globalThis.loaders={}),globalThis.loaders.log=e,globalThis.loaders.version=yMe,globalThis.probe||(globalThis.probe={}),globalThis.probe.loaders=e,e}var Dv=_Me();var wMe=e=>typeof e=="boolean",cu=e=>typeof e=="function",lu=e=>e!==null&&typeof e=="object",gw=e=>lu(e)&&e.constructor==={}.constructor;var NB=e=>typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer,s0=e=>lu(e)&&typeof e.byteLength=="number"&&typeof e.slice=="function";var UB=e=>Boolean(e)&&cu(e[Symbol.iterator]),zB=e=>Boolean(e)&&cu(e[Symbol.asyncIterator]);var Vi=e=>typeof Response<"u"&&e instanceof Response||lu(e)&&cu(e.arrayBuffer)&&cu(e.text)&&cu(e.json);var $i=e=>typeof Blob<"u"&&e instanceof Blob;var kte=e=>typeof ReadableStream<"u"&&e instanceof ReadableStream||lu(e)&&cu(e.tee)&&cu(e.cancel)&&cu(e.getReader);var Cte=e=>lu(e)&&cu(e.read)&&cu(e.pipe)&&wMe(e.readable),Bv=e=>kte(e)||Cte(e);function GB(e,t){return Dte(e||{},t)}function Dte(e,t,r=0){if(r>3)return t;let n={...e};for(let[a,i]of Object.entries(t))i&&typeof i=="object"&&!Array.isArray(i)?n[a]=Dte(n[a]||{},t[a],r+1):n[a]=t[a];return n}function u0(e){var t;globalThis.loaders||(globalThis.loaders={}),(t=globalThis.loaders).modules||(t.modules={}),Object.assign(globalThis.loaders.modules,e)}function HB(e){var r,n;return((n=(r=globalThis.loaders)==null?void 0:r.modules)==null?void 0:n[e])||null}var Bte="latest";function AMe(){var e;return(e=globalThis._loadersgl_)!=null&&e.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.4.1"),globalThis._loadersgl_.version}var Op=AMe();function xa(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var fu={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},ANt=fu.self||fu.window||fu.global||{},ENt=fu.window||fu.self||fu.global||{},TNt=fu.global||fu.self||fu.window||{},SNt=fu.document||{};var Pn=typeof process!="object"||String(process)!=="[object process]"||process.browser,Fv=typeof importScripts=="function",Ote=typeof window<"u"&&typeof window.orientation<"u",Fte=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),kNt=Fte&&parseFloat(Fte[1])||0;var Ov=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(t,r){this.name=t,this.workerThread=r,this.result=new Promise((n,a)=>{this._resolve=n,this._reject=a})}postMessage(t,r){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:r})}done(t){xa(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){xa(this.isRunning),this.isRunning=!1,this._reject(t)}};var Ip={};Fa(Ip,{NodeWorker:()=>Pv,parentPort:()=>EMe});var Iv=Ct(require("worker_threads"),1);Eb(Ip,require("worker_threads"));var EMe=Iv==null?void 0:Iv.parentPort,Pv=Iv.Worker;var VB=new Map;function Ite(e){xa(e.source&&!e.url||!e.source&&e.url);let t=VB.get(e.source||e.url);return t||(e.url&&(t=TMe(e.url),VB.set(e.url,t)),e.source&&(t=Pte(e.source),VB.set(e.source,t))),xa(t),t}function TMe(e){if(!e.startsWith("http"))return e;let t=SMe(e);return Pte(t)}function Pte(e){let t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function SMe(e){return`try {
155
155
  importScripts('${e}');
156
156
  } catch (error) {
157
157
  console.error(error);
158
158
  throw error;
159
159
  }`}function $B(e,t=!0,r){let n=r||new Set;if(e){if(Rte(e))n.add(e);else if(Rte(e.buffer))n.add(e.buffer);else if(!ArrayBuffer.isView(e)){if(t&&typeof e=="object")for(let a in e)$B(e[a],t,n)}}return r===void 0?Array.from(n):[]}function Rte(e){return e?e instanceof ArrayBuffer||typeof MessagePort<"u"&&e instanceof MessagePort||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas:!1}function WB(e){if(e===null)return{};let t=Object.assign({},e);return Object.keys(t).forEach(r=>{typeof e[r]=="object"&&!ArrayBuffer.isView(e[r])&&!(e[r]instanceof Array)?t[r]=WB(e[r]):typeof t[r]=="function"||t[r]instanceof RegExp?t[r]={}:t[r]=e[r]}),t}var KB=()=>{},Gl=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&Pn||typeof Pv<"u"&&!Pn}constructor(t){let{name:r,source:n,url:a}=t;xa(n||a),this.name=r,this.source=n,this.url=a,this.onMessage=KB,this.onError=i=>console.log(i),this.worker=Pn?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=KB,this.onError=KB,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,r){r=r||$B(t),this.worker.postMessage(t,r)}_getErrorFromErrorEvent(t){let r="Failed to load ";return r+=`worker ${this.name} from ${this.url}. `,t.message&&(r+=`${t.message} in `),t.lineno&&(r+=`:${t.lineno}:${t.colno}`),new Error(r)}_createBrowserWorker(){this._loadableURL=Ite({source:this.source,url:this.url});let t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error("No data received"))},t.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},t.onmessageerror=r=>console.error(r),t}_createNodeWorker(){let t;if(this.url){let n=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`,a=this.url.endsWith(".ts")||this.url.endsWith(".mjs")?"module":"commonjs";t=new Pv(n,{eval:!1,type:a})}else if(this.source)t=new Pv(this.source,{eval:!0});else throw new Error("no worker");return t.on("message",r=>{this.onMessage(r)}),t.on("error",r=>{this.onError(r)}),t.on("exit",r=>{}),t}};var Rv=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return Gl.isSupported()}constructor(t){this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},t.name!==void 0&&(this.name=t.name),t.maxConcurrency!==void 0&&(this.maxConcurrency=t.maxConcurrency),t.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=t.maxMobileConcurrency),t.reuseWorkers!==void 0&&(this.reuseWorkers=t.reuseWorkers),t.onDebug!==void 0&&(this.onDebug=t.onDebug)}async startJob(t,r=(a,i,o)=>a.done(o),n=(a,i)=>a.error(i)){let a=new Promise(i=>(this.jobQueue.push({name:t,onMessage:r,onError:n,onStart:i}),this));return this._startQueuedJob(),await a}async _startQueuedJob(){if(!this.jobQueue.length)return;let t=this._getAvailableWorker();if(!t)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:"Starting job",name:r.name,workerThread:t,backlog:this.jobQueue.length});let n=new Ov(r.name,t);t.onMessage=a=>r.onMessage(n,a.type,a.payload),t.onError=a=>r.onError(n,a),r.onStart(n);try{await n.result}catch(a){console.error(`Worker exception: ${a}`)}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!Pn||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let t=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Gl({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return Ote?this.maxMobileConcurrency:this.maxConcurrency}};var kMe={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},Pp=class{props;workerPools=new Map;static isSupported(){return Gl.isSupported()}static getWorkerFarm(t={}){return Pp._workerFarm=Pp._workerFarm||new Pp({}),Pp._workerFarm.setProps(t),Pp._workerFarm}constructor(t){this.props={...kMe},this.setProps(t),this.workerPools=new Map}destroy(){for(let t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(let r of this.workerPools.values())r.setProps(this._getWorkerPoolProps())}getWorkerPool(t){let{name:r,source:n,url:a}=t,i=this.workerPools.get(r);return i||(i=new Rv({name:r,source:n,url:a}),i.setProps(this._getWorkerPoolProps()),this.workerPools.set(r,i)),i}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},Ua=Pp;kz(Ua,"_workerFarm");function jte(e){let t=e.version!==Op?` (worker-utils@${Op})`:"";return`${e.name}@${e.version}${t}`}function jv(e,t={}){var o;let r=t[e.id]||{},n=Pn?`${e.id}-worker.js`:`${e.id}-worker-node.js`,a=r.workerUrl;if(!a&&e.id==="compression"&&(a=t.workerUrl),(t._workerType||((o=t==null?void 0:t.core)==null?void 0:o._workerType))==="test"&&(Pn?a=`modules/${e.module}/dist/${n}`:a=`modules/${e.module}/src/workers/${e.id}-worker-node.ts`),!a){let s=e.version;s==="latest"&&(s=Bte);let u=s?`@${s}`:"";a=`https://unpkg.com/@loaders.gl/${e.module}${u}/dist/${n}`}return xa(a),a}async function JB(e,t,r={},n={}){let a=jte(e),i=Ua.getWorkerFarm(r),{source:o}=r,s={name:a,source:o};o||(s.url=jv(e,r));let u=i.getWorkerPool(s),c=r.jobName||e.name,l=await u.startJob(c,CMe.bind(null,n)),f=WB(r);return l.postMessage("process",{input:t,options:f}),(await l.result).result}async function CMe(e,t,r,n){switch(r){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":let{id:a,input:i,options:o}=n;try{if(!e.process){t.postMessage("error",{id:a,error:"Worker not set up to process on main thread"});return}let s=await e.process(i,o);t.postMessage("done",{id:a,result:s})}catch(s){let u=s instanceof Error?s.message:"unknown error";t.postMessage("error",{id:a,error:u})}break;default:console.warn(`process-on-worker: unknown message ${r}`)}}function XB(e,t=Op){xa(e,"no worker provided");let r=e.version;return!(!t||!r)}var YB={};function Lv(e={}){var a,i;let t=e.useLocalLibraries??((a=e.core)==null?void 0:a.useLocalLibraries),r=e.CDN??((i=e.core)==null?void 0:i.CDN),n=e.modules;return{...t!==void 0?{useLocalLibraries:t}:{},...r!==void 0?{CDN:r}:{},...n!==void 0?{modules:n}:{}}}async function yo(e,t=null,r={},n=null){return t&&(e=Lte(e,t,r,n)),YB[e]=YB[e]||DMe(e),await YB[e]}function Lte(e,t,r={},n=null){if(r!=null&&r.core)throw new Error("loadLibrary: options.core must be pre-normalized");if(!r.useLocalLibraries&&e.startsWith("http"))return e;n=n||e;let a=r.modules||{};return a[n]?a[n]:Pn?r.CDN?(xa(r.CDN.startsWith("http")),`${r.CDN}/${t}@${Op}/dist/libs/${n}`):Fv?`../src/libs/${n}`:`modules/${t}/src/libs/${n}`:`modules/${t}/dist/libs/${n}`}async function DMe(e){if(e.endsWith("wasm"))return await FMe(e);if(!Pn){let{requireFromFile:r}=globalThis.loaders||{};try{let n=await(r==null?void 0:r(e));return n||!e.includes("/dist/libs/")?n:await(r==null?void 0:r(e.replace("/dist/libs/","/src/libs/")))}catch(n){if(e.includes("/dist/libs/"))try{return await(r==null?void 0:r(e.replace("/dist/libs/","/src/libs/")))}catch{}return console.error(n),null}}if(Fv)return importScripts(e);let t=await OMe(e);return BMe(t,e)}function BMe(e,t){if(!Pn){let{requireFromString:n}=globalThis.loaders||{};return n==null?void 0:n(e,t)}if(Fv)return eval.call(globalThis,e),null;let r=document.createElement("script");r.id=t;try{r.appendChild(document.createTextNode(e))}catch{r.text=e}return document.body.appendChild(r),null}async function FMe(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};if(Pn||!t||e.startsWith("http"))return await(await fetch(e)).arrayBuffer();try{return await t(e)}catch{if(e.includes("/dist/libs/"))return await t(e.replace("/dist/libs/","/src/libs/"));throw new Error(`Failed to load ArrayBuffer from ${e}`)}}async function OMe(e){let{readFileAsText:t}=globalThis.loaders||{};if(Pn||!t||e.startsWith("http"))return await(await fetch(e)).text();try{return await t(e)}catch{if(e.includes("/dist/libs/"))return await t(e.replace("/dist/libs/","/src/libs/"));throw new Error(`Failed to load text from ${e}`)}}var Mte=Ct(require("child_process"),1);function qte(e=3e3){return new Promise(t=>{Mte.default.exec("lsof -i -P -n | grep LISTEN",(r,n)=>{if(r){t(e);return}let a=[],i=/:(\d+) \(LISTEN\)/;n.split(`
160
- `).forEach(s=>{let u=i.exec(s);u&&a.push(Number(u[1]))});let o=e;for(;a.includes(o);)o++;t(o)})})}async function IMe(){var e;if(typeof process>"u"||!((e=process.versions)!=null&&e.node))throw new Error("ChildProcessProxy is only available in Node.js environments");return await import("child_process")}var Nte={command:"",arguments:[],port:5e3,autoPort:!0,wait:2e3,onSuccess:e=>{console.log(`Started ${e.props.command}`)}},c0=class{id;props={...Nte};childProcess=null;port=0;successTimer;constructor({id:t="browser-driver"}={}){this.id=t}async start(t){t={...Nte,...t},this.props=t;let r=await IMe(),n=[...t.arguments];return this.port=Number(t.port),t.portArg&&(t.autoPort&&(this.port=await qte(t.port)),n.push(t.portArg,String(this.port))),await new Promise((a,i)=>{var o,s;try{this._setTimeout(()=>{t.onSuccess&&t.onSuccess(this),a({})}),console.log(`Spawning ${t.command} ${t.arguments.join(" ")}`);let u=t.spawn||{},c=r.spawn(t.command,n,u);this.childProcess=c,(o=c.stdout)==null||o.on("data",l=>{console.log(l.toString())}),(s=c.stderr)==null||s.on("data",l=>{console.log(`Child process wrote to stderr: "${l}".`),t.ignoreStderr||(this._clearTimeout(),i(new Error(l)))}),c.on("error",l=>{console.log(`Child process errored with ${l}`),this._clearTimeout(),i(l)}),c.on("close",l=>{console.log(`Child process exited with ${l}`),this.childProcess=null,this._clearTimeout(),a({})})}catch(u){i(u)}})}async stop(){this.childProcess&&(this.childProcess.kill(),this.childProcess=null)}async exit(t=0){try{await this.stop(),process.exit(t)}catch(r){console.error(r.message||r),process.exit(1)}}_setTimeout(t){Number(this.props.wait)>0&&(this.successTimer=setTimeout(t,this.props.wait))}_clearTimeout(){this.successTimer&&clearTimeout(this.successTimer)}};function QB(e,t){var a,i;if(!Ua.isSupported())return!1;let r=(t==null?void 0:t._nodeWorkers)??((a=t==null?void 0:t.core)==null?void 0:a._nodeWorkers);if(!Pn&&!r)return!1;let n=(t==null?void 0:t.worker)??((i=t==null?void 0:t.core)==null?void 0:i.worker);return Boolean(e.worker&&n)}async function ZB(e,t,r,n,a){let i=e.id,o=jv(e,r),u=Ua.getWorkerFarm(r==null?void 0:r.core).getWorkerPool({name:i,url:o});r=JSON.parse(JSON.stringify(r)),n=JSON.parse(JSON.stringify(n||{}));let c=await u.startJob("process-on-worker",PMe.bind(null,a));return c.postMessage("process",{input:t,options:r,context:n}),await(await c.result).result}async function PMe(e,t,r,n){switch(r){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":let{id:a,input:i,options:o}=n;try{let s=await e(i,o);t.postMessage("done",{id:a,result:s})}catch(s){let u=s instanceof Error?s.message:"unknown error";t.postMessage("error",{id:a,error:u})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function eF(e,t){var a,i;if(!Ua.isSupported())return!1;let r=(t==null?void 0:t._nodeWorkers)??((a=t==null?void 0:t.core)==null?void 0:a._nodeWorkers),n=(t==null?void 0:t.worker)??((i=t==null?void 0:t.core)==null?void 0:i.worker);return!pr&&!r?!1:Boolean(e.worker&&n)}function zte(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?Ute(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?Ute(e,0,t):""}function Ute(e,t,r){if(e.byteLength<=t+r)return"";let n=new DataView(e),a="";for(let i=0;i<r;i++)a+=String.fromCharCode(n.getUint8(t+i));return a}function tF(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${zte(e)}"`)}}function pu(e,t,r){if(r=r||e.byteLength,e.byteLength<r||t.byteLength<r)return!1;let n=new Uint8Array(e),a=new Uint8Array(t);for(let i=0;i<n.length;++i)if(n[i]!==a[i])return!1;return!0}function bn(...e){return bw(e)}function bw(e){let t=e.map(i=>i instanceof ArrayBuffer?new Uint8Array(i):i),r=t.reduce((i,o)=>i+o.byteLength,0),n=new Uint8Array(r),a=0;for(let i of t)n.set(i,a),a+=i.byteLength;return n.buffer}function Wi(...e){let t=e,r=t&&t.length>1&&t[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let n=t.reduce((o,s)=>o+s.length,0),a=new r(n),i=0;for(let o of t)a.set(o,i),i+=o.length;return a}function Rp(e,t,r){let n=r!==void 0?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}function Ki(e,t){return yt(e>=0),yt(t>0),e+(t-1)&~(t-1)}function rF(e,t,r){let n;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else{let a=e.byteOffset,i=e.byteLength;n=new Uint8Array(e.buffer||e.arrayBuffer,a,i)}return t.set(n,r),r+Ki(n.byteLength,4)}function nF(e,t){let r=e.length,a=Math.ceil(r/t)*t-r,i="";for(let o=0;o<a;++o)i+=" ";return e+i}function l0(e,t,r,n){if(e)for(let a=0;a<n;a++)e.setUint8(t+a,r.charCodeAt(a));return t+n}function Mv(e,t,r,n){if(e)for(let a=0;a<n;a++)e.setUint8(t+a,r[a]);return t+n}function vw(e,t,r,n){let a=Ki(r.byteLength,n),i=a-r.byteLength;if(e){let o=new Uint8Array(e.buffer,e.byteOffset+t,r.byteLength),s=new Uint8Array(r);o.set(s);for(let u=0;u<i;++u)e.setUint8(t+r.byteLength+u,32)}return t+=a,t}function f0(e,t,r,n){let i=new TextEncoder().encode(r);return t=vw(e,t,i,n),t}async function jp(e){let t=[];for await(let r of e)t.push(RMe(r));return bn(...t)}function RMe(e){if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e)){let{buffer:t,byteOffset:r,byteLength:n}=e;return Gte(t,r,n)}return Gte(e)}function Gte(e,t=0,r=e.byteLength-t){let n=new Uint8Array(e,t,r),a=new Uint8Array(n.length);return a.set(n),a.buffer}var jMe="",Hte={};function du(e){for(let t in Hte)if(e.startsWith(t)){let r=Hte[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${jMe}${e}`),e}var LMe="4.4.0",aF={dataType:null,batchType:null,name:"JSON",id:"json",module:"json",version:LMe,extensions:["json","geojson"],mimeTypes:["application/json"],category:"json",text:!0,parseTextSync:Vte,parse:async e=>Vte(new TextDecoder().decode(e)),options:{}};function Vte(e){return JSON.parse(e)}function $te(e){return Buffer.isBuffer(e)?new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer:e}function xw(e){return e&&typeof e=="object"&&e.isBuffer}function Wn(e){if(xw(e))return $te(e);if(e instanceof ArrayBuffer)return e;if(NB(e))return Hl(e);if(ArrayBuffer.isView(e)){let t=e.buffer;return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?t:t.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(typeof e=="string"){let t=e;return new TextEncoder().encode(t).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}function za(e){if(e instanceof ArrayBuffer)return e;if(NB(e))return Hl(e);let{buffer:t,byteOffset:r,byteLength:n}=e;return t instanceof ArrayBuffer&&r===0&&n===t.byteLength?t:Hl(t,r,n)}function Hl(e,t=0,r=e.byteLength-t){let n=new Uint8Array(e,t,r),a=new Uint8Array(n.length);return a.set(n),a.buffer}function iF(e){return ArrayBuffer.isView(e)?e:new Uint8Array(e)}function p0(e){return t=>new Promise((r,n)=>e(t,(a,i)=>a?n(a):r(i)))}var Ga={};Fa(Ga,{dirname:()=>NMe,filename:()=>qMe,join:()=>UMe,resolve:()=>zMe});function Wte(){var t;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=(t=window.location)==null?void 0:t.pathname;return(e==null?void 0:e.slice(0,e.lastIndexOf("/")+1))||""}function qMe(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):e}function NMe(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function UMe(...e){let t="/";return e=e.map((r,n)=>(n&&(r=r.replace(new RegExp(`^${t}`),"")),n!==e.length-1&&(r=r.replace(new RegExp(`${t}$`),"")),r)),e.join(t)}function zMe(...e){let t=[];for(let i=0;i<e.length;i++)t[i]=e[i];let r="",n=!1,a;for(let i=t.length-1;i>=-1&&!n;i--){let o;i>=0?o=t[i]:(a===void 0&&(a=Wte()),o=a),o.length!==0&&(r=`${o}/${r}`,n=o.charCodeAt(0)===qv)}return r=GMe(r,!n),n?`/${r}`:r.length>0?r:"."}var qv=47,oF=46;function GMe(e,t){let r="",n=-1,a=0,i,o=!1;for(let s=0;s<=e.length;++s){if(s<e.length)i=e.charCodeAt(s);else{if(i===qv)break;i=qv}if(i===qv){if(!(n===s-1||a===1))if(n!==s-1&&a===2){if(r.length<2||!o||r.charCodeAt(r.length-1)!==oF||r.charCodeAt(r.length-2)!==oF){if(r.length>2){let u=r.length-1,c=u;for(;c>=0&&r.charCodeAt(c)!==qv;--c);if(c!==u){r=c===-1?"":r.slice(0,c),n=s,a=0,o=!1;continue}}else if(r.length===2||r.length===1){r="",n=s,a=0,o=!1;continue}}t&&(r.length>0?r+="/..":r="..",o=!0)}else{let u=e.slice(n+1,s);r.length>0?r+=`/${u}`:r=u,o=!1}n=s,a=0}else i===oF&&a!==-1?++a:a=-1}return r}var Nv=class{handle;size;bigsize;url;constructor(t){this.handle=t instanceof ArrayBuffer?new Blob([t]):t,this.size=t instanceof ArrayBuffer?t.byteLength:t.size,this.bigsize=BigInt(this.size),this.url=t instanceof File?t.name:""}async close(){}async stat(){return{size:this.handle.size,bigsize:BigInt(this.handle.size),isDirectory:!1}}async read(t,r){return await this.handle.slice(Number(t),Number(t)+Number(r)).arrayBuffer()}};var d0=class{handle;size=0;bigsize=0n;url;constructor(t){this.handle=t,this.url=t}async close(){}async stat(){let t=await fetch(this.handle,{method:"HEAD"});if(!t.ok)throw new Error(`Failed to fetch HEAD ${this.handle}`);let r=parseInt(t.headers.get("Content-Length")||"0");return{size:r,bigsize:BigInt(r),isDirectory:!1}}async read(t=0,r=0){return await(await this.fetchRange(t,r)).arrayBuffer()}async fetchRange(t,r,n){let a=Number(t),i=Number(r),o;n||(o=new AbortController,n=o.signal);let s=this.handle,u=await fetch(s,{signal:n,headers:{Range:`bytes=${a}-${a+i-1}`}});switch(u.status){case 206:break;case 200:let c=u.headers.get("Content-Length");if(!c||Number(c)>r)throw o&&o.abort(),Error("content-length header missing or exceeding request. Server must support HTTP Byte Serving.");case 416:if(t===0){let l=u.headers.get("Content-Range");if(!l||!l.startsWith("bytes *"))throw Error("Missing content-length on 416 response");let f=Number(l.substr(8));u=await fetch(this.url,{signal:n,headers:{Range:`bytes=0-${f-1}`}})}break;default:if(u.status>=300)throw Error(`Bad response code: ${u.status}`)}return u}};var Uv=new Error("Not implemented"),Ha=class{handle;size=0;bigsize=0n;url="";constructor(t,r,n){var a;if((a=globalThis.loaders)!=null&&a.NodeFile)return new globalThis.loaders.NodeFile(t,r,n);throw pr?new Error("Can't instantiate NodeFile in browser."):new Error("Can't instantiate NodeFile. Make sure to import @loaders.gl/polyfills first.")}async read(t,r){throw Uv}async write(t,r,n){throw Uv}async stat(){throw Uv}async truncate(t){throw Uv}async append(t){throw Uv}async close(){}};var h0=new Error("Not implemented"),zv=class{constructor(t){var r;if((r=globalThis.loaders)!=null&&r.NodeFileSystem)return new globalThis.loaders.NodeFileSystem(t);throw pr?new Error("Can't instantiate NodeFileSystem in browser."):new Error("Can't instantiate NodeFileSystem. Make sure to import @loaders.gl/polyfills first.")}readable=!0;writable=!0;async openReadableFile(t,r){throw h0}async openWritableFile(t,r,n){throw h0}async readdir(t=".",r){throw h0}async stat(t,r){throw h0}async unlink(t){throw h0}async fetch(t,r){throw h0}};var yc=Ct(require("fs"),1),Lp=class{handle;size;bigsize;url;constructor(t,r,n){t=du(t),this.handle=yc.default.openSync(t,r,n);let a=yc.default.fstatSync(this.handle,{bigint:!0});this.size=Number(a.size),this.bigsize=a.size,this.url=t}async close(){return new Promise((t,r)=>{yc.default.close(this.handle,n=>n?r(n):t())})}async truncate(t){return new Promise((r,n)=>{yc.default.ftruncate(this.handle,t,a=>{a?n(a):(this.bigsize=BigInt(t),this.size=Number(this.bigsize),r())})})}async append(t){return new Promise((r,n)=>{yc.default.appendFile(this.handle,t,a=>{a?n(a):(this.bigsize=this.bigsize+BigInt(t.length),this.size=Number(this.bigsize),r())})})}async stat(){return await new Promise((t,r)=>yc.default.fstat(this.handle,{bigint:!0},(n,a)=>{let i={size:Number(a.size),bigsize:a.size,isDirectory:a.isDirectory()};n?r(n):t(i)}))}async read(t,r){let n=new ArrayBuffer(r),a=BigInt(t),i=0,o=new Uint8Array(n),s;for(;r>0;){let u=await WMe(this.handle,o,0,r,a);if(u===0)break;i+=u,a+=BigInt(u),r-=u,s!==void 0&&(s+=u)}return i<r?n.slice(0,i):n}async write(t,r=0,n=t.byteLength){return new Promise((a,i)=>{let o=Number(r),s=new Uint8Array(t,Number(r),n);yc.default.write(this.handle,s,0,n,o,(u,c)=>u?i(u):a(c))})}};async function WMe(e,t,r,n,a){return await new Promise((i,o)=>yc.default.read(e,t,r,n,a,(s,u)=>s?o(s):i(u)))}var Aw=Ct(require("fs/promises"),1);var uF=Ct(require("fs"),1),sF=require("stream");var yw=Ct(require("zlib"),1);function _w(e,t){switch(t==null?void 0:t.get("content-encoding")){case"br":return e.pipe(yw.default.createBrotliDecompress());case"gzip":return e.pipe(yw.default.createGunzip());case"deflate":return e.pipe(yw.default.createDeflate());default:return e}}async function Kte(e){let t=[];return await new Promise((r,n)=>{e.on("error",a=>n(a)),e.on("readable",()=>e.read()),e.on("data",a=>{typeof a=="string"&&n(new Error("Read stream not binary")),t.push(Wn(a))}),e.on("end",()=>{let a=KMe(t);r(a)})})}function KMe(e){let t=e.map(i=>i instanceof ArrayBuffer?new Uint8Array(i):i),r=t.reduce((i,o)=>i+o.byteLength,0),n=new Uint8Array(r),a=0;for(let i of t)n.set(i,a),a+=i.byteLength;return n.buffer}var JMe=e=>typeof e=="boolean",Jte=e=>typeof e=="function",XMe=e=>e!==null&&typeof e=="object",YMe=e=>XMe(e)&&Jte(e.read)&&Jte(e.pipe)&&JMe(e.readable);async function ww(e,t){let r=/^file:\/\//;e.replace(r,"/");let n=e.split("?")[0];n=du(n);let a=new Headers;e.endsWith(".gz")&&a.set("content-encoding","gzip"),e.endsWith(".br")&&a.set("content-encoding","br");try{let i=await new Promise((f,p)=>{let d=uF.default.createReadStream(n,{encoding:null});d.once("readable",()=>f(d)),d.on("error",h=>p(h))}),o=i;YMe(i)?o=_w(i,a):typeof i=="string"?o=sF.Readable.from([new TextEncoder().encode(i)]):o=sF.Readable.from([i||new ArrayBuffer(0)]);let s=200,u="OK",c=QMe(n),l=new Response(o,{headers:c,status:s,statusText:u});return Object.defineProperty(l,"url",{value:e}),l}catch(i){let o=i.message,s=400,u=o,c={},l=new Response(o,{headers:c,status:s,statusText:u});return Object.defineProperty(l,"url",{value:e}),l}}function QMe(e){let t={};if(!t["content-length"]){let r=uF.default.statSync(e);t["content-length"]=r.size}return e.endsWith(".gz")&&(e=e.slice(0,-3),t["content-encoding"]="gzip"),new Headers(t)}var Ew=class{readable=!0;writable=!0;constructor(){}async readdir(t=".",r){return await Aw.default.readdir(t,r)}async stat(t){let r=await Aw.default.stat(t,{bigint:!0});return{size:Number(r.size),bigsize:r.size,isDirectory:r.isDirectory()}}async unlink(t){return await Aw.default.unlink(t)}async fetch(t,r){return await ww(t,r)}async openReadableFile(t,r="r"){return new Lp(t,r)}async openWritableFile(t,r="w",n){return new Lp(t,r,n)}};var _c=class{constructor(t={}){this.hashBatches=this.hashBatches.bind(this)}async preload(){}async*hashBatches(t,r="base64"){var o,s;let n=[];for await(let u of t)n.push(u),yield u;let a=await this.concatenate(n),i=await this.hash(a,r);(s=(o=this.options.crypto)==null?void 0:o.onEnd)==null||s.call(o,{hash:i})}async concatenate(t){return await jp(t)}};var m0=class{crc;constructor(){this.crc=-1}update(t){let r=e7e(),n=new Uint8Array(t);for(let a=0;a<n.byteLength;a++)this.crc=this.crc>>>8^r[(this.crc^n[a])&255];return this}finalize(){return this.crc=(this.crc^-1)>>>0,this.crc}},ZMe=Uint32Array.of(0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117);function e7e(){return ZMe}function Xte(e){e=`${e}`;for(let r=0;r<e.length;r++)if(e.charCodeAt(r)>255)return null;let t="";for(let r=0;r<e.length;r+=3){let n=[void 0,void 0,void 0,void 0];n[0]=e.charCodeAt(r)>>2,n[1]=(e.charCodeAt(r)&3)<<4,e.length>r+1&&(n[1]|=e.charCodeAt(r+1)>>4,n[2]=(e.charCodeAt(r+1)&15)<<2),e.length>r+2&&(n[2]|=e.charCodeAt(r+2)>>6,n[3]=e.charCodeAt(r+2)&63);for(let a=0;a<n.length;a++)typeof n[a]>"u"?t+="=":t+=t7e(n[a])}return t}function t7e(e){if(e<26)return String.fromCharCode(e+"A".charCodeAt(0));if(e<52)return String.fromCharCode(e-26+"a".charCodeAt(0));if(e<62)return String.fromCharCode(e-52+"0".charCodeAt(0));if(e===62)return"+";if(e===63)return"/"}function cF(e,t){switch(t){case"hex":return Yte(e);case"base64":return Zte(Yte(e));default:throw new Error(t)}}function Qte(e,t){switch(t){case"hex":return e;case"base64":return Zte(e);default:throw new Error(t)}}function Zte(e){e.length%2!==0&&(e=`0${e}`);let r=(e.match(/\w{2}/g)||[]).map(n=>String.fromCharCode(parseInt(n,16))).join("");return Xte(r)||""}function Yte(e){let t=e.toString(16);return t==="0"?`0${t}`:t}var Gv=class extends _c{name="crc32";options;constructor(t={}){super(),this.options={crypto:{},...t},this.hashBatches=this.hashBatches.bind(this)}async hash(t,r){return this.hashSync(t,r)}hashSync(t,r){let n=new m0;n.update(t);let a=n.finalize();return cF(a,r)}async*hashBatches(t,r="base64"){var i,o;let n=new m0;for await(let s of t)n.update(s),yield s;let a=n.finalize();(o=(i=this.options.crypto)==null?void 0:i.onEnd)==null||o.call(i,{hash:cF(a,r)})}};var Tw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ere=s7e("AGFzbQEAAAABDANgAX8AYAAAYAABfwIeAgdpbXBvcnRzA2xvZwAAB2ltcG9ydHMDbWVtAgABAzIxAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAAAAAAAAAAAAAAAAAAAAAgICAgIAAAAAAAaYARt/AUGBxpS6Bgt/AUGJ17b+fgt/AUH+uevFeQt/AUH2qMmBAQt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALB7oCJQhvbmVGdWxsQQAYCG9uZUZ1bGxCABkIb25lRnVsbEMAGghvbmVGdWxsRAAbBWxvb3BzAAEEbG9vcAACBXByaW1lAAMFbG9vcEEABAZsb29wQTEABQZsb29wQTIABgZsb29wQTMABwZsb29wQTQACAVsb29wQgAJBmxvb3BCMQAKBmxvb3BCMgALBmxvb3BCMwAMBmxvb3BCNAANBWxvb3BDAA4GbG9vcEMxAA8GbG9vcEMyABAGbG9vcEMzABEGbG9vcEM0ABIFbG9vcEQAEwZsb29wRDEAFAZsb29wRDIAFQZsb29wRDMAFgZsb29wRDQAFwRnZXRBACgEZ2V0QgApBGdldEMAKgRnZXREACsEZ2V0WAAsBHNldEEALQRzZXRCAC4Ec2V0QwAvBHNldEQAMARzZXRYADEKzA0xWwEBf0EAJAggAEEGdCEBAkADQCMIIAFGDQEjACQEIwEkBSMCJAYjAyQHEAIjBCMAaiQAIwUjAWokASMGIwJqJAIjByMDaiQDIwhBwABqJAgMAAsLIwgjGmokGgsTACMIIxpqJAkQAxAEEAkQDhATC6IBAEEAIwlqKAIAJApBBCMJaigCACQLQQgjCWooAgAkDEEMIwlqKAIAJA1BECMJaigCACQOQRQjCWooAgAkD0EYIwlqKAIAJBBBHCMJaigCACQRQSAjCWooAgAkEkEkIwlqKAIAJBNBKCMJaigCACQUQSwjCWooAgAkFUEwIwlqKAIAJBZBNCMJaigCACQXQTgjCWooAgAkGEE8IwlqKAIAJBkLCgAQBRAGEAcQCAsuAEH4yKq7fSMKahAYQdbunsZ+IwtqEBtB2+GBoQIjDGoQGkHunfeNfCMNahAZCy0AQa+f8Kt/Iw5qEBhBqoyfvAQjD2oQG0GTjMHBeiMQahAaQYGqmmojEWoQGQssAEHYsYLMBiMSahAYQa/vk9p4IxNqEBtBsbd9IxRqEBpBvq/zyngjFWoQGQstAEGiosDcBiMWahAYQZPj4WwjF2oQG0GOh+WzeiMYahAaQaGQ0M0EIxlqEBkLCgAQChALEAwQDQsuAEHiyviwfyMLahAcQcDmgoJ8IxBqEB9B0bT5sgIjFWoQHkGqj9vNfiMKahAdCy0AQd2gvLF9Iw9qEBxB06iQEiMUahAfQYHNh8V9IxlqEB5ByPfPvn4jDmoQHQsuAEHmm4ePAiMTahAcQdaP3Jl8IxhqEB9Bh5vUpn8jDWoQHkHtqeiqBCMSahAdCy0AQYXSj896IxdqEBxB+Me+ZyMMahAfQdmFvLsGIxFqEB5Bipmp6XgjFmoQHQsKABAPEBAQERASCysAQcLyaCMPahAgQYHtx7t4IxJqECNBosL17AYjFWoQIkGM8JRvIxhqECELLgBBxNT7pXojC2oQIEGpn/veBCMOahAjQeCW7bV/IxFqECJB8Pj+9XsjFGoQIQstAEHG/e3EAiMXahAgQfrPhNV+IwpqECNBheG8p30jDWoQIkGFuqAkIxBqECELLgBBuaDTzn0jE2oQIEHls+62fiMWahAjQfj5if0BIxlqECJB5ayxpXwjDGoQIQsKABAUEBUQFhAXCy0AQcTEpKF/IwpqECRBl/+rmQQjEWoQJ0Gnx9DceiMYahAmQbnAzmQjD2oQJQstAEHDs+2qBiMWahAkQZKZs/h4Iw1qECdB/ei/fyMUahAmQdG7kax4IwtqECULLQBBz/yh/QYjEmoQJEHgzbNxIxlqECdBlIaFmHojEGoQJkGho6DwBCMXahAlCy4AQYL9zbp/Iw5qECRBteTr6XsjFWoQJ0G7pd/WAiMMahAmQZGnm9x+IxNqECULKAEBf0F/IwFzIwNxIwEjAnFyIwBqIABqIgFBB3QgAUEZdnIjAWokAAsoAQF/QX8jAnMjAHEjAiMDcXIjAWogAGoiAUEWdCABQQp2ciMCaiQBCygBAX9BfyMDcyMBcSMDIwBxciMCaiAAaiIBQRF0IAFBD3ZyIwNqJAILKAEBf0F/IwBzIwJxIwAjAXFyIwNqIABqIgFBDHQgAUEUdnIjAGokAwsoAQF/IwJBfyMDc3EjASMDcXIjAGogAGoiAUEFdCABQRt2ciMBaiQACygBAX8jA0F/IwBzcSMCIwBxciMBaiAAaiIBQRR0IAFBDHZyIwJqJAELKAEBfyMAQX8jAXNxIwMjAXFyIwJqIABqIgFBDnQgAUESdnIjA2okAgsoAQF/IwFBfyMCc3EjACMCcXIjA2ogAGoiAUEJdCABQRd2ciMAaiQDCyIBAX8jASMCcyMDcyMAaiAAaiIBQQR0IAFBHHZyIwFqJAALIgEBfyMCIwNzIwBzIwFqIABqIgFBF3QgAUEJdnIjAmokAQsiAQF/IwMjAHMjAXMjAmogAGoiAUEQdCABQRB2ciMDaiQCCyIBAX8jACMBcyMCcyMDaiAAaiIBQQt0IAFBFXZyIwBqJAMLJQEBf0F/IwNzIwFyIwJzIwBqIABqIgFBBnQgAUEadnIjAWokAAslAQF/QX8jAHMjAnIjA3MjAWogAGoiAUEVdCABQQt2ciMCaiQBCyUBAX9BfyMBcyMDciMAcyMCaiAAaiIBQQ90IAFBEXZyIwNqJAILJQEBf0F/IwJzIwByIwFzIwNqIABqIgFBCnQgAUEWdnIjAGokAwsEACMACwQAIwELBAAjAgsEACMDCwQAIxoLBgAgACQACwYAIAAkAQsGACAAJAILBgAgACQDCwYAIAAkGgsA6gQEbmFtZQGSAzIAA2xvZwEFbG9vcHMCBGxvb3ADBXByaW1lBAVsb29wQQUGbG9vcEExBgZsb29wQTIHBmxvb3BBMwgGbG9vcEE0CQVsb29wQgoGbG9vcEIxCwZsb29wQjIMBmxvb3BCMw0GbG9vcEI0DgVsb29wQw8GbG9vcEMxEAZsb29wQzIRBmxvb3BDMxIGbG9vcEM0EwVsb29wRBQGbG9vcEQxFQZsb29wRDIWBmxvb3BEMxcGbG9vcEQ0GAhvbmVGdWxsQRkIb25lRnVsbEIaCG9uZUZ1bGxDGwhvbmVGdWxsRBwIdHdvRnVsbEEdCHR3b0Z1bGxCHgh0d29GdWxsQx8IdHdvRnVsbEQgCHRyZUZ1bGxBIQh0cmVGdWxsQiIIdHJlRnVsbEMjCHRyZUZ1bGxEJAhxdWFGdWxsQSUIcXVhRnVsbEImCHF1YUZ1bGxDJwhxdWFGdWxsRCgEZ2V0QSkEZ2V0QioEZ2V0QysEZ2V0RCwEZ2V0WC0Ec2V0QS4Ec2V0Qi8Ec2V0QzAEc2V0RDEEc2V0WALNATIAAQAAAQIAAAEIbnVtbG9vcHMCAAMABAAFAAYABwAIAAkACgALAAwADQAOAA8AEAARABIAEwAUABUAFgAXABgCAAABAW4ZAgAAAQFuGgIAAAEBbhsCAAABAW4cAgAAAQFuHQIAAAEBbh4CAAABAW4fAgAAAQFuIAIAAAEBbiECAAABAW4iAgAAAQFuIwIAAAEBbiQCAAABAW4lAgAAAQFuJgIAAAEBbicCAAABAW4oACkAKgArACwALQEAAC4BAAAvAQAAMAEAADEBAAA="),lF=typeof WebAssembly<"u"&&ere?ere.buffer:!1,hu=p7e(),fF=240*16*16,tre=Math.floor(fF*16*1.066666667),r7e=268435456-65536,n7e="Parameter must be ArrayBuffer, ArrayBufferView or string",a7e="Parameter exceeds max size of 255.9 Mbytes";lF||console.log("WebAssembly not available or WASM module could not be decoded; md5WASM will fall back to JavaScript");function pF(e){var t,r,n,a,i,o,s,u,c,l;let f=o7e(),p=i7e(),d={},h=new Date().getTime();return d.then=function(y){return s=y,g(),d},d.catch=function(y){return u=y,d},o=f7e(e),o||x(new TypeError(n7e)),o&&(i=o.length,lF&&i>tre?i>r7e?x(new Error(a7e)):(t=new WebAssembly.Memory({initial:i>32e6?i>64e6?i>128e6?4096:2048:1024:512}),r=new Uint32Array(t.buffer),a={mem:t,log:console.log},n={imports:a},WebAssembly.instantiate(lF,n).then(m)):g(f(o))),d;function m(y){g(p(o,y.instance.exports,r))}function g(y){var w=Boolean(y)?y:c;Boolean(y)&&(l=new Date().getTime()),typeof s=="function"?Boolean(w)&&(s(w,l-h),s=u=null):Boolean(y)&&(c=y)}function x(y){typeof u=="function"&&u(y)}}function i7e(){var e,t,r,n,a,i,o,s,u,c,l,f,p,d=function(h){var m,g,x,y,w,T,A,B,I,L,C,k,F,R,G,z,W,Y,ue,ie,le,fe,me=new Date().getTime(),ye=0,X=1732584193,N=-271733879,K=-1732584194,Q=271733878,Fe=0,Le=h.length*8,Ke;for(Ke=ve(h,p),p[Le>>>5]|=128<<Le%32,p[(Le+64>>>9<<4)+14]=Le,Ke=(Le+64>>>9<<4)+15,le=p;Fe<Ke;)Ke>Fe+tre?(n(X),i(N),s(K),c(Q),t(fF),Fe=Fe+fF*16,X=r(),N=a(),K=o(),Q=u(),ye++):(W=X,Y=N,ue=K,ie=Q,m=le[Fe+0]>>>0,g=le[Fe+1]>>>0,x=le[Fe+2]>>>0,y=le[Fe+3]>>>0,w=le[Fe+4]>>>0,T=le[Fe+5]>>>0,A=le[Fe+6]>>>0,B=le[Fe+7]>>>0,I=le[Fe+8]>>>0,L=le[Fe+9]>>>0,C=le[Fe+10]>>>0,k=le[Fe+11]>>>0,F=le[Fe+12]>>>0,R=le[Fe+13]>>>0,G=le[Fe+14]>>>0,z=le[Fe+15]>>>0,X=ae(7,25,X+(N&K|~N&Q)+m-680876936)+N,Q=ae(12,20,Q+(X&N|~X&K)+g-389564586)+X,K=ae(17,15,K+(Q&X|~Q&N)+x+606105819)+Q,N=ae(22,10,N+(K&Q|~K&X)+y-1044525330)+K,X=ae(7,25,X+(N&K|~N&Q)+w-176418897)+N,Q=ae(12,20,Q+(X&N|~X&K)+T+1200080426)+X,K=ae(17,15,K+(Q&X|~Q&N)+A-1473231341)+Q,N=ae(22,10,N+(K&Q|~K&X)+B-45705983)+K,X=ae(7,25,X+(N&K|~N&Q)+I+1770035416)+N,Q=ae(12,20,Q+(X&N|~X&K)+L-1958414417)+X,K=ae(17,15,K+(Q&X|~Q&N)+C-42063)+Q,N=ae(22,10,N+(K&Q|~K&X)+k-1990404162)+K,X=ae(7,25,X+(N&K|~N&Q)+F+1804603682)+N,Q=ae(12,20,Q+(X&N|~X&K)+R-40341101)+X,K=ae(17,15,K+(Q&X|~Q&N)+G-1502002290)+Q,N=ae(22,10,N+(K&Q|~K&X)+z+1236535329)+K,X=ae(5,27,X+(N&Q|K&~Q)+g-165796510)+N,Q=ae(9,23,Q+(X&K|N&~K)+A-1069501632)+X,K=ae(14,18,K+(Q&N|X&~N)+k+643717713)+Q,N=ae(20,12,N+(K&X|Q&~X)+m-373897302)+K,X=ae(5,27,X+(N&Q|K&~Q)+T-701558691)+N,Q=ae(9,23,Q+(X&K|N&~K)+C+38016083)+X,K=ae(14,18,K+(Q&N|X&~N)+z-660478335)+Q,N=ae(20,12,N+(K&X|Q&~X)+w-405537848)+K,X=ae(5,27,X+(N&Q|K&~Q)+L+568446438)+N,Q=ae(9,23,Q+(X&K|N&~K)+G-1019803690)+X,K=ae(14,18,K+(Q&N|X&~N)+y-187363961)+Q,N=ae(20,12,N+(K&X|Q&~X)+I+1163531501)+K,X=ae(5,27,X+(N&Q|K&~Q)+R-1444681467)+N,Q=ae(9,23,Q+(X&K|N&~K)+x-51403784)+X,K=ae(14,18,K+(Q&N|X&~N)+B+1735328473)+Q,N=ae(20,12,N+(K&X|Q&~X)+F-1926607734)+K,X=ae(4,28,X+(N^K^Q)+T-378558)+N,Q=ae(11,21,Q+(X^N^K)+I-2022574463)+X,K=ae(16,16,K+(Q^X^N)+k+1839030562)+Q,N=ae(23,9,N+(K^Q^X)+G-35309556)+K,X=ae(4,28,X+(N^K^Q)+g-1530992060)+N,Q=ae(11,21,Q+(X^N^K)+w+1272893353)+X,K=ae(16,16,K+(Q^X^N)+B-155497632)+Q,N=ae(23,9,N+(K^Q^X)+C-1094730640)+K,X=ae(4,28,X+(N^K^Q)+R+681279174)+N,Q=ae(11,21,Q+(X^N^K)+m-358537222)+X,K=ae(16,16,K+(Q^X^N)+y-722521979)+Q,N=ae(23,9,N+(K^Q^X)+A+76029189)+K,X=ae(4,28,X+(N^K^Q)+L-640364487)+N,Q=ae(11,21,Q+(X^N^K)+F-421815835)+X,K=ae(16,16,K+(Q^X^N)+z+530742520)+Q,N=ae(23,9,N+(K^Q^X)+x-995338651)+K,X=ae(6,26,X+(K^(N|~Q))+m-198630844)+N,Q=ae(10,22,Q+(N^(X|~K))+B+1126891415)+X,K=ae(15,17,K+(X^(Q|~N))+G-1416354905)+Q,N=ae(21,11,N+(Q^(K|~X))+T-57434055)+K,X=ae(6,26,X+(K^(N|~Q))+F+1700485571)+N,Q=ae(10,22,Q+(N^(X|~K))+y-1894986606)+X,K=ae(15,17,K+(X^(Q|~N))+C-1051523)+Q,N=ae(21,11,N+(Q^(K|~X))+g-2054922799)+K,X=ae(6,26,X+(K^(N|~Q))+I+1873313359)+N,Q=ae(10,22,Q+(N^(X|~K))+z-30611744)+X,K=ae(15,17,K+(X^(Q|~N))+A-1560198380)+Q,N=ae(21,11,N+(Q^(K|~X))+R+1309151649)+K,X=ae(6,26,X+(K^(N|~Q))+w-145523070)+N,Q=ae(10,22,Q+(N^(X|~K))+k-1120210379)+X,K=ae(15,17,K+(X^(Q|~N))+x+718787259)+Q,N=ae(21,11,N+(Q^(K|~X))+L-343485551)+K,Fe=Fe+16,X=X+W>>>0,N=N+Y>>>0,K=K+ue>>>0,Q=Q+ie>>>0);return hu.endian([X,N,K,Q]);function ae(ge,Xe,Te){return Te<<ge|Te>>>Xe}function ve(ge,Xe){for(var Te=-1,rt=Math.floor((ge.length-1)/4),vt=0,Cr,re,Oe,Ve;rt-8>Te++;)vt=Te<<2,Xe[Te]=ge[vt+0]|ge[vt+1]<<8|ge[vt+2]<<16|ge[vt+3]<<24;for(Te--;rt>Te++;)vt=Te<<2,Cr=typeof ge[vt+0]>"u"?0:ge[vt+0],re=typeof ge[vt+1]>"u"?0:ge[vt+1],Oe=typeof ge[vt+2]>"u"?0:ge[vt+2],Ve=typeof ge[vt+3]>"u"?0:ge[vt+3],Xe[Te]=Cr|re<<8|Oe<<16|Ve<<24;return rt+1}};return function(h,m,g,x){var y;return t=m.loops,e=m.loop,r=m.getA,a=m.getB,o=m.getC,u=m.getD,l=m.getX,n=m.setA,i=m.setB,s=m.setC,c=m.setD,f=m.setX,p=g,y=hu.wordsToBytes(d(h)),x&&x.asBytes?y:hu.bytesconvertNumberToHex(y)}}function o7e(){var e=function(t,r){var n,a,i,o,s,u,c,l,f,p,d,h,m,g,x,y,w,T,A,B,I,L=new Date().getTime(),C=1732584193,k=-271733879,F=-1732584194,R=271733878,G=t.length*8;I=hu.bytesToWords(t);for(var z=0;z<I.length;z++)I[z]=(I[z]<<8|I[z]>>>24)&16711935|(I[z]<<24|I[z]>>>8)&4278255360;I[G>>>5]|=128<<G%32,I[(G+64>>>9<<4)+14]=G;for(var W=0;W<I.length;W+=16)w=C,T=k,A=F,B=R,n=I[W+0]>>>0,a=I[W+1]>>>0,i=I[W+2]>>>0,o=I[W+3]>>>0,s=I[W+4]>>>0,u=I[W+5]>>>0,c=I[W+6]>>>0,l=I[W+7]>>>0,f=I[W+8]>>>0,p=I[W+9]>>>0,d=I[W+10]>>>0,h=I[W+11]>>>0,m=I[W+12]>>>0,g=I[W+13]>>>0,x=I[W+14]>>>0,y=I[W+15]>>>0,C=Y(7,25,C+(k&F|~k&R)+n-680876936)+k,R=Y(12,20,R+(C&k|~C&F)+a-389564586)+C,F=Y(17,15,F+(R&C|~R&k)+i+606105819)+R,k=Y(22,10,k+(F&R|~F&C)+o-1044525330)+F,C=Y(7,25,C+(k&F|~k&R)+s-176418897)+k,R=Y(12,20,R+(C&k|~C&F)+u+1200080426)+C,F=Y(17,15,F+(R&C|~R&k)+c-1473231341)+R,k=Y(22,10,k+(F&R|~F&C)+l-45705983)+F,C=Y(7,25,C+(k&F|~k&R)+f+1770035416)+k,R=Y(12,20,R+(C&k|~C&F)+p-1958414417)+C,F=Y(17,15,F+(R&C|~R&k)+d-42063)+R,k=Y(22,10,k+(F&R|~F&C)+h-1990404162)+F,C=Y(7,25,C+(k&F|~k&R)+m+1804603682)+k,R=Y(12,20,R+(C&k|~C&F)+g-40341101)+C,F=Y(17,15,F+(R&C|~R&k)+x-1502002290)+R,k=Y(22,10,k+(F&R|~F&C)+y+1236535329)+F,C=Y(5,27,C+(k&R|F&~R)+a-165796510)+k,R=Y(9,23,R+(C&F|k&~F)+c-1069501632)+C,F=Y(14,18,F+(R&k|C&~k)+h+643717713)+R,k=Y(20,12,k+(F&C|R&~C)+n-373897302)+F,C=Y(5,27,C+(k&R|F&~R)+u-701558691)+k,R=Y(9,23,R+(C&F|k&~F)+d+38016083)+C,F=Y(14,18,F+(R&k|C&~k)+y-660478335)+R,k=Y(20,12,k+(F&C|R&~C)+s-405537848)+F,C=Y(5,27,C+(k&R|F&~R)+p+568446438)+k,R=Y(9,23,R+(C&F|k&~F)+x-1019803690)+C,F=Y(14,18,F+(R&k|C&~k)+o-187363961)+R,k=Y(20,12,k+(F&C|R&~C)+f+1163531501)+F,C=Y(5,27,C+(k&R|F&~R)+g-1444681467)+k,R=Y(9,23,R+(C&F|k&~F)+i-51403784)+C,F=Y(14,18,F+(R&k|C&~k)+l+1735328473)+R,k=Y(20,12,k+(F&C|R&~C)+m-1926607734)+F,C=Y(4,28,C+(k^F^R)+u-378558)+k,R=Y(11,21,R+(C^k^F)+f-2022574463)+C,F=Y(16,16,F+(R^C^k)+h+1839030562)+R,k=Y(23,9,k+(F^R^C)+x-35309556)+F,C=Y(4,28,C+(k^F^R)+a-1530992060)+k,R=Y(11,21,R+(C^k^F)+s+1272893353)+C,F=Y(16,16,F+(R^C^k)+l-155497632)+R,k=Y(23,9,k+(F^R^C)+d-1094730640)+F,C=Y(4,28,C+(k^F^R)+g+681279174)+k,R=Y(11,21,R+(C^k^F)+n-358537222)+C,F=Y(16,16,F+(R^C^k)+o-722521979)+R,k=Y(23,9,k+(F^R^C)+c+76029189)+F,C=Y(4,28,C+(k^F^R)+p-640364487)+k,R=Y(11,21,R+(C^k^F)+m-421815835)+C,F=Y(16,16,F+(R^C^k)+y+530742520)+R,k=Y(23,9,k+(F^R^C)+i-995338651)+F,C=Y(6,26,C+(F^(k|~R))+n-198630844)+k,R=Y(10,22,R+(k^(C|~F))+l+1126891415)+C,F=Y(15,17,F+(C^(R|~k))+x-1416354905)+R,k=Y(21,11,k+(R^(F|~C))+u-57434055)+F,C=Y(6,26,C+(F^(k|~R))+m+1700485571)+k,R=Y(10,22,R+(k^(C|~F))+o-1894986606)+C,F=Y(15,17,F+(C^(R|~k))+d-1051523)+R,k=Y(21,11,k+(R^(F|~C))+a-2054922799)+F,C=Y(6,26,C+(F^(k|~R))+f+1873313359)+k,R=Y(10,22,R+(k^(C|~F))+y-30611744)+C,F=Y(15,17,F+(C^(R|~k))+c-1560198380)+R,k=Y(21,11,k+(R^(F|~C))+g+1309151649)+F,C=Y(6,26,C+(F^(k|~R))+s-145523070)+k,R=Y(10,22,R+(k^(C|~F))+h-1120210379)+C,F=Y(15,17,F+(C^(R|~k))+i+718787259)+R,k=Y(21,11,k+(R^(F|~C))+p-343485551)+F,C=C+w>>>0,k=k+T>>>0,F=F+A>>>0,R=R+B>>>0;return hu.endian([C,k,F,R]);function Y(ue,ie,le){return le<<ue|le>>>ie}};return function(t,r){var n=hu.wordsToBytes(e(t,r)),a=r&&r.asBytes?n:hu.bytesconvertNumberToHex(n);return a}}function s7e(e){try{return u7e(e)}catch{return null}}function u7e(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");return typeof atob=="function"?l7e(atob(t)):c7e(t)}function c7e(e){for(var t=e.endsWith("==")?2:e.endsWith("=")?1:0,r=e.length*3/4-t,n=new Uint8Array(r),a=0,i=0,o,s,u,c;i<e.length;){if(o=Tw.indexOf(e.charAt(i++)),s=Tw.indexOf(e.charAt(i++)),u=Tw.indexOf(e.charAt(i++)),c=Tw.indexOf(e.charAt(i++)),o<0||s<0||u<0||c<0)throw new TypeError("Invalid base64 input");n[a++]=o<<2|s>>4,u<64&&a<r&&(n[a++]=(s&15)<<4|u>>2),c<64&&a<r&&(n[a++]=(u&3)<<6|c)}return n}function l7e(e){for(var t=e.length,r=new Uint8Array(t),n=0;n<t;)r[n]=e.charCodeAt(n),n++;return r}function f7e(e){return e instanceof Uint8Array?e:typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?new Uint8Array(e):e&&typeof e=="object"&&ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):typeof e=="string"?new TextEncoder().encode(e):null}function p7e(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";return{rotl:function(t,r){return t<<r|t>>>32-r},endian:function(t){if(t.constructor==Number)return hu.rotl(t,8)&16711935|hu.rotl(t,24)&4278255360;for(var r=0;r<t.length;r++)t[r]=hu.endian(t[r]);return t},bytesToWords:function(t){for(var r=[],n=0,a=0;n<t.length;n++,a+=8)r[a>>>5]|=t[n]<<24-a%32;return r},wordsToBytes:function(t){for(var r=[],n=0;n<t.length*32;n+=8)r.push(t[n>>>5]>>>24-n%32&255);return r},bytesconvertNumberToHex:function(t){for(var r=[],n=0;n<t.length;n++)r.push((t[n]>>>4).toString(16)),r.push((t[n]&15).toString(16));return r.join("")}}}var mu=class extends _c{name="md5";options;constructor(t={}){super(),this.options=t}async hash(t,r){let a=await new Promise((i,o)=>pF(t).then(i).catch(o));return Qte(a,r)}};var Hv=Ct(require("crypto"),1),Sw=class extends _c{name="crypto-node";options;_algorithm;_hash;constructor(t){var r,n;if(super(),this.options=t,!((n=(r=this.options)==null?void 0:r.crypto)!=null&&n.algorithm))throw new Error(this.name)}async hash(t,r){var a,i,o,s;let n=(o=(i=(a=this.options)==null?void 0:a.crypto)==null?void 0:i.algorithm)==null?void 0:o.toLowerCase();try{if(!Hv.createHash)throw new Error("crypto.createHash not available");let u=(s=Hv.createHash)==null?void 0:s(n),c=new Uint8Array(t);return u.update(c).digest("base64")}catch(u){throw Error(`${n} hash not available. ${u}`)}}async*hashBatches(t,r="base64"){var i,o,s,u,c,l,f;if(!Hv.createHash)throw new Error("crypto.createHash not available");let n=(u=Hv.createHash)==null?void 0:u((s=(o=(i=this.options)==null?void 0:i.crypto)==null?void 0:o.algorithm)==null?void 0:s.toLowerCase());for await(let p of t){let d=new Uint8Array(p);n.update(d),yield p}let a=n.digest(r);(f=(l=(c=this.options)==null?void 0:c.crypto)==null?void 0:l.onEnd)==null||f.call(l,{hash:a})}};var Pne=require("process");var rre=Ct(require("stream"),1),dF=class{},d7e=rre.Readable||dF;function mF(e,t){let r=e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]();return new hF(r,t)}var hF=class extends d7e{_pulling;_bytesMode;_iterator;constructor(t,r){super(r),this._iterator=t,this._pulling=!1,this._bytesMode=!r||!r.objectMode}async _read(t){this._pulling||(this._pulling=!0,this._pulling=await this._pull(t,this._iterator))}async _destroy(t,r){var n,a,i,o;this._iterator&&(t?await((a=(n=this._iterator)==null?void 0:n.throw)==null?void 0:a.call(n,t)):await((o=(i=this._iterator)==null?void 0:i.return)==null?void 0:o.call(i,t)),r==null||r(null))}async _pull(t,r){var i;let n=this._bytesMode,a=null;for(;this.readable&&!(a=await r.next()).done&&(t!==null&&(t-=n&&ArrayBuffer.isView(a.value)?a.value.byteLength:1),!(!this.push(new Uint8Array(a.value))||t<=0)););return(a!=null&&a.done||!this.readable)&&(this.push(null)||!0)&&((i=r==null?void 0:r.return)==null||i.call(r)),!this.readable}};function Xv(){}function En(e){return typeof e=="object"&&e!==null||typeof e=="function"}var wre=Xv;function tr(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch{}}var PF=Promise,h7e=Promise.resolve.bind(PF),m7e=Promise.prototype.then,g7e=Promise.reject.bind(PF),b7e=h7e;function Rn(e){return new PF(e)}function rr(e){return Rn(t=>t(e))}function nt(e){return g7e(e)}function xu(e,t,r){return m7e.call(e,t,r)}function wi(e,t,r){xu(xu(e,t,r),void 0,wre)}function gF(e,t){wi(e,t)}function TF(e,t){wi(e,void 0,t)}function kc(e,t,r){return xu(e,t,r)}function A0(e){xu(e,void 0,wre)}var Gp=e=>{if(typeof queueMicrotask=="function")Gp=queueMicrotask;else{let t=rr(void 0);Gp=r=>xu(t,r)}return Gp(e)};function Hp(e,t,r){if(typeof e!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function Dc(e,t,r){try{return rr(Hp(e,t,r))}catch(n){return nt(n)}}var Ai=class{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(t){let r=this._back,n=r;r._elements.length===16383&&(n={_elements:[],_next:void 0}),r._elements.push(t),n!==r&&(this._back=n,r._next=n),++this._size}shift(){let t=this._front,r=t,n=this._cursor,a=n+1,i=t._elements,o=i[n];return a===16384&&(r=t._next,a=0),--this._size,this._cursor=a,t!==r&&(this._front=r),i[n]=void 0,o}forEach(t){let r=this._cursor,n=this._front,a=n._elements;for(;!(r===a.length&&n._next===void 0||r===a.length&&(n=n._next,a=n._elements,r=0,a.length===0));)t(a[r]),++r}peek(){let t=this._front,r=this._cursor;return t._elements[r]}},Are=Symbol("[[AbortSteps]]"),Ere=Symbol("[[ErrorSteps]]"),RF=Symbol("[[CancelSteps]]"),jF=Symbol("[[PullSteps]]"),LF=Symbol("[[ReleaseSteps]]");function Tre(e,t){e._ownerReadableStream=t,t._reader=e,t._state==="readable"?SF(e):t._state==="closed"?function(r){SF(r),kre(r)}(e):Sre(e,t._storedError)}function MF(e,t){return hs(e._ownerReadableStream,t)}function Sc(e){let t=e._ownerReadableStream;t._state==="readable"?qF(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(r,n){Sre(r,n)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),t._readableStreamController[LF](),t._reader=void 0,e._ownerReadableStream=void 0}function zw(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function SF(e){e._closedPromise=Rn((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r})}function Sre(e,t){SF(e),qF(e,t)}function qF(e,t){e._closedPromise_reject!==void 0&&(A0(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function kre(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}var nre=Number.isFinite||function(e){return typeof e=="number"&&isFinite(e)},v7e=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function yu(e,t){if(e!==void 0&&typeof(r=e)!="object"&&typeof r!="function")throw new TypeError(`${t} is not an object.`);var r}function wo(e,t){if(typeof e!="function")throw new TypeError(`${t} is not a function.`)}function Cre(e,t){if(!function(r){return typeof r=="object"&&r!==null||typeof r=="function"}(e))throw new TypeError(`${t} is not an object.`)}function Cc(e,t,r){if(e===void 0)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function kF(e,t,r){if(e===void 0)throw new TypeError(`${t} is required in '${r}'.`)}function NF(e){return Number(e)}function are(e){return e===0?0:e}function UF(e,t){let r=Number.MAX_SAFE_INTEGER,n=Number(e);if(n=are(n),!nre(n))throw new TypeError(`${t} is not a finite number`);if(n=function(a){return are(v7e(a))}(n),n<0||n>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return nre(n)&&n!==0?n:0}function zF(e,t){if(!Vl(e))throw new TypeError(`${t} is not a ReadableStream.`)}function v0(e){return new wc(e)}function Dre(e,t){e._reader._readRequests.push(t)}function GF(e,t,r){let n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function Xw(e){return e._reader._readRequests.length}function Bre(e){let t=e._reader;return t!==void 0&&!!$l(t)}var wc=class{constructor(t){if(Cc(t,1,"ReadableStreamDefaultReader"),zF(t,"First parameter"),Kl(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");Tre(this,t),this._readRequests=new Ai}get closed(){return $l(this)?this._closedPromise:nt(kw("closed"))}cancel(t=void 0){return $l(this)?this._ownerReadableStream===void 0?nt(zw("cancel")):MF(this,t):nt(kw("cancel"))}read(){if(!$l(this))return nt(kw("read"));if(this._ownerReadableStream===void 0)return nt(zw("read from"));let t,r,n=Rn((a,i)=>{t=a,r=i});return Yv(this,{_chunkSteps:a=>t({value:a,done:!1}),_closeSteps:()=>t({value:void 0,done:!0}),_errorSteps:a=>r(a)}),n}releaseLock(){if(!$l(this))throw kw("releaseLock");this._ownerReadableStream!==void 0&&function(t){Sc(t);let r=new TypeError("Reader was released");Fre(t,r)}(this)}};function $l(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof wc}function Yv(e,t){let r=e._ownerReadableStream;r._disturbed=!0,r._state==="closed"?t._closeSteps():r._state==="errored"?t._errorSteps(r._storedError):r._readableStreamController[jF](t)}function Fre(e,t){let r=e._readRequests;e._readRequests=new Ai,r.forEach(n=>{n._errorSteps(t)})}function kw(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}var bF,vF,xF;function $v(e){return e.slice()}function Ore(e,t,r,n,a){new Uint8Array(e).set(new Uint8Array(r,n,a),t)}Object.defineProperties(wc.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),tr(wc.prototype.cancel,"cancel"),tr(wc.prototype.read,"read"),tr(wc.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(wc.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});var Vp=e=>(Vp=typeof e.transfer=="function"?t=>t.transfer():typeof structuredClone=="function"?t=>structuredClone(t,{transfer:[t]}):t=>t,Vp(e)),$p=e=>($p=typeof e.detached=="boolean"?t=>t.detached:t=>t.byteLength===0,$p(e));function Ire(e,t,r){if(e.slice)return e.slice(t,r);let n=r-t,a=new ArrayBuffer(n);return Ore(a,0,e,t,n),a}function Wv(e,t){let r=e[t];if(r!=null){if(typeof r!="function")throw new TypeError(`${String(t)} is not a function`);return r}}function ire(e){try{let t=e.done,r=e.value;return xu(b7e(r),n=>({done:t,value:n}))}catch(t){return nt(t)}}var ix=(xF=(bF=Symbol.asyncIterator)!==null&&bF!==void 0?bF:(vF=Symbol.for)===null||vF===void 0?void 0:vF.call(Symbol,"Symbol.asyncIterator"))!==null&&xF!==void 0?xF:"@@asyncIterator";function Pre(e,t="sync",r){if(r===void 0)if(t==="async"){if((r=Wv(e,ix))===void 0)return function(a){let i={next(){let o;try{o=Rre(a)}catch(s){return nt(s)}return ire(o)},return(o){let s;try{let u=Wv(a.iterator,"return");if(u===void 0)return rr({done:!0,value:o});s=Hp(u,a.iterator,[o])}catch(u){return nt(u)}return En(s)?ire(s):nt(new TypeError("The iterator.return() method must return an object"))}};return{iterator:i,nextMethod:i.next,done:!1}}(Pre(e,"sync",Wv(e,Symbol.iterator)))}else r=Wv(e,Symbol.iterator);if(r===void 0)throw new TypeError("The object is not iterable");let n=Hp(r,e,[]);if(!En(n))throw new TypeError("The iterator method must return an object");return{iterator:n,nextMethod:n.next,done:!1}}function Rre(e){let t=Hp(e.nextMethod,e.iterator,[]);if(!En(t))throw new TypeError("The iterator.next() method must return an object");return t}var Gw=class{constructor(t,r){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=t,this._preventCancel=r}next(){let t=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?kc(this._ongoingPromise,t,t):t(),this._ongoingPromise}return(t){let r=()=>this._returnSteps(t);return this._ongoingPromise=this._ongoingPromise?kc(this._ongoingPromise,r,r):r(),this._ongoingPromise}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let t=this._reader,r,n,a=Rn((i,o)=>{r=i,n=o});return Yv(t,{_chunkSteps:i=>{this._ongoingPromise=void 0,Gp(()=>r({value:i,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,Sc(t),r({value:void 0,done:!0})},_errorSteps:i=>{this._ongoingPromise=void 0,this._isFinished=!0,Sc(t),n(i)}}),a}_returnSteps(t){if(this._isFinished)return Promise.resolve({value:t,done:!0});this._isFinished=!0;let r=this._reader;if(!this._preventCancel){let n=MF(r,t);return Sc(r),kc(n,()=>({value:t,done:!0}))}return Sc(r),rr({value:t,done:!0})}},jre={next(){return ore(this)?this._asyncIteratorImpl.next():nt(sre("next"))},return(e){return ore(this)?this._asyncIteratorImpl.return(e):nt(sre("return"))},[ix](){return this}};function ore(e){if(!En(e)||!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof Gw}catch{return!1}}function sre(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}Object.defineProperty(jre,ix,{enumerable:!1});var Lre=Number.isNaN||function(e){return e!=e};function ure(e){let t=Ire(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function CF(e){let t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function HF(e,t,r){if(typeof(n=r)!="number"||Lre(n)||n<0||r===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");var n;e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function Jl(e){e._queue=new Ai,e._queueTotalSize=0}function Mre(e){return e===DataView}var Wl=class{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!yF(this))throw _F("view");return this._view}respond(t){if(!yF(this))throw _F("respond");if(Cc(t,1,"respond"),t=UF(t,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if($p(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");Mw(this._associatedReadableByteStreamController,t)}respondWithNewView(t){if(!yF(this))throw _F("respondWithNewView");if(Cc(t,1,"respondWithNewView"),!ArrayBuffer.isView(t))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if($p(t.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");qw(this._associatedReadableByteStreamController,t)}};Object.defineProperties(Wl.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),tr(Wl.prototype.respond,"respond"),tr(Wl.prototype.respondWithNewView,"respondWithNewView"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Wl.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});var bu=class{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Up(this))throw Vv("byobRequest");return BF(this)}get desiredSize(){if(!Up(this))throw Vv("desiredSize");return Jre(this)}close(){if(!Up(this))throw Vv("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let t=this._controlledReadableByteStream._state;if(t!=="readable")throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be closed`);Kv(this)}enqueue(t){if(!Up(this))throw Vv("enqueue");if(Cc(t,1,"enqueue"),!ArrayBuffer.isView(t))throw new TypeError("chunk must be an array buffer view");if(t.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(t.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");let r=this._controlledReadableByteStream._state;if(r!=="readable")throw new TypeError(`The stream (in ${r} state) is not in the readable state and cannot be enqueued to`);Lw(this,t)}error(t=void 0){if(!Up(this))throw Vv("error");_o(this,t)}[RF](t){qre(this),Jl(this);let r=this._cancelAlgorithm(t);return Yw(this),r}[jF](t){let r=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void Kre(this,t);let n=this._autoAllocateChunkSize;if(n!==void 0){let a;try{a=new ArrayBuffer(n)}catch(o){return void t._errorSteps(o)}let i={buffer:a,bufferByteLength:n,byteOffset:0,byteLength:n,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(i)}Dre(r,t),Jp(this)}[LF](){if(this._pendingPullIntos.length>0){let t=this._pendingPullIntos.peek();t.readerType="none",this._pendingPullIntos=new Ai,this._pendingPullIntos.push(t)}}};function Up(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof bu}function yF(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof Wl}function Jp(e){if(function(r){let n=r._controlledReadableByteStream;return n._state!=="readable"||r._closeRequested||!r._started?!1:!!(Bre(n)&&Xw(n)>0||$F(n)&&Qre(n)>0||Jre(r)>0)}(e)){if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0,wi(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Jp(e)),null),r=>(_o(e,r),null))}}function qre(e){VF(e),e._pendingPullIntos=new Ai}function Nre(e,t){let r=!1;e._state==="closed"&&(r=!0);let n=Ure(t);t.readerType==="default"?GF(e,n,r):function(a,i,o){let s=a._reader,u=s._readIntoRequests.shift();o?u._closeSteps(i):u._chunkSteps(i)}(e,n,r)}function Rw(e,t){for(let r=0;r<t.length;++r)Nre(e,t[r])}function Ure(e){let t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function jw(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function zre(e,t,r,n){let a;try{a=Ire(t,r,r+n)}catch(i){throw _o(e,i),i}jw(e,a,0,n)}function Gre(e,t){t.bytesFilled>0&&zre(e,t.buffer,t.byteOffset,t.bytesFilled),x0(e)}function Hre(e,t){let r=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),n=t.bytesFilled+r,a=r,i=!1,o=n-n%t.elementSize;o>=t.minimumFill&&(a=o-t.bytesFilled,i=!0);let s=e._queue;for(;a>0;){let u=s.peek(),c=Math.min(a,u.byteLength),l=t.byteOffset+t.bytesFilled;Ore(t.buffer,l,u.buffer,u.byteOffset,c),u.byteLength===c?s.shift():(u.byteOffset+=c,u.byteLength-=c),e._queueTotalSize-=c,Vre(e,c,t),a-=c}return i}function Vre(e,t,r){r.bytesFilled+=t}function $re(e){e._queueTotalSize===0&&e._closeRequested?(Yw(e),ox(e._controlledReadableByteStream)):Jp(e)}function VF(e){e._byobRequest!==null&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function DF(e){let t=[];for(;e._pendingPullIntos.length>0&&e._queueTotalSize!==0;){let r=e._pendingPullIntos.peek();Hre(e,r)&&(x0(e),t.push(r))}return t}function x7e(e,t,r,n){let a=e._controlledReadableByteStream,i=t.constructor,o=function(p){return Mre(p)?1:p.BYTES_PER_ELEMENT}(i),{byteOffset:s,byteLength:u}=t,c=r*o,l;try{l=Vp(t.buffer)}catch(p){return void n._errorSteps(p)}let f={buffer:l,bufferByteLength:l.byteLength,byteOffset:s,byteLength:u,bytesFilled:0,minimumFill:c,elementSize:o,viewConstructor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(f),void cre(a,n);if(a._state==="closed"){let p=new i(f.buffer,f.byteOffset,0);return void n._closeSteps(p)}if(e._queueTotalSize>0){if(Hre(e,f)){let p=Ure(f);return $re(e),void n._chunkSteps(p)}if(e._closeRequested){let p=new TypeError("Insufficient bytes to fill elements in the given buffer");return _o(e,p),void n._errorSteps(p)}}e._pendingPullIntos.push(f),cre(a,n),Jp(e)}function Wre(e,t){let r=e._pendingPullIntos.peek();VF(e),e._controlledReadableByteStream._state==="closed"?function(n,a){a.readerType==="none"&&x0(n);let i=n._controlledReadableByteStream;if($F(i)){let o=[];for(;o.length<Qre(i);)o.push(x0(n));Rw(i,o)}}(e,r):function(n,a,i){if(Vre(0,a,i),i.readerType==="none"){Gre(n,i);let u=DF(n);return void Rw(n._controlledReadableByteStream,u)}if(i.bytesFilled<i.minimumFill)return;x0(n);let o=i.bytesFilled%i.elementSize;if(o>0){let u=i.byteOffset+i.bytesFilled;zre(n,i.buffer,u-o,o)}i.bytesFilled-=o;let s=DF(n);Nre(n._controlledReadableByteStream,i),Rw(n._controlledReadableByteStream,s)}(e,t,r),Jp(e)}function x0(e){return e._pendingPullIntos.shift()}function Yw(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function Kv(e){let t=e._controlledReadableByteStream;if(!e._closeRequested&&t._state==="readable")if(e._queueTotalSize>0)e._closeRequested=!0;else{if(e._pendingPullIntos.length>0){let r=e._pendingPullIntos.peek();if(r.bytesFilled%r.elementSize!==0){let n=new TypeError("Insufficient bytes to fill elements in the given buffer");throw _o(e,n),n}}Yw(e),ox(t)}}function Lw(e,t){let r=e._controlledReadableByteStream;if(e._closeRequested||r._state!=="readable")return;let{buffer:n,byteOffset:a,byteLength:i}=t;if($p(n))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");let o=Vp(n);if(e._pendingPullIntos.length>0){let s=e._pendingPullIntos.peek();if($p(s.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");VF(e),s.buffer=Vp(s.buffer),s.readerType==="none"&&Gre(e,s)}Bre(r)?(function(s){let u=s._controlledReadableByteStream._reader;for(;u._readRequests.length>0;){if(s._queueTotalSize===0)return;Kre(s,u._readRequests.shift())}}(e),Xw(r)===0?jw(e,o,a,i):(e._pendingPullIntos.length>0&&x0(e),GF(r,new Uint8Array(o,a,i),!1))):$F(r)?(jw(e,o,a,i),Rw(r,DF(e))):jw(e,o,a,i),Jp(e)}function _o(e,t){let r=e._controlledReadableByteStream;r._state==="readable"&&(qre(e),Jl(e),Yw(e),vne(r,t))}function Kre(e,t){let r=e._queue.shift();e._queueTotalSize-=r.byteLength,$re(e);let n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(n)}function BF(e){if(e._byobRequest===null&&e._pendingPullIntos.length>0){let t=e._pendingPullIntos.peek(),r=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),n=Object.create(Wl.prototype);(function(a,i,o){a._associatedReadableByteStreamController=i,a._view=o})(n,e,r),e._byobRequest=n}return e._byobRequest}function Jre(e){let t=e._controlledReadableByteStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function Mw(e,t){let r=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state==="closed"){if(t!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(t===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range")}r.buffer=Vp(r.buffer),Wre(e,t)}function qw(e,t){let r=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state==="closed"){if(t.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(t.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.bufferByteLength!==t.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(r.bytesFilled+t.byteLength>r.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let n=t.byteLength;r.buffer=Vp(t.buffer),Wre(e,n)}function Xre(e,t,r,n,a,i,o){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,Jl(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=a,t._autoAllocateChunkSize=o,t._pendingPullIntos=new Ai,e._readableStreamController=t,wi(rr(r()),()=>(t._started=!0,Jp(t),null),s=>(_o(t,s),null))}function _F(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function Vv(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function y7e(e,t){if((e=`${e}`)!="byob")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function Yre(e){return new Ac(e)}function cre(e,t){e._reader._readIntoRequests.push(t)}function Qre(e){return e._reader._readIntoRequests.length}function $F(e){let t=e._reader;return t!==void 0&&!!zp(t)}Object.defineProperties(bu.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),tr(bu.prototype.close,"close"),tr(bu.prototype.enqueue,"enqueue"),tr(bu.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(bu.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});var Ac=class{constructor(t){if(Cc(t,1,"ReadableStreamBYOBReader"),zF(t,"First parameter"),Kl(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Up(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");Tre(this,t),this._readIntoRequests=new Ai}get closed(){return zp(this)?this._closedPromise:nt(Cw("closed"))}cancel(t=void 0){return zp(this)?this._ownerReadableStream===void 0?nt(zw("cancel")):MF(this,t):nt(Cw("cancel"))}read(t,r={}){if(!zp(this))return nt(Cw("read"));if(!ArrayBuffer.isView(t))return nt(new TypeError("view must be an array buffer view"));if(t.byteLength===0)return nt(new TypeError("view must have non-zero byteLength"));if(t.buffer.byteLength===0)return nt(new TypeError("view's buffer must have non-zero byteLength"));if($p(t.buffer))return nt(new TypeError("view's buffer has been detached"));let n;try{n=function(u,c){var l;return yu(u,c),{min:UF((l=u==null?void 0:u.min)!==null&&l!==void 0?l:1,`${c} has member 'min' that`)}}(r,"options")}catch(u){return nt(u)}let a=n.min;if(a===0)return nt(new TypeError("options.min must be greater than 0"));if(function(u){return Mre(u.constructor)}(t)){if(a>t.byteLength)return nt(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(a>t.length)return nt(new RangeError("options.min must be less than or equal to view's length"));if(this._ownerReadableStream===void 0)return nt(zw("read from"));let i,o,s=Rn((u,c)=>{i=u,o=c});return Zre(this,t,a,{_chunkSteps:u=>i({value:u,done:!1}),_closeSteps:u=>i({value:u,done:!0}),_errorSteps:u=>o(u)}),s}releaseLock(){if(!zp(this))throw Cw("releaseLock");this._ownerReadableStream!==void 0&&function(t){Sc(t);let r=new TypeError("Reader was released");ene(t,r)}(this)}};function zp(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof Ac}function Zre(e,t,r,n){let a=e._ownerReadableStream;a._disturbed=!0,a._state==="errored"?n._errorSteps(a._storedError):x7e(a._readableStreamController,t,r,n)}function ene(e,t){let r=e._readIntoRequests;e._readIntoRequests=new Ai,r.forEach(n=>{n._errorSteps(t)})}function Cw(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function Qv(e,t){let{highWaterMark:r}=e;if(r===void 0)return t;if(Lre(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function Hw(e){let{size:t}=e;return t||(()=>1)}function Vw(e,t){yu(e,t);let r=e==null?void 0:e.highWaterMark,n=e==null?void 0:e.size;return{highWaterMark:r===void 0?void 0:NF(r),size:n===void 0?void 0:_7e(n,`${t} has member 'size' that`)}}function _7e(e,t){return wo(e,t),r=>NF(e(r))}function w7e(e,t,r){return wo(e,r),n=>Dc(e,t,[n])}function A7e(e,t,r){return wo(e,r),()=>Dc(e,t,[])}function E7e(e,t,r){return wo(e,r),n=>Hp(e,t,[n])}function T7e(e,t,r){return wo(e,r),(n,a)=>Dc(e,t,[n,a])}function tne(e,t){if(!b0(e))throw new TypeError(`${t} is not a WritableStream.`)}Object.defineProperties(Ac.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),tr(Ac.prototype.cancel,"cancel"),tr(Ac.prototype.read,"read"),tr(Ac.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Ac.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});var Ec=class{constructor(t={},r={}){t===void 0?t=null:Cre(t,"First parameter");let n=Vw(r,"Second parameter"),a=function(o,s){yu(o,s);let u=o==null?void 0:o.abort,c=o==null?void 0:o.close,l=o==null?void 0:o.start,f=o==null?void 0:o.type,p=o==null?void 0:o.write;return{abort:u===void 0?void 0:w7e(u,o,`${s} has member 'abort' that`),close:c===void 0?void 0:A7e(c,o,`${s} has member 'close' that`),start:l===void 0?void 0:E7e(l,o,`${s} has member 'start' that`),write:p===void 0?void 0:T7e(p,o,`${s} has member 'write' that`),type:f}}(t,"First parameter");if(nne(this),a.type!==void 0)throw new RangeError("Invalid type is specified");let i=Hw(n);(function(o,s,u,c){let l=Object.create(Wp.prototype),f,p,d,h;f=s.start!==void 0?()=>s.start(l):()=>{},p=s.write!==void 0?m=>s.write(m,l):()=>rr(void 0),d=s.close!==void 0?()=>s.close():()=>rr(void 0),h=s.abort!==void 0?m=>s.abort(m):()=>rr(void 0),lne(o,l,f,p,d,h,u,c)})(this,a,Qv(n,1),i)}get locked(){if(!b0(this))throw Bw("locked");return y0(this)}abort(t=void 0){return b0(this)?y0(this)?nt(new TypeError("Cannot abort a stream that already has a writer")):$w(this,t):nt(Bw("abort"))}close(){return b0(this)?y0(this)?nt(new TypeError("Cannot close a stream that already has a writer")):_u(this)?nt(new TypeError("Cannot close an already-closing stream")):ane(this):nt(Bw("close"))}getWriter(){if(!b0(this))throw Bw("getWriter");return rne(this)}};function rne(e){return new gu(e)}function nne(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new Ai,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function b0(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof Ec}function y0(e){return e._writer!==void 0}function $w(e,t){var r;if(e._state==="closed"||e._state==="errored")return rr(void 0);e._writableStreamController._abortReason=t,(r=e._writableStreamController._abortController)===null||r===void 0||r.abort(t);let n=e._state;if(n==="closed"||n==="errored")return rr(void 0);if(e._pendingAbortRequest!==void 0)return e._pendingAbortRequest._promise;let a=!1;n==="erroring"&&(a=!0,t=void 0);let i=Rn((o,s)=>{e._pendingAbortRequest={_promise:void 0,_resolve:o,_reject:s,_reason:t,_wasAlreadyErroring:a}});return e._pendingAbortRequest._promise=i,a||WF(e,t),i}function ane(e){let t=e._state;if(t==="closed"||t==="errored")return nt(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));let r=Rn((i,o)=>{let s={_resolve:i,_reject:o};e._closeRequest=s}),n=e._writer;var a;return n!==void 0&&e._backpressure&&t==="writable"&&QF(n),HF(a=e._writableStreamController,cne,0),Qw(a),r}function FF(e,t){e._state!=="writable"?KF(e):WF(e,t)}function WF(e,t){let r=e._writableStreamController;e._state="erroring",e._storedError=t;let n=e._writer;n!==void 0&&one(n,t),!function(a){return!(a._inFlightWriteRequest===void 0&&a._inFlightCloseRequest===void 0)}(e)&&r._started&&KF(e)}function KF(e){e._state="errored",e._writableStreamController[Ere]();let t=e._storedError;if(e._writeRequests.forEach(n=>{n._reject(t)}),e._writeRequests=new Ai,e._pendingAbortRequest===void 0)return void Dw(e);let r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void Dw(e);wi(e._writableStreamController[Are](r._reason),()=>(r._resolve(),Dw(e),null),n=>(r._reject(n),Dw(e),null))}function _u(e){return e._closeRequest!==void 0||e._inFlightCloseRequest!==void 0}function Dw(e){e._closeRequest!==void 0&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);let t=e._writer;t!==void 0&&YF(t,e._storedError)}function JF(e,t){let r=e._writer;r!==void 0&&t!==e._backpressure&&(t?function(n){Zw(n)}(r):QF(r)),e._backpressure=t}Object.defineProperties(Ec.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),tr(Ec.prototype.abort,"abort"),tr(Ec.prototype.close,"close"),tr(Ec.prototype.getWriter,"getWriter"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Ec.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});var gu=class{constructor(t){if(Cc(t,1,"WritableStreamDefaultWriter"),tne(t,"First parameter"),y0(t))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=t,t._writer=this;let r=t._state;if(r==="writable")!_u(t)&&t._backpressure?Zw(this):lre(this),Nw(this);else if(r==="erroring")OF(this,t._storedError),Nw(this);else if(r==="closed")lre(this),Nw(n=this),hne(n);else{let a=t._storedError;OF(this,a),dne(this,a)}var n}get closed(){return Mp(this)?this._closedPromise:nt(qp("closed"))}get desiredSize(){if(!Mp(this))throw qp("desiredSize");if(this._ownerWritableStream===void 0)throw Jv("desiredSize");return function(t){let r=t._ownerWritableStream,n=r._state;return n==="errored"||n==="erroring"?null:n==="closed"?0:fne(r._writableStreamController)}(this)}get ready(){return Mp(this)?this._readyPromise:nt(qp("ready"))}abort(t=void 0){return Mp(this)?this._ownerWritableStream===void 0?nt(Jv("abort")):function(r,n){return $w(r._ownerWritableStream,n)}(this,t):nt(qp("abort"))}close(){if(!Mp(this))return nt(qp("close"));let t=this._ownerWritableStream;return t===void 0?nt(Jv("close")):_u(t)?nt(new TypeError("Cannot close an already-closing stream")):ine(this)}releaseLock(){if(!Mp(this))throw qp("releaseLock");this._ownerWritableStream!==void 0&&sne(this)}write(t=void 0){return Mp(this)?this._ownerWritableStream===void 0?nt(Jv("write to")):une(this,t):nt(qp("write"))}};function Mp(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof gu}function ine(e){return ane(e._ownerWritableStream)}function S7e(e,t){e._closedPromiseState==="pending"?YF(e,t):function(r,n){dne(r,n)}(e,t)}function one(e,t){e._readyPromiseState==="pending"?mne(e,t):function(r,n){OF(r,n)}(e,t)}function sne(e){let t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");one(e,r),S7e(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function une(e,t){let r=e._ownerWritableStream,n=r._writableStreamController,a=function(s,u){if(s._strategySizeAlgorithm===void 0)return 1;try{return s._strategySizeAlgorithm(u)}catch(c){return Zv(s,c),1}}(n,t);if(r!==e._ownerWritableStream)return nt(Jv("write to"));let i=r._state;if(i==="errored")return nt(r._storedError);if(_u(r)||i==="closed")return nt(new TypeError("The stream is closing or closed and cannot be written to"));if(i==="erroring")return nt(r._storedError);let o=function(s){return Rn((u,c)=>{let l={_resolve:u,_reject:c};s._writeRequests.push(l)})}(r);return function(s,u,c){try{HF(s,u,c)}catch(f){return void Zv(s,f)}let l=s._controlledWritableStream;!_u(l)&&l._state==="writable"&&JF(l,XF(s)),Qw(s)}(n,t,a),o}Object.defineProperties(gu.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),tr(gu.prototype.abort,"abort"),tr(gu.prototype.close,"close"),tr(gu.prototype.releaseLock,"releaseLock"),tr(gu.prototype.write,"write"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(gu.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});var cne={},Wp=class{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!wF(this))throw AF("abortReason");return this._abortReason}get signal(){if(!wF(this))throw AF("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(t=void 0){if(!wF(this))throw AF("error");this._controlledWritableStream._state==="writable"&&pne(this,t)}[Are](t){let r=this._abortAlgorithm(t);return Ww(this),r}[Ere](){Jl(this)}};function wF(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof Wp}function lne(e,t,r,n,a,i,o,s){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,Jl(t),t._abortReason=void 0,t._abortController=function(){if(typeof AbortController=="function")return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=s,t._strategyHWM=o,t._writeAlgorithm=n,t._closeAlgorithm=a,t._abortAlgorithm=i;let u=XF(t);JF(e,u),wi(rr(r()),()=>(t._started=!0,Qw(t),null),c=>(t._started=!0,FF(e,c),null))}function Ww(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function fne(e){return e._strategyHWM-e._queueTotalSize}function Qw(e){let t=e._controlledWritableStream;if(!e._started||t._inFlightWriteRequest!==void 0)return;if(t._state==="erroring")return void KF(t);if(e._queue.length===0)return;let r=e._queue.peek().value;r===cne?function(n){let a=n._controlledWritableStream;(function(o){o._inFlightCloseRequest=o._closeRequest,o._closeRequest=void 0})(a),CF(n);let i=n._closeAlgorithm();Ww(n),wi(i,()=>(function(o){o._inFlightCloseRequest._resolve(void 0),o._inFlightCloseRequest=void 0,o._state==="erroring"&&(o._storedError=void 0,o._pendingAbortRequest!==void 0&&(o._pendingAbortRequest._resolve(),o._pendingAbortRequest=void 0)),o._state="closed";let s=o._writer;s!==void 0&&hne(s)}(a),null),o=>(function(s,u){s._inFlightCloseRequest._reject(u),s._inFlightCloseRequest=void 0,s._pendingAbortRequest!==void 0&&(s._pendingAbortRequest._reject(u),s._pendingAbortRequest=void 0),FF(s,u)}(a,o),null))}(e):function(n,a){let i=n._controlledWritableStream;(function(s){s._inFlightWriteRequest=s._writeRequests.shift()})(i);let o=n._writeAlgorithm(a);wi(o,()=>{(function(u){u._inFlightWriteRequest._resolve(void 0),u._inFlightWriteRequest=void 0})(i);let s=i._state;if(CF(n),!_u(i)&&s==="writable"){let u=XF(n);JF(i,u)}return Qw(n),null},s=>(i._state==="writable"&&Ww(n),function(u,c){u._inFlightWriteRequest._reject(c),u._inFlightWriteRequest=void 0,FF(u,c)}(i,s),null))}(e,r)}function Zv(e,t){e._controlledWritableStream._state==="writable"&&pne(e,t)}function XF(e){return fne(e)<=0}function pne(e,t){let r=e._controlledWritableStream;Ww(e),WF(r,t)}function Bw(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function AF(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function qp(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function Jv(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function Nw(e){e._closedPromise=Rn((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"})}function dne(e,t){Nw(e),YF(e,t)}function YF(e,t){e._closedPromise_reject!==void 0&&(A0(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function hne(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function Zw(e){e._readyPromise=Rn((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r}),e._readyPromiseState="pending"}function OF(e,t){Zw(e),mne(e,t)}function lre(e){Zw(e),QF(e)}function mne(e,t){e._readyPromise_reject!==void 0&&(A0(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function QF(e){e._readyPromise_resolve!==void 0&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}Object.defineProperties(Wp.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Wp.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});var fre=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof global<"u"?global:void 0,k7e=function(){let e=fre==null?void 0:fre.DOMException;return function(t){if(typeof t!="function"&&typeof t!="object"||t.name!=="DOMException")return!1;try{return new t,!0}catch{return!1}}(e)?e:void 0}()||function(){let e=function(t,r){this.message=t||"",this.name=r||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return tr(e,"DOMException"),e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function pre(e,t,r,n,a,i){let o=v0(e),s=rne(t);e._disturbed=!0;let u=!1,c=rr(void 0);return Rn((l,f)=>{let p;if(i!==void 0){if(p=()=>{let A=i.reason!==void 0?i.reason:new k7e("Aborted","AbortError"),B=[];n||B.push(()=>t._state==="writable"?$w(t,A):rr(void 0)),a||B.push(()=>e._state==="readable"?hs(e,A):rr(void 0)),y(()=>Promise.all(B.map(I=>I())),!0,A)},i.aborted)return void p();i.addEventListener("abort",p)}var d,h,m;if(x(e,o._closedPromise,A=>(n?w(!0,A):y(()=>$w(t,A),!0,A),null)),x(t,s._closedPromise,A=>(a?w(!0,A):y(()=>hs(e,A),!0,A),null)),d=e,h=o._closedPromise,m=()=>(r?w():y(()=>function(A){let B=A._ownerWritableStream,I=B._state;return _u(B)||I==="closed"?rr(void 0):I==="errored"?nt(B._storedError):ine(A)}(s)),null),d._state==="closed"?m():gF(h,m),_u(t)||t._state==="closed"){let A=new TypeError("the destination writable stream closed before all data could be piped to it");a?w(!0,A):y(()=>hs(e,A),!0,A)}function g(){let A=c;return xu(c,()=>A!==c?g():void 0)}function x(A,B,I){A._state==="errored"?I(A._storedError):TF(B,I)}function y(A,B,I){function L(){return wi(A(),()=>T(B,I),C=>T(!0,C)),null}u||(u=!0,t._state!=="writable"||_u(t)?L():gF(g(),L))}function w(A,B){u||(u=!0,t._state!=="writable"||_u(t)?T(A,B):gF(g(),()=>T(A,B)))}function T(A,B){return sne(s),Sc(o),i!==void 0&&i.removeEventListener("abort",p),A?f(B):l(void 0),null}A0(Rn((A,B)=>{(function I(L){L?A():xu(u?rr(!0):xu(s._readyPromise,()=>Rn((C,k)=>{Yv(o,{_chunkSteps:F=>{c=xu(une(s,F),void 0,Xv),C(!1)},_closeSteps:()=>C(!0),_errorSteps:k})})),I,B)})(!1)}))})}var vu=class{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Fw(this))throw Ow("desiredSize");return ZF(this)}close(){if(!Fw(this))throw Ow("close");if(!w0(this))throw new TypeError("The stream is not in a state that permits close");Kp(this)}enqueue(t=void 0){if(!Fw(this))throw Ow("enqueue");if(!w0(this))throw new TypeError("The stream is not in a state that permits enqueue");return _0(this,t)}error(t=void 0){if(!Fw(this))throw Ow("error");ms(this,t)}[RF](t){Jl(this);let r=this._cancelAlgorithm(t);return Kw(this),r}[jF](t){let r=this._controlledReadableStream;if(this._queue.length>0){let n=CF(this);this._closeRequested&&this._queue.length===0?(Kw(this),ox(r)):ex(this),t._chunkSteps(n)}else Dre(r,t),ex(this)}[LF](){}};function Fw(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")&&e instanceof vu}function ex(e){if(gne(e)){if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0,wi(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,ex(e)),null),t=>(ms(e,t),null))}}function gne(e){let t=e._controlledReadableStream;return!w0(e)||!e._started?!1:Kl(t)&&Xw(t)>0?!0:ZF(e)>0}function Kw(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Kp(e){if(!w0(e))return;let t=e._controlledReadableStream;e._closeRequested=!0,e._queue.length===0&&(Kw(e),ox(t))}function _0(e,t){if(!w0(e))return;let r=e._controlledReadableStream;if(Kl(r)&&Xw(r)>0)GF(r,t,!1);else{let n;try{n=e._strategySizeAlgorithm(t)}catch(a){throw ms(e,a),a}try{HF(e,t,n)}catch(a){throw ms(e,a),a}}ex(e)}function ms(e,t){let r=e._controlledReadableStream;r._state==="readable"&&(Jl(e),Kw(e),vne(r,t))}function ZF(e){let t=e._controlledReadableStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function w0(e){let t=e._controlledReadableStream._state;return!e._closeRequested&&t==="readable"}function bne(e,t,r,n,a,i,o){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,Jl(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=o,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=a,e._readableStreamController=t,wi(rr(r()),()=>(t._started=!0,ex(t),null),s=>(ms(t,s),null))}function Ow(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function C7e(e,t){return Up(e._readableStreamController)?function(r){let n,a,i,o,s,u=v0(r),c=!1,l=!1,f=!1,p=!1,d=!1,h=Rn(I=>{s=I});function m(I){TF(I._closedPromise,L=>(I!==u||(_o(i._readableStreamController,L),_o(o._readableStreamController,L),p&&d||s(void 0)),null))}function g(){zp(u)&&(Sc(u),u=v0(r),m(u)),Yv(u,{_chunkSteps:I=>{Gp(()=>{l=!1,f=!1;let L=I,C=I;if(!p&&!d)try{C=ure(I)}catch(k){return _o(i._readableStreamController,k),_o(o._readableStreamController,k),void s(hs(r,k))}p||Lw(i._readableStreamController,L),d||Lw(o._readableStreamController,C),c=!1,l?y():f&&w()})},_closeSteps:()=>{c=!1,p||Kv(i._readableStreamController),d||Kv(o._readableStreamController),i._readableStreamController._pendingPullIntos.length>0&&Mw(i._readableStreamController,0),o._readableStreamController._pendingPullIntos.length>0&&Mw(o._readableStreamController,0),p&&d||s(void 0)},_errorSteps:()=>{c=!1}})}function x(I,L){$l(u)&&(Sc(u),u=Yre(r),m(u));let C=L?o:i,k=L?i:o;Zre(u,I,1,{_chunkSteps:F=>{Gp(()=>{l=!1,f=!1;let R=L?d:p;if(L?p:d)R||qw(C._readableStreamController,F);else{let G;try{G=ure(F)}catch(z){return _o(C._readableStreamController,z),_o(k._readableStreamController,z),void s(hs(r,z))}R||qw(C._readableStreamController,F),Lw(k._readableStreamController,G)}c=!1,l?y():f&&w()})},_closeSteps:F=>{c=!1;let R=L?d:p,G=L?p:d;R||Kv(C._readableStreamController),G||Kv(k._readableStreamController),F!==void 0&&(R||qw(C._readableStreamController,F),!G&&k._readableStreamController._pendingPullIntos.length>0&&Mw(k._readableStreamController,0)),R&&G||s(void 0)},_errorSteps:()=>{c=!1}})}function y(){if(c)return l=!0,rr(void 0);c=!0;let I=BF(i._readableStreamController);return I===null?g():x(I._view,!1),rr(void 0)}function w(){if(c)return f=!0,rr(void 0);c=!0;let I=BF(o._readableStreamController);return I===null?g():x(I._view,!0),rr(void 0)}function T(I){if(p=!0,n=I,d){let L=$v([n,a]),C=hs(r,L);s(C)}return h}function A(I){if(d=!0,a=I,p){let L=$v([n,a]),C=hs(r,L);s(C)}return h}function B(){}return i=hre(B,y,T),o=hre(B,w,A),m(u),[i,o]}(e):function(r){let n=v0(r),a,i,o,s,u,c=!1,l=!1,f=!1,p=!1,d=Rn(y=>{u=y});function h(){return c?(l=!0,rr(void 0)):(c=!0,Yv(n,{_chunkSteps:y=>{Gp(()=>{l=!1;let w=y,T=y;f||_0(o._readableStreamController,w),p||_0(s._readableStreamController,T),c=!1,l&&h()})},_closeSteps:()=>{c=!1,f||Kp(o._readableStreamController),p||Kp(s._readableStreamController),f&&p||u(void 0)},_errorSteps:()=>{c=!1}}),rr(void 0))}function m(y){if(f=!0,a=y,p){let w=$v([a,i]),T=hs(r,w);u(T)}return d}function g(y){if(p=!0,i=y,f){let w=$v([a,i]),T=hs(r,w);u(T)}return d}function x(){}return o=tx(x,h,m),s=tx(x,h,g),TF(n._closedPromise,y=>(ms(o._readableStreamController,y),ms(s._readableStreamController,y),f&&p||u(void 0),null)),[o,s]}(e)}function D7e(e){return En(t=e)&&t.getReader!==void 0?function(r){let n;function a(){let o;try{o=r.read()}catch(s){return nt(s)}return kc(o,s=>{if(!En(s))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(s.done)Kp(n._readableStreamController);else{let u=s.value;_0(n._readableStreamController,u)}})}function i(o){try{return rr(r.cancel(o))}catch(s){return nt(s)}}return n=tx(Xv,a,i,0),n}(e.getReader()):function(r){let n,a=Pre(r,"async");function i(){let s;try{s=Rre(a)}catch(u){return nt(u)}return kc(rr(s),u=>{if(!En(u))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(u.done)Kp(n._readableStreamController);else{let c=u.value;_0(n._readableStreamController,c)}})}function o(s){let u=a.iterator,c;try{c=Wv(u,"return")}catch(l){return nt(l)}return c===void 0?rr(void 0):kc(Dc(c,u,[s]),l=>{if(!En(l))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")})}return n=tx(Xv,i,o,0),n}(e);var t}function B7e(e,t,r){return wo(e,r),n=>Dc(e,t,[n])}function F7e(e,t,r){return wo(e,r),n=>Dc(e,t,[n])}function O7e(e,t,r){return wo(e,r),n=>Hp(e,t,[n])}function I7e(e,t){if((e=`${e}`)!="bytes")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function dre(e,t){yu(e,t);let r=e==null?void 0:e.preventAbort,n=e==null?void 0:e.preventCancel,a=e==null?void 0:e.preventClose,i=e==null?void 0:e.signal;return i!==void 0&&function(o,s){if(!function(u){if(typeof u!="object"||u===null)return!1;try{return typeof u.aborted=="boolean"}catch{return!1}}(o))throw new TypeError(`${s} is not an AbortSignal.`)}(i,`${t} has member 'signal' that`),{preventAbort:Boolean(r),preventCancel:Boolean(n),preventClose:Boolean(a),signal:i}}Object.defineProperties(vu.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),tr(vu.prototype.close,"close"),tr(vu.prototype.enqueue,"enqueue"),tr(vu.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(vu.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});var Kn=class{constructor(t={},r={}){t===void 0?t=null:Cre(t,"First parameter");let n=Vw(r,"Second parameter"),a=function(i,o){yu(i,o);let s=i,u=s==null?void 0:s.autoAllocateChunkSize,c=s==null?void 0:s.cancel,l=s==null?void 0:s.pull,f=s==null?void 0:s.start,p=s==null?void 0:s.type;return{autoAllocateChunkSize:u===void 0?void 0:UF(u,`${o} has member 'autoAllocateChunkSize' that`),cancel:c===void 0?void 0:B7e(c,s,`${o} has member 'cancel' that`),pull:l===void 0?void 0:F7e(l,s,`${o} has member 'pull' that`),start:f===void 0?void 0:O7e(f,s,`${o} has member 'start' that`),type:p===void 0?void 0:I7e(p,`${o} has member 'type' that`)}}(t,"First parameter");if(eO(this),a.type==="bytes"){if(n.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");(function(i,o,s){let u=Object.create(bu.prototype),c,l,f;c=o.start!==void 0?()=>o.start(u):()=>{},l=o.pull!==void 0?()=>o.pull(u):()=>rr(void 0),f=o.cancel!==void 0?d=>o.cancel(d):()=>rr(void 0);let p=o.autoAllocateChunkSize;if(p===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");Xre(i,u,c,l,f,s,p)})(this,a,Qv(n,0))}else{let i=Hw(n);(function(o,s,u,c){let l=Object.create(vu.prototype),f,p,d;f=s.start!==void 0?()=>s.start(l):()=>{},p=s.pull!==void 0?()=>s.pull(l):()=>rr(void 0),d=s.cancel!==void 0?h=>s.cancel(h):()=>rr(void 0),bne(o,l,f,p,d,u,c)})(this,a,Qv(n,1),i)}}get locked(){if(!Vl(this))throw Np("locked");return Kl(this)}cancel(t=void 0){return Vl(this)?Kl(this)?nt(new TypeError("Cannot cancel a stream that already has a reader")):hs(this,t):nt(Np("cancel"))}getReader(t=void 0){if(!Vl(this))throw Np("getReader");return function(r,n){yu(r,n);let a=r==null?void 0:r.mode;return{mode:a===void 0?void 0:y7e(a,`${n} has member 'mode' that`)}}(t,"First parameter").mode===void 0?v0(this):Yre(this)}pipeThrough(t,r={}){if(!Vl(this))throw Np("pipeThrough");Cc(t,1,"pipeThrough");let n=function(i,o){yu(i,o);let s=i==null?void 0:i.readable;kF(s,"readable","ReadableWritablePair"),zF(s,`${o} has member 'readable' that`);let u=i==null?void 0:i.writable;return kF(u,"writable","ReadableWritablePair"),tne(u,`${o} has member 'writable' that`),{readable:s,writable:u}}(t,"First parameter"),a=dre(r,"Second parameter");if(Kl(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(y0(n.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return A0(pre(this,n.writable,a.preventClose,a.preventAbort,a.preventCancel,a.signal)),n.readable}pipeTo(t,r={}){if(!Vl(this))return nt(Np("pipeTo"));if(t===void 0)return nt("Parameter 1 is required in 'pipeTo'.");if(!b0(t))return nt(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let n;try{n=dre(r,"Second parameter")}catch(a){return nt(a)}return Kl(this)?nt(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):y0(t)?nt(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):pre(this,t,n.preventClose,n.preventAbort,n.preventCancel,n.signal)}tee(){if(!Vl(this))throw Np("tee");return $v(C7e(this))}values(t=void 0){if(!Vl(this))throw Np("values");return function(r,n){let a=v0(r),i=new Gw(a,n),o=Object.create(jre);return o._asyncIteratorImpl=i,o}(this,function(r,n){yu(r,n);let a=r==null?void 0:r.preventCancel;return{preventCancel:Boolean(a)}}(t,"First parameter").preventCancel)}[ix](t){return this.values(t)}static from(t){return D7e(t)}};function tx(e,t,r,n=1,a=()=>1){let i=Object.create(Kn.prototype);return eO(i),bne(i,Object.create(vu.prototype),e,t,r,n,a),i}function hre(e,t,r){let n=Object.create(Kn.prototype);return eO(n),Xre(n,Object.create(bu.prototype),e,t,r,0,void 0),n}function eO(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function Vl(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")&&e instanceof Kn}function Kl(e){return e._reader!==void 0}function hs(e,t){if(e._disturbed=!0,e._state==="closed")return rr(void 0);if(e._state==="errored")return nt(e._storedError);ox(e);let r=e._reader;if(r!==void 0&&zp(r)){let n=r._readIntoRequests;r._readIntoRequests=new Ai,n.forEach(a=>{a._closeSteps(void 0)})}return kc(e._readableStreamController[RF](t),Xv)}function ox(e){e._state="closed";let t=e._reader;if(t!==void 0&&(kre(t),$l(t))){let r=t._readRequests;t._readRequests=new Ai,r.forEach(n=>{n._closeSteps()})}}function vne(e,t){e._state="errored",e._storedError=t;let r=e._reader;r!==void 0&&(qF(r,t),$l(r)?Fre(r,t):ene(r,t))}function Np(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function xne(e,t){yu(e,t);let r=e==null?void 0:e.highWaterMark;return kF(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:NF(r)}}Object.defineProperties(Kn,{from:{enumerable:!0}}),Object.defineProperties(Kn.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),tr(Kn.from,"from"),tr(Kn.prototype.cancel,"cancel"),tr(Kn.prototype.getReader,"getReader"),tr(Kn.prototype.pipeThrough,"pipeThrough"),tr(Kn.prototype.pipeTo,"pipeTo"),tr(Kn.prototype.tee,"tee"),tr(Kn.prototype.values,"values"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Kn.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(Kn.prototype,ix,{value:Kn.prototype.values,writable:!0,configurable:!0});var yne=e=>e.byteLength;tr(yne,"size");var rx=class{constructor(t){Cc(t,1,"ByteLengthQueuingStrategy"),t=xne(t,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!gre(this))throw mre("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!gre(this))throw mre("size");return yne}};function mre(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function gre(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")&&e instanceof rx}Object.defineProperties(rx.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(rx.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});var _ne=()=>1;tr(_ne,"size");var nx=class{constructor(t){Cc(t,1,"CountQueuingStrategy"),t=xne(t,"First parameter"),this._countQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!vre(this))throw bre("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!vre(this))throw bre("size");return _ne}};function bre(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function vre(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")&&e instanceof nx}function P7e(e,t,r){return wo(e,r),n=>Dc(e,t,[n])}function R7e(e,t,r){return wo(e,r),n=>Hp(e,t,[n])}function j7e(e,t,r){return wo(e,r),(n,a)=>Dc(e,t,[n,a])}function L7e(e,t,r){return wo(e,r),n=>Dc(e,t,[n])}Object.defineProperties(nx.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(nx.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});var ax=class{constructor(t={},r={},n={}){t===void 0&&(t=null);let a=Vw(r,"Second parameter"),i=Vw(n,"Third parameter"),o=function(p,d){yu(p,d);let h=p==null?void 0:p.cancel,m=p==null?void 0:p.flush,g=p==null?void 0:p.readableType,x=p==null?void 0:p.start,y=p==null?void 0:p.transform,w=p==null?void 0:p.writableType;return{cancel:h===void 0?void 0:L7e(h,p,`${d} has member 'cancel' that`),flush:m===void 0?void 0:P7e(m,p,`${d} has member 'flush' that`),readableType:g,start:x===void 0?void 0:R7e(x,p,`${d} has member 'start' that`),transform:y===void 0?void 0:j7e(y,p,`${d} has member 'transform' that`),writableType:w}}(t,"First parameter");if(o.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(o.writableType!==void 0)throw new RangeError("Invalid writableType specified");let s=Qv(i,0),u=Hw(i),c=Qv(a,1),l=Hw(a),f;(function(p,d,h,m,g,x){function y(){return d}function w(L){return function(C,k){let F=C._transformStreamController;return C._backpressure?kc(C._backpressureChangePromise,()=>{let R=C._writable;if(R._state==="erroring")throw R._storedError;return yre(F,k)}):yre(F,k)}(p,L)}function T(L){return function(C,k){let F=C._transformStreamController;if(F._finishPromise!==void 0)return F._finishPromise;let R=C._readable;F._finishPromise=Rn((z,W)=>{F._finishPromise_resolve=z,F._finishPromise_reject=W});let G=F._cancelAlgorithm(k);return Uw(F),wi(G,()=>(R._state==="errored"?g0(F,R._storedError):(ms(R._readableStreamController,k),EF(F)),null),z=>(ms(R._readableStreamController,z),g0(F,z),null)),F._finishPromise}(p,L)}function A(){return function(L){let C=L._transformStreamController;if(C._finishPromise!==void 0)return C._finishPromise;let k=L._readable;C._finishPromise=Rn((R,G)=>{C._finishPromise_resolve=R,C._finishPromise_reject=G});let F=C._flushAlgorithm();return Uw(C),wi(F,()=>(k._state==="errored"?g0(C,k._storedError):(Kp(k._readableStreamController),EF(C)),null),R=>(ms(k._readableStreamController,R),g0(C,R),null)),C._finishPromise}(p)}function B(){return function(L){return Jw(L,!1),L._backpressureChangePromise}(p)}function I(L){return function(C,k){let F=C._transformStreamController;if(F._finishPromise!==void 0)return F._finishPromise;let R=C._writable;F._finishPromise=Rn((z,W)=>{F._finishPromise_resolve=z,F._finishPromise_reject=W});let G=F._cancelAlgorithm(k);return Uw(F),wi(G,()=>(R._state==="errored"?g0(F,R._storedError):(Zv(R._writableStreamController,k),IF(C),EF(F)),null),z=>(Zv(R._writableStreamController,z),IF(C),g0(F,z),null)),F._finishPromise}(p,L)}p._writable=function(L,C,k,F,R=1,G=()=>1){let z=Object.create(Ec.prototype);return nne(z),lne(z,Object.create(Wp.prototype),L,C,k,F,R,G),z}(y,w,A,T,h,m),p._readable=tx(y,B,I,g,x),p._backpressure=void 0,p._backpressureChangePromise=void 0,p._backpressureChangePromise_resolve=void 0,Jw(p,!0),p._transformStreamController=void 0})(this,Rn(p=>{f=p}),c,l,s,u),function(p,d){let h=Object.create(Tc.prototype),m,g,x;m=d.transform!==void 0?y=>d.transform(y,h):y=>{try{return Ane(h,y),rr(void 0)}catch(w){return nt(w)}},g=d.flush!==void 0?()=>d.flush(h):()=>rr(void 0),x=d.cancel!==void 0?y=>d.cancel(y):()=>rr(void 0),function(y,w,T,A,B){w._controlledTransformStream=y,y._transformStreamController=w,w._transformAlgorithm=T,w._flushAlgorithm=A,w._cancelAlgorithm=B,w._finishPromise=void 0,w._finishPromise_resolve=void 0,w._finishPromise_reject=void 0}(p,h,m,g,x)}(this,o),o.start!==void 0?f(o.start(this._transformStreamController)):f(void 0)}get readable(){if(!xre(this))throw _re("readable");return this._readable}get writable(){if(!xre(this))throw _re("writable");return this._writable}};function xre(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")&&e instanceof ax}function wne(e,t){ms(e._readable._readableStreamController,t),tO(e,t)}function tO(e,t){Uw(e._transformStreamController),Zv(e._writable._writableStreamController,t),IF(e)}function IF(e){e._backpressure&&Jw(e,!1)}function Jw(e,t){e._backpressureChangePromise!==void 0&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=Rn(r=>{e._backpressureChangePromise_resolve=r}),e._backpressure=t}Object.defineProperties(ax.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(ax.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});var Tc=class{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Iw(this))throw Pw("desiredSize");return ZF(this._controlledTransformStream._readable._readableStreamController)}enqueue(t=void 0){if(!Iw(this))throw Pw("enqueue");Ane(this,t)}error(t=void 0){if(!Iw(this))throw Pw("error");var r;r=t,wne(this._controlledTransformStream,r)}terminate(){if(!Iw(this))throw Pw("terminate");(function(t){let r=t._controlledTransformStream;Kp(r._readable._readableStreamController);let n=new TypeError("TransformStream terminated");tO(r,n)})(this)}};function Iw(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")&&e instanceof Tc}function Uw(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0,e._cancelAlgorithm=void 0}function Ane(e,t){let r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!w0(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{_0(n,t)}catch(i){throw tO(r,i),r._readable._storedError}(function(i){return!gne(i)})(n)!==r._backpressure&&Jw(r,!0)}function yre(e,t){return kc(e._transformAlgorithm(t),void 0,r=>{throw wne(e._controlledTransformStream,r),r})}function Pw(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function EF(e){e._finishPromise_resolve!==void 0&&(e._finishPromise_resolve(),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function g0(e,t){e._finishPromise_reject!==void 0&&(A0(e._finishPromise),e._finishPromise_reject(t),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function _re(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(Tc.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),tr(Tc.prototype.enqueue,"enqueue"),tr(Tc.prototype.error,"error"),tr(Tc.prototype.terminate,"terminate"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Tc.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});var eA=class extends Kn{};var tA=class{chunks;isWorking=!1;isCancelled=!1;constructor(t){this.chunks=t}start(t){this.work(t)}async work(t){let{chunks:r}=this;for(this.isWorking=!0;!this.isCancelled&&(t.desiredSize||0)>0;){let n;try{n=r.next()}catch(a){t.error(a);break}n&&(!n.done&&!this.isCancelled?t.enqueue(n.value):t.close())}this.isWorking=!1}pull(t){this.isWorking||this.work(t)}cancel(){this.isCancelled=!0}};var rA=class extends eA{_chunks;constructor(t){super(new tA(t.values()),{type:"bytes"}),this._chunks=t}async*[Symbol.asyncIterator](t){let r=this.getReader();yield*this._chunks,r.releaseLock()}};var Xp=class{type;size;parts;constructor(t=[],r={}){this.parts=[],this.size=0;for(let n of t)if(typeof n=="string"){let a=new TextEncoder().encode(n);this.parts.push(a),this.size+=a.byteLength}else if(n instanceof Xp)this.size+=n.size,this.parts.push(...n.parts);else if(n instanceof ArrayBuffer)this.parts.push(new Uint8Array(n)),this.size+=n.byteLength;else if(n instanceof Uint8Array)this.parts.push(n),this.size+=n.byteLength;else if(ArrayBuffer.isView(n)){let{buffer:a,byteOffset:i,byteLength:o}=n;this.parts.push(new Uint8Array(a,i,o)),this.size+=o}else{let a=new TextEncoder().encode(String(n));this.parts.push(a),this.size+=a.byteLength}this.type=M7e(r.type)}slice(t=0,r=this.size,n=""){let{size:a,parts:i}=this,o=t<0?Math.max(a+t,0):Math.min(t,a),s=r<0?Math.max(a+r,0):Math.min(r,a),u=Math.max(s-o,0),c=new Xp([],{type:n});if(u===0)return c;let l=0,f=[];for(let p of i){let{byteLength:d}=p;if(o>0&&d<=o)o-=d,s-=d;else{let h=p.subarray(o,Math.min(d,s));if(f.push(h),l+=h.byteLength,o=0,l>=u)break}}return c.parts=f,c.size=l,c}async arrayBuffer(){return this._toArrayBuffer()}async text(){let t=new TextDecoder,r="";for(let n of this.parts)r+=t.decode(n);return r}stream(){return new rA(this.parts)}toString(){return"[object Blob]"}get[Symbol.toStringTag](){return"Blob"}_toArrayBuffer(){let t=new ArrayBuffer(this.size),r=new Uint8Array(t),n=0;for(let a of this.parts)r.set(a,n),n+=a.byteLength;return t}};function M7e(e=""){let t=String(e).toLowerCase();return/[^\u0020-\u007E]/.test(t)?"":t}function q7e(){return typeof Blob>"u"&&!globalThis.Blob&&(globalThis.Blob=Xp),globalThis.Blob}var N7e=q7e();var nA=class{onload;onabort;onerror;error;onloadstart;onloadend;onprogress;readyState;result;DONE;EMPTY;LOADING;addEventListener;removeEventListener;dispatchEvent;constructor(){this.onload=null}abort(){}async readAsArrayBuffer(t){let r=await t.arrayBuffer();this.onload&&this.onload({target:{result:r}})}async readAsBinaryString(t){throw Error("Not implemented")}async readAsDataURL(t){let r=await t.text(),n=`data://;base64,${Sb(r)}`;this.onload&&this.onload({target:{result:n}})}async readAsText(t){let r=await t.text();this.onload&&this.onload({target:{result:r}})}};var aA=class extends globalThis.Blob{name="";webkitRelativePath="";lastModified;constructor(t,r,n={}){super(t,n),this.name=String(r).replace(/\//g,":"),this.lastModified=(n==null?void 0:n.lastModified)||Date.now()}get[Symbol.toStringTag](){return"File"}};function Ene(){return typeof FileReader>"u"&&!globalThis.FileReader&&(globalThis.FileReader=nA),typeof File>"u"&&!globalThis.File&&(globalThis.File=aA),global}var U7e=Ene();var rO=Ct(require("module"),1),Tne=Ct(require("path"),1),oA=Ct(require("fs"),1);async function Sne(e){if(e.startsWith("http"))return await(await fetch(e)).arrayBuffer();let t=oA.default.readFileSync(e);return za(t.buffer)}async function kne(e){return e.startsWith("http")?await(await fetch(e)).text():oA.default.readFileSync(e,"utf8")}async function Cne(e){if(e.startsWith("http")){let n=await(await fetch(e)).text();return iA(n)}e.startsWith("/")||(e=`${process.cwd()}/${e}`);let t=oA.default.readFileSync(e,"utf8");return iA(t)}function iA(e,t="",r){if(typeof t=="object"&&(r=t,t=""),t=t.replace("file://",""),typeof e!="string")throw new Error(`code must be a string, not ${typeof e}`);let n=rO.default._nodeModulePaths(Tne.default.dirname(t)),a=typeof module<"u"&&(module==null?void 0:module.parent),i=new rO.default(t,a);return i.filename=t,i.paths=[].concat((r==null?void 0:r.prependPaths)||[]).concat(n).concat((r==null?void 0:r.appendPaths)||[]),i._compile(e,t),a&&a.children&&a.children.splice(a.children.indexOf(i),1),i.exports}var gs=class{map;constructor(t){this.map={},t instanceof gs?t.forEach((r,n)=>this.append(n,r)):Array.isArray(t)?t.forEach(r=>this.append(r[0],r[1])):t&&Object.getOwnPropertyNames(t).forEach(r=>this.append(r,t[r]))}append(t,r){t=sx(t),r=Dne(r);let n=this.map[t];this.map[t]=n?`${n}, ${r}`:r}delete(t){delete this.map[sx(t)]}get(t){return t=sx(t),this.has(t)?this.map[t]:null}has(t){return this.map.hasOwnProperty(sx(t))}set(t,r){this.map[sx(t)]=Dne(r)}forEach(t,r=null){for(let n in this.map)this.map.hasOwnProperty(n)&&(r?t.call(r,this.map[n],n,this):t(this.map[n],n,this))}keys(){let t=[];return this.forEach(function(r,n){t.push(n)}),nO(t)}values(){let t=[];return this.forEach(function(r){t.push(r)}),nO(t)}entries(){let t=[];return this.forEach(function(r,n){t.push([n,r])}),nO(t)}*[Symbol.iterator](){yield*this.entries()}};function sx(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e)||e==="")throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function Dne(e){return typeof e!="string"&&(e=String(e)),e}function nO(e){let t={next(){let r=e.shift();return{done:r===void 0,value:r}}};return t[Symbol.iterator]=function(){return t},t}function aO(e,t){if(!e)throw new Error(`@loaders.gl/polyfills assertion ${t}`)}var oO=Ct(require("stream"),1),z7e=e=>typeof e=="boolean",Bne=e=>typeof e=="function",G7e=e=>e!==null&&typeof e=="object",iO=e=>G7e(e)&&Bne(e.read)&&Bne(e.pipe)&&z7e(e.readable),Bc=class{ok;status;statusText;headers;url;bodyUsed=!1;_body;constructor(t,r){let{headers:n,status:a=200,statusText:i="OK",url:o}=r||{};this.url=o,this.ok=a===200,this.status=a,this.statusText=i,this.headers=new gs((r==null?void 0:r.headers)||{}),iO(t)?this._body=_w(t,n):typeof t=="string"?this._body=oO.Readable.from([new TextEncoder().encode(t)]):this._body=oO.Readable.from([t||new ArrayBuffer(0)])}get body(){return aO(!this.bodyUsed),aO(iO(this._body)),this.bodyUsed=!0,this._body}async arrayBuffer(){return iO(this._body)?await Kte(this._body):this._body||new ArrayBuffer(0)}async text(){let t=await this.arrayBuffer();return new TextDecoder().decode(t)}async json(){let t=await this.text();return JSON.parse(t)}async blob(){if(typeof Blob>"u")throw new Error("Blob polyfill not installed");return new Blob([await this.arrayBuffer()])}};var One=Ct(require("http"),1),Ine=Ct(require("https"),1);function Fne(e){let t=e.indexOf(","),r,n;return e.slice(t-7,t)===";base64"?(r=Buffer.from(e.slice(t+1),"base64"),n=e.slice(5,t-7).trim()):(r=Buffer.from(decodeURIComponent(e.slice(t+1))),n=e.slice(5,t).trim()),n?n.startsWith(";")&&(n=`text/plain${n}`):n="text/plain;charset=US-ASCII",{arrayBuffer:Wn(r),mimeType:n}}var sO=e=>e.startsWith("data:"),H7e=e=>e.startsWith("http:")||e.startsWith("https:");async function ux(e,t){try{if(globalThis.fetch!==ux&&(H7e(e)||sO(e)))return await fetch(e,t);if(sO(e)){let{arrayBuffer:c,mimeType:l}=Fne(e);return new Bc(c,{headers:{"content-type":l},url:e})}let r={},n=e;e.endsWith(".gz")&&(e=e.slice(0,-3),r["content-encoding"]="gzip");let a=await V7e(n,t),i=J7e(e,a,r),{status:o,statusText:s}=K7e(a),u=!t||t.followRedirect||t.followRedirect===void 0;if(o>=300&&o<400&&i.has("location")&&u){let c=$7e(e,i.get("location"));return await ux(c,t)}return new Bc(a,{headers:i,status:o,statusText:s,url:e})}catch(r){return new Bc(null,{status:400,statusText:String(r),url:e})}}async function V7e(e,t){return await new Promise((r,n)=>{let a=W7e(e,t),i=e.startsWith("https:")?Ine.default.request(a,o=>r(o)):One.default.request(a,o=>r(o));i.on("error",o=>n(o)),i.end()})}function $7e(e,t){if(t.startsWith("http"))return t;let r=new URL(e);return r.pathname=t,r.href}function W7e(e,t){let r=(t==null?void 0:t.headers)||{},n={};for(let i of Object.keys(r))n[i.toLowerCase()]=r[i];n["accept-encoding"]=n["accept-encoding"]||"gzip,br,deflate";let a=new URL(e);return{hostname:a.hostname,path:a.pathname,method:"GET",...t,...t==null?void 0:t.fetch,headers:n,port:a.port}}function K7e(e){return e.statusCode?{status:e.statusCode,statusText:e.statusMessage||"NA"}:{status:200,statusText:"OK"}}function J7e(e,t,r={}){let n={};if(t&&t.headers){let a=t.headers;for(let i in a){let o=a[i];n[i.toLowerCase()]=String(o)}}if(!n["content-length"]){let a=X7e(e);Number.isFinite(a)&&(n["content-length"]=a)}return Object.assign(n,r),new gs(n)}function X7e(e){return sO(e)?e.length-5:null}var Y7e=parseInt(Pne.versions.node.split(".")[0]);Cz&&console.error("loaders.gl: The @loaders.gl/polyfills should only be used in Node.js environments");globalThis.loaders=globalThis.loaders||{};globalThis.loaders.makeNodeStream=mF;globalThis.loaders.NodeFile=Lp;globalThis.loaders.NodeFileSystem=Ew;globalThis.loaders.fetchNode=ww;globalThis.loaders.NodeHash=Sw;globalThis.TextEncoder||(globalThis.TextEncoder=Tb);globalThis.TextDecoder||(globalThis.TextDecoder=cp);globalThis.ReadableStream||(globalThis.ReadableStream=ReadableStream);!("atob"in globalThis)&&Sb&&(globalThis.atob=Sb);!("btoa"in globalThis)&&S4&&(globalThis.btoa=S4);globalThis.loaders.encodeImageNode=IV;globalThis.loaders.parseImageNode=PB;globalThis.loaders.imageFormatsNode=IB;globalThis._parseImageNode=PB;globalThis._imageFormatsNode=IB;globalThis.loaders.readFileAsArrayBuffer=Sne;globalThis.loaders.readFileAsText=kne;globalThis.loaders.requireFromFile=Cne;globalThis.loaders.requireFromString=iA;Y7e<18&&(!("Headers"in globalThis)&&gs&&(globalThis.Headers=gs),!("Response"in globalThis)&&Bc&&(globalThis.Response=Bc),!("fetch"in globalThis)&&ux&&(globalThis.fetch=ux));var K3e=require("path"),x4=Ct(jge(),1);var rn={OBJECT_ID_TYPE:"OBJECTID",STRING_TYPE:"string",DOUBLE_TYPE:"double",SHORT_INT_TYPE:"Int32"};var sS=class{_attributeStorageInfo;_fields;_popupInfo;constructor(){this._attributeStorageInfo=[],this._fields=[]}get attributeStorageInfo(){return this._attributeStorageInfo}get fields(){return this._fields}get popupInfo(){return this._popupInfo}addMetadataInfo(t){if(!Object.keys(t).length)return;let r={OBJECTID:rn.OBJECT_ID_TYPE,...t},n=!1,a=this._attributeStorageInfo.length;for(let i in r)if(!this._attributeStorageInfo.find(s=>s.name===i)){let s=r[i],u=this.createStorageAttribute(a,i,s),c=this.getFieldAttributeType(s),l=this.createFieldAttribute(i,c);this._attributeStorageInfo.push(u),this._fields.push(l),a+=1,n=!0}if(n){let i=[];for(let o of this._attributeStorageInfo)i.push(o.name);this._popupInfo=this.createPopupInfo(i)}}fromObject(t){this._attributeStorageInfo=t.attributeStorageInfo,this._fields=t.fields,this._popupInfo=t.popupInfo}createStorageAttribute(t,r,n){let a={key:`f_${t}`,name:r,ordering:["attributeValues"],header:[{property:"count",valueType:"UInt32"}],attributeValues:{valueType:"Int32",valuesPerElement:1}};switch(n){case rn.OBJECT_ID_TYPE:this.setupIdAttribute(a);break;case rn.STRING_TYPE:this.setupStringAttribute(a);break;case rn.DOUBLE_TYPE:this.setupDoubleAttribute(a);break;case rn.SHORT_INT_TYPE:break;default:this.setupStringAttribute(a)}return a}getFieldAttributeType(t){switch(t){case rn.OBJECT_ID_TYPE:return"esriFieldTypeOID";case rn.STRING_TYPE:return"esriFieldTypeString";case rn.SHORT_INT_TYPE:return"esriFieldTypeInteger";case rn.DOUBLE_TYPE:return"esriFieldTypeDouble";default:return"esriFieldTypeString"}}setupIdAttribute(t){t.attributeValues={valueType:"Oid32",valuesPerElement:1}}setupStringAttribute(t){t.ordering.unshift("attributeByteCounts"),t.header.push({property:"attributeValuesByteCount",valueType:"UInt32"}),t.attributeValues={valueType:"String",encoding:"UTF-8",valuesPerElement:1},t.attributeByteCounts={valueType:"UInt32",valuesPerElement:1}}setupDoubleAttribute(t){t.attributeValues={valueType:"Float64",valuesPerElement:1}}createFieldAttribute(t,r){return{name:t,type:r,alias:t}}createPopupInfo(t){let r="{OBJECTID}",n=[],a=[],i=[],o=[];for(let s of t)a.push({fieldName:s,visible:!0,isEditable:!1,label:s});return i.push({fieldInfos:a,type:"fields"}),{title:r,mediaInfos:n,popupElements:i,fieldInfos:a,expressionInfos:o}}};var uS=class extends Error{constructor(t,r){super(t),this.reason=r.reason,this.url=r.url,this.response=r.response}reason;url;response};var c1t=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,l1t=/^([-\w.]+\/[-\w.+]+)/;function pL(e,t){return e.toLowerCase()===t.toLowerCase()}function Lge(e){let t=l1t.exec(e);return t?t[1]:e}function dL(e){let t=c1t.exec(e);return t?t[1]:""}var Mge=/\?.*/;function qge(e){let t=e.match(Mge);return t&&t[0]}function Bf(e){return e.replace(Mge,"")}function Nge(e){if(e.length<50)return e;let t=e.slice(e.length-15);return`${e.substr(0,32)}...${t}`}function _d(e){return Vi(e)?e.url:$i(e)?("name"in e?e.name:"")||"":typeof e=="string"?e:""}function Hm(e){if(Vi(e)){let t=e.headers.get("content-type")||"",r=Bf(e.url);return Lge(t)||dL(r)}return $i(e)?e.type||"":typeof e=="string"?dL(e):""}function Uge(e){return Vi(e)?e.headers["content-length"]||-1:$i(e)?e.size:typeof e=="string"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function cS(e){if(Vi(e))return e;let t={},r=Uge(e);r>=0&&(t["content-length"]=String(r));let n=_d(e),a=Hm(e);a&&(t["content-type"]=a);let i=await p1t(e);i&&(t["x-first-bytes"]=i),typeof e=="string"&&(e=new TextEncoder().encode(e));let o=new Response(e,{headers:t});return Object.defineProperty(o,"url",{value:n}),o}async function zge(e){if(!e.ok)throw await f1t(e)}async function f1t(e){let t=Nge(e.url),r=`Failed to fetch resource (${e.status}) ${e.statusText}: ${t}`;r=r.length>100?`${r.slice(0,100)}...`:r;let n={reason:e.statusText,url:e.url,response:e};try{let a=e.headers.get("Content-Type");n.reason=!e.bodyUsed&&(a!=null&&a.includes("application/json"))?await e.json():await e.text()}catch{}return new uS(r,n)}async function p1t(e){if(typeof e=="string")return`data:,${e.slice(0,5)}`;if(e instanceof Blob){let r=e.slice(0,5);return await new Promise(n=>{let a=new FileReader;a.onload=i=>{var o;return n((o=i==null?void 0:i.target)==null?void 0:o.result)},a.readAsDataURL(r)})}if(e instanceof ArrayBuffer){let r=e.slice(0,5);return`data:base64,${d1t(r)}`}return null}function d1t(e){let t="",r=new Uint8Array(e);for(let n=0;n<r.byteLength;n++)t+=String.fromCharCode(r[n]);return btoa(t)}function h1t(e){return!m1t(e)&&!g1t(e)}function m1t(e){return e.startsWith("http:")||e.startsWith("https:")}function g1t(e){return e.startsWith("data:")}async function si(e,t){var r,n;if(typeof e=="string"){let a=du(e);return h1t(a)&&(r=globalThis.loaders)!=null&&r.fetchNode?(n=globalThis.loaders)==null?void 0:n.fetchNode(a,t):await fetch(a,t)}return await cS(e)}var d1=new ds({id:"loaders.gl"}),lS=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},fS=class{console;constructor(){this.console=console}log(...t){return this.console.log.bind(this.console,...t)}info(...t){return this.console.info.bind(this.console,...t)}warn(...t){return this.console.warn.bind(this.console,...t)}error(...t){return this.console.error.bind(this.console,...t)}};var pS={core:{baseUrl:void 0,fetch:null,mimeType:void 0,fallbackMimeType:void 0,ignoreRegisteredLoaders:void 0,nothrow:!1,log:new fS,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:pr,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]}},Gge={baseUri:"core.baseUrl",fetch:"core.fetch",mimeType:"core.mimeType",fallbackMimeType:"core.fallbackMimeType",ignoreRegisteredLoaders:"core.ignoreRegisteredLoaders",nothrow:"core.nothrow",log:"core.log",useLocalLibraries:"core.useLocalLibraries",CDN:"core.CDN",worker:"core.worker",maxConcurrency:"core.maxConcurrency",maxMobileConcurrency:"core.maxMobileConcurrency",reuseWorkers:"core.reuseWorkers",_nodeWorkers:"core.nodeWorkers",_workerType:"core._workerType",_worker:"core._workerType",limit:"core.limit",_limitMB:"core._limitMB",batchSize:"core.batchSize",batchDebounceMs:"core.batchDebounceMs",metadata:"core.metadata",transforms:"core.transforms",throws:"nothrow",dataType:"(no longer used)",uri:"core.baseUrl",method:"core.fetch.method",headers:"core.fetch.headers",body:"core.fetch.body",mode:"core.fetch.mode",credentials:"core.fetch.credentials",cache:"core.fetch.cache",redirect:"core.fetch.redirect",referrer:"core.fetch.referrer",referrerPolicy:"core.fetch.referrerPolicy",integrity:"core.fetch.integrity",keepalive:"core.fetch.keepalive",signal:"core.fetch.signal"};var hL=["baseUrl","fetch","mimeType","fallbackMimeType","ignoreRegisteredLoaders","nothrow","log","useLocalLibraries","CDN","worker","maxConcurrency","maxMobileConcurrency","reuseWorkers","_nodeWorkers","_workerType","limit","_limitMB","batchSize","batchDebounceMs","metadata","transforms"];function mL(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state||(e._state={}),e._state}function Vm(){let e=mL();return e.globalOptions=e.globalOptions||{...pS,core:{...pS.core}},Hc(e.globalOptions)}function $ge(e,t,r,n){return r=r||[],r=Array.isArray(r)?r:[r],b1t(e,r),Hc(x1t(t,e,n))}function Hc(e){let t=_1t(e);Wge(t);for(let r of hL)t.core&&t.core[r]!==void 0&&delete t[r];return t.core&&t.core._workerType!==void 0&&delete t._worker,t}function b1t(e,t){Hge(e,null,pS,Gge,t);for(let r of t){let n=e&&e[r.id]||{},a=r.options&&r.options[r.id]||{},i=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};Hge(n,r.id,a,i,t)}}function Hge(e,t,r,n,a){let i=t||"Top level",o=t?`${t}.`:"";for(let s in e){let u=!t&&lu(e[s]),c=s==="baseUri"&&!t,l=s==="workerUrl"&&t;if(!(s in r)&&!c&&!l){if(s in n)d1.level>0&&d1.warn(`${i} loader option '${o}${s}' no longer supported, use '${n[s]}'`)();else if(!u&&d1.level>0){let f=v1t(s,a);d1.warn(`${i} loader option '${o}${s}' not recognized. ${f}`)()}}}}function v1t(e,t){let r=e.toLowerCase(),n="";for(let a of t)for(let i in a.options){if(e===i)return`Did you mean '${a.id}.${i}'?`;let o=i.toLowerCase();(r.startsWith(o)||o.startsWith(r))&&(n=n||`Did you mean '${a.id}.${i}'?`)}return n}function x1t(e,t,r){var o;let n=e.options||{},a={...n};n.core&&(a.core={...n.core}),Wge(a),((o=a.core)==null?void 0:o.log)===null&&(a.core={...a.core,log:new lS}),Vge(a,Hc(Vm()));let i=Hc(t);return Vge(a,i),y1t(a,r),w1t(a),a}function Vge(e,t){for(let r in t)if(r in t){let n=t[r];gw(n)&&gw(e[r])?e[r]={...e[r],...t[r]}:e[r]=t[r]}}function y1t(e,t){var n;if(!t)return;((n=e.core)==null?void 0:n.baseUrl)!==void 0||(e.core||(e.core={}),e.core.baseUrl=Ga.dirname(Bf(t)))}function _1t(e){let t={...e};return e.core&&(t.core={...e.core}),t}function Wge(e){e.baseUri!==void 0&&(e.core||(e.core={}),e.core.baseUrl===void 0&&(e.core.baseUrl=e.baseUri));for(let r of hL)if(e[r]!==void 0){let a=e.core=e.core||{};a[r]===void 0&&(a[r]=e[r])}let t=e._worker;t!==void 0&&(e.core||(e.core={}),e.core._workerType===void 0&&(e.core._workerType=t))}function w1t(e){let t=e.core;if(t)for(let r of hL)t[r]!==void 0&&(e[r]=t[r])}function h1(e){return e?(Array.isArray(e)&&(e=e[0]),Array.isArray(e==null?void 0:e.extensions)):!1}function gL(e){yt(e,"null loader"),yt(h1(e),"invalid loader");let t;return Array.isArray(e)&&(t=e[1],e=e[0],e={...e,options:{...e.options,...t}}),(e!=null&&e.parseTextSync||e!=null&&e.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}var A1t=()=>{let e=mL();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function Kge(){return A1t()}var E1t=/\.([^.]+)$/;async function Yge(e,t=[],r,n){if(!Qge(e))return null;let a=Hc(r||{});if(a.core||(a.core={}),e instanceof Response&&Jge(e)){let o=await e.clone().text(),s=dS(o,t,{...a,core:{...a.core,nothrow:!0}},n);if(s)return s}let i=dS(e,t,{...a,core:{...a.core,nothrow:!0}},n);if(i)return i;if($i(e)&&(e=await e.slice(0,10).arrayBuffer(),i=dS(e,t,a,n)),!i&&e instanceof Response&&Jge(e)){let o=await e.clone().text();i=dS(o,t,a,n)}if(!i&&!a.core.nothrow)throw new Error(Zge(e));return i}function Jge(e){let t=Hm(e);return Boolean(t&&(t.startsWith("text/")||t==="application/json"||t.endsWith("+json")))}function dS(e,t=[],r,n){if(!Qge(e))return null;let a=Hc(r||{});if(a.core||(a.core={}),t&&!Array.isArray(t))return gL(t);let i=[];t&&(i=i.concat(t)),a.core.ignoreRegisteredLoaders||i.push(...Kge()),S1t(i);let o=T1t(e,i,a,n);if(!o&&!a.core.nothrow)throw new Error(Zge(e));return o}function T1t(e,t,r,n){var c,l,f,p,d;let a=_d(e),i=Hm(e),o=Bf(a)||(n==null?void 0:n.url),s=null,u="";return(c=r==null?void 0:r.core)!=null&&c.mimeType&&(s=bL(t,(l=r==null?void 0:r.core)==null?void 0:l.mimeType),u=`match forced by supplied MIME type ${(f=r==null?void 0:r.core)==null?void 0:f.mimeType}`),s=s||k1t(t,o),u=u||(s?`matched url ${o}`:""),s=s||bL(t,i),u=u||(s?`matched MIME type ${i}`:""),s=s||D1t(t,e),u=u||(s?`matched initial data ${ebe(e)}`:""),(p=r==null?void 0:r.core)!=null&&p.fallbackMimeType&&(s=s||bL(t,(d=r==null?void 0:r.core)==null?void 0:d.fallbackMimeType),u=u||(s?`matched fallback MIME type ${i}`:"")),u&&Dv.log(1,`selectLoader selected ${s==null?void 0:s.name}: ${u}.`),s}function Qge(e){return!(e instanceof Response&&e.status===204)}function Zge(e){let t=_d(e),r=Hm(e),n="No valid loader found (";n+=t?`${Ga.filename(t)}, `:"no url provided, ",n+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let a=e?ebe(e):"";return n+=a?` first bytes: "${a}"`:"first bytes: not available",n+=")",n}function S1t(e){for(let t of e)gL(t)}function k1t(e,t){let r=t&&E1t.exec(t),n=r&&r[1];return n?C1t(e,n):null}function C1t(e,t){t=t.toLowerCase();for(let r of e)for(let n of r.extensions)if(n.toLowerCase()===t)return r;return null}function bL(e,t){var r;for(let n of e)if((r=n.mimeTypes)!=null&&r.some(a=>pL(t,a))||pL(t,`application/x.${n.id}`))return n;return null}function D1t(e,t){if(!t)return null;for(let r of e)if(typeof t=="string"){if(B1t(t,r))return r}else if(ArrayBuffer.isView(t)){if(Xge(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer&&Xge(t,0,r))return r;return null}function B1t(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some(n=>e.startsWith(n))}function Xge(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(a=>F1t(e,t,r,a))}function F1t(e,t,r,n){if(s0(n))return pu(n,e,n.byteLength);switch(typeof n){case"function":return n(za(e));case"string":let a=vL(e,t,n.length);return n===a;default:return!1}}function ebe(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?vL(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?vL(e,0,t):""}function vL(e,t,r){if(e.byteLength<t+r)return"";let n=new DataView(e),a="";for(let i=0;i<r;i++)a+=String.fromCharCode(n.getUint8(t+i));return a}var O1t=256*1024;function*tbe(e,t){let r=(t==null?void 0:t.chunkSize)||O1t,n=0,a=new TextEncoder;for(;n<e.length;){let i=Math.min(e.length-n,r),o=e.slice(n,n+i);n+=i,yield za(a.encode(o))}}function*rbe(e,t={}){let{chunkSize:r=262144}=t,n=0;for(;n<e.byteLength;){let a=Math.min(e.byteLength-n,r),i=new ArrayBuffer(a),o=new Uint8Array(e,n,a);new Uint8Array(i).set(o),n+=a,yield i}}async function*nbe(e,t){let r=(t==null?void 0:t.chunkSize)||1048576,n=0;for(;n<e.size;){let a=n+r,i=await e.slice(n,a).arrayBuffer();n=a,yield i}}function xL(e,t){return pr?I1t(e,t):P1t(e,t)}async function*I1t(e,t){let r=e.getReader(),n;try{for(;;){let a=n||r.read();t!=null&&t._streamReadAhead&&(n=r.read());let{done:i,value:o}=await a;if(i)return;yield Wn(o)}}catch{r.releaseLock()}}async function*P1t(e,t){for await(let r of e)yield Wn(r)}function abe(e,t){if(typeof e=="string")return tbe(e,t);if(e instanceof ArrayBuffer)return rbe(e,t);if($i(e))return nbe(e,t);if(Bv(e))return xL(e,t);if(Vi(e)){let r=e.body;if(!r)throw new Error("Readable stream not available on Response");return xL(r,t)}throw new Error("makeIterator")}var ibe="Cannot convert supplied data type";function R1t(e,t,r){if(t.text&&typeof e=="string")return e;if(xw(e)&&(e=e.buffer),s0(e)){let n=iF(e);return t.text&&!t.binary?new TextDecoder("utf8").decode(n):Wn(n)}throw new Error(ibe)}async function obe(e,t,r){if(typeof e=="string"||s0(e))return R1t(e,t,r);if($i(e)&&(e=await cS(e)),Vi(e))return await zge(e),t.binary?await e.arrayBuffer():await e.text();if(Bv(e)&&(e=abe(e,r)),UB(e)||zB(e))return jp(e);throw new Error(ibe)}function hS(e,t){var i;let r=Vm(),n=e||r,a=n.fetch??((i=n.core)==null?void 0:i.fetch);return typeof a=="function"?a:lu(a)?o=>si(o,a):t!=null&&t.fetch?t==null?void 0:t.fetch:si}function sbe(e,t,r){if(r)return r;let n={fetch:hS(t,e),...e};if(n.url){let a=Bf(n.url);n.baseUrl=a,n.queryString=qge(n.url),n.filename=Ga.filename(a),n.baseUrl=Ga.dirname(a)}return Array.isArray(n.loaders)||(n.loaders=null),n}function ube(e,t){if(e&&!Array.isArray(e))return e;let r;if(e&&(r=Array.isArray(e)?e:[e]),t&&t.loaders){let n=Array.isArray(t.loaders)?t.loaders:[t.loaders];r=r?[...r,...n]:n}return r&&r.length?r:void 0}async function Xi(e,t,r,n){t&&!Array.isArray(t)&&!h1(t)&&(n=void 0,r=t,t=void 0),e=await e,r=r||{};let a=_d(e),o=ube(t,n),s=await Yge(e,o,r);if(!s)return null;let u=$ge(r,s,o,a);return n=sbe({url:a,_parse:Xi,loaders:o},u,n||null),await j1t(s,e,u,n)}async function j1t(e,t,r,n){if(XB(e),r=GB(e.options,r),Vi(t)){let{ok:i,redirected:o,status:s,statusText:u,type:c,url:l}=t,f=Object.fromEntries(t.headers.entries());n.response={headers:f,ok:i,redirected:o,status:s,statusText:u,type:c,url:l}}t=await obe(t,e,r);let a=e;if(a.parseTextSync&&typeof t=="string")return a.parseTextSync(t,r,n);if(QB(e,r))return await ZB(e,t,r,n,Xi);if(a.parseText&&typeof t=="string")return await a.parseText(t,r,n);if(a.parse)return await a.parse(t,r,n);throw xa(!a.parseSync),new Error(`${e.id} loader - no parser found and worker is disabled`)}function cbe(e){switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function yL(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function _L(e){let t=1/0,r=1/0,n=1/0,a=-1/0,i=-1/0,o=-1/0,s=e.POSITION?e.POSITION.value:[],u=s&&s.length;for(let c=0;c<u;c+=3){let l=s[c],f=s[c+1],p=s[c+2];t=l<t?l:t,r=f<r?f:r,n=p<n?p:n,a=l>a?l:a,i=f>i?f:i,o=p>o?p:o}return[[t,r,n],[a,i,o]]}function wL(e,t,r){let n=cbe(t.value),a=r||lbe(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:n}]},nullable:!1,metadata:a}}function lbe(e){let t={};return"byteOffset"in e&&(t.byteOffset=e.byteOffset.toString(10)),"byteStride"in e&&(t.byteStride=e.byteStride.toString(10)),"normalized"in e&&(t.normalized=e.normalized.toString()),t}async function Wr(e,t,r,n){var u;let a,i;!Array.isArray(t)&&!h1(t)?(a=[],i=t,n=void 0):(a=t,i=r);let o=hS(i),s=e;return typeof e=="string"&&(s=await o(e)),$i(e)&&(s=await o(e)),typeof e=="string"&&((u=Hc(i||{}).core)!=null&&u.baseUrl||(i={...i,core:{...i==null?void 0:i.core,baseUrl:e}})),Array.isArray(a)?await Xi(s,a,i):await Xi(s,a,i)}async function $m(e,t,r){let a={...Vm(),...r};return t.encodeURLtoURL?L1t(t,e,a):eF(t,a)?await JB(t,e,a):await t.encode(e,a)}function mS(e,t,r){if(t.encodeSync)return t.encodeSync(e,r);if(t.encodeTextSync)return za(new TextEncoder().encode(t.encodeTextSync(e,r)));throw new Error(`Writer ${t.name} could not synchronously encode data`)}async function pbe(e,t,r,n){if(e=du(e),t=du(t),pr||!r.encodeURLtoURL)throw new Error;return await r.encodeURLtoURL(e,t,n)}async function L1t(e,t,r){if(pr)throw new Error(`Writer ${e.name} not supported in browser`);let n=fbe("input");await new Ha(n,"w").write(t);let i=fbe("output"),o=await pbe(n,i,e,r);return(await si(o)).arrayBuffer()}function fbe(e){return`/tmp/${e}`}var M1t=1/Math.PI*180,q1t=1/180*Math.PI,N1t={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...N1t}};var Rr=globalThis.mathgl.config;function AL(e,{precision:t=Rr.precision}={}){return e=U1t(e),`${parseFloat(e.toPrecision(t))}`}function Fo(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function EL(e){return dbe(e)}function TL(e){return Vc(e)}function dbe(e,t){return kL(e,r=>r*q1t,t)}function Vc(e,t){return kL(e,r=>r*M1t,t)}function SL(e,t,r){return kL(e,n=>Math.max(t,Math.min(r,n)))}function Yi(e,t,r){let n=Rr.EPSILON;r&&(Rr.EPSILON=r);try{if(e===t)return!0;if(Fo(e)&&Fo(t)){if(e.length!==t.length)return!1;for(let a=0;a<e.length;++a)if(!Yi(e[a],t[a]))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)<=Rr.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{Rr.EPSILON=n}}function U1t(e){return Math.round(e/Rr.EPSILON)*Rr.EPSILON}function z1t(e){return e.clone?e.clone():new Array(e.length)}function kL(e,t,r){if(Fo(e)){let n=e;r=r||z1t(n);for(let a=0;a<r.length&&a<n.length;++a){let i=typeof e=="number"?e:e[a];r[a]=t(i,a,r)}return r}return t(e)}var Ff=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=t[n+r];return this.check()}toArray(t=[],r=0){for(let n=0;n<this.ELEMENTS;++n)t[r+n]=this[n];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Fo(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Rr)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+AL(this[n],t);return`${t.printTypes?this.constructor.name:""}[${r}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!Yi(this[r],t[r]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==t[r])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,r,n){if(n===void 0)return this.lerp(this,t,r);for(let a=0;a<this.ELEMENTS;++a){let i=t[a],o=typeof r=="number"?r:r[a];this[a]=i+n*(o-i)}return this.check()}min(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(t[r],this[r]);return this.check()}max(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(t[r],this[r]);return this.check()}clamp(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),r[n]);return this.check()}add(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(t){if(typeof t=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;else for(let r=0;r<this.ELEMENTS&&r<t.length;++r)this[r]*=t[r];return this.check()}multiplyByScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}check(){if(Rr.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)t=t&&Number.isFinite(this[r]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=t;return this.check()}addScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t),r);return this.check()}get elements(){return this}};function G1t(e,t){if(e.length!==t)return!1;for(let r=0;r<e.length;++r)if(!Number.isFinite(e[r]))return!1;return!0}function Ut(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function Of(e,t,r=""){if(Rr.debug&&!G1t(e,t))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return e}function ca(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var If=class extends Ff{get x(){return this[0]}set x(t){this[0]=Ut(t)}get y(){return this[1]}set y(t){this[1]=Ut(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*this[r];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let r=0;for(let n=0;n<this.ELEMENTS;++n){let a=this[n]-t[n];r+=a*a}return Ut(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return Ut(r)}normalize(){let t=this.magnitude();if(t!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=t;return this.check()}multiply(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return ca(t>=0&&t<this.ELEMENTS,"index is out of range"),Ut(this[t])}setComponent(t,r){return ca(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=r,this.check()}addVectors(t,r){return this.copy(t).add(r)}subVectors(t,r){return this.copy(t).subtract(r)}multiplyVectors(t,r){return this.copy(t).multiply(r)}addScaledVector(t,r){return this.add(new this.constructor(t).multiplyScalar(r))}};var nn=typeof Float32Array<"u"?Float32Array:Array,m1=Math.random;function Wm(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var Ytr=Math.PI/180;function H1t(){let e=new nn(2);return nn!=Float32Array&&(e[0]=0,e[1]=0),e}function hbe(e,t,r){let n=t[0],a=t[1];return e[0]=r[0]*n+r[2]*a,e[1]=r[1]*n+r[3]*a,e}function mbe(e,t,r){let n=t[0],a=t[1];return e[0]=r[0]*n+r[2]*a+r[4],e[1]=r[1]*n+r[3]*a+r[5],e}function gS(e,t,r){let n=t[0],a=t[1];return e[0]=r[0]*n+r[3]*a+r[6],e[1]=r[1]*n+r[4]*a+r[7],e}function bS(e,t,r){let n=t[0],a=t[1];return e[0]=r[0]*n+r[4]*a+r[12],e[1]=r[1]*n+r[5]*a+r[13],e}var Qtr=function(){let e=H1t();return function(t,r,n,a,i,o){let s,u;for(r||(r=2),n||(n=0),a?u=Math.min(a*r+n,t.length):u=t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],i(e,e,o),t[s]=e[0],t[s+1]=e[1];return t}}();function vS(e,t,r){let n=t[0],a=t[1],i=r[3]*n+r[7]*a||1;return e[0]=(r[0]*n+r[4]*a)/i,e[1]=(r[1]*n+r[5]*a)/i,e}function xS(e,t,r){let n=t[0],a=t[1],i=t[2],o=r[3]*n+r[7]*a+r[11]*i||1;return e[0]=(r[0]*n+r[4]*a+r[8]*i)/o,e[1]=(r[1]*n+r[5]*a+r[9]*i)/o,e[2]=(r[2]*n+r[6]*a+r[10]*i)/o,e}function gbe(e,t,r){let n=t[0],a=t[1];return e[0]=r[0]*n+r[2]*a,e[1]=r[1]*n+r[3]*a,e[2]=t[2],e}function bbe(e,t,r){let n=t[0],a=t[1];return e[0]=r[0]*n+r[2]*a,e[1]=r[1]*n+r[3]*a,e[2]=t[2],e[3]=t[3],e}function yS(e,t,r){let n=t[0],a=t[1],i=t[2];return e[0]=r[0]*n+r[3]*a+r[6]*i,e[1]=r[1]*n+r[4]*a+r[7]*i,e[2]=r[2]*n+r[5]*a+r[8]*i,e[3]=t[3],e}var wd=class extends If{constructor(t=0,r=0){super(2),Fo(t)&&arguments.length===1?this.copy(t):(Rr.debug&&(Ut(t),Ut(r)),this[0]=t,this[1]=r)}set(t,r){return this[0]=t,this[1]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return Rr.debug&&(Ut(t.x),Ut(t.y)),this[0]=t.x,this[1]=t.y,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return bS(this,this,t),this.check()}transformAsVector(t){return vS(this,this,t),this.check()}transformByMatrix3(t){return gS(this,this,t),this.check()}transformByMatrix2x3(t){return mbe(this,this,t),this.check()}transformByMatrix2(t){return hbe(this,this,t),this.check()}};var Jm={};Fa(Jm,{add:()=>J1t,angle:()=>OL,bezier:()=>uyt,ceil:()=>X1t,clone:()=>$1t,copy:()=>W1t,create:()=>_S,cross:()=>Ad,dist:()=>byt,distance:()=>wbe,div:()=>gyt,divide:()=>_be,dot:()=>g1,equals:()=>dyt,exactEquals:()=>pyt,floor:()=>Y1t,forEach:()=>yyt,fromValues:()=>wS,hermite:()=>syt,inverse:()=>ayt,len:()=>IL,length:()=>vbe,lerp:()=>iyt,max:()=>Z1t,min:()=>Q1t,mul:()=>myt,multiply:()=>ybe,negate:()=>nyt,normalize:()=>CL,random:()=>cyt,rotateX:()=>DL,rotateY:()=>BL,rotateZ:()=>FL,round:()=>eyt,scale:()=>tyt,scaleAndAdd:()=>ryt,set:()=>K1t,slerp:()=>oyt,sqrDist:()=>vyt,sqrLen:()=>xyt,squaredDistance:()=>Abe,squaredLength:()=>Ebe,str:()=>fyt,sub:()=>hyt,subtract:()=>xbe,transformMat3:()=>b1,transformMat4:()=>Ed,transformQuat:()=>v1,zero:()=>lyt});function _S(){let e=new nn(3);return nn!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function $1t(e){let t=new nn(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function vbe(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function wS(e,t,r){let n=new nn(3);return n[0]=e,n[1]=t,n[2]=r,n}function W1t(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function K1t(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function J1t(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function xbe(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function ybe(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function _be(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function X1t(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function Y1t(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function Q1t(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e}function Z1t(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e}function eyt(e,t){return e[0]=Wm(t[0]),e[1]=Wm(t[1]),e[2]=Wm(t[2]),e}function tyt(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function ryt(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e}function wbe(e,t){let r=t[0]-e[0],n=t[1]-e[1],a=t[2]-e[2];return Math.sqrt(r*r+n*n+a*a)}function Abe(e,t){let r=t[0]-e[0],n=t[1]-e[1],a=t[2]-e[2];return r*r+n*n+a*a}function Ebe(e){let t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function nyt(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function ayt(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function CL(e,t){let r=t[0],n=t[1],a=t[2],i=r*r+n*n+a*a;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 g1(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Ad(e,t,r){let n=t[0],a=t[1],i=t[2],o=r[0],s=r[1],u=r[2];return e[0]=a*u-i*s,e[1]=i*o-n*u,e[2]=n*s-a*o,e}function iyt(e,t,r,n){let a=t[0],i=t[1],o=t[2];return e[0]=a+n*(r[0]-a),e[1]=i+n*(r[1]-i),e[2]=o+n*(r[2]-o),e}function oyt(e,t,r,n){let a=Math.acos(Math.min(Math.max(g1(t,r),-1),1)),i=Math.sin(a),o=Math.sin((1-n)*a)/i,s=Math.sin(n*a)/i;return e[0]=o*t[0]+s*r[0],e[1]=o*t[1]+s*r[1],e[2]=o*t[2]+s*r[2],e}function syt(e,t,r,n,a,i){let o=i*i,s=o*(2*i-3)+1,u=o*(i-2)+i,c=o*(i-1),l=o*(3-2*i);return e[0]=t[0]*s+r[0]*u+n[0]*c+a[0]*l,e[1]=t[1]*s+r[1]*u+n[1]*c+a[1]*l,e[2]=t[2]*s+r[2]*u+n[2]*c+a[2]*l,e}function uyt(e,t,r,n,a,i){let o=1-i,s=o*o,u=i*i,c=s*o,l=3*i*s,f=3*u*o,p=u*i;return e[0]=t[0]*c+r[0]*l+n[0]*f+a[0]*p,e[1]=t[1]*c+r[1]*l+n[1]*f+a[1]*p,e[2]=t[2]*c+r[2]*l+n[2]*f+a[2]*p,e}function cyt(e,t){t=t===void 0?1:t;let r=m1()*2*Math.PI,n=m1()*2-1,a=Math.sqrt(1-n*n)*t;return e[0]=Math.cos(r)*a,e[1]=Math.sin(r)*a,e[2]=n*t,e}function Ed(e,t,r){let n=t[0],a=t[1],i=t[2],o=r[3]*n+r[7]*a+r[11]*i+r[15];return o=o||1,e[0]=(r[0]*n+r[4]*a+r[8]*i+r[12])/o,e[1]=(r[1]*n+r[5]*a+r[9]*i+r[13])/o,e[2]=(r[2]*n+r[6]*a+r[10]*i+r[14])/o,e}function b1(e,t,r){let n=t[0],a=t[1],i=t[2];return e[0]=n*r[0]+a*r[3]+i*r[6],e[1]=n*r[1]+a*r[4]+i*r[7],e[2]=n*r[2]+a*r[5]+i*r[8],e}function v1(e,t,r){let n=r[0],a=r[1],i=r[2],o=r[3],s=t[0],u=t[1],c=t[2],l=a*c-i*u,f=i*s-n*c,p=n*u-a*s,d=a*p-i*f,h=i*l-n*p,m=n*f-a*l,g=o*2;return l*=g,f*=g,p*=g,d*=2,h*=2,m*=2,e[0]=s+l+d,e[1]=u+f+h,e[2]=c+p+m,e}function DL(e,t,r,n){let a=[],i=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],i[0]=a[0],i[1]=a[1]*Math.cos(n)-a[2]*Math.sin(n),i[2]=a[1]*Math.sin(n)+a[2]*Math.cos(n),e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e}function BL(e,t,r,n){let a=[],i=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],i[0]=a[2]*Math.sin(n)+a[0]*Math.cos(n),i[1]=a[1],i[2]=a[2]*Math.cos(n)-a[0]*Math.sin(n),e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e}function FL(e,t,r,n){let a=[],i=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],i[0]=a[0]*Math.cos(n)-a[1]*Math.sin(n),i[1]=a[0]*Math.sin(n)+a[1]*Math.cos(n),i[2]=a[2],e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e}function OL(e,t){let r=e[0],n=e[1],a=e[2],i=t[0],o=t[1],s=t[2],u=Math.sqrt((r*r+n*n+a*a)*(i*i+o*o+s*s)),c=u&&g1(e,t)/u;return Math.acos(Math.min(Math.max(c,-1),1))}function lyt(e){return e[0]=0,e[1]=0,e[2]=0,e}function fyt(e){return`vec3(${e[0]}, ${e[1]}, ${e[2]})`}function pyt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function dyt(e,t){let r=e[0],n=e[1],a=e[2],i=t[0],o=t[1],s=t[2];return Math.abs(r-i)<=1e-6*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-o)<=1e-6*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(a-s)<=1e-6*Math.max(1,Math.abs(a),Math.abs(s))}var hyt=xbe,myt=ybe,gyt=_be,byt=wbe,vyt=Abe,IL=vbe,xyt=Ebe,yyt=function(){let e=_S();return function(t,r,n,a,i,o){let s,u;for(r||(r=3),n||(n=0),a?u=Math.min(a*r+n,t.length):u=t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],i(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2];return t}}();var PL=[0,0,0],AS,Z=class extends If{static get ZERO(){return AS||(AS=new Z(0,0,0),Object.freeze(AS)),AS}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&Fo(t)?this.copy(t):(Rr.debug&&(Ut(t),Ut(r),Ut(n)),this[0]=t,this[1]=r,this[2]=n)}set(t,r,n){return this[0]=t,this[1]=r,this[2]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Rr.debug&&(Ut(t.x),Ut(t.y),Ut(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]=Ut(t)}angle(t){return OL(this,t)}cross(t){return Ad(this,this,t),this.check()}rotateX({radians:t,origin:r=PL}){return DL(this,this,r,t),this.check()}rotateY({radians:t,origin:r=PL}){return BL(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=PL}){return FL(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Ed(this,this,t),this.check()}transformAsVector(t){return xS(this,this,t),this.check()}transformByMatrix3(t){return b1(this,this,t),this.check()}transformByMatrix2(t){return gbe(this,this,t),this.check()}transformByQuaternion(t){return v1(this,this,t),this.check()}};var ES,Oo=class extends If{static get ZERO(){return ES||(ES=new Oo(0,0,0,0),Object.freeze(ES)),ES}constructor(t=0,r=0,n=0,a=0){super(-0,-0,-0,-0),Fo(t)&&arguments.length===1?this.copy(t):(Rr.debug&&(Ut(t),Ut(r),Ut(n),Ut(a)),this[0]=t,this[1]=r,this[2]=n,this[3]=a)}set(t,r,n,a){return this[0]=t,this[1]=r,this[2]=n,this[3]=a,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 Rr.debug&&(Ut(t.x),Ut(t.y),Ut(t.z),Ut(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]=Ut(t)}get w(){return this[3]}set w(t){this[3]=Ut(t)}transform(t){return Ed(this,this,t),this.check()}transformByMatrix3(t){return yS(this,this,t),this.check()}transformByMatrix2(t){return bbe(this,this,t),this.check()}transformByQuaternion(t){return v1(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Xm=class extends Ff{toString(){let t="[";if(Rr.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)t+=` ${this[n*this.RANK+r]}`}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=` ${this[r]}`}return t+="]",t}getElementIndex(t,r){return r*this.RANK+t}getElement(t,r){return this[r*this.RANK+t]}setElement(t,r,n){return this[r*this.RANK+t]=Ut(n),this}getColumn(t,r=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let a=0;a<this.RANK;++a)r[a]=this[n+a];return r}setColumn(t,r){let n=t*this.RANK;for(let a=0;a<this.RANK;++a)this[n+a]=r[a];return this}};function Tbe(){let e=new nn(9);return nn!=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 Sbe(e,t){if(e===t){let r=t[1],n=t[2],a=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=a}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 kbe(e,t){let r=t[0],n=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],f=l*o-s*c,p=-l*i+s*u,d=c*i-o*u,h=r*f+n*p+a*d;return h?(h=1/h,e[0]=f*h,e[1]=(-l*n+a*c)*h,e[2]=(s*n-a*o)*h,e[3]=p*h,e[4]=(l*r-a*u)*h,e[5]=(-s*r+a*i)*h,e[6]=d*h,e[7]=(-c*r+n*u)*h,e[8]=(o*r-n*i)*h,e):null}function Cbe(e){let t=e[0],r=e[1],n=e[2],a=e[3],i=e[4],o=e[5],s=e[6],u=e[7],c=e[8];return t*(c*i-o*u)+r*(-c*a+o*s)+n*(u*a-i*s)}function RL(e,t,r){let n=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=t[8],p=r[0],d=r[1],h=r[2],m=r[3],g=r[4],x=r[5],y=r[6],w=r[7],T=r[8];return e[0]=p*n+d*o+h*c,e[1]=p*a+d*s+h*l,e[2]=p*i+d*u+h*f,e[3]=m*n+g*o+x*c,e[4]=m*a+g*s+x*l,e[5]=m*i+g*u+x*f,e[6]=y*n+w*o+T*c,e[7]=y*a+w*s+T*l,e[8]=y*i+w*u+T*f,e}function Dbe(e,t,r){let n=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=t[8],p=r[0],d=r[1];return e[0]=n,e[1]=a,e[2]=i,e[3]=o,e[4]=s,e[5]=u,e[6]=p*n+d*o+c,e[7]=p*a+d*s+l,e[8]=p*i+d*u+f,e}function Bbe(e,t,r){let n=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=t[8],p=Math.sin(r),d=Math.cos(r);return e[0]=d*n+p*o,e[1]=d*a+p*s,e[2]=d*i+p*u,e[3]=d*o-p*n,e[4]=d*s-p*a,e[5]=d*u-p*i,e[6]=c,e[7]=l,e[8]=f,e}function jL(e,t,r){let n=r[0],a=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=a*t[3],e[4]=a*t[4],e[5]=a*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Fbe(e,t){let r=t[0],n=t[1],a=t[2],i=t[3],o=r+r,s=n+n,u=a+a,c=r*o,l=n*o,f=n*s,p=a*o,d=a*s,h=a*u,m=i*o,g=i*s,x=i*u;return e[0]=1-f-h,e[3]=l-x,e[6]=p+g,e[1]=l+x,e[4]=1-c-h,e[7]=d-m,e[2]=p-g,e[5]=d+m,e[8]=1-c-f,e}var LL;(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"})(LL||(LL={}));var _yt=Object.freeze([1,0,0,0,1,0,0,0,1]),nr=class extends Xm{static get IDENTITY(){return Ayt()}static get ZERO(){return wyt()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return LL}constructor(t,...r){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):r.length>0?this.copy([t,...r]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(_yt)}fromObject(t){return this.check()}fromQuaternion(t){return Fbe(this,t),this.check()}set(t,r,n,a,i,o,s,u,c){return this[0]=t,this[1]=r,this[2]=n,this[3]=a,this[4]=i,this[5]=o,this[6]=s,this[7]=u,this[8]=c,this.check()}setRowMajor(t,r,n,a,i,o,s,u,c){return this[0]=t,this[1]=a,this[2]=s,this[3]=r,this[4]=i,this[5]=u,this[6]=n,this[7]=o,this[8]=c,this.check()}determinant(){return Cbe(this)}transpose(){return Sbe(this,this),this.check()}invert(){return kbe(this,this),this.check()}multiplyLeft(t){return RL(this,t,this),this.check()}multiplyRight(t){return RL(this,this,t),this.check()}rotate(t){return Bbe(this,this,t),this.check()}scale(t){return Array.isArray(t)?jL(this,this,t):jL(this,this,[t,t]),this.check()}translate(t){return Dbe(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=gS(r||[-0,-0],t,this);break;case 3:n=b1(r||[-0,-0,-0],t,this);break;case 4:n=yS(r||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Of(n,t.length),n}transformVector(t,r){return this.transform(t,r)}transformVector2(t,r){return this.transform(t,r)}transformVector3(t,r){return this.transform(t,r)}},TS,SS=null;function wyt(){return TS||(TS=new nr([0,0,0,0,0,0,0,0,0]),Object.freeze(TS)),TS}function Ayt(){return SS||(SS=new nr,Object.freeze(SS)),SS}var kS={};Fa(kS,{add:()=>Kyt,adjoint:()=>Dyt,clone:()=>Tyt,copy:()=>Syt,create:()=>Eyt,decompose:()=>qyt,determinant:()=>NL,equals:()=>Qyt,exactEquals:()=>Yyt,frob:()=>Wyt,fromQuat:()=>KL,fromQuat2:()=>jyt,fromRotation:()=>Oyt,fromRotationTranslation:()=>Pbe,fromRotationTranslationScale:()=>Nyt,fromRotationTranslationScaleOrigin:()=>Uyt,fromScaling:()=>Fyt,fromTranslation:()=>Byt,fromValues:()=>kyt,fromXRotation:()=>Iyt,fromYRotation:()=>Pyt,fromZRotation:()=>Ryt,frustum:()=>JL,getRotation:()=>Myt,getScaling:()=>Rbe,getTranslation:()=>Lyt,identity:()=>Ibe,invert:()=>qL,lookAt:()=>QL,mul:()=>Zyt,multiply:()=>x1,multiplyScalar:()=>Jyt,multiplyScalarAndAdd:()=>Xyt,ortho:()=>YL,orthoNO:()=>Lbe,orthoZO:()=>Hyt,perspective:()=>XL,perspectiveFromFieldOfView:()=>Gyt,perspectiveNO:()=>jbe,perspectiveZO:()=>zyt,rotate:()=>HL,rotateX:()=>VL,rotateY:()=>$L,rotateZ:()=>WL,scale:()=>zL,set:()=>Cyt,str:()=>$yt,sub:()=>e_t,subtract:()=>Mbe,targetTo:()=>Vyt,translate:()=>UL,transpose:()=>ML});function Eyt(){let e=new nn(16);return nn!=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 Tyt(e){let t=new nn(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 Syt(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 kyt(e,t,r,n,a,i,o,s,u,c,l,f,p,d,h,m){let g=new nn(16);return g[0]=e,g[1]=t,g[2]=r,g[3]=n,g[4]=a,g[5]=i,g[6]=o,g[7]=s,g[8]=u,g[9]=c,g[10]=l,g[11]=f,g[12]=p,g[13]=d,g[14]=h,g[15]=m,g}function Cyt(e,t,r,n,a,i,o,s,u,c,l,f,p,d,h,m,g){return e[0]=t,e[1]=r,e[2]=n,e[3]=a,e[4]=i,e[5]=o,e[6]=s,e[7]=u,e[8]=c,e[9]=l,e[10]=f,e[11]=p,e[12]=d,e[13]=h,e[14]=m,e[15]=g,e}function Ibe(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 ML(e,t){if(e===t){let r=t[1],n=t[2],a=t[3],i=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=i,e[11]=t[14],e[12]=a,e[13]=o,e[14]=s}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 qL(e,t){let r=t[0],n=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],f=t[9],p=t[10],d=t[11],h=t[12],m=t[13],g=t[14],x=t[15],y=r*s-n*o,w=r*u-a*o,T=r*c-i*o,A=n*u-a*s,B=n*c-i*s,I=a*c-i*u,L=l*m-f*h,C=l*g-p*h,k=l*x-d*h,F=f*g-p*m,R=f*x-d*m,G=p*x-d*g,z=y*G-w*R+T*F+A*k-B*C+I*L;return z?(z=1/z,e[0]=(s*G-u*R+c*F)*z,e[1]=(a*R-n*G-i*F)*z,e[2]=(m*I-g*B+x*A)*z,e[3]=(p*B-f*I-d*A)*z,e[4]=(u*k-o*G-c*C)*z,e[5]=(r*G-a*k+i*C)*z,e[6]=(g*T-h*I-x*w)*z,e[7]=(l*I-p*T+d*w)*z,e[8]=(o*R-s*k+c*L)*z,e[9]=(n*k-r*R-i*L)*z,e[10]=(h*B-m*T+x*y)*z,e[11]=(f*T-l*B-d*y)*z,e[12]=(s*C-o*F-u*L)*z,e[13]=(r*F-n*C+a*L)*z,e[14]=(m*w-h*A-g*y)*z,e[15]=(l*A-f*w+p*y)*z,e):null}function Dyt(e,t){let r=t[0],n=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],f=t[9],p=t[10],d=t[11],h=t[12],m=t[13],g=t[14],x=t[15],y=r*s-n*o,w=r*u-a*o,T=r*c-i*o,A=n*u-a*s,B=n*c-i*s,I=a*c-i*u,L=l*m-f*h,C=l*g-p*h,k=l*x-d*h,F=f*g-p*m,R=f*x-d*m,G=p*x-d*g;return e[0]=s*G-u*R+c*F,e[1]=a*R-n*G-i*F,e[2]=m*I-g*B+x*A,e[3]=p*B-f*I-d*A,e[4]=u*k-o*G-c*C,e[5]=r*G-a*k+i*C,e[6]=g*T-h*I-x*w,e[7]=l*I-p*T+d*w,e[8]=o*R-s*k+c*L,e[9]=n*k-r*R-i*L,e[10]=h*B-m*T+x*y,e[11]=f*T-l*B-d*y,e[12]=s*C-o*F-u*L,e[13]=r*F-n*C+a*L,e[14]=m*w-h*A-g*y,e[15]=l*A-f*w+p*y,e}function NL(e){let t=e[0],r=e[1],n=e[2],a=e[3],i=e[4],o=e[5],s=e[6],u=e[7],c=e[8],l=e[9],f=e[10],p=e[11],d=e[12],h=e[13],m=e[14],g=e[15],x=t*o-r*i,y=t*s-n*i,w=r*s-n*o,T=c*h-l*d,A=c*m-f*d,B=l*m-f*h,I=t*B-r*A+n*T,L=i*B-o*A+s*T,C=c*w-l*y+f*x,k=d*w-h*y+m*x;return u*I-a*L+g*C-p*k}function x1(e,t,r){let n=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=t[8],p=t[9],d=t[10],h=t[11],m=t[12],g=t[13],x=t[14],y=t[15],w=r[0],T=r[1],A=r[2],B=r[3];return e[0]=w*n+T*s+A*f+B*m,e[1]=w*a+T*u+A*p+B*g,e[2]=w*i+T*c+A*d+B*x,e[3]=w*o+T*l+A*h+B*y,w=r[4],T=r[5],A=r[6],B=r[7],e[4]=w*n+T*s+A*f+B*m,e[5]=w*a+T*u+A*p+B*g,e[6]=w*i+T*c+A*d+B*x,e[7]=w*o+T*l+A*h+B*y,w=r[8],T=r[9],A=r[10],B=r[11],e[8]=w*n+T*s+A*f+B*m,e[9]=w*a+T*u+A*p+B*g,e[10]=w*i+T*c+A*d+B*x,e[11]=w*o+T*l+A*h+B*y,w=r[12],T=r[13],A=r[14],B=r[15],e[12]=w*n+T*s+A*f+B*m,e[13]=w*a+T*u+A*p+B*g,e[14]=w*i+T*c+A*d+B*x,e[15]=w*o+T*l+A*h+B*y,e}function UL(e,t,r){let n=r[0],a=r[1],i=r[2],o,s,u,c,l,f,p,d,h,m,g,x;return t===e?(e[12]=t[0]*n+t[4]*a+t[8]*i+t[12],e[13]=t[1]*n+t[5]*a+t[9]*i+t[13],e[14]=t[2]*n+t[6]*a+t[10]*i+t[14],e[15]=t[3]*n+t[7]*a+t[11]*i+t[15]):(o=t[0],s=t[1],u=t[2],c=t[3],l=t[4],f=t[5],p=t[6],d=t[7],h=t[8],m=t[9],g=t[10],x=t[11],e[0]=o,e[1]=s,e[2]=u,e[3]=c,e[4]=l,e[5]=f,e[6]=p,e[7]=d,e[8]=h,e[9]=m,e[10]=g,e[11]=x,e[12]=o*n+l*a+h*i+t[12],e[13]=s*n+f*a+m*i+t[13],e[14]=u*n+p*a+g*i+t[14],e[15]=c*n+d*a+x*i+t[15]),e}function zL(e,t,r){let n=r[0],a=r[1],i=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,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 HL(e,t,r,n){let a=n[0],i=n[1],o=n[2],s=Math.sqrt(a*a+i*i+o*o),u,c,l,f,p,d,h,m,g,x,y,w,T,A,B,I,L,C,k,F,R,G,z,W;return s<1e-6?null:(s=1/s,a*=s,i*=s,o*=s,c=Math.sin(r),u=Math.cos(r),l=1-u,f=t[0],p=t[1],d=t[2],h=t[3],m=t[4],g=t[5],x=t[6],y=t[7],w=t[8],T=t[9],A=t[10],B=t[11],I=a*a*l+u,L=i*a*l+o*c,C=o*a*l-i*c,k=a*i*l-o*c,F=i*i*l+u,R=o*i*l+a*c,G=a*o*l+i*c,z=i*o*l-a*c,W=o*o*l+u,e[0]=f*I+m*L+w*C,e[1]=p*I+g*L+T*C,e[2]=d*I+x*L+A*C,e[3]=h*I+y*L+B*C,e[4]=f*k+m*F+w*R,e[5]=p*k+g*F+T*R,e[6]=d*k+x*F+A*R,e[7]=h*k+y*F+B*R,e[8]=f*G+m*z+w*W,e[9]=p*G+g*z+T*W,e[10]=d*G+x*z+A*W,e[11]=h*G+y*z+B*W,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function VL(e,t,r){let n=Math.sin(r),a=Math.cos(r),i=t[4],o=t[5],s=t[6],u=t[7],c=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*a+c*n,e[5]=o*a+l*n,e[6]=s*a+f*n,e[7]=u*a+p*n,e[8]=c*a-i*n,e[9]=l*a-o*n,e[10]=f*a-s*n,e[11]=p*a-u*n,e}function $L(e,t,r){let n=Math.sin(r),a=Math.cos(r),i=t[0],o=t[1],s=t[2],u=t[3],c=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*a-c*n,e[1]=o*a-l*n,e[2]=s*a-f*n,e[3]=u*a-p*n,e[8]=i*n+c*a,e[9]=o*n+l*a,e[10]=s*n+f*a,e[11]=u*n+p*a,e}function WL(e,t,r){let n=Math.sin(r),a=Math.cos(r),i=t[0],o=t[1],s=t[2],u=t[3],c=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*a+c*n,e[1]=o*a+l*n,e[2]=s*a+f*n,e[3]=u*a+p*n,e[4]=c*a-i*n,e[5]=l*a-o*n,e[6]=f*a-s*n,e[7]=p*a-u*n,e}function Byt(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 Fyt(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 Oyt(e,t,r){let n=r[0],a=r[1],i=r[2],o=Math.sqrt(n*n+a*a+i*i),s,u,c;return o<1e-6?null:(o=1/o,n*=o,a*=o,i*=o,u=Math.sin(t),s=Math.cos(t),c=1-s,e[0]=n*n*c+s,e[1]=a*n*c+i*u,e[2]=i*n*c-a*u,e[3]=0,e[4]=n*a*c-i*u,e[5]=a*a*c+s,e[6]=i*a*c+n*u,e[7]=0,e[8]=n*i*c+a*u,e[9]=a*i*c-n*u,e[10]=i*i*c+s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function Iyt(e,t){let r=Math.sin(t),n=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Pyt(e,t){let r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ryt(e,t){let r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Pbe(e,t,r){let n=t[0],a=t[1],i=t[2],o=t[3],s=n+n,u=a+a,c=i+i,l=n*s,f=n*u,p=n*c,d=a*u,h=a*c,m=i*c,g=o*s,x=o*u,y=o*c;return e[0]=1-(d+m),e[1]=f+y,e[2]=p-x,e[3]=0,e[4]=f-y,e[5]=1-(l+m),e[6]=h+g,e[7]=0,e[8]=p+x,e[9]=h-g,e[10]=1-(l+d),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function jyt(e,t){let r=new nn(3),n=-t[0],a=-t[1],i=-t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=n*n+a*a+i*i+o*o;return f>0?(r[0]=(s*o+l*n+u*i-c*a)*2/f,r[1]=(u*o+l*a+c*n-s*i)*2/f,r[2]=(c*o+l*i+s*a-u*n)*2/f):(r[0]=(s*o+l*n+u*i-c*a)*2,r[1]=(u*o+l*a+c*n-s*i)*2,r[2]=(c*o+l*i+s*a-u*n)*2),Pbe(e,t,r),e}function Lyt(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Rbe(e,t){let r=t[0],n=t[1],a=t[2],i=t[4],o=t[5],s=t[6],u=t[8],c=t[9],l=t[10];return e[0]=Math.sqrt(r*r+n*n+a*a),e[1]=Math.sqrt(i*i+o*o+s*s),e[2]=Math.sqrt(u*u+c*c+l*l),e}function Myt(e,t){let r=new nn(3);Rbe(r,t);let n=1/r[0],a=1/r[1],i=1/r[2],o=t[0]*n,s=t[1]*a,u=t[2]*i,c=t[4]*n,l=t[5]*a,f=t[6]*i,p=t[8]*n,d=t[9]*a,h=t[10]*i,m=o+l+h,g=0;return m>0?(g=Math.sqrt(m+1)*2,e[3]=.25*g,e[0]=(f-d)/g,e[1]=(p-u)/g,e[2]=(s-c)/g):o>l&&o>h?(g=Math.sqrt(1+o-l-h)*2,e[3]=(f-d)/g,e[0]=.25*g,e[1]=(s+c)/g,e[2]=(p+u)/g):l>h?(g=Math.sqrt(1+l-o-h)*2,e[3]=(p-u)/g,e[0]=(s+c)/g,e[1]=.25*g,e[2]=(f+d)/g):(g=Math.sqrt(1+h-o-l)*2,e[3]=(s-c)/g,e[0]=(p+u)/g,e[1]=(f+d)/g,e[2]=.25*g),e}function qyt(e,t,r,n){t[0]=n[12],t[1]=n[13],t[2]=n[14];let a=n[0],i=n[1],o=n[2],s=n[4],u=n[5],c=n[6],l=n[8],f=n[9],p=n[10];r[0]=Math.sqrt(a*a+i*i+o*o),r[1]=Math.sqrt(s*s+u*u+c*c),r[2]=Math.sqrt(l*l+f*f+p*p);let d=1/r[0],h=1/r[1],m=1/r[2],g=a*d,x=i*h,y=o*m,w=s*d,T=u*h,A=c*m,B=l*d,I=f*h,L=p*m,C=g+T+L,k=0;return C>0?(k=Math.sqrt(C+1)*2,e[3]=.25*k,e[0]=(A-I)/k,e[1]=(B-y)/k,e[2]=(x-w)/k):g>T&&g>L?(k=Math.sqrt(1+g-T-L)*2,e[3]=(A-I)/k,e[0]=.25*k,e[1]=(x+w)/k,e[2]=(B+y)/k):T>L?(k=Math.sqrt(1+T-g-L)*2,e[3]=(B-y)/k,e[0]=(x+w)/k,e[1]=.25*k,e[2]=(A+I)/k):(k=Math.sqrt(1+L-g-T)*2,e[3]=(x-w)/k,e[0]=(B+y)/k,e[1]=(A+I)/k,e[2]=.25*k),e}function Nyt(e,t,r,n){let a=t[0],i=t[1],o=t[2],s=t[3],u=a+a,c=i+i,l=o+o,f=a*u,p=a*c,d=a*l,h=i*c,m=i*l,g=o*l,x=s*u,y=s*c,w=s*l,T=n[0],A=n[1],B=n[2];return e[0]=(1-(h+g))*T,e[1]=(p+w)*T,e[2]=(d-y)*T,e[3]=0,e[4]=(p-w)*A,e[5]=(1-(f+g))*A,e[6]=(m+x)*A,e[7]=0,e[8]=(d+y)*B,e[9]=(m-x)*B,e[10]=(1-(f+h))*B,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function Uyt(e,t,r,n,a){let i=t[0],o=t[1],s=t[2],u=t[3],c=i+i,l=o+o,f=s+s,p=i*c,d=i*l,h=i*f,m=o*l,g=o*f,x=s*f,y=u*c,w=u*l,T=u*f,A=n[0],B=n[1],I=n[2],L=a[0],C=a[1],k=a[2],F=(1-(m+x))*A,R=(d+T)*A,G=(h-w)*A,z=(d-T)*B,W=(1-(p+x))*B,Y=(g+y)*B,ue=(h+w)*I,ie=(g-y)*I,le=(1-(p+m))*I;return e[0]=F,e[1]=R,e[2]=G,e[3]=0,e[4]=z,e[5]=W,e[6]=Y,e[7]=0,e[8]=ue,e[9]=ie,e[10]=le,e[11]=0,e[12]=r[0]+L-(F*L+z*C+ue*k),e[13]=r[1]+C-(R*L+W*C+ie*k),e[14]=r[2]+k-(G*L+Y*C+le*k),e[15]=1,e}function KL(e,t){let r=t[0],n=t[1],a=t[2],i=t[3],o=r+r,s=n+n,u=a+a,c=r*o,l=n*o,f=n*s,p=a*o,d=a*s,h=a*u,m=i*o,g=i*s,x=i*u;return e[0]=1-f-h,e[1]=l+x,e[2]=p-g,e[3]=0,e[4]=l-x,e[5]=1-c-h,e[6]=d+m,e[7]=0,e[8]=p+g,e[9]=d-m,e[10]=1-c-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function JL(e,t,r,n,a,i,o){let s=1/(r-t),u=1/(a-n),c=1/(i-o);return e[0]=i*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*u,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(a+n)*u,e[10]=(o+i)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*c,e[15]=0,e}function jbe(e,t,r,n,a){let i=1/Math.tan(t/2);if(e[0]=i/r,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,a!=null&&a!==1/0){let o=1/(n-a);e[10]=(a+n)*o,e[14]=2*a*n*o}else e[10]=-1,e[14]=-2*n;return e}var XL=jbe;function zyt(e,t,r,n,a){let i=1/Math.tan(t/2);if(e[0]=i/r,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,a!=null&&a!==1/0){let o=1/(n-a);e[10]=a*o,e[14]=a*n*o}else e[10]=-1,e[14]=-n;return e}function Gyt(e,t,r,n){let a=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),u=2/(o+s),c=2/(a+i);return e[0]=u,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=-((o-s)*u*.5),e[9]=(a-i)*c*.5,e[10]=n/(r-n),e[11]=-1,e[12]=0,e[13]=0,e[14]=n*r/(r-n),e[15]=0,e}function Lbe(e,t,r,n,a,i,o){let s=1/(t-r),u=1/(n-a),c=1/(i-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+r)*s,e[13]=(a+n)*u,e[14]=(o+i)*c,e[15]=1,e}var YL=Lbe;function Hyt(e,t,r,n,a,i,o){let s=1/(t-r),u=1/(n-a),c=1/(i-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=c,e[11]=0,e[12]=(t+r)*s,e[13]=(a+n)*u,e[14]=i*c,e[15]=1,e}function QL(e,t,r,n){let a,i,o,s,u,c,l,f,p,d,h=t[0],m=t[1],g=t[2],x=n[0],y=n[1],w=n[2],T=r[0],A=r[1],B=r[2];return Math.abs(h-T)<1e-6&&Math.abs(m-A)<1e-6&&Math.abs(g-B)<1e-6?Ibe(e):(f=h-T,p=m-A,d=g-B,a=1/Math.sqrt(f*f+p*p+d*d),f*=a,p*=a,d*=a,i=y*d-w*p,o=w*f-x*d,s=x*p-y*f,a=Math.sqrt(i*i+o*o+s*s),a?(a=1/a,i*=a,o*=a,s*=a):(i=0,o=0,s=0),u=p*s-d*o,c=d*i-f*s,l=f*o-p*i,a=Math.sqrt(u*u+c*c+l*l),a?(a=1/a,u*=a,c*=a,l*=a):(u=0,c=0,l=0),e[0]=i,e[1]=u,e[2]=f,e[3]=0,e[4]=o,e[5]=c,e[6]=p,e[7]=0,e[8]=s,e[9]=l,e[10]=d,e[11]=0,e[12]=-(i*h+o*m+s*g),e[13]=-(u*h+c*m+l*g),e[14]=-(f*h+p*m+d*g),e[15]=1,e)}function Vyt(e,t,r,n){let a=t[0],i=t[1],o=t[2],s=n[0],u=n[1],c=n[2],l=a-r[0],f=i-r[1],p=o-r[2],d=l*l+f*f+p*p;d>0&&(d=1/Math.sqrt(d),l*=d,f*=d,p*=d);let h=u*p-c*f,m=c*l-s*p,g=s*f-u*l;return d=h*h+m*m+g*g,d>0&&(d=1/Math.sqrt(d),h*=d,m*=d,g*=d),e[0]=h,e[1]=m,e[2]=g,e[3]=0,e[4]=f*g-p*m,e[5]=p*h-l*g,e[6]=l*m-f*h,e[7]=0,e[8]=l,e[9]=f,e[10]=p,e[11]=0,e[12]=a,e[13]=i,e[14]=o,e[15]=1,e}function $yt(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 Wyt(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 Kyt(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e}function Mbe(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}function Jyt(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e}function Xyt(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e[4]=t[4]+r[4]*n,e[5]=t[5]+r[5]*n,e[6]=t[6]+r[6]*n,e[7]=t[7]+r[7]*n,e[8]=t[8]+r[8]*n,e[9]=t[9]+r[9]*n,e[10]=t[10]+r[10]*n,e[11]=t[11]+r[11]*n,e[12]=t[12]+r[12]*n,e[13]=t[13]+r[13]*n,e[14]=t[14]+r[14]*n,e[15]=t[15]+r[15]*n,e}function Yyt(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 Qyt(e,t){let r=e[0],n=e[1],a=e[2],i=e[3],o=e[4],s=e[5],u=e[6],c=e[7],l=e[8],f=e[9],p=e[10],d=e[11],h=e[12],m=e[13],g=e[14],x=e[15],y=t[0],w=t[1],T=t[2],A=t[3],B=t[4],I=t[5],L=t[6],C=t[7],k=t[8],F=t[9],R=t[10],G=t[11],z=t[12],W=t[13],Y=t[14],ue=t[15];return Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(n-w)<=1e-6*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(a-T)<=1e-6*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(i-A)<=1e-6*Math.max(1,Math.abs(i),Math.abs(A))&&Math.abs(o-B)<=1e-6*Math.max(1,Math.abs(o),Math.abs(B))&&Math.abs(s-I)<=1e-6*Math.max(1,Math.abs(s),Math.abs(I))&&Math.abs(u-L)<=1e-6*Math.max(1,Math.abs(u),Math.abs(L))&&Math.abs(c-C)<=1e-6*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(l-k)<=1e-6*Math.max(1,Math.abs(l),Math.abs(k))&&Math.abs(f-F)<=1e-6*Math.max(1,Math.abs(f),Math.abs(F))&&Math.abs(p-R)<=1e-6*Math.max(1,Math.abs(p),Math.abs(R))&&Math.abs(d-G)<=1e-6*Math.max(1,Math.abs(d),Math.abs(G))&&Math.abs(h-z)<=1e-6*Math.max(1,Math.abs(h),Math.abs(z))&&Math.abs(m-W)<=1e-6*Math.max(1,Math.abs(m),Math.abs(W))&&Math.abs(g-Y)<=1e-6*Math.max(1,Math.abs(g),Math.abs(Y))&&Math.abs(x-ue)<=1e-6*Math.max(1,Math.abs(x),Math.abs(ue))}var Zyt=x1,e_t=Mbe;function t_t(){let e=new nn(4);return nn!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function qbe(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function Nbe(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function Ube(e){let t=e[0],r=e[1],n=e[2],a=e[3];return Math.sqrt(t*t+r*r+n*n+a*a)}function zbe(e){let t=e[0],r=e[1],n=e[2],a=e[3];return t*t+r*r+n*n+a*a}function Gbe(e,t){let r=t[0],n=t[1],a=t[2],i=t[3],o=r*r+n*n+a*a+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=n*o,e[2]=a*o,e[3]=i*o,e}function Hbe(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Vbe(e,t,r,n){let a=t[0],i=t[1],o=t[2],s=t[3];return e[0]=a+n*(r[0]-a),e[1]=i+n*(r[1]-i),e[2]=o+n*(r[2]-o),e[3]=s+n*(r[3]-s),e}function $be(e,t,r){let n=t[0],a=t[1],i=t[2],o=t[3];return e[0]=r[0]*n+r[4]*a+r[8]*i+r[12]*o,e[1]=r[1]*n+r[5]*a+r[9]*i+r[13]*o,e[2]=r[2]*n+r[6]*a+r[10]*i+r[14]*o,e[3]=r[3]*n+r[7]*a+r[11]*i+r[15]*o,e}function Wbe(e,t,r){let n=t[0],a=t[1],i=t[2],o=r[0],s=r[1],u=r[2],c=r[3],l=c*n+s*i-u*a,f=c*a+u*n-o*i,p=c*i+o*a-s*n,d=-o*n-s*a-u*i;return e[0]=l*c+d*-o+f*-u-p*-s,e[1]=f*c+d*-s+p*-o-l*-u,e[2]=p*c+d*-u+l*-s-f*-o,e[3]=t[3],e}var Drr=function(){let e=t_t();return function(t,r,n,a,i,o){let s,u;for(r||(r=4),n||(n=0),a?u=Math.min(a*r+n,t.length):u=t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],e[3]=t[s+3],i(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3];return t}}();var tM;(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"})(tM||(tM={}));var r_t=45*Math.PI/180,n_t=1,ZL=.1,eM=500,a_t=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),mr=class extends Xm{static get IDENTITY(){return o_t()}static get ZERO(){return i_t()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return tM}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,r,n,a,i,o,s,u,c,l,f,p,d,h,m,g){return this[0]=t,this[1]=r,this[2]=n,this[3]=a,this[4]=i,this[5]=o,this[6]=s,this[7]=u,this[8]=c,this[9]=l,this[10]=f,this[11]=p,this[12]=d,this[13]=h,this[14]=m,this[15]=g,this.check()}setRowMajor(t,r,n,a,i,o,s,u,c,l,f,p,d,h,m,g){return this[0]=t,this[1]=i,this[2]=c,this[3]=d,this[4]=r,this[5]=o,this[6]=l,this[7]=h,this[8]=n,this[9]=s,this[10]=f,this[11]=m,this[12]=a,this[13]=u,this[14]=p,this[15]=g,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(a_t)}fromObject(t){return this.check()}fromQuaternion(t){return KL(this,t),this.check()}frustum(t){let{left:r,right:n,bottom:a,top:i,near:o=ZL,far:s=eM}=t;return s===1/0?s_t(this,r,n,a,i,o):JL(this,r,n,a,i,o,s),this.check()}lookAt(t){let{eye:r,center:n=[0,0,0],up:a=[0,1,0]}=t;return QL(this,r,n,a),this.check()}ortho(t){let{left:r,right:n,bottom:a,top:i,near:o=ZL,far:s=eM}=t;return YL(this,r,n,a,i,o,s),this.check()}orthographic(t){let{fovy:r=r_t,aspect:n=n_t,focalDistance:a=1,near:i=ZL,far:o=eM}=t;Jbe(r);let s=r/2,u=a*Math.tan(s),c=u*n;return this.ortho({left:-c,right:c,bottom:-u,top:u,near:i,far:o})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:n=1,near:a=.1,far:i=500}=t;return Jbe(r),XL(this,r,n,a,i),this.check()}determinant(){return NL(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),a=1/n[0],i=1/n[1],o=1/n[2];return t[0]=this[0]*a,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*a,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*a,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,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),a=1/n[0],i=1/n[1],o=1/n[2];return t[0]=this[0]*a,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*a,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*a,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return ML(this,this),this.check()}invert(){return qL(this,this),this.check()}multiplyLeft(t){return x1(this,t,this),this.check()}multiplyRight(t){return x1(this,this,t),this.check()}rotateX(t){return VL(this,this,t),this.check()}rotateY(t){return $L(this,this,t),this.check()}rotateZ(t){return WL(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return HL(this,this,t,r),this.check()}scale(t){return zL(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return UL(this,this,t),this.check()}transform(t,r){return t.length===4?(r=$be(r||[-0,-0,-0,-0],t,this),Of(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,a;switch(n){case 2:a=bS(r||[-0,-0],t,this);break;case 3:a=Ed(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Of(a,t.length),a}transformAsVector(t,r){let n;switch(t.length){case 2:n=vS(r||[-0,-0],t,this);break;case 3:n=xS(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Of(n,t.length),n}transformPoint(t,r){return this.transformAsPoint(t,r)}transformVector(t,r){return this.transformAsPoint(t,r)}transformDirection(t,r){return this.transformAsVector(t,r)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,r,n){return this.identity().translate([t,r,n])}},CS,DS;function i_t(){return CS||(CS=new mr([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(CS)),CS}function o_t(){return DS||(DS=new mr,Object.freeze(DS)),DS}function Jbe(e){if(e>Math.PI*2)throw Error("expected radians")}function s_t(e,t,r,n,a,i){let o=2*i/(r-t),s=2*i/(a-n),u=(r+t)/(r-t),c=(a+n)/(a-n),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]=s,e[6]=0,e[7]=0,e[8]=u,e[9]=c,e[10]=l,e[11]=f,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function Xbe(){let e=new nn(4);return nn!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Ybe(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function rM(e,t,r){r=r*.5;let n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function nM(e,t,r){let n=t[0],a=t[1],i=t[2],o=t[3],s=r[0],u=r[1],c=r[2],l=r[3];return e[0]=n*l+o*s+a*c-i*u,e[1]=a*l+o*u+i*s-n*c,e[2]=i*l+o*c+n*u-a*s,e[3]=o*l-n*s-a*u-i*c,e}function Qbe(e,t,r){r*=.5;let n=t[0],a=t[1],i=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+o*s,e[1]=a*u+i*s,e[2]=i*u-a*s,e[3]=o*u-n*s,e}function Zbe(e,t,r){r*=.5;let n=t[0],a=t[1],i=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u-i*s,e[1]=a*u+o*s,e[2]=i*u+n*s,e[3]=o*u-a*s,e}function eve(e,t,r){r*=.5;let n=t[0],a=t[1],i=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+a*s,e[1]=a*u-n*s,e[2]=i*u+o*s,e[3]=o*u-i*s,e}function tve(e,t){let r=t[0],n=t[1],a=t[2];return e[0]=r,e[1]=n,e[2]=a,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-a*a)),e}function y1(e,t,r,n){let a=t[0],i=t[1],o=t[2],s=t[3],u=r[0],c=r[1],l=r[2],f=r[3],p,d,h,m,g;return p=a*u+i*c+o*l+s*f,p<0&&(p=-p,u=-u,c=-c,l=-l,f=-f),1-p>1e-6?(d=Math.acos(p),g=Math.sin(d),h=Math.sin((1-n)*d)/g,m=Math.sin(n*d)/g):(h=1-n,m=n),e[0]=h*a+m*u,e[1]=h*i+m*c,e[2]=h*o+m*l,e[3]=h*s+m*f,e}function rve(e,t){let r=t[0],n=t[1],a=t[2],i=t[3],o=r*r+n*n+a*a+i*i,s=o?1/o:0;return e[0]=-r*s,e[1]=-n*s,e[2]=-a*s,e[3]=i*s,e}function nve(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function aM(e,t){let r=t[0]+t[4]+t[8],n;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{let a=0;t[4]>t[0]&&(a=1),t[8]>t[a*3+a]&&(a=2);let i=(a+1)%3,o=(a+2)%3;n=Math.sqrt(t[a*3+a]-t[i*3+i]-t[o*3+o]+1),e[a]=.5*n,n=.5/n,e[3]=(t[i*3+o]-t[o*3+i])*n,e[i]=(t[i*3+a]+t[a*3+i])*n,e[o]=(t[o*3+a]+t[a*3+o])*n}return e}var ave=qbe;var ive=Nbe,ove=Hbe,sve=Vbe,uve=Ube;var cve=zbe;var lve=Gbe;var fve=function(){let e=_S(),t=wS(1,0,0),r=wS(0,1,0);return function(n,a,i){let o=g1(a,i);return o<-.999999?(Ad(e,t,a),IL(e)<1e-6&&Ad(e,r,a),CL(e,e),rM(n,e,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Ad(e,a,i),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+o,lve(n,n))}}(),Grr=function(){let e=Xbe(),t=Xbe();return function(r,n,a,i,o,s){return y1(e,n,o,s),y1(t,a,i,s),y1(r,e,t,2*s*(1-s)),r}}(),Hrr=function(){let e=Tbe();return function(t,r,n,a){return e[0]=n[0],e[3]=n[1],e[6]=n[2],e[1]=a[0],e[4]=a[1],e[7]=a[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],lve(t,aM(t,e))}}();var c_t=[0,0,0,1],Io=class extends Ff{constructor(t=0,r=0,n=0,a=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,n,a)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,r,n,a){return this[0]=t,this[1]=r,this[2]=n,this[3]=a,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 aM(this,t),this.check()}fromAxisRotation(t,r){return rM(this,t,r),this.check()}identity(){return Ybe(this),this.check()}setAxisAngle(t,r){return this.fromAxisRotation(t,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=Ut(t)}get y(){return this[1]}set y(t){this[1]=Ut(t)}get z(){return this[2]}set z(t){this[2]=Ut(t)}get w(){return this[3]}set w(t){this[3]=Ut(t)}len(){return uve(this)}lengthSquared(){return cve(this)}dot(t){return ove(this,t)}rotationTo(t,r){return fve(this,t,r),this.check()}add(t){return ave(this,this,t),this.check()}calculateW(){return tve(this,this),this.check()}conjugate(){return nve(this,this),this.check()}invert(){return rve(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(sve(this,t,r,n),this.check())}multiplyRight(t){return nM(this,this,t),this.check()}multiplyLeft(t){return nM(this,t,this),this.check()}normalize(){let t=this.len(),r=t>0?1/t:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,t===0&&(this[3]=1),this.check()}rotateX(t){return Qbe(this,this,t),this.check()}rotateY(t){return Zbe(this,this,t),this.check()}rotateZ(t){return eve(this,this,t),this.check()}scale(t){return ive(this,this,t),this.check()}slerp(t,r,n){let a,i,o;switch(arguments.length){case 1:({start:a=c_t,target:i,ratio:o}=t);break;case 2:a=this,i=t,o=r;break;default:a=t,i=r,o=n}return y1(this,a,i,o),this.check()}transformVector4(t,r=new Oo){return Wbe(r,t,this),Of(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,r){return this.setAxisAngle(t,r)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Es={};Fa(Es,{EPSILON1:()=>l_t,EPSILON10:()=>x_t,EPSILON11:()=>y_t,EPSILON12:()=>__t,EPSILON13:()=>w_t,EPSILON14:()=>A_t,EPSILON15:()=>E_t,EPSILON16:()=>T_t,EPSILON17:()=>S_t,EPSILON18:()=>k_t,EPSILON19:()=>C_t,EPSILON2:()=>f_t,EPSILON20:()=>D_t,EPSILON3:()=>p_t,EPSILON4:()=>d_t,EPSILON5:()=>h_t,EPSILON6:()=>m_t,EPSILON7:()=>g_t,EPSILON8:()=>b_t,EPSILON9:()=>v_t,PI_OVER_FOUR:()=>F_t,PI_OVER_SIX:()=>O_t,PI_OVER_TWO:()=>B_t,TWO_PI:()=>I_t});var l_t=.1,f_t=.01,p_t=.001,d_t=1e-4,h_t=1e-5,m_t=1e-6,g_t=1e-7,b_t=1e-8,v_t=1e-9,x_t=1e-10,y_t=1e-11,__t=1e-12,w_t=1e-13,A_t=1e-14,E_t=1e-15,T_t=1e-16,S_t=1e-17,k_t=1e-18,C_t=1e-19,D_t=1e-20,B_t=Math.PI/2,F_t=Math.PI/4,O_t=Math.PI/6,I_t=Math.PI*2;var $c=6356752314245179e-9,P_t={radii:[6378137,6378137,$c],radiiSquared:[6378137*6378137,6378137*6378137,$c*$c],oneOverRadii:[1/6378137,1/6378137,1/$c],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/($c*$c)],maximumRadius:Math.max(6378137,6378137,$c),centerToleranceSquared:.1};function BS(e){return e}var ynr=new Z;function R_t(e,t=[],r=BS){return"longitude"in e?(t[0]=r(e.longitude),t[1]=r(e.latitude),t[2]=e.height):"x"in e?(t[0]=r(e.x),t[1]=r(e.y),t[2]=e.z):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}function pve(e,t=[]){return R_t(e,t,Rr._cartographicRadians?BS:EL)}function j_t(e,t,r=BS){return"longitude"in t?(t.longitude=r(e[0]),t.latitude=r(e[1]),t.height=e[2]):"x"in t?(t.x=r(e[0]),t.y=r(e[1]),t.z=e[2]):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}function dve(e,t){return j_t(e,t,Rr._cartographicRadians?BS:TL)}var hve=1e-14,L_t=new Z,mve={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},iM={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},_1={east:new Z,north:new Z,up:new Z,west:new Z,south:new Z,down:new Z},M_t=new Z,q_t=new Z,N_t=new Z;function oM(e,t,r,n,a,i){let o=mve[t]&&mve[t][r];ca(o&&(!n||n===o));let s,u,c,l=L_t.copy(a);if(Yi(l.x,0,hve)&&Yi(l.y,0,hve)){let p=Math.sign(l.z);s=M_t.fromArray(iM[t]),t!=="east"&&t!=="west"&&s.scale(p),u=q_t.fromArray(iM[r]),r!=="east"&&r!=="west"&&u.scale(p),c=N_t.fromArray(iM[n]),n!=="east"&&n!=="west"&&c.scale(p)}else{let{up:p,east:d,north:h}=_1;d.set(-l.y,l.x,0).normalize(),e.geodeticSurfaceNormal(l,p),h.copy(p).cross(d);let{down:m,west:g,south:x}=_1;m.copy(p).scale(-1),g.copy(d).scale(-1),x.copy(h).scale(-1),s=_1[t],u=_1[r],c=_1[n]}return i[0]=s.x,i[1]=s.y,i[2]=s.z,i[3]=0,i[4]=u.x,i[5]=u.y,i[6]=u.z,i[7]=0,i[8]=c.x,i[9]=c.y,i[10]=c.z,i[11]=0,i[12]=l.x,i[13]=l.y,i[14]=l.z,i[15]=1,i}var Ym=new Z,U_t=new Z,z_t=new Z;function gve(e,t,r=[]){let{oneOverRadii:n,oneOverRadiiSquared:a,centerToleranceSquared:i}=t;Ym.from(e);let o=Ym.x,s=Ym.y,u=Ym.z,c=n.x,l=n.y,f=n.z,p=o*o*c*c,d=s*s*l*l,h=u*u*f*f,m=p+d+h,g=Math.sqrt(1/m);if(!Number.isFinite(g))return;let x=U_t;if(x.copy(e).scale(g),m<i)return x.to(r);let y=a.x,w=a.y,T=a.z,A=z_t;A.set(x.x*y*2,x.y*w*2,x.z*T*2);let B=(1-g)*Ym.len()/(.5*A.len()),I=0,L,C,k,F;do{B-=I,L=1/(1+B*y),C=1/(1+B*w),k=1/(1+B*T);let R=L*L,G=C*C,z=k*k,W=R*L,Y=G*C,ue=z*k;F=p*R+d*G+h*z-1;let le=-2*(p*W*y+d*Y*w+h*ue*T);I=F/le}while(Math.abs(F)>Es.EPSILON12);return Ym.scale([L,C,k]).to(r)}var FS=new Z,bve=new Z,V_t=new Z,Ts=new Z,$_t=new Z,OS=new Z,Ft=class{constructor(t=0,r=0,n=0){this.centerToleranceSquared=Es.EPSILON1,ca(t>=0),ca(r>=0),ca(n>=0),this.radii=new Z(t,r,n),this.radiiSquared=new Z(t*t,r*r,n*n),this.radiiToTheFourth=new Z(t*t*t*t,r*r*r*r,n*n*n*n),this.oneOverRadii=new Z(t===0?0:1/t,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new Z(t===0?0:1/(t*t),r===0?0:1/(r*r),n===0?0:1/(n*n)),this.minimumRadius=Math.min(t,r,n),this.maximumRadius=Math.max(t,r,n),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,r=[0,0,0]){let n=bve,a=V_t,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,n),a.copy(this.radiiSquared).scale(n);let o=Math.sqrt(n.dot(a));return a.scale(1/o),n.scale(i),a.add(n),a.to(r)}cartesianToCartographic(t,r=[0,0,0]){OS.from(t);let n=this.scaleToGeodeticSurface(OS,Ts);if(!n)return;let a=this.geodeticSurfaceNormal(n,bve),i=$_t;i.copy(OS).subtract(n);let o=Math.atan2(a.y,a.x),s=Math.asin(a.z),u=Math.sign(Jm.dot(i,OS))*Jm.length(i);return dve([o,s,u],r)}eastNorthUpToFixedFrame(t,r=new mr){return oM(this,"east","north","up",t,r)}localFrameToFixedFrame(t,r,n,a,i=new mr){return oM(this,t,r,n,a,i)}geocentricSurfaceNormal(t,r=[0,0,0]){return FS.from(t).normalize().to(r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=pve(t),a=n[0],i=n[1],o=Math.cos(i);return FS.set(o*Math.cos(a),o*Math.sin(a),Math.sin(i)).normalize(),FS.to(r)}geodeticSurfaceNormal(t,r=[0,0,0]){return FS.from(t).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(t,r){return gve(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){Ts.from(t);let n=Ts.x,a=Ts.y,i=Ts.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(n*n*o.x+a*a*o.y+i*i*o.z);return Ts.multiplyScalar(s).to(r)}transformPositionToScaledSpace(t,r=[0,0,0]){return Ts.from(t).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(t,r=[0,0,0]){return Ts.from(t).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){ca(Yi(this.radii.x,this.radii.y,Es.EPSILON15)),ca(this.radii.z>0),Ts.from(t);let a=Ts.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(a)>=this.radii.z-r))return Ts.set(0,0,a).to(n)}};Ft.WGS84=new Ft(6378137,6378137,$c);var la={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var qnr=new Z,Nnr=new Z;var w1=new Z,vve=new Z,ui=class{constructor(t=[0,0,0],r=0){this.radius=-0,this.center=new Z,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=w1.from(r),this.center=new Z().from(t).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new ui(this.center,this.radius)}union(t){let r=this.center,n=this.radius,a=t.center,i=t.radius,o=w1.copy(a).subtract(r),s=o.magnitude();if(n>=s+i)return this.clone();if(i>=s+n)return t.clone();let u=(n+s+i)*.5;return vve.copy(o).scale((-n+u)/s).add(r),this.center.copy(vve),this.radius=u,this}expand(t){let n=w1.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=kS.getScaling(w1,t);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(t){let r=this.distanceTo(t);return r*r}distanceTo(t){let n=w1.from(t).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(t){let r=this.center,n=this.radius,i=t.normal.dot(r)+t.distance;return i<-n?la.OUTSIDE:i<n?la.INTERSECTING:la.INSIDE}};var W_t=new Z,K_t=new Z,IS=new Z,PS=new Z,RS=new Z,J_t=new Z,X_t=new Z,Wc={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},fa=class{constructor(t=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){this.center=new Z().from(t),this.halfAxes=new nr(r)}get halfSize(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new Z(t).len(),new Z(r).len(),new Z(n).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),a=new Z(t).normalize(),i=new Z(r).normalize(),o=new Z(n).normalize();return new Io().fromMatrix3(new nr([...a,...i,...o]))}fromCenterHalfSizeQuaternion(t,r,n){let a=new Io(n),i=new nr().fromQuaternion(a);return i[0]=i[0]*r[0],i[1]=i[1]*r[0],i[2]=i[2]*r[0],i[3]=i[3]*r[1],i[4]=i[4]*r[1],i[5]=i[5]*r[1],i[6]=i[6]*r[2],i[7]=i[7]*r[2],i[8]=i[8]*r[2],this.center=new Z().from(t),this.halfAxes=i,this}clone(){return new fa(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new ui){let r=this.halfAxes,n=r.getColumn(0,IS),a=r.getColumn(1,PS),i=r.getColumn(2,RS),o=W_t.copy(n).add(a).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let r=this.center,n=t.normal,a=this.halfAxes,i=n.x,o=n.y,s=n.z,u=Math.abs(i*a[Wc.COLUMN0ROW0]+o*a[Wc.COLUMN0ROW1]+s*a[Wc.COLUMN0ROW2])+Math.abs(i*a[Wc.COLUMN1ROW0]+o*a[Wc.COLUMN1ROW1]+s*a[Wc.COLUMN1ROW2])+Math.abs(i*a[Wc.COLUMN2ROW0]+o*a[Wc.COLUMN2ROW1]+s*a[Wc.COLUMN2ROW2]),c=n.dot(r)+t.distance;return c<=-u?la.OUTSIDE:c>=u?la.INSIDE:la.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=K_t.from(t).subtract(this.center),n=this.halfAxes,a=n.getColumn(0,IS),i=n.getColumn(1,PS),o=n.getColumn(2,RS),s=a.magnitude(),u=i.magnitude(),c=o.magnitude();a.normalize(),i.normalize(),o.normalize();let l=0,f;return f=Math.abs(r.dot(a))-s,f>0&&(l+=f*f),f=Math.abs(r.dot(i))-u,f>0&&(l+=f*f),f=Math.abs(r.dot(o))-c,f>0&&(l+=f*f),l}computePlaneDistances(t,r,n=[-0,-0]){let a=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=this.center,s=this.halfAxes,u=s.getColumn(0,IS),c=s.getColumn(1,PS),l=s.getColumn(2,RS),f=J_t.copy(u).add(c).add(l).add(o),p=X_t.copy(f).subtract(t),d=r.dot(p);return a=Math.min(d,a),i=Math.max(d,i),f.copy(o).add(u).add(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),a=Math.min(d,a),i=Math.max(d,i),f.copy(o).add(u).subtract(c).add(l),p.copy(f).subtract(t),d=r.dot(p),a=Math.min(d,a),i=Math.max(d,i),f.copy(o).add(u).subtract(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),a=Math.min(d,a),i=Math.max(d,i),o.copy(f).subtract(u).add(c).add(l),p.copy(f).subtract(t),d=r.dot(p),a=Math.min(d,a),i=Math.max(d,i),o.copy(f).subtract(u).add(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),a=Math.min(d,a),i=Math.max(d,i),o.copy(f).subtract(u).subtract(c).add(l),p.copy(f).subtract(t),d=r.dot(p),a=Math.min(d,a),i=Math.max(d,i),o.copy(f).subtract(u).subtract(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),a=Math.min(d,a),i=Math.max(d,i),n[0]=a,n[1]=i,n}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,IS);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,PS);n.transformAsPoint(t);let a=this.halfAxes.getColumn(2,RS);return a.transformAsPoint(t),this.halfAxes=new nr([...r,...n,...a]),this}getTransform(){throw new Error("not implemented")}};var xve=new Z,yve=new Z,Kc=class{constructor(t=[0,0,1],r=0){this.normal=new Z,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return ca(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=xve.from(t),this.normal.from(r).normalize();let n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,r,n,a){return this.normal.set(t,r,n),ca(Yi(this.normal.len(),1)),this.distance=a,this}clone(){return new Kc(this.normal,this.distance)}equals(t){return Yi(this.distance,t.distance)&&Yi(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=yve.copy(this.normal).transformAsVector(t).normalize(),n=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(n,r)}projectPointOntoPlane(t,r=[0,0,0]){let n=xve.from(t),a=this.getPointDistance(n),i=yve.copy(this.normal).scale(a);return n.subtract(i).to(r)}};var _ve=[new Z([1,0,0]),new Z([0,1,0]),new Z([0,0,1])],wve=new Z,Y_t=new Z,Po=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*_ve.length;let r=t.center,n=t.radius,a=0;for(let i of _ve){let o=this.planes[a],s=this.planes[a+1];o||(o=this.planes[a]=new Kc),s||(s=this.planes[a+1]=new Kc);let u=wve.copy(i).scale(-n).add(r);o.fromPointNormal(u,i);let c=wve.copy(i).scale(n).add(r),l=Y_t.copy(i).negate();s.fromPointNormal(c,l),a+=2}return this}computeVisibility(t){let r=la.INSIDE;for(let n of this.planes)switch(t.intersectPlane(n)){case la.OUTSIDE:return la.OUTSIDE;case la.INTERSECTING:r=la.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(ca(Number.isFinite(r),"parentPlaneMask is required."),r===Po.MASK_OUTSIDE||r===Po.MASK_INSIDE)return r;let n=Po.MASK_INSIDE,a=this.planes;for(let i=0;i<this.planes.length;++i){let o=i<31?1<<i:0;if(i<31&&!(r&o))continue;let s=a[i],u=t.intersectPlane(s);if(u===la.OUTSIDE)return Po.MASK_OUTSIDE;u===la.INTERSECTING&&(n|=o)}return n}};Po.MASK_OUTSIDE=4294967295;Po.MASK_INSIDE=0;Po.MASK_INDETERMINATE=2147483647;var aar=new Z,iar=new Z,oar=new Z,sar=new Z,uar=new Z;var Z_t=new Z,e2t=new Z,t2t=new Z,r2t=new Z,n2t=new Z,a2t=new Z,i2t=new Z,Qm=new Z,o2t=new Z,s2t=new Z,u2t=new Z,c2t=new Z;function sM(e,t=new ui){if(!e||e.length===0)return t.fromCenterRadius([0,0,0],0);let r=i2t.copy(e[0]),n=Z_t.copy(r),a=e2t.copy(r),i=t2t.copy(r),o=r2t.copy(r),s=n2t.copy(r),u=a2t.copy(r);for(let B of e){r.copy(B);let I=r.x,L=r.y,C=r.z;I<n.x&&n.copy(r),I>o.x&&o.copy(r),L<a.y&&a.copy(r),L>s.y&&s.copy(r),C<i.z&&i.copy(r),C>u.z&&u.copy(r)}let c=Qm.copy(o).subtract(n).magnitudeSquared(),l=Qm.copy(s).subtract(a).magnitudeSquared(),f=Qm.copy(u).subtract(i).magnitudeSquared(),p=n,d=o,h=c;l>h&&(h=l,p=a,d=s),f>h&&(h=f,p=i,d=u);let m=o2t;m.x=(p.x+d.x)*.5,m.y=(p.y+d.y)*.5,m.z=(p.z+d.z)*.5;let g=Qm.copy(d).subtract(m).magnitudeSquared(),x=Math.sqrt(g),y=s2t;y.x=n.x,y.y=a.y,y.z=i.z;let w=u2t;w.x=o.x,w.y=s.y,w.z=u.z;let T=c2t.copy(y).add(w).multiplyByScalar(.5),A=0;for(let B of e){r.copy(B);let I=Qm.copy(r).subtract(T).magnitude();I>A&&(A=I);let L=Qm.copy(r).subtract(m).magnitudeSquared();if(L>g){let C=Math.sqrt(L);x=(x+C)*.5,g=x*x;let k=C-x;m.x=(x*m.x+k*r.x)/C,m.y=(x*m.y+k*r.y)/C,m.z=(x*m.z+k*r.z)/C}}return x<A?(m.to(t.center),t.radius=x):(T.to(t.center),t.radius=A),t}var Pu=new nr,l2t=new nr,f2t=new nr,jS=new nr,Ave=new nr;function lM(e,t={}){let r=Es.EPSILON20,n=10,a=0,i=0,o=l2t,s=f2t;o.identity(),s.copy(e);let u=r*p2t(s);for(;i<n&&d2t(s)>u;)h2t(s,jS),Ave.copy(jS).transpose(),s.multiplyRight(jS),s.multiplyLeft(Ave),o.multiplyRight(jS),++a>2&&(++i,a=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=s.toTarget(t.diagonal),t}function p2t(e){let t=0;for(let r=0;r<9;++r){let n=e[r];t+=n*n}return Math.sqrt(t)}var uM=[1,0,0],cM=[2,2,1];function d2t(e){let t=0;for(let r=0;r<3;++r){let n=e[Pu.getElementIndex(cM[r],uM[r])];t+=2*n*n}return Math.sqrt(t)}function h2t(e,t){let r=Es.EPSILON15,n=0,a=1;for(let c=0;c<3;++c){let l=Math.abs(e[Pu.getElementIndex(cM[c],uM[c])]);l>n&&(a=c,n=l)}let i=uM[a],o=cM[a],s=1,u=0;if(Math.abs(e[Pu.getElementIndex(o,i)])>r){let c=e[Pu.getElementIndex(o,o)],l=e[Pu.getElementIndex(i,i)],f=e[Pu.getElementIndex(o,i)],p=(c-l)/2/f,d;p<0?d=-1/(-p+Math.sqrt(1+p*p)):d=1/(p+Math.sqrt(1+p*p)),s=1/Math.sqrt(1+d*d),u=d*s}return nr.IDENTITY.to(t),t[Pu.getElementIndex(i,i)]=t[Pu.getElementIndex(o,o)]=s,t[Pu.getElementIndex(o,i)]=u,t[Pu.getElementIndex(i,o)]=-u,t}var Pf=new Z,g2t=new Z,b2t=new Z,v2t=new Z,x2t=new Z,y2t=new nr,_2t={diagonal:new nr,unitary:new nr};function A1(e,t=new fa){if(!e||e.length===0)return t.halfAxes=new nr([0,0,0,0,0,0,0,0,0]),t.center=new Z,t;let r=e.length,n=new Z(0,0,0);for(let C of e)n.add(C);let a=1/r;n.multiplyByScalar(a);let i=0,o=0,s=0,u=0,c=0,l=0;for(let C of e){let k=Pf.copy(C).subtract(n);i+=k.x*k.x,o+=k.x*k.y,s+=k.x*k.z,u+=k.y*k.y,c+=k.y*k.z,l+=k.z*k.z}i*=a,o*=a,s*=a,u*=a,c*=a,l*=a;let f=y2t;f[0]=i,f[1]=o,f[2]=s,f[3]=o,f[4]=u,f[5]=c,f[6]=s,f[7]=c,f[8]=l;let{unitary:p}=lM(f,_2t),d=t.halfAxes.copy(p),h=d.getColumn(0,b2t),m=d.getColumn(1,v2t),g=d.getColumn(2,x2t),x=-Number.MAX_VALUE,y=-Number.MAX_VALUE,w=-Number.MAX_VALUE,T=Number.MAX_VALUE,A=Number.MAX_VALUE,B=Number.MAX_VALUE;for(let C of e)Pf.copy(C),x=Math.max(Pf.dot(h),x),y=Math.max(Pf.dot(m),y),w=Math.max(Pf.dot(g),w),T=Math.min(Pf.dot(h),T),A=Math.min(Pf.dot(m),A),B=Math.min(Pf.dot(g),B);h=h.multiplyByScalar(.5*(T+x)),m=m.multiplyByScalar(.5*(A+y)),g=g.multiplyByScalar(.5*(B+w)),t.center.copy(h).add(m).add(g);let I=g2t.set(x-T,y-A,w-B).multiplyByScalar(.5),L=new nr([I[0],0,0,0,I[1],0,0,0,I[2]]);return t.halfAxes.multiplyRight(L),t}function kve(e){return e!=null}var Uar=new Z,w2t=new Z,A2t=new Z,E2t=new Z,Td=new Z,Eve=new Z,Tve=new Z,Sve=new Z;function E1(e,t,r){if(yt(e,"3D Tile: boundingVolume must be defined"),e.box)return Cve(e.box,t,r);if(e.region)return S2t(e.region);if(e.sphere)return T2t(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function Cve(e,t,r){let n=new Z(e[0],e[1],e[2]);t.transform(n,n);let a=[];if(e.length===10){let c=e.slice(3,6),l=new Io;l.fromArray(e,6);let f=new Z([1,0,0]),p=new Z([0,1,0]),d=new Z([0,0,1]);f.transformByQuaternion(l),f.scale(c[0]),p.transformByQuaternion(l),p.scale(c[1]),d.transformByQuaternion(l),d.scale(c[2]),a=[...f.toArray(),...p.toArray(),...d.toArray()]}else a=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let i=t.transformAsVector(a.slice(0,3)),o=t.transformAsVector(a.slice(3,6)),s=t.transformAsVector(a.slice(6,9)),u=new nr([i[0],i[1],i[2],o[0],o[1],o[2],s[0],s[1],s[2]]);return kve(r)?(r.center=n,r.halfAxes=u,r):new fa(n,u)}function T2t(e,t,r){let n=new Z(e[0],e[1],e[2]);t.transform(n,n);let a=t.getScale(w2t),i=Math.max(Math.max(a[0],a[1]),a[2]),o=e[3]*i;return kve(r)?(r.center=n,r.radius=o,r):new ui(n,o)}function S2t(e){let[t,r,n,a,i,o]=e,s=Ft.WGS84.cartographicToCartesian([Vc(t),Vc(a),i],A2t),u=Ft.WGS84.cartographicToCartesian([Vc(n),Vc(r),o],E2t),c=new Z().addVectors(s,u).multiplyByScalar(.5);return Ft.WGS84.cartesianToCartographic(c,Td),Ft.WGS84.cartographicToCartesian([Vc(n),Td[1],Td[2]],Eve),Ft.WGS84.cartographicToCartesian([Td[0],Vc(a),Td[2]],Tve),Ft.WGS84.cartographicToCartesian([Td[0],Td[1],o],Sve),Cve([...c,...Eve.subtract(c),...Tve.subtract(c),...Sve.subtract(c)],new mr)}var Zm="4.4.0";var pa={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},$ar=Object.keys(pa),Rf={BATCHED_MODEL:[98,51,100,109],INSTANCED_MODEL:[105,51,100,109],POINT_CLOUD:[112,110,116,115],COMPOSITE:[99,109,112,116]};function fM(e,t,r){yt(e instanceof ArrayBuffer);let n=new TextDecoder("utf8"),a=new Uint8Array(e,t,r);return n.decode(a)}function Dve(e,t=0){let r=new DataView(e);return`${String.fromCharCode(r.getUint8(t+0))}${String.fromCharCode(r.getUint8(t+1))}${String.fromCharCode(r.getUint8(t+2))}${String.fromCharCode(r.getUint8(t+3))}`}var k2t="1.5.6",C2t="1.4.1",pM=`https://www.gstatic.com/draco/versioned/decoders/${k2t}`,Ur={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},Ru={[Ur.DECODER]:`${pM}/${Ur.DECODER}`,[Ur.DECODER_WASM]:`${pM}/${Ur.DECODER_WASM}`,[Ur.FALLBACK_DECODER]:`${pM}/${Ur.FALLBACK_DECODER}`,[Ur.ENCODER]:`https://raw.githubusercontent.com/google/draco/${C2t}/javascript/${Ur.ENCODER}`},dM;async function Fve(e={},t){let r=e.modules||{};return r.draco3d?dM||(dM=r.draco3d.createDecoderModule({}).then(n=>({draco:n}))):dM||(dM=D2t(e,t)),await dM}function Bve(e,t){if(e&&typeof e=="object"){if(e.default)return e.default;if(e[t])return e[t]}return e}async function D2t(e,t){let r,n;switch(t){case"js":r=await yo(Ru[Ur.FALLBACK_DECODER],"draco",e,Ur.FALLBACK_DECODER);break;case"wasm":default:try{[r,n]=await Promise.all([await yo(Ru[Ur.DECODER],"draco",e,Ur.DECODER),await yo(Ru[Ur.DECODER_WASM],"draco",e,Ur.DECODER_WASM)])}catch{r=null,n=null}}return r=Bve(r,"DracoDecoderModule"),r=r||globalThis.DracoDecoderModule,!r&&!Pn&&([r,n]=await Promise.all([await yo(Ru[Ur.DECODER],"draco",{...e,useLocalLibraries:!0},Ur.DECODER),await yo(Ru[Ur.DECODER_WASM],"draco",{...e,useLocalLibraries:!0},Ur.DECODER_WASM)]),r=Bve(r,"DracoDecoderModule"),r=r||globalThis.DracoDecoderModule),await B2t(r,n)}function B2t(e,t){if(typeof e!="function")throw new Error("DracoDecoderModule could not be loaded");let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e({...r,onModuleLoaded:a=>n({draco:a})})})}var LS="4.4.0";var MS={id:"draco-writer",name:"Draco compressed geometry writer",module:"draco",version:LS,worker:!0,options:{draco:{},source:null}};function Ive(e,t,r){let n=Pve(t.metadata),a=[],i=F2t(t.attributes);for(let o in e){let s=e[o],u=Ove(o,s,i[o]);a.push(u)}if(r){let o=Ove("indices",r);a.push(o)}return{fields:a,metadata:n}}function F2t(e){let t={};for(let r in e){let n=e[r];t[n.name||"undefined"]=n}return t}function Ove(e,t,r){let n=r?Pve(r.metadata):void 0;return wL(e,t,n)}function Pve(e){Object.entries(e);let t={};for(let r in e)t[`${r}.string`]=JSON.stringify(e[r]);return t}var Rve={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},O2t={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},I2t=4,T1=class{draco;decoder;metadataQuerier;constructor(t){this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t,r={}){let n=new this.draco.DecoderBuffer;n.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(r);let a=this.decoder.GetEncodedGeometryType(n),i=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(a){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(n,i);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(n,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!i.ptr){let p=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(p)}let s=this._getDracoLoaderData(i,a,r),u=this._getMeshData(i,s,r),c=_L(u.attributes),l=Ive(u.attributes,s,u.indices);return{loader:"draco",loaderData:s,header:{vertexCount:i.num_points(),boundingBox:c},...u,schema:l}}finally{this.draco.destroy(n),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,r,n){let a=this._getTopLevelMetadata(t),i=this._getDracoAttributes(t,n);return{geometry_type:r,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:a,attributes:i}}_getDracoAttributes(t,r){let n={};for(let a=0;a<t.num_attributes();a++){let i=this.decoder.GetAttribute(t,a),o=this._getAttributeMetadata(t,a);n[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:a,metadata:o};let s=this._getQuantizationTransform(i,r);s&&(n[i.unique_id()].quantization_transform=s);let u=this._getOctahedronTransform(i,r);u&&(n[i.unique_id()].octahedron_transform=u)}return n}_getMeshData(t,r,n){let a=this._getMeshAttributes(r,t,n);if(!a.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(n.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:a,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:a,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:a}}_getMeshAttributes(t,r,n){let a={};for(let i of Object.values(t.attributes)){let o=this._deduceAttributeName(i,n);i.name=o;let s=this._getAttributeValues(r,i);if(s){let{value:u,size:c}=s;a[o]={value:u,size:c,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}}return a}_getTriangleListIndices(t){let n=t.num_faces()*3,a=n*I2t,i=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(t,a,i),new Uint32Array(this.draco.HEAPF32.buffer,i,n).slice()}finally{this.draco._free(i)}}_getTriangleStripIndices(t){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,r),j2t(r)}finally{this.draco.destroy(r)}}_getAttributeValues(t,r){let n=O2t[r.data_type];if(!n)return console.warn(`DRACO: Unsupported attribute type ${r.data_type}`),null;let a=r.num_components,o=t.num_points()*a,s=o*n.BYTES_PER_ELEMENT,u=P2t(this.draco,n),c,l=this.draco._malloc(s);try{let f=this.decoder.GetAttribute(t,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,f,u,s,l),c=new n(this.draco.HEAPF32.buffer,l,o).slice()}finally{this.draco._free(l)}return{value:c,size:a}}_deduceAttributeName(t,r){let n=t.unique_id;for(let[o,s]of Object.entries(r.extraAttributes||{}))if(s===n)return o;let a=t.attribute_type;for(let o in Rve)if(this.draco[o]===a)return Rve[o];let i=r.attributeNameEntry||"name";return t.metadata[i]?t.metadata[i].string:`CUSTOM_ATTRIBUTE_${n}`}_getTopLevelMetadata(t){let r=this.decoder.GetMetadata(t);return this._getDracoMetadata(r)}_getAttributeMetadata(t,r){let n=this.decoder.GetAttributeMetadata(t,r);return this._getDracoMetadata(n)}_getDracoMetadata(t){if(!t||!t.ptr)return{};let r={},n=this.metadataQuerier.NumEntries(t);for(let a=0;a<n;a++){let i=this.metadataQuerier.GetEntryName(t,a);r[i]=this._getDracoMetadataField(t,i)}return r}_getDracoMetadataField(t,r){let n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,r,n);let a=R2t(n);return{int:this.metadataQuerier.GetIntEntry(t,r),string:this.metadataQuerier.GetStringEntry(t,r),double:this.metadataQuerier.GetDoubleEntry(t,r),intArray:a}}finally{this.draco.destroy(n)}}_disableAttributeTransforms(t){let{quantizedAttributes:r=[],octahedronAttributes:n=[]}=t,a=[...r,...n];for(let i of a)this.decoder.SkipAttributeTransform(this.draco[i])}_getQuantizationTransform(t,r){let{quantizedAttributes:n=[]}=r,a=t.attribute_type();if(n.map(o=>this.decoder[o]).includes(a)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:new Float32Array([1,2,3]).map(s=>o.min_value(s))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(t,r){let{octahedronAttributes:n=[]}=r,a=t.attribute_type();if(n.map(o=>this.decoder[o]).includes(a)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function P2t(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32;default:return e.DT_INVALID}}function R2t(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}function j2t(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}var jve={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:LS,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",extraAttributes:{},attributeNameEntry:void 0}}},Sd={...jve,parse:L2t};async function L2t(e,t){var a;let{draco:r}=await Fve(Lv(t),((a=t==null?void 0:t.draco)==null?void 0:a.decoderType)||"wasm"),n=new T1(r);try{return n.parseSync(e,t==null?void 0:t.draco)}finally{n.destroy()}}var M2t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Tn={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},ht={...M2t,...Tn};var hM={[Tn.DOUBLE]:Float64Array,[Tn.FLOAT]:Float32Array,[Tn.UNSIGNED_SHORT]:Uint16Array,[Tn.UNSIGNED_INT]:Uint32Array,[Tn.UNSIGNED_BYTE]:Uint8Array,[Tn.BYTE]:Int8Array,[Tn.SHORT]:Int16Array,[Tn.INT]:Int32Array},q2t={DOUBLE:Tn.DOUBLE,FLOAT:Tn.FLOAT,UNSIGNED_SHORT:Tn.UNSIGNED_SHORT,UNSIGNED_INT:Tn.UNSIGNED_INT,UNSIGNED_BYTE:Tn.UNSIGNED_BYTE,BYTE:Tn.BYTE,SHORT:Tn.SHORT,INT:Tn.INT},mM="Failed to convert GL type",Jn=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let r in hM)if(hM[r]===t)return r;throw new Error(mM)}static fromName(t){let r=q2t[t];if(!r)throw new Error(mM);return r}static getArrayType(t){switch(t){case Tn.UNSIGNED_SHORT_5_6_5:case Tn.UNSIGNED_SHORT_4_4_4_4:case Tn.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let r=hM[t];if(!r)throw new Error(mM);return r}}static getByteSize(t){return Jn.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(Jn.getArrayType(t))}static createTypedArray(t,r,n=0,a){a===void 0&&(a=(r.byteLength-n)/Jn.getByteSize(t));let i=ArrayBuffer.isView(r)?r.buffer:r,o=Jn.getArrayType(t);return new o(i,n,a)}};function Lve(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function gM(e,t=[0,0,0]){let r=e>>11&31,n=e>>5&63,a=e&31;return t[0]=r<<3,t[1]=n<<2,t[2]=a<<3,t}var Air=1/256;var Eir=new wd,Tir=new Z,Sir=new wd,kir=new wd,Cir=new Uint8Array(1);function Mve(e,t=255){return SL(e,0,t)/t*2-1}function qve(e){return e<0?-1:1}function Nve(e,t,r,n){if(Lve(n),e<0||e>r||t<0||t>r)throw new Error(`x and y must be unsigned normalized integers between 0 and ${r}`);if(n.x=Mve(e,r),n.y=Mve(t,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){let a=n.x;n.x=(1-Math.abs(n.y))*qve(a),n.y=(1-Math.abs(a))*qve(n.y)}return n.normalize()}function bM(e,t,r){return Nve(e,t,255,r)}function qS(e){return(e%1+1)%1}var Jc=class{json;buffer;featuresLength=0;_cachedTypedArrays={};constructor(t,r){this.json=t,this.buffer=r}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t,r=ht.UNSIGNED_INT,n=1){let a=this.json[t];return a&&Number.isFinite(a.byteOffset)?this._getTypedArrayFromBinary(t,r,n,1,a.byteOffset):a}getPropertyArray(t,r,n){let a=this.json[t];return a&&Number.isFinite(a.byteOffset)?("componentType"in a&&(r=Jn.fromName(a.componentType)),this._getTypedArrayFromBinary(t,r,n,this.featuresLength,a.byteOffset)):this._getTypedArrayFromArray(t,r,a)}getProperty(t,r,n,a,i){let o=this.json[t];if(!o)return o;let s=this.getPropertyArray(t,r,n);if(n===1)return s[a];for(let u=0;u<n;++u)i[u]=s[n*a+u];return i}_getTypedArrayFromBinary(t,r,n,a,i){let o=this._cachedTypedArrays,s=o[t];return s||(s=Jn.createTypedArray(r,this.buffer.buffer,this.buffer.byteOffset+i,a*n),o[t]=s),s}_getTypedArrayFromArray(t,r,n){let a=this._cachedTypedArrays,i=a[t];if(!i){if(ArrayBuffer.isView(n)){let o=n.byteOffset,u=n.byteLength/Jn.getByteSize(r);i=Jn.createTypedArray(r,n.buffer,o,u)}else if(n instanceof ArrayBuffer)i=Jn.createTypedArray(r,n);else{let o=Jn.getArrayType(r);i=new o(n)}a[t]=i}return i}};var N2t={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},U2t={SCALAR:(e,t)=>e[t],VEC2:(e,t)=>[e[2*t+0],e[2*t+1]],VEC3:(e,t)=>[e[3*t+0],e[3*t+1],e[3*t+2]],VEC4:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT2:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT3:(e,t)=>[e[9*t+0],e[9*t+1],e[9*t+2],e[9*t+3],e[9*t+4],e[9*t+5],e[9*t+6],e[9*t+7],e[9*t+8]],MAT4:(e,t)=>[e[16*t+0],e[16*t+1],e[16*t+2],e[16*t+3],e[16*t+4],e[16*t+5],e[16*t+6],e[16*t+7],e[16*t+8],e[16*t+9],e[16*t+10],e[16*t+11],e[16*t+12],e[16*t+13],e[16*t+14],e[16*t+15]]},z2t={SCALAR:(e,t,r)=>{t[r]=e},VEC2:(e,t,r)=>{t[2*r+0]=e[0],t[2*r+1]=e[1]},VEC3:(e,t,r)=>{t[3*r+0]=e[0],t[3*r+1]=e[1],t[3*r+2]=e[2]},VEC4:(e,t,r)=>{t[4*r+0]=e[0],t[4*r+1]=e[1],t[4*r+2]=e[2],t[4*r+3]=e[3]},MAT2:(e,t,r)=>{t[4*r+0]=e[0],t[4*r+1]=e[1],t[4*r+2]=e[2],t[4*r+3]=e[3]},MAT3:(e,t,r)=>{t[9*r+0]=e[0],t[9*r+1]=e[1],t[9*r+2]=e[2],t[9*r+3]=e[3],t[9*r+4]=e[4],t[9*r+5]=e[5],t[9*r+6]=e[6],t[9*r+7]=e[7],t[9*r+8]=e[8],t[9*r+9]=e[9]},MAT4:(e,t,r)=>{t[16*r+0]=e[0],t[16*r+1]=e[1],t[16*r+2]=e[2],t[16*r+3]=e[3],t[16*r+4]=e[4],t[16*r+5]=e[5],t[16*r+6]=e[6],t[16*r+7]=e[7],t[16*r+8]=e[8],t[16*r+9]=e[9],t[16*r+10]=e[10],t[16*r+11]=e[11],t[16*r+12]=e[12],t[16*r+13]=e[13],t[16*r+14]=e[14],t[16*r+15]=e[15]}};function Uve(e,t,r,n){let{componentType:a}=e;yt(e.componentType);let i=typeof a=="string"?Jn.fromName(a):a,o=N2t[e.type],s=U2t[e.type],u=z2t[e.type];return r+=e.byteOffset,{values:Jn.createTypedArray(i,t,r,o*n),type:i,size:o,unpacker:s,packer:u}}var ju=e=>e!==void 0;function zve(e,t,r){if(!t)return null;let n=e.getExtension("3DTILES_batch_table_hierarchy"),a=t.HIERARCHY;return a&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=a,n=a),n?G2t(n,r):null}function G2t(e,t){let r,n,a,i=e.instancesLength,o=e.classes,s=e.classIds,u=e.parentCounts,c=e.parentIds,l=i;ju(s.byteOffset)&&(s.componentType=defaultValue(s.componentType,GL.UNSIGNED_SHORT),s.type=AttributeType.SCALAR,a=getBinaryAccessor(s),s=a.createArrayBufferView(t.buffer,t.byteOffset+s.byteOffset,i));let f;if(ju(u))for(ju(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,GL.UNSIGNED_SHORT),u.type=AttributeType.SCALAR,a=getBinaryAccessor(u),u=a.createArrayBufferView(t.buffer,t.byteOffset+u.byteOffset,i)),f=new Uint16Array(i),l=0,r=0;r<i;++r)f[r]=l,l+=u[r];ju(c)&&ju(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,a=getBinaryAccessor(c),c=a.createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,l));let p=o.length;for(r=0;r<p;++r){let g=o[r].length,x=o[r].instances,y=getBinaryProperties(g,x,t);o[r].instances=combine(y,x)}let d=new Array(p).fill(0),h=new Uint16Array(i);for(r=0;r<i;++r)n=s[r],h[r]=d[n],++d[n];let m={classes:o,classIds:s,classIndexes:h,parentCounts:u,parentIndexes:f,parentIds:c};return $2t(m),m}function eg(e,t,r){if(!e)return;let n=e.parentCounts;return e.parentIds?r(e,t):n>0?H2t(e,t,r):V2t(e,t,r)}function H2t(e,t,r){let n=e.classIds,a=e.parentCounts,i=e.parentIds,o=e.parentIndexes,s=n.length,u=scratchVisited;u.length=Math.max(u.length,s);let c=++marker,l=scratchStack;for(l.length=0,l.push(t);l.length>0;){if(t=l.pop(),u[t]===c)continue;u[t]=c;let f=r(e,t);if(ju(f))return f;let p=a[t],d=o[t];for(let h=0;h<p;++h){let m=i[d+h];m!==t&&l.push(m)}}return null}function V2t(e,t,r){let n=!0;for(;n;){let a=r(e,t);if(ju(a))return a;let i=e.parentIds[t];n=i!==t,t=i}throw new Error("traverseHierarchySingleParent")}function $2t(e){let t=[],n=e.classIds.length;for(let a=0;a<n;++a)Gve(e,a,stack)}function Gve(e,t,r){let n=e.parentCounts,a=e.parentIds,i=e.parentIndexes,s=e.classIds.length;if(!ju(a))return;assert(t<s,`Parent index ${t} exceeds the total number of instances: ${s}`),assert(r.indexOf(t)===-1,"Circular dependency detected in the batch table hierarchy."),r.push(t);let u=ju(n)?n[t]:1,c=ju(n)?i[t]:t;for(let l=0;l<u;++l){let f=a[c+l];f!==t&&Gve(e,f,r)}r.pop(t)}function Di(e){return e!=null}var NS=(e,t)=>e,W2t={HIERARCHY:!0,extensions:!0,extras:!0},kd=class{json;binary;featureCount;_extensions;_properties;_binaryProperties;_hierarchy;constructor(t,r,n,a={}){var i;yt(n>=0),this.json=t||{},this.binary=r,this.featureCount=n,this._extensions=((i=this.json)==null?void 0:i.extensions)||{},this._properties={};for(let o in this.json)W2t[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),a["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=zve(this,this.json,this.binary))}getExtension(t){return this.json&&this.json.extensions&&this.json.extensions[t]}memorySizeInBytes(){return 0}isClass(t,r){if(this._checkBatchId(t),yt(typeof r=="string",r),this._hierarchy){let n=eg(this._hierarchy,t,(a,i)=>{let o=a.classIds[i];return a.classes[o].name===r});return Di(n)}return!1}isExactClass(t,r){return yt(typeof r=="string",r),this.getExactClassName(t)===r}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){let r=this._hierarchy.classIds[t];return this._hierarchy.classes[r].name}}hasProperty(t,r){return this._checkBatchId(t),yt(typeof r=="string",r),Di(this._properties[r])||this._hasPropertyInHierarchy(t,r)}getPropertyNames(t,r){this._checkBatchId(t),r=Di(r)?r:[],r.length=0;let n=Object.keys(this._properties);return r.push(...n),this._hierarchy&&this._getPropertyNamesInHierarchy(t,r),r}getProperty(t,r){if(this._checkBatchId(t),yt(typeof r=="string",r),this._binaryProperties){let a=this._binaryProperties[r];if(Di(a))return this._getBinaryProperty(a,t)}let n=this._properties[r];if(Di(n))return NS(n[t],!0);if(this._hierarchy){let a=this._getHierarchyProperty(t,r);if(Di(a))return a}}setProperty(t,r,n){let a=this.featureCount;if(this._checkBatchId(t),yt(typeof r=="string",r),this._binaryProperties){let o=this._binaryProperties[r];if(o){this._setBinaryProperty(o,t,n);return}}if(this._hierarchy&&this._setHierarchyProperty(this,t,r,n))return;let i=this._properties[r];Di(i)||(this._properties[r]=new Array(a),i=this._properties[r]),i[t]=NS(n,!0)}_checkBatchId(t){if(!(t>=0&&t<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(t,r){return t.unpack(t.typedArray,r)}_setBinaryProperty(t,r,n){t.pack(n,t.typedArray,r)}_initializeBinaryProperties(){let t=null;for(let r in this._properties){let n=this._properties[r],a=this._initializeBinaryProperty(r,n);a&&(t=t||{},t[r]=a)}return t}_initializeBinaryProperty(t,r){if("byteOffset"in r){let n=r;yt(this.binary,`Property ${t} requires a batch table binary.`),yt(n.type,`Property ${t} requires a type.`);let a=Uve(n,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:a.values,componentCount:a.size,unpack:a.unpacker,pack:a.packer}}return null}_hasPropertyInHierarchy(t,r){if(!this._hierarchy)return!1;let n=eg(this._hierarchy,t,(a,i)=>{let o=a.classIds[i],s=a.classes[o].instances;return Di(s[r])});return Di(n)}_getPropertyNamesInHierarchy(t,r){eg(this._hierarchy,t,(n,a)=>{let i=n.classIds[a],o=n.classes[i].instances;for(let s in o)o.hasOwnProperty(s)&&r.indexOf(s)===-1&&r.push(s)})}_getHierarchyProperty(t,r){return eg(this._hierarchy,t,(n,a)=>{let i=n.classIds[a],o=n.classes[i],s=n.classIndexes[a],u=o.instances[r];return Di(u)?Di(u.typedArray)?this._getBinaryProperty(u,s):NS(u[s],!0):null})}_setHierarchyProperty(t,r,n,a){let i=eg(this._hierarchy,r,(o,s)=>{let u=o.classIds[s],c=o.classes[u],l=o.classIndexes[s],f=c.instances[n];return Di(f)?(yt(s===r,`Inherited property "${n}" is read-only.`),Di(f.typedArray)?this._setBinaryProperty(f,l,a):f[l]=NS(a,!0),!0):!1});return Di(i)}};var vM=4;function jf(e,t,r=0){let n=new DataView(t);if(e.magic=n.getUint32(r,!0),r+=vM,e.version=n.getUint32(r,!0),r+=vM,e.byteLength=n.getUint32(r,!0),r+=vM,e.version!==1)throw new Error(`3D Tile Version ${e.version} not supported`);return r}var tg=4,Hve="b3dm tile in legacy format.";function rg(e,t,r){let n=new DataView(t),a;e.header=e.header||{};let i=n.getUint32(r,!0);r+=tg;let o=n.getUint32(r,!0);r+=tg;let s=n.getUint32(r,!0);r+=tg;let u=n.getUint32(r,!0);return r+=tg,s>=570425344?(r-=tg*2,a=i,s=o,u=0,i=0,o=0,console.warn(Hve)):u>=570425344&&(r-=tg,a=s,s=i,u=o,i=0,o=0,console.warn(Hve)),e.header.featureTableJsonByteLength=i,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=u,e.header.batchLength=a,r}function ng(e,t,r,n){return r=K2t(e,t,r,n),r=J2t(e,t,r,n),r}function K2t(e,t,r,n){let{featureTableJsonByteLength:a,featureTableBinaryByteLength:i,batchLength:o}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:o||0},a&&a>0){let s=fM(t,r,a);e.featureTableJson=JSON.parse(s)}return r+=a||0,e.featureTableBinary=new Uint8Array(t,r,i),r+=i||0,r}function J2t(e,t,r,n){let{batchTableJsonByteLength:a,batchTableBinaryByteLength:i}=e.header||{};if(a&&a>0){let o=fM(t,r,a);e.batchTableJson=JSON.parse(o),r+=a,i&&i>0&&(e.batchTableBinary=new Uint8Array(t,r,i),e.batchTableBinary=new Uint8Array(e.batchTableBinary),r+=i)}return r}function xM(e,t,r){if(!t&&(!e||!e.batchIds||!r))return null;let{batchIds:n,isRGB565:a,pointCount:i=0}=e;if(n&&r){let o=new Uint8ClampedArray(i*3);for(let s=0;s<i;s++){let u=n[s],l=r.getProperty(u,"dimensions").map(f=>f*255);o[s*3]=l[0],o[s*3+1]=l[1],o[s*3+2]=l[2]}return{type:ht.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}if(t&&a){let o=new Uint8ClampedArray(i*3);for(let s=0;s<i;s++){let u=gM(t[s]);o[s*3]=u[0],o[s*3+1]=u[1],o[s*3+2]=u[2]}return{type:ht.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}return t&&t.length===i*3?{type:ht.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:ht.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var Vve=new Z;function $ve(e,t){if(!t)return null;if(e.isOctEncoded16P){let r=new Float32Array((e.pointsLength||0)*3);for(let n=0;n<(e.pointsLength||0);n++)bM(t[n*2],t[n*2+1],Vve),Vve.toArray(r,n*3);return{type:ht.FLOAT,size:2,value:r}}return{type:ht.FLOAT,size:2,value:t}}function Wve(e,t,r){return e.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,X2t(e,t)):{type:ht.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function X2t(e,t){let r=new Z,n=new Float32Array(e.pointCount*3);for(let a=0;a<e.pointCount;a++)r.set(t[a*3],t[a*3+1],t[a*3+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(n,a*3);return n}async function Kve(e,t,r,n,a){r=jf(e,t,r),r=rg(e,t,r),r=ng(e,t,r,n),Y2t(e);let{featureTable:i,batchTable:o}=Q2t(e);return await nwt(e,i,o,n,a),Z2t(e,i,n),ewt(e,i,o),twt(e,i),r}function Y2t(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function Q2t(e){let t=new Jc(e.featureTableJson,e.featureTableBinary),r=t.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(r))throw new Error("POINTS_LENGTH must be defined");t.featuresLength=r,e.featuresLength=r,e.pointsLength=r,e.pointCount=r,e.rtcCenter=t.getGlobalProperty("RTC_CENTER",ht.FLOAT,3);let n=rwt(e,t);return{featureTable:t,batchTable:n}}function Z2t(e,t,r){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.positions){if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",ht.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let n=t.getPropertyArray("POSITION_QUANTIZED",ht.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",ht.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",ht.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=Wve(e,n,r)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function ewt(e,t,r){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.colors){let n=null;t.hasProperty("RGBA")?(n=t.getPropertyArray("RGBA",ht.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?n=t.getPropertyArray("RGB",ht.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(n=t.getPropertyArray("RGB565",ht.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=xM(e,n,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",ht.UNSIGNED_BYTE,4))}function twt(e,t){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.normals){let r=null;t.hasProperty("NORMAL")?r=t.getPropertyArray("NORMAL",ht.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",ht.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=$ve(e,r)}}function rwt(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",ht.UNSIGNED_SHORT,1),e.batchIds)){let n=t.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:a,batchTableBinary:i}=e;r=new kd(a,i,n)}return r}async function nwt(e,t,r,n,a){let i,o,s,u=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];u&&(s=u.properties);let c=t.getExtension("3DTILES_draco_point_compression");if(c){o=c.properties;let f=c.byteOffset,p=c.byteLength;if(!o||!Number.isFinite(f)||!p)throw new Error("Draco properties, byteOffset, and byteLength must be defined");i=(e.featureTableBinary||[]).slice(f,f+p),e.hasPositions=Number.isFinite(o.POSITION),e.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),e.hasNormals=Number.isFinite(o.NORMAL),e.hasBatchIds=Number.isFinite(o.BATCH_ID),e.isTranslucent=Number.isFinite(o.RGBA)}if(!i)return!0;let l={buffer:i,properties:{...o,...s},featureTableProperties:o,batchTableProperties:s,dequantizeInShader:!1};return await awt(e,l,n,a)}async function awt(e,t,r,n){if(!n)return;let a={...r,draco:{...r==null?void 0:r.draco,extraAttributes:t.batchTableProperties||{}}};delete a["3d-tiles"];let i=await Hi(t.buffer,Sd,a,n),o=i.attributes.POSITION&&i.attributes.POSITION.value,s=i.attributes.COLOR_0&&i.attributes.COLOR_0.value,u=i.attributes.NORMAL&&i.attributes.NORMAL.value,c=i.attributes.BATCH_ID&&i.attributes.BATCH_ID.value,l=o&&i.attributes.POSITION.value.quantization,f=u&&i.attributes.NORMAL.value.quantization;if(l){let d=i.POSITION.data.quantization,h=d.range;e.quantizedVolumeScale=new Z(h,h,h),e.quantizedVolumeOffset=new Z(d.minValues),e.quantizedRange=(1<<d.quantizationBits)-1,e.isQuantizedDraco=!0}f&&(e.octEncodedRange=(1<<i.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let p={};if(t.batchTableProperties)for(let d of Object.keys(t.batchTableProperties))i.attributes[d]&&i.attributes[d].value&&(p[d.toLowerCase()]=i.attributes[d].value);e.attributes={positions:o,colors:xM(e,s,void 0),normals:u,batchIds:c,...p}}var ZS={};Fa(ZS,{createExtMeshFeatures:()=>QS,decode:()=>zwt,encode:()=>Gwt,name:()=>YS});var US="4.4.0";var Jve,iwt=(Jve=globalThis.loaders)==null?void 0:Jve.parseImageNode,yM=typeof Image<"u",_M=typeof ImageBitmap<"u",owt=Boolean(iwt),wM=pr?!0:owt;function Xve(e){switch(e){case"auto":return _M||yM||wM;case"imagebitmap":return _M;case"image":return yM;case"data":return wM;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Yve(){if(_M)return"imagebitmap";if(yM)return"image";if(wM)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Qve(e){let t=swt(e);if(!t)throw new Error("Not an image");return t}function AM(e){return ag(e)}function ag(e){switch(Qve(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function swt(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 uwt=/^data:image\/svg\+xml/,cwt=/\.svg((\?|#).*)?$/;function zS(e){return e&&(uwt.test(e)||cwt.test(e))}function Zve(e,t){if(zS(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return EM(e,t)}function EM(e,t){if(zS(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function GS(e,t,r){let n=Zve(e,r),a=self.URL||self.webkitURL,i=typeof n!="string"&&a.createObjectURL(n);try{return await lwt(i||n,t)}finally{i&&a.revokeObjectURL(i)}}async function lwt(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,a)=>{try{r.onload=()=>n(r),r.onerror=i=>{let o=i instanceof Error?i.message:"error";a(new Error(o))}}catch(i){a(i)}})}var exe=!0;async function txe(e,t,r){let n;zS(r)?n=await GS(e,t,r):n=EM(e,r);let a=t&&t.imagebitmap;return await fwt(n,a)}async function fwt(e,t=null){if((pwt(t)||!exe)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),exe=!1}return await createImageBitmap(e)}function pwt(e){if(!e)return!0;for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function rxe(e){return!gwt(e,"ftyp",4)||!(e[8]&96)?null:dwt(e)}function dwt(e){switch(hwt(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function hwt(e,t,r){return String.fromCharCode(...e.slice(t,r))}function mwt(e){return[...e].map(t=>t.charCodeAt(0))}function gwt(e,t,r=0){let n=mwt(t);for(let a=0;a<n.length;++a)if(n[a]!==e[a+r])return!1;return!0}var Lu=!1,S1=!0;function Cd(e){let t=k1(e);return vwt(t)||_wt(t)||xwt(t)||ywt(t)||bwt(t)}function bwt(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=rxe(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function vwt(e){let t=k1(e);return t.byteLength>=24&&t.getUint32(0,Lu)===2303741511?{mimeType:"image/png",width:t.getUint32(16,Lu),height:t.getUint32(20,Lu)}:null}function xwt(e){let t=k1(e);return t.byteLength>=10&&t.getUint32(0,Lu)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,S1),height:t.getUint16(8,S1)}:null}function ywt(e){let t=k1(e);return t.byteLength>=14&&t.getUint16(0,Lu)===16973&&t.getUint32(2,S1)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,S1),height:t.getUint32(22,S1)}:null}function _wt(e){let t=k1(e);if(!(t.byteLength>=3&&t.getUint16(0,Lu)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:a}=wwt(),i=2;for(;i+9<t.byteLength;){let o=t.getUint16(i,Lu);if(a.has(o))return{mimeType:"image/jpeg",height:t.getUint16(i+5,Lu),width:t.getUint16(i+7,Lu)};if(!n.has(o))return null;i+=2,i+=t.getUint16(i,Lu)}return null}function wwt(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function k1(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 nxe(e,t){var a;let{mimeType:r}=Cd(e)||{},n=(a=globalThis.loaders)==null?void 0:a.parseImageNode;return yt(n),await n(e,r)}async function axe(e,t,r){t=t||{};let a=(t.image||{}).type||"auto",{url:i}=r||{},o=Awt(a),s;switch(o){case"imagebitmap":s=await txe(e,t,i);break;case"image":s=await GS(e,t,i);break;case"data":s=await nxe(e,t);break;default:yt(!1)}return a==="data"&&(s=ag(s)),s}function Awt(e){switch(e){case"auto":case"data":return Yve();default:return Xve(e),e}}var Ewt=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Twt=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Swt={image:{type:"auto",decode:!0}},ig={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:US,mimeTypes:Twt,extensions:Ewt,parse:axe,tests:[e=>Boolean(Cd(new DataView(e)))],options:Swt};var sxe,ixe=(sxe=globalThis.loaders)==null?void 0:sxe.encodeImageNode;async function uxe(e,t){return t=t||{},t.image=t.image||{},ixe?ixe(e,{type:t.image.mimeType}):kwt(e,t)}var oxe=!0;async function kwt(e,t){let{mimeType:r,jpegQuality:n}=t.image,{width:a,height:i}=AM(e),o=document.createElement("canvas");o.width=a,o.height=i,Cwt(e,o);let s=await new Promise(u=>{if(n&&oxe)try{o.toBlob(u,r,n);return}catch{oxe=!1}o.toBlob(u,r)});if(!s)throw new Error("image encoding failed");return await s.arrayBuffer()}function Cwt(e,t,r=0,n=0){if(r===0&&n===0&&typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let i=t.getContext("bitmaprenderer");if(i)return i.transferFromImageBitmap(e),t}let a=t.getContext("2d");if(e.data){let i=new Uint8ClampedArray(e.data),o=new ImageData(i,e.width,e.height);return a.putImageData(o,0,0),t}return a.drawImage(e,0,0),t}var TM={name:"Images",id:"image",module:"images",version:US,extensions:["jpeg"],mimeTypes:[],options:{image:{mimeType:"image/png",jpegQuality:null}},encode:uxe};var SM={};function kM(e){if(SM[e]===void 0){let t=pr?Bwt(e):Dwt(e);SM[e]=t}return SM[e]}function Dwt(e){var a,i;let t=["image/png","image/jpeg","image/gif"],r=((a=globalThis.loaders)==null?void 0:a.imageFormatsNode)||t,n=(i=globalThis.loaders)==null?void 0:i.parseImageNode;return Boolean(n)&&r.includes(e)}function Bwt(e){switch(e){case"image/avif":case"image/webp":return Fwt(e);default:return!0}}function Fwt(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}function Xn(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var HS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},VS={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var Owt=1.33,cxe=["SCALAR","VEC2","VEC3","VEC4"],Iwt=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],Pwt=new Map(Iwt),Rwt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},jwt={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Lwt={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function $S(e){return cxe[e-1]||cxe[0]}function Lf(e){let t=Pwt.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function og(e,t){let r=Lwt[e.componentType],n=Rwt[e.type],a=jwt[e.componentType],i=e.count*n,o=e.count*n*a;Xn(o>=0&&o<=t.byteLength);let s=VS[e.componentType],u=HS[e.type];return{ArrayType:r,length:i,byteLength:o,componentByteSize:s,numberOfComponentsInElement:u}}function C1(e){let{images:t,bufferViews:r}=e;t=t||[],r=r||[];let n=t.map(o=>o.bufferView);r=r.filter(o=>!n.includes(o));let a=r.reduce((o,s)=>o+s.byteLength,0),i=t.reduce((o,s)=>{let{width:u,height:c}=s.image;return o+u*c},0);return a+Math.ceil(4*i*Owt)}function lxe(e,t,r){let n=e.bufferViews[r];Xn(n);let a=n.buffer,i=t[a];Xn(i);let o=(n.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,o,n.byteLength)}function fxe(e,t,r){var m,g;let n=typeof r=="number"?(m=e.accessors)==null?void 0:m[r]:r;if(!n)throw new Error(`No gltf accessor ${JSON.stringify(r)}`);let a=(g=e.bufferViews)==null?void 0:g[n.bufferView||0];if(!a)throw new Error(`No gltf buffer view for accessor ${a}`);let{arrayBuffer:i,byteOffset:o}=t[a.buffer],s=(o||0)+(n.byteOffset||0)+(a.byteOffset||0),{ArrayType:u,length:c,componentByteSize:l,numberOfComponentsInElement:f}=og(n,a),p=l*f,d=a.byteStride||p;if(typeof a.byteStride>"u"||a.byteStride===p)return new u(i,s,c);let h=new u(c);for(let x=0;x<n.count;x++){let y=new u(i,s+x*d,f);h.set(y,x*f)}return h}function Mwt(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var Xt=class{gltf;sourceBuffers;byteLength;constructor(t){this.gltf={json:(t==null?void 0:t.json)||Mwt(),buffers:(t==null?void 0:t.buffers)||[],images:(t==null?void 0:t.images)||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}hasExtension(t){let r=this.getUsedExtensions().find(a=>a===t),n=this.getRequiredExtensions().find(a=>a===t);return typeof r=="string"||typeof n=="string"}getExtension(t){let r=this.getUsedExtensions().find(a=>a===t),n=this.json.extensions||{};return r?n[t]:null}getRequiredExtension(t){return this.getRequiredExtensions().find(n=>n===t)?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(t,r){return(t.extensions||{})[r]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,r){if(typeof r=="object")return r;let n=this.json[t]&&this.json[t][r];if(!n)throw new Error(`glTF file error: Could not find ${t}[${r}]`);return n}getTypedArrayForBufferView(t){t=this.getBufferView(t);let r=t.buffer,n=this.gltf.buffers[r];Xn(n);let a=(t.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,a,t.byteLength)}getTypedArrayForAccessor(t){let r=this.getAccessor(t);return fxe(this.gltf.json,this.gltf.buffers,r)}getTypedArrayForImageData(t){t=this.getAccessor(t);let r=this.getBufferView(t.bufferView),a=this.getBuffer(r.buffer).data,i=r.byteOffset||0;return new Uint8Array(a,i,r.byteLength)}addApplicationData(t,r){return this.json[t]=r,this}addExtraData(t,r){return this.json.extras=this.json.extras||{},this.json.extras[t]=r,this}addObjectExtension(t,r,n){return t.extensions=t.extensions||{},t.extensions[r]=n,this.registerUsedExtension(r),this}setObjectExtension(t,r,n){let a=t.extensions||{};a[r]=n}removeObjectExtension(t,r){let n=(t==null?void 0:t.extensions)||{};if(n[r]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let a=this.json.extensionsRemoved;a.includes(r)||a.push(r)}delete n[r]}addExtension(t,r={}){return Xn(r),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=r,this.registerUsedExtension(t),r}addRequiredExtension(t,r={}){return Xn(r),this.addExtension(t,r),this.registerRequiredExtension(t),r}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(r=>r===t)||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(r=>r===t)||this.json.extensionsRequired.push(t)}removeExtension(t){var r;if((r=this.json.extensions)!=null&&r[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let n=this.json.extensionsRemoved;n.includes(t)||n.push(t)}this.json.extensions&&delete this.json.extensions[t],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t)}setDefaultScene(t){this.json.scene=t}addScene(t){let{nodeIndices:r}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:r}),this.json.scenes.length-1}addNode(t){let{meshIndex:r,matrix:n}=t;this.json.nodes=this.json.nodes||[];let a={mesh:r};return n&&(a.matrix=n),this.json.nodes.push(a),this.json.nodes.length-1}addMesh(t){let{attributes:r,indices:n,material:a,mode:i=4}=t,s={primitives:[{attributes:this._addAttributes(r),mode:i}]};if(n){let u=this._addIndices(n);s.primitives[0].indices=u}return Number.isFinite(a)&&(s.primitives[0].material=a),this.json.meshes=this.json.meshes||[],this.json.meshes.push(s),this.json.meshes.length-1}addPointCloud(t){let n={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(n),this.json.meshes.length-1}addImage(t,r){let n=Cd(t),a=r||(n==null?void 0:n.mimeType),o={bufferView:this.addBufferView(t),mimeType:a};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(t,r=0,n=this.byteLength){let a=t.byteLength;Xn(Number.isFinite(a)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let i={buffer:r,byteOffset:n,byteLength:a};return this.byteLength+=Ki(a,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(t,r){let n={bufferView:t,type:$S(r.size),componentType:r.componentType,count:r.count,max:r.max,min:r.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(t,r={size:3}){let n=this.addBufferView(t),a={min:r.min,max:r.max};(!a.min||!a.max)&&(a=this._getAccessorMinMax(t,r.size));let i={size:r.size,componentType:Lf(t),count:Math.round(t.length/r.size),min:a.min,max:a.max};return this.addAccessor(n,Object.assign(i,r))}addTexture(t){let{imageIndex:r}=t,n={source:r};return this.json.textures=this.json.textures||[],this.json.textures.push(n),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){var i,o;let t=this.byteLength,r=new ArrayBuffer(t),n=new Uint8Array(r),a=0;for(let s of this.sourceBuffers||[])a=rF(s,n,a);(o=(i=this.json)==null?void 0:i.buffers)!=null&&o[0]?this.json.buffers[0].byteLength=t:this.json.buffers=[{byteLength:t}],this.gltf.binary=r,this.sourceBuffers=[r],this.gltf.buffers=[{arrayBuffer:r,byteOffset:0,byteLength:r.byteLength}]}_removeStringFromArray(t,r){let n=!0;for(;n;){let a=t.indexOf(r);a>-1?t.splice(a,1):n=!1}}_addAttributes(t={}){let r={};for(let n in t){let a=t[n],i=this._getGltfAttributeName(n),o=this.addBinaryBuffer(a.value,a);r[i]=o}return r}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return t}}_getAccessorMinMax(t,r){let n={min:null,max:null};if(t.length<r)return n;n.min=[],n.max=[];let a=t.subarray(0,r);for(let i of a)n.min.push(i),n.max.push(i);for(let i=r;i<t.length;i+=r)for(let o=0;o<r;o++)n.min[0+o]=Math.min(n.min[0+o],t[i+o]),n.max[0+o]=Math.max(n.max[0+o],t[i+o]);return n}};function pxe(e){return(e%1+1)%1}var dxe={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},qwt={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},hxe={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function D1(e,t){return hxe[t]*dxe[e]}function sg(e,t,r,n){if(r!=="UINT8"&&r!=="UINT16"&&r!=="UINT32"&&r!=="UINT64")return null;let a=e.getTypedArrayForBufferView(t),i=ug(a,"SCALAR",r,n+1);return i instanceof BigInt64Array||i instanceof BigUint64Array?null:i}function ug(e,t,r,n=1){let a=dxe[t],i=qwt[r],o=hxe[r],s=n*a,u=s*o,c=e.buffer,l=e.byteOffset;return l%o!==0&&(c=new Uint8Array(c).slice(l,l+u).buffer,l=0),new i(za(c),l,s)}function cg(e,t,r){var c,l,f,p,d;let n=`TEXCOORD_${t.texCoord||0}`,a=r.attributes[n],i=e.getTypedArrayForAccessor(a),o=e.gltf.json,s=t.index,u=(l=(c=o.textures)==null?void 0:c[s])==null?void 0:l.source;if(typeof u<"u"){let h=(p=(f=o.images)==null?void 0:f[u])==null?void 0:p.mimeType,m=(d=e.gltf.images)==null?void 0:d[u];if(m&&typeof m.width<"u"){let g=[];for(let x=0;x<i.length;x+=2){let y=Nwt(m,h,i,x,t.channels);g.push(y)}return g}}return[]}function WS(e,t,r,n,a){if(!(r!=null&&r.length))return;let i=[];for(let l of r){let f=n.findIndex(p=>p===l);f===-1&&(f=n.push(l)-1),i.push(f)}let o=new Uint32Array(i),s=e.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,u=e.addBufferView(o,s,0),c=e.addAccessor(u,{size:1,componentType:Lf(o),count:o.length});a.attributes[t]=c}function Nwt(e,t,r,n,a=[0]){let i={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=r[n],s=r[n+1],u=1;t&&(t.indexOf("image/jpeg")!==-1||t.indexOf("image/png")!==-1)&&(u=4);let c=Uwt(o,s,e,u),l=0;for(let f of a){let p=typeof f=="number"?Object.values(i)[f]:i[f],d=c+p.offset,h=ag(e);if(h.data.length<=d)throw new Error(`${h.data.length} <= ${d}`);let m=h.data[d];l|=m<<p.shift}return l}function Uwt(e,t,r,n=1){let a=r.width,i=pxe(e)*(a-1),o=Math.round(i),s=r.height,u=pxe(t)*(s-1),c=Math.round(u),l=r.components?r.components:n;return(c*a+o)*l}function KS(e,t,r,n,a){let i=[];for(let o=0;o<t;o++){let s=r[o],u=r[o+1]-r[o];if(u+s>n)break;let c=s/a,l=u/a;i.push(e.slice(c,c+l))}return i}function JS(e,t,r){let n=[];for(let a=0;a<t;a++){let i=a*r;n.push(e.slice(i,i+r))}return n}function XS(e,t,r,n){if(r)throw new Error("Not implemented - arrayOffsets for strings is specified");if(n){let a=[],i=new TextDecoder("utf8"),o=0;for(let s=0;s<e;s++){let u=n[s+1]-n[s];if(u+o<=t.length){let c=t.subarray(o,u+o),l=i.decode(c);a.push(l),o+=u}}return a}return[]}var lg="EXT_mesh_features",YS=lg;async function zwt(e,t){let r=new Xt(e);Hwt(r,t)}function Gwt(e,t){let r=new Xt(e);return $wt(r,t),r.createBinaryChunk(),r.gltf}function Hwt(e,t){let r=e.gltf.json;if(r.meshes)for(let n of r.meshes)for(let a of n.primitives)Vwt(e,a,t)}function Vwt(e,t,r){var i,o,s;if(!((i=r==null?void 0:r.gltf)!=null&&i.loadBuffers))return;let n=(o=t.extensions)==null?void 0:o[lg],a=n==null?void 0:n.featureIds;if(a)for(let u of a){let c;if(typeof u.attribute<"u"){let l=`_FEATURE_ID_${u.attribute}`,f=t.attributes[l];c=e.getTypedArrayForAccessor(f)}else typeof u.texture<"u"&&((s=r==null?void 0:r.gltf)!=null&&s.loadImages)?c=cg(e,u.texture,t):c=[];u.data=c}}function $wt(e,t){let r=e.gltf.json.meshes;if(r)for(let n of r)for(let a of n.primitives)Wwt(e,a)}function QS(e,t,r,n){t.extensions||(t.extensions={});let a=t.extensions[lg];a||(a={featureIds:[]},t.extensions[lg]=a);let{featureIds:i}=a,o={featureCount:r.length,propertyTable:n,data:r};i.push(o),e.addObjectExtension(t,lg,a)}function Wwt(e,t){var a;let r=(a=t.extensions)==null?void 0:a[lg];if(!r)return;let n=r.featureIds;n.forEach((i,o)=>{if(i.data){let{accessorKey:s,index:u}=Kwt(t.attributes),c=new Uint32Array(i.data);n[o]={featureCount:c.length,propertyTable:i.propertyTable,attribute:u},e.gltf.buffers.push({arrayBuffer:c.buffer,byteOffset:c.byteOffset,byteLength:c.byteLength});let l=e.addBufferView(c),f=e.addAccessor(l,{size:1,componentType:Lf(c),count:c.length});t.attributes[s]=f}})}function Kwt(e){let t="_FEATURE_ID_",r=Object.keys(e).filter(i=>i.indexOf(t)===0),n=-1;for(let i of r){let o=Number(i.substring(t.length));o>n&&(n=o)}return n++,{accessorKey:`${t}${n}`,index:n}}var t8={};Fa(t8,{createExtStructuralMetadata:()=>e8,decode:()=>Jwt,encode:()=>Xwt,name:()=>Xc});var fg="EXT_structural_metadata",Xc=fg;async function Jwt(e,t){let r=new Xt(e);Ywt(r,t)}function Xwt(e,t){let r=new Xt(e);return dAt(r,t),r.createBinaryChunk(),r.gltf}function Ywt(e,t){var n,a;if(!((n=t.gltf)!=null&&n.loadBuffers))return;let r=e.getExtension(fg);r&&((a=t.gltf)!=null&&a.loadImages&&Qwt(e,r),Zwt(e,r))}function Qwt(e,t){let r=t.propertyTextures,n=e.gltf.json;if(r&&n.meshes)for(let a of n.meshes)for(let i of a.primitives)tAt(e,r,i,t)}function Zwt(e,t){let r=t.schema;if(!r)return;let n=r.classes,a=t.propertyTables;if(n&&a)for(let i in n){let o=eAt(a,i);o&&nAt(e,r,o)}}function eAt(e,t){for(let r of e)if(r.class===t)return r;return null}function tAt(e,t,r,n){var o;if(!t)return;let a=(o=r.extensions)==null?void 0:o[fg],i=a==null?void 0:a.propertyTextures;if(i)for(let s of i){let u=t[s];rAt(e,u,r,n)}}function rAt(e,t,r,n){var i;if(!t.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);let a=t.class;for(let o in t.properties){let s=`${a}_${o}`,u=(i=t.properties)==null?void 0:i[o];if(!u)continue;u.data||(u.data=[]);let c=u.data,l=cg(e,u,r);l!==null&&(WS(e,s,l,c,r),u.data=c,n.dataAttributeNames.push(s))}}function nAt(e,t,r){var i,o;let n=(i=t.classes)==null?void 0:i[r.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let a=r.count;for(let s in n.properties){let u=n.properties[s],c=(o=r.properties)==null?void 0:o[s];if(c){let l=aAt(e,t,u,a,c);c.data=l}}}function aAt(e,t,r,n,a){let i=[],o=a.values,s=e.getTypedArrayForBufferView(o),u=iAt(e,r,a,n),c=oAt(e,a,n);switch(r.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{i=sAt(r,n,s,u);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${r.type}`);case"STRING":{i=XS(n,s,u,c);break}case"ENUM":{i=uAt(t,r,n,s,u);break}default:throw new Error(`Unknown classProperty type ${r.type}`)}return i}function iAt(e,t,r,n){return t.array&&typeof t.count>"u"&&typeof r.arrayOffsets<"u"?sg(e,r.arrayOffsets,r.arrayOffsetType||"UINT32",n):null}function oAt(e,t,r){return typeof t.stringOffsets<"u"?sg(e,t.stringOffsets,t.stringOffsetType||"UINT32",r):null}function sAt(e,t,r,n){let a=e.array,i=e.count,o=D1(e.type,e.componentType),s=r.byteLength/o,u;return e.componentType?u=ug(r,e.type,e.componentType,s):u=r,a?n?KS(u,t,n,r.length,o):i?JS(u,t,i):[]:u}function uAt(e,t,r,n,a){var f;let i=t.enumType;if(!i)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let o=(f=e.enums)==null?void 0:f[i];if(!o)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${i}`);let s=o.valueType||"UINT16",u=D1(t.type,s),c=n.byteLength/u,l=ug(n,t.type,s,c);if(l||(l=n),t.array){if(a)return cAt({valuesData:l,numberOfElements:r,arrayOffsets:a,valuesDataBytesLength:n.length,elementSize:u,enumEntry:o});let p=t.count;return p?lAt(l,r,p,o):[]}return DM(l,0,r,o)}function cAt(e){let{valuesData:t,numberOfElements:r,arrayOffsets:n,valuesDataBytesLength:a,elementSize:i,enumEntry:o}=e,s=[];for(let u=0;u<r;u++){let c=n[u],l=n[u+1]-n[u];if(l+c>a)break;let f=c/i,p=l/i,d=DM(t,f,p,o);s.push(d)}return s}function lAt(e,t,r,n){let a=[];for(let i=0;i<t;i++){let o=r*i,s=DM(e,o,r,n);a.push(s)}return a}function DM(e,t,r,n){let a=[];for(let i=0;i<r;i++)if(e instanceof BigInt64Array||e instanceof BigUint64Array)a.push("");else{let o=e[t+i],s=fAt(n,o);s?a.push(s.name):a.push("")}return a}function fAt(e,t){for(let r of e.values)if(r.value===t)return r;return null}var pAt="schemaClassId";function dAt(e,t){var n,a;let r=e.getExtension(fg);if(r&&r.propertyTables)for(let i of r.propertyTables){let o=i.class,s=(a=(n=r.schema)==null?void 0:n.classes)==null?void 0:a[o];i.properties&&s&&hAt(i,s,e)}}function hAt(e,t,r){for(let n in e.properties){let a=e.properties[n].data;if(a){let i=t.properties[n];if(i){let o=bAt(a,i,r);e.properties[n]=o}}}}function e8(e,t,r=pAt){let n=e.getExtension(fg);n||(n=e.addExtension(fg)),n.schema=mAt(t,r,n.schema);let a=gAt(t,r,n.schema);return n.propertyTables||(n.propertyTables=[]),n.propertyTables.push(a)-1}function mAt(e,t,r){let n=r??{id:"schema_id"},a={properties:{}};for(let i of e){let o={type:i.elementType,componentType:i.componentType};a.properties[i.name]=o}return n.classes={},n.classes[t]=a,n}function gAt(e,t,r){var o;let n={class:t,count:0},a=0,i=(o=r.classes)==null?void 0:o[t];for(let s of e){if(a===0&&(a=s.values.length),a!==s.values.length&&s.values.length)throw new Error("Illegal values in attributes");(i==null?void 0:i.properties[s.name])&&(n.properties||(n.properties={}),n.properties[s.name]={values:0,data:s.values})}return n.count=a,n}function bAt(e,t,r){let n={values:0};if(t.type==="STRING"){let{stringData:a,stringOffsets:i}=yAt(e);n.stringOffsets=CM(i,r),n.values=CM(a,r)}else if(t.type==="SCALAR"&&t.componentType){let a=xAt(e,t.componentType);n.values=CM(a,r)}return n}var vAt={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:Int32Array,UINT64:Uint32Array,FLOAT32:Float32Array,FLOAT64:Float64Array};function xAt(e,t){let r=[];for(let a of e)r.push(Number(a));let n=vAt[t];if(!n)throw new Error("Illegal component type");return new n(r)}function yAt(e){let t=new TextEncoder,r=[],n=0;for(let u of e){let c=t.encode(u);n+=c.length,r.push(c)}let a=new Uint8Array(n),i=[],o=0;for(let u of r)a.set(u,o),i.push(o),o+=u.length;i.push(o);let s=new Uint32Array(i);return{stringData:a,stringOffsets:s}}function CM(e,t){return t.gltf.buffers.push({arrayBuffer:za(e.buffer),byteOffset:e.byteOffset,byteLength:e.byteLength}),t.addBufferView(e)}var BM={};Fa(BM,{decode:()=>_At,name:()=>Ro});var mxe="EXT_feature_metadata",Ro=mxe;async function _At(e,t){let r=new Xt(e);wAt(r,t)}function wAt(e,t){var n,a;if(!((n=t.gltf)!=null&&n.loadBuffers))return;let r=e.getExtension(mxe);r&&((a=t.gltf)!=null&&a.loadImages&&AAt(e,r),EAt(e,r))}function AAt(e,t){let r=t.schema;if(!r)return;let n=r.classes,{featureTextures:a}=t;if(n&&a)for(let i in n){let o=n[i],s=SAt(a,i);s&&CAt(e,s,o)}}function EAt(e,t){let r=t.schema;if(!r)return;let n=r.classes,a=t.featureTables;if(n&&a)for(let i in n){let o=TAt(a,i);o&&kAt(e,r,o)}}function TAt(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function SAt(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function kAt(e,t,r){var i,o;if(!r.class)return;let n=(i=t.classes)==null?void 0:i[r.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let a=r.count;for(let s in n.properties){let u=n.properties[s],c=(o=r.properties)==null?void 0:o[s];if(c){let l=DAt(e,t,u,a,c);c.data=l}}}function CAt(e,t,r){var a;let n=t.class;for(let i in r.properties){let o=(a=t==null?void 0:t.properties)==null?void 0:a[i];if(o){let s=PAt(e,o,n);o.data=s}}}function DAt(e,t,r,n,a){let i=[],o=a.bufferView,s=e.getTypedArrayForBufferView(o),u=BAt(e,r,a,n),c=FAt(e,r,a,n);return r.type==="STRING"||r.componentType==="STRING"?i=XS(n,s,u,c):OAt(r)&&(i=IAt(r,n,s,u)),i}function BAt(e,t,r,n){return t.type==="ARRAY"&&typeof t.componentCount>"u"&&typeof r.arrayOffsetBufferView<"u"?sg(e,r.arrayOffsetBufferView,r.offsetType||"UINT32",n):null}function FAt(e,t,r,n){return typeof r.stringOffsetBufferView<"u"?sg(e,r.stringOffsetBufferView,r.offsetType||"UINT32",n):null}function OAt(e){let t=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return t.includes(e.type)||typeof e.componentType<"u"&&t.includes(e.componentType)}function IAt(e,t,r,n){let a=e.type==="ARRAY",i=e.componentCount,o="SCALAR",s=e.componentType||e.type,u=D1(o,s),c=r.byteLength/u,l=ug(r,o,s,c);return a?n?KS(l,t,n,r.length,u):i?JS(l,t,i):[]:l}function PAt(e,t,r){let n=e.gltf.json;if(!n.meshes)return[];let a=[];for(let i of n.meshes)for(let o of i.primitives)RAt(e,r,t,a,o);return a}function RAt(e,t,r,n,a){let i={channels:r.channels,...r.texture},o=cg(e,i,a);o&&WS(e,t,o,n,a)}var r8="4.4.0";var pg="4.4.0";var Mu={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},gxe;async function OM(e){u0(e.modules);let t=HB("basis");return t||(gxe||(gxe=jAt(e)),await gxe)}async function jAt(e){let t=null,r=null;return[t,r]=await Promise.all([await yo(Mu.TRANSCODER,"textures",e),await yo(Mu.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await LAt(t,r)}function LAt(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e(r).then(a=>{let{BasisFile:i,initializeBasis:o}=a;o(),n({BasisFile:i})})})}var FM;async function IM(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(FM=FM||MAt(e),await FM)}async function MAt(e){let t=null,r=null;return[t,r]=await Promise.all([await yo(Mu.ENCODER,"textures",e),await yo(Mu.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await qAt(t,r)}function qAt(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e(r).then(a=>{let{BasisFile:i,KTX2File:o,initializeBasis:s,BasisEncoder:u}=a;s(),n({BasisFile:i,KTX2File:o,BasisEncoder:u})})})}var NAt=["","WEBKIT_","MOZ_"],bxe={WEBGL_compressed_texture_s3tc:["bc1-rgb-unorm-webgl","bc1-rgba-unorm","bc2-rgba-unorm","bc3-rgba-unorm"],WEBGL_compressed_texture_s3tc_srgb:["bc1-rgb-unorm-srgb-webgl","bc1-rgba-unorm-srgb","bc2-rgba-unorm-srgb","bc3-rgba-unorm-srgb"],EXT_texture_compression_rgtc:["bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm"],EXT_texture_compression_bptc:["bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"],WEBGL_compressed_texture_etc1:["etc1-rgb-unorm-webgl"],WEBGL_compressed_texture_etc:["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm"],WEBGL_compressed_texture_pvrtc:["pvrtc-rgb4unorm-webgl","pvrtc-rgba4unorm-webgl","pvrtc-rgb2unorm-webgl","pvrtc-rgba2unorm-webgl"],WEBGL_compressed_texture_atc:["atc-rgb-unorm-webgl","atc-rgba-unorm-webgl","atc-rgbai-unorm-webgl"],WEBGL_compressed_texture_astc:["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]};var n8=null;function vxe(e){if(!n8){e=e||UAt()||void 0,n8=new Set;for(let t of NAt)for(let r in bxe)if(e&&e.getExtension(`${t}${r}`))for(let n of bxe[r])n8.add(n)}return n8}function UAt(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var PM=class{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}},Dd=class{constructor(t,r,n,a){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(t.buffer,t.byteOffset+r,n),this._littleEndian=a,this._offset=0}_nextUint8(){let t=this._dataView.getUint8(this._offset);return this._offset+=1,t}_nextUint16(){let t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}_nextUint32(){let t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint64(){let t=this._dataView.getUint32(this._offset,this._littleEndian),r=this._dataView.getUint32(this._offset+4,this._littleEndian),n=t+2**32*r;return this._offset+=8,n}_nextInt32(){let t=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint8Array(t){let r=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,t);return this._offset+=t,r}_skip(t){return this._offset+=t,this}_scan(t,r=0){let n=this._offset,a=0;for(;this._dataView.getUint8(this._offset)!==r&&a<t;)a++,this._offset++;return a<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,a)}};var Zsr=new Uint8Array([0]),ci=[171,75,84,88,32,50,48,187,13,10,26,10];function xxe(e){return new TextDecoder().decode(e)}function yxe(e){let t=new Uint8Array(e.buffer,e.byteOffset,ci.length);if(t[0]!==ci[0]||t[1]!==ci[1]||t[2]!==ci[2]||t[3]!==ci[3]||t[4]!==ci[4]||t[5]!==ci[5]||t[6]!==ci[6]||t[7]!==ci[7]||t[8]!==ci[8]||t[9]!==ci[9]||t[10]!==ci[10]||t[11]!==ci[11])throw new Error("Missing KTX 2.0 identifier.");let r=new PM,n=17*Uint32Array.BYTES_PER_ELEMENT,a=new Dd(e,ci.length,n,!0);r.vkFormat=a._nextUint32(),r.typeSize=a._nextUint32(),r.pixelWidth=a._nextUint32(),r.pixelHeight=a._nextUint32(),r.pixelDepth=a._nextUint32(),r.layerCount=a._nextUint32(),r.faceCount=a._nextUint32();let i=a._nextUint32();r.supercompressionScheme=a._nextUint32();let o=a._nextUint32(),s=a._nextUint32(),u=a._nextUint32(),c=a._nextUint32(),l=a._nextUint64(),f=a._nextUint64(),p=i*3*8,d=new Dd(e,ci.length+n,p,!0);for(let fe=0;fe<i;fe++)r.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});let h=new Dd(e,o,s,!0),m={vendorId:h._skip(4)._nextUint16(),descriptorType:h._nextUint16(),versionNumber:h._nextUint16(),descriptorBlockSize:h._nextUint16(),colorModel:h._nextUint8(),colorPrimaries:h._nextUint8(),transferFunction:h._nextUint8(),flags:h._nextUint8(),texelBlockDimension:[h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8()],bytesPlane:[h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8()],samples:[]},g=6,x=4,y=(m.descriptorBlockSize/4-g)/x;for(let fe=0;fe<y;fe++){let me={bitOffset:h._nextUint16(),bitLength:h._nextUint8(),channelType:h._nextUint8(),samplePosition:[h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};me.channelType&64?(me.sampleLower=h._nextInt32(),me.sampleUpper=h._nextInt32()):(me.sampleLower=h._nextUint32(),me.sampleUpper=h._nextUint32()),m.samples[fe]=me}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(m);let w=new Dd(e,u,c,!0);for(;w._offset<c;){let fe=w._nextUint32(),me=w._scan(fe),ye=xxe(me);if(r.keyValue[ye]=w._nextUint8Array(fe-me.byteLength-1),ye.match(/^ktx/i)){let N=xxe(r.keyValue[ye]);r.keyValue[ye]=N.substring(0,N.lastIndexOf("\0"))}let X=fe%4?4-fe%4:0;w._skip(X)}if(f<=0)return r;let T=new Dd(e,l,f,!0),A=T._nextUint16(),B=T._nextUint16(),I=T._nextUint32(),L=T._nextUint32(),C=T._nextUint32(),k=T._nextUint32(),F=[];for(let fe=0;fe<i;fe++)F.push({imageFlags:T._nextUint32(),rgbSliceByteOffset:T._nextUint32(),rgbSliceByteLength:T._nextUint32(),alphaSliceByteOffset:T._nextUint32(),alphaSliceByteLength:T._nextUint32()});let R=l+T._offset,G=R+I,z=G+L,W=z+C,Y=new Uint8Array(e.buffer,e.byteOffset+R,I),ue=new Uint8Array(e.buffer,e.byteOffset+G,L),ie=new Uint8Array(e.buffer,e.byteOffset+z,C),le=new Uint8Array(e.buffer,e.byteOffset+W,k);return r.globalData={endpointCount:A,selectorCount:B,imageDescs:F,endpointsData:Y,selectorsData:ue,tablesData:ie,extendedData:le},r}var Nxe={[34836]:"rgba32float",[33776]:"bc1-rgb-unorm-webgl",[35916]:"bc1-rgb-unorm-srgb-webgl",[33777]:"bc1-rgba-unorm",[35917]:"bc1-rgba-unorm-srgb",[33778]:"bc2-rgba-unorm",[35918]:"bc2-rgba-unorm-srgb",[33779]:"bc3-rgba-unorm",[35919]:"bc3-rgba-unorm-srgb",[36283]:"bc4-r-unorm",[36284]:"bc4-r-snorm",[36285]:"bc5-rg-unorm",[36286]:"bc5-rg-snorm",[37492]:"etc2-rgb8unorm",[37494]:"etc2-rgb8unorm-srgb",[37496]:"etc2-rgb8a1unorm",[37497]:"etc2-rgb8a1unorm-srgb",[37493]:"etc2-rgba8unorm",[37495]:"etc2-rgba8unorm-srgb",[37488]:"eac-r11unorm",[37489]:"eac-r11snorm",[37490]:"eac-rg11unorm",[37491]:"eac-rg11snorm",[37808]:"astc-4x4-unorm",[37840]:"astc-4x4-unorm-srgb",[37809]:"astc-5x4-unorm",[37841]:"astc-5x4-unorm-srgb",[37810]:"astc-5x5-unorm",[37842]:"astc-5x5-unorm-srgb",[37811]:"astc-6x5-unorm",[37843]:"astc-6x5-unorm-srgb",[37812]:"astc-6x6-unorm",[37844]:"astc-6x6-unorm-srgb",[37813]:"astc-8x5-unorm",[37845]:"astc-8x5-unorm-srgb",[37814]:"astc-8x6-unorm",[37846]:"astc-8x6-unorm-srgb",[37815]:"astc-8x8-unorm",[37847]:"astc-8x8-unorm-srgb",[37816]:"astc-10x5-unorm",[37848]:"astc-10x5-unorm-srgb",[37817]:"astc-10x6-unorm",[37849]:"astc-10x6-unorm-srgb",[37818]:"astc-10x8-unorm",[37850]:"astc-10x8-unorm-srgb",[37819]:"astc-10x10-unorm",[37851]:"astc-10x10-unorm-srgb",[37820]:"astc-12x10-unorm",[37852]:"astc-12x10-unorm-srgb",[37821]:"astc-12x12-unorm",[37853]:"astc-12x12-unorm-srgb",[35840]:"pvrtc-rgb4unorm-webgl",[35842]:"pvrtc-rgba4unorm-webgl",[35841]:"pvrtc-rgb2unorm-webgl",[35843]:"pvrtc-rgba2unorm-webgl",[36196]:"etc1-rgb-unorm-webgl",[35986]:"atc-rgb-unorm-webgl",[35987]:"atc-rgba-unorm-webgl",[34798]:"atc-rgbai-unorm-webgl"},EEt=Object.fromEntries(Object.entries(Nxe).map(([e,t])=>[t,Number(e)]));function a8(e){if(e!==void 0)return Nxe[e]}function Uxe(e){if(e!==void 0)return EEt[e]}function dg(e,t){let r=new Array(t.mipMapLevels),n=t.textureFormat||a8(t.internalFormat),a=t.internalFormat||Uxe(t.textureFormat),i=t.width,o=t.height,s=0;for(let u=0;u<t.mipMapLevels;++u){let c=SEt(t,i,o,e,u),f={shape:"texture-level",compressed:!0,data:TEt(e,u,s,c),width:i,height:o,levelSize:c};a!==void 0&&(f.format=a),n&&(f.textureFormat=n),r[u]=f,i=Math.max(1,i>>1),o=Math.max(1,o>>1),s+=c}return r}function TEt(e,t,r,n){return Array.isArray(e)?e[t].levelData:new Uint8Array(e.buffer,e.byteOffset+r,n)}function SEt(e,t,r,n,a){return Array.isArray(n)?e.sizeFunction(n[a]):e.sizeFunction(t,r)}var kEt={131:33776,132:35916,133:33777,134:35917,135:33778,136:35918,137:33779,138:35919,139:36283,140:36284,141:36285,142:36286,147:37492,148:37494,149:37496,150:37497,151:37493,152:37495,153:37488,154:37489,155:37490,156:37491,157:37808,158:37840,159:37809,160:37841,161:37810,162:37842,163:37811,164:37843,165:37812,166:37844,167:37813,168:37845,169:37814,170:37846,171:37815,172:37847,173:37816,174:37848,175:37817,176:37849,177:37818,178:37850,179:37819,180:37851,181:37820,182:37852,183:37821,184:37853,1000054e3:35843,1000054001:35842,1000066e3:37808,1000066001:37809,1000066002:37810,1000066003:37811,1000066004:37812,1000066005:37813,1000066006:37814,1000066007:37815,1000066008:37816,1000066009:37817,1000066010:37818,1000066011:37819,1000066012:37820,1000066013:37821};function CEt(e){return kEt[e]}function zxe(e){return a8(CEt(e))}var Qi=[171,75,84,88,32,50,48,187,13,10,26,10];function i8(e){let t=new Uint8Array(e);return!(t.byteLength<Qi.length||t[0]!==Qi[0]||t[1]!==Qi[1]||t[2]!==Qi[2]||t[3]!==Qi[3]||t[4]!==Qi[4]||t[5]!==Qi[5]||t[6]!==Qi[6]||t[7]!==Qi[7]||t[8]!==Qi[8]||t[9]!==Qi[9]||t[10]!==Qi[10]||t[11]!==Qi[11])}function Gxe(e){let t=new Uint8Array(e),r=yxe(t),n=Math.max(1,r.levels.length),a=r.pixelWidth,i=r.pixelHeight,o=zxe(r.vkFormat);return o===void 0&&Dv.warn(`KTX2 container vkFormat ${r.vkFormat} does not map to a known texture format; returning texture levels without format metadata.`)(),dg(r.levels,{mipMapLevels:n,width:a,height:i,sizeFunction:s=>s.uncompressedByteLength,textureFormat:o})}var Hxe=Promise.resolve(),Wxe={etc1:{basisFormat:0,compressed:!0,format:36196,textureFormat:"etc1-rgb-unorm-webgl"},etc2:{basisFormat:1,compressed:!0,format:37493,textureFormat:"etc2-rgba8unorm"},bc1:{basisFormat:2,compressed:!0,format:33776,textureFormat:"bc1-rgb-unorm-webgl"},bc3:{basisFormat:3,compressed:!0,format:33779,textureFormat:"bc3-rgba-unorm"},bc4:{basisFormat:4,compressed:!0,format:36283,textureFormat:"bc4-r-unorm"},bc5:{basisFormat:5,compressed:!0,format:36285,textureFormat:"bc5-rg-unorm"},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0,format:36492,textureFormat:"bc7-rgba-unorm"},"bc7-m5":{basisFormat:7,compressed:!0,format:36492,textureFormat:"bc7-rgba-unorm"},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:35840,textureFormat:"pvrtc-rgb4unorm-webgl"},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:35842,textureFormat:"pvrtc-rgba4unorm-webgl"},"astc-4x4":{basisFormat:10,compressed:!0,format:37808,textureFormat:"astc-4x4-unorm"},"atc-rgb":{basisFormat:11,compressed:!0,format:35986,textureFormat:"atc-rgb-unorm-webgl"},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0,format:34798,textureFormat:"atc-rgbai-unorm-webgl"},rgba32:{basisFormat:13,compressed:!1,format:32856,textureFormat:"rgba8unorm"},rgb565:{basisFormat:14,compressed:!1,format:36194,textureFormat:"rgb565unorm-webgl"},bgr565:{basisFormat:15,compressed:!1,format:36194,textureFormat:"rgb565unorm-webgl"},rgba4444:{basisFormat:16,compressed:!1,format:32854,textureFormat:"rgba4unorm-webgl"}},yur=Object.freeze(Object.keys(Wxe));async function FEt(e){let t=Hxe,r;Hxe=new Promise(n=>{r=n}),await t;try{return await e()}finally{r()}}async function o8(e,t={}){let r=Lv(t);return await FEt(async()=>{var n;if(!((n=t.basis)!=null&&n.containerFormat)||t.basis.containerFormat==="auto"){if(i8(e)){let i=await IM(r);return Vxe(i.KTX2File,e,t)}let{BasisFile:a}=await OM(r);return jM(a,e,t)}switch(t.basis.module){case"encoder":let a=await IM(r);switch(t.basis.containerFormat){case"ktx2":return Vxe(a.KTX2File,e,t);case"basis":default:return jM(a.BasisFile,e,t)}case"transcoder":default:let{BasisFile:i}=await OM(r);return jM(i,e,t)}})}function jM(e,t,r){let n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("Failed to start basis transcoding");let a=n.getNumImages(),i=[];for(let o=0;o<a;o++){let s=n.getNumLevels(o),u=[];for(let c=0;c<s;c++)u.push(OEt(n,o,c,r));i.push(u)}return i}finally{n.close(),n.delete()}}function OEt(e,t,r,n){let a=e.getImageWidth(t,r),i=e.getImageHeight(t,r),o=e.getHasAlpha(),{compressed:s,format:u,basisFormat:c,textureFormat:l}=Kxe(n,o),f=e.getImageTranscodedSizeInBytes(t,r,c),p=new Uint8Array(f);if(!e.transcodeImage(p,t,r,c,0,0))throw new Error("failed to start Basis transcoding");return{shape:"texture-level",width:a,height:i,data:p,compressed:s,...u!==void 0?{format:u}:{},...l!==void 0?{textureFormat:l}:{},hasAlpha:o}}function Vxe(e,t,r){let n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("failed to start KTX2 transcoding");let a=n.getLevels(),i=[];for(let o=0;o<a;o++)i.push(IEt(n,o,r));return[i]}finally{n.close(),n.delete()}}function IEt(e,t,r){let{alphaFlag:n,height:a,width:i}=e.getImageLevelInfo(t,0,0),{compressed:o,format:s,basisFormat:u,textureFormat:c}=Kxe(r,n),l=e.getImageTranscodedSizeInBytes(t,0,0,u),f=new Uint8Array(l);if(!e.transcodeImage(f,t,0,0,u,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{shape:"texture-level",width:i,height:a,data:f,compressed:o,...s!==void 0?{format:s}:{},...c!==void 0?{textureFormat:c}:{},levelSize:l,hasAlpha:n}}function Kxe(e,t){var i,o;let r=((i=e.basis)==null?void 0:i.format)||"auto";r==="auto"&&(r=(o=e.basis)!=null&&o.supportedTextureFormats?$xe(e.basis.supportedTextureFormats):$xe()),typeof r=="object"&&(r=t?r.alpha:r.noAlpha);let n=r.toLowerCase(),a=Wxe[n];if(!a)throw new Error(`Unknown Basis format ${r}`);return a}function $xe(e=vxe()){let t=new Set(e);return hg(t,["astc-4x4-unorm","astc-4x4-unorm-srgb"])?"astc-4x4":hg(t,["bc7-rgba-unorm","bc7-rgba-unorm-srgb"])?{alpha:"bc7-m5",noAlpha:"bc7-m6-opaque-only"}:hg(t,["bc1-rgb-unorm-webgl","bc1-rgb-unorm-srgb-webgl","bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb"])?{alpha:"bc3",noAlpha:"bc1"}:hg(t,["pvrtc-rgb4unorm-webgl","pvrtc-rgba4unorm-webgl","pvrtc-rgb2unorm-webgl","pvrtc-rgba2unorm-webgl"])?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:hg(t,["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm"])?"etc2":t.has("etc1-rgb-unorm-webgl")?"etc1":hg(t,["atc-rgb-unorm-webgl","atc-rgba-unorm-webgl","atc-rgbai-unorm-webgl"])?{alpha:"atc-rgba-interpolated-alpha",noAlpha:"atc-rgb"}:"rgb565"}function hg(e,t){return t.some(r=>e.has(r))}var Jxe={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:pg,worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",containerFormat:"auto",module:"transcoder"}}},Bd={...Jxe,parse:o8};var Zi={MAGIC_NUMBER:542327876,HEADER_LENGTH:31,MAGIC_NUMBER_INDEX:0,HEADER_SIZE_INDEX:1,HEADER_FLAGS_INDEX:2,HEADER_HEIGHT_INDEX:3,HEADER_WIDTH_INDEX:4,MIPMAPCOUNT_INDEX:7,HEADER_PF_FLAGS_INDEX:20,HEADER_PF_FOURCC_INDEX:21,DDSD_MIPMAPCOUNT:131072,DDPF_FOURCC:4},PEt={DXT1:"bc1-rgb-unorm-webgl",DXT3:"bc2-rgba-unorm",DXT5:"bc3-rgba-unorm","ATC ":"atc-rgb-unorm-webgl",ATCA:"atc-rgba-unorm-webgl",ATCI:"atc-rgbai-unorm-webgl"},REt=Qxe,jEt=s8,LEt=s8,MEt={DXT1:Qxe,DXT3:s8,DXT5:s8,"ATC ":REt,ATCA:jEt,ATCI:LEt};function Xxe(e){return new Uint32Array(e,0,Zi.HEADER_LENGTH)[Zi.MAGIC_NUMBER_INDEX]===Zi.MAGIC_NUMBER}function Yxe(e){let t=new Int32Array(e,0,Zi.HEADER_LENGTH),r=t[Zi.HEADER_PF_FOURCC_INDEX];yt(Boolean(t[Zi.HEADER_PF_FLAGS_INDEX]&Zi.DDPF_FOURCC),"DDS: Unsupported format, must contain a FourCC code");let n=qEt(r),a=PEt[n],i=MEt[n];yt(a&&i,`DDS: Unknown pixel format ${r}`);let o=1;t[Zi.HEADER_FLAGS_INDEX]&Zi.DDSD_MIPMAPCOUNT&&(o=Math.max(1,t[Zi.MIPMAPCOUNT_INDEX]));let s=t[Zi.HEADER_WIDTH_INDEX],u=t[Zi.HEADER_HEIGHT_INDEX],c=t[Zi.HEADER_SIZE_INDEX]+4,l=new Uint8Array(e,c);return dg(l,{mipMapLevels:o,width:s,height:u,sizeFunction:i,textureFormat:a})}function Qxe(e,t){return(e+3>>2)*(t+3>>2)*8}function s8(e,t){return(e+3>>2)*(t+3>>2)*16}function qEt(e){return String.fromCharCode(e&255,e>>8&255,e>>16&255,e>>24&255)}var jo={MAGIC_NUMBER:55727696,MAGIC_NUMBER_EXTRA:1347834371,HEADER_LENGTH:13,HEADER_SIZE:52,MAGIC_NUMBER_INDEX:0,PIXEL_FORMAT_INDEX:2,COLOUR_SPACE_INDEX:4,HEIGHT_INDEX:6,WIDTH_INDEX:7,MIPMAPCOUNT_INDEX:11,METADATA_SIZE_INDEX:12},NEt={0:["pvrtc-rgb2unorm-webgl"],1:["pvrtc-rgba2unorm-webgl"],2:["pvrtc-rgb4unorm-webgl"],3:["pvrtc-rgba4unorm-webgl"],6:["etc1-rgb-unorm-webgl"],7:["bc1-rgb-unorm-webgl"],9:["bc2-rgba-unorm"],11:["bc3-rgba-unorm"],22:["etc2-rgb8unorm"],23:["etc2-rgba8unorm"],24:["etc2-rgb8a1unorm"],25:["eac-r11unorm"],26:["eac-rg11unorm"],27:["astc-4x4-unorm","astc-4x4-unorm-srgb"],28:["astc-5x4-unorm","astc-5x4-unorm-srgb"],29:["astc-5x5-unorm","astc-5x5-unorm-srgb"],30:["astc-6x5-unorm","astc-6x5-unorm-srgb"],31:["astc-6x6-unorm","astc-6x6-unorm-srgb"],32:["astc-8x5-unorm","astc-8x5-unorm-srgb"],33:["astc-8x6-unorm","astc-8x6-unorm-srgb"],34:["astc-8x8-unorm","astc-8x8-unorm-srgb"],35:["astc-10x5-unorm","astc-10x5-unorm-srgb"],36:["astc-10x6-unorm","astc-10x6-unorm-srgb"],37:["astc-10x8-unorm","astc-10x8-unorm-srgb"],38:["astc-10x10-unorm","astc-10x10-unorm-srgb"],39:["astc-12x10-unorm","astc-12x10-unorm-srgb"],40:["astc-12x12-unorm","astc-12x12-unorm-srgb"]},UEt={0:Zxe,1:Zxe,2:e1e,3:e1e,6:B1,7:B1,9:F1,11:F1,22:B1,23:F1,24:B1,25:B1,26:F1,27:F1,28:zEt,29:GEt,30:HEt,31:VEt,32:$Et,33:WEt,34:KEt,35:JEt,36:XEt,37:YEt,38:QEt,39:ZEt,40:eTt};function t1e(e){let r=new Uint32Array(e,0,jo.HEADER_LENGTH)[jo.MAGIC_NUMBER_INDEX];return r===jo.MAGIC_NUMBER||r===jo.MAGIC_NUMBER_EXTRA}function r1e(e){let t=new Uint32Array(e,0,jo.HEADER_LENGTH),r=t[jo.PIXEL_FORMAT_INDEX],n=t[jo.COLOUR_SPACE_INDEX],a=NEt[r]||[],i=a.length>1&&n?a[1]:a[0],o=UEt[r],s=t[jo.MIPMAPCOUNT_INDEX],u=t[jo.WIDTH_INDEX],c=t[jo.HEIGHT_INDEX],l=jo.HEADER_SIZE+t[jo.METADATA_SIZE_INDEX],f=new Uint8Array(e,l);return dg(f,{mipMapLevels:s,width:u,height:c,sizeFunction:o,textureFormat:i})}function Zxe(e,t){return e=Math.max(e,16),t=Math.max(t,8),e*t/4}function e1e(e,t){return e=Math.max(e,8),t=Math.max(t,8),e*t/2}function B1(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8}function F1(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16}function zEt(e,t){return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16}function GEt(e,t){return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16}function HEt(e,t){return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16}function VEt(e,t){return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16}function $Et(e,t){return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16}function WEt(e,t){return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16}function KEt(e,t){return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16}function JEt(e,t){return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16}function XEt(e,t){return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16}function YEt(e,t){return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16}function QEt(e,t){return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16}function ZEt(e,t){return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16}function eTt(e,t){return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16}function n1e(e){if(i8(e))return Gxe(e);if(Xxe(e))return Yxe(e);if(t1e(e))return r1e(e);throw new Error("Texture container format not recognized")}var a1e={dataType:null,batchType:null,name:"Texture Containers",id:"compressed-texture",module:"textures",version:pg,worker:!0,extensions:["ktx","ktx2","dds","pvr"],mimeTypes:["image/ktx2","image/ktx","image/vnd-ms.dds","image/x-dds","application/octet-stream"],binary:!0,options:{"compressed-texture":{useBasis:!1}}},u8={...a1e,parse:async(e,t)=>{var r;return t={...t},(r=t==null?void 0:t["compressed-texture"])!=null&&r.useBasis?(t.basis={format:{alpha:"BC3",noAlpha:"BC1"},...t.basis,containerFormat:"ktx2",module:"encoder"},(await o8(e,t))[0]):n1e(e)}};var LM={name:"Basis Universal Supercompressed GPU Texture",id:"ktx2-basis-writer",module:"textures",version:pg,extensions:["ktx2"],worker:!0,options:{useSRGB:!1,qualityLevel:10,encodeUASTC:!1,mipmaps:!1}};var mg=!0,i1e=1735152710,NM=12,c8=8,tTt=1313821514,rTt=5130562,nTt=0,aTt=0,iTt=1;function oTt(e,t=0){return`${String.fromCharCode(e.getUint8(t+0))}${String.fromCharCode(e.getUint8(t+1))}${String.fromCharCode(e.getUint8(t+2))}${String.fromCharCode(e.getUint8(t+3))}`}function o1e(e,t=0,r={}){let n=new DataView(e),{magic:a=i1e}=r,i=n.getUint32(t,!1);return i===a||i===i1e}function s1e(e,t,r=0,n={}){let a=new DataView(t),i=oTt(a,r+0),o=a.getUint32(r+4,mg),s=a.getUint32(r+8,mg);switch(Object.assign(e,{header:{byteOffset:r,byteLength:s,hasBinChunk:!1},type:i,version:o,json:{},binChunks:[]}),r+=NM,e.version){case 1:return sTt(e,a,r);case 2:return uTt(e,a,r,n={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function sTt(e,t,r){yt(e.header.byteLength>NM+c8);let n=t.getUint32(r+0,mg),a=t.getUint32(r+4,mg);return r+=c8,yt(a===nTt),MM(e,t,r,n),r+=n,r+=qM(e,t,r,e.header.byteLength),r}function uTt(e,t,r,n){return yt(e.header.byteLength>NM+c8),cTt(e,t,r,n),r+e.header.byteLength}function cTt(e,t,r,n){for(;r+8<=e.header.byteLength;){let a=t.getUint32(r+0,mg),i=t.getUint32(r+4,mg);switch(r+=c8,i){case tTt:MM(e,t,r,a);break;case rTt:qM(e,t,r,a);break;case aTt:n.strict||MM(e,t,r,a);break;case iTt:n.strict||qM(e,t,r,a);break;default:break}r+=Ki(a,4)}return r}function MM(e,t,r,n){let a=new Uint8Array(t.buffer,r,n),o=new TextDecoder("utf8").decode(a);return e.json=JSON.parse(o),Ki(n,4)}function qM(e,t,r,n){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:t.buffer}),Ki(n,4)}function UM(e,t,r){var i;if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;let a=(r==null?void 0:r.baseUrl)||lTt((i=t==null?void 0:t.core)==null?void 0:i.baseUrl);if(!a)throw new Error(`'baseUrl' must be provided to resolve relative url ${e}`);return a.endsWith("/")?`${a}${e}`:`${a}/${e}`}function lTt(e){if(!e)return;if(e.endsWith("/"))return e;let t=e.lastIndexOf("/");return t>=0?e.slice(0,t+1):""}var GM={};Fa(GM,{decode:()=>wTt,name:()=>_Tt});var fTt="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",pTt="B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",dTt=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),hTt=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),mTt={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},gTt={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function u1e(e,t,r,n,a,i="NONE"){let o=await bTt();yTt(o,o.exports[gTt[a]],e,t,r,n,o.exports[mTt[i||"NONE"]])}var zM;async function bTt(){return zM||(zM=vTt()),zM}async function vTt(){let e=fTt;WebAssembly.validate(dTt)&&(e=pTt,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(xTt(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function xTt(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;++n){let a=e.charCodeAt(n);t[n]=a>96?a-71:a>64?a-65:a>47?a+4:a>46?63:62}let r=0;for(let n=0;n<e.length;++n)t[r++]=t[n]<60?hTt[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,r)}function yTt(e,t,r,n,a,i,o){let s=e.exports.sbrk,u=n+3&-4,c=s(u*a),l=s(i.length),f=new Uint8Array(e.exports.memory.buffer);f.set(i,l);let p=t(c,n,a,l,i.length);if(p===0&&o&&o(c,u,a),r.set(f.subarray(c,c+n*a)),s(c-s(0)),p!==0)throw new Error(`Malformed buffer data: ${p}`)}var l8="EXT_meshopt_compression",_Tt=l8;async function wTt(e,t){var a,i;let r=new Xt(e);if(!((a=t==null?void 0:t.gltf)!=null&&a.decompressMeshes)||!((i=t.gltf)!=null&&i.loadBuffers))return;let n=[];for(let o of e.json.bufferViews||[])n.push(ATt(r,o));await Promise.all(n),r.removeExtension(l8)}async function ATt(e,t){let r=e.getObjectExtension(t,l8);if(r){let{byteOffset:n=0,byteLength:a=0,byteStride:i,count:o,mode:s,filter:u="NONE",buffer:c}=r,l=e.gltf.buffers[c],f=new Uint8Array(l.arrayBuffer,l.byteOffset+n,a),p=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await u1e(p,o,i,f,s,u),e.removeObjectExtension(t,l8)}}var HM={};Fa(HM,{name:()=>ETt,preprocess:()=>TTt});var gg="EXT_texture_webp",ETt=gg;function TTt(e,t){let r=new Xt(e);if(!kM("image/webp")){if(r.getRequiredExtensions().includes(gg))throw new Error(`gltf: Required extension ${gg} not supported by browser`);return}let{json:n}=r;for(let a of n.textures||[]){let i=r.getObjectExtension(a,gg);i&&(a.source=i.source),r.removeObjectExtension(a,gg)}r.removeExtension(gg)}var VM={};Fa(VM,{name:()=>STt,preprocess:()=>kTt});var f8="KHR_texture_basisu",STt=f8;function kTt(e,t){let r=new Xt(e),{json:n}=r;for(let a of n.textures||[]){let i=r.getObjectExtension(a,f8);i&&(a.source=i.source,r.removeObjectExtension(a,f8))}r.removeExtension(f8)}var WM={};Fa(WM,{decode:()=>OTt,encode:()=>ITt,name:()=>BTt,preprocess:()=>FTt});function c1e(e){let t={};for(let r in e){let n=e[r];if(r!=="indices"){let a=$M(n);t[r]=a}}return t}function $M(e){let{buffer:t,size:r,count:n}=CTt(e);return{value:t,size:r,byteOffset:0,count:n,type:$S(r),componentType:Lf(t)}}function CTt(e){let t=e,r=1,n=0;return e&&e.value&&(t=e.value,r=e.size||1),t&&(ArrayBuffer.isView(t)||(t=DTt(t,Float32Array)),n=t.length/r),{buffer:t,size:r,count:n}}function DTt(e,t,r=!1){return e?Array.isArray(e)?new t(e):r&&!(e instanceof t)?new t(e):e:null}var Mf="KHR_draco_mesh_compression",BTt=Mf;function FTt(e,t,r){let n=new Xt(e);for(let a of l1e(n))n.getObjectExtension(a,Mf)}async function OTt(e,t,r){var i;if(!((i=t==null?void 0:t.gltf)!=null&&i.decompressMeshes))return;let n=new Xt(e),a=[];for(let o of l1e(n))n.getObjectExtension(o,Mf)&&a.push(PTt(n,o,t,r));await Promise.all(a),n.removeExtension(Mf)}function ITt(e,t={}){let r=new Xt(e);for(let n of r.json.meshes||[])RTt(n,t),r.addRequiredExtension(Mf)}async function PTt(e,t,r,n){let a=e.getObjectExtension(t,Mf);if(!a)return;let i=e.getTypedArrayForBufferView(a.bufferView),o=Rp(i.buffer,i.byteOffset),s={...r};delete s["3d-tiles"];let u=await Hi(o,Sd,s,n),c=c1e(u.attributes);for(let[l,f]of Object.entries(c))if(l in t.attributes){let p=t.attributes[l],d=e.getAccessor(p);d!=null&&d.min&&(d!=null&&d.max)&&(f.min=d.min,f.max=d.max)}t.attributes=c,u.indices&&(t.indices=$M(u.indices)),e.removeObjectExtension(t,Mf),jTt(t)}function RTt(e,t,r=4,n,a){var l;if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let i=n.DracoWriter.encodeSync({attributes:e}),o=(l=a==null?void 0:a.parseSync)==null?void 0:l.call(a,{attributes:e}),s=n._addFauxAttributes(o.attributes),u=n.addBufferView(i);return{primitives:[{attributes:s,mode:r,extensions:{[Mf]:{bufferView:u,attributes:s}}}]}}function jTt(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*l1e(e){for(let t of e.json.meshes||[])for(let r of t.primitives)yield r}var KM={};Fa(KM,{decode:()=>NTt,name:()=>LTt});var d8="KHR_texture_transform",LTt=d8,p8=new Z,MTt=new nr,qTt=new nr;async function NTt(e,t){var i;if(!new Xt(e).hasExtension(d8)||!((i=t.gltf)!=null&&i.loadBuffers))return;let a=e.json.materials||[];for(let o=0;o<a.length;o++)UTt(o,e)}function UTt(e,t){var i,o,s,u;let r=(i=t.json.materials)==null?void 0:i[e],n=[(o=r==null?void 0:r.pbrMetallicRoughness)==null?void 0:o.baseColorTexture,r==null?void 0:r.emissiveTexture,r==null?void 0:r.normalTexture,r==null?void 0:r.occlusionTexture,(s=r==null?void 0:r.pbrMetallicRoughness)==null?void 0:s.metallicRoughnessTexture],a=[];for(let c of n)c&&((u=c==null?void 0:c.extensions)!=null&&u[d8])&&zTt(t,e,c,a)}function zTt(e,t,r,n){let a=GTt(r,n);if(!a)return;let i=e.json.meshes||[];for(let o of i)for(let s of o.primitives){let u=s.material;Number.isFinite(u)&&t===u&&HTt(e,s,a)}}function GTt(e,t){var o;let r=(o=e.extensions)==null?void 0:o[d8],{texCoord:n=0}=e,{texCoord:a=n}=r;if(!(t.findIndex(([s,u])=>s===n&&u===a)!==-1)){let s=WTt(r);return n!==a&&(e.texCoord=a),t.push([n,a]),{originalTexCoord:n,texCoord:a,matrix:s}}return null}function HTt(e,t,r){var s,u;let{originalTexCoord:n,texCoord:a,matrix:i}=r,o=t.attributes[`TEXCOORD_${n}`];if(Number.isFinite(o)){let c=(s=e.json.accessors)==null?void 0:s[o];if(c&&c.bufferView!==void 0){let l=(u=e.json.bufferViews)==null?void 0:u[c.bufferView];if(l){let{arrayBuffer:f,byteOffset:p}=e.buffers[l.buffer],d=(p||0)+(c.byteOffset||0)+(l.byteOffset||0),{ArrayType:h,length:m}=og(c,l),g=VS[c.componentType],x=HS[c.type],y=l.byteStride||g*x,w=new Float32Array(m);for(let T=0;T<c.count;T++){let A=new h(f,d+T*y,2);p8.set(A[0],A[1],1),p8.transformByMatrix3(i),w.set([p8[0],p8[1]],T*x)}n===a?VTt(c,e,w,c.bufferView):$Tt(a,c,t,e,w)}}}}function VTt(e,t,r,n){e.componentType=5126,e.byteOffset=0;let o=(t.json.accessors||[]).reduce((c,l)=>l.bufferView===n?c+1:c,0)>1;t.buffers.push({arrayBuffer:za(r.buffer),byteOffset:0,byteLength:r.buffer.byteLength});let s=t.buffers.length-1;if(t.json.bufferViews=t.json.bufferViews||[],o){t.json.bufferViews.push({buffer:s,byteLength:r.buffer.byteLength,byteOffset:0}),e.bufferView=t.json.bufferViews.length-1;return}let u=t.json.bufferViews[n];u&&(u.buffer=s,u.byteOffset=0,u.byteLength=r.buffer.byteLength,u.byteStride!==void 0&&delete u.byteStride)}function $Tt(e,t,r,n,a){n.buffers.push({arrayBuffer:za(a.buffer),byteOffset:0,byteLength:a.buffer.byteLength}),n.json.bufferViews=n.json.bufferViews||[];let i=n.json.bufferViews;i.push({buffer:n.buffers.length-1,byteLength:a.buffer.byteLength,byteOffset:0});let o=n.json.accessors;o&&(o.push({bufferView:(i==null?void 0:i.length)-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),r.attributes[`TEXCOORD_${e}`]=o.length-1)}function WTt(e){let{offset:t=[0,0],rotation:r=0,scale:n=[1,1]}=e,a=new nr().set(1,0,0,0,1,0,t[0],t[1],1),i=MTt.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),o=qTt.set(n[0],0,0,0,n[1],0,0,0,1);return a.multiplyRight(i).multiplyRight(o)}var JM={};Fa(JM,{decode:()=>JTt,encode:()=>XTt,name:()=>KTt});var Fd="KHR_lights_punctual",KTt=Fd;async function JTt(e){let t=new Xt(e),{json:r}=t,n=t.getExtension(Fd);n&&(t.json.lights=n.lights,t.removeExtension(Fd));for(let a of r.nodes||[]){let i=t.getObjectExtension(a,Fd);i&&(a.light=i.light),t.removeObjectExtension(a,Fd)}}async function XTt(e){let t=new Xt(e),{json:r}=t;if(r.lights){let n=t.addExtension(Fd);Xn(!n.lights),n.lights=r.lights,delete r.lights}if(t.json.lights){for(let n of t.json.lights){let a=n.node;t.addObjectExtension(a,Fd,n)}delete t.json.lights}}var XM={};Fa(XM,{decode:()=>QTt,encode:()=>ZTt,name:()=>YTt});var O1="KHR_materials_unlit",YTt=O1;async function QTt(e){let t=new Xt(e),{json:r}=t;for(let n of r.materials||[])n.extensions&&n.extensions.KHR_materials_unlit&&(n.unlit=!0),t.removeObjectExtension(n,O1);t.removeExtension(O1)}function ZTt(e){let t=new Xt(e),{json:r}=t;if(t.materials)for(let n of r.materials||[])n.unlit&&(delete n.unlit,t.addObjectExtension(n,O1,{}),t.addExtension(O1))}var YM={};Fa(YM,{decode:()=>t6t,encode:()=>r6t,name:()=>e6t});var I1="KHR_techniques_webgl",e6t=I1;async function t6t(e){let t=new Xt(e),{json:r}=t,n=t.getExtension(I1);if(n){let a=n6t(n,t);for(let i of r.materials||[]){let o=t.getObjectExtension(i,I1);o&&(i.technique=Object.assign({},o,a[o.technique]),i.technique.values=a6t(i.technique,t)),t.removeObjectExtension(i,I1)}t.removeExtension(I1)}}async function r6t(e,t){}function n6t(e,t){let{programs:r=[],shaders:n=[],techniques:a=[]}=e,i=new TextDecoder;return n.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=i.decode(t.getTypedArrayForBufferView(o.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),r.forEach(o=>{o.fragmentShader=n[o.fragmentShader],o.vertexShader=n[o.vertexShader]}),a.forEach(o=>{o.program=r[o.program]}),a}function a6t(e,t){let r=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(n=>{e.uniforms[n].value&&!(n in r)&&(r[n]=e.uniforms[n].value)}),Object.keys(r).forEach(n=>{typeof r[n]=="object"&&r[n].index!==void 0&&(r[n].texture=t.getTexture(r[n].index))}),r}var f1e=[t8,ZS,GM,HM,VM,WM,JM,XM,YM,KM,BM],i6t=[t8,ZS];function p1e(e,t={},r){var a;let n=f1e.filter(i=>m1e(i.name,t));for(let i of n)(a=i.preprocess)==null||a.call(i,e,t,r)}async function d1e(e,t={},r){var a;let n=f1e.filter(i=>m1e(i.name,t));for(let i of n)await((a=i.decode)==null?void 0:a.call(i,e,t,r))}function h1e(e,t={}){var r;for(let n of i6t)e=((r=n.encode)==null?void 0:r.call(n,e,t))??e;return e}function m1e(e,t){var a;let r=((a=t==null?void 0:t.gltf)==null?void 0:a.excludeExtensions)||{};return!(e in r&&!r[e])}var QM="KHR_binary_glTF";function g1e(e){let t=new Xt(e),{json:r}=t;for(let n of r.images||[]){let a=t.getObjectExtension(n,QM);a&&Object.assign(n,a),t.removeObjectExtension(n,QM)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,t.removeExtension(QM)}var b1e={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},s6t={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},ZM=class{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;normalize(t,r){this.json=t.json;let n=t.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${n.asset.version}`);return}if(!r.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(n),this._convertTopLevelObjectsToArrays(n),g1e(t),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(let r in b1e)this._convertTopLevelObjectToArray(t,r)}_convertTopLevelObjectToArray(t,r){let n=t[r];if(!(!n||Array.isArray(n))){t[r]=[];for(let a in n){let i=n[a];i.id=i.id||a;let o=t[r].length;t[r].push(i),this.idToIndexMap[r][a]=o}}}_convertObjectIdsToArrayIndices(t){for(let r in b1e)this._convertIdsToIndices(t,r);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(let r of t.textures)this._convertTextureIds(r);for(let r of t.meshes)this._convertMeshIds(r);for(let r of t.nodes)this._convertNodeIds(r);for(let r of t.scenes)this._convertSceneIds(r)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(let r of t.primitives){let{attributes:n,indices:a,material:i}=r;for(let o in n)n[o]=this._convertIdToIndex(n[o],"accessor");a&&(r.indices=this._convertIdToIndex(a,"accessor")),i&&(r.material=this._convertIdToIndex(i,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map(r=>this._convertIdToIndex(r,"node"))),t.meshes&&(t.meshes=t.meshes.map(r=>this._convertIdToIndex(r,"mesh")))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map(r=>this._convertIdToIndex(r,"node")))}_convertIdsToIndices(t,r){t[r]||(console.warn(`gltf v1: json doesn't contain attribute ${r}`),t[r]=[]);for(let n of t[r])for(let a in n){let i=n[a],o=this._convertIdToIndex(i,a);n[a]=o}}_convertIdToIndex(t,r){let n=s6t[r];if(n in this.idToIndexMap){let a=this.idToIndexMap[n][t];if(!Number.isFinite(a))throw new Error(`gltf v1: failed to resolve ${r} with id ${t}`);return a}return t}_updateObjects(t){for(let r of this.json.buffers)delete r.type}_updateMaterial(t){var r,n,a;for(let i of t.materials){i.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let o=((r=i.values)==null?void 0:r.tex)||((n=i.values)==null?void 0:n.texture2d_0)||((a=i.values)==null?void 0:a.diffuseTex),s=t.textures.findIndex(u=>u.id===o);s!==-1&&(i.pbrMetallicRoughness.baseColorTexture={index:s})}}};function v1e(e,t={}){return new ZM().normalize(e,t)}async function x1e(e,t,r=0,n,a){var i,o,s;return u6t(e,t,r,n),v1e(e,{normalize:(i=n==null?void 0:n.gltf)==null?void 0:i.normalize}),p1e(e,n,a),(o=n==null?void 0:n.gltf)!=null&&o.loadBuffers&&e.json.buffers&&await c6t(e,n,a),(s=n==null?void 0:n.gltf)!=null&&s.loadImages&&await l6t(e,n,a),await d1e(e,n,a),e}function u6t(e,t,r,n){var o,s;if((o=n.core)!=null&&o.baseUrl&&(e.baseUri=(s=n.core)==null?void 0:s.baseUrl),t instanceof ArrayBuffer&&!o1e(t,r,n.glb)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=tF(t);else if(t instanceof ArrayBuffer){let u={};r=s1e(u,t,r,n.glb),Xn(u.type==="glTF",`Invalid GLB magic string ${u.type}`),e._glb=u,e.json=u.json}else Xn(!1,"GLTF: must be ArrayBuffer or string");let a=e.json.buffers||[];if(e.buffers=new Array(a.length).fill(null),e._glb&&e._glb.header.hasBinChunk){let{binChunks:u}=e._glb;e.buffers[0]={arrayBuffer:u[0].arrayBuffer,byteOffset:u[0].byteOffset,byteLength:u[0].byteLength}}let i=e.json.images||[];e.images=new Array(i.length).fill({})}async function c6t(e,t,r){var a,i;let n=e.json.buffers||[];for(let o=0;o<n.length;++o){let s=n[o];if(s.uri){let{fetch:u}=r;Xn(u);let c=UM(s.uri,t,r),l=await((a=r==null?void 0:r.fetch)==null?void 0:a.call(r,c)),f=await((i=l==null?void 0:l.arrayBuffer)==null?void 0:i.call(l));e.buffers[o]={arrayBuffer:f,byteOffset:0,byteLength:f.byteLength},delete s.uri}else e.buffers[o]===null&&(e.buffers[o]={arrayBuffer:new ArrayBuffer(s.byteLength),byteOffset:0,byteLength:s.byteLength})}}async function l6t(e,t,r){let n=f6t(e),a=e.json.images||[],i=[];for(let o of n)i.push(p6t(e,a[o],o,t,r));return await Promise.all(i)}function f6t(e){let t=new Set,r=e.json.textures||[];for(let n of r)n.source!==void 0&&t.add(n.source);return Array.from(t).sort()}async function p6t(e,t,r,n,a){let i;if(t.uri&&!t.hasOwnProperty("bufferView")){let c=UM(t.uri,n,a),{fetch:l}=a;i=await(await l(c)).arrayBuffer(),t.bufferView={data:i}}if(Number.isFinite(t.bufferView)){let c=lxe(e.json,e.buffers,t.bufferView);i=Rp(c.buffer,c.byteOffset,c.byteLength)}Xn(i,"glTF image has no data");let o=n,s={...o,core:{...o==null?void 0:o.core,mimeType:t.mimeType}},u=await Hi(i,[ig,Bd],s,a);u&&u[0]&&(u={compressed:!0,mipmaps:!1,width:u[0].width,height:u[0].height,data:u[0]}),e.images=e.images||[],e.images[r]=u}var Yc={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:r8,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:d6t,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0}}};async function d6t(e,t={},r){var o;let n={...Yc.options,...t};n.gltf={...Yc.options.gltf,...n.gltf};let a=((o=t==null?void 0:t.glb)==null?void 0:o.byteOffset)||0;return await x1e({},e,a,n,r)}var h6t=1179937895,m6t=1313821514,g6t=5130562,qu=!0;function y1e(e,t,r=0,n={}){let{magic:a=h6t,version:i=2,json:o={},binary:s}=e,u=r;t&&(t.setUint32(r+0,a,qu),t.setUint32(r+4,i,qu),t.setUint32(r+8,0,qu));let c=r+8;r+=12;let l=r;t&&(t.setUint32(r+0,0,qu),t.setUint32(r+4,m6t,qu)),r+=8;let f=JSON.stringify(o);if(r=f0(t,r,f,4),t){let p=r-l-8;t.setUint32(l+0,p,qu)}if(s){let p=r;if(t&&(t.setUint32(r+0,0,qu),t.setUint32(r+4,g6t,qu)),r+=8,r=vw(t,r,s,4),t){let d=r-p-8;t.setUint32(p+0,d,qu)}}if(t){let p=r-u;t.setUint32(c,p,qu)}return r}function e7(e,t,r,n){return b6t(e),y1e(e,t,r,n)}function b6t(e){if(e.buffers&&e.buffers.length>1)throw new Error("encodeGLTF: multiple buffers not yet implemented")}var t7={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:r8,extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,options:{gltf:{}},encode:async(e,t={})=>_1e(e,t),encodeSync:_1e};function _1e(e,t={}){let{byteOffset:r=0}=t,n=h1e(e),a=e7(n,null,r,t),i=new ArrayBuffer(a),o=new DataView(i);return e7(n,o,r,t),i}var v6t={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},x6t={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Lo={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},y6t={magFilter:Lo.TEXTURE_MAG_FILTER,minFilter:Lo.TEXTURE_MIN_FILTER,wrapS:Lo.TEXTURE_WRAP_S,wrapT:Lo.TEXTURE_WRAP_T},_6t={[Lo.TEXTURE_MAG_FILTER]:Lo.LINEAR,[Lo.TEXTURE_MIN_FILTER]:Lo.NEAREST_MIPMAP_LINEAR,[Lo.TEXTURE_WRAP_S]:Lo.REPEAT,[Lo.TEXTURE_WRAP_T]:Lo.REPEAT};function w6t(){return{id:"default-sampler",parameters:_6t}}function A6t(e){return x6t[e]}function E6t(e){return v6t[e]}var r7=class{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(t,r={}){let{json:n,buffers:a=[],images:i=[]}=t,{baseUri:o=""}=t;return Xn(n),this.baseUri=o,this.buffers=a,this.images=i,this.jsonUnprocessed=n,this.json=this._resolveTree(t.json,r),this.json}_resolveTree(t,r={}){let n={...t};return this.json=n,t.bufferViews&&(n.bufferViews=t.bufferViews.map((a,i)=>this._resolveBufferView(a,i))),t.images&&(n.images=t.images.map((a,i)=>this._resolveImage(a,i))),t.samplers&&(n.samplers=t.samplers.map((a,i)=>this._resolveSampler(a,i))),t.textures&&(n.textures=t.textures.map((a,i)=>this._resolveTexture(a,i))),t.accessors&&(n.accessors=t.accessors.map((a,i)=>this._resolveAccessor(a,i))),t.materials&&(n.materials=t.materials.map((a,i)=>this._resolveMaterial(a,i))),t.meshes&&(n.meshes=t.meshes.map((a,i)=>this._resolveMesh(a,i))),t.nodes&&(n.nodes=t.nodes.map((a,i)=>this._resolveNode(a,i)),n.nodes=n.nodes.map((a,i)=>this._resolveNodeChildren(a))),t.skins&&(n.skins=t.skins.map((a,i)=>this._resolveSkin(a,i))),t.scenes&&(n.scenes=t.scenes.map((a,i)=>this._resolveScene(a,i))),typeof this.json.scene=="number"&&n.scenes&&(n.scene=n.scenes[this.json.scene]),n}getScene(t){return this._get(this.json.scenes,t)}getNode(t){return this._get(this.json.nodes,t)}getSkin(t){return this._get(this.json.skins,t)}getMesh(t){return this._get(this.json.meshes,t)}getMaterial(t){return this._get(this.json.materials,t)}getAccessor(t){return this._get(this.json.accessors,t)}getCamera(t){return this._get(this.json.cameras,t)}getTexture(t){return this._get(this.json.textures,t)}getSampler(t){return this._get(this.json.samplers,t)}getImage(t){return this._get(this.json.images,t)}getBufferView(t){return this._get(this.json.bufferViews,t)}getBuffer(t){return this._get(this.json.buffers,t)}_get(t,r){if(typeof r=="object")return r;let n=t&&t[r];return n||console.warn(`glTF file error: Could not find ${t}[${r}]`),n}_resolveScene(t,r){return{...t,id:t.id||`scene-${r}`,nodes:(t.nodes||[]).map(n=>this.getNode(n))}}_resolveNode(t,r){let n={...t,id:(t==null?void 0:t.id)||`node-${r}`};return t.mesh!==void 0&&(n.mesh=this.getMesh(t.mesh)),t.camera!==void 0&&(n.camera=this.getCamera(t.camera)),t.skin!==void 0&&(n.skin=this.getSkin(t.skin)),t.meshes!==void 0&&t.meshes.length&&(n.mesh=t.meshes.reduce((a,i)=>{let o=this.getMesh(i);return a.id=o.id,a.primitives=a.primitives.concat(o.primitives),a},{primitives:[]})),n}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map(r=>this.getNode(r))),t}_resolveSkin(t,r){let n=typeof t.inverseBindMatrices=="number"?this.getAccessor(t.inverseBindMatrices):void 0;return{...t,id:t.id||`skin-${r}`,inverseBindMatrices:n}}_resolveMesh(t,r){let n={...t,id:t.id||`mesh-${r}`,primitives:[]};return t.primitives&&(n.primitives=t.primitives.map(a=>{let i={...a,attributes:{},indices:void 0,material:void 0},o=a.attributes;for(let s in o)i.attributes[s]=this.getAccessor(o[s]);return a.indices!==void 0&&(i.indices=this.getAccessor(a.indices)),a.material!==void 0&&(i.material=this.getMaterial(a.material)),i})),n}_resolveMaterial(t,r){let n={...t,id:t.id||`material-${r}`};if(n.normalTexture&&(n.normalTexture={...n.normalTexture},n.normalTexture.texture=this.getTexture(n.normalTexture.index)),n.occlusionTexture&&(n.occlusionTexture={...n.occlusionTexture},n.occlusionTexture.texture=this.getTexture(n.occlusionTexture.index)),n.emissiveTexture&&(n.emissiveTexture={...n.emissiveTexture},n.emissiveTexture.texture=this.getTexture(n.emissiveTexture.index)),n.emissiveFactor||(n.emissiveFactor=n.emissiveTexture?[1,1,1]:[0,0,0]),n.pbrMetallicRoughness){n.pbrMetallicRoughness={...n.pbrMetallicRoughness};let a=n.pbrMetallicRoughness;a.baseColorTexture&&(a.baseColorTexture={...a.baseColorTexture},a.baseColorTexture.texture=this.getTexture(a.baseColorTexture.index)),a.metallicRoughnessTexture&&(a.metallicRoughnessTexture={...a.metallicRoughnessTexture},a.metallicRoughnessTexture.texture=this.getTexture(a.metallicRoughnessTexture.index))}return n}_resolveAccessor(t,r){let n=A6t(t.componentType),a=E6t(t.type),i=n*a,o={...t,id:t.id||`accessor-${r}`,bytesPerComponent:n,components:a,bytesPerElement:i,value:void 0,bufferView:void 0,sparse:void 0};if(t.bufferView!==void 0&&(o.bufferView=this.getBufferView(t.bufferView)),o.bufferView){let s=o.bufferView.buffer,{ArrayType:u,byteLength:c}=og(o,o.bufferView),l=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+s.byteOffset,f=Hl(s.arrayBuffer,l,c);o.bufferView.byteStride&&(f=this._getValueFromInterleavedBuffer(s,l,o.bufferView.byteStride,o.bytesPerElement,o.count)),o.value=new u(f)}return o}_getValueFromInterleavedBuffer(t,r,n,a,i){let o=new Uint8Array(i*a);for(let s=0;s<i;s++){let u=r+s*n;o.set(new Uint8Array(t.arrayBuffer.slice(u,u+a)),s*a)}return o.buffer}_resolveTexture(t,r){return{...t,id:t.id||`texture-${r}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):w6t(),source:typeof t.source=="number"?this.getImage(t.source):void 0}}_resolveSampler(t,r){let n={id:t.id||`sampler-${r}`,...t,parameters:{}};for(let a in n){let i=this._enumSamplerParameter(a);i!==void 0&&(n.parameters[i]=n[a])}return n}_enumSamplerParameter(t){return y6t[t]}_resolveImage(t,r){let n={...t,id:t.id||`image-${r}`,image:null,bufferView:t.bufferView!==void 0?this.getBufferView(t.bufferView):void 0},a=this.images[r];return a&&(n.image=a),n}_resolveBufferView(t,r){let n=t.buffer,a=this.buffers[n].arrayBuffer,i=this.buffers[n].byteOffset||0;return t.byteOffset&&(i+=t.byteOffset),{id:`bufferView-${r}`,...t,buffer:this.buffers[n],data:new Uint8Array(a,i,t.byteLength)}}_resolveCamera(t,r){let n={...t,id:t.id||`camera-${r}`};return n.perspective,n.orthographic,n}};function P1(e,t){return new r7().postProcess(e,t)}var h8={URI:0,EMBEDDED:1};function m8(e,t,r,n){e.rotateYtoZ=!0;let a=(e.byteOffset||0)+(e.byteLength||0)-r;if(a===0)throw new Error("glTF byte length must be greater than 0.");return e.gltfUpAxis=n!=null&&n["3d-tiles"]&&n["3d-tiles"].assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",e.gltfArrayBuffer=Rp(t,r,a),e.gltfByteOffset=0,e.gltfByteLength=a,r%4===0||console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`),(e.byteOffset||0)+(e.byteLength||0)}async function g8(e,t,r,n){let a=(r==null?void 0:r["3d-tiles"])||{};if(T6t(e,t,r),a.loadGLTF){if(!n)return;if(e.gltfUrl){let{fetch:i}=n,o=await i(e.gltfUrl,r==null?void 0:r.core);e.gltfArrayBuffer=await o.arrayBuffer(),e.gltfByteOffset=0}if(e.gltfArrayBuffer){let i=await Hi(e.gltfArrayBuffer,Yc,r,n);e.gltf=P1(i),e.gpuMemoryUsageInBytes=C1(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function T6t(e,t,r){switch(t){case h8.URI:if(e.gltfArrayBuffer){let n=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),i=new TextDecoder().decode(n);e.gltfUrl=i.replace(/[\s\0]+$/,"")}delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case h8.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function w1e(e,t,r,n,a){var o;r=S6t(e,t,r,n,a),await g8(e,h8.EMBEDDED,n,a);let i=(o=e==null?void 0:e.gltf)==null?void 0:o.extensions;return i&&i.CESIUM_RTC&&(e.rtcCenter=i.CESIUM_RTC.center),r}function S6t(e,t,r,n,a){r=jf(e,t,r),r=rg(e,t,r),r=ng(e,t,r,n),r=m8(e,t,r,n);let i=new Jc(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=i.getGlobalProperty("RTC_CENTER",ht.FLOAT,3),r}async function A1e(e,t,r,n,a){return r=k6t(e,t,r,n,a),await g8(e,e.gltfFormat||0,n,a),r}function k6t(e,t,r,n,a){var c;if(r=jf(e,t,r),e.version!==1)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);r=rg(e,t,r);let i=new DataView(t);if(e.gltfFormat=i.getUint32(r,!0),r+=4,r=ng(e,t,r,n),r=m8(e,t,r,n),!((c=e==null?void 0:e.header)!=null&&c.featureTableJsonByteLength)||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let o=new Jc(e.featureTableJson,e.featureTableBinary),s=o.getGlobalProperty("INSTANCES_LENGTH");if(o.featuresLength=s,!Number.isFinite(s))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=o.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=o.getGlobalProperty("RTC_CENTER",ht.FLOAT,3);let u=new kd(e.batchTableJson,e.batchTableBinary,s);return C6t(e,o,u,s),r}function C6t(e,t,r,n){let a=new Array(n),i=new Z,o=new Z,s=new Z,u=new Z,c=new nr,l=new Io,f=new Z,p={},d=new mr,h=[],m=[],g=[],x=[];for(let y=0;y<n;y++){let w;if(t.hasProperty("POSITION"))w=t.getProperty("POSITION",ht.FLOAT,3,y,i);else if(t.hasProperty("POSITION_QUANTIZED")){w=t.getProperty("POSITION_QUANTIZED",ht.UNSIGNED_SHORT,3,y,i);let k=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",ht.FLOAT,3);if(!k)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let F=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",ht.FLOAT,3);if(!F)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let R=65535;for(let G=0;G<3;G++)w[G]=w[G]/R*F[G]+k[G]}if(!w)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");i.copy(w),p.translation=i,e.normalUp=t.getProperty("NORMAL_UP",ht.FLOAT,3,y,h),e.normalRight=t.getProperty("NORMAL_RIGHT",ht.FLOAT,3,y,m);let T=!1;if(e.normalUp){if(!e.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");e.hasCustomOrientation=!0}else{if(e.octNormalUp=t.getProperty("NORMAL_UP_OCT32P",ht.UNSIGNED_SHORT,2,y,h),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",ht.UNSIGNED_SHORT,2,y,m),e.octNormalUp)throw e.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");e.eastNorthUp?(Ft.WGS84.eastNorthUpToFixedFrame(i,d),d.getRotationMatrix3(c)):c.identity()}T&&(u.copy(o).cross(s).normalize(),c.setColumn(0,o),c.setColumn(1,s),c.setColumn(2,u)),l.fromMatrix3(c),p.rotation=l,f.set(1,1,1);let A=t.getProperty("SCALE",ht.FLOAT,1,y,g);Number.isFinite(A)&&f.multiplyByScalar(A);let B=t.getProperty("SCALE_NON_UNIFORM",ht.FLOAT,3,y,h);B&&f.scale(B),p.scale=f;let I=t.getProperty("BATCH_ID",ht.UNSIGNED_SHORT,1,y,x);I===void 0&&(I=y);let L=new mr().fromQuaternion(p.rotation);d.identity(),d.translate(p.translation),d.multiplyRight(L),d.scale(p.scale);let C=d.clone();a[y]={modelMatrix:C,batchId:I}}e.instances=a}async function E1e(e,t,r,n,a,i){r=jf(e,t,r);let o=new DataView(t);for(e.tilesLength=o.getUint32(r,!0),r+=4,e.tiles=[];e.tiles.length<e.tilesLength&&(e.byteLength||0)-r>12;){let s={shape:"tile3d"};e.tiles.push(s),r=await i(t,r,n,a,s)}return r}async function T1e(e,t,r,n){var a,i;if(e.rotateYtoZ=!0,e.gltfUpAxis=(a=r==null?void 0:r["3d-tiles"])!=null&&a.assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",(i=r==null?void 0:r["3d-tiles"])!=null&&i.loadGLTF){if(!n)return t.byteLength;let o=await Hi(t,Yc,r,n);e.gltf=P1(o),e.gpuMemoryUsageInBytes=C1(e.gltf)}else e.gltfArrayBuffer=t;return t.byteLength}async function n7(e,t=0,r,n,a={shape:"tile3d"}){switch(a.byteOffset=t,a.type=Dve(e,t),a.type){case pa.COMPOSITE:return await E1e(a,e,t,r,n,n7);case pa.BATCHED_3D_MODEL:return await w1e(a,e,t,r,n);case pa.GLTF:return await T1e(a,e,r,n);case pa.INSTANCED_3D_MODEL:return await A1e(a,e,t,r,n);case pa.POINT_CLOUD:return await Kve(a,e,t,r,n);default:throw new Error(`3DTileLoader: unknown type ${a.type}`)}}async function a7(e,t,r){if(new Uint32Array(e.slice(0,4))[0]!==1952609651)throw new Error("Wrong subtree file magic number");if(new Uint32Array(e.slice(4,8))[0]!==1)throw new Error("Wrong subtree file verson, must be 1");let i=S1e(e.slice(8,16)),o=new Uint8Array(e,24,i),u=new TextDecoder("utf8").decode(o),c=JSON.parse(u),l=S1e(e.slice(16,24)),f=new ArrayBuffer(0);if(l&&(f=e.slice(24+i)),await b8(c,c.tileAvailability,f,r),Array.isArray(c.contentAvailability))for(let p of c.contentAvailability)await b8(c,p,f,r);else await b8(c,c.contentAvailability,f,r);return await b8(c,c.childSubtreeAvailability,f,r),c}async function b8(e,t,r,n){let a=Number.isFinite(t.bitstream)?t.bitstream:t.bufferView;if(typeof a!="number")return;let i=e.bufferViews[a],o=e.buffers[i.buffer];if(!(n!=null&&n.baseUrl))throw new Error("Url is not provided");if(!n.fetch)throw new Error("fetch is not provided");if(o.uri){let u=`${(n==null?void 0:n.baseUrl)||""}/${o.uri}`,l=await(await n.fetch(u)).arrayBuffer();t.explicitBitstream=new Uint8Array(l,i.byteOffset,i.byteLength);return}let s=e.buffers.slice(0,i.buffer).reduce((u,c)=>u+c.byteLength,0);t.explicitBitstream=new Uint8Array(r.slice(s,s+o.byteLength),i.byteOffset,i.byteLength)}function S1e(e){let t=new DataView(e),r=t.getUint32(0,!0),n=t.getUint32(4,!0);return r+2**32*n}var v8={dataType:null,batchType:null,id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Zm,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:a7,options:{}};var Mo=null;try{Mo=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Tr(e,t,r){this.low=e|0,this.high=t|0,this.unsigned=!!r}Tr.prototype.__isLong__;Object.defineProperty(Tr.prototype,"__isLong__",{value:!0});function Wa(e){return(e&&e.__isLong__)===!0}function k1e(e){var t=Math.clz32(e&-e);return e?31-t:t}Tr.isLong=Wa;var C1e={},D1e={};function Od(e,t){var r,n,a;return t?(e>>>=0,(a=0<=e&&e<256)&&(n=D1e[e],n)?n:(r=cr(e,0,!0),a&&(D1e[e]=r),r)):(e|=0,(a=-128<=e&&e<128)&&(n=C1e[e],n)?n:(r=cr(e,e<0?-1:0,!1),a&&(C1e[e]=r),r))}Tr.fromInt=Od;function qo(e,t){if(isNaN(e))return t?Qc:Ss;if(t){if(e<0)return Qc;if(e>=I1e)return j1e}else{if(e<=-F1e)return Bi;if(e+1>=F1e)return R1e}return e<0?qo(-e,t).neg():cr(e%vg|0,e/vg|0,t)}Tr.fromNumber=qo;function cr(e,t,r){return new Tr(e,t,r)}Tr.fromBits=cr;var x8=Math.pow;function o7(e,t,r){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(r=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?Qc:Ss;if(r=r||10,r<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(n===0)return o7(e.substring(1),t,r).neg();for(var a=qo(x8(r,8)),i=Ss,o=0;o<e.length;o+=8){var s=Math.min(8,e.length-o),u=parseInt(e.substring(o,o+s),r);if(s<8){var c=qo(x8(r,s));i=i.mul(c).add(qo(u))}else i=i.mul(a),i=i.add(qo(u))}return i.unsigned=t,i}Tr.fromString=o7;function No(e,t){return typeof e=="number"?qo(e,t):typeof e=="string"?o7(e,t):cr(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}Tr.fromValue=No;var B1e=1<<16,D6t=1<<24,vg=B1e*B1e,I1e=vg*vg,F1e=I1e/2,O1e=Od(D6t),Ss=Od(0);Tr.ZERO=Ss;var Qc=Od(0,!0);Tr.UZERO=Qc;var bg=Od(1);Tr.ONE=bg;var P1e=Od(1,!0);Tr.UONE=P1e;var i7=Od(-1);Tr.NEG_ONE=i7;var R1e=cr(-1,2147483647,!1);Tr.MAX_VALUE=R1e;var j1e=cr(-1,-1,!0);Tr.MAX_UNSIGNED_VALUE=j1e;var Bi=cr(0,-2147483648,!1);Tr.MIN_VALUE=Bi;var Se=Tr.prototype;Se.toInt=function(){return this.unsigned?this.low>>>0:this.low};Se.toNumber=function(){return this.unsigned?(this.high>>>0)*vg+(this.low>>>0):this.high*vg+(this.low>>>0)};Se.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Bi)){var r=qo(t),n=this.div(r),a=n.mul(r).sub(this);return n.toString(t)+a.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var i=qo(x8(t,6),this.unsigned),o=this,s="";;){var u=o.div(i),c=o.sub(u.mul(i)).toInt()>>>0,l=c.toString(t);if(o=u,o.isZero())return l+s;for(;l.length<6;)l="0"+l;s=""+l+s}};Se.getHighBits=function(){return this.high};Se.getHighBitsUnsigned=function(){return this.high>>>0};Se.getLowBits=function(){return this.low};Se.getLowBitsUnsigned=function(){return this.low>>>0};Se.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Bi)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,r=31;r>0&&!(t&1<<r);r--);return this.high!=0?r+33:r+1};Se.isSafeInteger=function(){var t=this.high>>21;return t?this.unsigned?!1:t===-1&&!(this.low===0&&this.high===-2097152):!0};Se.isZero=function(){return this.high===0&&this.low===0};Se.eqz=Se.isZero;Se.isNegative=function(){return!this.unsigned&&this.high<0};Se.isPositive=function(){return this.unsigned||this.high>=0};Se.isOdd=function(){return(this.low&1)===1};Se.isEven=function(){return(this.low&1)===0};Se.equals=function(t){return Wa(t)||(t=No(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};Se.eq=Se.equals;Se.notEquals=function(t){return!this.eq(t)};Se.neq=Se.notEquals;Se.ne=Se.notEquals;Se.lessThan=function(t){return this.comp(t)<0};Se.lt=Se.lessThan;Se.lessThanOrEqual=function(t){return this.comp(t)<=0};Se.lte=Se.lessThanOrEqual;Se.le=Se.lessThanOrEqual;Se.greaterThan=function(t){return this.comp(t)>0};Se.gt=Se.greaterThan;Se.greaterThanOrEqual=function(t){return this.comp(t)>=0};Se.gte=Se.greaterThanOrEqual;Se.ge=Se.greaterThanOrEqual;Se.compare=function(t){if(Wa(t)||(t=No(t)),this.eq(t))return 0;var r=this.isNegative(),n=t.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};Se.comp=Se.compare;Se.negate=function(){return!this.unsigned&&this.eq(Bi)?Bi:this.not().add(bg)};Se.neg=Se.negate;Se.add=function(t){Wa(t)||(t=No(t));var r=this.high>>>16,n=this.high&65535,a=this.low>>>16,i=this.low&65535,o=t.high>>>16,s=t.high&65535,u=t.low>>>16,c=t.low&65535,l=0,f=0,p=0,d=0;return d+=i+c,p+=d>>>16,d&=65535,p+=a+u,f+=p>>>16,p&=65535,f+=n+s,l+=f>>>16,f&=65535,l+=r+o,l&=65535,cr(p<<16|d,l<<16|f,this.unsigned)};Se.subtract=function(t){return Wa(t)||(t=No(t)),this.add(t.neg())};Se.sub=Se.subtract;Se.multiply=function(t){if(this.isZero())return this;if(Wa(t)||(t=No(t)),Mo){var r=Mo.mul(this.low,this.high,t.low,t.high);return cr(r,Mo.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?Qc:Ss;if(this.eq(Bi))return t.isOdd()?Bi:Ss;if(t.eq(Bi))return this.isOdd()?Bi:Ss;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(O1e)&&t.lt(O1e))return qo(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,a=this.high&65535,i=this.low>>>16,o=this.low&65535,s=t.high>>>16,u=t.high&65535,c=t.low>>>16,l=t.low&65535,f=0,p=0,d=0,h=0;return h+=o*l,d+=h>>>16,h&=65535,d+=i*l,p+=d>>>16,d&=65535,d+=o*c,p+=d>>>16,d&=65535,p+=a*l,f+=p>>>16,p&=65535,p+=i*c,f+=p>>>16,p&=65535,p+=o*u,f+=p>>>16,p&=65535,f+=n*l+a*c+i*u+o*s,f&=65535,cr(d<<16|h,f<<16|p,this.unsigned)};Se.mul=Se.multiply;Se.divide=function(t){if(Wa(t)||(t=No(t)),t.isZero())throw Error("division by zero");if(Mo){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?Mo.div_u:Mo.div_s)(this.low,this.high,t.low,t.high);return cr(r,Mo.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Qc:Ss;var n,a,i;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return Qc;if(t.gt(this.shru(1)))return P1e;i=Qc}else{if(this.eq(Bi)){if(t.eq(bg)||t.eq(i7))return Bi;if(t.eq(Bi))return bg;var o=this.shr(1);return n=o.div(t).shl(1),n.eq(Ss)?t.isNegative()?bg:i7:(a=this.sub(t.mul(n)),i=n.add(a.div(t)),i)}else if(t.eq(Bi))return this.unsigned?Qc:Ss;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();i=Ss}for(a=this;a.gte(t);){n=Math.max(1,Math.floor(a.toNumber()/t.toNumber()));for(var s=Math.ceil(Math.log(n)/Math.LN2),u=s<=48?1:x8(2,s-48),c=qo(n),l=c.mul(t);l.isNegative()||l.gt(a);)n-=u,c=qo(n,this.unsigned),l=c.mul(t);c.isZero()&&(c=bg),i=i.add(c),a=a.sub(l)}return i};Se.div=Se.divide;Se.modulo=function(t){if(Wa(t)||(t=No(t)),Mo){var r=(this.unsigned?Mo.rem_u:Mo.rem_s)(this.low,this.high,t.low,t.high);return cr(r,Mo.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};Se.mod=Se.modulo;Se.rem=Se.modulo;Se.not=function(){return cr(~this.low,~this.high,this.unsigned)};Se.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};Se.clz=Se.countLeadingZeros;Se.countTrailingZeros=function(){return this.low?k1e(this.low):k1e(this.high)+32};Se.ctz=Se.countTrailingZeros;Se.and=function(t){return Wa(t)||(t=No(t)),cr(this.low&t.low,this.high&t.high,this.unsigned)};Se.or=function(t){return Wa(t)||(t=No(t)),cr(this.low|t.low,this.high|t.high,this.unsigned)};Se.xor=function(t){return Wa(t)||(t=No(t)),cr(this.low^t.low,this.high^t.high,this.unsigned)};Se.shiftLeft=function(t){return Wa(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?cr(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):cr(0,this.low<<t-32,this.unsigned)};Se.shl=Se.shiftLeft;Se.shiftRight=function(t){return Wa(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?cr(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):cr(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};Se.shr=Se.shiftRight;Se.shiftRightUnsigned=function(t){return Wa(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?cr(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?cr(this.high,0,this.unsigned):cr(this.high>>>t-32,0,this.unsigned)};Se.shru=Se.shiftRightUnsigned;Se.shr_u=Se.shiftRightUnsigned;Se.rotateLeft=function(t){var r;return Wa(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?cr(this.high,this.low,this.unsigned):t<32?(r=32-t,cr(this.low<<t|this.high>>>r,this.high<<t|this.low>>>r,this.unsigned)):(t-=32,r=32-t,cr(this.high<<t|this.low>>>r,this.low<<t|this.high>>>r,this.unsigned))};Se.rotl=Se.rotateLeft;Se.rotateRight=function(t){var r;return Wa(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?cr(this.high,this.low,this.unsigned):t<32?(r=32-t,cr(this.high<<r|this.low>>>t,this.low<<r|this.high>>>t,this.unsigned)):(t-=32,r=32-t,cr(this.low<<r|this.high>>>t,this.high<<r|this.low>>>t,this.unsigned))};Se.rotr=Se.rotateRight;Se.toSigned=function(){return this.unsigned?cr(this.low,this.high,!1):this};Se.toUnsigned=function(){return this.unsigned?this:cr(this.low,this.high,!0)};Se.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};Se.toBytesLE=function(){var t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};Se.toBytesBE=function(){var t=this.high,r=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,r>>>24,r>>>16&255,r>>>8&255,r&255]};Tr.fromBytes=function(t,r,n){return n?Tr.fromBytesLE(t,r):Tr.fromBytesBE(t,r)};Tr.fromBytesLE=function(t,r){return new Tr(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)};Tr.fromBytesBE=function(t,r){return new Tr(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)};typeof BigInt=="function"&&(Tr.fromBigInt=function(t,r){var n=Number(BigInt.asIntN(32,t)),a=Number(BigInt.asIntN(32,t>>BigInt(32)));return cr(n,a,r)},Tr.fromValue=function(t,r){return typeof t=="bigint"?Tr.fromBigInt(t,r):No(t,r)},Se.toBigInt=function(){var t=BigInt(this.low>>>0),r=BigInt(this.unsigned?this.high>>>0:this.high);return r<<BigInt(32)|t});var xg=Tr;var B6t=16;function R1(e){e==="X"&&(e="");let t=e.padEnd(B6t,"0");return xg.fromString(t,!0,16)}function s7(e){if(e.isZero())return"X";let t=e.countTrailingZeros(),r=t%4;t=(t-r)/4;let n=t;t*=4;let i=e.shiftRightUnsigned(t).toString(16).replace(/0+$/,"");return Array(17-n-i.length).join("0")+i}function u7(e,t){let r=F6t(e).shiftRightUnsigned(2);return e.add(xg.fromNumber(2*t+1-4).multiply(r))}function F6t(e){return e.and(e.not().add(1))}var O6t=3,I6t=30,P6t=2*I6t+1,L1e=180/Math.PI;function q1e(e){if(e.length===0)throw new Error(`Invalid Hilbert quad key ${e}`);let t=e.split("/"),r=parseInt(t[0],10),n=t[1],a=n.length,i=0,o=[0,0];for(let s=a-1;s>=0;s--){i=a-s;let u=n[s],c=0,l=0;u==="1"?l=1:u==="2"?(c=1,l=1):u==="3"&&(c=1);let f=Math.pow(2,i-1);R6t(f,o,c,l),o[0]+=f*c,o[1]+=f*l}if(r%2===1){let s=o[0];o[0]=o[1],o[1]=s}return{face:r,ij:o,level:i}}function N1e(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<O6t+P6t;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),a=t.substring(3,r),i=a.length/2,o=xg.fromString(n,!0,2).toString(10),s="";if(i!==0)for(s=xg.fromString(a,!0,2).toString(4);s.length<i;)s="0"+s;return`${o}/${s}`}function c7(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function M1e(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function l7(e){return[M1e(e[0]),M1e(e[1])]}function f7(e,[t,r]){switch(e){case 0:return[1,t,r];case 1:return[-t,1,r];case 2:return[-t,-r,1];case 3:return[-1,-r,-t];case 4:return[r,-1,-t];case 5:return[r,t,-1];default:throw new Error("Invalid face")}}function p7([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*L1e,n*L1e]}function R6t(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let a=t[0];t[0]=t[1],t[1]=a}}function U1e(e){let t=c7(e.ij,e.level,[.5,.5]),r=l7(t),n=f7(e.face,r);return p7(n)}var j6t=100;function d7(e){let{face:t,ij:r,level:n}=e,a=[[0,0],[0,1],[1,1],[1,0],[0,0]],i=Math.max(1,Math.ceil(j6t*Math.pow(2,-n))),o=new Float64Array(4*i*2+2),s=0,u=0;for(let c=0;c<4;c++){let l=a[c].slice(0),f=a[c+1],p=(f[0]-l[0])/i,d=(f[1]-l[1])/i;for(let h=0;h<i;h++){l[0]+=p,l[1]+=d;let m=c7(r,n,l),g=l7(m),x=f7(t,g),y=p7(x);Math.abs(y[1])>89.999&&(y[0]=u);let w=y[0]-u;y[0]+=w>180?-360:w<-180?360:0,o[s++]=y[0],o[s++]=y[1],u=y[0]}}return o[s++]=o[0],o[s++]=o[1],o}function yg(e){let t=L6t(e);return q1e(t)}function L6t(e){if(e.indexOf("/")>0)return e;let t=R1(e);return N1e(t)}function h7(e){let t=yg(e);return U1e(t)}function G1e(e){let t;if(e.face===2||e.face===5){let r=null,n=0;for(let a=0;a<4;a++){let i=`${e.face}/${a}`,o=yg(i),s=d7(o);(typeof r>"u"||r===null)&&(r=new Float64Array(4*s.length)),r.set(s,n),n+=s.length}t=z1e(r)}else{let r=d7(e);t=z1e(r)}return t}function z1e(e){if(e.length%2!==0)throw new Error("Invalid corners");let t=[],r=[];for(let n=0;n<e.length;n+=2)t.push(e[n]),r.push(e[n+1]);return t.sort((n,a)=>n-a),r.sort((n,a)=>n-a),{west:t[0],east:t[t.length-1],north:r[r.length-1],south:r[0]}}function m7(e,t){let r=(t==null?void 0:t.minimumHeight)||0,n=(t==null?void 0:t.maximumHeight)||0,a=yg(e),i=G1e(a),o=i.west,s=i.south,u=i.east,c=i.north,l=[];return l.push(new Z(o,c,r)),l.push(new Z(u,c,r)),l.push(new Z(u,s,r)),l.push(new Z(o,s,r)),l.push(new Z(o,c,n)),l.push(new Z(u,c,n)),l.push(new Z(u,s,n)),l.push(new Z(o,s,n)),l}function y8(e){let t=e.token,r={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},n=m7(t,r),a=h7(t),i=a[0],o=a[1],s=Ft.WGS84.cartographicToCartesian([i,o,r.maximumHeight]),u=new Z(s[0],s[1],s[2]);n.push(u);let c=A1(n);return[...c.center,...c.halfAxes]}var M6t=4,q6t=8,N6t={QUADTREE:M6t,OCTREE:q6t};function U6t(e,t,r){if(e!=null&&e.box){let n=R1(e.s2VolumeInfo.token),a=u7(n,t),i=s7(a),o={...e.s2VolumeInfo};switch(o.token=i,r){case"OCTREE":let c=e.s2VolumeInfo,l=c.maximumHeight-c.minimumHeight,f=l/2,p=c.minimumHeight+l/2;c.minimumHeight=p-f,c.maximumHeight=p+f;break;default:break}return{box:y8(o),s2VolumeInfo:o}}}async function b7(e){let{subtree:t,subtreeData:r={level:0,x:0,y:0,z:0},parentData:n={mortonIndex:0,localLevel:-1,localX:0,localY:0,localZ:0},childIndex:a=0,implicitOptions:i,loaderOptions:o,s2VolumeBox:s}=e,{subdivisionScheme:u,subtreeLevels:c,maximumLevel:l,contentUrlTemplate:f,subtreesUriTemplate:p,basePath:d}=i,h={children:[],lodMetricValue:0,contentUrl:""};if(!l)return MB.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${f} won't be loaded...`),h;let m=n.localLevel+1,g=r.level+m;if(g>l)return h;let x=N6t[u],y=Math.log2(x),w=a&1,T=a>>1&1,A=a>>2&1,B=Id(n.localX,w,1),I=Id(n.localY,T,1),L=Id(n.localZ,A,1),C=Id(r.x,B,m),k=Id(r.y,I,m),F=Id(r.z,L,m),R=Id(n.mortonIndex,a,y),G=m===c&&g7(t.childSubtreeAvailability,R),z,W,Y,ue;if(G){let fe=`${d}/${p}`,me=_8(fe,g,C,k,F);z=await Wr(me,v8,o),ue=0,W={level:g,x:C,y:k,z:F},Y={mortonIndex:0,localLevel:0,localX:0,localY:0,localZ:0}}else z=t,ue=(x**m-1)/(x-1)+R,W=r,Y={mortonIndex:R,localLevel:m,localX:B,localY:I,localZ:L};if(!g7(z.tileAvailability,ue))return h;g7(z.contentAvailability,ue)&&(h.contentUrl=_8(f,g,C,k,F));for(let fe=0;fe<x;fe++){let me=U6t(s,fe,u),ye=await b7({subtree:z,subtreeData:W,parentData:Y,childIndex:fe,implicitOptions:i,loaderOptions:o,s2VolumeBox:me});(ye.contentUrl||ye.children.length)&&h.children.push(ye)}return h.contentUrl||h.children.length?z6t(h,{level:g,x:C,y:k,z:F},i,s):h}function g7(e,t){let r;return Array.isArray(e)?(r=e[0],e.length>1&&MB.once('Not supported extension "3DTILES_multiple_contents" has been detected')):r=e,"constant"in r?Boolean(r.constant):r.explicitBitstream?V6t(t,r.explicitBitstream):!1}function z6t(e,t,r,n){let{basePath:a,refine:i,getRefine:o,lodMetricType:s,getTileType:u,rootLodMetricValue:c,rootBoundingVolume:l}=r,f=e.contentUrl&&e.contentUrl.replace(`${a}/`,""),p=c/2**t.level,d=n!=null&&n.box?{box:n.box}:l,h=G6t(d,t,r.subdivisionScheme);return{children:e.children,contentUrl:e.contentUrl,content:{uri:f},id:e.contentUrl,refine:o(i),type:u(e),lodMetricType:s,lodMetricValue:p,geometricError:p,transform:e.transform,boundingVolume:h}}function G6t(e,t,r){if(e.region){let{level:n,x:a,y:i,z:o}=t,[s,u,c,l,f,p]=e.region,d=2**n,h=(c-s)/d,[m,g]=[s+h*a,s+h*(a+1)],x=(l-u)/d,[y,w]=[u+x*i,u+x*(i+1)],T,A;if(r==="OCTREE"){let B=(p-f)/d;[T,A]=[f+B*o,f+B*(o+1)]}else[T,A]=[f,p];return{region:[m,y,g,w,T,A]}}if(e.box)return e;throw new Error(`Unsupported bounding volume type ${JSON.stringify(e)}`)}function Id(e,t,r){return(e<<r)+t}function _8(e,t,r,n,a){let i=H6t({level:t,x:r,y:n,z:a});return e.replace(/{level}|{x}|{y}|{z}/gi,o=>i[o])}function H6t(e){let t={};for(let r in e)t[`{${r}}`]=e[r];return t}function V6t(e,t){let r=Math.floor(e/8),n=e%8;return(t[r]>>n&1)===1}function x7(e,t=""){if(!t)return"empty";let n=t.split("?")[0].split(".").pop();switch(n){case"pnts":return"pointcloud";case"i3dm":case"b3dm":case"glb":case"gltf":return"scenegraph";default:return n||"empty"}}function y7(e){switch(e){case"REPLACE":case"replace":return 2;case"ADD":case"add":return 1;default:return e}}function v7(e,t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){let n=new URL(e,`${t}/`);return decodeURI(n.toString())}else if(e.startsWith("/"))return e;return Ga.resolve(t,e)}function H1e(e,t){var a;if(!e)return null;let r;if(e.content){let i=e.content.uri||((a=e.content)==null?void 0:a.url);typeof i<"u"&&(r=v7(i,t))}return{...e,id:r,contentUrl:r,lodMetricType:"geometricError",lodMetricValue:e.geometricError,transformMatrix:e.transform,type:x7(e,r),refine:y7(e.refine)}}async function W1e(e,t,r){let n=null,a=$1e(e.root);a&&e.root?n=await V1e(e.root,e,t,a,r):n=H1e(e.root,t);let i=[];for(i.push(n);i.length>0;){let o=i.pop()||{},s=o.children||[],u=[];for(let c of s){let l=$1e(c),f;l?f=await V1e(c,e,t,l,r):f=H1e(c,t),f&&(u.push(f),i.push(f))}o.children=u}return n}async function V1e(e,t,r,n,a){var T,A,B;let{subdivisionScheme:i,maximumLevel:o,availableLevels:s,subtreeLevels:u,subtrees:{uri:c}}=n,l=_8(c,0,0,0,0),f=v7(l,r),p=await Wr(f,v8,a),d=(T=e.content)==null?void 0:T.uri,h=d?v7(d,r):"",m=(A=t==null?void 0:t.root)==null?void 0:A.refine,g=e.geometricError,x=(B=e.boundingVolume.extensions)==null?void 0:B["3DTILES_bounding_volume_S2"];if(x){let L={box:y8(x),s2VolumeInfo:x};e.boundingVolume=L}let y=e.boundingVolume,w={contentUrlTemplate:h,subtreesUriTemplate:c,subdivisionScheme:i,subtreeLevels:u,maximumLevel:Number.isFinite(s)?s-1:o,refine:m,basePath:r,lodMetricType:"geometricError",rootLodMetricValue:g,rootBoundingVolume:y,getTileType:x7,getRefine:y7};return await $6t(e,r,p,w,a)}async function $6t(e,t,r,n,a){if(!e)return null;let{children:i,contentUrl:o}=await b7({subtree:r,implicitOptions:n,loaderOptions:a}),s,u=null;return o&&(s=o,u={uri:o.replace(`${t}/`,"")}),{...e,id:s,contentUrl:s,lodMetricType:"geometricError",lodMetricValue:e.geometricError,transformMatrix:e.transform,type:x7(e,s),refine:y7(e.refine),content:u||e.content,children:i}}function $1e(e){var t;return((t=e==null?void 0:e.extensions)==null?void 0:t["3DTILES_implicit_tiling"])||(e==null?void 0:e.implicitTiling)}var Nu={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Zm,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:W6t,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function W6t(e,t={},r){let n=t["3d-tiles"]||{},a;return n.isTileset==="auto"?a=(r==null?void 0:r.url)&&r.url.indexOf(".json")!==-1:a=n.isTileset,a?K6t(e,t,r):J6t(e,t,r)}async function K6t(e,t,r){var u;let n=JSON.parse(new TextDecoder().decode(e)),a=(r==null?void 0:r.url)||"",i=X6t(a),o=await W1e(n,i,t||{});return{...n,shape:"tileset3d",loader:Nu,url:a,queryString:(r==null?void 0:r.queryString)||"",basePath:i,root:o||n.root,type:"TILES3D",lodMetricType:"geometricError",lodMetricValue:((u=n.root)==null?void 0:u.geometricError)||0}}async function J6t(e,t,r){let n={content:{shape:"tile3d",featureIds:null}};return await n7(e,0,t,r,n.content),n.content}function X6t(e){return Ga.dirname(e)}var K1e="https://api.cesium.com/v1/assets";async function J1e(e,t){var i;if(!t){let o=await Y6t(e);for(let s of o.items)s.type==="3DTILES"&&(t=s.id)}let r=await Q6t(e,t),n=r.type,a=((i=r.options)==null?void 0:i.url)||r.url;return yt(n==="3DTILES"&&a),r.headers={Authorization:`Bearer ${r.accessToken||e}`},r}async function Y6t(e){yt(e);let t=K1e,r={Authorization:`Bearer ${e}`},n=await si(t,{headers:r});if(!n.ok)throw new Error(n.statusText);return await n.json()}async function Q6t(e,t){yt(e,t);let r={Authorization:`Bearer ${e}`},n=`${K1e}/${t}`,a=await si(`${n}`,{headers:r});if(!a.ok)throw new Error(a.statusText);let i=await a.json();if(a=await si(`${n}/endpoint`,{headers:r}),!a.ok)throw new Error(a.statusText);let o=await a.json();return i={...i,...o},i}async function Z6t(e,t={}){t=t["cesium-ion"]||{};let{accessToken:r}=t,n=t.assetId;if(!Number.isFinite(n)){let a=e.match(/\/([0-9]+)\/tileset.json/);n=a&&a[1]}return J1e(r,n)}var w8={...Nu,id:"cesium-ion",name:"Cesium Ion",preload:Z6t,parse:async(e,t,r)=>(t={...t},t["3d-tiles"]=t["cesium-ion"],t.loader=w8,Nu.parse(e,t,r)),options:{"cesium-ion":{...Nu.options["3d-tiles"],accessToken:null}}};var aAe=Ct(nAe(),1),x4t="4.4.0",uN={dataType:null,batchType:null,id:"zip",module:"zip",name:"Zip Archive",version:x4t,extensions:["zip"],mimeTypes:["application/zip"],category:"archive",tests:["PK"],options:{},parse:y4t};async function y4t(e,t={}){let r=[],n={};try{let a=new aAe.default;return(await a.loadAsync(e,t)).forEach((o,s)=>{if(s.dir)return;let u=s.name,c=_4t(a,u,t).then(l=>{n[o]=l});r.push(c)}),await Promise.all(r),n}catch(a){throw t.log.error(`Unable to read zip archive: ${a}`),a}}async function _4t(e,t,r={}){try{return await e.file(t).async(r.dataType||"arraybuffer")}catch(n){return r.log.error(`Unable to read ${t} from zip archive: ${n}`),n}}function by(e){return typeof e=="bigint"?e:BigInt(e)}function oAe(e){let t=Number(e);if(!Number.isFinite(t))throw new Error("Offset is out of bounds");return t}function iAe(e,t){return e<0?Math.max(t+e,0):Math.min(e,t)}async function Jr(e,t,r){let n=by(t),i=by(r)-n;if(i<0)throw new Error("Invalid range requested");return await e.read(n,oAe(i))}async function Kd(e,t,r){let n=await Jr(e,t,r);return new DataView(n)}async function sAe(e,t){return(await Kd(e,t,by(t)+2n)).getUint16(0,!0)}async function cN(e,t){return(await Kd(e,t,by(t)+4n)).getUint32(0,!0)}async function xy(e,t){return(await Kd(e,t,by(t)+8n)).getBigUint64(0,!0)}async function yy(e){if(e.bigsize>0n)return e.bigsize;if(e.size>0)return BigInt(e.size);if(e.stat){let t=await e.stat();if((t==null?void 0:t.bigsize)!==void 0)return t.bigsize;if((t==null?void 0:t.size)!==void 0)return BigInt(t.size)}return 0n}var vy=class{handle;size;bigsize;url;constructor(t,r=""){this.handle=t,this.size=t.byteLength,this.bigsize=BigInt(t.byteLength),this.url=r}async close(){}async stat(){return{size:this.size,bigsize:this.bigsize,isDirectory:!1}}async read(t=0,r){let n=oAe(t),a=r?n+r:this.size,i=iAe(n,this.size),o=iAe(a,this.size),u=Math.max(o,i)-i;return u<=0?new ArrayBuffer(0):Hl(this.handle.buffer,i,u)}};var w4t=1024,Jd=async(e,t)=>{let r=await yy(e),n=new Uint8Array(await Jr(e,r-3n,r+1n)),a=[n[3],n[2],n[1],void 0],i=-1,o=r-4n;do{let s=o;o-=BigInt(w4t),o=o>=0n?o:0n;let u=new Uint8Array(await Jr(e,o,s));for(let c=u.length-1;c>-1;c--)if(a[3]=a[2],a[2]=a[1],a[1]=a[0],a[0]=u[c],a.every((l,f)=>l===t[f])){i=c;break}}while(i===-1&&o>0n);return o+BigInt(i)};var A4t=new Uint8Array([1,0]);function dk(e){let t={...e,zip64Length:(e.offset?1:0)*8+(e.size?1:0)*16},r=[];for(let n of E4t){if(!t[n.name??""]&&!n.default)continue;let a=new DataView(new ArrayBuffer(n.size));uAe[n.size](a,0,t[n.name??""]??n.default),r.push(a.buffer)}return bn(...r)}function Sa(e,t,r,n){uAe[t](e,Number(r),n)}var uAe={2:(e,t,r)=>{e.setUint16(t,Number(r>65535?65535:r),!0)},4:(e,t,r)=>{e.setUint32(t,Number(r>4294967295?4294967295:r),!0)},8:(e,t,r)=>{e.setBigUint64(t,BigInt(r),!0)}},E4t=[{size:2,default:new DataView(A4t.buffer).getUint16(0,!0)},{size:2,name:"zip64Length"},{size:8,name:"size"},{size:8,name:"size"},{size:8,name:"offset"}];var cAe=new Uint8Array([80,75,5,6]),lAe=new Uint8Array([80,75,6,7]),fAe=new Uint8Array([80,75,6,6]),pAe=8n,T4t=10n,dAe=12n,hAe=16n,S4t=22n,mAe=8n,gAe=24n,k4t=32n,bAe=40n,vAe=48n,C4t=56n,hk=async e=>{let t=await Jd(e,cAe),r=BigInt(await sAe(e,t+pAe)),n=BigInt(await cN(e,t+dAe)),a=BigInt(await cN(e,t+hAe)),i=t-20n,o=0n,s=await Jr(e,i,i+4n);if(pu(s,lAe.buffer)){o=await xy(e,i+mAe);let u=await Jr(e,o,o+4n);if(!pu(u,fAe.buffer))throw new Error("zip64 EoCD not found");r=await xy(e,o+gAe),n=await xy(e,o+bAe),a=await xy(e,o+vAe)}else i=0n;return{cdRecordsNumber:r,cdStartOffset:a,cdByteSize:n,offsets:{zip64EoCDOffset:o,zip64EoCDLocatorOffset:i,zipEoCDOffset:t}}};function xAe(e,t,r,n,a){let i=new DataView(e),o=t.zip64EoCDOffset?t.zipEoCDOffset-t.zip64EoCDOffset:0n;if(Number(a)<=65535&&(Sa(i,2,o+pAe,a),Sa(i,2,o+T4t,a)),n-r<=4294967295&&Sa(i,4,o+dAe,n-r),r<4294967295&&Sa(i,4,o+hAe,r),t.zip64EoCDLocatorOffset&&t.zip64EoCDOffset){let s=t.zip64EoCDLocatorOffset-t.zip64EoCDOffset;Sa(i,8,s+mAe,n),Sa(i,8,vAe,r),Sa(i,8,gAe,a),Sa(i,8,k4t,a),Sa(i,8,bAe,n-r)}return new Uint8Array(i.buffer)}function yAe(e){let t=new DataView(new ArrayBuffer(Number(S4t)));for(let a of D4t)Sa(t,a.size,a.offset,e[a.name??""]??a.default??0);let r=F4t(e),n=B4t(e);return bn(n,r,t.buffer)}var D4t=[{offset:0,size:4,default:new DataView(cAe.buffer).getUint32(0,!0)},{offset:4,size:2,default:0},{offset:6,size:2,default:0},{offset:8,size:2,name:"recordsNumber"},{offset:10,size:2,name:"recordsNumber"},{offset:12,size:4,name:"cdSize"},{offset:16,size:4,name:"cdOffset"},{offset:20,size:2,default:0}];function B4t(e){let t=new DataView(new ArrayBuffer(Number(C4t)));for(let r of I4t)Sa(t,r.size,r.offset,e[r.name??""]??r.default??0);return t.buffer}function F4t(e){let t=new DataView(new ArrayBuffer(Number(20)));for(let r of O4t)Sa(t,r.size,r.offset,e[r.name??""]??r.default??0);return t.buffer}var O4t=[{offset:0,size:4,default:new DataView(lAe.buffer).getUint32(0,!0)},{offset:4,size:4,default:0},{offset:8,size:8,name:"eoCDStart"},{offset:16,size:4,default:1}],I4t=[{offset:0,size:4,default:new DataView(fAe.buffer).getUint32(0,!0)},{offset:4,size:8,default:44},{offset:12,size:2,default:45},{offset:14,size:2,default:45},{offset:16,size:4,default:0},{offset:20,size:4,default:0},{offset:24,size:8,name:"recordsNumber"},{offset:32,size:8,name:"recordsNumber"},{offset:40,size:8,name:"cdSize"},{offset:48,size:8,name:"cdOffset"}];var P4t=20,R4t=24,j4t=28,L4t=30,M4t=32,q4t=42,_y=46n,Yd=new Uint8Array([80,75,1,2]),Xd=async(e,t)=>{let r=await yy(t);if(e>=r)return null;let n=await Kd(t,e,e+_y),a=n.buffer.slice(0,4);if(!pu(a,Yd.buffer))return null;let i=BigInt(n.getUint32(P4t,!0)),o=BigInt(n.getUint32(R4t,!0)),s=n.getUint16(L4t,!0),u=BigInt(n.getUint16(M4t,!0)),c=n.getUint16(j4t,!0),l=await Jr(t,e+_y,e+_y+BigInt(c+s)),f=l.slice(0,c),p=new TextDecoder().decode(f),d=e+_y+BigInt(c),h=n.getUint32(q4t,!0),m=BigInt(h),g=new DataView(l.slice(c,l.byteLength)),x={uncompressedSize:o,compressedSize:i,localHeaderOffset:m,startDisk:u},y=N4t(x,g);return{...x,...y,extraFieldLength:s,fileNameLength:c,fileName:p,extraOffset:d}};async function*Ku(e){let{cdStartOffset:t,cdByteSize:r}=await hk(e),n=new vy(new DataView(await Jr(e,t,t+r))),a=await Xd(0n,n);for(;a;)yield a,a=await Xd(a.extraOffset+BigInt(a.extraFieldLength),n)}var _Ae=(...e)=>e[0]+e[1]*16,N4t=(e,t)=>{let r=U4t(e),n={};if(r.length>0){let a=r.reduce((s,u)=>s+u.length,0),i=new Uint8Array(t.buffer).findIndex((s,u,c)=>_Ae(c[u],c[u+1])===1&&_Ae(c[u+2],c[u+3])===a),o=0;for(let s of r){let u=o;n[s.name]=t.getBigUint64(i+4+u,!0),o=u+s.length}}return n},U4t=e=>{let t=[];return e.uncompressedSize===BigInt(4294967295)&&t.push({name:"uncompressedSize",length:8}),e.compressedSize===BigInt(4294967295)&&t.push({name:"compressedSize",length:8}),e.localHeaderOffset===BigInt(4294967295)&&t.push({name:"localHeaderOffset",length:8}),e.startDisk===BigInt(4294967295)&&t.push({name:"startDisk",length:4}),t};function lN(e){let t={...e,fnlength:e.fileName.length,extraLength:0},r=new ArrayBuffer(0),n={};t.offset>=4294967295&&(n.offset=t.offset,t.offset=BigInt(4294967295)),t.length>=4294967295&&(n.size=t.length,t.length=4294967295),Object.keys(n).length&&(r=dk(n),t.extraLength=r.byteLength);let a=new DataView(new ArrayBuffer(Number(_y)));for(let s of z4t)Sa(a,s.size,s.offset,t[s.name??""]??s.default??0);let i=new TextEncoder().encode(t.fileName);return bn(a.buffer,i,r)}var z4t=[{offset:0,size:4,default:new DataView(Yd.buffer).getUint32(0,!0)},{offset:4,size:2,default:45},{offset:6,size:2,default:45},{offset:8,size:2,default:0},{offset:10,size:2,default:0},{offset:12,size:2,default:0},{offset:14,size:2,default:0},{offset:16,size:4,name:"crc32"},{offset:20,size:4,name:"length"},{offset:24,size:4,name:"length"},{offset:28,size:2,name:"fnlength"},{offset:30,size:2,default:0,name:"extraLength"},{offset:32,size:2,default:0},{offset:34,size:2,default:0},{offset:36,size:2,default:0},{offset:38,size:4,default:0},{offset:42,size:4,name:"offset"}];var G4t=8,H4t=18,V4t=22,$4t=26,W4t=28,wy=30n,fN=new Uint8Array([80,75,3,4]),Os=async(e,t)=>{let r=await Kd(t,e,e+wy),n=r.buffer.slice(0,4);if(!pu(n,fN.buffer))return null;let a=r.getUint16($4t,!0),i=r.getUint16(W4t,!0),o=await Jr(t,e+wy,e+wy+BigInt(a+i)),s=o.slice(0,a),u=new DataView(o.slice(a,o.byteLength)),c=new TextDecoder().decode(s).split("\\").join("/"),l=e+wy+BigInt(a+i),f=r.getUint16(G4t,!0),p=BigInt(r.getUint32(H4t,!0)),d=BigInt(r.getUint32(V4t,!0)),h=4;return d===BigInt(4294967295)&&(d=u.getBigUint64(h,!0),h+=8),p===BigInt(4294967295)&&(p=u.getBigUint64(h,!0),h+=8),l===BigInt(4294967295)&&(l=u.getBigUint64(h,!0)),{fileNameLength:a,fileName:c,extraFieldLength:i,fileDataOffset:l,compressedSize:p,compressionMethod:f}};function pN(e){let t={...e,extraLength:0,fnlength:e.fileName.length},r=new ArrayBuffer(0),n={};t.length>=4294967295&&(n.size=t.length,t.length=4294967295),Object.keys(n).length&&(r=dk(n),t.extraLength=r.byteLength);let a=new DataView(new ArrayBuffer(Number(wy)));for(let s of K4t)Sa(a,s.size,s.offset,t[s.name??""]??s.default??0);let i=new TextEncoder().encode(t.fileName);return bn(a.buffer,i,r)}var K4t=[{offset:0,size:4,default:new DataView(fN.buffer).getUint32(0,!0)},{offset:4,size:2,default:45},{offset:6,size:2,default:0},{offset:8,size:2,default:0},{offset:10,size:2,default:0},{offset:12,size:2,default:0},{offset:14,size:4,name:"crc32"},{offset:18,size:4,name:"length"},{offset:22,size:4,name:"length"},{offset:26,size:2,name:"fnlength"},{offset:28,size:2,default:0,name:"extraLength"}];async function J4t(e){let t=await hk(e),r=t.cdStartOffset,n=(await e.stat()).bigsize,a=Number(t.offsets.zip64EoCDOffset?t.offsets.zip64EoCDOffset-r:t.offsets.zipEoCDOffset-r),i=await Jr(e,r,n);await e.truncate(Number(r));let o=i.slice(0,a),s=i.slice(a,i.byteLength);return[o,s,t]}async function AAe(e,t,r){let n=parseInt(await new Gv().hash(t,"hex"),16),a=pN({crc32:n,fileName:e,length:t.byteLength}),i=lN({crc32:n,fileName:e,offset:r,length:t.byteLength});return[new Uint8Array(bn(a,t)),new Uint8Array(i)]}async function dN(e,t,r){let n=new Ha(e,"a+"),[a,i,o]=await J4t(n),s=(await n.stat()).bigsize,u=s,[c,l]=await AAe(r,t,u);await n.append(c),s+=BigInt(c.byteLength);let f=bn(a,l),p=s;await n.append(new Uint8Array(f)),s+=BigInt(f.byteLength);let d=s,h=xAe(i,o.offsets,p,d,o.cdRecordsNumber+1n);await n.append(h),s+=BigInt(h.byteLength)}async function hN(e,t,r){let n=X4t(e),a=new Ha(t,"w"),i=[],o=[];for await(let l of n)await wAe(l,a,o,i);if(r){let l=await r(i);await wAe(l,a,o)}let s=(await a.stat()).bigsize,u=bn(...o);await a.append(new Uint8Array(u));let c=(await a.stat()).bigsize;await a.append(new Uint8Array(yAe({recordsNumber:o.length,cdSize:u.byteLength,cdOffset:s,eoCDStart:c})))}async function wAe(e,t,r,n){let a=(await t.stat()).bigsize;n==null||n.push({fileName:e.path,localHeaderOffset:a});let[i,o]=await AAe(e.path,e.file,a);await t.append(i),r.push(Wn(o))}function X4t(e){async function*t(){let r=await EAe(e);for(let n of r){let a=await(await si(Ga.join(e,n))).arrayBuffer();yield{path:n,file:a}}}return t()}async function EAe(e,t="",r){let n=r||new zv({}),a=await n.readdir(mk(e,t)),i=[];for(let o of a){let s=mk(e,t,o);if((await n.stat(s)).isDirectory){let u=await EAe(e,mk(t,o));i.push(...u)}else i.push(mk(t,o))}return i}function mk(...e){let t=e.filter(r=>r.length);return Ga.join(...t)}var $g=class{constructor(t){this.compressBatches=this.compressBatches.bind(this),this.decompressBatches=this.decompressBatches.bind(this)}async preload(t={}){u0(t)}async compress(t){return await this.preload(),this.compressSync(t)}async decompress(t,r){return await this.preload(),this.decompressSync(t,r)}compressSync(t){throw new Error(`${this.name}: sync compression not supported`)}decompressSync(t,r){throw new Error(`${this.name}: sync decompression not supported`)}async*compressBatches(t){let r=await this.concatenate(t);yield this.compress(r)}async*decompressBatches(t){let r=await this.concatenate(t);yield this.decompress(r)}concatenate(t){return jp(t)}improveError(t){return t.message.includes(this.name)||(t.message=`${this.name} ${t.message}`),t}};var Ay=class extends $g{name="uncompressed";extensions=[];contentEncodings=[];isSupported=!0;options;constructor(t){super(t),this.options=t||{}}compressSync(t){return t}decompressSync(t){return t}async*compressBatches(t){return yield*t}async*decompressBatches(t){return yield*t}};var Qd=Ct(Jq(),1),cl=Ct(require("zlib"),1),ll=class extends $g{name="deflate";extensions=[];contentEncodings=["deflate"];isSupported=!0;options;_chunks=[];constructor(t={}){super(t),this.options=t}async compress(t){var r,n;if(!pr&&((r=this.options.deflate)!=null&&r.useZlib)){let a=(n=this.options.deflate)!=null&&n.gzip?await p0(cl.default.gzip)(t):await p0(cl.default.deflate)(t);return Wn(a)}return this.compressSync(t)}async decompress(t){var r,n;if(!pr&&((r=this.options.deflate)!=null&&r.useZlib)){let a=(n=this.options.deflate)!=null&&n.gzip?await p0(cl.default.gunzip)(t):await p0(cl.default.inflate)(t);return Wn(a)}return this.decompressSync(t)}compressSync(t){var i,o,s,u;if(!pr&&((i=this.options.deflate)!=null&&i.useZlib)){let c=(o=this.options.deflate)!=null&&o.gzip?cl.default.gzipSync(t):cl.default.deflateSync(t);return Wn(c)}let r=((s=this.options)==null?void 0:s.deflate)||{},n=new Uint8Array(t),a=(u=this.options)!=null&&u.raw?Qd.default.deflateRaw:Qd.default.deflate;return Wn(a(n,r).buffer)}decompressSync(t){var i,o,s,u;if(!pr&&((i=this.options.deflate)!=null&&i.useZlib)){let c=(o=this.options.deflate)!=null&&o.gzip?cl.default.gunzipSync(t):cl.default.inflateSync(t);return Wn(c)}let r=((s=this.options)==null?void 0:s.deflate)||{},n=new Uint8Array(t),a=(u=this.options)!=null&&u.raw?Qd.default.inflateRaw:Qd.default.inflate;return Wn(a(n,r).buffer)}async*compressBatches(t){var a;let r=((a=this.options)==null?void 0:a.deflate)||{},n=new Qd.default.Deflate(r);yield*this.transformBatches(n,t)}async*decompressBatches(t){var a;let r=((a=this.options)==null?void 0:a.deflate)||{},n=new Qd.default.Inflate(r);yield*this.transformBatches(n,t)}async*transformBatches(t,r){t.onData=this._onData.bind(this),t.onEnd=this._onEnd.bind(this);for await(let o of r){let s=new Uint8Array(o);if(!t.push(s,!1))throw new Error(`${this._getError()}write`);yield*this._getChunks()}let n=new Uint8Array(0),a=t.push(n,!0);yield*this._getChunks()}_onData(t){this._chunks.push(t)}_onEnd(t){if(t!==0)throw new Error(this._getError(t)+this._chunks.length)}_getChunks(){let t=this._chunks;return this._chunks=[],t}_getError(t=0){let r={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};return`${this.name}: ${r[t]}`}};var Ey=class extends ll{name="gzip";extensions=["gz","gzip"];contentEncodings=["gzip","x-gzip"];isSupported=!0;constructor(t){super({...t,deflate:{...t==null?void 0:t.gzip,gzip:!0}})}};var TAe={0:async e=>e,8:async e=>await new ll({raw:!0}).decompress(e)},fl=class{file=null;fileName;archive=null;constructor(t){if(typeof t=="string"){if(this.fileName=t,pr)throw new Error("ZipFileSystem cannot open file paths in browser environments");this.file=new Ha(t)}else t instanceof Blob||t instanceof ArrayBuffer?this.file=new Nv(t):t instanceof pl?(this.file=t.file,this.archive=t,this.fileName=t.fileName):this.file=t}async destroy(){this.file&&await this.file.close()}async readdir(){if(!this.file)throw new Error("No data detected in the zip archive");let t=[],r=Ku(this.file);for await(let n of r)t.push(n.fileName);return t}async stat(t){let r=await this.getCDFileHeader(t);return{...r,size:Number(r.uncompressedSize)}}async fetch(t){this.fileName&&t.indexOf(this.fileName)===0&&(t=t.substring(this.fileName.length+1));let r;if(this.archive)r=await this.archive.getFile(t,"http");else{if(!this.file)throw new Error("No data detected in the zip archive");let a=await this.getCDFileHeader(t),i=await Os(a.localHeaderOffset,this.file);if(!i)throw new Error("Local file header has not been found in the zip archive`");let o=TAe[i.compressionMethod.toString()];if(!o)throw Error("Only Deflation compression is supported");let s=await Jr(this.file,i.fileDataOffset,i.fileDataOffset+i.compressedSize);r=await o(s)}let n=new Response(r);return Object.defineProperty(n,"url",{value:t?`${this.fileName||""}/${t}`:this.fileName||""}),n}async getCDFileHeader(t){if(!this.file)throw new Error("No data detected in the zip archive");let r=Ku(this.file),n=null;for await(let a of r)if(a.fileName===t){n=a;break}if(!n)throw new Error("File has not been found in the zip archive");return n}};var pl=class{file;fileName;constructor(t,r,n){this.file=t,this.fileName=n}async getFileWithoutHash(t){return await(await new fl(this.file).fetch(t)).arrayBuffer()}};function Ty(e){let t=new DataView(e),r={};for(let n=0;n<e.byteLength;n=n+24){let a=t.getBigUint64(n+16,!0),i=Y4t(e,n,16);r[i]=a}return r}function Y4t(e,t,r){return[...new Uint8Array(e,t,r)].map(n=>n.toString(16).padStart(2,"0")).join("")}async function mN(e){let t=Ku(e);return Q4t(t)}async function Q4t(e){let t=new mu,r=new TextEncoder,n={};for await(let a of e){let i=a.fileName.split("\\").join("/").toLocaleLowerCase(),o=r.encode(i).buffer,s=await t.hash(o,"hex");n[s]=a.localHeaderOffset}return n}async function Sy(e){let t=new mu,r=new TextEncoder,n=[];for await(let i of e){let o=i.fileName.split("\\").join("/");o!=="3dSceneLayer.json.gz"&&(o=o.toLocaleLowerCase());let s=r.encode(o).buffer,u=await t.hash(s,"hex");n.push(bn(eCt(u),tCt(i.localHeaderOffset)))}let a=n.sort(Z4t);return bw(a)}function Z4t(e,t){let r=new BigUint64Array(e),n=new BigUint64Array(t);return Number(r[0]===n[0]?r[1]-n[1]:r[0]-n[0])}function eCt(e){var r;let t=(r=e.match(/../g))==null?void 0:r.map(n=>parseInt(n,16));return new Uint8Array(t??new Array(16)).buffer}function tCt(e){return new BigUint64Array([e]).buffer}var rCt={0:e=>new Ay().decompress(e),8:e=>new ll({raw:!0}).decompress(e)},ky=class extends pl{hashTable;constructor(t,r,n){super(t,r,n),this.hashTable=r}async getFile(t){let r=await this.getFileBytes(t.toLocaleLowerCase());if(r||(r=await this.getFileBytes(t)),!r)throw new Error(`No such file in the archive: ${t}`);return r}async getFileBytes(t){let r;if(this.hashTable){let n=new TextEncoder().encode(t).buffer,a=await new mu().hash(n,"hex"),i=this.hashTable[a];if(i===void 0)return null;let o=await Os(i,this.file);if(!o)return null;let s=await Jr(this.file,o.fileDataOffset,o.fileDataOffset+o.compressedSize),u=rCt[o.compressionMethod];if(!u)throw Error("Only Deflation compression is supported");r=await u(s)}else r=await this.getFileWithoutHash(t);return r}};function Xf(e,t,r){if(!t)return r+12;let{magic:a,version:i=1,byteLength:o=12}=e;return yt(Array.isArray(a)&&Number.isFinite(i)&&Number.isFinite(o)),t.setUint8(r+0,a[0]),t.setUint8(r+1,a[1]),t.setUint8(r+2,a[2]),t.setUint8(r+3,a[3]),t.setUint32(r+4,i,!0),t.setUint32(r+8,o,!0),r+=12,r}function Yf(e,t,r){e&&e.setUint32(t+8,r,!0)}function SAe(e,t,r,n,a){e={magic:Rf.COMPOSITE,tiles:[],...e};let i=r;r+=Xf(e,t,r),t&&t.setUint32(r,e.tiles.length,!0),r+=4;for(let o=0;o<e.tiles.length;++o)r+=a(e.tiles[o],t,r,n);return Yf(t,i,r-i),r}function kAe(e,t,r,n){let{featuresLength:a=0,batchTable:i}=e,s=JSON.stringify({BATCH_LENGTH:a}),u=i?JSON.stringify(i):"",c=Ki(s.length,8),l=u?Ki(u.length,8):0;e={magic:Rf.BATCHED_MODEL,...e};let f=r;r=Xf(e,t,r),t&&(t.setUint32(12,c,!0),t.setUint32(16,0,!0),t.setUint32(20,l,!0),t.setUint32(24,0,!0)),r+=16,r=f0(t,r,s,8),i&&(r=f0(t,r,u,8));let p=e.gltfEncoded;return p&&(r=Mv(t,r,p,p.byteLength)),Yf(t,f,r-f),r}function CAe(e,t,r,n){let{featuresLength:a=1,gltfFormat:i=1,gltfUri:o=""}=e,s=o.length,u={INSTANCES_LENGTH:a,POSITION:new Array(a*3).fill(0)},c=JSON.stringify(u),l=c.length;e={magic:Rf.INSTANCED_MODEL,...e};let f=r;return r=Xf(e,t,0),t&&(t.setUint32(12,l,!0),t.setUint32(16,0,!0),t.setUint32(20,0,!0),t.setUint32(24,0,!0),t.setUint32(28,i,!0)),r+=20,r+=l0(t,r,c,l),r+=l0(t,r,o,s),Yf(t,f,r-f),r}var nCt={POINTS_LENGTH:1,POSITIONS:{byteOffset:0}};function DAe(e,t,r,n){let{featureTableJson:a=nCt}=e,i=JSON.stringify(a);i=nF(i,4);let{featureTableJsonByteLength:o=i.length}=e,s=new ArrayBuffer(12),u=s.byteLength;e={magic:Rf.POINT_CLOUD,...e};let c=r;return r+=Xf(e,t,0),t&&(t.setUint32(r+0,o,!0),t.setUint32(r+4,u,!0),t.setUint32(r+8,0,!0),t.setUint32(r+12,0,!0)),r+=16,r+=l0(t,r,i,o),r+=Mv(t,r,s,u),Yf(t,c,r-c),r}function bN(e,t){let r=gN(e,null,0,t),n=new ArrayBuffer(r),a=new DataView(n);return gN(e,a,0,t),n}function gN(e,t,r,n){switch(yt(typeof e.type=="string"),e.type){case pa.COMPOSITE:return SAe(e,t,r,n,gN);case pa.POINT_CLOUD:return DAe(e,t,r,n);case pa.BATCHED_3D_MODEL:return kAe(e,t,r,n);case pa.INSTANCED_3D_MODEL:return CAe(e,t,r,n);default:throw new Error("3D Tiles: unknown tile type")}}var vN={name:"3D Tile",id:"3d-tiles",module:"3d-tiles",version:Zm,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],binary:!0,options:{["3d-tiles"]:{}},encode:async(e,t)=>BAe(e,t),encodeSync:BAe};function BAe(e,t){return bN(e,t)}var Jo=require("path");var FAe=Ct(require("crypto")),bk=new Uint8Array(256),gk=bk.length;function xN(){return gk>bk.length-16&&(FAe.default.randomFillSync(bk),gk=0),bk.slice(gk,gk+=16)}var ka=[];for(let e=0;e<256;++e)ka.push((e+256).toString(16).slice(1));function OAe(e,t=0){return ka[e[t+0]]+ka[e[t+1]]+ka[e[t+2]]+ka[e[t+3]]+"-"+ka[e[t+4]]+ka[e[t+5]]+"-"+ka[e[t+6]]+ka[e[t+7]]+"-"+ka[e[t+8]]+ka[e[t+9]]+"-"+ka[e[t+10]]+ka[e[t+11]]+ka[e[t+12]]+ka[e[t+13]]+ka[e[t+14]]+ka[e[t+15]]}var IAe=Ct(require("crypto")),yN={randomUUID:IAe.default.randomUUID};function aCt(e,t,r){if(yN.randomUUID&&!t&&!e)return yN.randomUUID();e=e||{};let n=e.random||(e.rng||xN)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let a=0;a<16;++a)t[r+a]=n[a];return t}return OAe(n)}var Ju=aCt;var fh=Ct(require("process"),1),f4=Ct(Is(),1),p4=Ct(AN(),1);var yk=require("path"),JAe=Ct(Is(),1);var VAe=()=>({folderPattern:{path:"folderPattern",default:"BASIC"},archiveCompressionType:{path:"archiveCompressionType",default:"STORE"},resourceCompressionType:{path:"resourceCompressionType",default:"GZIP"},I3SVersion:{path:"I3SVersion",default:"1.8"},nodeCount:{path:"nodeCount"}});var Zd=require("fs"),Wg=require("path");var $Ae=require("zlib"),vk=require("fs");function xk(e){let t=`${e}.gz`,r=(0,$Ae.createGzip)(),n=(0,vk.createReadStream)(e),a=(0,vk.createWriteStream)(t);return new Promise((i,o)=>{n.on("end",()=>{console.log(`${t} compressed and saved.`),i(t)}),n.on("error",s=>{console.log(`${t}: compression error!`),o(s)}),n.pipe(r).pipe(a)})}async function Oi(e,t,r="index.json"){let n;t instanceof Promise?n=new Uint8Array(await t):t instanceof ArrayBuffer?n=new Uint8Array(t):n=t,await Zd.promises.mkdir(e,{recursive:!0});let a=(0,Wg.join)(e,r);try{await Zd.promises.writeFile(a,n)}catch(i){throw i}return console.log(`${a} saved.`),a}async function Xu(e,t,r="index.json",n=!0,a){let i=await Oi(e,t,r);if(n){if(a)return a.includes(i)?null:(a.push(i),`${i}.gz`);let o=await xk(i);return await Fy(i),o}return i}async function Kg(e,t){return new Promise((r,n)=>{let a=0;console.log(`load ${e}/${t}.`);let i=setInterval(()=>{let o=(0,Wg.join)(e,t);Wr(o,aF).then(s=>{clearInterval(i),r(s)}).catch(()=>{a++,a>100&&(clearInterval(i),n(new Error(`Cannon load ${e}/${t}.`)))})},200)})}async function Dy(e){try{return await Zd.promises.stat(e),!0}catch{return!1}}function By(e){return Zd.promises.rm(e,{recursive:!0})}function Fy(e){return Zd.promises.unlink(e)}function WAe(e){return(0,Wg.isAbsolute)(e)?e:(0,Wg.join)(process.cwd(),e)}async function KAe(e,t){try{await Zd.promises.rename(e,t)}catch(r){console.log("Can't rename file",r)}}var Ca=class{nodesPerPage;nodesCounter;writeFile;converter;nodePages;length=0;constructor(t,r,n){this.nodesPerPage=r,this.nodesCounter=0,this.nodePages=[{}],this.nodePages[0].nodes=[],this.writeFile=t,this.converter=n,this.length=0}useWriteFunction(t){this.writeFile=t}getNodePageFileName(t){let r=(0,yk.join)(this.converter.layers0Path,"nodepages"),n=`${t.toString()}.json`;return{filePath:r,fileName:n}}async loadNodePage(t){let{filePath:r,fileName:n}=this.getNodePageFileName(t),a=(0,yk.join)(r,n);return await Dy(a)?(console.log(`load ${a}.`),await Kg(r,n)):{nodes:[]}}getPageIndexByNodeId(t){return Math.floor(t/this.nodesPerPage)}async getPageByNodeId(t){let r=this.getPageIndexByNodeId(t);return this.converter.options.instantNodeWriting?await this.loadNodePage(r):this.nodePages[r]}async getNodeById(t,r){let n=t%this.nodesPerPage;return r=r||await this.getPageByNodeId(t),r.nodes[n]}async addChildRelation(t,r){var a;if(t==null)return;let n=await this.getNodeById(t);(a=n.children)==null||a.push(r),await this.saveNode(n)}async push(t,r){if(t.index=this.nodesCounter++,!this.converter.options.instantNodeWriting){let n=this.nodePages[this.nodePages.length-1];n.nodes.length===this.nodesPerPage&&(n={nodes:[]},this.nodePages.push(n)),n.nodes.push(t)}return await this.addChildRelation(r,t.index),Ca.updateResourceInMesh(t),await this.saveNode(t),t}async saveNode(t){if(!this.converter.options.instantNodeWriting)return;let r=this.getPageIndexByNodeId(t.index),n=await this.getPageByNodeId(t.index),{filePath:a,fileName:i}=this.getNodePageFileName(r),o=await this.getNodeById(t.index,n);o?Ca.updateAll(o,t):n.nodes.push(t);let s=JSON.stringify(n);await this.converter.writeQueue.enqueue({archiveKey:`nodePages/${r.toString()}.json.gz`,writePromise:()=>this.writeFile(a,s,i,!0,this.converter.compressList)},!0)}async saveMetadata(){let t=(0,JAe.default)({nodeCount:this.nodesCounter},VAe()),r=!1;await this.converter.writeQueue.enqueue({archiveKey:"metadata.json",writePromise:()=>this.writeFile(this.converter.layers0Path,JSON.stringify(t),"metadata.json",r)})}async save(){if(this.converter.options.instantNodeWriting){await this.saveMetadata();return}for(let[t,r]of this.nodePages.entries()){let n=JSON.stringify(r),a=(0,yk.join)(this.converter.layers0Path,"nodepages");await this.converter.writeQueue.enqueue({archiveKey:`nodePages/${t.toString()}.json.gz`,writePromise:()=>this.writeFile(a,n,`${t.toString()}.json`)})}await this.saveMetadata()}static updateResourceInMesh(t){t.mesh&&isFinite(t.index)&&(t.mesh.geometry.resource=t.index)}static updateAll(t,r){return Object.assign(t,r,{index:t.index}),Ca.updateResourceInMesh(t),t}static updateMaterialByNodeId(t,r){t.mesh&&(t.mesh.material={definition:r,resource:t.index})}static updateVertexCountByNodeId(t,r){t.mesh&&(t.mesh.geometry.vertexCount=r)}static updateNodeAttributeByNodeId(t){!t.mesh||!t.index||(t.mesh.attribute.resource=t.index)}static updateFeatureCountByNodeId(t,r){t.mesh&&(t.mesh.geometry.featureCount=r)}static updateTexelCountHintByNodeId(t,r){!t.mesh||!t.mesh.material||(t.mesh.material.texelCountHint=r)}};var Oy=require("path"),_k=require("fs");function Jg(e){if(typeof e=="number"){let i=Math.floor(e/1e3),o=e-i*1e3;return XAe(i,o)}let t=1e6,r=e[0],n=e[1]/t;return XAe(r,n)}function XAe(e,t){let r=Math.floor(e/3600);e=e-r*3600;let n=Math.floor(e/60);e=e-n*60;let a=Math.floor(e),i="";return r&&(i+=`${r}h `),n&&(i+=`${n}m `),a&&(i+=`${a}s`),i||(i+=`${Math.floor(t)}ms`),i}async function wk(e){let{slpk:t,outputPath:r,tilesetName:n}=e,a=WAe(r);try{if(t){let s=(0,Oy.join)(a,`${n}.slpk`);return(await _k.promises.stat(s)).size}let i=(0,Oy.join)(a,n);return await YAe(i)}catch(i){return console.log("Calculate file sizes error: ",i),null}}async function YAe(e){let t=0,r=await _k.promises.readdir(e);for(let n of r){let a=await _k.promises.stat((0,Oy.join)(e,n));a.isDirectory()?t+=await YAe((0,Oy.join)(e,n)):t+=a.size}return t}var mEe=require("module"),Sk=require("path");var gEe=Ct(AN(),1);var eh=3,Xg=9;function ZAe(e){let{positions:t,normals:r,texCoords:n,colors:a,uvRegions:i,featureIndices:o}=e,s=t.length/Xg;if(!o.length)return{faceRange:new Uint32Array([0,s-1]),featureIds:[0],featureCount:1,positions:t,normals:r,texCoords:n,colors:a,uvRegions:i};let u=mCt(o),c=gCt({...u,...e}),l=bCt(c);return vCt(l,u.featureCount)}function mCt(e){let t=1,r=1,n=QAe(e.slice(0,eh)),a=[],i=[],o=[n];a[0]=0,i[0]=n;for(let c=eh;c<e.length;c+=eh){let l=QAe(e.slice(c,c+eh));n!==l&&(a[t]=c/eh-1,a[t+1]=c/eh,i[r]=l,o.includes(l)||o.push(l),t+=2,r+=1),n=l}a[t]=e.length/eh-1;let s=new Uint32Array(a),u=o.length;return{faceRange:s,featureCount:u,featureIds:i}}function QAe(e){let t={},r=e[0],n=1;for(let a of e)t[a]=(t[a]||0)+1,n=n>t[a]?n:t[a],r=n>t[a]?r:a;return r}function gCt(e){let{featureIds:t,positions:r,normals:n,colors:a,uvRegions:i,texCoords:o,faceRange:s=new Uint32Array(0)}=e,u=[],c=new Float32Array(r),l=new Float32Array(n),f=new Uint8Array(a),p=new Float32Array(o),d=new Uint16Array(i),h=0,m=0,g=0,x=0,y=0;for(let w=0;w<t.length;w++){let T=s[w*2],A=s[w*2+1],B=Iy("positions",T,A),I=Iy("normals",T,A),L=Iy("colors",T,A),C=Iy("uvRegions",T,A),k=Iy("texCoords",T,A);u.push({featureId:t[w],positions:c.subarray(h,h+B),normals:l.subarray(m,m+I),colors:f.subarray(g,g+L),uvRegions:d.subarray(x,x+C),texCoords:p.subarray(y,y+k)}),h+=B,m+=I,g+=L,x+=C,y+=k}return u}function Iy(e,t,r){let i=r-t+1,o=i*3;switch(e){case"positions":case"normals":return i*Xg;case"colors":case"uvRegions":return o*4;case"texCoords":return o*2;default:return 0}}function bCt(e){let t=[];for(let n of e){let a=t.find(i=>i.featureId===n.featureId);a?a.attributes.push(n):t.push({featureId:n.featureId,attributes:[n]})}let r=[];for(let n of t){let a=eEe(n.attributes);r.push({featureId:n.featureId,...a})}return r}function vCt(e,t){let n=[e[0].featureId||0],a=[0],i=0,o=0;for(let c=1;c<e.length;c++){let l=e[c];n.push(l.featureId||0);let f=e[i];a.push(f.positions.length/Xg-1+o),a.push(f.positions.length/Xg+o),o+=f.positions.length/Xg,i+=1}let s=eEe(e);return a.push(s.positions.length/Xg-1),{faceRange:new Uint32Array(a),featureIds:n,featureCount:t,...s}}function eEe(e){let t=e.map(({positions:f})=>f),r=t.length>1?Wi(...t):t[0],n=e.map(({normals:f})=>f),a=n.length>1?Wi(...n):n[0],i=e.map(({colors:f})=>f),o=i.length>1?Wi(...i):i[0],s=e.map(({texCoords:f})=>f),u=s.length>1?Wi(...s):s[0],c=e.map(({uvRegions:f})=>f),l=c.length>1?Wi(...c):c[0];return{positions:r,normals:a,colors:o,texCoords:u,uvRegions:l}}function Ak(e,t){let r,n,a,i=Ft.WGS84.cartesianToCartographic(e.center,new Z);return t&&(i[2]=i[2]-t.getHeight(i[1],i[0])),e instanceof fa?(n=e.halfSize,r=new Z(n[0],n[1],n[2]).len(),a=e.quaternion):(r=e.radius,n=[r,r,r],a=new Io().fromMatrix3(new nr([n[0],0,0,0,n[1],0,0,0,n[2]])).normalize()),{mbs:[i[0],i[1],i[2],r],obb:{center:[i[0],i[1],i[2]],halfSize:n,quaternion:a}}}function tEe(e,t){let r=xCt(e),n=A1(r),a=sM(r),i=Ft.WGS84.cartesianToCartographic(a.center,new Z),o=Ft.WGS84.cartesianToCartographic(n.center,new Z);return t&&(i[2]=i[2]-t.getHeight(i[1],i[0]),o[2]=o[2]-t.getHeight(o[1],o[0])),{mbs:[i[0],i[1],i[2],a.radius],obb:{center:o,halfSize:n.halfSize,quaternion:n.quaternion}}}function xCt(e){let t=[];for(let r=0;r<e.length;r+=3){let n=new Z([e[r],e[r+1],e[r+2]]);t.push(n)}return t}function rEe(e){let t;e instanceof ui?t=e:t=e.getBoundingSphere();let r=t.center,n=t.radius,a=Ft.WGS84.cartesianToCartographic(new Z(r[0]+n,r[1]+n,r[2]+n),new Z),i=Ft.WGS84.cartesianToCartographic(new Z(r[0]-n,r[1]-n,r[2]-n),new Z);return{xmin:Math.min(i[0],a[0]),xmax:Math.max(i[0],a[0]),ymin:Math.min(i[1],a[1]),ymax:Math.max(i[1],a[1]),zmin:Math.min(i[2],a[2]),zmax:Math.max(i[2],a[2])}}function EN(e){let t=e[3],r=new Z(e[0],e[1],e[2]),n=new nr([t,0,0,0,t,0,0,0,t]);return new fa(r,n)}function nEe(e,t,r){var s,u,c,l,f,p,d,h;let n=((u=(s=e.gltf)==null?void 0:s.scene)==null?void 0:u.nodes)||((f=(l=(c=e.gltf)==null?void 0:c.scenes)==null?void 0:l[0])==null?void 0:f.nodes)||((p=e.gltf)==null?void 0:p.nodes)||[],a=((h=(d=e.gltf)==null?void 0:d.images)==null?void 0:h.map(m=>{var y,w;if((y=m==null?void 0:m.image)!=null&&y.compressed)return null;let g=(w=m==null?void 0:m.image)==null?void 0:w.data,x=new Uint8Array(g.length);return x.set(g),{data:x,compressed:!1,height:m.image.height,width:m.image.width,components:m.image.components,mimeType:m.mimeType}}))||[];aEe(n);let{cartographicOrigin:i,modelMatrix:o}=_Ct(e,t,r);return{nodes:n,images:a,cartographicOrigin:i,cartesianModelMatrix:o}}function yCt(e){let t={};for(let r in e)t[r]={value:e[r].value};return t}function _Ct(e,t,r){let{rtcCenter:n,gltfUpAxis:a}=e,{center:i}=r,o=new mr(t);switch(n&&o.translate(n),a){case"Z":break;case"Y":let c=new mr().rotateX(Math.PI/2);o=o.multiplyRight(c);break;case"X":let l=new mr().rotateY(-Math.PI/2);o=o.multiplyRight(l);break;default:break}let s=new Z(i),u=Ft.WGS84.cartesianToCartographic(s,new Z);return{modelMatrix:o,cartographicOrigin:u}}function aEe(e){var t;for(let r=0;r<e.length;r++){let n=e[r];n.mesh&&(e[r]={...n,mesh:{...n.mesh,primitives:(t=n.mesh)==null?void 0:t.primitives.map(a=>{var i,o,s;return{...a,indices:{value:(i=a==null?void 0:a.indices)==null?void 0:i.value},attributes:yCt(a.attributes),material:{id:(o=a==null?void 0:a.material)==null?void 0:o.id,uniqueId:(s=a==null?void 0:a.material)==null?void 0:s.uniqueId}}})}}),n.children&&aEe(n.children)}}function iEe(e,t){var n,a;let r=(a=(n=e.gltf)==null?void 0:n.extensions)==null?void 0:a[Ro];if(!(r!=null&&r.featureTextures))return null;for(let i in r.featureTextures)if(r.featureTextures[i].class===t)return i;return null}function oEe(e,t,r,n){let a=t==null?void 0:t.extensions;if(!a)return[];for(let[i,o]of Object.entries(a||{}))switch(i){case Ro:return ACt(e,o,r,n);case YS:return wCt(e,o);default:return[]}return[]}function wCt(e,t){for(let r of t.featureIds)if(typeof r.propertyTable<"u")return r.data;return[]}function ACt(e,t,r,n){var o,s,u,c,l,f,p;let a=(o=t==null?void 0:t.featureIdAttributes)==null?void 0:o[0];if((s=a==null?void 0:a.featureIds)!=null&&s.attribute)return e[a.featureIds.attribute].value;if((u=a==null?void 0:a.featureIds)!=null&&u.hasOwnProperty("constant")&&((c=a==null?void 0:a.featureIds)!=null&&c.hasOwnProperty("divisor"))){let d=((l=e==null?void 0:e.POSITIONS)==null?void 0:l.value.length)/3||0;return ECt(d,a.featureIds.constant,a.featureIds.divisor)}let i=(t==null?void 0:t.featureIdTextures)&&(t==null?void 0:t.featureIdTextures[0]);if(i){let h=`TEXCOORD_${((p=(f=i==null?void 0:i.featureIds)==null?void 0:f.texture)==null?void 0:p.texCoord)||0}`,m=e[h].value;return TCt(i,m,r)}return n?e[n].value:[]}function ECt(e,t=0,r=0){let n=[];if(r>0){let a=t,i=r;for(let o=0;o<e;o++)n.push(a),i-=1,i===0&&(a++,i=r)}else n=Array(e).fill(t,0,e);return n}function TCt(e,t,r){var c,l,f;if(!(r!=null&&r.length))return[];let n={r:0,g:1,b:2,a:3},a=(l=(c=e==null?void 0:e.featureIds)==null?void 0:c.texture)==null?void 0:l.index,i=(f=e==null?void 0:e.featureIds)==null?void 0:f.channels;if(!i||a===void 0)return[];let o=r[a],s=[],u=n[i];if(o&&(o!=null&&o.width)&&(o!=null&&o.height)&&(o!=null&&o.components))for(let p=0;p<t.length;p+=2){let d=t[p],h=t[p+1],m=Math.min(qS(d)*o.width|0,o.width-1),x=(Math.min(qS(h)*o.height|0,o.height-1)*o.width+m)*o.components+u,y=new Uint8Array(o.data)[x];s.push(y)}else console.warn(`Can't get batch Ids from ${(o==null?void 0:o.mimeType)||""} compressed texture`);return s}function sEe(e,t){let r={};for(let n in t){let a=t[n];r[n]=SCt(a,e)}return r}function SCt(e,t){let r=[];if(e)for(let n in t){let a=e[n]||null;r.push(a)}return r}function uEe(e,t){let r=!1;for(let n of Object.values(t))(!e||!n||e.length!==n.length)&&(r=!0);return r}function kCt(e){return typeof e=="string"||typeof e=="bigint"?rn.STRING_TYPE:typeof e=="number"?Number.isInteger(e)?rn.SHORT_INT_TYPE:rn.DOUBLE_TYPE:rn.STRING_TYPE}function cEe(e){let t={};for(let r in e){let n=e[r][0],a=kCt(n);t[r]=a}return t}var lEe=(e,t)=>{var i,o,s,u,c,l,f,p;let r={},n=(u=(s=(o=(i=e.extensions)==null?void 0:i[Ro])==null?void 0:o.schema)==null?void 0:s.classes)==null?void 0:u[t];if(n){for(let d in n.properties){let h=n.properties[d],m=CCt(h);r[d]=m}return r}let a=(p=(f=(l=(c=e.extensions)==null?void 0:c[Xc])==null?void 0:l.schema)==null?void 0:f.classes)==null?void 0:p[t];if(a){for(let d in a.properties){let h=a.properties[d],m=DCt(h);r[d]=m}return r}return null},CCt=e=>{let t;switch(e.type){case"INT8":case"UINT8":case"INT16":case"UINT16":case"INT32":case"UINT32":t=rn.SHORT_INT_TYPE;break;case"FLOAT32":case"FLOAT64":t=rn.DOUBLE_TYPE;break;case"INT64":case"UINT64":case"BOOLEAN":case"ENUM":case"STRING":case"ARRAY":t=rn.STRING_TYPE;break;default:t=rn.STRING_TYPE;break}return t},DCt=e=>{let t;if(e.array)t=rn.STRING_TYPE;else switch(e.componentType){case"INT8":case"UINT8":case"INT16":case"UINT16":case"INT32":case"UINT32":t=rn.SHORT_INT_TYPE;break;case"FLOAT32":case"FLOAT64":t=rn.DOUBLE_TYPE;break;case"INT64":case"UINT64":t=rn.STRING_TYPE;break;default:t=rn.STRING_TYPE;break}return t};var Ek=e=>{let t=new Uint32Array(e);for(let r=0;r<e;r++)t[r]=r;return t};var EDt={},BCt=1,FCt=1,Ps=3,Py=2,OCt=4,ICt="string",PCt="Int32",RCt="Float64",jCt="Oid32",fEe=["CUSTOM_ATTRIBUTE_2","_BATCHID","BATCHID"],Qf=new Z;async function TN({tileContent:e,tileTransform:t,tileBoundingVolume:r,addNodeToNodePage:n,propertyTable:a,featuresHashArray:i,attributeStorageInfo:o,draco:s,generateBoundingVolumes:u,shouldMergeMaterials:c,geoidHeightModel:l,libraries:f,metadataClass:p}){var w;let d=u,h=await YCt((w=e.gltf)==null?void 0:w.materials,c),m=nEe(e,t,r),g=iEe(e,p),x=await qCt(m,h,d,g);u&&LCt(x,l);let y=[];for(let T of h){let A=T.mergedMaterials[0].originalMaterialId;if(!x.has(A))continue;let B=x.get(A);if(!B)continue;let{material:I,texture:L}=T,C=await n();y.push(await MCt({convertedAttributes:B,material:I,texture:L,tileContent:e,nodeId:C,featuresHashArray:i,propertyTable:a,attributeStorageInfo:o,draco:s,libraries:f}))}return y.length?y:null}function LCt(e,t){for(let r of e.values()){let n=tEe(r.positions,t);r.boundingVolumes=n;let a=n.obb.center;for(let i=0;i<r.positions.length;i+=Ps){let o=r.positions.subarray(i,i+Ps);Ft.WGS84.cartesianToCartographic(Array.from(o),Qf),t&&(Qf[2]=Qf[2]-t.getHeight(Qf[1],Qf[0])),Qf=Qf.subtract(a),r.positions.set(Qf,i)}}}async function MCt({convertedAttributes:e,material:t,texture:r,tileContent:n,nodeId:a,featuresHashArray:i,propertyTable:o,attributeStorageInfo:s,draco:u,libraries:c}){var k;let l=e.boundingVolumes,f=e.positions.length/Ps,{faceRange:p,featureIds:d,positions:h,normals:m,colors:g,uvRegions:x,texCoords:y,featureCount:w}=ZAe(e),T={};o&&(T=uDt(d,e.featureIndices,i,o));let A=new Uint32Array(2),B=bDt(d);A.set([f,w],0);let I=new Uint8Array(bn(A.buffer,h.buffer,m.buffer,r?y.buffer:new ArrayBuffer(0),g.buffer,x,B.buffer,p.buffer)),L=u?vDt(f,e,{positions:h,normals:m,texCoords:r?y:new Float32Array(0),colors:g,uvRegions:x,featureIds:d,faceRange:p},c):null,C=[];return s&&o&&(C=pDt(d,T,o,s)),{nodeId:a,geometry:I,compressedGeometry:L,texture:r,hasUvRegions:Boolean(x.length),sharedResources:nDt(((k=n.gltf)==null?void 0:k.materials)||[],a),meshMaterial:t,vertexCount:f,attributes:C,featureCount:w,boundingVolumes:l}}async function qCt(e,t,r,n){let{nodes:a,images:i,cartographicOrigin:o,cartesianModelMatrix:s}=e,u=new Map;for(let c of t){let l={positions:new Float32Array(0),normals:new Float32Array(0),texCoords:new Float32Array(0),colors:new Uint8Array(0),uvRegions:new Uint16Array(0),featureIndicesGroups:[],featureIndices:[],boundingVolumes:null,mergedMaterials:c.mergedMaterials};for(let f of c.mergedMaterials)u.set(f.originalMaterialId,l)}bEe({nodes:a,images:i,cartographicOrigin:o,cartesianModelMatrix:s,attributesMap:u,useCartesianPositions:r,featureTexture:n});for(let c of u.keys()){let l=u.get(c);if(l){if(l.positions.length===0){u.delete(c);continue}l.featureIndicesGroups&&(l.featureIndices=l.featureIndicesGroups.reduce((f,p)=>f.concat(p)),delete l.featureIndicesGroups)}}return u}function bEe({nodes:e,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:a,useCartesianPositions:i,matrix:o=new mr([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),featureTexture:s}){if(e)for(let u of e)UCt({node:u,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:a,useCartesianPositions:i,matrix:o,featureTexture:s})}function NCt(e,t){let r=t,{matrix:n,rotation:a,scale:i,translation:o}=e;return n&&(r=t.multiplyRight(n)),o&&(r=r.translate(o)),a&&(r=r.rotateXYZ(a)),i&&(r=r.scale(i)),r}function UCt({node:e,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:a,useCartesianPositions:i,matrix:o=new mr([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),featureTexture:s}){let u=NCt(e,o),c=e.mesh;c&&zCt({mesh:c,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:a,useCartesianPositions:i,matrix:u,featureTexture:s}),bEe({nodes:e.children||[],images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:a,useCartesianPositions:i,matrix:u,featureTexture:s})}function zCt({mesh:e,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:a,useCartesianPositions:i=!1,matrix:o,featureTexture:s}){var u;for(let c of e.primitives){let l=null,f;c.material?(l=a.get(c.material.id),f=(u=l==null?void 0:l.mergedMaterials.find(({originalMaterialId:h})=>{var m;return h===((m=c.material)==null?void 0:m.id)}))==null?void 0:u.uvRegion):a.has("default")&&(l=a.get("default")),yt(l!==null,"Primitive - material mapping failed"),yt(c.mode===void 0||c.mode===ht.TRIANGLES||c.mode===ht.TRIANGLE_STRIP,`Primitive - unsupported mode ${c.mode}`);let p=c.attributes;if(!l)continue;let d=GCt(c);l.positions=Wi(l.positions,pEe({vertices:p.POSITION.value,cartographicOrigin:r,cartesianModelMatrix:n,nodeMatrix:o,indices:d,attributeSpecificTransformation:HCt,useCartesianPositions:i})),l.normals=Wi(l.normals,pEe({vertices:p.NORMAL&&p.NORMAL.value,cartographicOrigin:r,cartesianModelMatrix:n,nodeMatrix:o,indices:d,attributeSpecificTransformation:VCt,useCartesianPositions:!1})),l.texCoords=Wi(l.texCoords,$Ct(p.TEXCOORD_0&&p.TEXCOORD_0.value,d)),l.colors=Wi(l.colors,WCt(p.COLOR_0,d)),f&&(l.uvRegions=Wi(l.uvRegions,KCt(f,d))),l.featureIndicesGroups=l.featureIndicesGroups||[],l.featureIndicesGroups.push(JCt(XCt(p,c,t,s),d))}}function GCt(e){var r;let t=(r=e.indices)==null?void 0:r.value;if(!t){let n=e.attributes.POSITION.value;return Ek(n.length/Ps)}if(t&&e.mode===ht.TRIANGLE_STRIP){let n=t.constructor,a=new n((t.length-2)*3),i=0,o=t.slice(0,3);a.set(o,0);for(let s=1;s+2<t.length;s++)i+=3,o=t.slice(s,s+3),s%2===0?a.set(o,i):a.set(o.reverse(),i);t=a}return t}function pEe(e){let{vertices:t,indices:r,attributeSpecificTransformation:n}=e,a=new Float32Array(r.length*Ps);if(!t)return a;for(let i=0;i<r.length;i++){let o=r[i]*Ps,s=t.subarray(o,o+Ps),u=new Z(Array.from(s));u=n(u,e),a[i*Ps]=u.x,a[i*Ps+1]=u.y,a[i*Ps+2]=u.z}return a}function HCt(e,t){let{cartesianModelMatrix:r,cartographicOrigin:n,nodeMatrix:a,useCartesianPositions:i}=t;return a&&(e=e.transform(a)),e=e.transform(r),i||(Ft.WGS84.cartesianToCartographic([e[0],e[1],e[2]],e),e=e.subtract(n)),e}function VCt(e,t){let{cartesianModelMatrix:r,nodeMatrix:n}=t;return n&&(e=e.transformAsVector(n)),e=e.transformAsVector(r),e}function $Ct(e,t){let r=new Float32Array(t.length*Py);if(!e)return r.fill(1),r;for(let n=0;n<t.length;n++){let a=t[n]*Py,i=e.subarray(a,a+Py);r[n*Py]=i[0],r[n*Py+1]=i[1]}return r}function WCt(e,t){let r=(e==null?void 0:e.components)||OCt,n=new Uint8Array(t.length*r);if(!e)return n.fill(255),n;let a=e.value;for(let i=0;i<t.length;i++){let o=t[i]*r,s=a.subarray(o,o+r),u=new Uint8Array(r);for(let c=0;c<s.length;c++)u[c]=s[c]*255;n.set(u,i*r)}return n}function KCt(e,t){let r=new Uint16Array(t.length*4);for(let n=0;n<r.length;n+=4)r.set(e,n);return r}function JCt(e,t){if(!e.length||!t.length)return[];let r=[];for(let n=0;n<t.length;n++){let a=t[n];r.push(e[a])}return r}function XCt(e,t,r,n){let a=oEe(e,t,r,n);if(a.length)return a;for(let i=0;i<fEe.length;i++){let o=fEe[i];if(e[o]&&e[o].value)return e[o].value}return[]}async function YCt(e=[],t){let r=[];for(let n of e)r.push(eDt(n));return t&&(r=await QCt(r)),r}async function QCt(e){var r,n;let t=[];for(;e.length>0;){let a=e.splice(0,1)[0],i=[];for(let o=0;o<e.length;o++){let s=e[o];(a.texture&&s.texture||!a.texture&&!s.texture)&&(a=await ZCt(a,s),i.push(o))}if(a.texture&&i.length){let o=(r=a.mergedMaterials)==null?void 0:r.reduce((c,{textureSize:l})=>c+((l==null?void 0:l.width)||0),0),s=(n=a.mergedMaterials)==null?void 0:n.reduce((c,{textureSize:l})=>Math.max(c,(l==null?void 0:l.height)||0),0),u=-1;for(let c of a.mergedMaterials)if(c.textureSize){let l=u+1+c.textureSize.width/o*2**(Uint16Array.BYTES_PER_ELEMENT*8)-1;c.uvRegion=new Uint16Array([u+1,0,l,c.textureSize.height/s*2**(Uint16Array.BYTES_PER_ELEMENT*8)-1]),u=l}a.texture.image.width=o,a.texture.image.height=s}for(let o of i.reverse())e.splice(o,1);t.push(a)}return t.length||t.push({material:rDt(),mergedMaterials:[{originalMaterialId:"default"}]}),t}async function ZCt(e,t){var r,n;if((r=e.texture)!=null&&r.bufferView&&((n=t.texture)!=null&&n.bufferView)&&e.mergedMaterials&&t.mergedMaterials){let a=Buffer.from(e.texture.bufferView.data),i=Buffer.from(t.texture.bufferView.data);try{let{joinImages:o}=await import("join-images"),s=await o([a,i],{direction:"horizontal"});e.texture.bufferView.data=await s.toFormat(e.texture.mimeType==="image/png"?"png":"jpeg").toBuffer()}catch(o){throw console.log("Join images into a texture atlas has failed. Consider usage `--split-nodes` option. (See documentation https://loaders.gl/modules/tile-converter/docs/cli-reference/tile-converter)"),o}e.material.pbrMetallicRoughness.baseColorTexture.textureSetDefinitionId=1}return e.mergedMaterials=e.mergedMaterials.concat(t.mergedMaterials),e}function eDt(e){var a,i,o,s,u;let t={doubleSided:e.doubleSided,emissiveFactor:(a=e.emissiveFactor)==null?void 0:a.map(c=>Math.round(c*255)),alphaMode:tDt(e.alphaMode),pbrMetallicRoughness:{roughnessFactor:((i=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:i.roughnessFactor)||BCt,metallicFactor:((o=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:o.metallicFactor)||FCt}},r;(s=e==null?void 0:e.pbrMetallicRoughness)!=null&&s.baseColorTexture?(r=e.pbrMetallicRoughness.baseColorTexture.texture.source,t.pbrMetallicRoughness.baseColorTexture={textureSetDefinitionId:0}):e.emissiveTexture&&(r=e.emissiveTexture.texture.source,t.pbrMetallicRoughness.baseColorTexture={textureSetDefinitionId:0}),e.id=Number.isFinite(e.id)?e.id:Ju();let n=[{originalMaterialId:e.id}];if(r)n[0].textureSize={width:r.image.width,height:r.image.height};else{let c=(u=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:u.baseColorFactor;t.pbrMetallicRoughness.baseColorFactor=c&&c.map(l=>Math.round(l*255))||void 0}return{material:t,texture:r,mergedMaterials:n}}function tDt(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend";default:return"opaque"}}function rDt(){return{alphaMode:"opaque",pbrMetallicRoughness:{metallicFactor:1,roughnessFactor:1}}}function nDt(e,t){let r={};if(!e||!e.length)return r;r.materialDefinitionInfos=[];for(let n of e){let{materialDefinitionInfo:a,textureDefinitionInfo:i}=aDt(n,t);r.materialDefinitionInfos.push(a),i&&(r.textureDefinitionInfos=r.textureDefinitionInfos||[],r.textureDefinitionInfos.push(i))}return r}function aDt(e,t){var s;let r=((s=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:s.baseColorTexture)||e.emissiveTexture,n=null;r&&(n=oDt(r.texture,t));let{baseColorFactor:a,metallicFactor:i}=(e==null?void 0:e.pbrMetallicRoughness)||{},o=a;return(!a||a[3]===0)&&e.emissiveFactor&&(o=e.emissiveFactor,o[3]=o[3]||1),{materialDefinitionInfo:iDt(o||[1,1,1,1],i),textureDefinitionInfo:n}}function iDt(e,t=1){let r=.00015686274509803922,n=new Oo(0,0,0,1),a=new Oo(1,1,1,1),i=new Oo(r,r,r,0),o=new Oo(e),s=a.subtract(i).multiply(o),u=s.lerp(s,n,t);i[3]=1;let c=i.lerp(i,o,t);return{params:{diffuse:u.toArray(),specular:c.toArray(),renderMode:"solid"}}}function oDt(e,t){var r,n,a,i;return{encoding:(r=e==null?void 0:e.source)!=null&&r.mimeType?[e.source.mimeType]:void 0,images:[{id:sDt(e,t),size:(n=e.source)==null?void 0:n.image.width,length:(a=e.source)!=null&&a.image.data.length?[(i=e.source)==null?void 0:i.image.data.length]:void 0}]}}function sDt(e,t){var m;let{width:r,height:n}=((m=e.source)==null?void 0:m.image)||{};if(!r||!n)return"";let a=1,i=0,o=t+1,s=32-o.toString(2).length,u="0".repeat(s).concat(o.toString(2)),c=a<<28,l=i<<24,f=r-1<<12,p=n-1<<0,d=c+l+f+p;return BigInt(`0b${d.toString(2)}${u}`).toString()}function uDt(e,t,r,n){let a=cDt(e,n,r);return dEe(t,a),dEe(e,a),a}function cDt(e,t,r){let n={};for(let a=0;a<e.length;a++){let i=e[a],o=fDt(a,t,r);n[i.toString()]=o}return n}function lDt(e,t){let r="";for(let n in e)r+=e[n][t];return r}function fDt(e,t,r){let n=lDt(t,e),a=(0,gEe.default)(n);return r.includes(a)?r.indexOf(a):r.push(a)-1}function dEe(e,t){for(let r=0;r<e.length;r++)e[r]=t[e[r]]}function pDt(e,t,r,n){let a=[],o=uEe(e,r)?sEe(t,r):r,s={OBJECTID:e,...o};for(let u in s){let c=hDt(u,n);if(c){let l=s[u],f=dDt(c,l);a.push(f)}}return a}function dDt(e,t){let r;switch(e){case jCt:case PCt:r=mDt(t);break;case RCt:r=gDt(t);break;case ICt:r=hEe(t);break;default:r=hEe(t)}return r}function hDt(e,t){let r=t.find(n=>n.name===e);return r?r.attributeValues?r.attributeValues.valueType:(console.error(`attributeValues is null, attribute=${r}`),""):(console.error(`attribute is null, key=${e}, attributeStorageInfo=${JSON.stringify(t,null,2)}`),"")}function mDt(e){let t=new Uint32Array([e.length]),r=new Uint32Array(e);return bn(t.buffer,r.buffer)}function gDt(e){let t=new Uint32Array([e.length]),r=new Uint8Array(4),n=new Float64Array(e);return bn(t.buffer,r.buffer,n.buffer)}function hEe(e){let t=new Uint32Array([e.length]),r=0,n=new Uint32Array(e.length),a=[];for(let o=0;o<e.length;o++){let s=`${String(e[o])}\0`,u=Buffer.from(s),c=u.length;r+=c,n[o]=c,a.push(u)}let i=new Uint32Array([r]);return bn(t.buffer,i.buffer,n.buffer,...a)}function bDt(e){let t=new BigUint64Array(e.length);for(let r=0;r<e.length;r++)t[r]=BigInt(e[r]);return t}async function vDt(e,t,r,n){let{positions:a,normals:i,texCoords:o,colors:s,uvRegions:u,featureIds:c,faceRange:l}=r,f=new Uint32Array(e);for(let g=0;g<f.length;g++)f.set([g],g);let p=new Uint32Array(t.featureIndices.length?t.featureIndices:e),d=yDt(p,l),h={positions:a,normals:i,colors:s,"feature-index":d};o.length&&(h.texCoords=o);let m={"feature-index":{"i3s-attribute-type":"feature-index","i3s-feature-ids":new Int32Array(c)}};return u.length&&(h["uv-region"]=u,m["uv-region"]={"i3s-attribute-type":"uv-region"}),$m({attributes:h,indices:f},MS,{...MS.options,reuseWorkers:!0,_nodeWorkers:!0,modules:n,useLocalLibraries:!0,draco:{method:"MESH_SEQUENTIAL_ENCODING",attributesMetadata:m},["draco-writer"]:{workerUrl:xDt()}})}function xDt(){try{let t=(0,mEe.createRequire)(EDt.url).resolve("@loaders.gl/draco/package.json");return(0,Sk.join)((0,Sk.dirname)(t),"src/workers/draco-writer-worker-node.cjs")}catch{return"./modules/draco/src/workers/draco-writer-worker-node.cjs"}}function yDt(e,t){let r=new Uint32Array(e.length),n=0,a=0;for(let i=1;i<t.length;i+=2){let o=(t[i]+1)*Ps;r.fill(n,a,o),n++,a=o+1}return r}function vEe(e,t){if(!e)return null;let r,n=e.batchTableJson;if(n)return n;let{extensionName:a,extension:i}=ADt(e);switch(a){case Xc:return r=_Dt(i,t),r;case Ro:return r=wDt(i,t),r;default:return null}}function _Dt(e,t){if(e.propertyTables){for(let r of e.propertyTables)if(r.class===t||!t)return Tk(r)}if(e.propertyTextures){for(let r of e.propertyTextures)if(r.class===t||!t)return Tk(r)}return null}function wDt(e,t){if(e.featureTables)for(let r in e.featureTables){let n=e.featureTables[r];if(n.class===t||!t)return Tk(n)}if(e.featureTextures)for(let r in e.featureTextures){let n=e.featureTextures[r];if(n.class===t||!t)return Tk(n)}return null}function Tk(e){let t={};for(let r in e.properties)t[r]=e.properties[r].data;return t}function ADt(e){var i,o,s,u;let t=[Ro,Xc];if(!((i=e==null?void 0:e.gltf)==null?void 0:i.extensionsUsed))return{extensionName:null,extension:null};let n="";for(let c of((o=e==null?void 0:e.gltf)==null?void 0:o.extensionsUsed)||[])if(t.includes(c)){n=c;break}if(!n)return{extensionName:null,extension:null};let a=(u=(s=e==null?void 0:e.gltf)==null?void 0:s.extensions)==null?void 0:u[n];return{extensionName:n,extension:a}}var yEe=Ct(Is(),1),_Ee=require("path");var xEe=()=>({serviceItemId:{path:"serviceItemId"},serviceName:{path:"layerName"},name:{path:"layerName"},currentVersion:{path:"currentVersion",default:10.7},serviceVersion:{path:"serviceVersion",default:"1.8"},supportedBindings:{path:"supportedBindings",default:["REST"]},layers:{path:"layers0",transform:e=>[e]}});async function wEe(e,t,r){let n={serviceItemId:Ju().replace(/-/gi,""),layerName:e,layers0:t},a=(0,yEe.default)(n,xEe()),i=(0,_Ee.join)(r,"SceneServer");await Oi(i,JSON.stringify(a))}var SN=16;function AEe(e,t){let r=[],n=e.boundingVolume,a=e.lodMetricValue||.1,i={metricType:"maxScreenThreshold",maxError:t.mbs[3]*2*SN/a},o={metricType:"maxScreenThresholdSQ",maxError:Math.PI*.25*i.maxError*i.maxError};return n.constructor.name==="OrientedBoundingBox"?(r.push(o),r.push(i)):(r.push(i),r.push(o)),r}function kN(e){var n,a;let t=(n=e.lodSelection)==null?void 0:n.find(i=>i.metricType==="maxScreenThreshold"),r=t==null?void 0:t.maxError;if(!r){let i=(a=e.lodSelection)==null?void 0:a.find(o=>o.metricType==="maxScreenThresholdSQ");i&&(r=Math.sqrt(i.maxError/(Math.PI*.25)))}return r||(r=SN),e.mbs[3]*2*SN/r}var TDt=[9,-18,-88,0,96,90,0,0,-60,-20,-9,18,8,0,-96,30,0,0,60,-20,9,-88,-18,90,96,0,-20,-60,0,0,186,-42,-42,-150,-96,-150,60,60,60,60,54,162,-78,30,-24,-90,-60,60,-60,60,-9,-32,18,30,24,0,20,-60,0,0,-9,8,18,30,-96,0,-20,60,0,0,54,-78,162,-90,-24,30,60,-60,60,-60,-54,78,78,90,144,90,-60,-60,-60,-60,9,-8,-18,-30,-24,0,20,60,0,0,-9,18,-32,0,24,30,0,0,-60,20,9,-18,-8,0,-24,-30,0,0,60,20],SDt=372,kDt=[0,0,-131,0,138,144,0,0,-102,-31,0,0,7,0,-138,42,0,0,102,-31,62,0,-31,0,0,-62,0,0,0,31,124,0,-62,0,0,-124,0,0,0,62,124,0,-62,0,0,-124,0,0,0,62,62,0,-31,0,0,-62,0,0,0,31,0,0,45,0,-183,-9,0,93,18,0,0,0,216,0,33,87,0,-93,12,-93,0,0,156,0,153,99,0,-93,-12,-93,0,0,-45,0,-3,9,0,93,-18,0,0,0,-55,0,48,42,0,0,-84,31,0,0,-7,0,-48,-42,0,0,84,31],CDt=372,DDt=[18,-36,-122,0,120,135,0,0,-84,-31,-18,36,-2,0,-120,51,0,0,84,-31,36,-165,-27,93,147,-9,0,-93,18,0,210,45,-111,-93,-57,-192,0,93,12,93,162,141,-75,-93,-129,-180,0,93,-12,93,-36,-21,27,93,39,9,0,-93,-18,0,0,0,62,0,0,31,0,0,0,-31,0,0,124,0,0,62,0,0,0,-62,0,0,124,0,0,62,0,0,0,-62,0,0,62,0,0,31,0,0,0,-31,-18,36,-64,0,66,51,0,0,-102,31,18,-36,2,0,-66,-51,0,0,102,31],BDt=12,CN=(3+1)*(3+2)/2,FDt=2,Yg=class{constructor(t){this._v00=0,this._v01=0,this._v10=0,this._v11=0,this._t=[],this.options=t,this._ix=this.options._width,this._iy=this.options._height}getHeight(t,r){if(t=Math.abs(t)>90?NaN:t,isNaN(t)||isNaN(r))return NaN;let n=ODt(r,360);r=n!==-180?n:180;let a=r*this.options._rlonres,i=-t*this.options._rlatres,o=Math.floor(a),s=Math.min(Math.round((this.options._height-1)/2-1),Math.floor(i));a-=o,i-=s,s+=(this.options._height-1)/2,o+=o<0?this.options._width:o>=this.options._width?-this.options._width:0;let u=0,c=0,l=0,f=0,p=new Array(CN);if(o===this._ix&&s===this._iy)this.options.cubic?p=this._t:(u=this._v00,c=this._v01,l=this._v10,f=this._v11);else if(!this.options.cubic)u=this._rawval(o,s),c=this._rawval(o+1,s),l=this._rawval(o,s+1),f=this._rawval(o+1,s+1);else{let h=[this._rawval(o,s-1),this._rawval(o+1,s-1),this._rawval(o-1,s),this._rawval(o,s),this._rawval(o+1,s),this._rawval(o+2,s),this._rawval(o-1,s+1),this._rawval(o,s+1),this._rawval(o+1,s+1),this._rawval(o+2,s+1),this._rawval(o,s+2),this._rawval(o+1,s+2)],m=kDt;s!==0&&(m=s===this.options._height-2?DDt:TDt);let g=SDt;s!==0&&(g=s===this.options._height-2?CDt:240);for(let x=0;x<CN;++x){p[x]=0;for(let y=0;y<BDt;++y)p[x]+=h[y]*m[CN*y+x];p[x]/=g}}if(!this.options.cubic){let h=(1-a)*u+a*c,m=(1-a)*l+a*f,g=(1-i)*h+i*m,x=this.options._offset+this.options._scale*g;return this._ix=o,this._iy=s,this._v00=u,this._v01=c,this._v10=l,this._v11=f,x}let d=p[0]+a*(p[1]+a*(p[3]+a*p[6]))+i*(p[2]+a*(p[4]+a*p[7])+i*(p[5]+a*p[8]+i*p[9]));return d=this.options._offset+this.options._scale*d,this._ix=o,this._iy=s,this._t=p,d}_rawval(t,r){t<0?t+=this.options._width:t>=this.options._width&&(t-=this.options._width),(r<0||r>=this.options._height)&&(r=r<0?-r:2*(this.options._height-1)-r,t+=(t<this.options._width/2?1:-1)*this.options._width/2);let n=this.options._datastart+FDt*(r*this.options._swidth+t),a=this.options.data[n],i=this.options.data[n+1];return a<<8|i}};function ODt(e,t){t=Math.abs(t);let r=EEe(e,t);return 2*Math.abs(r)===t?r-=EEe(e,2*t)-r:2*Math.abs(r)>t&&(r+=r<0?t:-t),r}function EEe(e,t){return e-Math.floor(e/t)*t}var IDt=10,PDt=65535;function DN(e,t){let r=RDt(e),n=r.next();if(n.done||n.value.line!=="P5")throw new Error("Geoid model file: File not in PGM format");let a=Number.MAX_VALUE,i=0,o=-1,s=-1,u="NONE",c="UNKNOWN",l=0,f=0,p=null,d=null;do{n=r.next();let x=n.value.line;if(x.length)if(x[0]==="#"){let y=x.split(" "),w=y[0],T=y[1];if(w!=="#"||!T)continue;let A=y.length>2?y.slice(2):[];if(T==="Description")u=A.join(" ");else if(T==="DateTime")c=A.join(" ");else if(T==="Offset"){if(!y[2])throw new Error("Geoid model file: Error reading offset");a=parseInt(y[2],10)}else if(T==="Scale"){if(!y[2])throw new Error("Geoid model file: Error reading scale");i=parseFloat(y[2])}else T===(t.cubic?"MaxCubicError":"MaxBilinearError")?isFinite(parseFloat(y[2]))&&(o=parseFloat(y[2])):T===(t.cubic?"RMSCubicError":"RMSBilinearError")&&isFinite(parseFloat(y[2]))&&(s=parseFloat(y[2]))}else{let y=x.split(" ");if(y=y.filter(w=>w!==""),l=parseInt(y[0],10),f=parseInt(y[1],10),!(l&&f))throw new Error("Geoid model file: Error reading raster size");break}}while(!n.done);n=r.next();let h=parseInt(n.value.line,10);if(n.done)throw new Error("Geoid model file: Error reading maxval");if(h!==PDt)throw new Error("Geoid model file: Incorrect value of maxval");if(p=n.value.offset,d=l,a===Number.MAX_VALUE)throw new Error("Geoid model file: Offset not set");if(i===0)throw new Error("Geoid model file: Scale not set");if(i<0)throw new Error("Geoid model file: Scale must be positive");if(f<2||l<2)throw new Error("Geoid model file: Raster size too small");if(l&1)throw new Error("Geoid model file: Raster width is odd");if(!(f&1))throw new Error("Geoid model file: Raster height is even");let m=l/360,g=(f-1)/180;return new Yg({cubic:t.cubic,_width:l,_height:f,_rlonres:m,_rlatres:g,_offset:a,_scale:i,_swidth:d,_datastart:p,_maxerror:o,_rmserror:s,_description:u,_datetime:c,data:e})}function*RDt(e){let t=0;do{let r=e.indexOf(IDt,t);if(r!==-1){let n=e.subarray(t,r);t=r+1,yield{offset:t,line:TEe(n)}}else{let n=e.subarray(t,e.length);t=e.length,yield{offset:t,line:TEe(n)}}}while(t<e.length);return{offset:t,line:""}}function TEe(e){let t="";for(let r of e)t+=String.fromCharCode(r);return t}var jDt="4.4.0";var kk={dataType:null,batchType:null,name:"PGM - Netpbm grayscale image format",id:"pgm",module:"tile-converter",version:jDt,mimeTypes:["image/x-portable-graymap"],parse:async(e,t)=>DN(new Uint8Array(e),(t==null?void 0:t.pgm)||{}),extensions:["pgm"],options:{pgm:{cubic:!1}}};var Qg=Ct(Is(),1);var SEe={id:{path:"id",transform:e=>e.toUpperCase()},profile:{path:"profile",default:"meshpyramids"},version:{path:"version",default:"1.8"},resourcePattern:{path:"resourcePattern",default:["3dNodeIndexDocument","Attributes","SharedResource","Geometry"]},rootNode:{path:"rootNode",default:"./nodes/root"},extent:{path:"extent"},indexCRS:{path:"indexCRS",default:"http://www.opengis.net/def/crs/EPSG/0/4326"},vertexCRS:{path:"vertexCRS",default:"http://www.opengis.net/def/crs/EPSG/0/4326"},normalReferenceFrame:{path:"normalReferenceFrame",default:"east-north-up"},attributeEncoding:{path:"attributeEncoding",default:"application/octet-stream; version=1.6"},textureEncoding:{path:"textureEncoding",default:["image/jpeg","image/ktx2"]},lodType:{path:"lodType",default:"MeshPyramid"},lodModel:{path:"lodModel",default:"node-switching"},defaultGeometrySchema:{path:"defaultGeometrySchema",default:{geometryType:"triangles",header:[{property:"vertexCount",type:"UInt32"},{property:"featureCount",type:"UInt32"}],topology:"PerAttributeArray",ordering:["position","normal","uv0","color"],vertexAttributes:{position:{valueType:"Float32",valuesPerElement:3},normal:{valueType:"Float32",valuesPerElement:3},uv0:{valueType:"Float32",valuesPerElement:2},color:{valueType:"UInt8",valuesPerElement:4}},featureAttributeOrder:["id","faceRange"],featureAttributes:{id:{valueType:"UInt64",valuesPerElement:1},faceRange:{valueType:"UInt32",valuesPerElement:2}}}}};var LDt=()=>({wkid:{path:"wkid",default:4326},latestWkid:{path:"latestWkid",default:4326},vcsWkid:{path:"vcsWkid",default:5773},latestVcsWkid:{path:"latestVcsWkid",default:5773}}),MDt=()=>({heightModel:{path:"heightModel",default:"gravity_related_height"},vertCRS:{path:"vertCRS",default:"EGM96_Geoid"},heightUnit:{path:"heightUnit",default:"meter"}}),qDt=()=>({nodesPerPage:{path:"nodesPerPage"},lodSelectionMetricType:{path:"lodSelectionMetricType",default:"maxScreenThresholdSQ"}}),NDt=()=>({xmin:{path:"xmin"},ymin:{path:"ymin"},xmax:{path:"xmax"},ymax:{path:"ymax"},zmin:{path:"zmin"},zmax:{path:"zmax"}}),kEe=()=>({version:{path:"version",transform:e=>e.toUpperCase()},id:{path:"id",default:0},name:{path:"name"},href:{path:"href",default:"./layers/0"},layerType:{path:"layerType",default:"IntegratedMesh"},spatialReference:{path:"spatialReference",transform:e=>(0,Qg.default)(e,LDt())},capabilities:{path:"capabilities",default:["View","Query"]},store:{path:"store",transform:e=>(0,Qg.default)(e,SEe)},fullExtent:{path:"fullExtent",transform:e=>(0,Qg.default)(e,NDt())},heightModelInfo:{path:"heightModelInfo",transform:e=>(0,Qg.default)(e,MDt())},nodePages:{path:"nodePages",transform:e=>(0,Qg.default)(e,qDt())},materialDefinitions:{path:"materialDefinitions",default:[]},textureSetDefinitions:{path:"textureSetDefinitions",default:[]},geometryDefinitions:{path:"geometryDefinitions",default:[]},attributeStorageInfo:{path:"attributeStorageInfo",default:[]},fields:{path:"fields",default:[]},popupInfo:{path:"popupInfo",default:null}});var BN=Ct(Is(),1),UDt=()=>({offset:{default:8},position:{default:{type:"Float32",component:3}},normal:{default:{type:"Float32",component:3}},uv0:{path:"hasTexture",transform:e=>e&&{type:"Float32",component:2}||!1,omitValues:[!1]},color:{default:{type:"UInt8",component:4}},uvRegion:{path:"hasUvRegions",transform:e=>e&&{type:"UInt16",component:4}||!1,omitValues:[!1]},featureId:{default:{binding:"per-feature",type:"UInt64",component:1}},faceRange:{default:{binding:"per-feature",type:"UInt32",component:2}}}),zDt=()=>({"compressedAttributes.encoding":{default:"draco"},"compressedAttributes.attributes":{path:"geometryConfig",transform:e=>{let t=["position","normal"];return e.hasTexture&&t.push("uv0"),t.push("color"),e.hasUvRegions&&t.push("uv-region"),t.push("feature-index"),t}}}),CEe=()=>({geometryBuffers:{path:"geometryConfig",transform:e=>{let t=[(0,BN.default)(e,UDt())];return e.draco&&t.push((0,BN.default)({geometryConfig:e},zDt())),t}}});var Ry=Ct(Is(),1),GDt=()=>({renderMode:{path:"renderMode",default:"solid"},shininess:{path:"shininess",default:1},reflectivity:{path:"reflectivity",default:0},ambient:{path:"ambient",default:[1,1,1]},diffuse:{path:"diffuse",default:[1,1,1]},specular:{path:"specular",default:[0,0,0]},useVertexColorAlpha:{path:"useVertexColorAlpha",default:!1},vertexRegions:{path:"vertexRegions",default:!1},vertexColors:{path:"vertexColors",default:!0}}),HDt=()=>({name:{path:"name",default:"standard"},type:{path:"type",default:"standard"},params:{path:"params",transform:(e,t,r)=>(0,Ry.default)(r,GDt())}}),VDt=()=>({id:{path:"id"},size:{path:"size"},href:{path:"href",default:["../textures/0"]},length:{path:"length"}}),$Dt=()=>({encoding:{path:"encoding"},wrap:{path:"wrap",default:["none"]},atlas:{path:"atlas",default:!1},uvSet:{path:"uvSet",default:"uv0"},channels:{path:"channels",default:"rgb"},images:{path:"images",transform:(e,t,r)=>e.map(n=>(0,Ry.default)(n,VDt()))}}),DEe=()=>({materialDefinitions:{path:"materialDefinitionInfos",transform:WDt},textureDefinitions:{path:"textureDefinitionInfos",transform:KDt}});function WDt(e,t,r){let n={};for(let[a,i]of e.entries())n[`Mat${r.nodePath}${a}`]=(0,Ry.default)(i,HDt());return n}function KDt(e,t,r){if(!e)return null;let n={};for(let[a,i]of e.entries()){let o=`${r.nodePath}${a}`;i.imageIndex=o,n[o]=(0,Ry.default)(i,$Dt())}return n}var JDt=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]);function FEe(e){var r,n;if(!((r=e==null?void 0:e.parentNode)!=null&&r.obb)||!((n=e==null?void 0:e.parentNode)!=null&&n.mbs))return[];let t=[];return XDt(t,e),YDt(t,e),t}function XDt(e,t){var o;let r=QDt(t.parentNode.obb),n=ZDt(t);if(e5t(r,n))return;let i=`OBB of Tile (${t.id}) doesn't fit into Parent (${(o=t.parentNode)==null?void 0:o.id}) tile OBB`;e.push(i)}function YDt(e,t){var i;let r=BEe(t.mbs),n=BEe(t.parentNode.mbs);if(r.center.distanceTo(n.center)+r.radius>n.radius){let o=`MBS of Tile (${t.id}) doesn't fit into Parent (${(i=t.parentNode)==null?void 0:i.id}) tile MBS`;e.push(o)}}function BEe(e){return new ui([e[0],e[1],e[2]],e[3])}function QDt(e){let{center:t,halfSize:r,quaternion:n}=e;return new fa().fromCenterHalfSizeQuaternion(t,r,n)}function ZDt(e){let t=e.obb.halfSize,r=JDt,n=Ft.WGS84.cartographicToCartesian(e.obb.center),a=[];for(let i=0;i<r.length;i+=3){let s=new Z(r[i]*=t[0],r[i+1]*=t[1],r[i+2]*=t[2]).transformByQuaternion(e.obb.quaternion).add(n);a=a.concat(s)}return a}function e5t(e,t){let r=!0;for(let n=0;n<t.length/3;n+=3){let a=[t[n],t[n+1],t[n+2]],i=Ft.WGS84.cartesianToCartographic(a);if(e.distanceTo(i)>0){r=!1;break}}return r}var Ck=class extends Array{enqueue(t){this.push(t)}dequeue(){return this.shift()}peek(){return this[0]}isEmpty(){return this.length===0}};var OEe=Ct(require("process"),1),t5t=4*1024*1024*1024,Zg=class extends Ck{intervalId;conversionDump;writePromise=null;fileMap={};listeningInterval;writeConcurrency;constructor(t,r=2e3,n=400){super(),this.conversionDump=t,this.listeningInterval=r,this.writeConcurrency=n}async enqueue(t,r=!1){if(r){let{archiveKey:n,writePromise:a}=t,i=await a();n&&i&&(this.fileMap[n]=i)}else super.enqueue(t),OEe.default.memoryUsage().rss>t5t&&await this.startWrite()}startListening(){this.intervalId=setInterval(()=>this.startWrite.bind(this),this.listeningInterval)}stopListening(){this.intervalId&&clearInterval(this.intervalId)}async startWrite(){this.writePromise||(this.writePromise=this.doWrite()),await this.writePromise,this.writePromise=null}async finalize(){this.stopListening(),await this.startWrite()}async doWrite(){for(;this.length;){let t=[],r=[],n=[];for(let i=0;i<this.writeConcurrency;i++){let o=this.dequeue();if(!o)break;let{archiveKey:s,sourceId:u,outputId:c,resourceType:l,writePromise:f}=o;r.push(s),n.push({sourceId:u,outputId:c,resourceType:l});let p=f();t.push(p)}let a=await Promise.allSettled(t);this.updateFileMap(r,a),await this.conversionDump.updateConvertedTilesDump(n,a)}}updateFileMap(t,r){for(let n=0;n<t.length;n++){let a=t[n];a&&"value"in r[n]&&(this.fileMap[a]=r[n].value)}}};var eb="Tile converter does not work in browser, only in node js environment",Zf=".dump.json";var ON=require("path"),IN=Ct(Is(),1);var IEe=Ct(Is(),1),PEe=()=>({mbs:{path:"mbs"},obb:{path:"obb"}}),r5t=()=>({href:{path:"href"}}),n5t=()=>({id:{path:"id"},...r5t(),...PEe()}),FN=()=>({version:{path:"version"},id:{path:"id"},path:{path:"path"},level:{path:"level"},...PEe(),lodSelection:{path:"lodSelection",default:[{metricType:"maxScreenThresholdSQ",maxError:196349.54374999998},{metricType:"maxScreenThreshold",maxError:999.9999999999999}]},children:{path:"children",default:null},neighbors:{path:"neighbors",default:null},parentNode:{path:"parentNode",transform:e=>(0,IEe.default)(e,n5t()),default:null},sharedResource:{path:"sharedResource",default:null},featureData:{path:"featureData",default:null},geometryData:{path:"geometryData",default:null},textureData:{path:"textureData",default:null},attributeData:{path:"attributeData",default:null}});var Rs=class{id;inPageId;data=null;children=[];converter;_finalized=!1;get finalized(){return this._finalized}constructor(t,r){this.inPageId=t,this.id=t===0?"root":t.toString(),this.converter=r}async addData(t){return this.converter.options.instantNodeWriting?await this.write(t):this.data=t,this}async addChildren(t){let r=[];for(let a of t){let i=await a.load();r.push({id:a.id,href:`../${a.id}`,obb:i.obb,mbs:i.mbs})}this.children=this.children.concat(t);let n=this.data;this.converter.options.instantNodeWriting&&(n=await this.load()),n&&(n.children=n.children??[],n.children=n.children.concat(r)),this.converter.options.instantNodeWriting&&n&&await this.write(n)}async addNeighbors(){var r;if(this.finalized)return;let t=await this.load();for(let n of this.children){let a=await n.load();if(a.neighbors=a.neighbors??[],Number((r=t==null?void 0:t.children)==null?void 0:r.length)<1e3)for(let i of t.children||[])n.id!==i.id&&a.neighbors.push({...i});else console.warn(`Node ${n.id}: neighbors attribute is omited because of large number of neigbors`),delete a.neighbors;this.converter.options.instantNodeWriting&&a&&await n.write(a),await n.save()}this.finalize()}async save(){this.data&&await this.write(this.data)}finalize(){this._finalized=!0;for(let t of this.children)t.flush()}async write(t){let r=(0,ON.join)(this.converter.layers0Path,"nodes",this.id);await this.converter.writeQueue.enqueue({archiveKey:`nodes/${this.id}/3dNodeIndexDocument.json.gz`,writePromise:()=>Xu(r,JSON.stringify(t),"3dNodeIndexDocument.json",!0,this.converter.compressList)},!0)}async load(){if(this.data)return this.data;let t=this.id,r=(0,ON.join)(this.converter.layers0Path,"nodes",t);return await Kg(r,"3dNodeIndexDocument.json")}flush(){this.data=null}static async createRootNode(t,r){let n=Rs.createRootNodeIndexDocument(t);return await new Rs(0,r).addData(n)}static async createNode({parentNode:t,boundingVolumes:r,lodSelection:n,nodeInPage:a,resources:i,converter:o}){let s=await Rs.createNodeIndexDocument(t,r,n,a,i);return await new Rs(a.index,o).addData(s)}static createRootNodeIndexDocument(t){let r={version:`{${Ju().toUpperCase()}}`,id:"root",level:0,lodSelection:[{metricType:"maxScreenThresholdSQ",maxError:0},{metricType:"maxScreenThreshold",maxError:0}],...t,children:[]};return(0,IN.default)(r,FN())}static async createNodeIndexDocument(t,r,n,a,i){var l,f,p,d,h;let o=a.index,s=await t.load(),u={version:s.version,id:o.toString(),level:s.level+1,...r,lodSelection:n,parentNode:{id:t.id,href:`../${t.id}`,mbs:s.mbs,obb:s.obb},children:[],neighbors:[]},c=(0,IN.default)(u,FN());if(a.mesh&&(c.geometryData=[{href:"./geometries/0"}],c.sharedResource={href:"./shared"},("texture"in i&&i.texture||"texelCountHint"in i&&i.texelCountHint)&&(c.textureData=[{href:"./textures/0"},{href:"./textures/1"}]),"attributes"in i&&i.attributes&&i.attributes.length&&((f=(l=t.converter.layers0)==null?void 0:l.attributeStorageInfo)!=null&&f.length)||"attributesCount"in i&&i.attributesCount&&((d=(p=t.converter.layers0)==null?void 0:p.attributeStorageInfo)!=null&&d.length))){let m=("attributes"in i?(h=i.attributes)==null?void 0:h.length:i.attributesCount)||0;c.attributeData=[];let g=m<t.converter.layers0.attributeStorageInfo.length?m:t.converter.layers0.attributeStorageInfo.length;for(let x=0;x<g;x++){let y=t.converter.layers0.attributeStorageInfo[x].key;c.attributeData.push({href:`./attributes/${y}/0`})}}return c}};var PN=async(e,t,r)=>{let n=jy(t);if(!e||!t.contentUrl||!n)return;let a={...r,[e.loader.id]:{isTileset:n,assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}},i=await Dk(t.contentUrl,e.loader,a);i.root&&(t.children=[i.root])},RN=async(e,t,r)=>{let n=jy(t);if(!e||!t.contentUrl||n)return null;let a={...r,[e.loader.id]:{...r[e.loader.id]||{},isTileset:n,assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}};return await Dk(t.contentUrl,e.loader,a)};async function Dk(e,t,r){let n=e.split(".3tz"),a;if(n.length===1)a=null;else if(n.length===2)a=n[1].slice(1),a===""&&(a="tileset.json");else throw new Error("Unexpected URL format");if(a){let i=`${n[0]}.3tz`,o=a5t(i),s=await i5t(o),u=new ky(o,s,i),c=new fl(u),l=await Wr(a,t,r);return await c.destroy(),l}return await Wr(e,t,r)}function jy(e){return(e==null?void 0:e.type)==="json"||(e==null?void 0:e.type)==="3tz"}function a5t(e){return e.startsWith("http://")||e.startsWith("https://")?new d0(e):pr?new d0(e):new Ha(e)}async function i5t(e){let t,r=await Jd(e,Yd),n=await Xd(r,e);if((n==null?void 0:n.fileName)==="@3dtilesIndex1@"){let a=await Os(n.localHeaderOffset,e);if(!a)throw new Error("corrupted 3tz");let i=a.fileDataOffset,o=await Jr(e,i,i+a.compressedSize);t=Ty(o)}return t}var Bk=async({tile:e,traversalProps:t,processTile:r,postprocessTile:n,maxDepth:a,level:i=0})=>{if(a&&i>a)return;let o=[],s=await r(e,t);o.push(s);for(let u of e.children)await Bk({tile:u,traversalProps:s,processTile:r,postprocessTile:n,maxDepth:a,level:i+1});n&&await n(o,t)};var o5t=["POINTS","LINES","LINE_LOOP","LINE_STRIP","TRIANGLES","TRIANGLE_STRIP","TRIANGLE_FAN"],REe=async e=>{let t={meshTopologyTypes:new Set,metadataClasses:new Set};if(!(e!=null&&e.gltfArrayBuffer))return t;let n=(await Xi(e.gltfArrayBuffer,Yc,{gltf:{normalize:!1,loadBuffers:!1,loadImages:!1,decompressMeshes:!1}})).json;if(!n)return t;let a=s5t(n),i=u5t(n);return{meshTopologyTypes:a,metadataClasses:i}},s5t=e=>{let t=new Set;for(let r of e.meshes||[])for(let n of r.primitives){let{mode:a}=n;typeof a!="number"&&(a=4),t.add(o5t[a])}return t},u5t=e=>{var a,i,o,s,u,c;let t=new Set,r=(o=(i=(a=e.extensions)==null?void 0:a[Ro])==null?void 0:i.schema)==null?void 0:o.classes;if(r)for(let l of Object.keys(r))t.add(l);let n=(c=(u=(s=e.extensions)==null?void 0:s[Xc])==null?void 0:u.schema)==null?void 0:c.classes;if(n)for(let l of Object.keys(n))t.add(l);return t},jEe=(e,t)=>{for(let r of t.meshTopologyTypes)e.meshTopologyTypes.add(r);for(let r of t.metadataClasses)e.metadataClasses.add(r)};var LEe=Ct(require("process"),1);var c5t=.2,tb=class{_stepsTotal=0;_stepsDone=0;startTime=0;stopTime=0;timeOfUpdatingStepsDone=0;milliSecForOneStep=0;trust=!1;numberOfDigitsInPercentage=0;threshold;getTime;constructor(t={}){this.getTime=t.getTime||LEe.default.hrtime.bigint,this.threshold=t.threshold||c5t}get stepsTotal(){return this._stepsTotal}set stepsTotal(t){this._stepsTotal=t,this.numberOfDigitsInPercentage=this.stepsTotal>100?Math.ceil(Math.log10(this.stepsTotal))-2:0}get stepsDone(){return this._stepsDone}set stepsDone(t){if(this._stepsDone=t,this.timeOfUpdatingStepsDone=this.getCurrentTimeInMilliSeconds(),this._stepsDone){let n=(this.timeOfUpdatingStepsDone-this.startTime)/this._stepsDone;this.trust=this.isVelocityTrust(n,this.milliSecForOneStep),this.milliSecForOneStep=n}}startMonitoring(){this.startTime=this.getCurrentTimeInMilliSeconds(),this.milliSecForOneStep=0,this.trust=!1,this.timeOfUpdatingStepsDone=0,this.stopTime=0,this.stepsDone=0}stopMonitoring(){this.stopTime=this.getCurrentTimeInMilliSeconds()}getPercent(){return this._stepsTotal?this._stepsDone/this._stepsTotal*100:null}getPercentString(){let t=this.getPercent();return t!==null?t.toFixed(this.numberOfDigitsInPercentage):""}getTimeCurrentlyElapsed(){return(this.stopTime?this.stopTime:this.getCurrentTimeInMilliSeconds())-this.startTime}getTimeRemaining(){return!this._stepsTotal||!this._stepsDone||!this.startTime?null:{timeRemaining:(this._stepsTotal-this._stepsDone)*this.milliSecForOneStep,trust:this.trust}}getTimeRemainingString(){let t=this.getTimeRemaining();return t!=null&&t.trust?Jg(t.timeRemaining):""}isVelocityTrust(t,r){return r?Math.abs((t-r)/r)<this.threshold:!1}getCurrentTimeInMilliSeconds(){return Number(this.getTime()/BigInt(1e6))}};var f3e=require("util");var sp=require("path"),p3e=Ct(require("process"),1),d3e=Ct(c3e(),1);var l3e={type:"object",properties:{options:{type:"object",properties:{inputUrl:{type:"string"},outputPath:{type:"string"},tilesetName:{type:"string"},maxDepth:{type:"number"},slpk:{type:"boolean"},egmFilePath:{type:"string"},token:{type:"string"},draco:{type:"boolean"},mergeMaterials:{type:"boolean"},generateTextures:{type:"boolean"},generateBoundingVolumes:{type:"boolean"},metadataClass:{type:"string"},analyze:{type:"boolean"}},required:["inputUrl","outputPath","tilesetName"]},tilesConverted:{type:"object",patternProperties:{".*":{type:"object",properties:{nodes:{type:"array",items:{type:"object",properties:{nodeId:{type:["number","string"]},done:{type:"boolean"},progress:{type:"object",patternProperties:{".*":{type:"boolean"}}},dumpMetadata:{type:"object",properties:{boundingVolumes:{type:["object","null"],properties:{mbs:{type:"array",minItems:4,maxItems:4,items:{type:"number"}},obb:{type:"object",properties:{center:{type:"array",minItems:3,maxItems:3,items:{type:"number"}},halfSize:{type:"array",minItems:3,maxItems:3,items:{type:"number"}},quaternion:{type:"array",minItems:4,maxItems:4,items:{type:"number"}}},required:["center","halfSize","quaternion"]}},required:["mbs","obb"]},attributesCount:{type:"number"},featureCount:{type:"number"},geometry:{type:"boolean"},hasUvRegions:{type:"boolean"},materialId:{type:"number"},texelCountHint:{type:"number"},vertexCount:{type:"number"}},required:["boundingVolumes","featureCount","geometry","hasUvRegions","materialId","vertexCount"]}},required:["nodeId","done"]}}},required:["nodes"]}}},textureSetDefinitions:{type:"array",items:{type:"object",properties:{formats:{type:"array",items:{type:"object",properties:{name:{type:"string"},format:{enum:["jpg","png","ktx-etc2","dds","ktx2"]}},required:["name","format"]}},atlas:{type:"boolean"}},required:["formats"]}},attributeMetadataInfo:{type:"object",properties:{attributeStorageInfo:{type:"array",items:{type:"object",properties:{key:{type:"string"},name:{type:"string"},header:{type:"array",items:{type:"object",properties:{property:{type:"string"},valueType:{type:"string"}},required:["property","valueType"]}},ordering:{type:"array",items:{type:"string"}},attributeValues:{$ref:"#/$defs/AttributeValue"},attributeByteCounts:{$ref:"#/$defs/AttributeValue"},objectIds:{$ref:"#/$defs/AttributeValue"}},required:["key","name","header"]}},fields:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{$ref:"#/$defs/ESRIField"},alias:{type:"string"},domain:{$ref:"#/$defs/Domain"}},required:["name","type"]}},popupInfo:{type:"object",properties:{title:{type:"string"},description:{type:"string"},expressionInfos:{type:"array",items:{}},fieldInfos:{type:"array",items:{$ref:"#/$defs/FieldInfo"}},mediaInfos:{type:"array",items:{}},popupElements:{type:"array",items:{type:"object",properties:{text:{type:"string"},type:{type:"string"},fieldInfos:{type:"array",items:{$ref:"#/$defs/FieldInfo"}}}}}}}},required:["attributeStorageInfo","fields"]},materialDefinitions:{type:"array",items:{type:"object",properties:{pbrMetallicRoughness:{type:"object",properties:{baseColorFactor:{type:"array",minItems:4,maxItems:4,items:{type:"number"}},baseColorTexture:{$ref:"#/$defs/I3SMaterialTexture"},metallicFactor:{type:"number"},roughnessFactor:{type:"number"},metallicRoughnessTexture:{$ref:"#/$defs/I3SMaterialTexture"}},required:["metallicFactor","roughnessFactor"]},normalTexture:{$ref:"#/$defs/I3SMaterialTexture"},occlusionTexture:{$ref:"#/$defs/I3SMaterialTexture"},emissiveTexture:{$ref:"#/$defs/I3SMaterialTexture"},emissiveFactor:{type:"array",minItems:3,maxItems:3,items:{type:"number"}},alphaMode:{enum:["opaque","mask","blend"]},alphaCutoff:{type:"number"},doubleSided:{type:"boolean"},cullFace:{enum:["none","front","back"]}},required:["pbrMetallicRoughness","alphaMode"]}}},required:["options","tilesConverted"],$defs:{AttributeValue:{type:"object",properties:{valueType:{type:"string"},encoding:{type:"string"},valuesPerElement:{type:"number"}},required:["valueType"]},ESRIField:{enum:["esriFieldTypeDate","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeGUID","esriFieldTypeGlobalID","esriFieldTypeInteger","esriFieldTypeOID","esriFieldTypeSmallInteger","esriFieldTypeString"]},Domain:{type:"object",properties:{type:{type:"string"},name:{type:"string"},description:{type:"string"},fieldType:{type:"string"},range:{type:"array",items:{type:"number"}},codedValues:{type:"array",items:{type:"object",properties:{name:{type:"string"},code:{type:["string","number"]}},required:["name","code"]}},mergePolicy:{type:"string"},splitPolicy:{type:"string"}},required:["type","name"]},FieldInfo:{type:"object",properties:{fieldName:{type:"string"},visible:{type:"boolean"},isEditable:{type:"boolean"},label:{type:"string"}},required:["fieldName","visible","isEditable","label"]},I3SMaterialTexture:{type:"object",properties:{textureSetDefinitionId:{type:"number"},texCoord:{type:"number"},factor:{type:"number"}},required:["textureSetDefinitionId"]}}};var lh=class{restored=!1;options;tilesConverted;textureSetDefinitions;attributeMetadataInfo;materialDefinitions;constructor(){this.tilesConverted={}}async createDump(t){let{tilesetName:r,slpk:n,egmFilePath:a,inputUrl:i,outputPath:o,draco:s=!0,maxDepth:u,token:c,generateTextures:l,generateBoundingVolumes:f,mergeMaterials:p=!0,metadataClass:d,analyze:h=!1,outputVersion:m="1.1"}=t;this.options={tilesetName:r,slpk:n,egmFilePath:a,inputUrl:i,outputPath:o,draco:s,maxDepth:u,token:c,generateTextures:l,generateBoundingVolumes:f,mergeMaterials:p,metadataClass:d,analyze:h,outputVersion:m};let g=(0,sp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Zf}`);if(await Dy(g))try{let x=await Kg((0,sp.join)(this.options.outputPath,this.options.tilesetName),`${this.options.tilesetName}${Zf}`),{options:y,tilesConverted:w,textureSetDefinitions:T,attributeMetadataInfo:A,materialDefinitions:B}=x;if(new d3e.default().compile(l3e)(x)&&(0,f3e.isDeepStrictEqual)(y,JSON.parse(JSON.stringify(this.options)))){this.tilesConverted=w,this.textureSetDefinitions=T,this.attributeMetadataInfo=A,this.materialDefinitions=B,this.restored=!0;return}}catch(x){console.log("Can't open dump file",x)}await this.deleteDumpFile()}reset(){this.restored=!1,this.tilesConverted={},this.textureSetDefinitions&&delete this.textureSetDefinitions,this.attributeMetadataInfo&&delete this.attributeMetadataInfo,this.materialDefinitions&&delete this.materialDefinitions}async updateDumpFile(){var t;if((t=this.options)!=null&&t.outputPath&&this.options.tilesetName)try{let r=p3e.default.hrtime();await Oi((0,sp.join)(this.options.outputPath,this.options.tilesetName),JSON.stringify({options:this.options,tilesConverted:this.tilesConverted,textureSetDefinitions:this.textureSetDefinitions,attributeMetadataInfo:this.attributeMetadataInfo,materialDefinitions:this.materialDefinitions}),`${this.options.tilesetName}${Zf}.${r[0]}.${r[1]}`),await KAe((0,sp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Zf}.${r[0]}.${r[1]}`),(0,sp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Zf}`))}catch(r){console.log("Can't update dump file",r)}}async deleteDumpFile(){var t;(t=this.options)!=null&&t.outputPath&&this.options.tilesetName&&await Dy((0,sp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Zf}`))&&await Fy((0,sp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Zf}`))}getRecord(t){return this.tilesConverted[t]}setRecord(t,r){this.tilesConverted[t]=r}async addNode(t,r,n){let{nodes:a}=this.getRecord(t)||{nodes:[]};a.push({nodeId:r,done:!1,dumpMetadata:n}),a.length===1&&this.setRecord(t,{nodes:a}),await this.updateDumpFile()}clearDumpRecord(t){this.setRecord(t,{nodes:[]})}addTexturesDefinitions(t){this.textureSetDefinitions=t}updateDoneStatus(t,r,n,a){var o;let i=(o=this.tilesConverted[t])==null?void 0:o.nodes.find(s=>s.nodeId===r);i&&(i.progress||(i.progress={}),i.progress[n]=a,a||(i.done=!1))}async updateConvertedTilesDump(t,r){for(let n=0;n<t.length;n++)if(t[n]&&"value"in r[n]){let{sourceId:a,resourceType:i,outputId:o}=t[n];this.updateNodes(a,o,i)}await this.updateDumpFile()}updateNodes(t,r,n){if(!(!t||!n||!r)){for(let a of this.tilesConverted[t].nodes)if(a.nodeId===r&&a.progress){a.progress[n]=!0;let i=!1;for(let o in a.progress)if(i=a.progress[o],!i)break;a.done=i,a.done&&delete a.progress;break}}}async updateConvertedNodesDumpFile(t,r,n){var i;let a=(i=this.tilesConverted[t])==null?void 0:i.nodes.find(o=>o.nodeId===r);a&&(a.done=n,await this.updateDumpFile())}isFileConversionComplete(t){var n,a,i;let r=!0;for(let o of((n=this.tilesConverted[t])==null?void 0:n.nodes)||[])if(!o.done){r=!1;break}return r&&((i=(a=this.tilesConverted[t])==null?void 0:a.nodes)==null?void 0:i.length)>0}setMaterialsDefinitions(t){this.materialDefinitions=t}};var m3e,jPt=(m3e=fh.default.env)==null?void 0:m3e.IonToken,h3e=64,LPt="3DTILES",MPt="3DObject",qPt=1800,NPt="https://",up="phase1-count",bb=class{attributeMetadataInfo;nodePages;options;layers0Path;materialMap;materialDefinitions;geometryMap;geometryConfigs;vertexCounter;layers0;featuresHashArray;refinementCounter;validate;boundingVolumeWarnings=[];conversionStartTime=[0,0];refreshTokenTime=[0,0];sourceTileset=null;loadOptions={core:{_nodeWorkers:!0,reuseWorkers:!0,useLocalLibraries:!0},basis:{format:"rgba32",workerUrl:"./modules/textures/dist/basis-worker-node.js"},draco:{workerUrl:"./modules/draco/dist/draco-worker-node.js"},modules:{}};geoidHeightModel=null;Loader=Nu;generateTextures;generateBoundingVolumes;layersHasTexture;workerSource={};writeQueue=new Zg(new lh);compressList=null;preprocessData={meshTopologyTypes:new Set,metadataClasses:new Set};progresses={};conversionDump;constructor(){this.attributeMetadataInfo=new sS,this.nodePages=new Ca(Oi,h3e,this),this.options={},this.layers0Path="",this.materialMap=new Map,this.materialDefinitions=[],this.geometryMap=new Map,this.geometryConfigs=[],this.vertexCounter=0,this.layers0=null,this.featuresHashArray=[],this.refinementCounter={tilesCount:0,tilesWithAddRefineCount:0},this.validate=!1,this.generateTextures=!1,this.generateBoundingVolumes=!1,this.layersHasTexture=!1,this.compressList=null,this.conversionDump=new lh}async convert(t){var x;if(pr)return console.log(eb),eb;this.conversionStartTime=fh.default.hrtime();let{tilesetName:r,egmFilePath:n,inputUrl:a,validate:i,outputPath:o,draco:s=!0,maxDepth:u,token:c,generateTextures:l,generateBoundingVolumes:f,instantNodeWriting:p=!1,mergeMaterials:d=!0,inquirer:h,metadataClass:m,analyze:g=!1}=t;this.options={outputPath:o,tilesetName:r,maxDepth:u,egmFilePath:n,draco:s,token:c,inputUrl:a,instantNodeWriting:p,mergeMaterials:d,inquirer:h,metadataClass:m},this.progresses[up]=new tb,this.compressList=this.options.instantNodeWriting&&[]||null,this.validate=Boolean(i),this.Loader=a.indexOf(NPt)!==-1?w8:Nu,this.generateTextures=Boolean(l),this.generateBoundingVolumes=Boolean(f),this.writeQueue=new Zg(this.conversionDump),this.writeQueue.startListening(),n.toLowerCase()==="none"?console.log('--egm chousen to be "none", skip loading egm file'):(console.log("Loading egm file..."),this.geoidHeightModel=await Wr(n,kk),console.log("Loading egm file completed!")),this.nodePages.useWriteFunction(Xu);try{let y=await this._fetchPreloadOptions(),w=a;if(y.url&&(w=y.url),y.headers){(x=this.loadOptions).core||(x.core={});let A=this.loadOptions.core.fetch;if(typeof A=="function")this.loadOptions.core.fetch=(B,I)=>A(B,{...I||{},headers:y.headers});else{let B=A&&typeof A=="object"?A:{};this.loadOptions.core.fetch={...B,headers:y.headers}}}this.sourceTileset=await Dk(w,this.Loader,this.loadOptions),(this.Loader===Nu||g?await this.preprocessConversion():!0)&&!g&&await this.selectMetadataClass()&&(await this._createAndSaveTileset(o,r),await this._finishConversion({outputPath:o,tilesetName:r}))}catch(y){throw y}finally{await this.writeQueue.finalize(),Ua.getWorkerFarm({}).destroy()}return"success"}async preprocessConversion(){console.log("Analyze source tileset");let t=this.sourceTileset.root;await Bk({tile:t,traversalProps:null,processTile:this.analyzeTile.bind(this),postprocessTile:void 0,maxDepth:this.options.maxDepth});let{meshTopologyTypes:r,metadataClasses:n}=this.preprocessData;return console.log("------------------------------------------------"),console.log("Preprocess results:"),console.log(`Tile count: ${this.progresses[up].stepsTotal}`),console.log(`glTF mesh topology types: ${Array.from(r).join(", ")}`),n.size?console.log(`Feature metadata classes have been found: ${Array.from(n).join(", ")}`):console.log("Feature metadata classes have not been found"),!r.has("TRIANGLES")&&!r.has("TRIANGLE_STRIP")?(console.log("The tileset is of unsupported mesh topology types. The conversion will be interrupted."),console.log("------------------------------------------------"),!1):(console.log("------------------------------------------------"),!0)}async analyzeTile(t,r){if(jy(t))return await PN(this.sourceTileset,t,this.loadOptions),null;t.id&&(this.progresses[up].stepsTotal+=1,console.log(`[analyze]: ${t.id}`));let a=null;try{a=await RN(this.sourceTileset,t,{...this.loadOptions,"3d-tiles":{...this.loadOptions["3d-tiles"],loadGLTF:!1}})}catch{console.log(`[warning]: Failed to load ${t.contentUrl}. An I3S tile with empty content will be added to the output tileset`)}let i=await REe(a);return jEe(this.preprocessData,i),null}async selectMetadataClass(){var r;let{metadataClasses:t}=this.preprocessData;if(t.size>1)if((r=this.options.metadataClass)!=null&&r.length)console.log(`${this.options.metadataClass} has been selected`);else if(this.options.inquirer){let n=await this.options.inquirer.prompt([{name:"metadataClass",type:"list",message:"Select feature metadata data class to convert...",choices:Array.from(t)}]);this.options.metadataClass=n.metadataClass,console.log(`${n.metadataClass} has been selected`)}else return console.log(`A feature metadata class has not been selected. Start the converter with option "--metadata-class". For example, "npx tile-converter ... --metadata-class ${Array.from(t)[0]}"`),console.log("------------------------------------------------"),!1;return!0}async _createAndSaveTileset(t,r){var c,l,f;let n=(0,Jo.join)(`${t}`,`${r}`);await this.conversionDump.createDump(this.options),this.conversionDump.restored&&this.options.inquirer&&((await this.options.inquirer.prompt([{name:"resumeConversion",type:"confirm",message:"Dump file of the previous conversion exists, do you want to resume that conversion?"}])).resumeConversion||this.conversionDump.reset()),this.layers0Path=(0,Jo.join)(n,"SceneServer","layers","0");let a=this.conversionDump.restored?(0,Jo.join)(this.layers0Path,"nodepages"):n;try{await By(a)}catch{}if(this.conversionDump.restored&&this.conversionDump.attributeMetadataInfo&&this.attributeMetadataInfo.fromObject(this.conversionDump.attributeMetadataInfo),this.materialDefinitions=[],this.materialMap=new Map,this.conversionDump.restored&&this.conversionDump.materialDefinitions){for(let p=0;p<this.conversionDump.materialDefinitions.length;p++){let d=(0,p4.default)(JSON.stringify(this.conversionDump.materialDefinitions[p]));this.materialMap.set(d,p)}this.materialDefinitions=this.conversionDump.materialDefinitions}let i=this.sourceTileset.root,o=E1(i.boundingVolume,new mr(i.transform),null);this._formLayers0(r,o,(f=(l=(c=this.sourceTileset)==null?void 0:c.root)==null?void 0:l.boundingVolume)==null?void 0:f.region);let s=Ak(o,this.geoidHeightModel);await this.nodePages.push({index:0,lodThreshold:0,obb:s.obb,children:[]}),this.progresses[up].startMonitoring();let u=await Rs.createRootNode(s,this);await Bk({tile:i,traversalProps:{transform:new mr(i.transform),parentNodes:[u]},processTile:this.convertTile.bind(this),postprocessTile:this.finalizeTile.bind(this),maxDepth:this.options.maxDepth}),this.progresses[up].stopMonitoring(),console.log("[finalizing conversion]"),this.layers0.attributeStorageInfo=this.attributeMetadataInfo.attributeStorageInfo,this.layers0.fields=this.attributeMetadataInfo.fields,this.layers0.popupInfo=this.attributeMetadataInfo.popupInfo,this.attributeMetadataInfo.attributeStorageInfo.length&&(this.layers0.layerType=MPt),this.conversionDump.restored&&this.conversionDump.textureSetDefinitions&&(this.layers0.textureSetDefinitions=this.conversionDump.textureSetDefinitions),this.layers0.materialDefinitions=this.materialDefinitions,this.layers0.geometryDefinitions=(0,f4.default)(this.geometryConfigs.map(p=>({geometryConfig:{...p,draco:this.options.draco}})),CEe()),this.layersHasTexture===!1&&(this.layers0.store.defaultGeometrySchema.ordering=this.layers0.store.defaultGeometrySchema.ordering.filter(p=>p!=="uv0")),await this._writeLayers0(),wEe(r,this.layers0,n);for(let p of this.compressList||[])await xk(p),await Fy(p);await this.nodePages.save(),await this.writeQueue.finalize(),await this._createSlpk(n)}_formLayers0(t,r,n){var s;if(!((s=this.sourceTileset)!=null&&s.root))return;let a=rEe(r);n&&(a.zmin=n[4],a.zmax=n[5]);let i=[a.xmin,a.ymin,a.xmax,a.ymax],o={version:`{${Ju().toUpperCase()}}`,id:0,name:t,href:"./layers/0",store:{id:`{${Ju().toUpperCase()}}`,extent:i},nodePages:{nodesPerPage:h3e},compressGeometry:this.options.draco,fullExtent:a};this.layers0=(0,f4.default)(o,kEe())}async _writeLayers0(){await this.writeQueue.enqueue({archiveKey:"3dSceneLayer.json.gz",writePromise:()=>Xu(this.layers0Path,JSON.stringify(this.layers0),"3dSceneLayer.json")})}async _createSlpk(t){await this.conversionDump.deleteDumpFile();let r=(0,Jo.join)(t,"SceneServer","layers","0"),n=`${t}.slpk`;await hN(r,n,async a=>({path:"@specialIndexFileHASH128@",file:await Sy(a)}));try{await By(t)}catch{}}async convertTile(t,r){let n=jy(t);if(n||t.type==="empty")return n&&(t.id&&console.log(`[load]: ${t.id}`),await PN(this.sourceTileset,t,this.loadOptions)),r;t.id&&console.log(`[convert]: ${t.id}`);let{parentNodes:a,transform:i}=r,o=i.clone();t.transform&&(o=o.multiplyRight(t.transform));let s=a[0],u=await this._restoreNode(s,t,o),c;u===null?c=await this._createNode(s,t,o):c=u,await s.addChildren(c);let l={transform:o,parentNodes:c};if(t.id){this.progresses[up].stepsDone+=1;let f="Calculating time left...",p=this.progresses[up].getTimeRemainingString();p&&(f=`${p} left`);let d=this.progresses[up].getPercentString(),h=d?` ${d}%, ${f}`:"";console.log(`[converted${h}]: ${t.id}`)}return l}async finalizeTile(t,r){for(let n of t)for(let a of n.parentNodes)await a.addNeighbors();for(let n of r.parentNodes)await n.save()}async _generateNodeIndexDocument(t,r,n,a,i){this.layersHasTexture=this.layersHasTexture||Boolean("texture"in r&&r.texture||"texelCountHint"in r&&r.texelCountHint),this.generateBoundingVolumes&&r.boundingVolumes&&(t=r.boundingVolumes);let o=AEe(a,t),s=o.find(f=>f.metricType==="maxScreenThresholdSQ")||{maxError:0};if(i){let f={center:[],halfSize:[],quaternion:[]};await this.nodePages.push({index:0,obb:f},n.inPageId)}let u=await this._updateNodeInNodePages(s,t,a,n.inPageId,r),c=await Rs.createNodeIndexDocument(n,t,o,u,r);return{node:await new Rs(u.index,this).addData(c),nodeInPage:u,nodeData:c}}async _restoreNode(t,r,n){if(this._checkAddRefinementTypeForTile(r),await this._updateTilesetOptions(),this.conversionDump.restored&&r.id&&this.conversionDump.isFileConversionComplete(r.id)){let a=E1(r.boundingVolume,n,null),i=Ak(a,this.geoidHeightModel),o=[];for(let s of this.conversionDump.tilesConverted[r.id].nodes){let{node:u}=await this._generateNodeIndexDocument(i,{...s.dumpMetadata,nodeId:s.nodeId},t,r,!0);o.push(u)}return o}else this.conversionDump.restored&&r.id&&this.conversionDump.clearDumpRecord(r.id);return null}async _createNode(t,r,n){var d;this._checkAddRefinementTypeForTile(r),await this._updateTilesetOptions();let a=null;try{a=await RN(this.sourceTileset,r,this.loadOptions)}catch{console.log(`[warning]: Failed to load ${r.contentUrl}`)}let i=E1(r.boundingVolume,n,null),o=Ak(i,this.geoidHeightModel),s=vEe(a,this.options.metadataClass);this.createAttributeStorageInfo(a,s),this.conversionDump.attributeMetadataInfo={attributeStorageInfo:this.attributeMetadataInfo.attributeStorageInfo,fields:this.attributeMetadataInfo.fields,popupInfo:this.attributeMetadataInfo.popupInfo};let u=await this._convertResources({sourceTile:r,transformationMatrix:n,boundingVolume:i,tileContent:a,parentId:t.inPageId,propertyTable:s}),c=[],l=[],f=[],p={geometry:null,compressedGeometry:null,texture:null,hasUvRegions:!1,sharedResources:null,meshMaterial:null,vertexCount:null,attributes:null,featureCount:null,boundingVolumes:null};for(let h of u||[p]){let{node:m,nodeInPage:g,nodeData:x}=await this._generateNodeIndexDocument(o,h,t,r,!1);if(c.push(m),g.mesh){if(r.id){let y={boundingVolumes:h.boundingVolumes,attributesCount:(d=h.attributes)==null?void 0:d.length,featureCount:h.featureCount,geometry:Boolean(h.geometry),hasUvRegions:h.hasUvRegions,materialId:g.mesh.material.definition,texelCountHint:g.mesh.material.texelCountHint,vertexCount:h.vertexCount};this.conversionDump.setMaterialsDefinitions(this.materialDefinitions),await this.conversionDump.addNode(r.id,g.index,y)}await this._writeResources(h,m.id,r)}this.validate&&(this.boundingVolumeWarnings=FEe(x),this.boundingVolumeWarnings&&this.boundingVolumeWarnings.length&&console.warn("Bounding Volume Warnings: ",...this.boundingVolumeWarnings)),l.push(g.index),f.push(g)}return c}async _convertResources({sourceTile:t,transformationMatrix:r,boundingVolume:n,tileContent:a,parentId:i,propertyTable:o}){if(!this.isContentSupported(t)||!a)return null;let s={center:[],halfSize:[],quaternion:[]};return await TN({tileContent:a,tileTransform:r,tileBoundingVolume:n,addNodeToNodePage:async()=>(await this.nodePages.push({index:0,obb:s},i)).index,propertyTable:o,featuresHashArray:this.featuresHashArray,attributeStorageInfo:this.attributeMetadataInfo.attributeStorageInfo,draco:this.options.draco??!1,generateBoundingVolumes:this.generateBoundingVolumes,shouldMergeMaterials:this.options.mergeMaterials??!1,geoidHeightModel:this.geoidHeightModel,libraries:this.loadOptions.modules,metadataClass:this.options.metadataClass})}async _updateNodeInNodePages(t,r,n,a,i){let{vertexCount:o,featureCount:s,geometry:u,hasUvRegions:c}=i,l={index:0,lodThreshold:t.maxError,obb:r.obb,children:[]};u&&this.isContentSupported(n)&&(l.mesh={geometry:{definition:this.findOrCreateGeometryDefinition(Boolean("texture"in i&&i.texture||"texelCountHint"in i&&i.texelCountHint),c),resource:0},attribute:{resource:0},material:{definition:0}});let f="nodeId"in i?i.nodeId:void 0,p;if(f?p=await this.nodePages.getNodeById(f):p=await this.nodePages.push(l,a),l.mesh||console.log(`[warning]: node ${p.index} is created with empty content`),Ca.updateAll(p,l),"meshMaterial"in i&&i.meshMaterial?Ca.updateMaterialByNodeId(p,this._findOrCreateMaterial(i.meshMaterial)):"materialId"in i&&i.materialId!==null&&Ca.updateMaterialByNodeId(p,i.materialId),"texture"in i&&i.texture){let d=i.texture.image.height*i.texture.image.width;Ca.updateTexelCountHintByNodeId(p,d)}else"texelCountHint"in i&&i.texelCountHint&&Ca.updateTexelCountHintByNodeId(p,i.texelCountHint);return o&&(this.vertexCounter+=o,Ca.updateVertexCountByNodeId(p,o)),Ca.updateNodeAttributeByNodeId(p),s&&Ca.updateFeatureCountByNodeId(p,s),this.nodePages.saveNode(p),p}async _writeResources(t,r,n){let{geometry:a,compressedGeometry:i,texture:o,sharedResources:s,attributes:u}=t,c=(0,Jo.join)(this.layers0Path,"nodes",r),l=(0,Jo.join)("nodes",r);await this._writeGeometries({geometryBuffer:a,compressedGeometry:i,childPath:c,slpkChildPath:l,sourceId:n.id||"",nodeId:parseInt(r)}),await this._writeShared({sharedResources:s,childPath:c,slpkChildPath:l,nodePath:r,sourceId:n.id||"",nodeId:parseInt(r)}),await this._writeTexture(o,c,l,n.id||"",parseInt(r)),await this._writeAttributes(u,c,l,n.id||"",parseInt(r))}async _writeGeometries({geometryBuffer:t,compressedGeometry:r,childPath:n,slpkChildPath:a,sourceId:i,nodeId:o}){if(!t)return;this.conversionDump.updateDoneStatus(i,o,"GEOMETRY",!1);let s=(0,Jo.join)(n,"geometries");if(await this.writeQueue.enqueue({archiveKey:`${a}/geometries/0.bin.gz`,sourceId:i,outputId:o,resourceType:"GEOMETRY",writePromise:()=>Xu(s,t,"0.bin")}),this.options.draco&&r){this.conversionDump.updateDoneStatus(i,o,"DRACO_GEOMETRY",!1);let u=(0,Jo.join)(n,"geometries");await this.writeQueue.enqueue({archiveKey:`${a}/geometries/1.bin.gz`,sourceId:i,outputId:o,resourceType:"DRACO_GEOMETRY",writePromise:()=>Xu(u,r,"1.bin")})}}async _writeShared({sharedResources:t,childPath:r,slpkChildPath:n,nodePath:a,sourceId:i,nodeId:o}){if(!t)return;t.nodePath=a;let s=(0,f4.default)(t,DEe()),u=JSON.stringify(s);this.conversionDump.updateDoneStatus(i,o,"SHARED",!1);let c=(0,Jo.join)(r,"shared");await this.writeQueue.enqueue({archiveKey:`${n}/shared/sharedResource.json.gz`,sourceId:i,outputId:o,resourceType:"SHARED",writePromise:()=>Xu(c,u,"sharedResource.json")})}async _writeTexture(t,r,n,a,i){if(t){let o=this._getFormatByMimeType(t==null?void 0:t.mimeType),s=[],u=t.bufferView.data;switch(o){case"jpg":case"png":{if(s.push({name:"0",format:o}),this.conversionDump.updateDoneStatus(a,i,`${"TEXTURE"}/${o}`,!1),await this.writeTextureFile({textureData:u,name:"0",format:o,childPath:r,slpkChildPath:n,sourceId:a,nodeId:i}),this.generateTextures){s.push({name:"1",format:"ktx2"});let c=t.image.data.subarray(),l=new Uint8Array(c),f=$m({...t.image,data:l},LM,{...LM.options,["ktx2-basis-writer"]:{workerUrl:"./modules/textures/dist/ktx2-basis-writer-worker-node.js"},reuseWorkers:!0,_nodeWorkers:!0,useLocalLibraries:!0});this.conversionDump.updateDoneStatus(a,i,`${"TEXTURE"}/ktx2`,!1),await this.writeTextureFile({textureData:f,name:"1",format:"ktx2",childPath:r,slpkChildPath:n,sourceId:a,nodeId:i})}break}case"ktx2":{if(s.push({name:"1",format:o}),this.conversionDump.updateDoneStatus(a,i,`${"TEXTURE"}/${o}`,!1),await this.writeTextureFile({textureData:u,name:"1",format:o,childPath:r,slpkChildPath:n,sourceId:a,nodeId:i}),this.generateTextures){s.push({name:"0",format:"jpg"});let c=$m(t.image.data[0],TM);this.conversionDump.updateDoneStatus(a,i,`${"TEXTURE"}/jpg`,!1),await this.writeTextureFile({textureData:c,name:"0",format:"jpg",childPath:r,slpkChildPath:n,sourceId:a,nodeId:i})}break}default:}this.layers0.textureSetDefinitions.length||(this.layers0.textureSetDefinitions.push({formats:s}),this.layers0.textureSetDefinitions.push({formats:s,atlas:!0}),this.layers0.textureSetDefinitions&&this.conversionDump.addTexturesDefinitions(this.layers0.textureSetDefinitions))}}async writeTextureFile({textureData:t,name:r,format:n,childPath:a,slpkChildPath:i,sourceId:o,nodeId:s}){let u=(0,Jo.join)(a,"textures"),c=!1;await this.writeQueue.enqueue({archiveKey:`${i}/textures/${r}.${n}`,sourceId:o,outputId:s,resourceType:`${"TEXTURE"}/${n}`,writePromise:()=>Xu(u,t,`${r}.${n}`,c)})}async _writeAttributes(t=[],r,n,a,i){if(t!=null&&t.length&&this.attributeMetadataInfo.attributeStorageInfo.length){let o=t.length<this.attributeMetadataInfo.attributeStorageInfo.length?t.length:this.attributeMetadataInfo.attributeStorageInfo.length;for(let s=0;s<o;s++){let u=this.attributeMetadataInfo.attributeStorageInfo[s].key,c=new Uint8Array(t[s]);this.conversionDump.updateDoneStatus(a,i,`${"ATTRIBUTES"}/${u}`,!1);let l=(0,Jo.join)(r,"attributes",u);await this.writeQueue.enqueue({archiveKey:`${n}/attributes/${u}.bin.gz`,sourceId:a,outputId:i,resourceType:`${"ATTRIBUTES"}/${u}`,writePromise:()=>Xu(l,c,"0.bin")})}}}_getFormatByMimeType(t){switch(t){case"image/jpeg":return"jpg";case"image/png":return"png";case"image/ktx2":return"ktx2";default:return"jpg"}}_findOrCreateMaterial(t){let r=(0,p4.default)(JSON.stringify(t));if(this.materialMap.has(r))return this.materialMap.get(r)||0;let n=this.materialDefinitions.push(t)-1;return this.materialMap.set(r,n),n}findOrCreateGeometryDefinition(t,r){let n={hasTexture:t,hasUvRegions:r},a=(0,p4.default)(JSON.stringify(n));if(this.geometryMap.has(a))return this.geometryMap.get(a)||0;let i=this.geometryConfigs.push(n)-1;return this.geometryMap.set(a,i),i}createAttributeStorageInfo(t,r){let n=null;this.options.metadataClass?!this.attributeMetadataInfo.attributeStorageInfo.length&&(t!=null&&t.gltf)&&(n=lEe(t.gltf,this.options.metadataClass)):r&&(n=cEe(r)),n&&this.attributeMetadataInfo.addMetadataInfo(n)}async _finishConversion(t){let{tilesCount:r,tilesWithAddRefineCount:n}=this.refinementCounter,a=n?n/r*100:0,i=await wk({outputPath:t.outputPath,tilesetName:t.tilesetName,slpk:!0}),o=fh.default.hrtime(this.conversionStartTime),s=Jg(o);console.log("------------------------------------------------"),console.log(`Finishing conversion of ${LPt}`),console.log(`Total conversion time: ${s}`),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",i," bytes"),console.log('Percentage of tiles with "ADD" refinement type:',a,"%"),console.log("------------------------------------------------")}async _fetchPreloadOptions(){if(!this.Loader.preload)return{};let t={"cesium-ion":{accessToken:this.options.token||jPt}},r=await this.Loader.preload(this.options.inputUrl??"",t);return this.refreshTokenTime=fh.default.hrtime(),{...t,...r}}async _updateTilesetOptions(){var n;if(fh.default.hrtime(this.refreshTokenTime)[0]<qPt)return;this.refreshTokenTime=fh.default.hrtime();let r=await this._fetchPreloadOptions();if(r.headers){(n=this.loadOptions).core||(n.core={});let a=this.loadOptions.core.fetch;if(typeof a=="function")this.loadOptions.core.fetch=(i,o)=>a(i,{...o||{},headers:r.headers});else{let i=a&&typeof a=="object"?a:{};this.loadOptions.core.fetch={...i,headers:r.headers}}console.log("Authorization Bearer token has been updated")}}_checkAddRefinementTypeForTile(t){let r=1;t.refine===r&&(this.refinementCounter.tilesWithAddRefineCount+=1,console.warn('This tile uses "ADD" type of refinement')),this.refinementCounter.tilesCount+=1}isContentSupported(t){return["b3dm","glTF","scenegraph"].includes(t.type||"")}};var z3e=require("path"),Ez=Ct(require("process"),1),G3e=Ct(Is(),1);function xz(e){switch(e){case"UInt8":return Uint8Array;case"UInt16":return Uint16Array;case"UInt32":return Uint32Array;case"Float32":return Float32Array;case"UInt64":return Float64Array;default:throw new Error(`parse i3s tile content: unknown type of data: ${e}`)}}var g3e={UInt8:ht.UNSIGNED_BYTE,UInt16:ht.UNSIGNED_SHORT,Float32:ht.FLOAT,UInt32:ht.UNSIGNED_INT,UInt64:ht.DOUBLE};function vb(e){switch(e){case"UInt8":return 1;case"UInt16":case"Int16":return 2;case"UInt32":case"Int32":case"Float32":return 4;case"UInt64":case"Int64":case"Float64":return 8;default:throw new Error(`parse i3s tile content: unknown size of data: ${e}`)}}var b3e="String",v3e="Oid32",x3e="Float64",y3e="Int16";function d4(e){let t;try{let r=new URL(e);t=`${r.origin}${r.pathname}`,t.startsWith("null")&&(t=null)}catch{t=null}return t||e}function xb(e,t=null){return t?`${e}?token=${t}`:e}function _3e(e,t){let{attributeData:r=[]}=t,n=[];for(let a=0;a<r.length;a++){let i=r[a].href.replace("./","");n.push(`${e}/${i}`)}return n}function w3e(e,t,r){let n=[],{attributeStorageInfo:a=[]}=e;for(let i=0;i<a.length;i++){let o=a[i].key;n.push(`${t}/nodes/${r}/attributes/${o}/0`)}return n}var h4=new Z([0,0,0]);function zPt(e){switch(e){case"ktx-etc2":case"dds":return u8;case"ktx2":return Bd;case"jpg":case"png":default:return ig}}var GPt="i3s-attribute-type";async function S3e(e,t,r,n,a){var o;let i={attributes:{},indices:null,featureIds:[],vertexCount:0,modelMatrix:new mr,coordinateSystem:0,byteLength:0,texture:null};if(t.textureUrl){let s=xb(t.textureUrl,(o=n==null?void 0:n.i3s)==null?void 0:o.token),u=zPt(t.textureFormat),f=await(await((a==null?void 0:a.fetch)||fetch)(s)).arrayBuffer();if(n!=null&&n.i3s.decodeTextures){if(u===ig){let p={...t.textureLoaderOptions,image:{type:"data"}};try{let d=await Hi(f,[],p,a);i.texture=d}catch{let h=await Xi(f,u,p,a);i.texture=h}}else if(u===u8||u===Bd){let p=await Wr(f,u,t.textureLoaderOptions);u===Bd&&(p=p[0]),i.texture={compressed:!0,mipmaps:!1,width:p[0].width,height:p[0].height,data:p}}}else i.texture=f}return i.material=QPt(t.materialDefinition,i.texture),i.material&&(i.texture=null),await HPt(e,i,t,r,n)}async function HPt(e,t,r,n,a){var f,p;let i=e.byteLength,o,s,u=0,c=0,l;if(r.isDracoGeometry){let d=await Xi(e,Sd,{draco:{attributeNameEntry:GPt}});s=d.header.vertexCount,l=(f=d.indices)==null?void 0:f.value;let{POSITION:h,NORMAL:m,COLOR_0:g,TEXCOORD_0:x,["feature-index"]:y,["uv-region"]:w}=d.attributes;o={position:h,normal:m,color:g,uv0:x,uvRegion:w,id:y},VPt(o,d);let T=rRt(y);T&&tRt(o,T)}else{let{vertexAttributes:d,ordering:h,featureAttributes:m,featureAttributeOrder:g}=n.store.defaultGeometrySchema,x=WPt(e,n);u=x.byteOffset,s=x.vertexCount,c=x.featureCount;let{attributes:y,byteOffset:w}=E3e(e,u,d,s,h),{attributes:T}=E3e(e,w,m,c,g);eRt(T),o=$Pt(y,T)}if(!((p=a==null?void 0:a.i3s)!=null&&p.coordinateSystem)||a.i3s.coordinateSystem===2){let d=JPt(o.position,r);t.modelMatrix=d.invert(),t.coordinateSystem=2}else t.modelMatrix=YPt(o.position),t.coordinateSystem=3;t.attributes={positions:o.position,normals:o.normal,colors:A3e(o.color),texCoords:o.uv0,uvRegions:A3e(o.uvRegion||o.region)},t.indices=l||null,o.id&&o.id.value&&(t.featureIds=o.id.value);for(let d in t.attributes)t.attributes[d]||delete t.attributes[d];return t.vertexCount=s,t.byteLength=i,t}function VPt(e,t){for(let r in t.loaderData.attributes){let n=t.loaderData.attributes[r];switch(n.name){case"POSITION":e.position.metadata=n.metadata;break;case"feature-index":e.id.metadata=n.metadata;break;default:break}}}function $Pt(e,t){return{...e,...t}}function A3e(e){return e&&(e.normalized=!0,e)}function WPt(e,t){let r=0,n=0,a=0;for(let{property:i,type:o}of t.store.defaultGeometrySchema.header){let s=xz(o);switch(i){case"vertexCount".toString():n=new s(e,0,4)[0],r+=vb(o);break;case"featureCount".toString():a=new s(e,4,4)[0],r+=vb(o);break;default:break}}return{vertexCount:n,featureCount:a,byteOffset:r}}function E3e(e,t,r,n,a){let i={};for(let o of a)if(r[o]){let{valueType:s,valuesPerElement:u}=r[o];if(t+n*u*vb(s)<=e.byteLength){let c=e.slice(t),l;if(s==="UInt64")l=KPt(c,n*u,vb(s));else{let f=xz(s);l=new f(c,0,n*u)}switch(i[o]={value:l,type:g3e[s],size:u},o){case"color":i.color.normalized=!0;break;case"position":case"region":case"normal":default:}t=t+n*u*vb(s)}else if(o!=="uv0")break}return{attributes:i,byteOffset:t}}function KPt(e,t,r){let n=[],a=new DataView(e),i=0;for(let o=0;o<t;o++){let s=a.getUint32(i,!0),u=a.getUint32(i+4,!0),c=s+2**32*u;n.push(c),i+=r}return new Uint32Array(n)}function JPt(e,t){let r=t.mbs,n=e.value,a=e.metadata,i=new mr,o=new Z(r[0],r[1],r[2]),s=new Z;return Ft.WGS84.cartographicToCartesian(o,s),Ft.WGS84.eastNorthUpToFixedFrame(s,i),e.value=XPt(n,a,o),i}function XPt(e,t={},r){let n=new Float64Array(e.length),a=t["i3s-scale_x"]&&t["i3s-scale_x"].double||1,i=t["i3s-scale_y"]&&t["i3s-scale_y"].double||1;for(let o=0;o<n.length;o+=3)n[o]=e[o]*a+r.x,n[o+1]=e[o+1]*i+r.y,n[o+2]=e[o+2]+r.z;for(let o=0;o<n.length;o+=3)Ft.WGS84.cartographicToCartesian(n.subarray(o,o+3),h4),n[o]=h4.x,n[o+1]=h4.y,n[o+2]=h4.z;return n}function YPt(e){var i,o;let t=e.metadata,r=((i=t==null?void 0:t["i3s-scale_x"])==null?void 0:i.double)||1,n=((o=t==null?void 0:t["i3s-scale_y"])==null?void 0:o.double)||1,a=new mr;return a[0]=r,a[5]=n,a}function QPt(e,t){let r;return e?r={...e,pbrMetallicRoughness:e.pbrMetallicRoughness?{...e.pbrMetallicRoughness}:{baseColorFactor:[255,255,255,255]}}:(r={pbrMetallicRoughness:{}},t?r.pbrMetallicRoughness.baseColorTexture={texCoord:0}:r.pbrMetallicRoughness.baseColorFactor=[255,255,255,255]),r.alphaCutoff=r.alphaCutoff||.25,r.alphaMode&&(r.alphaMode=r.alphaMode.toUpperCase()),r.emissiveFactor&&(r.emissiveFactor=T3e(r.emissiveFactor)),r.pbrMetallicRoughness&&r.pbrMetallicRoughness.baseColorFactor&&(r.pbrMetallicRoughness.baseColorFactor=T3e(r.pbrMetallicRoughness.baseColorFactor)),t&&ZPt(r,t),r}function T3e(e){let t=[...e];for(let r=0;r<e.length;r++)t[r]=e[r]/255;return t}function ZPt(e,t){let r={source:{image:t}};e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture?e.pbrMetallicRoughness.baseColorTexture={...e.pbrMetallicRoughness.baseColorTexture,texture:r}:e.emissiveTexture?e.emissiveTexture={...e.emissiveTexture,texture:r}:e.pbrMetallicRoughness&&e.pbrMetallicRoughness.metallicRoughnessTexture?e.pbrMetallicRoughness.metallicRoughnessTexture={...e.pbrMetallicRoughness.metallicRoughnessTexture,texture:r}:e.normalTexture?e.normalTexture={...e.normalTexture,texture:r}:e.occlusionTexture&&(e.occlusionTexture={...e.occlusionTexture,texture:r})}function eRt(e){let{id:t,faceRange:r}=e;if(!t||!r)return;let n=t.value,a=r.value,i=a[a.length-1]+1,o=new Uint32Array(i*3),s=0,u=0;for(let c=1;c<a.length;c+=2){let l=Number(n[s]),f=a[c],p=a[c-1],d=f-p+1,h=u+d*3;o.fill(l,u,h),s++,u=h}e.id.value=o}function tRt(e,t){let r=e.id.value,n=new Float32Array(r.length);for(let a=0;a<r.length;a++)n[a]=t[r[a]];e.id.value=n}function rRt(e){var t,r;return(r=(t=e==null?void 0:e.metadata)==null?void 0:t["i3s-feature-ids"])==null?void 0:r.intArray}var nRt="4.4.0",k3e={dataType:null,batchType:null,name:"I3S Content (Indexed Scene Layers)",id:"i3s-content",module:"i3s",worker:!0,version:nRt,mimeTypes:["application/octet-stream"],parse:aRt,extensions:["bin"],options:{"i3s-content":{}}};async function aRt(e,t,r){let{tile:n,_tileOptions:a,tileset:i,_tilesetOptions:o}=(t==null?void 0:t.i3s)||{},s=a||n,u=o||i;return!s||!u?null:await S3e(e,s,u,t,r)}var iRt="4.4.0",C3e={dataType:null,batchType:null,name:"I3S Node Page",id:"i3s-node-page",module:"i3s",version:iRt,mimeTypes:["application/json"],parse:oRt,extensions:["json"],options:{i3s:{}}};async function oRt(e,t){return JSON.parse(new TextDecoder().decode(e))}var sRt=["","WEBKIT_","MOZ_"],D3e={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"},f_=class{tileset;nodePages=[];pendingNodePages=[];nodesPerPage;options;lodSelectionMetricType;textureDefinitionsSelectedFormats=[];nodesInNodePages;url;textureLoaderOptions={};constructor(t,r="",n){var a,i;this.tileset={...t},this.url=r,this.nodesPerPage=((a=t.nodePages)==null?void 0:a.nodesPerPage)||64,this.lodSelectionMetricType=(i=t.nodePages)==null?void 0:i.lodSelectionMetricType,this.options=n,this.nodesInNodePages=0,this.initSelectedFormatsForTextureDefinitions(t)}async getNodeById(t){var a;let r=Math.floor(t/this.nodesPerPage);if(!this.nodePages[r]&&!this.pendingNodePages[r]){let i=xb(`${this.url}/nodepages/${r}`,(a=this.options.i3s)==null?void 0:a.token);this.pendingNodePages[r]={status:"Pending",promise:Wr(i,C3e,this.options)},this.nodePages[r]=await this.pendingNodePages[r].promise,this.nodesInNodePages+=this.nodePages[r].nodes.length,this.pendingNodePages[r].status="Done"}this.pendingNodePages[r].status==="Pending"&&(this.nodePages[r]=await this.pendingNodePages[r].promise);let n=t%this.nodesPerPage;return this.nodePages[r].nodes[n]}async formTileFromNodePages(t){let r=await this.getNodeById(t),n=[],a=[];for(let d of r.children||[])a.push(this.getNodeById(d));let i=await Promise.all(a);for(let d of i)n.push({id:d.index.toString(),obb:d.obb});let o,s,u,c="jpg",l=[],f=!1;if(r&&r.mesh){let{url:d,isDracoGeometry:h}=r.mesh.geometry&&this.getContentUrl(r.mesh.geometry)||{isDracoGeometry:!1};o=d,f=h;let{textureData:m,materialDefinition:g}=this.getInformationFromMaterial(r.mesh.material);u=g,c=m.format||c,m.name&&(s=`${this.url}/nodes/${r.mesh.material.resource}/textures/${m.name}`),this.tileset.attributeStorageInfo&&(l=w3e(this.tileset,this.url,r.mesh.attribute.resource))}let p=this.getLodSelection(r);return yz({id:t.toString(),lodSelection:p,obb:r.obb,contentUrl:o,textureUrl:s,attributeUrls:l,materialDefinition:u,textureFormat:c,textureLoaderOptions:this.textureLoaderOptions,children:n,isDracoGeometry:f})}getContentUrl(t){let r=null,n=this.tileset.geometryDefinitions[t.definition],a=-1,i=this.options.i3s;if(i&&typeof i=="object"&&i.useDracoGeometry&&(a=n.geometryBuffers.findIndex(o=>o.compressedAttributes&&o.compressedAttributes.encoding==="draco")),a===-1&&(a=n.geometryBuffers.findIndex(o=>!o.compressedAttributes)),a!==-1){let o=Boolean(n.geometryBuffers[a].compressedAttributes);r={url:`${this.url}/nodes/${t.resource}/geometries/${a}`,isDracoGeometry:o}}return r}getLodSelection(t){let r=[];return this.lodSelectionMetricType==="maxScreenThresholdSQ"&&r.push({metricType:"maxScreenThreshold",maxError:Math.sqrt(t.lodThreshold/(Math.PI*.25))}),r.push({metricType:this.lodSelectionMetricType,maxError:t.lodThreshold}),r}getInformationFromMaterial(t){var n,a,i;let r={textureData:{name:null}};if(t){let o=(n=this.tileset.materialDefinitions)==null?void 0:n[t.definition];if(o){r.materialDefinition=o;let s=(i=(a=o==null?void 0:o.pbrMetallicRoughness)==null?void 0:a.baseColorTexture)==null?void 0:i.textureSetDefinitionId;typeof s=="number"&&(r.textureData=this.textureDefinitionsSelectedFormats[s]||r.textureData)}}return r}initSelectedFormatsForTextureDefinitions(t){this.textureDefinitionsSelectedFormats=[];let r=this.getSupportedTextureFormats(),n=t.textureSetDefinitions||[];for(let a of n){let i=a&&a.formats||[],o=null;for(let s of r){let u=i.find(c=>c.format===s);if(u){o=u;break}}o&&o.format==="ktx2"&&(this.textureLoaderOptions.basis={containerFormat:"ktx2",module:"encoder"}),this.textureDefinitionsSelectedFormats.push(o)}}getSupportedTextureFormats(){let t=[],r=this.options.i3s;if(!r||r.useCompressedTextures){let n=uRt();n.has("etc2")&&t.push("ktx-etc2"),n.has("dxt")&&t.push("dds"),t.push("ktx2")}return t.push("jpg"),t.push("png"),t}};function uRt(e){let t=new Set;e=e||cRt()||void 0;for(let r of sRt)for(let n in D3e)e&&e.getExtension(`${r}${n}`)&&t.add(D3e[n]);return t}function cRt(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}function B3e(e,t){let r=t.url||"",n;e.geometryData&&(n=`${r}/${e.geometryData[0].href}`);let a;e.textureData&&(a=`${r}/${e.textureData[0].href}`);let i;e.attributeData&&(i=_3e(r,e));let o=e.children||[];return yz({...e,children:o,url:r,contentUrl:n,textureUrl:a,textureFormat:"jpg",attributeUrls:i,isDracoGeometry:!1})}function yz(e){var s,u;let t={},r=[0,0,0,1];if(e.mbs)r=e.mbs,t.sphere=[...Ft.WGS84.cartographicToCartesian(e.mbs.slice(0,3)),e.mbs[3]];else if(e.obb){t.box=[...Ft.WGS84.cartographicToCartesian(e.obb.center),...e.obb.halfSize,...e.obb.quaternion];let l=new fa().fromCenterHalfSizeQuaternion(t.box.slice(0,3),e.obb.halfSize,e.obb.quaternion).getBoundingSphere();t.sphere=[...l.center,l.radius],r=[...e.obb.center,l.radius]}let n=(s=e.lodSelection)==null?void 0:s[0].metricType,a=(u=e.lodSelection)==null?void 0:u[0].maxError,i="mesh",o=2;return{...e,mbs:r,boundingVolume:t,lodMetricType:n,lodMetricValue:a,type:i,refine:o}}async function F3e(e,t,r){let n=d4(r.url||""),a,i;if(e.nodePages)a=new f_(e,n,t),i=await a.formTileFromNodePages(0);else{let o=t.i3s&&typeof t.i3s=="object"?t.i3s:{},s=xb(`${n}/nodes/root`,o.token);i=await Wr(s,vl,{...t,i3s:{...o,loadContent:!1,isTileHeader:!0,isTileset:!1}})}return{...e,loader:vl,url:n,basePath:n,type:"I3S",nodePagesTile:a,root:i,lodMetricType:i.lodMetricType,lodMetricValue:i.lodMetricValue}}var lRt="4.4.0",fRt=/layers\/[0-9]+$/,pRt=/\.slpk$/,dRt=/nodes\/([0-9-]+|root)$/,hRt="504b0304",mRt="PointCloud",vl={dataType:null,batchType:null,name:"I3S (Indexed Scene Layers)",id:"i3s",module:"i3s",version:lRt,mimeTypes:["application/octet-stream"],parse:gRt,extensions:["bin"],options:{i3s:{token:void 0,isTileset:"auto",isTileHeader:"auto",tile:void 0,tileset:void 0,_tileOptions:void 0,_tilesetOptions:void 0,useDracoGeometry:!0,useCompressedTextures:!0,decodeTextures:!0,coordinateSystem:2}}};async function gRt(e,t={},r){let n=r.url;if(t.i3s=t.i3s||{},yRt(e)===hRt)throw new Error("Files with .slpk extention currently are not supported by I3SLoader");let i=d4(n),o;t.i3s.isTileset==="auto"?o=fRt.test(i)||pRt.test(i):o=t.i3s.isTileset;let s;return t.i3s.isTileHeader==="auto"?s=dRt.test(i):s=t.i3s.isTileHeader,o?e=await vRt(e,t,r):s?e=await xRt(e,r):e=await bRt(e,t),e}async function bRt(e,t){return await Xi(e,k3e,t)}async function vRt(e,t,r){let n=JSON.parse(new TextDecoder().decode(e));if((n==null?void 0:n.layerType)===mRt)throw new Error("Point Cloud layers currently are not supported by I3SLoader");return await F3e(n,t,r)}async function xRt(e,t){return e=JSON.parse(new TextDecoder().decode(e)),B3e(e,t)}function yRt(e){return e instanceof ArrayBuffer?[...new Uint8Array(e,0,4)].map(t=>t.toString(16).padStart(2,"0")).join(""):null}var _Rt=[{test:/^$/,extensions:["3dSceneLayer.json.gz"]},{test:/nodepages\/\d+$/,extensions:[".json.gz"]},{test:/sublayers\/\d+$/,extensions:["/3dSceneLayer.json.gz"]},{test:/nodes\/(\d+|root)$/,extensions:["/3dNodeIndexDocument.json.gz"]},{test:/nodes\/\d+\/textures\/.+$/,extensions:[".jpg",".png",".bin.dds.gz",".ktx",".ktx2"]},{test:/nodes\/\d+\/geometries\/\d+$/,extensions:[".bin.gz",".draco.gz"]},{test:/nodes\/\d+\/attributes\/f_\d+\/\d+$/,extensions:[".bin.gz"]},{test:/statistics\/(f_\d+\/\d+|summary)$/,extensions:[".json.gz"]},{test:/nodes\/\d+\/shared$/,extensions:["/sharedResource.json.gz"]}],m4=class extends pl{hashTable;_textEncoder=new TextEncoder;_textDecoder=new TextDecoder;_md5Hash=new mu;constructor(t,r,n){super(t,r,n),this.hashTable=r}async getFile(t,r="raw"){var n;if(r==="http"){let a=(n=_Rt.find(i=>i.test.test(t)))==null?void 0:n.extensions;if(a){let i;for(let o of a)if(i=await this.getDataByPath(`${t}${o}`),i)break;if(i)return i}}if(r==="raw"){let a=await this.getDataByPath(`${t}.gz`);if(a)return a;let i=await this.getFileBytes(t);if(i)return i}throw new Error(`No such file in the archive: ${t}`)}async getDataByPath(t){let r=await this.getFileBytes(t.toLocaleLowerCase());if(r||(r=await this.getFileBytes(t)),!!r)return/\.gz$/.test(t)?await new Ey().decompress(r):r}async getFileBytes(t){let r;if(this.hashTable){let n=this._textEncoder.encode(t),a=await this._md5Hash.hash(n.buffer,"hex"),i=this.hashTable[a];if(i===void 0)return;let o=await Os(i,this.file);if(!o)return;r=await Jr(this.file,o.fileDataOffset,o.fileDataOffset+o.compressedSize)}else try{r=await this.getFileWithoutHash(t)}catch{r=void 0}return r}};async function _z(e,t,r){let n=await Jd(e,Yd),a=await Xd(n,e),i;if((a==null?void 0:a.fileName)!=="@specialIndexFileHASH128@")i=await mN(e),t==null||t("SLPK doesnt contain hash file, hash info has been composed according to zip archive headers");else{let o=await Os(a.localHeaderOffset,e);if(!o)throw new Error("corrupted SLPK");let s=o.fileDataOffset,u=await Jr(e,s,s+o.compressedSize);i=Ty(u)}return new m4(e,i,r)}function I3e(e,t){let{attributeName:r,attributeType:n}=t;return r?{[r]:n?wRt(n,e):null}:{}}function wRt(e,t){switch(e){case b3e:return TRt(t);case v3e:return O3e(t);case x3e:return ERt(t);case y3e:return ARt(t);default:return O3e(t)}}function O3e(e){return new Uint32Array(e,4)}function ARt(e){return new Int16Array(e,4)}function ERt(e){return new Float64Array(e,8)}function TRt(e){let a=[];try{let i=new DataView(e,0,4).getUint32(0,!0),o=new Uint32Array(e,8,i),s=8+i*4;for(let u of o){let c=new TextDecoder("utf-8"),l=new Uint8Array(e,s,u);a.push(c.decode(l)),s+=u}}catch(i){console.error("Parse string attribute error: ",i.message)}return a}var SRt="4.4.0";var wz={dataType:null,batchType:null,name:"I3S Attribute",id:"i3s-attribute",module:"i3s",version:SRt,mimeTypes:["application/binary"],parse:async(e,t)=>I3e(e,t),extensions:["bin"],options:{},binary:!0};function Az(e,t){let r=[e.center[0],e.center[1],e.center[2]+t.getHeight(e.center[1],e.center[0])],n=Ft.WGS84.cartographicToCartesian(r,new Z),a=new fa().fromCenterHalfSizeQuaternion(n,e.halfSize,e.quaternion);return[...a.center,...a.halfAxes.toArray()]}var g4=Ct(Is(),1),kRt=()=>({version:{path:"version",default:"1.0"}}),P3e=()=>({boundingVolume:{path:"boundingVolume"},geometricError:{path:"geometricError"},refine:{path:"refine"},content:{path:"content"},children:{path:"children",transform:e=>e.map(t=>(0,g4.default)(t,P3e()))}}),R3e=()=>({asset:{path:"asset",transform:e=>(0,g4.default)(e,kRt())},geometricError:{path:"root",transform:e=>e.geometricError},root:{path:"root",transform:e=>(0,g4.default)(e,P3e())}});function j3e(e,t){let r=new Float32Array(e.length),n=DRt(t);for(let a=0;a<e.length;a+=2){let i=e.subarray(a,a+2),o=n.slice(a*2,a*2+4),s=CRt([i[0],i[1]]),u=[o[2]-o[0],o[3]-o[1]],c=[s[0]*u[0],s[1]*u[1]],l=[c[0]+o[0],c[1]+o[1]];r[a]=l[0],r[a+1]=l[1]}return r}function CRt(e){return[e[0]-Math.floor(e[0]),e[1]-Math.floor(e[1])]}function DRt(e){let r=[];for(let n=0;n<e.length;n++)r[n]=e[n]/65535;return r}var BRt=new mr([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),L3e=new Z,M3e="KHR_materials_unlit",FRt=1,ORt=1,b4=class{rtcCenter;i3sTile;tileType;constructor(t={outputVersion:"1.1"}){this.tileType=t.outputVersion==="1.0"?pa.BATCHED_3D_MODEL:pa.GLTF}async convert(t,r=null,n){let a=await this.buildGLTF(t,r,n);return this.tileType===pa.BATCHED_3D_MODEL?mS({gltfEncoded:new Uint8Array(a),type:"b3dm",featuresLength:this._getFeaturesLength(r),batchTable:r},vN):a}async buildGLTF(t,r,n){let{tileContent:a,textureFormat:i,box:o}=t,{material:s,attributes:u,indices:c,modelMatrix:l}=a,f=new Xt,p=await this._addI3sTextureToGLTF(a,i,f),d=s==null?void 0:s.pbrMetallicRoughness;d&&(d.metallicFactor===void 0||d.metallicFactor===FRt)&&(d.roughnessFactor===void 0||d.roughnessFactor===ORt)&&(f.addObjectExtension(s,M3e,{}),f.addExtension(M3e));let h=this._convertI3sMaterialToGLTFMaterial(s,p),m=f.addMaterial(h),g=u.positions,x=g.value;u.uvRegions&&u.texCoords&&(u.texCoords.value=j3e(u.texCoords.value,u.uvRegions.value));let y=new Z(o),w=Ft.WGS84.cartesianToCartographic(y,new Z);u.positions.value=this._normalizePositions(x,y,w,l),this._createBatchIds(a,r),u.normals&&!this._checkNormals(u.normals.value)&&delete u.normals;let T=c||Ek(x.length/g.size),A=f.addMesh({attributes:u,indices:T,material:m,mode:4});this.tileType===pa.GLTF&&this._createMetadataExtensions(f,A,r,n,a);let B=this._generateTransformMatrix(y),I=f.addNode({meshIndex:A,matrix:B}),L=f.addScene({nodeIndices:[I]});return f.setDefaultScene(L),f.createBinaryChunk(),mS(f.gltf,t7,{gltfBuilder:f})}_createMetadataExtensions(t,r,n,a,i){var c;let o=this._createPropertyAttibutes(n,a),s=e8(t,o),u=t.getMesh(r);for(let l of u.primitives)(c=i.attributes._BATCHID)!=null&&c.value&&QS(t,l,i.attributes._BATCHID.value,s)}_createPropertyAttibutes(t,r){if(!t||!r)return[];let n=[];for(let a in t){let i=this._convertAttributeStorageInfoToPropertyAttribute(a,r,t);i&&n.push(i)}return n}_convertAttributeStorageInfoToPropertyAttribute(t,r,n){let a=n[t],i=r.find(l=>l.name===t);if(!i)return null;let o=i.attributeValues;if(!(o!=null&&o.valueType))return null;let s,u;switch(o.valueType.toLowerCase()){case"oid32":s="SCALAR",u="UINT32";break;case"int32":s="SCALAR",u="INT32";break;case"uint32":s="SCALAR",u="UINT32";break;case"int16":s="SCALAR",u="INT16";break;case"uint16":s="SCALAR",u="UINT16";break;case"float64":s="SCALAR",u="FLOAT64";break;case"string":s="STRING";break;default:s="";break}let c={name:t,elementType:s,componentType:u,values:[]};return yL(a)?c.values=Array.from(a):a!==null&&(c.values=a),c}async _addI3sTextureToGLTF(t,r,n){let{texture:a,material:i,attributes:o}=t,s=null,u=a;if(!a&&i&&(u=i.pbrMetallicRoughness&&i.pbrMetallicRoughness.baseColorTexture&&i.pbrMetallicRoughness.baseColorTexture.texture.source.image),u){let c=this._deduceMimeTypeFromFormat(r),l=n.addImage(u,c);s=n.addTexture({imageIndex:l}),delete o.colors}return s}_normalizePositions(t,r,n,a){let i=new Float32Array(t.length);for(let o=0;o<t.length;o+=3){let s=t.subarray(o,o+3),u=new Z(r),c=new Z(Array.from(s)).transform(a).add(n);Ft.WGS84.cartographicToCartesian(c,L3e),c=L3e.subtract(u),i.set(c,o)}return i}_generateTransformMatrix(t){return new mr().translate(t).multiplyLeft(BRt)}_createBatchIds(t,r){let{featureIds:n}=t,{OBJECTID:a}=r||{};if(!(!n||!a)){for(let i=0;i<n.length;i++){let o=n[i],s=a.indexOf(o);n[i]=s}t.attributes._BATCHID={size:1,byteOffset:0,value:n}}}_deduceMimeTypeFromFormat(t){switch(t){case"jpg":return"image/jpeg";case"png":return"image/png";case"ktx2":return"image/ktx2";default:return console.warn(`Unexpected texture format in I3S: ${t}`),"image/jpeg"}}_convertI3sMaterialToGLTFMaterial(t,r){let n=r!==null;return t?(r!==null&&(t=this._setGLTFTexture(t,r)),t):(t={alphaMode:"OPAQUE",doubleSided:!1,pbrMetallicRoughness:{metallicFactor:0,roughnessFactor:1}},n?t.pbrMetallicRoughness.baseColorTexture={index:r,texCoord:0}:t.pbrMetallicRoughness.baseColorFactor=[1,1,1,1],t)}_setGLTFTexture(t,r){let n={...t,pbrMetallicRoughness:{...t.pbrMetallicRoughness}};return t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture?n.pbrMetallicRoughness.baseColorTexture={index:r,texCoord:0}:t.emissiveTexture?n.emissiveTexture={index:r,texCoord:0}:t.pbrMetallicRoughness&&t.pbrMetallicRoughness.metallicRoughnessTexture?n.pbrMetallicRoughness.metallicRoughnessTexture={index:r,texCoord:0}:t.normalTexture?n.normalTexture={index:r,texCoord:0}:t.occlusionTexture&&(n.occlusionTexture={index:r,texCoord:0}),n}_getFeaturesLength(t){if(!t)return 0;let r=Object.keys(t)[0];return r?t[r].length:0}_checkNormals(t){return t.find(r=>r)}};var q3e=async(e,t,r,n)=>{if(!e||!t.contentUrl)return null;let a={...r,i3s:{...r.i3s,isTileset:!1,isTileHeader:!1,_tileOptions:{attributeUrls:t.attributeUrls||[],textureUrl:t.textureUrl,textureFormat:t.textureFormat,textureLoaderOptions:t.textureLoaderOptions,materialDefinition:t.materialDefinition,isDracoGeometry:t.isDracoGeometry,mbs:t.mbs},_tilesetOptions:{store:e.store,attributeStorageInfo:e.attributeStorageInfo,fields:e.fields}}};return await p_(t.contentUrl,vl,a,n)};async function N3e(e){let t=e.split(".slpk");if(t.length===2){let r=`${t[0]}.slpk`,n=new Ha(r),a=await _z(n,void 0,r);return new fl(a)}return null}async function p_(e,t,r,n){return n!==null?await Wr(e,t,{...r,core:{...r==null?void 0:r.core,fetch:n.fetch.bind(n)}}):await Wr(e,t,r)}async function U3e(e){if(!(e!=null&&e.file))return 0;let t=new Set,r=Ku(e.file);for await(let n of r){let a=n.fileName,i=/^nodes\/(\d+)\//.exec(a);i&&t.add(i[1])}return t.size}var IRt="I3S",yb=class{options;tilesetPath;vertexCounter;conversionStartTime;geoidHeightModel;sourceTileset;attributeStorageInfo;workerSource={};slpkFilesystem=null;loaderOptions={core:{_nodeWorkers:!0,reuseWorkers:!0,worker:!1},i3s:{coordinateSystem:3,decodeTextures:!1},"i3s-content":{workerUrl:"./modules/i3s/dist/i3s-content-worker-node.js"}};conversionDump;progress;fileExt;constructor(){this.options={},this.tilesetPath="",this.vertexCounter=0,this.conversionStartTime=[0,0],this.geoidHeightModel=null,this.sourceTileset=null,this.attributeStorageInfo=null,this.workerSource={},this.conversionDump=new lh,this.progress=new tb,this.fileExt=""}async convert(t){var m;if(pr)return console.log(eb),eb;let{inputUrl:r,outputPath:n,outputVersion:a,tilesetName:i,maxDepth:o,egmFilePath:s,inquirer:u,analyze:c}=t;this.conversionStartTime=Ez.default.hrtime(),this.options={maxDepth:o,inquirer:u,outputVersion:a},this.fileExt=this.options.outputVersion==="1.0"?"b3dm":"glb",console.log("Loading egm file..."),this.geoidHeightModel=await Wr(s,kk),console.log("Loading egm file completed!"),this.slpkFilesystem=await N3e(r);let l=!0;if((c||this.slpkFilesystem)&&(l=await this.preprocessConversion(),!l||c)||(this.progress.startMonitoring(),this.sourceTileset=await p_(r,vl,{...this.loaderOptions,i3s:{...this.loaderOptions.i3s,isTileset:!0}},this.slpkFilesystem),!this.sourceTileset))return;let f=(m=this.sourceTileset)==null?void 0:m.root;if(f.obb||(f.obb=EN(f.mbs)),this.tilesetPath=(0,z3e.join)(`${n}`,`${i}`),this.attributeStorageInfo=this.sourceTileset.attributeStorageInfo,await this.conversionDump.createDump(t),this.conversionDump.restored&&this.options.inquirer&&((await this.options.inquirer.prompt([{name:"resumeConversion",type:"confirm",message:"Dump file of the previous conversion exists, do you want to resume that conversion?"}])).resumeConversion||this.conversionDump.reset()),!this.conversionDump.restored)try{await By(this.tilesetPath)}catch{}let p={boundingVolume:{box:Az(f.obb,this.geoidHeightModel)},geometricError:kN(f),children:[],refine:"REPLACE"};await this._addChildren(f,p,1);let d=(0,G3e.default)({asset:{version:a},root:p},R3e());await Oi(this.tilesetPath,JSON.stringify(d),"tileset.json"),await this.conversionDump.deleteDumpFile(),this.progress.stopMonitoring(),await this._finishConversion({slpk:!1,outputPath:n,tilesetName:i}),this.slpkFilesystem&&this.slpkFilesystem.destroy(),Ua.getWorkerFarm({}).destroy()}async preprocessConversion(){console.log("Analyze source layer");let t=await U3e(this.slpkFilesystem);if(this.progress.stepsTotal=t,console.log("------------------------------------------------"),console.log("Preprocess results:"),this.slpkFilesystem){if(console.log(`Node count: ${t}`),t===0)return console.log("Node count is 0. The conversion will be interrupted."),console.log("------------------------------------------------"),!1}else console.log("Node count cannot be calculated for the remote dataset");return console.log("------------------------------------------------"),!0}async convertChildNode(t,r,n,a){let i=r,o=await this._loadChildNode(t,a);if(o.contentUrl){if(this.conversionDump.restored&&this.conversionDump.isFileConversionComplete(`${o.id}.${this.fileExt}`)&&(o.obb||o.mbs)){let{child:y}=this._createChildAndBoundingVolume(o);r.children.push(y),await this._addChildren(o,y,n+1);return}let f=await q3e(this.sourceTileset,o,this.loaderOptions,this.slpkFilesystem);if(!f){await this._addChildren(o,r,n+1);return}this.vertexCounter+=(f==null?void 0:f.vertexCount)||0;let p=null;this.attributeStorageInfo&&(p=await this._loadChildAttributes(o,this.attributeStorageInfo));let{child:d,boundingVolume:h}=this._createChildAndBoundingVolume(o),m={tileContent:f,box:h.box||[],textureFormat:o.textureFormat},x=await new b4({outputVersion:this.options.outputVersion}).convert(m,p,this.attributeStorageInfo);await this.conversionDump.addNode(`${o.id}.${this.fileExt}`,o.id),await Oi(this.tilesetPath,new Uint8Array(x),`${o.id}.${this.fileExt}`),await this.conversionDump.updateConvertedNodesDumpFile(`${o.id}.${this.fileExt}`,o.id,!0),r.children.push(d),i=d}this.progress.stepsDone+=1;let s="Calculating time left...",u=this.progress.getTimeRemainingString();u&&(s=`${u} left`);let c=this.progress.getPercentString(),l=c?` ${c}%, ${s}`:"";console.log(`[converted${l}]: ${a.id}`),await this._addChildren(o,i,n+1)}async _addChildren(t,r,n){if(!(this.options.maxDepth&&n>this.options.maxDepth))for(let a of t.children||[])await this.convertChildNode(t,r,n,a)}async _loadChildNode(t,r){var a;let n;if((a=this.sourceTileset)!=null&&a.nodePagesTile)console.log(`Node conversion: ${r.id}`),n=await this.sourceTileset.nodePagesTile.formTileFromNodePages(parseInt(r.id));else{let i=this._relativeUrlToFullUrl(t.url,r.href),o={i3s:{...this.loaderOptions,isTileHeader:!0,loadContent:!1}};console.log(`Node conversion: ${i}`),n=await p_(i,vl,o,this.slpkFilesystem)}return n}_createChildAndBoundingVolume(t){t.obb||(t.obb=EN(t.mbs));let r={box:Az(t.obb,this.geoidHeightModel)},n={boundingVolume:r,geometricError:kN(t),children:[],content:{uri:`${t.id}.${this.fileExt}`,boundingVolume:r}};return{boundingVolume:r,child:n}}_relativeUrlToFullUrl(t="",r){let n=t.split("/"),a=r.split("/");for(let i of a)switch(i){case".":continue;case"..":n=n.slice(0,-1);break;default:n.push(i)}return n.join("/")}async _loadChildAttributes(t,r){let n=[],{attributeUrls:a=[]}=t;for(let o=0;o<a.length;o++){let s=a[o],u=r[o],c={i3s:{attributeName:u.name,attributeType:this._getAttributeType(u)}};n.push(p_(s,wz,c,this.slpkFilesystem))}let i=await Promise.all(n);return this._replaceNestedArrays(i),Object.assign({},...i)}_getAttributeType(t){return t.attributeValues?t.attributeValues.valueType:t.objectIds?"Oid32":""}_replaceNestedArrays(t){for(let r=0;r<t.length;r++){let n=t[r];for(let a in n)n[a]=Array.from(n[a])}}async _finishConversion(t){let r=await wk(t),n=Ez.default.hrtime(this.conversionStartTime),a=Jg(n);console.log("------------------------------------------------"),console.log(`Finish conversion of ${IRt}`),console.log(`Total conversion time: ${a}`),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",r," bytes"),console.log("------------------------------------------------")}};var _b=require("path");var PRt="4.4.0",RRt="https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip",v4=class{async install(t=""){console.log('Installing "EGM2008-5" model...');let r=await Wr(RRt,uN,{}),n=process.cwd();t&&(n=(0,_b.join)(n,t)),await Oi(n,new Uint8Array(r["geoids/egm2008-5.pgm"]),"egm2008-5.pgm"),console.log('Installing "I3S Content Loader" worker'),await this.installFromNpm("i3s","i3s-content-worker-node.js"),console.log('Installing "Draco Loader" worker'),await this.installFromNpm("draco","draco-worker-node.js"),console.log('Installing "Draco Writer" worker'),await this.installFromNpm("draco","draco-writer-worker-node.js"),console.log('Installing "Basis Loader" worker'),await this.installFromNpm("textures","basis-worker-node.js"),console.log('Installing "KTX2 Basis Writer" worker'),await this.installFromNpm("textures","ktx2-basis-writer-worker-node.js"),console.log('Installing "Draco decoder" library'),await this.installFromUrl(Ru[Ur.DECODER],"draco",Ur.DECODER),await this.installFromUrl(Ru[Ur.DECODER_WASM],"draco",Ur.DECODER_WASM),console.log('Installing "Draco encoder" library'),await this.installFromUrl(Ru[Ur.ENCODER],"draco",Ur.ENCODER),console.log('Installing "Basis transcoder" library'),await this.installFromNpm("textures",Mu.TRANSCODER,"libs"),await this.installFromNpm("textures",Mu.TRANSCODER_WASM,"libs"),console.log('Installing "Basis encoder" library'),await this.installFromNpm("textures",Mu.ENCODER,"libs"),await this.installFromNpm("textures",Mu.ENCODER_WASM,"libs"),console.log('Installing "join-images" npm package');let a=new c0,i=(0,_b.dirname)(process.execPath);await a.start({command:`"${i}/${process.platform==="win32"?"npm.cmd":"npm"}"`,arguments:["install","sharp@0.30.4","join-images@1.1.3"],wait:0,ignoreStderr:!0,spawn:{shell:!0}}),console.log("All dependencies were installed succesfully.")}async installFromNpm(t,r,n=""){let a=await si(`https://unpkg.com/@loaders.gl/${t}@${PRt}/dist/${n}/${r}`);if(a.status<200||a.status>=300)throw new Error(`Failed to load resource ${r}`);let i=await a.arrayBuffer();if(!i)return;let o=(0,_b.join)(process.cwd(),"modules",t,"dist",n);await Oi(o,i,r)}async installFromUrl(t,r,n){let i=await(await si(t)).arrayBuffer();if(!i)return;let o=(0,_b.join)(process.cwd(),"modules",r,"dist","libs");await Oi(o,i,n)}};function Us(e,t){if(e+1>=t.length)return"";let r=t[e+1];return r.indexOf("--")===0?"":r}function H3e(e,t){let r=Us(e,t);return console.log(`Input tileset value: ${r}`),console.log(`Modified tileset value: ${r.replace(/\\/g,"/")}`),r.replace(/\\/g,"/")}function V3e(e){return e.reduce((t,r)=>{let n=r.indexOf("="),a=r.slice(0,n),i=r.slice(n+1,r.length);return r.includes("=")&&r.startsWith("--")&&i?t.concat(a,i):t.concat(r)},[])}function $3e(e,t){let r=Us(e,t),n=Number.parseInt(r);return isFinite(n)?n:NaN}function zs(e,t){let r=Us(e,t).toLowerCase().trim();return["--no-draco","--split-nodes"].includes(t[e])&&!r?!1:!r||r==="true"}var J3e=require("fs/promises"),Tz={I3S:"I3S",_3DTILES:"3DTILES"};async function jRt(){let[,,...e]=process.argv;e.length===0&&Sz();let t=V3e(e),r=MRt(t);if(r.installDependencies){new v4().install("deps");return}if(r.addHash){let a=W3e(r,!0),i=a.tileset;if(!r.quiet)if(a.output==="data"){let s=a.tileset.substring(0,a.tileset.length-5);(await x4.default.prompt([{name:"isNewFileRequired",type:"list",message:"What would you like to do?",choices:[{name:"Add hash file to the current SLPK file",value:!1},{name:`Create a new file ${s}-hash.slpk with hash file inside`,value:!0}]}])).isNewFileRequired&&(i=`${s}-hash.slpk`)}else i=a.output;i!==a.tileset&&await(0,J3e.copyFile)(a.tileset,i);let o=await Sy(Ku(new Ha(i)));await dN(i,o,"@specialIndexFileHASH128@");return}let n=W3e(r);await LRt(n)}jRt().catch(e=>{console.log(e),process.exit(1)});function Sz(){console.log("cli: converter 3dTiles to I3S or I3S to 3dTiles..."),console.log('--install-dependencies [Run the script for installing dependencies. Run this options separate from others. Now "*.pgm" file installation is implemented]'),console.log("--max-depth [Maximal depth of hierarchical tiles tree traversal, default: infinite]"),console.log("--name [Tileset name]"),console.log('--output [Output folder, default: "data" folder]'),console.log("--instant-node-writing [Keep created 3DNodeIndexDocument files on disk instead of memory. This option reduces memory usage but decelerates conversion speed]"),console.log("--split-nodes [Prevent merging similar materials that could lead to incorrect visualization (I3S to 3DTiles conversion only)]"),console.log("--slpk [(Deprecated since version 4.3.0) Whether the converter generates *.slpk (Scene Layer Package) I3S output files. Note: For versions 4.3.0 and up *.slpk is the default output without this option specified.]"),console.log("--tileset [tileset.json file (3DTiles) / http://..../SceneServer/layers/0 resource (I3S)]"),console.log("--input-type [tileset input type: I3S or 3DTILES]"),console.log("--output-version [3DTiles version: 1.0 or 1.1, default: 1.1]. This option supports only 1.0/1.1 values for 3DTiles output. I3S output version setting is not supported yet."),console.log('--egm [location of Earth Gravity Model *.pgm file to convert heights from ellipsoidal to gravity-related format or "None" to not use it. A model file can be loaded from GeographicLib https://geographiclib.sourceforge.io/html/geoid.html], default: "./deps/egm2008-5.zip"'),console.log("--token [Token for Cesium ION tilesets authentication]"),console.log("--no-draco [Disable draco compression for geometry]"),console.log("--generate-textures [Enable KTX2 textures generation if only one of (JPG, PNG) texture is provided or generate JPG texture if only KTX2 is provided]"),console.log("--generate-bounding-volumes [Generate obb and mbs bounding volumes from geometry]"),console.log("--analyze [Analyze the input tileset content without conversion, default: false]"),console.log('--metadata-class [One of the list of feature metadata classes, detected by converter on "analyze" stage, default: not set]'),console.log("--validate [Enable validation]"),console.log("--quiet [Skip all prompts that stop conversion and wait for a user input: default: false]"),process.exit(0)}async function LRt(e){switch(console.log("------------------------------------------------"),console.log(`Starting conversion of ${e.inputType}`),console.log("------------------------------------------------"),e.inputType.toUpperCase()){case Tz.I3S:await new yb().convert({inputUrl:e.tileset,outputPath:e.output,outputVersion:e.outputVersion,tilesetName:e.name,maxDepth:e.maxDepth,egmFilePath:e.egm,analyze:e.analyze,inquirer:e.quiet?void 0:x4.default});break;case Tz._3DTILES:await new bb().convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,egmFilePath:e.egm,token:e.token,draco:e.draco,mergeMaterials:e.mergeMaterials,generateTextures:e.generateTextures,generateBoundingVolumes:e.generateBoundingVolumes,validate:e.validate,instantNodeWriting:e.instantNodeWriting,metadataClass:e.metadataClass,analyze:e.analyze,inquirer:e.quiet?void 0:x4.default});break;default:Sz()}}function W3e(e,t){let r={name:{getMessage:()=>console.log("Missed: --name [Tileset name]"),condition:a=>t||Boolean(a)||Boolean(e.analyze)},output:{getMessage:()=>console.log("Missed: --output [Output path name]")},egm:{getMessage:()=>console.log("Missed: --egm [*.pgm earth gravity model file path]")},tileset:{getMessage:()=>console.log("Missed: --tileset [tileset.json file]")},inputType:{getMessage:()=>console.log("Missed/Incorrect: --input-type [tileset input type: I3S or 3DTILES]"),condition:a=>t||Boolean(a)&&Object.values(Tz).includes(a.toUpperCase())},outputVersion:{getMessage:()=>console.log('Incorrect: --output-version [1.0 or 1.1] is for --input-type "I3S" only'),condition:a=>t||Boolean(a)&&Object.values(["1.0","1.1"]).includes(a)&&Boolean(e.inputType==="I3S")||Boolean(e.inputType!=="I3S")||Boolean(e.analyze)}},n=[];for(let a in r){let i=e[a],o=r[a].condition;(o?o(i):i)||n.push(r[a].getMessage)}return n.length&&(n.forEach(a=>a()),process.exit(1)),e}function MRt(e){let t={output:"data",outputVersion:"1.1",instantNodeWriting:!1,mergeMaterials:!0,egm:(0,K3e.join)(process.cwd(),"deps","egm2008-5.pgm"),draco:!0,installDependencies:!1,generateTextures:!1,generateBoundingVolumes:!1,validate:!1,addHash:!1,quiet:!1};return e.forEach((r,n)=>{if(r.indexOf("--")===0)switch(r){case"--input-type":t.inputType=Us(n,e);break;case"--tileset":t.tileset=H3e(n,e);break;case"--name":t.name=Us(n,e);break;case"--output":t.output=Us(n,e);break;case"--output-version":t.outputVersion=Us(n,e);break;case"--instant-node-writing":t.instantNodeWriting=zs(n,e);break;case"--split-nodes":t.mergeMaterials=zs(n,e);break;case"--max-depth":t.maxDepth=$3e(n,e);break;case"--add-hash":t.addHash=zs(n,e);break;case"--egm":t.egm=Us(n,e);break;case"--token":t.token=Us(n,e);break;case"--no-draco":t.draco=zs(n,e);break;case"--validate":t.validate=zs(n,e);break;case"--install-dependencies":t.installDependencies=zs(n,e);break;case"--generate-textures":t.generateTextures=zs(n,e);break;case"--generate-bounding-volumes":t.generateBoundingVolumes=zs(n,e);break;case"--analyze":t.analyze=zs(n,e);break;case"--quiet":t.quiet=zs(n,e);break;case"--metadata-class":t.metadataClass=Us(n,e);break;case"--help":Sz();break;case"--slpk":break;default:console.warn(`Unknown option ${r}`),process.exit(0)}}),t}
160
+ `).forEach(s=>{let u=i.exec(s);u&&a.push(Number(u[1]))});let o=e;for(;a.includes(o);)o++;t(o)})})}async function IMe(){var e;if(typeof process>"u"||!((e=process.versions)!=null&&e.node))throw new Error("ChildProcessProxy is only available in Node.js environments");return await import("child_process")}var Nte={command:"",arguments:[],port:5e3,autoPort:!0,wait:2e3,onSuccess:e=>{console.log(`Started ${e.props.command}`)}},c0=class{id;props={...Nte};childProcess=null;port=0;successTimer;constructor({id:t="browser-driver"}={}){this.id=t}async start(t){t={...Nte,...t},this.props=t;let r=await IMe(),n=[...t.arguments];return this.port=Number(t.port),t.portArg&&(t.autoPort&&(this.port=await qte(t.port)),n.push(t.portArg,String(this.port))),await new Promise((a,i)=>{var o,s;try{this._setTimeout(()=>{t.onSuccess&&t.onSuccess(this),a({})}),console.log(`Spawning ${t.command} ${t.arguments.join(" ")}`);let u=t.spawn||{},c=r.spawn(t.command,n,u);this.childProcess=c,(o=c.stdout)==null||o.on("data",l=>{console.log(l.toString())}),(s=c.stderr)==null||s.on("data",l=>{console.log(`Child process wrote to stderr: "${l}".`),t.ignoreStderr||(this._clearTimeout(),i(new Error(l)))}),c.on("error",l=>{console.log(`Child process errored with ${l}`),this._clearTimeout(),i(l)}),c.on("close",l=>{console.log(`Child process exited with ${l}`),this.childProcess=null,this._clearTimeout(),a({})})}catch(u){i(u)}})}async stop(){this.childProcess&&(this.childProcess.kill(),this.childProcess=null)}async exit(t=0){try{await this.stop(),process.exit(t)}catch(r){console.error(r.message||r),process.exit(1)}}_setTimeout(t){Number(this.props.wait)>0&&(this.successTimer=setTimeout(t,this.props.wait))}_clearTimeout(){this.successTimer&&clearTimeout(this.successTimer)}};function QB(e,t){var a,i;if(!Ua.isSupported())return!1;let r=(t==null?void 0:t._nodeWorkers)??((a=t==null?void 0:t.core)==null?void 0:a._nodeWorkers);if(!Pn&&!r)return!1;let n=(t==null?void 0:t.worker)??((i=t==null?void 0:t.core)==null?void 0:i.worker);return Boolean(e.worker&&n)}async function ZB(e,t,r,n,a){let i=e.id,o=jv(e,r),u=Ua.getWorkerFarm(r==null?void 0:r.core).getWorkerPool({name:i,url:o});r=JSON.parse(JSON.stringify(r)),n=JSON.parse(JSON.stringify(n||{}));let c=await u.startJob("process-on-worker",PMe.bind(null,a));return c.postMessage("process",{input:t,options:r,context:n}),await(await c.result).result}async function PMe(e,t,r,n){switch(r){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":let{id:a,input:i,options:o}=n;try{let s=await e(i,o);t.postMessage("done",{id:a,result:s})}catch(s){let u=s instanceof Error?s.message:"unknown error";t.postMessage("error",{id:a,error:u})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function eF(e,t){var a,i;if(!Ua.isSupported())return!1;let r=(t==null?void 0:t._nodeWorkers)??((a=t==null?void 0:t.core)==null?void 0:a._nodeWorkers),n=(t==null?void 0:t.worker)??((i=t==null?void 0:t.core)==null?void 0:i.worker);return!pr&&!r?!1:Boolean(e.worker&&n)}function zte(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?Ute(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?Ute(e,0,t):""}function Ute(e,t,r){if(e.byteLength<=t+r)return"";let n=new DataView(e),a="";for(let i=0;i<r;i++)a+=String.fromCharCode(n.getUint8(t+i));return a}function tF(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${zte(e)}"`)}}function pu(e,t,r){if(r=r||e.byteLength,e.byteLength<r||t.byteLength<r)return!1;let n=new Uint8Array(e),a=new Uint8Array(t);for(let i=0;i<n.length;++i)if(n[i]!==a[i])return!1;return!0}function bn(...e){return bw(e)}function bw(e){let t=e.map(i=>i instanceof ArrayBuffer?new Uint8Array(i):i),r=t.reduce((i,o)=>i+o.byteLength,0),n=new Uint8Array(r),a=0;for(let i of t)n.set(i,a),a+=i.byteLength;return n.buffer}function Wi(...e){let t=e,r=t&&t.length>1&&t[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let n=t.reduce((o,s)=>o+s.length,0),a=new r(n),i=0;for(let o of t)a.set(o,i),i+=o.length;return a}function Rp(e,t,r){let n=r!==void 0?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}function Ki(e,t){return yt(e>=0),yt(t>0),e+(t-1)&~(t-1)}function rF(e,t,r){let n;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else{let a=e.byteOffset,i=e.byteLength;n=new Uint8Array(e.buffer||e.arrayBuffer,a,i)}return t.set(n,r),r+Ki(n.byteLength,4)}function nF(e,t){let r=e.length,a=Math.ceil(r/t)*t-r,i="";for(let o=0;o<a;++o)i+=" ";return e+i}function l0(e,t,r,n){if(e)for(let a=0;a<n;a++)e.setUint8(t+a,r.charCodeAt(a));return t+n}function Mv(e,t,r,n){if(e)for(let a=0;a<n;a++)e.setUint8(t+a,r[a]);return t+n}function vw(e,t,r,n){let a=Ki(r.byteLength,n),i=a-r.byteLength;if(e){let o=new Uint8Array(e.buffer,e.byteOffset+t,r.byteLength),s=new Uint8Array(r);o.set(s);for(let u=0;u<i;++u)e.setUint8(t+r.byteLength+u,32)}return t+=a,t}function f0(e,t,r,n){let i=new TextEncoder().encode(r);return t=vw(e,t,i,n),t}async function jp(e){let t=[];for await(let r of e)t.push(RMe(r));return bn(...t)}function RMe(e){if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e)){let{buffer:t,byteOffset:r,byteLength:n}=e;return Gte(t,r,n)}return Gte(e)}function Gte(e,t=0,r=e.byteLength-t){let n=new Uint8Array(e,t,r),a=new Uint8Array(n.length);return a.set(n),a.buffer}var jMe="",Hte={};function du(e){for(let t in Hte)if(e.startsWith(t)){let r=Hte[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${jMe}${e}`),e}var LMe="4.4.1",aF={dataType:null,batchType:null,name:"JSON",id:"json",module:"json",version:LMe,extensions:["json","geojson"],mimeTypes:["application/json"],category:"json",text:!0,parseTextSync:Vte,parse:async e=>Vte(new TextDecoder().decode(e)),options:{}};function Vte(e){return JSON.parse(e)}function $te(e){return Buffer.isBuffer(e)?new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer:e}function xw(e){return e&&typeof e=="object"&&e.isBuffer}function Wn(e){if(xw(e))return $te(e);if(e instanceof ArrayBuffer)return e;if(NB(e))return Hl(e);if(ArrayBuffer.isView(e)){let t=e.buffer;return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?t:t.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(typeof e=="string"){let t=e;return new TextEncoder().encode(t).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}function za(e){if(e instanceof ArrayBuffer)return e;if(NB(e))return Hl(e);let{buffer:t,byteOffset:r,byteLength:n}=e;return t instanceof ArrayBuffer&&r===0&&n===t.byteLength?t:Hl(t,r,n)}function Hl(e,t=0,r=e.byteLength-t){let n=new Uint8Array(e,t,r),a=new Uint8Array(n.length);return a.set(n),a.buffer}function iF(e){return ArrayBuffer.isView(e)?e:new Uint8Array(e)}function p0(e){return t=>new Promise((r,n)=>e(t,(a,i)=>a?n(a):r(i)))}var Ga={};Fa(Ga,{dirname:()=>NMe,filename:()=>qMe,join:()=>UMe,resolve:()=>zMe});function Wte(){var t;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=(t=window.location)==null?void 0:t.pathname;return(e==null?void 0:e.slice(0,e.lastIndexOf("/")+1))||""}function qMe(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):e}function NMe(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function UMe(...e){let t="/";return e=e.map((r,n)=>(n&&(r=r.replace(new RegExp(`^${t}`),"")),n!==e.length-1&&(r=r.replace(new RegExp(`${t}$`),"")),r)),e.join(t)}function zMe(...e){let t=[];for(let i=0;i<e.length;i++)t[i]=e[i];let r="",n=!1,a;for(let i=t.length-1;i>=-1&&!n;i--){let o;i>=0?o=t[i]:(a===void 0&&(a=Wte()),o=a),o.length!==0&&(r=`${o}/${r}`,n=o.charCodeAt(0)===qv)}return r=GMe(r,!n),n?`/${r}`:r.length>0?r:"."}var qv=47,oF=46;function GMe(e,t){let r="",n=-1,a=0,i,o=!1;for(let s=0;s<=e.length;++s){if(s<e.length)i=e.charCodeAt(s);else{if(i===qv)break;i=qv}if(i===qv){if(!(n===s-1||a===1))if(n!==s-1&&a===2){if(r.length<2||!o||r.charCodeAt(r.length-1)!==oF||r.charCodeAt(r.length-2)!==oF){if(r.length>2){let u=r.length-1,c=u;for(;c>=0&&r.charCodeAt(c)!==qv;--c);if(c!==u){r=c===-1?"":r.slice(0,c),n=s,a=0,o=!1;continue}}else if(r.length===2||r.length===1){r="",n=s,a=0,o=!1;continue}}t&&(r.length>0?r+="/..":r="..",o=!0)}else{let u=e.slice(n+1,s);r.length>0?r+=`/${u}`:r=u,o=!1}n=s,a=0}else i===oF&&a!==-1?++a:a=-1}return r}var Nv=class{handle;size;bigsize;url;constructor(t){this.handle=t instanceof ArrayBuffer?new Blob([t]):t,this.size=t instanceof ArrayBuffer?t.byteLength:t.size,this.bigsize=BigInt(this.size),this.url=t instanceof File?t.name:""}async close(){}async stat(){return{size:this.handle.size,bigsize:BigInt(this.handle.size),isDirectory:!1}}async read(t,r){return await this.handle.slice(Number(t),Number(t)+Number(r)).arrayBuffer()}};var d0=class{handle;size=0;bigsize=0n;url;constructor(t){this.handle=t,this.url=t}async close(){}async stat(){let t=await fetch(this.handle,{method:"HEAD"});if(!t.ok)throw new Error(`Failed to fetch HEAD ${this.handle}`);let r=parseInt(t.headers.get("Content-Length")||"0");return{size:r,bigsize:BigInt(r),isDirectory:!1}}async read(t=0,r=0){return await(await this.fetchRange(t,r)).arrayBuffer()}async fetchRange(t,r,n){let a=Number(t),i=Number(r),o;n||(o=new AbortController,n=o.signal);let s=this.handle,u=await fetch(s,{signal:n,headers:{Range:`bytes=${a}-${a+i-1}`}});switch(u.status){case 206:break;case 200:let c=u.headers.get("Content-Length");if(!c||Number(c)>r)throw o&&o.abort(),Error("content-length header missing or exceeding request. Server must support HTTP Byte Serving.");case 416:if(t===0){let l=u.headers.get("Content-Range");if(!l||!l.startsWith("bytes *"))throw Error("Missing content-length on 416 response");let f=Number(l.substr(8));u=await fetch(this.url,{signal:n,headers:{Range:`bytes=0-${f-1}`}})}break;default:if(u.status>=300)throw Error(`Bad response code: ${u.status}`)}return u}};var Uv=new Error("Not implemented"),Ha=class{handle;size=0;bigsize=0n;url="";constructor(t,r,n){var a;if((a=globalThis.loaders)!=null&&a.NodeFile)return new globalThis.loaders.NodeFile(t,r,n);throw pr?new Error("Can't instantiate NodeFile in browser."):new Error("Can't instantiate NodeFile. Make sure to import @loaders.gl/polyfills first.")}async read(t,r){throw Uv}async write(t,r,n){throw Uv}async stat(){throw Uv}async truncate(t){throw Uv}async append(t){throw Uv}async close(){}};var h0=new Error("Not implemented"),zv=class{constructor(t){var r;if((r=globalThis.loaders)!=null&&r.NodeFileSystem)return new globalThis.loaders.NodeFileSystem(t);throw pr?new Error("Can't instantiate NodeFileSystem in browser."):new Error("Can't instantiate NodeFileSystem. Make sure to import @loaders.gl/polyfills first.")}readable=!0;writable=!0;async openReadableFile(t,r){throw h0}async openWritableFile(t,r,n){throw h0}async readdir(t=".",r){throw h0}async stat(t,r){throw h0}async unlink(t){throw h0}async fetch(t,r){throw h0}};var yc=Ct(require("fs"),1),Lp=class{handle;size;bigsize;url;constructor(t,r,n){t=du(t),this.handle=yc.default.openSync(t,r,n);let a=yc.default.fstatSync(this.handle,{bigint:!0});this.size=Number(a.size),this.bigsize=a.size,this.url=t}async close(){return new Promise((t,r)=>{yc.default.close(this.handle,n=>n?r(n):t())})}async truncate(t){return new Promise((r,n)=>{yc.default.ftruncate(this.handle,t,a=>{a?n(a):(this.bigsize=BigInt(t),this.size=Number(this.bigsize),r())})})}async append(t){return new Promise((r,n)=>{yc.default.appendFile(this.handle,t,a=>{a?n(a):(this.bigsize=this.bigsize+BigInt(t.length),this.size=Number(this.bigsize),r())})})}async stat(){return await new Promise((t,r)=>yc.default.fstat(this.handle,{bigint:!0},(n,a)=>{let i={size:Number(a.size),bigsize:a.size,isDirectory:a.isDirectory()};n?r(n):t(i)}))}async read(t,r){let n=new ArrayBuffer(r),a=BigInt(t),i=0,o=new Uint8Array(n),s;for(;r>0;){let u=await WMe(this.handle,o,0,r,a);if(u===0)break;i+=u,a+=BigInt(u),r-=u,s!==void 0&&(s+=u)}return i<r?n.slice(0,i):n}async write(t,r=0,n=t.byteLength){return new Promise((a,i)=>{let o=Number(r),s=new Uint8Array(t,Number(r),n);yc.default.write(this.handle,s,0,n,o,(u,c)=>u?i(u):a(c))})}};async function WMe(e,t,r,n,a){return await new Promise((i,o)=>yc.default.read(e,t,r,n,a,(s,u)=>s?o(s):i(u)))}var Aw=Ct(require("fs/promises"),1);var uF=Ct(require("fs"),1),sF=require("stream");var yw=Ct(require("zlib"),1);function _w(e,t){switch(t==null?void 0:t.get("content-encoding")){case"br":return e.pipe(yw.default.createBrotliDecompress());case"gzip":return e.pipe(yw.default.createGunzip());case"deflate":return e.pipe(yw.default.createDeflate());default:return e}}async function Kte(e){let t=[];return await new Promise((r,n)=>{e.on("error",a=>n(a)),e.on("readable",()=>e.read()),e.on("data",a=>{typeof a=="string"&&n(new Error("Read stream not binary")),t.push(Wn(a))}),e.on("end",()=>{let a=KMe(t);r(a)})})}function KMe(e){let t=e.map(i=>i instanceof ArrayBuffer?new Uint8Array(i):i),r=t.reduce((i,o)=>i+o.byteLength,0),n=new Uint8Array(r),a=0;for(let i of t)n.set(i,a),a+=i.byteLength;return n.buffer}var JMe=e=>typeof e=="boolean",Jte=e=>typeof e=="function",XMe=e=>e!==null&&typeof e=="object",YMe=e=>XMe(e)&&Jte(e.read)&&Jte(e.pipe)&&JMe(e.readable);async function ww(e,t){let r=/^file:\/\//;e.replace(r,"/");let n=e.split("?")[0];n=du(n);let a=new Headers;e.endsWith(".gz")&&a.set("content-encoding","gzip"),e.endsWith(".br")&&a.set("content-encoding","br");try{let i=await new Promise((f,p)=>{let d=uF.default.createReadStream(n,{encoding:null});d.once("readable",()=>f(d)),d.on("error",h=>p(h))}),o=i;YMe(i)?o=_w(i,a):typeof i=="string"?o=sF.Readable.from([new TextEncoder().encode(i)]):o=sF.Readable.from([i||new ArrayBuffer(0)]);let s=200,u="OK",c=QMe(n),l=new Response(o,{headers:c,status:s,statusText:u});return Object.defineProperty(l,"url",{value:e}),l}catch(i){let o=i.message,s=400,u=o,c={},l=new Response(o,{headers:c,status:s,statusText:u});return Object.defineProperty(l,"url",{value:e}),l}}function QMe(e){let t={};if(!t["content-length"]){let r=uF.default.statSync(e);t["content-length"]=r.size}return e.endsWith(".gz")&&(e=e.slice(0,-3),t["content-encoding"]="gzip"),new Headers(t)}var Ew=class{readable=!0;writable=!0;constructor(){}async readdir(t=".",r){return await Aw.default.readdir(t,r)}async stat(t){let r=await Aw.default.stat(t,{bigint:!0});return{size:Number(r.size),bigsize:r.size,isDirectory:r.isDirectory()}}async unlink(t){return await Aw.default.unlink(t)}async fetch(t,r){return await ww(t,r)}async openReadableFile(t,r="r"){return new Lp(t,r)}async openWritableFile(t,r="w",n){return new Lp(t,r,n)}};var _c=class{constructor(t={}){this.hashBatches=this.hashBatches.bind(this)}async preload(){}async*hashBatches(t,r="base64"){var o,s;let n=[];for await(let u of t)n.push(u),yield u;let a=await this.concatenate(n),i=await this.hash(a,r);(s=(o=this.options.crypto)==null?void 0:o.onEnd)==null||s.call(o,{hash:i})}async concatenate(t){return await jp(t)}};var m0=class{crc;constructor(){this.crc=-1}update(t){let r=e7e(),n=new Uint8Array(t);for(let a=0;a<n.byteLength;a++)this.crc=this.crc>>>8^r[(this.crc^n[a])&255];return this}finalize(){return this.crc=(this.crc^-1)>>>0,this.crc}},ZMe=Uint32Array.of(0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117);function e7e(){return ZMe}function Xte(e){e=`${e}`;for(let r=0;r<e.length;r++)if(e.charCodeAt(r)>255)return null;let t="";for(let r=0;r<e.length;r+=3){let n=[void 0,void 0,void 0,void 0];n[0]=e.charCodeAt(r)>>2,n[1]=(e.charCodeAt(r)&3)<<4,e.length>r+1&&(n[1]|=e.charCodeAt(r+1)>>4,n[2]=(e.charCodeAt(r+1)&15)<<2),e.length>r+2&&(n[2]|=e.charCodeAt(r+2)>>6,n[3]=e.charCodeAt(r+2)&63);for(let a=0;a<n.length;a++)typeof n[a]>"u"?t+="=":t+=t7e(n[a])}return t}function t7e(e){if(e<26)return String.fromCharCode(e+"A".charCodeAt(0));if(e<52)return String.fromCharCode(e-26+"a".charCodeAt(0));if(e<62)return String.fromCharCode(e-52+"0".charCodeAt(0));if(e===62)return"+";if(e===63)return"/"}function cF(e,t){switch(t){case"hex":return Yte(e);case"base64":return Zte(Yte(e));default:throw new Error(t)}}function Qte(e,t){switch(t){case"hex":return e;case"base64":return Zte(e);default:throw new Error(t)}}function Zte(e){e.length%2!==0&&(e=`0${e}`);let r=(e.match(/\w{2}/g)||[]).map(n=>String.fromCharCode(parseInt(n,16))).join("");return Xte(r)||""}function Yte(e){let t=e.toString(16);return t==="0"?`0${t}`:t}var Gv=class extends _c{name="crc32";options;constructor(t={}){super(),this.options={crypto:{},...t},this.hashBatches=this.hashBatches.bind(this)}async hash(t,r){return this.hashSync(t,r)}hashSync(t,r){let n=new m0;n.update(t);let a=n.finalize();return cF(a,r)}async*hashBatches(t,r="base64"){var i,o;let n=new m0;for await(let s of t)n.update(s),yield s;let a=n.finalize();(o=(i=this.options.crypto)==null?void 0:i.onEnd)==null||o.call(i,{hash:cF(a,r)})}};var Tw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ere=s7e("AGFzbQEAAAABDANgAX8AYAAAYAABfwIeAgdpbXBvcnRzA2xvZwAAB2ltcG9ydHMDbWVtAgABAzIxAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAAAAAAAAAAAAAAAAAAAAAgICAgIAAAAAAAaYARt/AUGBxpS6Bgt/AUGJ17b+fgt/AUH+uevFeQt/AUH2qMmBAQt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALB7oCJQhvbmVGdWxsQQAYCG9uZUZ1bGxCABkIb25lRnVsbEMAGghvbmVGdWxsRAAbBWxvb3BzAAEEbG9vcAACBXByaW1lAAMFbG9vcEEABAZsb29wQTEABQZsb29wQTIABgZsb29wQTMABwZsb29wQTQACAVsb29wQgAJBmxvb3BCMQAKBmxvb3BCMgALBmxvb3BCMwAMBmxvb3BCNAANBWxvb3BDAA4GbG9vcEMxAA8GbG9vcEMyABAGbG9vcEMzABEGbG9vcEM0ABIFbG9vcEQAEwZsb29wRDEAFAZsb29wRDIAFQZsb29wRDMAFgZsb29wRDQAFwRnZXRBACgEZ2V0QgApBGdldEMAKgRnZXREACsEZ2V0WAAsBHNldEEALQRzZXRCAC4Ec2V0QwAvBHNldEQAMARzZXRYADEKzA0xWwEBf0EAJAggAEEGdCEBAkADQCMIIAFGDQEjACQEIwEkBSMCJAYjAyQHEAIjBCMAaiQAIwUjAWokASMGIwJqJAIjByMDaiQDIwhBwABqJAgMAAsLIwgjGmokGgsTACMIIxpqJAkQAxAEEAkQDhATC6IBAEEAIwlqKAIAJApBBCMJaigCACQLQQgjCWooAgAkDEEMIwlqKAIAJA1BECMJaigCACQOQRQjCWooAgAkD0EYIwlqKAIAJBBBHCMJaigCACQRQSAjCWooAgAkEkEkIwlqKAIAJBNBKCMJaigCACQUQSwjCWooAgAkFUEwIwlqKAIAJBZBNCMJaigCACQXQTgjCWooAgAkGEE8IwlqKAIAJBkLCgAQBRAGEAcQCAsuAEH4yKq7fSMKahAYQdbunsZ+IwtqEBtB2+GBoQIjDGoQGkHunfeNfCMNahAZCy0AQa+f8Kt/Iw5qEBhBqoyfvAQjD2oQG0GTjMHBeiMQahAaQYGqmmojEWoQGQssAEHYsYLMBiMSahAYQa/vk9p4IxNqEBtBsbd9IxRqEBpBvq/zyngjFWoQGQstAEGiosDcBiMWahAYQZPj4WwjF2oQG0GOh+WzeiMYahAaQaGQ0M0EIxlqEBkLCgAQChALEAwQDQsuAEHiyviwfyMLahAcQcDmgoJ8IxBqEB9B0bT5sgIjFWoQHkGqj9vNfiMKahAdCy0AQd2gvLF9Iw9qEBxB06iQEiMUahAfQYHNh8V9IxlqEB5ByPfPvn4jDmoQHQsuAEHmm4ePAiMTahAcQdaP3Jl8IxhqEB9Bh5vUpn8jDWoQHkHtqeiqBCMSahAdCy0AQYXSj896IxdqEBxB+Me+ZyMMahAfQdmFvLsGIxFqEB5Bipmp6XgjFmoQHQsKABAPEBAQERASCysAQcLyaCMPahAgQYHtx7t4IxJqECNBosL17AYjFWoQIkGM8JRvIxhqECELLgBBxNT7pXojC2oQIEGpn/veBCMOahAjQeCW7bV/IxFqECJB8Pj+9XsjFGoQIQstAEHG/e3EAiMXahAgQfrPhNV+IwpqECNBheG8p30jDWoQIkGFuqAkIxBqECELLgBBuaDTzn0jE2oQIEHls+62fiMWahAjQfj5if0BIxlqECJB5ayxpXwjDGoQIQsKABAUEBUQFhAXCy0AQcTEpKF/IwpqECRBl/+rmQQjEWoQJ0Gnx9DceiMYahAmQbnAzmQjD2oQJQstAEHDs+2qBiMWahAkQZKZs/h4Iw1qECdB/ei/fyMUahAmQdG7kax4IwtqECULLQBBz/yh/QYjEmoQJEHgzbNxIxlqECdBlIaFmHojEGoQJkGho6DwBCMXahAlCy4AQYL9zbp/Iw5qECRBteTr6XsjFWoQJ0G7pd/WAiMMahAmQZGnm9x+IxNqECULKAEBf0F/IwFzIwNxIwEjAnFyIwBqIABqIgFBB3QgAUEZdnIjAWokAAsoAQF/QX8jAnMjAHEjAiMDcXIjAWogAGoiAUEWdCABQQp2ciMCaiQBCygBAX9BfyMDcyMBcSMDIwBxciMCaiAAaiIBQRF0IAFBD3ZyIwNqJAILKAEBf0F/IwBzIwJxIwAjAXFyIwNqIABqIgFBDHQgAUEUdnIjAGokAwsoAQF/IwJBfyMDc3EjASMDcXIjAGogAGoiAUEFdCABQRt2ciMBaiQACygBAX8jA0F/IwBzcSMCIwBxciMBaiAAaiIBQRR0IAFBDHZyIwJqJAELKAEBfyMAQX8jAXNxIwMjAXFyIwJqIABqIgFBDnQgAUESdnIjA2okAgsoAQF/IwFBfyMCc3EjACMCcXIjA2ogAGoiAUEJdCABQRd2ciMAaiQDCyIBAX8jASMCcyMDcyMAaiAAaiIBQQR0IAFBHHZyIwFqJAALIgEBfyMCIwNzIwBzIwFqIABqIgFBF3QgAUEJdnIjAmokAQsiAQF/IwMjAHMjAXMjAmogAGoiAUEQdCABQRB2ciMDaiQCCyIBAX8jACMBcyMCcyMDaiAAaiIBQQt0IAFBFXZyIwBqJAMLJQEBf0F/IwNzIwFyIwJzIwBqIABqIgFBBnQgAUEadnIjAWokAAslAQF/QX8jAHMjAnIjA3MjAWogAGoiAUEVdCABQQt2ciMCaiQBCyUBAX9BfyMBcyMDciMAcyMCaiAAaiIBQQ90IAFBEXZyIwNqJAILJQEBf0F/IwJzIwByIwFzIwNqIABqIgFBCnQgAUEWdnIjAGokAwsEACMACwQAIwELBAAjAgsEACMDCwQAIxoLBgAgACQACwYAIAAkAQsGACAAJAILBgAgACQDCwYAIAAkGgsA6gQEbmFtZQGSAzIAA2xvZwEFbG9vcHMCBGxvb3ADBXByaW1lBAVsb29wQQUGbG9vcEExBgZsb29wQTIHBmxvb3BBMwgGbG9vcEE0CQVsb29wQgoGbG9vcEIxCwZsb29wQjIMBmxvb3BCMw0GbG9vcEI0DgVsb29wQw8GbG9vcEMxEAZsb29wQzIRBmxvb3BDMxIGbG9vcEM0EwVsb29wRBQGbG9vcEQxFQZsb29wRDIWBmxvb3BEMxcGbG9vcEQ0GAhvbmVGdWxsQRkIb25lRnVsbEIaCG9uZUZ1bGxDGwhvbmVGdWxsRBwIdHdvRnVsbEEdCHR3b0Z1bGxCHgh0d29GdWxsQx8IdHdvRnVsbEQgCHRyZUZ1bGxBIQh0cmVGdWxsQiIIdHJlRnVsbEMjCHRyZUZ1bGxEJAhxdWFGdWxsQSUIcXVhRnVsbEImCHF1YUZ1bGxDJwhxdWFGdWxsRCgEZ2V0QSkEZ2V0QioEZ2V0QysEZ2V0RCwEZ2V0WC0Ec2V0QS4Ec2V0Qi8Ec2V0QzAEc2V0RDEEc2V0WALNATIAAQAAAQIAAAEIbnVtbG9vcHMCAAMABAAFAAYABwAIAAkACgALAAwADQAOAA8AEAARABIAEwAUABUAFgAXABgCAAABAW4ZAgAAAQFuGgIAAAEBbhsCAAABAW4cAgAAAQFuHQIAAAEBbh4CAAABAW4fAgAAAQFuIAIAAAEBbiECAAABAW4iAgAAAQFuIwIAAAEBbiQCAAABAW4lAgAAAQFuJgIAAAEBbicCAAABAW4oACkAKgArACwALQEAAC4BAAAvAQAAMAEAADEBAAA="),lF=typeof WebAssembly<"u"&&ere?ere.buffer:!1,hu=p7e(),fF=240*16*16,tre=Math.floor(fF*16*1.066666667),r7e=268435456-65536,n7e="Parameter must be ArrayBuffer, ArrayBufferView or string",a7e="Parameter exceeds max size of 255.9 Mbytes";lF||console.log("WebAssembly not available or WASM module could not be decoded; md5WASM will fall back to JavaScript");function pF(e){var t,r,n,a,i,o,s,u,c,l;let f=o7e(),p=i7e(),d={},h=new Date().getTime();return d.then=function(y){return s=y,g(),d},d.catch=function(y){return u=y,d},o=f7e(e),o||x(new TypeError(n7e)),o&&(i=o.length,lF&&i>tre?i>r7e?x(new Error(a7e)):(t=new WebAssembly.Memory({initial:i>32e6?i>64e6?i>128e6?4096:2048:1024:512}),r=new Uint32Array(t.buffer),a={mem:t,log:console.log},n={imports:a},WebAssembly.instantiate(lF,n).then(m)):g(f(o))),d;function m(y){g(p(o,y.instance.exports,r))}function g(y){var w=Boolean(y)?y:c;Boolean(y)&&(l=new Date().getTime()),typeof s=="function"?Boolean(w)&&(s(w,l-h),s=u=null):Boolean(y)&&(c=y)}function x(y){typeof u=="function"&&u(y)}}function i7e(){var e,t,r,n,a,i,o,s,u,c,l,f,p,d=function(h){var m,g,x,y,w,T,A,B,I,L,C,k,F,R,G,z,W,Y,ue,ie,le,fe,me=new Date().getTime(),ye=0,X=1732584193,N=-271733879,K=-1732584194,Q=271733878,Fe=0,Le=h.length*8,Ke;for(Ke=ve(h,p),p[Le>>>5]|=128<<Le%32,p[(Le+64>>>9<<4)+14]=Le,Ke=(Le+64>>>9<<4)+15,le=p;Fe<Ke;)Ke>Fe+tre?(n(X),i(N),s(K),c(Q),t(fF),Fe=Fe+fF*16,X=r(),N=a(),K=o(),Q=u(),ye++):(W=X,Y=N,ue=K,ie=Q,m=le[Fe+0]>>>0,g=le[Fe+1]>>>0,x=le[Fe+2]>>>0,y=le[Fe+3]>>>0,w=le[Fe+4]>>>0,T=le[Fe+5]>>>0,A=le[Fe+6]>>>0,B=le[Fe+7]>>>0,I=le[Fe+8]>>>0,L=le[Fe+9]>>>0,C=le[Fe+10]>>>0,k=le[Fe+11]>>>0,F=le[Fe+12]>>>0,R=le[Fe+13]>>>0,G=le[Fe+14]>>>0,z=le[Fe+15]>>>0,X=ae(7,25,X+(N&K|~N&Q)+m-680876936)+N,Q=ae(12,20,Q+(X&N|~X&K)+g-389564586)+X,K=ae(17,15,K+(Q&X|~Q&N)+x+606105819)+Q,N=ae(22,10,N+(K&Q|~K&X)+y-1044525330)+K,X=ae(7,25,X+(N&K|~N&Q)+w-176418897)+N,Q=ae(12,20,Q+(X&N|~X&K)+T+1200080426)+X,K=ae(17,15,K+(Q&X|~Q&N)+A-1473231341)+Q,N=ae(22,10,N+(K&Q|~K&X)+B-45705983)+K,X=ae(7,25,X+(N&K|~N&Q)+I+1770035416)+N,Q=ae(12,20,Q+(X&N|~X&K)+L-1958414417)+X,K=ae(17,15,K+(Q&X|~Q&N)+C-42063)+Q,N=ae(22,10,N+(K&Q|~K&X)+k-1990404162)+K,X=ae(7,25,X+(N&K|~N&Q)+F+1804603682)+N,Q=ae(12,20,Q+(X&N|~X&K)+R-40341101)+X,K=ae(17,15,K+(Q&X|~Q&N)+G-1502002290)+Q,N=ae(22,10,N+(K&Q|~K&X)+z+1236535329)+K,X=ae(5,27,X+(N&Q|K&~Q)+g-165796510)+N,Q=ae(9,23,Q+(X&K|N&~K)+A-1069501632)+X,K=ae(14,18,K+(Q&N|X&~N)+k+643717713)+Q,N=ae(20,12,N+(K&X|Q&~X)+m-373897302)+K,X=ae(5,27,X+(N&Q|K&~Q)+T-701558691)+N,Q=ae(9,23,Q+(X&K|N&~K)+C+38016083)+X,K=ae(14,18,K+(Q&N|X&~N)+z-660478335)+Q,N=ae(20,12,N+(K&X|Q&~X)+w-405537848)+K,X=ae(5,27,X+(N&Q|K&~Q)+L+568446438)+N,Q=ae(9,23,Q+(X&K|N&~K)+G-1019803690)+X,K=ae(14,18,K+(Q&N|X&~N)+y-187363961)+Q,N=ae(20,12,N+(K&X|Q&~X)+I+1163531501)+K,X=ae(5,27,X+(N&Q|K&~Q)+R-1444681467)+N,Q=ae(9,23,Q+(X&K|N&~K)+x-51403784)+X,K=ae(14,18,K+(Q&N|X&~N)+B+1735328473)+Q,N=ae(20,12,N+(K&X|Q&~X)+F-1926607734)+K,X=ae(4,28,X+(N^K^Q)+T-378558)+N,Q=ae(11,21,Q+(X^N^K)+I-2022574463)+X,K=ae(16,16,K+(Q^X^N)+k+1839030562)+Q,N=ae(23,9,N+(K^Q^X)+G-35309556)+K,X=ae(4,28,X+(N^K^Q)+g-1530992060)+N,Q=ae(11,21,Q+(X^N^K)+w+1272893353)+X,K=ae(16,16,K+(Q^X^N)+B-155497632)+Q,N=ae(23,9,N+(K^Q^X)+C-1094730640)+K,X=ae(4,28,X+(N^K^Q)+R+681279174)+N,Q=ae(11,21,Q+(X^N^K)+m-358537222)+X,K=ae(16,16,K+(Q^X^N)+y-722521979)+Q,N=ae(23,9,N+(K^Q^X)+A+76029189)+K,X=ae(4,28,X+(N^K^Q)+L-640364487)+N,Q=ae(11,21,Q+(X^N^K)+F-421815835)+X,K=ae(16,16,K+(Q^X^N)+z+530742520)+Q,N=ae(23,9,N+(K^Q^X)+x-995338651)+K,X=ae(6,26,X+(K^(N|~Q))+m-198630844)+N,Q=ae(10,22,Q+(N^(X|~K))+B+1126891415)+X,K=ae(15,17,K+(X^(Q|~N))+G-1416354905)+Q,N=ae(21,11,N+(Q^(K|~X))+T-57434055)+K,X=ae(6,26,X+(K^(N|~Q))+F+1700485571)+N,Q=ae(10,22,Q+(N^(X|~K))+y-1894986606)+X,K=ae(15,17,K+(X^(Q|~N))+C-1051523)+Q,N=ae(21,11,N+(Q^(K|~X))+g-2054922799)+K,X=ae(6,26,X+(K^(N|~Q))+I+1873313359)+N,Q=ae(10,22,Q+(N^(X|~K))+z-30611744)+X,K=ae(15,17,K+(X^(Q|~N))+A-1560198380)+Q,N=ae(21,11,N+(Q^(K|~X))+R+1309151649)+K,X=ae(6,26,X+(K^(N|~Q))+w-145523070)+N,Q=ae(10,22,Q+(N^(X|~K))+k-1120210379)+X,K=ae(15,17,K+(X^(Q|~N))+x+718787259)+Q,N=ae(21,11,N+(Q^(K|~X))+L-343485551)+K,Fe=Fe+16,X=X+W>>>0,N=N+Y>>>0,K=K+ue>>>0,Q=Q+ie>>>0);return hu.endian([X,N,K,Q]);function ae(ge,Xe,Te){return Te<<ge|Te>>>Xe}function ve(ge,Xe){for(var Te=-1,rt=Math.floor((ge.length-1)/4),vt=0,Cr,re,Oe,Ve;rt-8>Te++;)vt=Te<<2,Xe[Te]=ge[vt+0]|ge[vt+1]<<8|ge[vt+2]<<16|ge[vt+3]<<24;for(Te--;rt>Te++;)vt=Te<<2,Cr=typeof ge[vt+0]>"u"?0:ge[vt+0],re=typeof ge[vt+1]>"u"?0:ge[vt+1],Oe=typeof ge[vt+2]>"u"?0:ge[vt+2],Ve=typeof ge[vt+3]>"u"?0:ge[vt+3],Xe[Te]=Cr|re<<8|Oe<<16|Ve<<24;return rt+1}};return function(h,m,g,x){var y;return t=m.loops,e=m.loop,r=m.getA,a=m.getB,o=m.getC,u=m.getD,l=m.getX,n=m.setA,i=m.setB,s=m.setC,c=m.setD,f=m.setX,p=g,y=hu.wordsToBytes(d(h)),x&&x.asBytes?y:hu.bytesconvertNumberToHex(y)}}function o7e(){var e=function(t,r){var n,a,i,o,s,u,c,l,f,p,d,h,m,g,x,y,w,T,A,B,I,L=new Date().getTime(),C=1732584193,k=-271733879,F=-1732584194,R=271733878,G=t.length*8;I=hu.bytesToWords(t);for(var z=0;z<I.length;z++)I[z]=(I[z]<<8|I[z]>>>24)&16711935|(I[z]<<24|I[z]>>>8)&4278255360;I[G>>>5]|=128<<G%32,I[(G+64>>>9<<4)+14]=G;for(var W=0;W<I.length;W+=16)w=C,T=k,A=F,B=R,n=I[W+0]>>>0,a=I[W+1]>>>0,i=I[W+2]>>>0,o=I[W+3]>>>0,s=I[W+4]>>>0,u=I[W+5]>>>0,c=I[W+6]>>>0,l=I[W+7]>>>0,f=I[W+8]>>>0,p=I[W+9]>>>0,d=I[W+10]>>>0,h=I[W+11]>>>0,m=I[W+12]>>>0,g=I[W+13]>>>0,x=I[W+14]>>>0,y=I[W+15]>>>0,C=Y(7,25,C+(k&F|~k&R)+n-680876936)+k,R=Y(12,20,R+(C&k|~C&F)+a-389564586)+C,F=Y(17,15,F+(R&C|~R&k)+i+606105819)+R,k=Y(22,10,k+(F&R|~F&C)+o-1044525330)+F,C=Y(7,25,C+(k&F|~k&R)+s-176418897)+k,R=Y(12,20,R+(C&k|~C&F)+u+1200080426)+C,F=Y(17,15,F+(R&C|~R&k)+c-1473231341)+R,k=Y(22,10,k+(F&R|~F&C)+l-45705983)+F,C=Y(7,25,C+(k&F|~k&R)+f+1770035416)+k,R=Y(12,20,R+(C&k|~C&F)+p-1958414417)+C,F=Y(17,15,F+(R&C|~R&k)+d-42063)+R,k=Y(22,10,k+(F&R|~F&C)+h-1990404162)+F,C=Y(7,25,C+(k&F|~k&R)+m+1804603682)+k,R=Y(12,20,R+(C&k|~C&F)+g-40341101)+C,F=Y(17,15,F+(R&C|~R&k)+x-1502002290)+R,k=Y(22,10,k+(F&R|~F&C)+y+1236535329)+F,C=Y(5,27,C+(k&R|F&~R)+a-165796510)+k,R=Y(9,23,R+(C&F|k&~F)+c-1069501632)+C,F=Y(14,18,F+(R&k|C&~k)+h+643717713)+R,k=Y(20,12,k+(F&C|R&~C)+n-373897302)+F,C=Y(5,27,C+(k&R|F&~R)+u-701558691)+k,R=Y(9,23,R+(C&F|k&~F)+d+38016083)+C,F=Y(14,18,F+(R&k|C&~k)+y-660478335)+R,k=Y(20,12,k+(F&C|R&~C)+s-405537848)+F,C=Y(5,27,C+(k&R|F&~R)+p+568446438)+k,R=Y(9,23,R+(C&F|k&~F)+x-1019803690)+C,F=Y(14,18,F+(R&k|C&~k)+o-187363961)+R,k=Y(20,12,k+(F&C|R&~C)+f+1163531501)+F,C=Y(5,27,C+(k&R|F&~R)+g-1444681467)+k,R=Y(9,23,R+(C&F|k&~F)+i-51403784)+C,F=Y(14,18,F+(R&k|C&~k)+l+1735328473)+R,k=Y(20,12,k+(F&C|R&~C)+m-1926607734)+F,C=Y(4,28,C+(k^F^R)+u-378558)+k,R=Y(11,21,R+(C^k^F)+f-2022574463)+C,F=Y(16,16,F+(R^C^k)+h+1839030562)+R,k=Y(23,9,k+(F^R^C)+x-35309556)+F,C=Y(4,28,C+(k^F^R)+a-1530992060)+k,R=Y(11,21,R+(C^k^F)+s+1272893353)+C,F=Y(16,16,F+(R^C^k)+l-155497632)+R,k=Y(23,9,k+(F^R^C)+d-1094730640)+F,C=Y(4,28,C+(k^F^R)+g+681279174)+k,R=Y(11,21,R+(C^k^F)+n-358537222)+C,F=Y(16,16,F+(R^C^k)+o-722521979)+R,k=Y(23,9,k+(F^R^C)+c+76029189)+F,C=Y(4,28,C+(k^F^R)+p-640364487)+k,R=Y(11,21,R+(C^k^F)+m-421815835)+C,F=Y(16,16,F+(R^C^k)+y+530742520)+R,k=Y(23,9,k+(F^R^C)+i-995338651)+F,C=Y(6,26,C+(F^(k|~R))+n-198630844)+k,R=Y(10,22,R+(k^(C|~F))+l+1126891415)+C,F=Y(15,17,F+(C^(R|~k))+x-1416354905)+R,k=Y(21,11,k+(R^(F|~C))+u-57434055)+F,C=Y(6,26,C+(F^(k|~R))+m+1700485571)+k,R=Y(10,22,R+(k^(C|~F))+o-1894986606)+C,F=Y(15,17,F+(C^(R|~k))+d-1051523)+R,k=Y(21,11,k+(R^(F|~C))+a-2054922799)+F,C=Y(6,26,C+(F^(k|~R))+f+1873313359)+k,R=Y(10,22,R+(k^(C|~F))+y-30611744)+C,F=Y(15,17,F+(C^(R|~k))+c-1560198380)+R,k=Y(21,11,k+(R^(F|~C))+g+1309151649)+F,C=Y(6,26,C+(F^(k|~R))+s-145523070)+k,R=Y(10,22,R+(k^(C|~F))+h-1120210379)+C,F=Y(15,17,F+(C^(R|~k))+i+718787259)+R,k=Y(21,11,k+(R^(F|~C))+p-343485551)+F,C=C+w>>>0,k=k+T>>>0,F=F+A>>>0,R=R+B>>>0;return hu.endian([C,k,F,R]);function Y(ue,ie,le){return le<<ue|le>>>ie}};return function(t,r){var n=hu.wordsToBytes(e(t,r)),a=r&&r.asBytes?n:hu.bytesconvertNumberToHex(n);return a}}function s7e(e){try{return u7e(e)}catch{return null}}function u7e(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");return typeof atob=="function"?l7e(atob(t)):c7e(t)}function c7e(e){for(var t=e.endsWith("==")?2:e.endsWith("=")?1:0,r=e.length*3/4-t,n=new Uint8Array(r),a=0,i=0,o,s,u,c;i<e.length;){if(o=Tw.indexOf(e.charAt(i++)),s=Tw.indexOf(e.charAt(i++)),u=Tw.indexOf(e.charAt(i++)),c=Tw.indexOf(e.charAt(i++)),o<0||s<0||u<0||c<0)throw new TypeError("Invalid base64 input");n[a++]=o<<2|s>>4,u<64&&a<r&&(n[a++]=(s&15)<<4|u>>2),c<64&&a<r&&(n[a++]=(u&3)<<6|c)}return n}function l7e(e){for(var t=e.length,r=new Uint8Array(t),n=0;n<t;)r[n]=e.charCodeAt(n),n++;return r}function f7e(e){return e instanceof Uint8Array?e:typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?new Uint8Array(e):e&&typeof e=="object"&&ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):typeof e=="string"?new TextEncoder().encode(e):null}function p7e(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";return{rotl:function(t,r){return t<<r|t>>>32-r},endian:function(t){if(t.constructor==Number)return hu.rotl(t,8)&16711935|hu.rotl(t,24)&4278255360;for(var r=0;r<t.length;r++)t[r]=hu.endian(t[r]);return t},bytesToWords:function(t){for(var r=[],n=0,a=0;n<t.length;n++,a+=8)r[a>>>5]|=t[n]<<24-a%32;return r},wordsToBytes:function(t){for(var r=[],n=0;n<t.length*32;n+=8)r.push(t[n>>>5]>>>24-n%32&255);return r},bytesconvertNumberToHex:function(t){for(var r=[],n=0;n<t.length;n++)r.push((t[n]>>>4).toString(16)),r.push((t[n]&15).toString(16));return r.join("")}}}var mu=class extends _c{name="md5";options;constructor(t={}){super(),this.options=t}async hash(t,r){let a=await new Promise((i,o)=>pF(t).then(i).catch(o));return Qte(a,r)}};var Hv=Ct(require("crypto"),1),Sw=class extends _c{name="crypto-node";options;_algorithm;_hash;constructor(t){var r,n;if(super(),this.options=t,!((n=(r=this.options)==null?void 0:r.crypto)!=null&&n.algorithm))throw new Error(this.name)}async hash(t,r){var a,i,o,s;let n=(o=(i=(a=this.options)==null?void 0:a.crypto)==null?void 0:i.algorithm)==null?void 0:o.toLowerCase();try{if(!Hv.createHash)throw new Error("crypto.createHash not available");let u=(s=Hv.createHash)==null?void 0:s(n),c=new Uint8Array(t);return u.update(c).digest("base64")}catch(u){throw Error(`${n} hash not available. ${u}`)}}async*hashBatches(t,r="base64"){var i,o,s,u,c,l,f;if(!Hv.createHash)throw new Error("crypto.createHash not available");let n=(u=Hv.createHash)==null?void 0:u((s=(o=(i=this.options)==null?void 0:i.crypto)==null?void 0:o.algorithm)==null?void 0:s.toLowerCase());for await(let p of t){let d=new Uint8Array(p);n.update(d),yield p}let a=n.digest(r);(f=(l=(c=this.options)==null?void 0:c.crypto)==null?void 0:l.onEnd)==null||f.call(l,{hash:a})}};var Pne=require("process");var rre=Ct(require("stream"),1),dF=class{},d7e=rre.Readable||dF;function mF(e,t){let r=e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]();return new hF(r,t)}var hF=class extends d7e{_pulling;_bytesMode;_iterator;constructor(t,r){super(r),this._iterator=t,this._pulling=!1,this._bytesMode=!r||!r.objectMode}async _read(t){this._pulling||(this._pulling=!0,this._pulling=await this._pull(t,this._iterator))}async _destroy(t,r){var n,a,i,o;this._iterator&&(t?await((a=(n=this._iterator)==null?void 0:n.throw)==null?void 0:a.call(n,t)):await((o=(i=this._iterator)==null?void 0:i.return)==null?void 0:o.call(i,t)),r==null||r(null))}async _pull(t,r){var i;let n=this._bytesMode,a=null;for(;this.readable&&!(a=await r.next()).done&&(t!==null&&(t-=n&&ArrayBuffer.isView(a.value)?a.value.byteLength:1),!(!this.push(new Uint8Array(a.value))||t<=0)););return(a!=null&&a.done||!this.readable)&&(this.push(null)||!0)&&((i=r==null?void 0:r.return)==null||i.call(r)),!this.readable}};function Xv(){}function En(e){return typeof e=="object"&&e!==null||typeof e=="function"}var wre=Xv;function tr(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch{}}var PF=Promise,h7e=Promise.resolve.bind(PF),m7e=Promise.prototype.then,g7e=Promise.reject.bind(PF),b7e=h7e;function Rn(e){return new PF(e)}function rr(e){return Rn(t=>t(e))}function nt(e){return g7e(e)}function xu(e,t,r){return m7e.call(e,t,r)}function wi(e,t,r){xu(xu(e,t,r),void 0,wre)}function gF(e,t){wi(e,t)}function TF(e,t){wi(e,void 0,t)}function kc(e,t,r){return xu(e,t,r)}function A0(e){xu(e,void 0,wre)}var Gp=e=>{if(typeof queueMicrotask=="function")Gp=queueMicrotask;else{let t=rr(void 0);Gp=r=>xu(t,r)}return Gp(e)};function Hp(e,t,r){if(typeof e!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function Dc(e,t,r){try{return rr(Hp(e,t,r))}catch(n){return nt(n)}}var Ai=class{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(t){let r=this._back,n=r;r._elements.length===16383&&(n={_elements:[],_next:void 0}),r._elements.push(t),n!==r&&(this._back=n,r._next=n),++this._size}shift(){let t=this._front,r=t,n=this._cursor,a=n+1,i=t._elements,o=i[n];return a===16384&&(r=t._next,a=0),--this._size,this._cursor=a,t!==r&&(this._front=r),i[n]=void 0,o}forEach(t){let r=this._cursor,n=this._front,a=n._elements;for(;!(r===a.length&&n._next===void 0||r===a.length&&(n=n._next,a=n._elements,r=0,a.length===0));)t(a[r]),++r}peek(){let t=this._front,r=this._cursor;return t._elements[r]}},Are=Symbol("[[AbortSteps]]"),Ere=Symbol("[[ErrorSteps]]"),RF=Symbol("[[CancelSteps]]"),jF=Symbol("[[PullSteps]]"),LF=Symbol("[[ReleaseSteps]]");function Tre(e,t){e._ownerReadableStream=t,t._reader=e,t._state==="readable"?SF(e):t._state==="closed"?function(r){SF(r),kre(r)}(e):Sre(e,t._storedError)}function MF(e,t){return hs(e._ownerReadableStream,t)}function Sc(e){let t=e._ownerReadableStream;t._state==="readable"?qF(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(r,n){Sre(r,n)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),t._readableStreamController[LF](),t._reader=void 0,e._ownerReadableStream=void 0}function zw(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function SF(e){e._closedPromise=Rn((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r})}function Sre(e,t){SF(e),qF(e,t)}function qF(e,t){e._closedPromise_reject!==void 0&&(A0(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function kre(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}var nre=Number.isFinite||function(e){return typeof e=="number"&&isFinite(e)},v7e=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function yu(e,t){if(e!==void 0&&typeof(r=e)!="object"&&typeof r!="function")throw new TypeError(`${t} is not an object.`);var r}function wo(e,t){if(typeof e!="function")throw new TypeError(`${t} is not a function.`)}function Cre(e,t){if(!function(r){return typeof r=="object"&&r!==null||typeof r=="function"}(e))throw new TypeError(`${t} is not an object.`)}function Cc(e,t,r){if(e===void 0)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function kF(e,t,r){if(e===void 0)throw new TypeError(`${t} is required in '${r}'.`)}function NF(e){return Number(e)}function are(e){return e===0?0:e}function UF(e,t){let r=Number.MAX_SAFE_INTEGER,n=Number(e);if(n=are(n),!nre(n))throw new TypeError(`${t} is not a finite number`);if(n=function(a){return are(v7e(a))}(n),n<0||n>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return nre(n)&&n!==0?n:0}function zF(e,t){if(!Vl(e))throw new TypeError(`${t} is not a ReadableStream.`)}function v0(e){return new wc(e)}function Dre(e,t){e._reader._readRequests.push(t)}function GF(e,t,r){let n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function Xw(e){return e._reader._readRequests.length}function Bre(e){let t=e._reader;return t!==void 0&&!!$l(t)}var wc=class{constructor(t){if(Cc(t,1,"ReadableStreamDefaultReader"),zF(t,"First parameter"),Kl(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");Tre(this,t),this._readRequests=new Ai}get closed(){return $l(this)?this._closedPromise:nt(kw("closed"))}cancel(t=void 0){return $l(this)?this._ownerReadableStream===void 0?nt(zw("cancel")):MF(this,t):nt(kw("cancel"))}read(){if(!$l(this))return nt(kw("read"));if(this._ownerReadableStream===void 0)return nt(zw("read from"));let t,r,n=Rn((a,i)=>{t=a,r=i});return Yv(this,{_chunkSteps:a=>t({value:a,done:!1}),_closeSteps:()=>t({value:void 0,done:!0}),_errorSteps:a=>r(a)}),n}releaseLock(){if(!$l(this))throw kw("releaseLock");this._ownerReadableStream!==void 0&&function(t){Sc(t);let r=new TypeError("Reader was released");Fre(t,r)}(this)}};function $l(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof wc}function Yv(e,t){let r=e._ownerReadableStream;r._disturbed=!0,r._state==="closed"?t._closeSteps():r._state==="errored"?t._errorSteps(r._storedError):r._readableStreamController[jF](t)}function Fre(e,t){let r=e._readRequests;e._readRequests=new Ai,r.forEach(n=>{n._errorSteps(t)})}function kw(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}var bF,vF,xF;function $v(e){return e.slice()}function Ore(e,t,r,n,a){new Uint8Array(e).set(new Uint8Array(r,n,a),t)}Object.defineProperties(wc.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),tr(wc.prototype.cancel,"cancel"),tr(wc.prototype.read,"read"),tr(wc.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(wc.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});var Vp=e=>(Vp=typeof e.transfer=="function"?t=>t.transfer():typeof structuredClone=="function"?t=>structuredClone(t,{transfer:[t]}):t=>t,Vp(e)),$p=e=>($p=typeof e.detached=="boolean"?t=>t.detached:t=>t.byteLength===0,$p(e));function Ire(e,t,r){if(e.slice)return e.slice(t,r);let n=r-t,a=new ArrayBuffer(n);return Ore(a,0,e,t,n),a}function Wv(e,t){let r=e[t];if(r!=null){if(typeof r!="function")throw new TypeError(`${String(t)} is not a function`);return r}}function ire(e){try{let t=e.done,r=e.value;return xu(b7e(r),n=>({done:t,value:n}))}catch(t){return nt(t)}}var ix=(xF=(bF=Symbol.asyncIterator)!==null&&bF!==void 0?bF:(vF=Symbol.for)===null||vF===void 0?void 0:vF.call(Symbol,"Symbol.asyncIterator"))!==null&&xF!==void 0?xF:"@@asyncIterator";function Pre(e,t="sync",r){if(r===void 0)if(t==="async"){if((r=Wv(e,ix))===void 0)return function(a){let i={next(){let o;try{o=Rre(a)}catch(s){return nt(s)}return ire(o)},return(o){let s;try{let u=Wv(a.iterator,"return");if(u===void 0)return rr({done:!0,value:o});s=Hp(u,a.iterator,[o])}catch(u){return nt(u)}return En(s)?ire(s):nt(new TypeError("The iterator.return() method must return an object"))}};return{iterator:i,nextMethod:i.next,done:!1}}(Pre(e,"sync",Wv(e,Symbol.iterator)))}else r=Wv(e,Symbol.iterator);if(r===void 0)throw new TypeError("The object is not iterable");let n=Hp(r,e,[]);if(!En(n))throw new TypeError("The iterator method must return an object");return{iterator:n,nextMethod:n.next,done:!1}}function Rre(e){let t=Hp(e.nextMethod,e.iterator,[]);if(!En(t))throw new TypeError("The iterator.next() method must return an object");return t}var Gw=class{constructor(t,r){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=t,this._preventCancel=r}next(){let t=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?kc(this._ongoingPromise,t,t):t(),this._ongoingPromise}return(t){let r=()=>this._returnSteps(t);return this._ongoingPromise=this._ongoingPromise?kc(this._ongoingPromise,r,r):r(),this._ongoingPromise}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let t=this._reader,r,n,a=Rn((i,o)=>{r=i,n=o});return Yv(t,{_chunkSteps:i=>{this._ongoingPromise=void 0,Gp(()=>r({value:i,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,Sc(t),r({value:void 0,done:!0})},_errorSteps:i=>{this._ongoingPromise=void 0,this._isFinished=!0,Sc(t),n(i)}}),a}_returnSteps(t){if(this._isFinished)return Promise.resolve({value:t,done:!0});this._isFinished=!0;let r=this._reader;if(!this._preventCancel){let n=MF(r,t);return Sc(r),kc(n,()=>({value:t,done:!0}))}return Sc(r),rr({value:t,done:!0})}},jre={next(){return ore(this)?this._asyncIteratorImpl.next():nt(sre("next"))},return(e){return ore(this)?this._asyncIteratorImpl.return(e):nt(sre("return"))},[ix](){return this}};function ore(e){if(!En(e)||!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof Gw}catch{return!1}}function sre(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}Object.defineProperty(jre,ix,{enumerable:!1});var Lre=Number.isNaN||function(e){return e!=e};function ure(e){let t=Ire(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function CF(e){let t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function HF(e,t,r){if(typeof(n=r)!="number"||Lre(n)||n<0||r===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");var n;e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function Jl(e){e._queue=new Ai,e._queueTotalSize=0}function Mre(e){return e===DataView}var Wl=class{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!yF(this))throw _F("view");return this._view}respond(t){if(!yF(this))throw _F("respond");if(Cc(t,1,"respond"),t=UF(t,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if($p(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");Mw(this._associatedReadableByteStreamController,t)}respondWithNewView(t){if(!yF(this))throw _F("respondWithNewView");if(Cc(t,1,"respondWithNewView"),!ArrayBuffer.isView(t))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if($p(t.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");qw(this._associatedReadableByteStreamController,t)}};Object.defineProperties(Wl.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),tr(Wl.prototype.respond,"respond"),tr(Wl.prototype.respondWithNewView,"respondWithNewView"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Wl.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});var bu=class{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Up(this))throw Vv("byobRequest");return BF(this)}get desiredSize(){if(!Up(this))throw Vv("desiredSize");return Jre(this)}close(){if(!Up(this))throw Vv("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let t=this._controlledReadableByteStream._state;if(t!=="readable")throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be closed`);Kv(this)}enqueue(t){if(!Up(this))throw Vv("enqueue");if(Cc(t,1,"enqueue"),!ArrayBuffer.isView(t))throw new TypeError("chunk must be an array buffer view");if(t.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(t.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");let r=this._controlledReadableByteStream._state;if(r!=="readable")throw new TypeError(`The stream (in ${r} state) is not in the readable state and cannot be enqueued to`);Lw(this,t)}error(t=void 0){if(!Up(this))throw Vv("error");_o(this,t)}[RF](t){qre(this),Jl(this);let r=this._cancelAlgorithm(t);return Yw(this),r}[jF](t){let r=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void Kre(this,t);let n=this._autoAllocateChunkSize;if(n!==void 0){let a;try{a=new ArrayBuffer(n)}catch(o){return void t._errorSteps(o)}let i={buffer:a,bufferByteLength:n,byteOffset:0,byteLength:n,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(i)}Dre(r,t),Jp(this)}[LF](){if(this._pendingPullIntos.length>0){let t=this._pendingPullIntos.peek();t.readerType="none",this._pendingPullIntos=new Ai,this._pendingPullIntos.push(t)}}};function Up(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof bu}function yF(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof Wl}function Jp(e){if(function(r){let n=r._controlledReadableByteStream;return n._state!=="readable"||r._closeRequested||!r._started?!1:!!(Bre(n)&&Xw(n)>0||$F(n)&&Qre(n)>0||Jre(r)>0)}(e)){if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0,wi(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Jp(e)),null),r=>(_o(e,r),null))}}function qre(e){VF(e),e._pendingPullIntos=new Ai}function Nre(e,t){let r=!1;e._state==="closed"&&(r=!0);let n=Ure(t);t.readerType==="default"?GF(e,n,r):function(a,i,o){let s=a._reader,u=s._readIntoRequests.shift();o?u._closeSteps(i):u._chunkSteps(i)}(e,n,r)}function Rw(e,t){for(let r=0;r<t.length;++r)Nre(e,t[r])}function Ure(e){let t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function jw(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function zre(e,t,r,n){let a;try{a=Ire(t,r,r+n)}catch(i){throw _o(e,i),i}jw(e,a,0,n)}function Gre(e,t){t.bytesFilled>0&&zre(e,t.buffer,t.byteOffset,t.bytesFilled),x0(e)}function Hre(e,t){let r=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),n=t.bytesFilled+r,a=r,i=!1,o=n-n%t.elementSize;o>=t.minimumFill&&(a=o-t.bytesFilled,i=!0);let s=e._queue;for(;a>0;){let u=s.peek(),c=Math.min(a,u.byteLength),l=t.byteOffset+t.bytesFilled;Ore(t.buffer,l,u.buffer,u.byteOffset,c),u.byteLength===c?s.shift():(u.byteOffset+=c,u.byteLength-=c),e._queueTotalSize-=c,Vre(e,c,t),a-=c}return i}function Vre(e,t,r){r.bytesFilled+=t}function $re(e){e._queueTotalSize===0&&e._closeRequested?(Yw(e),ox(e._controlledReadableByteStream)):Jp(e)}function VF(e){e._byobRequest!==null&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function DF(e){let t=[];for(;e._pendingPullIntos.length>0&&e._queueTotalSize!==0;){let r=e._pendingPullIntos.peek();Hre(e,r)&&(x0(e),t.push(r))}return t}function x7e(e,t,r,n){let a=e._controlledReadableByteStream,i=t.constructor,o=function(p){return Mre(p)?1:p.BYTES_PER_ELEMENT}(i),{byteOffset:s,byteLength:u}=t,c=r*o,l;try{l=Vp(t.buffer)}catch(p){return void n._errorSteps(p)}let f={buffer:l,bufferByteLength:l.byteLength,byteOffset:s,byteLength:u,bytesFilled:0,minimumFill:c,elementSize:o,viewConstructor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(f),void cre(a,n);if(a._state==="closed"){let p=new i(f.buffer,f.byteOffset,0);return void n._closeSteps(p)}if(e._queueTotalSize>0){if(Hre(e,f)){let p=Ure(f);return $re(e),void n._chunkSteps(p)}if(e._closeRequested){let p=new TypeError("Insufficient bytes to fill elements in the given buffer");return _o(e,p),void n._errorSteps(p)}}e._pendingPullIntos.push(f),cre(a,n),Jp(e)}function Wre(e,t){let r=e._pendingPullIntos.peek();VF(e),e._controlledReadableByteStream._state==="closed"?function(n,a){a.readerType==="none"&&x0(n);let i=n._controlledReadableByteStream;if($F(i)){let o=[];for(;o.length<Qre(i);)o.push(x0(n));Rw(i,o)}}(e,r):function(n,a,i){if(Vre(0,a,i),i.readerType==="none"){Gre(n,i);let u=DF(n);return void Rw(n._controlledReadableByteStream,u)}if(i.bytesFilled<i.minimumFill)return;x0(n);let o=i.bytesFilled%i.elementSize;if(o>0){let u=i.byteOffset+i.bytesFilled;zre(n,i.buffer,u-o,o)}i.bytesFilled-=o;let s=DF(n);Nre(n._controlledReadableByteStream,i),Rw(n._controlledReadableByteStream,s)}(e,t,r),Jp(e)}function x0(e){return e._pendingPullIntos.shift()}function Yw(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function Kv(e){let t=e._controlledReadableByteStream;if(!e._closeRequested&&t._state==="readable")if(e._queueTotalSize>0)e._closeRequested=!0;else{if(e._pendingPullIntos.length>0){let r=e._pendingPullIntos.peek();if(r.bytesFilled%r.elementSize!==0){let n=new TypeError("Insufficient bytes to fill elements in the given buffer");throw _o(e,n),n}}Yw(e),ox(t)}}function Lw(e,t){let r=e._controlledReadableByteStream;if(e._closeRequested||r._state!=="readable")return;let{buffer:n,byteOffset:a,byteLength:i}=t;if($p(n))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");let o=Vp(n);if(e._pendingPullIntos.length>0){let s=e._pendingPullIntos.peek();if($p(s.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");VF(e),s.buffer=Vp(s.buffer),s.readerType==="none"&&Gre(e,s)}Bre(r)?(function(s){let u=s._controlledReadableByteStream._reader;for(;u._readRequests.length>0;){if(s._queueTotalSize===0)return;Kre(s,u._readRequests.shift())}}(e),Xw(r)===0?jw(e,o,a,i):(e._pendingPullIntos.length>0&&x0(e),GF(r,new Uint8Array(o,a,i),!1))):$F(r)?(jw(e,o,a,i),Rw(r,DF(e))):jw(e,o,a,i),Jp(e)}function _o(e,t){let r=e._controlledReadableByteStream;r._state==="readable"&&(qre(e),Jl(e),Yw(e),vne(r,t))}function Kre(e,t){let r=e._queue.shift();e._queueTotalSize-=r.byteLength,$re(e);let n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(n)}function BF(e){if(e._byobRequest===null&&e._pendingPullIntos.length>0){let t=e._pendingPullIntos.peek(),r=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),n=Object.create(Wl.prototype);(function(a,i,o){a._associatedReadableByteStreamController=i,a._view=o})(n,e,r),e._byobRequest=n}return e._byobRequest}function Jre(e){let t=e._controlledReadableByteStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function Mw(e,t){let r=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state==="closed"){if(t!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(t===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range")}r.buffer=Vp(r.buffer),Wre(e,t)}function qw(e,t){let r=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state==="closed"){if(t.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(t.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.bufferByteLength!==t.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(r.bytesFilled+t.byteLength>r.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let n=t.byteLength;r.buffer=Vp(t.buffer),Wre(e,n)}function Xre(e,t,r,n,a,i,o){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,Jl(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=a,t._autoAllocateChunkSize=o,t._pendingPullIntos=new Ai,e._readableStreamController=t,wi(rr(r()),()=>(t._started=!0,Jp(t),null),s=>(_o(t,s),null))}function _F(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function Vv(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function y7e(e,t){if((e=`${e}`)!="byob")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function Yre(e){return new Ac(e)}function cre(e,t){e._reader._readIntoRequests.push(t)}function Qre(e){return e._reader._readIntoRequests.length}function $F(e){let t=e._reader;return t!==void 0&&!!zp(t)}Object.defineProperties(bu.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),tr(bu.prototype.close,"close"),tr(bu.prototype.enqueue,"enqueue"),tr(bu.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(bu.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});var Ac=class{constructor(t){if(Cc(t,1,"ReadableStreamBYOBReader"),zF(t,"First parameter"),Kl(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Up(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");Tre(this,t),this._readIntoRequests=new Ai}get closed(){return zp(this)?this._closedPromise:nt(Cw("closed"))}cancel(t=void 0){return zp(this)?this._ownerReadableStream===void 0?nt(zw("cancel")):MF(this,t):nt(Cw("cancel"))}read(t,r={}){if(!zp(this))return nt(Cw("read"));if(!ArrayBuffer.isView(t))return nt(new TypeError("view must be an array buffer view"));if(t.byteLength===0)return nt(new TypeError("view must have non-zero byteLength"));if(t.buffer.byteLength===0)return nt(new TypeError("view's buffer must have non-zero byteLength"));if($p(t.buffer))return nt(new TypeError("view's buffer has been detached"));let n;try{n=function(u,c){var l;return yu(u,c),{min:UF((l=u==null?void 0:u.min)!==null&&l!==void 0?l:1,`${c} has member 'min' that`)}}(r,"options")}catch(u){return nt(u)}let a=n.min;if(a===0)return nt(new TypeError("options.min must be greater than 0"));if(function(u){return Mre(u.constructor)}(t)){if(a>t.byteLength)return nt(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(a>t.length)return nt(new RangeError("options.min must be less than or equal to view's length"));if(this._ownerReadableStream===void 0)return nt(zw("read from"));let i,o,s=Rn((u,c)=>{i=u,o=c});return Zre(this,t,a,{_chunkSteps:u=>i({value:u,done:!1}),_closeSteps:u=>i({value:u,done:!0}),_errorSteps:u=>o(u)}),s}releaseLock(){if(!zp(this))throw Cw("releaseLock");this._ownerReadableStream!==void 0&&function(t){Sc(t);let r=new TypeError("Reader was released");ene(t,r)}(this)}};function zp(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof Ac}function Zre(e,t,r,n){let a=e._ownerReadableStream;a._disturbed=!0,a._state==="errored"?n._errorSteps(a._storedError):x7e(a._readableStreamController,t,r,n)}function ene(e,t){let r=e._readIntoRequests;e._readIntoRequests=new Ai,r.forEach(n=>{n._errorSteps(t)})}function Cw(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function Qv(e,t){let{highWaterMark:r}=e;if(r===void 0)return t;if(Lre(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function Hw(e){let{size:t}=e;return t||(()=>1)}function Vw(e,t){yu(e,t);let r=e==null?void 0:e.highWaterMark,n=e==null?void 0:e.size;return{highWaterMark:r===void 0?void 0:NF(r),size:n===void 0?void 0:_7e(n,`${t} has member 'size' that`)}}function _7e(e,t){return wo(e,t),r=>NF(e(r))}function w7e(e,t,r){return wo(e,r),n=>Dc(e,t,[n])}function A7e(e,t,r){return wo(e,r),()=>Dc(e,t,[])}function E7e(e,t,r){return wo(e,r),n=>Hp(e,t,[n])}function T7e(e,t,r){return wo(e,r),(n,a)=>Dc(e,t,[n,a])}function tne(e,t){if(!b0(e))throw new TypeError(`${t} is not a WritableStream.`)}Object.defineProperties(Ac.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),tr(Ac.prototype.cancel,"cancel"),tr(Ac.prototype.read,"read"),tr(Ac.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Ac.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});var Ec=class{constructor(t={},r={}){t===void 0?t=null:Cre(t,"First parameter");let n=Vw(r,"Second parameter"),a=function(o,s){yu(o,s);let u=o==null?void 0:o.abort,c=o==null?void 0:o.close,l=o==null?void 0:o.start,f=o==null?void 0:o.type,p=o==null?void 0:o.write;return{abort:u===void 0?void 0:w7e(u,o,`${s} has member 'abort' that`),close:c===void 0?void 0:A7e(c,o,`${s} has member 'close' that`),start:l===void 0?void 0:E7e(l,o,`${s} has member 'start' that`),write:p===void 0?void 0:T7e(p,o,`${s} has member 'write' that`),type:f}}(t,"First parameter");if(nne(this),a.type!==void 0)throw new RangeError("Invalid type is specified");let i=Hw(n);(function(o,s,u,c){let l=Object.create(Wp.prototype),f,p,d,h;f=s.start!==void 0?()=>s.start(l):()=>{},p=s.write!==void 0?m=>s.write(m,l):()=>rr(void 0),d=s.close!==void 0?()=>s.close():()=>rr(void 0),h=s.abort!==void 0?m=>s.abort(m):()=>rr(void 0),lne(o,l,f,p,d,h,u,c)})(this,a,Qv(n,1),i)}get locked(){if(!b0(this))throw Bw("locked");return y0(this)}abort(t=void 0){return b0(this)?y0(this)?nt(new TypeError("Cannot abort a stream that already has a writer")):$w(this,t):nt(Bw("abort"))}close(){return b0(this)?y0(this)?nt(new TypeError("Cannot close a stream that already has a writer")):_u(this)?nt(new TypeError("Cannot close an already-closing stream")):ane(this):nt(Bw("close"))}getWriter(){if(!b0(this))throw Bw("getWriter");return rne(this)}};function rne(e){return new gu(e)}function nne(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new Ai,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function b0(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof Ec}function y0(e){return e._writer!==void 0}function $w(e,t){var r;if(e._state==="closed"||e._state==="errored")return rr(void 0);e._writableStreamController._abortReason=t,(r=e._writableStreamController._abortController)===null||r===void 0||r.abort(t);let n=e._state;if(n==="closed"||n==="errored")return rr(void 0);if(e._pendingAbortRequest!==void 0)return e._pendingAbortRequest._promise;let a=!1;n==="erroring"&&(a=!0,t=void 0);let i=Rn((o,s)=>{e._pendingAbortRequest={_promise:void 0,_resolve:o,_reject:s,_reason:t,_wasAlreadyErroring:a}});return e._pendingAbortRequest._promise=i,a||WF(e,t),i}function ane(e){let t=e._state;if(t==="closed"||t==="errored")return nt(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));let r=Rn((i,o)=>{let s={_resolve:i,_reject:o};e._closeRequest=s}),n=e._writer;var a;return n!==void 0&&e._backpressure&&t==="writable"&&QF(n),HF(a=e._writableStreamController,cne,0),Qw(a),r}function FF(e,t){e._state!=="writable"?KF(e):WF(e,t)}function WF(e,t){let r=e._writableStreamController;e._state="erroring",e._storedError=t;let n=e._writer;n!==void 0&&one(n,t),!function(a){return!(a._inFlightWriteRequest===void 0&&a._inFlightCloseRequest===void 0)}(e)&&r._started&&KF(e)}function KF(e){e._state="errored",e._writableStreamController[Ere]();let t=e._storedError;if(e._writeRequests.forEach(n=>{n._reject(t)}),e._writeRequests=new Ai,e._pendingAbortRequest===void 0)return void Dw(e);let r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void Dw(e);wi(e._writableStreamController[Are](r._reason),()=>(r._resolve(),Dw(e),null),n=>(r._reject(n),Dw(e),null))}function _u(e){return e._closeRequest!==void 0||e._inFlightCloseRequest!==void 0}function Dw(e){e._closeRequest!==void 0&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);let t=e._writer;t!==void 0&&YF(t,e._storedError)}function JF(e,t){let r=e._writer;r!==void 0&&t!==e._backpressure&&(t?function(n){Zw(n)}(r):QF(r)),e._backpressure=t}Object.defineProperties(Ec.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),tr(Ec.prototype.abort,"abort"),tr(Ec.prototype.close,"close"),tr(Ec.prototype.getWriter,"getWriter"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Ec.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});var gu=class{constructor(t){if(Cc(t,1,"WritableStreamDefaultWriter"),tne(t,"First parameter"),y0(t))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=t,t._writer=this;let r=t._state;if(r==="writable")!_u(t)&&t._backpressure?Zw(this):lre(this),Nw(this);else if(r==="erroring")OF(this,t._storedError),Nw(this);else if(r==="closed")lre(this),Nw(n=this),hne(n);else{let a=t._storedError;OF(this,a),dne(this,a)}var n}get closed(){return Mp(this)?this._closedPromise:nt(qp("closed"))}get desiredSize(){if(!Mp(this))throw qp("desiredSize");if(this._ownerWritableStream===void 0)throw Jv("desiredSize");return function(t){let r=t._ownerWritableStream,n=r._state;return n==="errored"||n==="erroring"?null:n==="closed"?0:fne(r._writableStreamController)}(this)}get ready(){return Mp(this)?this._readyPromise:nt(qp("ready"))}abort(t=void 0){return Mp(this)?this._ownerWritableStream===void 0?nt(Jv("abort")):function(r,n){return $w(r._ownerWritableStream,n)}(this,t):nt(qp("abort"))}close(){if(!Mp(this))return nt(qp("close"));let t=this._ownerWritableStream;return t===void 0?nt(Jv("close")):_u(t)?nt(new TypeError("Cannot close an already-closing stream")):ine(this)}releaseLock(){if(!Mp(this))throw qp("releaseLock");this._ownerWritableStream!==void 0&&sne(this)}write(t=void 0){return Mp(this)?this._ownerWritableStream===void 0?nt(Jv("write to")):une(this,t):nt(qp("write"))}};function Mp(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof gu}function ine(e){return ane(e._ownerWritableStream)}function S7e(e,t){e._closedPromiseState==="pending"?YF(e,t):function(r,n){dne(r,n)}(e,t)}function one(e,t){e._readyPromiseState==="pending"?mne(e,t):function(r,n){OF(r,n)}(e,t)}function sne(e){let t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");one(e,r),S7e(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function une(e,t){let r=e._ownerWritableStream,n=r._writableStreamController,a=function(s,u){if(s._strategySizeAlgorithm===void 0)return 1;try{return s._strategySizeAlgorithm(u)}catch(c){return Zv(s,c),1}}(n,t);if(r!==e._ownerWritableStream)return nt(Jv("write to"));let i=r._state;if(i==="errored")return nt(r._storedError);if(_u(r)||i==="closed")return nt(new TypeError("The stream is closing or closed and cannot be written to"));if(i==="erroring")return nt(r._storedError);let o=function(s){return Rn((u,c)=>{let l={_resolve:u,_reject:c};s._writeRequests.push(l)})}(r);return function(s,u,c){try{HF(s,u,c)}catch(f){return void Zv(s,f)}let l=s._controlledWritableStream;!_u(l)&&l._state==="writable"&&JF(l,XF(s)),Qw(s)}(n,t,a),o}Object.defineProperties(gu.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),tr(gu.prototype.abort,"abort"),tr(gu.prototype.close,"close"),tr(gu.prototype.releaseLock,"releaseLock"),tr(gu.prototype.write,"write"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(gu.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});var cne={},Wp=class{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!wF(this))throw AF("abortReason");return this._abortReason}get signal(){if(!wF(this))throw AF("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(t=void 0){if(!wF(this))throw AF("error");this._controlledWritableStream._state==="writable"&&pne(this,t)}[Are](t){let r=this._abortAlgorithm(t);return Ww(this),r}[Ere](){Jl(this)}};function wF(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof Wp}function lne(e,t,r,n,a,i,o,s){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,Jl(t),t._abortReason=void 0,t._abortController=function(){if(typeof AbortController=="function")return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=s,t._strategyHWM=o,t._writeAlgorithm=n,t._closeAlgorithm=a,t._abortAlgorithm=i;let u=XF(t);JF(e,u),wi(rr(r()),()=>(t._started=!0,Qw(t),null),c=>(t._started=!0,FF(e,c),null))}function Ww(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function fne(e){return e._strategyHWM-e._queueTotalSize}function Qw(e){let t=e._controlledWritableStream;if(!e._started||t._inFlightWriteRequest!==void 0)return;if(t._state==="erroring")return void KF(t);if(e._queue.length===0)return;let r=e._queue.peek().value;r===cne?function(n){let a=n._controlledWritableStream;(function(o){o._inFlightCloseRequest=o._closeRequest,o._closeRequest=void 0})(a),CF(n);let i=n._closeAlgorithm();Ww(n),wi(i,()=>(function(o){o._inFlightCloseRequest._resolve(void 0),o._inFlightCloseRequest=void 0,o._state==="erroring"&&(o._storedError=void 0,o._pendingAbortRequest!==void 0&&(o._pendingAbortRequest._resolve(),o._pendingAbortRequest=void 0)),o._state="closed";let s=o._writer;s!==void 0&&hne(s)}(a),null),o=>(function(s,u){s._inFlightCloseRequest._reject(u),s._inFlightCloseRequest=void 0,s._pendingAbortRequest!==void 0&&(s._pendingAbortRequest._reject(u),s._pendingAbortRequest=void 0),FF(s,u)}(a,o),null))}(e):function(n,a){let i=n._controlledWritableStream;(function(s){s._inFlightWriteRequest=s._writeRequests.shift()})(i);let o=n._writeAlgorithm(a);wi(o,()=>{(function(u){u._inFlightWriteRequest._resolve(void 0),u._inFlightWriteRequest=void 0})(i);let s=i._state;if(CF(n),!_u(i)&&s==="writable"){let u=XF(n);JF(i,u)}return Qw(n),null},s=>(i._state==="writable"&&Ww(n),function(u,c){u._inFlightWriteRequest._reject(c),u._inFlightWriteRequest=void 0,FF(u,c)}(i,s),null))}(e,r)}function Zv(e,t){e._controlledWritableStream._state==="writable"&&pne(e,t)}function XF(e){return fne(e)<=0}function pne(e,t){let r=e._controlledWritableStream;Ww(e),WF(r,t)}function Bw(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function AF(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function qp(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function Jv(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function Nw(e){e._closedPromise=Rn((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"})}function dne(e,t){Nw(e),YF(e,t)}function YF(e,t){e._closedPromise_reject!==void 0&&(A0(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function hne(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function Zw(e){e._readyPromise=Rn((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r}),e._readyPromiseState="pending"}function OF(e,t){Zw(e),mne(e,t)}function lre(e){Zw(e),QF(e)}function mne(e,t){e._readyPromise_reject!==void 0&&(A0(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function QF(e){e._readyPromise_resolve!==void 0&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}Object.defineProperties(Wp.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Wp.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});var fre=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof global<"u"?global:void 0,k7e=function(){let e=fre==null?void 0:fre.DOMException;return function(t){if(typeof t!="function"&&typeof t!="object"||t.name!=="DOMException")return!1;try{return new t,!0}catch{return!1}}(e)?e:void 0}()||function(){let e=function(t,r){this.message=t||"",this.name=r||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return tr(e,"DOMException"),e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function pre(e,t,r,n,a,i){let o=v0(e),s=rne(t);e._disturbed=!0;let u=!1,c=rr(void 0);return Rn((l,f)=>{let p;if(i!==void 0){if(p=()=>{let A=i.reason!==void 0?i.reason:new k7e("Aborted","AbortError"),B=[];n||B.push(()=>t._state==="writable"?$w(t,A):rr(void 0)),a||B.push(()=>e._state==="readable"?hs(e,A):rr(void 0)),y(()=>Promise.all(B.map(I=>I())),!0,A)},i.aborted)return void p();i.addEventListener("abort",p)}var d,h,m;if(x(e,o._closedPromise,A=>(n?w(!0,A):y(()=>$w(t,A),!0,A),null)),x(t,s._closedPromise,A=>(a?w(!0,A):y(()=>hs(e,A),!0,A),null)),d=e,h=o._closedPromise,m=()=>(r?w():y(()=>function(A){let B=A._ownerWritableStream,I=B._state;return _u(B)||I==="closed"?rr(void 0):I==="errored"?nt(B._storedError):ine(A)}(s)),null),d._state==="closed"?m():gF(h,m),_u(t)||t._state==="closed"){let A=new TypeError("the destination writable stream closed before all data could be piped to it");a?w(!0,A):y(()=>hs(e,A),!0,A)}function g(){let A=c;return xu(c,()=>A!==c?g():void 0)}function x(A,B,I){A._state==="errored"?I(A._storedError):TF(B,I)}function y(A,B,I){function L(){return wi(A(),()=>T(B,I),C=>T(!0,C)),null}u||(u=!0,t._state!=="writable"||_u(t)?L():gF(g(),L))}function w(A,B){u||(u=!0,t._state!=="writable"||_u(t)?T(A,B):gF(g(),()=>T(A,B)))}function T(A,B){return sne(s),Sc(o),i!==void 0&&i.removeEventListener("abort",p),A?f(B):l(void 0),null}A0(Rn((A,B)=>{(function I(L){L?A():xu(u?rr(!0):xu(s._readyPromise,()=>Rn((C,k)=>{Yv(o,{_chunkSteps:F=>{c=xu(une(s,F),void 0,Xv),C(!1)},_closeSteps:()=>C(!0),_errorSteps:k})})),I,B)})(!1)}))})}var vu=class{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Fw(this))throw Ow("desiredSize");return ZF(this)}close(){if(!Fw(this))throw Ow("close");if(!w0(this))throw new TypeError("The stream is not in a state that permits close");Kp(this)}enqueue(t=void 0){if(!Fw(this))throw Ow("enqueue");if(!w0(this))throw new TypeError("The stream is not in a state that permits enqueue");return _0(this,t)}error(t=void 0){if(!Fw(this))throw Ow("error");ms(this,t)}[RF](t){Jl(this);let r=this._cancelAlgorithm(t);return Kw(this),r}[jF](t){let r=this._controlledReadableStream;if(this._queue.length>0){let n=CF(this);this._closeRequested&&this._queue.length===0?(Kw(this),ox(r)):ex(this),t._chunkSteps(n)}else Dre(r,t),ex(this)}[LF](){}};function Fw(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")&&e instanceof vu}function ex(e){if(gne(e)){if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0,wi(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,ex(e)),null),t=>(ms(e,t),null))}}function gne(e){let t=e._controlledReadableStream;return!w0(e)||!e._started?!1:Kl(t)&&Xw(t)>0?!0:ZF(e)>0}function Kw(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Kp(e){if(!w0(e))return;let t=e._controlledReadableStream;e._closeRequested=!0,e._queue.length===0&&(Kw(e),ox(t))}function _0(e,t){if(!w0(e))return;let r=e._controlledReadableStream;if(Kl(r)&&Xw(r)>0)GF(r,t,!1);else{let n;try{n=e._strategySizeAlgorithm(t)}catch(a){throw ms(e,a),a}try{HF(e,t,n)}catch(a){throw ms(e,a),a}}ex(e)}function ms(e,t){let r=e._controlledReadableStream;r._state==="readable"&&(Jl(e),Kw(e),vne(r,t))}function ZF(e){let t=e._controlledReadableStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function w0(e){let t=e._controlledReadableStream._state;return!e._closeRequested&&t==="readable"}function bne(e,t,r,n,a,i,o){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,Jl(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=o,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=a,e._readableStreamController=t,wi(rr(r()),()=>(t._started=!0,ex(t),null),s=>(ms(t,s),null))}function Ow(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function C7e(e,t){return Up(e._readableStreamController)?function(r){let n,a,i,o,s,u=v0(r),c=!1,l=!1,f=!1,p=!1,d=!1,h=Rn(I=>{s=I});function m(I){TF(I._closedPromise,L=>(I!==u||(_o(i._readableStreamController,L),_o(o._readableStreamController,L),p&&d||s(void 0)),null))}function g(){zp(u)&&(Sc(u),u=v0(r),m(u)),Yv(u,{_chunkSteps:I=>{Gp(()=>{l=!1,f=!1;let L=I,C=I;if(!p&&!d)try{C=ure(I)}catch(k){return _o(i._readableStreamController,k),_o(o._readableStreamController,k),void s(hs(r,k))}p||Lw(i._readableStreamController,L),d||Lw(o._readableStreamController,C),c=!1,l?y():f&&w()})},_closeSteps:()=>{c=!1,p||Kv(i._readableStreamController),d||Kv(o._readableStreamController),i._readableStreamController._pendingPullIntos.length>0&&Mw(i._readableStreamController,0),o._readableStreamController._pendingPullIntos.length>0&&Mw(o._readableStreamController,0),p&&d||s(void 0)},_errorSteps:()=>{c=!1}})}function x(I,L){$l(u)&&(Sc(u),u=Yre(r),m(u));let C=L?o:i,k=L?i:o;Zre(u,I,1,{_chunkSteps:F=>{Gp(()=>{l=!1,f=!1;let R=L?d:p;if(L?p:d)R||qw(C._readableStreamController,F);else{let G;try{G=ure(F)}catch(z){return _o(C._readableStreamController,z),_o(k._readableStreamController,z),void s(hs(r,z))}R||qw(C._readableStreamController,F),Lw(k._readableStreamController,G)}c=!1,l?y():f&&w()})},_closeSteps:F=>{c=!1;let R=L?d:p,G=L?p:d;R||Kv(C._readableStreamController),G||Kv(k._readableStreamController),F!==void 0&&(R||qw(C._readableStreamController,F),!G&&k._readableStreamController._pendingPullIntos.length>0&&Mw(k._readableStreamController,0)),R&&G||s(void 0)},_errorSteps:()=>{c=!1}})}function y(){if(c)return l=!0,rr(void 0);c=!0;let I=BF(i._readableStreamController);return I===null?g():x(I._view,!1),rr(void 0)}function w(){if(c)return f=!0,rr(void 0);c=!0;let I=BF(o._readableStreamController);return I===null?g():x(I._view,!0),rr(void 0)}function T(I){if(p=!0,n=I,d){let L=$v([n,a]),C=hs(r,L);s(C)}return h}function A(I){if(d=!0,a=I,p){let L=$v([n,a]),C=hs(r,L);s(C)}return h}function B(){}return i=hre(B,y,T),o=hre(B,w,A),m(u),[i,o]}(e):function(r){let n=v0(r),a,i,o,s,u,c=!1,l=!1,f=!1,p=!1,d=Rn(y=>{u=y});function h(){return c?(l=!0,rr(void 0)):(c=!0,Yv(n,{_chunkSteps:y=>{Gp(()=>{l=!1;let w=y,T=y;f||_0(o._readableStreamController,w),p||_0(s._readableStreamController,T),c=!1,l&&h()})},_closeSteps:()=>{c=!1,f||Kp(o._readableStreamController),p||Kp(s._readableStreamController),f&&p||u(void 0)},_errorSteps:()=>{c=!1}}),rr(void 0))}function m(y){if(f=!0,a=y,p){let w=$v([a,i]),T=hs(r,w);u(T)}return d}function g(y){if(p=!0,i=y,f){let w=$v([a,i]),T=hs(r,w);u(T)}return d}function x(){}return o=tx(x,h,m),s=tx(x,h,g),TF(n._closedPromise,y=>(ms(o._readableStreamController,y),ms(s._readableStreamController,y),f&&p||u(void 0),null)),[o,s]}(e)}function D7e(e){return En(t=e)&&t.getReader!==void 0?function(r){let n;function a(){let o;try{o=r.read()}catch(s){return nt(s)}return kc(o,s=>{if(!En(s))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(s.done)Kp(n._readableStreamController);else{let u=s.value;_0(n._readableStreamController,u)}})}function i(o){try{return rr(r.cancel(o))}catch(s){return nt(s)}}return n=tx(Xv,a,i,0),n}(e.getReader()):function(r){let n,a=Pre(r,"async");function i(){let s;try{s=Rre(a)}catch(u){return nt(u)}return kc(rr(s),u=>{if(!En(u))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(u.done)Kp(n._readableStreamController);else{let c=u.value;_0(n._readableStreamController,c)}})}function o(s){let u=a.iterator,c;try{c=Wv(u,"return")}catch(l){return nt(l)}return c===void 0?rr(void 0):kc(Dc(c,u,[s]),l=>{if(!En(l))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")})}return n=tx(Xv,i,o,0),n}(e);var t}function B7e(e,t,r){return wo(e,r),n=>Dc(e,t,[n])}function F7e(e,t,r){return wo(e,r),n=>Dc(e,t,[n])}function O7e(e,t,r){return wo(e,r),n=>Hp(e,t,[n])}function I7e(e,t){if((e=`${e}`)!="bytes")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function dre(e,t){yu(e,t);let r=e==null?void 0:e.preventAbort,n=e==null?void 0:e.preventCancel,a=e==null?void 0:e.preventClose,i=e==null?void 0:e.signal;return i!==void 0&&function(o,s){if(!function(u){if(typeof u!="object"||u===null)return!1;try{return typeof u.aborted=="boolean"}catch{return!1}}(o))throw new TypeError(`${s} is not an AbortSignal.`)}(i,`${t} has member 'signal' that`),{preventAbort:Boolean(r),preventCancel:Boolean(n),preventClose:Boolean(a),signal:i}}Object.defineProperties(vu.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),tr(vu.prototype.close,"close"),tr(vu.prototype.enqueue,"enqueue"),tr(vu.prototype.error,"error"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(vu.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});var Kn=class{constructor(t={},r={}){t===void 0?t=null:Cre(t,"First parameter");let n=Vw(r,"Second parameter"),a=function(i,o){yu(i,o);let s=i,u=s==null?void 0:s.autoAllocateChunkSize,c=s==null?void 0:s.cancel,l=s==null?void 0:s.pull,f=s==null?void 0:s.start,p=s==null?void 0:s.type;return{autoAllocateChunkSize:u===void 0?void 0:UF(u,`${o} has member 'autoAllocateChunkSize' that`),cancel:c===void 0?void 0:B7e(c,s,`${o} has member 'cancel' that`),pull:l===void 0?void 0:F7e(l,s,`${o} has member 'pull' that`),start:f===void 0?void 0:O7e(f,s,`${o} has member 'start' that`),type:p===void 0?void 0:I7e(p,`${o} has member 'type' that`)}}(t,"First parameter");if(eO(this),a.type==="bytes"){if(n.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");(function(i,o,s){let u=Object.create(bu.prototype),c,l,f;c=o.start!==void 0?()=>o.start(u):()=>{},l=o.pull!==void 0?()=>o.pull(u):()=>rr(void 0),f=o.cancel!==void 0?d=>o.cancel(d):()=>rr(void 0);let p=o.autoAllocateChunkSize;if(p===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");Xre(i,u,c,l,f,s,p)})(this,a,Qv(n,0))}else{let i=Hw(n);(function(o,s,u,c){let l=Object.create(vu.prototype),f,p,d;f=s.start!==void 0?()=>s.start(l):()=>{},p=s.pull!==void 0?()=>s.pull(l):()=>rr(void 0),d=s.cancel!==void 0?h=>s.cancel(h):()=>rr(void 0),bne(o,l,f,p,d,u,c)})(this,a,Qv(n,1),i)}}get locked(){if(!Vl(this))throw Np("locked");return Kl(this)}cancel(t=void 0){return Vl(this)?Kl(this)?nt(new TypeError("Cannot cancel a stream that already has a reader")):hs(this,t):nt(Np("cancel"))}getReader(t=void 0){if(!Vl(this))throw Np("getReader");return function(r,n){yu(r,n);let a=r==null?void 0:r.mode;return{mode:a===void 0?void 0:y7e(a,`${n} has member 'mode' that`)}}(t,"First parameter").mode===void 0?v0(this):Yre(this)}pipeThrough(t,r={}){if(!Vl(this))throw Np("pipeThrough");Cc(t,1,"pipeThrough");let n=function(i,o){yu(i,o);let s=i==null?void 0:i.readable;kF(s,"readable","ReadableWritablePair"),zF(s,`${o} has member 'readable' that`);let u=i==null?void 0:i.writable;return kF(u,"writable","ReadableWritablePair"),tne(u,`${o} has member 'writable' that`),{readable:s,writable:u}}(t,"First parameter"),a=dre(r,"Second parameter");if(Kl(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(y0(n.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return A0(pre(this,n.writable,a.preventClose,a.preventAbort,a.preventCancel,a.signal)),n.readable}pipeTo(t,r={}){if(!Vl(this))return nt(Np("pipeTo"));if(t===void 0)return nt("Parameter 1 is required in 'pipeTo'.");if(!b0(t))return nt(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let n;try{n=dre(r,"Second parameter")}catch(a){return nt(a)}return Kl(this)?nt(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):y0(t)?nt(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):pre(this,t,n.preventClose,n.preventAbort,n.preventCancel,n.signal)}tee(){if(!Vl(this))throw Np("tee");return $v(C7e(this))}values(t=void 0){if(!Vl(this))throw Np("values");return function(r,n){let a=v0(r),i=new Gw(a,n),o=Object.create(jre);return o._asyncIteratorImpl=i,o}(this,function(r,n){yu(r,n);let a=r==null?void 0:r.preventCancel;return{preventCancel:Boolean(a)}}(t,"First parameter").preventCancel)}[ix](t){return this.values(t)}static from(t){return D7e(t)}};function tx(e,t,r,n=1,a=()=>1){let i=Object.create(Kn.prototype);return eO(i),bne(i,Object.create(vu.prototype),e,t,r,n,a),i}function hre(e,t,r){let n=Object.create(Kn.prototype);return eO(n),Xre(n,Object.create(bu.prototype),e,t,r,0,void 0),n}function eO(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function Vl(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")&&e instanceof Kn}function Kl(e){return e._reader!==void 0}function hs(e,t){if(e._disturbed=!0,e._state==="closed")return rr(void 0);if(e._state==="errored")return nt(e._storedError);ox(e);let r=e._reader;if(r!==void 0&&zp(r)){let n=r._readIntoRequests;r._readIntoRequests=new Ai,n.forEach(a=>{a._closeSteps(void 0)})}return kc(e._readableStreamController[RF](t),Xv)}function ox(e){e._state="closed";let t=e._reader;if(t!==void 0&&(kre(t),$l(t))){let r=t._readRequests;t._readRequests=new Ai,r.forEach(n=>{n._closeSteps()})}}function vne(e,t){e._state="errored",e._storedError=t;let r=e._reader;r!==void 0&&(qF(r,t),$l(r)?Fre(r,t):ene(r,t))}function Np(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function xne(e,t){yu(e,t);let r=e==null?void 0:e.highWaterMark;return kF(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:NF(r)}}Object.defineProperties(Kn,{from:{enumerable:!0}}),Object.defineProperties(Kn.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),tr(Kn.from,"from"),tr(Kn.prototype.cancel,"cancel"),tr(Kn.prototype.getReader,"getReader"),tr(Kn.prototype.pipeThrough,"pipeThrough"),tr(Kn.prototype.pipeTo,"pipeTo"),tr(Kn.prototype.tee,"tee"),tr(Kn.prototype.values,"values"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Kn.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(Kn.prototype,ix,{value:Kn.prototype.values,writable:!0,configurable:!0});var yne=e=>e.byteLength;tr(yne,"size");var rx=class{constructor(t){Cc(t,1,"ByteLengthQueuingStrategy"),t=xne(t,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!gre(this))throw mre("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!gre(this))throw mre("size");return yne}};function mre(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function gre(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")&&e instanceof rx}Object.defineProperties(rx.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(rx.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});var _ne=()=>1;tr(_ne,"size");var nx=class{constructor(t){Cc(t,1,"CountQueuingStrategy"),t=xne(t,"First parameter"),this._countQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!vre(this))throw bre("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!vre(this))throw bre("size");return _ne}};function bre(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function vre(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")&&e instanceof nx}function P7e(e,t,r){return wo(e,r),n=>Dc(e,t,[n])}function R7e(e,t,r){return wo(e,r),n=>Hp(e,t,[n])}function j7e(e,t,r){return wo(e,r),(n,a)=>Dc(e,t,[n,a])}function L7e(e,t,r){return wo(e,r),n=>Dc(e,t,[n])}Object.defineProperties(nx.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(nx.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});var ax=class{constructor(t={},r={},n={}){t===void 0&&(t=null);let a=Vw(r,"Second parameter"),i=Vw(n,"Third parameter"),o=function(p,d){yu(p,d);let h=p==null?void 0:p.cancel,m=p==null?void 0:p.flush,g=p==null?void 0:p.readableType,x=p==null?void 0:p.start,y=p==null?void 0:p.transform,w=p==null?void 0:p.writableType;return{cancel:h===void 0?void 0:L7e(h,p,`${d} has member 'cancel' that`),flush:m===void 0?void 0:P7e(m,p,`${d} has member 'flush' that`),readableType:g,start:x===void 0?void 0:R7e(x,p,`${d} has member 'start' that`),transform:y===void 0?void 0:j7e(y,p,`${d} has member 'transform' that`),writableType:w}}(t,"First parameter");if(o.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(o.writableType!==void 0)throw new RangeError("Invalid writableType specified");let s=Qv(i,0),u=Hw(i),c=Qv(a,1),l=Hw(a),f;(function(p,d,h,m,g,x){function y(){return d}function w(L){return function(C,k){let F=C._transformStreamController;return C._backpressure?kc(C._backpressureChangePromise,()=>{let R=C._writable;if(R._state==="erroring")throw R._storedError;return yre(F,k)}):yre(F,k)}(p,L)}function T(L){return function(C,k){let F=C._transformStreamController;if(F._finishPromise!==void 0)return F._finishPromise;let R=C._readable;F._finishPromise=Rn((z,W)=>{F._finishPromise_resolve=z,F._finishPromise_reject=W});let G=F._cancelAlgorithm(k);return Uw(F),wi(G,()=>(R._state==="errored"?g0(F,R._storedError):(ms(R._readableStreamController,k),EF(F)),null),z=>(ms(R._readableStreamController,z),g0(F,z),null)),F._finishPromise}(p,L)}function A(){return function(L){let C=L._transformStreamController;if(C._finishPromise!==void 0)return C._finishPromise;let k=L._readable;C._finishPromise=Rn((R,G)=>{C._finishPromise_resolve=R,C._finishPromise_reject=G});let F=C._flushAlgorithm();return Uw(C),wi(F,()=>(k._state==="errored"?g0(C,k._storedError):(Kp(k._readableStreamController),EF(C)),null),R=>(ms(k._readableStreamController,R),g0(C,R),null)),C._finishPromise}(p)}function B(){return function(L){return Jw(L,!1),L._backpressureChangePromise}(p)}function I(L){return function(C,k){let F=C._transformStreamController;if(F._finishPromise!==void 0)return F._finishPromise;let R=C._writable;F._finishPromise=Rn((z,W)=>{F._finishPromise_resolve=z,F._finishPromise_reject=W});let G=F._cancelAlgorithm(k);return Uw(F),wi(G,()=>(R._state==="errored"?g0(F,R._storedError):(Zv(R._writableStreamController,k),IF(C),EF(F)),null),z=>(Zv(R._writableStreamController,z),IF(C),g0(F,z),null)),F._finishPromise}(p,L)}p._writable=function(L,C,k,F,R=1,G=()=>1){let z=Object.create(Ec.prototype);return nne(z),lne(z,Object.create(Wp.prototype),L,C,k,F,R,G),z}(y,w,A,T,h,m),p._readable=tx(y,B,I,g,x),p._backpressure=void 0,p._backpressureChangePromise=void 0,p._backpressureChangePromise_resolve=void 0,Jw(p,!0),p._transformStreamController=void 0})(this,Rn(p=>{f=p}),c,l,s,u),function(p,d){let h=Object.create(Tc.prototype),m,g,x;m=d.transform!==void 0?y=>d.transform(y,h):y=>{try{return Ane(h,y),rr(void 0)}catch(w){return nt(w)}},g=d.flush!==void 0?()=>d.flush(h):()=>rr(void 0),x=d.cancel!==void 0?y=>d.cancel(y):()=>rr(void 0),function(y,w,T,A,B){w._controlledTransformStream=y,y._transformStreamController=w,w._transformAlgorithm=T,w._flushAlgorithm=A,w._cancelAlgorithm=B,w._finishPromise=void 0,w._finishPromise_resolve=void 0,w._finishPromise_reject=void 0}(p,h,m,g,x)}(this,o),o.start!==void 0?f(o.start(this._transformStreamController)):f(void 0)}get readable(){if(!xre(this))throw _re("readable");return this._readable}get writable(){if(!xre(this))throw _re("writable");return this._writable}};function xre(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")&&e instanceof ax}function wne(e,t){ms(e._readable._readableStreamController,t),tO(e,t)}function tO(e,t){Uw(e._transformStreamController),Zv(e._writable._writableStreamController,t),IF(e)}function IF(e){e._backpressure&&Jw(e,!1)}function Jw(e,t){e._backpressureChangePromise!==void 0&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=Rn(r=>{e._backpressureChangePromise_resolve=r}),e._backpressure=t}Object.defineProperties(ax.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(ax.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});var Tc=class{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Iw(this))throw Pw("desiredSize");return ZF(this._controlledTransformStream._readable._readableStreamController)}enqueue(t=void 0){if(!Iw(this))throw Pw("enqueue");Ane(this,t)}error(t=void 0){if(!Iw(this))throw Pw("error");var r;r=t,wne(this._controlledTransformStream,r)}terminate(){if(!Iw(this))throw Pw("terminate");(function(t){let r=t._controlledTransformStream;Kp(r._readable._readableStreamController);let n=new TypeError("TransformStream terminated");tO(r,n)})(this)}};function Iw(e){return!!En(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")&&e instanceof Tc}function Uw(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0,e._cancelAlgorithm=void 0}function Ane(e,t){let r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!w0(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{_0(n,t)}catch(i){throw tO(r,i),r._readable._storedError}(function(i){return!gne(i)})(n)!==r._backpressure&&Jw(r,!0)}function yre(e,t){return kc(e._transformAlgorithm(t),void 0,r=>{throw wne(e._controlledTransformStream,r),r})}function Pw(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function EF(e){e._finishPromise_resolve!==void 0&&(e._finishPromise_resolve(),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function g0(e,t){e._finishPromise_reject!==void 0&&(A0(e._finishPromise),e._finishPromise_reject(t),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function _re(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(Tc.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),tr(Tc.prototype.enqueue,"enqueue"),tr(Tc.prototype.error,"error"),tr(Tc.prototype.terminate,"terminate"),typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(Tc.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});var eA=class extends Kn{};var tA=class{chunks;isWorking=!1;isCancelled=!1;constructor(t){this.chunks=t}start(t){this.work(t)}async work(t){let{chunks:r}=this;for(this.isWorking=!0;!this.isCancelled&&(t.desiredSize||0)>0;){let n;try{n=r.next()}catch(a){t.error(a);break}n&&(!n.done&&!this.isCancelled?t.enqueue(n.value):t.close())}this.isWorking=!1}pull(t){this.isWorking||this.work(t)}cancel(){this.isCancelled=!0}};var rA=class extends eA{_chunks;constructor(t){super(new tA(t.values()),{type:"bytes"}),this._chunks=t}async*[Symbol.asyncIterator](t){let r=this.getReader();yield*this._chunks,r.releaseLock()}};var Xp=class{type;size;parts;constructor(t=[],r={}){this.parts=[],this.size=0;for(let n of t)if(typeof n=="string"){let a=new TextEncoder().encode(n);this.parts.push(a),this.size+=a.byteLength}else if(n instanceof Xp)this.size+=n.size,this.parts.push(...n.parts);else if(n instanceof ArrayBuffer)this.parts.push(new Uint8Array(n)),this.size+=n.byteLength;else if(n instanceof Uint8Array)this.parts.push(n),this.size+=n.byteLength;else if(ArrayBuffer.isView(n)){let{buffer:a,byteOffset:i,byteLength:o}=n;this.parts.push(new Uint8Array(a,i,o)),this.size+=o}else{let a=new TextEncoder().encode(String(n));this.parts.push(a),this.size+=a.byteLength}this.type=M7e(r.type)}slice(t=0,r=this.size,n=""){let{size:a,parts:i}=this,o=t<0?Math.max(a+t,0):Math.min(t,a),s=r<0?Math.max(a+r,0):Math.min(r,a),u=Math.max(s-o,0),c=new Xp([],{type:n});if(u===0)return c;let l=0,f=[];for(let p of i){let{byteLength:d}=p;if(o>0&&d<=o)o-=d,s-=d;else{let h=p.subarray(o,Math.min(d,s));if(f.push(h),l+=h.byteLength,o=0,l>=u)break}}return c.parts=f,c.size=l,c}async arrayBuffer(){return this._toArrayBuffer()}async text(){let t=new TextDecoder,r="";for(let n of this.parts)r+=t.decode(n);return r}stream(){return new rA(this.parts)}toString(){return"[object Blob]"}get[Symbol.toStringTag](){return"Blob"}_toArrayBuffer(){let t=new ArrayBuffer(this.size),r=new Uint8Array(t),n=0;for(let a of this.parts)r.set(a,n),n+=a.byteLength;return t}};function M7e(e=""){let t=String(e).toLowerCase();return/[^\u0020-\u007E]/.test(t)?"":t}function q7e(){return typeof Blob>"u"&&!globalThis.Blob&&(globalThis.Blob=Xp),globalThis.Blob}var N7e=q7e();var nA=class{onload;onabort;onerror;error;onloadstart;onloadend;onprogress;readyState;result;DONE;EMPTY;LOADING;addEventListener;removeEventListener;dispatchEvent;constructor(){this.onload=null}abort(){}async readAsArrayBuffer(t){let r=await t.arrayBuffer();this.onload&&this.onload({target:{result:r}})}async readAsBinaryString(t){throw Error("Not implemented")}async readAsDataURL(t){let r=await t.text(),n=`data://;base64,${Sb(r)}`;this.onload&&this.onload({target:{result:n}})}async readAsText(t){let r=await t.text();this.onload&&this.onload({target:{result:r}})}};var aA=class extends globalThis.Blob{name="";webkitRelativePath="";lastModified;constructor(t,r,n={}){super(t,n),this.name=String(r).replace(/\//g,":"),this.lastModified=(n==null?void 0:n.lastModified)||Date.now()}get[Symbol.toStringTag](){return"File"}};function Ene(){return typeof FileReader>"u"&&!globalThis.FileReader&&(globalThis.FileReader=nA),typeof File>"u"&&!globalThis.File&&(globalThis.File=aA),global}var U7e=Ene();var rO=Ct(require("module"),1),Tne=Ct(require("path"),1),oA=Ct(require("fs"),1);async function Sne(e){if(e.startsWith("http"))return await(await fetch(e)).arrayBuffer();let t=oA.default.readFileSync(e);return za(t.buffer)}async function kne(e){return e.startsWith("http")?await(await fetch(e)).text():oA.default.readFileSync(e,"utf8")}async function Cne(e){if(e.startsWith("http")){let n=await(await fetch(e)).text();return iA(n)}e.startsWith("/")||(e=`${process.cwd()}/${e}`);let t=oA.default.readFileSync(e,"utf8");return iA(t)}function iA(e,t="",r){if(typeof t=="object"&&(r=t,t=""),t=t.replace("file://",""),typeof e!="string")throw new Error(`code must be a string, not ${typeof e}`);let n=rO.default._nodeModulePaths(Tne.default.dirname(t)),a=typeof module<"u"&&(module==null?void 0:module.parent),i=new rO.default(t,a);return i.filename=t,i.paths=[].concat((r==null?void 0:r.prependPaths)||[]).concat(n).concat((r==null?void 0:r.appendPaths)||[]),i._compile(e,t),a&&a.children&&a.children.splice(a.children.indexOf(i),1),i.exports}var gs=class{map;constructor(t){this.map={},t instanceof gs?t.forEach((r,n)=>this.append(n,r)):Array.isArray(t)?t.forEach(r=>this.append(r[0],r[1])):t&&Object.getOwnPropertyNames(t).forEach(r=>this.append(r,t[r]))}append(t,r){t=sx(t),r=Dne(r);let n=this.map[t];this.map[t]=n?`${n}, ${r}`:r}delete(t){delete this.map[sx(t)]}get(t){return t=sx(t),this.has(t)?this.map[t]:null}has(t){return this.map.hasOwnProperty(sx(t))}set(t,r){this.map[sx(t)]=Dne(r)}forEach(t,r=null){for(let n in this.map)this.map.hasOwnProperty(n)&&(r?t.call(r,this.map[n],n,this):t(this.map[n],n,this))}keys(){let t=[];return this.forEach(function(r,n){t.push(n)}),nO(t)}values(){let t=[];return this.forEach(function(r){t.push(r)}),nO(t)}entries(){let t=[];return this.forEach(function(r,n){t.push([n,r])}),nO(t)}*[Symbol.iterator](){yield*this.entries()}};function sx(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e)||e==="")throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function Dne(e){return typeof e!="string"&&(e=String(e)),e}function nO(e){let t={next(){let r=e.shift();return{done:r===void 0,value:r}}};return t[Symbol.iterator]=function(){return t},t}function aO(e,t){if(!e)throw new Error(`@loaders.gl/polyfills assertion ${t}`)}var oO=Ct(require("stream"),1),z7e=e=>typeof e=="boolean",Bne=e=>typeof e=="function",G7e=e=>e!==null&&typeof e=="object",iO=e=>G7e(e)&&Bne(e.read)&&Bne(e.pipe)&&z7e(e.readable),Bc=class{ok;status;statusText;headers;url;bodyUsed=!1;_body;constructor(t,r){let{headers:n,status:a=200,statusText:i="OK",url:o}=r||{};this.url=o,this.ok=a===200,this.status=a,this.statusText=i,this.headers=new gs((r==null?void 0:r.headers)||{}),iO(t)?this._body=_w(t,n):typeof t=="string"?this._body=oO.Readable.from([new TextEncoder().encode(t)]):this._body=oO.Readable.from([t||new ArrayBuffer(0)])}get body(){return aO(!this.bodyUsed),aO(iO(this._body)),this.bodyUsed=!0,this._body}async arrayBuffer(){return iO(this._body)?await Kte(this._body):this._body||new ArrayBuffer(0)}async text(){let t=await this.arrayBuffer();return new TextDecoder().decode(t)}async json(){let t=await this.text();return JSON.parse(t)}async blob(){if(typeof Blob>"u")throw new Error("Blob polyfill not installed");return new Blob([await this.arrayBuffer()])}};var One=Ct(require("http"),1),Ine=Ct(require("https"),1);function Fne(e){let t=e.indexOf(","),r,n;return e.slice(t-7,t)===";base64"?(r=Buffer.from(e.slice(t+1),"base64"),n=e.slice(5,t-7).trim()):(r=Buffer.from(decodeURIComponent(e.slice(t+1))),n=e.slice(5,t).trim()),n?n.startsWith(";")&&(n=`text/plain${n}`):n="text/plain;charset=US-ASCII",{arrayBuffer:Wn(r),mimeType:n}}var sO=e=>e.startsWith("data:"),H7e=e=>e.startsWith("http:")||e.startsWith("https:");async function ux(e,t){try{if(globalThis.fetch!==ux&&(H7e(e)||sO(e)))return await fetch(e,t);if(sO(e)){let{arrayBuffer:c,mimeType:l}=Fne(e);return new Bc(c,{headers:{"content-type":l},url:e})}let r={},n=e;e.endsWith(".gz")&&(e=e.slice(0,-3),r["content-encoding"]="gzip");let a=await V7e(n,t),i=J7e(e,a,r),{status:o,statusText:s}=K7e(a),u=!t||t.followRedirect||t.followRedirect===void 0;if(o>=300&&o<400&&i.has("location")&&u){let c=$7e(e,i.get("location"));return await ux(c,t)}return new Bc(a,{headers:i,status:o,statusText:s,url:e})}catch(r){return new Bc(null,{status:400,statusText:String(r),url:e})}}async function V7e(e,t){return await new Promise((r,n)=>{let a=W7e(e,t),i=e.startsWith("https:")?Ine.default.request(a,o=>r(o)):One.default.request(a,o=>r(o));i.on("error",o=>n(o)),i.end()})}function $7e(e,t){if(t.startsWith("http"))return t;let r=new URL(e);return r.pathname=t,r.href}function W7e(e,t){let r=(t==null?void 0:t.headers)||{},n={};for(let i of Object.keys(r))n[i.toLowerCase()]=r[i];n["accept-encoding"]=n["accept-encoding"]||"gzip,br,deflate";let a=new URL(e);return{hostname:a.hostname,path:a.pathname,method:"GET",...t,...t==null?void 0:t.fetch,headers:n,port:a.port}}function K7e(e){return e.statusCode?{status:e.statusCode,statusText:e.statusMessage||"NA"}:{status:200,statusText:"OK"}}function J7e(e,t,r={}){let n={};if(t&&t.headers){let a=t.headers;for(let i in a){let o=a[i];n[i.toLowerCase()]=String(o)}}if(!n["content-length"]){let a=X7e(e);Number.isFinite(a)&&(n["content-length"]=a)}return Object.assign(n,r),new gs(n)}function X7e(e){return sO(e)?e.length-5:null}var Y7e=parseInt(Pne.versions.node.split(".")[0]);Cz&&console.error("loaders.gl: The @loaders.gl/polyfills should only be used in Node.js environments");globalThis.loaders=globalThis.loaders||{};globalThis.loaders.makeNodeStream=mF;globalThis.loaders.NodeFile=Lp;globalThis.loaders.NodeFileSystem=Ew;globalThis.loaders.fetchNode=ww;globalThis.loaders.NodeHash=Sw;globalThis.TextEncoder||(globalThis.TextEncoder=Tb);globalThis.TextDecoder||(globalThis.TextDecoder=cp);globalThis.ReadableStream||(globalThis.ReadableStream=ReadableStream);!("atob"in globalThis)&&Sb&&(globalThis.atob=Sb);!("btoa"in globalThis)&&S4&&(globalThis.btoa=S4);globalThis.loaders.encodeImageNode=IV;globalThis.loaders.parseImageNode=PB;globalThis.loaders.imageFormatsNode=IB;globalThis._parseImageNode=PB;globalThis._imageFormatsNode=IB;globalThis.loaders.readFileAsArrayBuffer=Sne;globalThis.loaders.readFileAsText=kne;globalThis.loaders.requireFromFile=Cne;globalThis.loaders.requireFromString=iA;Y7e<18&&(!("Headers"in globalThis)&&gs&&(globalThis.Headers=gs),!("Response"in globalThis)&&Bc&&(globalThis.Response=Bc),!("fetch"in globalThis)&&ux&&(globalThis.fetch=ux));var K3e=require("path"),x4=Ct(jge(),1);var rn={OBJECT_ID_TYPE:"OBJECTID",STRING_TYPE:"string",DOUBLE_TYPE:"double",SHORT_INT_TYPE:"Int32"};var sS=class{_attributeStorageInfo;_fields;_popupInfo;constructor(){this._attributeStorageInfo=[],this._fields=[]}get attributeStorageInfo(){return this._attributeStorageInfo}get fields(){return this._fields}get popupInfo(){return this._popupInfo}addMetadataInfo(t){if(!Object.keys(t).length)return;let r={OBJECTID:rn.OBJECT_ID_TYPE,...t},n=!1,a=this._attributeStorageInfo.length;for(let i in r)if(!this._attributeStorageInfo.find(s=>s.name===i)){let s=r[i],u=this.createStorageAttribute(a,i,s),c=this.getFieldAttributeType(s),l=this.createFieldAttribute(i,c);this._attributeStorageInfo.push(u),this._fields.push(l),a+=1,n=!0}if(n){let i=[];for(let o of this._attributeStorageInfo)i.push(o.name);this._popupInfo=this.createPopupInfo(i)}}fromObject(t){this._attributeStorageInfo=t.attributeStorageInfo,this._fields=t.fields,this._popupInfo=t.popupInfo}createStorageAttribute(t,r,n){let a={key:`f_${t}`,name:r,ordering:["attributeValues"],header:[{property:"count",valueType:"UInt32"}],attributeValues:{valueType:"Int32",valuesPerElement:1}};switch(n){case rn.OBJECT_ID_TYPE:this.setupIdAttribute(a);break;case rn.STRING_TYPE:this.setupStringAttribute(a);break;case rn.DOUBLE_TYPE:this.setupDoubleAttribute(a);break;case rn.SHORT_INT_TYPE:break;default:this.setupStringAttribute(a)}return a}getFieldAttributeType(t){switch(t){case rn.OBJECT_ID_TYPE:return"esriFieldTypeOID";case rn.STRING_TYPE:return"esriFieldTypeString";case rn.SHORT_INT_TYPE:return"esriFieldTypeInteger";case rn.DOUBLE_TYPE:return"esriFieldTypeDouble";default:return"esriFieldTypeString"}}setupIdAttribute(t){t.attributeValues={valueType:"Oid32",valuesPerElement:1}}setupStringAttribute(t){t.ordering.unshift("attributeByteCounts"),t.header.push({property:"attributeValuesByteCount",valueType:"UInt32"}),t.attributeValues={valueType:"String",encoding:"UTF-8",valuesPerElement:1},t.attributeByteCounts={valueType:"UInt32",valuesPerElement:1}}setupDoubleAttribute(t){t.attributeValues={valueType:"Float64",valuesPerElement:1}}createFieldAttribute(t,r){return{name:t,type:r,alias:t}}createPopupInfo(t){let r="{OBJECTID}",n=[],a=[],i=[],o=[];for(let s of t)a.push({fieldName:s,visible:!0,isEditable:!1,label:s});return i.push({fieldInfos:a,type:"fields"}),{title:r,mediaInfos:n,popupElements:i,fieldInfos:a,expressionInfos:o}}};var uS=class extends Error{constructor(t,r){super(t),this.reason=r.reason,this.url=r.url,this.response=r.response}reason;url;response};var c1t=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,l1t=/^([-\w.]+\/[-\w.+]+)/;function pL(e,t){return e.toLowerCase()===t.toLowerCase()}function Lge(e){let t=l1t.exec(e);return t?t[1]:e}function dL(e){let t=c1t.exec(e);return t?t[1]:""}var Mge=/\?.*/;function qge(e){let t=e.match(Mge);return t&&t[0]}function Bf(e){return e.replace(Mge,"")}function Nge(e){if(e.length<50)return e;let t=e.slice(e.length-15);return`${e.substr(0,32)}...${t}`}function _d(e){return Vi(e)?e.url:$i(e)?("name"in e?e.name:"")||"":typeof e=="string"?e:""}function Hm(e){if(Vi(e)){let t=e.headers.get("content-type")||"",r=Bf(e.url);return Lge(t)||dL(r)}return $i(e)?e.type||"":typeof e=="string"?dL(e):""}function Uge(e){return Vi(e)?e.headers["content-length"]||-1:$i(e)?e.size:typeof e=="string"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function cS(e){if(Vi(e))return e;let t={},r=Uge(e);r>=0&&(t["content-length"]=String(r));let n=_d(e),a=Hm(e);a&&(t["content-type"]=a);let i=await p1t(e);i&&(t["x-first-bytes"]=i),typeof e=="string"&&(e=new TextEncoder().encode(e));let o=new Response(e,{headers:t});return Object.defineProperty(o,"url",{value:n}),o}async function zge(e){if(!e.ok)throw await f1t(e)}async function f1t(e){let t=Nge(e.url),r=`Failed to fetch resource (${e.status}) ${e.statusText}: ${t}`;r=r.length>100?`${r.slice(0,100)}...`:r;let n={reason:e.statusText,url:e.url,response:e};try{let a=e.headers.get("Content-Type");n.reason=!e.bodyUsed&&(a!=null&&a.includes("application/json"))?await e.json():await e.text()}catch{}return new uS(r,n)}async function p1t(e){if(typeof e=="string")return`data:,${e.slice(0,5)}`;if(e instanceof Blob){let r=e.slice(0,5);return await new Promise(n=>{let a=new FileReader;a.onload=i=>{var o;return n((o=i==null?void 0:i.target)==null?void 0:o.result)},a.readAsDataURL(r)})}if(e instanceof ArrayBuffer){let r=e.slice(0,5);return`data:base64,${d1t(r)}`}return null}function d1t(e){let t="",r=new Uint8Array(e);for(let n=0;n<r.byteLength;n++)t+=String.fromCharCode(r[n]);return btoa(t)}function h1t(e){return!m1t(e)&&!g1t(e)}function m1t(e){return e.startsWith("http:")||e.startsWith("https:")}function g1t(e){return e.startsWith("data:")}async function si(e,t){var r,n;if(typeof e=="string"){let a=du(e);return h1t(a)&&(r=globalThis.loaders)!=null&&r.fetchNode?(n=globalThis.loaders)==null?void 0:n.fetchNode(a,t):await fetch(a,t)}return await cS(e)}var d1=new ds({id:"loaders.gl"}),lS=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},fS=class{console;constructor(){this.console=console}log(...t){return this.console.log.bind(this.console,...t)}info(...t){return this.console.info.bind(this.console,...t)}warn(...t){return this.console.warn.bind(this.console,...t)}error(...t){return this.console.error.bind(this.console,...t)}};var pS={core:{baseUrl:void 0,fetch:null,mimeType:void 0,fallbackMimeType:void 0,ignoreRegisteredLoaders:void 0,nothrow:!1,log:new fS,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:pr,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]}},Gge={baseUri:"core.baseUrl",fetch:"core.fetch",mimeType:"core.mimeType",fallbackMimeType:"core.fallbackMimeType",ignoreRegisteredLoaders:"core.ignoreRegisteredLoaders",nothrow:"core.nothrow",log:"core.log",useLocalLibraries:"core.useLocalLibraries",CDN:"core.CDN",worker:"core.worker",maxConcurrency:"core.maxConcurrency",maxMobileConcurrency:"core.maxMobileConcurrency",reuseWorkers:"core.reuseWorkers",_nodeWorkers:"core.nodeWorkers",_workerType:"core._workerType",_worker:"core._workerType",limit:"core.limit",_limitMB:"core._limitMB",batchSize:"core.batchSize",batchDebounceMs:"core.batchDebounceMs",metadata:"core.metadata",transforms:"core.transforms",throws:"nothrow",dataType:"(no longer used)",uri:"core.baseUrl",method:"core.fetch.method",headers:"core.fetch.headers",body:"core.fetch.body",mode:"core.fetch.mode",credentials:"core.fetch.credentials",cache:"core.fetch.cache",redirect:"core.fetch.redirect",referrer:"core.fetch.referrer",referrerPolicy:"core.fetch.referrerPolicy",integrity:"core.fetch.integrity",keepalive:"core.fetch.keepalive",signal:"core.fetch.signal"};var hL=["baseUrl","fetch","mimeType","fallbackMimeType","ignoreRegisteredLoaders","nothrow","log","useLocalLibraries","CDN","worker","maxConcurrency","maxMobileConcurrency","reuseWorkers","_nodeWorkers","_workerType","limit","_limitMB","batchSize","batchDebounceMs","metadata","transforms"];function mL(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state||(e._state={}),e._state}function Vm(){let e=mL();return e.globalOptions=e.globalOptions||{...pS,core:{...pS.core}},Hc(e.globalOptions)}function $ge(e,t,r,n){return r=r||[],r=Array.isArray(r)?r:[r],b1t(e,r),Hc(x1t(t,e,n))}function Hc(e){let t=_1t(e);Wge(t);for(let r of hL)t.core&&t.core[r]!==void 0&&delete t[r];return t.core&&t.core._workerType!==void 0&&delete t._worker,t}function b1t(e,t){Hge(e,null,pS,Gge,t);for(let r of t){let n=e&&e[r.id]||{},a=r.options&&r.options[r.id]||{},i=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};Hge(n,r.id,a,i,t)}}function Hge(e,t,r,n,a){let i=t||"Top level",o=t?`${t}.`:"";for(let s in e){let u=!t&&lu(e[s]),c=s==="baseUri"&&!t,l=s==="workerUrl"&&t;if(!(s in r)&&!c&&!l){if(s in n)d1.level>0&&d1.warn(`${i} loader option '${o}${s}' no longer supported, use '${n[s]}'`)();else if(!u&&d1.level>0){let f=v1t(s,a);d1.warn(`${i} loader option '${o}${s}' not recognized. ${f}`)()}}}}function v1t(e,t){let r=e.toLowerCase(),n="";for(let a of t)for(let i in a.options){if(e===i)return`Did you mean '${a.id}.${i}'?`;let o=i.toLowerCase();(r.startsWith(o)||o.startsWith(r))&&(n=n||`Did you mean '${a.id}.${i}'?`)}return n}function x1t(e,t,r){var o;let n=e.options||{},a={...n};n.core&&(a.core={...n.core}),Wge(a),((o=a.core)==null?void 0:o.log)===null&&(a.core={...a.core,log:new lS}),Vge(a,Hc(Vm()));let i=Hc(t);return Vge(a,i),y1t(a,r),w1t(a),a}function Vge(e,t){for(let r in t)if(r in t){let n=t[r];gw(n)&&gw(e[r])?e[r]={...e[r],...t[r]}:e[r]=t[r]}}function y1t(e,t){var n;if(!t)return;((n=e.core)==null?void 0:n.baseUrl)!==void 0||(e.core||(e.core={}),e.core.baseUrl=Ga.dirname(Bf(t)))}function _1t(e){let t={...e};return e.core&&(t.core={...e.core}),t}function Wge(e){e.baseUri!==void 0&&(e.core||(e.core={}),e.core.baseUrl===void 0&&(e.core.baseUrl=e.baseUri));for(let r of hL)if(e[r]!==void 0){let a=e.core=e.core||{};a[r]===void 0&&(a[r]=e[r])}let t=e._worker;t!==void 0&&(e.core||(e.core={}),e.core._workerType===void 0&&(e.core._workerType=t))}function w1t(e){let t=e.core;if(t)for(let r of hL)t[r]!==void 0&&(e[r]=t[r])}function h1(e){return e?(Array.isArray(e)&&(e=e[0]),Array.isArray(e==null?void 0:e.extensions)):!1}function gL(e){yt(e,"null loader"),yt(h1(e),"invalid loader");let t;return Array.isArray(e)&&(t=e[1],e=e[0],e={...e,options:{...e.options,...t}}),(e!=null&&e.parseTextSync||e!=null&&e.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}var A1t=()=>{let e=mL();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function Kge(){return A1t()}var E1t=/\.([^.]+)$/;async function Yge(e,t=[],r,n){if(!Qge(e))return null;let a=Hc(r||{});if(a.core||(a.core={}),e instanceof Response&&Jge(e)){let o=await e.clone().text(),s=dS(o,t,{...a,core:{...a.core,nothrow:!0}},n);if(s)return s}let i=dS(e,t,{...a,core:{...a.core,nothrow:!0}},n);if(i)return i;if($i(e)&&(e=await e.slice(0,10).arrayBuffer(),i=dS(e,t,a,n)),!i&&e instanceof Response&&Jge(e)){let o=await e.clone().text();i=dS(o,t,a,n)}if(!i&&!a.core.nothrow)throw new Error(Zge(e));return i}function Jge(e){let t=Hm(e);return Boolean(t&&(t.startsWith("text/")||t==="application/json"||t.endsWith("+json")))}function dS(e,t=[],r,n){if(!Qge(e))return null;let a=Hc(r||{});if(a.core||(a.core={}),t&&!Array.isArray(t))return gL(t);let i=[];t&&(i=i.concat(t)),a.core.ignoreRegisteredLoaders||i.push(...Kge()),S1t(i);let o=T1t(e,i,a,n);if(!o&&!a.core.nothrow)throw new Error(Zge(e));return o}function T1t(e,t,r,n){var c,l,f,p,d;let a=_d(e),i=Hm(e),o=Bf(a)||(n==null?void 0:n.url),s=null,u="";return(c=r==null?void 0:r.core)!=null&&c.mimeType&&(s=bL(t,(l=r==null?void 0:r.core)==null?void 0:l.mimeType),u=`match forced by supplied MIME type ${(f=r==null?void 0:r.core)==null?void 0:f.mimeType}`),s=s||k1t(t,o),u=u||(s?`matched url ${o}`:""),s=s||bL(t,i),u=u||(s?`matched MIME type ${i}`:""),s=s||D1t(t,e),u=u||(s?`matched initial data ${ebe(e)}`:""),(p=r==null?void 0:r.core)!=null&&p.fallbackMimeType&&(s=s||bL(t,(d=r==null?void 0:r.core)==null?void 0:d.fallbackMimeType),u=u||(s?`matched fallback MIME type ${i}`:"")),u&&Dv.log(1,`selectLoader selected ${s==null?void 0:s.name}: ${u}.`),s}function Qge(e){return!(e instanceof Response&&e.status===204)}function Zge(e){let t=_d(e),r=Hm(e),n="No valid loader found (";n+=t?`${Ga.filename(t)}, `:"no url provided, ",n+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let a=e?ebe(e):"";return n+=a?` first bytes: "${a}"`:"first bytes: not available",n+=")",n}function S1t(e){for(let t of e)gL(t)}function k1t(e,t){let r=t&&E1t.exec(t),n=r&&r[1];return n?C1t(e,n):null}function C1t(e,t){t=t.toLowerCase();for(let r of e)for(let n of r.extensions)if(n.toLowerCase()===t)return r;return null}function bL(e,t){var r;for(let n of e)if((r=n.mimeTypes)!=null&&r.some(a=>pL(t,a))||pL(t,`application/x.${n.id}`))return n;return null}function D1t(e,t){if(!t)return null;for(let r of e)if(typeof t=="string"){if(B1t(t,r))return r}else if(ArrayBuffer.isView(t)){if(Xge(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer&&Xge(t,0,r))return r;return null}function B1t(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some(n=>e.startsWith(n))}function Xge(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(a=>F1t(e,t,r,a))}function F1t(e,t,r,n){if(s0(n))return pu(n,e,n.byteLength);switch(typeof n){case"function":return n(za(e));case"string":let a=vL(e,t,n.length);return n===a;default:return!1}}function ebe(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?vL(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?vL(e,0,t):""}function vL(e,t,r){if(e.byteLength<t+r)return"";let n=new DataView(e),a="";for(let i=0;i<r;i++)a+=String.fromCharCode(n.getUint8(t+i));return a}var O1t=256*1024;function*tbe(e,t){let r=(t==null?void 0:t.chunkSize)||O1t,n=0,a=new TextEncoder;for(;n<e.length;){let i=Math.min(e.length-n,r),o=e.slice(n,n+i);n+=i,yield za(a.encode(o))}}function*rbe(e,t={}){let{chunkSize:r=262144}=t,n=0;for(;n<e.byteLength;){let a=Math.min(e.byteLength-n,r),i=new ArrayBuffer(a),o=new Uint8Array(e,n,a);new Uint8Array(i).set(o),n+=a,yield i}}async function*nbe(e,t){let r=(t==null?void 0:t.chunkSize)||1048576,n=0;for(;n<e.size;){let a=n+r,i=await e.slice(n,a).arrayBuffer();n=a,yield i}}function xL(e,t){return pr?I1t(e,t):P1t(e,t)}async function*I1t(e,t){let r=e.getReader(),n;try{for(;;){let a=n||r.read();t!=null&&t._streamReadAhead&&(n=r.read());let{done:i,value:o}=await a;if(i)return;yield Wn(o)}}catch{r.releaseLock()}}async function*P1t(e,t){for await(let r of e)yield Wn(r)}function abe(e,t){if(typeof e=="string")return tbe(e,t);if(e instanceof ArrayBuffer)return rbe(e,t);if($i(e))return nbe(e,t);if(Bv(e))return xL(e,t);if(Vi(e)){let r=e.body;if(!r)throw new Error("Readable stream not available on Response");return xL(r,t)}throw new Error("makeIterator")}var ibe="Cannot convert supplied data type";function R1t(e,t,r){if(t.text&&typeof e=="string")return e;if(xw(e)&&(e=e.buffer),s0(e)){let n=iF(e);return t.text&&!t.binary?new TextDecoder("utf8").decode(n):Wn(n)}throw new Error(ibe)}async function obe(e,t,r){if(typeof e=="string"||s0(e))return R1t(e,t,r);if($i(e)&&(e=await cS(e)),Vi(e))return await zge(e),t.binary?await e.arrayBuffer():await e.text();if(Bv(e)&&(e=abe(e,r)),UB(e)||zB(e))return jp(e);throw new Error(ibe)}function hS(e,t){var i;let r=Vm(),n=e||r,a=n.fetch??((i=n.core)==null?void 0:i.fetch);return typeof a=="function"?a:lu(a)?o=>si(o,a):t!=null&&t.fetch?t==null?void 0:t.fetch:si}function sbe(e,t,r){if(r)return r;let n={fetch:hS(t,e),...e};if(n.url){let a=Bf(n.url);n.baseUrl=a,n.queryString=qge(n.url),n.filename=Ga.filename(a),n.baseUrl=Ga.dirname(a)}return Array.isArray(n.loaders)||(n.loaders=null),n}function ube(e,t){if(e&&!Array.isArray(e))return e;let r;if(e&&(r=Array.isArray(e)?e:[e]),t&&t.loaders){let n=Array.isArray(t.loaders)?t.loaders:[t.loaders];r=r?[...r,...n]:n}return r&&r.length?r:void 0}async function Xi(e,t,r,n){t&&!Array.isArray(t)&&!h1(t)&&(n=void 0,r=t,t=void 0),e=await e,r=r||{};let a=_d(e),o=ube(t,n),s=await Yge(e,o,r);if(!s)return null;let u=$ge(r,s,o,a);return n=sbe({url:a,_parse:Xi,loaders:o},u,n||null),await j1t(s,e,u,n)}async function j1t(e,t,r,n){if(XB(e),r=GB(e.options,r),Vi(t)){let{ok:i,redirected:o,status:s,statusText:u,type:c,url:l}=t,f=Object.fromEntries(t.headers.entries());n.response={headers:f,ok:i,redirected:o,status:s,statusText:u,type:c,url:l}}t=await obe(t,e,r);let a=e;if(a.parseTextSync&&typeof t=="string")return a.parseTextSync(t,r,n);if(QB(e,r))return await ZB(e,t,r,n,Xi);if(a.parseText&&typeof t=="string")return await a.parseText(t,r,n);if(a.parse)return await a.parse(t,r,n);throw xa(!a.parseSync),new Error(`${e.id} loader - no parser found and worker is disabled`)}function cbe(e){switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function yL(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function _L(e){let t=1/0,r=1/0,n=1/0,a=-1/0,i=-1/0,o=-1/0,s=e.POSITION?e.POSITION.value:[],u=s&&s.length;for(let c=0;c<u;c+=3){let l=s[c],f=s[c+1],p=s[c+2];t=l<t?l:t,r=f<r?f:r,n=p<n?p:n,a=l>a?l:a,i=f>i?f:i,o=p>o?p:o}return[[t,r,n],[a,i,o]]}function wL(e,t,r){let n=cbe(t.value),a=r||lbe(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:n}]},nullable:!1,metadata:a}}function lbe(e){let t={};return"byteOffset"in e&&(t.byteOffset=e.byteOffset.toString(10)),"byteStride"in e&&(t.byteStride=e.byteStride.toString(10)),"normalized"in e&&(t.normalized=e.normalized.toString()),t}async function Wr(e,t,r,n){var u;let a,i;!Array.isArray(t)&&!h1(t)?(a=[],i=t,n=void 0):(a=t,i=r);let o=hS(i),s=e;return typeof e=="string"&&(s=await o(e)),$i(e)&&(s=await o(e)),typeof e=="string"&&((u=Hc(i||{}).core)!=null&&u.baseUrl||(i={...i,core:{...i==null?void 0:i.core,baseUrl:e}})),Array.isArray(a)?await Xi(s,a,i):await Xi(s,a,i)}async function $m(e,t,r){let a={...Vm(),...r};return t.encodeURLtoURL?L1t(t,e,a):eF(t,a)?await JB(t,e,a):await t.encode(e,a)}function mS(e,t,r){if(t.encodeSync)return t.encodeSync(e,r);if(t.encodeTextSync)return za(new TextEncoder().encode(t.encodeTextSync(e,r)));throw new Error(`Writer ${t.name} could not synchronously encode data`)}async function pbe(e,t,r,n){if(e=du(e),t=du(t),pr||!r.encodeURLtoURL)throw new Error;return await r.encodeURLtoURL(e,t,n)}async function L1t(e,t,r){if(pr)throw new Error(`Writer ${e.name} not supported in browser`);let n=fbe("input");await new Ha(n,"w").write(t);let i=fbe("output"),o=await pbe(n,i,e,r);return(await si(o)).arrayBuffer()}function fbe(e){return`/tmp/${e}`}var M1t=1/Math.PI*180,q1t=1/180*Math.PI,N1t={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...N1t}};var Rr=globalThis.mathgl.config;function AL(e,{precision:t=Rr.precision}={}){return e=U1t(e),`${parseFloat(e.toPrecision(t))}`}function Fo(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function EL(e){return dbe(e)}function TL(e){return Vc(e)}function dbe(e,t){return kL(e,r=>r*q1t,t)}function Vc(e,t){return kL(e,r=>r*M1t,t)}function SL(e,t,r){return kL(e,n=>Math.max(t,Math.min(r,n)))}function Yi(e,t,r){let n=Rr.EPSILON;r&&(Rr.EPSILON=r);try{if(e===t)return!0;if(Fo(e)&&Fo(t)){if(e.length!==t.length)return!1;for(let a=0;a<e.length;++a)if(!Yi(e[a],t[a]))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)<=Rr.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{Rr.EPSILON=n}}function U1t(e){return Math.round(e/Rr.EPSILON)*Rr.EPSILON}function z1t(e){return e.clone?e.clone():new Array(e.length)}function kL(e,t,r){if(Fo(e)){let n=e;r=r||z1t(n);for(let a=0;a<r.length&&a<n.length;++a){let i=typeof e=="number"?e:e[a];r[a]=t(i,a,r)}return r}return t(e)}var Ff=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=t[n+r];return this.check()}toArray(t=[],r=0){for(let n=0;n<this.ELEMENTS;++n)t[r+n]=this[n];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Fo(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Rr)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+AL(this[n],t);return`${t.printTypes?this.constructor.name:""}[${r}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!Yi(this[r],t[r]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==t[r])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,r,n){if(n===void 0)return this.lerp(this,t,r);for(let a=0;a<this.ELEMENTS;++a){let i=t[a],o=typeof r=="number"?r:r[a];this[a]=i+n*(o-i)}return this.check()}min(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(t[r],this[r]);return this.check()}max(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(t[r],this[r]);return this.check()}clamp(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),r[n]);return this.check()}add(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(t){if(typeof t=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;else for(let r=0;r<this.ELEMENTS&&r<t.length;++r)this[r]*=t[r];return this.check()}multiplyByScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}check(){if(Rr.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)t=t&&Number.isFinite(this[r]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=t;return this.check()}addScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t),r);return this.check()}get elements(){return this}};function G1t(e,t){if(e.length!==t)return!1;for(let r=0;r<e.length;++r)if(!Number.isFinite(e[r]))return!1;return!0}function Ut(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function Of(e,t,r=""){if(Rr.debug&&!G1t(e,t))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return e}function ca(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var If=class extends Ff{get x(){return this[0]}set x(t){this[0]=Ut(t)}get y(){return this[1]}set y(t){this[1]=Ut(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*this[r];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let r=0;for(let n=0;n<this.ELEMENTS;++n){let a=this[n]-t[n];r+=a*a}return Ut(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return Ut(r)}normalize(){let t=this.magnitude();if(t!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=t;return this.check()}multiply(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return ca(t>=0&&t<this.ELEMENTS,"index is out of range"),Ut(this[t])}setComponent(t,r){return ca(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=r,this.check()}addVectors(t,r){return this.copy(t).add(r)}subVectors(t,r){return this.copy(t).subtract(r)}multiplyVectors(t,r){return this.copy(t).multiply(r)}addScaledVector(t,r){return this.add(new this.constructor(t).multiplyScalar(r))}};var nn=typeof Float32Array<"u"?Float32Array:Array,m1=Math.random;function Wm(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var Ytr=Math.PI/180;function H1t(){let e=new nn(2);return nn!=Float32Array&&(e[0]=0,e[1]=0),e}function hbe(e,t,r){let n=t[0],a=t[1];return e[0]=r[0]*n+r[2]*a,e[1]=r[1]*n+r[3]*a,e}function mbe(e,t,r){let n=t[0],a=t[1];return e[0]=r[0]*n+r[2]*a+r[4],e[1]=r[1]*n+r[3]*a+r[5],e}function gS(e,t,r){let n=t[0],a=t[1];return e[0]=r[0]*n+r[3]*a+r[6],e[1]=r[1]*n+r[4]*a+r[7],e}function bS(e,t,r){let n=t[0],a=t[1];return e[0]=r[0]*n+r[4]*a+r[12],e[1]=r[1]*n+r[5]*a+r[13],e}var Qtr=function(){let e=H1t();return function(t,r,n,a,i,o){let s,u;for(r||(r=2),n||(n=0),a?u=Math.min(a*r+n,t.length):u=t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],i(e,e,o),t[s]=e[0],t[s+1]=e[1];return t}}();function vS(e,t,r){let n=t[0],a=t[1],i=r[3]*n+r[7]*a||1;return e[0]=(r[0]*n+r[4]*a)/i,e[1]=(r[1]*n+r[5]*a)/i,e}function xS(e,t,r){let n=t[0],a=t[1],i=t[2],o=r[3]*n+r[7]*a+r[11]*i||1;return e[0]=(r[0]*n+r[4]*a+r[8]*i)/o,e[1]=(r[1]*n+r[5]*a+r[9]*i)/o,e[2]=(r[2]*n+r[6]*a+r[10]*i)/o,e}function gbe(e,t,r){let n=t[0],a=t[1];return e[0]=r[0]*n+r[2]*a,e[1]=r[1]*n+r[3]*a,e[2]=t[2],e}function bbe(e,t,r){let n=t[0],a=t[1];return e[0]=r[0]*n+r[2]*a,e[1]=r[1]*n+r[3]*a,e[2]=t[2],e[3]=t[3],e}function yS(e,t,r){let n=t[0],a=t[1],i=t[2];return e[0]=r[0]*n+r[3]*a+r[6]*i,e[1]=r[1]*n+r[4]*a+r[7]*i,e[2]=r[2]*n+r[5]*a+r[8]*i,e[3]=t[3],e}var wd=class extends If{constructor(t=0,r=0){super(2),Fo(t)&&arguments.length===1?this.copy(t):(Rr.debug&&(Ut(t),Ut(r)),this[0]=t,this[1]=r)}set(t,r){return this[0]=t,this[1]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return Rr.debug&&(Ut(t.x),Ut(t.y)),this[0]=t.x,this[1]=t.y,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return bS(this,this,t),this.check()}transformAsVector(t){return vS(this,this,t),this.check()}transformByMatrix3(t){return gS(this,this,t),this.check()}transformByMatrix2x3(t){return mbe(this,this,t),this.check()}transformByMatrix2(t){return hbe(this,this,t),this.check()}};var Jm={};Fa(Jm,{add:()=>J1t,angle:()=>OL,bezier:()=>uyt,ceil:()=>X1t,clone:()=>$1t,copy:()=>W1t,create:()=>_S,cross:()=>Ad,dist:()=>byt,distance:()=>wbe,div:()=>gyt,divide:()=>_be,dot:()=>g1,equals:()=>dyt,exactEquals:()=>pyt,floor:()=>Y1t,forEach:()=>yyt,fromValues:()=>wS,hermite:()=>syt,inverse:()=>ayt,len:()=>IL,length:()=>vbe,lerp:()=>iyt,max:()=>Z1t,min:()=>Q1t,mul:()=>myt,multiply:()=>ybe,negate:()=>nyt,normalize:()=>CL,random:()=>cyt,rotateX:()=>DL,rotateY:()=>BL,rotateZ:()=>FL,round:()=>eyt,scale:()=>tyt,scaleAndAdd:()=>ryt,set:()=>K1t,slerp:()=>oyt,sqrDist:()=>vyt,sqrLen:()=>xyt,squaredDistance:()=>Abe,squaredLength:()=>Ebe,str:()=>fyt,sub:()=>hyt,subtract:()=>xbe,transformMat3:()=>b1,transformMat4:()=>Ed,transformQuat:()=>v1,zero:()=>lyt});function _S(){let e=new nn(3);return nn!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function $1t(e){let t=new nn(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function vbe(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function wS(e,t,r){let n=new nn(3);return n[0]=e,n[1]=t,n[2]=r,n}function W1t(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function K1t(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function J1t(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function xbe(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function ybe(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function _be(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function X1t(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function Y1t(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function Q1t(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e}function Z1t(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e}function eyt(e,t){return e[0]=Wm(t[0]),e[1]=Wm(t[1]),e[2]=Wm(t[2]),e}function tyt(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function ryt(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e}function wbe(e,t){let r=t[0]-e[0],n=t[1]-e[1],a=t[2]-e[2];return Math.sqrt(r*r+n*n+a*a)}function Abe(e,t){let r=t[0]-e[0],n=t[1]-e[1],a=t[2]-e[2];return r*r+n*n+a*a}function Ebe(e){let t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function nyt(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function ayt(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function CL(e,t){let r=t[0],n=t[1],a=t[2],i=r*r+n*n+a*a;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 g1(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Ad(e,t,r){let n=t[0],a=t[1],i=t[2],o=r[0],s=r[1],u=r[2];return e[0]=a*u-i*s,e[1]=i*o-n*u,e[2]=n*s-a*o,e}function iyt(e,t,r,n){let a=t[0],i=t[1],o=t[2];return e[0]=a+n*(r[0]-a),e[1]=i+n*(r[1]-i),e[2]=o+n*(r[2]-o),e}function oyt(e,t,r,n){let a=Math.acos(Math.min(Math.max(g1(t,r),-1),1)),i=Math.sin(a),o=Math.sin((1-n)*a)/i,s=Math.sin(n*a)/i;return e[0]=o*t[0]+s*r[0],e[1]=o*t[1]+s*r[1],e[2]=o*t[2]+s*r[2],e}function syt(e,t,r,n,a,i){let o=i*i,s=o*(2*i-3)+1,u=o*(i-2)+i,c=o*(i-1),l=o*(3-2*i);return e[0]=t[0]*s+r[0]*u+n[0]*c+a[0]*l,e[1]=t[1]*s+r[1]*u+n[1]*c+a[1]*l,e[2]=t[2]*s+r[2]*u+n[2]*c+a[2]*l,e}function uyt(e,t,r,n,a,i){let o=1-i,s=o*o,u=i*i,c=s*o,l=3*i*s,f=3*u*o,p=u*i;return e[0]=t[0]*c+r[0]*l+n[0]*f+a[0]*p,e[1]=t[1]*c+r[1]*l+n[1]*f+a[1]*p,e[2]=t[2]*c+r[2]*l+n[2]*f+a[2]*p,e}function cyt(e,t){t=t===void 0?1:t;let r=m1()*2*Math.PI,n=m1()*2-1,a=Math.sqrt(1-n*n)*t;return e[0]=Math.cos(r)*a,e[1]=Math.sin(r)*a,e[2]=n*t,e}function Ed(e,t,r){let n=t[0],a=t[1],i=t[2],o=r[3]*n+r[7]*a+r[11]*i+r[15];return o=o||1,e[0]=(r[0]*n+r[4]*a+r[8]*i+r[12])/o,e[1]=(r[1]*n+r[5]*a+r[9]*i+r[13])/o,e[2]=(r[2]*n+r[6]*a+r[10]*i+r[14])/o,e}function b1(e,t,r){let n=t[0],a=t[1],i=t[2];return e[0]=n*r[0]+a*r[3]+i*r[6],e[1]=n*r[1]+a*r[4]+i*r[7],e[2]=n*r[2]+a*r[5]+i*r[8],e}function v1(e,t,r){let n=r[0],a=r[1],i=r[2],o=r[3],s=t[0],u=t[1],c=t[2],l=a*c-i*u,f=i*s-n*c,p=n*u-a*s,d=a*p-i*f,h=i*l-n*p,m=n*f-a*l,g=o*2;return l*=g,f*=g,p*=g,d*=2,h*=2,m*=2,e[0]=s+l+d,e[1]=u+f+h,e[2]=c+p+m,e}function DL(e,t,r,n){let a=[],i=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],i[0]=a[0],i[1]=a[1]*Math.cos(n)-a[2]*Math.sin(n),i[2]=a[1]*Math.sin(n)+a[2]*Math.cos(n),e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e}function BL(e,t,r,n){let a=[],i=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],i[0]=a[2]*Math.sin(n)+a[0]*Math.cos(n),i[1]=a[1],i[2]=a[2]*Math.cos(n)-a[0]*Math.sin(n),e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e}function FL(e,t,r,n){let a=[],i=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],i[0]=a[0]*Math.cos(n)-a[1]*Math.sin(n),i[1]=a[0]*Math.sin(n)+a[1]*Math.cos(n),i[2]=a[2],e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e}function OL(e,t){let r=e[0],n=e[1],a=e[2],i=t[0],o=t[1],s=t[2],u=Math.sqrt((r*r+n*n+a*a)*(i*i+o*o+s*s)),c=u&&g1(e,t)/u;return Math.acos(Math.min(Math.max(c,-1),1))}function lyt(e){return e[0]=0,e[1]=0,e[2]=0,e}function fyt(e){return`vec3(${e[0]}, ${e[1]}, ${e[2]})`}function pyt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function dyt(e,t){let r=e[0],n=e[1],a=e[2],i=t[0],o=t[1],s=t[2];return Math.abs(r-i)<=1e-6*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-o)<=1e-6*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(a-s)<=1e-6*Math.max(1,Math.abs(a),Math.abs(s))}var hyt=xbe,myt=ybe,gyt=_be,byt=wbe,vyt=Abe,IL=vbe,xyt=Ebe,yyt=function(){let e=_S();return function(t,r,n,a,i,o){let s,u;for(r||(r=3),n||(n=0),a?u=Math.min(a*r+n,t.length):u=t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],i(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2];return t}}();var PL=[0,0,0],AS,Z=class extends If{static get ZERO(){return AS||(AS=new Z(0,0,0),Object.freeze(AS)),AS}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&Fo(t)?this.copy(t):(Rr.debug&&(Ut(t),Ut(r),Ut(n)),this[0]=t,this[1]=r,this[2]=n)}set(t,r,n){return this[0]=t,this[1]=r,this[2]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Rr.debug&&(Ut(t.x),Ut(t.y),Ut(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]=Ut(t)}angle(t){return OL(this,t)}cross(t){return Ad(this,this,t),this.check()}rotateX({radians:t,origin:r=PL}){return DL(this,this,r,t),this.check()}rotateY({radians:t,origin:r=PL}){return BL(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=PL}){return FL(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Ed(this,this,t),this.check()}transformAsVector(t){return xS(this,this,t),this.check()}transformByMatrix3(t){return b1(this,this,t),this.check()}transformByMatrix2(t){return gbe(this,this,t),this.check()}transformByQuaternion(t){return v1(this,this,t),this.check()}};var ES,Oo=class extends If{static get ZERO(){return ES||(ES=new Oo(0,0,0,0),Object.freeze(ES)),ES}constructor(t=0,r=0,n=0,a=0){super(-0,-0,-0,-0),Fo(t)&&arguments.length===1?this.copy(t):(Rr.debug&&(Ut(t),Ut(r),Ut(n),Ut(a)),this[0]=t,this[1]=r,this[2]=n,this[3]=a)}set(t,r,n,a){return this[0]=t,this[1]=r,this[2]=n,this[3]=a,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 Rr.debug&&(Ut(t.x),Ut(t.y),Ut(t.z),Ut(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]=Ut(t)}get w(){return this[3]}set w(t){this[3]=Ut(t)}transform(t){return Ed(this,this,t),this.check()}transformByMatrix3(t){return yS(this,this,t),this.check()}transformByMatrix2(t){return bbe(this,this,t),this.check()}transformByQuaternion(t){return v1(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Xm=class extends Ff{toString(){let t="[";if(Rr.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)t+=` ${this[n*this.RANK+r]}`}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=` ${this[r]}`}return t+="]",t}getElementIndex(t,r){return r*this.RANK+t}getElement(t,r){return this[r*this.RANK+t]}setElement(t,r,n){return this[r*this.RANK+t]=Ut(n),this}getColumn(t,r=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let a=0;a<this.RANK;++a)r[a]=this[n+a];return r}setColumn(t,r){let n=t*this.RANK;for(let a=0;a<this.RANK;++a)this[n+a]=r[a];return this}};function Tbe(){let e=new nn(9);return nn!=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 Sbe(e,t){if(e===t){let r=t[1],n=t[2],a=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=a}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 kbe(e,t){let r=t[0],n=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],f=l*o-s*c,p=-l*i+s*u,d=c*i-o*u,h=r*f+n*p+a*d;return h?(h=1/h,e[0]=f*h,e[1]=(-l*n+a*c)*h,e[2]=(s*n-a*o)*h,e[3]=p*h,e[4]=(l*r-a*u)*h,e[5]=(-s*r+a*i)*h,e[6]=d*h,e[7]=(-c*r+n*u)*h,e[8]=(o*r-n*i)*h,e):null}function Cbe(e){let t=e[0],r=e[1],n=e[2],a=e[3],i=e[4],o=e[5],s=e[6],u=e[7],c=e[8];return t*(c*i-o*u)+r*(-c*a+o*s)+n*(u*a-i*s)}function RL(e,t,r){let n=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=t[8],p=r[0],d=r[1],h=r[2],m=r[3],g=r[4],x=r[5],y=r[6],w=r[7],T=r[8];return e[0]=p*n+d*o+h*c,e[1]=p*a+d*s+h*l,e[2]=p*i+d*u+h*f,e[3]=m*n+g*o+x*c,e[4]=m*a+g*s+x*l,e[5]=m*i+g*u+x*f,e[6]=y*n+w*o+T*c,e[7]=y*a+w*s+T*l,e[8]=y*i+w*u+T*f,e}function Dbe(e,t,r){let n=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=t[8],p=r[0],d=r[1];return e[0]=n,e[1]=a,e[2]=i,e[3]=o,e[4]=s,e[5]=u,e[6]=p*n+d*o+c,e[7]=p*a+d*s+l,e[8]=p*i+d*u+f,e}function Bbe(e,t,r){let n=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=t[8],p=Math.sin(r),d=Math.cos(r);return e[0]=d*n+p*o,e[1]=d*a+p*s,e[2]=d*i+p*u,e[3]=d*o-p*n,e[4]=d*s-p*a,e[5]=d*u-p*i,e[6]=c,e[7]=l,e[8]=f,e}function jL(e,t,r){let n=r[0],a=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=a*t[3],e[4]=a*t[4],e[5]=a*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Fbe(e,t){let r=t[0],n=t[1],a=t[2],i=t[3],o=r+r,s=n+n,u=a+a,c=r*o,l=n*o,f=n*s,p=a*o,d=a*s,h=a*u,m=i*o,g=i*s,x=i*u;return e[0]=1-f-h,e[3]=l-x,e[6]=p+g,e[1]=l+x,e[4]=1-c-h,e[7]=d-m,e[2]=p-g,e[5]=d+m,e[8]=1-c-f,e}var LL;(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"})(LL||(LL={}));var _yt=Object.freeze([1,0,0,0,1,0,0,0,1]),nr=class extends Xm{static get IDENTITY(){return Ayt()}static get ZERO(){return wyt()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return LL}constructor(t,...r){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):r.length>0?this.copy([t,...r]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(_yt)}fromObject(t){return this.check()}fromQuaternion(t){return Fbe(this,t),this.check()}set(t,r,n,a,i,o,s,u,c){return this[0]=t,this[1]=r,this[2]=n,this[3]=a,this[4]=i,this[5]=o,this[6]=s,this[7]=u,this[8]=c,this.check()}setRowMajor(t,r,n,a,i,o,s,u,c){return this[0]=t,this[1]=a,this[2]=s,this[3]=r,this[4]=i,this[5]=u,this[6]=n,this[7]=o,this[8]=c,this.check()}determinant(){return Cbe(this)}transpose(){return Sbe(this,this),this.check()}invert(){return kbe(this,this),this.check()}multiplyLeft(t){return RL(this,t,this),this.check()}multiplyRight(t){return RL(this,this,t),this.check()}rotate(t){return Bbe(this,this,t),this.check()}scale(t){return Array.isArray(t)?jL(this,this,t):jL(this,this,[t,t]),this.check()}translate(t){return Dbe(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=gS(r||[-0,-0],t,this);break;case 3:n=b1(r||[-0,-0,-0],t,this);break;case 4:n=yS(r||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Of(n,t.length),n}transformVector(t,r){return this.transform(t,r)}transformVector2(t,r){return this.transform(t,r)}transformVector3(t,r){return this.transform(t,r)}},TS,SS=null;function wyt(){return TS||(TS=new nr([0,0,0,0,0,0,0,0,0]),Object.freeze(TS)),TS}function Ayt(){return SS||(SS=new nr,Object.freeze(SS)),SS}var kS={};Fa(kS,{add:()=>Kyt,adjoint:()=>Dyt,clone:()=>Tyt,copy:()=>Syt,create:()=>Eyt,decompose:()=>qyt,determinant:()=>NL,equals:()=>Qyt,exactEquals:()=>Yyt,frob:()=>Wyt,fromQuat:()=>KL,fromQuat2:()=>jyt,fromRotation:()=>Oyt,fromRotationTranslation:()=>Pbe,fromRotationTranslationScale:()=>Nyt,fromRotationTranslationScaleOrigin:()=>Uyt,fromScaling:()=>Fyt,fromTranslation:()=>Byt,fromValues:()=>kyt,fromXRotation:()=>Iyt,fromYRotation:()=>Pyt,fromZRotation:()=>Ryt,frustum:()=>JL,getRotation:()=>Myt,getScaling:()=>Rbe,getTranslation:()=>Lyt,identity:()=>Ibe,invert:()=>qL,lookAt:()=>QL,mul:()=>Zyt,multiply:()=>x1,multiplyScalar:()=>Jyt,multiplyScalarAndAdd:()=>Xyt,ortho:()=>YL,orthoNO:()=>Lbe,orthoZO:()=>Hyt,perspective:()=>XL,perspectiveFromFieldOfView:()=>Gyt,perspectiveNO:()=>jbe,perspectiveZO:()=>zyt,rotate:()=>HL,rotateX:()=>VL,rotateY:()=>$L,rotateZ:()=>WL,scale:()=>zL,set:()=>Cyt,str:()=>$yt,sub:()=>e_t,subtract:()=>Mbe,targetTo:()=>Vyt,translate:()=>UL,transpose:()=>ML});function Eyt(){let e=new nn(16);return nn!=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 Tyt(e){let t=new nn(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 Syt(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 kyt(e,t,r,n,a,i,o,s,u,c,l,f,p,d,h,m){let g=new nn(16);return g[0]=e,g[1]=t,g[2]=r,g[3]=n,g[4]=a,g[5]=i,g[6]=o,g[7]=s,g[8]=u,g[9]=c,g[10]=l,g[11]=f,g[12]=p,g[13]=d,g[14]=h,g[15]=m,g}function Cyt(e,t,r,n,a,i,o,s,u,c,l,f,p,d,h,m,g){return e[0]=t,e[1]=r,e[2]=n,e[3]=a,e[4]=i,e[5]=o,e[6]=s,e[7]=u,e[8]=c,e[9]=l,e[10]=f,e[11]=p,e[12]=d,e[13]=h,e[14]=m,e[15]=g,e}function Ibe(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 ML(e,t){if(e===t){let r=t[1],n=t[2],a=t[3],i=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=i,e[11]=t[14],e[12]=a,e[13]=o,e[14]=s}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 qL(e,t){let r=t[0],n=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],f=t[9],p=t[10],d=t[11],h=t[12],m=t[13],g=t[14],x=t[15],y=r*s-n*o,w=r*u-a*o,T=r*c-i*o,A=n*u-a*s,B=n*c-i*s,I=a*c-i*u,L=l*m-f*h,C=l*g-p*h,k=l*x-d*h,F=f*g-p*m,R=f*x-d*m,G=p*x-d*g,z=y*G-w*R+T*F+A*k-B*C+I*L;return z?(z=1/z,e[0]=(s*G-u*R+c*F)*z,e[1]=(a*R-n*G-i*F)*z,e[2]=(m*I-g*B+x*A)*z,e[3]=(p*B-f*I-d*A)*z,e[4]=(u*k-o*G-c*C)*z,e[5]=(r*G-a*k+i*C)*z,e[6]=(g*T-h*I-x*w)*z,e[7]=(l*I-p*T+d*w)*z,e[8]=(o*R-s*k+c*L)*z,e[9]=(n*k-r*R-i*L)*z,e[10]=(h*B-m*T+x*y)*z,e[11]=(f*T-l*B-d*y)*z,e[12]=(s*C-o*F-u*L)*z,e[13]=(r*F-n*C+a*L)*z,e[14]=(m*w-h*A-g*y)*z,e[15]=(l*A-f*w+p*y)*z,e):null}function Dyt(e,t){let r=t[0],n=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],f=t[9],p=t[10],d=t[11],h=t[12],m=t[13],g=t[14],x=t[15],y=r*s-n*o,w=r*u-a*o,T=r*c-i*o,A=n*u-a*s,B=n*c-i*s,I=a*c-i*u,L=l*m-f*h,C=l*g-p*h,k=l*x-d*h,F=f*g-p*m,R=f*x-d*m,G=p*x-d*g;return e[0]=s*G-u*R+c*F,e[1]=a*R-n*G-i*F,e[2]=m*I-g*B+x*A,e[3]=p*B-f*I-d*A,e[4]=u*k-o*G-c*C,e[5]=r*G-a*k+i*C,e[6]=g*T-h*I-x*w,e[7]=l*I-p*T+d*w,e[8]=o*R-s*k+c*L,e[9]=n*k-r*R-i*L,e[10]=h*B-m*T+x*y,e[11]=f*T-l*B-d*y,e[12]=s*C-o*F-u*L,e[13]=r*F-n*C+a*L,e[14]=m*w-h*A-g*y,e[15]=l*A-f*w+p*y,e}function NL(e){let t=e[0],r=e[1],n=e[2],a=e[3],i=e[4],o=e[5],s=e[6],u=e[7],c=e[8],l=e[9],f=e[10],p=e[11],d=e[12],h=e[13],m=e[14],g=e[15],x=t*o-r*i,y=t*s-n*i,w=r*s-n*o,T=c*h-l*d,A=c*m-f*d,B=l*m-f*h,I=t*B-r*A+n*T,L=i*B-o*A+s*T,C=c*w-l*y+f*x,k=d*w-h*y+m*x;return u*I-a*L+g*C-p*k}function x1(e,t,r){let n=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=t[8],p=t[9],d=t[10],h=t[11],m=t[12],g=t[13],x=t[14],y=t[15],w=r[0],T=r[1],A=r[2],B=r[3];return e[0]=w*n+T*s+A*f+B*m,e[1]=w*a+T*u+A*p+B*g,e[2]=w*i+T*c+A*d+B*x,e[3]=w*o+T*l+A*h+B*y,w=r[4],T=r[5],A=r[6],B=r[7],e[4]=w*n+T*s+A*f+B*m,e[5]=w*a+T*u+A*p+B*g,e[6]=w*i+T*c+A*d+B*x,e[7]=w*o+T*l+A*h+B*y,w=r[8],T=r[9],A=r[10],B=r[11],e[8]=w*n+T*s+A*f+B*m,e[9]=w*a+T*u+A*p+B*g,e[10]=w*i+T*c+A*d+B*x,e[11]=w*o+T*l+A*h+B*y,w=r[12],T=r[13],A=r[14],B=r[15],e[12]=w*n+T*s+A*f+B*m,e[13]=w*a+T*u+A*p+B*g,e[14]=w*i+T*c+A*d+B*x,e[15]=w*o+T*l+A*h+B*y,e}function UL(e,t,r){let n=r[0],a=r[1],i=r[2],o,s,u,c,l,f,p,d,h,m,g,x;return t===e?(e[12]=t[0]*n+t[4]*a+t[8]*i+t[12],e[13]=t[1]*n+t[5]*a+t[9]*i+t[13],e[14]=t[2]*n+t[6]*a+t[10]*i+t[14],e[15]=t[3]*n+t[7]*a+t[11]*i+t[15]):(o=t[0],s=t[1],u=t[2],c=t[3],l=t[4],f=t[5],p=t[6],d=t[7],h=t[8],m=t[9],g=t[10],x=t[11],e[0]=o,e[1]=s,e[2]=u,e[3]=c,e[4]=l,e[5]=f,e[6]=p,e[7]=d,e[8]=h,e[9]=m,e[10]=g,e[11]=x,e[12]=o*n+l*a+h*i+t[12],e[13]=s*n+f*a+m*i+t[13],e[14]=u*n+p*a+g*i+t[14],e[15]=c*n+d*a+x*i+t[15]),e}function zL(e,t,r){let n=r[0],a=r[1],i=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,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 HL(e,t,r,n){let a=n[0],i=n[1],o=n[2],s=Math.sqrt(a*a+i*i+o*o),u,c,l,f,p,d,h,m,g,x,y,w,T,A,B,I,L,C,k,F,R,G,z,W;return s<1e-6?null:(s=1/s,a*=s,i*=s,o*=s,c=Math.sin(r),u=Math.cos(r),l=1-u,f=t[0],p=t[1],d=t[2],h=t[3],m=t[4],g=t[5],x=t[6],y=t[7],w=t[8],T=t[9],A=t[10],B=t[11],I=a*a*l+u,L=i*a*l+o*c,C=o*a*l-i*c,k=a*i*l-o*c,F=i*i*l+u,R=o*i*l+a*c,G=a*o*l+i*c,z=i*o*l-a*c,W=o*o*l+u,e[0]=f*I+m*L+w*C,e[1]=p*I+g*L+T*C,e[2]=d*I+x*L+A*C,e[3]=h*I+y*L+B*C,e[4]=f*k+m*F+w*R,e[5]=p*k+g*F+T*R,e[6]=d*k+x*F+A*R,e[7]=h*k+y*F+B*R,e[8]=f*G+m*z+w*W,e[9]=p*G+g*z+T*W,e[10]=d*G+x*z+A*W,e[11]=h*G+y*z+B*W,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function VL(e,t,r){let n=Math.sin(r),a=Math.cos(r),i=t[4],o=t[5],s=t[6],u=t[7],c=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*a+c*n,e[5]=o*a+l*n,e[6]=s*a+f*n,e[7]=u*a+p*n,e[8]=c*a-i*n,e[9]=l*a-o*n,e[10]=f*a-s*n,e[11]=p*a-u*n,e}function $L(e,t,r){let n=Math.sin(r),a=Math.cos(r),i=t[0],o=t[1],s=t[2],u=t[3],c=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*a-c*n,e[1]=o*a-l*n,e[2]=s*a-f*n,e[3]=u*a-p*n,e[8]=i*n+c*a,e[9]=o*n+l*a,e[10]=s*n+f*a,e[11]=u*n+p*a,e}function WL(e,t,r){let n=Math.sin(r),a=Math.cos(r),i=t[0],o=t[1],s=t[2],u=t[3],c=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*a+c*n,e[1]=o*a+l*n,e[2]=s*a+f*n,e[3]=u*a+p*n,e[4]=c*a-i*n,e[5]=l*a-o*n,e[6]=f*a-s*n,e[7]=p*a-u*n,e}function Byt(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 Fyt(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 Oyt(e,t,r){let n=r[0],a=r[1],i=r[2],o=Math.sqrt(n*n+a*a+i*i),s,u,c;return o<1e-6?null:(o=1/o,n*=o,a*=o,i*=o,u=Math.sin(t),s=Math.cos(t),c=1-s,e[0]=n*n*c+s,e[1]=a*n*c+i*u,e[2]=i*n*c-a*u,e[3]=0,e[4]=n*a*c-i*u,e[5]=a*a*c+s,e[6]=i*a*c+n*u,e[7]=0,e[8]=n*i*c+a*u,e[9]=a*i*c-n*u,e[10]=i*i*c+s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function Iyt(e,t){let r=Math.sin(t),n=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Pyt(e,t){let r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ryt(e,t){let r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Pbe(e,t,r){let n=t[0],a=t[1],i=t[2],o=t[3],s=n+n,u=a+a,c=i+i,l=n*s,f=n*u,p=n*c,d=a*u,h=a*c,m=i*c,g=o*s,x=o*u,y=o*c;return e[0]=1-(d+m),e[1]=f+y,e[2]=p-x,e[3]=0,e[4]=f-y,e[5]=1-(l+m),e[6]=h+g,e[7]=0,e[8]=p+x,e[9]=h-g,e[10]=1-(l+d),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function jyt(e,t){let r=new nn(3),n=-t[0],a=-t[1],i=-t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=n*n+a*a+i*i+o*o;return f>0?(r[0]=(s*o+l*n+u*i-c*a)*2/f,r[1]=(u*o+l*a+c*n-s*i)*2/f,r[2]=(c*o+l*i+s*a-u*n)*2/f):(r[0]=(s*o+l*n+u*i-c*a)*2,r[1]=(u*o+l*a+c*n-s*i)*2,r[2]=(c*o+l*i+s*a-u*n)*2),Pbe(e,t,r),e}function Lyt(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Rbe(e,t){let r=t[0],n=t[1],a=t[2],i=t[4],o=t[5],s=t[6],u=t[8],c=t[9],l=t[10];return e[0]=Math.sqrt(r*r+n*n+a*a),e[1]=Math.sqrt(i*i+o*o+s*s),e[2]=Math.sqrt(u*u+c*c+l*l),e}function Myt(e,t){let r=new nn(3);Rbe(r,t);let n=1/r[0],a=1/r[1],i=1/r[2],o=t[0]*n,s=t[1]*a,u=t[2]*i,c=t[4]*n,l=t[5]*a,f=t[6]*i,p=t[8]*n,d=t[9]*a,h=t[10]*i,m=o+l+h,g=0;return m>0?(g=Math.sqrt(m+1)*2,e[3]=.25*g,e[0]=(f-d)/g,e[1]=(p-u)/g,e[2]=(s-c)/g):o>l&&o>h?(g=Math.sqrt(1+o-l-h)*2,e[3]=(f-d)/g,e[0]=.25*g,e[1]=(s+c)/g,e[2]=(p+u)/g):l>h?(g=Math.sqrt(1+l-o-h)*2,e[3]=(p-u)/g,e[0]=(s+c)/g,e[1]=.25*g,e[2]=(f+d)/g):(g=Math.sqrt(1+h-o-l)*2,e[3]=(s-c)/g,e[0]=(p+u)/g,e[1]=(f+d)/g,e[2]=.25*g),e}function qyt(e,t,r,n){t[0]=n[12],t[1]=n[13],t[2]=n[14];let a=n[0],i=n[1],o=n[2],s=n[4],u=n[5],c=n[6],l=n[8],f=n[9],p=n[10];r[0]=Math.sqrt(a*a+i*i+o*o),r[1]=Math.sqrt(s*s+u*u+c*c),r[2]=Math.sqrt(l*l+f*f+p*p);let d=1/r[0],h=1/r[1],m=1/r[2],g=a*d,x=i*h,y=o*m,w=s*d,T=u*h,A=c*m,B=l*d,I=f*h,L=p*m,C=g+T+L,k=0;return C>0?(k=Math.sqrt(C+1)*2,e[3]=.25*k,e[0]=(A-I)/k,e[1]=(B-y)/k,e[2]=(x-w)/k):g>T&&g>L?(k=Math.sqrt(1+g-T-L)*2,e[3]=(A-I)/k,e[0]=.25*k,e[1]=(x+w)/k,e[2]=(B+y)/k):T>L?(k=Math.sqrt(1+T-g-L)*2,e[3]=(B-y)/k,e[0]=(x+w)/k,e[1]=.25*k,e[2]=(A+I)/k):(k=Math.sqrt(1+L-g-T)*2,e[3]=(x-w)/k,e[0]=(B+y)/k,e[1]=(A+I)/k,e[2]=.25*k),e}function Nyt(e,t,r,n){let a=t[0],i=t[1],o=t[2],s=t[3],u=a+a,c=i+i,l=o+o,f=a*u,p=a*c,d=a*l,h=i*c,m=i*l,g=o*l,x=s*u,y=s*c,w=s*l,T=n[0],A=n[1],B=n[2];return e[0]=(1-(h+g))*T,e[1]=(p+w)*T,e[2]=(d-y)*T,e[3]=0,e[4]=(p-w)*A,e[5]=(1-(f+g))*A,e[6]=(m+x)*A,e[7]=0,e[8]=(d+y)*B,e[9]=(m-x)*B,e[10]=(1-(f+h))*B,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function Uyt(e,t,r,n,a){let i=t[0],o=t[1],s=t[2],u=t[3],c=i+i,l=o+o,f=s+s,p=i*c,d=i*l,h=i*f,m=o*l,g=o*f,x=s*f,y=u*c,w=u*l,T=u*f,A=n[0],B=n[1],I=n[2],L=a[0],C=a[1],k=a[2],F=(1-(m+x))*A,R=(d+T)*A,G=(h-w)*A,z=(d-T)*B,W=(1-(p+x))*B,Y=(g+y)*B,ue=(h+w)*I,ie=(g-y)*I,le=(1-(p+m))*I;return e[0]=F,e[1]=R,e[2]=G,e[3]=0,e[4]=z,e[5]=W,e[6]=Y,e[7]=0,e[8]=ue,e[9]=ie,e[10]=le,e[11]=0,e[12]=r[0]+L-(F*L+z*C+ue*k),e[13]=r[1]+C-(R*L+W*C+ie*k),e[14]=r[2]+k-(G*L+Y*C+le*k),e[15]=1,e}function KL(e,t){let r=t[0],n=t[1],a=t[2],i=t[3],o=r+r,s=n+n,u=a+a,c=r*o,l=n*o,f=n*s,p=a*o,d=a*s,h=a*u,m=i*o,g=i*s,x=i*u;return e[0]=1-f-h,e[1]=l+x,e[2]=p-g,e[3]=0,e[4]=l-x,e[5]=1-c-h,e[6]=d+m,e[7]=0,e[8]=p+g,e[9]=d-m,e[10]=1-c-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function JL(e,t,r,n,a,i,o){let s=1/(r-t),u=1/(a-n),c=1/(i-o);return e[0]=i*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*u,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(a+n)*u,e[10]=(o+i)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*c,e[15]=0,e}function jbe(e,t,r,n,a){let i=1/Math.tan(t/2);if(e[0]=i/r,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,a!=null&&a!==1/0){let o=1/(n-a);e[10]=(a+n)*o,e[14]=2*a*n*o}else e[10]=-1,e[14]=-2*n;return e}var XL=jbe;function zyt(e,t,r,n,a){let i=1/Math.tan(t/2);if(e[0]=i/r,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,a!=null&&a!==1/0){let o=1/(n-a);e[10]=a*o,e[14]=a*n*o}else e[10]=-1,e[14]=-n;return e}function Gyt(e,t,r,n){let a=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),u=2/(o+s),c=2/(a+i);return e[0]=u,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=-((o-s)*u*.5),e[9]=(a-i)*c*.5,e[10]=n/(r-n),e[11]=-1,e[12]=0,e[13]=0,e[14]=n*r/(r-n),e[15]=0,e}function Lbe(e,t,r,n,a,i,o){let s=1/(t-r),u=1/(n-a),c=1/(i-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+r)*s,e[13]=(a+n)*u,e[14]=(o+i)*c,e[15]=1,e}var YL=Lbe;function Hyt(e,t,r,n,a,i,o){let s=1/(t-r),u=1/(n-a),c=1/(i-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=c,e[11]=0,e[12]=(t+r)*s,e[13]=(a+n)*u,e[14]=i*c,e[15]=1,e}function QL(e,t,r,n){let a,i,o,s,u,c,l,f,p,d,h=t[0],m=t[1],g=t[2],x=n[0],y=n[1],w=n[2],T=r[0],A=r[1],B=r[2];return Math.abs(h-T)<1e-6&&Math.abs(m-A)<1e-6&&Math.abs(g-B)<1e-6?Ibe(e):(f=h-T,p=m-A,d=g-B,a=1/Math.sqrt(f*f+p*p+d*d),f*=a,p*=a,d*=a,i=y*d-w*p,o=w*f-x*d,s=x*p-y*f,a=Math.sqrt(i*i+o*o+s*s),a?(a=1/a,i*=a,o*=a,s*=a):(i=0,o=0,s=0),u=p*s-d*o,c=d*i-f*s,l=f*o-p*i,a=Math.sqrt(u*u+c*c+l*l),a?(a=1/a,u*=a,c*=a,l*=a):(u=0,c=0,l=0),e[0]=i,e[1]=u,e[2]=f,e[3]=0,e[4]=o,e[5]=c,e[6]=p,e[7]=0,e[8]=s,e[9]=l,e[10]=d,e[11]=0,e[12]=-(i*h+o*m+s*g),e[13]=-(u*h+c*m+l*g),e[14]=-(f*h+p*m+d*g),e[15]=1,e)}function Vyt(e,t,r,n){let a=t[0],i=t[1],o=t[2],s=n[0],u=n[1],c=n[2],l=a-r[0],f=i-r[1],p=o-r[2],d=l*l+f*f+p*p;d>0&&(d=1/Math.sqrt(d),l*=d,f*=d,p*=d);let h=u*p-c*f,m=c*l-s*p,g=s*f-u*l;return d=h*h+m*m+g*g,d>0&&(d=1/Math.sqrt(d),h*=d,m*=d,g*=d),e[0]=h,e[1]=m,e[2]=g,e[3]=0,e[4]=f*g-p*m,e[5]=p*h-l*g,e[6]=l*m-f*h,e[7]=0,e[8]=l,e[9]=f,e[10]=p,e[11]=0,e[12]=a,e[13]=i,e[14]=o,e[15]=1,e}function $yt(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 Wyt(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 Kyt(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e}function Mbe(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}function Jyt(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e}function Xyt(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e[4]=t[4]+r[4]*n,e[5]=t[5]+r[5]*n,e[6]=t[6]+r[6]*n,e[7]=t[7]+r[7]*n,e[8]=t[8]+r[8]*n,e[9]=t[9]+r[9]*n,e[10]=t[10]+r[10]*n,e[11]=t[11]+r[11]*n,e[12]=t[12]+r[12]*n,e[13]=t[13]+r[13]*n,e[14]=t[14]+r[14]*n,e[15]=t[15]+r[15]*n,e}function Yyt(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 Qyt(e,t){let r=e[0],n=e[1],a=e[2],i=e[3],o=e[4],s=e[5],u=e[6],c=e[7],l=e[8],f=e[9],p=e[10],d=e[11],h=e[12],m=e[13],g=e[14],x=e[15],y=t[0],w=t[1],T=t[2],A=t[3],B=t[4],I=t[5],L=t[6],C=t[7],k=t[8],F=t[9],R=t[10],G=t[11],z=t[12],W=t[13],Y=t[14],ue=t[15];return Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(n-w)<=1e-6*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(a-T)<=1e-6*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(i-A)<=1e-6*Math.max(1,Math.abs(i),Math.abs(A))&&Math.abs(o-B)<=1e-6*Math.max(1,Math.abs(o),Math.abs(B))&&Math.abs(s-I)<=1e-6*Math.max(1,Math.abs(s),Math.abs(I))&&Math.abs(u-L)<=1e-6*Math.max(1,Math.abs(u),Math.abs(L))&&Math.abs(c-C)<=1e-6*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(l-k)<=1e-6*Math.max(1,Math.abs(l),Math.abs(k))&&Math.abs(f-F)<=1e-6*Math.max(1,Math.abs(f),Math.abs(F))&&Math.abs(p-R)<=1e-6*Math.max(1,Math.abs(p),Math.abs(R))&&Math.abs(d-G)<=1e-6*Math.max(1,Math.abs(d),Math.abs(G))&&Math.abs(h-z)<=1e-6*Math.max(1,Math.abs(h),Math.abs(z))&&Math.abs(m-W)<=1e-6*Math.max(1,Math.abs(m),Math.abs(W))&&Math.abs(g-Y)<=1e-6*Math.max(1,Math.abs(g),Math.abs(Y))&&Math.abs(x-ue)<=1e-6*Math.max(1,Math.abs(x),Math.abs(ue))}var Zyt=x1,e_t=Mbe;function t_t(){let e=new nn(4);return nn!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function qbe(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function Nbe(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function Ube(e){let t=e[0],r=e[1],n=e[2],a=e[3];return Math.sqrt(t*t+r*r+n*n+a*a)}function zbe(e){let t=e[0],r=e[1],n=e[2],a=e[3];return t*t+r*r+n*n+a*a}function Gbe(e,t){let r=t[0],n=t[1],a=t[2],i=t[3],o=r*r+n*n+a*a+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=n*o,e[2]=a*o,e[3]=i*o,e}function Hbe(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Vbe(e,t,r,n){let a=t[0],i=t[1],o=t[2],s=t[3];return e[0]=a+n*(r[0]-a),e[1]=i+n*(r[1]-i),e[2]=o+n*(r[2]-o),e[3]=s+n*(r[3]-s),e}function $be(e,t,r){let n=t[0],a=t[1],i=t[2],o=t[3];return e[0]=r[0]*n+r[4]*a+r[8]*i+r[12]*o,e[1]=r[1]*n+r[5]*a+r[9]*i+r[13]*o,e[2]=r[2]*n+r[6]*a+r[10]*i+r[14]*o,e[3]=r[3]*n+r[7]*a+r[11]*i+r[15]*o,e}function Wbe(e,t,r){let n=t[0],a=t[1],i=t[2],o=r[0],s=r[1],u=r[2],c=r[3],l=c*n+s*i-u*a,f=c*a+u*n-o*i,p=c*i+o*a-s*n,d=-o*n-s*a-u*i;return e[0]=l*c+d*-o+f*-u-p*-s,e[1]=f*c+d*-s+p*-o-l*-u,e[2]=p*c+d*-u+l*-s-f*-o,e[3]=t[3],e}var Drr=function(){let e=t_t();return function(t,r,n,a,i,o){let s,u;for(r||(r=4),n||(n=0),a?u=Math.min(a*r+n,t.length):u=t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],e[3]=t[s+3],i(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3];return t}}();var tM;(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"})(tM||(tM={}));var r_t=45*Math.PI/180,n_t=1,ZL=.1,eM=500,a_t=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),mr=class extends Xm{static get IDENTITY(){return o_t()}static get ZERO(){return i_t()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return tM}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,r,n,a,i,o,s,u,c,l,f,p,d,h,m,g){return this[0]=t,this[1]=r,this[2]=n,this[3]=a,this[4]=i,this[5]=o,this[6]=s,this[7]=u,this[8]=c,this[9]=l,this[10]=f,this[11]=p,this[12]=d,this[13]=h,this[14]=m,this[15]=g,this.check()}setRowMajor(t,r,n,a,i,o,s,u,c,l,f,p,d,h,m,g){return this[0]=t,this[1]=i,this[2]=c,this[3]=d,this[4]=r,this[5]=o,this[6]=l,this[7]=h,this[8]=n,this[9]=s,this[10]=f,this[11]=m,this[12]=a,this[13]=u,this[14]=p,this[15]=g,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(a_t)}fromObject(t){return this.check()}fromQuaternion(t){return KL(this,t),this.check()}frustum(t){let{left:r,right:n,bottom:a,top:i,near:o=ZL,far:s=eM}=t;return s===1/0?s_t(this,r,n,a,i,o):JL(this,r,n,a,i,o,s),this.check()}lookAt(t){let{eye:r,center:n=[0,0,0],up:a=[0,1,0]}=t;return QL(this,r,n,a),this.check()}ortho(t){let{left:r,right:n,bottom:a,top:i,near:o=ZL,far:s=eM}=t;return YL(this,r,n,a,i,o,s),this.check()}orthographic(t){let{fovy:r=r_t,aspect:n=n_t,focalDistance:a=1,near:i=ZL,far:o=eM}=t;Jbe(r);let s=r/2,u=a*Math.tan(s),c=u*n;return this.ortho({left:-c,right:c,bottom:-u,top:u,near:i,far:o})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:n=1,near:a=.1,far:i=500}=t;return Jbe(r),XL(this,r,n,a,i),this.check()}determinant(){return NL(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),a=1/n[0],i=1/n[1],o=1/n[2];return t[0]=this[0]*a,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*a,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*a,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,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),a=1/n[0],i=1/n[1],o=1/n[2];return t[0]=this[0]*a,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*a,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*a,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return ML(this,this),this.check()}invert(){return qL(this,this),this.check()}multiplyLeft(t){return x1(this,t,this),this.check()}multiplyRight(t){return x1(this,this,t),this.check()}rotateX(t){return VL(this,this,t),this.check()}rotateY(t){return $L(this,this,t),this.check()}rotateZ(t){return WL(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return HL(this,this,t,r),this.check()}scale(t){return zL(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return UL(this,this,t),this.check()}transform(t,r){return t.length===4?(r=$be(r||[-0,-0,-0,-0],t,this),Of(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,a;switch(n){case 2:a=bS(r||[-0,-0],t,this);break;case 3:a=Ed(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Of(a,t.length),a}transformAsVector(t,r){let n;switch(t.length){case 2:n=vS(r||[-0,-0],t,this);break;case 3:n=xS(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Of(n,t.length),n}transformPoint(t,r){return this.transformAsPoint(t,r)}transformVector(t,r){return this.transformAsPoint(t,r)}transformDirection(t,r){return this.transformAsVector(t,r)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,r,n){return this.identity().translate([t,r,n])}},CS,DS;function i_t(){return CS||(CS=new mr([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(CS)),CS}function o_t(){return DS||(DS=new mr,Object.freeze(DS)),DS}function Jbe(e){if(e>Math.PI*2)throw Error("expected radians")}function s_t(e,t,r,n,a,i){let o=2*i/(r-t),s=2*i/(a-n),u=(r+t)/(r-t),c=(a+n)/(a-n),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]=s,e[6]=0,e[7]=0,e[8]=u,e[9]=c,e[10]=l,e[11]=f,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function Xbe(){let e=new nn(4);return nn!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Ybe(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function rM(e,t,r){r=r*.5;let n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function nM(e,t,r){let n=t[0],a=t[1],i=t[2],o=t[3],s=r[0],u=r[1],c=r[2],l=r[3];return e[0]=n*l+o*s+a*c-i*u,e[1]=a*l+o*u+i*s-n*c,e[2]=i*l+o*c+n*u-a*s,e[3]=o*l-n*s-a*u-i*c,e}function Qbe(e,t,r){r*=.5;let n=t[0],a=t[1],i=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+o*s,e[1]=a*u+i*s,e[2]=i*u-a*s,e[3]=o*u-n*s,e}function Zbe(e,t,r){r*=.5;let n=t[0],a=t[1],i=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u-i*s,e[1]=a*u+o*s,e[2]=i*u+n*s,e[3]=o*u-a*s,e}function eve(e,t,r){r*=.5;let n=t[0],a=t[1],i=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+a*s,e[1]=a*u-n*s,e[2]=i*u+o*s,e[3]=o*u-i*s,e}function tve(e,t){let r=t[0],n=t[1],a=t[2];return e[0]=r,e[1]=n,e[2]=a,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-a*a)),e}function y1(e,t,r,n){let a=t[0],i=t[1],o=t[2],s=t[3],u=r[0],c=r[1],l=r[2],f=r[3],p,d,h,m,g;return p=a*u+i*c+o*l+s*f,p<0&&(p=-p,u=-u,c=-c,l=-l,f=-f),1-p>1e-6?(d=Math.acos(p),g=Math.sin(d),h=Math.sin((1-n)*d)/g,m=Math.sin(n*d)/g):(h=1-n,m=n),e[0]=h*a+m*u,e[1]=h*i+m*c,e[2]=h*o+m*l,e[3]=h*s+m*f,e}function rve(e,t){let r=t[0],n=t[1],a=t[2],i=t[3],o=r*r+n*n+a*a+i*i,s=o?1/o:0;return e[0]=-r*s,e[1]=-n*s,e[2]=-a*s,e[3]=i*s,e}function nve(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function aM(e,t){let r=t[0]+t[4]+t[8],n;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{let a=0;t[4]>t[0]&&(a=1),t[8]>t[a*3+a]&&(a=2);let i=(a+1)%3,o=(a+2)%3;n=Math.sqrt(t[a*3+a]-t[i*3+i]-t[o*3+o]+1),e[a]=.5*n,n=.5/n,e[3]=(t[i*3+o]-t[o*3+i])*n,e[i]=(t[i*3+a]+t[a*3+i])*n,e[o]=(t[o*3+a]+t[a*3+o])*n}return e}var ave=qbe;var ive=Nbe,ove=Hbe,sve=Vbe,uve=Ube;var cve=zbe;var lve=Gbe;var fve=function(){let e=_S(),t=wS(1,0,0),r=wS(0,1,0);return function(n,a,i){let o=g1(a,i);return o<-.999999?(Ad(e,t,a),IL(e)<1e-6&&Ad(e,r,a),CL(e,e),rM(n,e,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Ad(e,a,i),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+o,lve(n,n))}}(),Grr=function(){let e=Xbe(),t=Xbe();return function(r,n,a,i,o,s){return y1(e,n,o,s),y1(t,a,i,s),y1(r,e,t,2*s*(1-s)),r}}(),Hrr=function(){let e=Tbe();return function(t,r,n,a){return e[0]=n[0],e[3]=n[1],e[6]=n[2],e[1]=a[0],e[4]=a[1],e[7]=a[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],lve(t,aM(t,e))}}();var c_t=[0,0,0,1],Io=class extends Ff{constructor(t=0,r=0,n=0,a=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,n,a)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,r,n,a){return this[0]=t,this[1]=r,this[2]=n,this[3]=a,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 aM(this,t),this.check()}fromAxisRotation(t,r){return rM(this,t,r),this.check()}identity(){return Ybe(this),this.check()}setAxisAngle(t,r){return this.fromAxisRotation(t,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=Ut(t)}get y(){return this[1]}set y(t){this[1]=Ut(t)}get z(){return this[2]}set z(t){this[2]=Ut(t)}get w(){return this[3]}set w(t){this[3]=Ut(t)}len(){return uve(this)}lengthSquared(){return cve(this)}dot(t){return ove(this,t)}rotationTo(t,r){return fve(this,t,r),this.check()}add(t){return ave(this,this,t),this.check()}calculateW(){return tve(this,this),this.check()}conjugate(){return nve(this,this),this.check()}invert(){return rve(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(sve(this,t,r,n),this.check())}multiplyRight(t){return nM(this,this,t),this.check()}multiplyLeft(t){return nM(this,t,this),this.check()}normalize(){let t=this.len(),r=t>0?1/t:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,t===0&&(this[3]=1),this.check()}rotateX(t){return Qbe(this,this,t),this.check()}rotateY(t){return Zbe(this,this,t),this.check()}rotateZ(t){return eve(this,this,t),this.check()}scale(t){return ive(this,this,t),this.check()}slerp(t,r,n){let a,i,o;switch(arguments.length){case 1:({start:a=c_t,target:i,ratio:o}=t);break;case 2:a=this,i=t,o=r;break;default:a=t,i=r,o=n}return y1(this,a,i,o),this.check()}transformVector4(t,r=new Oo){return Wbe(r,t,this),Of(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,r){return this.setAxisAngle(t,r)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Es={};Fa(Es,{EPSILON1:()=>l_t,EPSILON10:()=>x_t,EPSILON11:()=>y_t,EPSILON12:()=>__t,EPSILON13:()=>w_t,EPSILON14:()=>A_t,EPSILON15:()=>E_t,EPSILON16:()=>T_t,EPSILON17:()=>S_t,EPSILON18:()=>k_t,EPSILON19:()=>C_t,EPSILON2:()=>f_t,EPSILON20:()=>D_t,EPSILON3:()=>p_t,EPSILON4:()=>d_t,EPSILON5:()=>h_t,EPSILON6:()=>m_t,EPSILON7:()=>g_t,EPSILON8:()=>b_t,EPSILON9:()=>v_t,PI_OVER_FOUR:()=>F_t,PI_OVER_SIX:()=>O_t,PI_OVER_TWO:()=>B_t,TWO_PI:()=>I_t});var l_t=.1,f_t=.01,p_t=.001,d_t=1e-4,h_t=1e-5,m_t=1e-6,g_t=1e-7,b_t=1e-8,v_t=1e-9,x_t=1e-10,y_t=1e-11,__t=1e-12,w_t=1e-13,A_t=1e-14,E_t=1e-15,T_t=1e-16,S_t=1e-17,k_t=1e-18,C_t=1e-19,D_t=1e-20,B_t=Math.PI/2,F_t=Math.PI/4,O_t=Math.PI/6,I_t=Math.PI*2;var $c=6356752314245179e-9,P_t={radii:[6378137,6378137,$c],radiiSquared:[6378137*6378137,6378137*6378137,$c*$c],oneOverRadii:[1/6378137,1/6378137,1/$c],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/($c*$c)],maximumRadius:Math.max(6378137,6378137,$c),centerToleranceSquared:.1};function BS(e){return e}var ynr=new Z;function R_t(e,t=[],r=BS){return"longitude"in e?(t[0]=r(e.longitude),t[1]=r(e.latitude),t[2]=e.height):"x"in e?(t[0]=r(e.x),t[1]=r(e.y),t[2]=e.z):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}function pve(e,t=[]){return R_t(e,t,Rr._cartographicRadians?BS:EL)}function j_t(e,t,r=BS){return"longitude"in t?(t.longitude=r(e[0]),t.latitude=r(e[1]),t.height=e[2]):"x"in t?(t.x=r(e[0]),t.y=r(e[1]),t.z=e[2]):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}function dve(e,t){return j_t(e,t,Rr._cartographicRadians?BS:TL)}var hve=1e-14,L_t=new Z,mve={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},iM={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},_1={east:new Z,north:new Z,up:new Z,west:new Z,south:new Z,down:new Z},M_t=new Z,q_t=new Z,N_t=new Z;function oM(e,t,r,n,a,i){let o=mve[t]&&mve[t][r];ca(o&&(!n||n===o));let s,u,c,l=L_t.copy(a);if(Yi(l.x,0,hve)&&Yi(l.y,0,hve)){let p=Math.sign(l.z);s=M_t.fromArray(iM[t]),t!=="east"&&t!=="west"&&s.scale(p),u=q_t.fromArray(iM[r]),r!=="east"&&r!=="west"&&u.scale(p),c=N_t.fromArray(iM[n]),n!=="east"&&n!=="west"&&c.scale(p)}else{let{up:p,east:d,north:h}=_1;d.set(-l.y,l.x,0).normalize(),e.geodeticSurfaceNormal(l,p),h.copy(p).cross(d);let{down:m,west:g,south:x}=_1;m.copy(p).scale(-1),g.copy(d).scale(-1),x.copy(h).scale(-1),s=_1[t],u=_1[r],c=_1[n]}return i[0]=s.x,i[1]=s.y,i[2]=s.z,i[3]=0,i[4]=u.x,i[5]=u.y,i[6]=u.z,i[7]=0,i[8]=c.x,i[9]=c.y,i[10]=c.z,i[11]=0,i[12]=l.x,i[13]=l.y,i[14]=l.z,i[15]=1,i}var Ym=new Z,U_t=new Z,z_t=new Z;function gve(e,t,r=[]){let{oneOverRadii:n,oneOverRadiiSquared:a,centerToleranceSquared:i}=t;Ym.from(e);let o=Ym.x,s=Ym.y,u=Ym.z,c=n.x,l=n.y,f=n.z,p=o*o*c*c,d=s*s*l*l,h=u*u*f*f,m=p+d+h,g=Math.sqrt(1/m);if(!Number.isFinite(g))return;let x=U_t;if(x.copy(e).scale(g),m<i)return x.to(r);let y=a.x,w=a.y,T=a.z,A=z_t;A.set(x.x*y*2,x.y*w*2,x.z*T*2);let B=(1-g)*Ym.len()/(.5*A.len()),I=0,L,C,k,F;do{B-=I,L=1/(1+B*y),C=1/(1+B*w),k=1/(1+B*T);let R=L*L,G=C*C,z=k*k,W=R*L,Y=G*C,ue=z*k;F=p*R+d*G+h*z-1;let le=-2*(p*W*y+d*Y*w+h*ue*T);I=F/le}while(Math.abs(F)>Es.EPSILON12);return Ym.scale([L,C,k]).to(r)}var FS=new Z,bve=new Z,V_t=new Z,Ts=new Z,$_t=new Z,OS=new Z,Ft=class{constructor(t=0,r=0,n=0){this.centerToleranceSquared=Es.EPSILON1,ca(t>=0),ca(r>=0),ca(n>=0),this.radii=new Z(t,r,n),this.radiiSquared=new Z(t*t,r*r,n*n),this.radiiToTheFourth=new Z(t*t*t*t,r*r*r*r,n*n*n*n),this.oneOverRadii=new Z(t===0?0:1/t,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new Z(t===0?0:1/(t*t),r===0?0:1/(r*r),n===0?0:1/(n*n)),this.minimumRadius=Math.min(t,r,n),this.maximumRadius=Math.max(t,r,n),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,r=[0,0,0]){let n=bve,a=V_t,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,n),a.copy(this.radiiSquared).scale(n);let o=Math.sqrt(n.dot(a));return a.scale(1/o),n.scale(i),a.add(n),a.to(r)}cartesianToCartographic(t,r=[0,0,0]){OS.from(t);let n=this.scaleToGeodeticSurface(OS,Ts);if(!n)return;let a=this.geodeticSurfaceNormal(n,bve),i=$_t;i.copy(OS).subtract(n);let o=Math.atan2(a.y,a.x),s=Math.asin(a.z),u=Math.sign(Jm.dot(i,OS))*Jm.length(i);return dve([o,s,u],r)}eastNorthUpToFixedFrame(t,r=new mr){return oM(this,"east","north","up",t,r)}localFrameToFixedFrame(t,r,n,a,i=new mr){return oM(this,t,r,n,a,i)}geocentricSurfaceNormal(t,r=[0,0,0]){return FS.from(t).normalize().to(r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=pve(t),a=n[0],i=n[1],o=Math.cos(i);return FS.set(o*Math.cos(a),o*Math.sin(a),Math.sin(i)).normalize(),FS.to(r)}geodeticSurfaceNormal(t,r=[0,0,0]){return FS.from(t).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(t,r){return gve(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){Ts.from(t);let n=Ts.x,a=Ts.y,i=Ts.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(n*n*o.x+a*a*o.y+i*i*o.z);return Ts.multiplyScalar(s).to(r)}transformPositionToScaledSpace(t,r=[0,0,0]){return Ts.from(t).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(t,r=[0,0,0]){return Ts.from(t).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){ca(Yi(this.radii.x,this.radii.y,Es.EPSILON15)),ca(this.radii.z>0),Ts.from(t);let a=Ts.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(a)>=this.radii.z-r))return Ts.set(0,0,a).to(n)}};Ft.WGS84=new Ft(6378137,6378137,$c);var la={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var qnr=new Z,Nnr=new Z;var w1=new Z,vve=new Z,ui=class{constructor(t=[0,0,0],r=0){this.radius=-0,this.center=new Z,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=w1.from(r),this.center=new Z().from(t).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new ui(this.center,this.radius)}union(t){let r=this.center,n=this.radius,a=t.center,i=t.radius,o=w1.copy(a).subtract(r),s=o.magnitude();if(n>=s+i)return this.clone();if(i>=s+n)return t.clone();let u=(n+s+i)*.5;return vve.copy(o).scale((-n+u)/s).add(r),this.center.copy(vve),this.radius=u,this}expand(t){let n=w1.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=kS.getScaling(w1,t);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(t){let r=this.distanceTo(t);return r*r}distanceTo(t){let n=w1.from(t).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(t){let r=this.center,n=this.radius,i=t.normal.dot(r)+t.distance;return i<-n?la.OUTSIDE:i<n?la.INTERSECTING:la.INSIDE}};var W_t=new Z,K_t=new Z,IS=new Z,PS=new Z,RS=new Z,J_t=new Z,X_t=new Z,Wc={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},fa=class{constructor(t=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){this.center=new Z().from(t),this.halfAxes=new nr(r)}get halfSize(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new Z(t).len(),new Z(r).len(),new Z(n).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),a=new Z(t).normalize(),i=new Z(r).normalize(),o=new Z(n).normalize();return new Io().fromMatrix3(new nr([...a,...i,...o]))}fromCenterHalfSizeQuaternion(t,r,n){let a=new Io(n),i=new nr().fromQuaternion(a);return i[0]=i[0]*r[0],i[1]=i[1]*r[0],i[2]=i[2]*r[0],i[3]=i[3]*r[1],i[4]=i[4]*r[1],i[5]=i[5]*r[1],i[6]=i[6]*r[2],i[7]=i[7]*r[2],i[8]=i[8]*r[2],this.center=new Z().from(t),this.halfAxes=i,this}clone(){return new fa(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new ui){let r=this.halfAxes,n=r.getColumn(0,IS),a=r.getColumn(1,PS),i=r.getColumn(2,RS),o=W_t.copy(n).add(a).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let r=this.center,n=t.normal,a=this.halfAxes,i=n.x,o=n.y,s=n.z,u=Math.abs(i*a[Wc.COLUMN0ROW0]+o*a[Wc.COLUMN0ROW1]+s*a[Wc.COLUMN0ROW2])+Math.abs(i*a[Wc.COLUMN1ROW0]+o*a[Wc.COLUMN1ROW1]+s*a[Wc.COLUMN1ROW2])+Math.abs(i*a[Wc.COLUMN2ROW0]+o*a[Wc.COLUMN2ROW1]+s*a[Wc.COLUMN2ROW2]),c=n.dot(r)+t.distance;return c<=-u?la.OUTSIDE:c>=u?la.INSIDE:la.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=K_t.from(t).subtract(this.center),n=this.halfAxes,a=n.getColumn(0,IS),i=n.getColumn(1,PS),o=n.getColumn(2,RS),s=a.magnitude(),u=i.magnitude(),c=o.magnitude();a.normalize(),i.normalize(),o.normalize();let l=0,f;return f=Math.abs(r.dot(a))-s,f>0&&(l+=f*f),f=Math.abs(r.dot(i))-u,f>0&&(l+=f*f),f=Math.abs(r.dot(o))-c,f>0&&(l+=f*f),l}computePlaneDistances(t,r,n=[-0,-0]){let a=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=this.center,s=this.halfAxes,u=s.getColumn(0,IS),c=s.getColumn(1,PS),l=s.getColumn(2,RS),f=J_t.copy(u).add(c).add(l).add(o),p=X_t.copy(f).subtract(t),d=r.dot(p);return a=Math.min(d,a),i=Math.max(d,i),f.copy(o).add(u).add(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),a=Math.min(d,a),i=Math.max(d,i),f.copy(o).add(u).subtract(c).add(l),p.copy(f).subtract(t),d=r.dot(p),a=Math.min(d,a),i=Math.max(d,i),f.copy(o).add(u).subtract(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),a=Math.min(d,a),i=Math.max(d,i),o.copy(f).subtract(u).add(c).add(l),p.copy(f).subtract(t),d=r.dot(p),a=Math.min(d,a),i=Math.max(d,i),o.copy(f).subtract(u).add(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),a=Math.min(d,a),i=Math.max(d,i),o.copy(f).subtract(u).subtract(c).add(l),p.copy(f).subtract(t),d=r.dot(p),a=Math.min(d,a),i=Math.max(d,i),o.copy(f).subtract(u).subtract(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),a=Math.min(d,a),i=Math.max(d,i),n[0]=a,n[1]=i,n}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,IS);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,PS);n.transformAsPoint(t);let a=this.halfAxes.getColumn(2,RS);return a.transformAsPoint(t),this.halfAxes=new nr([...r,...n,...a]),this}getTransform(){throw new Error("not implemented")}};var xve=new Z,yve=new Z,Kc=class{constructor(t=[0,0,1],r=0){this.normal=new Z,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return ca(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=xve.from(t),this.normal.from(r).normalize();let n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,r,n,a){return this.normal.set(t,r,n),ca(Yi(this.normal.len(),1)),this.distance=a,this}clone(){return new Kc(this.normal,this.distance)}equals(t){return Yi(this.distance,t.distance)&&Yi(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=yve.copy(this.normal).transformAsVector(t).normalize(),n=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(n,r)}projectPointOntoPlane(t,r=[0,0,0]){let n=xve.from(t),a=this.getPointDistance(n),i=yve.copy(this.normal).scale(a);return n.subtract(i).to(r)}};var _ve=[new Z([1,0,0]),new Z([0,1,0]),new Z([0,0,1])],wve=new Z,Y_t=new Z,Po=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*_ve.length;let r=t.center,n=t.radius,a=0;for(let i of _ve){let o=this.planes[a],s=this.planes[a+1];o||(o=this.planes[a]=new Kc),s||(s=this.planes[a+1]=new Kc);let u=wve.copy(i).scale(-n).add(r);o.fromPointNormal(u,i);let c=wve.copy(i).scale(n).add(r),l=Y_t.copy(i).negate();s.fromPointNormal(c,l),a+=2}return this}computeVisibility(t){let r=la.INSIDE;for(let n of this.planes)switch(t.intersectPlane(n)){case la.OUTSIDE:return la.OUTSIDE;case la.INTERSECTING:r=la.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(ca(Number.isFinite(r),"parentPlaneMask is required."),r===Po.MASK_OUTSIDE||r===Po.MASK_INSIDE)return r;let n=Po.MASK_INSIDE,a=this.planes;for(let i=0;i<this.planes.length;++i){let o=i<31?1<<i:0;if(i<31&&!(r&o))continue;let s=a[i],u=t.intersectPlane(s);if(u===la.OUTSIDE)return Po.MASK_OUTSIDE;u===la.INTERSECTING&&(n|=o)}return n}};Po.MASK_OUTSIDE=4294967295;Po.MASK_INSIDE=0;Po.MASK_INDETERMINATE=2147483647;var aar=new Z,iar=new Z,oar=new Z,sar=new Z,uar=new Z;var Z_t=new Z,e2t=new Z,t2t=new Z,r2t=new Z,n2t=new Z,a2t=new Z,i2t=new Z,Qm=new Z,o2t=new Z,s2t=new Z,u2t=new Z,c2t=new Z;function sM(e,t=new ui){if(!e||e.length===0)return t.fromCenterRadius([0,0,0],0);let r=i2t.copy(e[0]),n=Z_t.copy(r),a=e2t.copy(r),i=t2t.copy(r),o=r2t.copy(r),s=n2t.copy(r),u=a2t.copy(r);for(let B of e){r.copy(B);let I=r.x,L=r.y,C=r.z;I<n.x&&n.copy(r),I>o.x&&o.copy(r),L<a.y&&a.copy(r),L>s.y&&s.copy(r),C<i.z&&i.copy(r),C>u.z&&u.copy(r)}let c=Qm.copy(o).subtract(n).magnitudeSquared(),l=Qm.copy(s).subtract(a).magnitudeSquared(),f=Qm.copy(u).subtract(i).magnitudeSquared(),p=n,d=o,h=c;l>h&&(h=l,p=a,d=s),f>h&&(h=f,p=i,d=u);let m=o2t;m.x=(p.x+d.x)*.5,m.y=(p.y+d.y)*.5,m.z=(p.z+d.z)*.5;let g=Qm.copy(d).subtract(m).magnitudeSquared(),x=Math.sqrt(g),y=s2t;y.x=n.x,y.y=a.y,y.z=i.z;let w=u2t;w.x=o.x,w.y=s.y,w.z=u.z;let T=c2t.copy(y).add(w).multiplyByScalar(.5),A=0;for(let B of e){r.copy(B);let I=Qm.copy(r).subtract(T).magnitude();I>A&&(A=I);let L=Qm.copy(r).subtract(m).magnitudeSquared();if(L>g){let C=Math.sqrt(L);x=(x+C)*.5,g=x*x;let k=C-x;m.x=(x*m.x+k*r.x)/C,m.y=(x*m.y+k*r.y)/C,m.z=(x*m.z+k*r.z)/C}}return x<A?(m.to(t.center),t.radius=x):(T.to(t.center),t.radius=A),t}var Pu=new nr,l2t=new nr,f2t=new nr,jS=new nr,Ave=new nr;function lM(e,t={}){let r=Es.EPSILON20,n=10,a=0,i=0,o=l2t,s=f2t;o.identity(),s.copy(e);let u=r*p2t(s);for(;i<n&&d2t(s)>u;)h2t(s,jS),Ave.copy(jS).transpose(),s.multiplyRight(jS),s.multiplyLeft(Ave),o.multiplyRight(jS),++a>2&&(++i,a=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=s.toTarget(t.diagonal),t}function p2t(e){let t=0;for(let r=0;r<9;++r){let n=e[r];t+=n*n}return Math.sqrt(t)}var uM=[1,0,0],cM=[2,2,1];function d2t(e){let t=0;for(let r=0;r<3;++r){let n=e[Pu.getElementIndex(cM[r],uM[r])];t+=2*n*n}return Math.sqrt(t)}function h2t(e,t){let r=Es.EPSILON15,n=0,a=1;for(let c=0;c<3;++c){let l=Math.abs(e[Pu.getElementIndex(cM[c],uM[c])]);l>n&&(a=c,n=l)}let i=uM[a],o=cM[a],s=1,u=0;if(Math.abs(e[Pu.getElementIndex(o,i)])>r){let c=e[Pu.getElementIndex(o,o)],l=e[Pu.getElementIndex(i,i)],f=e[Pu.getElementIndex(o,i)],p=(c-l)/2/f,d;p<0?d=-1/(-p+Math.sqrt(1+p*p)):d=1/(p+Math.sqrt(1+p*p)),s=1/Math.sqrt(1+d*d),u=d*s}return nr.IDENTITY.to(t),t[Pu.getElementIndex(i,i)]=t[Pu.getElementIndex(o,o)]=s,t[Pu.getElementIndex(o,i)]=u,t[Pu.getElementIndex(i,o)]=-u,t}var Pf=new Z,g2t=new Z,b2t=new Z,v2t=new Z,x2t=new Z,y2t=new nr,_2t={diagonal:new nr,unitary:new nr};function A1(e,t=new fa){if(!e||e.length===0)return t.halfAxes=new nr([0,0,0,0,0,0,0,0,0]),t.center=new Z,t;let r=e.length,n=new Z(0,0,0);for(let C of e)n.add(C);let a=1/r;n.multiplyByScalar(a);let i=0,o=0,s=0,u=0,c=0,l=0;for(let C of e){let k=Pf.copy(C).subtract(n);i+=k.x*k.x,o+=k.x*k.y,s+=k.x*k.z,u+=k.y*k.y,c+=k.y*k.z,l+=k.z*k.z}i*=a,o*=a,s*=a,u*=a,c*=a,l*=a;let f=y2t;f[0]=i,f[1]=o,f[2]=s,f[3]=o,f[4]=u,f[5]=c,f[6]=s,f[7]=c,f[8]=l;let{unitary:p}=lM(f,_2t),d=t.halfAxes.copy(p),h=d.getColumn(0,b2t),m=d.getColumn(1,v2t),g=d.getColumn(2,x2t),x=-Number.MAX_VALUE,y=-Number.MAX_VALUE,w=-Number.MAX_VALUE,T=Number.MAX_VALUE,A=Number.MAX_VALUE,B=Number.MAX_VALUE;for(let C of e)Pf.copy(C),x=Math.max(Pf.dot(h),x),y=Math.max(Pf.dot(m),y),w=Math.max(Pf.dot(g),w),T=Math.min(Pf.dot(h),T),A=Math.min(Pf.dot(m),A),B=Math.min(Pf.dot(g),B);h=h.multiplyByScalar(.5*(T+x)),m=m.multiplyByScalar(.5*(A+y)),g=g.multiplyByScalar(.5*(B+w)),t.center.copy(h).add(m).add(g);let I=g2t.set(x-T,y-A,w-B).multiplyByScalar(.5),L=new nr([I[0],0,0,0,I[1],0,0,0,I[2]]);return t.halfAxes.multiplyRight(L),t}function kve(e){return e!=null}var Uar=new Z,w2t=new Z,A2t=new Z,E2t=new Z,Td=new Z,Eve=new Z,Tve=new Z,Sve=new Z;function E1(e,t,r){if(yt(e,"3D Tile: boundingVolume must be defined"),e.box)return Cve(e.box,t,r);if(e.region)return S2t(e.region);if(e.sphere)return T2t(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function Cve(e,t,r){let n=new Z(e[0],e[1],e[2]);t.transform(n,n);let a=[];if(e.length===10){let c=e.slice(3,6),l=new Io;l.fromArray(e,6);let f=new Z([1,0,0]),p=new Z([0,1,0]),d=new Z([0,0,1]);f.transformByQuaternion(l),f.scale(c[0]),p.transformByQuaternion(l),p.scale(c[1]),d.transformByQuaternion(l),d.scale(c[2]),a=[...f.toArray(),...p.toArray(),...d.toArray()]}else a=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let i=t.transformAsVector(a.slice(0,3)),o=t.transformAsVector(a.slice(3,6)),s=t.transformAsVector(a.slice(6,9)),u=new nr([i[0],i[1],i[2],o[0],o[1],o[2],s[0],s[1],s[2]]);return kve(r)?(r.center=n,r.halfAxes=u,r):new fa(n,u)}function T2t(e,t,r){let n=new Z(e[0],e[1],e[2]);t.transform(n,n);let a=t.getScale(w2t),i=Math.max(Math.max(a[0],a[1]),a[2]),o=e[3]*i;return kve(r)?(r.center=n,r.radius=o,r):new ui(n,o)}function S2t(e){let[t,r,n,a,i,o]=e,s=Ft.WGS84.cartographicToCartesian([Vc(t),Vc(a),i],A2t),u=Ft.WGS84.cartographicToCartesian([Vc(n),Vc(r),o],E2t),c=new Z().addVectors(s,u).multiplyByScalar(.5);return Ft.WGS84.cartesianToCartographic(c,Td),Ft.WGS84.cartographicToCartesian([Vc(n),Td[1],Td[2]],Eve),Ft.WGS84.cartographicToCartesian([Td[0],Vc(a),Td[2]],Tve),Ft.WGS84.cartographicToCartesian([Td[0],Td[1],o],Sve),Cve([...c,...Eve.subtract(c),...Tve.subtract(c),...Sve.subtract(c)],new mr)}var Zm="4.4.1";var pa={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},$ar=Object.keys(pa),Rf={BATCHED_MODEL:[98,51,100,109],INSTANCED_MODEL:[105,51,100,109],POINT_CLOUD:[112,110,116,115],COMPOSITE:[99,109,112,116]};function fM(e,t,r){yt(e instanceof ArrayBuffer);let n=new TextDecoder("utf8"),a=new Uint8Array(e,t,r);return n.decode(a)}function Dve(e,t=0){let r=new DataView(e);return`${String.fromCharCode(r.getUint8(t+0))}${String.fromCharCode(r.getUint8(t+1))}${String.fromCharCode(r.getUint8(t+2))}${String.fromCharCode(r.getUint8(t+3))}`}var k2t="1.5.6",C2t="1.4.1",pM=`https://www.gstatic.com/draco/versioned/decoders/${k2t}`,Ur={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},Ru={[Ur.DECODER]:`${pM}/${Ur.DECODER}`,[Ur.DECODER_WASM]:`${pM}/${Ur.DECODER_WASM}`,[Ur.FALLBACK_DECODER]:`${pM}/${Ur.FALLBACK_DECODER}`,[Ur.ENCODER]:`https://raw.githubusercontent.com/google/draco/${C2t}/javascript/${Ur.ENCODER}`},dM;async function Fve(e={},t){let r=e.modules||{};return r.draco3d?dM||(dM=r.draco3d.createDecoderModule({}).then(n=>({draco:n}))):dM||(dM=D2t(e,t)),await dM}function Bve(e,t){if(e&&typeof e=="object"){if(e.default)return e.default;if(e[t])return e[t]}return e}async function D2t(e,t){let r,n;switch(t){case"js":r=await yo(Ru[Ur.FALLBACK_DECODER],"draco",e,Ur.FALLBACK_DECODER);break;case"wasm":default:try{[r,n]=await Promise.all([await yo(Ru[Ur.DECODER],"draco",e,Ur.DECODER),await yo(Ru[Ur.DECODER_WASM],"draco",e,Ur.DECODER_WASM)])}catch{r=null,n=null}}return r=Bve(r,"DracoDecoderModule"),r=r||globalThis.DracoDecoderModule,!r&&!Pn&&([r,n]=await Promise.all([await yo(Ru[Ur.DECODER],"draco",{...e,useLocalLibraries:!0},Ur.DECODER),await yo(Ru[Ur.DECODER_WASM],"draco",{...e,useLocalLibraries:!0},Ur.DECODER_WASM)]),r=Bve(r,"DracoDecoderModule"),r=r||globalThis.DracoDecoderModule),await B2t(r,n)}function B2t(e,t){if(typeof e!="function")throw new Error("DracoDecoderModule could not be loaded");let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e({...r,onModuleLoaded:a=>n({draco:a})})})}var LS="4.4.1";var MS={id:"draco-writer",name:"Draco compressed geometry writer",module:"draco",version:LS,worker:!0,options:{draco:{},source:null}};function Ive(e,t,r){let n=Pve(t.metadata),a=[],i=F2t(t.attributes);for(let o in e){let s=e[o],u=Ove(o,s,i[o]);a.push(u)}if(r){let o=Ove("indices",r);a.push(o)}return{fields:a,metadata:n}}function F2t(e){let t={};for(let r in e){let n=e[r];t[n.name||"undefined"]=n}return t}function Ove(e,t,r){let n=r?Pve(r.metadata):void 0;return wL(e,t,n)}function Pve(e){Object.entries(e);let t={};for(let r in e)t[`${r}.string`]=JSON.stringify(e[r]);return t}var Rve={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},O2t={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},I2t=4,T1=class{draco;decoder;metadataQuerier;constructor(t){this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t,r={}){let n=new this.draco.DecoderBuffer;n.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(r);let a=this.decoder.GetEncodedGeometryType(n),i=a===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(a){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(n,i);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(n,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!i.ptr){let p=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(p)}let s=this._getDracoLoaderData(i,a,r),u=this._getMeshData(i,s,r),c=_L(u.attributes),l=Ive(u.attributes,s,u.indices);return{loader:"draco",loaderData:s,header:{vertexCount:i.num_points(),boundingBox:c},...u,schema:l}}finally{this.draco.destroy(n),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,r,n){let a=this._getTopLevelMetadata(t),i=this._getDracoAttributes(t,n);return{geometry_type:r,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:a,attributes:i}}_getDracoAttributes(t,r){let n={};for(let a=0;a<t.num_attributes();a++){let i=this.decoder.GetAttribute(t,a),o=this._getAttributeMetadata(t,a);n[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:a,metadata:o};let s=this._getQuantizationTransform(i,r);s&&(n[i.unique_id()].quantization_transform=s);let u=this._getOctahedronTransform(i,r);u&&(n[i.unique_id()].octahedron_transform=u)}return n}_getMeshData(t,r,n){let a=this._getMeshAttributes(r,t,n);if(!a.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(n.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:a,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:a,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:a}}_getMeshAttributes(t,r,n){let a={};for(let i of Object.values(t.attributes)){let o=this._deduceAttributeName(i,n);i.name=o;let s=this._getAttributeValues(r,i);if(s){let{value:u,size:c}=s;a[o]={value:u,size:c,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}}return a}_getTriangleListIndices(t){let n=t.num_faces()*3,a=n*I2t,i=this.draco._malloc(a);try{return this.decoder.GetTrianglesUInt32Array(t,a,i),new Uint32Array(this.draco.HEAPF32.buffer,i,n).slice()}finally{this.draco._free(i)}}_getTriangleStripIndices(t){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,r),j2t(r)}finally{this.draco.destroy(r)}}_getAttributeValues(t,r){let n=O2t[r.data_type];if(!n)return console.warn(`DRACO: Unsupported attribute type ${r.data_type}`),null;let a=r.num_components,o=t.num_points()*a,s=o*n.BYTES_PER_ELEMENT,u=P2t(this.draco,n),c,l=this.draco._malloc(s);try{let f=this.decoder.GetAttribute(t,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,f,u,s,l),c=new n(this.draco.HEAPF32.buffer,l,o).slice()}finally{this.draco._free(l)}return{value:c,size:a}}_deduceAttributeName(t,r){let n=t.unique_id;for(let[o,s]of Object.entries(r.extraAttributes||{}))if(s===n)return o;let a=t.attribute_type;for(let o in Rve)if(this.draco[o]===a)return Rve[o];let i=r.attributeNameEntry||"name";return t.metadata[i]?t.metadata[i].string:`CUSTOM_ATTRIBUTE_${n}`}_getTopLevelMetadata(t){let r=this.decoder.GetMetadata(t);return this._getDracoMetadata(r)}_getAttributeMetadata(t,r){let n=this.decoder.GetAttributeMetadata(t,r);return this._getDracoMetadata(n)}_getDracoMetadata(t){if(!t||!t.ptr)return{};let r={},n=this.metadataQuerier.NumEntries(t);for(let a=0;a<n;a++){let i=this.metadataQuerier.GetEntryName(t,a);r[i]=this._getDracoMetadataField(t,i)}return r}_getDracoMetadataField(t,r){let n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,r,n);let a=R2t(n);return{int:this.metadataQuerier.GetIntEntry(t,r),string:this.metadataQuerier.GetStringEntry(t,r),double:this.metadataQuerier.GetDoubleEntry(t,r),intArray:a}}finally{this.draco.destroy(n)}}_disableAttributeTransforms(t){let{quantizedAttributes:r=[],octahedronAttributes:n=[]}=t,a=[...r,...n];for(let i of a)this.decoder.SkipAttributeTransform(this.draco[i])}_getQuantizationTransform(t,r){let{quantizedAttributes:n=[]}=r,a=t.attribute_type();if(n.map(o=>this.decoder[o]).includes(a)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:new Float32Array([1,2,3]).map(s=>o.min_value(s))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(t,r){let{octahedronAttributes:n=[]}=r,a=t.attribute_type();if(n.map(o=>this.decoder[o]).includes(a)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function P2t(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32;default:return e.DT_INVALID}}function R2t(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}function j2t(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}var jve={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:LS,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",extraAttributes:{},attributeNameEntry:void 0}}},Sd={...jve,parse:L2t};async function L2t(e,t){var a;let{draco:r}=await Fve(Lv(t),((a=t==null?void 0:t.draco)==null?void 0:a.decoderType)||"wasm"),n=new T1(r);try{return n.parseSync(e,t==null?void 0:t.draco)}finally{n.destroy()}}var M2t={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Tn={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},ht={...M2t,...Tn};var hM={[Tn.DOUBLE]:Float64Array,[Tn.FLOAT]:Float32Array,[Tn.UNSIGNED_SHORT]:Uint16Array,[Tn.UNSIGNED_INT]:Uint32Array,[Tn.UNSIGNED_BYTE]:Uint8Array,[Tn.BYTE]:Int8Array,[Tn.SHORT]:Int16Array,[Tn.INT]:Int32Array},q2t={DOUBLE:Tn.DOUBLE,FLOAT:Tn.FLOAT,UNSIGNED_SHORT:Tn.UNSIGNED_SHORT,UNSIGNED_INT:Tn.UNSIGNED_INT,UNSIGNED_BYTE:Tn.UNSIGNED_BYTE,BYTE:Tn.BYTE,SHORT:Tn.SHORT,INT:Tn.INT},mM="Failed to convert GL type",Jn=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let r in hM)if(hM[r]===t)return r;throw new Error(mM)}static fromName(t){let r=q2t[t];if(!r)throw new Error(mM);return r}static getArrayType(t){switch(t){case Tn.UNSIGNED_SHORT_5_6_5:case Tn.UNSIGNED_SHORT_4_4_4_4:case Tn.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let r=hM[t];if(!r)throw new Error(mM);return r}}static getByteSize(t){return Jn.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(Jn.getArrayType(t))}static createTypedArray(t,r,n=0,a){a===void 0&&(a=(r.byteLength-n)/Jn.getByteSize(t));let i=ArrayBuffer.isView(r)?r.buffer:r,o=Jn.getArrayType(t);return new o(i,n,a)}};function Lve(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function gM(e,t=[0,0,0]){let r=e>>11&31,n=e>>5&63,a=e&31;return t[0]=r<<3,t[1]=n<<2,t[2]=a<<3,t}var Air=1/256;var Eir=new wd,Tir=new Z,Sir=new wd,kir=new wd,Cir=new Uint8Array(1);function Mve(e,t=255){return SL(e,0,t)/t*2-1}function qve(e){return e<0?-1:1}function Nve(e,t,r,n){if(Lve(n),e<0||e>r||t<0||t>r)throw new Error(`x and y must be unsigned normalized integers between 0 and ${r}`);if(n.x=Mve(e,r),n.y=Mve(t,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){let a=n.x;n.x=(1-Math.abs(n.y))*qve(a),n.y=(1-Math.abs(a))*qve(n.y)}return n.normalize()}function bM(e,t,r){return Nve(e,t,255,r)}function qS(e){return(e%1+1)%1}var Jc=class{json;buffer;featuresLength=0;_cachedTypedArrays={};constructor(t,r){this.json=t,this.buffer=r}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t,r=ht.UNSIGNED_INT,n=1){let a=this.json[t];return a&&Number.isFinite(a.byteOffset)?this._getTypedArrayFromBinary(t,r,n,1,a.byteOffset):a}getPropertyArray(t,r,n){let a=this.json[t];return a&&Number.isFinite(a.byteOffset)?("componentType"in a&&(r=Jn.fromName(a.componentType)),this._getTypedArrayFromBinary(t,r,n,this.featuresLength,a.byteOffset)):this._getTypedArrayFromArray(t,r,a)}getProperty(t,r,n,a,i){let o=this.json[t];if(!o)return o;let s=this.getPropertyArray(t,r,n);if(n===1)return s[a];for(let u=0;u<n;++u)i[u]=s[n*a+u];return i}_getTypedArrayFromBinary(t,r,n,a,i){let o=this._cachedTypedArrays,s=o[t];return s||(s=Jn.createTypedArray(r,this.buffer.buffer,this.buffer.byteOffset+i,a*n),o[t]=s),s}_getTypedArrayFromArray(t,r,n){let a=this._cachedTypedArrays,i=a[t];if(!i){if(ArrayBuffer.isView(n)){let o=n.byteOffset,u=n.byteLength/Jn.getByteSize(r);i=Jn.createTypedArray(r,n.buffer,o,u)}else if(n instanceof ArrayBuffer)i=Jn.createTypedArray(r,n);else{let o=Jn.getArrayType(r);i=new o(n)}a[t]=i}return i}};var N2t={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},U2t={SCALAR:(e,t)=>e[t],VEC2:(e,t)=>[e[2*t+0],e[2*t+1]],VEC3:(e,t)=>[e[3*t+0],e[3*t+1],e[3*t+2]],VEC4:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT2:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT3:(e,t)=>[e[9*t+0],e[9*t+1],e[9*t+2],e[9*t+3],e[9*t+4],e[9*t+5],e[9*t+6],e[9*t+7],e[9*t+8]],MAT4:(e,t)=>[e[16*t+0],e[16*t+1],e[16*t+2],e[16*t+3],e[16*t+4],e[16*t+5],e[16*t+6],e[16*t+7],e[16*t+8],e[16*t+9],e[16*t+10],e[16*t+11],e[16*t+12],e[16*t+13],e[16*t+14],e[16*t+15]]},z2t={SCALAR:(e,t,r)=>{t[r]=e},VEC2:(e,t,r)=>{t[2*r+0]=e[0],t[2*r+1]=e[1]},VEC3:(e,t,r)=>{t[3*r+0]=e[0],t[3*r+1]=e[1],t[3*r+2]=e[2]},VEC4:(e,t,r)=>{t[4*r+0]=e[0],t[4*r+1]=e[1],t[4*r+2]=e[2],t[4*r+3]=e[3]},MAT2:(e,t,r)=>{t[4*r+0]=e[0],t[4*r+1]=e[1],t[4*r+2]=e[2],t[4*r+3]=e[3]},MAT3:(e,t,r)=>{t[9*r+0]=e[0],t[9*r+1]=e[1],t[9*r+2]=e[2],t[9*r+3]=e[3],t[9*r+4]=e[4],t[9*r+5]=e[5],t[9*r+6]=e[6],t[9*r+7]=e[7],t[9*r+8]=e[8],t[9*r+9]=e[9]},MAT4:(e,t,r)=>{t[16*r+0]=e[0],t[16*r+1]=e[1],t[16*r+2]=e[2],t[16*r+3]=e[3],t[16*r+4]=e[4],t[16*r+5]=e[5],t[16*r+6]=e[6],t[16*r+7]=e[7],t[16*r+8]=e[8],t[16*r+9]=e[9],t[16*r+10]=e[10],t[16*r+11]=e[11],t[16*r+12]=e[12],t[16*r+13]=e[13],t[16*r+14]=e[14],t[16*r+15]=e[15]}};function Uve(e,t,r,n){let{componentType:a}=e;yt(e.componentType);let i=typeof a=="string"?Jn.fromName(a):a,o=N2t[e.type],s=U2t[e.type],u=z2t[e.type];return r+=e.byteOffset,{values:Jn.createTypedArray(i,t,r,o*n),type:i,size:o,unpacker:s,packer:u}}var ju=e=>e!==void 0;function zve(e,t,r){if(!t)return null;let n=e.getExtension("3DTILES_batch_table_hierarchy"),a=t.HIERARCHY;return a&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=a,n=a),n?G2t(n,r):null}function G2t(e,t){let r,n,a,i=e.instancesLength,o=e.classes,s=e.classIds,u=e.parentCounts,c=e.parentIds,l=i;ju(s.byteOffset)&&(s.componentType=defaultValue(s.componentType,GL.UNSIGNED_SHORT),s.type=AttributeType.SCALAR,a=getBinaryAccessor(s),s=a.createArrayBufferView(t.buffer,t.byteOffset+s.byteOffset,i));let f;if(ju(u))for(ju(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,GL.UNSIGNED_SHORT),u.type=AttributeType.SCALAR,a=getBinaryAccessor(u),u=a.createArrayBufferView(t.buffer,t.byteOffset+u.byteOffset,i)),f=new Uint16Array(i),l=0,r=0;r<i;++r)f[r]=l,l+=u[r];ju(c)&&ju(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,a=getBinaryAccessor(c),c=a.createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,l));let p=o.length;for(r=0;r<p;++r){let g=o[r].length,x=o[r].instances,y=getBinaryProperties(g,x,t);o[r].instances=combine(y,x)}let d=new Array(p).fill(0),h=new Uint16Array(i);for(r=0;r<i;++r)n=s[r],h[r]=d[n],++d[n];let m={classes:o,classIds:s,classIndexes:h,parentCounts:u,parentIndexes:f,parentIds:c};return $2t(m),m}function eg(e,t,r){if(!e)return;let n=e.parentCounts;return e.parentIds?r(e,t):n>0?H2t(e,t,r):V2t(e,t,r)}function H2t(e,t,r){let n=e.classIds,a=e.parentCounts,i=e.parentIds,o=e.parentIndexes,s=n.length,u=scratchVisited;u.length=Math.max(u.length,s);let c=++marker,l=scratchStack;for(l.length=0,l.push(t);l.length>0;){if(t=l.pop(),u[t]===c)continue;u[t]=c;let f=r(e,t);if(ju(f))return f;let p=a[t],d=o[t];for(let h=0;h<p;++h){let m=i[d+h];m!==t&&l.push(m)}}return null}function V2t(e,t,r){let n=!0;for(;n;){let a=r(e,t);if(ju(a))return a;let i=e.parentIds[t];n=i!==t,t=i}throw new Error("traverseHierarchySingleParent")}function $2t(e){let t=[],n=e.classIds.length;for(let a=0;a<n;++a)Gve(e,a,stack)}function Gve(e,t,r){let n=e.parentCounts,a=e.parentIds,i=e.parentIndexes,s=e.classIds.length;if(!ju(a))return;assert(t<s,`Parent index ${t} exceeds the total number of instances: ${s}`),assert(r.indexOf(t)===-1,"Circular dependency detected in the batch table hierarchy."),r.push(t);let u=ju(n)?n[t]:1,c=ju(n)?i[t]:t;for(let l=0;l<u;++l){let f=a[c+l];f!==t&&Gve(e,f,r)}r.pop(t)}function Di(e){return e!=null}var NS=(e,t)=>e,W2t={HIERARCHY:!0,extensions:!0,extras:!0},kd=class{json;binary;featureCount;_extensions;_properties;_binaryProperties;_hierarchy;constructor(t,r,n,a={}){var i;yt(n>=0),this.json=t||{},this.binary=r,this.featureCount=n,this._extensions=((i=this.json)==null?void 0:i.extensions)||{},this._properties={};for(let o in this.json)W2t[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),a["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=zve(this,this.json,this.binary))}getExtension(t){return this.json&&this.json.extensions&&this.json.extensions[t]}memorySizeInBytes(){return 0}isClass(t,r){if(this._checkBatchId(t),yt(typeof r=="string",r),this._hierarchy){let n=eg(this._hierarchy,t,(a,i)=>{let o=a.classIds[i];return a.classes[o].name===r});return Di(n)}return!1}isExactClass(t,r){return yt(typeof r=="string",r),this.getExactClassName(t)===r}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){let r=this._hierarchy.classIds[t];return this._hierarchy.classes[r].name}}hasProperty(t,r){return this._checkBatchId(t),yt(typeof r=="string",r),Di(this._properties[r])||this._hasPropertyInHierarchy(t,r)}getPropertyNames(t,r){this._checkBatchId(t),r=Di(r)?r:[],r.length=0;let n=Object.keys(this._properties);return r.push(...n),this._hierarchy&&this._getPropertyNamesInHierarchy(t,r),r}getProperty(t,r){if(this._checkBatchId(t),yt(typeof r=="string",r),this._binaryProperties){let a=this._binaryProperties[r];if(Di(a))return this._getBinaryProperty(a,t)}let n=this._properties[r];if(Di(n))return NS(n[t],!0);if(this._hierarchy){let a=this._getHierarchyProperty(t,r);if(Di(a))return a}}setProperty(t,r,n){let a=this.featureCount;if(this._checkBatchId(t),yt(typeof r=="string",r),this._binaryProperties){let o=this._binaryProperties[r];if(o){this._setBinaryProperty(o,t,n);return}}if(this._hierarchy&&this._setHierarchyProperty(this,t,r,n))return;let i=this._properties[r];Di(i)||(this._properties[r]=new Array(a),i=this._properties[r]),i[t]=NS(n,!0)}_checkBatchId(t){if(!(t>=0&&t<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(t,r){return t.unpack(t.typedArray,r)}_setBinaryProperty(t,r,n){t.pack(n,t.typedArray,r)}_initializeBinaryProperties(){let t=null;for(let r in this._properties){let n=this._properties[r],a=this._initializeBinaryProperty(r,n);a&&(t=t||{},t[r]=a)}return t}_initializeBinaryProperty(t,r){if("byteOffset"in r){let n=r;yt(this.binary,`Property ${t} requires a batch table binary.`),yt(n.type,`Property ${t} requires a type.`);let a=Uve(n,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:a.values,componentCount:a.size,unpack:a.unpacker,pack:a.packer}}return null}_hasPropertyInHierarchy(t,r){if(!this._hierarchy)return!1;let n=eg(this._hierarchy,t,(a,i)=>{let o=a.classIds[i],s=a.classes[o].instances;return Di(s[r])});return Di(n)}_getPropertyNamesInHierarchy(t,r){eg(this._hierarchy,t,(n,a)=>{let i=n.classIds[a],o=n.classes[i].instances;for(let s in o)o.hasOwnProperty(s)&&r.indexOf(s)===-1&&r.push(s)})}_getHierarchyProperty(t,r){return eg(this._hierarchy,t,(n,a)=>{let i=n.classIds[a],o=n.classes[i],s=n.classIndexes[a],u=o.instances[r];return Di(u)?Di(u.typedArray)?this._getBinaryProperty(u,s):NS(u[s],!0):null})}_setHierarchyProperty(t,r,n,a){let i=eg(this._hierarchy,r,(o,s)=>{let u=o.classIds[s],c=o.classes[u],l=o.classIndexes[s],f=c.instances[n];return Di(f)?(yt(s===r,`Inherited property "${n}" is read-only.`),Di(f.typedArray)?this._setBinaryProperty(f,l,a):f[l]=NS(a,!0),!0):!1});return Di(i)}};var vM=4;function jf(e,t,r=0){let n=new DataView(t);if(e.magic=n.getUint32(r,!0),r+=vM,e.version=n.getUint32(r,!0),r+=vM,e.byteLength=n.getUint32(r,!0),r+=vM,e.version!==1)throw new Error(`3D Tile Version ${e.version} not supported`);return r}var tg=4,Hve="b3dm tile in legacy format.";function rg(e,t,r){let n=new DataView(t),a;e.header=e.header||{};let i=n.getUint32(r,!0);r+=tg;let o=n.getUint32(r,!0);r+=tg;let s=n.getUint32(r,!0);r+=tg;let u=n.getUint32(r,!0);return r+=tg,s>=570425344?(r-=tg*2,a=i,s=o,u=0,i=0,o=0,console.warn(Hve)):u>=570425344&&(r-=tg,a=s,s=i,u=o,i=0,o=0,console.warn(Hve)),e.header.featureTableJsonByteLength=i,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=u,e.header.batchLength=a,r}function ng(e,t,r,n){return r=K2t(e,t,r,n),r=J2t(e,t,r,n),r}function K2t(e,t,r,n){let{featureTableJsonByteLength:a,featureTableBinaryByteLength:i,batchLength:o}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:o||0},a&&a>0){let s=fM(t,r,a);e.featureTableJson=JSON.parse(s)}return r+=a||0,e.featureTableBinary=new Uint8Array(t,r,i),r+=i||0,r}function J2t(e,t,r,n){let{batchTableJsonByteLength:a,batchTableBinaryByteLength:i}=e.header||{};if(a&&a>0){let o=fM(t,r,a);e.batchTableJson=JSON.parse(o),r+=a,i&&i>0&&(e.batchTableBinary=new Uint8Array(t,r,i),e.batchTableBinary=new Uint8Array(e.batchTableBinary),r+=i)}return r}function xM(e,t,r){if(!t&&(!e||!e.batchIds||!r))return null;let{batchIds:n,isRGB565:a,pointCount:i=0}=e;if(n&&r){let o=new Uint8ClampedArray(i*3);for(let s=0;s<i;s++){let u=n[s],l=r.getProperty(u,"dimensions").map(f=>f*255);o[s*3]=l[0],o[s*3+1]=l[1],o[s*3+2]=l[2]}return{type:ht.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}if(t&&a){let o=new Uint8ClampedArray(i*3);for(let s=0;s<i;s++){let u=gM(t[s]);o[s*3]=u[0],o[s*3+1]=u[1],o[s*3+2]=u[2]}return{type:ht.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}return t&&t.length===i*3?{type:ht.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:ht.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var Vve=new Z;function $ve(e,t){if(!t)return null;if(e.isOctEncoded16P){let r=new Float32Array((e.pointsLength||0)*3);for(let n=0;n<(e.pointsLength||0);n++)bM(t[n*2],t[n*2+1],Vve),Vve.toArray(r,n*3);return{type:ht.FLOAT,size:2,value:r}}return{type:ht.FLOAT,size:2,value:t}}function Wve(e,t,r){return e.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,X2t(e,t)):{type:ht.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function X2t(e,t){let r=new Z,n=new Float32Array(e.pointCount*3);for(let a=0;a<e.pointCount;a++)r.set(t[a*3],t[a*3+1],t[a*3+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(n,a*3);return n}async function Kve(e,t,r,n,a){r=jf(e,t,r),r=rg(e,t,r),r=ng(e,t,r,n),Y2t(e);let{featureTable:i,batchTable:o}=Q2t(e);return await nwt(e,i,o,n,a),Z2t(e,i,n),ewt(e,i,o),twt(e,i),r}function Y2t(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function Q2t(e){let t=new Jc(e.featureTableJson,e.featureTableBinary),r=t.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(r))throw new Error("POINTS_LENGTH must be defined");t.featuresLength=r,e.featuresLength=r,e.pointsLength=r,e.pointCount=r,e.rtcCenter=t.getGlobalProperty("RTC_CENTER",ht.FLOAT,3);let n=rwt(e,t);return{featureTable:t,batchTable:n}}function Z2t(e,t,r){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.positions){if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",ht.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let n=t.getPropertyArray("POSITION_QUANTIZED",ht.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",ht.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",ht.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=Wve(e,n,r)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function ewt(e,t,r){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.colors){let n=null;t.hasProperty("RGBA")?(n=t.getPropertyArray("RGBA",ht.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?n=t.getPropertyArray("RGB",ht.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(n=t.getPropertyArray("RGB565",ht.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=xM(e,n,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",ht.UNSIGNED_BYTE,4))}function twt(e,t){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.normals){let r=null;t.hasProperty("NORMAL")?r=t.getPropertyArray("NORMAL",ht.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",ht.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=$ve(e,r)}}function rwt(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",ht.UNSIGNED_SHORT,1),e.batchIds)){let n=t.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:a,batchTableBinary:i}=e;r=new kd(a,i,n)}return r}async function nwt(e,t,r,n,a){let i,o,s,u=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];u&&(s=u.properties);let c=t.getExtension("3DTILES_draco_point_compression");if(c){o=c.properties;let f=c.byteOffset,p=c.byteLength;if(!o||!Number.isFinite(f)||!p)throw new Error("Draco properties, byteOffset, and byteLength must be defined");i=(e.featureTableBinary||[]).slice(f,f+p),e.hasPositions=Number.isFinite(o.POSITION),e.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),e.hasNormals=Number.isFinite(o.NORMAL),e.hasBatchIds=Number.isFinite(o.BATCH_ID),e.isTranslucent=Number.isFinite(o.RGBA)}if(!i)return!0;let l={buffer:i,properties:{...o,...s},featureTableProperties:o,batchTableProperties:s,dequantizeInShader:!1};return await awt(e,l,n,a)}async function awt(e,t,r,n){if(!n)return;let a={...r,draco:{...r==null?void 0:r.draco,extraAttributes:t.batchTableProperties||{}}};delete a["3d-tiles"];let i=await Hi(t.buffer,Sd,a,n),o=i.attributes.POSITION&&i.attributes.POSITION.value,s=i.attributes.COLOR_0&&i.attributes.COLOR_0.value,u=i.attributes.NORMAL&&i.attributes.NORMAL.value,c=i.attributes.BATCH_ID&&i.attributes.BATCH_ID.value,l=o&&i.attributes.POSITION.value.quantization,f=u&&i.attributes.NORMAL.value.quantization;if(l){let d=i.POSITION.data.quantization,h=d.range;e.quantizedVolumeScale=new Z(h,h,h),e.quantizedVolumeOffset=new Z(d.minValues),e.quantizedRange=(1<<d.quantizationBits)-1,e.isQuantizedDraco=!0}f&&(e.octEncodedRange=(1<<i.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let p={};if(t.batchTableProperties)for(let d of Object.keys(t.batchTableProperties))i.attributes[d]&&i.attributes[d].value&&(p[d.toLowerCase()]=i.attributes[d].value);e.attributes={positions:o,colors:xM(e,s,void 0),normals:u,batchIds:c,...p}}var ZS={};Fa(ZS,{createExtMeshFeatures:()=>QS,decode:()=>zwt,encode:()=>Gwt,name:()=>YS});var US="4.4.1";var Jve,iwt=(Jve=globalThis.loaders)==null?void 0:Jve.parseImageNode,yM=typeof Image<"u",_M=typeof ImageBitmap<"u",owt=Boolean(iwt),wM=pr?!0:owt;function Xve(e){switch(e){case"auto":return _M||yM||wM;case"imagebitmap":return _M;case"image":return yM;case"data":return wM;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Yve(){if(_M)return"imagebitmap";if(yM)return"image";if(wM)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Qve(e){let t=swt(e);if(!t)throw new Error("Not an image");return t}function AM(e){return ag(e)}function ag(e){switch(Qve(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function swt(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 uwt=/^data:image\/svg\+xml/,cwt=/\.svg((\?|#).*)?$/;function zS(e){return e&&(uwt.test(e)||cwt.test(e))}function Zve(e,t){if(zS(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return EM(e,t)}function EM(e,t){if(zS(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function GS(e,t,r){let n=Zve(e,r),a=self.URL||self.webkitURL,i=typeof n!="string"&&a.createObjectURL(n);try{return await lwt(i||n,t)}finally{i&&a.revokeObjectURL(i)}}async function lwt(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,a)=>{try{r.onload=()=>n(r),r.onerror=i=>{let o=i instanceof Error?i.message:"error";a(new Error(o))}}catch(i){a(i)}})}var exe=!0;async function txe(e,t,r){let n;zS(r)?n=await GS(e,t,r):n=EM(e,r);let a=t&&t.imagebitmap;return await fwt(n,a)}async function fwt(e,t=null){if((pwt(t)||!exe)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),exe=!1}return await createImageBitmap(e)}function pwt(e){if(!e)return!0;for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function rxe(e){return!gwt(e,"ftyp",4)||!(e[8]&96)?null:dwt(e)}function dwt(e){switch(hwt(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function hwt(e,t,r){return String.fromCharCode(...e.slice(t,r))}function mwt(e){return[...e].map(t=>t.charCodeAt(0))}function gwt(e,t,r=0){let n=mwt(t);for(let a=0;a<n.length;++a)if(n[a]!==e[a+r])return!1;return!0}var Lu=!1,S1=!0;function Cd(e){let t=k1(e);return vwt(t)||_wt(t)||xwt(t)||ywt(t)||bwt(t)}function bwt(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=rxe(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function vwt(e){let t=k1(e);return t.byteLength>=24&&t.getUint32(0,Lu)===2303741511?{mimeType:"image/png",width:t.getUint32(16,Lu),height:t.getUint32(20,Lu)}:null}function xwt(e){let t=k1(e);return t.byteLength>=10&&t.getUint32(0,Lu)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,S1),height:t.getUint16(8,S1)}:null}function ywt(e){let t=k1(e);return t.byteLength>=14&&t.getUint16(0,Lu)===16973&&t.getUint32(2,S1)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,S1),height:t.getUint32(22,S1)}:null}function _wt(e){let t=k1(e);if(!(t.byteLength>=3&&t.getUint16(0,Lu)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:a}=wwt(),i=2;for(;i+9<t.byteLength;){let o=t.getUint16(i,Lu);if(a.has(o))return{mimeType:"image/jpeg",height:t.getUint16(i+5,Lu),width:t.getUint16(i+7,Lu)};if(!n.has(o))return null;i+=2,i+=t.getUint16(i,Lu)}return null}function wwt(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function k1(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 nxe(e,t){var a;let{mimeType:r}=Cd(e)||{},n=(a=globalThis.loaders)==null?void 0:a.parseImageNode;return yt(n),await n(e,r)}async function axe(e,t,r){t=t||{};let a=(t.image||{}).type||"auto",{url:i}=r||{},o=Awt(a),s;switch(o){case"imagebitmap":s=await txe(e,t,i);break;case"image":s=await GS(e,t,i);break;case"data":s=await nxe(e,t);break;default:yt(!1)}return a==="data"&&(s=ag(s)),s}function Awt(e){switch(e){case"auto":case"data":return Yve();default:return Xve(e),e}}var Ewt=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Twt=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Swt={image:{type:"auto",decode:!0}},ig={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:US,mimeTypes:Twt,extensions:Ewt,parse:axe,tests:[e=>Boolean(Cd(new DataView(e)))],options:Swt};var sxe,ixe=(sxe=globalThis.loaders)==null?void 0:sxe.encodeImageNode;async function uxe(e,t){return t=t||{},t.image=t.image||{},ixe?ixe(e,{type:t.image.mimeType}):kwt(e,t)}var oxe=!0;async function kwt(e,t){let{mimeType:r,jpegQuality:n}=t.image,{width:a,height:i}=AM(e),o=document.createElement("canvas");o.width=a,o.height=i,Cwt(e,o);let s=await new Promise(u=>{if(n&&oxe)try{o.toBlob(u,r,n);return}catch{oxe=!1}o.toBlob(u,r)});if(!s)throw new Error("image encoding failed");return await s.arrayBuffer()}function Cwt(e,t,r=0,n=0){if(r===0&&n===0&&typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let i=t.getContext("bitmaprenderer");if(i)return i.transferFromImageBitmap(e),t}let a=t.getContext("2d");if(e.data){let i=new Uint8ClampedArray(e.data),o=new ImageData(i,e.width,e.height);return a.putImageData(o,0,0),t}return a.drawImage(e,0,0),t}var TM={name:"Images",id:"image",module:"images",version:US,extensions:["jpeg"],mimeTypes:[],options:{image:{mimeType:"image/png",jpegQuality:null}},encode:uxe};var SM={};function kM(e){if(SM[e]===void 0){let t=pr?Bwt(e):Dwt(e);SM[e]=t}return SM[e]}function Dwt(e){var a,i;let t=["image/png","image/jpeg","image/gif"],r=((a=globalThis.loaders)==null?void 0:a.imageFormatsNode)||t,n=(i=globalThis.loaders)==null?void 0:i.parseImageNode;return Boolean(n)&&r.includes(e)}function Bwt(e){switch(e){case"image/avif":case"image/webp":return Fwt(e);default:return!0}}function Fwt(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}function Xn(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var HS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},VS={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var Owt=1.33,cxe=["SCALAR","VEC2","VEC3","VEC4"],Iwt=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],Pwt=new Map(Iwt),Rwt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},jwt={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Lwt={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function $S(e){return cxe[e-1]||cxe[0]}function Lf(e){let t=Pwt.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function og(e,t){let r=Lwt[e.componentType],n=Rwt[e.type],a=jwt[e.componentType],i=e.count*n,o=e.count*n*a;Xn(o>=0&&o<=t.byteLength);let s=VS[e.componentType],u=HS[e.type];return{ArrayType:r,length:i,byteLength:o,componentByteSize:s,numberOfComponentsInElement:u}}function C1(e){let{images:t,bufferViews:r}=e;t=t||[],r=r||[];let n=t.map(o=>o.bufferView);r=r.filter(o=>!n.includes(o));let a=r.reduce((o,s)=>o+s.byteLength,0),i=t.reduce((o,s)=>{let{width:u,height:c}=s.image;return o+u*c},0);return a+Math.ceil(4*i*Owt)}function lxe(e,t,r){let n=e.bufferViews[r];Xn(n);let a=n.buffer,i=t[a];Xn(i);let o=(n.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,o,n.byteLength)}function fxe(e,t,r){var m,g;let n=typeof r=="number"?(m=e.accessors)==null?void 0:m[r]:r;if(!n)throw new Error(`No gltf accessor ${JSON.stringify(r)}`);let a=(g=e.bufferViews)==null?void 0:g[n.bufferView||0];if(!a)throw new Error(`No gltf buffer view for accessor ${a}`);let{arrayBuffer:i,byteOffset:o}=t[a.buffer],s=(o||0)+(n.byteOffset||0)+(a.byteOffset||0),{ArrayType:u,length:c,componentByteSize:l,numberOfComponentsInElement:f}=og(n,a),p=l*f,d=a.byteStride||p;if(typeof a.byteStride>"u"||a.byteStride===p)return new u(i,s,c);let h=new u(c);for(let x=0;x<n.count;x++){let y=new u(i,s+x*d,f);h.set(y,x*f)}return h}function Mwt(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var Xt=class{gltf;sourceBuffers;byteLength;constructor(t){this.gltf={json:(t==null?void 0:t.json)||Mwt(),buffers:(t==null?void 0:t.buffers)||[],images:(t==null?void 0:t.images)||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}hasExtension(t){let r=this.getUsedExtensions().find(a=>a===t),n=this.getRequiredExtensions().find(a=>a===t);return typeof r=="string"||typeof n=="string"}getExtension(t){let r=this.getUsedExtensions().find(a=>a===t),n=this.json.extensions||{};return r?n[t]:null}getRequiredExtension(t){return this.getRequiredExtensions().find(n=>n===t)?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(t,r){return(t.extensions||{})[r]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,r){if(typeof r=="object")return r;let n=this.json[t]&&this.json[t][r];if(!n)throw new Error(`glTF file error: Could not find ${t}[${r}]`);return n}getTypedArrayForBufferView(t){t=this.getBufferView(t);let r=t.buffer,n=this.gltf.buffers[r];Xn(n);let a=(t.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,a,t.byteLength)}getTypedArrayForAccessor(t){let r=this.getAccessor(t);return fxe(this.gltf.json,this.gltf.buffers,r)}getTypedArrayForImageData(t){t=this.getAccessor(t);let r=this.getBufferView(t.bufferView),a=this.getBuffer(r.buffer).data,i=r.byteOffset||0;return new Uint8Array(a,i,r.byteLength)}addApplicationData(t,r){return this.json[t]=r,this}addExtraData(t,r){return this.json.extras=this.json.extras||{},this.json.extras[t]=r,this}addObjectExtension(t,r,n){return t.extensions=t.extensions||{},t.extensions[r]=n,this.registerUsedExtension(r),this}setObjectExtension(t,r,n){let a=t.extensions||{};a[r]=n}removeObjectExtension(t,r){let n=(t==null?void 0:t.extensions)||{};if(n[r]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let a=this.json.extensionsRemoved;a.includes(r)||a.push(r)}delete n[r]}addExtension(t,r={}){return Xn(r),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=r,this.registerUsedExtension(t),r}addRequiredExtension(t,r={}){return Xn(r),this.addExtension(t,r),this.registerRequiredExtension(t),r}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(r=>r===t)||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(r=>r===t)||this.json.extensionsRequired.push(t)}removeExtension(t){var r;if((r=this.json.extensions)!=null&&r[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let n=this.json.extensionsRemoved;n.includes(t)||n.push(t)}this.json.extensions&&delete this.json.extensions[t],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t)}setDefaultScene(t){this.json.scene=t}addScene(t){let{nodeIndices:r}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:r}),this.json.scenes.length-1}addNode(t){let{meshIndex:r,matrix:n}=t;this.json.nodes=this.json.nodes||[];let a={mesh:r};return n&&(a.matrix=n),this.json.nodes.push(a),this.json.nodes.length-1}addMesh(t){let{attributes:r,indices:n,material:a,mode:i=4}=t,s={primitives:[{attributes:this._addAttributes(r),mode:i}]};if(n){let u=this._addIndices(n);s.primitives[0].indices=u}return Number.isFinite(a)&&(s.primitives[0].material=a),this.json.meshes=this.json.meshes||[],this.json.meshes.push(s),this.json.meshes.length-1}addPointCloud(t){let n={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(n),this.json.meshes.length-1}addImage(t,r){let n=Cd(t),a=r||(n==null?void 0:n.mimeType),o={bufferView:this.addBufferView(t),mimeType:a};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(t,r=0,n=this.byteLength){let a=t.byteLength;Xn(Number.isFinite(a)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let i={buffer:r,byteOffset:n,byteLength:a};return this.byteLength+=Ki(a,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(t,r){let n={bufferView:t,type:$S(r.size),componentType:r.componentType,count:r.count,max:r.max,min:r.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(t,r={size:3}){let n=this.addBufferView(t),a={min:r.min,max:r.max};(!a.min||!a.max)&&(a=this._getAccessorMinMax(t,r.size));let i={size:r.size,componentType:Lf(t),count:Math.round(t.length/r.size),min:a.min,max:a.max};return this.addAccessor(n,Object.assign(i,r))}addTexture(t){let{imageIndex:r}=t,n={source:r};return this.json.textures=this.json.textures||[],this.json.textures.push(n),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){var i,o;let t=this.byteLength,r=new ArrayBuffer(t),n=new Uint8Array(r),a=0;for(let s of this.sourceBuffers||[])a=rF(s,n,a);(o=(i=this.json)==null?void 0:i.buffers)!=null&&o[0]?this.json.buffers[0].byteLength=t:this.json.buffers=[{byteLength:t}],this.gltf.binary=r,this.sourceBuffers=[r],this.gltf.buffers=[{arrayBuffer:r,byteOffset:0,byteLength:r.byteLength}]}_removeStringFromArray(t,r){let n=!0;for(;n;){let a=t.indexOf(r);a>-1?t.splice(a,1):n=!1}}_addAttributes(t={}){let r={};for(let n in t){let a=t[n],i=this._getGltfAttributeName(n),o=this.addBinaryBuffer(a.value,a);r[i]=o}return r}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return t}}_getAccessorMinMax(t,r){let n={min:null,max:null};if(t.length<r)return n;n.min=[],n.max=[];let a=t.subarray(0,r);for(let i of a)n.min.push(i),n.max.push(i);for(let i=r;i<t.length;i+=r)for(let o=0;o<r;o++)n.min[0+o]=Math.min(n.min[0+o],t[i+o]),n.max[0+o]=Math.max(n.max[0+o],t[i+o]);return n}};function pxe(e){return(e%1+1)%1}var dxe={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},qwt={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},hxe={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function D1(e,t){return hxe[t]*dxe[e]}function sg(e,t,r,n){if(r!=="UINT8"&&r!=="UINT16"&&r!=="UINT32"&&r!=="UINT64")return null;let a=e.getTypedArrayForBufferView(t),i=ug(a,"SCALAR",r,n+1);return i instanceof BigInt64Array||i instanceof BigUint64Array?null:i}function ug(e,t,r,n=1){let a=dxe[t],i=qwt[r],o=hxe[r],s=n*a,u=s*o,c=e.buffer,l=e.byteOffset;return l%o!==0&&(c=new Uint8Array(c).slice(l,l+u).buffer,l=0),new i(za(c),l,s)}function cg(e,t,r){var c,l,f,p,d;let n=`TEXCOORD_${t.texCoord||0}`,a=r.attributes[n],i=e.getTypedArrayForAccessor(a),o=e.gltf.json,s=t.index,u=(l=(c=o.textures)==null?void 0:c[s])==null?void 0:l.source;if(typeof u<"u"){let h=(p=(f=o.images)==null?void 0:f[u])==null?void 0:p.mimeType,m=(d=e.gltf.images)==null?void 0:d[u];if(m&&typeof m.width<"u"){let g=[];for(let x=0;x<i.length;x+=2){let y=Nwt(m,h,i,x,t.channels);g.push(y)}return g}}return[]}function WS(e,t,r,n,a){if(!(r!=null&&r.length))return;let i=[];for(let l of r){let f=n.findIndex(p=>p===l);f===-1&&(f=n.push(l)-1),i.push(f)}let o=new Uint32Array(i),s=e.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,u=e.addBufferView(o,s,0),c=e.addAccessor(u,{size:1,componentType:Lf(o),count:o.length});a.attributes[t]=c}function Nwt(e,t,r,n,a=[0]){let i={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=r[n],s=r[n+1],u=1;t&&(t.indexOf("image/jpeg")!==-1||t.indexOf("image/png")!==-1)&&(u=4);let c=Uwt(o,s,e,u),l=0;for(let f of a){let p=typeof f=="number"?Object.values(i)[f]:i[f],d=c+p.offset,h=ag(e);if(h.data.length<=d)throw new Error(`${h.data.length} <= ${d}`);let m=h.data[d];l|=m<<p.shift}return l}function Uwt(e,t,r,n=1){let a=r.width,i=pxe(e)*(a-1),o=Math.round(i),s=r.height,u=pxe(t)*(s-1),c=Math.round(u),l=r.components?r.components:n;return(c*a+o)*l}function KS(e,t,r,n,a){let i=[];for(let o=0;o<t;o++){let s=r[o],u=r[o+1]-r[o];if(u+s>n)break;let c=s/a,l=u/a;i.push(e.slice(c,c+l))}return i}function JS(e,t,r){let n=[];for(let a=0;a<t;a++){let i=a*r;n.push(e.slice(i,i+r))}return n}function XS(e,t,r,n){if(r)throw new Error("Not implemented - arrayOffsets for strings is specified");if(n){let a=[],i=new TextDecoder("utf8"),o=0;for(let s=0;s<e;s++){let u=n[s+1]-n[s];if(u+o<=t.length){let c=t.subarray(o,u+o),l=i.decode(c);a.push(l),o+=u}}return a}return[]}var lg="EXT_mesh_features",YS=lg;async function zwt(e,t){let r=new Xt(e);Hwt(r,t)}function Gwt(e,t){let r=new Xt(e);return $wt(r,t),r.createBinaryChunk(),r.gltf}function Hwt(e,t){let r=e.gltf.json;if(r.meshes)for(let n of r.meshes)for(let a of n.primitives)Vwt(e,a,t)}function Vwt(e,t,r){var i,o,s;if(!((i=r==null?void 0:r.gltf)!=null&&i.loadBuffers))return;let n=(o=t.extensions)==null?void 0:o[lg],a=n==null?void 0:n.featureIds;if(a)for(let u of a){let c;if(typeof u.attribute<"u"){let l=`_FEATURE_ID_${u.attribute}`,f=t.attributes[l];c=e.getTypedArrayForAccessor(f)}else typeof u.texture<"u"&&((s=r==null?void 0:r.gltf)!=null&&s.loadImages)?c=cg(e,u.texture,t):c=[];u.data=c}}function $wt(e,t){let r=e.gltf.json.meshes;if(r)for(let n of r)for(let a of n.primitives)Wwt(e,a)}function QS(e,t,r,n){t.extensions||(t.extensions={});let a=t.extensions[lg];a||(a={featureIds:[]},t.extensions[lg]=a);let{featureIds:i}=a,o={featureCount:r.length,propertyTable:n,data:r};i.push(o),e.addObjectExtension(t,lg,a)}function Wwt(e,t){var a;let r=(a=t.extensions)==null?void 0:a[lg];if(!r)return;let n=r.featureIds;n.forEach((i,o)=>{if(i.data){let{accessorKey:s,index:u}=Kwt(t.attributes),c=new Uint32Array(i.data);n[o]={featureCount:c.length,propertyTable:i.propertyTable,attribute:u},e.gltf.buffers.push({arrayBuffer:c.buffer,byteOffset:c.byteOffset,byteLength:c.byteLength});let l=e.addBufferView(c),f=e.addAccessor(l,{size:1,componentType:Lf(c),count:c.length});t.attributes[s]=f}})}function Kwt(e){let t="_FEATURE_ID_",r=Object.keys(e).filter(i=>i.indexOf(t)===0),n=-1;for(let i of r){let o=Number(i.substring(t.length));o>n&&(n=o)}return n++,{accessorKey:`${t}${n}`,index:n}}var t8={};Fa(t8,{createExtStructuralMetadata:()=>e8,decode:()=>Jwt,encode:()=>Xwt,name:()=>Xc});var fg="EXT_structural_metadata",Xc=fg;async function Jwt(e,t){let r=new Xt(e);Ywt(r,t)}function Xwt(e,t){let r=new Xt(e);return dAt(r,t),r.createBinaryChunk(),r.gltf}function Ywt(e,t){var n,a;if(!((n=t.gltf)!=null&&n.loadBuffers))return;let r=e.getExtension(fg);r&&((a=t.gltf)!=null&&a.loadImages&&Qwt(e,r),Zwt(e,r))}function Qwt(e,t){let r=t.propertyTextures,n=e.gltf.json;if(r&&n.meshes)for(let a of n.meshes)for(let i of a.primitives)tAt(e,r,i,t)}function Zwt(e,t){let r=t.schema;if(!r)return;let n=r.classes,a=t.propertyTables;if(n&&a)for(let i in n){let o=eAt(a,i);o&&nAt(e,r,o)}}function eAt(e,t){for(let r of e)if(r.class===t)return r;return null}function tAt(e,t,r,n){var o;if(!t)return;let a=(o=r.extensions)==null?void 0:o[fg],i=a==null?void 0:a.propertyTextures;if(i)for(let s of i){let u=t[s];rAt(e,u,r,n)}}function rAt(e,t,r,n){var i;if(!t.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);let a=t.class;for(let o in t.properties){let s=`${a}_${o}`,u=(i=t.properties)==null?void 0:i[o];if(!u)continue;u.data||(u.data=[]);let c=u.data,l=cg(e,u,r);l!==null&&(WS(e,s,l,c,r),u.data=c,n.dataAttributeNames.push(s))}}function nAt(e,t,r){var i,o;let n=(i=t.classes)==null?void 0:i[r.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let a=r.count;for(let s in n.properties){let u=n.properties[s],c=(o=r.properties)==null?void 0:o[s];if(c){let l=aAt(e,t,u,a,c);c.data=l}}}function aAt(e,t,r,n,a){let i=[],o=a.values,s=e.getTypedArrayForBufferView(o),u=iAt(e,r,a,n),c=oAt(e,a,n);switch(r.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{i=sAt(r,n,s,u);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${r.type}`);case"STRING":{i=XS(n,s,u,c);break}case"ENUM":{i=uAt(t,r,n,s,u);break}default:throw new Error(`Unknown classProperty type ${r.type}`)}return i}function iAt(e,t,r,n){return t.array&&typeof t.count>"u"&&typeof r.arrayOffsets<"u"?sg(e,r.arrayOffsets,r.arrayOffsetType||"UINT32",n):null}function oAt(e,t,r){return typeof t.stringOffsets<"u"?sg(e,t.stringOffsets,t.stringOffsetType||"UINT32",r):null}function sAt(e,t,r,n){let a=e.array,i=e.count,o=D1(e.type,e.componentType),s=r.byteLength/o,u;return e.componentType?u=ug(r,e.type,e.componentType,s):u=r,a?n?KS(u,t,n,r.length,o):i?JS(u,t,i):[]:u}function uAt(e,t,r,n,a){var f;let i=t.enumType;if(!i)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let o=(f=e.enums)==null?void 0:f[i];if(!o)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${i}`);let s=o.valueType||"UINT16",u=D1(t.type,s),c=n.byteLength/u,l=ug(n,t.type,s,c);if(l||(l=n),t.array){if(a)return cAt({valuesData:l,numberOfElements:r,arrayOffsets:a,valuesDataBytesLength:n.length,elementSize:u,enumEntry:o});let p=t.count;return p?lAt(l,r,p,o):[]}return DM(l,0,r,o)}function cAt(e){let{valuesData:t,numberOfElements:r,arrayOffsets:n,valuesDataBytesLength:a,elementSize:i,enumEntry:o}=e,s=[];for(let u=0;u<r;u++){let c=n[u],l=n[u+1]-n[u];if(l+c>a)break;let f=c/i,p=l/i,d=DM(t,f,p,o);s.push(d)}return s}function lAt(e,t,r,n){let a=[];for(let i=0;i<t;i++){let o=r*i,s=DM(e,o,r,n);a.push(s)}return a}function DM(e,t,r,n){let a=[];for(let i=0;i<r;i++)if(e instanceof BigInt64Array||e instanceof BigUint64Array)a.push("");else{let o=e[t+i],s=fAt(n,o);s?a.push(s.name):a.push("")}return a}function fAt(e,t){for(let r of e.values)if(r.value===t)return r;return null}var pAt="schemaClassId";function dAt(e,t){var n,a;let r=e.getExtension(fg);if(r&&r.propertyTables)for(let i of r.propertyTables){let o=i.class,s=(a=(n=r.schema)==null?void 0:n.classes)==null?void 0:a[o];i.properties&&s&&hAt(i,s,e)}}function hAt(e,t,r){for(let n in e.properties){let a=e.properties[n].data;if(a){let i=t.properties[n];if(i){let o=bAt(a,i,r);e.properties[n]=o}}}}function e8(e,t,r=pAt){let n=e.getExtension(fg);n||(n=e.addExtension(fg)),n.schema=mAt(t,r,n.schema);let a=gAt(t,r,n.schema);return n.propertyTables||(n.propertyTables=[]),n.propertyTables.push(a)-1}function mAt(e,t,r){let n=r??{id:"schema_id"},a={properties:{}};for(let i of e){let o={type:i.elementType,componentType:i.componentType};a.properties[i.name]=o}return n.classes={},n.classes[t]=a,n}function gAt(e,t,r){var o;let n={class:t,count:0},a=0,i=(o=r.classes)==null?void 0:o[t];for(let s of e){if(a===0&&(a=s.values.length),a!==s.values.length&&s.values.length)throw new Error("Illegal values in attributes");(i==null?void 0:i.properties[s.name])&&(n.properties||(n.properties={}),n.properties[s.name]={values:0,data:s.values})}return n.count=a,n}function bAt(e,t,r){let n={values:0};if(t.type==="STRING"){let{stringData:a,stringOffsets:i}=yAt(e);n.stringOffsets=CM(i,r),n.values=CM(a,r)}else if(t.type==="SCALAR"&&t.componentType){let a=xAt(e,t.componentType);n.values=CM(a,r)}return n}var vAt={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:Int32Array,UINT64:Uint32Array,FLOAT32:Float32Array,FLOAT64:Float64Array};function xAt(e,t){let r=[];for(let a of e)r.push(Number(a));let n=vAt[t];if(!n)throw new Error("Illegal component type");return new n(r)}function yAt(e){let t=new TextEncoder,r=[],n=0;for(let u of e){let c=t.encode(u);n+=c.length,r.push(c)}let a=new Uint8Array(n),i=[],o=0;for(let u of r)a.set(u,o),i.push(o),o+=u.length;i.push(o);let s=new Uint32Array(i);return{stringData:a,stringOffsets:s}}function CM(e,t){return t.gltf.buffers.push({arrayBuffer:za(e.buffer),byteOffset:e.byteOffset,byteLength:e.byteLength}),t.addBufferView(e)}var BM={};Fa(BM,{decode:()=>_At,name:()=>Ro});var mxe="EXT_feature_metadata",Ro=mxe;async function _At(e,t){let r=new Xt(e);wAt(r,t)}function wAt(e,t){var n,a;if(!((n=t.gltf)!=null&&n.loadBuffers))return;let r=e.getExtension(mxe);r&&((a=t.gltf)!=null&&a.loadImages&&AAt(e,r),EAt(e,r))}function AAt(e,t){let r=t.schema;if(!r)return;let n=r.classes,{featureTextures:a}=t;if(n&&a)for(let i in n){let o=n[i],s=SAt(a,i);s&&CAt(e,s,o)}}function EAt(e,t){let r=t.schema;if(!r)return;let n=r.classes,a=t.featureTables;if(n&&a)for(let i in n){let o=TAt(a,i);o&&kAt(e,r,o)}}function TAt(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function SAt(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function kAt(e,t,r){var i,o;if(!r.class)return;let n=(i=t.classes)==null?void 0:i[r.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let a=r.count;for(let s in n.properties){let u=n.properties[s],c=(o=r.properties)==null?void 0:o[s];if(c){let l=DAt(e,t,u,a,c);c.data=l}}}function CAt(e,t,r){var a;let n=t.class;for(let i in r.properties){let o=(a=t==null?void 0:t.properties)==null?void 0:a[i];if(o){let s=PAt(e,o,n);o.data=s}}}function DAt(e,t,r,n,a){let i=[],o=a.bufferView,s=e.getTypedArrayForBufferView(o),u=BAt(e,r,a,n),c=FAt(e,r,a,n);return r.type==="STRING"||r.componentType==="STRING"?i=XS(n,s,u,c):OAt(r)&&(i=IAt(r,n,s,u)),i}function BAt(e,t,r,n){return t.type==="ARRAY"&&typeof t.componentCount>"u"&&typeof r.arrayOffsetBufferView<"u"?sg(e,r.arrayOffsetBufferView,r.offsetType||"UINT32",n):null}function FAt(e,t,r,n){return typeof r.stringOffsetBufferView<"u"?sg(e,r.stringOffsetBufferView,r.offsetType||"UINT32",n):null}function OAt(e){let t=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return t.includes(e.type)||typeof e.componentType<"u"&&t.includes(e.componentType)}function IAt(e,t,r,n){let a=e.type==="ARRAY",i=e.componentCount,o="SCALAR",s=e.componentType||e.type,u=D1(o,s),c=r.byteLength/u,l=ug(r,o,s,c);return a?n?KS(l,t,n,r.length,u):i?JS(l,t,i):[]:l}function PAt(e,t,r){let n=e.gltf.json;if(!n.meshes)return[];let a=[];for(let i of n.meshes)for(let o of i.primitives)RAt(e,r,t,a,o);return a}function RAt(e,t,r,n,a){let i={channels:r.channels,...r.texture},o=cg(e,i,a);o&&WS(e,t,o,n,a)}var r8="4.4.1";var pg="4.4.1";var Mu={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},gxe;async function OM(e){u0(e.modules);let t=HB("basis");return t||(gxe||(gxe=jAt(e)),await gxe)}async function jAt(e){let t=null,r=null;return[t,r]=await Promise.all([await yo(Mu.TRANSCODER,"textures",e),await yo(Mu.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await LAt(t,r)}function LAt(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e(r).then(a=>{let{BasisFile:i,initializeBasis:o}=a;o(),n({BasisFile:i})})})}var FM;async function IM(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(FM=FM||MAt(e),await FM)}async function MAt(e){let t=null,r=null;return[t,r]=await Promise.all([await yo(Mu.ENCODER,"textures",e),await yo(Mu.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await qAt(t,r)}function qAt(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e(r).then(a=>{let{BasisFile:i,KTX2File:o,initializeBasis:s,BasisEncoder:u}=a;s(),n({BasisFile:i,KTX2File:o,BasisEncoder:u})})})}var NAt=["","WEBKIT_","MOZ_"],bxe={WEBGL_compressed_texture_s3tc:["bc1-rgb-unorm-webgl","bc1-rgba-unorm","bc2-rgba-unorm","bc3-rgba-unorm"],WEBGL_compressed_texture_s3tc_srgb:["bc1-rgb-unorm-srgb-webgl","bc1-rgba-unorm-srgb","bc2-rgba-unorm-srgb","bc3-rgba-unorm-srgb"],EXT_texture_compression_rgtc:["bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm"],EXT_texture_compression_bptc:["bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"],WEBGL_compressed_texture_etc1:["etc1-rgb-unorm-webgl"],WEBGL_compressed_texture_etc:["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm"],WEBGL_compressed_texture_pvrtc:["pvrtc-rgb4unorm-webgl","pvrtc-rgba4unorm-webgl","pvrtc-rgb2unorm-webgl","pvrtc-rgba2unorm-webgl"],WEBGL_compressed_texture_atc:["atc-rgb-unorm-webgl","atc-rgba-unorm-webgl","atc-rgbai-unorm-webgl"],WEBGL_compressed_texture_astc:["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]};var n8=null;function vxe(e){if(!n8){e=e||UAt()||void 0,n8=new Set;for(let t of NAt)for(let r in bxe)if(e&&e.getExtension(`${t}${r}`))for(let n of bxe[r])n8.add(n)}return n8}function UAt(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var PM=class{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}},Dd=class{constructor(t,r,n,a){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(t.buffer,t.byteOffset+r,n),this._littleEndian=a,this._offset=0}_nextUint8(){let t=this._dataView.getUint8(this._offset);return this._offset+=1,t}_nextUint16(){let t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}_nextUint32(){let t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint64(){let t=this._dataView.getUint32(this._offset,this._littleEndian),r=this._dataView.getUint32(this._offset+4,this._littleEndian),n=t+2**32*r;return this._offset+=8,n}_nextInt32(){let t=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint8Array(t){let r=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,t);return this._offset+=t,r}_skip(t){return this._offset+=t,this}_scan(t,r=0){let n=this._offset,a=0;for(;this._dataView.getUint8(this._offset)!==r&&a<t;)a++,this._offset++;return a<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,a)}};var Zsr=new Uint8Array([0]),ci=[171,75,84,88,32,50,48,187,13,10,26,10];function xxe(e){return new TextDecoder().decode(e)}function yxe(e){let t=new Uint8Array(e.buffer,e.byteOffset,ci.length);if(t[0]!==ci[0]||t[1]!==ci[1]||t[2]!==ci[2]||t[3]!==ci[3]||t[4]!==ci[4]||t[5]!==ci[5]||t[6]!==ci[6]||t[7]!==ci[7]||t[8]!==ci[8]||t[9]!==ci[9]||t[10]!==ci[10]||t[11]!==ci[11])throw new Error("Missing KTX 2.0 identifier.");let r=new PM,n=17*Uint32Array.BYTES_PER_ELEMENT,a=new Dd(e,ci.length,n,!0);r.vkFormat=a._nextUint32(),r.typeSize=a._nextUint32(),r.pixelWidth=a._nextUint32(),r.pixelHeight=a._nextUint32(),r.pixelDepth=a._nextUint32(),r.layerCount=a._nextUint32(),r.faceCount=a._nextUint32();let i=a._nextUint32();r.supercompressionScheme=a._nextUint32();let o=a._nextUint32(),s=a._nextUint32(),u=a._nextUint32(),c=a._nextUint32(),l=a._nextUint64(),f=a._nextUint64(),p=i*3*8,d=new Dd(e,ci.length+n,p,!0);for(let fe=0;fe<i;fe++)r.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});let h=new Dd(e,o,s,!0),m={vendorId:h._skip(4)._nextUint16(),descriptorType:h._nextUint16(),versionNumber:h._nextUint16(),descriptorBlockSize:h._nextUint16(),colorModel:h._nextUint8(),colorPrimaries:h._nextUint8(),transferFunction:h._nextUint8(),flags:h._nextUint8(),texelBlockDimension:[h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8()],bytesPlane:[h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8()],samples:[]},g=6,x=4,y=(m.descriptorBlockSize/4-g)/x;for(let fe=0;fe<y;fe++){let me={bitOffset:h._nextUint16(),bitLength:h._nextUint8(),channelType:h._nextUint8(),samplePosition:[h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};me.channelType&64?(me.sampleLower=h._nextInt32(),me.sampleUpper=h._nextInt32()):(me.sampleLower=h._nextUint32(),me.sampleUpper=h._nextUint32()),m.samples[fe]=me}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(m);let w=new Dd(e,u,c,!0);for(;w._offset<c;){let fe=w._nextUint32(),me=w._scan(fe),ye=xxe(me);if(r.keyValue[ye]=w._nextUint8Array(fe-me.byteLength-1),ye.match(/^ktx/i)){let N=xxe(r.keyValue[ye]);r.keyValue[ye]=N.substring(0,N.lastIndexOf("\0"))}let X=fe%4?4-fe%4:0;w._skip(X)}if(f<=0)return r;let T=new Dd(e,l,f,!0),A=T._nextUint16(),B=T._nextUint16(),I=T._nextUint32(),L=T._nextUint32(),C=T._nextUint32(),k=T._nextUint32(),F=[];for(let fe=0;fe<i;fe++)F.push({imageFlags:T._nextUint32(),rgbSliceByteOffset:T._nextUint32(),rgbSliceByteLength:T._nextUint32(),alphaSliceByteOffset:T._nextUint32(),alphaSliceByteLength:T._nextUint32()});let R=l+T._offset,G=R+I,z=G+L,W=z+C,Y=new Uint8Array(e.buffer,e.byteOffset+R,I),ue=new Uint8Array(e.buffer,e.byteOffset+G,L),ie=new Uint8Array(e.buffer,e.byteOffset+z,C),le=new Uint8Array(e.buffer,e.byteOffset+W,k);return r.globalData={endpointCount:A,selectorCount:B,imageDescs:F,endpointsData:Y,selectorsData:ue,tablesData:ie,extendedData:le},r}var Nxe={[34836]:"rgba32float",[33776]:"bc1-rgb-unorm-webgl",[35916]:"bc1-rgb-unorm-srgb-webgl",[33777]:"bc1-rgba-unorm",[35917]:"bc1-rgba-unorm-srgb",[33778]:"bc2-rgba-unorm",[35918]:"bc2-rgba-unorm-srgb",[33779]:"bc3-rgba-unorm",[35919]:"bc3-rgba-unorm-srgb",[36283]:"bc4-r-unorm",[36284]:"bc4-r-snorm",[36285]:"bc5-rg-unorm",[36286]:"bc5-rg-snorm",[37492]:"etc2-rgb8unorm",[37494]:"etc2-rgb8unorm-srgb",[37496]:"etc2-rgb8a1unorm",[37497]:"etc2-rgb8a1unorm-srgb",[37493]:"etc2-rgba8unorm",[37495]:"etc2-rgba8unorm-srgb",[37488]:"eac-r11unorm",[37489]:"eac-r11snorm",[37490]:"eac-rg11unorm",[37491]:"eac-rg11snorm",[37808]:"astc-4x4-unorm",[37840]:"astc-4x4-unorm-srgb",[37809]:"astc-5x4-unorm",[37841]:"astc-5x4-unorm-srgb",[37810]:"astc-5x5-unorm",[37842]:"astc-5x5-unorm-srgb",[37811]:"astc-6x5-unorm",[37843]:"astc-6x5-unorm-srgb",[37812]:"astc-6x6-unorm",[37844]:"astc-6x6-unorm-srgb",[37813]:"astc-8x5-unorm",[37845]:"astc-8x5-unorm-srgb",[37814]:"astc-8x6-unorm",[37846]:"astc-8x6-unorm-srgb",[37815]:"astc-8x8-unorm",[37847]:"astc-8x8-unorm-srgb",[37816]:"astc-10x5-unorm",[37848]:"astc-10x5-unorm-srgb",[37817]:"astc-10x6-unorm",[37849]:"astc-10x6-unorm-srgb",[37818]:"astc-10x8-unorm",[37850]:"astc-10x8-unorm-srgb",[37819]:"astc-10x10-unorm",[37851]:"astc-10x10-unorm-srgb",[37820]:"astc-12x10-unorm",[37852]:"astc-12x10-unorm-srgb",[37821]:"astc-12x12-unorm",[37853]:"astc-12x12-unorm-srgb",[35840]:"pvrtc-rgb4unorm-webgl",[35842]:"pvrtc-rgba4unorm-webgl",[35841]:"pvrtc-rgb2unorm-webgl",[35843]:"pvrtc-rgba2unorm-webgl",[36196]:"etc1-rgb-unorm-webgl",[35986]:"atc-rgb-unorm-webgl",[35987]:"atc-rgba-unorm-webgl",[34798]:"atc-rgbai-unorm-webgl"},EEt=Object.fromEntries(Object.entries(Nxe).map(([e,t])=>[t,Number(e)]));function a8(e){if(e!==void 0)return Nxe[e]}function Uxe(e){if(e!==void 0)return EEt[e]}function dg(e,t){let r=new Array(t.mipMapLevels),n=t.textureFormat||a8(t.internalFormat),a=t.internalFormat||Uxe(t.textureFormat),i=t.width,o=t.height,s=0;for(let u=0;u<t.mipMapLevels;++u){let c=SEt(t,i,o,e,u),f={shape:"texture-level",compressed:!0,data:TEt(e,u,s,c),width:i,height:o,levelSize:c};a!==void 0&&(f.format=a),n&&(f.textureFormat=n),r[u]=f,i=Math.max(1,i>>1),o=Math.max(1,o>>1),s+=c}return r}function TEt(e,t,r,n){return Array.isArray(e)?e[t].levelData:new Uint8Array(e.buffer,e.byteOffset+r,n)}function SEt(e,t,r,n,a){return Array.isArray(n)?e.sizeFunction(n[a]):e.sizeFunction(t,r)}var kEt={131:33776,132:35916,133:33777,134:35917,135:33778,136:35918,137:33779,138:35919,139:36283,140:36284,141:36285,142:36286,147:37492,148:37494,149:37496,150:37497,151:37493,152:37495,153:37488,154:37489,155:37490,156:37491,157:37808,158:37840,159:37809,160:37841,161:37810,162:37842,163:37811,164:37843,165:37812,166:37844,167:37813,168:37845,169:37814,170:37846,171:37815,172:37847,173:37816,174:37848,175:37817,176:37849,177:37818,178:37850,179:37819,180:37851,181:37820,182:37852,183:37821,184:37853,1000054e3:35843,1000054001:35842,1000066e3:37808,1000066001:37809,1000066002:37810,1000066003:37811,1000066004:37812,1000066005:37813,1000066006:37814,1000066007:37815,1000066008:37816,1000066009:37817,1000066010:37818,1000066011:37819,1000066012:37820,1000066013:37821};function CEt(e){return kEt[e]}function zxe(e){return a8(CEt(e))}var Qi=[171,75,84,88,32,50,48,187,13,10,26,10];function i8(e){let t=new Uint8Array(e);return!(t.byteLength<Qi.length||t[0]!==Qi[0]||t[1]!==Qi[1]||t[2]!==Qi[2]||t[3]!==Qi[3]||t[4]!==Qi[4]||t[5]!==Qi[5]||t[6]!==Qi[6]||t[7]!==Qi[7]||t[8]!==Qi[8]||t[9]!==Qi[9]||t[10]!==Qi[10]||t[11]!==Qi[11])}function Gxe(e){let t=new Uint8Array(e),r=yxe(t),n=Math.max(1,r.levels.length),a=r.pixelWidth,i=r.pixelHeight,o=zxe(r.vkFormat);return o===void 0&&Dv.warn(`KTX2 container vkFormat ${r.vkFormat} does not map to a known texture format; returning texture levels without format metadata.`)(),dg(r.levels,{mipMapLevels:n,width:a,height:i,sizeFunction:s=>s.uncompressedByteLength,textureFormat:o})}var Hxe=Promise.resolve(),Wxe={etc1:{basisFormat:0,compressed:!0,format:36196,textureFormat:"etc1-rgb-unorm-webgl"},etc2:{basisFormat:1,compressed:!0,format:37493,textureFormat:"etc2-rgba8unorm"},bc1:{basisFormat:2,compressed:!0,format:33776,textureFormat:"bc1-rgb-unorm-webgl"},bc3:{basisFormat:3,compressed:!0,format:33779,textureFormat:"bc3-rgba-unorm"},bc4:{basisFormat:4,compressed:!0,format:36283,textureFormat:"bc4-r-unorm"},bc5:{basisFormat:5,compressed:!0,format:36285,textureFormat:"bc5-rg-unorm"},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0,format:36492,textureFormat:"bc7-rgba-unorm"},"bc7-m5":{basisFormat:7,compressed:!0,format:36492,textureFormat:"bc7-rgba-unorm"},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:35840,textureFormat:"pvrtc-rgb4unorm-webgl"},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:35842,textureFormat:"pvrtc-rgba4unorm-webgl"},"astc-4x4":{basisFormat:10,compressed:!0,format:37808,textureFormat:"astc-4x4-unorm"},"atc-rgb":{basisFormat:11,compressed:!0,format:35986,textureFormat:"atc-rgb-unorm-webgl"},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0,format:34798,textureFormat:"atc-rgbai-unorm-webgl"},rgba32:{basisFormat:13,compressed:!1,format:32856,textureFormat:"rgba8unorm"},rgb565:{basisFormat:14,compressed:!1,format:36194,textureFormat:"rgb565unorm-webgl"},bgr565:{basisFormat:15,compressed:!1,format:36194,textureFormat:"rgb565unorm-webgl"},rgba4444:{basisFormat:16,compressed:!1,format:32854,textureFormat:"rgba4unorm-webgl"}},yur=Object.freeze(Object.keys(Wxe));async function FEt(e){let t=Hxe,r;Hxe=new Promise(n=>{r=n}),await t;try{return await e()}finally{r()}}async function o8(e,t={}){let r=Lv(t);return await FEt(async()=>{var n;if(!((n=t.basis)!=null&&n.containerFormat)||t.basis.containerFormat==="auto"){if(i8(e)){let i=await IM(r);return Vxe(i.KTX2File,e,t)}let{BasisFile:a}=await OM(r);return jM(a,e,t)}switch(t.basis.module){case"encoder":let a=await IM(r);switch(t.basis.containerFormat){case"ktx2":return Vxe(a.KTX2File,e,t);case"basis":default:return jM(a.BasisFile,e,t)}case"transcoder":default:let{BasisFile:i}=await OM(r);return jM(i,e,t)}})}function jM(e,t,r){let n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("Failed to start basis transcoding");let a=n.getNumImages(),i=[];for(let o=0;o<a;o++){let s=n.getNumLevels(o),u=[];for(let c=0;c<s;c++)u.push(OEt(n,o,c,r));i.push(u)}return i}finally{n.close(),n.delete()}}function OEt(e,t,r,n){let a=e.getImageWidth(t,r),i=e.getImageHeight(t,r),o=e.getHasAlpha(),{compressed:s,format:u,basisFormat:c,textureFormat:l}=Kxe(n,o),f=e.getImageTranscodedSizeInBytes(t,r,c),p=new Uint8Array(f);if(!e.transcodeImage(p,t,r,c,0,0))throw new Error("failed to start Basis transcoding");return{shape:"texture-level",width:a,height:i,data:p,compressed:s,...u!==void 0?{format:u}:{},...l!==void 0?{textureFormat:l}:{},hasAlpha:o}}function Vxe(e,t,r){let n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("failed to start KTX2 transcoding");let a=n.getLevels(),i=[];for(let o=0;o<a;o++)i.push(IEt(n,o,r));return[i]}finally{n.close(),n.delete()}}function IEt(e,t,r){let{alphaFlag:n,height:a,width:i}=e.getImageLevelInfo(t,0,0),{compressed:o,format:s,basisFormat:u,textureFormat:c}=Kxe(r,n),l=e.getImageTranscodedSizeInBytes(t,0,0,u),f=new Uint8Array(l);if(!e.transcodeImage(f,t,0,0,u,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{shape:"texture-level",width:i,height:a,data:f,compressed:o,...s!==void 0?{format:s}:{},...c!==void 0?{textureFormat:c}:{},levelSize:l,hasAlpha:n}}function Kxe(e,t){var i,o;let r=((i=e.basis)==null?void 0:i.format)||"auto";r==="auto"&&(r=(o=e.basis)!=null&&o.supportedTextureFormats?$xe(e.basis.supportedTextureFormats):$xe()),typeof r=="object"&&(r=t?r.alpha:r.noAlpha);let n=r.toLowerCase(),a=Wxe[n];if(!a)throw new Error(`Unknown Basis format ${r}`);return a}function $xe(e=vxe()){let t=new Set(e);return hg(t,["astc-4x4-unorm","astc-4x4-unorm-srgb"])?"astc-4x4":hg(t,["bc7-rgba-unorm","bc7-rgba-unorm-srgb"])?{alpha:"bc7-m5",noAlpha:"bc7-m6-opaque-only"}:hg(t,["bc1-rgb-unorm-webgl","bc1-rgb-unorm-srgb-webgl","bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb"])?{alpha:"bc3",noAlpha:"bc1"}:hg(t,["pvrtc-rgb4unorm-webgl","pvrtc-rgba4unorm-webgl","pvrtc-rgb2unorm-webgl","pvrtc-rgba2unorm-webgl"])?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:hg(t,["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm"])?"etc2":t.has("etc1-rgb-unorm-webgl")?"etc1":hg(t,["atc-rgb-unorm-webgl","atc-rgba-unorm-webgl","atc-rgbai-unorm-webgl"])?{alpha:"atc-rgba-interpolated-alpha",noAlpha:"atc-rgb"}:"rgb565"}function hg(e,t){return t.some(r=>e.has(r))}var Jxe={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:pg,worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",containerFormat:"auto",module:"transcoder"}}},Bd={...Jxe,parse:o8};var Zi={MAGIC_NUMBER:542327876,HEADER_LENGTH:31,MAGIC_NUMBER_INDEX:0,HEADER_SIZE_INDEX:1,HEADER_FLAGS_INDEX:2,HEADER_HEIGHT_INDEX:3,HEADER_WIDTH_INDEX:4,MIPMAPCOUNT_INDEX:7,HEADER_PF_FLAGS_INDEX:20,HEADER_PF_FOURCC_INDEX:21,DDSD_MIPMAPCOUNT:131072,DDPF_FOURCC:4},PEt={DXT1:"bc1-rgb-unorm-webgl",DXT3:"bc2-rgba-unorm",DXT5:"bc3-rgba-unorm","ATC ":"atc-rgb-unorm-webgl",ATCA:"atc-rgba-unorm-webgl",ATCI:"atc-rgbai-unorm-webgl"},REt=Qxe,jEt=s8,LEt=s8,MEt={DXT1:Qxe,DXT3:s8,DXT5:s8,"ATC ":REt,ATCA:jEt,ATCI:LEt};function Xxe(e){return new Uint32Array(e,0,Zi.HEADER_LENGTH)[Zi.MAGIC_NUMBER_INDEX]===Zi.MAGIC_NUMBER}function Yxe(e){let t=new Int32Array(e,0,Zi.HEADER_LENGTH),r=t[Zi.HEADER_PF_FOURCC_INDEX];yt(Boolean(t[Zi.HEADER_PF_FLAGS_INDEX]&Zi.DDPF_FOURCC),"DDS: Unsupported format, must contain a FourCC code");let n=qEt(r),a=PEt[n],i=MEt[n];yt(a&&i,`DDS: Unknown pixel format ${r}`);let o=1;t[Zi.HEADER_FLAGS_INDEX]&Zi.DDSD_MIPMAPCOUNT&&(o=Math.max(1,t[Zi.MIPMAPCOUNT_INDEX]));let s=t[Zi.HEADER_WIDTH_INDEX],u=t[Zi.HEADER_HEIGHT_INDEX],c=t[Zi.HEADER_SIZE_INDEX]+4,l=new Uint8Array(e,c);return dg(l,{mipMapLevels:o,width:s,height:u,sizeFunction:i,textureFormat:a})}function Qxe(e,t){return(e+3>>2)*(t+3>>2)*8}function s8(e,t){return(e+3>>2)*(t+3>>2)*16}function qEt(e){return String.fromCharCode(e&255,e>>8&255,e>>16&255,e>>24&255)}var jo={MAGIC_NUMBER:55727696,MAGIC_NUMBER_EXTRA:1347834371,HEADER_LENGTH:13,HEADER_SIZE:52,MAGIC_NUMBER_INDEX:0,PIXEL_FORMAT_INDEX:2,COLOUR_SPACE_INDEX:4,HEIGHT_INDEX:6,WIDTH_INDEX:7,MIPMAPCOUNT_INDEX:11,METADATA_SIZE_INDEX:12},NEt={0:["pvrtc-rgb2unorm-webgl"],1:["pvrtc-rgba2unorm-webgl"],2:["pvrtc-rgb4unorm-webgl"],3:["pvrtc-rgba4unorm-webgl"],6:["etc1-rgb-unorm-webgl"],7:["bc1-rgb-unorm-webgl"],9:["bc2-rgba-unorm"],11:["bc3-rgba-unorm"],22:["etc2-rgb8unorm"],23:["etc2-rgba8unorm"],24:["etc2-rgb8a1unorm"],25:["eac-r11unorm"],26:["eac-rg11unorm"],27:["astc-4x4-unorm","astc-4x4-unorm-srgb"],28:["astc-5x4-unorm","astc-5x4-unorm-srgb"],29:["astc-5x5-unorm","astc-5x5-unorm-srgb"],30:["astc-6x5-unorm","astc-6x5-unorm-srgb"],31:["astc-6x6-unorm","astc-6x6-unorm-srgb"],32:["astc-8x5-unorm","astc-8x5-unorm-srgb"],33:["astc-8x6-unorm","astc-8x6-unorm-srgb"],34:["astc-8x8-unorm","astc-8x8-unorm-srgb"],35:["astc-10x5-unorm","astc-10x5-unorm-srgb"],36:["astc-10x6-unorm","astc-10x6-unorm-srgb"],37:["astc-10x8-unorm","astc-10x8-unorm-srgb"],38:["astc-10x10-unorm","astc-10x10-unorm-srgb"],39:["astc-12x10-unorm","astc-12x10-unorm-srgb"],40:["astc-12x12-unorm","astc-12x12-unorm-srgb"]},UEt={0:Zxe,1:Zxe,2:e1e,3:e1e,6:B1,7:B1,9:F1,11:F1,22:B1,23:F1,24:B1,25:B1,26:F1,27:F1,28:zEt,29:GEt,30:HEt,31:VEt,32:$Et,33:WEt,34:KEt,35:JEt,36:XEt,37:YEt,38:QEt,39:ZEt,40:eTt};function t1e(e){let r=new Uint32Array(e,0,jo.HEADER_LENGTH)[jo.MAGIC_NUMBER_INDEX];return r===jo.MAGIC_NUMBER||r===jo.MAGIC_NUMBER_EXTRA}function r1e(e){let t=new Uint32Array(e,0,jo.HEADER_LENGTH),r=t[jo.PIXEL_FORMAT_INDEX],n=t[jo.COLOUR_SPACE_INDEX],a=NEt[r]||[],i=a.length>1&&n?a[1]:a[0],o=UEt[r],s=t[jo.MIPMAPCOUNT_INDEX],u=t[jo.WIDTH_INDEX],c=t[jo.HEIGHT_INDEX],l=jo.HEADER_SIZE+t[jo.METADATA_SIZE_INDEX],f=new Uint8Array(e,l);return dg(f,{mipMapLevels:s,width:u,height:c,sizeFunction:o,textureFormat:i})}function Zxe(e,t){return e=Math.max(e,16),t=Math.max(t,8),e*t/4}function e1e(e,t){return e=Math.max(e,8),t=Math.max(t,8),e*t/2}function B1(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8}function F1(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16}function zEt(e,t){return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16}function GEt(e,t){return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16}function HEt(e,t){return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16}function VEt(e,t){return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16}function $Et(e,t){return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16}function WEt(e,t){return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16}function KEt(e,t){return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16}function JEt(e,t){return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16}function XEt(e,t){return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16}function YEt(e,t){return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16}function QEt(e,t){return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16}function ZEt(e,t){return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16}function eTt(e,t){return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16}function n1e(e){if(i8(e))return Gxe(e);if(Xxe(e))return Yxe(e);if(t1e(e))return r1e(e);throw new Error("Texture container format not recognized")}var a1e={dataType:null,batchType:null,name:"Texture Containers",id:"compressed-texture",module:"textures",version:pg,worker:!0,extensions:["ktx","ktx2","dds","pvr"],mimeTypes:["image/ktx2","image/ktx","image/vnd-ms.dds","image/x-dds","application/octet-stream"],binary:!0,options:{"compressed-texture":{useBasis:!1}}},u8={...a1e,parse:async(e,t)=>{var r;return t={...t},(r=t==null?void 0:t["compressed-texture"])!=null&&r.useBasis?(t.basis={format:{alpha:"BC3",noAlpha:"BC1"},...t.basis,containerFormat:"ktx2",module:"encoder"},(await o8(e,t))[0]):n1e(e)}};var LM={name:"Basis Universal Supercompressed GPU Texture",id:"ktx2-basis-writer",module:"textures",version:pg,extensions:["ktx2"],worker:!0,options:{useSRGB:!1,qualityLevel:10,encodeUASTC:!1,mipmaps:!1}};var mg=!0,i1e=1735152710,NM=12,c8=8,tTt=1313821514,rTt=5130562,nTt=0,aTt=0,iTt=1;function oTt(e,t=0){return`${String.fromCharCode(e.getUint8(t+0))}${String.fromCharCode(e.getUint8(t+1))}${String.fromCharCode(e.getUint8(t+2))}${String.fromCharCode(e.getUint8(t+3))}`}function o1e(e,t=0,r={}){let n=new DataView(e),{magic:a=i1e}=r,i=n.getUint32(t,!1);return i===a||i===i1e}function s1e(e,t,r=0,n={}){let a=new DataView(t),i=oTt(a,r+0),o=a.getUint32(r+4,mg),s=a.getUint32(r+8,mg);switch(Object.assign(e,{header:{byteOffset:r,byteLength:s,hasBinChunk:!1},type:i,version:o,json:{},binChunks:[]}),r+=NM,e.version){case 1:return sTt(e,a,r);case 2:return uTt(e,a,r,n={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function sTt(e,t,r){yt(e.header.byteLength>NM+c8);let n=t.getUint32(r+0,mg),a=t.getUint32(r+4,mg);return r+=c8,yt(a===nTt),MM(e,t,r,n),r+=n,r+=qM(e,t,r,e.header.byteLength),r}function uTt(e,t,r,n){return yt(e.header.byteLength>NM+c8),cTt(e,t,r,n),r+e.header.byteLength}function cTt(e,t,r,n){for(;r+8<=e.header.byteLength;){let a=t.getUint32(r+0,mg),i=t.getUint32(r+4,mg);switch(r+=c8,i){case tTt:MM(e,t,r,a);break;case rTt:qM(e,t,r,a);break;case aTt:n.strict||MM(e,t,r,a);break;case iTt:n.strict||qM(e,t,r,a);break;default:break}r+=Ki(a,4)}return r}function MM(e,t,r,n){let a=new Uint8Array(t.buffer,r,n),o=new TextDecoder("utf8").decode(a);return e.json=JSON.parse(o),Ki(n,4)}function qM(e,t,r,n){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:t.buffer}),Ki(n,4)}function UM(e,t,r){var i;if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;let a=(r==null?void 0:r.baseUrl)||lTt((i=t==null?void 0:t.core)==null?void 0:i.baseUrl);if(!a)throw new Error(`'baseUrl' must be provided to resolve relative url ${e}`);return a.endsWith("/")?`${a}${e}`:`${a}/${e}`}function lTt(e){if(!e)return;if(e.endsWith("/"))return e;let t=e.lastIndexOf("/");return t>=0?e.slice(0,t+1):""}var GM={};Fa(GM,{decode:()=>wTt,name:()=>_Tt});var fTt="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",pTt="B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",dTt=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),hTt=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),mTt={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},gTt={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function u1e(e,t,r,n,a,i="NONE"){let o=await bTt();yTt(o,o.exports[gTt[a]],e,t,r,n,o.exports[mTt[i||"NONE"]])}var zM;async function bTt(){return zM||(zM=vTt()),zM}async function vTt(){let e=fTt;WebAssembly.validate(dTt)&&(e=pTt,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(xTt(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function xTt(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;++n){let a=e.charCodeAt(n);t[n]=a>96?a-71:a>64?a-65:a>47?a+4:a>46?63:62}let r=0;for(let n=0;n<e.length;++n)t[r++]=t[n]<60?hTt[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,r)}function yTt(e,t,r,n,a,i,o){let s=e.exports.sbrk,u=n+3&-4,c=s(u*a),l=s(i.length),f=new Uint8Array(e.exports.memory.buffer);f.set(i,l);let p=t(c,n,a,l,i.length);if(p===0&&o&&o(c,u,a),r.set(f.subarray(c,c+n*a)),s(c-s(0)),p!==0)throw new Error(`Malformed buffer data: ${p}`)}var l8="EXT_meshopt_compression",_Tt=l8;async function wTt(e,t){var a,i;let r=new Xt(e);if(!((a=t==null?void 0:t.gltf)!=null&&a.decompressMeshes)||!((i=t.gltf)!=null&&i.loadBuffers))return;let n=[];for(let o of e.json.bufferViews||[])n.push(ATt(r,o));await Promise.all(n),r.removeExtension(l8)}async function ATt(e,t){let r=e.getObjectExtension(t,l8);if(r){let{byteOffset:n=0,byteLength:a=0,byteStride:i,count:o,mode:s,filter:u="NONE",buffer:c}=r,l=e.gltf.buffers[c],f=new Uint8Array(l.arrayBuffer,l.byteOffset+n,a),p=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await u1e(p,o,i,f,s,u),e.removeObjectExtension(t,l8)}}var HM={};Fa(HM,{name:()=>ETt,preprocess:()=>TTt});var gg="EXT_texture_webp",ETt=gg;function TTt(e,t){let r=new Xt(e);if(!kM("image/webp")){if(r.getRequiredExtensions().includes(gg))throw new Error(`gltf: Required extension ${gg} not supported by browser`);return}let{json:n}=r;for(let a of n.textures||[]){let i=r.getObjectExtension(a,gg);i&&(a.source=i.source),r.removeObjectExtension(a,gg)}r.removeExtension(gg)}var VM={};Fa(VM,{name:()=>STt,preprocess:()=>kTt});var f8="KHR_texture_basisu",STt=f8;function kTt(e,t){let r=new Xt(e),{json:n}=r;for(let a of n.textures||[]){let i=r.getObjectExtension(a,f8);i&&(a.source=i.source,r.removeObjectExtension(a,f8))}r.removeExtension(f8)}var WM={};Fa(WM,{decode:()=>OTt,encode:()=>ITt,name:()=>BTt,preprocess:()=>FTt});function c1e(e){let t={};for(let r in e){let n=e[r];if(r!=="indices"){let a=$M(n);t[r]=a}}return t}function $M(e){let{buffer:t,size:r,count:n}=CTt(e);return{value:t,size:r,byteOffset:0,count:n,type:$S(r),componentType:Lf(t)}}function CTt(e){let t=e,r=1,n=0;return e&&e.value&&(t=e.value,r=e.size||1),t&&(ArrayBuffer.isView(t)||(t=DTt(t,Float32Array)),n=t.length/r),{buffer:t,size:r,count:n}}function DTt(e,t,r=!1){return e?Array.isArray(e)?new t(e):r&&!(e instanceof t)?new t(e):e:null}var Mf="KHR_draco_mesh_compression",BTt=Mf;function FTt(e,t,r){let n=new Xt(e);for(let a of l1e(n))n.getObjectExtension(a,Mf)}async function OTt(e,t,r){var i;if(!((i=t==null?void 0:t.gltf)!=null&&i.decompressMeshes))return;let n=new Xt(e),a=[];for(let o of l1e(n))n.getObjectExtension(o,Mf)&&a.push(PTt(n,o,t,r));await Promise.all(a),n.removeExtension(Mf)}function ITt(e,t={}){let r=new Xt(e);for(let n of r.json.meshes||[])RTt(n,t),r.addRequiredExtension(Mf)}async function PTt(e,t,r,n){let a=e.getObjectExtension(t,Mf);if(!a)return;let i=e.getTypedArrayForBufferView(a.bufferView),o=Rp(i.buffer,i.byteOffset),s={...r};delete s["3d-tiles"];let u=await Hi(o,Sd,s,n),c=c1e(u.attributes);for(let[l,f]of Object.entries(c))if(l in t.attributes){let p=t.attributes[l],d=e.getAccessor(p);d!=null&&d.min&&(d!=null&&d.max)&&(f.min=d.min,f.max=d.max)}t.attributes=c,u.indices&&(t.indices=$M(u.indices)),e.removeObjectExtension(t,Mf),jTt(t)}function RTt(e,t,r=4,n,a){var l;if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let i=n.DracoWriter.encodeSync({attributes:e}),o=(l=a==null?void 0:a.parseSync)==null?void 0:l.call(a,{attributes:e}),s=n._addFauxAttributes(o.attributes),u=n.addBufferView(i);return{primitives:[{attributes:s,mode:r,extensions:{[Mf]:{bufferView:u,attributes:s}}}]}}function jTt(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*l1e(e){for(let t of e.json.meshes||[])for(let r of t.primitives)yield r}var KM={};Fa(KM,{decode:()=>NTt,name:()=>LTt});var d8="KHR_texture_transform",LTt=d8,p8=new Z,MTt=new nr,qTt=new nr;async function NTt(e,t){var i;if(!new Xt(e).hasExtension(d8)||!((i=t.gltf)!=null&&i.loadBuffers))return;let a=e.json.materials||[];for(let o=0;o<a.length;o++)UTt(o,e)}function UTt(e,t){var i,o,s,u;let r=(i=t.json.materials)==null?void 0:i[e],n=[(o=r==null?void 0:r.pbrMetallicRoughness)==null?void 0:o.baseColorTexture,r==null?void 0:r.emissiveTexture,r==null?void 0:r.normalTexture,r==null?void 0:r.occlusionTexture,(s=r==null?void 0:r.pbrMetallicRoughness)==null?void 0:s.metallicRoughnessTexture],a=[];for(let c of n)c&&((u=c==null?void 0:c.extensions)!=null&&u[d8])&&zTt(t,e,c,a)}function zTt(e,t,r,n){let a=GTt(r,n);if(!a)return;let i=e.json.meshes||[];for(let o of i)for(let s of o.primitives){let u=s.material;Number.isFinite(u)&&t===u&&HTt(e,s,a)}}function GTt(e,t){var o;let r=(o=e.extensions)==null?void 0:o[d8],{texCoord:n=0}=e,{texCoord:a=n}=r;if(!(t.findIndex(([s,u])=>s===n&&u===a)!==-1)){let s=WTt(r);return n!==a&&(e.texCoord=a),t.push([n,a]),{originalTexCoord:n,texCoord:a,matrix:s}}return null}function HTt(e,t,r){var s,u;let{originalTexCoord:n,texCoord:a,matrix:i}=r,o=t.attributes[`TEXCOORD_${n}`];if(Number.isFinite(o)){let c=(s=e.json.accessors)==null?void 0:s[o];if(c&&c.bufferView!==void 0){let l=(u=e.json.bufferViews)==null?void 0:u[c.bufferView];if(l){let{arrayBuffer:f,byteOffset:p}=e.buffers[l.buffer],d=(p||0)+(c.byteOffset||0)+(l.byteOffset||0),{ArrayType:h,length:m}=og(c,l),g=VS[c.componentType],x=HS[c.type],y=l.byteStride||g*x,w=new Float32Array(m);for(let T=0;T<c.count;T++){let A=new h(f,d+T*y,2);p8.set(A[0],A[1],1),p8.transformByMatrix3(i),w.set([p8[0],p8[1]],T*x)}n===a?VTt(c,e,w,c.bufferView):$Tt(a,c,t,e,w)}}}}function VTt(e,t,r,n){e.componentType=5126,e.byteOffset=0;let o=(t.json.accessors||[]).reduce((c,l)=>l.bufferView===n?c+1:c,0)>1;t.buffers.push({arrayBuffer:za(r.buffer),byteOffset:0,byteLength:r.buffer.byteLength});let s=t.buffers.length-1;if(t.json.bufferViews=t.json.bufferViews||[],o){t.json.bufferViews.push({buffer:s,byteLength:r.buffer.byteLength,byteOffset:0}),e.bufferView=t.json.bufferViews.length-1;return}let u=t.json.bufferViews[n];u&&(u.buffer=s,u.byteOffset=0,u.byteLength=r.buffer.byteLength,u.byteStride!==void 0&&delete u.byteStride)}function $Tt(e,t,r,n,a){n.buffers.push({arrayBuffer:za(a.buffer),byteOffset:0,byteLength:a.buffer.byteLength}),n.json.bufferViews=n.json.bufferViews||[];let i=n.json.bufferViews;i.push({buffer:n.buffers.length-1,byteLength:a.buffer.byteLength,byteOffset:0});let o=n.json.accessors;o&&(o.push({bufferView:(i==null?void 0:i.length)-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),r.attributes[`TEXCOORD_${e}`]=o.length-1)}function WTt(e){let{offset:t=[0,0],rotation:r=0,scale:n=[1,1]}=e,a=new nr().set(1,0,0,0,1,0,t[0],t[1],1),i=MTt.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),o=qTt.set(n[0],0,0,0,n[1],0,0,0,1);return a.multiplyRight(i).multiplyRight(o)}var JM={};Fa(JM,{decode:()=>JTt,encode:()=>XTt,name:()=>KTt});var Fd="KHR_lights_punctual",KTt=Fd;async function JTt(e){let t=new Xt(e),{json:r}=t,n=t.getExtension(Fd);n&&(t.json.lights=n.lights,t.removeExtension(Fd));for(let a of r.nodes||[]){let i=t.getObjectExtension(a,Fd);i&&(a.light=i.light),t.removeObjectExtension(a,Fd)}}async function XTt(e){let t=new Xt(e),{json:r}=t;if(r.lights){let n=t.addExtension(Fd);Xn(!n.lights),n.lights=r.lights,delete r.lights}if(t.json.lights){for(let n of t.json.lights){let a=n.node;t.addObjectExtension(a,Fd,n)}delete t.json.lights}}var XM={};Fa(XM,{decode:()=>QTt,encode:()=>ZTt,name:()=>YTt});var O1="KHR_materials_unlit",YTt=O1;async function QTt(e){let t=new Xt(e),{json:r}=t;for(let n of r.materials||[])n.extensions&&n.extensions.KHR_materials_unlit&&(n.unlit=!0),t.removeObjectExtension(n,O1);t.removeExtension(O1)}function ZTt(e){let t=new Xt(e),{json:r}=t;if(t.materials)for(let n of r.materials||[])n.unlit&&(delete n.unlit,t.addObjectExtension(n,O1,{}),t.addExtension(O1))}var YM={};Fa(YM,{decode:()=>t6t,encode:()=>r6t,name:()=>e6t});var I1="KHR_techniques_webgl",e6t=I1;async function t6t(e){let t=new Xt(e),{json:r}=t,n=t.getExtension(I1);if(n){let a=n6t(n,t);for(let i of r.materials||[]){let o=t.getObjectExtension(i,I1);o&&(i.technique=Object.assign({},o,a[o.technique]),i.technique.values=a6t(i.technique,t)),t.removeObjectExtension(i,I1)}t.removeExtension(I1)}}async function r6t(e,t){}function n6t(e,t){let{programs:r=[],shaders:n=[],techniques:a=[]}=e,i=new TextDecoder;return n.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=i.decode(t.getTypedArrayForBufferView(o.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),r.forEach(o=>{o.fragmentShader=n[o.fragmentShader],o.vertexShader=n[o.vertexShader]}),a.forEach(o=>{o.program=r[o.program]}),a}function a6t(e,t){let r=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(n=>{e.uniforms[n].value&&!(n in r)&&(r[n]=e.uniforms[n].value)}),Object.keys(r).forEach(n=>{typeof r[n]=="object"&&r[n].index!==void 0&&(r[n].texture=t.getTexture(r[n].index))}),r}var f1e=[t8,ZS,GM,HM,VM,WM,JM,XM,YM,KM,BM],i6t=[t8,ZS];function p1e(e,t={},r){var a;let n=f1e.filter(i=>m1e(i.name,t));for(let i of n)(a=i.preprocess)==null||a.call(i,e,t,r)}async function d1e(e,t={},r){var a;let n=f1e.filter(i=>m1e(i.name,t));for(let i of n)await((a=i.decode)==null?void 0:a.call(i,e,t,r))}function h1e(e,t={}){var r;for(let n of i6t)e=((r=n.encode)==null?void 0:r.call(n,e,t))??e;return e}function m1e(e,t){var a;let r=((a=t==null?void 0:t.gltf)==null?void 0:a.excludeExtensions)||{};return!(e in r&&!r[e])}var QM="KHR_binary_glTF";function g1e(e){let t=new Xt(e),{json:r}=t;for(let n of r.images||[]){let a=t.getObjectExtension(n,QM);a&&Object.assign(n,a),t.removeObjectExtension(n,QM)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,t.removeExtension(QM)}var b1e={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},s6t={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},ZM=class{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;normalize(t,r){this.json=t.json;let n=t.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${n.asset.version}`);return}if(!r.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(n),this._convertTopLevelObjectsToArrays(n),g1e(t),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(let r in b1e)this._convertTopLevelObjectToArray(t,r)}_convertTopLevelObjectToArray(t,r){let n=t[r];if(!(!n||Array.isArray(n))){t[r]=[];for(let a in n){let i=n[a];i.id=i.id||a;let o=t[r].length;t[r].push(i),this.idToIndexMap[r][a]=o}}}_convertObjectIdsToArrayIndices(t){for(let r in b1e)this._convertIdsToIndices(t,r);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(let r of t.textures)this._convertTextureIds(r);for(let r of t.meshes)this._convertMeshIds(r);for(let r of t.nodes)this._convertNodeIds(r);for(let r of t.scenes)this._convertSceneIds(r)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(let r of t.primitives){let{attributes:n,indices:a,material:i}=r;for(let o in n)n[o]=this._convertIdToIndex(n[o],"accessor");a&&(r.indices=this._convertIdToIndex(a,"accessor")),i&&(r.material=this._convertIdToIndex(i,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map(r=>this._convertIdToIndex(r,"node"))),t.meshes&&(t.meshes=t.meshes.map(r=>this._convertIdToIndex(r,"mesh")))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map(r=>this._convertIdToIndex(r,"node")))}_convertIdsToIndices(t,r){t[r]||(console.warn(`gltf v1: json doesn't contain attribute ${r}`),t[r]=[]);for(let n of t[r])for(let a in n){let i=n[a],o=this._convertIdToIndex(i,a);n[a]=o}}_convertIdToIndex(t,r){let n=s6t[r];if(n in this.idToIndexMap){let a=this.idToIndexMap[n][t];if(!Number.isFinite(a))throw new Error(`gltf v1: failed to resolve ${r} with id ${t}`);return a}return t}_updateObjects(t){for(let r of this.json.buffers)delete r.type}_updateMaterial(t){var r,n,a;for(let i of t.materials){i.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let o=((r=i.values)==null?void 0:r.tex)||((n=i.values)==null?void 0:n.texture2d_0)||((a=i.values)==null?void 0:a.diffuseTex),s=t.textures.findIndex(u=>u.id===o);s!==-1&&(i.pbrMetallicRoughness.baseColorTexture={index:s})}}};function v1e(e,t={}){return new ZM().normalize(e,t)}async function x1e(e,t,r=0,n,a){var i,o,s;return u6t(e,t,r,n),v1e(e,{normalize:(i=n==null?void 0:n.gltf)==null?void 0:i.normalize}),p1e(e,n,a),(o=n==null?void 0:n.gltf)!=null&&o.loadBuffers&&e.json.buffers&&await c6t(e,n,a),(s=n==null?void 0:n.gltf)!=null&&s.loadImages&&await l6t(e,n,a),await d1e(e,n,a),e}function u6t(e,t,r,n){var o,s;if((o=n.core)!=null&&o.baseUrl&&(e.baseUri=(s=n.core)==null?void 0:s.baseUrl),t instanceof ArrayBuffer&&!o1e(t,r,n.glb)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=tF(t);else if(t instanceof ArrayBuffer){let u={};r=s1e(u,t,r,n.glb),Xn(u.type==="glTF",`Invalid GLB magic string ${u.type}`),e._glb=u,e.json=u.json}else Xn(!1,"GLTF: must be ArrayBuffer or string");let a=e.json.buffers||[];if(e.buffers=new Array(a.length).fill(null),e._glb&&e._glb.header.hasBinChunk){let{binChunks:u}=e._glb;e.buffers[0]={arrayBuffer:u[0].arrayBuffer,byteOffset:u[0].byteOffset,byteLength:u[0].byteLength}}let i=e.json.images||[];e.images=new Array(i.length).fill({})}async function c6t(e,t,r){var a,i;let n=e.json.buffers||[];for(let o=0;o<n.length;++o){let s=n[o];if(s.uri){let{fetch:u}=r;Xn(u);let c=UM(s.uri,t,r),l=await((a=r==null?void 0:r.fetch)==null?void 0:a.call(r,c)),f=await((i=l==null?void 0:l.arrayBuffer)==null?void 0:i.call(l));e.buffers[o]={arrayBuffer:f,byteOffset:0,byteLength:f.byteLength},delete s.uri}else e.buffers[o]===null&&(e.buffers[o]={arrayBuffer:new ArrayBuffer(s.byteLength),byteOffset:0,byteLength:s.byteLength})}}async function l6t(e,t,r){let n=f6t(e),a=e.json.images||[],i=[];for(let o of n)i.push(p6t(e,a[o],o,t,r));return await Promise.all(i)}function f6t(e){let t=new Set,r=e.json.textures||[];for(let n of r)n.source!==void 0&&t.add(n.source);return Array.from(t).sort()}async function p6t(e,t,r,n,a){let i;if(t.uri&&!t.hasOwnProperty("bufferView")){let c=UM(t.uri,n,a),{fetch:l}=a;i=await(await l(c)).arrayBuffer(),t.bufferView={data:i}}if(Number.isFinite(t.bufferView)){let c=lxe(e.json,e.buffers,t.bufferView);i=Rp(c.buffer,c.byteOffset,c.byteLength)}Xn(i,"glTF image has no data");let o=n,s={...o,core:{...o==null?void 0:o.core,mimeType:t.mimeType}},u=await Hi(i,[ig,Bd],s,a);u&&u[0]&&(u={compressed:!0,mipmaps:!1,width:u[0].width,height:u[0].height,data:u[0]}),e.images=e.images||[],e.images[r]=u}var Yc={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:r8,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:d6t,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0}}};async function d6t(e,t={},r){var o;let n={...Yc.options,...t};n.gltf={...Yc.options.gltf,...n.gltf};let a=((o=t==null?void 0:t.glb)==null?void 0:o.byteOffset)||0;return await x1e({},e,a,n,r)}var h6t=1179937895,m6t=1313821514,g6t=5130562,qu=!0;function y1e(e,t,r=0,n={}){let{magic:a=h6t,version:i=2,json:o={},binary:s}=e,u=r;t&&(t.setUint32(r+0,a,qu),t.setUint32(r+4,i,qu),t.setUint32(r+8,0,qu));let c=r+8;r+=12;let l=r;t&&(t.setUint32(r+0,0,qu),t.setUint32(r+4,m6t,qu)),r+=8;let f=JSON.stringify(o);if(r=f0(t,r,f,4),t){let p=r-l-8;t.setUint32(l+0,p,qu)}if(s){let p=r;if(t&&(t.setUint32(r+0,0,qu),t.setUint32(r+4,g6t,qu)),r+=8,r=vw(t,r,s,4),t){let d=r-p-8;t.setUint32(p+0,d,qu)}}if(t){let p=r-u;t.setUint32(c,p,qu)}return r}function e7(e,t,r,n){return b6t(e),y1e(e,t,r,n)}function b6t(e){if(e.buffers&&e.buffers.length>1)throw new Error("encodeGLTF: multiple buffers not yet implemented")}var t7={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:r8,extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,options:{gltf:{}},encode:async(e,t={})=>_1e(e,t),encodeSync:_1e};function _1e(e,t={}){let{byteOffset:r=0}=t,n=h1e(e),a=e7(n,null,r,t),i=new ArrayBuffer(a),o=new DataView(i);return e7(n,o,r,t),i}var v6t={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},x6t={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Lo={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},y6t={magFilter:Lo.TEXTURE_MAG_FILTER,minFilter:Lo.TEXTURE_MIN_FILTER,wrapS:Lo.TEXTURE_WRAP_S,wrapT:Lo.TEXTURE_WRAP_T},_6t={[Lo.TEXTURE_MAG_FILTER]:Lo.LINEAR,[Lo.TEXTURE_MIN_FILTER]:Lo.NEAREST_MIPMAP_LINEAR,[Lo.TEXTURE_WRAP_S]:Lo.REPEAT,[Lo.TEXTURE_WRAP_T]:Lo.REPEAT};function w6t(){return{id:"default-sampler",parameters:_6t}}function A6t(e){return x6t[e]}function E6t(e){return v6t[e]}var r7=class{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(t,r={}){let{json:n,buffers:a=[],images:i=[]}=t,{baseUri:o=""}=t;return Xn(n),this.baseUri=o,this.buffers=a,this.images=i,this.jsonUnprocessed=n,this.json=this._resolveTree(t.json,r),this.json}_resolveTree(t,r={}){let n={...t};return this.json=n,t.bufferViews&&(n.bufferViews=t.bufferViews.map((a,i)=>this._resolveBufferView(a,i))),t.images&&(n.images=t.images.map((a,i)=>this._resolveImage(a,i))),t.samplers&&(n.samplers=t.samplers.map((a,i)=>this._resolveSampler(a,i))),t.textures&&(n.textures=t.textures.map((a,i)=>this._resolveTexture(a,i))),t.accessors&&(n.accessors=t.accessors.map((a,i)=>this._resolveAccessor(a,i))),t.materials&&(n.materials=t.materials.map((a,i)=>this._resolveMaterial(a,i))),t.meshes&&(n.meshes=t.meshes.map((a,i)=>this._resolveMesh(a,i))),t.nodes&&(n.nodes=t.nodes.map((a,i)=>this._resolveNode(a,i)),n.nodes=n.nodes.map((a,i)=>this._resolveNodeChildren(a))),t.skins&&(n.skins=t.skins.map((a,i)=>this._resolveSkin(a,i))),t.scenes&&(n.scenes=t.scenes.map((a,i)=>this._resolveScene(a,i))),typeof this.json.scene=="number"&&n.scenes&&(n.scene=n.scenes[this.json.scene]),n}getScene(t){return this._get(this.json.scenes,t)}getNode(t){return this._get(this.json.nodes,t)}getSkin(t){return this._get(this.json.skins,t)}getMesh(t){return this._get(this.json.meshes,t)}getMaterial(t){return this._get(this.json.materials,t)}getAccessor(t){return this._get(this.json.accessors,t)}getCamera(t){return this._get(this.json.cameras,t)}getTexture(t){return this._get(this.json.textures,t)}getSampler(t){return this._get(this.json.samplers,t)}getImage(t){return this._get(this.json.images,t)}getBufferView(t){return this._get(this.json.bufferViews,t)}getBuffer(t){return this._get(this.json.buffers,t)}_get(t,r){if(typeof r=="object")return r;let n=t&&t[r];return n||console.warn(`glTF file error: Could not find ${t}[${r}]`),n}_resolveScene(t,r){return{...t,id:t.id||`scene-${r}`,nodes:(t.nodes||[]).map(n=>this.getNode(n))}}_resolveNode(t,r){let n={...t,id:(t==null?void 0:t.id)||`node-${r}`};return t.mesh!==void 0&&(n.mesh=this.getMesh(t.mesh)),t.camera!==void 0&&(n.camera=this.getCamera(t.camera)),t.skin!==void 0&&(n.skin=this.getSkin(t.skin)),t.meshes!==void 0&&t.meshes.length&&(n.mesh=t.meshes.reduce((a,i)=>{let o=this.getMesh(i);return a.id=o.id,a.primitives=a.primitives.concat(o.primitives),a},{primitives:[]})),n}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map(r=>this.getNode(r))),t}_resolveSkin(t,r){let n=typeof t.inverseBindMatrices=="number"?this.getAccessor(t.inverseBindMatrices):void 0;return{...t,id:t.id||`skin-${r}`,inverseBindMatrices:n}}_resolveMesh(t,r){let n={...t,id:t.id||`mesh-${r}`,primitives:[]};return t.primitives&&(n.primitives=t.primitives.map(a=>{let i={...a,attributes:{},indices:void 0,material:void 0},o=a.attributes;for(let s in o)i.attributes[s]=this.getAccessor(o[s]);return a.indices!==void 0&&(i.indices=this.getAccessor(a.indices)),a.material!==void 0&&(i.material=this.getMaterial(a.material)),i})),n}_resolveMaterial(t,r){let n={...t,id:t.id||`material-${r}`};if(n.normalTexture&&(n.normalTexture={...n.normalTexture},n.normalTexture.texture=this.getTexture(n.normalTexture.index)),n.occlusionTexture&&(n.occlusionTexture={...n.occlusionTexture},n.occlusionTexture.texture=this.getTexture(n.occlusionTexture.index)),n.emissiveTexture&&(n.emissiveTexture={...n.emissiveTexture},n.emissiveTexture.texture=this.getTexture(n.emissiveTexture.index)),n.emissiveFactor||(n.emissiveFactor=n.emissiveTexture?[1,1,1]:[0,0,0]),n.pbrMetallicRoughness){n.pbrMetallicRoughness={...n.pbrMetallicRoughness};let a=n.pbrMetallicRoughness;a.baseColorTexture&&(a.baseColorTexture={...a.baseColorTexture},a.baseColorTexture.texture=this.getTexture(a.baseColorTexture.index)),a.metallicRoughnessTexture&&(a.metallicRoughnessTexture={...a.metallicRoughnessTexture},a.metallicRoughnessTexture.texture=this.getTexture(a.metallicRoughnessTexture.index))}return n}_resolveAccessor(t,r){let n=A6t(t.componentType),a=E6t(t.type),i=n*a,o={...t,id:t.id||`accessor-${r}`,bytesPerComponent:n,components:a,bytesPerElement:i,value:void 0,bufferView:void 0,sparse:void 0};if(t.bufferView!==void 0&&(o.bufferView=this.getBufferView(t.bufferView)),o.bufferView){let s=o.bufferView.buffer,{ArrayType:u,byteLength:c}=og(o,o.bufferView),l=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+s.byteOffset,f=Hl(s.arrayBuffer,l,c);o.bufferView.byteStride&&(f=this._getValueFromInterleavedBuffer(s,l,o.bufferView.byteStride,o.bytesPerElement,o.count)),o.value=new u(f)}return o}_getValueFromInterleavedBuffer(t,r,n,a,i){let o=new Uint8Array(i*a);for(let s=0;s<i;s++){let u=r+s*n;o.set(new Uint8Array(t.arrayBuffer.slice(u,u+a)),s*a)}return o.buffer}_resolveTexture(t,r){return{...t,id:t.id||`texture-${r}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):w6t(),source:typeof t.source=="number"?this.getImage(t.source):void 0}}_resolveSampler(t,r){let n={id:t.id||`sampler-${r}`,...t,parameters:{}};for(let a in n){let i=this._enumSamplerParameter(a);i!==void 0&&(n.parameters[i]=n[a])}return n}_enumSamplerParameter(t){return y6t[t]}_resolveImage(t,r){let n={...t,id:t.id||`image-${r}`,image:null,bufferView:t.bufferView!==void 0?this.getBufferView(t.bufferView):void 0},a=this.images[r];return a&&(n.image=a),n}_resolveBufferView(t,r){let n=t.buffer,a=this.buffers[n].arrayBuffer,i=this.buffers[n].byteOffset||0;return t.byteOffset&&(i+=t.byteOffset),{id:`bufferView-${r}`,...t,buffer:this.buffers[n],data:new Uint8Array(a,i,t.byteLength)}}_resolveCamera(t,r){let n={...t,id:t.id||`camera-${r}`};return n.perspective,n.orthographic,n}};function P1(e,t){return new r7().postProcess(e,t)}var h8={URI:0,EMBEDDED:1};function m8(e,t,r,n){e.rotateYtoZ=!0;let a=(e.byteOffset||0)+(e.byteLength||0)-r;if(a===0)throw new Error("glTF byte length must be greater than 0.");return e.gltfUpAxis=n!=null&&n["3d-tiles"]&&n["3d-tiles"].assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",e.gltfArrayBuffer=Rp(t,r,a),e.gltfByteOffset=0,e.gltfByteLength=a,r%4===0||console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`),(e.byteOffset||0)+(e.byteLength||0)}async function g8(e,t,r,n){let a=(r==null?void 0:r["3d-tiles"])||{};if(T6t(e,t,r),a.loadGLTF){if(!n)return;if(e.gltfUrl){let{fetch:i}=n,o=await i(e.gltfUrl,r==null?void 0:r.core);e.gltfArrayBuffer=await o.arrayBuffer(),e.gltfByteOffset=0}if(e.gltfArrayBuffer){let i=await Hi(e.gltfArrayBuffer,Yc,r,n);e.gltf=P1(i),e.gpuMemoryUsageInBytes=C1(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function T6t(e,t,r){switch(t){case h8.URI:if(e.gltfArrayBuffer){let n=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),i=new TextDecoder().decode(n);e.gltfUrl=i.replace(/[\s\0]+$/,"")}delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case h8.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function w1e(e,t,r,n,a){var o;r=S6t(e,t,r,n,a),await g8(e,h8.EMBEDDED,n,a);let i=(o=e==null?void 0:e.gltf)==null?void 0:o.extensions;return i&&i.CESIUM_RTC&&(e.rtcCenter=i.CESIUM_RTC.center),r}function S6t(e,t,r,n,a){r=jf(e,t,r),r=rg(e,t,r),r=ng(e,t,r,n),r=m8(e,t,r,n);let i=new Jc(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=i.getGlobalProperty("RTC_CENTER",ht.FLOAT,3),r}async function A1e(e,t,r,n,a){return r=k6t(e,t,r,n,a),await g8(e,e.gltfFormat||0,n,a),r}function k6t(e,t,r,n,a){var c;if(r=jf(e,t,r),e.version!==1)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);r=rg(e,t,r);let i=new DataView(t);if(e.gltfFormat=i.getUint32(r,!0),r+=4,r=ng(e,t,r,n),r=m8(e,t,r,n),!((c=e==null?void 0:e.header)!=null&&c.featureTableJsonByteLength)||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let o=new Jc(e.featureTableJson,e.featureTableBinary),s=o.getGlobalProperty("INSTANCES_LENGTH");if(o.featuresLength=s,!Number.isFinite(s))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=o.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=o.getGlobalProperty("RTC_CENTER",ht.FLOAT,3);let u=new kd(e.batchTableJson,e.batchTableBinary,s);return C6t(e,o,u,s),r}function C6t(e,t,r,n){let a=new Array(n),i=new Z,o=new Z,s=new Z,u=new Z,c=new nr,l=new Io,f=new Z,p={},d=new mr,h=[],m=[],g=[],x=[];for(let y=0;y<n;y++){let w;if(t.hasProperty("POSITION"))w=t.getProperty("POSITION",ht.FLOAT,3,y,i);else if(t.hasProperty("POSITION_QUANTIZED")){w=t.getProperty("POSITION_QUANTIZED",ht.UNSIGNED_SHORT,3,y,i);let k=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",ht.FLOAT,3);if(!k)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let F=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",ht.FLOAT,3);if(!F)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let R=65535;for(let G=0;G<3;G++)w[G]=w[G]/R*F[G]+k[G]}if(!w)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");i.copy(w),p.translation=i,e.normalUp=t.getProperty("NORMAL_UP",ht.FLOAT,3,y,h),e.normalRight=t.getProperty("NORMAL_RIGHT",ht.FLOAT,3,y,m);let T=!1;if(e.normalUp){if(!e.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");e.hasCustomOrientation=!0}else{if(e.octNormalUp=t.getProperty("NORMAL_UP_OCT32P",ht.UNSIGNED_SHORT,2,y,h),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",ht.UNSIGNED_SHORT,2,y,m),e.octNormalUp)throw e.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");e.eastNorthUp?(Ft.WGS84.eastNorthUpToFixedFrame(i,d),d.getRotationMatrix3(c)):c.identity()}T&&(u.copy(o).cross(s).normalize(),c.setColumn(0,o),c.setColumn(1,s),c.setColumn(2,u)),l.fromMatrix3(c),p.rotation=l,f.set(1,1,1);let A=t.getProperty("SCALE",ht.FLOAT,1,y,g);Number.isFinite(A)&&f.multiplyByScalar(A);let B=t.getProperty("SCALE_NON_UNIFORM",ht.FLOAT,3,y,h);B&&f.scale(B),p.scale=f;let I=t.getProperty("BATCH_ID",ht.UNSIGNED_SHORT,1,y,x);I===void 0&&(I=y);let L=new mr().fromQuaternion(p.rotation);d.identity(),d.translate(p.translation),d.multiplyRight(L),d.scale(p.scale);let C=d.clone();a[y]={modelMatrix:C,batchId:I}}e.instances=a}async function E1e(e,t,r,n,a,i){r=jf(e,t,r);let o=new DataView(t);for(e.tilesLength=o.getUint32(r,!0),r+=4,e.tiles=[];e.tiles.length<e.tilesLength&&(e.byteLength||0)-r>12;){let s={shape:"tile3d"};e.tiles.push(s),r=await i(t,r,n,a,s)}return r}async function T1e(e,t,r,n){var a,i;if(e.rotateYtoZ=!0,e.gltfUpAxis=(a=r==null?void 0:r["3d-tiles"])!=null&&a.assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",(i=r==null?void 0:r["3d-tiles"])!=null&&i.loadGLTF){if(!n)return t.byteLength;let o=await Hi(t,Yc,r,n);e.gltf=P1(o),e.gpuMemoryUsageInBytes=C1(e.gltf)}else e.gltfArrayBuffer=t;return t.byteLength}async function n7(e,t=0,r,n,a={shape:"tile3d"}){switch(a.byteOffset=t,a.type=Dve(e,t),a.type){case pa.COMPOSITE:return await E1e(a,e,t,r,n,n7);case pa.BATCHED_3D_MODEL:return await w1e(a,e,t,r,n);case pa.GLTF:return await T1e(a,e,r,n);case pa.INSTANCED_3D_MODEL:return await A1e(a,e,t,r,n);case pa.POINT_CLOUD:return await Kve(a,e,t,r,n);default:throw new Error(`3DTileLoader: unknown type ${a.type}`)}}async function a7(e,t,r){if(new Uint32Array(e.slice(0,4))[0]!==1952609651)throw new Error("Wrong subtree file magic number");if(new Uint32Array(e.slice(4,8))[0]!==1)throw new Error("Wrong subtree file verson, must be 1");let i=S1e(e.slice(8,16)),o=new Uint8Array(e,24,i),u=new TextDecoder("utf8").decode(o),c=JSON.parse(u),l=S1e(e.slice(16,24)),f=new ArrayBuffer(0);if(l&&(f=e.slice(24+i)),await b8(c,c.tileAvailability,f,r),Array.isArray(c.contentAvailability))for(let p of c.contentAvailability)await b8(c,p,f,r);else await b8(c,c.contentAvailability,f,r);return await b8(c,c.childSubtreeAvailability,f,r),c}async function b8(e,t,r,n){let a=Number.isFinite(t.bitstream)?t.bitstream:t.bufferView;if(typeof a!="number")return;let i=e.bufferViews[a],o=e.buffers[i.buffer];if(!(n!=null&&n.baseUrl))throw new Error("Url is not provided");if(!n.fetch)throw new Error("fetch is not provided");if(o.uri){let u=`${(n==null?void 0:n.baseUrl)||""}/${o.uri}`,l=await(await n.fetch(u)).arrayBuffer();t.explicitBitstream=new Uint8Array(l,i.byteOffset,i.byteLength);return}let s=e.buffers.slice(0,i.buffer).reduce((u,c)=>u+c.byteLength,0);t.explicitBitstream=new Uint8Array(r.slice(s,s+o.byteLength),i.byteOffset,i.byteLength)}function S1e(e){let t=new DataView(e),r=t.getUint32(0,!0),n=t.getUint32(4,!0);return r+2**32*n}var v8={dataType:null,batchType:null,id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Zm,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:a7,options:{}};var Mo=null;try{Mo=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Tr(e,t,r){this.low=e|0,this.high=t|0,this.unsigned=!!r}Tr.prototype.__isLong__;Object.defineProperty(Tr.prototype,"__isLong__",{value:!0});function Wa(e){return(e&&e.__isLong__)===!0}function k1e(e){var t=Math.clz32(e&-e);return e?31-t:t}Tr.isLong=Wa;var C1e={},D1e={};function Od(e,t){var r,n,a;return t?(e>>>=0,(a=0<=e&&e<256)&&(n=D1e[e],n)?n:(r=cr(e,0,!0),a&&(D1e[e]=r),r)):(e|=0,(a=-128<=e&&e<128)&&(n=C1e[e],n)?n:(r=cr(e,e<0?-1:0,!1),a&&(C1e[e]=r),r))}Tr.fromInt=Od;function qo(e,t){if(isNaN(e))return t?Qc:Ss;if(t){if(e<0)return Qc;if(e>=I1e)return j1e}else{if(e<=-F1e)return Bi;if(e+1>=F1e)return R1e}return e<0?qo(-e,t).neg():cr(e%vg|0,e/vg|0,t)}Tr.fromNumber=qo;function cr(e,t,r){return new Tr(e,t,r)}Tr.fromBits=cr;var x8=Math.pow;function o7(e,t,r){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(r=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?Qc:Ss;if(r=r||10,r<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(n===0)return o7(e.substring(1),t,r).neg();for(var a=qo(x8(r,8)),i=Ss,o=0;o<e.length;o+=8){var s=Math.min(8,e.length-o),u=parseInt(e.substring(o,o+s),r);if(s<8){var c=qo(x8(r,s));i=i.mul(c).add(qo(u))}else i=i.mul(a),i=i.add(qo(u))}return i.unsigned=t,i}Tr.fromString=o7;function No(e,t){return typeof e=="number"?qo(e,t):typeof e=="string"?o7(e,t):cr(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}Tr.fromValue=No;var B1e=1<<16,D6t=1<<24,vg=B1e*B1e,I1e=vg*vg,F1e=I1e/2,O1e=Od(D6t),Ss=Od(0);Tr.ZERO=Ss;var Qc=Od(0,!0);Tr.UZERO=Qc;var bg=Od(1);Tr.ONE=bg;var P1e=Od(1,!0);Tr.UONE=P1e;var i7=Od(-1);Tr.NEG_ONE=i7;var R1e=cr(-1,2147483647,!1);Tr.MAX_VALUE=R1e;var j1e=cr(-1,-1,!0);Tr.MAX_UNSIGNED_VALUE=j1e;var Bi=cr(0,-2147483648,!1);Tr.MIN_VALUE=Bi;var Se=Tr.prototype;Se.toInt=function(){return this.unsigned?this.low>>>0:this.low};Se.toNumber=function(){return this.unsigned?(this.high>>>0)*vg+(this.low>>>0):this.high*vg+(this.low>>>0)};Se.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Bi)){var r=qo(t),n=this.div(r),a=n.mul(r).sub(this);return n.toString(t)+a.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var i=qo(x8(t,6),this.unsigned),o=this,s="";;){var u=o.div(i),c=o.sub(u.mul(i)).toInt()>>>0,l=c.toString(t);if(o=u,o.isZero())return l+s;for(;l.length<6;)l="0"+l;s=""+l+s}};Se.getHighBits=function(){return this.high};Se.getHighBitsUnsigned=function(){return this.high>>>0};Se.getLowBits=function(){return this.low};Se.getLowBitsUnsigned=function(){return this.low>>>0};Se.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Bi)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,r=31;r>0&&!(t&1<<r);r--);return this.high!=0?r+33:r+1};Se.isSafeInteger=function(){var t=this.high>>21;return t?this.unsigned?!1:t===-1&&!(this.low===0&&this.high===-2097152):!0};Se.isZero=function(){return this.high===0&&this.low===0};Se.eqz=Se.isZero;Se.isNegative=function(){return!this.unsigned&&this.high<0};Se.isPositive=function(){return this.unsigned||this.high>=0};Se.isOdd=function(){return(this.low&1)===1};Se.isEven=function(){return(this.low&1)===0};Se.equals=function(t){return Wa(t)||(t=No(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};Se.eq=Se.equals;Se.notEquals=function(t){return!this.eq(t)};Se.neq=Se.notEquals;Se.ne=Se.notEquals;Se.lessThan=function(t){return this.comp(t)<0};Se.lt=Se.lessThan;Se.lessThanOrEqual=function(t){return this.comp(t)<=0};Se.lte=Se.lessThanOrEqual;Se.le=Se.lessThanOrEqual;Se.greaterThan=function(t){return this.comp(t)>0};Se.gt=Se.greaterThan;Se.greaterThanOrEqual=function(t){return this.comp(t)>=0};Se.gte=Se.greaterThanOrEqual;Se.ge=Se.greaterThanOrEqual;Se.compare=function(t){if(Wa(t)||(t=No(t)),this.eq(t))return 0;var r=this.isNegative(),n=t.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};Se.comp=Se.compare;Se.negate=function(){return!this.unsigned&&this.eq(Bi)?Bi:this.not().add(bg)};Se.neg=Se.negate;Se.add=function(t){Wa(t)||(t=No(t));var r=this.high>>>16,n=this.high&65535,a=this.low>>>16,i=this.low&65535,o=t.high>>>16,s=t.high&65535,u=t.low>>>16,c=t.low&65535,l=0,f=0,p=0,d=0;return d+=i+c,p+=d>>>16,d&=65535,p+=a+u,f+=p>>>16,p&=65535,f+=n+s,l+=f>>>16,f&=65535,l+=r+o,l&=65535,cr(p<<16|d,l<<16|f,this.unsigned)};Se.subtract=function(t){return Wa(t)||(t=No(t)),this.add(t.neg())};Se.sub=Se.subtract;Se.multiply=function(t){if(this.isZero())return this;if(Wa(t)||(t=No(t)),Mo){var r=Mo.mul(this.low,this.high,t.low,t.high);return cr(r,Mo.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?Qc:Ss;if(this.eq(Bi))return t.isOdd()?Bi:Ss;if(t.eq(Bi))return this.isOdd()?Bi:Ss;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(O1e)&&t.lt(O1e))return qo(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,a=this.high&65535,i=this.low>>>16,o=this.low&65535,s=t.high>>>16,u=t.high&65535,c=t.low>>>16,l=t.low&65535,f=0,p=0,d=0,h=0;return h+=o*l,d+=h>>>16,h&=65535,d+=i*l,p+=d>>>16,d&=65535,d+=o*c,p+=d>>>16,d&=65535,p+=a*l,f+=p>>>16,p&=65535,p+=i*c,f+=p>>>16,p&=65535,p+=o*u,f+=p>>>16,p&=65535,f+=n*l+a*c+i*u+o*s,f&=65535,cr(d<<16|h,f<<16|p,this.unsigned)};Se.mul=Se.multiply;Se.divide=function(t){if(Wa(t)||(t=No(t)),t.isZero())throw Error("division by zero");if(Mo){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?Mo.div_u:Mo.div_s)(this.low,this.high,t.low,t.high);return cr(r,Mo.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Qc:Ss;var n,a,i;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return Qc;if(t.gt(this.shru(1)))return P1e;i=Qc}else{if(this.eq(Bi)){if(t.eq(bg)||t.eq(i7))return Bi;if(t.eq(Bi))return bg;var o=this.shr(1);return n=o.div(t).shl(1),n.eq(Ss)?t.isNegative()?bg:i7:(a=this.sub(t.mul(n)),i=n.add(a.div(t)),i)}else if(t.eq(Bi))return this.unsigned?Qc:Ss;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();i=Ss}for(a=this;a.gte(t);){n=Math.max(1,Math.floor(a.toNumber()/t.toNumber()));for(var s=Math.ceil(Math.log(n)/Math.LN2),u=s<=48?1:x8(2,s-48),c=qo(n),l=c.mul(t);l.isNegative()||l.gt(a);)n-=u,c=qo(n,this.unsigned),l=c.mul(t);c.isZero()&&(c=bg),i=i.add(c),a=a.sub(l)}return i};Se.div=Se.divide;Se.modulo=function(t){if(Wa(t)||(t=No(t)),Mo){var r=(this.unsigned?Mo.rem_u:Mo.rem_s)(this.low,this.high,t.low,t.high);return cr(r,Mo.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};Se.mod=Se.modulo;Se.rem=Se.modulo;Se.not=function(){return cr(~this.low,~this.high,this.unsigned)};Se.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};Se.clz=Se.countLeadingZeros;Se.countTrailingZeros=function(){return this.low?k1e(this.low):k1e(this.high)+32};Se.ctz=Se.countTrailingZeros;Se.and=function(t){return Wa(t)||(t=No(t)),cr(this.low&t.low,this.high&t.high,this.unsigned)};Se.or=function(t){return Wa(t)||(t=No(t)),cr(this.low|t.low,this.high|t.high,this.unsigned)};Se.xor=function(t){return Wa(t)||(t=No(t)),cr(this.low^t.low,this.high^t.high,this.unsigned)};Se.shiftLeft=function(t){return Wa(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?cr(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):cr(0,this.low<<t-32,this.unsigned)};Se.shl=Se.shiftLeft;Se.shiftRight=function(t){return Wa(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?cr(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):cr(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};Se.shr=Se.shiftRight;Se.shiftRightUnsigned=function(t){return Wa(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?cr(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?cr(this.high,0,this.unsigned):cr(this.high>>>t-32,0,this.unsigned)};Se.shru=Se.shiftRightUnsigned;Se.shr_u=Se.shiftRightUnsigned;Se.rotateLeft=function(t){var r;return Wa(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?cr(this.high,this.low,this.unsigned):t<32?(r=32-t,cr(this.low<<t|this.high>>>r,this.high<<t|this.low>>>r,this.unsigned)):(t-=32,r=32-t,cr(this.high<<t|this.low>>>r,this.low<<t|this.high>>>r,this.unsigned))};Se.rotl=Se.rotateLeft;Se.rotateRight=function(t){var r;return Wa(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?cr(this.high,this.low,this.unsigned):t<32?(r=32-t,cr(this.high<<r|this.low>>>t,this.low<<r|this.high>>>t,this.unsigned)):(t-=32,r=32-t,cr(this.low<<r|this.high>>>t,this.high<<r|this.low>>>t,this.unsigned))};Se.rotr=Se.rotateRight;Se.toSigned=function(){return this.unsigned?cr(this.low,this.high,!1):this};Se.toUnsigned=function(){return this.unsigned?this:cr(this.low,this.high,!0)};Se.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};Se.toBytesLE=function(){var t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};Se.toBytesBE=function(){var t=this.high,r=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,r>>>24,r>>>16&255,r>>>8&255,r&255]};Tr.fromBytes=function(t,r,n){return n?Tr.fromBytesLE(t,r):Tr.fromBytesBE(t,r)};Tr.fromBytesLE=function(t,r){return new Tr(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)};Tr.fromBytesBE=function(t,r){return new Tr(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)};typeof BigInt=="function"&&(Tr.fromBigInt=function(t,r){var n=Number(BigInt.asIntN(32,t)),a=Number(BigInt.asIntN(32,t>>BigInt(32)));return cr(n,a,r)},Tr.fromValue=function(t,r){return typeof t=="bigint"?Tr.fromBigInt(t,r):No(t,r)},Se.toBigInt=function(){var t=BigInt(this.low>>>0),r=BigInt(this.unsigned?this.high>>>0:this.high);return r<<BigInt(32)|t});var xg=Tr;var B6t=16;function R1(e){e==="X"&&(e="");let t=e.padEnd(B6t,"0");return xg.fromString(t,!0,16)}function s7(e){if(e.isZero())return"X";let t=e.countTrailingZeros(),r=t%4;t=(t-r)/4;let n=t;t*=4;let i=e.shiftRightUnsigned(t).toString(16).replace(/0+$/,"");return Array(17-n-i.length).join("0")+i}function u7(e,t){let r=F6t(e).shiftRightUnsigned(2);return e.add(xg.fromNumber(2*t+1-4).multiply(r))}function F6t(e){return e.and(e.not().add(1))}var O6t=3,I6t=30,P6t=2*I6t+1,L1e=180/Math.PI;function q1e(e){if(e.length===0)throw new Error(`Invalid Hilbert quad key ${e}`);let t=e.split("/"),r=parseInt(t[0],10),n=t[1],a=n.length,i=0,o=[0,0];for(let s=a-1;s>=0;s--){i=a-s;let u=n[s],c=0,l=0;u==="1"?l=1:u==="2"?(c=1,l=1):u==="3"&&(c=1);let f=Math.pow(2,i-1);R6t(f,o,c,l),o[0]+=f*c,o[1]+=f*l}if(r%2===1){let s=o[0];o[0]=o[1],o[1]=s}return{face:r,ij:o,level:i}}function N1e(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<O6t+P6t;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),a=t.substring(3,r),i=a.length/2,o=xg.fromString(n,!0,2).toString(10),s="";if(i!==0)for(s=xg.fromString(a,!0,2).toString(4);s.length<i;)s="0"+s;return`${o}/${s}`}function c7(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function M1e(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function l7(e){return[M1e(e[0]),M1e(e[1])]}function f7(e,[t,r]){switch(e){case 0:return[1,t,r];case 1:return[-t,1,r];case 2:return[-t,-r,1];case 3:return[-1,-r,-t];case 4:return[r,-1,-t];case 5:return[r,t,-1];default:throw new Error("Invalid face")}}function p7([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*L1e,n*L1e]}function R6t(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let a=t[0];t[0]=t[1],t[1]=a}}function U1e(e){let t=c7(e.ij,e.level,[.5,.5]),r=l7(t),n=f7(e.face,r);return p7(n)}var j6t=100;function d7(e){let{face:t,ij:r,level:n}=e,a=[[0,0],[0,1],[1,1],[1,0],[0,0]],i=Math.max(1,Math.ceil(j6t*Math.pow(2,-n))),o=new Float64Array(4*i*2+2),s=0,u=0;for(let c=0;c<4;c++){let l=a[c].slice(0),f=a[c+1],p=(f[0]-l[0])/i,d=(f[1]-l[1])/i;for(let h=0;h<i;h++){l[0]+=p,l[1]+=d;let m=c7(r,n,l),g=l7(m),x=f7(t,g),y=p7(x);Math.abs(y[1])>89.999&&(y[0]=u);let w=y[0]-u;y[0]+=w>180?-360:w<-180?360:0,o[s++]=y[0],o[s++]=y[1],u=y[0]}}return o[s++]=o[0],o[s++]=o[1],o}function yg(e){let t=L6t(e);return q1e(t)}function L6t(e){if(e.indexOf("/")>0)return e;let t=R1(e);return N1e(t)}function h7(e){let t=yg(e);return U1e(t)}function G1e(e){let t;if(e.face===2||e.face===5){let r=null,n=0;for(let a=0;a<4;a++){let i=`${e.face}/${a}`,o=yg(i),s=d7(o);(typeof r>"u"||r===null)&&(r=new Float64Array(4*s.length)),r.set(s,n),n+=s.length}t=z1e(r)}else{let r=d7(e);t=z1e(r)}return t}function z1e(e){if(e.length%2!==0)throw new Error("Invalid corners");let t=[],r=[];for(let n=0;n<e.length;n+=2)t.push(e[n]),r.push(e[n+1]);return t.sort((n,a)=>n-a),r.sort((n,a)=>n-a),{west:t[0],east:t[t.length-1],north:r[r.length-1],south:r[0]}}function m7(e,t){let r=(t==null?void 0:t.minimumHeight)||0,n=(t==null?void 0:t.maximumHeight)||0,a=yg(e),i=G1e(a),o=i.west,s=i.south,u=i.east,c=i.north,l=[];return l.push(new Z(o,c,r)),l.push(new Z(u,c,r)),l.push(new Z(u,s,r)),l.push(new Z(o,s,r)),l.push(new Z(o,c,n)),l.push(new Z(u,c,n)),l.push(new Z(u,s,n)),l.push(new Z(o,s,n)),l}function y8(e){let t=e.token,r={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},n=m7(t,r),a=h7(t),i=a[0],o=a[1],s=Ft.WGS84.cartographicToCartesian([i,o,r.maximumHeight]),u=new Z(s[0],s[1],s[2]);n.push(u);let c=A1(n);return[...c.center,...c.halfAxes]}var M6t=4,q6t=8,N6t={QUADTREE:M6t,OCTREE:q6t};function U6t(e,t,r){if(e!=null&&e.box){let n=R1(e.s2VolumeInfo.token),a=u7(n,t),i=s7(a),o={...e.s2VolumeInfo};switch(o.token=i,r){case"OCTREE":let c=e.s2VolumeInfo,l=c.maximumHeight-c.minimumHeight,f=l/2,p=c.minimumHeight+l/2;c.minimumHeight=p-f,c.maximumHeight=p+f;break;default:break}return{box:y8(o),s2VolumeInfo:o}}}async function b7(e){let{subtree:t,subtreeData:r={level:0,x:0,y:0,z:0},parentData:n={mortonIndex:0,localLevel:-1,localX:0,localY:0,localZ:0},childIndex:a=0,implicitOptions:i,loaderOptions:o,s2VolumeBox:s}=e,{subdivisionScheme:u,subtreeLevels:c,maximumLevel:l,contentUrlTemplate:f,subtreesUriTemplate:p,basePath:d}=i,h={children:[],lodMetricValue:0,contentUrl:""};if(!l)return MB.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${f} won't be loaded...`),h;let m=n.localLevel+1,g=r.level+m;if(g>l)return h;let x=N6t[u],y=Math.log2(x),w=a&1,T=a>>1&1,A=a>>2&1,B=Id(n.localX,w,1),I=Id(n.localY,T,1),L=Id(n.localZ,A,1),C=Id(r.x,B,m),k=Id(r.y,I,m),F=Id(r.z,L,m),R=Id(n.mortonIndex,a,y),G=m===c&&g7(t.childSubtreeAvailability,R),z,W,Y,ue;if(G){let fe=`${d}/${p}`,me=_8(fe,g,C,k,F);z=await Wr(me,v8,o),ue=0,W={level:g,x:C,y:k,z:F},Y={mortonIndex:0,localLevel:0,localX:0,localY:0,localZ:0}}else z=t,ue=(x**m-1)/(x-1)+R,W=r,Y={mortonIndex:R,localLevel:m,localX:B,localY:I,localZ:L};if(!g7(z.tileAvailability,ue))return h;g7(z.contentAvailability,ue)&&(h.contentUrl=_8(f,g,C,k,F));for(let fe=0;fe<x;fe++){let me=U6t(s,fe,u),ye=await b7({subtree:z,subtreeData:W,parentData:Y,childIndex:fe,implicitOptions:i,loaderOptions:o,s2VolumeBox:me});(ye.contentUrl||ye.children.length)&&h.children.push(ye)}return h.contentUrl||h.children.length?z6t(h,{level:g,x:C,y:k,z:F},i,s):h}function g7(e,t){let r;return Array.isArray(e)?(r=e[0],e.length>1&&MB.once('Not supported extension "3DTILES_multiple_contents" has been detected')):r=e,"constant"in r?Boolean(r.constant):r.explicitBitstream?V6t(t,r.explicitBitstream):!1}function z6t(e,t,r,n){let{basePath:a,refine:i,getRefine:o,lodMetricType:s,getTileType:u,rootLodMetricValue:c,rootBoundingVolume:l}=r,f=e.contentUrl&&e.contentUrl.replace(`${a}/`,""),p=c/2**t.level,d=n!=null&&n.box?{box:n.box}:l,h=G6t(d,t,r.subdivisionScheme);return{children:e.children,contentUrl:e.contentUrl,content:{uri:f},id:e.contentUrl,refine:o(i),type:u(e),lodMetricType:s,lodMetricValue:p,geometricError:p,transform:e.transform,boundingVolume:h}}function G6t(e,t,r){if(e.region){let{level:n,x:a,y:i,z:o}=t,[s,u,c,l,f,p]=e.region,d=2**n,h=(c-s)/d,[m,g]=[s+h*a,s+h*(a+1)],x=(l-u)/d,[y,w]=[u+x*i,u+x*(i+1)],T,A;if(r==="OCTREE"){let B=(p-f)/d;[T,A]=[f+B*o,f+B*(o+1)]}else[T,A]=[f,p];return{region:[m,y,g,w,T,A]}}if(e.box)return e;throw new Error(`Unsupported bounding volume type ${JSON.stringify(e)}`)}function Id(e,t,r){return(e<<r)+t}function _8(e,t,r,n,a){let i=H6t({level:t,x:r,y:n,z:a});return e.replace(/{level}|{x}|{y}|{z}/gi,o=>i[o])}function H6t(e){let t={};for(let r in e)t[`{${r}}`]=e[r];return t}function V6t(e,t){let r=Math.floor(e/8),n=e%8;return(t[r]>>n&1)===1}function x7(e,t=""){if(!t)return"empty";let n=t.split("?")[0].split(".").pop();switch(n){case"pnts":return"pointcloud";case"i3dm":case"b3dm":case"glb":case"gltf":return"scenegraph";default:return n||"empty"}}function y7(e){switch(e){case"REPLACE":case"replace":return 2;case"ADD":case"add":return 1;default:return e}}function v7(e,t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){let n=new URL(e,`${t}/`);return decodeURI(n.toString())}else if(e.startsWith("/"))return e;return Ga.resolve(t,e)}function H1e(e,t){var a;if(!e)return null;let r;if(e.content){let i=e.content.uri||((a=e.content)==null?void 0:a.url);typeof i<"u"&&(r=v7(i,t))}return{...e,id:r,contentUrl:r,lodMetricType:"geometricError",lodMetricValue:e.geometricError,transformMatrix:e.transform,type:x7(e,r),refine:y7(e.refine)}}async function W1e(e,t,r){let n=null,a=$1e(e.root);a&&e.root?n=await V1e(e.root,e,t,a,r):n=H1e(e.root,t);let i=[];for(i.push(n);i.length>0;){let o=i.pop()||{},s=o.children||[],u=[];for(let c of s){let l=$1e(c),f;l?f=await V1e(c,e,t,l,r):f=H1e(c,t),f&&(u.push(f),i.push(f))}o.children=u}return n}async function V1e(e,t,r,n,a){var T,A,B;let{subdivisionScheme:i,maximumLevel:o,availableLevels:s,subtreeLevels:u,subtrees:{uri:c}}=n,l=_8(c,0,0,0,0),f=v7(l,r),p=await Wr(f,v8,a),d=(T=e.content)==null?void 0:T.uri,h=d?v7(d,r):"",m=(A=t==null?void 0:t.root)==null?void 0:A.refine,g=e.geometricError,x=(B=e.boundingVolume.extensions)==null?void 0:B["3DTILES_bounding_volume_S2"];if(x){let L={box:y8(x),s2VolumeInfo:x};e.boundingVolume=L}let y=e.boundingVolume,w={contentUrlTemplate:h,subtreesUriTemplate:c,subdivisionScheme:i,subtreeLevels:u,maximumLevel:Number.isFinite(s)?s-1:o,refine:m,basePath:r,lodMetricType:"geometricError",rootLodMetricValue:g,rootBoundingVolume:y,getTileType:x7,getRefine:y7};return await $6t(e,r,p,w,a)}async function $6t(e,t,r,n,a){if(!e)return null;let{children:i,contentUrl:o}=await b7({subtree:r,implicitOptions:n,loaderOptions:a}),s,u=null;return o&&(s=o,u={uri:o.replace(`${t}/`,"")}),{...e,id:s,contentUrl:s,lodMetricType:"geometricError",lodMetricValue:e.geometricError,transformMatrix:e.transform,type:x7(e,s),refine:y7(e.refine),content:u||e.content,children:i}}function $1e(e){var t;return((t=e==null?void 0:e.extensions)==null?void 0:t["3DTILES_implicit_tiling"])||(e==null?void 0:e.implicitTiling)}var Nu={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Zm,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:W6t,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function W6t(e,t={},r){let n=t["3d-tiles"]||{},a;return n.isTileset==="auto"?a=(r==null?void 0:r.url)&&r.url.indexOf(".json")!==-1:a=n.isTileset,a?K6t(e,t,r):J6t(e,t,r)}async function K6t(e,t,r){var u;let n=JSON.parse(new TextDecoder().decode(e)),a=(r==null?void 0:r.url)||"",i=X6t(a),o=await W1e(n,i,t||{});return{...n,shape:"tileset3d",loader:Nu,url:a,queryString:(r==null?void 0:r.queryString)||"",basePath:i,root:o||n.root,type:"TILES3D",lodMetricType:"geometricError",lodMetricValue:((u=n.root)==null?void 0:u.geometricError)||0}}async function J6t(e,t,r){let n={content:{shape:"tile3d",featureIds:null}};return await n7(e,0,t,r,n.content),n.content}function X6t(e){return Ga.dirname(e)}var K1e="https://api.cesium.com/v1/assets";async function J1e(e,t){var i;if(!t){let o=await Y6t(e);for(let s of o.items)s.type==="3DTILES"&&(t=s.id)}let r=await Q6t(e,t),n=r.type,a=((i=r.options)==null?void 0:i.url)||r.url;return yt(n==="3DTILES"&&a),r.headers={Authorization:`Bearer ${r.accessToken||e}`},r}async function Y6t(e){yt(e);let t=K1e,r={Authorization:`Bearer ${e}`},n=await si(t,{headers:r});if(!n.ok)throw new Error(n.statusText);return await n.json()}async function Q6t(e,t){yt(e,t);let r={Authorization:`Bearer ${e}`},n=`${K1e}/${t}`,a=await si(`${n}`,{headers:r});if(!a.ok)throw new Error(a.statusText);let i=await a.json();if(a=await si(`${n}/endpoint`,{headers:r}),!a.ok)throw new Error(a.statusText);let o=await a.json();return i={...i,...o},i}async function Z6t(e,t={}){t=t["cesium-ion"]||{};let{accessToken:r}=t,n=t.assetId;if(!Number.isFinite(n)){let a=e.match(/\/([0-9]+)\/tileset.json/);n=a&&a[1]}return J1e(r,n)}var w8={...Nu,id:"cesium-ion",name:"Cesium Ion",preload:Z6t,parse:async(e,t,r)=>(t={...t},t["3d-tiles"]=t["cesium-ion"],t.loader=w8,Nu.parse(e,t,r)),options:{"cesium-ion":{...Nu.options["3d-tiles"],accessToken:null}}};var aAe=Ct(nAe(),1),x4t="4.4.1",uN={dataType:null,batchType:null,id:"zip",module:"zip",name:"Zip Archive",version:x4t,extensions:["zip"],mimeTypes:["application/zip"],category:"archive",tests:["PK"],options:{},parse:y4t};async function y4t(e,t={}){let r=[],n={};try{let a=new aAe.default;return(await a.loadAsync(e,t)).forEach((o,s)=>{if(s.dir)return;let u=s.name,c=_4t(a,u,t).then(l=>{n[o]=l});r.push(c)}),await Promise.all(r),n}catch(a){throw t.log.error(`Unable to read zip archive: ${a}`),a}}async function _4t(e,t,r={}){try{return await e.file(t).async(r.dataType||"arraybuffer")}catch(n){return r.log.error(`Unable to read ${t} from zip archive: ${n}`),n}}function by(e){return typeof e=="bigint"?e:BigInt(e)}function oAe(e){let t=Number(e);if(!Number.isFinite(t))throw new Error("Offset is out of bounds");return t}function iAe(e,t){return e<0?Math.max(t+e,0):Math.min(e,t)}async function Jr(e,t,r){let n=by(t),i=by(r)-n;if(i<0)throw new Error("Invalid range requested");return await e.read(n,oAe(i))}async function Kd(e,t,r){let n=await Jr(e,t,r);return new DataView(n)}async function sAe(e,t){return(await Kd(e,t,by(t)+2n)).getUint16(0,!0)}async function cN(e,t){return(await Kd(e,t,by(t)+4n)).getUint32(0,!0)}async function xy(e,t){return(await Kd(e,t,by(t)+8n)).getBigUint64(0,!0)}async function yy(e){if(e.bigsize>0n)return e.bigsize;if(e.size>0)return BigInt(e.size);if(e.stat){let t=await e.stat();if((t==null?void 0:t.bigsize)!==void 0)return t.bigsize;if((t==null?void 0:t.size)!==void 0)return BigInt(t.size)}return 0n}var vy=class{handle;size;bigsize;url;constructor(t,r=""){this.handle=t,this.size=t.byteLength,this.bigsize=BigInt(t.byteLength),this.url=r}async close(){}async stat(){return{size:this.size,bigsize:this.bigsize,isDirectory:!1}}async read(t=0,r){let n=oAe(t),a=r?n+r:this.size,i=iAe(n,this.size),o=iAe(a,this.size),u=Math.max(o,i)-i;return u<=0?new ArrayBuffer(0):Hl(this.handle.buffer,i,u)}};var w4t=1024,Jd=async(e,t)=>{let r=await yy(e),n=new Uint8Array(await Jr(e,r-3n,r+1n)),a=[n[3],n[2],n[1],void 0],i=-1,o=r-4n;do{let s=o;o-=BigInt(w4t),o=o>=0n?o:0n;let u=new Uint8Array(await Jr(e,o,s));for(let c=u.length-1;c>-1;c--)if(a[3]=a[2],a[2]=a[1],a[1]=a[0],a[0]=u[c],a.every((l,f)=>l===t[f])){i=c;break}}while(i===-1&&o>0n);return o+BigInt(i)};var A4t=new Uint8Array([1,0]);function dk(e){let t={...e,zip64Length:(e.offset?1:0)*8+(e.size?1:0)*16},r=[];for(let n of E4t){if(!t[n.name??""]&&!n.default)continue;let a=new DataView(new ArrayBuffer(n.size));uAe[n.size](a,0,t[n.name??""]??n.default),r.push(a.buffer)}return bn(...r)}function Sa(e,t,r,n){uAe[t](e,Number(r),n)}var uAe={2:(e,t,r)=>{e.setUint16(t,Number(r>65535?65535:r),!0)},4:(e,t,r)=>{e.setUint32(t,Number(r>4294967295?4294967295:r),!0)},8:(e,t,r)=>{e.setBigUint64(t,BigInt(r),!0)}},E4t=[{size:2,default:new DataView(A4t.buffer).getUint16(0,!0)},{size:2,name:"zip64Length"},{size:8,name:"size"},{size:8,name:"size"},{size:8,name:"offset"}];var cAe=new Uint8Array([80,75,5,6]),lAe=new Uint8Array([80,75,6,7]),fAe=new Uint8Array([80,75,6,6]),pAe=8n,T4t=10n,dAe=12n,hAe=16n,S4t=22n,mAe=8n,gAe=24n,k4t=32n,bAe=40n,vAe=48n,C4t=56n,hk=async e=>{let t=await Jd(e,cAe),r=BigInt(await sAe(e,t+pAe)),n=BigInt(await cN(e,t+dAe)),a=BigInt(await cN(e,t+hAe)),i=t-20n,o=0n,s=await Jr(e,i,i+4n);if(pu(s,lAe.buffer)){o=await xy(e,i+mAe);let u=await Jr(e,o,o+4n);if(!pu(u,fAe.buffer))throw new Error("zip64 EoCD not found");r=await xy(e,o+gAe),n=await xy(e,o+bAe),a=await xy(e,o+vAe)}else i=0n;return{cdRecordsNumber:r,cdStartOffset:a,cdByteSize:n,offsets:{zip64EoCDOffset:o,zip64EoCDLocatorOffset:i,zipEoCDOffset:t}}};function xAe(e,t,r,n,a){let i=new DataView(e),o=t.zip64EoCDOffset?t.zipEoCDOffset-t.zip64EoCDOffset:0n;if(Number(a)<=65535&&(Sa(i,2,o+pAe,a),Sa(i,2,o+T4t,a)),n-r<=4294967295&&Sa(i,4,o+dAe,n-r),r<4294967295&&Sa(i,4,o+hAe,r),t.zip64EoCDLocatorOffset&&t.zip64EoCDOffset){let s=t.zip64EoCDLocatorOffset-t.zip64EoCDOffset;Sa(i,8,s+mAe,n),Sa(i,8,vAe,r),Sa(i,8,gAe,a),Sa(i,8,k4t,a),Sa(i,8,bAe,n-r)}return new Uint8Array(i.buffer)}function yAe(e){let t=new DataView(new ArrayBuffer(Number(S4t)));for(let a of D4t)Sa(t,a.size,a.offset,e[a.name??""]??a.default??0);let r=F4t(e),n=B4t(e);return bn(n,r,t.buffer)}var D4t=[{offset:0,size:4,default:new DataView(cAe.buffer).getUint32(0,!0)},{offset:4,size:2,default:0},{offset:6,size:2,default:0},{offset:8,size:2,name:"recordsNumber"},{offset:10,size:2,name:"recordsNumber"},{offset:12,size:4,name:"cdSize"},{offset:16,size:4,name:"cdOffset"},{offset:20,size:2,default:0}];function B4t(e){let t=new DataView(new ArrayBuffer(Number(C4t)));for(let r of I4t)Sa(t,r.size,r.offset,e[r.name??""]??r.default??0);return t.buffer}function F4t(e){let t=new DataView(new ArrayBuffer(Number(20)));for(let r of O4t)Sa(t,r.size,r.offset,e[r.name??""]??r.default??0);return t.buffer}var O4t=[{offset:0,size:4,default:new DataView(lAe.buffer).getUint32(0,!0)},{offset:4,size:4,default:0},{offset:8,size:8,name:"eoCDStart"},{offset:16,size:4,default:1}],I4t=[{offset:0,size:4,default:new DataView(fAe.buffer).getUint32(0,!0)},{offset:4,size:8,default:44},{offset:12,size:2,default:45},{offset:14,size:2,default:45},{offset:16,size:4,default:0},{offset:20,size:4,default:0},{offset:24,size:8,name:"recordsNumber"},{offset:32,size:8,name:"recordsNumber"},{offset:40,size:8,name:"cdSize"},{offset:48,size:8,name:"cdOffset"}];var P4t=20,R4t=24,j4t=28,L4t=30,M4t=32,q4t=42,_y=46n,Yd=new Uint8Array([80,75,1,2]),Xd=async(e,t)=>{let r=await yy(t);if(e>=r)return null;let n=await Kd(t,e,e+_y),a=n.buffer.slice(0,4);if(!pu(a,Yd.buffer))return null;let i=BigInt(n.getUint32(P4t,!0)),o=BigInt(n.getUint32(R4t,!0)),s=n.getUint16(L4t,!0),u=BigInt(n.getUint16(M4t,!0)),c=n.getUint16(j4t,!0),l=await Jr(t,e+_y,e+_y+BigInt(c+s)),f=l.slice(0,c),p=new TextDecoder().decode(f),d=e+_y+BigInt(c),h=n.getUint32(q4t,!0),m=BigInt(h),g=new DataView(l.slice(c,l.byteLength)),x={uncompressedSize:o,compressedSize:i,localHeaderOffset:m,startDisk:u},y=N4t(x,g);return{...x,...y,extraFieldLength:s,fileNameLength:c,fileName:p,extraOffset:d}};async function*Ku(e){let{cdStartOffset:t,cdByteSize:r}=await hk(e),n=new vy(new DataView(await Jr(e,t,t+r))),a=await Xd(0n,n);for(;a;)yield a,a=await Xd(a.extraOffset+BigInt(a.extraFieldLength),n)}var _Ae=(...e)=>e[0]+e[1]*16,N4t=(e,t)=>{let r=U4t(e),n={};if(r.length>0){let a=r.reduce((s,u)=>s+u.length,0),i=new Uint8Array(t.buffer).findIndex((s,u,c)=>_Ae(c[u],c[u+1])===1&&_Ae(c[u+2],c[u+3])===a),o=0;for(let s of r){let u=o;n[s.name]=t.getBigUint64(i+4+u,!0),o=u+s.length}}return n},U4t=e=>{let t=[];return e.uncompressedSize===BigInt(4294967295)&&t.push({name:"uncompressedSize",length:8}),e.compressedSize===BigInt(4294967295)&&t.push({name:"compressedSize",length:8}),e.localHeaderOffset===BigInt(4294967295)&&t.push({name:"localHeaderOffset",length:8}),e.startDisk===BigInt(4294967295)&&t.push({name:"startDisk",length:4}),t};function lN(e){let t={...e,fnlength:e.fileName.length,extraLength:0},r=new ArrayBuffer(0),n={};t.offset>=4294967295&&(n.offset=t.offset,t.offset=BigInt(4294967295)),t.length>=4294967295&&(n.size=t.length,t.length=4294967295),Object.keys(n).length&&(r=dk(n),t.extraLength=r.byteLength);let a=new DataView(new ArrayBuffer(Number(_y)));for(let s of z4t)Sa(a,s.size,s.offset,t[s.name??""]??s.default??0);let i=new TextEncoder().encode(t.fileName);return bn(a.buffer,i,r)}var z4t=[{offset:0,size:4,default:new DataView(Yd.buffer).getUint32(0,!0)},{offset:4,size:2,default:45},{offset:6,size:2,default:45},{offset:8,size:2,default:0},{offset:10,size:2,default:0},{offset:12,size:2,default:0},{offset:14,size:2,default:0},{offset:16,size:4,name:"crc32"},{offset:20,size:4,name:"length"},{offset:24,size:4,name:"length"},{offset:28,size:2,name:"fnlength"},{offset:30,size:2,default:0,name:"extraLength"},{offset:32,size:2,default:0},{offset:34,size:2,default:0},{offset:36,size:2,default:0},{offset:38,size:4,default:0},{offset:42,size:4,name:"offset"}];var G4t=8,H4t=18,V4t=22,$4t=26,W4t=28,wy=30n,fN=new Uint8Array([80,75,3,4]),Os=async(e,t)=>{let r=await Kd(t,e,e+wy),n=r.buffer.slice(0,4);if(!pu(n,fN.buffer))return null;let a=r.getUint16($4t,!0),i=r.getUint16(W4t,!0),o=await Jr(t,e+wy,e+wy+BigInt(a+i)),s=o.slice(0,a),u=new DataView(o.slice(a,o.byteLength)),c=new TextDecoder().decode(s).split("\\").join("/"),l=e+wy+BigInt(a+i),f=r.getUint16(G4t,!0),p=BigInt(r.getUint32(H4t,!0)),d=BigInt(r.getUint32(V4t,!0)),h=4;return d===BigInt(4294967295)&&(d=u.getBigUint64(h,!0),h+=8),p===BigInt(4294967295)&&(p=u.getBigUint64(h,!0),h+=8),l===BigInt(4294967295)&&(l=u.getBigUint64(h,!0)),{fileNameLength:a,fileName:c,extraFieldLength:i,fileDataOffset:l,compressedSize:p,compressionMethod:f}};function pN(e){let t={...e,extraLength:0,fnlength:e.fileName.length},r=new ArrayBuffer(0),n={};t.length>=4294967295&&(n.size=t.length,t.length=4294967295),Object.keys(n).length&&(r=dk(n),t.extraLength=r.byteLength);let a=new DataView(new ArrayBuffer(Number(wy)));for(let s of K4t)Sa(a,s.size,s.offset,t[s.name??""]??s.default??0);let i=new TextEncoder().encode(t.fileName);return bn(a.buffer,i,r)}var K4t=[{offset:0,size:4,default:new DataView(fN.buffer).getUint32(0,!0)},{offset:4,size:2,default:45},{offset:6,size:2,default:0},{offset:8,size:2,default:0},{offset:10,size:2,default:0},{offset:12,size:2,default:0},{offset:14,size:4,name:"crc32"},{offset:18,size:4,name:"length"},{offset:22,size:4,name:"length"},{offset:26,size:2,name:"fnlength"},{offset:28,size:2,default:0,name:"extraLength"}];async function J4t(e){let t=await hk(e),r=t.cdStartOffset,n=(await e.stat()).bigsize,a=Number(t.offsets.zip64EoCDOffset?t.offsets.zip64EoCDOffset-r:t.offsets.zipEoCDOffset-r),i=await Jr(e,r,n);await e.truncate(Number(r));let o=i.slice(0,a),s=i.slice(a,i.byteLength);return[o,s,t]}async function AAe(e,t,r){let n=parseInt(await new Gv().hash(t,"hex"),16),a=pN({crc32:n,fileName:e,length:t.byteLength}),i=lN({crc32:n,fileName:e,offset:r,length:t.byteLength});return[new Uint8Array(bn(a,t)),new Uint8Array(i)]}async function dN(e,t,r){let n=new Ha(e,"a+"),[a,i,o]=await J4t(n),s=(await n.stat()).bigsize,u=s,[c,l]=await AAe(r,t,u);await n.append(c),s+=BigInt(c.byteLength);let f=bn(a,l),p=s;await n.append(new Uint8Array(f)),s+=BigInt(f.byteLength);let d=s,h=xAe(i,o.offsets,p,d,o.cdRecordsNumber+1n);await n.append(h),s+=BigInt(h.byteLength)}async function hN(e,t,r){let n=X4t(e),a=new Ha(t,"w"),i=[],o=[];for await(let l of n)await wAe(l,a,o,i);if(r){let l=await r(i);await wAe(l,a,o)}let s=(await a.stat()).bigsize,u=bn(...o);await a.append(new Uint8Array(u));let c=(await a.stat()).bigsize;await a.append(new Uint8Array(yAe({recordsNumber:o.length,cdSize:u.byteLength,cdOffset:s,eoCDStart:c})))}async function wAe(e,t,r,n){let a=(await t.stat()).bigsize;n==null||n.push({fileName:e.path,localHeaderOffset:a});let[i,o]=await AAe(e.path,e.file,a);await t.append(i),r.push(Wn(o))}function X4t(e){async function*t(){let r=await EAe(e);for(let n of r){let a=await(await si(Ga.join(e,n))).arrayBuffer();yield{path:n,file:a}}}return t()}async function EAe(e,t="",r){let n=r||new zv({}),a=await n.readdir(mk(e,t)),i=[];for(let o of a){let s=mk(e,t,o);if((await n.stat(s)).isDirectory){let u=await EAe(e,mk(t,o));i.push(...u)}else i.push(mk(t,o))}return i}function mk(...e){let t=e.filter(r=>r.length);return Ga.join(...t)}var $g=class{constructor(t){this.compressBatches=this.compressBatches.bind(this),this.decompressBatches=this.decompressBatches.bind(this)}async preload(t={}){u0(t)}async compress(t){return await this.preload(),this.compressSync(t)}async decompress(t,r){return await this.preload(),this.decompressSync(t,r)}compressSync(t){throw new Error(`${this.name}: sync compression not supported`)}decompressSync(t,r){throw new Error(`${this.name}: sync decompression not supported`)}async*compressBatches(t){let r=await this.concatenate(t);yield this.compress(r)}async*decompressBatches(t){let r=await this.concatenate(t);yield this.decompress(r)}concatenate(t){return jp(t)}improveError(t){return t.message.includes(this.name)||(t.message=`${this.name} ${t.message}`),t}};var Ay=class extends $g{name="uncompressed";extensions=[];contentEncodings=[];isSupported=!0;options;constructor(t){super(t),this.options=t||{}}compressSync(t){return t}decompressSync(t){return t}async*compressBatches(t){return yield*t}async*decompressBatches(t){return yield*t}};var Qd=Ct(Jq(),1),cl=Ct(require("zlib"),1),ll=class extends $g{name="deflate";extensions=[];contentEncodings=["deflate"];isSupported=!0;options;_chunks=[];constructor(t={}){super(t),this.options=t}async compress(t){var r,n;if(!pr&&((r=this.options.deflate)!=null&&r.useZlib)){let a=(n=this.options.deflate)!=null&&n.gzip?await p0(cl.default.gzip)(t):await p0(cl.default.deflate)(t);return Wn(a)}return this.compressSync(t)}async decompress(t){var r,n;if(!pr&&((r=this.options.deflate)!=null&&r.useZlib)){let a=(n=this.options.deflate)!=null&&n.gzip?await p0(cl.default.gunzip)(t):await p0(cl.default.inflate)(t);return Wn(a)}return this.decompressSync(t)}compressSync(t){var i,o,s,u;if(!pr&&((i=this.options.deflate)!=null&&i.useZlib)){let c=(o=this.options.deflate)!=null&&o.gzip?cl.default.gzipSync(t):cl.default.deflateSync(t);return Wn(c)}let r=((s=this.options)==null?void 0:s.deflate)||{},n=new Uint8Array(t),a=(u=this.options)!=null&&u.raw?Qd.default.deflateRaw:Qd.default.deflate;return Wn(a(n,r).buffer)}decompressSync(t){var i,o,s,u;if(!pr&&((i=this.options.deflate)!=null&&i.useZlib)){let c=(o=this.options.deflate)!=null&&o.gzip?cl.default.gunzipSync(t):cl.default.inflateSync(t);return Wn(c)}let r=((s=this.options)==null?void 0:s.deflate)||{},n=new Uint8Array(t),a=(u=this.options)!=null&&u.raw?Qd.default.inflateRaw:Qd.default.inflate;return Wn(a(n,r).buffer)}async*compressBatches(t){var a;let r=((a=this.options)==null?void 0:a.deflate)||{},n=new Qd.default.Deflate(r);yield*this.transformBatches(n,t)}async*decompressBatches(t){var a;let r=((a=this.options)==null?void 0:a.deflate)||{},n=new Qd.default.Inflate(r);yield*this.transformBatches(n,t)}async*transformBatches(t,r){t.onData=this._onData.bind(this),t.onEnd=this._onEnd.bind(this);for await(let o of r){let s=new Uint8Array(o);if(!t.push(s,!1))throw new Error(`${this._getError()}write`);yield*this._getChunks()}let n=new Uint8Array(0),a=t.push(n,!0);yield*this._getChunks()}_onData(t){this._chunks.push(t)}_onEnd(t){if(t!==0)throw new Error(this._getError(t)+this._chunks.length)}_getChunks(){let t=this._chunks;return this._chunks=[],t}_getError(t=0){let r={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};return`${this.name}: ${r[t]}`}};var Ey=class extends ll{name="gzip";extensions=["gz","gzip"];contentEncodings=["gzip","x-gzip"];isSupported=!0;constructor(t){super({...t,deflate:{...t==null?void 0:t.gzip,gzip:!0}})}};var TAe={0:async e=>e,8:async e=>await new ll({raw:!0}).decompress(e)},fl=class{file=null;fileName;archive=null;constructor(t){if(typeof t=="string"){if(this.fileName=t,pr)throw new Error("ZipFileSystem cannot open file paths in browser environments");this.file=new Ha(t)}else t instanceof Blob||t instanceof ArrayBuffer?this.file=new Nv(t):t instanceof pl?(this.file=t.file,this.archive=t,this.fileName=t.fileName):this.file=t}async destroy(){this.file&&await this.file.close()}async readdir(){if(!this.file)throw new Error("No data detected in the zip archive");let t=[],r=Ku(this.file);for await(let n of r)t.push(n.fileName);return t}async stat(t){let r=await this.getCDFileHeader(t);return{...r,size:Number(r.uncompressedSize)}}async fetch(t){this.fileName&&t.indexOf(this.fileName)===0&&(t=t.substring(this.fileName.length+1));let r;if(this.archive)r=await this.archive.getFile(t,"http");else{if(!this.file)throw new Error("No data detected in the zip archive");let a=await this.getCDFileHeader(t),i=await Os(a.localHeaderOffset,this.file);if(!i)throw new Error("Local file header has not been found in the zip archive`");let o=TAe[i.compressionMethod.toString()];if(!o)throw Error("Only Deflation compression is supported");let s=await Jr(this.file,i.fileDataOffset,i.fileDataOffset+i.compressedSize);r=await o(s)}let n=new Response(r);return Object.defineProperty(n,"url",{value:t?`${this.fileName||""}/${t}`:this.fileName||""}),n}async getCDFileHeader(t){if(!this.file)throw new Error("No data detected in the zip archive");let r=Ku(this.file),n=null;for await(let a of r)if(a.fileName===t){n=a;break}if(!n)throw new Error("File has not been found in the zip archive");return n}};var pl=class{file;fileName;constructor(t,r,n){this.file=t,this.fileName=n}async getFileWithoutHash(t){return await(await new fl(this.file).fetch(t)).arrayBuffer()}};function Ty(e){let t=new DataView(e),r={};for(let n=0;n<e.byteLength;n=n+24){let a=t.getBigUint64(n+16,!0),i=Y4t(e,n,16);r[i]=a}return r}function Y4t(e,t,r){return[...new Uint8Array(e,t,r)].map(n=>n.toString(16).padStart(2,"0")).join("")}async function mN(e){let t=Ku(e);return Q4t(t)}async function Q4t(e){let t=new mu,r=new TextEncoder,n={};for await(let a of e){let i=a.fileName.split("\\").join("/").toLocaleLowerCase(),o=r.encode(i).buffer,s=await t.hash(o,"hex");n[s]=a.localHeaderOffset}return n}async function Sy(e){let t=new mu,r=new TextEncoder,n=[];for await(let i of e){let o=i.fileName.split("\\").join("/");o!=="3dSceneLayer.json.gz"&&(o=o.toLocaleLowerCase());let s=r.encode(o).buffer,u=await t.hash(s,"hex");n.push(bn(eCt(u),tCt(i.localHeaderOffset)))}let a=n.sort(Z4t);return bw(a)}function Z4t(e,t){let r=new BigUint64Array(e),n=new BigUint64Array(t);return Number(r[0]===n[0]?r[1]-n[1]:r[0]-n[0])}function eCt(e){var r;let t=(r=e.match(/../g))==null?void 0:r.map(n=>parseInt(n,16));return new Uint8Array(t??new Array(16)).buffer}function tCt(e){return new BigUint64Array([e]).buffer}var rCt={0:e=>new Ay().decompress(e),8:e=>new ll({raw:!0}).decompress(e)},ky=class extends pl{hashTable;constructor(t,r,n){super(t,r,n),this.hashTable=r}async getFile(t){let r=await this.getFileBytes(t.toLocaleLowerCase());if(r||(r=await this.getFileBytes(t)),!r)throw new Error(`No such file in the archive: ${t}`);return r}async getFileBytes(t){let r;if(this.hashTable){let n=new TextEncoder().encode(t).buffer,a=await new mu().hash(n,"hex"),i=this.hashTable[a];if(i===void 0)return null;let o=await Os(i,this.file);if(!o)return null;let s=await Jr(this.file,o.fileDataOffset,o.fileDataOffset+o.compressedSize),u=rCt[o.compressionMethod];if(!u)throw Error("Only Deflation compression is supported");r=await u(s)}else r=await this.getFileWithoutHash(t);return r}};function Xf(e,t,r){if(!t)return r+12;let{magic:a,version:i=1,byteLength:o=12}=e;return yt(Array.isArray(a)&&Number.isFinite(i)&&Number.isFinite(o)),t.setUint8(r+0,a[0]),t.setUint8(r+1,a[1]),t.setUint8(r+2,a[2]),t.setUint8(r+3,a[3]),t.setUint32(r+4,i,!0),t.setUint32(r+8,o,!0),r+=12,r}function Yf(e,t,r){e&&e.setUint32(t+8,r,!0)}function SAe(e,t,r,n,a){e={magic:Rf.COMPOSITE,tiles:[],...e};let i=r;r+=Xf(e,t,r),t&&t.setUint32(r,e.tiles.length,!0),r+=4;for(let o=0;o<e.tiles.length;++o)r+=a(e.tiles[o],t,r,n);return Yf(t,i,r-i),r}function kAe(e,t,r,n){let{featuresLength:a=0,batchTable:i}=e,s=JSON.stringify({BATCH_LENGTH:a}),u=i?JSON.stringify(i):"",c=Ki(s.length,8),l=u?Ki(u.length,8):0;e={magic:Rf.BATCHED_MODEL,...e};let f=r;r=Xf(e,t,r),t&&(t.setUint32(12,c,!0),t.setUint32(16,0,!0),t.setUint32(20,l,!0),t.setUint32(24,0,!0)),r+=16,r=f0(t,r,s,8),i&&(r=f0(t,r,u,8));let p=e.gltfEncoded;return p&&(r=Mv(t,r,p,p.byteLength)),Yf(t,f,r-f),r}function CAe(e,t,r,n){let{featuresLength:a=1,gltfFormat:i=1,gltfUri:o=""}=e,s=o.length,u={INSTANCES_LENGTH:a,POSITION:new Array(a*3).fill(0)},c=JSON.stringify(u),l=c.length;e={magic:Rf.INSTANCED_MODEL,...e};let f=r;return r=Xf(e,t,0),t&&(t.setUint32(12,l,!0),t.setUint32(16,0,!0),t.setUint32(20,0,!0),t.setUint32(24,0,!0),t.setUint32(28,i,!0)),r+=20,r+=l0(t,r,c,l),r+=l0(t,r,o,s),Yf(t,f,r-f),r}var nCt={POINTS_LENGTH:1,POSITIONS:{byteOffset:0}};function DAe(e,t,r,n){let{featureTableJson:a=nCt}=e,i=JSON.stringify(a);i=nF(i,4);let{featureTableJsonByteLength:o=i.length}=e,s=new ArrayBuffer(12),u=s.byteLength;e={magic:Rf.POINT_CLOUD,...e};let c=r;return r+=Xf(e,t,0),t&&(t.setUint32(r+0,o,!0),t.setUint32(r+4,u,!0),t.setUint32(r+8,0,!0),t.setUint32(r+12,0,!0)),r+=16,r+=l0(t,r,i,o),r+=Mv(t,r,s,u),Yf(t,c,r-c),r}function bN(e,t){let r=gN(e,null,0,t),n=new ArrayBuffer(r),a=new DataView(n);return gN(e,a,0,t),n}function gN(e,t,r,n){switch(yt(typeof e.type=="string"),e.type){case pa.COMPOSITE:return SAe(e,t,r,n,gN);case pa.POINT_CLOUD:return DAe(e,t,r,n);case pa.BATCHED_3D_MODEL:return kAe(e,t,r,n);case pa.INSTANCED_3D_MODEL:return CAe(e,t,r,n);default:throw new Error("3D Tiles: unknown tile type")}}var vN={name:"3D Tile",id:"3d-tiles",module:"3d-tiles",version:Zm,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],binary:!0,options:{["3d-tiles"]:{}},encode:async(e,t)=>BAe(e,t),encodeSync:BAe};function BAe(e,t){return bN(e,t)}var Jo=require("path");var FAe=Ct(require("crypto")),bk=new Uint8Array(256),gk=bk.length;function xN(){return gk>bk.length-16&&(FAe.default.randomFillSync(bk),gk=0),bk.slice(gk,gk+=16)}var ka=[];for(let e=0;e<256;++e)ka.push((e+256).toString(16).slice(1));function OAe(e,t=0){return ka[e[t+0]]+ka[e[t+1]]+ka[e[t+2]]+ka[e[t+3]]+"-"+ka[e[t+4]]+ka[e[t+5]]+"-"+ka[e[t+6]]+ka[e[t+7]]+"-"+ka[e[t+8]]+ka[e[t+9]]+"-"+ka[e[t+10]]+ka[e[t+11]]+ka[e[t+12]]+ka[e[t+13]]+ka[e[t+14]]+ka[e[t+15]]}var IAe=Ct(require("crypto")),yN={randomUUID:IAe.default.randomUUID};function aCt(e,t,r){if(yN.randomUUID&&!t&&!e)return yN.randomUUID();e=e||{};let n=e.random||(e.rng||xN)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let a=0;a<16;++a)t[r+a]=n[a];return t}return OAe(n)}var Ju=aCt;var fh=Ct(require("process"),1),f4=Ct(Is(),1),p4=Ct(AN(),1);var yk=require("path"),JAe=Ct(Is(),1);var VAe=()=>({folderPattern:{path:"folderPattern",default:"BASIC"},archiveCompressionType:{path:"archiveCompressionType",default:"STORE"},resourceCompressionType:{path:"resourceCompressionType",default:"GZIP"},I3SVersion:{path:"I3SVersion",default:"1.8"},nodeCount:{path:"nodeCount"}});var Zd=require("fs"),Wg=require("path");var $Ae=require("zlib"),vk=require("fs");function xk(e){let t=`${e}.gz`,r=(0,$Ae.createGzip)(),n=(0,vk.createReadStream)(e),a=(0,vk.createWriteStream)(t);return new Promise((i,o)=>{n.on("end",()=>{console.log(`${t} compressed and saved.`),i(t)}),n.on("error",s=>{console.log(`${t}: compression error!`),o(s)}),n.pipe(r).pipe(a)})}async function Oi(e,t,r="index.json"){let n;t instanceof Promise?n=new Uint8Array(await t):t instanceof ArrayBuffer?n=new Uint8Array(t):n=t,await Zd.promises.mkdir(e,{recursive:!0});let a=(0,Wg.join)(e,r);try{await Zd.promises.writeFile(a,n)}catch(i){throw i}return console.log(`${a} saved.`),a}async function Xu(e,t,r="index.json",n=!0,a){let i=await Oi(e,t,r);if(n){if(a)return a.includes(i)?null:(a.push(i),`${i}.gz`);let o=await xk(i);return await Fy(i),o}return i}async function Kg(e,t){return new Promise((r,n)=>{let a=0;console.log(`load ${e}/${t}.`);let i=setInterval(()=>{let o=(0,Wg.join)(e,t);Wr(o,aF).then(s=>{clearInterval(i),r(s)}).catch(()=>{a++,a>100&&(clearInterval(i),n(new Error(`Cannon load ${e}/${t}.`)))})},200)})}async function Dy(e){try{return await Zd.promises.stat(e),!0}catch{return!1}}function By(e){return Zd.promises.rm(e,{recursive:!0})}function Fy(e){return Zd.promises.unlink(e)}function WAe(e){return(0,Wg.isAbsolute)(e)?e:(0,Wg.join)(process.cwd(),e)}async function KAe(e,t){try{await Zd.promises.rename(e,t)}catch(r){console.log("Can't rename file",r)}}var Ca=class{nodesPerPage;nodesCounter;writeFile;converter;nodePages;length=0;constructor(t,r,n){this.nodesPerPage=r,this.nodesCounter=0,this.nodePages=[{}],this.nodePages[0].nodes=[],this.writeFile=t,this.converter=n,this.length=0}useWriteFunction(t){this.writeFile=t}getNodePageFileName(t){let r=(0,yk.join)(this.converter.layers0Path,"nodepages"),n=`${t.toString()}.json`;return{filePath:r,fileName:n}}async loadNodePage(t){let{filePath:r,fileName:n}=this.getNodePageFileName(t),a=(0,yk.join)(r,n);return await Dy(a)?(console.log(`load ${a}.`),await Kg(r,n)):{nodes:[]}}getPageIndexByNodeId(t){return Math.floor(t/this.nodesPerPage)}async getPageByNodeId(t){let r=this.getPageIndexByNodeId(t);return this.converter.options.instantNodeWriting?await this.loadNodePage(r):this.nodePages[r]}async getNodeById(t,r){let n=t%this.nodesPerPage;return r=r||await this.getPageByNodeId(t),r.nodes[n]}async addChildRelation(t,r){var a;if(t==null)return;let n=await this.getNodeById(t);(a=n.children)==null||a.push(r),await this.saveNode(n)}async push(t,r){if(t.index=this.nodesCounter++,!this.converter.options.instantNodeWriting){let n=this.nodePages[this.nodePages.length-1];n.nodes.length===this.nodesPerPage&&(n={nodes:[]},this.nodePages.push(n)),n.nodes.push(t)}return await this.addChildRelation(r,t.index),Ca.updateResourceInMesh(t),await this.saveNode(t),t}async saveNode(t){if(!this.converter.options.instantNodeWriting)return;let r=this.getPageIndexByNodeId(t.index),n=await this.getPageByNodeId(t.index),{filePath:a,fileName:i}=this.getNodePageFileName(r),o=await this.getNodeById(t.index,n);o?Ca.updateAll(o,t):n.nodes.push(t);let s=JSON.stringify(n);await this.converter.writeQueue.enqueue({archiveKey:`nodePages/${r.toString()}.json.gz`,writePromise:()=>this.writeFile(a,s,i,!0,this.converter.compressList)},!0)}async saveMetadata(){let t=(0,JAe.default)({nodeCount:this.nodesCounter},VAe()),r=!1;await this.converter.writeQueue.enqueue({archiveKey:"metadata.json",writePromise:()=>this.writeFile(this.converter.layers0Path,JSON.stringify(t),"metadata.json",r)})}async save(){if(this.converter.options.instantNodeWriting){await this.saveMetadata();return}for(let[t,r]of this.nodePages.entries()){let n=JSON.stringify(r),a=(0,yk.join)(this.converter.layers0Path,"nodepages");await this.converter.writeQueue.enqueue({archiveKey:`nodePages/${t.toString()}.json.gz`,writePromise:()=>this.writeFile(a,n,`${t.toString()}.json`)})}await this.saveMetadata()}static updateResourceInMesh(t){t.mesh&&isFinite(t.index)&&(t.mesh.geometry.resource=t.index)}static updateAll(t,r){return Object.assign(t,r,{index:t.index}),Ca.updateResourceInMesh(t),t}static updateMaterialByNodeId(t,r){t.mesh&&(t.mesh.material={definition:r,resource:t.index})}static updateVertexCountByNodeId(t,r){t.mesh&&(t.mesh.geometry.vertexCount=r)}static updateNodeAttributeByNodeId(t){!t.mesh||!t.index||(t.mesh.attribute.resource=t.index)}static updateFeatureCountByNodeId(t,r){t.mesh&&(t.mesh.geometry.featureCount=r)}static updateTexelCountHintByNodeId(t,r){!t.mesh||!t.mesh.material||(t.mesh.material.texelCountHint=r)}};var Oy=require("path"),_k=require("fs");function Jg(e){if(typeof e=="number"){let i=Math.floor(e/1e3),o=e-i*1e3;return XAe(i,o)}let t=1e6,r=e[0],n=e[1]/t;return XAe(r,n)}function XAe(e,t){let r=Math.floor(e/3600);e=e-r*3600;let n=Math.floor(e/60);e=e-n*60;let a=Math.floor(e),i="";return r&&(i+=`${r}h `),n&&(i+=`${n}m `),a&&(i+=`${a}s`),i||(i+=`${Math.floor(t)}ms`),i}async function wk(e){let{slpk:t,outputPath:r,tilesetName:n}=e,a=WAe(r);try{if(t){let s=(0,Oy.join)(a,`${n}.slpk`);return(await _k.promises.stat(s)).size}let i=(0,Oy.join)(a,n);return await YAe(i)}catch(i){return console.log("Calculate file sizes error: ",i),null}}async function YAe(e){let t=0,r=await _k.promises.readdir(e);for(let n of r){let a=await _k.promises.stat((0,Oy.join)(e,n));a.isDirectory()?t+=await YAe((0,Oy.join)(e,n)):t+=a.size}return t}var mEe=require("module"),Sk=require("path");var gEe=Ct(AN(),1);var eh=3,Xg=9;function ZAe(e){let{positions:t,normals:r,texCoords:n,colors:a,uvRegions:i,featureIndices:o}=e,s=t.length/Xg;if(!o.length)return{faceRange:new Uint32Array([0,s-1]),featureIds:[0],featureCount:1,positions:t,normals:r,texCoords:n,colors:a,uvRegions:i};let u=mCt(o),c=gCt({...u,...e}),l=bCt(c);return vCt(l,u.featureCount)}function mCt(e){let t=1,r=1,n=QAe(e.slice(0,eh)),a=[],i=[],o=[n];a[0]=0,i[0]=n;for(let c=eh;c<e.length;c+=eh){let l=QAe(e.slice(c,c+eh));n!==l&&(a[t]=c/eh-1,a[t+1]=c/eh,i[r]=l,o.includes(l)||o.push(l),t+=2,r+=1),n=l}a[t]=e.length/eh-1;let s=new Uint32Array(a),u=o.length;return{faceRange:s,featureCount:u,featureIds:i}}function QAe(e){let t={},r=e[0],n=1;for(let a of e)t[a]=(t[a]||0)+1,n=n>t[a]?n:t[a],r=n>t[a]?r:a;return r}function gCt(e){let{featureIds:t,positions:r,normals:n,colors:a,uvRegions:i,texCoords:o,faceRange:s=new Uint32Array(0)}=e,u=[],c=new Float32Array(r),l=new Float32Array(n),f=new Uint8Array(a),p=new Float32Array(o),d=new Uint16Array(i),h=0,m=0,g=0,x=0,y=0;for(let w=0;w<t.length;w++){let T=s[w*2],A=s[w*2+1],B=Iy("positions",T,A),I=Iy("normals",T,A),L=Iy("colors",T,A),C=Iy("uvRegions",T,A),k=Iy("texCoords",T,A);u.push({featureId:t[w],positions:c.subarray(h,h+B),normals:l.subarray(m,m+I),colors:f.subarray(g,g+L),uvRegions:d.subarray(x,x+C),texCoords:p.subarray(y,y+k)}),h+=B,m+=I,g+=L,x+=C,y+=k}return u}function Iy(e,t,r){let i=r-t+1,o=i*3;switch(e){case"positions":case"normals":return i*Xg;case"colors":case"uvRegions":return o*4;case"texCoords":return o*2;default:return 0}}function bCt(e){let t=[];for(let n of e){let a=t.find(i=>i.featureId===n.featureId);a?a.attributes.push(n):t.push({featureId:n.featureId,attributes:[n]})}let r=[];for(let n of t){let a=eEe(n.attributes);r.push({featureId:n.featureId,...a})}return r}function vCt(e,t){let n=[e[0].featureId||0],a=[0],i=0,o=0;for(let c=1;c<e.length;c++){let l=e[c];n.push(l.featureId||0);let f=e[i];a.push(f.positions.length/Xg-1+o),a.push(f.positions.length/Xg+o),o+=f.positions.length/Xg,i+=1}let s=eEe(e);return a.push(s.positions.length/Xg-1),{faceRange:new Uint32Array(a),featureIds:n,featureCount:t,...s}}function eEe(e){let t=e.map(({positions:f})=>f),r=t.length>1?Wi(...t):t[0],n=e.map(({normals:f})=>f),a=n.length>1?Wi(...n):n[0],i=e.map(({colors:f})=>f),o=i.length>1?Wi(...i):i[0],s=e.map(({texCoords:f})=>f),u=s.length>1?Wi(...s):s[0],c=e.map(({uvRegions:f})=>f),l=c.length>1?Wi(...c):c[0];return{positions:r,normals:a,colors:o,texCoords:u,uvRegions:l}}function Ak(e,t){let r,n,a,i=Ft.WGS84.cartesianToCartographic(e.center,new Z);return t&&(i[2]=i[2]-t.getHeight(i[1],i[0])),e instanceof fa?(n=e.halfSize,r=new Z(n[0],n[1],n[2]).len(),a=e.quaternion):(r=e.radius,n=[r,r,r],a=new Io().fromMatrix3(new nr([n[0],0,0,0,n[1],0,0,0,n[2]])).normalize()),{mbs:[i[0],i[1],i[2],r],obb:{center:[i[0],i[1],i[2]],halfSize:n,quaternion:a}}}function tEe(e,t){let r=xCt(e),n=A1(r),a=sM(r),i=Ft.WGS84.cartesianToCartographic(a.center,new Z),o=Ft.WGS84.cartesianToCartographic(n.center,new Z);return t&&(i[2]=i[2]-t.getHeight(i[1],i[0]),o[2]=o[2]-t.getHeight(o[1],o[0])),{mbs:[i[0],i[1],i[2],a.radius],obb:{center:o,halfSize:n.halfSize,quaternion:n.quaternion}}}function xCt(e){let t=[];for(let r=0;r<e.length;r+=3){let n=new Z([e[r],e[r+1],e[r+2]]);t.push(n)}return t}function rEe(e){let t;e instanceof ui?t=e:t=e.getBoundingSphere();let r=t.center,n=t.radius,a=Ft.WGS84.cartesianToCartographic(new Z(r[0]+n,r[1]+n,r[2]+n),new Z),i=Ft.WGS84.cartesianToCartographic(new Z(r[0]-n,r[1]-n,r[2]-n),new Z);return{xmin:Math.min(i[0],a[0]),xmax:Math.max(i[0],a[0]),ymin:Math.min(i[1],a[1]),ymax:Math.max(i[1],a[1]),zmin:Math.min(i[2],a[2]),zmax:Math.max(i[2],a[2])}}function EN(e){let t=e[3],r=new Z(e[0],e[1],e[2]),n=new nr([t,0,0,0,t,0,0,0,t]);return new fa(r,n)}function nEe(e,t,r){var s,u,c,l,f,p,d,h;let n=((u=(s=e.gltf)==null?void 0:s.scene)==null?void 0:u.nodes)||((f=(l=(c=e.gltf)==null?void 0:c.scenes)==null?void 0:l[0])==null?void 0:f.nodes)||((p=e.gltf)==null?void 0:p.nodes)||[],a=((h=(d=e.gltf)==null?void 0:d.images)==null?void 0:h.map(m=>{var y,w;if((y=m==null?void 0:m.image)!=null&&y.compressed)return null;let g=(w=m==null?void 0:m.image)==null?void 0:w.data,x=new Uint8Array(g.length);return x.set(g),{data:x,compressed:!1,height:m.image.height,width:m.image.width,components:m.image.components,mimeType:m.mimeType}}))||[];aEe(n);let{cartographicOrigin:i,modelMatrix:o}=_Ct(e,t,r);return{nodes:n,images:a,cartographicOrigin:i,cartesianModelMatrix:o}}function yCt(e){let t={};for(let r in e)t[r]={value:e[r].value};return t}function _Ct(e,t,r){let{rtcCenter:n,gltfUpAxis:a}=e,{center:i}=r,o=new mr(t);switch(n&&o.translate(n),a){case"Z":break;case"Y":let c=new mr().rotateX(Math.PI/2);o=o.multiplyRight(c);break;case"X":let l=new mr().rotateY(-Math.PI/2);o=o.multiplyRight(l);break;default:break}let s=new Z(i),u=Ft.WGS84.cartesianToCartographic(s,new Z);return{modelMatrix:o,cartographicOrigin:u}}function aEe(e){var t;for(let r=0;r<e.length;r++){let n=e[r];n.mesh&&(e[r]={...n,mesh:{...n.mesh,primitives:(t=n.mesh)==null?void 0:t.primitives.map(a=>{var i,o,s;return{...a,indices:{value:(i=a==null?void 0:a.indices)==null?void 0:i.value},attributes:yCt(a.attributes),material:{id:(o=a==null?void 0:a.material)==null?void 0:o.id,uniqueId:(s=a==null?void 0:a.material)==null?void 0:s.uniqueId}}})}}),n.children&&aEe(n.children)}}function iEe(e,t){var n,a;let r=(a=(n=e.gltf)==null?void 0:n.extensions)==null?void 0:a[Ro];if(!(r!=null&&r.featureTextures))return null;for(let i in r.featureTextures)if(r.featureTextures[i].class===t)return i;return null}function oEe(e,t,r,n){let a=t==null?void 0:t.extensions;if(!a)return[];for(let[i,o]of Object.entries(a||{}))switch(i){case Ro:return ACt(e,o,r,n);case YS:return wCt(e,o);default:return[]}return[]}function wCt(e,t){for(let r of t.featureIds)if(typeof r.propertyTable<"u")return r.data;return[]}function ACt(e,t,r,n){var o,s,u,c,l,f,p;let a=(o=t==null?void 0:t.featureIdAttributes)==null?void 0:o[0];if((s=a==null?void 0:a.featureIds)!=null&&s.attribute)return e[a.featureIds.attribute].value;if((u=a==null?void 0:a.featureIds)!=null&&u.hasOwnProperty("constant")&&((c=a==null?void 0:a.featureIds)!=null&&c.hasOwnProperty("divisor"))){let d=((l=e==null?void 0:e.POSITIONS)==null?void 0:l.value.length)/3||0;return ECt(d,a.featureIds.constant,a.featureIds.divisor)}let i=(t==null?void 0:t.featureIdTextures)&&(t==null?void 0:t.featureIdTextures[0]);if(i){let h=`TEXCOORD_${((p=(f=i==null?void 0:i.featureIds)==null?void 0:f.texture)==null?void 0:p.texCoord)||0}`,m=e[h].value;return TCt(i,m,r)}return n?e[n].value:[]}function ECt(e,t=0,r=0){let n=[];if(r>0){let a=t,i=r;for(let o=0;o<e;o++)n.push(a),i-=1,i===0&&(a++,i=r)}else n=Array(e).fill(t,0,e);return n}function TCt(e,t,r){var c,l,f;if(!(r!=null&&r.length))return[];let n={r:0,g:1,b:2,a:3},a=(l=(c=e==null?void 0:e.featureIds)==null?void 0:c.texture)==null?void 0:l.index,i=(f=e==null?void 0:e.featureIds)==null?void 0:f.channels;if(!i||a===void 0)return[];let o=r[a],s=[],u=n[i];if(o&&(o!=null&&o.width)&&(o!=null&&o.height)&&(o!=null&&o.components))for(let p=0;p<t.length;p+=2){let d=t[p],h=t[p+1],m=Math.min(qS(d)*o.width|0,o.width-1),x=(Math.min(qS(h)*o.height|0,o.height-1)*o.width+m)*o.components+u,y=new Uint8Array(o.data)[x];s.push(y)}else console.warn(`Can't get batch Ids from ${(o==null?void 0:o.mimeType)||""} compressed texture`);return s}function sEe(e,t){let r={};for(let n in t){let a=t[n];r[n]=SCt(a,e)}return r}function SCt(e,t){let r=[];if(e)for(let n in t){let a=e[n]||null;r.push(a)}return r}function uEe(e,t){let r=!1;for(let n of Object.values(t))(!e||!n||e.length!==n.length)&&(r=!0);return r}function kCt(e){return typeof e=="string"||typeof e=="bigint"?rn.STRING_TYPE:typeof e=="number"?Number.isInteger(e)?rn.SHORT_INT_TYPE:rn.DOUBLE_TYPE:rn.STRING_TYPE}function cEe(e){let t={};for(let r in e){let n=e[r][0],a=kCt(n);t[r]=a}return t}var lEe=(e,t)=>{var i,o,s,u,c,l,f,p;let r={},n=(u=(s=(o=(i=e.extensions)==null?void 0:i[Ro])==null?void 0:o.schema)==null?void 0:s.classes)==null?void 0:u[t];if(n){for(let d in n.properties){let h=n.properties[d],m=CCt(h);r[d]=m}return r}let a=(p=(f=(l=(c=e.extensions)==null?void 0:c[Xc])==null?void 0:l.schema)==null?void 0:f.classes)==null?void 0:p[t];if(a){for(let d in a.properties){let h=a.properties[d],m=DCt(h);r[d]=m}return r}return null},CCt=e=>{let t;switch(e.type){case"INT8":case"UINT8":case"INT16":case"UINT16":case"INT32":case"UINT32":t=rn.SHORT_INT_TYPE;break;case"FLOAT32":case"FLOAT64":t=rn.DOUBLE_TYPE;break;case"INT64":case"UINT64":case"BOOLEAN":case"ENUM":case"STRING":case"ARRAY":t=rn.STRING_TYPE;break;default:t=rn.STRING_TYPE;break}return t},DCt=e=>{let t;if(e.array)t=rn.STRING_TYPE;else switch(e.componentType){case"INT8":case"UINT8":case"INT16":case"UINT16":case"INT32":case"UINT32":t=rn.SHORT_INT_TYPE;break;case"FLOAT32":case"FLOAT64":t=rn.DOUBLE_TYPE;break;case"INT64":case"UINT64":t=rn.STRING_TYPE;break;default:t=rn.STRING_TYPE;break}return t};var Ek=e=>{let t=new Uint32Array(e);for(let r=0;r<e;r++)t[r]=r;return t};var EDt={},BCt=1,FCt=1,Ps=3,Py=2,OCt=4,ICt="string",PCt="Int32",RCt="Float64",jCt="Oid32",fEe=["CUSTOM_ATTRIBUTE_2","_BATCHID","BATCHID"],Qf=new Z;async function TN({tileContent:e,tileTransform:t,tileBoundingVolume:r,addNodeToNodePage:n,propertyTable:a,featuresHashArray:i,attributeStorageInfo:o,draco:s,generateBoundingVolumes:u,shouldMergeMaterials:c,geoidHeightModel:l,libraries:f,metadataClass:p}){var w;let d=u,h=await YCt((w=e.gltf)==null?void 0:w.materials,c),m=nEe(e,t,r),g=iEe(e,p),x=await qCt(m,h,d,g);u&&LCt(x,l);let y=[];for(let T of h){let A=T.mergedMaterials[0].originalMaterialId;if(!x.has(A))continue;let B=x.get(A);if(!B)continue;let{material:I,texture:L}=T,C=await n();y.push(await MCt({convertedAttributes:B,material:I,texture:L,tileContent:e,nodeId:C,featuresHashArray:i,propertyTable:a,attributeStorageInfo:o,draco:s,libraries:f}))}return y.length?y:null}function LCt(e,t){for(let r of e.values()){let n=tEe(r.positions,t);r.boundingVolumes=n;let a=n.obb.center;for(let i=0;i<r.positions.length;i+=Ps){let o=r.positions.subarray(i,i+Ps);Ft.WGS84.cartesianToCartographic(Array.from(o),Qf),t&&(Qf[2]=Qf[2]-t.getHeight(Qf[1],Qf[0])),Qf=Qf.subtract(a),r.positions.set(Qf,i)}}}async function MCt({convertedAttributes:e,material:t,texture:r,tileContent:n,nodeId:a,featuresHashArray:i,propertyTable:o,attributeStorageInfo:s,draco:u,libraries:c}){var k;let l=e.boundingVolumes,f=e.positions.length/Ps,{faceRange:p,featureIds:d,positions:h,normals:m,colors:g,uvRegions:x,texCoords:y,featureCount:w}=ZAe(e),T={};o&&(T=uDt(d,e.featureIndices,i,o));let A=new Uint32Array(2),B=bDt(d);A.set([f,w],0);let I=new Uint8Array(bn(A.buffer,h.buffer,m.buffer,r?y.buffer:new ArrayBuffer(0),g.buffer,x,B.buffer,p.buffer)),L=u?vDt(f,e,{positions:h,normals:m,texCoords:r?y:new Float32Array(0),colors:g,uvRegions:x,featureIds:d,faceRange:p},c):null,C=[];return s&&o&&(C=pDt(d,T,o,s)),{nodeId:a,geometry:I,compressedGeometry:L,texture:r,hasUvRegions:Boolean(x.length),sharedResources:nDt(((k=n.gltf)==null?void 0:k.materials)||[],a),meshMaterial:t,vertexCount:f,attributes:C,featureCount:w,boundingVolumes:l}}async function qCt(e,t,r,n){let{nodes:a,images:i,cartographicOrigin:o,cartesianModelMatrix:s}=e,u=new Map;for(let c of t){let l={positions:new Float32Array(0),normals:new Float32Array(0),texCoords:new Float32Array(0),colors:new Uint8Array(0),uvRegions:new Uint16Array(0),featureIndicesGroups:[],featureIndices:[],boundingVolumes:null,mergedMaterials:c.mergedMaterials};for(let f of c.mergedMaterials)u.set(f.originalMaterialId,l)}bEe({nodes:a,images:i,cartographicOrigin:o,cartesianModelMatrix:s,attributesMap:u,useCartesianPositions:r,featureTexture:n});for(let c of u.keys()){let l=u.get(c);if(l){if(l.positions.length===0){u.delete(c);continue}l.featureIndicesGroups&&(l.featureIndices=l.featureIndicesGroups.reduce((f,p)=>f.concat(p)),delete l.featureIndicesGroups)}}return u}function bEe({nodes:e,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:a,useCartesianPositions:i,matrix:o=new mr([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),featureTexture:s}){if(e)for(let u of e)UCt({node:u,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:a,useCartesianPositions:i,matrix:o,featureTexture:s})}function NCt(e,t){let r=t,{matrix:n,rotation:a,scale:i,translation:o}=e;return n&&(r=t.multiplyRight(n)),o&&(r=r.translate(o)),a&&(r=r.rotateXYZ(a)),i&&(r=r.scale(i)),r}function UCt({node:e,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:a,useCartesianPositions:i,matrix:o=new mr([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),featureTexture:s}){let u=NCt(e,o),c=e.mesh;c&&zCt({mesh:c,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:a,useCartesianPositions:i,matrix:u,featureTexture:s}),bEe({nodes:e.children||[],images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:a,useCartesianPositions:i,matrix:u,featureTexture:s})}function zCt({mesh:e,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:a,useCartesianPositions:i=!1,matrix:o,featureTexture:s}){var u;for(let c of e.primitives){let l=null,f;c.material?(l=a.get(c.material.id),f=(u=l==null?void 0:l.mergedMaterials.find(({originalMaterialId:h})=>{var m;return h===((m=c.material)==null?void 0:m.id)}))==null?void 0:u.uvRegion):a.has("default")&&(l=a.get("default")),yt(l!==null,"Primitive - material mapping failed"),yt(c.mode===void 0||c.mode===ht.TRIANGLES||c.mode===ht.TRIANGLE_STRIP,`Primitive - unsupported mode ${c.mode}`);let p=c.attributes;if(!l)continue;let d=GCt(c);l.positions=Wi(l.positions,pEe({vertices:p.POSITION.value,cartographicOrigin:r,cartesianModelMatrix:n,nodeMatrix:o,indices:d,attributeSpecificTransformation:HCt,useCartesianPositions:i})),l.normals=Wi(l.normals,pEe({vertices:p.NORMAL&&p.NORMAL.value,cartographicOrigin:r,cartesianModelMatrix:n,nodeMatrix:o,indices:d,attributeSpecificTransformation:VCt,useCartesianPositions:!1})),l.texCoords=Wi(l.texCoords,$Ct(p.TEXCOORD_0&&p.TEXCOORD_0.value,d)),l.colors=Wi(l.colors,WCt(p.COLOR_0,d)),f&&(l.uvRegions=Wi(l.uvRegions,KCt(f,d))),l.featureIndicesGroups=l.featureIndicesGroups||[],l.featureIndicesGroups.push(JCt(XCt(p,c,t,s),d))}}function GCt(e){var r;let t=(r=e.indices)==null?void 0:r.value;if(!t){let n=e.attributes.POSITION.value;return Ek(n.length/Ps)}if(t&&e.mode===ht.TRIANGLE_STRIP){let n=t.constructor,a=new n((t.length-2)*3),i=0,o=t.slice(0,3);a.set(o,0);for(let s=1;s+2<t.length;s++)i+=3,o=t.slice(s,s+3),s%2===0?a.set(o,i):a.set(o.reverse(),i);t=a}return t}function pEe(e){let{vertices:t,indices:r,attributeSpecificTransformation:n}=e,a=new Float32Array(r.length*Ps);if(!t)return a;for(let i=0;i<r.length;i++){let o=r[i]*Ps,s=t.subarray(o,o+Ps),u=new Z(Array.from(s));u=n(u,e),a[i*Ps]=u.x,a[i*Ps+1]=u.y,a[i*Ps+2]=u.z}return a}function HCt(e,t){let{cartesianModelMatrix:r,cartographicOrigin:n,nodeMatrix:a,useCartesianPositions:i}=t;return a&&(e=e.transform(a)),e=e.transform(r),i||(Ft.WGS84.cartesianToCartographic([e[0],e[1],e[2]],e),e=e.subtract(n)),e}function VCt(e,t){let{cartesianModelMatrix:r,nodeMatrix:n}=t;return n&&(e=e.transformAsVector(n)),e=e.transformAsVector(r),e}function $Ct(e,t){let r=new Float32Array(t.length*Py);if(!e)return r.fill(1),r;for(let n=0;n<t.length;n++){let a=t[n]*Py,i=e.subarray(a,a+Py);r[n*Py]=i[0],r[n*Py+1]=i[1]}return r}function WCt(e,t){let r=(e==null?void 0:e.components)||OCt,n=new Uint8Array(t.length*r);if(!e)return n.fill(255),n;let a=e.value;for(let i=0;i<t.length;i++){let o=t[i]*r,s=a.subarray(o,o+r),u=new Uint8Array(r);for(let c=0;c<s.length;c++)u[c]=s[c]*255;n.set(u,i*r)}return n}function KCt(e,t){let r=new Uint16Array(t.length*4);for(let n=0;n<r.length;n+=4)r.set(e,n);return r}function JCt(e,t){if(!e.length||!t.length)return[];let r=[];for(let n=0;n<t.length;n++){let a=t[n];r.push(e[a])}return r}function XCt(e,t,r,n){let a=oEe(e,t,r,n);if(a.length)return a;for(let i=0;i<fEe.length;i++){let o=fEe[i];if(e[o]&&e[o].value)return e[o].value}return[]}async function YCt(e=[],t){let r=[];for(let n of e)r.push(eDt(n));return t&&(r=await QCt(r)),r}async function QCt(e){var r,n;let t=[];for(;e.length>0;){let a=e.splice(0,1)[0],i=[];for(let o=0;o<e.length;o++){let s=e[o];(a.texture&&s.texture||!a.texture&&!s.texture)&&(a=await ZCt(a,s),i.push(o))}if(a.texture&&i.length){let o=(r=a.mergedMaterials)==null?void 0:r.reduce((c,{textureSize:l})=>c+((l==null?void 0:l.width)||0),0),s=(n=a.mergedMaterials)==null?void 0:n.reduce((c,{textureSize:l})=>Math.max(c,(l==null?void 0:l.height)||0),0),u=-1;for(let c of a.mergedMaterials)if(c.textureSize){let l=u+1+c.textureSize.width/o*2**(Uint16Array.BYTES_PER_ELEMENT*8)-1;c.uvRegion=new Uint16Array([u+1,0,l,c.textureSize.height/s*2**(Uint16Array.BYTES_PER_ELEMENT*8)-1]),u=l}a.texture.image.width=o,a.texture.image.height=s}for(let o of i.reverse())e.splice(o,1);t.push(a)}return t.length||t.push({material:rDt(),mergedMaterials:[{originalMaterialId:"default"}]}),t}async function ZCt(e,t){var r,n;if((r=e.texture)!=null&&r.bufferView&&((n=t.texture)!=null&&n.bufferView)&&e.mergedMaterials&&t.mergedMaterials){let a=Buffer.from(e.texture.bufferView.data),i=Buffer.from(t.texture.bufferView.data);try{let{joinImages:o}=await import("join-images"),s=await o([a,i],{direction:"horizontal"});e.texture.bufferView.data=await s.toFormat(e.texture.mimeType==="image/png"?"png":"jpeg").toBuffer()}catch(o){throw console.log("Join images into a texture atlas has failed. Consider usage `--split-nodes` option. (See documentation https://loaders.gl/modules/tile-converter/docs/cli-reference/tile-converter)"),o}e.material.pbrMetallicRoughness.baseColorTexture.textureSetDefinitionId=1}return e.mergedMaterials=e.mergedMaterials.concat(t.mergedMaterials),e}function eDt(e){var a,i,o,s,u;let t={doubleSided:e.doubleSided,emissiveFactor:(a=e.emissiveFactor)==null?void 0:a.map(c=>Math.round(c*255)),alphaMode:tDt(e.alphaMode),pbrMetallicRoughness:{roughnessFactor:((i=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:i.roughnessFactor)||BCt,metallicFactor:((o=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:o.metallicFactor)||FCt}},r;(s=e==null?void 0:e.pbrMetallicRoughness)!=null&&s.baseColorTexture?(r=e.pbrMetallicRoughness.baseColorTexture.texture.source,t.pbrMetallicRoughness.baseColorTexture={textureSetDefinitionId:0}):e.emissiveTexture&&(r=e.emissiveTexture.texture.source,t.pbrMetallicRoughness.baseColorTexture={textureSetDefinitionId:0}),e.id=Number.isFinite(e.id)?e.id:Ju();let n=[{originalMaterialId:e.id}];if(r)n[0].textureSize={width:r.image.width,height:r.image.height};else{let c=(u=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:u.baseColorFactor;t.pbrMetallicRoughness.baseColorFactor=c&&c.map(l=>Math.round(l*255))||void 0}return{material:t,texture:r,mergedMaterials:n}}function tDt(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend";default:return"opaque"}}function rDt(){return{alphaMode:"opaque",pbrMetallicRoughness:{metallicFactor:1,roughnessFactor:1}}}function nDt(e,t){let r={};if(!e||!e.length)return r;r.materialDefinitionInfos=[];for(let n of e){let{materialDefinitionInfo:a,textureDefinitionInfo:i}=aDt(n,t);r.materialDefinitionInfos.push(a),i&&(r.textureDefinitionInfos=r.textureDefinitionInfos||[],r.textureDefinitionInfos.push(i))}return r}function aDt(e,t){var s;let r=((s=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:s.baseColorTexture)||e.emissiveTexture,n=null;r&&(n=oDt(r.texture,t));let{baseColorFactor:a,metallicFactor:i}=(e==null?void 0:e.pbrMetallicRoughness)||{},o=a;return(!a||a[3]===0)&&e.emissiveFactor&&(o=e.emissiveFactor,o[3]=o[3]||1),{materialDefinitionInfo:iDt(o||[1,1,1,1],i),textureDefinitionInfo:n}}function iDt(e,t=1){let r=.00015686274509803922,n=new Oo(0,0,0,1),a=new Oo(1,1,1,1),i=new Oo(r,r,r,0),o=new Oo(e),s=a.subtract(i).multiply(o),u=s.lerp(s,n,t);i[3]=1;let c=i.lerp(i,o,t);return{params:{diffuse:u.toArray(),specular:c.toArray(),renderMode:"solid"}}}function oDt(e,t){var r,n,a,i;return{encoding:(r=e==null?void 0:e.source)!=null&&r.mimeType?[e.source.mimeType]:void 0,images:[{id:sDt(e,t),size:(n=e.source)==null?void 0:n.image.width,length:(a=e.source)!=null&&a.image.data.length?[(i=e.source)==null?void 0:i.image.data.length]:void 0}]}}function sDt(e,t){var m;let{width:r,height:n}=((m=e.source)==null?void 0:m.image)||{};if(!r||!n)return"";let a=1,i=0,o=t+1,s=32-o.toString(2).length,u="0".repeat(s).concat(o.toString(2)),c=a<<28,l=i<<24,f=r-1<<12,p=n-1<<0,d=c+l+f+p;return BigInt(`0b${d.toString(2)}${u}`).toString()}function uDt(e,t,r,n){let a=cDt(e,n,r);return dEe(t,a),dEe(e,a),a}function cDt(e,t,r){let n={};for(let a=0;a<e.length;a++){let i=e[a],o=fDt(a,t,r);n[i.toString()]=o}return n}function lDt(e,t){let r="";for(let n in e)r+=e[n][t];return r}function fDt(e,t,r){let n=lDt(t,e),a=(0,gEe.default)(n);return r.includes(a)?r.indexOf(a):r.push(a)-1}function dEe(e,t){for(let r=0;r<e.length;r++)e[r]=t[e[r]]}function pDt(e,t,r,n){let a=[],o=uEe(e,r)?sEe(t,r):r,s={OBJECTID:e,...o};for(let u in s){let c=hDt(u,n);if(c){let l=s[u],f=dDt(c,l);a.push(f)}}return a}function dDt(e,t){let r;switch(e){case jCt:case PCt:r=mDt(t);break;case RCt:r=gDt(t);break;case ICt:r=hEe(t);break;default:r=hEe(t)}return r}function hDt(e,t){let r=t.find(n=>n.name===e);return r?r.attributeValues?r.attributeValues.valueType:(console.error(`attributeValues is null, attribute=${r}`),""):(console.error(`attribute is null, key=${e}, attributeStorageInfo=${JSON.stringify(t,null,2)}`),"")}function mDt(e){let t=new Uint32Array([e.length]),r=new Uint32Array(e);return bn(t.buffer,r.buffer)}function gDt(e){let t=new Uint32Array([e.length]),r=new Uint8Array(4),n=new Float64Array(e);return bn(t.buffer,r.buffer,n.buffer)}function hEe(e){let t=new Uint32Array([e.length]),r=0,n=new Uint32Array(e.length),a=[];for(let o=0;o<e.length;o++){let s=`${String(e[o])}\0`,u=Buffer.from(s),c=u.length;r+=c,n[o]=c,a.push(u)}let i=new Uint32Array([r]);return bn(t.buffer,i.buffer,n.buffer,...a)}function bDt(e){let t=new BigUint64Array(e.length);for(let r=0;r<e.length;r++)t[r]=BigInt(e[r]);return t}async function vDt(e,t,r,n){let{positions:a,normals:i,texCoords:o,colors:s,uvRegions:u,featureIds:c,faceRange:l}=r,f=new Uint32Array(e);for(let g=0;g<f.length;g++)f.set([g],g);let p=new Uint32Array(t.featureIndices.length?t.featureIndices:e),d=yDt(p,l),h={positions:a,normals:i,colors:s,"feature-index":d};o.length&&(h.texCoords=o);let m={"feature-index":{"i3s-attribute-type":"feature-index","i3s-feature-ids":new Int32Array(c)}};return u.length&&(h["uv-region"]=u,m["uv-region"]={"i3s-attribute-type":"uv-region"}),$m({attributes:h,indices:f},MS,{...MS.options,reuseWorkers:!0,_nodeWorkers:!0,modules:n,useLocalLibraries:!0,draco:{method:"MESH_SEQUENTIAL_ENCODING",attributesMetadata:m},["draco-writer"]:{workerUrl:xDt()}})}function xDt(){try{let t=(0,mEe.createRequire)(EDt.url).resolve("@loaders.gl/draco/package.json");return(0,Sk.join)((0,Sk.dirname)(t),"src/workers/draco-writer-worker-node.cjs")}catch{return"./modules/draco/src/workers/draco-writer-worker-node.cjs"}}function yDt(e,t){let r=new Uint32Array(e.length),n=0,a=0;for(let i=1;i<t.length;i+=2){let o=(t[i]+1)*Ps;r.fill(n,a,o),n++,a=o+1}return r}function vEe(e,t){if(!e)return null;let r,n=e.batchTableJson;if(n)return n;let{extensionName:a,extension:i}=ADt(e);switch(a){case Xc:return r=_Dt(i,t),r;case Ro:return r=wDt(i,t),r;default:return null}}function _Dt(e,t){if(e.propertyTables){for(let r of e.propertyTables)if(r.class===t||!t)return Tk(r)}if(e.propertyTextures){for(let r of e.propertyTextures)if(r.class===t||!t)return Tk(r)}return null}function wDt(e,t){if(e.featureTables)for(let r in e.featureTables){let n=e.featureTables[r];if(n.class===t||!t)return Tk(n)}if(e.featureTextures)for(let r in e.featureTextures){let n=e.featureTextures[r];if(n.class===t||!t)return Tk(n)}return null}function Tk(e){let t={};for(let r in e.properties)t[r]=e.properties[r].data;return t}function ADt(e){var i,o,s,u;let t=[Ro,Xc];if(!((i=e==null?void 0:e.gltf)==null?void 0:i.extensionsUsed))return{extensionName:null,extension:null};let n="";for(let c of((o=e==null?void 0:e.gltf)==null?void 0:o.extensionsUsed)||[])if(t.includes(c)){n=c;break}if(!n)return{extensionName:null,extension:null};let a=(u=(s=e==null?void 0:e.gltf)==null?void 0:s.extensions)==null?void 0:u[n];return{extensionName:n,extension:a}}var yEe=Ct(Is(),1),_Ee=require("path");var xEe=()=>({serviceItemId:{path:"serviceItemId"},serviceName:{path:"layerName"},name:{path:"layerName"},currentVersion:{path:"currentVersion",default:10.7},serviceVersion:{path:"serviceVersion",default:"1.8"},supportedBindings:{path:"supportedBindings",default:["REST"]},layers:{path:"layers0",transform:e=>[e]}});async function wEe(e,t,r){let n={serviceItemId:Ju().replace(/-/gi,""),layerName:e,layers0:t},a=(0,yEe.default)(n,xEe()),i=(0,_Ee.join)(r,"SceneServer");await Oi(i,JSON.stringify(a))}var SN=16;function AEe(e,t){let r=[],n=e.boundingVolume,a=e.lodMetricValue||.1,i={metricType:"maxScreenThreshold",maxError:t.mbs[3]*2*SN/a},o={metricType:"maxScreenThresholdSQ",maxError:Math.PI*.25*i.maxError*i.maxError};return n.constructor.name==="OrientedBoundingBox"?(r.push(o),r.push(i)):(r.push(i),r.push(o)),r}function kN(e){var n,a;let t=(n=e.lodSelection)==null?void 0:n.find(i=>i.metricType==="maxScreenThreshold"),r=t==null?void 0:t.maxError;if(!r){let i=(a=e.lodSelection)==null?void 0:a.find(o=>o.metricType==="maxScreenThresholdSQ");i&&(r=Math.sqrt(i.maxError/(Math.PI*.25)))}return r||(r=SN),e.mbs[3]*2*SN/r}var TDt=[9,-18,-88,0,96,90,0,0,-60,-20,-9,18,8,0,-96,30,0,0,60,-20,9,-88,-18,90,96,0,-20,-60,0,0,186,-42,-42,-150,-96,-150,60,60,60,60,54,162,-78,30,-24,-90,-60,60,-60,60,-9,-32,18,30,24,0,20,-60,0,0,-9,8,18,30,-96,0,-20,60,0,0,54,-78,162,-90,-24,30,60,-60,60,-60,-54,78,78,90,144,90,-60,-60,-60,-60,9,-8,-18,-30,-24,0,20,60,0,0,-9,18,-32,0,24,30,0,0,-60,20,9,-18,-8,0,-24,-30,0,0,60,20],SDt=372,kDt=[0,0,-131,0,138,144,0,0,-102,-31,0,0,7,0,-138,42,0,0,102,-31,62,0,-31,0,0,-62,0,0,0,31,124,0,-62,0,0,-124,0,0,0,62,124,0,-62,0,0,-124,0,0,0,62,62,0,-31,0,0,-62,0,0,0,31,0,0,45,0,-183,-9,0,93,18,0,0,0,216,0,33,87,0,-93,12,-93,0,0,156,0,153,99,0,-93,-12,-93,0,0,-45,0,-3,9,0,93,-18,0,0,0,-55,0,48,42,0,0,-84,31,0,0,-7,0,-48,-42,0,0,84,31],CDt=372,DDt=[18,-36,-122,0,120,135,0,0,-84,-31,-18,36,-2,0,-120,51,0,0,84,-31,36,-165,-27,93,147,-9,0,-93,18,0,210,45,-111,-93,-57,-192,0,93,12,93,162,141,-75,-93,-129,-180,0,93,-12,93,-36,-21,27,93,39,9,0,-93,-18,0,0,0,62,0,0,31,0,0,0,-31,0,0,124,0,0,62,0,0,0,-62,0,0,124,0,0,62,0,0,0,-62,0,0,62,0,0,31,0,0,0,-31,-18,36,-64,0,66,51,0,0,-102,31,18,-36,2,0,-66,-51,0,0,102,31],BDt=12,CN=(3+1)*(3+2)/2,FDt=2,Yg=class{constructor(t){this._v00=0,this._v01=0,this._v10=0,this._v11=0,this._t=[],this.options=t,this._ix=this.options._width,this._iy=this.options._height}getHeight(t,r){if(t=Math.abs(t)>90?NaN:t,isNaN(t)||isNaN(r))return NaN;let n=ODt(r,360);r=n!==-180?n:180;let a=r*this.options._rlonres,i=-t*this.options._rlatres,o=Math.floor(a),s=Math.min(Math.round((this.options._height-1)/2-1),Math.floor(i));a-=o,i-=s,s+=(this.options._height-1)/2,o+=o<0?this.options._width:o>=this.options._width?-this.options._width:0;let u=0,c=0,l=0,f=0,p=new Array(CN);if(o===this._ix&&s===this._iy)this.options.cubic?p=this._t:(u=this._v00,c=this._v01,l=this._v10,f=this._v11);else if(!this.options.cubic)u=this._rawval(o,s),c=this._rawval(o+1,s),l=this._rawval(o,s+1),f=this._rawval(o+1,s+1);else{let h=[this._rawval(o,s-1),this._rawval(o+1,s-1),this._rawval(o-1,s),this._rawval(o,s),this._rawval(o+1,s),this._rawval(o+2,s),this._rawval(o-1,s+1),this._rawval(o,s+1),this._rawval(o+1,s+1),this._rawval(o+2,s+1),this._rawval(o,s+2),this._rawval(o+1,s+2)],m=kDt;s!==0&&(m=s===this.options._height-2?DDt:TDt);let g=SDt;s!==0&&(g=s===this.options._height-2?CDt:240);for(let x=0;x<CN;++x){p[x]=0;for(let y=0;y<BDt;++y)p[x]+=h[y]*m[CN*y+x];p[x]/=g}}if(!this.options.cubic){let h=(1-a)*u+a*c,m=(1-a)*l+a*f,g=(1-i)*h+i*m,x=this.options._offset+this.options._scale*g;return this._ix=o,this._iy=s,this._v00=u,this._v01=c,this._v10=l,this._v11=f,x}let d=p[0]+a*(p[1]+a*(p[3]+a*p[6]))+i*(p[2]+a*(p[4]+a*p[7])+i*(p[5]+a*p[8]+i*p[9]));return d=this.options._offset+this.options._scale*d,this._ix=o,this._iy=s,this._t=p,d}_rawval(t,r){t<0?t+=this.options._width:t>=this.options._width&&(t-=this.options._width),(r<0||r>=this.options._height)&&(r=r<0?-r:2*(this.options._height-1)-r,t+=(t<this.options._width/2?1:-1)*this.options._width/2);let n=this.options._datastart+FDt*(r*this.options._swidth+t),a=this.options.data[n],i=this.options.data[n+1];return a<<8|i}};function ODt(e,t){t=Math.abs(t);let r=EEe(e,t);return 2*Math.abs(r)===t?r-=EEe(e,2*t)-r:2*Math.abs(r)>t&&(r+=r<0?t:-t),r}function EEe(e,t){return e-Math.floor(e/t)*t}var IDt=10,PDt=65535;function DN(e,t){let r=RDt(e),n=r.next();if(n.done||n.value.line!=="P5")throw new Error("Geoid model file: File not in PGM format");let a=Number.MAX_VALUE,i=0,o=-1,s=-1,u="NONE",c="UNKNOWN",l=0,f=0,p=null,d=null;do{n=r.next();let x=n.value.line;if(x.length)if(x[0]==="#"){let y=x.split(" "),w=y[0],T=y[1];if(w!=="#"||!T)continue;let A=y.length>2?y.slice(2):[];if(T==="Description")u=A.join(" ");else if(T==="DateTime")c=A.join(" ");else if(T==="Offset"){if(!y[2])throw new Error("Geoid model file: Error reading offset");a=parseInt(y[2],10)}else if(T==="Scale"){if(!y[2])throw new Error("Geoid model file: Error reading scale");i=parseFloat(y[2])}else T===(t.cubic?"MaxCubicError":"MaxBilinearError")?isFinite(parseFloat(y[2]))&&(o=parseFloat(y[2])):T===(t.cubic?"RMSCubicError":"RMSBilinearError")&&isFinite(parseFloat(y[2]))&&(s=parseFloat(y[2]))}else{let y=x.split(" ");if(y=y.filter(w=>w!==""),l=parseInt(y[0],10),f=parseInt(y[1],10),!(l&&f))throw new Error("Geoid model file: Error reading raster size");break}}while(!n.done);n=r.next();let h=parseInt(n.value.line,10);if(n.done)throw new Error("Geoid model file: Error reading maxval");if(h!==PDt)throw new Error("Geoid model file: Incorrect value of maxval");if(p=n.value.offset,d=l,a===Number.MAX_VALUE)throw new Error("Geoid model file: Offset not set");if(i===0)throw new Error("Geoid model file: Scale not set");if(i<0)throw new Error("Geoid model file: Scale must be positive");if(f<2||l<2)throw new Error("Geoid model file: Raster size too small");if(l&1)throw new Error("Geoid model file: Raster width is odd");if(!(f&1))throw new Error("Geoid model file: Raster height is even");let m=l/360,g=(f-1)/180;return new Yg({cubic:t.cubic,_width:l,_height:f,_rlonres:m,_rlatres:g,_offset:a,_scale:i,_swidth:d,_datastart:p,_maxerror:o,_rmserror:s,_description:u,_datetime:c,data:e})}function*RDt(e){let t=0;do{let r=e.indexOf(IDt,t);if(r!==-1){let n=e.subarray(t,r);t=r+1,yield{offset:t,line:TEe(n)}}else{let n=e.subarray(t,e.length);t=e.length,yield{offset:t,line:TEe(n)}}}while(t<e.length);return{offset:t,line:""}}function TEe(e){let t="";for(let r of e)t+=String.fromCharCode(r);return t}var jDt="4.4.1";var kk={dataType:null,batchType:null,name:"PGM - Netpbm grayscale image format",id:"pgm",module:"tile-converter",version:jDt,mimeTypes:["image/x-portable-graymap"],parse:async(e,t)=>DN(new Uint8Array(e),(t==null?void 0:t.pgm)||{}),extensions:["pgm"],options:{pgm:{cubic:!1}}};var Qg=Ct(Is(),1);var SEe={id:{path:"id",transform:e=>e.toUpperCase()},profile:{path:"profile",default:"meshpyramids"},version:{path:"version",default:"1.8"},resourcePattern:{path:"resourcePattern",default:["3dNodeIndexDocument","Attributes","SharedResource","Geometry"]},rootNode:{path:"rootNode",default:"./nodes/root"},extent:{path:"extent"},indexCRS:{path:"indexCRS",default:"http://www.opengis.net/def/crs/EPSG/0/4326"},vertexCRS:{path:"vertexCRS",default:"http://www.opengis.net/def/crs/EPSG/0/4326"},normalReferenceFrame:{path:"normalReferenceFrame",default:"east-north-up"},attributeEncoding:{path:"attributeEncoding",default:"application/octet-stream; version=1.6"},textureEncoding:{path:"textureEncoding",default:["image/jpeg","image/ktx2"]},lodType:{path:"lodType",default:"MeshPyramid"},lodModel:{path:"lodModel",default:"node-switching"},defaultGeometrySchema:{path:"defaultGeometrySchema",default:{geometryType:"triangles",header:[{property:"vertexCount",type:"UInt32"},{property:"featureCount",type:"UInt32"}],topology:"PerAttributeArray",ordering:["position","normal","uv0","color"],vertexAttributes:{position:{valueType:"Float32",valuesPerElement:3},normal:{valueType:"Float32",valuesPerElement:3},uv0:{valueType:"Float32",valuesPerElement:2},color:{valueType:"UInt8",valuesPerElement:4}},featureAttributeOrder:["id","faceRange"],featureAttributes:{id:{valueType:"UInt64",valuesPerElement:1},faceRange:{valueType:"UInt32",valuesPerElement:2}}}}};var LDt=()=>({wkid:{path:"wkid",default:4326},latestWkid:{path:"latestWkid",default:4326},vcsWkid:{path:"vcsWkid",default:5773},latestVcsWkid:{path:"latestVcsWkid",default:5773}}),MDt=()=>({heightModel:{path:"heightModel",default:"gravity_related_height"},vertCRS:{path:"vertCRS",default:"EGM96_Geoid"},heightUnit:{path:"heightUnit",default:"meter"}}),qDt=()=>({nodesPerPage:{path:"nodesPerPage"},lodSelectionMetricType:{path:"lodSelectionMetricType",default:"maxScreenThresholdSQ"}}),NDt=()=>({xmin:{path:"xmin"},ymin:{path:"ymin"},xmax:{path:"xmax"},ymax:{path:"ymax"},zmin:{path:"zmin"},zmax:{path:"zmax"}}),kEe=()=>({version:{path:"version",transform:e=>e.toUpperCase()},id:{path:"id",default:0},name:{path:"name"},href:{path:"href",default:"./layers/0"},layerType:{path:"layerType",default:"IntegratedMesh"},spatialReference:{path:"spatialReference",transform:e=>(0,Qg.default)(e,LDt())},capabilities:{path:"capabilities",default:["View","Query"]},store:{path:"store",transform:e=>(0,Qg.default)(e,SEe)},fullExtent:{path:"fullExtent",transform:e=>(0,Qg.default)(e,NDt())},heightModelInfo:{path:"heightModelInfo",transform:e=>(0,Qg.default)(e,MDt())},nodePages:{path:"nodePages",transform:e=>(0,Qg.default)(e,qDt())},materialDefinitions:{path:"materialDefinitions",default:[]},textureSetDefinitions:{path:"textureSetDefinitions",default:[]},geometryDefinitions:{path:"geometryDefinitions",default:[]},attributeStorageInfo:{path:"attributeStorageInfo",default:[]},fields:{path:"fields",default:[]},popupInfo:{path:"popupInfo",default:null}});var BN=Ct(Is(),1),UDt=()=>({offset:{default:8},position:{default:{type:"Float32",component:3}},normal:{default:{type:"Float32",component:3}},uv0:{path:"hasTexture",transform:e=>e&&{type:"Float32",component:2}||!1,omitValues:[!1]},color:{default:{type:"UInt8",component:4}},uvRegion:{path:"hasUvRegions",transform:e=>e&&{type:"UInt16",component:4}||!1,omitValues:[!1]},featureId:{default:{binding:"per-feature",type:"UInt64",component:1}},faceRange:{default:{binding:"per-feature",type:"UInt32",component:2}}}),zDt=()=>({"compressedAttributes.encoding":{default:"draco"},"compressedAttributes.attributes":{path:"geometryConfig",transform:e=>{let t=["position","normal"];return e.hasTexture&&t.push("uv0"),t.push("color"),e.hasUvRegions&&t.push("uv-region"),t.push("feature-index"),t}}}),CEe=()=>({geometryBuffers:{path:"geometryConfig",transform:e=>{let t=[(0,BN.default)(e,UDt())];return e.draco&&t.push((0,BN.default)({geometryConfig:e},zDt())),t}}});var Ry=Ct(Is(),1),GDt=()=>({renderMode:{path:"renderMode",default:"solid"},shininess:{path:"shininess",default:1},reflectivity:{path:"reflectivity",default:0},ambient:{path:"ambient",default:[1,1,1]},diffuse:{path:"diffuse",default:[1,1,1]},specular:{path:"specular",default:[0,0,0]},useVertexColorAlpha:{path:"useVertexColorAlpha",default:!1},vertexRegions:{path:"vertexRegions",default:!1},vertexColors:{path:"vertexColors",default:!0}}),HDt=()=>({name:{path:"name",default:"standard"},type:{path:"type",default:"standard"},params:{path:"params",transform:(e,t,r)=>(0,Ry.default)(r,GDt())}}),VDt=()=>({id:{path:"id"},size:{path:"size"},href:{path:"href",default:["../textures/0"]},length:{path:"length"}}),$Dt=()=>({encoding:{path:"encoding"},wrap:{path:"wrap",default:["none"]},atlas:{path:"atlas",default:!1},uvSet:{path:"uvSet",default:"uv0"},channels:{path:"channels",default:"rgb"},images:{path:"images",transform:(e,t,r)=>e.map(n=>(0,Ry.default)(n,VDt()))}}),DEe=()=>({materialDefinitions:{path:"materialDefinitionInfos",transform:WDt},textureDefinitions:{path:"textureDefinitionInfos",transform:KDt}});function WDt(e,t,r){let n={};for(let[a,i]of e.entries())n[`Mat${r.nodePath}${a}`]=(0,Ry.default)(i,HDt());return n}function KDt(e,t,r){if(!e)return null;let n={};for(let[a,i]of e.entries()){let o=`${r.nodePath}${a}`;i.imageIndex=o,n[o]=(0,Ry.default)(i,$Dt())}return n}var JDt=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]);function FEe(e){var r,n;if(!((r=e==null?void 0:e.parentNode)!=null&&r.obb)||!((n=e==null?void 0:e.parentNode)!=null&&n.mbs))return[];let t=[];return XDt(t,e),YDt(t,e),t}function XDt(e,t){var o;let r=QDt(t.parentNode.obb),n=ZDt(t);if(e5t(r,n))return;let i=`OBB of Tile (${t.id}) doesn't fit into Parent (${(o=t.parentNode)==null?void 0:o.id}) tile OBB`;e.push(i)}function YDt(e,t){var i;let r=BEe(t.mbs),n=BEe(t.parentNode.mbs);if(r.center.distanceTo(n.center)+r.radius>n.radius){let o=`MBS of Tile (${t.id}) doesn't fit into Parent (${(i=t.parentNode)==null?void 0:i.id}) tile MBS`;e.push(o)}}function BEe(e){return new ui([e[0],e[1],e[2]],e[3])}function QDt(e){let{center:t,halfSize:r,quaternion:n}=e;return new fa().fromCenterHalfSizeQuaternion(t,r,n)}function ZDt(e){let t=e.obb.halfSize,r=JDt,n=Ft.WGS84.cartographicToCartesian(e.obb.center),a=[];for(let i=0;i<r.length;i+=3){let s=new Z(r[i]*=t[0],r[i+1]*=t[1],r[i+2]*=t[2]).transformByQuaternion(e.obb.quaternion).add(n);a=a.concat(s)}return a}function e5t(e,t){let r=!0;for(let n=0;n<t.length/3;n+=3){let a=[t[n],t[n+1],t[n+2]],i=Ft.WGS84.cartesianToCartographic(a);if(e.distanceTo(i)>0){r=!1;break}}return r}var Ck=class extends Array{enqueue(t){this.push(t)}dequeue(){return this.shift()}peek(){return this[0]}isEmpty(){return this.length===0}};var OEe=Ct(require("process"),1),t5t=4*1024*1024*1024,Zg=class extends Ck{intervalId;conversionDump;writePromise=null;fileMap={};listeningInterval;writeConcurrency;constructor(t,r=2e3,n=400){super(),this.conversionDump=t,this.listeningInterval=r,this.writeConcurrency=n}async enqueue(t,r=!1){if(r){let{archiveKey:n,writePromise:a}=t,i=await a();n&&i&&(this.fileMap[n]=i)}else super.enqueue(t),OEe.default.memoryUsage().rss>t5t&&await this.startWrite()}startListening(){this.intervalId=setInterval(()=>this.startWrite.bind(this),this.listeningInterval)}stopListening(){this.intervalId&&clearInterval(this.intervalId)}async startWrite(){this.writePromise||(this.writePromise=this.doWrite()),await this.writePromise,this.writePromise=null}async finalize(){this.stopListening(),await this.startWrite()}async doWrite(){for(;this.length;){let t=[],r=[],n=[];for(let i=0;i<this.writeConcurrency;i++){let o=this.dequeue();if(!o)break;let{archiveKey:s,sourceId:u,outputId:c,resourceType:l,writePromise:f}=o;r.push(s),n.push({sourceId:u,outputId:c,resourceType:l});let p=f();t.push(p)}let a=await Promise.allSettled(t);this.updateFileMap(r,a),await this.conversionDump.updateConvertedTilesDump(n,a)}}updateFileMap(t,r){for(let n=0;n<t.length;n++){let a=t[n];a&&"value"in r[n]&&(this.fileMap[a]=r[n].value)}}};var eb="Tile converter does not work in browser, only in node js environment",Zf=".dump.json";var ON=require("path"),IN=Ct(Is(),1);var IEe=Ct(Is(),1),PEe=()=>({mbs:{path:"mbs"},obb:{path:"obb"}}),r5t=()=>({href:{path:"href"}}),n5t=()=>({id:{path:"id"},...r5t(),...PEe()}),FN=()=>({version:{path:"version"},id:{path:"id"},path:{path:"path"},level:{path:"level"},...PEe(),lodSelection:{path:"lodSelection",default:[{metricType:"maxScreenThresholdSQ",maxError:196349.54374999998},{metricType:"maxScreenThreshold",maxError:999.9999999999999}]},children:{path:"children",default:null},neighbors:{path:"neighbors",default:null},parentNode:{path:"parentNode",transform:e=>(0,IEe.default)(e,n5t()),default:null},sharedResource:{path:"sharedResource",default:null},featureData:{path:"featureData",default:null},geometryData:{path:"geometryData",default:null},textureData:{path:"textureData",default:null},attributeData:{path:"attributeData",default:null}});var Rs=class{id;inPageId;data=null;children=[];converter;_finalized=!1;get finalized(){return this._finalized}constructor(t,r){this.inPageId=t,this.id=t===0?"root":t.toString(),this.converter=r}async addData(t){return this.converter.options.instantNodeWriting?await this.write(t):this.data=t,this}async addChildren(t){let r=[];for(let a of t){let i=await a.load();r.push({id:a.id,href:`../${a.id}`,obb:i.obb,mbs:i.mbs})}this.children=this.children.concat(t);let n=this.data;this.converter.options.instantNodeWriting&&(n=await this.load()),n&&(n.children=n.children??[],n.children=n.children.concat(r)),this.converter.options.instantNodeWriting&&n&&await this.write(n)}async addNeighbors(){var r;if(this.finalized)return;let t=await this.load();for(let n of this.children){let a=await n.load();if(a.neighbors=a.neighbors??[],Number((r=t==null?void 0:t.children)==null?void 0:r.length)<1e3)for(let i of t.children||[])n.id!==i.id&&a.neighbors.push({...i});else console.warn(`Node ${n.id}: neighbors attribute is omited because of large number of neigbors`),delete a.neighbors;this.converter.options.instantNodeWriting&&a&&await n.write(a),await n.save()}this.finalize()}async save(){this.data&&await this.write(this.data)}finalize(){this._finalized=!0;for(let t of this.children)t.flush()}async write(t){let r=(0,ON.join)(this.converter.layers0Path,"nodes",this.id);await this.converter.writeQueue.enqueue({archiveKey:`nodes/${this.id}/3dNodeIndexDocument.json.gz`,writePromise:()=>Xu(r,JSON.stringify(t),"3dNodeIndexDocument.json",!0,this.converter.compressList)},!0)}async load(){if(this.data)return this.data;let t=this.id,r=(0,ON.join)(this.converter.layers0Path,"nodes",t);return await Kg(r,"3dNodeIndexDocument.json")}flush(){this.data=null}static async createRootNode(t,r){let n=Rs.createRootNodeIndexDocument(t);return await new Rs(0,r).addData(n)}static async createNode({parentNode:t,boundingVolumes:r,lodSelection:n,nodeInPage:a,resources:i,converter:o}){let s=await Rs.createNodeIndexDocument(t,r,n,a,i);return await new Rs(a.index,o).addData(s)}static createRootNodeIndexDocument(t){let r={version:`{${Ju().toUpperCase()}}`,id:"root",level:0,lodSelection:[{metricType:"maxScreenThresholdSQ",maxError:0},{metricType:"maxScreenThreshold",maxError:0}],...t,children:[]};return(0,IN.default)(r,FN())}static async createNodeIndexDocument(t,r,n,a,i){var l,f,p,d,h;let o=a.index,s=await t.load(),u={version:s.version,id:o.toString(),level:s.level+1,...r,lodSelection:n,parentNode:{id:t.id,href:`../${t.id}`,mbs:s.mbs,obb:s.obb},children:[],neighbors:[]},c=(0,IN.default)(u,FN());if(a.mesh&&(c.geometryData=[{href:"./geometries/0"}],c.sharedResource={href:"./shared"},("texture"in i&&i.texture||"texelCountHint"in i&&i.texelCountHint)&&(c.textureData=[{href:"./textures/0"},{href:"./textures/1"}]),"attributes"in i&&i.attributes&&i.attributes.length&&((f=(l=t.converter.layers0)==null?void 0:l.attributeStorageInfo)!=null&&f.length)||"attributesCount"in i&&i.attributesCount&&((d=(p=t.converter.layers0)==null?void 0:p.attributeStorageInfo)!=null&&d.length))){let m=("attributes"in i?(h=i.attributes)==null?void 0:h.length:i.attributesCount)||0;c.attributeData=[];let g=m<t.converter.layers0.attributeStorageInfo.length?m:t.converter.layers0.attributeStorageInfo.length;for(let x=0;x<g;x++){let y=t.converter.layers0.attributeStorageInfo[x].key;c.attributeData.push({href:`./attributes/${y}/0`})}}return c}};var PN=async(e,t,r)=>{let n=jy(t);if(!e||!t.contentUrl||!n)return;let a={...r,[e.loader.id]:{isTileset:n,assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}},i=await Dk(t.contentUrl,e.loader,a);i.root&&(t.children=[i.root])},RN=async(e,t,r)=>{let n=jy(t);if(!e||!t.contentUrl||n)return null;let a={...r,[e.loader.id]:{...r[e.loader.id]||{},isTileset:n,assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}};return await Dk(t.contentUrl,e.loader,a)};async function Dk(e,t,r){let n=e.split(".3tz"),a;if(n.length===1)a=null;else if(n.length===2)a=n[1].slice(1),a===""&&(a="tileset.json");else throw new Error("Unexpected URL format");if(a){let i=`${n[0]}.3tz`,o=a5t(i),s=await i5t(o),u=new ky(o,s,i),c=new fl(u),l=await Wr(a,t,r);return await c.destroy(),l}return await Wr(e,t,r)}function jy(e){return(e==null?void 0:e.type)==="json"||(e==null?void 0:e.type)==="3tz"}function a5t(e){return e.startsWith("http://")||e.startsWith("https://")?new d0(e):pr?new d0(e):new Ha(e)}async function i5t(e){let t,r=await Jd(e,Yd),n=await Xd(r,e);if((n==null?void 0:n.fileName)==="@3dtilesIndex1@"){let a=await Os(n.localHeaderOffset,e);if(!a)throw new Error("corrupted 3tz");let i=a.fileDataOffset,o=await Jr(e,i,i+a.compressedSize);t=Ty(o)}return t}var Bk=async({tile:e,traversalProps:t,processTile:r,postprocessTile:n,maxDepth:a,level:i=0})=>{if(a&&i>a)return;let o=[],s=await r(e,t);o.push(s);for(let u of e.children)await Bk({tile:u,traversalProps:s,processTile:r,postprocessTile:n,maxDepth:a,level:i+1});n&&await n(o,t)};var o5t=["POINTS","LINES","LINE_LOOP","LINE_STRIP","TRIANGLES","TRIANGLE_STRIP","TRIANGLE_FAN"],REe=async e=>{let t={meshTopologyTypes:new Set,metadataClasses:new Set};if(!(e!=null&&e.gltfArrayBuffer))return t;let n=(await Xi(e.gltfArrayBuffer,Yc,{gltf:{normalize:!1,loadBuffers:!1,loadImages:!1,decompressMeshes:!1}})).json;if(!n)return t;let a=s5t(n),i=u5t(n);return{meshTopologyTypes:a,metadataClasses:i}},s5t=e=>{let t=new Set;for(let r of e.meshes||[])for(let n of r.primitives){let{mode:a}=n;typeof a!="number"&&(a=4),t.add(o5t[a])}return t},u5t=e=>{var a,i,o,s,u,c;let t=new Set,r=(o=(i=(a=e.extensions)==null?void 0:a[Ro])==null?void 0:i.schema)==null?void 0:o.classes;if(r)for(let l of Object.keys(r))t.add(l);let n=(c=(u=(s=e.extensions)==null?void 0:s[Xc])==null?void 0:u.schema)==null?void 0:c.classes;if(n)for(let l of Object.keys(n))t.add(l);return t},jEe=(e,t)=>{for(let r of t.meshTopologyTypes)e.meshTopologyTypes.add(r);for(let r of t.metadataClasses)e.metadataClasses.add(r)};var LEe=Ct(require("process"),1);var c5t=.2,tb=class{_stepsTotal=0;_stepsDone=0;startTime=0;stopTime=0;timeOfUpdatingStepsDone=0;milliSecForOneStep=0;trust=!1;numberOfDigitsInPercentage=0;threshold;getTime;constructor(t={}){this.getTime=t.getTime||LEe.default.hrtime.bigint,this.threshold=t.threshold||c5t}get stepsTotal(){return this._stepsTotal}set stepsTotal(t){this._stepsTotal=t,this.numberOfDigitsInPercentage=this.stepsTotal>100?Math.ceil(Math.log10(this.stepsTotal))-2:0}get stepsDone(){return this._stepsDone}set stepsDone(t){if(this._stepsDone=t,this.timeOfUpdatingStepsDone=this.getCurrentTimeInMilliSeconds(),this._stepsDone){let n=(this.timeOfUpdatingStepsDone-this.startTime)/this._stepsDone;this.trust=this.isVelocityTrust(n,this.milliSecForOneStep),this.milliSecForOneStep=n}}startMonitoring(){this.startTime=this.getCurrentTimeInMilliSeconds(),this.milliSecForOneStep=0,this.trust=!1,this.timeOfUpdatingStepsDone=0,this.stopTime=0,this.stepsDone=0}stopMonitoring(){this.stopTime=this.getCurrentTimeInMilliSeconds()}getPercent(){return this._stepsTotal?this._stepsDone/this._stepsTotal*100:null}getPercentString(){let t=this.getPercent();return t!==null?t.toFixed(this.numberOfDigitsInPercentage):""}getTimeCurrentlyElapsed(){return(this.stopTime?this.stopTime:this.getCurrentTimeInMilliSeconds())-this.startTime}getTimeRemaining(){return!this._stepsTotal||!this._stepsDone||!this.startTime?null:{timeRemaining:(this._stepsTotal-this._stepsDone)*this.milliSecForOneStep,trust:this.trust}}getTimeRemainingString(){let t=this.getTimeRemaining();return t!=null&&t.trust?Jg(t.timeRemaining):""}isVelocityTrust(t,r){return r?Math.abs((t-r)/r)<this.threshold:!1}getCurrentTimeInMilliSeconds(){return Number(this.getTime()/BigInt(1e6))}};var f3e=require("util");var sp=require("path"),p3e=Ct(require("process"),1),d3e=Ct(c3e(),1);var l3e={type:"object",properties:{options:{type:"object",properties:{inputUrl:{type:"string"},outputPath:{type:"string"},tilesetName:{type:"string"},maxDepth:{type:"number"},slpk:{type:"boolean"},egmFilePath:{type:"string"},token:{type:"string"},draco:{type:"boolean"},mergeMaterials:{type:"boolean"},generateTextures:{type:"boolean"},generateBoundingVolumes:{type:"boolean"},metadataClass:{type:"string"},analyze:{type:"boolean"}},required:["inputUrl","outputPath","tilesetName"]},tilesConverted:{type:"object",patternProperties:{".*":{type:"object",properties:{nodes:{type:"array",items:{type:"object",properties:{nodeId:{type:["number","string"]},done:{type:"boolean"},progress:{type:"object",patternProperties:{".*":{type:"boolean"}}},dumpMetadata:{type:"object",properties:{boundingVolumes:{type:["object","null"],properties:{mbs:{type:"array",minItems:4,maxItems:4,items:{type:"number"}},obb:{type:"object",properties:{center:{type:"array",minItems:3,maxItems:3,items:{type:"number"}},halfSize:{type:"array",minItems:3,maxItems:3,items:{type:"number"}},quaternion:{type:"array",minItems:4,maxItems:4,items:{type:"number"}}},required:["center","halfSize","quaternion"]}},required:["mbs","obb"]},attributesCount:{type:"number"},featureCount:{type:"number"},geometry:{type:"boolean"},hasUvRegions:{type:"boolean"},materialId:{type:"number"},texelCountHint:{type:"number"},vertexCount:{type:"number"}},required:["boundingVolumes","featureCount","geometry","hasUvRegions","materialId","vertexCount"]}},required:["nodeId","done"]}}},required:["nodes"]}}},textureSetDefinitions:{type:"array",items:{type:"object",properties:{formats:{type:"array",items:{type:"object",properties:{name:{type:"string"},format:{enum:["jpg","png","ktx-etc2","dds","ktx2"]}},required:["name","format"]}},atlas:{type:"boolean"}},required:["formats"]}},attributeMetadataInfo:{type:"object",properties:{attributeStorageInfo:{type:"array",items:{type:"object",properties:{key:{type:"string"},name:{type:"string"},header:{type:"array",items:{type:"object",properties:{property:{type:"string"},valueType:{type:"string"}},required:["property","valueType"]}},ordering:{type:"array",items:{type:"string"}},attributeValues:{$ref:"#/$defs/AttributeValue"},attributeByteCounts:{$ref:"#/$defs/AttributeValue"},objectIds:{$ref:"#/$defs/AttributeValue"}},required:["key","name","header"]}},fields:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{$ref:"#/$defs/ESRIField"},alias:{type:"string"},domain:{$ref:"#/$defs/Domain"}},required:["name","type"]}},popupInfo:{type:"object",properties:{title:{type:"string"},description:{type:"string"},expressionInfos:{type:"array",items:{}},fieldInfos:{type:"array",items:{$ref:"#/$defs/FieldInfo"}},mediaInfos:{type:"array",items:{}},popupElements:{type:"array",items:{type:"object",properties:{text:{type:"string"},type:{type:"string"},fieldInfos:{type:"array",items:{$ref:"#/$defs/FieldInfo"}}}}}}}},required:["attributeStorageInfo","fields"]},materialDefinitions:{type:"array",items:{type:"object",properties:{pbrMetallicRoughness:{type:"object",properties:{baseColorFactor:{type:"array",minItems:4,maxItems:4,items:{type:"number"}},baseColorTexture:{$ref:"#/$defs/I3SMaterialTexture"},metallicFactor:{type:"number"},roughnessFactor:{type:"number"},metallicRoughnessTexture:{$ref:"#/$defs/I3SMaterialTexture"}},required:["metallicFactor","roughnessFactor"]},normalTexture:{$ref:"#/$defs/I3SMaterialTexture"},occlusionTexture:{$ref:"#/$defs/I3SMaterialTexture"},emissiveTexture:{$ref:"#/$defs/I3SMaterialTexture"},emissiveFactor:{type:"array",minItems:3,maxItems:3,items:{type:"number"}},alphaMode:{enum:["opaque","mask","blend"]},alphaCutoff:{type:"number"},doubleSided:{type:"boolean"},cullFace:{enum:["none","front","back"]}},required:["pbrMetallicRoughness","alphaMode"]}}},required:["options","tilesConverted"],$defs:{AttributeValue:{type:"object",properties:{valueType:{type:"string"},encoding:{type:"string"},valuesPerElement:{type:"number"}},required:["valueType"]},ESRIField:{enum:["esriFieldTypeDate","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeGUID","esriFieldTypeGlobalID","esriFieldTypeInteger","esriFieldTypeOID","esriFieldTypeSmallInteger","esriFieldTypeString"]},Domain:{type:"object",properties:{type:{type:"string"},name:{type:"string"},description:{type:"string"},fieldType:{type:"string"},range:{type:"array",items:{type:"number"}},codedValues:{type:"array",items:{type:"object",properties:{name:{type:"string"},code:{type:["string","number"]}},required:["name","code"]}},mergePolicy:{type:"string"},splitPolicy:{type:"string"}},required:["type","name"]},FieldInfo:{type:"object",properties:{fieldName:{type:"string"},visible:{type:"boolean"},isEditable:{type:"boolean"},label:{type:"string"}},required:["fieldName","visible","isEditable","label"]},I3SMaterialTexture:{type:"object",properties:{textureSetDefinitionId:{type:"number"},texCoord:{type:"number"},factor:{type:"number"}},required:["textureSetDefinitionId"]}}};var lh=class{restored=!1;options;tilesConverted;textureSetDefinitions;attributeMetadataInfo;materialDefinitions;constructor(){this.tilesConverted={}}async createDump(t){let{tilesetName:r,slpk:n,egmFilePath:a,inputUrl:i,outputPath:o,draco:s=!0,maxDepth:u,token:c,generateTextures:l,generateBoundingVolumes:f,mergeMaterials:p=!0,metadataClass:d,analyze:h=!1,outputVersion:m="1.1"}=t;this.options={tilesetName:r,slpk:n,egmFilePath:a,inputUrl:i,outputPath:o,draco:s,maxDepth:u,token:c,generateTextures:l,generateBoundingVolumes:f,mergeMaterials:p,metadataClass:d,analyze:h,outputVersion:m};let g=(0,sp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Zf}`);if(await Dy(g))try{let x=await Kg((0,sp.join)(this.options.outputPath,this.options.tilesetName),`${this.options.tilesetName}${Zf}`),{options:y,tilesConverted:w,textureSetDefinitions:T,attributeMetadataInfo:A,materialDefinitions:B}=x;if(new d3e.default().compile(l3e)(x)&&(0,f3e.isDeepStrictEqual)(y,JSON.parse(JSON.stringify(this.options)))){this.tilesConverted=w,this.textureSetDefinitions=T,this.attributeMetadataInfo=A,this.materialDefinitions=B,this.restored=!0;return}}catch(x){console.log("Can't open dump file",x)}await this.deleteDumpFile()}reset(){this.restored=!1,this.tilesConverted={},this.textureSetDefinitions&&delete this.textureSetDefinitions,this.attributeMetadataInfo&&delete this.attributeMetadataInfo,this.materialDefinitions&&delete this.materialDefinitions}async updateDumpFile(){var t;if((t=this.options)!=null&&t.outputPath&&this.options.tilesetName)try{let r=p3e.default.hrtime();await Oi((0,sp.join)(this.options.outputPath,this.options.tilesetName),JSON.stringify({options:this.options,tilesConverted:this.tilesConverted,textureSetDefinitions:this.textureSetDefinitions,attributeMetadataInfo:this.attributeMetadataInfo,materialDefinitions:this.materialDefinitions}),`${this.options.tilesetName}${Zf}.${r[0]}.${r[1]}`),await KAe((0,sp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Zf}.${r[0]}.${r[1]}`),(0,sp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Zf}`))}catch(r){console.log("Can't update dump file",r)}}async deleteDumpFile(){var t;(t=this.options)!=null&&t.outputPath&&this.options.tilesetName&&await Dy((0,sp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Zf}`))&&await Fy((0,sp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Zf}`))}getRecord(t){return this.tilesConverted[t]}setRecord(t,r){this.tilesConverted[t]=r}async addNode(t,r,n){let{nodes:a}=this.getRecord(t)||{nodes:[]};a.push({nodeId:r,done:!1,dumpMetadata:n}),a.length===1&&this.setRecord(t,{nodes:a}),await this.updateDumpFile()}clearDumpRecord(t){this.setRecord(t,{nodes:[]})}addTexturesDefinitions(t){this.textureSetDefinitions=t}updateDoneStatus(t,r,n,a){var o;let i=(o=this.tilesConverted[t])==null?void 0:o.nodes.find(s=>s.nodeId===r);i&&(i.progress||(i.progress={}),i.progress[n]=a,a||(i.done=!1))}async updateConvertedTilesDump(t,r){for(let n=0;n<t.length;n++)if(t[n]&&"value"in r[n]){let{sourceId:a,resourceType:i,outputId:o}=t[n];this.updateNodes(a,o,i)}await this.updateDumpFile()}updateNodes(t,r,n){if(!(!t||!n||!r)){for(let a of this.tilesConverted[t].nodes)if(a.nodeId===r&&a.progress){a.progress[n]=!0;let i=!1;for(let o in a.progress)if(i=a.progress[o],!i)break;a.done=i,a.done&&delete a.progress;break}}}async updateConvertedNodesDumpFile(t,r,n){var i;let a=(i=this.tilesConverted[t])==null?void 0:i.nodes.find(o=>o.nodeId===r);a&&(a.done=n,await this.updateDumpFile())}isFileConversionComplete(t){var n,a,i;let r=!0;for(let o of((n=this.tilesConverted[t])==null?void 0:n.nodes)||[])if(!o.done){r=!1;break}return r&&((i=(a=this.tilesConverted[t])==null?void 0:a.nodes)==null?void 0:i.length)>0}setMaterialsDefinitions(t){this.materialDefinitions=t}};var m3e,jPt=(m3e=fh.default.env)==null?void 0:m3e.IonToken,h3e=64,LPt="3DTILES",MPt="3DObject",qPt=1800,NPt="https://",up="phase1-count",bb=class{attributeMetadataInfo;nodePages;options;layers0Path;materialMap;materialDefinitions;geometryMap;geometryConfigs;vertexCounter;layers0;featuresHashArray;refinementCounter;validate;boundingVolumeWarnings=[];conversionStartTime=[0,0];refreshTokenTime=[0,0];sourceTileset=null;loadOptions={core:{_nodeWorkers:!0,reuseWorkers:!0,useLocalLibraries:!0},basis:{format:"rgba32",workerUrl:"./modules/textures/dist/basis-worker-node.js"},draco:{workerUrl:"./modules/draco/dist/draco-worker-node.js"},modules:{}};geoidHeightModel=null;Loader=Nu;generateTextures;generateBoundingVolumes;layersHasTexture;workerSource={};writeQueue=new Zg(new lh);compressList=null;preprocessData={meshTopologyTypes:new Set,metadataClasses:new Set};progresses={};conversionDump;constructor(){this.attributeMetadataInfo=new sS,this.nodePages=new Ca(Oi,h3e,this),this.options={},this.layers0Path="",this.materialMap=new Map,this.materialDefinitions=[],this.geometryMap=new Map,this.geometryConfigs=[],this.vertexCounter=0,this.layers0=null,this.featuresHashArray=[],this.refinementCounter={tilesCount:0,tilesWithAddRefineCount:0},this.validate=!1,this.generateTextures=!1,this.generateBoundingVolumes=!1,this.layersHasTexture=!1,this.compressList=null,this.conversionDump=new lh}async convert(t){var x;if(pr)return console.log(eb),eb;this.conversionStartTime=fh.default.hrtime();let{tilesetName:r,egmFilePath:n,inputUrl:a,validate:i,outputPath:o,draco:s=!0,maxDepth:u,token:c,generateTextures:l,generateBoundingVolumes:f,instantNodeWriting:p=!1,mergeMaterials:d=!0,inquirer:h,metadataClass:m,analyze:g=!1}=t;this.options={outputPath:o,tilesetName:r,maxDepth:u,egmFilePath:n,draco:s,token:c,inputUrl:a,instantNodeWriting:p,mergeMaterials:d,inquirer:h,metadataClass:m},this.progresses[up]=new tb,this.compressList=this.options.instantNodeWriting&&[]||null,this.validate=Boolean(i),this.Loader=a.indexOf(NPt)!==-1?w8:Nu,this.generateTextures=Boolean(l),this.generateBoundingVolumes=Boolean(f),this.writeQueue=new Zg(this.conversionDump),this.writeQueue.startListening(),n.toLowerCase()==="none"?console.log('--egm chousen to be "none", skip loading egm file'):(console.log("Loading egm file..."),this.geoidHeightModel=await Wr(n,kk),console.log("Loading egm file completed!")),this.nodePages.useWriteFunction(Xu);try{let y=await this._fetchPreloadOptions(),w=a;if(y.url&&(w=y.url),y.headers){(x=this.loadOptions).core||(x.core={});let A=this.loadOptions.core.fetch;if(typeof A=="function")this.loadOptions.core.fetch=(B,I)=>A(B,{...I||{},headers:y.headers});else{let B=A&&typeof A=="object"?A:{};this.loadOptions.core.fetch={...B,headers:y.headers}}}this.sourceTileset=await Dk(w,this.Loader,this.loadOptions),(this.Loader===Nu||g?await this.preprocessConversion():!0)&&!g&&await this.selectMetadataClass()&&(await this._createAndSaveTileset(o,r),await this._finishConversion({outputPath:o,tilesetName:r}))}catch(y){throw y}finally{await this.writeQueue.finalize(),Ua.getWorkerFarm({}).destroy()}return"success"}async preprocessConversion(){console.log("Analyze source tileset");let t=this.sourceTileset.root;await Bk({tile:t,traversalProps:null,processTile:this.analyzeTile.bind(this),postprocessTile:void 0,maxDepth:this.options.maxDepth});let{meshTopologyTypes:r,metadataClasses:n}=this.preprocessData;return console.log("------------------------------------------------"),console.log("Preprocess results:"),console.log(`Tile count: ${this.progresses[up].stepsTotal}`),console.log(`glTF mesh topology types: ${Array.from(r).join(", ")}`),n.size?console.log(`Feature metadata classes have been found: ${Array.from(n).join(", ")}`):console.log("Feature metadata classes have not been found"),!r.has("TRIANGLES")&&!r.has("TRIANGLE_STRIP")?(console.log("The tileset is of unsupported mesh topology types. The conversion will be interrupted."),console.log("------------------------------------------------"),!1):(console.log("------------------------------------------------"),!0)}async analyzeTile(t,r){if(jy(t))return await PN(this.sourceTileset,t,this.loadOptions),null;t.id&&(this.progresses[up].stepsTotal+=1,console.log(`[analyze]: ${t.id}`));let a=null;try{a=await RN(this.sourceTileset,t,{...this.loadOptions,"3d-tiles":{...this.loadOptions["3d-tiles"],loadGLTF:!1}})}catch{console.log(`[warning]: Failed to load ${t.contentUrl}. An I3S tile with empty content will be added to the output tileset`)}let i=await REe(a);return jEe(this.preprocessData,i),null}async selectMetadataClass(){var r;let{metadataClasses:t}=this.preprocessData;if(t.size>1)if((r=this.options.metadataClass)!=null&&r.length)console.log(`${this.options.metadataClass} has been selected`);else if(this.options.inquirer){let n=await this.options.inquirer.prompt([{name:"metadataClass",type:"list",message:"Select feature metadata data class to convert...",choices:Array.from(t)}]);this.options.metadataClass=n.metadataClass,console.log(`${n.metadataClass} has been selected`)}else return console.log(`A feature metadata class has not been selected. Start the converter with option "--metadata-class". For example, "npx tile-converter ... --metadata-class ${Array.from(t)[0]}"`),console.log("------------------------------------------------"),!1;return!0}async _createAndSaveTileset(t,r){var c,l,f;let n=(0,Jo.join)(`${t}`,`${r}`);await this.conversionDump.createDump(this.options),this.conversionDump.restored&&this.options.inquirer&&((await this.options.inquirer.prompt([{name:"resumeConversion",type:"confirm",message:"Dump file of the previous conversion exists, do you want to resume that conversion?"}])).resumeConversion||this.conversionDump.reset()),this.layers0Path=(0,Jo.join)(n,"SceneServer","layers","0");let a=this.conversionDump.restored?(0,Jo.join)(this.layers0Path,"nodepages"):n;try{await By(a)}catch{}if(this.conversionDump.restored&&this.conversionDump.attributeMetadataInfo&&this.attributeMetadataInfo.fromObject(this.conversionDump.attributeMetadataInfo),this.materialDefinitions=[],this.materialMap=new Map,this.conversionDump.restored&&this.conversionDump.materialDefinitions){for(let p=0;p<this.conversionDump.materialDefinitions.length;p++){let d=(0,p4.default)(JSON.stringify(this.conversionDump.materialDefinitions[p]));this.materialMap.set(d,p)}this.materialDefinitions=this.conversionDump.materialDefinitions}let i=this.sourceTileset.root,o=E1(i.boundingVolume,new mr(i.transform),null);this._formLayers0(r,o,(f=(l=(c=this.sourceTileset)==null?void 0:c.root)==null?void 0:l.boundingVolume)==null?void 0:f.region);let s=Ak(o,this.geoidHeightModel);await this.nodePages.push({index:0,lodThreshold:0,obb:s.obb,children:[]}),this.progresses[up].startMonitoring();let u=await Rs.createRootNode(s,this);await Bk({tile:i,traversalProps:{transform:new mr(i.transform),parentNodes:[u]},processTile:this.convertTile.bind(this),postprocessTile:this.finalizeTile.bind(this),maxDepth:this.options.maxDepth}),this.progresses[up].stopMonitoring(),console.log("[finalizing conversion]"),this.layers0.attributeStorageInfo=this.attributeMetadataInfo.attributeStorageInfo,this.layers0.fields=this.attributeMetadataInfo.fields,this.layers0.popupInfo=this.attributeMetadataInfo.popupInfo,this.attributeMetadataInfo.attributeStorageInfo.length&&(this.layers0.layerType=MPt),this.conversionDump.restored&&this.conversionDump.textureSetDefinitions&&(this.layers0.textureSetDefinitions=this.conversionDump.textureSetDefinitions),this.layers0.materialDefinitions=this.materialDefinitions,this.layers0.geometryDefinitions=(0,f4.default)(this.geometryConfigs.map(p=>({geometryConfig:{...p,draco:this.options.draco}})),CEe()),this.layersHasTexture===!1&&(this.layers0.store.defaultGeometrySchema.ordering=this.layers0.store.defaultGeometrySchema.ordering.filter(p=>p!=="uv0")),await this._writeLayers0(),wEe(r,this.layers0,n);for(let p of this.compressList||[])await xk(p),await Fy(p);await this.nodePages.save(),await this.writeQueue.finalize(),await this._createSlpk(n)}_formLayers0(t,r,n){var s;if(!((s=this.sourceTileset)!=null&&s.root))return;let a=rEe(r);n&&(a.zmin=n[4],a.zmax=n[5]);let i=[a.xmin,a.ymin,a.xmax,a.ymax],o={version:`{${Ju().toUpperCase()}}`,id:0,name:t,href:"./layers/0",store:{id:`{${Ju().toUpperCase()}}`,extent:i},nodePages:{nodesPerPage:h3e},compressGeometry:this.options.draco,fullExtent:a};this.layers0=(0,f4.default)(o,kEe())}async _writeLayers0(){await this.writeQueue.enqueue({archiveKey:"3dSceneLayer.json.gz",writePromise:()=>Xu(this.layers0Path,JSON.stringify(this.layers0),"3dSceneLayer.json")})}async _createSlpk(t){await this.conversionDump.deleteDumpFile();let r=(0,Jo.join)(t,"SceneServer","layers","0"),n=`${t}.slpk`;await hN(r,n,async a=>({path:"@specialIndexFileHASH128@",file:await Sy(a)}));try{await By(t)}catch{}}async convertTile(t,r){let n=jy(t);if(n||t.type==="empty")return n&&(t.id&&console.log(`[load]: ${t.id}`),await PN(this.sourceTileset,t,this.loadOptions)),r;t.id&&console.log(`[convert]: ${t.id}`);let{parentNodes:a,transform:i}=r,o=i.clone();t.transform&&(o=o.multiplyRight(t.transform));let s=a[0],u=await this._restoreNode(s,t,o),c;u===null?c=await this._createNode(s,t,o):c=u,await s.addChildren(c);let l={transform:o,parentNodes:c};if(t.id){this.progresses[up].stepsDone+=1;let f="Calculating time left...",p=this.progresses[up].getTimeRemainingString();p&&(f=`${p} left`);let d=this.progresses[up].getPercentString(),h=d?` ${d}%, ${f}`:"";console.log(`[converted${h}]: ${t.id}`)}return l}async finalizeTile(t,r){for(let n of t)for(let a of n.parentNodes)await a.addNeighbors();for(let n of r.parentNodes)await n.save()}async _generateNodeIndexDocument(t,r,n,a,i){this.layersHasTexture=this.layersHasTexture||Boolean("texture"in r&&r.texture||"texelCountHint"in r&&r.texelCountHint),this.generateBoundingVolumes&&r.boundingVolumes&&(t=r.boundingVolumes);let o=AEe(a,t),s=o.find(f=>f.metricType==="maxScreenThresholdSQ")||{maxError:0};if(i){let f={center:[],halfSize:[],quaternion:[]};await this.nodePages.push({index:0,obb:f},n.inPageId)}let u=await this._updateNodeInNodePages(s,t,a,n.inPageId,r),c=await Rs.createNodeIndexDocument(n,t,o,u,r);return{node:await new Rs(u.index,this).addData(c),nodeInPage:u,nodeData:c}}async _restoreNode(t,r,n){if(this._checkAddRefinementTypeForTile(r),await this._updateTilesetOptions(),this.conversionDump.restored&&r.id&&this.conversionDump.isFileConversionComplete(r.id)){let a=E1(r.boundingVolume,n,null),i=Ak(a,this.geoidHeightModel),o=[];for(let s of this.conversionDump.tilesConverted[r.id].nodes){let{node:u}=await this._generateNodeIndexDocument(i,{...s.dumpMetadata,nodeId:s.nodeId},t,r,!0);o.push(u)}return o}else this.conversionDump.restored&&r.id&&this.conversionDump.clearDumpRecord(r.id);return null}async _createNode(t,r,n){var d;this._checkAddRefinementTypeForTile(r),await this._updateTilesetOptions();let a=null;try{a=await RN(this.sourceTileset,r,this.loadOptions)}catch{console.log(`[warning]: Failed to load ${r.contentUrl}`)}let i=E1(r.boundingVolume,n,null),o=Ak(i,this.geoidHeightModel),s=vEe(a,this.options.metadataClass);this.createAttributeStorageInfo(a,s),this.conversionDump.attributeMetadataInfo={attributeStorageInfo:this.attributeMetadataInfo.attributeStorageInfo,fields:this.attributeMetadataInfo.fields,popupInfo:this.attributeMetadataInfo.popupInfo};let u=await this._convertResources({sourceTile:r,transformationMatrix:n,boundingVolume:i,tileContent:a,parentId:t.inPageId,propertyTable:s}),c=[],l=[],f=[],p={geometry:null,compressedGeometry:null,texture:null,hasUvRegions:!1,sharedResources:null,meshMaterial:null,vertexCount:null,attributes:null,featureCount:null,boundingVolumes:null};for(let h of u||[p]){let{node:m,nodeInPage:g,nodeData:x}=await this._generateNodeIndexDocument(o,h,t,r,!1);if(c.push(m),g.mesh){if(r.id){let y={boundingVolumes:h.boundingVolumes,attributesCount:(d=h.attributes)==null?void 0:d.length,featureCount:h.featureCount,geometry:Boolean(h.geometry),hasUvRegions:h.hasUvRegions,materialId:g.mesh.material.definition,texelCountHint:g.mesh.material.texelCountHint,vertexCount:h.vertexCount};this.conversionDump.setMaterialsDefinitions(this.materialDefinitions),await this.conversionDump.addNode(r.id,g.index,y)}await this._writeResources(h,m.id,r)}this.validate&&(this.boundingVolumeWarnings=FEe(x),this.boundingVolumeWarnings&&this.boundingVolumeWarnings.length&&console.warn("Bounding Volume Warnings: ",...this.boundingVolumeWarnings)),l.push(g.index),f.push(g)}return c}async _convertResources({sourceTile:t,transformationMatrix:r,boundingVolume:n,tileContent:a,parentId:i,propertyTable:o}){if(!this.isContentSupported(t)||!a)return null;let s={center:[],halfSize:[],quaternion:[]};return await TN({tileContent:a,tileTransform:r,tileBoundingVolume:n,addNodeToNodePage:async()=>(await this.nodePages.push({index:0,obb:s},i)).index,propertyTable:o,featuresHashArray:this.featuresHashArray,attributeStorageInfo:this.attributeMetadataInfo.attributeStorageInfo,draco:this.options.draco??!1,generateBoundingVolumes:this.generateBoundingVolumes,shouldMergeMaterials:this.options.mergeMaterials??!1,geoidHeightModel:this.geoidHeightModel,libraries:this.loadOptions.modules,metadataClass:this.options.metadataClass})}async _updateNodeInNodePages(t,r,n,a,i){let{vertexCount:o,featureCount:s,geometry:u,hasUvRegions:c}=i,l={index:0,lodThreshold:t.maxError,obb:r.obb,children:[]};u&&this.isContentSupported(n)&&(l.mesh={geometry:{definition:this.findOrCreateGeometryDefinition(Boolean("texture"in i&&i.texture||"texelCountHint"in i&&i.texelCountHint),c),resource:0},attribute:{resource:0},material:{definition:0}});let f="nodeId"in i?i.nodeId:void 0,p;if(f?p=await this.nodePages.getNodeById(f):p=await this.nodePages.push(l,a),l.mesh||console.log(`[warning]: node ${p.index} is created with empty content`),Ca.updateAll(p,l),"meshMaterial"in i&&i.meshMaterial?Ca.updateMaterialByNodeId(p,this._findOrCreateMaterial(i.meshMaterial)):"materialId"in i&&i.materialId!==null&&Ca.updateMaterialByNodeId(p,i.materialId),"texture"in i&&i.texture){let d=i.texture.image.height*i.texture.image.width;Ca.updateTexelCountHintByNodeId(p,d)}else"texelCountHint"in i&&i.texelCountHint&&Ca.updateTexelCountHintByNodeId(p,i.texelCountHint);return o&&(this.vertexCounter+=o,Ca.updateVertexCountByNodeId(p,o)),Ca.updateNodeAttributeByNodeId(p),s&&Ca.updateFeatureCountByNodeId(p,s),this.nodePages.saveNode(p),p}async _writeResources(t,r,n){let{geometry:a,compressedGeometry:i,texture:o,sharedResources:s,attributes:u}=t,c=(0,Jo.join)(this.layers0Path,"nodes",r),l=(0,Jo.join)("nodes",r);await this._writeGeometries({geometryBuffer:a,compressedGeometry:i,childPath:c,slpkChildPath:l,sourceId:n.id||"",nodeId:parseInt(r)}),await this._writeShared({sharedResources:s,childPath:c,slpkChildPath:l,nodePath:r,sourceId:n.id||"",nodeId:parseInt(r)}),await this._writeTexture(o,c,l,n.id||"",parseInt(r)),await this._writeAttributes(u,c,l,n.id||"",parseInt(r))}async _writeGeometries({geometryBuffer:t,compressedGeometry:r,childPath:n,slpkChildPath:a,sourceId:i,nodeId:o}){if(!t)return;this.conversionDump.updateDoneStatus(i,o,"GEOMETRY",!1);let s=(0,Jo.join)(n,"geometries");if(await this.writeQueue.enqueue({archiveKey:`${a}/geometries/0.bin.gz`,sourceId:i,outputId:o,resourceType:"GEOMETRY",writePromise:()=>Xu(s,t,"0.bin")}),this.options.draco&&r){this.conversionDump.updateDoneStatus(i,o,"DRACO_GEOMETRY",!1);let u=(0,Jo.join)(n,"geometries");await this.writeQueue.enqueue({archiveKey:`${a}/geometries/1.bin.gz`,sourceId:i,outputId:o,resourceType:"DRACO_GEOMETRY",writePromise:()=>Xu(u,r,"1.bin")})}}async _writeShared({sharedResources:t,childPath:r,slpkChildPath:n,nodePath:a,sourceId:i,nodeId:o}){if(!t)return;t.nodePath=a;let s=(0,f4.default)(t,DEe()),u=JSON.stringify(s);this.conversionDump.updateDoneStatus(i,o,"SHARED",!1);let c=(0,Jo.join)(r,"shared");await this.writeQueue.enqueue({archiveKey:`${n}/shared/sharedResource.json.gz`,sourceId:i,outputId:o,resourceType:"SHARED",writePromise:()=>Xu(c,u,"sharedResource.json")})}async _writeTexture(t,r,n,a,i){if(t){let o=this._getFormatByMimeType(t==null?void 0:t.mimeType),s=[],u=t.bufferView.data;switch(o){case"jpg":case"png":{if(s.push({name:"0",format:o}),this.conversionDump.updateDoneStatus(a,i,`${"TEXTURE"}/${o}`,!1),await this.writeTextureFile({textureData:u,name:"0",format:o,childPath:r,slpkChildPath:n,sourceId:a,nodeId:i}),this.generateTextures){s.push({name:"1",format:"ktx2"});let c=t.image.data.subarray(),l=new Uint8Array(c),f=$m({...t.image,data:l},LM,{...LM.options,["ktx2-basis-writer"]:{workerUrl:"./modules/textures/dist/ktx2-basis-writer-worker-node.js"},reuseWorkers:!0,_nodeWorkers:!0,useLocalLibraries:!0});this.conversionDump.updateDoneStatus(a,i,`${"TEXTURE"}/ktx2`,!1),await this.writeTextureFile({textureData:f,name:"1",format:"ktx2",childPath:r,slpkChildPath:n,sourceId:a,nodeId:i})}break}case"ktx2":{if(s.push({name:"1",format:o}),this.conversionDump.updateDoneStatus(a,i,`${"TEXTURE"}/${o}`,!1),await this.writeTextureFile({textureData:u,name:"1",format:o,childPath:r,slpkChildPath:n,sourceId:a,nodeId:i}),this.generateTextures){s.push({name:"0",format:"jpg"});let c=$m(t.image.data[0],TM);this.conversionDump.updateDoneStatus(a,i,`${"TEXTURE"}/jpg`,!1),await this.writeTextureFile({textureData:c,name:"0",format:"jpg",childPath:r,slpkChildPath:n,sourceId:a,nodeId:i})}break}default:}this.layers0.textureSetDefinitions.length||(this.layers0.textureSetDefinitions.push({formats:s}),this.layers0.textureSetDefinitions.push({formats:s,atlas:!0}),this.layers0.textureSetDefinitions&&this.conversionDump.addTexturesDefinitions(this.layers0.textureSetDefinitions))}}async writeTextureFile({textureData:t,name:r,format:n,childPath:a,slpkChildPath:i,sourceId:o,nodeId:s}){let u=(0,Jo.join)(a,"textures"),c=!1;await this.writeQueue.enqueue({archiveKey:`${i}/textures/${r}.${n}`,sourceId:o,outputId:s,resourceType:`${"TEXTURE"}/${n}`,writePromise:()=>Xu(u,t,`${r}.${n}`,c)})}async _writeAttributes(t=[],r,n,a,i){if(t!=null&&t.length&&this.attributeMetadataInfo.attributeStorageInfo.length){let o=t.length<this.attributeMetadataInfo.attributeStorageInfo.length?t.length:this.attributeMetadataInfo.attributeStorageInfo.length;for(let s=0;s<o;s++){let u=this.attributeMetadataInfo.attributeStorageInfo[s].key,c=new Uint8Array(t[s]);this.conversionDump.updateDoneStatus(a,i,`${"ATTRIBUTES"}/${u}`,!1);let l=(0,Jo.join)(r,"attributes",u);await this.writeQueue.enqueue({archiveKey:`${n}/attributes/${u}.bin.gz`,sourceId:a,outputId:i,resourceType:`${"ATTRIBUTES"}/${u}`,writePromise:()=>Xu(l,c,"0.bin")})}}}_getFormatByMimeType(t){switch(t){case"image/jpeg":return"jpg";case"image/png":return"png";case"image/ktx2":return"ktx2";default:return"jpg"}}_findOrCreateMaterial(t){let r=(0,p4.default)(JSON.stringify(t));if(this.materialMap.has(r))return this.materialMap.get(r)||0;let n=this.materialDefinitions.push(t)-1;return this.materialMap.set(r,n),n}findOrCreateGeometryDefinition(t,r){let n={hasTexture:t,hasUvRegions:r},a=(0,p4.default)(JSON.stringify(n));if(this.geometryMap.has(a))return this.geometryMap.get(a)||0;let i=this.geometryConfigs.push(n)-1;return this.geometryMap.set(a,i),i}createAttributeStorageInfo(t,r){let n=null;this.options.metadataClass?!this.attributeMetadataInfo.attributeStorageInfo.length&&(t!=null&&t.gltf)&&(n=lEe(t.gltf,this.options.metadataClass)):r&&(n=cEe(r)),n&&this.attributeMetadataInfo.addMetadataInfo(n)}async _finishConversion(t){let{tilesCount:r,tilesWithAddRefineCount:n}=this.refinementCounter,a=n?n/r*100:0,i=await wk({outputPath:t.outputPath,tilesetName:t.tilesetName,slpk:!0}),o=fh.default.hrtime(this.conversionStartTime),s=Jg(o);console.log("------------------------------------------------"),console.log(`Finishing conversion of ${LPt}`),console.log(`Total conversion time: ${s}`),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",i," bytes"),console.log('Percentage of tiles with "ADD" refinement type:',a,"%"),console.log("------------------------------------------------")}async _fetchPreloadOptions(){if(!this.Loader.preload)return{};let t={"cesium-ion":{accessToken:this.options.token||jPt}},r=await this.Loader.preload(this.options.inputUrl??"",t);return this.refreshTokenTime=fh.default.hrtime(),{...t,...r}}async _updateTilesetOptions(){var n;if(fh.default.hrtime(this.refreshTokenTime)[0]<qPt)return;this.refreshTokenTime=fh.default.hrtime();let r=await this._fetchPreloadOptions();if(r.headers){(n=this.loadOptions).core||(n.core={});let a=this.loadOptions.core.fetch;if(typeof a=="function")this.loadOptions.core.fetch=(i,o)=>a(i,{...o||{},headers:r.headers});else{let i=a&&typeof a=="object"?a:{};this.loadOptions.core.fetch={...i,headers:r.headers}}console.log("Authorization Bearer token has been updated")}}_checkAddRefinementTypeForTile(t){let r=1;t.refine===r&&(this.refinementCounter.tilesWithAddRefineCount+=1,console.warn('This tile uses "ADD" type of refinement')),this.refinementCounter.tilesCount+=1}isContentSupported(t){return["b3dm","glTF","scenegraph"].includes(t.type||"")}};var z3e=require("path"),Ez=Ct(require("process"),1),G3e=Ct(Is(),1);function xz(e){switch(e){case"UInt8":return Uint8Array;case"UInt16":return Uint16Array;case"UInt32":return Uint32Array;case"Float32":return Float32Array;case"UInt64":return Float64Array;default:throw new Error(`parse i3s tile content: unknown type of data: ${e}`)}}var g3e={UInt8:ht.UNSIGNED_BYTE,UInt16:ht.UNSIGNED_SHORT,Float32:ht.FLOAT,UInt32:ht.UNSIGNED_INT,UInt64:ht.DOUBLE};function vb(e){switch(e){case"UInt8":return 1;case"UInt16":case"Int16":return 2;case"UInt32":case"Int32":case"Float32":return 4;case"UInt64":case"Int64":case"Float64":return 8;default:throw new Error(`parse i3s tile content: unknown size of data: ${e}`)}}var b3e="String",v3e="Oid32",x3e="Float64",y3e="Int16";function d4(e){let t;try{let r=new URL(e);t=`${r.origin}${r.pathname}`,t.startsWith("null")&&(t=null)}catch{t=null}return t||e}function xb(e,t=null){return t?`${e}?token=${t}`:e}function _3e(e,t){let{attributeData:r=[]}=t,n=[];for(let a=0;a<r.length;a++){let i=r[a].href.replace("./","");n.push(`${e}/${i}`)}return n}function w3e(e,t,r){let n=[],{attributeStorageInfo:a=[]}=e;for(let i=0;i<a.length;i++){let o=a[i].key;n.push(`${t}/nodes/${r}/attributes/${o}/0`)}return n}var h4=new Z([0,0,0]);function zPt(e){switch(e){case"ktx-etc2":case"dds":return u8;case"ktx2":return Bd;case"jpg":case"png":default:return ig}}var GPt="i3s-attribute-type";async function S3e(e,t,r,n,a){var o;let i={attributes:{},indices:null,featureIds:[],vertexCount:0,modelMatrix:new mr,coordinateSystem:0,byteLength:0,texture:null};if(t.textureUrl){let s=xb(t.textureUrl,(o=n==null?void 0:n.i3s)==null?void 0:o.token),u=zPt(t.textureFormat),f=await(await((a==null?void 0:a.fetch)||fetch)(s)).arrayBuffer();if(n!=null&&n.i3s.decodeTextures){if(u===ig){let p={...t.textureLoaderOptions,image:{type:"data"}};try{let d=await Hi(f,[],p,a);i.texture=d}catch{let h=await Xi(f,u,p,a);i.texture=h}}else if(u===u8||u===Bd){let p=await Wr(f,u,t.textureLoaderOptions);u===Bd&&(p=p[0]),i.texture={compressed:!0,mipmaps:!1,width:p[0].width,height:p[0].height,data:p}}}else i.texture=f}return i.material=QPt(t.materialDefinition,i.texture),i.material&&(i.texture=null),await HPt(e,i,t,r,n)}async function HPt(e,t,r,n,a){var f,p;let i=e.byteLength,o,s,u=0,c=0,l;if(r.isDracoGeometry){let d=await Xi(e,Sd,{draco:{attributeNameEntry:GPt}});s=d.header.vertexCount,l=(f=d.indices)==null?void 0:f.value;let{POSITION:h,NORMAL:m,COLOR_0:g,TEXCOORD_0:x,["feature-index"]:y,["uv-region"]:w}=d.attributes;o={position:h,normal:m,color:g,uv0:x,uvRegion:w,id:y},VPt(o,d);let T=rRt(y);T&&tRt(o,T)}else{let{vertexAttributes:d,ordering:h,featureAttributes:m,featureAttributeOrder:g}=n.store.defaultGeometrySchema,x=WPt(e,n);u=x.byteOffset,s=x.vertexCount,c=x.featureCount;let{attributes:y,byteOffset:w}=E3e(e,u,d,s,h),{attributes:T}=E3e(e,w,m,c,g);eRt(T),o=$Pt(y,T)}if(!((p=a==null?void 0:a.i3s)!=null&&p.coordinateSystem)||a.i3s.coordinateSystem===2){let d=JPt(o.position,r);t.modelMatrix=d.invert(),t.coordinateSystem=2}else t.modelMatrix=YPt(o.position),t.coordinateSystem=3;t.attributes={positions:o.position,normals:o.normal,colors:A3e(o.color),texCoords:o.uv0,uvRegions:A3e(o.uvRegion||o.region)},t.indices=l||null,o.id&&o.id.value&&(t.featureIds=o.id.value);for(let d in t.attributes)t.attributes[d]||delete t.attributes[d];return t.vertexCount=s,t.byteLength=i,t}function VPt(e,t){for(let r in t.loaderData.attributes){let n=t.loaderData.attributes[r];switch(n.name){case"POSITION":e.position.metadata=n.metadata;break;case"feature-index":e.id.metadata=n.metadata;break;default:break}}}function $Pt(e,t){return{...e,...t}}function A3e(e){return e&&(e.normalized=!0,e)}function WPt(e,t){let r=0,n=0,a=0;for(let{property:i,type:o}of t.store.defaultGeometrySchema.header){let s=xz(o);switch(i){case"vertexCount".toString():n=new s(e,0,4)[0],r+=vb(o);break;case"featureCount".toString():a=new s(e,4,4)[0],r+=vb(o);break;default:break}}return{vertexCount:n,featureCount:a,byteOffset:r}}function E3e(e,t,r,n,a){let i={};for(let o of a)if(r[o]){let{valueType:s,valuesPerElement:u}=r[o];if(t+n*u*vb(s)<=e.byteLength){let c=e.slice(t),l;if(s==="UInt64")l=KPt(c,n*u,vb(s));else{let f=xz(s);l=new f(c,0,n*u)}switch(i[o]={value:l,type:g3e[s],size:u},o){case"color":i.color.normalized=!0;break;case"position":case"region":case"normal":default:}t=t+n*u*vb(s)}else if(o!=="uv0")break}return{attributes:i,byteOffset:t}}function KPt(e,t,r){let n=[],a=new DataView(e),i=0;for(let o=0;o<t;o++){let s=a.getUint32(i,!0),u=a.getUint32(i+4,!0),c=s+2**32*u;n.push(c),i+=r}return new Uint32Array(n)}function JPt(e,t){let r=t.mbs,n=e.value,a=e.metadata,i=new mr,o=new Z(r[0],r[1],r[2]),s=new Z;return Ft.WGS84.cartographicToCartesian(o,s),Ft.WGS84.eastNorthUpToFixedFrame(s,i),e.value=XPt(n,a,o),i}function XPt(e,t={},r){let n=new Float64Array(e.length),a=t["i3s-scale_x"]&&t["i3s-scale_x"].double||1,i=t["i3s-scale_y"]&&t["i3s-scale_y"].double||1;for(let o=0;o<n.length;o+=3)n[o]=e[o]*a+r.x,n[o+1]=e[o+1]*i+r.y,n[o+2]=e[o+2]+r.z;for(let o=0;o<n.length;o+=3)Ft.WGS84.cartographicToCartesian(n.subarray(o,o+3),h4),n[o]=h4.x,n[o+1]=h4.y,n[o+2]=h4.z;return n}function YPt(e){var i,o;let t=e.metadata,r=((i=t==null?void 0:t["i3s-scale_x"])==null?void 0:i.double)||1,n=((o=t==null?void 0:t["i3s-scale_y"])==null?void 0:o.double)||1,a=new mr;return a[0]=r,a[5]=n,a}function QPt(e,t){let r;return e?r={...e,pbrMetallicRoughness:e.pbrMetallicRoughness?{...e.pbrMetallicRoughness}:{baseColorFactor:[255,255,255,255]}}:(r={pbrMetallicRoughness:{}},t?r.pbrMetallicRoughness.baseColorTexture={texCoord:0}:r.pbrMetallicRoughness.baseColorFactor=[255,255,255,255]),r.alphaCutoff=r.alphaCutoff||.25,r.alphaMode&&(r.alphaMode=r.alphaMode.toUpperCase()),r.emissiveFactor&&(r.emissiveFactor=T3e(r.emissiveFactor)),r.pbrMetallicRoughness&&r.pbrMetallicRoughness.baseColorFactor&&(r.pbrMetallicRoughness.baseColorFactor=T3e(r.pbrMetallicRoughness.baseColorFactor)),t&&ZPt(r,t),r}function T3e(e){let t=[...e];for(let r=0;r<e.length;r++)t[r]=e[r]/255;return t}function ZPt(e,t){let r={source:{image:t}};e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture?e.pbrMetallicRoughness.baseColorTexture={...e.pbrMetallicRoughness.baseColorTexture,texture:r}:e.emissiveTexture?e.emissiveTexture={...e.emissiveTexture,texture:r}:e.pbrMetallicRoughness&&e.pbrMetallicRoughness.metallicRoughnessTexture?e.pbrMetallicRoughness.metallicRoughnessTexture={...e.pbrMetallicRoughness.metallicRoughnessTexture,texture:r}:e.normalTexture?e.normalTexture={...e.normalTexture,texture:r}:e.occlusionTexture&&(e.occlusionTexture={...e.occlusionTexture,texture:r})}function eRt(e){let{id:t,faceRange:r}=e;if(!t||!r)return;let n=t.value,a=r.value,i=a[a.length-1]+1,o=new Uint32Array(i*3),s=0,u=0;for(let c=1;c<a.length;c+=2){let l=Number(n[s]),f=a[c],p=a[c-1],d=f-p+1,h=u+d*3;o.fill(l,u,h),s++,u=h}e.id.value=o}function tRt(e,t){let r=e.id.value,n=new Float32Array(r.length);for(let a=0;a<r.length;a++)n[a]=t[r[a]];e.id.value=n}function rRt(e){var t,r;return(r=(t=e==null?void 0:e.metadata)==null?void 0:t["i3s-feature-ids"])==null?void 0:r.intArray}var nRt="4.4.1",k3e={dataType:null,batchType:null,name:"I3S Content (Indexed Scene Layers)",id:"i3s-content",module:"i3s",worker:!0,version:nRt,mimeTypes:["application/octet-stream"],parse:aRt,extensions:["bin"],options:{"i3s-content":{}}};async function aRt(e,t,r){let{tile:n,_tileOptions:a,tileset:i,_tilesetOptions:o}=(t==null?void 0:t.i3s)||{},s=a||n,u=o||i;return!s||!u?null:await S3e(e,s,u,t,r)}var iRt="4.4.1",C3e={dataType:null,batchType:null,name:"I3S Node Page",id:"i3s-node-page",module:"i3s",version:iRt,mimeTypes:["application/json"],parse:oRt,extensions:["json"],options:{i3s:{}}};async function oRt(e,t){return JSON.parse(new TextDecoder().decode(e))}var sRt=["","WEBKIT_","MOZ_"],D3e={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"},f_=class{tileset;nodePages=[];pendingNodePages=[];nodesPerPage;options;lodSelectionMetricType;textureDefinitionsSelectedFormats=[];nodesInNodePages;url;textureLoaderOptions={};constructor(t,r="",n){var a,i;this.tileset={...t},this.url=r,this.nodesPerPage=((a=t.nodePages)==null?void 0:a.nodesPerPage)||64,this.lodSelectionMetricType=(i=t.nodePages)==null?void 0:i.lodSelectionMetricType,this.options=n,this.nodesInNodePages=0,this.initSelectedFormatsForTextureDefinitions(t)}async getNodeById(t){var a;let r=Math.floor(t/this.nodesPerPage);if(!this.nodePages[r]&&!this.pendingNodePages[r]){let i=xb(`${this.url}/nodepages/${r}`,(a=this.options.i3s)==null?void 0:a.token);this.pendingNodePages[r]={status:"Pending",promise:Wr(i,C3e,this.options)},this.nodePages[r]=await this.pendingNodePages[r].promise,this.nodesInNodePages+=this.nodePages[r].nodes.length,this.pendingNodePages[r].status="Done"}this.pendingNodePages[r].status==="Pending"&&(this.nodePages[r]=await this.pendingNodePages[r].promise);let n=t%this.nodesPerPage;return this.nodePages[r].nodes[n]}async formTileFromNodePages(t){let r=await this.getNodeById(t),n=[],a=[];for(let d of r.children||[])a.push(this.getNodeById(d));let i=await Promise.all(a);for(let d of i)n.push({id:d.index.toString(),obb:d.obb});let o,s,u,c="jpg",l=[],f=!1;if(r&&r.mesh){let{url:d,isDracoGeometry:h}=r.mesh.geometry&&this.getContentUrl(r.mesh.geometry)||{isDracoGeometry:!1};o=d,f=h;let{textureData:m,materialDefinition:g}=this.getInformationFromMaterial(r.mesh.material);u=g,c=m.format||c,m.name&&(s=`${this.url}/nodes/${r.mesh.material.resource}/textures/${m.name}`),this.tileset.attributeStorageInfo&&(l=w3e(this.tileset,this.url,r.mesh.attribute.resource))}let p=this.getLodSelection(r);return yz({id:t.toString(),lodSelection:p,obb:r.obb,contentUrl:o,textureUrl:s,attributeUrls:l,materialDefinition:u,textureFormat:c,textureLoaderOptions:this.textureLoaderOptions,children:n,isDracoGeometry:f})}getContentUrl(t){let r=null,n=this.tileset.geometryDefinitions[t.definition],a=-1,i=this.options.i3s;if(i&&typeof i=="object"&&i.useDracoGeometry&&(a=n.geometryBuffers.findIndex(o=>o.compressedAttributes&&o.compressedAttributes.encoding==="draco")),a===-1&&(a=n.geometryBuffers.findIndex(o=>!o.compressedAttributes)),a!==-1){let o=Boolean(n.geometryBuffers[a].compressedAttributes);r={url:`${this.url}/nodes/${t.resource}/geometries/${a}`,isDracoGeometry:o}}return r}getLodSelection(t){let r=[];return this.lodSelectionMetricType==="maxScreenThresholdSQ"&&r.push({metricType:"maxScreenThreshold",maxError:Math.sqrt(t.lodThreshold/(Math.PI*.25))}),r.push({metricType:this.lodSelectionMetricType,maxError:t.lodThreshold}),r}getInformationFromMaterial(t){var n,a,i;let r={textureData:{name:null}};if(t){let o=(n=this.tileset.materialDefinitions)==null?void 0:n[t.definition];if(o){r.materialDefinition=o;let s=(i=(a=o==null?void 0:o.pbrMetallicRoughness)==null?void 0:a.baseColorTexture)==null?void 0:i.textureSetDefinitionId;typeof s=="number"&&(r.textureData=this.textureDefinitionsSelectedFormats[s]||r.textureData)}}return r}initSelectedFormatsForTextureDefinitions(t){this.textureDefinitionsSelectedFormats=[];let r=this.getSupportedTextureFormats(),n=t.textureSetDefinitions||[];for(let a of n){let i=a&&a.formats||[],o=null;for(let s of r){let u=i.find(c=>c.format===s);if(u){o=u;break}}o&&o.format==="ktx2"&&(this.textureLoaderOptions.basis={containerFormat:"ktx2",module:"encoder"}),this.textureDefinitionsSelectedFormats.push(o)}}getSupportedTextureFormats(){let t=[],r=this.options.i3s;if(!r||r.useCompressedTextures){let n=uRt();n.has("etc2")&&t.push("ktx-etc2"),n.has("dxt")&&t.push("dds"),t.push("ktx2")}return t.push("jpg"),t.push("png"),t}};function uRt(e){let t=new Set;e=e||cRt()||void 0;for(let r of sRt)for(let n in D3e)e&&e.getExtension(`${r}${n}`)&&t.add(D3e[n]);return t}function cRt(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}function B3e(e,t){let r=t.url||"",n;e.geometryData&&(n=`${r}/${e.geometryData[0].href}`);let a;e.textureData&&(a=`${r}/${e.textureData[0].href}`);let i;e.attributeData&&(i=_3e(r,e));let o=e.children||[];return yz({...e,children:o,url:r,contentUrl:n,textureUrl:a,textureFormat:"jpg",attributeUrls:i,isDracoGeometry:!1})}function yz(e){var s,u;let t={},r=[0,0,0,1];if(e.mbs)r=e.mbs,t.sphere=[...Ft.WGS84.cartographicToCartesian(e.mbs.slice(0,3)),e.mbs[3]];else if(e.obb){t.box=[...Ft.WGS84.cartographicToCartesian(e.obb.center),...e.obb.halfSize,...e.obb.quaternion];let l=new fa().fromCenterHalfSizeQuaternion(t.box.slice(0,3),e.obb.halfSize,e.obb.quaternion).getBoundingSphere();t.sphere=[...l.center,l.radius],r=[...e.obb.center,l.radius]}let n=(s=e.lodSelection)==null?void 0:s[0].metricType,a=(u=e.lodSelection)==null?void 0:u[0].maxError,i="mesh",o=2;return{...e,mbs:r,boundingVolume:t,lodMetricType:n,lodMetricValue:a,type:i,refine:o}}async function F3e(e,t,r){let n=d4(r.url||""),a,i;if(e.nodePages)a=new f_(e,n,t),i=await a.formTileFromNodePages(0);else{let o=t.i3s&&typeof t.i3s=="object"?t.i3s:{},s=xb(`${n}/nodes/root`,o.token);i=await Wr(s,vl,{...t,i3s:{...o,loadContent:!1,isTileHeader:!0,isTileset:!1}})}return{...e,loader:vl,url:n,basePath:n,type:"I3S",nodePagesTile:a,root:i,lodMetricType:i.lodMetricType,lodMetricValue:i.lodMetricValue}}var lRt="4.4.1",fRt=/layers\/[0-9]+$/,pRt=/\.slpk$/,dRt=/nodes\/([0-9-]+|root)$/,hRt="504b0304",mRt="PointCloud",vl={dataType:null,batchType:null,name:"I3S (Indexed Scene Layers)",id:"i3s",module:"i3s",version:lRt,mimeTypes:["application/octet-stream"],parse:gRt,extensions:["bin"],options:{i3s:{token:void 0,isTileset:"auto",isTileHeader:"auto",tile:void 0,tileset:void 0,_tileOptions:void 0,_tilesetOptions:void 0,useDracoGeometry:!0,useCompressedTextures:!0,decodeTextures:!0,coordinateSystem:2}}};async function gRt(e,t={},r){let n=r.url;if(t.i3s=t.i3s||{},yRt(e)===hRt)throw new Error("Files with .slpk extention currently are not supported by I3SLoader");let i=d4(n),o;t.i3s.isTileset==="auto"?o=fRt.test(i)||pRt.test(i):o=t.i3s.isTileset;let s;return t.i3s.isTileHeader==="auto"?s=dRt.test(i):s=t.i3s.isTileHeader,o?e=await vRt(e,t,r):s?e=await xRt(e,r):e=await bRt(e,t),e}async function bRt(e,t){return await Xi(e,k3e,t)}async function vRt(e,t,r){let n=JSON.parse(new TextDecoder().decode(e));if((n==null?void 0:n.layerType)===mRt)throw new Error("Point Cloud layers currently are not supported by I3SLoader");return await F3e(n,t,r)}async function xRt(e,t){return e=JSON.parse(new TextDecoder().decode(e)),B3e(e,t)}function yRt(e){return e instanceof ArrayBuffer?[...new Uint8Array(e,0,4)].map(t=>t.toString(16).padStart(2,"0")).join(""):null}var _Rt=[{test:/^$/,extensions:["3dSceneLayer.json.gz"]},{test:/nodepages\/\d+$/,extensions:[".json.gz"]},{test:/sublayers\/\d+$/,extensions:["/3dSceneLayer.json.gz"]},{test:/nodes\/(\d+|root)$/,extensions:["/3dNodeIndexDocument.json.gz"]},{test:/nodes\/\d+\/textures\/.+$/,extensions:[".jpg",".png",".bin.dds.gz",".ktx",".ktx2"]},{test:/nodes\/\d+\/geometries\/\d+$/,extensions:[".bin.gz",".draco.gz"]},{test:/nodes\/\d+\/attributes\/f_\d+\/\d+$/,extensions:[".bin.gz"]},{test:/statistics\/(f_\d+\/\d+|summary)$/,extensions:[".json.gz"]},{test:/nodes\/\d+\/shared$/,extensions:["/sharedResource.json.gz"]}],m4=class extends pl{hashTable;_textEncoder=new TextEncoder;_textDecoder=new TextDecoder;_md5Hash=new mu;constructor(t,r,n){super(t,r,n),this.hashTable=r}async getFile(t,r="raw"){var n;if(r==="http"){let a=(n=_Rt.find(i=>i.test.test(t)))==null?void 0:n.extensions;if(a){let i;for(let o of a)if(i=await this.getDataByPath(`${t}${o}`),i)break;if(i)return i}}if(r==="raw"){let a=await this.getDataByPath(`${t}.gz`);if(a)return a;let i=await this.getFileBytes(t);if(i)return i}throw new Error(`No such file in the archive: ${t}`)}async getDataByPath(t){let r=await this.getFileBytes(t.toLocaleLowerCase());if(r||(r=await this.getFileBytes(t)),!!r)return/\.gz$/.test(t)?await new Ey().decompress(r):r}async getFileBytes(t){let r;if(this.hashTable){let n=this._textEncoder.encode(t),a=await this._md5Hash.hash(n.buffer,"hex"),i=this.hashTable[a];if(i===void 0)return;let o=await Os(i,this.file);if(!o)return;r=await Jr(this.file,o.fileDataOffset,o.fileDataOffset+o.compressedSize)}else try{r=await this.getFileWithoutHash(t)}catch{r=void 0}return r}};async function _z(e,t,r){let n=await Jd(e,Yd),a=await Xd(n,e),i;if((a==null?void 0:a.fileName)!=="@specialIndexFileHASH128@")i=await mN(e),t==null||t("SLPK doesnt contain hash file, hash info has been composed according to zip archive headers");else{let o=await Os(a.localHeaderOffset,e);if(!o)throw new Error("corrupted SLPK");let s=o.fileDataOffset,u=await Jr(e,s,s+o.compressedSize);i=Ty(u)}return new m4(e,i,r)}function I3e(e,t){let{attributeName:r,attributeType:n}=t;return r?{[r]:n?wRt(n,e):null}:{}}function wRt(e,t){switch(e){case b3e:return TRt(t);case v3e:return O3e(t);case x3e:return ERt(t);case y3e:return ARt(t);default:return O3e(t)}}function O3e(e){return new Uint32Array(e,4)}function ARt(e){return new Int16Array(e,4)}function ERt(e){return new Float64Array(e,8)}function TRt(e){let a=[];try{let i=new DataView(e,0,4).getUint32(0,!0),o=new Uint32Array(e,8,i),s=8+i*4;for(let u of o){let c=new TextDecoder("utf-8"),l=new Uint8Array(e,s,u);a.push(c.decode(l)),s+=u}}catch(i){console.error("Parse string attribute error: ",i.message)}return a}var SRt="4.4.1";var wz={dataType:null,batchType:null,name:"I3S Attribute",id:"i3s-attribute",module:"i3s",version:SRt,mimeTypes:["application/binary"],parse:async(e,t)=>I3e(e,t),extensions:["bin"],options:{},binary:!0};function Az(e,t){let r=[e.center[0],e.center[1],e.center[2]+t.getHeight(e.center[1],e.center[0])],n=Ft.WGS84.cartographicToCartesian(r,new Z),a=new fa().fromCenterHalfSizeQuaternion(n,e.halfSize,e.quaternion);return[...a.center,...a.halfAxes.toArray()]}var g4=Ct(Is(),1),kRt=()=>({version:{path:"version",default:"1.0"}}),P3e=()=>({boundingVolume:{path:"boundingVolume"},geometricError:{path:"geometricError"},refine:{path:"refine"},content:{path:"content"},children:{path:"children",transform:e=>e.map(t=>(0,g4.default)(t,P3e()))}}),R3e=()=>({asset:{path:"asset",transform:e=>(0,g4.default)(e,kRt())},geometricError:{path:"root",transform:e=>e.geometricError},root:{path:"root",transform:e=>(0,g4.default)(e,P3e())}});function j3e(e,t){let r=new Float32Array(e.length),n=DRt(t);for(let a=0;a<e.length;a+=2){let i=e.subarray(a,a+2),o=n.slice(a*2,a*2+4),s=CRt([i[0],i[1]]),u=[o[2]-o[0],o[3]-o[1]],c=[s[0]*u[0],s[1]*u[1]],l=[c[0]+o[0],c[1]+o[1]];r[a]=l[0],r[a+1]=l[1]}return r}function CRt(e){return[e[0]-Math.floor(e[0]),e[1]-Math.floor(e[1])]}function DRt(e){let r=[];for(let n=0;n<e.length;n++)r[n]=e[n]/65535;return r}var BRt=new mr([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),L3e=new Z,M3e="KHR_materials_unlit",FRt=1,ORt=1,b4=class{rtcCenter;i3sTile;tileType;constructor(t={outputVersion:"1.1"}){this.tileType=t.outputVersion==="1.0"?pa.BATCHED_3D_MODEL:pa.GLTF}async convert(t,r=null,n){let a=await this.buildGLTF(t,r,n);return this.tileType===pa.BATCHED_3D_MODEL?mS({gltfEncoded:new Uint8Array(a),type:"b3dm",featuresLength:this._getFeaturesLength(r),batchTable:r},vN):a}async buildGLTF(t,r,n){let{tileContent:a,textureFormat:i,box:o}=t,{material:s,attributes:u,indices:c,modelMatrix:l}=a,f=new Xt,p=await this._addI3sTextureToGLTF(a,i,f),d=s==null?void 0:s.pbrMetallicRoughness;d&&(d.metallicFactor===void 0||d.metallicFactor===FRt)&&(d.roughnessFactor===void 0||d.roughnessFactor===ORt)&&(f.addObjectExtension(s,M3e,{}),f.addExtension(M3e));let h=this._convertI3sMaterialToGLTFMaterial(s,p),m=f.addMaterial(h),g=u.positions,x=g.value;u.uvRegions&&u.texCoords&&(u.texCoords.value=j3e(u.texCoords.value,u.uvRegions.value));let y=new Z(o),w=Ft.WGS84.cartesianToCartographic(y,new Z);u.positions.value=this._normalizePositions(x,y,w,l),this._createBatchIds(a,r),u.normals&&!this._checkNormals(u.normals.value)&&delete u.normals;let T=c||Ek(x.length/g.size),A=f.addMesh({attributes:u,indices:T,material:m,mode:4});this.tileType===pa.GLTF&&this._createMetadataExtensions(f,A,r,n,a);let B=this._generateTransformMatrix(y),I=f.addNode({meshIndex:A,matrix:B}),L=f.addScene({nodeIndices:[I]});return f.setDefaultScene(L),f.createBinaryChunk(),mS(f.gltf,t7,{gltfBuilder:f})}_createMetadataExtensions(t,r,n,a,i){var c;let o=this._createPropertyAttibutes(n,a),s=e8(t,o),u=t.getMesh(r);for(let l of u.primitives)(c=i.attributes._BATCHID)!=null&&c.value&&QS(t,l,i.attributes._BATCHID.value,s)}_createPropertyAttibutes(t,r){if(!t||!r)return[];let n=[];for(let a in t){let i=this._convertAttributeStorageInfoToPropertyAttribute(a,r,t);i&&n.push(i)}return n}_convertAttributeStorageInfoToPropertyAttribute(t,r,n){let a=n[t],i=r.find(l=>l.name===t);if(!i)return null;let o=i.attributeValues;if(!(o!=null&&o.valueType))return null;let s,u;switch(o.valueType.toLowerCase()){case"oid32":s="SCALAR",u="UINT32";break;case"int32":s="SCALAR",u="INT32";break;case"uint32":s="SCALAR",u="UINT32";break;case"int16":s="SCALAR",u="INT16";break;case"uint16":s="SCALAR",u="UINT16";break;case"float64":s="SCALAR",u="FLOAT64";break;case"string":s="STRING";break;default:s="";break}let c={name:t,elementType:s,componentType:u,values:[]};return yL(a)?c.values=Array.from(a):a!==null&&(c.values=a),c}async _addI3sTextureToGLTF(t,r,n){let{texture:a,material:i,attributes:o}=t,s=null,u=a;if(!a&&i&&(u=i.pbrMetallicRoughness&&i.pbrMetallicRoughness.baseColorTexture&&i.pbrMetallicRoughness.baseColorTexture.texture.source.image),u){let c=this._deduceMimeTypeFromFormat(r),l=n.addImage(u,c);s=n.addTexture({imageIndex:l}),delete o.colors}return s}_normalizePositions(t,r,n,a){let i=new Float32Array(t.length);for(let o=0;o<t.length;o+=3){let s=t.subarray(o,o+3),u=new Z(r),c=new Z(Array.from(s)).transform(a).add(n);Ft.WGS84.cartographicToCartesian(c,L3e),c=L3e.subtract(u),i.set(c,o)}return i}_generateTransformMatrix(t){return new mr().translate(t).multiplyLeft(BRt)}_createBatchIds(t,r){let{featureIds:n}=t,{OBJECTID:a}=r||{};if(!(!n||!a)){for(let i=0;i<n.length;i++){let o=n[i],s=a.indexOf(o);n[i]=s}t.attributes._BATCHID={size:1,byteOffset:0,value:n}}}_deduceMimeTypeFromFormat(t){switch(t){case"jpg":return"image/jpeg";case"png":return"image/png";case"ktx2":return"image/ktx2";default:return console.warn(`Unexpected texture format in I3S: ${t}`),"image/jpeg"}}_convertI3sMaterialToGLTFMaterial(t,r){let n=r!==null;return t?(r!==null&&(t=this._setGLTFTexture(t,r)),t):(t={alphaMode:"OPAQUE",doubleSided:!1,pbrMetallicRoughness:{metallicFactor:0,roughnessFactor:1}},n?t.pbrMetallicRoughness.baseColorTexture={index:r,texCoord:0}:t.pbrMetallicRoughness.baseColorFactor=[1,1,1,1],t)}_setGLTFTexture(t,r){let n={...t,pbrMetallicRoughness:{...t.pbrMetallicRoughness}};return t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture?n.pbrMetallicRoughness.baseColorTexture={index:r,texCoord:0}:t.emissiveTexture?n.emissiveTexture={index:r,texCoord:0}:t.pbrMetallicRoughness&&t.pbrMetallicRoughness.metallicRoughnessTexture?n.pbrMetallicRoughness.metallicRoughnessTexture={index:r,texCoord:0}:t.normalTexture?n.normalTexture={index:r,texCoord:0}:t.occlusionTexture&&(n.occlusionTexture={index:r,texCoord:0}),n}_getFeaturesLength(t){if(!t)return 0;let r=Object.keys(t)[0];return r?t[r].length:0}_checkNormals(t){return t.find(r=>r)}};var q3e=async(e,t,r,n)=>{if(!e||!t.contentUrl)return null;let a={...r,i3s:{...r.i3s,isTileset:!1,isTileHeader:!1,_tileOptions:{attributeUrls:t.attributeUrls||[],textureUrl:t.textureUrl,textureFormat:t.textureFormat,textureLoaderOptions:t.textureLoaderOptions,materialDefinition:t.materialDefinition,isDracoGeometry:t.isDracoGeometry,mbs:t.mbs},_tilesetOptions:{store:e.store,attributeStorageInfo:e.attributeStorageInfo,fields:e.fields}}};return await p_(t.contentUrl,vl,a,n)};async function N3e(e){let t=e.split(".slpk");if(t.length===2){let r=`${t[0]}.slpk`,n=new Ha(r),a=await _z(n,void 0,r);return new fl(a)}return null}async function p_(e,t,r,n){return n!==null?await Wr(e,t,{...r,core:{...r==null?void 0:r.core,fetch:n.fetch.bind(n)}}):await Wr(e,t,r)}async function U3e(e){if(!(e!=null&&e.file))return 0;let t=new Set,r=Ku(e.file);for await(let n of r){let a=n.fileName,i=/^nodes\/(\d+)\//.exec(a);i&&t.add(i[1])}return t.size}var IRt="I3S",yb=class{options;tilesetPath;vertexCounter;conversionStartTime;geoidHeightModel;sourceTileset;attributeStorageInfo;workerSource={};slpkFilesystem=null;loaderOptions={core:{_nodeWorkers:!0,reuseWorkers:!0,worker:!1},i3s:{coordinateSystem:3,decodeTextures:!1},"i3s-content":{workerUrl:"./modules/i3s/dist/i3s-content-worker-node.js"}};conversionDump;progress;fileExt;constructor(){this.options={},this.tilesetPath="",this.vertexCounter=0,this.conversionStartTime=[0,0],this.geoidHeightModel=null,this.sourceTileset=null,this.attributeStorageInfo=null,this.workerSource={},this.conversionDump=new lh,this.progress=new tb,this.fileExt=""}async convert(t){var m;if(pr)return console.log(eb),eb;let{inputUrl:r,outputPath:n,outputVersion:a,tilesetName:i,maxDepth:o,egmFilePath:s,inquirer:u,analyze:c}=t;this.conversionStartTime=Ez.default.hrtime(),this.options={maxDepth:o,inquirer:u,outputVersion:a},this.fileExt=this.options.outputVersion==="1.0"?"b3dm":"glb",console.log("Loading egm file..."),this.geoidHeightModel=await Wr(s,kk),console.log("Loading egm file completed!"),this.slpkFilesystem=await N3e(r);let l=!0;if((c||this.slpkFilesystem)&&(l=await this.preprocessConversion(),!l||c)||(this.progress.startMonitoring(),this.sourceTileset=await p_(r,vl,{...this.loaderOptions,i3s:{...this.loaderOptions.i3s,isTileset:!0}},this.slpkFilesystem),!this.sourceTileset))return;let f=(m=this.sourceTileset)==null?void 0:m.root;if(f.obb||(f.obb=EN(f.mbs)),this.tilesetPath=(0,z3e.join)(`${n}`,`${i}`),this.attributeStorageInfo=this.sourceTileset.attributeStorageInfo,await this.conversionDump.createDump(t),this.conversionDump.restored&&this.options.inquirer&&((await this.options.inquirer.prompt([{name:"resumeConversion",type:"confirm",message:"Dump file of the previous conversion exists, do you want to resume that conversion?"}])).resumeConversion||this.conversionDump.reset()),!this.conversionDump.restored)try{await By(this.tilesetPath)}catch{}let p={boundingVolume:{box:Az(f.obb,this.geoidHeightModel)},geometricError:kN(f),children:[],refine:"REPLACE"};await this._addChildren(f,p,1);let d=(0,G3e.default)({asset:{version:a},root:p},R3e());await Oi(this.tilesetPath,JSON.stringify(d),"tileset.json"),await this.conversionDump.deleteDumpFile(),this.progress.stopMonitoring(),await this._finishConversion({slpk:!1,outputPath:n,tilesetName:i}),this.slpkFilesystem&&this.slpkFilesystem.destroy(),Ua.getWorkerFarm({}).destroy()}async preprocessConversion(){console.log("Analyze source layer");let t=await U3e(this.slpkFilesystem);if(this.progress.stepsTotal=t,console.log("------------------------------------------------"),console.log("Preprocess results:"),this.slpkFilesystem){if(console.log(`Node count: ${t}`),t===0)return console.log("Node count is 0. The conversion will be interrupted."),console.log("------------------------------------------------"),!1}else console.log("Node count cannot be calculated for the remote dataset");return console.log("------------------------------------------------"),!0}async convertChildNode(t,r,n,a){let i=r,o=await this._loadChildNode(t,a);if(o.contentUrl){if(this.conversionDump.restored&&this.conversionDump.isFileConversionComplete(`${o.id}.${this.fileExt}`)&&(o.obb||o.mbs)){let{child:y}=this._createChildAndBoundingVolume(o);r.children.push(y),await this._addChildren(o,y,n+1);return}let f=await q3e(this.sourceTileset,o,this.loaderOptions,this.slpkFilesystem);if(!f){await this._addChildren(o,r,n+1);return}this.vertexCounter+=(f==null?void 0:f.vertexCount)||0;let p=null;this.attributeStorageInfo&&(p=await this._loadChildAttributes(o,this.attributeStorageInfo));let{child:d,boundingVolume:h}=this._createChildAndBoundingVolume(o),m={tileContent:f,box:h.box||[],textureFormat:o.textureFormat},x=await new b4({outputVersion:this.options.outputVersion}).convert(m,p,this.attributeStorageInfo);await this.conversionDump.addNode(`${o.id}.${this.fileExt}`,o.id),await Oi(this.tilesetPath,new Uint8Array(x),`${o.id}.${this.fileExt}`),await this.conversionDump.updateConvertedNodesDumpFile(`${o.id}.${this.fileExt}`,o.id,!0),r.children.push(d),i=d}this.progress.stepsDone+=1;let s="Calculating time left...",u=this.progress.getTimeRemainingString();u&&(s=`${u} left`);let c=this.progress.getPercentString(),l=c?` ${c}%, ${s}`:"";console.log(`[converted${l}]: ${a.id}`),await this._addChildren(o,i,n+1)}async _addChildren(t,r,n){if(!(this.options.maxDepth&&n>this.options.maxDepth))for(let a of t.children||[])await this.convertChildNode(t,r,n,a)}async _loadChildNode(t,r){var a;let n;if((a=this.sourceTileset)!=null&&a.nodePagesTile)console.log(`Node conversion: ${r.id}`),n=await this.sourceTileset.nodePagesTile.formTileFromNodePages(parseInt(r.id));else{let i=this._relativeUrlToFullUrl(t.url,r.href),o={i3s:{...this.loaderOptions,isTileHeader:!0,loadContent:!1}};console.log(`Node conversion: ${i}`),n=await p_(i,vl,o,this.slpkFilesystem)}return n}_createChildAndBoundingVolume(t){t.obb||(t.obb=EN(t.mbs));let r={box:Az(t.obb,this.geoidHeightModel)},n={boundingVolume:r,geometricError:kN(t),children:[],content:{uri:`${t.id}.${this.fileExt}`,boundingVolume:r}};return{boundingVolume:r,child:n}}_relativeUrlToFullUrl(t="",r){let n=t.split("/"),a=r.split("/");for(let i of a)switch(i){case".":continue;case"..":n=n.slice(0,-1);break;default:n.push(i)}return n.join("/")}async _loadChildAttributes(t,r){let n=[],{attributeUrls:a=[]}=t;for(let o=0;o<a.length;o++){let s=a[o],u=r[o],c={i3s:{attributeName:u.name,attributeType:this._getAttributeType(u)}};n.push(p_(s,wz,c,this.slpkFilesystem))}let i=await Promise.all(n);return this._replaceNestedArrays(i),Object.assign({},...i)}_getAttributeType(t){return t.attributeValues?t.attributeValues.valueType:t.objectIds?"Oid32":""}_replaceNestedArrays(t){for(let r=0;r<t.length;r++){let n=t[r];for(let a in n)n[a]=Array.from(n[a])}}async _finishConversion(t){let r=await wk(t),n=Ez.default.hrtime(this.conversionStartTime),a=Jg(n);console.log("------------------------------------------------"),console.log(`Finish conversion of ${IRt}`),console.log(`Total conversion time: ${a}`),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",r," bytes"),console.log("------------------------------------------------")}};var _b=require("path");var PRt="4.4.1",RRt="https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip",v4=class{async install(t=""){console.log('Installing "EGM2008-5" model...');let r=await Wr(RRt,uN,{}),n=process.cwd();t&&(n=(0,_b.join)(n,t)),await Oi(n,new Uint8Array(r["geoids/egm2008-5.pgm"]),"egm2008-5.pgm"),console.log('Installing "I3S Content Loader" worker'),await this.installFromNpm("i3s","i3s-content-worker-node.js"),console.log('Installing "Draco Loader" worker'),await this.installFromNpm("draco","draco-worker-node.js"),console.log('Installing "Draco Writer" worker'),await this.installFromNpm("draco","draco-writer-worker-node.js"),console.log('Installing "Basis Loader" worker'),await this.installFromNpm("textures","basis-worker-node.js"),console.log('Installing "KTX2 Basis Writer" worker'),await this.installFromNpm("textures","ktx2-basis-writer-worker-node.js"),console.log('Installing "Draco decoder" library'),await this.installFromUrl(Ru[Ur.DECODER],"draco",Ur.DECODER),await this.installFromUrl(Ru[Ur.DECODER_WASM],"draco",Ur.DECODER_WASM),console.log('Installing "Draco encoder" library'),await this.installFromUrl(Ru[Ur.ENCODER],"draco",Ur.ENCODER),console.log('Installing "Basis transcoder" library'),await this.installFromNpm("textures",Mu.TRANSCODER,"libs"),await this.installFromNpm("textures",Mu.TRANSCODER_WASM,"libs"),console.log('Installing "Basis encoder" library'),await this.installFromNpm("textures",Mu.ENCODER,"libs"),await this.installFromNpm("textures",Mu.ENCODER_WASM,"libs"),console.log('Installing "join-images" npm package');let a=new c0,i=(0,_b.dirname)(process.execPath);await a.start({command:`"${i}/${process.platform==="win32"?"npm.cmd":"npm"}"`,arguments:["install","sharp@0.30.4","join-images@1.1.3"],wait:0,ignoreStderr:!0,spawn:{shell:!0}}),console.log("All dependencies were installed succesfully.")}async installFromNpm(t,r,n=""){let a=await si(`https://unpkg.com/@loaders.gl/${t}@${PRt}/dist/${n}/${r}`);if(a.status<200||a.status>=300)throw new Error(`Failed to load resource ${r}`);let i=await a.arrayBuffer();if(!i)return;let o=(0,_b.join)(process.cwd(),"modules",t,"dist",n);await Oi(o,i,r)}async installFromUrl(t,r,n){let i=await(await si(t)).arrayBuffer();if(!i)return;let o=(0,_b.join)(process.cwd(),"modules",r,"dist","libs");await Oi(o,i,n)}};function Us(e,t){if(e+1>=t.length)return"";let r=t[e+1];return r.indexOf("--")===0?"":r}function H3e(e,t){let r=Us(e,t);return console.log(`Input tileset value: ${r}`),console.log(`Modified tileset value: ${r.replace(/\\/g,"/")}`),r.replace(/\\/g,"/")}function V3e(e){return e.reduce((t,r)=>{let n=r.indexOf("="),a=r.slice(0,n),i=r.slice(n+1,r.length);return r.includes("=")&&r.startsWith("--")&&i?t.concat(a,i):t.concat(r)},[])}function $3e(e,t){let r=Us(e,t),n=Number.parseInt(r);return isFinite(n)?n:NaN}function zs(e,t){let r=Us(e,t).toLowerCase().trim();return["--no-draco","--split-nodes"].includes(t[e])&&!r?!1:!r||r==="true"}var J3e=require("fs/promises"),Tz={I3S:"I3S",_3DTILES:"3DTILES"};async function jRt(){let[,,...e]=process.argv;e.length===0&&Sz();let t=V3e(e),r=MRt(t);if(r.installDependencies){new v4().install("deps");return}if(r.addHash){let a=W3e(r,!0),i=a.tileset;if(!r.quiet)if(a.output==="data"){let s=a.tileset.substring(0,a.tileset.length-5);(await x4.default.prompt([{name:"isNewFileRequired",type:"list",message:"What would you like to do?",choices:[{name:"Add hash file to the current SLPK file",value:!1},{name:`Create a new file ${s}-hash.slpk with hash file inside`,value:!0}]}])).isNewFileRequired&&(i=`${s}-hash.slpk`)}else i=a.output;i!==a.tileset&&await(0,J3e.copyFile)(a.tileset,i);let o=await Sy(Ku(new Ha(i)));await dN(i,o,"@specialIndexFileHASH128@");return}let n=W3e(r);await LRt(n)}jRt().catch(e=>{console.log(e),process.exit(1)});function Sz(){console.log("cli: converter 3dTiles to I3S or I3S to 3dTiles..."),console.log('--install-dependencies [Run the script for installing dependencies. Run this options separate from others. Now "*.pgm" file installation is implemented]'),console.log("--max-depth [Maximal depth of hierarchical tiles tree traversal, default: infinite]"),console.log("--name [Tileset name]"),console.log('--output [Output folder, default: "data" folder]'),console.log("--instant-node-writing [Keep created 3DNodeIndexDocument files on disk instead of memory. This option reduces memory usage but decelerates conversion speed]"),console.log("--split-nodes [Prevent merging similar materials that could lead to incorrect visualization (I3S to 3DTiles conversion only)]"),console.log("--slpk [(Deprecated since version 4.3.0) Whether the converter generates *.slpk (Scene Layer Package) I3S output files. Note: For versions 4.3.0 and up *.slpk is the default output without this option specified.]"),console.log("--tileset [tileset.json file (3DTiles) / http://..../SceneServer/layers/0 resource (I3S)]"),console.log("--input-type [tileset input type: I3S or 3DTILES]"),console.log("--output-version [3DTiles version: 1.0 or 1.1, default: 1.1]. This option supports only 1.0/1.1 values for 3DTiles output. I3S output version setting is not supported yet."),console.log('--egm [location of Earth Gravity Model *.pgm file to convert heights from ellipsoidal to gravity-related format or "None" to not use it. A model file can be loaded from GeographicLib https://geographiclib.sourceforge.io/html/geoid.html], default: "./deps/egm2008-5.zip"'),console.log("--token [Token for Cesium ION tilesets authentication]"),console.log("--no-draco [Disable draco compression for geometry]"),console.log("--generate-textures [Enable KTX2 textures generation if only one of (JPG, PNG) texture is provided or generate JPG texture if only KTX2 is provided]"),console.log("--generate-bounding-volumes [Generate obb and mbs bounding volumes from geometry]"),console.log("--analyze [Analyze the input tileset content without conversion, default: false]"),console.log('--metadata-class [One of the list of feature metadata classes, detected by converter on "analyze" stage, default: not set]'),console.log("--validate [Enable validation]"),console.log("--quiet [Skip all prompts that stop conversion and wait for a user input: default: false]"),process.exit(0)}async function LRt(e){switch(console.log("------------------------------------------------"),console.log(`Starting conversion of ${e.inputType}`),console.log("------------------------------------------------"),e.inputType.toUpperCase()){case Tz.I3S:await new yb().convert({inputUrl:e.tileset,outputPath:e.output,outputVersion:e.outputVersion,tilesetName:e.name,maxDepth:e.maxDepth,egmFilePath:e.egm,analyze:e.analyze,inquirer:e.quiet?void 0:x4.default});break;case Tz._3DTILES:await new bb().convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,egmFilePath:e.egm,token:e.token,draco:e.draco,mergeMaterials:e.mergeMaterials,generateTextures:e.generateTextures,generateBoundingVolumes:e.generateBoundingVolumes,validate:e.validate,instantNodeWriting:e.instantNodeWriting,metadataClass:e.metadataClass,analyze:e.analyze,inquirer:e.quiet?void 0:x4.default});break;default:Sz()}}function W3e(e,t){let r={name:{getMessage:()=>console.log("Missed: --name [Tileset name]"),condition:a=>t||Boolean(a)||Boolean(e.analyze)},output:{getMessage:()=>console.log("Missed: --output [Output path name]")},egm:{getMessage:()=>console.log("Missed: --egm [*.pgm earth gravity model file path]")},tileset:{getMessage:()=>console.log("Missed: --tileset [tileset.json file]")},inputType:{getMessage:()=>console.log("Missed/Incorrect: --input-type [tileset input type: I3S or 3DTILES]"),condition:a=>t||Boolean(a)&&Object.values(Tz).includes(a.toUpperCase())},outputVersion:{getMessage:()=>console.log('Incorrect: --output-version [1.0 or 1.1] is for --input-type "I3S" only'),condition:a=>t||Boolean(a)&&Object.values(["1.0","1.1"]).includes(a)&&Boolean(e.inputType==="I3S")||Boolean(e.inputType!=="I3S")||Boolean(e.analyze)}},n=[];for(let a in r){let i=e[a],o=r[a].condition;(o?o(i):i)||n.push(r[a].getMessage)}return n.length&&(n.forEach(a=>a()),process.exit(1)),e}function MRt(e){let t={output:"data",outputVersion:"1.1",instantNodeWriting:!1,mergeMaterials:!0,egm:(0,K3e.join)(process.cwd(),"deps","egm2008-5.pgm"),draco:!0,installDependencies:!1,generateTextures:!1,generateBoundingVolumes:!1,validate:!1,addHash:!1,quiet:!1};return e.forEach((r,n)=>{if(r.indexOf("--")===0)switch(r){case"--input-type":t.inputType=Us(n,e);break;case"--tileset":t.tileset=H3e(n,e);break;case"--name":t.name=Us(n,e);break;case"--output":t.output=Us(n,e);break;case"--output-version":t.outputVersion=Us(n,e);break;case"--instant-node-writing":t.instantNodeWriting=zs(n,e);break;case"--split-nodes":t.mergeMaterials=zs(n,e);break;case"--max-depth":t.maxDepth=$3e(n,e);break;case"--add-hash":t.addHash=zs(n,e);break;case"--egm":t.egm=Us(n,e);break;case"--token":t.token=Us(n,e);break;case"--no-draco":t.draco=zs(n,e);break;case"--validate":t.validate=zs(n,e);break;case"--install-dependencies":t.installDependencies=zs(n,e);break;case"--generate-textures":t.generateTextures=zs(n,e);break;case"--generate-bounding-volumes":t.generateBoundingVolumes=zs(n,e);break;case"--analyze":t.analyze=zs(n,e);break;case"--quiet":t.quiet=zs(n,e);break;case"--metadata-class":t.metadataClass=Us(n,e);break;case"--help":Sz();break;case"--slpk":break;default:console.warn(`Unknown option ${r}`),process.exit(0)}}),t}
161
161
  /*! Bundled license information:
162
162
 
163
163
  is-buffer/index.js: