@loaders.gl/tile-converter 4.2.0-beta.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/converter.min.cjs +2 -2
- package/dist/deps-installer/deps-installer.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +2 -2
- package/dist/pgm-loader.js +1 -1
- package/package.json +16 -16
package/dist/converter.min.cjs
CHANGED
|
@@ -152,13 +152,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
152
152
|
|| ${o} === "boolean" || ${i} === null`).assign(s,(0,Ht._)`[${i}]`)}}}function dPt({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,Ht._)`${t} !== undefined`,()=>e.assign((0,Ht._)`${t}[${r}]`,n))}function cU(e,t,r,n=S2.Correct){let i=n===S2.Correct?Ht.operators.EQ:Ht.operators.NEQ,a;switch(e){case"null":return(0,Ht._)`${t} ${i} null`;case"array":a=(0,Ht._)`Array.isArray(${t})`;break;case"object":a=(0,Ht._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":a=o((0,Ht._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":a=o();break;default:return(0,Ht._)`typeof ${t} ${i} ${e}`}return n===S2.Correct?a:(0,Ht.not)(a);function o(s=Ht.nil){return(0,Ht.and)((0,Ht._)`typeof ${t} == "number"`,s,r?(0,Ht._)`isFinite(${t})`:Ht.nil)}}na.checkDataType=cU;function lU(e,t,r,n){if(e.length===1)return cU(e[0],t,r,n);let i,a=(0,BSe.toHash)(e);if(a.array&&a.object){let o=(0,Ht._)`typeof ${t} != "object"`;i=a.null?o:(0,Ht._)`!${t} || ${o}`,delete a.null,delete a.array,delete a.object}else i=Ht.nil;a.number&&delete a.integer;for(let o in a)i=(0,Ht.and)(i,cU(o,t,r,n));return i}na.checkDataTypes=lU;var hPt={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,Ht._)`{type: ${e}}`:(0,Ht._)`{type: ${t}}`};function fU(e){let t=mPt(e);(0,uPt.reportError)(t,hPt)}na.reportTypeError=fU;function mPt(e){let{gen:t,data:r,schema:n}=e,i=(0,BSe.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:e}}});var RSe=x(d4=>{"use strict";Object.defineProperty(d4,"__esModule",{value:!0});d4.assignDefaults=void 0;var W1=er(),gPt=_r();function vPt(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let i in r)ISe(e,i,r[i].default);else t==="array"&&Array.isArray(n)&&n.forEach((i,a)=>ISe(e,a,i.default))}d4.assignDefaults=vPt;function ISe(e,t,r){let{gen:n,compositeRule:i,data:a,opts:o}=e;if(r===void 0)return;let s=(0,W1._)`${a}${(0,W1.getProperty)(t)}`;if(i){(0,gPt.checkStrictMode)(e,`default is ignored for: ${s}`);return}let u=(0,W1._)`${s} === undefined`;o.useDefaults==="empty"&&(u=(0,W1._)`${u} || ${s} === null || ${s} === ""`),n.if(u,(0,W1._)`${s} = ${(0,W1.stringify)(r)}`)}});var fs=x(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.validateUnion=Hr.validateArray=Hr.usePattern=Hr.callValidateCode=Hr.schemaProperties=Hr.allSchemaProperties=Hr.noPropertyInData=Hr.propertyInData=Hr.isOwnProperty=Hr.hasPropFunc=Hr.reportMissingProp=Hr.checkMissingProp=Hr.checkReportMissingProp=void 0;var hn=er(),pU=_r(),Bp=Ml(),xPt=_r();function bPt(e,t){let{gen:r,data:n,it:i}=e;r.if(hU(r,n,t,i.opts.ownProperties),()=>{e.setParams({missingProperty:(0,hn._)`${t}`},!0),e.error()})}Hr.checkReportMissingProp=bPt;function yPt({gen:e,data:t,it:{opts:r}},n,i){return(0,hn.or)(...n.map(a=>(0,hn.and)(hU(e,t,a,r.ownProperties),(0,hn._)`${i} = ${a}`)))}Hr.checkMissingProp=yPt;function _Pt(e,t){e.setParams({missingProperty:t},!0),e.error()}Hr.reportMissingProp=_Pt;function jSe(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,hn._)`Object.prototype.hasOwnProperty`})}Hr.hasPropFunc=jSe;function dU(e,t,r){return(0,hn._)`${jSe(e)}.call(${t}, ${r})`}Hr.isOwnProperty=dU;function wPt(e,t,r,n){let i=(0,hn._)`${t}${(0,hn.getProperty)(r)} !== undefined`;return n?(0,hn._)`${i} && ${dU(e,t,r)}`:i}Hr.propertyInData=wPt;function hU(e,t,r,n){let i=(0,hn._)`${t}${(0,hn.getProperty)(r)} === undefined`;return n?(0,hn.or)(i,(0,hn.not)(dU(e,t,r))):i}Hr.noPropertyInData=hU;function MSe(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}Hr.allSchemaProperties=MSe;function EPt(e,t){return MSe(t).filter(r=>!(0,pU.alwaysValidSchema)(e,t[r]))}Hr.schemaProperties=EPt;function APt({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:a},it:o},s,u,c){let l=c?(0,hn._)`${e}, ${t}, ${n}${i}`:t,f=[[Bp.default.instancePath,(0,hn.strConcat)(Bp.default.instancePath,a)],[Bp.default.parentData,o.parentData],[Bp.default.parentDataProperty,o.parentDataProperty],[Bp.default.rootData,Bp.default.rootData]];o.opts.dynamicRef&&f.push([Bp.default.dynamicAnchors,Bp.default.dynamicAnchors]);let p=(0,hn._)`${l}, ${r.object(...f)}`;return u!==hn.nil?(0,hn._)`${s}.call(${u}, ${p})`:(0,hn._)`${s}(${p})`}Hr.callValidateCode=APt;var SPt=(0,hn._)`new RegExp`;function TPt({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:i}=t.code,a=i(r,n);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:(0,hn._)`${i.code==="new RegExp"?SPt:(0,xPt.useFunc)(e,i)}(${r}, ${n})`})}Hr.usePattern=TPt;function CPt(e){let{gen:t,data:r,keyword:n,it:i}=e,a=t.name("valid");if(i.allErrors){let s=t.let("valid",!0);return o(()=>t.assign(s,!1)),s}return t.var(a,!0),o(()=>t.break()),a;function o(s){let u=t.const("len",(0,hn._)`${r}.length`);t.forRange("i",0,u,c=>{e.subschema({keyword:n,dataProp:c,dataPropType:pU.Type.Num},a),t.if((0,hn.not)(a),s)})}}Hr.validateArray=CPt;function DPt(e){let{gen:t,schema:r,keyword:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(u=>(0,pU.alwaysValidSchema)(i,u))&&!i.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,hn._)`${o} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,hn.not)(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}Hr.validateUnion=DPt});var NSe=x(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});_c.validateKeywordUsage=_c.validSchemaType=_c.funcKeywordCode=_c.macroKeywordCode=void 0;var La=er(),Ph=Ml(),kPt=fs(),FPt=A2();function BPt(e,t){let{gen:r,keyword:n,schema:i,parentSchema:a,it:o}=e,s=t.macro.call(o.self,i,a,o),u=qSe(r,n,s);o.opts.validateSchema!==!1&&o.self.validateSchema(s,!0);let c=r.name("valid");e.subschema({schema:s,schemaPath:La.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:u,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}_c.macroKeywordCode=BPt;function PPt(e,t){var r;let{gen:n,keyword:i,schema:a,parentSchema:o,$data:s,it:u}=e;IPt(u,t);let c=!s&&t.compile?t.compile.call(u.self,a,o,u):t.validate,l=qSe(n,i,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)v(),t.modifying&&LSe(e),m(()=>e.error());else{let b=t.async?d():h();t.modifying&&LSe(e),m(()=>OPt(e,b))}}function d(){let b=n.let("ruleErrs",null);return n.try(()=>v((0,La._)`await `),_=>n.assign(f,!1).if((0,La._)`${_} instanceof ${u.ValidationError}`,()=>n.assign(b,(0,La._)`${_}.errors`),()=>n.throw(_))),b}function h(){let b=(0,La._)`${l}.errors`;return n.assign(b,null),v(La.nil),b}function v(b=t.async?(0,La._)`await `:La.nil){let _=u.opts.passContext?Ph.default.this:Ph.default.self,E=!("compile"in t&&!s||t.schema===!1);n.assign(f,(0,La._)`${b}${(0,kPt.callValidateCode)(e,l,_,E)}`,t.modifying)}function m(b){var _;n.if((0,La.not)((_=t.valid)!==null&&_!==void 0?_:f),b)}}_c.funcKeywordCode=PPt;function LSe(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,La._)`${n.parentData}[${n.parentDataProperty}]`))}function OPt(e,t){let{gen:r}=e;r.if((0,La._)`Array.isArray(${t})`,()=>{r.assign(Ph.default.vErrors,(0,La._)`${Ph.default.vErrors} === null ? ${t} : ${Ph.default.vErrors}.concat(${t})`).assign(Ph.default.errors,(0,La._)`${Ph.default.vErrors}.length`),(0,FPt.extendErrors)(e)},()=>e.error())}function IPt({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function qSe(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,La.stringify)(r)})}function RPt(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")}_c.validSchemaType=RPt;function jPt({schema:e,opts:t,self:r,errSchemaPath:n},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw new Error("ajv implementation error");let o=i.dependencies;if(o!=null&&o.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${a}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[a])){let u=`keyword "${a}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(u);else throw new Error(u)}}_c.validateKeywordUsage=jPt});var GSe=x(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});Pp.extendSubschemaMode=Pp.extendSubschemaData=Pp.getSubschema=void 0;var wc=er(),USe=_r();function MPt(e,{keyword:t,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:a,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,wc._)`${e.schemaPath}${(0,wc.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,wc._)`${e.schemaPath}${(0,wc.getProperty)(t)}${(0,wc.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,USe.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||a===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')}Pp.getSubschema=MPt;function LPt(e,t,{dataProp:r,dataPropType:n,data:i,dataTypes:a,propertyName:o}){if(i!==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,wc._)`${t.data}${(0,wc.getProperty)(r)}`,!0);u(p),e.errorPath=(0,wc.str)`${c}${(0,USe.getErrorPath)(r,n,f.jsPropertySyntax)}`,e.parentDataProperty=(0,wc._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(i!==void 0){let c=i instanceof wc.Name?i:s.let("data",i,!0);u(c),o!==void 0&&(e.propertyName=o)}a&&(e.dataTypes=a);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]}}Pp.extendSubschemaData=LPt;function qPt(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:a}){n!==void 0&&(e.compositeRule=n),i!==void 0&&(e.createErrors=i),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=r}Pp.extendSubschemaMode=qPt});var HSe=x((zbr,zSe)=>{"use strict";var Op=zSe.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};h4(t,n,i,e,"",e)};Op.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Op.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Op.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Op.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 h4(e,t,r,n,i,a,o,s,u,c){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,i,a,o,s,u,c);for(var l in n){var f=n[l];if(Array.isArray(f)){if(l in Op.arrayKeywords)for(var p=0;p<f.length;p++)h4(e,t,r,f[p],i+"/"+l+"/"+p,a,i,l,n,p)}else if(l in Op.propsKeywords){if(f&&typeof f=="object")for(var d in f)h4(e,t,r,f[d],i+"/"+l+"/"+NPt(d),a,i,l,n,d)}else(l in Op.keywords||e.allKeys&&!(l in Op.skipKeywords))&&h4(e,t,r,f,i+"/"+l,a,i,l,n)}r(n,i,a,o,s,u,c)}}function NPt(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var C2=x(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.getSchemaRefs=io.resolveUrl=io.normalizeId=io._getFullPath=io.getFullPath=io.inlineRef=void 0;var UPt=_r(),GPt=P0(),zPt=HSe(),HPt=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function WPt(e,t=!0){return typeof e=="boolean"?!0:t===!0?!mU(e):t?WSe(e)<=t:!1}io.inlineRef=WPt;var VPt=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function mU(e){for(let t in e){if(VPt.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(mU)||typeof r=="object"&&mU(r))return!0}return!1}function WSe(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!HPt.has(r)&&(typeof e[r]=="object"&&(0,UPt.eachItem)(e[r],n=>t+=WSe(n)),t===1/0))return 1/0}return t}function VSe(e,t="",r){r!==!1&&(t=V1(t));let n=e.parse(t);return $Se(e,n)}io.getFullPath=VSe;function $Se(e,t){return e.serialize(t).split("#")[0]+"#"}io._getFullPath=$Se;var $Pt=/#\/?$/;function V1(e){return e?e.replace($Pt,""):""}io.normalizeId=V1;function KPt(e,t,r){return r=V1(r),e.resolve(t,r)}io.resolveUrl=KPt;var JPt=/^[a-z_][-a-z0-9._]*$/i;function YPt(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=V1(e[r]||t),a={"":i},o=VSe(n,i,!1),s={},u=new Set;return zPt(e,{allKeys:!0},(f,p,d,h)=>{if(h===void 0)return;let v=o+p,m=a[h];typeof f[r]=="string"&&(m=b.call(this,f[r])),_.call(this,f.$anchor),_.call(this,f.$dynamicAnchor),a[p]=m;function b(E){let T=this.opts.uriResolver.resolve;if(E=V1(m?T(m,E):E),u.has(E))throw l(E);u.add(E);let S=this.refs[E];return typeof S=="string"&&(S=this.refs[S]),typeof S=="object"?c(f,S.schema,E):E!==V1(v)&&(E[0]==="#"?(c(f,s[E],E),s[E]=f):this.refs[E]=v),E}function _(E){if(typeof E=="string"){if(!JPt.test(E))throw new Error(`invalid anchor "${E}"`);b.call(this,`#${E}`)}}}),s;function c(f,p,d){if(p!==void 0&&!GPt(f,p))throw l(d)}function l(f){return new Error(`reference "${f}" resolves to more than one schema`)}}io.getSchemaRefs=YPt});var F2=x(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});Ip.getData=Ip.KeywordCxt=Ip.validateFunctionCode=void 0;var QSe=DSe(),KSe=T2(),vU=uU(),m4=T2(),XPt=RSe(),k2=NSe(),gU=GSe(),xt=er(),jt=Ml(),QPt=C2(),Ll=_r(),D2=A2();function ZPt(e){if(t3e(e)&&(r3e(e),e3e(e))){rOt(e);return}ZSe(e,()=>(0,QSe.topBoolOrEmptySchema)(e))}Ip.validateFunctionCode=ZPt;function ZSe({gen:e,validateName:t,schema:r,schemaEnv:n,opts:i},a){i.code.es5?e.func(t,(0,xt._)`${jt.default.data}, ${jt.default.valCxt}`,n.$async,()=>{e.code((0,xt._)`"use strict"; ${JSe(r,i)}`),tOt(e,i),e.code(a)}):e.func(t,(0,xt._)`${jt.default.data}, ${eOt(i)}`,n.$async,()=>e.code(JSe(r,i)).code(a))}function eOt(e){return(0,xt._)`{${jt.default.instancePath}="", ${jt.default.parentData}, ${jt.default.parentDataProperty}, ${jt.default.rootData}=${jt.default.data}${e.dynamicRef?(0,xt._)`, ${jt.default.dynamicAnchors}={}`:xt.nil}}={}`}function tOt(e,t){e.if(jt.default.valCxt,()=>{e.var(jt.default.instancePath,(0,xt._)`${jt.default.valCxt}.${jt.default.instancePath}`),e.var(jt.default.parentData,(0,xt._)`${jt.default.valCxt}.${jt.default.parentData}`),e.var(jt.default.parentDataProperty,(0,xt._)`${jt.default.valCxt}.${jt.default.parentDataProperty}`),e.var(jt.default.rootData,(0,xt._)`${jt.default.valCxt}.${jt.default.rootData}`),t.dynamicRef&&e.var(jt.default.dynamicAnchors,(0,xt._)`${jt.default.valCxt}.${jt.default.dynamicAnchors}`)},()=>{e.var(jt.default.instancePath,(0,xt._)`""`),e.var(jt.default.parentData,(0,xt._)`undefined`),e.var(jt.default.parentDataProperty,(0,xt._)`undefined`),e.var(jt.default.rootData,jt.default.data),t.dynamicRef&&e.var(jt.default.dynamicAnchors,(0,xt._)`{}`)})}function rOt(e){let{schema:t,opts:r,gen:n}=e;ZSe(e,()=>{r.$comment&&t.$comment&&i3e(e),sOt(e),n.let(jt.default.vErrors,null),n.let(jt.default.errors,0),r.unevaluated&&nOt(e),n3e(e),lOt(e)})}function nOt(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,xt._)`${r}.evaluated`),t.if((0,xt._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,xt._)`${e.evaluated}.props`,(0,xt._)`undefined`)),t.if((0,xt._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,xt._)`${e.evaluated}.items`,(0,xt._)`undefined`))}function JSe(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,xt._)`/*# sourceURL=${r} */`:xt.nil}function iOt(e,t){if(t3e(e)&&(r3e(e),e3e(e))){aOt(e,t);return}(0,QSe.boolOrEmptySchema)(e,t)}function e3e({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 t3e(e){return typeof e.schema!="boolean"}function aOt(e,t){let{schema:r,gen:n,opts:i}=e;i.$comment&&r.$comment&&i3e(e),uOt(e),cOt(e);let a=n.const("_errs",jt.default.errors);n3e(e,a),n.var(t,(0,xt._)`${a} === ${jt.default.errors}`)}function r3e(e){(0,Ll.checkUnknownRules)(e),oOt(e)}function n3e(e,t){if(e.opts.jtd)return YSe(e,[],!1,t);let r=(0,KSe.getSchemaTypes)(e.schema),n=(0,KSe.coerceAndCheckDataType)(e,r);YSe(e,r,!n,t)}function oOt(e){let{schema:t,errSchemaPath:r,opts:n,self:i}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Ll.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function sOt(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ll.checkStrictMode)(e,"default is ignored in the schema root")}function uOt(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,QPt.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function cOt(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function i3e({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:i}){let a=r.$comment;if(i.$comment===!0)e.code((0,xt._)`${jt.default.self}.logger.log(${a})`);else if(typeof i.$comment=="function"){let o=(0,xt.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,xt._)`${jt.default.self}.opts.$comment(${a}, ${o}, ${s}.schema)`)}}function lOt(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:i,opts:a}=e;r.$async?t.if((0,xt._)`${jt.default.errors} === 0`,()=>t.return(jt.default.data),()=>t.throw((0,xt._)`new ${i}(${jt.default.vErrors})`)):(t.assign((0,xt._)`${n}.errors`,jt.default.vErrors),a.unevaluated&&fOt(e),t.return((0,xt._)`${jt.default.errors} === 0`))}function fOt({gen:e,evaluated:t,props:r,items:n}){r instanceof xt.Name&&e.assign((0,xt._)`${t}.props`,r),n instanceof xt.Name&&e.assign((0,xt._)`${t}.items`,n)}function YSe(e,t,r,n){let{gen:i,schema:a,data:o,allErrors:s,opts:u,self:c}=e,{RULES:l}=c;if(a.$ref&&(u.ignoreKeywordsWithRef||!(0,Ll.schemaHasRulesButRef)(a,l))){i.block(()=>o3e(e,"$ref",l.all.$ref.definition));return}u.jtd||pOt(e,t),i.block(()=>{for(let p of l.rules)f(p);f(l.post)});function f(p){(0,vU.shouldUseGroup)(a,p)&&(p.type?(i.if((0,m4.checkDataType)(p.type,o,u.strictNumbers)),XSe(e,p),t.length===1&&t[0]===p.type&&r&&(i.else(),(0,m4.reportTypeError)(e)),i.endIf()):XSe(e,p),s||i.if((0,xt._)`${jt.default.errors} === ${n||0}`))}}function XSe(e,t){let{gen:r,schema:n,opts:{useDefaults:i}}=e;i&&(0,XPt.assignDefaults)(e,t.type),r.block(()=>{for(let a of t.rules)(0,vU.shouldUseRule)(n,a)&&o3e(e,a.keyword,a.definition,t.type)})}function pOt(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(dOt(e,t),e.opts.allowUnionTypes||hOt(e,t),mOt(e,e.dataTypes))}function dOt(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{a3e(e.dataTypes,r)||xU(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),vOt(e,t)}}function hOt(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&xU(e,"use allowUnionTypes to allow union type keyword")}function mOt(e,t){let r=e.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,vU.shouldUseRule)(e.schema,i)){let{type:a}=i.definition;a.length&&!a.some(o=>gOt(t,o))&&xU(e,`missing type "${a.join(",")}" for keyword "${n}"`)}}}function gOt(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function a3e(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function vOt(e,t){let r=[];for(let n of e.dataTypes)a3e(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function xU(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Ll.checkStrictMode)(e,t,e.opts.strictTypes)}var g4=class{constructor(t,r,n){if((0,k2.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,Ll.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",s3e(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,k2.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",jt.default.errors))}result(t,r,n){this.failResult((0,xt.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,xt.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,xt._)`${r} !== undefined && (${(0,xt.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?D2.reportExtraError:D2.reportError)(this,this.def.error,r)}$dataError(){(0,D2.reportError)(this,this.def.$dataError||D2.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,D2.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=xt.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=xt.nil,r=xt.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:a,def:o}=this;n.if((0,xt.or)((0,xt._)`${i} === undefined`,r)),t!==xt.nil&&n.assign(t,!0),(a.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==xt.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:i,it:a}=this;return(0,xt.or)(o(),s());function o(){if(n.length){if(!(r instanceof xt.Name))throw new Error("ajv implementation error");let u=Array.isArray(n)?n:[n];return(0,xt._)`${(0,m4.checkDataTypes)(u,r,a.opts.strictNumbers,m4.DataType.Wrong)}`}return xt.nil}function s(){if(i.validateSchema){let u=t.scopeValue("validate$data",{ref:i.validateSchema});return(0,xt._)`!${u}(${r})`}return xt.nil}}subschema(t,r){let n=(0,gU.getSubschema)(this.it,t);(0,gU.extendSubschemaData)(n,this.it,t),(0,gU.extendSubschemaMode)(n,t);let i={...this.it,...n,items:void 0,props:void 0};return iOt(i,r),i}mergeEvaluated(t,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Ll.mergeEvaluated.props(i,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Ll.mergeEvaluated.items(i,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(t,xt.Name)),!0}};Ip.KeywordCxt=g4;function o3e(e,t,r,n){let i=new g4(e,r,t);"code"in r?r.code(i,n):i.$data&&r.validate?(0,k2.funcKeywordCode)(i,r):"macro"in r?(0,k2.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,k2.funcKeywordCode)(i,r)}var xOt=/^\/(?:[^~]|~0|~1)*$/,bOt=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function s3e(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let i,a;if(e==="")return jt.default.rootData;if(e[0]==="/"){if(!xOt.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);i=e,a=jt.default.rootData}else{let c=bOt.exec(e);if(!c)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+c[1];if(i=c[2],i==="#"){if(l>=t)throw new Error(u("property/index",l));return n[t-l]}if(l>t)throw new Error(u("data",l));if(a=r[t-l],!i)return a}let o=a,s=i.split("/");for(let c of s)c&&(a=(0,xt._)`${a}${(0,xt.getProperty)((0,Ll.unescapeJsonPointer)(c))}`,o=(0,xt._)`${o} && ${a}`);return o;function u(c,l){return`Cannot access ${c} ${l} levels up, current level is ${t}`}}Ip.getData=s3e});var v4=x(yU=>{"use strict";Object.defineProperty(yU,"__esModule",{value:!0});var bU=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};yU.default=bU});var x4=x(EU=>{"use strict";Object.defineProperty(EU,"__esModule",{value:!0});var _U=C2(),wU=class extends Error{constructor(t,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,_U.resolveUrl)(t,r,n),this.missingSchema=(0,_U.normalizeId)((0,_U.getFullPath)(t,this.missingRef))}};EU.default=wU});var y4=x(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.resolveSchema=ps.getCompilingSchema=ps.resolveRef=ps.compileSchema=ps.SchemaEnv=void 0;var su=er(),yOt=v4(),Oh=Ml(),uu=C2(),u3e=_r(),_Ot=F2(),$1=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,uu.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={}}};ps.SchemaEnv=$1;function SU(e){let t=c3e.call(this,e);if(t)return t;let r=(0,uu.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:a}=this.opts,o=new su.CodeGen(this.scope,{es5:n,lines:i,ownProperties:a}),s;e.$async&&(s=o.scopeValue("Error",{ref:yOt.default,code:(0,su._)`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:[su.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,su.stringify)(e.schema)}:{ref:e.schema}),validateName:u,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:su.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,su._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,_Ot.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:v}=c;d.evaluated={props:h instanceof su.Name?void 0:h,items:v instanceof su.Name?void 0:v,dynamicProps:h instanceof su.Name,dynamicItems:v instanceof su.Name},d.source&&(d.source.evaluated=(0,su.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)}}ps.compileSchema=SU;function wOt(e,t,r){var n;r=(0,uu.resolveUrl)(this.opts.uriResolver,t,r);let i=e.refs[r];if(i)return i;let a=SOt.call(this,e,r);if(a===void 0){let o=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;o&&(a=new $1({schema:o,schemaId:s,root:e,baseId:t}))}if(a!==void 0)return e.refs[r]=EOt.call(this,a)}ps.resolveRef=wOt;function EOt(e){return(0,uu.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:SU.call(this,e)}function c3e(e){for(let t of this._compilations)if(AOt(t,e))return t}ps.getCompilingSchema=c3e;function AOt(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function SOt(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||b4.call(this,e,t)}function b4(e,t){let r=this.opts.uriResolver.parse(t),n=(0,uu._getFullPath)(this.opts.uriResolver,r),i=(0,uu.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===i)return AU.call(this,r,e);let a=(0,uu.normalizeId)(n),o=this.refs[a]||this.schemas[a];if(typeof o=="string"){let s=b4.call(this,e,o);return typeof(s==null?void 0:s.schema)!="object"?void 0:AU.call(this,r,s)}if(typeof(o==null?void 0:o.schema)=="object"){if(o.validate||SU.call(this,o),a===(0,uu.normalizeId)(t)){let{schema:s}=o,{schemaId:u}=this.opts,c=s[u];return c&&(i=(0,uu.resolveUrl)(this.opts.uriResolver,i,c)),new $1({schema:s,schemaId:u,root:e,baseId:i})}return AU.call(this,r,o)}}ps.resolveSchema=b4;var TOt=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function AU(e,{baseId:t,schema:r,root:n}){var i;if(((i=e.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let u=r[(0,u3e.unescapeFragment)(s)];if(u===void 0)return;r=u;let c=typeof r=="object"&&r[this.opts.schemaId];!TOt.has(s)&&c&&(t=(0,uu.resolveUrl)(this.opts.uriResolver,t,c))}let a;if(typeof r!="boolean"&&r.$ref&&!(0,u3e.schemaHasRulesButRef)(r,this.RULES)){let s=(0,uu.resolveUrl)(this.opts.uriResolver,t,r.$ref);a=b4.call(this,n,s)}let{schemaId:o}=this.opts;if(a=a||new $1({schema:r,schemaId:o,root:n,baseId:t}),a.schema!==a.root.schema)return a}});var l3e=x((Jbr,COt)=>{COt.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 p3e=x(TU=>{"use strict";Object.defineProperty(TU,"__esModule",{value:!0});var f3e=M5();f3e.code='require("ajv/dist/runtime/uri").default';TU.default=f3e});var y3e=x(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.CodeGen=ia.Name=ia.nil=ia.stringify=ia.str=ia._=ia.KeywordCxt=void 0;var DOt=F2();Object.defineProperty(ia,"KeywordCxt",{enumerable:!0,get:function(){return DOt.KeywordCxt}});var K1=er();Object.defineProperty(ia,"_",{enumerable:!0,get:function(){return K1._}});Object.defineProperty(ia,"str",{enumerable:!0,get:function(){return K1.str}});Object.defineProperty(ia,"stringify",{enumerable:!0,get:function(){return K1.stringify}});Object.defineProperty(ia,"nil",{enumerable:!0,get:function(){return K1.nil}});Object.defineProperty(ia,"Name",{enumerable:!0,get:function(){return K1.Name}});Object.defineProperty(ia,"CodeGen",{enumerable:!0,get:function(){return K1.CodeGen}});var kOt=v4(),v3e=x4(),FOt=sU(),B2=y4(),BOt=er(),P2=C2(),_4=T2(),DU=_r(),d3e=l3e(),POt=p3e(),x3e=(e,t)=>new RegExp(e,t);x3e.code="new RegExp";var OOt=["removeAdditional","useDefaults","coerceTypes"],IOt=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),ROt={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."},jOt={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},h3e=200;function MOt(e){var t,r,n,i,a,o,s,u,c,l,f,p,d,h,v,m,b,_,E,T,S,D,I,L,F;let P=e.strict,M=(t=e.code)===null||t===void 0?void 0:t.optimize,U=M===!0||M===void 0?1:M||0,W=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:x3e,V=(i=e.uriResolver)!==null&&i!==void 0?i:POt.default;return{strictSchema:(o=(a=e.strictSchema)!==null&&a!==void 0?a:P)!==null&&o!==void 0?o:!0,strictNumbers:(u=(s=e.strictNumbers)!==null&&s!==void 0?s:P)!==null&&u!==void 0?u:!0,strictTypes:(l=(c=e.strictTypes)!==null&&c!==void 0?c:P)!==null&&l!==void 0?l:"log",strictTuples:(p=(f=e.strictTuples)!==null&&f!==void 0?f:P)!==null&&p!==void 0?p:"log",strictRequired:(h=(d=e.strictRequired)!==null&&d!==void 0?d:P)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:U,regExp:W}:{optimize:U,regExp:W},loopRequired:(v=e.loopRequired)!==null&&v!==void 0?v:h3e,loopEnum:(m=e.loopEnum)!==null&&m!==void 0?m:h3e,meta:(b=e.meta)!==null&&b!==void 0?b:!0,messages:(_=e.messages)!==null&&_!==void 0?_:!0,inlineRefs:(E=e.inlineRefs)!==null&&E!==void 0?E:!0,schemaId:(T=e.schemaId)!==null&&T!==void 0?T:"$id",addUsedSchema:(S=e.addUsedSchema)!==null&&S!==void 0?S:!0,validateSchema:(D=e.validateSchema)!==null&&D!==void 0?D:!0,validateFormats:(I=e.validateFormats)!==null&&I!==void 0?I:!0,unicodeRegExp:(L=e.unicodeRegExp)!==null&&L!==void 0?L:!0,int32range:(F=e.int32range)!==null&&F!==void 0?F:!0,uriResolver:V}}var O2=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...MOt(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new BOt.ValueScope({scope:{},prefixes:IOt,es5:r,lines:n}),this.logger=zOt(t.logger);let i=t.validateFormats;t.validateFormats=!1,this.RULES=(0,FOt.getRules)(),m3e.call(this,ROt,t,"NOT SUPPORTED"),m3e.call(this,jOt,t,"DEPRECATED","warn"),this._metaOpts=UOt.call(this),t.formats&&qOt.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&NOt.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),LOt.call(this),t.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,i=d3e;n==="id"&&(i={...d3e},i.id=i.$id,delete i.$id),r&&t&&this.addMetaSchema(i,i[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 i=n(r);return"$async"in n||(this.errors=n.errors),i}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 i.call(this,t,r);async function i(l,f){await a.call(this,l.$schema);let p=this._addSchema(l,f);return p.validate||o.call(this,p)}async function a(l){l&&!this.getSchema(l)&&await i.call(this,{$ref:l},!0)}async function o(l){try{return this._compileSchemaEnv(l)}catch(f){if(!(f instanceof v3e.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 a.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,i=this.opts.validateSchema){if(Array.isArray(t)){for(let o of t)this.addSchema(o,void 0,n,i);return this}let a;if(typeof t=="object"){let{schemaId:o}=this.opts;if(a=t[o],a!==void 0&&typeof a!="string")throw new Error(`schema ${o} must be string`)}return r=(0,P2.normalizeId)(r||a),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,i,!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 i=this.validate(n,t);if(!i&&r){let a="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(a);else throw new Error(a)}return i}getSchema(t){let r;for(;typeof(r=g3e.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,i=new B2.SchemaEnv({schema:{},schemaId:n});if(r=B2.resolveSchema.call(this,i,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=g3e.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,P2.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(WOt.call(this,n,r),!r)return(0,DU.eachItem)(n,a=>CU.call(this,a)),this;$Ot.call(this,r);let i={...r,type:(0,_4.getJSONTypes)(r.type),schemaType:(0,_4.getJSONTypes)(r.schemaType)};return(0,DU.eachItem)(n,i.type.length===0?a=>CU.call(this,a,i):a=>i.type.forEach(o=>CU.call(this,a,i,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 i=n.rules.findIndex(a=>a.keyword===t);i>=0&&n.rules.splice(i,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(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,a)=>i+r+a)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let i of r){let a=i.split("/").slice(1),o=t;for(let s of a)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]=b3e(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let i=t[n];(!r||r.test(n))&&(typeof i=="string"?delete t[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete t[n]))}}_addSchema(t,r,n,i=this.opts.validateSchema,a=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,P2.normalizeId)(o||n);let c=P2.getSchemaRefs.call(this,t,n);return u=new B2.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:n,localRefs:c}),this._cache.set(u.schema,u),a&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=u),i&&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):B2.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{B2.compileSchema.call(this,t)}finally{this.opts=r}}};ia.default=O2;O2.ValidationError=kOt.default;O2.MissingRefError=v3e.default;function m3e(e,t,r,n="error"){for(let i in e){let a=i;a in t&&this.logger[n](`${r}: option ${i}. ${e[a]}`)}}function g3e(e){return e=(0,P2.normalizeId)(e),this.schemas[e]||this.refs[e]}function LOt(){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 qOt(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function NOt(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 UOt(){let e={...this.opts};for(let t of OOt)delete e[t];return e}var GOt={log(){},warn(){},error(){}};function zOt(e){if(e===!1)return GOt;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 HOt=/^[a-z_$][a-z0-9_$:-]*$/i;function WOt(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(!HOt.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 i=t==null?void 0:t.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:a}=this,o=i?a.post:a.rules.find(({type:u})=>u===r);if(o||(o={type:r,rules:[]},a.rules.push(o)),a.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,_4.getJSONTypes)(t.type),schemaType:(0,_4.getJSONTypes)(t.schemaType)}};t.before?VOt.call(this,o,s,t.before):o.rules.push(s),a.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(u=>this.addKeyword(u))}function VOt(e,t,r){let n=e.rules.findIndex(i=>i.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function $Ot(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=b3e(t)),e.validateSchema=this.compile(t,!0))}var KOt={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function b3e(e){return{anyOf:[e,KOt]}}});var _3e=x(kU=>{"use strict";Object.defineProperty(kU,"__esModule",{value:!0});var JOt={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};kU.default=JOt});var S3e=x(Ih=>{"use strict";Object.defineProperty(Ih,"__esModule",{value:!0});Ih.callRef=Ih.getValidate=void 0;var YOt=x4(),w3e=fs(),ao=er(),J1=Ml(),E3e=y4(),w4=_r(),XOt={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:i,schemaEnv:a,validateName:o,opts:s,self:u}=n,{root:c}=a;if((r==="#"||r==="#/")&&i===c.baseId)return f();let l=E3e.resolveRef.call(u,c,i,r);if(l===void 0)throw new YOt.default(n.opts.uriResolver,i,r);if(l instanceof E3e.SchemaEnv)return p(l);return d(l);function f(){if(a===c)return E4(e,o,a,a.$async);let h=t.scopeValue("root",{ref:c});return E4(e,(0,ao._)`${h}.validate`,c,c.$async)}function p(h){let v=A3e(e,h);E4(e,v,h,h.$async)}function d(h){let v=t.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,ao.stringify)(h)}:{ref:h}),m=t.name("valid"),b=e.subschema({schema:h,dataTypes:[],schemaPath:ao.nil,topSchemaRef:v,errSchemaPath:r},m);e.mergeEvaluated(b),e.ok(m)}}};function A3e(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,ao._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Ih.getValidate=A3e;function E4(e,t,r,n){let{gen:i,it:a}=e,{allErrors:o,schemaEnv:s,opts:u}=a,c=u.passContext?J1.default.this:ao.nil;n?l():f();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=i.let("valid");i.try(()=>{i.code((0,ao._)`await ${(0,w3e.callValidateCode)(e,t,c)}`),d(t),o||i.assign(h,!0)},v=>{i.if((0,ao._)`!(${v} instanceof ${a.ValidationError})`,()=>i.throw(v)),p(v),o||i.assign(h,!1)}),e.ok(h)}function f(){e.result((0,w3e.callValidateCode)(e,t,c),()=>d(t),()=>p(t))}function p(h){let v=(0,ao._)`${h}.errors`;i.assign(J1.default.vErrors,(0,ao._)`${J1.default.vErrors} === null ? ${v} : ${J1.default.vErrors}.concat(${v})`),i.assign(J1.default.errors,(0,ao._)`${J1.default.vErrors}.length`)}function d(h){var v;if(!a.opts.unevaluated)return;let m=(v=r==null?void 0:r.validate)===null||v===void 0?void 0:v.evaluated;if(a.props!==!0)if(m&&!m.dynamicProps)m.props!==void 0&&(a.props=w4.mergeEvaluated.props(i,m.props,a.props));else{let b=i.var("props",(0,ao._)`${h}.evaluated.props`);a.props=w4.mergeEvaluated.props(i,b,a.props,ao.Name)}if(a.items!==!0)if(m&&!m.dynamicItems)m.items!==void 0&&(a.items=w4.mergeEvaluated.items(i,m.items,a.items));else{let b=i.var("items",(0,ao._)`${h}.evaluated.items`);a.items=w4.mergeEvaluated.items(i,b,a.items,ao.Name)}}}Ih.callRef=E4;Ih.default=XOt});var T3e=x(FU=>{"use strict";Object.defineProperty(FU,"__esModule",{value:!0});var QOt=_3e(),ZOt=S3e(),eIt=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",QOt.default,ZOt.default];FU.default=eIt});var C3e=x(BU=>{"use strict";Object.defineProperty(BU,"__esModule",{value:!0});var A4=er(),Rp=A4.operators,S4={maximum:{okStr:"<=",ok:Rp.LTE,fail:Rp.GT},minimum:{okStr:">=",ok:Rp.GTE,fail:Rp.LT},exclusiveMaximum:{okStr:"<",ok:Rp.LT,fail:Rp.GTE},exclusiveMinimum:{okStr:">",ok:Rp.GT,fail:Rp.LTE}},tIt={message:({keyword:e,schemaCode:t})=>(0,A4.str)`must be ${S4[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,A4._)`{comparison: ${S4[e].okStr}, limit: ${t}}`},rIt={keyword:Object.keys(S4),type:"number",schemaType:"number",$data:!0,error:tIt,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,A4._)`${r} ${S4[t].fail} ${n} || isNaN(${r})`)}};BU.default=rIt});var D3e=x(PU=>{"use strict";Object.defineProperty(PU,"__esModule",{value:!0});var I2=er(),nIt={message:({schemaCode:e})=>(0,I2.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,I2._)`{multipleOf: ${e}}`},iIt={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:nIt,code(e){let{gen:t,data:r,schemaCode:n,it:i}=e,a=i.opts.multipleOfPrecision,o=t.let("res"),s=a?(0,I2._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${a}`:(0,I2._)`${o} !== parseInt(${o})`;e.fail$data((0,I2._)`(${n} === 0 || (${o} = ${r}/${n}, ${s}))`)}};PU.default=iIt});var F3e=x(OU=>{"use strict";Object.defineProperty(OU,"__esModule",{value:!0});function k3e(e){let t=e.length,r=0,n=0,i;for(;n<t;)r++,i=e.charCodeAt(n++),i>=55296&&i<=56319&&n<t&&(i=e.charCodeAt(n),(i&64512)===56320&&n++);return r}OU.default=k3e;k3e.code='require("ajv/dist/runtime/ucs2length").default'});var B3e=x(IU=>{"use strict";Object.defineProperty(IU,"__esModule",{value:!0});var Rh=er(),aIt=_r(),oIt=F3e(),sIt={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Rh.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Rh._)`{limit: ${e}}`},uIt={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:sIt,code(e){let{keyword:t,data:r,schemaCode:n,it:i}=e,a=t==="maxLength"?Rh.operators.GT:Rh.operators.LT,o=i.opts.unicode===!1?(0,Rh._)`${r}.length`:(0,Rh._)`${(0,aIt.useFunc)(e.gen,oIt.default)}(${r})`;e.fail$data((0,Rh._)`${o} ${a} ${n}`)}};IU.default=uIt});var P3e=x(RU=>{"use strict";Object.defineProperty(RU,"__esModule",{value:!0});var cIt=fs(),T4=er(),lIt={message:({schemaCode:e})=>(0,T4.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,T4._)`{pattern: ${e}}`},fIt={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:lIt,code(e){let{data:t,$data:r,schema:n,schemaCode:i,it:a}=e,o=a.opts.unicodeRegExp?"u":"",s=r?(0,T4._)`(new RegExp(${i}, ${o}))`:(0,cIt.usePattern)(e,n);e.fail$data((0,T4._)`!${s}.test(${t})`)}};RU.default=fIt});var O3e=x(jU=>{"use strict";Object.defineProperty(jU,"__esModule",{value:!0});var R2=er(),pIt={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,R2.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,R2._)`{limit: ${e}}`},dIt={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:pIt,code(e){let{keyword:t,data:r,schemaCode:n}=e,i=t==="maxProperties"?R2.operators.GT:R2.operators.LT;e.fail$data((0,R2._)`Object.keys(${r}).length ${i} ${n}`)}};jU.default=dIt});var I3e=x(MU=>{"use strict";Object.defineProperty(MU,"__esModule",{value:!0});var j2=fs(),M2=er(),hIt=_r(),mIt={message:({params:{missingProperty:e}})=>(0,M2.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,M2._)`{missingProperty: ${e}}`},gIt={keyword:"required",type:"object",schemaType:"array",$data:!0,error:mIt,code(e){let{gen:t,schema:r,schemaCode:n,data:i,$data:a,it:o}=e,{opts:s}=o;if(!a&&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 v of r)if((d==null?void 0:d[v])===void 0&&!h.has(v)){let m=o.schemaEnv.baseId+o.errSchemaPath,b=`required property "${v}" is not defined at "${m}" (strictRequired)`;(0,hIt.checkStrictMode)(o,b,o.opts.strictRequired)}}function c(){if(u||a)e.block$data(M2.nil,f);else for(let d of r)(0,j2.checkReportMissingProp)(e,d)}function l(){let d=t.let("missing");if(u||a){let h=t.let("valid",!0);e.block$data(h,()=>p(d,h)),e.ok(h)}else t.if((0,j2.checkMissingProp)(e,r,d)),(0,j2.reportMissingProp)(e,d),t.else()}function f(){t.forOf("prop",n,d=>{e.setParams({missingProperty:d}),t.if((0,j2.noPropertyInData)(t,i,d,s.ownProperties),()=>e.error())})}function p(d,h){e.setParams({missingProperty:d}),t.forOf(d,n,()=>{t.assign(h,(0,j2.propertyInData)(t,i,d,s.ownProperties)),t.if((0,M2.not)(h),()=>{e.error(),t.break()})},M2.nil)}}};MU.default=gIt});var R3e=x(LU=>{"use strict";Object.defineProperty(LU,"__esModule",{value:!0});var L2=er(),vIt={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,L2.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,L2._)`{limit: ${e}}`},xIt={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:vIt,code(e){let{keyword:t,data:r,schemaCode:n}=e,i=t==="maxItems"?L2.operators.GT:L2.operators.LT;e.fail$data((0,L2._)`${r}.length ${i} ${n}`)}};LU.default=xIt});var C4=x(qU=>{"use strict";Object.defineProperty(qU,"__esModule",{value:!0});var j3e=P0();j3e.code='require("ajv/dist/runtime/equal").default';qU.default=j3e});var M3e=x(UU=>{"use strict";Object.defineProperty(UU,"__esModule",{value:!0});var NU=T2(),aa=er(),bIt=_r(),yIt=C4(),_It={message:({params:{i:e,j:t}})=>(0,aa.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,aa._)`{i: ${e}, j: ${t}}`},wIt={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:_It,code(e){let{gen:t,data:r,$data:n,schema:i,parentSchema:a,schemaCode:o,it:s}=e;if(!n&&!i)return;let u=t.let("valid"),c=a.items?(0,NU.getSchemaTypes)(a.items):[];e.block$data(u,l,(0,aa._)`${o} === false`),e.ok(u);function l(){let h=t.let("i",(0,aa._)`${r}.length`),v=t.let("j");e.setParams({i:h,j:v}),t.assign(u,!0),t.if((0,aa._)`${h} > 1`,()=>(f()?p:d)(h,v))}function f(){return c.length>0&&!c.some(h=>h==="object"||h==="array")}function p(h,v){let m=t.name("item"),b=(0,NU.checkDataTypes)(c,m,s.opts.strictNumbers,NU.DataType.Wrong),_=t.const("indices",(0,aa._)`{}`);t.for((0,aa._)`;${h}--;`,()=>{t.let(m,(0,aa._)`${r}[${h}]`),t.if(b,(0,aa._)`continue`),c.length>1&&t.if((0,aa._)`typeof ${m} == "string"`,(0,aa._)`${m} += "_"`),t.if((0,aa._)`typeof ${_}[${m}] == "number"`,()=>{t.assign(v,(0,aa._)`${_}[${m}]`),e.error(),t.assign(u,!1).break()}).code((0,aa._)`${_}[${m}] = ${h}`)})}function d(h,v){let m=(0,bIt.useFunc)(t,yIt.default),b=t.name("outer");t.label(b).for((0,aa._)`;${h}--;`,()=>t.for((0,aa._)`${v} = ${h}; ${v}--;`,()=>t.if((0,aa._)`${m}(${r}[${h}], ${r}[${v}])`,()=>{e.error(),t.assign(u,!1).break(b)})))}}};UU.default=wIt});var L3e=x(zU=>{"use strict";Object.defineProperty(zU,"__esModule",{value:!0});var GU=er(),EIt=_r(),AIt=C4(),SIt={message:"must be equal to constant",params:({schemaCode:e})=>(0,GU._)`{allowedValue: ${e}}`},TIt={keyword:"const",$data:!0,error:SIt,code(e){let{gen:t,data:r,$data:n,schemaCode:i,schema:a}=e;n||a&&typeof a=="object"?e.fail$data((0,GU._)`!${(0,EIt.useFunc)(t,AIt.default)}(${r}, ${i})`):e.fail((0,GU._)`${a} !== ${r}`)}};zU.default=TIt});var q3e=x(HU=>{"use strict";Object.defineProperty(HU,"__esModule",{value:!0});var q2=er(),CIt=_r(),DIt=C4(),kIt={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,q2._)`{allowedValues: ${e}}`},FIt={keyword:"enum",schemaType:"array",$data:!0,error:kIt,code(e){let{gen:t,data:r,$data:n,schema:i,schemaCode:a,it:o}=e;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let s=i.length>=o.opts.loopEnum,u,c=()=>u??(u=(0,CIt.useFunc)(t,DIt.default)),l;if(s||n)l=t.let("valid"),e.block$data(l,f);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let d=t.const("vSchema",a);l=(0,q2.or)(...i.map((h,v)=>p(d,v)))}e.pass(l);function f(){t.assign(l,!1),t.forOf("v",a,d=>t.if((0,q2._)`${c()}(${r}, ${d})`,()=>t.assign(l,!0).break()))}function p(d,h){let v=i[h];return typeof v=="object"&&v!==null?(0,q2._)`${c()}(${r}, ${d}[${h}])`:(0,q2._)`${r} === ${v}`}}};HU.default=FIt});var N3e=x(WU=>{"use strict";Object.defineProperty(WU,"__esModule",{value:!0});var BIt=C3e(),PIt=D3e(),OIt=B3e(),IIt=P3e(),RIt=O3e(),jIt=I3e(),MIt=R3e(),LIt=M3e(),qIt=L3e(),NIt=q3e(),UIt=[BIt.default,PIt.default,OIt.default,IIt.default,RIt.default,jIt.default,MIt.default,LIt.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},qIt.default,NIt.default];WU.default=UIt});var $U=x(N2=>{"use strict";Object.defineProperty(N2,"__esModule",{value:!0});N2.validateAdditionalItems=void 0;var jh=er(),VU=_r(),GIt={message:({params:{len:e}})=>(0,jh.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,jh._)`{limit: ${e}}`},zIt={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:GIt,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,VU.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}U3e(e,n)}};function U3e(e,t){let{gen:r,schema:n,data:i,keyword:a,it:o}=e;o.items=!0;let s=r.const("len",(0,jh._)`${i}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,jh._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,VU.alwaysValidSchema)(o,n)){let c=r.var("valid",(0,jh._)`${s} <= ${t.length}`);r.if((0,jh.not)(c),()=>u(c)),e.ok(c)}function u(c){r.forRange("i",t.length,s,l=>{e.subschema({keyword:a,dataProp:l,dataPropType:VU.Type.Num},c),o.allErrors||r.if((0,jh.not)(c),()=>r.break())})}}N2.validateAdditionalItems=U3e;N2.default=zIt});var KU=x(U2=>{"use strict";Object.defineProperty(U2,"__esModule",{value:!0});U2.validateTuple=void 0;var G3e=er(),D4=_r(),HIt=fs(),WIt={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return z3e(e,"additionalItems",t);r.items=!0,!(0,D4.alwaysValidSchema)(r,t)&&e.ok((0,HIt.validateArray)(e))}};function z3e(e,t,r=e.schema){let{gen:n,parentSchema:i,data:a,keyword:o,it:s}=e;l(i),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=D4.mergeEvaluated.items(n,r.length,s.items));let u=n.name("valid"),c=n.const("len",(0,G3e._)`${a}.length`);r.forEach((f,p)=>{(0,D4.alwaysValidSchema)(s,f)||(n.if((0,G3e._)`${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,v=h===f.minItems&&(h===f.maxItems||f[t]===!1);if(p.strictTuples&&!v){let m=`"${o}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${d}"`;(0,D4.checkStrictMode)(s,m,p.strictTuples)}}}U2.validateTuple=z3e;U2.default=WIt});var H3e=x(JU=>{"use strict";Object.defineProperty(JU,"__esModule",{value:!0});var VIt=KU(),$It={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,VIt.validateTuple)(e,"items")};JU.default=$It});var V3e=x(YU=>{"use strict";Object.defineProperty(YU,"__esModule",{value:!0});var W3e=er(),KIt=_r(),JIt=fs(),YIt=$U(),XIt={message:({params:{len:e}})=>(0,W3e.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,W3e._)`{limit: ${e}}`},QIt={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:XIt,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:i}=r;n.items=!0,!(0,KIt.alwaysValidSchema)(n,t)&&(i?(0,YIt.validateAdditionalItems)(e,i):e.ok((0,JIt.validateArray)(e)))}};YU.default=QIt});var $3e=x(XU=>{"use strict";Object.defineProperty(XU,"__esModule",{value:!0});var ds=er(),k4=_r(),ZIt={message:({params:{min:e,max:t}})=>t===void 0?(0,ds.str)`must contain at least ${e} valid item(s)`:(0,ds.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,ds._)`{minContains: ${e}}`:(0,ds._)`{minContains: ${e}, maxContains: ${t}}`},e9t={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:ZIt,code(e){let{gen:t,schema:r,parentSchema:n,data:i,it:a}=e,o,s,{minContains:u,maxContains:c}=n;a.opts.next?(o=u===void 0?1:u,s=c):o=1;let l=t.const("len",(0,ds._)`${i}.length`);if(e.setParams({min:o,max:s}),s===void 0&&o===0){(0,k4.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&o>s){(0,k4.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,k4.alwaysValidSchema)(a,r)){let v=(0,ds._)`${l} >= ${o}`;s!==void 0&&(v=(0,ds._)`${v} && ${l} <= ${s}`),e.pass(v);return}a.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,ds._)`${i}.length > 0`,p)):(t.let(f,!1),p()),e.result(f,()=>e.reset());function p(){let v=t.name("_valid"),m=t.let("count",0);d(v,()=>t.if(v,()=>h(m)))}function d(v,m){t.forRange("i",0,l,b=>{e.subschema({keyword:"contains",dataProp:b,dataPropType:k4.Type.Num,compositeRule:!0},v),m()})}function h(v){t.code((0,ds._)`${v}++`),s===void 0?t.if((0,ds._)`${v} >= ${o}`,()=>t.assign(f,!0).break()):(t.if((0,ds._)`${v} > ${s}`,()=>t.assign(f,!1).break()),o===1?t.assign(f,!0):t.if((0,ds._)`${v} >= ${o}`,()=>t.assign(f,!0)))}}};XU.default=e9t});var Y3e=x(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});Ec.validateSchemaDeps=Ec.validatePropertyDeps=Ec.error=void 0;var QU=er(),t9t=_r(),G2=fs();Ec.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,QU.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,QU._)`{property: ${e},
|
|
153
153
|
missingProperty: ${n},
|
|
154
154
|
depsCount: ${t},
|
|
155
|
-
deps: ${r}}`};var r9t={keyword:"dependencies",type:"object",schemaType:"object",error:Ec.error,code(e){let[t,r]=n9t(e);K3e(e,t),J3e(e,r)}};function n9t({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let i=Array.isArray(e[n])?t:r;i[n]=e[n]}return[t,r]}function K3e(e,t=e.schema){let{gen:r,data:n,it:i}=e;if(Object.keys(t).length===0)return;let a=r.let("missing");for(let o in t){let s=t[o];if(s.length===0)continue;let u=(0,G2.propertyInData)(r,n,o,i.opts.ownProperties);e.setParams({property:o,depsCount:s.length,deps:s.join(", ")}),i.allErrors?r.if(u,()=>{for(let c of s)(0,G2.checkReportMissingProp)(e,c)}):(r.if((0,QU._)`${u} && (${(0,G2.checkMissingProp)(e,s,a)})`),(0,G2.reportMissingProp)(e,a),r.else())}}Ec.validatePropertyDeps=K3e;function J3e(e,t=e.schema){let{gen:r,data:n,keyword:i,it:a}=e,o=r.name("valid");for(let s in t)(0,t9t.alwaysValidSchema)(a,t[s])||(r.if((0,G2.propertyInData)(r,n,s,a.opts.ownProperties),()=>{let u=e.subschema({keyword:i,schemaProp:s},o);e.mergeValidEvaluated(u,o)},()=>r.var(o,!0)),e.ok(o))}Ec.validateSchemaDeps=J3e;Ec.default=r9t});var Q3e=x(ZU=>{"use strict";Object.defineProperty(ZU,"__esModule",{value:!0});var X3e=er(),i9t=_r(),a9t={message:"property name must be valid",params:({params:e})=>(0,X3e._)`{propertyName: ${e.propertyName}}`},o9t={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:a9t,code(e){let{gen:t,schema:r,data:n,it:i}=e;if((0,i9t.alwaysValidSchema)(i,r))return;let a=t.name("valid");t.forIn("key",n,o=>{e.setParams({propertyName:o}),e.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},a),t.if((0,X3e.not)(a),()=>{e.error(!0),i.allErrors||t.break()})}),e.ok(a)}};ZU.default=o9t});var tG=x(eG=>{"use strict";Object.defineProperty(eG,"__esModule",{value:!0});var F4=fs(),cu=er(),s9t=Ml(),B4=_r(),u9t={message:"must NOT have additional properties",params:({params:e})=>(0,cu._)`{additionalProperty: ${e.additionalProperty}}`},c9t={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:u9t,code(e){let{gen:t,schema:r,parentSchema:n,data:i,errsCount:a,it:o}=e;if(!a)throw new Error("ajv implementation error");let{allErrors:s,opts:u}=o;if(o.props=!0,u.removeAdditional!=="all"&&(0,B4.alwaysValidSchema)(o,r))return;let c=(0,F4.allSchemaProperties)(n.properties),l=(0,F4.allSchemaProperties)(n.patternProperties);f(),e.ok((0,cu._)`${a} === ${s9t.default.errors}`);function f(){t.forIn("key",i,m=>{!c.length&&!l.length?h(m):t.if(p(m),()=>h(m))})}function p(m){let b;if(c.length>8){let _=(0,B4.schemaRefOrVal)(o,n.properties,"properties");b=(0,F4.isOwnProperty)(t,_,m)}else c.length?b=(0,cu.or)(...c.map(_=>(0,cu._)`${m} === ${_}`)):b=cu.nil;return l.length&&(b=(0,cu.or)(b,...l.map(_=>(0,cu._)`${(0,F4.usePattern)(e,_)}.test(${m})`))),(0,cu.not)(b)}function d(m){t.code((0,cu._)`delete ${i}[${m}]`)}function h(m){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){d(m);return}if(r===!1){e.setParams({additionalProperty:m}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,B4.alwaysValidSchema)(o,r)){let b=t.name("valid");u.removeAdditional==="failing"?(v(m,b,!1),t.if((0,cu.not)(b),()=>{e.reset(),d(m)})):(v(m,b),s||t.if((0,cu.not)(b),()=>t.break()))}}function v(m,b,_){let E={keyword:"additionalProperties",dataProp:m,dataPropType:B4.Type.Str};_===!1&&Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(E,b)}}};eG.default=c9t});var t6e=x(nG=>{"use strict";Object.defineProperty(nG,"__esModule",{value:!0});var l9t=F2(),Z3e=fs(),rG=_r(),e6e=tG(),f9t={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:i,it:a}=e;a.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&e6e.default.code(new l9t.KeywordCxt(a,e6e.default,"additionalProperties"));let o=(0,Z3e.allSchemaProperties)(r);for(let f of o)a.definedProperties.add(f);a.opts.unevaluated&&o.length&&a.props!==!0&&(a.props=rG.mergeEvaluated.props(t,(0,rG.toHash)(o),a.props));let s=o.filter(f=>!(0,rG.alwaysValidSchema)(a,r[f]));if(s.length===0)return;let u=t.name("valid");for(let f of s)c(f)?l(f):(t.if((0,Z3e.propertyInData)(t,i,f,a.opts.ownProperties)),l(f),a.allErrors||t.else().var(u,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(u);function c(f){return a.opts.useDefaults&&!a.compositeRule&&r[f].default!==void 0}function l(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},u)}}};nG.default=f9t});var a6e=x(iG=>{"use strict";Object.defineProperty(iG,"__esModule",{value:!0});var r6e=fs(),P4=er(),n6e=_r(),i6e=_r(),p9t={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:i,it:a}=e,{opts:o}=a,s=(0,r6e.allSchemaProperties)(r),u=s.filter(v=>(0,n6e.alwaysValidSchema)(a,r[v]));if(s.length===0||u.length===s.length&&(!a.opts.unevaluated||a.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&i.properties,l=t.name("valid");a.props!==!0&&!(a.props instanceof P4.Name)&&(a.props=(0,i6e.evaluatedPropsToName)(t,a.props));let{props:f}=a;p();function p(){for(let v of s)c&&d(v),a.allErrors?h(v):(t.var(l,!0),h(v),t.if(l))}function d(v){for(let m in c)new RegExp(v).test(m)&&(0,n6e.checkStrictMode)(a,`property ${m} matches pattern ${v} (use allowMatchingProperties)`)}function h(v){t.forIn("key",n,m=>{t.if((0,P4._)`${(0,r6e.usePattern)(e,v)}.test(${m})`,()=>{let b=u.includes(v);b||e.subschema({keyword:"patternProperties",schemaProp:v,dataProp:m,dataPropType:i6e.Type.Str},l),a.opts.unevaluated&&f!==!0?t.assign((0,P4._)`${f}[${m}]`,!0):!b&&!a.allErrors&&t.if((0,P4.not)(l),()=>t.break())})})}}};iG.default=p9t});var o6e=x(aG=>{"use strict";Object.defineProperty(aG,"__esModule",{value:!0});var d9t=_r(),h9t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,d9t.alwaysValidSchema)(n,r)){e.fail();return}let i=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),e.failResult(i,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};aG.default=h9t});var s6e=x(oG=>{"use strict";Object.defineProperty(oG,"__esModule",{value:!0});var m9t=fs(),g9t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:m9t.validateUnion,error:{message:"must match a schema in anyOf"}};oG.default=g9t});var u6e=x(sG=>{"use strict";Object.defineProperty(sG,"__esModule",{value:!0});var O4=er(),v9t=_r(),x9t={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,O4._)`{passingSchemas: ${e.passing}}`},b9t={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:x9t,code(e){let{gen:t,schema:r,parentSchema:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let a=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(){a.forEach((l,f)=>{let p;(0,v9t.alwaysValidSchema)(i,l)?t.var(u,!0):p=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},u),f>0&&t.if((0,O4._)`${u} && ${o}`).assign(o,!1).assign(s,(0,O4._)`[${s}, ${f}]`).else(),t.if(u,()=>{t.assign(o,!0),t.assign(s,f),p&&e.mergeEvaluated(p,O4.Name)})})}}};sG.default=b9t});var c6e=x(uG=>{"use strict";Object.defineProperty(uG,"__esModule",{value:!0});var y9t=_r(),_9t={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 i=t.name("valid");r.forEach((a,o)=>{if((0,y9t.alwaysValidSchema)(n,a))return;let s=e.subschema({keyword:"allOf",schemaProp:o},i);e.ok(i),e.mergeEvaluated(s)})}};uG.default=_9t});var p6e=x(cG=>{"use strict";Object.defineProperty(cG,"__esModule",{value:!0});var I4=er(),f6e=_r(),w9t={message:({params:e})=>(0,I4.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,I4._)`{failingKeyword: ${e.ifClause}}`},E9t={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:w9t,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,f6e.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=l6e(n,"then"),a=l6e(n,"else");if(!i&&!a)return;let o=t.let("valid",!0),s=t.name("_valid");if(u(),e.reset(),i&&a){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,c("then",l),c("else",l))}else i?t.if(s,c("then")):t.if((0,I4.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,I4._)`${l}`):e.setParams({ifClause:l})}}}};function l6e(e,t){let r=e.schema[t];return r!==void 0&&!(0,f6e.alwaysValidSchema)(e,r)}cG.default=E9t});var d6e=x(lG=>{"use strict";Object.defineProperty(lG,"__esModule",{value:!0});var A9t=_r(),S9t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,A9t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};lG.default=S9t});var h6e=x(fG=>{"use strict";Object.defineProperty(fG,"__esModule",{value:!0});var T9t=$U(),C9t=H3e(),D9t=KU(),k9t=V3e(),F9t=$3e(),B9t=Y3e(),P9t=Q3e(),O9t=tG(),I9t=t6e(),R9t=a6e(),j9t=o6e(),M9t=s6e(),L9t=u6e(),q9t=c6e(),N9t=p6e(),U9t=d6e();function G9t(e=!1){let t=[j9t.default,M9t.default,L9t.default,q9t.default,N9t.default,U9t.default,P9t.default,O9t.default,B9t.default,I9t.default,R9t.default];return e?t.push(C9t.default,k9t.default):t.push(T9t.default,D9t.default),t.push(F9t.default),t}fG.default=G9t});var m6e=x(pG=>{"use strict";Object.defineProperty(pG,"__esModule",{value:!0});var Xn=er(),z9t={message:({schemaCode:e})=>(0,Xn.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,Xn._)`{format: ${e}}`},H9t={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:z9t,code(e,t){let{gen:r,data:n,$data:i,schema:a,schemaCode:o,it:s}=e,{opts:u,errSchemaPath:c,schemaEnv:l,self:f}=s;if(!u.validateFormats)return;i?p():d();function p(){let h=r.scopeValue("formats",{ref:f.formats,code:u.code.formats}),v=r.const("fDef",(0,Xn._)`${h}[${o}]`),m=r.let("fType"),b=r.let("format");r.if((0,Xn._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`,()=>r.assign(m,(0,Xn._)`${v}.type || "string"`).assign(b,(0,Xn._)`${v}.validate`),()=>r.assign(m,(0,Xn._)`"string"`).assign(b,v)),e.fail$data((0,Xn.or)(_(),E()));function _(){return u.strictSchema===!1?Xn.nil:(0,Xn._)`${o} && !${b}`}function E(){let T=l.$async?(0,Xn._)`(${v}.async ? await ${b}(${n}) : ${b}(${n}))`:(0,Xn._)`${b}(${n})`,S=(0,Xn._)`(typeof ${b} == "function" ? ${T} : ${b}.test(${n}))`;return(0,Xn._)`${b} && ${b} !== true && ${m} === ${t} && !${S}`}}function d(){let h=f.formats[a];if(!h){_();return}if(h===!0)return;let[v,m,b]=E(h);v===t&&e.pass(T());function _(){if(u.strictSchema===!1){f.logger.warn(S());return}throw new Error(S());function S(){return`unknown format "${a}" ignored in schema at path "${c}"`}}function E(S){let D=S instanceof RegExp?(0,Xn.regexpCode)(S):u.code.formats?(0,Xn._)`${u.code.formats}${(0,Xn.getProperty)(a)}`:void 0,I=r.scopeValue("formats",{key:a,ref:S,code:D});return typeof S=="object"&&!(S instanceof RegExp)?[S.type||"string",S.validate,(0,Xn._)`${I}.validate`]:["string",S,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,Xn._)`await ${b}(${n})`}return typeof m=="function"?(0,Xn._)`${b}(${n})`:(0,Xn._)`${b}.test(${n})`}}}};pG.default=H9t});var g6e=x(dG=>{"use strict";Object.defineProperty(dG,"__esModule",{value:!0});var W9t=m6e(),V9t=[W9t.default];dG.default=V9t});var v6e=x(Y1=>{"use strict";Object.defineProperty(Y1,"__esModule",{value:!0});Y1.contentVocabulary=Y1.metadataVocabulary=void 0;Y1.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Y1.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var b6e=x(hG=>{"use strict";Object.defineProperty(hG,"__esModule",{value:!0});var $9t=T3e(),K9t=N3e(),J9t=h6e(),Y9t=g6e(),x6e=v6e(),X9t=[$9t.default,K9t.default,(0,J9t.default)(),Y9t.default,x6e.metadataVocabulary,x6e.contentVocabulary];hG.default=X9t});var y6e=x(z2=>{"use strict";Object.defineProperty(z2,"__esModule",{value:!0});z2.DiscrError=void 0;var Q9t;(function(e){e.Tag="tag",e.Mapping="mapping"})(Q9t=z2.DiscrError||(z2.DiscrError={}))});var w6e=x(gG=>{"use strict";Object.defineProperty(gG,"__esModule",{value:!0});var X1=er(),mG=y6e(),_6e=y4(),Z9t=_r(),eRt={message:({params:{discrError:e,tagName:t}})=>e===mG.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,X1._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},tRt={keyword:"discriminator",type:"object",schemaType:"object",error:eRt,code(e){let{gen:t,data:r,schema:n,parentSchema:i,it:a}=e,{oneOf:o}=i;if(!a.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,X1._)`${r}${(0,X1.getProperty)(s)}`);t.if((0,X1._)`typeof ${c} == "string"`,()=>l(),()=>e.error(!1,{discrError:mG.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,X1._)`${c} === ${h}`),t.assign(u,f(d[h]));t.else(),e.error(!1,{discrError:mG.DiscrError.Mapping,tag:c,tagName:s}),t.endIf()}function f(d){let h=t.name("valid"),v=e.subschema({keyword:"oneOf",schemaProp:d},h);return e.mergeEvaluated(v,X1.Name),h}function p(){var d;let h={},v=b(i),m=!0;for(let T=0;T<o.length;T++){let S=o[T];S!=null&&S.$ref&&!(0,Z9t.schemaHasRulesButRef)(S,a.self.RULES)&&(S=_6e.resolveRef.call(a.self,a.schemaEnv.root,a.baseId,S==null?void 0:S.$ref),S instanceof _6e.SchemaEnv&&(S=S.schema));let D=(d=S==null?void 0:S.properties)===null||d===void 0?void 0:d[s];if(typeof D!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);m=m&&(v||b(S)),_(D,T)}if(!m)throw new Error(`discriminator: "${s}" must be required`);return h;function b({required:T}){return Array.isArray(T)&&T.includes(s)}function _(T,S){if(T.const)E(T.const,S);else if(T.enum)for(let D of T.enum)E(D,S);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function E(T,S){if(typeof T!="string"||T in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[T]=S}}}};gG.default=tRt});var E6e=x((Myr,rRt)=>{rRt.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 T6e=x((On,S6e)=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.MissingRefError=On.ValidationError=On.CodeGen=On.Name=On.nil=On.stringify=On.str=On._=On.KeywordCxt=void 0;var nRt=y3e(),iRt=b6e(),aRt=w6e(),A6e=E6e(),oRt=["/properties"],R4="http://json-schema.org/draft-07/schema",j4=class extends nRt.default{_addVocabularies(){super._addVocabularies(),iRt.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(aRt.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(A6e,oRt):A6e;this.addMetaSchema(t,R4,!1),this.refs["http://json-schema.org/schema"]=R4}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(R4)?R4:void 0)}};S6e.exports=On=j4;Object.defineProperty(On,"__esModule",{value:!0});On.default=j4;var sRt=F2();Object.defineProperty(On,"KeywordCxt",{enumerable:!0,get:function(){return sRt.KeywordCxt}});var Q1=er();Object.defineProperty(On,"_",{enumerable:!0,get:function(){return Q1._}});Object.defineProperty(On,"str",{enumerable:!0,get:function(){return Q1.str}});Object.defineProperty(On,"stringify",{enumerable:!0,get:function(){return Q1.stringify}});Object.defineProperty(On,"nil",{enumerable:!0,get:function(){return Q1.nil}});Object.defineProperty(On,"Name",{enumerable:!0,get:function(){return Q1.Name}});Object.defineProperty(On,"CodeGen",{enumerable:!0,get:function(){return Q1.CodeGen}});var uRt=v4();Object.defineProperty(On,"ValidationError",{enumerable:!0,get:function(){return uRt.default}});var cRt=x4();Object.defineProperty(On,"MissingRefError",{enumerable:!0,get:function(){return cRt.default}})});var iz=typeof process!="object"||String(process)!=="[object process]"||process.browser;var az={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"]=az||{};function Nt(e,t,r){return t<=e&&e<=r}function p8e(e,t){return e.indexOf(t)!==-1}var Cc=Math.floor;function l_(e){if(e===void 0)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function d8e(e){for(var t=String(e),r=t.length,n=0,i=[];n<r;){var a=t.charCodeAt(n);if(a<55296||a>57343)i.push(a);else if(56320<=a&&a<=57343)i.push(65533);else if(55296<=a&&a<=56319)if(n===r-1)i.push(65533);else{var o=t.charCodeAt(n+1);if(56320<=o&&o<=57343){var s=a&1023,u=o&1023;i.push(65536+(s<<10)+u),n+=1}else i.push(65533)}n+=1}return i}function h8e(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 Do(e){return 0<=e&&e<=127}var Co=Do,ur=-1;function lD(e){this.tokens=[].slice.call(e),this.tokens.reverse()}lD.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():ur},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 Kr=-1;function sr(e,t){if(e)throw TypeError("Decoder error");return t||65533}function bs(e){throw TypeError("The code point "+e+" could not be encoded.")}function m8e(){}m8e.prototype={handler:function(e,t){}};function g8e(){}g8e.prototype={handler:function(e,t){}};function uD(e){return e=String(e).trim().toLowerCase(),Object.prototype.hasOwnProperty.call(cD,e)?cD[e]:null}var oz=[{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"}],cD={};oz.forEach(function(e){e.encodings.forEach(function(t){t.labels.forEach(function(r){cD[r]=t})})});var Na={},Ua={};function Wh(e,t){return t&&t[e]||null}function Vh(e,t){var r=t.indexOf(e);return r===-1?null:r}function Ta(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 v8e(e){if(e>39419&&e<189e3||e>1237575)return null;if(e===7457)return 59335;var t=0,r=0,n=Ta("gb18030-ranges"),i;for(i=0;i<n.length;++i){var a=n[i];if(a[0]<=e)t=a[0],r=a[1];else break}return r+e-t}function x8e(e){if(e===59335)return 7457;var t=0,r=0,n=Ta("gb18030-ranges"),i;for(i=0;i<n.length;++i){var a=n[i];if(a[1]<=e)t=a[1],r=a[0];else break}return r+e-t}function b8e(e){oD=oD||Ta("jis0208").map(function(r,n){return Nt(n,8272,8835)?null:r});var t=oD;return t.indexOf(e)}var oD;function y8e(e){sD=sD||Ta("big5").map(function(r,n){return n<(161-129)*157?null:r});var t=sD;return e===9552||e===9566||e===9569||e===9578||e===21313||e===21317?t.lastIndexOf(e):Vh(e,t)}var sD,sz="utf-8";function Hp(e,t){if(!(this instanceof Hp))throw TypeError("Called as a function. Did you forget 'new'?");e=e!==void 0?String(e):sz,t=l_(t),this._encoding=null,this._decoder=null,this._ignoreBOM=!1,this._BOMseen=!1,this._error_mode="replacement",this._do_not_flush=!1;var r=uD(e);if(r===null||r.name==="replacement")throw RangeError("Unknown encoding: "+e);if(!Ua[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(Hp.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(Hp.prototype,"fatal",{get:function(){return this._error_mode==="fatal"}}),Object.defineProperty(Hp.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}}));Hp.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=l_(r),this._do_not_flush||(this._decoder=Ua[this._encoding.name]({fatal:this._error_mode==="fatal"}),this._BOMseen=!1),this._do_not_flush=Boolean(r.stream);for(var i=new lD(n),a=[],o;;){var s=i.read();if(s===ur||(o=this._decoder.handler(i,s),o===Kr))break;o!==null&&(Array.isArray(o)?a.push.apply(a,o):a.push(o))}if(!this._do_not_flush){do{if(o=this._decoder.handler(i,i.read()),o===Kr)break;o!==null&&(Array.isArray(o)?a.push.apply(a,o):a.push(o))}while(!i.endOfStream());this._decoder=null}function u(c){return p8e(["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)),h8e(c)}return u.call(this,a)};function dv(e,t){if(!(this instanceof dv))throw TypeError("Called as a function. Did you forget 'new'?");t=l_(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):sz;var n=uD(e);if(n===null||n.name==="replacement")throw RangeError("Unknown encoding: "+e);if(!Na[n.name])throw Error("Encoder not present. Did you forget to include encoding-indexes.js first?");r._encoding=n}else r._encoding=uD("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(dv.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}});dv.prototype.encode=function(t,r){t=t===void 0?"":String(t),r=l_(r),this._do_not_flush||(this._encoder=Na[this._encoding.name]({fatal:this._fatal==="fatal"})),this._do_not_flush=Boolean(r.stream);for(var n=new lD(d8e(t)),i=[],a;;){var o=n.read();if(o===ur||(a=this._encoder.handler(n,o),a===Kr))break;Array.isArray(a)?i.push.apply(i,a):i.push(a)}if(!this._do_not_flush){for(;a=this._encoder.handler(n,n.read()),a!==Kr;)Array.isArray(a)?i.push.apply(i,a):i.push(a);this._encoder=null}return new Uint8Array(i)};function _8e(e){var t=e.fatal,r=0,n=0,i=0,a=128,o=191;this.handler=function(s,u){if(u===ur&&i!==0)return i=0,sr(t);if(u===ur)return Kr;if(i===0){if(Nt(u,0,127))return u;if(Nt(u,194,223))i=1,r=u&31;else if(Nt(u,224,239))u===224&&(a=160),u===237&&(o=159),i=2,r=u&15;else if(Nt(u,240,244))u===240&&(a=144),u===244&&(o=143),i=3,r=u&7;else return sr(t);return null}if(!Nt(u,a,o))return r=i=n=0,a=128,o=191,s.prepend(u),sr(t);if(a=128,o=191,r=r<<6|u&63,n+=1,n!==i)return null;var c=r;return r=i=n=0,c}}function w8e(e){var t=e.fatal;this.handler=function(r,n){if(n===ur)return Kr;if(Co(n))return n;var i,a;Nt(n,128,2047)?(i=1,a=192):Nt(n,2048,65535)?(i=2,a=224):Nt(n,65536,1114111)&&(i=3,a=240);for(var o=[(n>>6*i)+a];i>0;){var s=n>>6*(i-1);o.push(128|s&63),i-=1}return o}}Na["UTF-8"]=function(e){return new w8e(e)};Ua["UTF-8"]=function(e){return new _8e(e)};function E8e(e,t){var r=t.fatal;this.handler=function(n,i){if(i===ur)return Kr;if(Do(i))return i;var a=e[i-128];return a===null?sr(r):a}}function A8e(e,t){var r=t.fatal;this.handler=function(n,i){if(i===ur)return Kr;if(Co(i))return i;var a=Vh(i,e);return a===null&&bs(i),a+128}}(function(){"encoding-indexes"in globalThis&&oz.forEach(function(e){e.heading==="Legacy single-byte encodings"&&e.encodings.forEach(function(t){var r=t.name,n=Ta(r.toLowerCase());Ua[r]=function(i){return new E8e(n,i)},Na[r]=function(i){return new A8e(n,i)}})})})();Ua.GBK=function(e){return new uz(e)};Na.GBK=function(e){return new cz(e,!0)};function uz(e){var t=e.fatal,r=0,n=0,i=0;this.handler=function(a,o){if(o===ur&&r===0&&n===0&&i===0)return Kr;o===ur&&(r!==0||n!==0||i!==0)&&(r=0,n=0,i=0,sr(t));var s;if(i!==0){s=null,Nt(o,48,57)&&(s=v8e((((r-129)*10+n-48)*126+i-129)*10+o-48));var u=[n,i,o];return r=0,n=0,i=0,s===null?(a.prepend(u),sr(t)):s}if(n!==0)return Nt(o,129,254)?(i=o,null):(a.prepend([n,o]),r=0,n=0,sr(t));if(r!==0){if(Nt(o,48,57))return n=o,null;var c=r,l=null;r=0;var f=o<127?64:65;return(Nt(o,64,126)||Nt(o,128,254))&&(l=(c-129)*190+(o-f)),s=l===null?null:Wh(l,Ta("gb18030")),s===null&&Do(o)&&a.prepend(o),s===null?sr(t):s}return Do(o)?o:o===128?8364:Nt(o,129,254)?(r=o,null):sr(t)}}function cz(e,t){var r=e.fatal;this.handler=function(n,i){if(i===ur)return Kr;if(Co(i))return i;if(i===58853)return bs(i);if(t&&i===8364)return 128;var a=Vh(i,Ta("gb18030"));if(a!==null){var o=Cc(a/190)+129,s=a%190,u=s<63?64:65;return[o,s+u]}if(t)return bs(i);a=x8e(i);var c=Cc(a/10/126/10);a=a-c*10*126*10;var l=Cc(a/10/126);a=a-l*10*126;var f=Cc(a/10),p=a-f*10;return[c+129,l+48,f+129,p+48]}}Na.gb18030=function(e){return new cz(e)};Ua.gb18030=function(e){return new uz(e)};function S8e(e){var t=e.fatal,r=0;this.handler=function(n,i){if(i===ur&&r!==0)return r=0,sr(t);if(i===ur&&r===0)return Kr;if(r!==0){var a=r,o=null;r=0;var s=i<127?64:98;switch((Nt(i,64,126)||Nt(i,161,254))&&(o=(a-129)*157+(i-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:Wh(o,Ta("big5"));return u===null&&Do(i)&&n.prepend(i),u===null?sr(t):u}return Do(i)?i:Nt(i,129,254)?(r=i,null):sr(t)}}function T8e(e){var t=e.fatal;this.handler=function(r,n){if(n===ur)return Kr;if(Co(n))return n;var i=y8e(n);if(i===null)return bs(n);var a=Cc(i/157)+129;if(a<161)return bs(n);var o=i%157,s=o<63?64:98;return[a,o+s]}}Na.Big5=function(e){return new T8e(e)};Ua.Big5=function(e){return new S8e(e)};function C8e(e){var t=e.fatal,r=!1,n=0;this.handler=function(i,a){if(a===ur&&n!==0)return n=0,sr(t);if(a===ur&&n===0)return Kr;if(n===142&&Nt(a,161,223))return n=0,65377-161+a;if(n===143&&Nt(a,161,254))return r=!0,n=a,null;if(n!==0){var o=n;n=0;var s=null;return Nt(o,161,254)&&Nt(a,161,254)&&(s=Wh((o-161)*94+(a-161),Ta(r?"jis0212":"jis0208"))),r=!1,Nt(a,161,254)||i.prepend(a),s===null?sr(t):s}return Do(a)?a:a===142||a===143||Nt(a,161,254)?(n=a,null):sr(t)}}function D8e(e){var t=e.fatal;this.handler=function(r,n){if(n===ur)return Kr;if(Co(n))return n;if(n===165)return 92;if(n===8254)return 126;if(Nt(n,65377,65439))return[142,n-65377+161];n===8722&&(n=65293);var i=Vh(n,Ta("jis0208"));if(i===null)return bs(n);var a=Cc(i/94)+161,o=i%94+161;return[a,o]}}Na["EUC-JP"]=function(e){return new D8e(e)};Ua["EUC-JP"]=function(e){return new C8e(e)};function k8e(e){var t=e.fatal,r={ASCII:0,Roman:1,Katakana:2,LeadByte:3,TrailByte:4,EscapeStart:5,Escape:6},n=r.ASCII,i=r.ASCII,a=0,o=!1;this.handler=function(s,u){switch(n){default:case r.ASCII:return u===27?(n=r.EscapeStart,null):Nt(u,0,127)&&u!==14&&u!==15&&u!==27?(o=!1,u):u===ur?Kr:(o=!1,sr(t));case r.Roman:return u===27?(n=r.EscapeStart,null):u===92?(o=!1,165):u===126?(o=!1,8254):Nt(u,0,127)&&u!==14&&u!==15&&u!==27&&u!==92&&u!==126?(o=!1,u):u===ur?Kr:(o=!1,sr(t));case r.Katakana:return u===27?(n=r.EscapeStart,null):Nt(u,33,95)?(o=!1,65377-33+u):u===ur?Kr:(o=!1,sr(t));case r.LeadByte:return u===27?(n=r.EscapeStart,null):Nt(u,33,126)?(o=!1,a=u,n=r.TrailByte,null):u===ur?Kr:(o=!1,sr(t));case r.TrailByte:if(u===27)return n=r.EscapeStart,sr(t);if(Nt(u,33,126)){n=r.LeadByte;var c=(a-33)*94+u-33,l=Wh(c,Ta("jis0208"));return l===null?sr(t):l}return u===ur?(n=r.LeadByte,s.prepend(u),sr(t)):(n=r.LeadByte,sr(t));case r.EscapeStart:return u===36||u===40?(a=u,n=r.Escape,null):(s.prepend(u),o=!1,n=i,sr(t));case r.Escape:var f=a;a=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?sr(t):null}return s.prepend([f,u]),o=!1,n=i,sr(t)}}}function F8e(e){var t=e.fatal,r={ASCII:0,Roman:1,jis0208:2},n=r.ASCII;this.handler=function(i,a){if(a===ur&&n!==r.ASCII)return i.prepend(a),n=r.ASCII,[27,40,66];if(a===ur&&n===r.ASCII)return Kr;if((n===r.ASCII||n===r.Roman)&&(a===14||a===15||a===27))return bs(65533);if(n===r.ASCII&&Co(a))return a;if(n===r.Roman&&(Co(a)&&a!==92&&a!==126||a==165||a==8254)){if(Co(a))return a;if(a===165)return 92;if(a===8254)return 126}if(Co(a)&&n!==r.ASCII)return i.prepend(a),n=r.ASCII,[27,40,66];if((a===165||a===8254)&&n!==r.Roman)return i.prepend(a),n=r.Roman,[27,40,74];a===8722&&(a=65293);var o=Vh(a,Ta("jis0208"));if(o===null)return bs(a);if(n!==r.jis0208)return i.prepend(a),n=r.jis0208,[27,36,66];var s=Cc(o/94)+33,u=o%94+33;return[s,u]}}Na["ISO-2022-JP"]=function(e){return new F8e(e)};Ua["ISO-2022-JP"]=function(e){return new k8e(e)};function B8e(e){var t=e.fatal,r=0;this.handler=function(n,i){if(i===ur&&r!==0)return r=0,sr(t);if(i===ur&&r===0)return Kr;if(r!==0){var a=r,o=null;r=0;var s=i<127?64:65,u=a<160?129:193;if((Nt(i,64,126)||Nt(i,128,252))&&(o=(a-u)*188+i-s),Nt(o,8836,10715))return 57344-8836+o;var c=o===null?null:Wh(o,Ta("jis0208"));return c===null&&Do(i)&&n.prepend(i),c===null?sr(t):c}return Do(i)||i===128?i:Nt(i,161,223)?65377-161+i:Nt(i,129,159)||Nt(i,224,252)?(r=i,null):sr(t)}}function P8e(e){var t=e.fatal;this.handler=function(r,n){if(n===ur)return Kr;if(Co(n)||n===128)return n;if(n===165)return 92;if(n===8254)return 126;if(Nt(n,65377,65439))return n-65377+161;n===8722&&(n=65293);var i=b8e(n);if(i===null)return bs(n);var a=Cc(i/188),o=a<31?129:193,s=i%188,u=s<63?64:65;return[a+o,s+u]}}Na.Shift_JIS=function(e){return new P8e(e)};Ua.Shift_JIS=function(e){return new B8e(e)};function O8e(e){var t=e.fatal,r=0;this.handler=function(n,i){if(i===ur&&r!==0)return r=0,sr(t);if(i===ur&&r===0)return Kr;if(r!==0){var a=r,o=null;r=0,Nt(i,65,254)&&(o=(a-129)*190+(i-65));var s=o===null?null:Wh(o,Ta("euc-kr"));return o===null&&Do(i)&&n.prepend(i),s===null?sr(t):s}return Do(i)?i:Nt(i,129,254)?(r=i,null):sr(t)}}function I8e(e){var t=e.fatal;this.handler=function(r,n){if(n===ur)return Kr;if(Co(n))return n;var i=Vh(n,Ta("euc-kr"));if(i===null)return bs(n);var a=Cc(i/190)+129,o=i%190+65;return[a,o]}}Na["EUC-KR"]=function(e){return new I8e(e)};Ua["EUC-KR"]=function(e){return new O8e(e)};function c_(e,t){var r=e>>8,n=e&255;return t?[r,n]:[n,r]}function lz(e,t){var r=t.fatal,n=null,i=null;this.handler=function(a,o){if(o===ur&&(n!==null||i!==null))return sr(r);if(o===ur&&n===null&&i===null)return Kr;if(n===null)return n=o,null;var s;if(e?s=(n<<8)+o:s=(o<<8)+n,n=null,i!==null){var u=i;return i=null,Nt(s,56320,57343)?65536+(u-55296)*1024+(s-56320):(a.prepend(c_(s,e)),sr(r))}return Nt(s,55296,56319)?(i=s,null):Nt(s,56320,57343)?sr(r):s}}function fz(e,t){var r=t.fatal;this.handler=function(n,i){if(i===ur)return Kr;if(Nt(i,0,65535))return c_(i,e);var a=c_((i-65536>>10)+55296,e),o=c_((i-65536&1023)+56320,e);return a.concat(o)}}Na["UTF-16BE"]=function(e){return new fz(!0,e)};Ua["UTF-16BE"]=function(e){return new lz(!0,e)};Na["UTF-16LE"]=function(e){return new fz(!1,e)};Ua["UTF-16LE"]=function(e){return new lz(!1,e)};function R8e(e){var t=e.fatal;this.handler=function(r,n){return n===ur?Kr:Do(n)?n:63360+n-128}}function j8e(e){var t=e.fatal;this.handler=function(r,n){return n===ur?Kr:Co(n)?n:Nt(n,63360,63487)?n-63360+128:bs(n)}}Na["x-user-defined"]=function(e){return new j8e(e)};Ua["x-user-defined"]=function(e){return new R8e(e)};function hv(e){return Buffer.from(e).toString("base64")}function fD(e){return Buffer.from(e,"base64").toString("ascii")}var aV=Lt(nV(),1),oV=Lt(wv(),1);function iV(e){return Buffer.isBuffer(e)?new Uint8Array(e).buffer:e}function YDe(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,aV.default)(n,r,t)}function sV(e,t){let r=YDe(e,t);return new Promise(n=>{let i=[];r.on("data",a=>i.push(a)),r.on("end",()=>{let a=Buffer.concat(i);n(iV(a))})})}var qte=Lt(Lte(),1),mB=["image/png","image/jpeg","image/gif"];async function gB(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 u7e(r,t)}function u7e(e,t){return new Promise(r=>(0,qte.default)(e,t,(n,i)=>{if(n)throw n;let a=[...i.shape],o=i.shape.length===4?i.shape.shift():1,s=i.data instanceof Buffer?new Uint8Array(i.data):i.data;r({shape:a,data:s,width:i.shape[0],height:i.shape[1],components:i.shape[2],layers:o?[o]:[]})}))}async function ho(e,t,r,n){return n._parse(e,t,r,n)}function Rt(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var Ou={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Ute=Ou.self||Ou.window||Ou.global||{},Gte=Ou.window||Ou.self||Ou.global||{},zte=Ou.global||Ou.self||Ou.window||{},Hte=Ou.document||{};var jr=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Nte=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),c7e=Nte&&parseFloat(Nte[1])||0;function xf(e){return xf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xf(e)}function vB(e,t){if(xf(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(xf(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xB(e){var t=vB(e,"string");return xf(t)==="symbol"?t:String(t)}function St(e,t,r){return t=xB(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bB(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function Is(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||bB()}var l7e=globalThis.self||globalThis.window||globalThis.global,M0=globalThis.window||globalThis.self||globalThis.global,f7e=globalThis.document||{},ld=globalThis.process||{},p7e=globalThis.console,vUt=globalThis.navigator||{};var iE="4.2.0-alpha.6",yUt=Is();function d7e(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var aE=class{constructor(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";St(this,"storage",void 0),St(this,"id",void 0),St(this,"config",void 0),this.storage=d7e(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="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function Vte(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}function oE(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));let a=e.width*r,o=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}var sE;(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"})(sE||(sE={}));var h7e=10;function $te(e){return typeof e!="string"?e:(e=e.toUpperCase(),sE[e]||sE.WHITE)}function Kte(e,t,r){if(!Is&&typeof e=="string"){if(t){let n=$te(t);e="\x1B[".concat(n,"m").concat(e,"\x1B[39m")}if(r){let n=$te(r);e="\x1B[".concat(n+h7e,"m").concat(e,"\x1B[49m")}}return e}function Jte(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let a of n){let o=i[a];typeof o=="function"&&(t.find(s=>a===s)||(i[a]=o.bind(e)))}}function L0(e,t){if(!e)throw new Error(t||"Assertion failed")}function fd(){let e;if(Is()&&M0.performance){var t,r;e=M0===null||M0===void 0||(t=M0.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in ld){var n;let i=ld===null||ld===void 0||(n=ld.hrtime)===null||n===void 0?void 0:n.call(ld);e=i[0]*1e3+i[1]/1e6}else e=Date.now();return e}var q0={debug:Is()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},m7e={enabled:!0,level:0};function qo(){}var Yte={},Xte={once:!0},Iu=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};St(this,"id",void 0),St(this,"VERSION",iE),St(this,"_startTs",fd()),St(this,"_deltaTs",fd()),St(this,"_storage",void 0),St(this,"userData",{}),St(this,"LOG_THROTTLE_TIMEOUT",0),this.id=t,this.userData={},this._storage=new aE("__probe-".concat(this.id,"__"),m7e),this.timeStamp("".concat(this.id," started")),Jte(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((fd()-this._startTs).toPrecision(10))}getDelta(){return Number((fd()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){L0(t,r)}warn(t){return this._getLogFunction(0,t,q0.warn,arguments,Xte)}error(t){return this._getLogFunction(0,t,q0.error,arguments)}deprecated(t,r){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(t,r){return this.error("`".concat(t,"` has been removed. Use `").concat(r,"` instead"))}probe(t,r){return this._getLogFunction(t,r,q0.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,q0.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,q0.debug||q0.info,arguments,Xte)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||qo,n&&[n],{tag:b7e(r)}):qo}image(t){let{logLevel:r,priority:n,image:i,message:a="",scale:o=1}=t;return this._shouldLog(r||n)?Is()?x7e({image:i,message:a,scale:o}):v7e({image:i,message:a,scale:o}):qo}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||qo)}group(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},i=Qte({logLevel:t,message:r,opts:n}),{collapsed:a}=n;return i.method=(a?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||qo)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Zte(t)}_getLogFunction(t,r,n,i,a){if(this._shouldLog(t)){a=Qte({logLevel:t,message:r,args:i,opts:a}),n=n||a.method,L0(n),a.total=this.getTotal(),a.delta=this.getDelta(),this._deltaTs=fd();let o=a.tag||a.message;if(a.once&&o)if(!Yte[o])Yte[o]=fd();else return qo;return r=g7e(this.id,a.message,a),n.bind(console,r,...a.args)}return qo}};St(Iu,"VERSION",iE);function Zte(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 L0(Number.isFinite(t)&&t>=0),t}function Qte(e){let{logLevel:t,message:r}=e;e.logLevel=Zte(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 i=typeof e.message;return L0(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}function g7e(e,t,r){if(typeof t=="string"){let n=r.time?Vte(Wte(r.total)):"";t=r.time?"".concat(e,": ").concat(n," ").concat(t):"".concat(e,": ").concat(t),t=Kte(t,r.color,r.background)}return t}function v7e(e){let{image:t,message:r="",scale:n=1}=e;return console.warn("removed"),qo}function x7e(e){let{image:t,message:r="",scale:n=1}=e;if(typeof t=="string"){let a=new Image;return a.onload=()=>{let o=oE(a,r,n);console.log(...o)},a.src=t,qo}let i=t.nodeName||"";if(i.toLowerCase()==="img")return console.log(...oE(t,r,n)),qo;if(i.toLowerCase()==="canvas"){let a=new Image;return a.onload=()=>console.log(...oE(a,r,n)),a.src=t.toDataURL(),qo}return qo}function b7e(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var $Ut=new Iu({id:"@probe.gl/log"});function yB(e,t){return ere(e||{},t)}function ere(e,t,r=0){if(r>3)return t;let n={...e};for(let[i,a]of Object.entries(t))a&&typeof a=="object"&&!Array.isArray(a)?n[i]=ere(n[i]||{},t[i],r+1):n[i]=t[i];return n}function xx(e){var t;globalThis.loaders||(globalThis.loaders={}),(t=globalThis.loaders).modules||(t.modules={}),Object.assign(globalThis.loaders.modules,e)}function _B(e){var r,n;return((n=(r=globalThis.loaders)==null?void 0:r.modules)==null?void 0:n[e])||null}var tre="latest";function y7e(){var e;return(e=globalThis._loadersgl_)!=null&&e.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.0-alpha.6"),globalThis._loadersgl_.version}var pd=y7e();function Wi(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var Ru={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},eGt=Ru.self||Ru.window||Ru.global||{},tGt=Ru.window||Ru.self||Ru.global||{},rGt=Ru.global||Ru.self||Ru.window||{},nGt=Ru.document||{};var Di=typeof process!="object"||String(process)!=="[object process]"||process.browser,bx=typeof importScripts=="function",nre=typeof window<"u"&&typeof window.orientation<"u",rre=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),iGt=rre&&parseFloat(rre[1])||0;var yx=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(t,r){this.name=t,this.workerThread=r,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(t,r){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:r})}done(t){Wi(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){Wi(this.isRunning),this.isRunning=!1,this._reject(t)}};var dd={};ui(dd,{NodeWorker:()=>wx,parentPort:()=>_7e});var _x=Lt(require("worker_threads"),1);pv(dd,require("worker_threads"));var _7e=_x==null?void 0:_x.parentPort,wx=_x.Worker;var wB=new Map;function ire(e){Wi(e.source&&!e.url||!e.source&&e.url);let t=wB.get(e.source||e.url);return t||(e.url&&(t=w7e(e.url),wB.set(e.url,t)),e.source&&(t=are(e.source),wB.set(e.source,t))),Wi(t),t}function w7e(e){if(!e.startsWith("http"))return e;let t=E7e(e);return are(t)}function are(e){let t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function E7e(e){return`try {
|
|
155
|
+
deps: ${r}}`};var r9t={keyword:"dependencies",type:"object",schemaType:"object",error:Ec.error,code(e){let[t,r]=n9t(e);K3e(e,t),J3e(e,r)}};function n9t({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let i=Array.isArray(e[n])?t:r;i[n]=e[n]}return[t,r]}function K3e(e,t=e.schema){let{gen:r,data:n,it:i}=e;if(Object.keys(t).length===0)return;let a=r.let("missing");for(let o in t){let s=t[o];if(s.length===0)continue;let u=(0,G2.propertyInData)(r,n,o,i.opts.ownProperties);e.setParams({property:o,depsCount:s.length,deps:s.join(", ")}),i.allErrors?r.if(u,()=>{for(let c of s)(0,G2.checkReportMissingProp)(e,c)}):(r.if((0,QU._)`${u} && (${(0,G2.checkMissingProp)(e,s,a)})`),(0,G2.reportMissingProp)(e,a),r.else())}}Ec.validatePropertyDeps=K3e;function J3e(e,t=e.schema){let{gen:r,data:n,keyword:i,it:a}=e,o=r.name("valid");for(let s in t)(0,t9t.alwaysValidSchema)(a,t[s])||(r.if((0,G2.propertyInData)(r,n,s,a.opts.ownProperties),()=>{let u=e.subschema({keyword:i,schemaProp:s},o);e.mergeValidEvaluated(u,o)},()=>r.var(o,!0)),e.ok(o))}Ec.validateSchemaDeps=J3e;Ec.default=r9t});var Q3e=x(ZU=>{"use strict";Object.defineProperty(ZU,"__esModule",{value:!0});var X3e=er(),i9t=_r(),a9t={message:"property name must be valid",params:({params:e})=>(0,X3e._)`{propertyName: ${e.propertyName}}`},o9t={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:a9t,code(e){let{gen:t,schema:r,data:n,it:i}=e;if((0,i9t.alwaysValidSchema)(i,r))return;let a=t.name("valid");t.forIn("key",n,o=>{e.setParams({propertyName:o}),e.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},a),t.if((0,X3e.not)(a),()=>{e.error(!0),i.allErrors||t.break()})}),e.ok(a)}};ZU.default=o9t});var tG=x(eG=>{"use strict";Object.defineProperty(eG,"__esModule",{value:!0});var F4=fs(),cu=er(),s9t=Ml(),B4=_r(),u9t={message:"must NOT have additional properties",params:({params:e})=>(0,cu._)`{additionalProperty: ${e.additionalProperty}}`},c9t={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:u9t,code(e){let{gen:t,schema:r,parentSchema:n,data:i,errsCount:a,it:o}=e;if(!a)throw new Error("ajv implementation error");let{allErrors:s,opts:u}=o;if(o.props=!0,u.removeAdditional!=="all"&&(0,B4.alwaysValidSchema)(o,r))return;let c=(0,F4.allSchemaProperties)(n.properties),l=(0,F4.allSchemaProperties)(n.patternProperties);f(),e.ok((0,cu._)`${a} === ${s9t.default.errors}`);function f(){t.forIn("key",i,m=>{!c.length&&!l.length?h(m):t.if(p(m),()=>h(m))})}function p(m){let b;if(c.length>8){let _=(0,B4.schemaRefOrVal)(o,n.properties,"properties");b=(0,F4.isOwnProperty)(t,_,m)}else c.length?b=(0,cu.or)(...c.map(_=>(0,cu._)`${m} === ${_}`)):b=cu.nil;return l.length&&(b=(0,cu.or)(b,...l.map(_=>(0,cu._)`${(0,F4.usePattern)(e,_)}.test(${m})`))),(0,cu.not)(b)}function d(m){t.code((0,cu._)`delete ${i}[${m}]`)}function h(m){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){d(m);return}if(r===!1){e.setParams({additionalProperty:m}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,B4.alwaysValidSchema)(o,r)){let b=t.name("valid");u.removeAdditional==="failing"?(v(m,b,!1),t.if((0,cu.not)(b),()=>{e.reset(),d(m)})):(v(m,b),s||t.if((0,cu.not)(b),()=>t.break()))}}function v(m,b,_){let E={keyword:"additionalProperties",dataProp:m,dataPropType:B4.Type.Str};_===!1&&Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(E,b)}}};eG.default=c9t});var t6e=x(nG=>{"use strict";Object.defineProperty(nG,"__esModule",{value:!0});var l9t=F2(),Z3e=fs(),rG=_r(),e6e=tG(),f9t={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:i,it:a}=e;a.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&e6e.default.code(new l9t.KeywordCxt(a,e6e.default,"additionalProperties"));let o=(0,Z3e.allSchemaProperties)(r);for(let f of o)a.definedProperties.add(f);a.opts.unevaluated&&o.length&&a.props!==!0&&(a.props=rG.mergeEvaluated.props(t,(0,rG.toHash)(o),a.props));let s=o.filter(f=>!(0,rG.alwaysValidSchema)(a,r[f]));if(s.length===0)return;let u=t.name("valid");for(let f of s)c(f)?l(f):(t.if((0,Z3e.propertyInData)(t,i,f,a.opts.ownProperties)),l(f),a.allErrors||t.else().var(u,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(u);function c(f){return a.opts.useDefaults&&!a.compositeRule&&r[f].default!==void 0}function l(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},u)}}};nG.default=f9t});var a6e=x(iG=>{"use strict";Object.defineProperty(iG,"__esModule",{value:!0});var r6e=fs(),P4=er(),n6e=_r(),i6e=_r(),p9t={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:i,it:a}=e,{opts:o}=a,s=(0,r6e.allSchemaProperties)(r),u=s.filter(v=>(0,n6e.alwaysValidSchema)(a,r[v]));if(s.length===0||u.length===s.length&&(!a.opts.unevaluated||a.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&i.properties,l=t.name("valid");a.props!==!0&&!(a.props instanceof P4.Name)&&(a.props=(0,i6e.evaluatedPropsToName)(t,a.props));let{props:f}=a;p();function p(){for(let v of s)c&&d(v),a.allErrors?h(v):(t.var(l,!0),h(v),t.if(l))}function d(v){for(let m in c)new RegExp(v).test(m)&&(0,n6e.checkStrictMode)(a,`property ${m} matches pattern ${v} (use allowMatchingProperties)`)}function h(v){t.forIn("key",n,m=>{t.if((0,P4._)`${(0,r6e.usePattern)(e,v)}.test(${m})`,()=>{let b=u.includes(v);b||e.subschema({keyword:"patternProperties",schemaProp:v,dataProp:m,dataPropType:i6e.Type.Str},l),a.opts.unevaluated&&f!==!0?t.assign((0,P4._)`${f}[${m}]`,!0):!b&&!a.allErrors&&t.if((0,P4.not)(l),()=>t.break())})})}}};iG.default=p9t});var o6e=x(aG=>{"use strict";Object.defineProperty(aG,"__esModule",{value:!0});var d9t=_r(),h9t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,d9t.alwaysValidSchema)(n,r)){e.fail();return}let i=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),e.failResult(i,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};aG.default=h9t});var s6e=x(oG=>{"use strict";Object.defineProperty(oG,"__esModule",{value:!0});var m9t=fs(),g9t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:m9t.validateUnion,error:{message:"must match a schema in anyOf"}};oG.default=g9t});var u6e=x(sG=>{"use strict";Object.defineProperty(sG,"__esModule",{value:!0});var O4=er(),v9t=_r(),x9t={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,O4._)`{passingSchemas: ${e.passing}}`},b9t={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:x9t,code(e){let{gen:t,schema:r,parentSchema:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let a=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(){a.forEach((l,f)=>{let p;(0,v9t.alwaysValidSchema)(i,l)?t.var(u,!0):p=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},u),f>0&&t.if((0,O4._)`${u} && ${o}`).assign(o,!1).assign(s,(0,O4._)`[${s}, ${f}]`).else(),t.if(u,()=>{t.assign(o,!0),t.assign(s,f),p&&e.mergeEvaluated(p,O4.Name)})})}}};sG.default=b9t});var c6e=x(uG=>{"use strict";Object.defineProperty(uG,"__esModule",{value:!0});var y9t=_r(),_9t={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 i=t.name("valid");r.forEach((a,o)=>{if((0,y9t.alwaysValidSchema)(n,a))return;let s=e.subschema({keyword:"allOf",schemaProp:o},i);e.ok(i),e.mergeEvaluated(s)})}};uG.default=_9t});var p6e=x(cG=>{"use strict";Object.defineProperty(cG,"__esModule",{value:!0});var I4=er(),f6e=_r(),w9t={message:({params:e})=>(0,I4.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,I4._)`{failingKeyword: ${e.ifClause}}`},E9t={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:w9t,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,f6e.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=l6e(n,"then"),a=l6e(n,"else");if(!i&&!a)return;let o=t.let("valid",!0),s=t.name("_valid");if(u(),e.reset(),i&&a){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,c("then",l),c("else",l))}else i?t.if(s,c("then")):t.if((0,I4.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,I4._)`${l}`):e.setParams({ifClause:l})}}}};function l6e(e,t){let r=e.schema[t];return r!==void 0&&!(0,f6e.alwaysValidSchema)(e,r)}cG.default=E9t});var d6e=x(lG=>{"use strict";Object.defineProperty(lG,"__esModule",{value:!0});var A9t=_r(),S9t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,A9t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};lG.default=S9t});var h6e=x(fG=>{"use strict";Object.defineProperty(fG,"__esModule",{value:!0});var T9t=$U(),C9t=H3e(),D9t=KU(),k9t=V3e(),F9t=$3e(),B9t=Y3e(),P9t=Q3e(),O9t=tG(),I9t=t6e(),R9t=a6e(),j9t=o6e(),M9t=s6e(),L9t=u6e(),q9t=c6e(),N9t=p6e(),U9t=d6e();function G9t(e=!1){let t=[j9t.default,M9t.default,L9t.default,q9t.default,N9t.default,U9t.default,P9t.default,O9t.default,B9t.default,I9t.default,R9t.default];return e?t.push(C9t.default,k9t.default):t.push(T9t.default,D9t.default),t.push(F9t.default),t}fG.default=G9t});var m6e=x(pG=>{"use strict";Object.defineProperty(pG,"__esModule",{value:!0});var Xn=er(),z9t={message:({schemaCode:e})=>(0,Xn.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,Xn._)`{format: ${e}}`},H9t={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:z9t,code(e,t){let{gen:r,data:n,$data:i,schema:a,schemaCode:o,it:s}=e,{opts:u,errSchemaPath:c,schemaEnv:l,self:f}=s;if(!u.validateFormats)return;i?p():d();function p(){let h=r.scopeValue("formats",{ref:f.formats,code:u.code.formats}),v=r.const("fDef",(0,Xn._)`${h}[${o}]`),m=r.let("fType"),b=r.let("format");r.if((0,Xn._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`,()=>r.assign(m,(0,Xn._)`${v}.type || "string"`).assign(b,(0,Xn._)`${v}.validate`),()=>r.assign(m,(0,Xn._)`"string"`).assign(b,v)),e.fail$data((0,Xn.or)(_(),E()));function _(){return u.strictSchema===!1?Xn.nil:(0,Xn._)`${o} && !${b}`}function E(){let T=l.$async?(0,Xn._)`(${v}.async ? await ${b}(${n}) : ${b}(${n}))`:(0,Xn._)`${b}(${n})`,S=(0,Xn._)`(typeof ${b} == "function" ? ${T} : ${b}.test(${n}))`;return(0,Xn._)`${b} && ${b} !== true && ${m} === ${t} && !${S}`}}function d(){let h=f.formats[a];if(!h){_();return}if(h===!0)return;let[v,m,b]=E(h);v===t&&e.pass(T());function _(){if(u.strictSchema===!1){f.logger.warn(S());return}throw new Error(S());function S(){return`unknown format "${a}" ignored in schema at path "${c}"`}}function E(S){let D=S instanceof RegExp?(0,Xn.regexpCode)(S):u.code.formats?(0,Xn._)`${u.code.formats}${(0,Xn.getProperty)(a)}`:void 0,I=r.scopeValue("formats",{key:a,ref:S,code:D});return typeof S=="object"&&!(S instanceof RegExp)?[S.type||"string",S.validate,(0,Xn._)`${I}.validate`]:["string",S,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,Xn._)`await ${b}(${n})`}return typeof m=="function"?(0,Xn._)`${b}(${n})`:(0,Xn._)`${b}.test(${n})`}}}};pG.default=H9t});var g6e=x(dG=>{"use strict";Object.defineProperty(dG,"__esModule",{value:!0});var W9t=m6e(),V9t=[W9t.default];dG.default=V9t});var v6e=x(Y1=>{"use strict";Object.defineProperty(Y1,"__esModule",{value:!0});Y1.contentVocabulary=Y1.metadataVocabulary=void 0;Y1.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Y1.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var b6e=x(hG=>{"use strict";Object.defineProperty(hG,"__esModule",{value:!0});var $9t=T3e(),K9t=N3e(),J9t=h6e(),Y9t=g6e(),x6e=v6e(),X9t=[$9t.default,K9t.default,(0,J9t.default)(),Y9t.default,x6e.metadataVocabulary,x6e.contentVocabulary];hG.default=X9t});var y6e=x(z2=>{"use strict";Object.defineProperty(z2,"__esModule",{value:!0});z2.DiscrError=void 0;var Q9t;(function(e){e.Tag="tag",e.Mapping="mapping"})(Q9t=z2.DiscrError||(z2.DiscrError={}))});var w6e=x(gG=>{"use strict";Object.defineProperty(gG,"__esModule",{value:!0});var X1=er(),mG=y6e(),_6e=y4(),Z9t=_r(),eRt={message:({params:{discrError:e,tagName:t}})=>e===mG.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,X1._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},tRt={keyword:"discriminator",type:"object",schemaType:"object",error:eRt,code(e){let{gen:t,data:r,schema:n,parentSchema:i,it:a}=e,{oneOf:o}=i;if(!a.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,X1._)`${r}${(0,X1.getProperty)(s)}`);t.if((0,X1._)`typeof ${c} == "string"`,()=>l(),()=>e.error(!1,{discrError:mG.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,X1._)`${c} === ${h}`),t.assign(u,f(d[h]));t.else(),e.error(!1,{discrError:mG.DiscrError.Mapping,tag:c,tagName:s}),t.endIf()}function f(d){let h=t.name("valid"),v=e.subschema({keyword:"oneOf",schemaProp:d},h);return e.mergeEvaluated(v,X1.Name),h}function p(){var d;let h={},v=b(i),m=!0;for(let T=0;T<o.length;T++){let S=o[T];S!=null&&S.$ref&&!(0,Z9t.schemaHasRulesButRef)(S,a.self.RULES)&&(S=_6e.resolveRef.call(a.self,a.schemaEnv.root,a.baseId,S==null?void 0:S.$ref),S instanceof _6e.SchemaEnv&&(S=S.schema));let D=(d=S==null?void 0:S.properties)===null||d===void 0?void 0:d[s];if(typeof D!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);m=m&&(v||b(S)),_(D,T)}if(!m)throw new Error(`discriminator: "${s}" must be required`);return h;function b({required:T}){return Array.isArray(T)&&T.includes(s)}function _(T,S){if(T.const)E(T.const,S);else if(T.enum)for(let D of T.enum)E(D,S);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function E(T,S){if(typeof T!="string"||T in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[T]=S}}}};gG.default=tRt});var E6e=x((Myr,rRt)=>{rRt.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 T6e=x((On,S6e)=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.MissingRefError=On.ValidationError=On.CodeGen=On.Name=On.nil=On.stringify=On.str=On._=On.KeywordCxt=void 0;var nRt=y3e(),iRt=b6e(),aRt=w6e(),A6e=E6e(),oRt=["/properties"],R4="http://json-schema.org/draft-07/schema",j4=class extends nRt.default{_addVocabularies(){super._addVocabularies(),iRt.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(aRt.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(A6e,oRt):A6e;this.addMetaSchema(t,R4,!1),this.refs["http://json-schema.org/schema"]=R4}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(R4)?R4:void 0)}};S6e.exports=On=j4;Object.defineProperty(On,"__esModule",{value:!0});On.default=j4;var sRt=F2();Object.defineProperty(On,"KeywordCxt",{enumerable:!0,get:function(){return sRt.KeywordCxt}});var Q1=er();Object.defineProperty(On,"_",{enumerable:!0,get:function(){return Q1._}});Object.defineProperty(On,"str",{enumerable:!0,get:function(){return Q1.str}});Object.defineProperty(On,"stringify",{enumerable:!0,get:function(){return Q1.stringify}});Object.defineProperty(On,"nil",{enumerable:!0,get:function(){return Q1.nil}});Object.defineProperty(On,"Name",{enumerable:!0,get:function(){return Q1.Name}});Object.defineProperty(On,"CodeGen",{enumerable:!0,get:function(){return Q1.CodeGen}});var uRt=v4();Object.defineProperty(On,"ValidationError",{enumerable:!0,get:function(){return uRt.default}});var cRt=x4();Object.defineProperty(On,"MissingRefError",{enumerable:!0,get:function(){return cRt.default}})});var iz=typeof process!="object"||String(process)!=="[object process]"||process.browser;var az={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"]=az||{};function Nt(e,t,r){return t<=e&&e<=r}function p8e(e,t){return e.indexOf(t)!==-1}var Cc=Math.floor;function l_(e){if(e===void 0)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function d8e(e){for(var t=String(e),r=t.length,n=0,i=[];n<r;){var a=t.charCodeAt(n);if(a<55296||a>57343)i.push(a);else if(56320<=a&&a<=57343)i.push(65533);else if(55296<=a&&a<=56319)if(n===r-1)i.push(65533);else{var o=t.charCodeAt(n+1);if(56320<=o&&o<=57343){var s=a&1023,u=o&1023;i.push(65536+(s<<10)+u),n+=1}else i.push(65533)}n+=1}return i}function h8e(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 Do(e){return 0<=e&&e<=127}var Co=Do,ur=-1;function lD(e){this.tokens=[].slice.call(e),this.tokens.reverse()}lD.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():ur},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 Kr=-1;function sr(e,t){if(e)throw TypeError("Decoder error");return t||65533}function bs(e){throw TypeError("The code point "+e+" could not be encoded.")}function m8e(){}m8e.prototype={handler:function(e,t){}};function g8e(){}g8e.prototype={handler:function(e,t){}};function uD(e){return e=String(e).trim().toLowerCase(),Object.prototype.hasOwnProperty.call(cD,e)?cD[e]:null}var oz=[{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"}],cD={};oz.forEach(function(e){e.encodings.forEach(function(t){t.labels.forEach(function(r){cD[r]=t})})});var Na={},Ua={};function Wh(e,t){return t&&t[e]||null}function Vh(e,t){var r=t.indexOf(e);return r===-1?null:r}function Ta(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 v8e(e){if(e>39419&&e<189e3||e>1237575)return null;if(e===7457)return 59335;var t=0,r=0,n=Ta("gb18030-ranges"),i;for(i=0;i<n.length;++i){var a=n[i];if(a[0]<=e)t=a[0],r=a[1];else break}return r+e-t}function x8e(e){if(e===59335)return 7457;var t=0,r=0,n=Ta("gb18030-ranges"),i;for(i=0;i<n.length;++i){var a=n[i];if(a[1]<=e)t=a[1],r=a[0];else break}return r+e-t}function b8e(e){oD=oD||Ta("jis0208").map(function(r,n){return Nt(n,8272,8835)?null:r});var t=oD;return t.indexOf(e)}var oD;function y8e(e){sD=sD||Ta("big5").map(function(r,n){return n<(161-129)*157?null:r});var t=sD;return e===9552||e===9566||e===9569||e===9578||e===21313||e===21317?t.lastIndexOf(e):Vh(e,t)}var sD,sz="utf-8";function Hp(e,t){if(!(this instanceof Hp))throw TypeError("Called as a function. Did you forget 'new'?");e=e!==void 0?String(e):sz,t=l_(t),this._encoding=null,this._decoder=null,this._ignoreBOM=!1,this._BOMseen=!1,this._error_mode="replacement",this._do_not_flush=!1;var r=uD(e);if(r===null||r.name==="replacement")throw RangeError("Unknown encoding: "+e);if(!Ua[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(Hp.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(Hp.prototype,"fatal",{get:function(){return this._error_mode==="fatal"}}),Object.defineProperty(Hp.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}}));Hp.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=l_(r),this._do_not_flush||(this._decoder=Ua[this._encoding.name]({fatal:this._error_mode==="fatal"}),this._BOMseen=!1),this._do_not_flush=Boolean(r.stream);for(var i=new lD(n),a=[],o;;){var s=i.read();if(s===ur||(o=this._decoder.handler(i,s),o===Kr))break;o!==null&&(Array.isArray(o)?a.push.apply(a,o):a.push(o))}if(!this._do_not_flush){do{if(o=this._decoder.handler(i,i.read()),o===Kr)break;o!==null&&(Array.isArray(o)?a.push.apply(a,o):a.push(o))}while(!i.endOfStream());this._decoder=null}function u(c){return p8e(["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)),h8e(c)}return u.call(this,a)};function dv(e,t){if(!(this instanceof dv))throw TypeError("Called as a function. Did you forget 'new'?");t=l_(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):sz;var n=uD(e);if(n===null||n.name==="replacement")throw RangeError("Unknown encoding: "+e);if(!Na[n.name])throw Error("Encoder not present. Did you forget to include encoding-indexes.js first?");r._encoding=n}else r._encoding=uD("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(dv.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}});dv.prototype.encode=function(t,r){t=t===void 0?"":String(t),r=l_(r),this._do_not_flush||(this._encoder=Na[this._encoding.name]({fatal:this._fatal==="fatal"})),this._do_not_flush=Boolean(r.stream);for(var n=new lD(d8e(t)),i=[],a;;){var o=n.read();if(o===ur||(a=this._encoder.handler(n,o),a===Kr))break;Array.isArray(a)?i.push.apply(i,a):i.push(a)}if(!this._do_not_flush){for(;a=this._encoder.handler(n,n.read()),a!==Kr;)Array.isArray(a)?i.push.apply(i,a):i.push(a);this._encoder=null}return new Uint8Array(i)};function _8e(e){var t=e.fatal,r=0,n=0,i=0,a=128,o=191;this.handler=function(s,u){if(u===ur&&i!==0)return i=0,sr(t);if(u===ur)return Kr;if(i===0){if(Nt(u,0,127))return u;if(Nt(u,194,223))i=1,r=u&31;else if(Nt(u,224,239))u===224&&(a=160),u===237&&(o=159),i=2,r=u&15;else if(Nt(u,240,244))u===240&&(a=144),u===244&&(o=143),i=3,r=u&7;else return sr(t);return null}if(!Nt(u,a,o))return r=i=n=0,a=128,o=191,s.prepend(u),sr(t);if(a=128,o=191,r=r<<6|u&63,n+=1,n!==i)return null;var c=r;return r=i=n=0,c}}function w8e(e){var t=e.fatal;this.handler=function(r,n){if(n===ur)return Kr;if(Co(n))return n;var i,a;Nt(n,128,2047)?(i=1,a=192):Nt(n,2048,65535)?(i=2,a=224):Nt(n,65536,1114111)&&(i=3,a=240);for(var o=[(n>>6*i)+a];i>0;){var s=n>>6*(i-1);o.push(128|s&63),i-=1}return o}}Na["UTF-8"]=function(e){return new w8e(e)};Ua["UTF-8"]=function(e){return new _8e(e)};function E8e(e,t){var r=t.fatal;this.handler=function(n,i){if(i===ur)return Kr;if(Do(i))return i;var a=e[i-128];return a===null?sr(r):a}}function A8e(e,t){var r=t.fatal;this.handler=function(n,i){if(i===ur)return Kr;if(Co(i))return i;var a=Vh(i,e);return a===null&&bs(i),a+128}}(function(){"encoding-indexes"in globalThis&&oz.forEach(function(e){e.heading==="Legacy single-byte encodings"&&e.encodings.forEach(function(t){var r=t.name,n=Ta(r.toLowerCase());Ua[r]=function(i){return new E8e(n,i)},Na[r]=function(i){return new A8e(n,i)}})})})();Ua.GBK=function(e){return new uz(e)};Na.GBK=function(e){return new cz(e,!0)};function uz(e){var t=e.fatal,r=0,n=0,i=0;this.handler=function(a,o){if(o===ur&&r===0&&n===0&&i===0)return Kr;o===ur&&(r!==0||n!==0||i!==0)&&(r=0,n=0,i=0,sr(t));var s;if(i!==0){s=null,Nt(o,48,57)&&(s=v8e((((r-129)*10+n-48)*126+i-129)*10+o-48));var u=[n,i,o];return r=0,n=0,i=0,s===null?(a.prepend(u),sr(t)):s}if(n!==0)return Nt(o,129,254)?(i=o,null):(a.prepend([n,o]),r=0,n=0,sr(t));if(r!==0){if(Nt(o,48,57))return n=o,null;var c=r,l=null;r=0;var f=o<127?64:65;return(Nt(o,64,126)||Nt(o,128,254))&&(l=(c-129)*190+(o-f)),s=l===null?null:Wh(l,Ta("gb18030")),s===null&&Do(o)&&a.prepend(o),s===null?sr(t):s}return Do(o)?o:o===128?8364:Nt(o,129,254)?(r=o,null):sr(t)}}function cz(e,t){var r=e.fatal;this.handler=function(n,i){if(i===ur)return Kr;if(Co(i))return i;if(i===58853)return bs(i);if(t&&i===8364)return 128;var a=Vh(i,Ta("gb18030"));if(a!==null){var o=Cc(a/190)+129,s=a%190,u=s<63?64:65;return[o,s+u]}if(t)return bs(i);a=x8e(i);var c=Cc(a/10/126/10);a=a-c*10*126*10;var l=Cc(a/10/126);a=a-l*10*126;var f=Cc(a/10),p=a-f*10;return[c+129,l+48,f+129,p+48]}}Na.gb18030=function(e){return new cz(e)};Ua.gb18030=function(e){return new uz(e)};function S8e(e){var t=e.fatal,r=0;this.handler=function(n,i){if(i===ur&&r!==0)return r=0,sr(t);if(i===ur&&r===0)return Kr;if(r!==0){var a=r,o=null;r=0;var s=i<127?64:98;switch((Nt(i,64,126)||Nt(i,161,254))&&(o=(a-129)*157+(i-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:Wh(o,Ta("big5"));return u===null&&Do(i)&&n.prepend(i),u===null?sr(t):u}return Do(i)?i:Nt(i,129,254)?(r=i,null):sr(t)}}function T8e(e){var t=e.fatal;this.handler=function(r,n){if(n===ur)return Kr;if(Co(n))return n;var i=y8e(n);if(i===null)return bs(n);var a=Cc(i/157)+129;if(a<161)return bs(n);var o=i%157,s=o<63?64:98;return[a,o+s]}}Na.Big5=function(e){return new T8e(e)};Ua.Big5=function(e){return new S8e(e)};function C8e(e){var t=e.fatal,r=!1,n=0;this.handler=function(i,a){if(a===ur&&n!==0)return n=0,sr(t);if(a===ur&&n===0)return Kr;if(n===142&&Nt(a,161,223))return n=0,65377-161+a;if(n===143&&Nt(a,161,254))return r=!0,n=a,null;if(n!==0){var o=n;n=0;var s=null;return Nt(o,161,254)&&Nt(a,161,254)&&(s=Wh((o-161)*94+(a-161),Ta(r?"jis0212":"jis0208"))),r=!1,Nt(a,161,254)||i.prepend(a),s===null?sr(t):s}return Do(a)?a:a===142||a===143||Nt(a,161,254)?(n=a,null):sr(t)}}function D8e(e){var t=e.fatal;this.handler=function(r,n){if(n===ur)return Kr;if(Co(n))return n;if(n===165)return 92;if(n===8254)return 126;if(Nt(n,65377,65439))return[142,n-65377+161];n===8722&&(n=65293);var i=Vh(n,Ta("jis0208"));if(i===null)return bs(n);var a=Cc(i/94)+161,o=i%94+161;return[a,o]}}Na["EUC-JP"]=function(e){return new D8e(e)};Ua["EUC-JP"]=function(e){return new C8e(e)};function k8e(e){var t=e.fatal,r={ASCII:0,Roman:1,Katakana:2,LeadByte:3,TrailByte:4,EscapeStart:5,Escape:6},n=r.ASCII,i=r.ASCII,a=0,o=!1;this.handler=function(s,u){switch(n){default:case r.ASCII:return u===27?(n=r.EscapeStart,null):Nt(u,0,127)&&u!==14&&u!==15&&u!==27?(o=!1,u):u===ur?Kr:(o=!1,sr(t));case r.Roman:return u===27?(n=r.EscapeStart,null):u===92?(o=!1,165):u===126?(o=!1,8254):Nt(u,0,127)&&u!==14&&u!==15&&u!==27&&u!==92&&u!==126?(o=!1,u):u===ur?Kr:(o=!1,sr(t));case r.Katakana:return u===27?(n=r.EscapeStart,null):Nt(u,33,95)?(o=!1,65377-33+u):u===ur?Kr:(o=!1,sr(t));case r.LeadByte:return u===27?(n=r.EscapeStart,null):Nt(u,33,126)?(o=!1,a=u,n=r.TrailByte,null):u===ur?Kr:(o=!1,sr(t));case r.TrailByte:if(u===27)return n=r.EscapeStart,sr(t);if(Nt(u,33,126)){n=r.LeadByte;var c=(a-33)*94+u-33,l=Wh(c,Ta("jis0208"));return l===null?sr(t):l}return u===ur?(n=r.LeadByte,s.prepend(u),sr(t)):(n=r.LeadByte,sr(t));case r.EscapeStart:return u===36||u===40?(a=u,n=r.Escape,null):(s.prepend(u),o=!1,n=i,sr(t));case r.Escape:var f=a;a=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?sr(t):null}return s.prepend([f,u]),o=!1,n=i,sr(t)}}}function F8e(e){var t=e.fatal,r={ASCII:0,Roman:1,jis0208:2},n=r.ASCII;this.handler=function(i,a){if(a===ur&&n!==r.ASCII)return i.prepend(a),n=r.ASCII,[27,40,66];if(a===ur&&n===r.ASCII)return Kr;if((n===r.ASCII||n===r.Roman)&&(a===14||a===15||a===27))return bs(65533);if(n===r.ASCII&&Co(a))return a;if(n===r.Roman&&(Co(a)&&a!==92&&a!==126||a==165||a==8254)){if(Co(a))return a;if(a===165)return 92;if(a===8254)return 126}if(Co(a)&&n!==r.ASCII)return i.prepend(a),n=r.ASCII,[27,40,66];if((a===165||a===8254)&&n!==r.Roman)return i.prepend(a),n=r.Roman,[27,40,74];a===8722&&(a=65293);var o=Vh(a,Ta("jis0208"));if(o===null)return bs(a);if(n!==r.jis0208)return i.prepend(a),n=r.jis0208,[27,36,66];var s=Cc(o/94)+33,u=o%94+33;return[s,u]}}Na["ISO-2022-JP"]=function(e){return new F8e(e)};Ua["ISO-2022-JP"]=function(e){return new k8e(e)};function B8e(e){var t=e.fatal,r=0;this.handler=function(n,i){if(i===ur&&r!==0)return r=0,sr(t);if(i===ur&&r===0)return Kr;if(r!==0){var a=r,o=null;r=0;var s=i<127?64:65,u=a<160?129:193;if((Nt(i,64,126)||Nt(i,128,252))&&(o=(a-u)*188+i-s),Nt(o,8836,10715))return 57344-8836+o;var c=o===null?null:Wh(o,Ta("jis0208"));return c===null&&Do(i)&&n.prepend(i),c===null?sr(t):c}return Do(i)||i===128?i:Nt(i,161,223)?65377-161+i:Nt(i,129,159)||Nt(i,224,252)?(r=i,null):sr(t)}}function P8e(e){var t=e.fatal;this.handler=function(r,n){if(n===ur)return Kr;if(Co(n)||n===128)return n;if(n===165)return 92;if(n===8254)return 126;if(Nt(n,65377,65439))return n-65377+161;n===8722&&(n=65293);var i=b8e(n);if(i===null)return bs(n);var a=Cc(i/188),o=a<31?129:193,s=i%188,u=s<63?64:65;return[a+o,s+u]}}Na.Shift_JIS=function(e){return new P8e(e)};Ua.Shift_JIS=function(e){return new B8e(e)};function O8e(e){var t=e.fatal,r=0;this.handler=function(n,i){if(i===ur&&r!==0)return r=0,sr(t);if(i===ur&&r===0)return Kr;if(r!==0){var a=r,o=null;r=0,Nt(i,65,254)&&(o=(a-129)*190+(i-65));var s=o===null?null:Wh(o,Ta("euc-kr"));return o===null&&Do(i)&&n.prepend(i),s===null?sr(t):s}return Do(i)?i:Nt(i,129,254)?(r=i,null):sr(t)}}function I8e(e){var t=e.fatal;this.handler=function(r,n){if(n===ur)return Kr;if(Co(n))return n;var i=Vh(n,Ta("euc-kr"));if(i===null)return bs(n);var a=Cc(i/190)+129,o=i%190+65;return[a,o]}}Na["EUC-KR"]=function(e){return new I8e(e)};Ua["EUC-KR"]=function(e){return new O8e(e)};function c_(e,t){var r=e>>8,n=e&255;return t?[r,n]:[n,r]}function lz(e,t){var r=t.fatal,n=null,i=null;this.handler=function(a,o){if(o===ur&&(n!==null||i!==null))return sr(r);if(o===ur&&n===null&&i===null)return Kr;if(n===null)return n=o,null;var s;if(e?s=(n<<8)+o:s=(o<<8)+n,n=null,i!==null){var u=i;return i=null,Nt(s,56320,57343)?65536+(u-55296)*1024+(s-56320):(a.prepend(c_(s,e)),sr(r))}return Nt(s,55296,56319)?(i=s,null):Nt(s,56320,57343)?sr(r):s}}function fz(e,t){var r=t.fatal;this.handler=function(n,i){if(i===ur)return Kr;if(Nt(i,0,65535))return c_(i,e);var a=c_((i-65536>>10)+55296,e),o=c_((i-65536&1023)+56320,e);return a.concat(o)}}Na["UTF-16BE"]=function(e){return new fz(!0,e)};Ua["UTF-16BE"]=function(e){return new lz(!0,e)};Na["UTF-16LE"]=function(e){return new fz(!1,e)};Ua["UTF-16LE"]=function(e){return new lz(!1,e)};function R8e(e){var t=e.fatal;this.handler=function(r,n){return n===ur?Kr:Do(n)?n:63360+n-128}}function j8e(e){var t=e.fatal;this.handler=function(r,n){return n===ur?Kr:Co(n)?n:Nt(n,63360,63487)?n-63360+128:bs(n)}}Na["x-user-defined"]=function(e){return new j8e(e)};Ua["x-user-defined"]=function(e){return new R8e(e)};function hv(e){return Buffer.from(e).toString("base64")}function fD(e){return Buffer.from(e,"base64").toString("ascii")}var aV=Lt(nV(),1),oV=Lt(wv(),1);function iV(e){return Buffer.isBuffer(e)?new Uint8Array(e).buffer:e}function YDe(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,aV.default)(n,r,t)}function sV(e,t){let r=YDe(e,t);return new Promise(n=>{let i=[];r.on("data",a=>i.push(a)),r.on("end",()=>{let a=Buffer.concat(i);n(iV(a))})})}var qte=Lt(Lte(),1),mB=["image/png","image/jpeg","image/gif"];async function gB(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 u7e(r,t)}function u7e(e,t){return new Promise(r=>(0,qte.default)(e,t,(n,i)=>{if(n)throw n;let a=[...i.shape],o=i.shape.length===4?i.shape.shift():1,s=i.data instanceof Buffer?new Uint8Array(i.data):i.data;r({shape:a,data:s,width:i.shape[0],height:i.shape[1],components:i.shape[2],layers:o?[o]:[]})}))}async function ho(e,t,r,n){return n._parse(e,t,r,n)}function Rt(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var Ou={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Ute=Ou.self||Ou.window||Ou.global||{},Gte=Ou.window||Ou.self||Ou.global||{},zte=Ou.global||Ou.self||Ou.window||{},Hte=Ou.document||{};var jr=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Nte=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),c7e=Nte&&parseFloat(Nte[1])||0;function xf(e){return xf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xf(e)}function vB(e,t){if(xf(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(xf(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xB(e){var t=vB(e,"string");return xf(t)==="symbol"?t:String(t)}function St(e,t,r){return t=xB(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bB(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function Is(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||bB()}var l7e=globalThis.self||globalThis.window||globalThis.global,M0=globalThis.window||globalThis.self||globalThis.global,f7e=globalThis.document||{},ld=globalThis.process||{},p7e=globalThis.console,vUt=globalThis.navigator||{};var iE="4.2.0-beta.2",yUt=Is();function d7e(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var aE=class{constructor(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";St(this,"storage",void 0),St(this,"id",void 0),St(this,"config",void 0),this.storage=d7e(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="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function Vte(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}function oE(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));let a=e.width*r,o=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}var sE;(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"})(sE||(sE={}));var h7e=10;function $te(e){return typeof e!="string"?e:(e=e.toUpperCase(),sE[e]||sE.WHITE)}function Kte(e,t,r){if(!Is&&typeof e=="string"){if(t){let n=$te(t);e="\x1B[".concat(n,"m").concat(e,"\x1B[39m")}if(r){let n=$te(r);e="\x1B[".concat(n+h7e,"m").concat(e,"\x1B[49m")}}return e}function Jte(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let a of n){let o=i[a];typeof o=="function"&&(t.find(s=>a===s)||(i[a]=o.bind(e)))}}function L0(e,t){if(!e)throw new Error(t||"Assertion failed")}function fd(){let e;if(Is()&&M0.performance){var t,r;e=M0===null||M0===void 0||(t=M0.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in ld){var n;let i=ld===null||ld===void 0||(n=ld.hrtime)===null||n===void 0?void 0:n.call(ld);e=i[0]*1e3+i[1]/1e6}else e=Date.now();return e}var q0={debug:Is()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},m7e={enabled:!0,level:0};function qo(){}var Yte={},Xte={once:!0},Iu=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};St(this,"id",void 0),St(this,"VERSION",iE),St(this,"_startTs",fd()),St(this,"_deltaTs",fd()),St(this,"_storage",void 0),St(this,"userData",{}),St(this,"LOG_THROTTLE_TIMEOUT",0),this.id=t,this.userData={},this._storage=new aE("__probe-".concat(this.id,"__"),m7e),this.timeStamp("".concat(this.id," started")),Jte(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((fd()-this._startTs).toPrecision(10))}getDelta(){return Number((fd()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){L0(t,r)}warn(t){return this._getLogFunction(0,t,q0.warn,arguments,Xte)}error(t){return this._getLogFunction(0,t,q0.error,arguments)}deprecated(t,r){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(t,r){return this.error("`".concat(t,"` has been removed. Use `").concat(r,"` instead"))}probe(t,r){return this._getLogFunction(t,r,q0.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,q0.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,q0.debug||q0.info,arguments,Xte)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||qo,n&&[n],{tag:b7e(r)}):qo}image(t){let{logLevel:r,priority:n,image:i,message:a="",scale:o=1}=t;return this._shouldLog(r||n)?Is()?x7e({image:i,message:a,scale:o}):v7e({image:i,message:a,scale:o}):qo}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||qo)}group(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},i=Qte({logLevel:t,message:r,opts:n}),{collapsed:a}=n;return i.method=(a?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||qo)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Zte(t)}_getLogFunction(t,r,n,i,a){if(this._shouldLog(t)){a=Qte({logLevel:t,message:r,args:i,opts:a}),n=n||a.method,L0(n),a.total=this.getTotal(),a.delta=this.getDelta(),this._deltaTs=fd();let o=a.tag||a.message;if(a.once&&o)if(!Yte[o])Yte[o]=fd();else return qo;return r=g7e(this.id,a.message,a),n.bind(console,r,...a.args)}return qo}};St(Iu,"VERSION",iE);function Zte(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 L0(Number.isFinite(t)&&t>=0),t}function Qte(e){let{logLevel:t,message:r}=e;e.logLevel=Zte(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 i=typeof e.message;return L0(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}function g7e(e,t,r){if(typeof t=="string"){let n=r.time?Vte(Wte(r.total)):"";t=r.time?"".concat(e,": ").concat(n," ").concat(t):"".concat(e,": ").concat(t),t=Kte(t,r.color,r.background)}return t}function v7e(e){let{image:t,message:r="",scale:n=1}=e;return console.warn("removed"),qo}function x7e(e){let{image:t,message:r="",scale:n=1}=e;if(typeof t=="string"){let a=new Image;return a.onload=()=>{let o=oE(a,r,n);console.log(...o)},a.src=t,qo}let i=t.nodeName||"";if(i.toLowerCase()==="img")return console.log(...oE(t,r,n)),qo;if(i.toLowerCase()==="canvas"){let a=new Image;return a.onload=()=>console.log(...oE(a,r,n)),a.src=t.toDataURL(),qo}return qo}function b7e(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var $Ut=new Iu({id:"@probe.gl/log"});function yB(e,t){return ere(e||{},t)}function ere(e,t,r=0){if(r>3)return t;let n={...e};for(let[i,a]of Object.entries(t))a&&typeof a=="object"&&!Array.isArray(a)?n[i]=ere(n[i]||{},t[i],r+1):n[i]=t[i];return n}function xx(e){var t;globalThis.loaders||(globalThis.loaders={}),(t=globalThis.loaders).modules||(t.modules={}),Object.assign(globalThis.loaders.modules,e)}function _B(e){var r,n;return((n=(r=globalThis.loaders)==null?void 0:r.modules)==null?void 0:n[e])||null}var tre="latest";function y7e(){var e;return(e=globalThis._loadersgl_)!=null&&e.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.0-beta.2"),globalThis._loadersgl_.version}var pd=y7e();function Wi(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var Ru={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},eGt=Ru.self||Ru.window||Ru.global||{},tGt=Ru.window||Ru.self||Ru.global||{},rGt=Ru.global||Ru.self||Ru.window||{},nGt=Ru.document||{};var Di=typeof process!="object"||String(process)!=="[object process]"||process.browser,bx=typeof importScripts=="function",nre=typeof window<"u"&&typeof window.orientation<"u",rre=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),iGt=rre&&parseFloat(rre[1])||0;var yx=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(t,r){this.name=t,this.workerThread=r,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(t,r){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:r})}done(t){Wi(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){Wi(this.isRunning),this.isRunning=!1,this._reject(t)}};var dd={};ui(dd,{NodeWorker:()=>wx,parentPort:()=>_7e});var _x=Lt(require("worker_threads"),1);pv(dd,require("worker_threads"));var _7e=_x==null?void 0:_x.parentPort,wx=_x.Worker;var wB=new Map;function ire(e){Wi(e.source&&!e.url||!e.source&&e.url);let t=wB.get(e.source||e.url);return t||(e.url&&(t=w7e(e.url),wB.set(e.url,t)),e.source&&(t=are(e.source),wB.set(e.source,t))),Wi(t),t}function w7e(e){if(!e.startsWith("http"))return e;let t=E7e(e);return are(t)}function are(e){let t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function E7e(e){return`try {
|
|
156
156
|
importScripts('${e}');
|
|
157
157
|
} catch (error) {
|
|
158
158
|
console.error(error);
|
|
159
159
|
throw error;
|
|
160
160
|
}`}function EB(e,t=!0,r){let n=r||new Set;if(e){if(ore(e))n.add(e);else if(ore(e.buffer))n.add(e.buffer);else if(!ArrayBuffer.isView(e)){if(t&&typeof e=="object")for(let i in e)EB(e[i],t,n)}}return r===void 0?Array.from(n):[]}function ore(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 AB(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]=AB(e[r]):typeof t[r]=="function"||t[r]instanceof RegExp?t[r]={}:t[r]=e[r]}),t}var SB=()=>{},bf=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&Di||typeof wx<"u"&&!Di}constructor(t){let{name:r,source:n,url:i}=t;Wi(n||i),this.name=r,this.source=n,this.url=i,this.onMessage=SB,this.onError=a=>console.log(a),this.worker=Di?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=SB,this.onError=SB,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,r){r=r||EB(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=ire({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}`;t=new wx(n,{eval:!1})}else if(this.source)t=new wx(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 Ex=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return bf.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=(i,a,o)=>i.done(o),n=(i,a)=>i.error(a)){let i=new Promise(a=>(this.jobQueue.push({name:t,onMessage:r,onError:n,onStart:a}),this));return this._startQueuedJob(),await i}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 yx(r.name,t);t.onMessage=i=>r.onMessage(n,i.type,i.payload),t.onError=i=>r.onError(n,i),r.onStart(n);try{await n.result}catch(i){console.error(`Worker exception: ${i}`)}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!Di||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 bf({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return nre?this.maxMobileConcurrency:this.maxConcurrency}};var A7e={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},hd=class{props;workerPools=new Map;static isSupported(){return bf.isSupported()}static getWorkerFarm(t={}){return hd._workerFarm=hd._workerFarm||new hd({}),hd._workerFarm.setProps(t),hd._workerFarm}constructor(t){this.props={...A7e},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:i}=t,a=this.workerPools.get(r);return a||(a=new Ex({name:r,source:n,url:i}),a.setProps(this._getWorkerPoolProps()),this.workerPools.set(r,a)),a}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},xa=hd;nz(xa,"_workerFarm");function sre(e){let t=e.version!==pd?` (worker-utils@${pd})`:"";return`${e.name}@${e.version}${t}`}function Ax(e,t={}){let r=t[e.id]||{},n=Di?`${e.id}-worker.js`:`${e.id}-worker-node.js`,i=r.workerUrl;if(!i&&e.id==="compression"&&(i=t.workerUrl),t._workerType==="test"&&(Di?i=`modules/${e.module}/dist/${n}`:i=`modules/${e.module}/src/workers/${e.id}-worker-node.ts`),!i){let a=e.version;a==="latest"&&(a=tre);let o=a?`@${a}`:"";i=`https://unpkg.com/@loaders.gl/${e.module}${o}/dist/${n}`}return Wi(i),i}async function TB(e,t,r={},n={}){let i=sre(e),a=xa.getWorkerFarm(r),{source:o}=r,s={name:i,source:o};o||(s.url=Ax(e,r));let u=a.getWorkerPool(s),c=r.jobName||e.name,l=await u.startJob(c,S7e.bind(null,n)),f=AB(r);return l.postMessage("process",{input:t,options:f}),(await l.result).result}async function S7e(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:i,input:a,options:o}=n;try{if(!e.process){t.postMessage("error",{id:i,error:"Worker not set up to process on main thread"});return}let s=await e.process(a,o);t.postMessage("done",{id:i,result:s})}catch(s){let u=s instanceof Error?s.message:"unknown error";t.postMessage("error",{id:i,error:u})}break;default:console.warn(`process-on-worker: unknown message ${r}`)}}function CB(e,t=pd){Wi(e,"no worker provided");let r=e.version;return!(!t||!r)}var DB={};async function ju(e,t=null,r={},n=null){return t&&(e=ure(e,t,r,n)),DB[e]=DB[e]||T7e(e),await DB[e]}function ure(e,t,r={},n=null){if(!r.useLocalLibraries&&e.startsWith("http"))return e;n=n||e;let i=r.modules||{};return i[n]?i[n]:Di?r.CDN?(Wi(r.CDN.startsWith("http")),`${r.CDN}/${t}@${pd}/dist/libs/${n}`):bx?`../src/libs/${n}`:`modules/${t}/src/libs/${n}`:`modules/${t}/dist/libs/${n}`}async function T7e(e){if(e.endsWith("wasm"))return await D7e(e);if(!Di)try{let{requireFromFile:r}=globalThis.loaders||{};return await(r==null?void 0:r(e))}catch(r){return console.error(r),null}if(bx)return importScripts(e);let t=await k7e(e);return C7e(t,e)}function C7e(e,t){if(!Di){let{requireFromString:n}=globalThis.loaders||{};return n==null?void 0:n(e,t)}if(bx)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 D7e(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return Di||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function k7e(e){let{readFileAsText:t}=globalThis.loaders||{};return Di||!t||e.startsWith("http")?await(await fetch(e)).text():await t(e)}var pre=Lt(require("child_process"),1);var cre=Lt(require("child_process"),1);function lre(e=3e3){return new Promise(t=>{cre.default.exec("lsof -i -P -n | grep LISTEN",(r,n)=>{if(r){t(e);return}let i=[],a=/:(\d+) \(LISTEN\)/;n.split(`
|
|
161
|
-
`).forEach(s=>{let u=a.exec(s);u&&i.push(Number(u[1]))});let o=e;for(;i.includes(o);)o++;t(o)})})}var fre={command:"",arguments:[],port:5e3,autoPort:!0,wait:2e3,onSuccess:e=>{console.log(`Started ${e.props.command}`)}},N0=class{id;props={...fre};childProcess=null;port=0;successTimer;constructor({id:t="browser-driver"}={}){this.id=t}async start(t){t={...fre,...t},this.props=t;let r=[...t.arguments];return this.port=Number(t.port),t.portArg&&(t.autoPort&&(this.port=await lre(t.port)),r.push(t.portArg,String(this.port))),await new Promise((n,i)=>{try{this._setTimeout(()=>{t.onSuccess&&t.onSuccess(this),n({})}),console.log(`Spawning ${t.command} ${t.arguments.join(" ")}`);let a=pre.spawn(t.command,r,t.spawn);this.childProcess=a,a.stdout.on("data",o=>{console.log(o.toString())}),a.stderr.on("data",o=>{console.log(`Child process wrote to stderr: "${o}".`),t.ignoreStderr||(this._clearTimeout(),i(new Error(o)))}),a.on("error",o=>{console.log(`Child process errored with ${o}`),this._clearTimeout(),i(o)}),a.on("close",o=>{console.log(`Child process exited with ${o}`),this.childProcess=null,this._clearTimeout(),n({})})}catch(a){i(a)}})}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 kB(e,t){return!xa.isSupported()||!Di&&!(t!=null&&t._nodeWorkers)?!1:e.worker&&(t==null?void 0:t.worker)}async function FB(e,t,r,n,i){let a=e.id,o=Ax(e,r),u=xa.getWorkerFarm(r).getWorkerPool({name:a,url:o});r=JSON.parse(JSON.stringify(r)),n=JSON.parse(JSON.stringify(n||{}));let c=await u.startJob("process-on-worker",F7e.bind(null,i));return c.postMessage("process",{input:t,options:r,context:n}),await(await c.result).result}async function F7e(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:i,input:a,options:o}=n;try{let s=await e(a,o);t.postMessage("done",{id:i,result:s})}catch(s){let u=s instanceof Error?s.message:"unknown error";t.postMessage("error",{id:i,error:u})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function BB(e,t){return!xa.isSupported()||!jr&&!(t!=null&&t._nodeWorkers)?!1:e.worker&&(t==null?void 0:t.worker)}function hre(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?dre(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?dre(e,0,t):""}function dre(e,t,r){if(e.byteLength<=t+r)return"";let n=new DataView(e),i="";for(let a=0;a<r;a++)i+=String.fromCharCode(n.getUint8(t+a));return i}function PB(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${hre(e)}"`)}}function Mu(e,t,r){if(r=r||e.byteLength,e.byteLength<r||t.byteLength<r)return!1;let n=new Uint8Array(e),i=new Uint8Array(t);for(let a=0;a<n.length;++a)if(n[a]!==i[a])return!1;return!0}function qn(...e){return uE(e)}function uE(e){let t=e.map(a=>a instanceof ArrayBuffer?new Uint8Array(a):a),r=t.reduce((a,o)=>a+o.byteLength,0),n=new Uint8Array(r),i=0;for(let a of t)n.set(a,i),i+=a.byteLength;return n.buffer}function mo(...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),i=new r(n),a=0;for(let o of t)i.set(o,a),a+=o.length;return i}function md(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 go(e,t){return Rt(e>=0),Rt(t>0),e+(t-1)&~(t-1)}function OB(e,t,r){let n;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else{let i=e.byteOffset,a=e.byteLength;n=new Uint8Array(e.buffer||e.arrayBuffer,i,a)}return t.set(n,r),r+go(n.byteLength,4)}function IB(e,t){let r=e.length,i=Math.ceil(r/t)*t-r,a="";for(let o=0;o<i;++o)a+=" ";return e+a}function U0(e,t,r,n){if(e)for(let i=0;i<n;i++)e.setUint8(t+i,r.charCodeAt(i));return t+n}function Sx(e,t,r,n){if(e)for(let i=0;i<n;i++)e.setUint8(t+i,r[i]);return t+n}function cE(e,t,r,n){let i=go(r.byteLength,n),a=i-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<a;++u)e.setUint8(t+r.byteLength+u,32)}return t+=i,t}function G0(e,t,r,n){let a=new TextEncoder().encode(r);return t=cE(e,t,a,n),t}async function gd(e){let t=[];for await(let r of e)t.push(r);return qn(...t)}var B7e="",mre={};function Lu(e){for(let t in mre)if(e.startsWith(t)){let r=mre[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${B7e}${e}`),e}var P7e="4.2.0-alpha.6",RB={dataType:null,batchType:null,name:"JSON",id:"json",module:"json",version:P7e,extensions:["json","geojson"],mimeTypes:["application/json"],category:"json",text:!0,parseTextSync:gre,parse:async e=>gre(new TextDecoder().decode(e)),options:{}};function gre(e){return JSON.parse(e)}function vre(e){return Buffer.isBuffer(e)?new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer:e}function xre(e){return e&&typeof e=="object"&&e.isBuffer}function Hc(e){if(xre(e))return vre(e);if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.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 z0(e){return t=>new Promise((r,n)=>e(t,(i,a)=>i?n(i):r(a)))}var $a={};ui($a,{dirname:()=>R7e,filename:()=>I7e,join:()=>j7e,resolve:()=>M7e});function bre(){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 I7e(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function R7e(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function j7e(...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 M7e(...e){let t=[];for(let a=0;a<e.length;a++)t[a]=e[a];let r="",n=!1,i;for(let a=t.length-1;a>=-1&&!n;a--){let o;a>=0?o=t[a]:(i===void 0&&(i=bre()),o=i),o.length!==0&&(r=`${o}/${r}`,n=o.charCodeAt(0)===Tx)}return r=L7e(r,!n),n?`/${r}`:r.length>0?r:"."}var Tx=47,jB=46;function L7e(e,t){let r="",n=-1,i=0,a,o=!1;for(let s=0;s<=e.length;++s){if(s<e.length)a=e.charCodeAt(s);else{if(a===Tx)break;a=Tx}if(a===Tx){if(!(n===s-1||i===1))if(n!==s-1&&i===2){if(r.length<2||!o||r.charCodeAt(r.length-1)!==jB||r.charCodeAt(r.length-2)!==jB){if(r.length>2){let u=r.length-1,c=u;for(;c>=0&&r.charCodeAt(c)!==Tx;--c);if(c!==u){r=c===-1?"":r.slice(0,c),n=s,i=0,o=!1;continue}}else if(r.length===2||r.length===1){r="",n=s,i=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,i=0}else a===jB&&i!==-1?++i:i=-1}return r}var Cx=new Error("Not implemented"),Wc=class{handle;size=0;bigsize=0n;url="";constructor(t,r,n){var i;if((i=globalThis.loaders)!=null&&i.NodeFile)return new globalThis.loaders.NodeFile(t,r,n);throw jr?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 Cx}async write(t,r,n){throw Cx}async stat(){throw Cx}async truncate(t){throw Cx}async append(t){throw Cx}async close(){}};var H0=new Error("Not implemented"),Dx=class{constructor(t){var r;if((r=globalThis.loaders)!=null&&r.NodeFileSystem)return new globalThis.loaders.NodeFileSystem(t);throw jr?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 MB=e=>(e==null?void 0:e.getUint8)&&(e==null?void 0:e.slice)&&(e==null?void 0:e.length);var vo=class{file;constructor(t,r=!1){this.file=new Wc(t,r?"a+":"r")}async truncate(t){await this.file.truncate(t)}async append(t){await this.file.append(t)}async destroy(){await this.file.close()}async getUint8(t){let r=await this.file.read(t,1),n=new Uint8Array(r).at(0);if(n===void 0)throw new Error("something went wrong");return n}async getUint16(t){let r=await this.file.read(t,2),n=new Uint16Array(r).at(0);if(n===void 0)throw new Error("something went wrong");return n}async getUint32(t){let r=await this.file.read(t,4),n=new Uint32Array(r).at(0);if(n===void 0)throw new Error("something went wrong");return n}async getBigUint64(t){let r=await this.file.read(t,8),n=new BigInt64Array(r).at(0);if(n===void 0)throw new Error("something went wrong");return n}async slice(t,r){let n=r-t;if(n>Number.MAX_SAFE_INTEGER)throw new Error("too big slice");let i=Number(n);return await this.file.read(t,i)}get length(){return this.file.bigsize}};var Vc=Lt(require("fs"),1),vd=class{handle;size;bigsize;url;constructor(t,r,n){t=Lu(t),this.handle=Vc.default.openSync(t,r,n);let i=Vc.default.fstatSync(this.handle,{bigint:!0});this.size=Number(i.size),this.bigsize=i.size,this.url=t}async close(){return new Promise((t,r)=>{Vc.default.close(this.handle,n=>n?r(n):t())})}async truncate(t){return new Promise((r,n)=>{Vc.default.ftruncate(this.handle,t,i=>{i?n(i):(this.bigsize=BigInt(t),this.size=Number(this.bigsize),r())})})}async append(t){return new Promise((r,n)=>{Vc.default.appendFile(this.handle,t,i=>{i?n(i):(this.bigsize=this.bigsize+BigInt(t.length),this.size=Number(this.bigsize),r())})})}async stat(){return await new Promise((t,r)=>Vc.default.fstat(this.handle,{bigint:!0},(n,i)=>{let a={size:Number(i.size),bigsize:i.size,isDirectory:i.isDirectory()};n?r(n):t(a)}))}async read(t,r){let n=new ArrayBuffer(r),i=BigInt(t),a=0,o=new Uint8Array(n),s;for(;r>0;){let u=await N7e(this.handle,o,0,r,i);if(u===0)break;a+=u,i+=BigInt(u),r-=u,s!==void 0&&(s+=u)}return a<r?n.slice(0,a):n}async write(t,r=0,n=t.byteLength){return new Promise((i,a)=>{let o=Number(r),s=new Uint8Array(t,Number(r),n);Vc.default.write(this.handle,s,0,n,o,(u,c)=>u?a(u):i(c))})}};async function N7e(e,t,r,n,i){return await new Promise((a,o)=>Vc.default.read(e,t,r,n,i,(s,u)=>s?o(s):a(u)))}var dE=Lt(require("fs/promises"),1);var qB=Lt(require("fs"),1),LB=require("stream");var lE=Lt(require("zlib"),1),U7e=e=>e&&e instanceof ArrayBuffer,G7e=e=>e&&e instanceof Buffer;function fE(e,t){switch(t==null?void 0:t.get("content-encoding")){case"br":return e.pipe(lE.default.createBrotliDecompress());case"gzip":return e.pipe(lE.default.createGunzip());case"deflate":return e.pipe(lE.default.createDeflate());default:return e}}async function yre(e){let t=[];return await new Promise((r,n)=>{e.on("error",i=>n(i)),e.on("readable",()=>e.read()),e.on("data",i=>{typeof i=="string"&&n(new Error("Read stream not binary")),t.push(H7e(i))}),e.on("end",()=>{let i=z7e(t);r(i)})})}function z7e(e){let t=e.map(a=>a instanceof ArrayBuffer?new Uint8Array(a):a),r=t.reduce((a,o)=>a+o.byteLength,0),n=new Uint8Array(r),i=0;for(let a of t)n.set(a,i),i+=a.byteLength;return n.buffer}function H7e(e){if(U7e(e))return e;if(G7e(e))return new Uint8Array(e).buffer;if(ArrayBuffer.isView(e))return e.buffer;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(${JSON.stringify(e,null,2).slice(10)})`)}var W7e=e=>typeof e=="boolean",_re=e=>typeof e=="function",V7e=e=>e!==null&&typeof e=="object",$7e=e=>V7e(e)&&_re(e.read)&&_re(e.pipe)&&W7e(e.readable);async function pE(e,t){let r=/^file:\/\//;e.replace(r,"/");let n=e.split("?")[0];n=Lu(n);let i=new Headers;e.endsWith(".gz")&&(i["content-encoding"]="gzip"),e.endsWith(".br")&&(i["content-encoding"]="br");try{let a=await new Promise((f,p)=>{let d=qB.default.createReadStream(n,{encoding:null});d.once("readable",()=>f(d)),d.on("error",h=>p(h))}),o=a;$7e(a)?o=fE(a,i):typeof a=="string"?o=LB.Readable.from([new TextEncoder().encode(a)]):o=LB.Readable.from([a||new ArrayBuffer(0)]);let s=200,u="OK",c=K7e(n),l=new Response(o,{headers:c,status:s,statusText:u});return Object.defineProperty(l,"url",{value:e}),l}catch(a){let o=a.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 K7e(e){let t={};if(!t["content-length"]){let r=qB.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 hE=class{readable=!0;writable=!0;constructor(){}async readdir(t=".",r){return await dE.default.readdir(t,r)}async stat(t){let r=await dE.default.stat(t,{bigint:!0});return{size:Number(r.size),bigsize:r.size,isDirectory:r.isDirectory()}}async unlink(t){return await dE.default.unlink(t)}async fetch(t,r){return await pE(t,r)}async openReadableFile(t,r="r"){return new vd(t,r)}async openWritableFile(t,r="w",n){return new vd(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 i=await this.concatenate(n),a=await this.hash(i,r);(s=(o=this.options.crypto)==null?void 0:o.onEnd)==null||s.call(o,{hash:a})}async concatenate(t){return await gd(t)}};var W0=class{crc;constructor(){this.crc=-1}update(t){let r=Y7e(),n=new Uint8Array(t);for(let i=0;i<n.byteLength;i++)this.crc=this.crc>>>8^r[(this.crc^n[i])&255];return this}finalize(){return this.crc=(this.crc^-1)>>>0,this.crc}},J7e=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 Y7e(){return J7e}function wre(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 i=0;i<n.length;i++)typeof n[i]>"u"?t+="=":t+=X7e(n[i])}return t}function X7e(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 NB(e,t){switch(t){case"hex":return Ere(e);case"base64":return Sre(Ere(e));default:throw new Error(t)}}function Are(e,t){switch(t){case"hex":return e;case"base64":return Sre(e);default:throw new Error(t)}}function Sre(e){e.length%2!==0&&(e=`0${e}`);let r=(e.match(/\w{2}/g)||[]).map(n=>String.fromCharCode(parseInt(n,16))).join("");return wre(r)||""}function Ere(e){let t=e.toString(16);return t==="0"?`0${t}`:t}var kx=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 W0;n.update(t);let i=n.finalize();return NB(i,r)}async*hashBatches(t,r="base64"){var a,o;let n=new W0;for await(let s of t)n.update(s),yield s;let i=n.finalize();(o=(a=this.options.crypto)==null?void 0:a.onEnd)==null||o.call(a,{hash:NB(i,r)})}};var Cre=typeof atob=="function"?atob:typeof Buffer=="function"?iqe:kre,Q7e=Cre("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="),UB=WebAssembly&&Cre!==kre?nqe(Q7e).buffer:!1,qu=aqe(),GB=240*16*16,Dre=Math.floor(GB*16*1.066666667),Z7e=268435456-65536,Tre="Parameter must be Buffer, ArrayBuffer or Uint8Array",eqe="Parameter exceeds max size of 255.9 Mbytes";UB||console.log("WebAssembly not available or WASM module could not be decoded; md5WASM will fall back to JavaScript");function zB(e){var t,r,n,i,a,o,s,u,c,l;let f=rqe(),p=tqe(),d={},h=new Date().getTime();return d.then=function(_){return s=_,m(),d},d.catch=function(_){return u=_,d},e&&typeof e=="object"?typeof Buffer=="function"&&e.constructor===Buffer?o=e:e.constructor===Uint8Array||e.constructor===ArrayBuffer?o=e.constructor===ArrayBuffer?new Uint8Array(e):e:b(new TypeError(Tre)):b(new TypeError(Tre)),o&&(a=o.length,UB&&a>Dre?a>Z7e?b(new Error(eqe)):(t=new WebAssembly.Memory({initial:a>32e6?a>64e6?a>128e6?4096:2048:1024:512}),r=new Uint32Array(t.buffer),i={mem:t,log:console.log},n={imports:i},WebAssembly.instantiate(UB,n).then(v)):m(f(o))),d;function v(_){m(p(o,_.instance.exports,r))}function m(_){var E=Boolean(_)?_:c;Boolean(_)&&(l=new Date().getTime()),typeof s=="function"?Boolean(E)&&(s(E,l-h),s=u=null):Boolean(_)&&(c=_)}function b(_){typeof u=="function"&&u(_)}}function tqe(){var e,t,r,n,i,a,o,s,u,c,l,f,p,d=function(h){var v,m,b,_,E,T,S,D,I,L,F,P,M,U,W,V,Z,ee,ge,de,he,Ae,Ne=new Date().getTime(),qe=0,te=1732584193,H=-271733879,Q=-1732584194,re=271733878,Ie=0,Xe=h.length*8,it;for(it=Se(h,p),p[Xe>>>5]|=128<<Xe%32,p[(Xe+64>>>9<<4)+14]=Xe,it=(Xe+64>>>9<<4)+15,he=p;Ie<it;)it>Ie+Dre?(n(te),a(H),s(Q),c(re),t(GB),Ie=Ie+GB*16,te=r(),H=i(),Q=o(),re=u(),qe++):(Z=te,ee=H,ge=Q,de=re,v=he[Ie+0]>>>0,m=he[Ie+1]>>>0,b=he[Ie+2]>>>0,_=he[Ie+3]>>>0,E=he[Ie+4]>>>0,T=he[Ie+5]>>>0,S=he[Ie+6]>>>0,D=he[Ie+7]>>>0,I=he[Ie+8]>>>0,L=he[Ie+9]>>>0,F=he[Ie+10]>>>0,P=he[Ie+11]>>>0,M=he[Ie+12]>>>0,U=he[Ie+13]>>>0,W=he[Ie+14]>>>0,V=he[Ie+15]>>>0,te=ue(7,25,te+(H&Q|~H&re)+v-680876936)+H,re=ue(12,20,re+(te&H|~te&Q)+m-389564586)+te,Q=ue(17,15,Q+(re&te|~re&H)+b+606105819)+re,H=ue(22,10,H+(Q&re|~Q&te)+_-1044525330)+Q,te=ue(7,25,te+(H&Q|~H&re)+E-176418897)+H,re=ue(12,20,re+(te&H|~te&Q)+T+1200080426)+te,Q=ue(17,15,Q+(re&te|~re&H)+S-1473231341)+re,H=ue(22,10,H+(Q&re|~Q&te)+D-45705983)+Q,te=ue(7,25,te+(H&Q|~H&re)+I+1770035416)+H,re=ue(12,20,re+(te&H|~te&Q)+L-1958414417)+te,Q=ue(17,15,Q+(re&te|~re&H)+F-42063)+re,H=ue(22,10,H+(Q&re|~Q&te)+P-1990404162)+Q,te=ue(7,25,te+(H&Q|~H&re)+M+1804603682)+H,re=ue(12,20,re+(te&H|~te&Q)+U-40341101)+te,Q=ue(17,15,Q+(re&te|~re&H)+W-1502002290)+re,H=ue(22,10,H+(Q&re|~Q&te)+V+1236535329)+Q,te=ue(5,27,te+(H&re|Q&~re)+m-165796510)+H,re=ue(9,23,re+(te&Q|H&~Q)+S-1069501632)+te,Q=ue(14,18,Q+(re&H|te&~H)+P+643717713)+re,H=ue(20,12,H+(Q&te|re&~te)+v-373897302)+Q,te=ue(5,27,te+(H&re|Q&~re)+T-701558691)+H,re=ue(9,23,re+(te&Q|H&~Q)+F+38016083)+te,Q=ue(14,18,Q+(re&H|te&~H)+V-660478335)+re,H=ue(20,12,H+(Q&te|re&~te)+E-405537848)+Q,te=ue(5,27,te+(H&re|Q&~re)+L+568446438)+H,re=ue(9,23,re+(te&Q|H&~Q)+W-1019803690)+te,Q=ue(14,18,Q+(re&H|te&~H)+_-187363961)+re,H=ue(20,12,H+(Q&te|re&~te)+I+1163531501)+Q,te=ue(5,27,te+(H&re|Q&~re)+U-1444681467)+H,re=ue(9,23,re+(te&Q|H&~Q)+b-51403784)+te,Q=ue(14,18,Q+(re&H|te&~H)+D+1735328473)+re,H=ue(20,12,H+(Q&te|re&~te)+M-1926607734)+Q,te=ue(4,28,te+(H^Q^re)+T-378558)+H,re=ue(11,21,re+(te^H^Q)+I-2022574463)+te,Q=ue(16,16,Q+(re^te^H)+P+1839030562)+re,H=ue(23,9,H+(Q^re^te)+W-35309556)+Q,te=ue(4,28,te+(H^Q^re)+m-1530992060)+H,re=ue(11,21,re+(te^H^Q)+E+1272893353)+te,Q=ue(16,16,Q+(re^te^H)+D-155497632)+re,H=ue(23,9,H+(Q^re^te)+F-1094730640)+Q,te=ue(4,28,te+(H^Q^re)+U+681279174)+H,re=ue(11,21,re+(te^H^Q)+v-358537222)+te,Q=ue(16,16,Q+(re^te^H)+_-722521979)+re,H=ue(23,9,H+(Q^re^te)+S+76029189)+Q,te=ue(4,28,te+(H^Q^re)+L-640364487)+H,re=ue(11,21,re+(te^H^Q)+M-421815835)+te,Q=ue(16,16,Q+(re^te^H)+V+530742520)+re,H=ue(23,9,H+(Q^re^te)+b-995338651)+Q,te=ue(6,26,te+(Q^(H|~re))+v-198630844)+H,re=ue(10,22,re+(H^(te|~Q))+D+1126891415)+te,Q=ue(15,17,Q+(te^(re|~H))+W-1416354905)+re,H=ue(21,11,H+(re^(Q|~te))+T-57434055)+Q,te=ue(6,26,te+(Q^(H|~re))+M+1700485571)+H,re=ue(10,22,re+(H^(te|~Q))+_-1894986606)+te,Q=ue(15,17,Q+(te^(re|~H))+F-1051523)+re,H=ue(21,11,H+(re^(Q|~te))+m-2054922799)+Q,te=ue(6,26,te+(Q^(H|~re))+I+1873313359)+H,re=ue(10,22,re+(H^(te|~Q))+V-30611744)+te,Q=ue(15,17,Q+(te^(re|~H))+S-1560198380)+re,H=ue(21,11,H+(re^(Q|~te))+U+1309151649)+Q,te=ue(6,26,te+(Q^(H|~re))+E-145523070)+H,re=ue(10,22,re+(H^(te|~Q))+P-1120210379)+te,Q=ue(15,17,Q+(te^(re|~H))+b+718787259)+re,H=ue(21,11,H+(re^(Q|~te))+L-343485551)+Q,Ie=Ie+16,te=te+Z>>>0,H=H+ee>>>0,Q=Q+ge>>>0,re=re+de>>>0);return qu.endian([te,H,Q,re]);function ue(we,ut,Pe){return Pe<<we|Pe>>>ut}function Se(we,ut){for(var Pe=-1,ft=Math.floor((we.length-1)/4),Ct=0,dr,oe,Ue,Ze;ft-8>Pe++;)Ct=Pe<<2,ut[Pe]=we[Ct+0]|we[Ct+1]<<8|we[Ct+2]<<16|we[Ct+3]<<24;for(Pe--;ft>Pe++;)Ct=Pe<<2,dr=typeof we[Ct+0]>"u"?0:we[Ct+0],oe=typeof we[Ct+1]>"u"?0:we[Ct+1],Ue=typeof we[Ct+2]>"u"?0:we[Ct+2],Ze=typeof we[Ct+3]>"u"?0:we[Ct+3],ut[Pe]=dr|oe<<8|Ue<<16|Ze<<24;return ft+1}};return function(h,v,m,b){var _;return t=v.loops,e=v.loop,r=v.getA,i=v.getB,o=v.getC,u=v.getD,l=v.getX,n=v.setA,a=v.setB,s=v.setC,c=v.setD,f=v.setX,p=m,_=qu.wordsToBytes(d(h)),b&&b.asBytes?_:qu.bytesconvertNumberToHex(_)}}function rqe(){var e=function(t,r){var n,i,a,o,s,u,c,l,f,p,d,h,v,m,b,_,E,T,S,D,I,L=new Date().getTime(),F=1732584193,P=-271733879,M=-1732584194,U=271733878,W=t.length*8;I=qu.bytesToWords(t);for(var V=0;V<I.length;V++)I[V]=(I[V]<<8|I[V]>>>24)&16711935|(I[V]<<24|I[V]>>>8)&4278255360;I[W>>>5]|=128<<W%32,I[(W+64>>>9<<4)+14]=W;for(var Z=0;Z<I.length;Z+=16)E=F,T=P,S=M,D=U,n=I[Z+0]>>>0,i=I[Z+1]>>>0,a=I[Z+2]>>>0,o=I[Z+3]>>>0,s=I[Z+4]>>>0,u=I[Z+5]>>>0,c=I[Z+6]>>>0,l=I[Z+7]>>>0,f=I[Z+8]>>>0,p=I[Z+9]>>>0,d=I[Z+10]>>>0,h=I[Z+11]>>>0,v=I[Z+12]>>>0,m=I[Z+13]>>>0,b=I[Z+14]>>>0,_=I[Z+15]>>>0,F=ee(7,25,F+(P&M|~P&U)+n-680876936)+P,U=ee(12,20,U+(F&P|~F&M)+i-389564586)+F,M=ee(17,15,M+(U&F|~U&P)+a+606105819)+U,P=ee(22,10,P+(M&U|~M&F)+o-1044525330)+M,F=ee(7,25,F+(P&M|~P&U)+s-176418897)+P,U=ee(12,20,U+(F&P|~F&M)+u+1200080426)+F,M=ee(17,15,M+(U&F|~U&P)+c-1473231341)+U,P=ee(22,10,P+(M&U|~M&F)+l-45705983)+M,F=ee(7,25,F+(P&M|~P&U)+f+1770035416)+P,U=ee(12,20,U+(F&P|~F&M)+p-1958414417)+F,M=ee(17,15,M+(U&F|~U&P)+d-42063)+U,P=ee(22,10,P+(M&U|~M&F)+h-1990404162)+M,F=ee(7,25,F+(P&M|~P&U)+v+1804603682)+P,U=ee(12,20,U+(F&P|~F&M)+m-40341101)+F,M=ee(17,15,M+(U&F|~U&P)+b-1502002290)+U,P=ee(22,10,P+(M&U|~M&F)+_+1236535329)+M,F=ee(5,27,F+(P&U|M&~U)+i-165796510)+P,U=ee(9,23,U+(F&M|P&~M)+c-1069501632)+F,M=ee(14,18,M+(U&P|F&~P)+h+643717713)+U,P=ee(20,12,P+(M&F|U&~F)+n-373897302)+M,F=ee(5,27,F+(P&U|M&~U)+u-701558691)+P,U=ee(9,23,U+(F&M|P&~M)+d+38016083)+F,M=ee(14,18,M+(U&P|F&~P)+_-660478335)+U,P=ee(20,12,P+(M&F|U&~F)+s-405537848)+M,F=ee(5,27,F+(P&U|M&~U)+p+568446438)+P,U=ee(9,23,U+(F&M|P&~M)+b-1019803690)+F,M=ee(14,18,M+(U&P|F&~P)+o-187363961)+U,P=ee(20,12,P+(M&F|U&~F)+f+1163531501)+M,F=ee(5,27,F+(P&U|M&~U)+m-1444681467)+P,U=ee(9,23,U+(F&M|P&~M)+a-51403784)+F,M=ee(14,18,M+(U&P|F&~P)+l+1735328473)+U,P=ee(20,12,P+(M&F|U&~F)+v-1926607734)+M,F=ee(4,28,F+(P^M^U)+u-378558)+P,U=ee(11,21,U+(F^P^M)+f-2022574463)+F,M=ee(16,16,M+(U^F^P)+h+1839030562)+U,P=ee(23,9,P+(M^U^F)+b-35309556)+M,F=ee(4,28,F+(P^M^U)+i-1530992060)+P,U=ee(11,21,U+(F^P^M)+s+1272893353)+F,M=ee(16,16,M+(U^F^P)+l-155497632)+U,P=ee(23,9,P+(M^U^F)+d-1094730640)+M,F=ee(4,28,F+(P^M^U)+m+681279174)+P,U=ee(11,21,U+(F^P^M)+n-358537222)+F,M=ee(16,16,M+(U^F^P)+o-722521979)+U,P=ee(23,9,P+(M^U^F)+c+76029189)+M,F=ee(4,28,F+(P^M^U)+p-640364487)+P,U=ee(11,21,U+(F^P^M)+v-421815835)+F,M=ee(16,16,M+(U^F^P)+_+530742520)+U,P=ee(23,9,P+(M^U^F)+a-995338651)+M,F=ee(6,26,F+(M^(P|~U))+n-198630844)+P,U=ee(10,22,U+(P^(F|~M))+l+1126891415)+F,M=ee(15,17,M+(F^(U|~P))+b-1416354905)+U,P=ee(21,11,P+(U^(M|~F))+u-57434055)+M,F=ee(6,26,F+(M^(P|~U))+v+1700485571)+P,U=ee(10,22,U+(P^(F|~M))+o-1894986606)+F,M=ee(15,17,M+(F^(U|~P))+d-1051523)+U,P=ee(21,11,P+(U^(M|~F))+i-2054922799)+M,F=ee(6,26,F+(M^(P|~U))+f+1873313359)+P,U=ee(10,22,U+(P^(F|~M))+_-30611744)+F,M=ee(15,17,M+(F^(U|~P))+c-1560198380)+U,P=ee(21,11,P+(U^(M|~F))+m+1309151649)+M,F=ee(6,26,F+(M^(P|~U))+s-145523070)+P,U=ee(10,22,U+(P^(F|~M))+h-1120210379)+F,M=ee(15,17,M+(F^(U|~P))+a+718787259)+U,P=ee(21,11,P+(U^(M|~F))+p-343485551)+M,F=F+E>>>0,P=P+T>>>0,M=M+S>>>0,U=U+D>>>0;return qu.endian([F,P,M,U]);function ee(ge,de,he){return he<<ge|he>>>de}};return function(t,r){var n=qu.wordsToBytes(e(t,r)),i=r&&r.asBytes?n:qu.bytesconvertNumberToHex(n);return i}}function nqe(e){var t,r,n,i=-1;for(t=e.length-1,r=new ArrayBuffer(e.length),n=new Uint8Array(r);t>i++;)n[i]=e.charCodeAt(i);return n}function iqe(e){return Buffer.from(e,"base64").toString("binary")}function kre(e){return e}function aqe(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";return{rotl:function(t,r){return t<<r|t>>>32-r},endian:function(t){if(t.constructor==Number)return qu.rotl(t,8)&16711935|qu.rotl(t,24)&4278255360;for(var r=0;r<t.length;r++)t[r]=qu.endian(t[r]);return t},bytesToWords:function(t){for(var r=[],n=0,i=0;n<t.length;n++,i+=8)r[i>>>5]|=t[n]<<24-i%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 Nu=class extends $c{name="md5";options;constructor(t={}){super(),this.options=t}async hash(t,r){let i=await new Promise((a,o)=>zB(t).then(a).catch(o));return Are(i,r)}};var Fx=Lt(require("crypto"),1),mE=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 i,a,o,s;let n=(o=(a=(i=this.options)==null?void 0:i.crypto)==null?void 0:a.algorithm)==null?void 0:o.toLowerCase();try{if(!Fx.createHash)throw new Error("crypto.createHash not available");let u=(s=Fx.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 a,o,s,u,c,l,f;if(!Fx.createHash)throw new Error("crypto.createHash not available");let n=(u=Fx.createHash)==null?void 0:u((s=(o=(a=this.options)==null?void 0:a.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 i=n.digest(r);(f=(l=(c=this.options)==null?void 0:c.crypto)==null?void 0:l.onEnd)==null||f.call(l,{hash:i})}};var Hre=require("process");var Fre=Lt(require("stream"),1),HB=class{},oqe=Fre.Readable||HB;function VB(e,t){let r=e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]();return new WB(r,t)}var WB=class extends oqe{_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,i,a,o;this._iterator&&(t?await((i=(n=this._iterator)==null?void 0:n.throw)==null?void 0:i.call(n,t)):await((o=(a=this._iterator)==null?void 0:a.return)==null?void 0:o.call(a,t)),r==null||r(null))}async _pull(t,r){var a;let n=this._bytesMode,i=null;for(;this.readable&&!(i=await r.next()).done&&(t!==null&&(t-=n&&ArrayBuffer.isView(i.value)?i.value.byteLength:1),!(!this.push(new Uint8Array(i.value))||t<=0)););return(i!=null&&i.done||!this.readable)&&(this.push(null)||!0)&&((a=r==null?void 0:r.return)==null||a.call(r)),!this.readable}};var Ore=Lt(Pre(),1);delete globalThis.ReadableStream;var vE=class extends Ore.ReadableStream{};var xE=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(i){t.error(i);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 bE=class extends vE{_chunks;constructor(t){super(new xE(t.values()),{type:"bytes"}),this._chunks=t}async*[Symbol.asyncIterator](t){let r=this.getReader();yield*this._chunks,r.releaseLock()}};var xd=class{type;size;parts;constructor(t=[],r={}){this.parts=[],this.size=0;for(let n of t)if(typeof n=="string"){let i=new TextEncoder().encode(n);this.parts.push(i),this.size+=i.byteLength}else if(n instanceof xd)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:i,byteOffset:a,byteLength:o}=n;this.parts.push(new Uint8Array(i,a,o)),this.size+=o}else{let i=new TextEncoder().encode(String(n));this.parts.push(i),this.size+=i.byteLength}this.type=sqe(r.type)}slice(t=0,r=this.size,n=""){let{size:i,parts:a}=this,o=t<0?Math.max(i+t,0):Math.min(t,i),s=r<0?Math.max(i+r,0):Math.min(r,i),u=Math.max(s-o,0),c=new xd([],{type:n});if(u===0)return c;let l=0,f=[];for(let p of a){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 bE(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 i of this.parts)r.set(i,n),n+=i.byteLength;return t}};function sqe(e=""){let t=String(e).toLowerCase();return/[^\u0020-\u007E]/.test(t)?"":t}function uqe(){return typeof Blob>"u"&&!globalThis.Blob&&(globalThis.Blob=xd),globalThis.Blob}var cqe=uqe();var yE=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,${hv(r)}`;this.onload&&this.onload({target:{result:n}})}async readAsText(t){let r=await t.text();this.onload&&this.onload({target:{result:r}})}};var _E=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 Ire(){return typeof FileReader>"u"&&!globalThis.FileReader&&(globalThis.FileReader=yE),typeof File>"u"&&!globalThis.File&&(globalThis.File=_E),global}var lqe=Ire();var $B=Lt(require("module"),1),Rre=Lt(require("path"),1),EE=Lt(require("fs"),1);async function jre(e){return e.startsWith("http")?await(await fetch(e)).arrayBuffer():EE.default.readFileSync(e).buffer}async function Mre(e){return e.startsWith("http")?await(await fetch(e)).text():EE.default.readFileSync(e,"utf8")}async function Lre(e){if(e.startsWith("http")){let n=await(await fetch(e)).text();return wE(n)}e.startsWith("/")||(e=`${process.cwd()}/${e}`);let t=EE.default.readFileSync(e,"utf8");return wE(t)}function wE(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=$B.default._nodeModulePaths(Rre.default.dirname(t)),i=typeof module<"u"&&(module==null?void 0:module.parent),a=new $B.default(t,i);return a.filename=t,a.paths=[].concat((r==null?void 0:r.prependPaths)||[]).concat(n).concat((r==null?void 0:r.appendPaths)||[]),a._compile(e,t),i&&i.children&&i.children.splice(i.children.indexOf(a),1),a.exports}var Rs=class{map;constructor(t){this.map={},t instanceof Rs?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=Bx(t),r=qre(r);let n=this.map[t];this.map[t]=n?`${n}, ${r}`:r}delete(t){delete this.map[Bx(t)]}get(t){return t=Bx(t),this.has(t)?this.map[t]:null}has(t){return this.map.hasOwnProperty(Bx(t))}set(t,r){this.map[Bx(t)]=qre(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)}),KB(t)}values(){let t=[];return this.forEach(function(r){t.push(r)}),KB(t)}entries(){let t=[];return this.forEach(function(r,n){t.push([n,r])}),KB(t)}*[Symbol.iterator](){yield*this.entries()}};function Bx(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 qre(e){return typeof e!="string"&&(e=String(e)),e}function KB(e){let t={next(){let r=e.shift();return{done:r===void 0,value:r}}};return t[Symbol.iterator]=function(){return t},t}function JB(e,t){if(!e)throw new Error(`@loaders.gl/polyfills assertion ${t}`)}var XB=Lt(require("stream"),1),fqe=e=>typeof e=="boolean",Nre=e=>typeof e=="function",pqe=e=>e!==null&&typeof e=="object",YB=e=>pqe(e)&&Nre(e.read)&&Nre(e.pipe)&&fqe(e.readable),Kc=class{ok;status;statusText;headers;url;bodyUsed=!1;_body;constructor(t,r){let{headers:n,status:i=200,statusText:a="OK",url:o}=r||{};this.url=o,this.ok=i===200,this.status=i,this.statusText=a,this.headers=new Rs((r==null?void 0:r.headers)||{}),YB(t)?this._body=fE(t,n):typeof t=="string"?this._body=XB.Readable.from([new TextEncoder().encode(t)]):this._body=XB.Readable.from([t||new ArrayBuffer(0)])}get body(){return JB(!this.bodyUsed),JB(YB(this._body)),this.bodyUsed=!0,this._body}async arrayBuffer(){return YB(this._body)?await yre(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 Gre=Lt(require("http"),1),zre=Lt(require("https"),1);var dqe=e=>e&&e instanceof ArrayBuffer,hqe=e=>e&&e instanceof Buffer;function Ure(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:mqe(r),mimeType:n}}function mqe(e){if(dqe(e))return e;if(hqe(e))return new Uint8Array(e).buffer;if(ArrayBuffer.isView(e))return e.buffer;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(${JSON.stringify(e,null,2).slice(10)})`)}var QB=e=>e.startsWith("data:"),gqe=e=>e.startsWith("http:")||e.startsWith("https:");async function Px(e,t){try{if(globalThis.fetch!==Px&&(gqe(e)||QB(e)))return await fetch(e,t);if(QB(e)){let{arrayBuffer:c,mimeType:l}=Ure(e);return new Kc(c,{headers:{"content-type":l},url:e})}let r={},n=e;e.endsWith(".gz")&&(e=e.slice(0,-3),r["content-encoding"]="gzip");let i=await vqe(n,t),a=_qe(e,i,r),{status:o,statusText:s}=yqe(i),u=!t||t.followRedirect||t.followRedirect===void 0;if(o>=300&&o<400&&a.has("location")&&u){let c=xqe(e,a.get("location"));return await Px(c,t)}return new Kc(i,{headers:a,status:o,statusText:s,url:e})}catch(r){return new Kc(null,{status:400,statusText:String(r),url:e})}}async function vqe(e,t){return await new Promise((r,n)=>{let i=bqe(e,t),a=e.startsWith("https:")?zre.default.request(i,o=>r(o)):Gre.default.request(i,o=>r(o));a.on("error",o=>n(o)),a.end()})}function xqe(e,t){if(t.startsWith("http"))return t;let r=new URL(e);return r.pathname=t,r.href}function bqe(e,t){let r=(t==null?void 0:t.headers)||{},n={};for(let a of Object.keys(r))n[a.toLowerCase()]=r[a];n["accept-encoding"]=n["accept-encoding"]||"gzip,br,deflate";let i=new URL(e);return{hostname:i.hostname,path:i.pathname,method:"GET",...t,...t==null?void 0:t.fetch,headers:n,port:i.port}}function yqe(e){return e.statusCode?{status:e.statusCode,statusText:e.statusMessage||"NA"}:{status:200,statusText:"OK"}}function _qe(e,t,r={}){let n={};if(t&&t.headers){let i=t.headers;for(let a in i){let o=i[a];n[a.toLowerCase()]=String(o)}}if(!n["content-length"]){let i=wqe(e);Number.isFinite(i)&&(n["content-length"]=i)}return Object.assign(n,r),new Rs(n)}function wqe(e){return QB(e)?e.length-5:null}var Eqe=parseInt(Hre.versions.node.split(".")[0]);iz&&console.error("loaders.gl: The @loaders.gl/polyfills should only be used in Node.js environments");globalThis.loaders=globalThis.loaders||{};globalThis.loaders.makeNodeStream=VB;globalThis.loaders.NodeFile=vd;globalThis.loaders.NodeFileSystem=hE;globalThis.loaders.fetchNode=pE;globalThis.loaders.NodeHash=mE;globalThis.TextEncoder||(globalThis.TextEncoder=dv);globalThis.TextDecoder||(globalThis.TextDecoder=Hp);!("atob"in globalThis)&&hv&&(globalThis.atob=hv);!("btoa"in globalThis)&&fD&&(globalThis.btoa=fD);globalThis.loaders.encodeImageNode=sV;globalThis.loaders.parseImageNode=gB;globalThis.loaders.imageFormatsNode=mB;globalThis._parseImageNode=gB;globalThis._imageFormatsNode=mB;globalThis.loaders.readFileAsArrayBuffer=jre;globalThis.loaders.readFileAsText=Mre;globalThis.loaders.requireFromFile=Lre;globalThis.loaders.requireFromString=wE;Eqe<18&&(!("Headers"in globalThis)&&Rs&&(globalThis.Headers=Rs),!("Response"in globalThis)&&Kc&&(globalThis.Response=Kc),!("fetch"in globalThis)&&Px&&(globalThis.fetch=Px));var lTe=require("path"),H4=Lt(cge(),1);var xn={OBJECT_ID_TYPE:"OBJECTID",STRING_TYPE:"string",DOUBLE_TYPE:"double",SHORT_INT_TYPE:"Int32"};var bT=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:xn.OBJECT_ID_TYPE,...t},n=!1,i=this._attributeStorageInfo.length;for(let a in r)if(!this._attributeStorageInfo.find(s=>s.name===a)){let s=r[a],u=this.createStorageAttribute(i,a,s),c=this.getFieldAttributeType(s),l=this.createFieldAttribute(a,c);this._attributeStorageInfo.push(u),this._fields.push(l),i+=1,n=!0}if(n){let a=[];for(let o of this._attributeStorageInfo)a.push(o.name);this._popupInfo=this.createPopupInfo(a)}}fromObject(t){this._attributeStorageInfo=t.attributeStorageInfo,this._fields=t.fields,this._popupInfo=t.popupInfo}createStorageAttribute(t,r,n){let i={key:`f_${t}`,name:r,ordering:["attributeValues"],header:[{property:"count",valueType:"UInt32"}],attributeValues:{valueType:"Int32",valuesPerElement:1}};switch(n){case xn.OBJECT_ID_TYPE:this.setupIdAttribute(i);break;case xn.STRING_TYPE:this.setupStringAttribute(i);break;case xn.DOUBLE_TYPE:this.setupDoubleAttribute(i);break;case xn.SHORT_INT_TYPE:break;default:this.setupStringAttribute(i)}return i}getFieldAttributeType(t){switch(t){case xn.OBJECT_ID_TYPE:return"esriFieldTypeOID";case xn.STRING_TYPE:return"esriFieldTypeString";case xn.SHORT_INT_TYPE:return"esriFieldTypeInteger";case xn.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=[],i=[],a=[],o=[];for(let s of t)i.push({fieldName:s,visible:!0,isEditable:!1,label:s});return a.push({fieldInfos:i,type:"fields"}),{title:r,mediaInfos:n,popupElements:a,fieldInfos:i,expressionInfos:o}}};var Pbt=e=>typeof e=="boolean",qb=e=>typeof e=="function",Wd=e=>e!==null&&typeof e=="object",Ej=e=>Wd(e)&&e.constructor==={}.constructor;var lge=e=>Boolean(e)&&typeof e[Symbol.iterator]=="function",fge=e=>e&&typeof e[Symbol.asyncIterator]=="function";var Vo=e=>typeof Response<"u"&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json;var $o=e=>typeof Blob<"u"&&e instanceof Blob,pge=e=>e&&typeof e=="object"&&e.isBuffer;var Obt=e=>typeof ReadableStream<"u"&&e instanceof ReadableStream||Wd(e)&&qb(e.tee)&&qb(e.cancel)&&qb(e.getReader);var Ibt=e=>Wd(e)&&qb(e.read)&&qb(e.pipe)&&Pbt(e.readable),yT=e=>Obt(e)||Ibt(e);var _T=class extends Error{constructor(t,r){super(t),this.reason=r.reason,this.url=r.url,this.response=r.response}reason;url;response};var Rbt=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,jbt=/^([-\w.]+\/[-\w.+]+)/;function Aj(e,t){return e.toLowerCase()===t.toLowerCase()}function dge(e){let t=jbt.exec(e);return t?t[1]:e}function Sj(e){let t=Rbt.exec(e);return t?t[1]:""}var hge=/\?.*/;function mge(e){let t=e.match(hge);return t&&t[0]}function xg(e){return e.replace(hge,"")}function gge(e){if(e.length<50)return e;let t=e.slice(e.length-15);return`${e.substr(0,32)}...${t}`}function Vd(e){return Vo(e)?e.url:$o(e)?e.name||"":typeof e=="string"?e:""}function Nb(e){if(Vo(e)){let t=e,r=t.headers.get("content-type")||"",n=xg(t.url);return dge(r)||Sj(n)}return $o(e)?e.type||"":typeof e=="string"?Sj(e):""}function vge(e){return Vo(e)?e.headers["content-length"]||-1:$o(e)?e.size:typeof e=="string"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function wT(e){if(Vo(e))return e;let t={},r=vge(e);r>=0&&(t["content-length"]=String(r));let n=Vd(e),i=Nb(e);i&&(t["content-type"]=i);let a=await Lbt(e);a&&(t["x-first-bytes"]=a),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 xge(e){if(!e.ok)throw await Mbt(e)}async function Mbt(e){let t=gge(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 i=e.headers.get("Content-Type");n.reason=i!=null&&i.includes("application/json")?await e.json():e.text()}catch{}return new _T(r,n)}async function Lbt(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 i=new FileReader;i.onload=a=>{var o;return n((o=a==null?void 0:a.target)==null?void 0:o.result)},i.readAsDataURL(r)})}if(e instanceof ArrayBuffer){let r=e.slice(0,5);return`data:base64,${qbt(r)}`}return null}function qbt(e){let t="",r=new Uint8Array(e);for(let n=0;n<r.byteLength;n++)t+=String.fromCharCode(r[n]);return btoa(t)}function Nbt(e){return!Ubt(e)&&!Gbt(e)}function Ubt(e){return e.startsWith("http:")||e.startsWith("https:")}function Gbt(e){return e.startsWith("data:")}async function Pa(e,t){var r,n;if(typeof e=="string"){let i=Lu(e);return Nbt(i)&&(r=globalThis.loaders)!=null&&r.fetchNode?(n=globalThis.loaders)==null?void 0:n.fetchNode(i,t):await fetch(i,t)}return await wT(e)}var Tj=new Iu({id:"loaders.gl"}),ET=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},AT=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 Cj={fetch:null,mimeType:void 0,nothrow:!1,log:new AT,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:jr,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},bge={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function Dj(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state||(e._state={}),e._state}function bg(){let e=Dj();return e.globalOptions=e.globalOptions||{...Cj},e.globalOptions}function wge(e,t,r,n){return r=r||[],r=Array.isArray(r)?r:[r],zbt(e,r),Wbt(t,e,n)}function zbt(e,t){yge(e,null,Cj,bge,t);for(let r of t){let n=e&&e[r.id]||{},i=r.options&&r.options[r.id]||{},a=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};yge(n,r.id,i,a,t)}}function yge(e,t,r,n,i){let a=t||"Top level",o=t?`${t}.`:"";for(let s in e){let u=!t&&Wd(e[s]),c=s==="baseUri"&&!t,l=s==="workerUrl"&&t;if(!(s in r)&&!c&&!l){if(s in n)Tj.warn(`${a} loader option '${o}${s}' no longer supported, use '${n[s]}'`)();else if(!u){let f=Hbt(s,i);Tj.warn(`${a} loader option '${o}${s}' not recognized. ${f}`)()}}}}function Hbt(e,t){let r=e.toLowerCase(),n="";for(let i of t)for(let a in i.options){if(e===a)return`Did you mean '${i.id}.${a}'?`;let o=a.toLowerCase();(r.startsWith(o)||o.startsWith(r))&&(n=n||`Did you mean '${i.id}.${a}'?`)}return n}function Wbt(e,t,r){let i={...e.options||{}};return Vbt(i,r),i.log===null&&(i.log=new ET),_ge(i,bg()),_ge(i,t),i}function _ge(e,t){for(let r in t)if(r in t){let n=t[r];Ej(n)&&Ej(e[r])?e[r]={...e[r],...t[r]}:e[r]=t[r]}}function Vbt(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)}function Ub(e){return e?(Array.isArray(e)&&(e=e[0]),Array.isArray(e==null?void 0:e.extensions)):!1}function kj(e){Rt(e,"null loader"),Rt(Ub(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 $bt=()=>{let e=Dj();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function Ege(){return $bt()}var Age=new Iu({id:"loaders.gl"});var Kbt=/\.([^.]+)$/;async function Cge(e,t=[],r,n){if(!Dge(e))return null;let i=Sge(e,t,{...r,nothrow:!0},n);if(i)return i;if($o(e)&&(e=await e.slice(0,10).arrayBuffer(),i=Sge(e,t,r,n)),!i&&!(r!=null&&r.nothrow))throw new Error(kge(e));return i}function Sge(e,t=[],r,n){if(!Dge(e))return null;if(t&&!Array.isArray(t))return kj(t);let i=[];t&&(i=i.concat(t)),r!=null&&r.ignoreRegisteredLoaders||i.push(...Ege()),Ybt(i);let a=Jbt(e,i,r,n);if(!a&&!(r!=null&&r.nothrow))throw new Error(kge(e));return a}function Jbt(e,t,r,n){let i=Vd(e),a=Nb(e),o=xg(i)||(n==null?void 0:n.url),s=null,u="";return r!=null&&r.mimeType&&(s=Fj(t,r==null?void 0:r.mimeType),u=`match forced by supplied MIME type ${r==null?void 0:r.mimeType}`),s=s||Xbt(t,o),u=u||(s?`matched url ${o}`:""),s=s||Fj(t,a),u=u||(s?`matched MIME type ${a}`:""),s=s||Zbt(t,e),u=u||(s?`matched initial data ${Fge(e)}`:""),r!=null&&r.fallbackMimeType&&(s=s||Fj(t,r==null?void 0:r.fallbackMimeType),u=u||(s?`matched fallback MIME type ${a}`:"")),u&&Age.log(1,`selectLoader selected ${s==null?void 0:s.name}: ${u}.`),s}function Dge(e){return!(e instanceof Response&&e.status===204)}function kge(e){let t=Vd(e),r=Nb(e),n="No valid loader found (";n+=t?`${$a.filename(t)}, `:"no url provided, ",n+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let i=e?Fge(e):"";return n+=i?` first bytes: "${i}"`:"first bytes: not available",n+=")",n}function Ybt(e){for(let t of e)kj(t)}function Xbt(e,t){let r=t&&Kbt.exec(t),n=r&&r[1];return n?Qbt(e,n):null}function Qbt(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 Fj(e,t){var r;for(let n of e)if((r=n.mimeTypes)!=null&&r.some(i=>Aj(t,i))||Aj(t,`application/x.${n.id}`))return n;return null}function Zbt(e,t){if(!t)return null;for(let r of e)if(typeof t=="string"){if(eyt(t,r))return r}else if(ArrayBuffer.isView(t)){if(Tge(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer&&Tge(t,0,r))return r;return null}function eyt(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some(n=>e.startsWith(n))}function Tge(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(i=>tyt(e,t,r,i))}function tyt(e,t,r,n){if(n instanceof ArrayBuffer)return Mu(n,e,n.byteLength);switch(typeof n){case"function":return n(e);case"string":let i=Bj(e,t,n.length);return n===i;default:return!1}}function Fge(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?Bj(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?Bj(e,0,t):""}function Bj(e,t,r){if(e.byteLength<t+r)return"";let n=new DataView(e),i="";for(let a=0;a<r;a++)i+=String.fromCharCode(n.getUint8(t+a));return i}function*Bge(e,t){let r=(t==null?void 0:t.chunkSize)||262144,n=0,i=new TextEncoder;for(;n<e.length;){let a=Math.min(e.length-n,r),o=e.slice(n,n+a);n+=a,yield i.encode(o)}}function*Pge(e,t={}){let{chunkSize:r=262144}=t,n=0;for(;n<e.byteLength;){let i=Math.min(e.byteLength-n,r),a=new ArrayBuffer(i),o=new Uint8Array(e,n,i);new Uint8Array(a).set(o),n+=i,yield a}}async function*Oge(e,t){let r=(t==null?void 0:t.chunkSize)||1048576,n=0;for(;n<e.size;){let i=n+r,a=await e.slice(n,i).arrayBuffer();n=i,yield a}}function Pj(e,t){return jr?ryt(e,t):nyt(e,t)}async function*ryt(e,t){let r=e.getReader(),n;try{for(;;){let i=n||r.read();t!=null&&t._streamReadAhead&&(n=r.read());let{done:a,value:o}=await i;if(a)return;yield Hc(o)}}catch{r.releaseLock()}}async function*nyt(e,t){for await(let r of e)yield Hc(r)}function Ige(e,t){if(typeof e=="string")return Bge(e,t);if(e instanceof ArrayBuffer)return Pge(e,t);if($o(e))return Oge(e,t);if(yT(e))return Pj(e,t);if(Vo(e))return Pj(e.body,t);throw new Error("makeIterator")}var Rge="Cannot convert supplied data type";function iyt(e,t,r){if(t.text&&typeof e=="string")return e;if(pge(e)&&(e=e.buffer),e instanceof ArrayBuffer){let n=e;return t.text&&!t.binary?new TextDecoder("utf8").decode(n):n}if(ArrayBuffer.isView(e)){if(t.text&&!t.binary)return new TextDecoder("utf8").decode(e);let n=e.buffer,i=e.byteLength||e.length;return(e.byteOffset!==0||i!==n.byteLength)&&(n=n.slice(e.byteOffset,e.byteOffset+i)),n}throw new Error(Rge)}async function jge(e,t,r){let n=e instanceof ArrayBuffer||ArrayBuffer.isView(e);if(typeof e=="string"||n)return iyt(e,t,r);if($o(e)&&(e=await wT(e)),Vo(e)){let i=e;return await xge(i),t.binary?await i.arrayBuffer():await i.text()}if(yT(e)&&(e=Ige(e,r)),lge(e)||fge(e))return gd(e);throw new Error(Rge)}function ST(e,t){let r=bg(),n=e||r;return typeof n.fetch=="function"?n.fetch:Wd(n.fetch)?i=>Pa(i,n.fetch):t!=null&&t.fetch?t==null?void 0:t.fetch:Pa}function Mge(e,t,r){if(r)return r;let n={fetch:ST(t,e),...e};if(n.url){let i=xg(n.url);n.baseUrl=i,n.queryString=mge(n.url),n.filename=$a.filename(i),n.baseUrl=$a.dirname(i)}return Array.isArray(n.loaders)||(n.loaders=null),n}function Lge(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 bo(e,t,r,n){t&&!Array.isArray(t)&&!Ub(t)&&(n=void 0,r=t,t=void 0),e=await e,r=r||{};let i=Vd(e),o=Lge(t,n),s=await Cge(e,o,r);return s?(r=wge(r,s,o,i),n=Mge({url:i,_parse:bo,loaders:o},r,n||null),await ayt(s,e,r,n)):null}async function ayt(e,t,r,n){if(CB(e),r=yB(e.options,r),Vo(t)){let a=t,{ok:o,redirected:s,status:u,statusText:c,type:l,url:f}=a,p=Object.fromEntries(a.headers.entries());n.response={headers:p,ok:o,redirected:s,status:u,statusText:c,type:l,url:f}}t=await jge(t,e,r);let i=e;if(i.parseTextSync&&typeof t=="string")return i.parseTextSync(t,r,n);if(kB(e,r))return await FB(e,t,r,n,bo);if(i.parseText&&typeof t=="string")return await i.parseText(t,r,n);if(i.parse)return await i.parse(t,r,n);throw Wi(!i.parseSync),new Error(`${e.id} loader - no parser found and worker is disabled`)}function qge(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 Oj(e){let t=1/0,r=1/0,n=1/0,i=-1/0,a=-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,i=l>i?l:i,a=f>a?f:a,o=p>o?p:o}return[[t,r,n],[i,a,o]]}function Ij(e,t,r){let n=qge(t.value),i=r||Nge(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:n}]},nullable:!1,metadata:i}}function Nge(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 fn(e,t,r,n){let i,a;!Array.isArray(t)&&!Ub(t)?(i=[],a=t,n=void 0):(i=t,a=r);let o=ST(a),s=e;return typeof e=="string"&&(s=await o(e)),$o(e)&&(s=await o(e)),Array.isArray(i)?await bo(s,i,a):await bo(s,i,a)}async function yg(e,t,r){return r={...bg(),...r},t.encodeURLtoURL?oyt(t,e,r):BB(t,r)?await TB(t,e,r):await t.encode(e,r)}function TT(e,t,r){if(t.encodeSync)return t.encodeSync(e,r);if(t.encodeTextSync)return new TextEncoder().encode(t.encodeTextSync(e,r));throw new Error(`Writer ${t.name} could not synchronously encode data`)}async function Gge(e,t,r,n){if(e=Lu(e),t=Lu(t),jr||!r.encodeURLtoURL)throw new Error;return await r.encodeURLtoURL(e,t,n)}async function oyt(e,t,r){if(jr)throw new Error(`Writer ${e.name} not supported in browser`);let n=Uge("input");await new Wc(n,"w").write(t);let a=Uge("output"),o=await Gge(n,a,e,r);return(await Pa(o)).arrayBuffer()}function Uge(e){return`/tmp/${e}`}var syt=1/Math.PI*180,uyt=1/180*Math.PI,cyt={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...cyt}};var Qr=globalThis.mathgl.config;function Rj(e,{precision:t=Qr.precision}={}){return e=lyt(e),"".concat(parseFloat(e.toPrecision(t)))}function Ko(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function jj(e){return zge(e)}function Mj(e){return cl(e)}function zge(e,t){return qj(e,r=>r*uyt,t)}function cl(e,t){return qj(e,r=>r*syt,t)}function Lj(e,t,r){return qj(e,n=>Math.max(t,Math.min(r,n)))}function yo(e,t,r){let n=Qr.EPSILON;r&&(Qr.EPSILON=r);try{if(e===t)return!0;if(Ko(e)&&Ko(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(!yo(e[i],t[i]))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)<=Qr.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{Qr.EPSILON=n}}function lyt(e){return Math.round(e/Qr.EPSILON)*Qr.EPSILON}function fyt(e){return e.clone?e.clone():new Array(e.length)}function qj(e,t,r){if(Ko(e)){let n=e;r=r||fyt(n);for(let i=0;i<r.length&&i<n.length;++i){let a=typeof e=="number"?e:e[i];r[i]=t(a,i,r)}return r}return t(e)}function pyt(e){function t(){var r=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(r,Object.getPrototypeOf(this)),r}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}var tp=class extends pyt(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:Ko(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Qr)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+Rj(this[n],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(r,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!yo(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 i=0;i<this.ELEMENTS;++i){let a=t[i],o=typeof r=="number"?r:r[i];this[i]=a+n*(o-a)}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(Qr.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let 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 dyt(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 nr(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(JSON.stringify(e)));return e}function rp(e,t,r=""){if(Qr.debug&&!dyt(e,t))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return e}function Pi(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}var np=class extends tp{get x(){return this[0]}set x(t){this[0]=nr(t)}get y(){return this[1]}set y(t){this[1]=nr(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 i=this[n]-t[n];r+=i*i}return nr(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return nr(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 Pi(t>=0&&t<this.ELEMENTS,"index is out of range"),nr(this[t])}setComponent(t,r){return Pi(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 bn=typeof Float32Array<"u"?Float32Array:Array,Gb=Math.random;function _g(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var lnr=Math.PI/180;function hyt(){let e=new bn(2);return bn!=Float32Array&&(e[0]=0,e[1]=0),e}function Hge(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e}function Wge(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5],e}function CT(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e}function DT(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e}var fnr=function(){let e=hyt();return function(t,r,n,i,a,o){let s,u;for(r||(r=2),n||(n=0),i?u=Math.min(i*r+n,t.length):u=t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],a(e,e,o),t[s]=e[0],t[s+1]=e[1];return t}}();function kT(e,t,r){let n=t[0],i=t[1],a=r[3]*n+r[7]*i||1;return e[0]=(r[0]*n+r[4]*i)/a,e[1]=(r[1]*n+r[5]*i)/a,e}function FT(e,t,r){let n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a||1;return e[0]=(r[0]*n+r[4]*i+r[8]*a)/o,e[1]=(r[1]*n+r[5]*i+r[9]*a)/o,e[2]=(r[2]*n+r[6]*i+r[10]*a)/o,e}function Vge(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e}function $ge(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e[3]=t[3],e}function BT(e,t,r){let n=t[0],i=t[1],a=t[2];return e[0]=r[0]*n+r[3]*i+r[6]*a,e[1]=r[1]*n+r[4]*i+r[7]*a,e[2]=r[2]*n+r[5]*i+r[8]*a,e[3]=t[3],e}var $d=class extends np{constructor(t=0,r=0){super(2),Ko(t)&&arguments.length===1?this.copy(t):(Qr.debug&&(nr(t),nr(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 Qr.debug&&(nr(t.x),nr(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 DT(this,this,t),this.check()}transformAsVector(t){return kT(this,this,t),this.check()}transformByMatrix3(t){return CT(this,this,t),this.check()}transformByMatrix2x3(t){return Wge(this,this,t),this.check()}transformByMatrix2(t){return Hge(this,this,t),this.check()}};var Eg={};ui(Eg,{add:()=>xyt,angle:()=>Hj,bezier:()=>Byt,ceil:()=>byt,clone:()=>myt,copy:()=>gyt,create:()=>PT,cross:()=>Kd,dist:()=>Nyt,distance:()=>Qge,div:()=>qyt,divide:()=>Xge,dot:()=>zb,equals:()=>jyt,exactEquals:()=>Ryt,floor:()=>yyt,forEach:()=>zyt,fromValues:()=>OT,hermite:()=>Fyt,inverse:()=>Cyt,len:()=>Wj,length:()=>Kge,lerp:()=>Dyt,max:()=>wyt,min:()=>_yt,mul:()=>Lyt,multiply:()=>Yge,negate:()=>Tyt,normalize:()=>Nj,random:()=>Pyt,rotateX:()=>Uj,rotateY:()=>Gj,rotateZ:()=>zj,round:()=>Eyt,scale:()=>Ayt,scaleAndAdd:()=>Syt,set:()=>vyt,slerp:()=>kyt,sqrDist:()=>Uyt,sqrLen:()=>Gyt,squaredDistance:()=>Zge,squaredLength:()=>e1e,str:()=>Iyt,sub:()=>Myt,subtract:()=>Jge,transformMat3:()=>Hb,transformMat4:()=>Jd,transformQuat:()=>Wb,zero:()=>Oyt});function PT(){let e=new bn(3);return bn!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function myt(e){let t=new bn(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Kge(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function OT(e,t,r){let n=new bn(3);return n[0]=e,n[1]=t,n[2]=r,n}function gyt(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function vyt(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function xyt(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function Jge(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function Yge(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function Xge(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function byt(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function yyt(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function _yt(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 wyt(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]=_g(t[0]),e[1]=_g(t[1]),e[2]=_g(t[2]),e}function Ayt(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function Syt(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 Qge(e,t){let r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(r*r+n*n+i*i)}function Zge(e,t){let r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return r*r+n*n+i*i}function e1e(e){let t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function Tyt(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function Cyt(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Nj(e,t){let r=t[0],n=t[1],i=t[2],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function zb(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Kd(e,t,r){let n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2];return e[0]=i*u-a*s,e[1]=a*o-n*u,e[2]=n*s-i*o,e}function Dyt(e,t,r,n){let i=t[0],a=t[1],o=t[2];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e}function kyt(e,t,r,n){let i=Math.acos(Math.min(Math.max(zb(t,r),-1),1)),a=Math.sin(i),o=Math.sin((1-n)*i)/a,s=Math.sin(n*i)/a;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 Fyt(e,t,r,n,i,a){let o=a*a,s=o*(2*a-3)+1,u=o*(a-2)+a,c=o*(a-1),l=o*(3-2*a);return e[0]=t[0]*s+r[0]*u+n[0]*c+i[0]*l,e[1]=t[1]*s+r[1]*u+n[1]*c+i[1]*l,e[2]=t[2]*s+r[2]*u+n[2]*c+i[2]*l,e}function Byt(e,t,r,n,i,a){let o=1-a,s=o*o,u=a*a,c=s*o,l=3*a*s,f=3*u*o,p=u*a;return e[0]=t[0]*c+r[0]*l+n[0]*f+i[0]*p,e[1]=t[1]*c+r[1]*l+n[1]*f+i[1]*p,e[2]=t[2]*c+r[2]*l+n[2]*f+i[2]*p,e}function Pyt(e,t){t=t===void 0?1:t;let r=Gb()*2*Math.PI,n=Gb()*2-1,i=Math.sqrt(1-n*n)*t;return e[0]=Math.cos(r)*i,e[1]=Math.sin(r)*i,e[2]=n*t,e}function Jd(e,t,r){let n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,e}function Hb(e,t,r){let n=t[0],i=t[1],a=t[2];return e[0]=n*r[0]+i*r[3]+a*r[6],e[1]=n*r[1]+i*r[4]+a*r[7],e[2]=n*r[2]+i*r[5]+a*r[8],e}function Wb(e,t,r){let n=r[0],i=r[1],a=r[2],o=r[3],s=t[0],u=t[1],c=t[2],l=i*c-a*u,f=a*s-n*c,p=n*u-i*s,d=i*p-a*f,h=a*l-n*p,v=n*f-i*l,m=o*2;return l*=m,f*=m,p*=m,d*=2,h*=2,v*=2,e[0]=s+l+d,e[1]=u+f+h,e[2]=c+p+v,e}function Uj(e,t,r,n){let i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function Gj(e,t,r,n){let i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function zj(e,t,r,n){let i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function Hj(e,t){let r=e[0],n=e[1],i=e[2],a=t[0],o=t[1],s=t[2],u=Math.sqrt((r*r+n*n+i*i)*(a*a+o*o+s*s)),c=u&&zb(e,t)/u;return Math.acos(Math.min(Math.max(c,-1),1))}function Oyt(e){return e[0]=0,e[1]=0,e[2]=0,e}function Iyt(e){return"vec3(".concat(e[0],", ").concat(e[1],", ").concat(e[2],")")}function Ryt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function jyt(e,t){let r=e[0],n=e[1],i=e[2],a=t[0],o=t[1],s=t[2];return Math.abs(r-a)<=1e-6*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-o)<=1e-6*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-s)<=1e-6*Math.max(1,Math.abs(i),Math.abs(s))}var Myt=Jge,Lyt=Yge,qyt=Xge,Nyt=Qge,Uyt=Zge,Wj=Kge,Gyt=e1e,zyt=function(){let e=PT();return function(t,r,n,i,a,o){let s,u;for(r||(r=3),n||(n=0),i?u=Math.min(i*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],a(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2];return t}}();var Vj=[0,0,0],IT,ce=class extends np{static get ZERO(){return IT||(IT=new ce(0,0,0),Object.freeze(IT)),IT}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&Ko(t)?this.copy(t):(Qr.debug&&(nr(t),nr(r),nr(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 Qr.debug&&(nr(t.x),nr(t.y),nr(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]=nr(t)}angle(t){return Hj(this,t)}cross(t){return Kd(this,this,t),this.check()}rotateX({radians:t,origin:r=Vj}){return Uj(this,this,r,t),this.check()}rotateY({radians:t,origin:r=Vj}){return Gj(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=Vj}){return zj(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Jd(this,this,t),this.check()}transformAsVector(t){return FT(this,this,t),this.check()}transformByMatrix3(t){return Hb(this,this,t),this.check()}transformByMatrix2(t){return Vge(this,this,t),this.check()}transformByQuaternion(t){return Wb(this,this,t),this.check()}};var RT,Jo=class extends np{static get ZERO(){return RT||(RT=new Jo(0,0,0,0),Object.freeze(RT)),RT}constructor(t=0,r=0,n=0,i=0){super(-0,-0,-0,-0),Ko(t)&&arguments.length===1?this.copy(t):(Qr.debug&&(nr(t),nr(r),nr(n),nr(i)),this[0]=t,this[1]=r,this[2]=n,this[3]=i)}set(t,r,n,i){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,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 Qr.debug&&(nr(t.x),nr(t.y),nr(t.z),nr(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]=nr(t)}get w(){return this[3]}set w(t){this[3]=nr(t)}transform(t){return Jd(this,this,t),this.check()}transformByMatrix3(t){return BT(this,this,t),this.check()}transformByMatrix2(t){return $ge(this,this,t),this.check()}transformByQuaternion(t){return Wb(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Ag=class extends tp{toString(){let t="[";if(Qr.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)t+=" ".concat(this[n*this.RANK+r])}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=" ".concat(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]=nr(n),this}getColumn(t,r=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)r[i]=this[n+i];return r}setColumn(t,r){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)this[n+i]=r[i];return this}};function t1e(){let e=new bn(9);return bn!=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 r1e(e,t){if(e===t){let r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}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 n1e(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],f=l*o-s*c,p=-l*a+s*u,d=c*a-o*u,h=r*f+n*p+i*d;return h?(h=1/h,e[0]=f*h,e[1]=(-l*n+i*c)*h,e[2]=(s*n-i*o)*h,e[3]=p*h,e[4]=(l*r-i*u)*h,e[5]=(-s*r+i*a)*h,e[6]=d*h,e[7]=(-c*r+n*u)*h,e[8]=(o*r-n*a)*h,e):null}function i1e(e){let t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8];return t*(c*a-o*u)+r*(-c*i+o*s)+n*(u*i-a*s)}function $j(e,t,r){let n=t[0],i=t[1],a=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],v=r[3],m=r[4],b=r[5],_=r[6],E=r[7],T=r[8];return e[0]=p*n+d*o+h*c,e[1]=p*i+d*s+h*l,e[2]=p*a+d*u+h*f,e[3]=v*n+m*o+b*c,e[4]=v*i+m*s+b*l,e[5]=v*a+m*u+b*f,e[6]=_*n+E*o+T*c,e[7]=_*i+E*s+T*l,e[8]=_*a+E*u+T*f,e}function a1e(e,t,r){let n=t[0],i=t[1],a=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]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=u,e[6]=p*n+d*o+c,e[7]=p*i+d*s+l,e[8]=p*a+d*u+f,e}function o1e(e,t,r){let n=t[0],i=t[1],a=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*i+p*s,e[2]=d*a+p*u,e[3]=d*o-p*n,e[4]=d*s-p*i,e[5]=d*u-p*a,e[6]=c,e[7]=l,e[8]=f,e}function Kj(e,t,r){let n=r[0],i=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function s1e(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,f=n*s,p=i*o,d=i*s,h=i*u,v=a*o,m=a*s,b=a*u;return e[0]=1-f-h,e[3]=l-b,e[6]=p+m,e[1]=l+b,e[4]=1-c-h,e[7]=d-v,e[2]=p-m,e[5]=d+v,e[8]=1-c-f,e}var Jj;(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"})(Jj||(Jj={}));var Wyt=Object.freeze([1,0,0,0,1,0,0,0,1]),Sr=class extends Ag{static get IDENTITY(){return $yt()}static get ZERO(){return Vyt()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Jj}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(Wyt)}fromObject(t){return this.check()}fromQuaternion(t){return s1e(this,t),this.check()}set(t,r,n,i,a,o,s,u,c){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=a,this[5]=o,this[6]=s,this[7]=u,this[8]=c,this.check()}setRowMajor(t,r,n,i,a,o,s,u,c){return this[0]=t,this[1]=i,this[2]=s,this[3]=r,this[4]=a,this[5]=u,this[6]=n,this[7]=o,this[8]=c,this.check()}determinant(){return i1e(this)}transpose(){return r1e(this,this),this.check()}invert(){return n1e(this,this),this.check()}multiplyLeft(t){return $j(this,t,this),this.check()}multiplyRight(t){return $j(this,this,t),this.check()}rotate(t){return o1e(this,this,t),this.check()}scale(t){return Array.isArray(t)?Kj(this,this,t):Kj(this,this,[t,t]),this.check()}translate(t){return a1e(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=CT(r||[-0,-0],t,this);break;case 3:n=Hb(r||[-0,-0,-0],t,this);break;case 4:n=BT(r||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return rp(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)}},jT,MT=null;function Vyt(){return jT||(jT=new Sr([0,0,0,0,0,0,0,0,0]),Object.freeze(jT)),jT}function $yt(){return MT||(MT=new Sr,Object.freeze(MT)),MT}var LT={};ui(LT,{add:()=>x2t,adjoint:()=>Zyt,clone:()=>Jyt,copy:()=>Yyt,create:()=>Kyt,decompose:()=>c2t,determinant:()=>Qj,equals:()=>w2t,exactEquals:()=>_2t,frob:()=>v2t,fromQuat:()=>aM,fromQuat2:()=>o2t,fromRotation:()=>r2t,fromRotationTranslation:()=>c1e,fromRotationTranslationScale:()=>l2t,fromRotationTranslationScaleOrigin:()=>f2t,fromScaling:()=>t2t,fromTranslation:()=>e2t,fromValues:()=>Xyt,fromXRotation:()=>n2t,fromYRotation:()=>i2t,fromZRotation:()=>a2t,frustum:()=>oM,getRotation:()=>u2t,getScaling:()=>l1e,getTranslation:()=>s2t,identity:()=>u1e,invert:()=>Xj,lookAt:()=>cM,mul:()=>E2t,multiply:()=>Vb,multiplyScalar:()=>b2t,multiplyScalarAndAdd:()=>y2t,ortho:()=>uM,orthoNO:()=>p1e,orthoZO:()=>h2t,perspective:()=>sM,perspectiveFromFieldOfView:()=>d2t,perspectiveNO:()=>f1e,perspectiveZO:()=>p2t,rotate:()=>tM,rotateX:()=>rM,rotateY:()=>nM,rotateZ:()=>iM,scale:()=>eM,set:()=>Qyt,str:()=>g2t,sub:()=>A2t,subtract:()=>d1e,targetTo:()=>m2t,translate:()=>Zj,transpose:()=>Yj});function Kyt(){let e=new bn(16);return bn!=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 Jyt(e){let t=new bn(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 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],e}function Xyt(e,t,r,n,i,a,o,s,u,c,l,f,p,d,h,v){let m=new bn(16);return m[0]=e,m[1]=t,m[2]=r,m[3]=n,m[4]=i,m[5]=a,m[6]=o,m[7]=s,m[8]=u,m[9]=c,m[10]=l,m[11]=f,m[12]=p,m[13]=d,m[14]=h,m[15]=v,m}function Qyt(e,t,r,n,i,a,o,s,u,c,l,f,p,d,h,v,m){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=a,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]=v,e[15]=m,e}function u1e(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 Yj(e,t){if(e===t){let r=t[1],n=t[2],i=t[3],a=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]=a,e[11]=t[14],e[12]=i,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 Xj(e,t){let r=t[0],n=t[1],i=t[2],a=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],v=t[13],m=t[14],b=t[15],_=r*s-n*o,E=r*u-i*o,T=r*c-a*o,S=n*u-i*s,D=n*c-a*s,I=i*c-a*u,L=l*v-f*h,F=l*m-p*h,P=l*b-d*h,M=f*m-p*v,U=f*b-d*v,W=p*b-d*m,V=_*W-E*U+T*M+S*P-D*F+I*L;return V?(V=1/V,e[0]=(s*W-u*U+c*M)*V,e[1]=(i*U-n*W-a*M)*V,e[2]=(v*I-m*D+b*S)*V,e[3]=(p*D-f*I-d*S)*V,e[4]=(u*P-o*W-c*F)*V,e[5]=(r*W-i*P+a*F)*V,e[6]=(m*T-h*I-b*E)*V,e[7]=(l*I-p*T+d*E)*V,e[8]=(o*U-s*P+c*L)*V,e[9]=(n*P-r*U-a*L)*V,e[10]=(h*D-v*T+b*_)*V,e[11]=(f*T-l*D-d*_)*V,e[12]=(s*F-o*M-u*L)*V,e[13]=(r*M-n*F+i*L)*V,e[14]=(v*E-h*S-m*_)*V,e[15]=(l*S-f*E+p*_)*V,e):null}function Zyt(e,t){let r=t[0],n=t[1],i=t[2],a=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],v=t[13],m=t[14],b=t[15],_=r*s-n*o,E=r*u-i*o,T=r*c-a*o,S=n*u-i*s,D=n*c-a*s,I=i*c-a*u,L=l*v-f*h,F=l*m-p*h,P=l*b-d*h,M=f*m-p*v,U=f*b-d*v,W=p*b-d*m;return e[0]=s*W-u*U+c*M,e[1]=i*U-n*W-a*M,e[2]=v*I-m*D+b*S,e[3]=p*D-f*I-d*S,e[4]=u*P-o*W-c*F,e[5]=r*W-i*P+a*F,e[6]=m*T-h*I-b*E,e[7]=l*I-p*T+d*E,e[8]=o*U-s*P+c*L,e[9]=n*P-r*U-a*L,e[10]=h*D-v*T+b*_,e[11]=f*T-l*D-d*_,e[12]=s*F-o*M-u*L,e[13]=r*M-n*F+i*L,e[14]=v*E-h*S-m*_,e[15]=l*S-f*E+p*_,e}function Qj(e){let t=e[0],r=e[1],n=e[2],i=e[3],a=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],v=e[14],m=e[15],b=t*o-r*a,_=t*s-n*a,E=r*s-n*o,T=c*h-l*d,S=c*v-f*d,D=l*v-f*h,I=t*D-r*S+n*T,L=a*D-o*S+s*T,F=c*E-l*_+f*b,P=d*E-h*_+v*b;return u*I-i*L+m*F-p*P}function Vb(e,t,r){let n=t[0],i=t[1],a=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],v=t[12],m=t[13],b=t[14],_=t[15],E=r[0],T=r[1],S=r[2],D=r[3];return e[0]=E*n+T*s+S*f+D*v,e[1]=E*i+T*u+S*p+D*m,e[2]=E*a+T*c+S*d+D*b,e[3]=E*o+T*l+S*h+D*_,E=r[4],T=r[5],S=r[6],D=r[7],e[4]=E*n+T*s+S*f+D*v,e[5]=E*i+T*u+S*p+D*m,e[6]=E*a+T*c+S*d+D*b,e[7]=E*o+T*l+S*h+D*_,E=r[8],T=r[9],S=r[10],D=r[11],e[8]=E*n+T*s+S*f+D*v,e[9]=E*i+T*u+S*p+D*m,e[10]=E*a+T*c+S*d+D*b,e[11]=E*o+T*l+S*h+D*_,E=r[12],T=r[13],S=r[14],D=r[15],e[12]=E*n+T*s+S*f+D*v,e[13]=E*i+T*u+S*p+D*m,e[14]=E*a+T*c+S*d+D*b,e[15]=E*o+T*l+S*h+D*_,e}function Zj(e,t,r){let n=r[0],i=r[1],a=r[2],o,s,u,c,l,f,p,d,h,v,m,b;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*a+t[12],e[13]=t[1]*n+t[5]*i+t[9]*a+t[13],e[14]=t[2]*n+t[6]*i+t[10]*a+t[14],e[15]=t[3]*n+t[7]*i+t[11]*a+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],v=t[9],m=t[10],b=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]=v,e[10]=m,e[11]=b,e[12]=o*n+l*i+h*a+t[12],e[13]=s*n+f*i+v*a+t[13],e[14]=u*n+p*i+m*a+t[14],e[15]=c*n+d*i+b*a+t[15]),e}function eM(e,t,r){let n=r[0],i=r[1],a=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]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function tM(e,t,r,n){let i=n[0],a=n[1],o=n[2],s=Math.sqrt(i*i+a*a+o*o),u,c,l,f,p,d,h,v,m,b,_,E,T,S,D,I,L,F,P,M,U,W,V,Z;return s<1e-6?null:(s=1/s,i*=s,a*=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],v=t[4],m=t[5],b=t[6],_=t[7],E=t[8],T=t[9],S=t[10],D=t[11],I=i*i*l+u,L=a*i*l+o*c,F=o*i*l-a*c,P=i*a*l-o*c,M=a*a*l+u,U=o*a*l+i*c,W=i*o*l+a*c,V=a*o*l-i*c,Z=o*o*l+u,e[0]=f*I+v*L+E*F,e[1]=p*I+m*L+T*F,e[2]=d*I+b*L+S*F,e[3]=h*I+_*L+D*F,e[4]=f*P+v*M+E*U,e[5]=p*P+m*M+T*U,e[6]=d*P+b*M+S*U,e[7]=h*P+_*M+D*U,e[8]=f*W+v*V+E*Z,e[9]=p*W+m*V+T*Z,e[10]=d*W+b*V+S*Z,e[11]=h*W+_*V+D*Z,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function rM(e,t,r){let n=Math.sin(r),i=Math.cos(r),a=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]=a*i+c*n,e[5]=o*i+l*n,e[6]=s*i+f*n,e[7]=u*i+p*n,e[8]=c*i-a*n,e[9]=l*i-o*n,e[10]=f*i-s*n,e[11]=p*i-u*n,e}function nM(e,t,r){let n=Math.sin(r),i=Math.cos(r),a=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]=a*i-c*n,e[1]=o*i-l*n,e[2]=s*i-f*n,e[3]=u*i-p*n,e[8]=a*n+c*i,e[9]=o*n+l*i,e[10]=s*n+f*i,e[11]=u*n+p*i,e}function iM(e,t,r){let n=Math.sin(r),i=Math.cos(r),a=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]=a*i+c*n,e[1]=o*i+l*n,e[2]=s*i+f*n,e[3]=u*i+p*n,e[4]=c*i-a*n,e[5]=l*i-o*n,e[6]=f*i-s*n,e[7]=p*i-u*n,e}function e2t(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 t2t(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 r2t(e,t,r){let n=r[0],i=r[1],a=r[2],o=Math.sqrt(n*n+i*i+a*a),s,u,c;return o<1e-6?null:(o=1/o,n*=o,i*=o,a*=o,u=Math.sin(t),s=Math.cos(t),c=1-s,e[0]=n*n*c+s,e[1]=i*n*c+a*u,e[2]=a*n*c-i*u,e[3]=0,e[4]=n*i*c-a*u,e[5]=i*i*c+s,e[6]=a*i*c+n*u,e[7]=0,e[8]=n*a*c+i*u,e[9]=i*a*c-n*u,e[10]=a*a*c+s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function n2t(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 i2t(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 a2t(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 c1e(e,t,r){let n=t[0],i=t[1],a=t[2],o=t[3],s=n+n,u=i+i,c=a+a,l=n*s,f=n*u,p=n*c,d=i*u,h=i*c,v=a*c,m=o*s,b=o*u,_=o*c;return e[0]=1-(d+v),e[1]=f+_,e[2]=p-b,e[3]=0,e[4]=f-_,e[5]=1-(l+v),e[6]=h+m,e[7]=0,e[8]=p+b,e[9]=h-m,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 o2t(e,t){let r=new bn(3),n=-t[0],i=-t[1],a=-t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=n*n+i*i+a*a+o*o;return f>0?(r[0]=(s*o+l*n+u*a-c*i)*2/f,r[1]=(u*o+l*i+c*n-s*a)*2/f,r[2]=(c*o+l*a+s*i-u*n)*2/f):(r[0]=(s*o+l*n+u*a-c*i)*2,r[1]=(u*o+l*i+c*n-s*a)*2,r[2]=(c*o+l*a+s*i-u*n)*2),c1e(e,t,r),e}function s2t(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function l1e(e,t){let r=t[0],n=t[1],i=t[2],a=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+i*i),e[1]=Math.sqrt(a*a+o*o+s*s),e[2]=Math.sqrt(u*u+c*c+l*l),e}function u2t(e,t){let r=new bn(3);l1e(r,t);let n=1/r[0],i=1/r[1],a=1/r[2],o=t[0]*n,s=t[1]*i,u=t[2]*a,c=t[4]*n,l=t[5]*i,f=t[6]*a,p=t[8]*n,d=t[9]*i,h=t[10]*a,v=o+l+h,m=0;return v>0?(m=Math.sqrt(v+1)*2,e[3]=.25*m,e[0]=(f-d)/m,e[1]=(p-u)/m,e[2]=(s-c)/m):o>l&&o>h?(m=Math.sqrt(1+o-l-h)*2,e[3]=(f-d)/m,e[0]=.25*m,e[1]=(s+c)/m,e[2]=(p+u)/m):l>h?(m=Math.sqrt(1+l-o-h)*2,e[3]=(p-u)/m,e[0]=(s+c)/m,e[1]=.25*m,e[2]=(f+d)/m):(m=Math.sqrt(1+h-o-l)*2,e[3]=(s-c)/m,e[0]=(p+u)/m,e[1]=(f+d)/m,e[2]=.25*m),e}function c2t(e,t,r,n){t[0]=n[12],t[1]=n[13],t[2]=n[14];let i=n[0],a=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(i*i+a*a+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],v=1/r[2],m=i*d,b=a*h,_=o*v,E=s*d,T=u*h,S=c*v,D=l*d,I=f*h,L=p*v,F=m+T+L,P=0;return F>0?(P=Math.sqrt(F+1)*2,e[3]=.25*P,e[0]=(S-I)/P,e[1]=(D-_)/P,e[2]=(b-E)/P):m>T&&m>L?(P=Math.sqrt(1+m-T-L)*2,e[3]=(S-I)/P,e[0]=.25*P,e[1]=(b+E)/P,e[2]=(D+_)/P):T>L?(P=Math.sqrt(1+T-m-L)*2,e[3]=(D-_)/P,e[0]=(b+E)/P,e[1]=.25*P,e[2]=(S+I)/P):(P=Math.sqrt(1+L-m-T)*2,e[3]=(b-E)/P,e[0]=(D+_)/P,e[1]=(S+I)/P,e[2]=.25*P),e}function l2t(e,t,r,n){let i=t[0],a=t[1],o=t[2],s=t[3],u=i+i,c=a+a,l=o+o,f=i*u,p=i*c,d=i*l,h=a*c,v=a*l,m=o*l,b=s*u,_=s*c,E=s*l,T=n[0],S=n[1],D=n[2];return e[0]=(1-(h+m))*T,e[1]=(p+E)*T,e[2]=(d-_)*T,e[3]=0,e[4]=(p-E)*S,e[5]=(1-(f+m))*S,e[6]=(v+b)*S,e[7]=0,e[8]=(d+_)*D,e[9]=(v-b)*D,e[10]=(1-(f+h))*D,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function f2t(e,t,r,n,i){let a=t[0],o=t[1],s=t[2],u=t[3],c=a+a,l=o+o,f=s+s,p=a*c,d=a*l,h=a*f,v=o*l,m=o*f,b=s*f,_=u*c,E=u*l,T=u*f,S=n[0],D=n[1],I=n[2],L=i[0],F=i[1],P=i[2],M=(1-(v+b))*S,U=(d+T)*S,W=(h-E)*S,V=(d-T)*D,Z=(1-(p+b))*D,ee=(m+_)*D,ge=(h+E)*I,de=(m-_)*I,he=(1-(p+v))*I;return e[0]=M,e[1]=U,e[2]=W,e[3]=0,e[4]=V,e[5]=Z,e[6]=ee,e[7]=0,e[8]=ge,e[9]=de,e[10]=he,e[11]=0,e[12]=r[0]+L-(M*L+V*F+ge*P),e[13]=r[1]+F-(U*L+Z*F+de*P),e[14]=r[2]+P-(W*L+ee*F+he*P),e[15]=1,e}function aM(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,f=n*s,p=i*o,d=i*s,h=i*u,v=a*o,m=a*s,b=a*u;return e[0]=1-f-h,e[1]=l+b,e[2]=p-m,e[3]=0,e[4]=l-b,e[5]=1-c-h,e[6]=d+v,e[7]=0,e[8]=p+m,e[9]=d-v,e[10]=1-c-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function oM(e,t,r,n,i,a,o){let s=1/(r-t),u=1/(i-n),c=1/(a-o);return e[0]=a*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*u,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(i+n)*u,e[10]=(o+a)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*a*2*c,e[15]=0,e}function f1e(e,t,r,n,i){let a=1/Math.tan(t/2);if(e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let o=1/(n-i);e[10]=(i+n)*o,e[14]=2*i*n*o}else e[10]=-1,e[14]=-2*n;return e}var sM=f1e;function p2t(e,t,r,n,i){let a=1/Math.tan(t/2);if(e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let o=1/(n-i);e[10]=i*o,e[14]=i*n*o}else e[10]=-1,e[14]=-n;return e}function d2t(e,t,r,n){let i=Math.tan(t.upDegrees*Math.PI/180),a=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/(i+a);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]=(i-a)*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 p1e(e,t,r,n,i,a,o){let s=1/(t-r),u=1/(n-i),c=1/(a-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]=(i+n)*u,e[14]=(o+a)*c,e[15]=1,e}var uM=p1e;function h2t(e,t,r,n,i,a,o){let s=1/(t-r),u=1/(n-i),c=1/(a-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]=(i+n)*u,e[14]=a*c,e[15]=1,e}function cM(e,t,r,n){let i,a,o,s,u,c,l,f,p,d,h=t[0],v=t[1],m=t[2],b=n[0],_=n[1],E=n[2],T=r[0],S=r[1],D=r[2];return Math.abs(h-T)<1e-6&&Math.abs(v-S)<1e-6&&Math.abs(m-D)<1e-6?u1e(e):(f=h-T,p=v-S,d=m-D,i=1/Math.sqrt(f*f+p*p+d*d),f*=i,p*=i,d*=i,a=_*d-E*p,o=E*f-b*d,s=b*p-_*f,i=Math.sqrt(a*a+o*o+s*s),i?(i=1/i,a*=i,o*=i,s*=i):(a=0,o=0,s=0),u=p*s-d*o,c=d*a-f*s,l=f*o-p*a,i=Math.sqrt(u*u+c*c+l*l),i?(i=1/i,u*=i,c*=i,l*=i):(u=0,c=0,l=0),e[0]=a,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]=-(a*h+o*v+s*m),e[13]=-(u*h+c*v+l*m),e[14]=-(f*h+p*v+d*m),e[15]=1,e)}function m2t(e,t,r,n){let i=t[0],a=t[1],o=t[2],s=n[0],u=n[1],c=n[2],l=i-r[0],f=a-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,v=c*l-s*p,m=s*f-u*l;return d=h*h+v*v+m*m,d>0&&(d=1/Math.sqrt(d),h*=d,v*=d,m*=d),e[0]=h,e[1]=v,e[2]=m,e[3]=0,e[4]=f*m-p*v,e[5]=p*h-l*m,e[6]=l*v-f*h,e[7]=0,e[8]=l,e[9]=f,e[10]=p,e[11]=0,e[12]=i,e[13]=a,e[14]=o,e[15]=1,e}function g2t(e){return"mat4(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(e[3],", ").concat(e[4],", ").concat(e[5],", ").concat(e[6],", ").concat(e[7],", ").concat(e[8],", ").concat(e[9],", ").concat(e[10],", ").concat(e[11],", ").concat(e[12],", ").concat(e[13],", ").concat(e[14],", ").concat(e[15],")")}function v2t(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 x2t(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 d1e(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 b2t(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 y2t(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 _2t(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 w2t(e,t){let r=e[0],n=e[1],i=e[2],a=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],v=e[13],m=e[14],b=e[15],_=t[0],E=t[1],T=t[2],S=t[3],D=t[4],I=t[5],L=t[6],F=t[7],P=t[8],M=t[9],U=t[10],W=t[11],V=t[12],Z=t[13],ee=t[14],ge=t[15];return Math.abs(r-_)<=1e-6*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(i-T)<=1e-6*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(a-S)<=1e-6*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(o-D)<=1e-6*Math.max(1,Math.abs(o),Math.abs(D))&&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-F)<=1e-6*Math.max(1,Math.abs(c),Math.abs(F))&&Math.abs(l-P)<=1e-6*Math.max(1,Math.abs(l),Math.abs(P))&&Math.abs(f-M)<=1e-6*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(p-U)<=1e-6*Math.max(1,Math.abs(p),Math.abs(U))&&Math.abs(d-W)<=1e-6*Math.max(1,Math.abs(d),Math.abs(W))&&Math.abs(h-V)<=1e-6*Math.max(1,Math.abs(h),Math.abs(V))&&Math.abs(v-Z)<=1e-6*Math.max(1,Math.abs(v),Math.abs(Z))&&Math.abs(m-ee)<=1e-6*Math.max(1,Math.abs(m),Math.abs(ee))&&Math.abs(b-ge)<=1e-6*Math.max(1,Math.abs(b),Math.abs(ge))}var E2t=Vb,A2t=d1e;function S2t(){let e=new bn(4);return bn!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function h1e(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 m1e(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 g1e(e){let t=e[0],r=e[1],n=e[2],i=e[3];return Math.sqrt(t*t+r*r+n*n+i*i)}function v1e(e){let t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}function x1e(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=n*o,e[2]=i*o,e[3]=a*o,e}function b1e(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function y1e(e,t,r,n){let i=t[0],a=t[1],o=t[2],s=t[3];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e[3]=s+n*(r[3]-s),e}function _1e(e,t,r){let n=t[0],i=t[1],a=t[2],o=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,e[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,e[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,e[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,e}function w1e(e,t,r){let n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],c=r[3],l=c*n+s*a-u*i,f=c*i+u*n-o*a,p=c*a+o*i-s*n,d=-o*n-s*i-u*a;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 znr=function(){let e=S2t();return function(t,r,n,i,a,o){let s,u;for(r||(r=4),n||(n=0),i?u=Math.min(i*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],a(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 pM;(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"})(pM||(pM={}));var C2t=45*Math.PI/180,D2t=1,lM=.1,fM=500,k2t=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),zr=class extends Ag{static get IDENTITY(){return B2t()}static get ZERO(){return F2t()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return pM}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,i,a,o,s,u,c,l,f,p,d,h,v,m){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=a,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]=v,this[15]=m,this.check()}setRowMajor(t,r,n,i,a,o,s,u,c,l,f,p,d,h,v,m){return this[0]=t,this[1]=a,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]=v,this[12]=i,this[13]=u,this[14]=p,this[15]=m,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(k2t)}fromObject(t){return this.check()}fromQuaternion(t){return aM(this,t),this.check()}frustum(t){let{left:r,right:n,bottom:i,top:a,near:o=lM,far:s=fM}=t;return s===1/0?P2t(this,r,n,i,a,o):oM(this,r,n,i,a,o,s),this.check()}lookAt(t){let{eye:r,center:n=[0,0,0],up:i=[0,1,0]}=t;return cM(this,r,n,i),this.check()}ortho(t){let{left:r,right:n,bottom:i,top:a,near:o=lM,far:s=fM}=t;return uM(this,r,n,i,a,o,s),this.check()}orthographic(t){let{fovy:r=C2t,aspect:n=D2t,focalDistance:i=1,near:a=lM,far:o=fM}=t;E1e(r);let s=r/2,u=i*Math.tan(s),c=u*n;return this.ortho({left:-c,right:c,bottom:-u,top:u,near:a,far:o})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:n=1,near:i=.1,far:a=500}=t;return E1e(r),sM(this,r,n,i,a),this.check()}determinant(){return Qj(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),i=1/n[0],a=1/n[1],o=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*a,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*i,t[5]=this[5]*a,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*i,t[9]=this[9]*a,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),i=1/n[0],a=1/n[1],o=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*a,t[2]=this[2]*o,t[3]=this[4]*i,t[4]=this[5]*a,t[5]=this[6]*o,t[6]=this[8]*i,t[7]=this[9]*a,t[8]=this[10]*o,t}transpose(){return Yj(this,this),this.check()}invert(){return Xj(this,this),this.check()}multiplyLeft(t){return Vb(this,t,this),this.check()}multiplyRight(t){return Vb(this,this,t),this.check()}rotateX(t){return rM(this,this,t),this.check()}rotateY(t){return nM(this,this,t),this.check()}rotateZ(t){return iM(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return tM(this,this,t,r),this.check()}scale(t){return eM(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Zj(this,this,t),this.check()}transform(t,r){return t.length===4?(r=_1e(r||[-0,-0,-0,-0],t,this),rp(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,i;switch(n){case 2:i=DT(r||[-0,-0],t,this);break;case 3:i=Jd(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return rp(i,t.length),i}transformAsVector(t,r){let n;switch(t.length){case 2:n=kT(r||[-0,-0],t,this);break;case 3:n=FT(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return rp(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])}},qT,NT;function F2t(){return qT||(qT=new zr([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(qT)),qT}function B2t(){return NT||(NT=new zr,Object.freeze(NT)),NT}function E1e(e){if(e>Math.PI*2)throw Error("expected radians")}function P2t(e,t,r,n,i,a){let o=2*a/(r-t),s=2*a/(i-n),u=(r+t)/(r-t),c=(i+n)/(i-n),l=-1,f=-1,p=-2*a;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 A1e(){let e=new bn(4);return bn!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function S1e(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function dM(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 hM(e,t,r){let n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],u=r[1],c=r[2],l=r[3];return e[0]=n*l+o*s+i*c-a*u,e[1]=i*l+o*u+a*s-n*c,e[2]=a*l+o*c+n*u-i*s,e[3]=o*l-n*s-i*u-a*c,e}function T1e(e,t,r){r*=.5;let n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+o*s,e[1]=i*u+a*s,e[2]=a*u-i*s,e[3]=o*u-n*s,e}function C1e(e,t,r){r*=.5;let n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u-a*s,e[1]=i*u+o*s,e[2]=a*u+n*s,e[3]=o*u-i*s,e}function D1e(e,t,r){r*=.5;let n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+i*s,e[1]=i*u-n*s,e[2]=a*u+o*s,e[3]=o*u-a*s,e}function k1e(e,t){let r=t[0],n=t[1],i=t[2];return e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),e}function $b(e,t,r,n){let i=t[0],a=t[1],o=t[2],s=t[3],u=r[0],c=r[1],l=r[2],f=r[3],p,d,h,v,m;return p=i*u+a*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),m=Math.sin(d),h=Math.sin((1-n)*d)/m,v=Math.sin(n*d)/m):(h=1-n,v=n),e[0]=h*i+v*u,e[1]=h*a+v*c,e[2]=h*o+v*l,e[3]=h*s+v*f,e}function F1e(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return e[0]=-r*s,e[1]=-n*s,e[2]=-i*s,e[3]=a*s,e}function B1e(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function mM(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 i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);let a=(i+1)%3,o=(i+2)%3;n=Math.sqrt(t[i*3+i]-t[a*3+a]-t[o*3+o]+1),e[i]=.5*n,n=.5/n,e[3]=(t[a*3+o]-t[o*3+a])*n,e[a]=(t[a*3+i]+t[i*3+a])*n,e[o]=(t[o*3+i]+t[i*3+o])*n}return e}var P1e=h1e;var O1e=m1e,I1e=b1e,R1e=y1e,j1e=g1e;var M1e=v1e;var L1e=x1e;var q1e=function(){let e=PT(),t=OT(1,0,0),r=OT(0,1,0);return function(n,i,a){let o=zb(i,a);return o<-.999999?(Kd(e,t,i),Wj(e)<1e-6&&Kd(e,r,i),Nj(e,e),dM(n,e,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Kd(e,i,a),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+o,L1e(n,n))}}(),nir=function(){let e=A1e(),t=A1e();return function(r,n,i,a,o,s){return $b(e,n,o,s),$b(t,i,a,s),$b(r,e,t,2*s*(1-s)),r}}(),iir=function(){let e=t1e();return function(t,r,n,i){return e[0]=n[0],e[3]=n[1],e[6]=n[2],e[1]=i[0],e[4]=i[1],e[7]=i[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],L1e(t,mM(t,e))}}();var O2t=[0,0,0,1],tc=class extends tp{constructor(t=0,r=0,n=0,i=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,n,i)}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,i){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,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 mM(this,t),this.check()}fromAxisRotation(t,r){return dM(this,t,r),this.check()}identity(){return S1e(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]=nr(t)}get y(){return this[1]}set y(t){this[1]=nr(t)}get z(){return this[2]}set z(t){this[2]=nr(t)}get w(){return this[3]}set w(t){this[3]=nr(t)}len(){return j1e(this)}lengthSquared(){return M1e(this)}dot(t){return I1e(this,t)}rotationTo(t,r){return q1e(this,t,r),this.check()}add(t){return P1e(this,this,t),this.check()}calculateW(){return k1e(this,this),this.check()}conjugate(){return B1e(this,this),this.check()}invert(){return F1e(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(R1e(this,t,r,n),this.check())}multiplyRight(t){return hM(this,this,t),this.check()}multiplyLeft(t){return hM(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 T1e(this,this,t),this.check()}rotateY(t){return C1e(this,this,t),this.check()}rotateZ(t){return D1e(this,this,t),this.check()}scale(t){return O1e(this,this,t),this.check()}slerp(t,r,n){let i,a,o;switch(arguments.length){case 1:({start:i=O2t,target:a,ratio:o}=t);break;case 2:i=this,a=t,o=r;break;default:i=t,a=r,o=n}return $b(this,i,a,o),this.check()}transformVector4(t,r=new Jo){return w1e(r,t,this),rp(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 Hs={};ui(Hs,{EPSILON1:()=>I2t,EPSILON10:()=>z2t,EPSILON11:()=>H2t,EPSILON12:()=>W2t,EPSILON13:()=>V2t,EPSILON14:()=>$2t,EPSILON15:()=>K2t,EPSILON16:()=>J2t,EPSILON17:()=>Y2t,EPSILON18:()=>X2t,EPSILON19:()=>Q2t,EPSILON2:()=>R2t,EPSILON20:()=>Z2t,EPSILON3:()=>j2t,EPSILON4:()=>M2t,EPSILON5:()=>L2t,EPSILON6:()=>q2t,EPSILON7:()=>N2t,EPSILON8:()=>U2t,EPSILON9:()=>G2t,PI_OVER_FOUR:()=>t_t,PI_OVER_SIX:()=>r_t,PI_OVER_TWO:()=>e_t,TWO_PI:()=>n_t});var I2t=.1,R2t=.01,j2t=.001,M2t=1e-4,L2t=1e-5,q2t=1e-6,N2t=1e-7,U2t=1e-8,G2t=1e-9,z2t=1e-10,H2t=1e-11,W2t=1e-12,V2t=1e-13,$2t=1e-14,K2t=1e-15,J2t=1e-16,Y2t=1e-17,X2t=1e-18,Q2t=1e-19,Z2t=1e-20,e_t=Math.PI/2,t_t=Math.PI/4,r_t=Math.PI/6,n_t=Math.PI*2;var ll=6356752314245179e-9,i_t={radii:[6378137,6378137,ll],radiiSquared:[6378137*6378137,6378137*6378137,ll*ll],oneOverRadii:[1/6378137,1/6378137,1/ll],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(ll*ll)],maximumRadius:Math.max(6378137,6378137,ll),centerToleranceSquared:.1};function UT(e){return e}var Rir=new ce;function a_t(e,t=[],r=UT){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 N1e(e,t=[]){return a_t(e,t,Qr._cartographicRadians?UT:jj)}function o_t(e,t,r=UT){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 U1e(e,t){return o_t(e,t,Qr._cartographicRadians?UT:Mj)}var G1e=1e-14,s_t=new ce,z1e={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"}},gM={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Kb={east:new ce,north:new ce,up:new ce,west:new ce,south:new ce,down:new ce},u_t=new ce,c_t=new ce,l_t=new ce;function vM(e,t,r,n,i,a){let o=z1e[t]&&z1e[t][r];Pi(o&&(!n||n===o));let s,u,c,l=s_t.copy(i);if(yo(l.x,0,G1e)&&yo(l.y,0,G1e)){let p=Math.sign(l.z);s=u_t.fromArray(gM[t]),t!=="east"&&t!=="west"&&s.scale(p),u=c_t.fromArray(gM[r]),r!=="east"&&r!=="west"&&u.scale(p),c=l_t.fromArray(gM[n]),n!=="east"&&n!=="west"&&c.scale(p)}else{let{up:p,east:d,north:h}=Kb;d.set(-l.y,l.x,0).normalize(),e.geodeticSurfaceNormal(l,p),h.copy(p).cross(d);let{down:v,west:m,south:b}=Kb;v.copy(p).scale(-1),m.copy(d).scale(-1),b.copy(h).scale(-1),s=Kb[t],u=Kb[r],c=Kb[n]}return a[0]=s.x,a[1]=s.y,a[2]=s.z,a[3]=0,a[4]=u.x,a[5]=u.y,a[6]=u.z,a[7]=0,a[8]=c.x,a[9]=c.y,a[10]=c.z,a[11]=0,a[12]=l.x,a[13]=l.y,a[14]=l.z,a[15]=1,a}var Sg=new ce,f_t=new ce,p_t=new ce;function H1e(e,t,r=[]){let{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:a}=t;Sg.from(e);let o=Sg.x,s=Sg.y,u=Sg.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,v=p+d+h,m=Math.sqrt(1/v);if(!Number.isFinite(m))return;let b=f_t;if(b.copy(e).scale(m),v<a)return b.to(r);let _=i.x,E=i.y,T=i.z,S=p_t;S.set(b.x*_*2,b.y*E*2,b.z*T*2);let D=(1-m)*Sg.len()/(.5*S.len()),I=0,L,F,P,M;do{D-=I,L=1/(1+D*_),F=1/(1+D*E),P=1/(1+D*T);let U=L*L,W=F*F,V=P*P,Z=U*L,ee=W*F,ge=V*P;M=p*U+d*W+h*V-1;let he=-2*(p*Z*_+d*ee*E+h*ge*T);I=M/he}while(Math.abs(M)>Hs.EPSILON12);return Sg.scale([L,F,P]).to(r)}var GT=new ce,W1e=new ce,m_t=new ce,Ws=new ce,g_t=new ce,zT=new ce,Zt=class{constructor(t=0,r=0,n=0){St(this,"radii",void 0),St(this,"radiiSquared",void 0),St(this,"radiiToTheFourth",void 0),St(this,"oneOverRadii",void 0),St(this,"oneOverRadiiSquared",void 0),St(this,"minimumRadius",void 0),St(this,"maximumRadius",void 0),St(this,"centerToleranceSquared",Hs.EPSILON1),St(this,"squaredXOverSquaredZ",void 0),Pi(t>=0),Pi(r>=0),Pi(n>=0),this.radii=new ce(t,r,n),this.radiiSquared=new ce(t*t,r*r,n*n),this.radiiToTheFourth=new ce(t*t*t*t,r*r*r*r,n*n*n*n),this.oneOverRadii=new ce(t===0?0:1/t,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new ce(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=W1e,i=m_t,[,,a]=t;this.geodeticSurfaceNormalCartographic(t,n),i.copy(this.radiiSquared).scale(n);let o=Math.sqrt(n.dot(i));return i.scale(1/o),n.scale(a),i.add(n),i.to(r)}cartesianToCartographic(t,r=[0,0,0]){zT.from(t);let n=this.scaleToGeodeticSurface(zT,Ws);if(!n)return;let i=this.geodeticSurfaceNormal(n,W1e),a=g_t;a.copy(zT).subtract(n);let o=Math.atan2(i.y,i.x),s=Math.asin(i.z),u=Math.sign(Eg.dot(a,zT))*Eg.length(a);return U1e([o,s,u],r)}eastNorthUpToFixedFrame(t,r=new zr){return vM(this,"east","north","up",t,r)}localFrameToFixedFrame(t,r,n,i,a=new zr){return vM(this,t,r,n,i,a)}geocentricSurfaceNormal(t,r=[0,0,0]){return GT.from(t).normalize().to(r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=N1e(t),i=n[0],a=n[1],o=Math.cos(a);return GT.set(o*Math.cos(i),o*Math.sin(i),Math.sin(a)).normalize(),GT.to(r)}geodeticSurfaceNormal(t,r=[0,0,0]){return GT.from(t).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(t,r){return H1e(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){Ws.from(t);let n=Ws.x,i=Ws.y,a=Ws.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(n*n*o.x+i*i*o.y+a*a*o.z);return Ws.multiplyScalar(s).to(r)}transformPositionToScaledSpace(t,r=[0,0,0]){return Ws.from(t).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(t,r=[0,0,0]){return Ws.from(t).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){Pi(yo(this.radii.x,this.radii.y,Hs.EPSILON15)),Pi(this.radii.z>0),Ws.from(t);let i=Ws.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(i)>=this.radii.z-r))return Ws.set(0,0,i).to(n)}};St(Zt,"WGS84",new Zt(6378137,6378137,ll));var Oi={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var rar=new ce,nar=new ce;var Jb=new ce,V1e=new ce,Oa=class{constructor(t=[0,0,0],r=0){St(this,"center",void 0),St(this,"radius",void 0),this.radius=-0,this.center=new ce,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=Jb.from(r),this.center=new ce().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 Oa(this.center,this.radius)}union(t){let r=this.center,n=this.radius,i=t.center,a=t.radius,o=Jb.copy(i).subtract(r),s=o.magnitude();if(n>=s+a)return this.clone();if(a>=s+n)return t.clone();let u=(n+s+a)*.5;return V1e.copy(o).scale((-n+u)/s).add(r),this.center.copy(V1e),this.radius=u,this}expand(t){let n=Jb.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=LT.getScaling(Jb,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=Jb.from(t).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(t){let r=this.center,n=this.radius,a=t.normal.dot(r)+t.distance;return a<-n?Oi.OUTSIDE:a<n?Oi.INTERSECTING:Oi.INSIDE}};var v_t=new ce,x_t=new ce,HT=new ce,WT=new ce,VT=new ce,b_t=new ce,y_t=new ce,fl={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Ii=class{constructor(t=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){St(this,"center",void 0),St(this,"halfAxes",void 0),this.center=new ce().from(t),this.halfAxes=new Sr(r)}get halfSize(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new ce(t).len(),new ce(r).len(),new ce(n).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),i=new ce(t).normalize(),a=new ce(r).normalize(),o=new ce(n).normalize();return new tc().fromMatrix3(new Sr([...i,...a,...o]))}fromCenterHalfSizeQuaternion(t,r,n){let i=new tc(n),a=new Sr().fromQuaternion(i);return a[0]=a[0]*r[0],a[1]=a[1]*r[0],a[2]=a[2]*r[0],a[3]=a[3]*r[1],a[4]=a[4]*r[1],a[5]=a[5]*r[1],a[6]=a[6]*r[2],a[7]=a[7]*r[2],a[8]=a[8]*r[2],this.center=new ce().from(t),this.halfAxes=a,this}clone(){return new Ii(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new Oa){let r=this.halfAxes,n=r.getColumn(0,HT),i=r.getColumn(1,WT),a=r.getColumn(2,VT),o=v_t.copy(n).add(i).add(a);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let r=this.center,n=t.normal,i=this.halfAxes,a=n.x,o=n.y,s=n.z,u=Math.abs(a*i[fl.COLUMN0ROW0]+o*i[fl.COLUMN0ROW1]+s*i[fl.COLUMN0ROW2])+Math.abs(a*i[fl.COLUMN1ROW0]+o*i[fl.COLUMN1ROW1]+s*i[fl.COLUMN1ROW2])+Math.abs(a*i[fl.COLUMN2ROW0]+o*i[fl.COLUMN2ROW1]+s*i[fl.COLUMN2ROW2]),c=n.dot(r)+t.distance;return c<=-u?Oi.OUTSIDE:c>=u?Oi.INSIDE:Oi.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=x_t.from(t).subtract(this.center),n=this.halfAxes,i=n.getColumn(0,HT),a=n.getColumn(1,WT),o=n.getColumn(2,VT),s=i.magnitude(),u=a.magnitude(),c=o.magnitude();i.normalize(),a.normalize(),o.normalize();let l=0,f;return f=Math.abs(r.dot(i))-s,f>0&&(l+=f*f),f=Math.abs(r.dot(a))-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 i=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=this.center,s=this.halfAxes,u=s.getColumn(0,HT),c=s.getColumn(1,WT),l=s.getColumn(2,VT),f=b_t.copy(u).add(c).add(l).add(o),p=y_t.copy(f).subtract(t),d=r.dot(p);return i=Math.min(d,i),a=Math.max(d,a),f.copy(o).add(u).add(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),f.copy(o).add(u).subtract(c).add(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),f.copy(o).add(u).subtract(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),o.copy(f).subtract(u).add(c).add(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),o.copy(f).subtract(u).add(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),o.copy(f).subtract(u).subtract(c).add(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),o.copy(f).subtract(u).subtract(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),n[0]=i,n[1]=a,n}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,HT);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,WT);n.transformAsPoint(t);let i=this.halfAxes.getColumn(2,VT);return i.transformAsPoint(t),this.halfAxes=new Sr([...r,...n,...i]),this}getTransform(){throw new Error("not implemented")}};var $1e=new ce,K1e=new ce,pl=class{constructor(t=[0,0,1],r=0){St(this,"normal",void 0),St(this,"distance",void 0),this.normal=new ce,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return Pi(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=$1e.from(t),this.normal.from(r).normalize();let n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,r,n,i){return this.normal.set(t,r,n),Pi(yo(this.normal.len(),1)),this.distance=i,this}clone(){return new pl(this.normal,this.distance)}equals(t){return yo(this.distance,t.distance)&&yo(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=K1e.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=$1e.from(t),i=this.getPointDistance(n),a=K1e.copy(this.normal).scale(i);return n.subtract(a).to(r)}};var J1e=[new ce([1,0,0]),new ce([0,1,0]),new ce([0,0,1])],Y1e=new ce,__t=new ce,Yo=class{constructor(t=[]){St(this,"planes",void 0),this.planes=t}fromBoundingSphere(t){this.planes.length=2*J1e.length;let r=t.center,n=t.radius,i=0;for(let a of J1e){let o=this.planes[i],s=this.planes[i+1];o||(o=this.planes[i]=new pl),s||(s=this.planes[i+1]=new pl);let u=Y1e.copy(a).scale(-n).add(r);o.fromPointNormal(u,a);let c=Y1e.copy(a).scale(n).add(r),l=__t.copy(a).negate();s.fromPointNormal(c,l),i+=2}return this}computeVisibility(t){let r=Oi.INSIDE;for(let n of this.planes)switch(t.intersectPlane(n)){case Oi.OUTSIDE:return Oi.OUTSIDE;case Oi.INTERSECTING:r=Oi.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(Pi(Number.isFinite(r),"parentPlaneMask is required."),r===Yo.MASK_OUTSIDE||r===Yo.MASK_INSIDE)return r;let n=Yo.MASK_INSIDE,i=this.planes;for(let a=0;a<this.planes.length;++a){let o=a<31?1<<a:0;if(a<31&&!(r&o))continue;let s=i[a],u=t.intersectPlane(s);if(u===Oi.OUTSIDE)return Yo.MASK_OUTSIDE;u===Oi.INTERSECTING&&(n|=o)}return n}};St(Yo,"MASK_OUTSIDE",4294967295);St(Yo,"MASK_INSIDE",0);St(Yo,"MASK_INDETERMINATE",2147483647);var Car=new ce,Dar=new ce,kar=new ce,Far=new ce,Bar=new ce;var E_t=new ce,A_t=new ce,S_t=new ce,T_t=new ce,C_t=new ce,D_t=new ce,k_t=new ce,Tg=new ce,F_t=new ce,B_t=new ce,P_t=new ce,O_t=new ce;function xM(e,t=new Oa){if(!e||e.length===0)return t.fromCenterRadius([0,0,0],0);let r=k_t.copy(e[0]),n=E_t.copy(r),i=A_t.copy(r),a=S_t.copy(r),o=T_t.copy(r),s=C_t.copy(r),u=D_t.copy(r);for(let D of e){r.copy(D);let I=r.x,L=r.y,F=r.z;I<n.x&&n.copy(r),I>o.x&&o.copy(r),L<i.y&&i.copy(r),L>s.y&&s.copy(r),F<a.z&&a.copy(r),F>u.z&&u.copy(r)}let c=Tg.copy(o).subtract(n).magnitudeSquared(),l=Tg.copy(s).subtract(i).magnitudeSquared(),f=Tg.copy(u).subtract(a).magnitudeSquared(),p=n,d=o,h=c;l>h&&(h=l,p=i,d=s),f>h&&(h=f,p=a,d=u);let v=F_t;v.x=(p.x+d.x)*.5,v.y=(p.y+d.y)*.5,v.z=(p.z+d.z)*.5;let m=Tg.copy(d).subtract(v).magnitudeSquared(),b=Math.sqrt(m),_=B_t;_.x=n.x,_.y=i.y,_.z=a.z;let E=P_t;E.x=o.x,E.y=s.y,E.z=u.z;let T=O_t.copy(_).add(E).multiplyByScalar(.5),S=0;for(let D of e){r.copy(D);let I=Tg.copy(r).subtract(T).magnitude();I>S&&(S=I);let L=Tg.copy(r).subtract(v).magnitudeSquared();if(L>m){let F=Math.sqrt(L);b=(b+F)*.5,m=b*b;let P=F-b;v.x=(b*v.x+P*r.x)/F,v.y=(b*v.y+P*r.y)/F,v.z=(b*v.z+P*r.z)/F}}return b<S?(v.to(t.center),t.radius=b):(T.to(t.center),t.radius=S),t}var rc=new Sr,I_t=new Sr,R_t=new Sr,$T=new Sr,X1e=new Sr;function _M(e,t={}){let r=Hs.EPSILON20,n=10,i=0,a=0,o=I_t,s=R_t;o.identity(),s.copy(e);let u=r*j_t(s);for(;a<n&&M_t(s)>u;)L_t(s,$T),X1e.copy($T).transpose(),s.multiplyRight($T),s.multiplyLeft(X1e),o.multiplyRight($T),++i>2&&(++a,i=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=s.toTarget(t.diagonal),t}function j_t(e){let t=0;for(let r=0;r<9;++r){let n=e[r];t+=n*n}return Math.sqrt(t)}var bM=[1,0,0],yM=[2,2,1];function M_t(e){let t=0;for(let r=0;r<3;++r){let n=e[rc.getElementIndex(yM[r],bM[r])];t+=2*n*n}return Math.sqrt(t)}function L_t(e,t){let r=Hs.EPSILON15,n=0,i=1;for(let c=0;c<3;++c){let l=Math.abs(e[rc.getElementIndex(yM[c],bM[c])]);l>n&&(i=c,n=l)}let a=bM[i],o=yM[i],s=1,u=0;if(Math.abs(e[rc.getElementIndex(o,a)])>r){let c=e[rc.getElementIndex(o,o)],l=e[rc.getElementIndex(a,a)],f=e[rc.getElementIndex(o,a)],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 Sr.IDENTITY.to(t),t[rc.getElementIndex(a,a)]=t[rc.getElementIndex(o,o)]=s,t[rc.getElementIndex(o,a)]=u,t[rc.getElementIndex(a,o)]=-u,t}var ip=new ce,N_t=new ce,U_t=new ce,G_t=new ce,z_t=new ce,H_t=new Sr,W_t={diagonal:new Sr,unitary:new Sr};function wM(e,t=new Ii){if(!e||e.length===0)return t.halfAxes=new Sr([0,0,0,0,0,0,0,0,0]),t.center=new ce,t;let r=e.length,n=new ce(0,0,0);for(let F of e)n.add(F);let i=1/r;n.multiplyByScalar(i);let a=0,o=0,s=0,u=0,c=0,l=0;for(let F of e){let P=ip.copy(F).subtract(n);a+=P.x*P.x,o+=P.x*P.y,s+=P.x*P.z,u+=P.y*P.y,c+=P.y*P.z,l+=P.z*P.z}a*=i,o*=i,s*=i,u*=i,c*=i,l*=i;let f=H_t;f[0]=a,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}=_M(f,W_t),d=t.halfAxes.copy(p),h=d.getColumn(0,U_t),v=d.getColumn(1,G_t),m=d.getColumn(2,z_t),b=-Number.MAX_VALUE,_=-Number.MAX_VALUE,E=-Number.MAX_VALUE,T=Number.MAX_VALUE,S=Number.MAX_VALUE,D=Number.MAX_VALUE;for(let F of e)ip.copy(F),b=Math.max(ip.dot(h),b),_=Math.max(ip.dot(v),_),E=Math.max(ip.dot(m),E),T=Math.min(ip.dot(h),T),S=Math.min(ip.dot(v),S),D=Math.min(ip.dot(m),D);h=h.multiplyByScalar(.5*(T+b)),v=v.multiplyByScalar(.5*(S+_)),m=m.multiplyByScalar(.5*(D+E)),t.center.copy(h).add(v).add(m);let I=N_t.set(b-T,_-S,E-D).multiplyByScalar(.5),L=new Sr([I[0],0,0,0,I[1],0,0,0,I[2]]);return t.halfAxes.multiplyRight(L),t}function tve(e){return e!=null}var lor=new ce,V_t=new ce,$_t=new ce,K_t=new ce,Yd=new ce,Q1e=new ce,Z1e=new ce,eve=new ce;function Yb(e,t,r){if(Rt(e,"3D Tile: boundingVolume must be defined"),e.box)return rve(e.box,t,r);if(e.region)return Y_t(e.region);if(e.sphere)return J_t(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function rve(e,t,r){let n=new ce(e[0],e[1],e[2]);t.transform(n,n);let i=[];if(e.length===10){let c=e.slice(3,6),l=new tc;l.fromArray(e,6);let f=new ce([1,0,0]),p=new ce([0,1,0]),d=new ce([0,0,1]);f.transformByQuaternion(l),f.scale(c[0]),p.transformByQuaternion(l),p.scale(c[1]),d.transformByQuaternion(l),d.scale(c[2]),i=[...f.toArray(),...p.toArray(),...d.toArray()]}else i=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let a=t.transformAsVector(i.slice(0,3)),o=t.transformAsVector(i.slice(3,6)),s=t.transformAsVector(i.slice(6,9)),u=new Sr([a[0],a[1],a[2],o[0],o[1],o[2],s[0],s[1],s[2]]);return tve(r)?(r.center=n,r.halfAxes=u,r):new Ii(n,u)}function J_t(e,t,r){let n=new ce(e[0],e[1],e[2]);t.transform(n,n);let i=t.getScale(V_t),a=Math.max(Math.max(i[0],i[1]),i[2]),o=e[3]*a;return tve(r)?(r.center=n,r.radius=o,r):new Oa(n,o)}function Y_t(e){let[t,r,n,i,a,o]=e,s=Zt.WGS84.cartographicToCartesian([cl(t),cl(i),a],$_t),u=Zt.WGS84.cartographicToCartesian([cl(n),cl(r),o],K_t),c=new ce().addVectors(s,u).multiplyByScalar(.5);return Zt.WGS84.cartesianToCartographic(c,Yd),Zt.WGS84.cartographicToCartesian([cl(n),Yd[1],Yd[2]],Q1e),Zt.WGS84.cartographicToCartesian([Yd[0],cl(i),Yd[2]],Z1e),Zt.WGS84.cartographicToCartesian([Yd[0],Yd[1],o],eve),rve([...c,...Q1e.subtract(c),...Z1e.subtract(c),...eve.subtract(c)],new zr)}var Cg="4.2.0-alpha.6";var Xo={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},gor=Object.keys(Xo),ap={BATCHED_MODEL:[98,51,100,109],INSTANCED_MODEL:[105,51,100,109],POINT_CLOUD:[112,110,116,115],COMPOSITE:[99,109,112,116]};function EM(e,t,r){Rt(e instanceof ArrayBuffer);let n=new TextDecoder("utf8"),i=new Uint8Array(e,t,r);return n.decode(i)}function nve(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 KT="4.2.0-alpha.6";var ive={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:KT,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function ove(e,t,r){let n=sve(t.metadata),i=[],a=X_t(t.attributes);for(let o in e){let s=e[o],u=ave(o,s,a[o]);i.push(u)}if(r){let o=ave("indices",r);i.push(o)}return{fields:i,metadata:n}}function X_t(e){let t={};for(let r in e){let n=e[r];t[n.name||"undefined"]=n}return t}function ave(e,t,r){let n=r?sve(r.metadata):void 0;return Ij(e,t,n)}function sve(e){Object.entries(e);let t={};for(let r in e)t[`${r}.string`]=JSON.stringify(e[r]);return t}var uve={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},Q_t={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},Z_t=4,Xb=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 i=this.decoder.GetEncodedGeometryType(n),a=i===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(i){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(n,a);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(n,a);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!a.ptr){let p=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(p)}let s=this._getDracoLoaderData(a,i,r),u=this._getMeshData(a,s,r),c=Oj(u.attributes),l=ove(u.attributes,s,u.indices);return{loader:"draco",loaderData:s,header:{vertexCount:a.num_points(),boundingBox:c},...u,schema:l}}finally{this.draco.destroy(n),a&&this.draco.destroy(a)}}_getDracoLoaderData(t,r,n){let i=this._getTopLevelMetadata(t),a=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:i,attributes:a}}_getDracoAttributes(t,r){let n={};for(let i=0;i<t.num_attributes();i++){let a=this.decoder.GetAttribute(t,i),o=this._getAttributeMetadata(t,i);n[a.unique_id()]={unique_id:a.unique_id(),attribute_type:a.attribute_type(),data_type:a.data_type(),num_components:a.num_components(),byte_offset:a.byte_offset(),byte_stride:a.byte_stride(),normalized:a.normalized(),attribute_index:i,metadata:o};let s=this._getQuantizationTransform(a,r);s&&(n[a.unique_id()].quantization_transform=s);let u=this._getOctahedronTransform(a,r);u&&(n[a.unique_id()].octahedron_transform=u)}return n}_getMeshData(t,r,n){let i=this._getMeshAttributes(r,t,n);if(!i.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:i,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:i,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:i}}_getMeshAttributes(t,r,n){let i={};for(let a of Object.values(t.attributes)){let o=this._deduceAttributeName(a,n);a.name=o;let s=this._getAttributeValues(r,a);if(s){let{value:u,size:c}=s;i[o]={value:u,size:c,byteOffset:a.byte_offset,byteStride:a.byte_stride,normalized:a.normalized}}}return i}_getTriangleListIndices(t){let n=t.num_faces()*3,i=n*Z_t,a=this.draco._malloc(i);try{return this.decoder.GetTrianglesUInt32Array(t,i,a),new Uint32Array(this.draco.HEAPF32.buffer,a,n).slice()}finally{this.draco._free(a)}}_getTriangleStripIndices(t){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,r),rwt(r)}finally{this.draco.destroy(r)}}_getAttributeValues(t,r){let n=Q_t[r.data_type];if(!n)return console.warn(`DRACO: Unsupported attribute type ${r.data_type}`),null;let i=r.num_components,o=t.num_points()*i,s=o*n.BYTES_PER_ELEMENT,u=ewt(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:i}}_deduceAttributeName(t,r){let n=t.unique_id;for(let[o,s]of Object.entries(r.extraAttributes||{}))if(s===n)return o;let i=t.attribute_type;for(let o in uve)if(this.draco[o]===i)return uve[o];let a=r.attributeNameEntry||"name";return t.metadata[a]?t.metadata[a].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 i=0;i<n;i++){let a=this.metadataQuerier.GetEntryName(t,i);r[a]=this._getDracoMetadataField(t,a)}return r}_getDracoMetadataField(t,r){let n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,r,n);let i=twt(n);return{int:this.metadataQuerier.GetIntEntry(t,r),string:this.metadataQuerier.GetStringEntry(t,r),double:this.metadataQuerier.GetDoubleEntry(t,r),intArray:i}}finally{this.draco.destroy(n)}}_disableAttributeTransforms(t){let{quantizedAttributes:r=[],octahedronAttributes:n=[]}=t,i=[...r,...n];for(let a of i)this.decoder.SkipAttributeTransform(this.draco[a])}_getQuantizationTransform(t,r){let{quantizedAttributes:n=[]}=r,i=t.attribute_type();if(n.map(o=>this.decoder[o]).includes(i)){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,i=t.attribute_type();if(n.map(o=>this.decoder[o]).includes(i)){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 ewt(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 twt(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}function rwt(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}var nwt="1.5.6",iwt="1.4.1",AM=`https://www.gstatic.com/draco/versioned/decoders/${nwt}`,Gn={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},op={[Gn.DECODER]:`${AM}/${Gn.DECODER}`,[Gn.DECODER_WASM]:`${AM}/${Gn.DECODER_WASM}`,[Gn.FALLBACK_DECODER]:`${AM}/${Gn.FALLBACK_DECODER}`,[Gn.ENCODER]:`https://raw.githubusercontent.com/google/draco/${iwt}/javascript/${Gn.ENCODER}`},SM;async function cve(e){let t=e.modules||{};return t.draco3d?SM||(SM=t.draco3d.createDecoderModule({}).then(r=>({draco:r}))):SM||(SM=awt(e)),await SM}async function awt(e){let t,r;switch(e.draco&&e.draco.decoderType){case"js":t=await ju(op[Gn.FALLBACK_DECODER],"draco",e,Gn.FALLBACK_DECODER);break;case"wasm":default:[t,r]=await Promise.all([await ju(op[Gn.DECODER],"draco",e,Gn.DECODER),await ju(op[Gn.DECODER_WASM],"draco",e,Gn.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await owt(t,r)}function owt(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e({...r,onModuleLoaded:i=>n({draco:i})})})}var TM={id:"draco-writer",name:"Draco compressed geometry writer",module:"draco",version:KT,worker:!0,options:{draco:{},source:null}};var Dg={...ive,parse:swt};async function swt(e,t){let{draco:r}=await cve(t),n=new Xb(r);try{return n.parseSync(e,t==null?void 0:t.draco)}finally{n.destroy()}}var uwt={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Jn={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},Tt={...uwt,...Jn};var CM={[Jn.DOUBLE]:Float64Array,[Jn.FLOAT]:Float32Array,[Jn.UNSIGNED_SHORT]:Uint16Array,[Jn.UNSIGNED_INT]:Uint32Array,[Jn.UNSIGNED_BYTE]:Uint8Array,[Jn.BYTE]:Int8Array,[Jn.SHORT]:Int16Array,[Jn.INT]:Int32Array},cwt={DOUBLE:Jn.DOUBLE,FLOAT:Jn.FLOAT,UNSIGNED_SHORT:Jn.UNSIGNED_SHORT,UNSIGNED_INT:Jn.UNSIGNED_INT,UNSIGNED_BYTE:Jn.UNSIGNED_BYTE,BYTE:Jn.BYTE,SHORT:Jn.SHORT,INT:Jn.INT},DM="Failed to convert GL type",ya=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let r in CM)if(CM[r]===t)return r;throw new Error(DM)}static fromName(t){let r=cwt[t];if(!r)throw new Error(DM);return r}static getArrayType(t){switch(t){case Jn.UNSIGNED_SHORT_5_6_5:case Jn.UNSIGNED_SHORT_4_4_4_4:case Jn.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let r=CM[t];if(!r)throw new Error(DM);return r}}static getByteSize(t){return ya.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(ya.getArrayType(t))}static createTypedArray(t,r,n=0,i){i===void 0&&(i=(r.byteLength-n)/ya.getByteSize(t));let a=ya.getArrayType(t);return new a(r,n,i)}};function lve(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function kM(e,t=[0,0,0]){let r=e>>11&31,n=e>>5&63,i=e&31;return t[0]=r<<3,t[1]=n<<2,t[2]=i<<3,t}var Hor=1/256;var Wor=new $d,Vor=new ce,$or=new $d,Kor=new $d,Jor=new Uint8Array(1);function fve(e,t=255){return Lj(e,0,t)/t*2-1}function pve(e){return e<0?-1:1}function dve(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=fve(e,r),n.y=fve(t,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){let i=n.x;n.x=(1-Math.abs(n.y))*pve(i),n.y=(1-Math.abs(i))*pve(n.y)}return n.normalize()}function FM(e,t,r){return dve(e,t,255,r)}function JT(e){return(e%1+1)%1}var lwt=1/Math.PI*180,fwt=1/180*Math.PI,pwt={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...pwt}};var yn=globalThis.mathgl.config;function BM(e,{precision:t=yn.precision}={}){return e=dwt(e),`${parseFloat(e.toPrecision(t))}`}function nc(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function PM(e){return hve(e)}function OM(e){return mve(e)}function hve(e,t){return gve(e,r=>r*fwt,t)}function mve(e,t){return gve(e,r=>r*lwt,t)}function _o(e,t,r){let n=yn.EPSILON;r&&(yn.EPSILON=r);try{if(e===t)return!0;if(nc(e)&&nc(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(!_o(e[i],t[i]))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)<=yn.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{yn.EPSILON=n}}function dwt(e){return Math.round(e/yn.EPSILON)*yn.EPSILON}function hwt(e){return e.clone?e.clone():new Array(e.length)}function gve(e,t,r){if(nc(e)){let n=e;r=r||hwt(n);for(let i=0;i<r.length&&i<n.length;++i){let a=typeof e=="number"?e:e[i];r[i]=t(a,i,r)}return r}return t(e)}var sp=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:nc(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(yn)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+BM(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(!_o(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 i=0;i<this.ELEMENTS;++i){let a=t[i],o=typeof r=="number"?r:r[i];this[i]=a+n*(o-a)}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(yn.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 mwt(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 Tr(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function up(e,t,r=""){if(yn.debug&&!mwt(e,t))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return e}function Ri(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var kg=class extends sp{get x(){return this[0]}set x(t){this[0]=Tr(t)}get y(){return this[1]}set y(t){this[1]=Tr(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 i=this[n]-t[n];r+=i*i}return Tr(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return Tr(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 Ri(t>=0&&t<this.ELEMENTS,"index is out of range"),Tr(this[t])}setComponent(t,r){return Ri(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 _n=typeof Float32Array<"u"?Float32Array:Array,Qb=Math.random;function Fg(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var Csr=Math.PI/180;function gwt(){let e=new _n(2);return _n!=Float32Array&&(e[0]=0,e[1]=0),e}function vve(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e}function xve(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e}var Dsr=function(){let e=gwt();return function(t,r,n,i,a,o){let s,u;for(r||(r=2),n||(n=0),i?u=Math.min(i*r+n,t.length):u=t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],a(e,e,o),t[s]=e[0],t[s+1]=e[1];return t}}();function bve(e,t,r){let n=t[0],i=t[1],a=r[3]*n+r[7]*i||1;return e[0]=(r[0]*n+r[4]*i)/a,e[1]=(r[1]*n+r[5]*i)/a,e}function YT(e,t,r){let n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a||1;return e[0]=(r[0]*n+r[4]*i+r[8]*a)/o,e[1]=(r[1]*n+r[5]*i+r[9]*a)/o,e[2]=(r[2]*n+r[6]*i+r[10]*a)/o,e}function yve(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e}function _ve(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e[3]=t[3],e}function XT(e,t,r){let n=t[0],i=t[1],a=t[2];return e[0]=r[0]*n+r[3]*i+r[6]*a,e[1]=r[1]*n+r[4]*i+r[7]*a,e[2]=r[2]*n+r[5]*i+r[8]*a,e[3]=t[3],e}var Pg={};ui(Pg,{add:()=>_wt,angle:()=>LM,bezier:()=>Iwt,ceil:()=>wwt,clone:()=>xwt,copy:()=>bwt,create:()=>QT,cross:()=>Xd,dist:()=>zwt,distance:()=>Tve,div:()=>Gwt,divide:()=>Sve,dot:()=>Zb,equals:()=>qwt,exactEquals:()=>Lwt,floor:()=>Ewt,forEach:()=>Vwt,fromValues:()=>ZT,hermite:()=>Owt,inverse:()=>Fwt,len:()=>qM,length:()=>wve,lerp:()=>Bwt,max:()=>Swt,min:()=>Awt,mul:()=>Uwt,multiply:()=>Ave,negate:()=>kwt,normalize:()=>IM,random:()=>Rwt,rotateX:()=>RM,rotateY:()=>jM,rotateZ:()=>MM,round:()=>Twt,scale:()=>Cwt,scaleAndAdd:()=>Dwt,set:()=>ywt,slerp:()=>Pwt,sqrDist:()=>Hwt,sqrLen:()=>Wwt,squaredDistance:()=>Cve,squaredLength:()=>Dve,str:()=>Mwt,sub:()=>Nwt,subtract:()=>Eve,transformMat3:()=>ey,transformMat4:()=>Qd,transformQuat:()=>ty,zero:()=>jwt});function QT(){let e=new _n(3);return _n!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function xwt(e){let t=new _n(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function wve(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function ZT(e,t,r){let n=new _n(3);return n[0]=e,n[1]=t,n[2]=r,n}function bwt(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function ywt(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function _wt(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function Eve(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function Ave(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function Sve(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function wwt(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function Ewt(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function Awt(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 Swt(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 Twt(e,t){return e[0]=Fg(t[0]),e[1]=Fg(t[1]),e[2]=Fg(t[2]),e}function Cwt(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function Dwt(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 Tve(e,t){let r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(r*r+n*n+i*i)}function Cve(e,t){let r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return r*r+n*n+i*i}function Dve(e){let t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function kwt(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function Fwt(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function IM(e,t){let r=t[0],n=t[1],i=t[2],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function Zb(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Xd(e,t,r){let n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2];return e[0]=i*u-a*s,e[1]=a*o-n*u,e[2]=n*s-i*o,e}function Bwt(e,t,r,n){let i=t[0],a=t[1],o=t[2];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e}function Pwt(e,t,r,n){let i=Math.acos(Math.min(Math.max(Zb(t,r),-1),1)),a=Math.sin(i),o=Math.sin((1-n)*i)/a,s=Math.sin(n*i)/a;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 Owt(e,t,r,n,i,a){let o=a*a,s=o*(2*a-3)+1,u=o*(a-2)+a,c=o*(a-1),l=o*(3-2*a);return e[0]=t[0]*s+r[0]*u+n[0]*c+i[0]*l,e[1]=t[1]*s+r[1]*u+n[1]*c+i[1]*l,e[2]=t[2]*s+r[2]*u+n[2]*c+i[2]*l,e}function Iwt(e,t,r,n,i,a){let o=1-a,s=o*o,u=a*a,c=s*o,l=3*a*s,f=3*u*o,p=u*a;return e[0]=t[0]*c+r[0]*l+n[0]*f+i[0]*p,e[1]=t[1]*c+r[1]*l+n[1]*f+i[1]*p,e[2]=t[2]*c+r[2]*l+n[2]*f+i[2]*p,e}function Rwt(e,t){t=t===void 0?1:t;let r=Qb()*2*Math.PI,n=Qb()*2-1,i=Math.sqrt(1-n*n)*t;return e[0]=Math.cos(r)*i,e[1]=Math.sin(r)*i,e[2]=n*t,e}function Qd(e,t,r){let n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,e}function ey(e,t,r){let n=t[0],i=t[1],a=t[2];return e[0]=n*r[0]+i*r[3]+a*r[6],e[1]=n*r[1]+i*r[4]+a*r[7],e[2]=n*r[2]+i*r[5]+a*r[8],e}function ty(e,t,r){let n=r[0],i=r[1],a=r[2],o=r[3],s=t[0],u=t[1],c=t[2],l=i*c-a*u,f=a*s-n*c,p=n*u-i*s,d=i*p-a*f,h=a*l-n*p,v=n*f-i*l,m=o*2;return l*=m,f*=m,p*=m,d*=2,h*=2,v*=2,e[0]=s+l+d,e[1]=u+f+h,e[2]=c+p+v,e}function RM(e,t,r,n){let i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function jM(e,t,r,n){let i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function MM(e,t,r,n){let i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function LM(e,t){let r=e[0],n=e[1],i=e[2],a=t[0],o=t[1],s=t[2],u=Math.sqrt((r*r+n*n+i*i)*(a*a+o*o+s*s)),c=u&&Zb(e,t)/u;return Math.acos(Math.min(Math.max(c,-1),1))}function jwt(e){return e[0]=0,e[1]=0,e[2]=0,e}function Mwt(e){return`vec3(${e[0]}, ${e[1]}, ${e[2]})`}function Lwt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function qwt(e,t){let r=e[0],n=e[1],i=e[2],a=t[0],o=t[1],s=t[2];return Math.abs(r-a)<=1e-6*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-o)<=1e-6*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-s)<=1e-6*Math.max(1,Math.abs(i),Math.abs(s))}var Nwt=Eve,Uwt=Ave,Gwt=Sve,zwt=Tve,Hwt=Cve,qM=wve,Wwt=Dve,Vwt=function(){let e=QT();return function(t,r,n,i,a,o){let s,u;for(r||(r=3),n||(n=0),i?u=Math.min(i*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],a(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2];return t}}();var NM=[0,0,0],e8,_e=class extends kg{static get ZERO(){return e8||(e8=new _e(0,0,0),Object.freeze(e8)),e8}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&nc(t)?this.copy(t):(yn.debug&&(Tr(t),Tr(r),Tr(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 yn.debug&&(Tr(t.x),Tr(t.y),Tr(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]=Tr(t)}angle(t){return LM(this,t)}cross(t){return Xd(this,this,t),this.check()}rotateX({radians:t,origin:r=NM}){return RM(this,this,r,t),this.check()}rotateY({radians:t,origin:r=NM}){return jM(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=NM}){return MM(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Qd(this,this,t),this.check()}transformAsVector(t){return YT(this,this,t),this.check()}transformByMatrix3(t){return ey(this,this,t),this.check()}transformByMatrix2(t){return yve(this,this,t),this.check()}transformByQuaternion(t){return ty(this,this,t),this.check()}};var t8,Og=class extends kg{static get ZERO(){return t8||(t8=new Og(0,0,0,0),Object.freeze(t8)),t8}constructor(t=0,r=0,n=0,i=0){super(-0,-0,-0,-0),nc(t)&&arguments.length===1?this.copy(t):(yn.debug&&(Tr(t),Tr(r),Tr(n),Tr(i)),this[0]=t,this[1]=r,this[2]=n,this[3]=i)}set(t,r,n,i){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,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 yn.debug&&(Tr(t.x),Tr(t.y),Tr(t.z),Tr(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]=Tr(t)}get w(){return this[3]}set w(t){this[3]=Tr(t)}transform(t){return Qd(this,this,t),this.check()}transformByMatrix3(t){return XT(this,this,t),this.check()}transformByMatrix2(t){return _ve(this,this,t),this.check()}transformByQuaternion(t){return ty(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Ig=class extends sp{toString(){let t="[";if(yn.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]=Tr(n),this}getColumn(t,r=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)r[i]=this[n+i];return r}setColumn(t,r){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)this[n+i]=r[i];return this}};function kve(){let e=new _n(9);return _n!=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 Fve(e,t){if(e===t){let r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}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 Bve(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],f=l*o-s*c,p=-l*a+s*u,d=c*a-o*u,h=r*f+n*p+i*d;return h?(h=1/h,e[0]=f*h,e[1]=(-l*n+i*c)*h,e[2]=(s*n-i*o)*h,e[3]=p*h,e[4]=(l*r-i*u)*h,e[5]=(-s*r+i*a)*h,e[6]=d*h,e[7]=(-c*r+n*u)*h,e[8]=(o*r-n*a)*h,e):null}function Pve(e){let t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8];return t*(c*a-o*u)+r*(-c*i+o*s)+n*(u*i-a*s)}function UM(e,t,r){let n=t[0],i=t[1],a=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],v=r[3],m=r[4],b=r[5],_=r[6],E=r[7],T=r[8];return e[0]=p*n+d*o+h*c,e[1]=p*i+d*s+h*l,e[2]=p*a+d*u+h*f,e[3]=v*n+m*o+b*c,e[4]=v*i+m*s+b*l,e[5]=v*a+m*u+b*f,e[6]=_*n+E*o+T*c,e[7]=_*i+E*s+T*l,e[8]=_*a+E*u+T*f,e}function Ove(e,t,r){let n=t[0],i=t[1],a=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]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=u,e[6]=p*n+d*o+c,e[7]=p*i+d*s+l,e[8]=p*a+d*u+f,e}function Ive(e,t,r){let n=t[0],i=t[1],a=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*i+p*s,e[2]=d*a+p*u,e[3]=d*o-p*n,e[4]=d*s-p*i,e[5]=d*u-p*a,e[6]=c,e[7]=l,e[8]=f,e}function GM(e,t,r){let n=r[0],i=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Rve(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,f=n*s,p=i*o,d=i*s,h=i*u,v=a*o,m=a*s,b=a*u;return e[0]=1-f-h,e[3]=l-b,e[6]=p+m,e[1]=l+b,e[4]=1-c-h,e[7]=d-v,e[2]=p-m,e[5]=d+v,e[8]=1-c-f,e}var zM;(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"})(zM||(zM={}));var $wt=Object.freeze([1,0,0,0,1,0,0,0,1]),pn=class extends Ig{static get IDENTITY(){return Jwt()}static get ZERO(){return Kwt()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return zM}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($wt)}fromObject(t){return this.check()}fromQuaternion(t){return Rve(this,t),this.check()}set(t,r,n,i,a,o,s,u,c){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=a,this[5]=o,this[6]=s,this[7]=u,this[8]=c,this.check()}setRowMajor(t,r,n,i,a,o,s,u,c){return this[0]=t,this[1]=i,this[2]=s,this[3]=r,this[4]=a,this[5]=u,this[6]=n,this[7]=o,this[8]=c,this.check()}determinant(){return Pve(this)}transpose(){return Fve(this,this),this.check()}invert(){return Bve(this,this),this.check()}multiplyLeft(t){return UM(this,t,this),this.check()}multiplyRight(t){return UM(this,this,t),this.check()}rotate(t){return Ive(this,this,t),this.check()}scale(t){return Array.isArray(t)?GM(this,this,t):GM(this,this,[t,t]),this.check()}translate(t){return Ove(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=vve(r||[-0,-0],t,this);break;case 3:n=ey(r||[-0,-0,-0],t,this);break;case 4:n=XT(r||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return up(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)}},r8,n8=null;function Kwt(){return r8||(r8=new pn([0,0,0,0,0,0,0,0,0]),Object.freeze(r8)),r8}function Jwt(){return n8||(n8=new pn,Object.freeze(n8)),n8}var i8={};ui(i8,{add:()=>yEt,adjoint:()=>tEt,clone:()=>Xwt,copy:()=>Qwt,create:()=>Ywt,decompose:()=>fEt,determinant:()=>VM,equals:()=>AEt,exactEquals:()=>EEt,frob:()=>bEt,fromQuat:()=>ZM,fromQuat2:()=>uEt,fromRotation:()=>iEt,fromRotationTranslation:()=>Lve,fromRotationTranslationScale:()=>pEt,fromRotationTranslationScaleOrigin:()=>dEt,fromScaling:()=>nEt,fromTranslation:()=>rEt,fromValues:()=>Zwt,fromXRotation:()=>aEt,fromYRotation:()=>oEt,fromZRotation:()=>sEt,frustum:()=>eL,getRotation:()=>lEt,getScaling:()=>qve,getTranslation:()=>cEt,identity:()=>Mve,invert:()=>WM,lookAt:()=>nL,mul:()=>SEt,multiply:()=>ry,multiplyScalar:()=>_Et,multiplyScalarAndAdd:()=>wEt,ortho:()=>rL,orthoNO:()=>Uve,orthoZO:()=>gEt,perspective:()=>tL,perspectiveFromFieldOfView:()=>mEt,perspectiveNO:()=>Nve,perspectiveZO:()=>hEt,rotate:()=>JM,rotateX:()=>YM,rotateY:()=>XM,rotateZ:()=>QM,scale:()=>KM,set:()=>eEt,str:()=>xEt,sub:()=>TEt,subtract:()=>Gve,targetTo:()=>vEt,translate:()=>$M,transpose:()=>HM});function Ywt(){let e=new _n(16);return _n!=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 Xwt(e){let t=new _n(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 Qwt(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 Zwt(e,t,r,n,i,a,o,s,u,c,l,f,p,d,h,v){let m=new _n(16);return m[0]=e,m[1]=t,m[2]=r,m[3]=n,m[4]=i,m[5]=a,m[6]=o,m[7]=s,m[8]=u,m[9]=c,m[10]=l,m[11]=f,m[12]=p,m[13]=d,m[14]=h,m[15]=v,m}function eEt(e,t,r,n,i,a,o,s,u,c,l,f,p,d,h,v,m){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=a,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]=v,e[15]=m,e}function Mve(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 HM(e,t){if(e===t){let r=t[1],n=t[2],i=t[3],a=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]=a,e[11]=t[14],e[12]=i,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 WM(e,t){let r=t[0],n=t[1],i=t[2],a=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],v=t[13],m=t[14],b=t[15],_=r*s-n*o,E=r*u-i*o,T=r*c-a*o,S=n*u-i*s,D=n*c-a*s,I=i*c-a*u,L=l*v-f*h,F=l*m-p*h,P=l*b-d*h,M=f*m-p*v,U=f*b-d*v,W=p*b-d*m,V=_*W-E*U+T*M+S*P-D*F+I*L;return V?(V=1/V,e[0]=(s*W-u*U+c*M)*V,e[1]=(i*U-n*W-a*M)*V,e[2]=(v*I-m*D+b*S)*V,e[3]=(p*D-f*I-d*S)*V,e[4]=(u*P-o*W-c*F)*V,e[5]=(r*W-i*P+a*F)*V,e[6]=(m*T-h*I-b*E)*V,e[7]=(l*I-p*T+d*E)*V,e[8]=(o*U-s*P+c*L)*V,e[9]=(n*P-r*U-a*L)*V,e[10]=(h*D-v*T+b*_)*V,e[11]=(f*T-l*D-d*_)*V,e[12]=(s*F-o*M-u*L)*V,e[13]=(r*M-n*F+i*L)*V,e[14]=(v*E-h*S-m*_)*V,e[15]=(l*S-f*E+p*_)*V,e):null}function tEt(e,t){let r=t[0],n=t[1],i=t[2],a=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],v=t[13],m=t[14],b=t[15],_=r*s-n*o,E=r*u-i*o,T=r*c-a*o,S=n*u-i*s,D=n*c-a*s,I=i*c-a*u,L=l*v-f*h,F=l*m-p*h,P=l*b-d*h,M=f*m-p*v,U=f*b-d*v,W=p*b-d*m;return e[0]=s*W-u*U+c*M,e[1]=i*U-n*W-a*M,e[2]=v*I-m*D+b*S,e[3]=p*D-f*I-d*S,e[4]=u*P-o*W-c*F,e[5]=r*W-i*P+a*F,e[6]=m*T-h*I-b*E,e[7]=l*I-p*T+d*E,e[8]=o*U-s*P+c*L,e[9]=n*P-r*U-a*L,e[10]=h*D-v*T+b*_,e[11]=f*T-l*D-d*_,e[12]=s*F-o*M-u*L,e[13]=r*M-n*F+i*L,e[14]=v*E-h*S-m*_,e[15]=l*S-f*E+p*_,e}function VM(e){let t=e[0],r=e[1],n=e[2],i=e[3],a=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],v=e[14],m=e[15],b=t*o-r*a,_=t*s-n*a,E=r*s-n*o,T=c*h-l*d,S=c*v-f*d,D=l*v-f*h,I=t*D-r*S+n*T,L=a*D-o*S+s*T,F=c*E-l*_+f*b,P=d*E-h*_+v*b;return u*I-i*L+m*F-p*P}function ry(e,t,r){let n=t[0],i=t[1],a=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],v=t[12],m=t[13],b=t[14],_=t[15],E=r[0],T=r[1],S=r[2],D=r[3];return e[0]=E*n+T*s+S*f+D*v,e[1]=E*i+T*u+S*p+D*m,e[2]=E*a+T*c+S*d+D*b,e[3]=E*o+T*l+S*h+D*_,E=r[4],T=r[5],S=r[6],D=r[7],e[4]=E*n+T*s+S*f+D*v,e[5]=E*i+T*u+S*p+D*m,e[6]=E*a+T*c+S*d+D*b,e[7]=E*o+T*l+S*h+D*_,E=r[8],T=r[9],S=r[10],D=r[11],e[8]=E*n+T*s+S*f+D*v,e[9]=E*i+T*u+S*p+D*m,e[10]=E*a+T*c+S*d+D*b,e[11]=E*o+T*l+S*h+D*_,E=r[12],T=r[13],S=r[14],D=r[15],e[12]=E*n+T*s+S*f+D*v,e[13]=E*i+T*u+S*p+D*m,e[14]=E*a+T*c+S*d+D*b,e[15]=E*o+T*l+S*h+D*_,e}function $M(e,t,r){let n=r[0],i=r[1],a=r[2],o,s,u,c,l,f,p,d,h,v,m,b;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*a+t[12],e[13]=t[1]*n+t[5]*i+t[9]*a+t[13],e[14]=t[2]*n+t[6]*i+t[10]*a+t[14],e[15]=t[3]*n+t[7]*i+t[11]*a+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],v=t[9],m=t[10],b=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]=v,e[10]=m,e[11]=b,e[12]=o*n+l*i+h*a+t[12],e[13]=s*n+f*i+v*a+t[13],e[14]=u*n+p*i+m*a+t[14],e[15]=c*n+d*i+b*a+t[15]),e}function KM(e,t,r){let n=r[0],i=r[1],a=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]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function JM(e,t,r,n){let i=n[0],a=n[1],o=n[2],s=Math.sqrt(i*i+a*a+o*o),u,c,l,f,p,d,h,v,m,b,_,E,T,S,D,I,L,F,P,M,U,W,V,Z;return s<1e-6?null:(s=1/s,i*=s,a*=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],v=t[4],m=t[5],b=t[6],_=t[7],E=t[8],T=t[9],S=t[10],D=t[11],I=i*i*l+u,L=a*i*l+o*c,F=o*i*l-a*c,P=i*a*l-o*c,M=a*a*l+u,U=o*a*l+i*c,W=i*o*l+a*c,V=a*o*l-i*c,Z=o*o*l+u,e[0]=f*I+v*L+E*F,e[1]=p*I+m*L+T*F,e[2]=d*I+b*L+S*F,e[3]=h*I+_*L+D*F,e[4]=f*P+v*M+E*U,e[5]=p*P+m*M+T*U,e[6]=d*P+b*M+S*U,e[7]=h*P+_*M+D*U,e[8]=f*W+v*V+E*Z,e[9]=p*W+m*V+T*Z,e[10]=d*W+b*V+S*Z,e[11]=h*W+_*V+D*Z,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function YM(e,t,r){let n=Math.sin(r),i=Math.cos(r),a=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]=a*i+c*n,e[5]=o*i+l*n,e[6]=s*i+f*n,e[7]=u*i+p*n,e[8]=c*i-a*n,e[9]=l*i-o*n,e[10]=f*i-s*n,e[11]=p*i-u*n,e}function XM(e,t,r){let n=Math.sin(r),i=Math.cos(r),a=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]=a*i-c*n,e[1]=o*i-l*n,e[2]=s*i-f*n,e[3]=u*i-p*n,e[8]=a*n+c*i,e[9]=o*n+l*i,e[10]=s*n+f*i,e[11]=u*n+p*i,e}function QM(e,t,r){let n=Math.sin(r),i=Math.cos(r),a=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]=a*i+c*n,e[1]=o*i+l*n,e[2]=s*i+f*n,e[3]=u*i+p*n,e[4]=c*i-a*n,e[5]=l*i-o*n,e[6]=f*i-s*n,e[7]=p*i-u*n,e}function rEt(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 nEt(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 iEt(e,t,r){let n=r[0],i=r[1],a=r[2],o=Math.sqrt(n*n+i*i+a*a),s,u,c;return o<1e-6?null:(o=1/o,n*=o,i*=o,a*=o,u=Math.sin(t),s=Math.cos(t),c=1-s,e[0]=n*n*c+s,e[1]=i*n*c+a*u,e[2]=a*n*c-i*u,e[3]=0,e[4]=n*i*c-a*u,e[5]=i*i*c+s,e[6]=a*i*c+n*u,e[7]=0,e[8]=n*a*c+i*u,e[9]=i*a*c-n*u,e[10]=a*a*c+s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function aEt(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 oEt(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 sEt(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 Lve(e,t,r){let n=t[0],i=t[1],a=t[2],o=t[3],s=n+n,u=i+i,c=a+a,l=n*s,f=n*u,p=n*c,d=i*u,h=i*c,v=a*c,m=o*s,b=o*u,_=o*c;return e[0]=1-(d+v),e[1]=f+_,e[2]=p-b,e[3]=0,e[4]=f-_,e[5]=1-(l+v),e[6]=h+m,e[7]=0,e[8]=p+b,e[9]=h-m,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 uEt(e,t){let r=new _n(3),n=-t[0],i=-t[1],a=-t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=n*n+i*i+a*a+o*o;return f>0?(r[0]=(s*o+l*n+u*a-c*i)*2/f,r[1]=(u*o+l*i+c*n-s*a)*2/f,r[2]=(c*o+l*a+s*i-u*n)*2/f):(r[0]=(s*o+l*n+u*a-c*i)*2,r[1]=(u*o+l*i+c*n-s*a)*2,r[2]=(c*o+l*a+s*i-u*n)*2),Lve(e,t,r),e}function cEt(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function qve(e,t){let r=t[0],n=t[1],i=t[2],a=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+i*i),e[1]=Math.sqrt(a*a+o*o+s*s),e[2]=Math.sqrt(u*u+c*c+l*l),e}function lEt(e,t){let r=new _n(3);qve(r,t);let n=1/r[0],i=1/r[1],a=1/r[2],o=t[0]*n,s=t[1]*i,u=t[2]*a,c=t[4]*n,l=t[5]*i,f=t[6]*a,p=t[8]*n,d=t[9]*i,h=t[10]*a,v=o+l+h,m=0;return v>0?(m=Math.sqrt(v+1)*2,e[3]=.25*m,e[0]=(f-d)/m,e[1]=(p-u)/m,e[2]=(s-c)/m):o>l&&o>h?(m=Math.sqrt(1+o-l-h)*2,e[3]=(f-d)/m,e[0]=.25*m,e[1]=(s+c)/m,e[2]=(p+u)/m):l>h?(m=Math.sqrt(1+l-o-h)*2,e[3]=(p-u)/m,e[0]=(s+c)/m,e[1]=.25*m,e[2]=(f+d)/m):(m=Math.sqrt(1+h-o-l)*2,e[3]=(s-c)/m,e[0]=(p+u)/m,e[1]=(f+d)/m,e[2]=.25*m),e}function fEt(e,t,r,n){t[0]=n[12],t[1]=n[13],t[2]=n[14];let i=n[0],a=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(i*i+a*a+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],v=1/r[2],m=i*d,b=a*h,_=o*v,E=s*d,T=u*h,S=c*v,D=l*d,I=f*h,L=p*v,F=m+T+L,P=0;return F>0?(P=Math.sqrt(F+1)*2,e[3]=.25*P,e[0]=(S-I)/P,e[1]=(D-_)/P,e[2]=(b-E)/P):m>T&&m>L?(P=Math.sqrt(1+m-T-L)*2,e[3]=(S-I)/P,e[0]=.25*P,e[1]=(b+E)/P,e[2]=(D+_)/P):T>L?(P=Math.sqrt(1+T-m-L)*2,e[3]=(D-_)/P,e[0]=(b+E)/P,e[1]=.25*P,e[2]=(S+I)/P):(P=Math.sqrt(1+L-m-T)*2,e[3]=(b-E)/P,e[0]=(D+_)/P,e[1]=(S+I)/P,e[2]=.25*P),e}function pEt(e,t,r,n){let i=t[0],a=t[1],o=t[2],s=t[3],u=i+i,c=a+a,l=o+o,f=i*u,p=i*c,d=i*l,h=a*c,v=a*l,m=o*l,b=s*u,_=s*c,E=s*l,T=n[0],S=n[1],D=n[2];return e[0]=(1-(h+m))*T,e[1]=(p+E)*T,e[2]=(d-_)*T,e[3]=0,e[4]=(p-E)*S,e[5]=(1-(f+m))*S,e[6]=(v+b)*S,e[7]=0,e[8]=(d+_)*D,e[9]=(v-b)*D,e[10]=(1-(f+h))*D,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function dEt(e,t,r,n,i){let a=t[0],o=t[1],s=t[2],u=t[3],c=a+a,l=o+o,f=s+s,p=a*c,d=a*l,h=a*f,v=o*l,m=o*f,b=s*f,_=u*c,E=u*l,T=u*f,S=n[0],D=n[1],I=n[2],L=i[0],F=i[1],P=i[2],M=(1-(v+b))*S,U=(d+T)*S,W=(h-E)*S,V=(d-T)*D,Z=(1-(p+b))*D,ee=(m+_)*D,ge=(h+E)*I,de=(m-_)*I,he=(1-(p+v))*I;return e[0]=M,e[1]=U,e[2]=W,e[3]=0,e[4]=V,e[5]=Z,e[6]=ee,e[7]=0,e[8]=ge,e[9]=de,e[10]=he,e[11]=0,e[12]=r[0]+L-(M*L+V*F+ge*P),e[13]=r[1]+F-(U*L+Z*F+de*P),e[14]=r[2]+P-(W*L+ee*F+he*P),e[15]=1,e}function ZM(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,f=n*s,p=i*o,d=i*s,h=i*u,v=a*o,m=a*s,b=a*u;return e[0]=1-f-h,e[1]=l+b,e[2]=p-m,e[3]=0,e[4]=l-b,e[5]=1-c-h,e[6]=d+v,e[7]=0,e[8]=p+m,e[9]=d-v,e[10]=1-c-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function eL(e,t,r,n,i,a,o){let s=1/(r-t),u=1/(i-n),c=1/(a-o);return e[0]=a*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*u,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(i+n)*u,e[10]=(o+a)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*a*2*c,e[15]=0,e}function Nve(e,t,r,n,i){let a=1/Math.tan(t/2);if(e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let o=1/(n-i);e[10]=(i+n)*o,e[14]=2*i*n*o}else e[10]=-1,e[14]=-2*n;return e}var tL=Nve;function hEt(e,t,r,n,i){let a=1/Math.tan(t/2);if(e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let o=1/(n-i);e[10]=i*o,e[14]=i*n*o}else e[10]=-1,e[14]=-n;return e}function mEt(e,t,r,n){let i=Math.tan(t.upDegrees*Math.PI/180),a=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/(i+a);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]=(i-a)*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 Uve(e,t,r,n,i,a,o){let s=1/(t-r),u=1/(n-i),c=1/(a-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]=(i+n)*u,e[14]=(o+a)*c,e[15]=1,e}var rL=Uve;function gEt(e,t,r,n,i,a,o){let s=1/(t-r),u=1/(n-i),c=1/(a-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]=(i+n)*u,e[14]=a*c,e[15]=1,e}function nL(e,t,r,n){let i,a,o,s,u,c,l,f,p,d,h=t[0],v=t[1],m=t[2],b=n[0],_=n[1],E=n[2],T=r[0],S=r[1],D=r[2];return Math.abs(h-T)<1e-6&&Math.abs(v-S)<1e-6&&Math.abs(m-D)<1e-6?Mve(e):(f=h-T,p=v-S,d=m-D,i=1/Math.sqrt(f*f+p*p+d*d),f*=i,p*=i,d*=i,a=_*d-E*p,o=E*f-b*d,s=b*p-_*f,i=Math.sqrt(a*a+o*o+s*s),i?(i=1/i,a*=i,o*=i,s*=i):(a=0,o=0,s=0),u=p*s-d*o,c=d*a-f*s,l=f*o-p*a,i=Math.sqrt(u*u+c*c+l*l),i?(i=1/i,u*=i,c*=i,l*=i):(u=0,c=0,l=0),e[0]=a,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]=-(a*h+o*v+s*m),e[13]=-(u*h+c*v+l*m),e[14]=-(f*h+p*v+d*m),e[15]=1,e)}function vEt(e,t,r,n){let i=t[0],a=t[1],o=t[2],s=n[0],u=n[1],c=n[2],l=i-r[0],f=a-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,v=c*l-s*p,m=s*f-u*l;return d=h*h+v*v+m*m,d>0&&(d=1/Math.sqrt(d),h*=d,v*=d,m*=d),e[0]=h,e[1]=v,e[2]=m,e[3]=0,e[4]=f*m-p*v,e[5]=p*h-l*m,e[6]=l*v-f*h,e[7]=0,e[8]=l,e[9]=f,e[10]=p,e[11]=0,e[12]=i,e[13]=a,e[14]=o,e[15]=1,e}function xEt(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 bEt(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 yEt(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 Gve(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 _Et(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 wEt(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 EEt(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 AEt(e,t){let r=e[0],n=e[1],i=e[2],a=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],v=e[13],m=e[14],b=e[15],_=t[0],E=t[1],T=t[2],S=t[3],D=t[4],I=t[5],L=t[6],F=t[7],P=t[8],M=t[9],U=t[10],W=t[11],V=t[12],Z=t[13],ee=t[14],ge=t[15];return Math.abs(r-_)<=1e-6*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(i-T)<=1e-6*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(a-S)<=1e-6*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(o-D)<=1e-6*Math.max(1,Math.abs(o),Math.abs(D))&&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-F)<=1e-6*Math.max(1,Math.abs(c),Math.abs(F))&&Math.abs(l-P)<=1e-6*Math.max(1,Math.abs(l),Math.abs(P))&&Math.abs(f-M)<=1e-6*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(p-U)<=1e-6*Math.max(1,Math.abs(p),Math.abs(U))&&Math.abs(d-W)<=1e-6*Math.max(1,Math.abs(d),Math.abs(W))&&Math.abs(h-V)<=1e-6*Math.max(1,Math.abs(h),Math.abs(V))&&Math.abs(v-Z)<=1e-6*Math.max(1,Math.abs(v),Math.abs(Z))&&Math.abs(m-ee)<=1e-6*Math.max(1,Math.abs(m),Math.abs(ee))&&Math.abs(b-ge)<=1e-6*Math.max(1,Math.abs(b),Math.abs(ge))}var SEt=ry,TEt=Gve;function CEt(){let e=new _n(4);return _n!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function zve(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 Hve(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 Wve(e){let t=e[0],r=e[1],n=e[2],i=e[3];return Math.sqrt(t*t+r*r+n*n+i*i)}function Vve(e){let t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}function $ve(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=n*o,e[2]=i*o,e[3]=a*o,e}function Kve(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Jve(e,t,r,n){let i=t[0],a=t[1],o=t[2],s=t[3];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e[3]=s+n*(r[3]-s),e}function Yve(e,t,r){let n=t[0],i=t[1],a=t[2],o=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,e[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,e[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,e[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,e}function Xve(e,t,r){let n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],c=r[3],l=c*n+s*a-u*i,f=c*i+u*n-o*a,p=c*a+o*i-s*n,d=-o*n-s*i-u*a;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 Zsr=function(){let e=CEt();return function(t,r,n,i,a,o){let s,u;for(r||(r=4),n||(n=0),i?u=Math.min(i*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],a(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 oL;(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"})(oL||(oL={}));var DEt=45*Math.PI/180,kEt=1,iL=.1,aL=500,FEt=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Qo=class extends Ig{static get IDENTITY(){return PEt()}static get ZERO(){return BEt()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return oL}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,i,a,o,s,u,c,l,f,p,d,h,v,m){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=a,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]=v,this[15]=m,this.check()}setRowMajor(t,r,n,i,a,o,s,u,c,l,f,p,d,h,v,m){return this[0]=t,this[1]=a,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]=v,this[12]=i,this[13]=u,this[14]=p,this[15]=m,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(FEt)}fromObject(t){return this.check()}fromQuaternion(t){return ZM(this,t),this.check()}frustum(t){let{left:r,right:n,bottom:i,top:a,near:o=iL,far:s=aL}=t;return s===1/0?OEt(this,r,n,i,a,o):eL(this,r,n,i,a,o,s),this.check()}lookAt(t){let{eye:r,center:n=[0,0,0],up:i=[0,1,0]}=t;return nL(this,r,n,i),this.check()}ortho(t){let{left:r,right:n,bottom:i,top:a,near:o=iL,far:s=aL}=t;return rL(this,r,n,i,a,o,s),this.check()}orthographic(t){let{fovy:r=DEt,aspect:n=kEt,focalDistance:i=1,near:a=iL,far:o=aL}=t;Zve(r);let s=r/2,u=i*Math.tan(s),c=u*n;return this.ortho({left:-c,right:c,bottom:-u,top:u,near:a,far:o})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:n=1,near:i=.1,far:a=500}=t;return Zve(r),tL(this,r,n,i,a),this.check()}determinant(){return VM(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),i=1/n[0],a=1/n[1],o=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*a,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*i,t[5]=this[5]*a,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*i,t[9]=this[9]*a,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),i=1/n[0],a=1/n[1],o=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*a,t[2]=this[2]*o,t[3]=this[4]*i,t[4]=this[5]*a,t[5]=this[6]*o,t[6]=this[8]*i,t[7]=this[9]*a,t[8]=this[10]*o,t}transpose(){return HM(this,this),this.check()}invert(){return WM(this,this),this.check()}multiplyLeft(t){return ry(this,t,this),this.check()}multiplyRight(t){return ry(this,this,t),this.check()}rotateX(t){return YM(this,this,t),this.check()}rotateY(t){return XM(this,this,t),this.check()}rotateZ(t){return QM(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return JM(this,this,t,r),this.check()}scale(t){return KM(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return $M(this,this,t),this.check()}transform(t,r){return t.length===4?(r=Yve(r||[-0,-0,-0,-0],t,this),up(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,i;switch(n){case 2:i=xve(r||[-0,-0],t,this);break;case 3:i=Qd(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return up(i,t.length),i}transformAsVector(t,r){let n;switch(t.length){case 2:n=bve(r||[-0,-0],t,this);break;case 3:n=YT(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return up(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])}},a8,o8;function BEt(){return a8||(a8=new Qo([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(a8)),a8}function PEt(){return o8||(o8=new Qo,Object.freeze(o8)),o8}function Zve(e){if(e>Math.PI*2)throw Error("expected radians")}function OEt(e,t,r,n,i,a){let o=2*a/(r-t),s=2*a/(i-n),u=(r+t)/(r-t),c=(i+n)/(i-n),l=-1,f=-1,p=-2*a;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 exe(){let e=new _n(4);return _n!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function txe(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function sL(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 uL(e,t,r){let n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],u=r[1],c=r[2],l=r[3];return e[0]=n*l+o*s+i*c-a*u,e[1]=i*l+o*u+a*s-n*c,e[2]=a*l+o*c+n*u-i*s,e[3]=o*l-n*s-i*u-a*c,e}function rxe(e,t,r){r*=.5;let n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+o*s,e[1]=i*u+a*s,e[2]=a*u-i*s,e[3]=o*u-n*s,e}function nxe(e,t,r){r*=.5;let n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u-a*s,e[1]=i*u+o*s,e[2]=a*u+n*s,e[3]=o*u-i*s,e}function ixe(e,t,r){r*=.5;let n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+i*s,e[1]=i*u-n*s,e[2]=a*u+o*s,e[3]=o*u-a*s,e}function axe(e,t){let r=t[0],n=t[1],i=t[2];return e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),e}function ny(e,t,r,n){let i=t[0],a=t[1],o=t[2],s=t[3],u=r[0],c=r[1],l=r[2],f=r[3],p,d,h,v,m;return p=i*u+a*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),m=Math.sin(d),h=Math.sin((1-n)*d)/m,v=Math.sin(n*d)/m):(h=1-n,v=n),e[0]=h*i+v*u,e[1]=h*a+v*c,e[2]=h*o+v*l,e[3]=h*s+v*f,e}function oxe(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return e[0]=-r*s,e[1]=-n*s,e[2]=-i*s,e[3]=a*s,e}function sxe(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function cL(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 i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);let a=(i+1)%3,o=(i+2)%3;n=Math.sqrt(t[i*3+i]-t[a*3+a]-t[o*3+o]+1),e[i]=.5*n,n=.5/n,e[3]=(t[a*3+o]-t[o*3+a])*n,e[a]=(t[a*3+i]+t[i*3+a])*n,e[o]=(t[o*3+i]+t[i*3+o])*n}return e}var uxe=zve;var cxe=Hve,lxe=Kve,fxe=Jve,pxe=Wve;var dxe=Vve;var hxe=$ve;var mxe=function(){let e=QT(),t=ZT(1,0,0),r=ZT(0,1,0);return function(n,i,a){let o=Zb(i,a);return o<-.999999?(Xd(e,t,i),qM(e)<1e-6&&Xd(e,r,i),IM(e,e),sL(n,e,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Xd(e,i,a),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+o,hxe(n,n))}}(),dur=function(){let e=exe(),t=exe();return function(r,n,i,a,o,s){return ny(e,n,o,s),ny(t,i,a,s),ny(r,e,t,2*s*(1-s)),r}}(),hur=function(){let e=kve();return function(t,r,n,i){return e[0]=n[0],e[3]=n[1],e[6]=n[2],e[1]=i[0],e[4]=i[1],e[7]=i[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],hxe(t,cL(t,e))}}();var REt=[0,0,0,1],cp=class extends sp{constructor(t=0,r=0,n=0,i=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,n,i)}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,i){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,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 cL(this,t),this.check()}fromAxisRotation(t,r){return sL(this,t,r),this.check()}identity(){return txe(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]=Tr(t)}get y(){return this[1]}set y(t){this[1]=Tr(t)}get z(){return this[2]}set z(t){this[2]=Tr(t)}get w(){return this[3]}set w(t){this[3]=Tr(t)}len(){return pxe(this)}lengthSquared(){return dxe(this)}dot(t){return lxe(this,t)}rotationTo(t,r){return mxe(this,t,r),this.check()}add(t){return uxe(this,this,t),this.check()}calculateW(){return axe(this,this),this.check()}conjugate(){return sxe(this,this),this.check()}invert(){return oxe(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(fxe(this,t,r,n),this.check())}multiplyRight(t){return uL(this,this,t),this.check()}multiplyLeft(t){return uL(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 rxe(this,this,t),this.check()}rotateY(t){return nxe(this,this,t),this.check()}rotateZ(t){return ixe(this,this,t),this.check()}scale(t){return cxe(this,this,t),this.check()}slerp(t,r,n){let i,a,o;switch(arguments.length){case 1:({start:i=REt,target:a,ratio:o}=t);break;case 2:i=this,a=t,o=r;break;default:i=t,a=r,o=n}return ny(this,i,a,o),this.check()}transformVector4(t,r=new Og){return Xve(r,t,this),up(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 ic={};ui(ic,{EPSILON1:()=>jEt,EPSILON10:()=>WEt,EPSILON11:()=>VEt,EPSILON12:()=>$Et,EPSILON13:()=>KEt,EPSILON14:()=>JEt,EPSILON15:()=>YEt,EPSILON16:()=>XEt,EPSILON17:()=>QEt,EPSILON18:()=>ZEt,EPSILON19:()=>eAt,EPSILON2:()=>MEt,EPSILON20:()=>tAt,EPSILON3:()=>LEt,EPSILON4:()=>qEt,EPSILON5:()=>NEt,EPSILON6:()=>UEt,EPSILON7:()=>GEt,EPSILON8:()=>zEt,EPSILON9:()=>HEt,PI_OVER_FOUR:()=>nAt,PI_OVER_SIX:()=>iAt,PI_OVER_TWO:()=>rAt,TWO_PI:()=>aAt});var jEt=.1,MEt=.01,LEt=.001,qEt=1e-4,NEt=1e-5,UEt=1e-6,GEt=1e-7,zEt=1e-8,HEt=1e-9,WEt=1e-10,VEt=1e-11,$Et=1e-12,KEt=1e-13,JEt=1e-14,YEt=1e-15,XEt=1e-16,QEt=1e-17,ZEt=1e-18,eAt=1e-19,tAt=1e-20,rAt=Math.PI/2,nAt=Math.PI/4,iAt=Math.PI/6,aAt=Math.PI*2;var dl=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=Tt.UNSIGNED_INT,n=1){let i=this.json[t];return i&&Number.isFinite(i.byteOffset)?this._getTypedArrayFromBinary(t,r,n,1,i.byteOffset):i}getPropertyArray(t,r,n){let i=this.json[t];return i&&Number.isFinite(i.byteOffset)?("componentType"in i&&(r=ya.fromName(i.componentType)),this._getTypedArrayFromBinary(t,r,n,this.featuresLength,i.byteOffset)):this._getTypedArrayFromArray(t,r,i)}getProperty(t,r,n,i,a){let o=this.json[t];if(!o)return o;let s=this.getPropertyArray(t,r,n);if(n===1)return s[i];for(let u=0;u<n;++u)a[u]=s[n*i+u];return a}_getTypedArrayFromBinary(t,r,n,i,a){let o=this._cachedTypedArrays,s=o[t];return s||(s=ya.createTypedArray(r,this.buffer.buffer,this.buffer.byteOffset+a,i*n),o[t]=s),s}_getTypedArrayFromArray(t,r,n){let i=this._cachedTypedArrays,a=i[t];return a||(a=ya.createTypedArray(r,n),i[t]=a),a}};var oAt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},sAt={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]]},uAt={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 gxe(e,t,r,n){let{componentType:i}=e;Rt(e.componentType);let a=typeof i=="string"?ya.fromName(i):i,o=oAt[e.type],s=sAt[e.type],u=uAt[e.type];return r+=e.byteOffset,{values:ya.createTypedArray(a,t,r,o*n),type:a,size:o,unpacker:s,packer:u}}var ac=e=>e!==void 0;function vxe(e,t,r){if(!t)return null;let n=e.getExtension("3DTILES_batch_table_hierarchy"),i=t.HIERARCHY;return i&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=i,n=i),n?cAt(n,r):null}function cAt(e,t){let r,n,i,a=e.instancesLength,o=e.classes,s=e.classIds,u=e.parentCounts,c=e.parentIds,l=a;ac(s.byteOffset)&&(s.componentType=defaultValue(s.componentType,GL.UNSIGNED_SHORT),s.type=AttributeType.SCALAR,i=getBinaryAccessor(s),s=i.createArrayBufferView(t.buffer,t.byteOffset+s.byteOffset,a));let f;if(ac(u))for(ac(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,GL.UNSIGNED_SHORT),u.type=AttributeType.SCALAR,i=getBinaryAccessor(u),u=i.createArrayBufferView(t.buffer,t.byteOffset+u.byteOffset,a)),f=new Uint16Array(a),l=0,r=0;r<a;++r)f[r]=l,l+=u[r];ac(c)&&ac(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,i=getBinaryAccessor(c),c=i.createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,l));let p=o.length;for(r=0;r<p;++r){let m=o[r].length,b=o[r].instances,_=getBinaryProperties(m,b,t);o[r].instances=combine(_,b)}let d=new Array(p).fill(0),h=new Uint16Array(a);for(r=0;r<a;++r)n=s[r],h[r]=d[n],++d[n];let v={classes:o,classIds:s,classIndexes:h,parentCounts:u,parentIndexes:f,parentIds:c};return pAt(v),v}function Rg(e,t,r){if(!e)return;let n=e.parentCounts;return e.parentIds?r(e,t):n>0?lAt(e,t,r):fAt(e,t,r)}function lAt(e,t,r){let n=e.classIds,i=e.parentCounts,a=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(ac(f))return f;let p=i[t],d=o[t];for(let h=0;h<p;++h){let v=a[d+h];v!==t&&l.push(v)}}return null}function fAt(e,t,r){let n=!0;for(;n;){let i=r(e,t);if(ac(i))return i;let a=e.parentIds[t];n=a!==t,t=a}throw new Error("traverseHierarchySingleParent")}function pAt(e){let t=[],n=e.classIds.length;for(let i=0;i<n;++i)xxe(e,i,stack)}function xxe(e,t,r){let n=e.parentCounts,i=e.parentIds,a=e.parentIndexes,s=e.classIds.length;if(!ac(i))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=ac(n)?n[t]:1,c=ac(n)?a[t]:t;for(let l=0;l<u;++l){let f=i[c+l];f!==t&&xxe(e,f,r)}r.pop(t)}function eo(e){return e!=null}var s8=(e,t)=>e,dAt={HIERARCHY:!0,extensions:!0,extras:!0},Zd=class{json;binary;featureCount;_extensions;_properties;_binaryProperties;_hierarchy;constructor(t,r,n,i={}){var a;Rt(n>=0),this.json=t||{},this.binary=r,this.featureCount=n,this._extensions=((a=this.json)==null?void 0:a.extensions)||{},this._properties={};for(let o in this.json)dAt[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),i["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=vxe(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),Rt(typeof r=="string",r),this._hierarchy){let n=Rg(this._hierarchy,t,(i,a)=>{let o=i.classIds[a];return i.classes[o].name===r});return eo(n)}return!1}isExactClass(t,r){return Rt(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),Rt(typeof r=="string",r),eo(this._properties[r])||this._hasPropertyInHierarchy(t,r)}getPropertyNames(t,r){this._checkBatchId(t),r=eo(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),Rt(typeof r=="string",r),this._binaryProperties){let i=this._binaryProperties[r];if(eo(i))return this._getBinaryProperty(i,t)}let n=this._properties[r];if(eo(n))return s8(n[t],!0);if(this._hierarchy){let i=this._getHierarchyProperty(t,r);if(eo(i))return i}}setProperty(t,r,n){let i=this.featureCount;if(this._checkBatchId(t),Rt(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 a=this._properties[r];eo(a)||(this._properties[r]=new Array(i),a=this._properties[r]),a[t]=s8(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],i=this._initializeBinaryProperty(r,n);i&&(t=t||{},t[r]=i)}return t}_initializeBinaryProperty(t,r){if("byteOffset"in r){let n=r;Rt(this.binary,`Property ${t} requires a batch table binary.`),Rt(n.type,`Property ${t} requires a type.`);let i=gxe(n,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:i.values,componentCount:i.size,unpack:i.unpacker,pack:i.packer}}return null}_hasPropertyInHierarchy(t,r){if(!this._hierarchy)return!1;let n=Rg(this._hierarchy,t,(i,a)=>{let o=i.classIds[a],s=i.classes[o].instances;return eo(s[r])});return eo(n)}_getPropertyNamesInHierarchy(t,r){Rg(this._hierarchy,t,(n,i)=>{let a=n.classIds[i],o=n.classes[a].instances;for(let s in o)o.hasOwnProperty(s)&&r.indexOf(s)===-1&&r.push(s)})}_getHierarchyProperty(t,r){return Rg(this._hierarchy,t,(n,i)=>{let a=n.classIds[i],o=n.classes[a],s=n.classIndexes[i],u=o.instances[r];return eo(u)?eo(u.typedArray)?this._getBinaryProperty(u,s):s8(u[s],!0):null})}_setHierarchyProperty(t,r,n,i){let a=Rg(this._hierarchy,r,(o,s)=>{let u=o.classIds[s],c=o.classes[u],l=o.classIndexes[s],f=c.instances[n];return eo(f)?(Rt(s===r,`Inherited property "${n}" is read-only.`),eo(f.typedArray)?this._setBinaryProperty(f,l,i):f[l]=s8(i,!0),!0):!1});return eo(a)}};var lL=4;function lp(e,t,r=0){let n=new DataView(t);if(e.magic=n.getUint32(r,!0),r+=lL,e.version=n.getUint32(r,!0),r+=lL,e.byteLength=n.getUint32(r,!0),r+=lL,e.version!==1)throw new Error(`3D Tile Version ${e.version} not supported`);return r}var jg=4,bxe="b3dm tile in legacy format.";function Mg(e,t,r){let n=new DataView(t),i;e.header=e.header||{};let a=n.getUint32(r,!0);r+=jg;let o=n.getUint32(r,!0);r+=jg;let s=n.getUint32(r,!0);r+=jg;let u=n.getUint32(r,!0);return r+=jg,s>=570425344?(r-=jg*2,i=a,s=o,u=0,a=0,o=0,console.warn(bxe)):u>=570425344&&(r-=jg,i=s,s=a,u=o,a=0,o=0,console.warn(bxe)),e.header.featureTableJsonByteLength=a,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=u,e.header.batchLength=i,r}function Lg(e,t,r,n){return r=hAt(e,t,r,n),r=mAt(e,t,r,n),r}function hAt(e,t,r,n){let{featureTableJsonByteLength:i,featureTableBinaryByteLength:a,batchLength:o}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:o||0},i&&i>0){let s=EM(t,r,i);e.featureTableJson=JSON.parse(s)}return r+=i||0,e.featureTableBinary=new Uint8Array(t,r,a),r+=a||0,r}function mAt(e,t,r,n){let{batchTableJsonByteLength:i,batchTableBinaryByteLength:a}=e.header||{};if(i&&i>0){let o=EM(t,r,i);e.batchTableJson=JSON.parse(o),r+=i,a&&a>0&&(e.batchTableBinary=new Uint8Array(t,r,a),e.batchTableBinary=new Uint8Array(e.batchTableBinary),r+=a)}return r}function fL(e,t,r){if(!t&&(!e||!e.batchIds||!r))return null;let{batchIds:n,isRGB565:i,pointCount:a=0}=e;if(n&&r){let o=new Uint8ClampedArray(a*3);for(let s=0;s<a;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:Tt.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}if(t&&i){let o=new Uint8ClampedArray(a*3);for(let s=0;s<a;s++){let u=kM(t[s]);o[s*3]=u[0],o[s*3+1]=u[1],o[s*3+2]=u[2]}return{type:Tt.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}return t&&t.length===a*3?{type:Tt.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:Tt.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var yxe=new _e;function _xe(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++)FM(t[n*2],t[n*2+1],yxe),yxe.toArray(r,n*3);return{type:Tt.FLOAT,size:2,value:r}}return{type:Tt.FLOAT,size:2,value:t}}function wxe(e,t,r){return e.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,gAt(e,t)):{type:Tt.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function gAt(e,t){let r=new _e,n=new Float32Array(e.pointCount*3);for(let i=0;i<e.pointCount;i++)r.set(t[i*3],t[i*3+1],t[i*3+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(n,i*3);return n}async function Exe(e,t,r,n,i){r=lp(e,t,r),r=Mg(e,t,r),r=Lg(e,t,r,n),vAt(e);let{featureTable:a,batchTable:o}=xAt(e);return await EAt(e,a,o,n,i),bAt(e,a,n),yAt(e,a,o),_At(e,a),r}function vAt(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function xAt(e){let t=new dl(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",Tt.FLOAT,3);let n=wAt(e,t);return{featureTable:t,batchTable:n}}function bAt(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",Tt.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let n=t.getPropertyArray("POSITION_QUANTIZED",Tt.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Tt.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Tt.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=wxe(e,n,r)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function yAt(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",Tt.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?n=t.getPropertyArray("RGB",Tt.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(n=t.getPropertyArray("RGB565",Tt.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=fL(e,n,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",Tt.UNSIGNED_BYTE,4))}function _At(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",Tt.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",Tt.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=_xe(e,r)}}function wAt(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",Tt.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:i,batchTableBinary:a}=e;r=new Zd(i,a,n)}return r}async function EAt(e,t,r,n,i){let a,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");a=(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(!a)return!0;let l={buffer:a,properties:{...o,...s},featureTableProperties:o,batchTableProperties:s,dequantizeInShader:!1};return await AAt(e,l,n,i)}async function AAt(e,t,r,n){if(!n)return;let i={...r,draco:{...r==null?void 0:r.draco,extraAttributes:t.batchTableProperties||{}}};delete i["3d-tiles"];let a=await ho(t.buffer,Dg,i,n),o=a.attributes.POSITION&&a.attributes.POSITION.value,s=a.attributes.COLOR_0&&a.attributes.COLOR_0.value,u=a.attributes.NORMAL&&a.attributes.NORMAL.value,c=a.attributes.BATCH_ID&&a.attributes.BATCH_ID.value,l=o&&a.attributes.POSITION.value.quantization,f=u&&a.attributes.NORMAL.value.quantization;if(l){let d=a.POSITION.data.quantization,h=d.range;e.quantizedVolumeScale=new _e(h,h,h),e.quantizedVolumeOffset=new _e(d.minValues),e.quantizedRange=(1<<d.quantizationBits)-1,e.isQuantizedDraco=!0}f&&(e.octEncodedRange=(1<<a.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let p={};if(t.batchTableProperties)for(let d of Object.keys(t.batchTableProperties))a.attributes[d]&&a.attributes[d].value&&(p[d.toLowerCase()]=a.attributes[d].value);e.attributes={positions:o,colors:fL(e,s,void 0),normals:u,batchIds:c,...p}}var yL={};ui(yL,{decode:()=>cSt,name:()=>x8});var u8="4.2.0-alpha.6";var Axe,SAt=(Axe=globalThis.loaders)==null?void 0:Axe.parseImageNode,pL=typeof Image<"u",dL=typeof ImageBitmap<"u",TAt=Boolean(SAt),hL=jr?!0:TAt;function Sxe(e){switch(e){case"auto":return dL||pL||hL;case"imagebitmap":return dL;case"image":return pL;case"data":return hL;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Txe(){if(dL)return"imagebitmap";if(pL)return"image";if(hL)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Cxe(e){let t=CAt(e);if(!t)throw new Error("Not an image");return t}function mL(e){return qg(e)}function qg(e){switch(Cxe(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 CAt(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 DAt=/^data:image\/svg\+xml/,kAt=/\.svg((\?|#).*)?$/;function c8(e){return e&&(DAt.test(e)||kAt.test(e))}function Dxe(e,t){if(c8(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(a){throw new Error(a.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return gL(e,t)}function gL(e,t){if(c8(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function l8(e,t,r){let n=Dxe(e,r),i=self.URL||self.webkitURL,a=typeof n!="string"&&i.createObjectURL(n);try{return await FAt(a||n,t)}finally{a&&i.revokeObjectURL(a)}}async function FAt(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,i)=>{try{r.onload=()=>n(r),r.onerror=a=>{let o=a instanceof Error?a.message:"error";i(new Error(o))}}catch(a){i(a)}})}var BAt={},kxe=!0;async function Fxe(e,t,r){let n;c8(r)?n=await l8(e,t,r):n=gL(e,r);let i=t&&t.imagebitmap;return await PAt(n,i)}async function PAt(e,t=null){if((OAt(t)||!kxe)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),kxe=!1}return await createImageBitmap(e)}function OAt(e){for(let t in e||BAt)return!1;return!0}function Bxe(e){return!MAt(e,"ftyp",4)||!(e[8]&96)?null:IAt(e)}function IAt(e){switch(RAt(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function RAt(e,t,r){return String.fromCharCode(...e.slice(t,r))}function jAt(e){return[...e].map(t=>t.charCodeAt(0))}function MAt(e,t,r=0){let n=jAt(t);for(let i=0;i<n.length;++i)if(n[i]!==e[i+r])return!1;return!0}var oc=!1,iy=!0;function eh(e){let t=ay(e);return qAt(t)||GAt(t)||NAt(t)||UAt(t)||LAt(t)}function LAt(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=Bxe(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function qAt(e){let t=ay(e);return t.byteLength>=24&&t.getUint32(0,oc)===2303741511?{mimeType:"image/png",width:t.getUint32(16,oc),height:t.getUint32(20,oc)}:null}function NAt(e){let t=ay(e);return t.byteLength>=10&&t.getUint32(0,oc)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,iy),height:t.getUint16(8,iy)}:null}function UAt(e){let t=ay(e);return t.byteLength>=14&&t.getUint16(0,oc)===16973&&t.getUint32(2,iy)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,iy),height:t.getUint32(22,iy)}:null}function GAt(e){let t=ay(e);if(!(t.byteLength>=3&&t.getUint16(0,oc)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:i}=zAt(),a=2;for(;a+9<t.byteLength;){let o=t.getUint16(a,oc);if(i.has(o))return{mimeType:"image/jpeg",height:t.getUint16(a+5,oc),width:t.getUint16(a+7,oc)};if(!n.has(o))return null;a+=2,a+=t.getUint16(a,oc)}return null}function zAt(){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 ay(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 Pxe(e,t){var i;let{mimeType:r}=eh(e)||{},n=(i=globalThis.loaders)==null?void 0:i.parseImageNode;return Rt(n),await n(e,r)}async function Oxe(e,t,r){t=t||{};let i=(t.image||{}).type||"auto",{url:a}=r||{},o=HAt(i),s;switch(o){case"imagebitmap":s=await Fxe(e,t,a);break;case"image":s=await l8(e,t,a);break;case"data":s=await Pxe(e,t);break;default:Rt(!1)}return i==="data"&&(s=qg(s)),s}function HAt(e){switch(e){case"auto":case"data":return Txe();default:return Sxe(e),e}}var WAt=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],VAt=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],$At={image:{type:"auto",decode:!0}},Ng={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:u8,mimeTypes:VAt,extensions:WAt,parse:Oxe,tests:[e=>Boolean(eh(new DataView(e)))],options:$At};var jxe,Ixe=(jxe=globalThis.loaders)==null?void 0:jxe.encodeImageNode;async function Mxe(e,t){return t=t||{},t.image=t.image||{},Ixe?Ixe(e,{type:t.image.mimeType}):KAt(e,t)}var Rxe=!0;async function KAt(e,t){let{mimeType:r,jpegQuality:n}=t.image,{width:i,height:a}=mL(e),o=document.createElement("canvas");o.width=i,o.height=a,JAt(e,o);let s=await new Promise(u=>{if(n&&Rxe)try{o.toBlob(u,r,n);return}catch{Rxe=!1}o.toBlob(u,r)});if(!s)throw new Error("image encoding failed");return await s.arrayBuffer()}function JAt(e,t,r=0,n=0){if(r===0&&n===0&&typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let a=t.getContext("bitmaprenderer");if(a)return a.transferFromImageBitmap(e),t}let i=t.getContext("2d");if(e.data){let a=new Uint8ClampedArray(e.data),o=new ImageData(a,e.width,e.height);return i.putImageData(o,0,0),t}return i.drawImage(e,0,0),t}var vL={name:"Images",id:"image",module:"images",version:u8,extensions:["jpeg"],options:{image:{mimeType:"image/png",jpegQuality:null}},encode:Mxe};var xL={};function bL(e){if(xL[e]===void 0){let t=jr?XAt(e):YAt(e);xL[e]=t}return xL[e]}function YAt(e){var i,a;let t=["image/png","image/jpeg","image/gif"],r=((i=globalThis.loaders)==null?void 0:i.imageFormatsNode)||t,n=(a=globalThis.loaders)==null?void 0:a.parseImageNode;return Boolean(n)&&r.includes(e)}function XAt(e){switch(e){case"image/avif":case"image/webp":return QAt(e);default:return!0}}function QAt(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}function bi(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var f8={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},p8={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var ZAt=1.33,Lxe=["SCALAR","VEC2","VEC3","VEC4"],eSt=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],tSt=new Map(eSt),rSt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},nSt={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},iSt={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function d8(e){return Lxe[e-1]||Lxe[0]}function Ug(e){let t=tSt.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function Gg(e,t){let r=iSt[e.componentType],n=rSt[e.type],i=nSt[e.componentType],a=e.count*n,o=e.count*n*i;bi(o>=0&&o<=t.byteLength);let s=p8[e.componentType],u=f8[e.type];return{ArrayType:r,length:a,byteLength:o,componentByteSize:s,numberOfComponentsInElement:u}}function oy(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 i=r.reduce((o,s)=>o+s.byteLength,0),a=t.reduce((o,s)=>{let{width:u,height:c}=s.image;return o+u*c},0);return i+Math.ceil(4*a*ZAt)}function qxe(e,t,r){let n=e.bufferViews[r];bi(n);let i=n.buffer,a=t[i];bi(a);let o=(n.byteOffset||0)+a.byteOffset;return new Uint8Array(a.arrayBuffer,o,n.byteLength)}function Nxe(e,t,r){var v,m;let n=typeof r=="number"?(v=e.accessors)==null?void 0:v[r]:r;if(!n)throw new Error(`No gltf accessor ${JSON.stringify(r)}`);let i=(m=e.bufferViews)==null?void 0:m[n.bufferView||0];if(!i)throw new Error(`No gltf buffer view for accessor ${i}`);let{arrayBuffer:a,byteOffset:o}=t[i.buffer],s=(o||0)+(n.byteOffset||0)+(i.byteOffset||0),{ArrayType:u,length:c,componentByteSize:l,numberOfComponentsInElement:f}=Gg(n,i),p=l*f,d=i.byteStride||p;if(typeof i.byteStride>"u"||i.byteStride===p)return new u(a,s,c);let h=new u(c);for(let b=0;b<n.count;b++){let _=new u(a,s+b*d,f);h.set(_,b*f)}return h}function aSt(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var br=class{gltf;sourceBuffers;byteLength;constructor(t){this.gltf={json:(t==null?void 0:t.json)||aSt(),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(i=>i===t),n=this.getRequiredExtensions().find(i=>i===t);return typeof r=="string"||typeof n=="string"}getExtension(t){let r=this.getUsedExtensions().find(i=>i===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];bi(n);let i=(t.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,i,t.byteLength)}getTypedArrayForAccessor(t){let r=this.getAccessor(t);return Nxe(this.gltf.json,this.gltf.buffers,r)}getTypedArrayForImageData(t){t=this.getAccessor(t);let r=this.getBufferView(t.bufferView),i=this.getBuffer(r.buffer).data,a=r.byteOffset||0;return new Uint8Array(i,a,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 i=t.extensions||{};i[r]=n}removeObjectExtension(t,r){let n=(t==null?void 0:t.extensions)||{};if(n[r]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let i=this.json.extensionsRemoved;i.includes(r)||i.push(r)}delete n[r]}addExtension(t,r={}){return bi(r),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=r,this.registerUsedExtension(t),r}addRequiredExtension(t,r={}){return bi(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 i={mesh:r};return n&&(i.matrix=n),this.json.nodes.push(i),this.json.nodes.length-1}addMesh(t){let{attributes:r,indices:n,material:i,mode:a=4}=t,s={primitives:[{attributes:this._addAttributes(r),mode:a}]};if(n){let u=this._addIndices(n);s.primitives[0].indices=u}return Number.isFinite(i)&&(s.primitives[0].material=i),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=eh(t),i=r||(n==null?void 0:n.mimeType),o={bufferView:this.addBufferView(t),mimeType:i};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 i=t.byteLength;bi(Number.isFinite(i)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let a={buffer:r,byteOffset:n,byteLength:i};return this.byteLength+=go(i,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(a),this.json.bufferViews.length-1}addAccessor(t,r){let n={bufferView:t,type:d8(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),i={min:r.min,max:r.max};(!i.min||!i.max)&&(i=this._getAccessorMinMax(t,r.size));let a={size:r.size,componentType:Ug(t),count:Math.round(t.length/r.size),min:i.min,max:i.max};return this.addAccessor(n,Object.assign(a,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 a,o;this.gltf.buffers=[];let t=this.byteLength,r=new ArrayBuffer(t),n=new Uint8Array(r),i=0;for(let s of this.sourceBuffers||[])i=OB(s,n,i);(o=(a=this.json)==null?void 0:a.buffers)!=null&&o[0]?this.json.buffers[0].byteLength=t:this.json.buffers=[{byteLength:t}],this.gltf.binary=r,this.sourceBuffers=[r]}_removeStringFromArray(t,r){let n=!0;for(;n;){let i=t.indexOf(r);i>-1?t.splice(i,1):n=!1}}_addAttributes(t={}){let r={};for(let n in t){let i=t[n],a=this._getGltfAttributeName(n),o=this.addBinaryBuffer(i.value,i);r[a]=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 i=t.subarray(0,r);for(let a of i)n.min.push(a),n.max.push(a);for(let a=r;a<t.length;a+=r)for(let o=0;o<r;o++)n.min[0+o]=Math.min(n.min[0+o],t[a+o]),n.max[0+o]=Math.max(n.max[0+o],t[a+o]);return n}};function Uxe(e){return(e%1+1)%1}var Gxe={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},oSt={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},zxe={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function sy(e,t){return zxe[t]*Gxe[e]}function zg(e,t,r,n){if(r!=="UINT8"&&r!=="UINT16"&&r!=="UINT32"&&r!=="UINT64")return null;let i=e.getTypedArrayForBufferView(t),a=Hg(i,"SCALAR",r,n+1);return a instanceof BigInt64Array||a instanceof BigUint64Array?null:a}function Hg(e,t,r,n=1){let i=Gxe[t],a=oSt[r],o=zxe[r],s=n*i,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 a(c,l,s)}function Wg(e,t,r){var c,l,f,p,d;let n=`TEXCOORD_${t.texCoord||0}`,i=r.attributes[n],a=e.getTypedArrayForAccessor(i),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,v=(d=e.gltf.images)==null?void 0:d[u];if(v&&typeof v.width<"u"){let m=[];for(let b=0;b<a.length;b+=2){let _=sSt(v,h,a,b,t.channels);m.push(_)}return m}}return[]}function h8(e,t,r,n,i){if(!(r!=null&&r.length))return;let a=[];for(let l of r){let f=n.findIndex(p=>p===l);f===-1&&(f=n.push(l)-1),a.push(f)}let o=new Uint32Array(a),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:Ug(o),count:o.length});i.attributes[t]=c}function sSt(e,t,r,n,i=[0]){let a={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=uSt(o,s,e,u),l=0;for(let f of i){let p=typeof f=="number"?Object.values(a)[f]:a[f],d=c+p.offset,h=qg(e);if(h.data.length<=d)throw new Error(`${h.data.length} <= ${d}`);let v=h.data[d];l|=v<<p.shift}return l}function uSt(e,t,r,n=1){let i=r.width,a=Uxe(e)*(i-1),o=Math.round(a),s=r.height,u=Uxe(t)*(s-1),c=Math.round(u),l=r.components?r.components:n;return(c*i+o)*l}function m8(e,t,r,n,i){let a=[];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/i,l=u/i;a.push(e.slice(c,c+l))}return a}function g8(e,t,r){let n=[];for(let i=0;i<t;i++){let a=i*r;n.push(e.slice(a,a+r))}return n}function v8(e,t,r,n){if(r)throw new Error("Not implemented - arrayOffsets for strings is specified");if(n){let i=[],a=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=a.decode(c);i.push(l),o+=u}}return i}return[]}var Hxe="EXT_mesh_features",x8=Hxe;async function cSt(e,t){let r=new br(e);lSt(r,t)}function lSt(e,t){let r=e.gltf.json;if(r.meshes)for(let n of r.meshes)for(let i of n.primitives)fSt(e,i,t)}function fSt(e,t,r){var a,o,s;if(!((a=r==null?void 0:r.gltf)!=null&&a.loadBuffers))return;let n=(o=t.extensions)==null?void 0:o[Hxe],i=n==null?void 0:n.featureIds;if(i)for(let u of i){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=Wg(e,u.texture,t):c=[];u.data=c}}var EL={};ui(EL,{decode:()=>pSt,name:()=>hl});var _L="EXT_structural_metadata",hl=_L;async function pSt(e,t){let r=new br(e);dSt(r,t)}function dSt(e,t){var n,i;if(!((n=t.gltf)!=null&&n.loadBuffers))return;let r=e.getExtension(_L);r&&((i=t.gltf)!=null&&i.loadImages&&hSt(e,r),mSt(e,r))}function hSt(e,t){let r=t.propertyTextures,n=e.gltf.json;if(r&&n.meshes)for(let i of n.meshes)for(let a of i.primitives)vSt(e,r,a,t)}function mSt(e,t){let r=t.schema;if(!r)return;let n=r.classes,i=t.propertyTables;if(n&&i)for(let a in n){let o=gSt(i,a);o&&bSt(e,r,o)}}function gSt(e,t){for(let r of e)if(r.class===t)return r;return null}function vSt(e,t,r,n){var o;if(!t)return;let i=(o=r.extensions)==null?void 0:o[_L],a=i==null?void 0:i.propertyTextures;if(a)for(let s of a){let u=t[s];xSt(e,u,r,n)}}function xSt(e,t,r,n){var a;if(!t.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);let i=t.class;for(let o in t.properties){let s=`${i}_${o}`,u=(a=t.properties)==null?void 0:a[o];if(!u)continue;u.data||(u.data=[]);let c=u.data,l=Wg(e,u,r);l!==null&&(h8(e,s,l,c,r),u.data=c,n.dataAttributeNames.push(s))}}function bSt(e,t,r){var a,o;let n=(a=t.classes)==null?void 0:a[r.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let i=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=ySt(e,t,u,i,c);c.data=l}}}function ySt(e,t,r,n,i){let a=[],o=i.values,s=e.getTypedArrayForBufferView(o),u=_St(e,r,i,n),c=wSt(e,i,n);switch(r.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{a=ESt(r,n,s,u);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${r.type}`);case"STRING":{a=v8(n,s,u,c);break}case"ENUM":{a=ASt(t,r,n,s,u);break}default:throw new Error(`Unknown classProperty type ${r.type}`)}return a}function _St(e,t,r,n){return t.array&&typeof t.count>"u"&&typeof r.arrayOffsets<"u"?zg(e,r.arrayOffsets,r.arrayOffsetType||"UINT32",n):null}function wSt(e,t,r){return typeof t.stringOffsets<"u"?zg(e,t.stringOffsets,t.stringOffsetType||"UINT32",r):null}function ESt(e,t,r,n){let i=e.array,a=e.count,o=sy(e.type,e.componentType),s=r.byteLength/o,u;return e.componentType?u=Hg(r,e.type,e.componentType,s):u=r,i?n?m8(u,t,n,r.length,o):a?g8(u,t,a):[]:u}function ASt(e,t,r,n,i){var f;let a=t.enumType;if(!a)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[a];if(!o)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${a}`);let s=o.valueType||"UINT16",u=sy(t.type,s),c=n.byteLength/u,l=Hg(n,t.type,s,c);if(l||(l=n),t.array){if(i)return SSt({valuesData:l,numberOfElements:r,arrayOffsets:i,valuesDataBytesLength:n.length,elementSize:u,enumEntry:o});let p=t.count;return p?TSt(l,r,p,o):[]}return wL(l,0,r,o)}function SSt(e){let{valuesData:t,numberOfElements:r,arrayOffsets:n,valuesDataBytesLength:i,elementSize:a,enumEntry:o}=e,s=[];for(let u=0;u<r;u++){let c=n[u],l=n[u+1]-n[u];if(l+c>i)break;let f=c/a,p=l/a,d=wL(t,f,p,o);s.push(d)}return s}function TSt(e,t,r,n){let i=[];for(let a=0;a<t;a++){let o=r*a,s=wL(e,o,r,n);i.push(s)}return i}function wL(e,t,r,n){let i=[];for(let a=0;a<r;a++)if(e instanceof BigInt64Array||e instanceof BigUint64Array)i.push("");else{let o=e[t+a],s=CSt(n,o);s?i.push(s.name):i.push("")}return i}function CSt(e,t){for(let r of e.values)if(r.value===t)return r;return null}var AL={};ui(AL,{decode:()=>DSt,name:()=>Zo});var Wxe="EXT_feature_metadata",Zo=Wxe;async function DSt(e,t){let r=new br(e);kSt(r,t)}function kSt(e,t){var n,i;if(!((n=t.gltf)!=null&&n.loadBuffers))return;let r=e.getExtension(Wxe);r&&((i=t.gltf)!=null&&i.loadImages&&FSt(e,r),BSt(e,r))}function FSt(e,t){let r=t.schema;if(!r)return;let n=r.classes,{featureTextures:i}=t;if(n&&i)for(let a in n){let o=n[a],s=OSt(i,a);s&&RSt(e,s,o)}}function BSt(e,t){let r=t.schema;if(!r)return;let n=r.classes,i=t.featureTables;if(n&&i)for(let a in n){let o=PSt(i,a);o&&ISt(e,r,o)}}function PSt(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function OSt(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function ISt(e,t,r){var a,o;if(!r.class)return;let n=(a=t.classes)==null?void 0:a[r.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let i=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=jSt(e,t,u,i,c);c.data=l}}}function RSt(e,t,r){var i;let n=t.class;for(let a in r.properties){let o=(i=t==null?void 0:t.properties)==null?void 0:i[a];if(o){let s=USt(e,o,n);o.data=s}}}function jSt(e,t,r,n,i){let a=[],o=i.bufferView,s=e.getTypedArrayForBufferView(o),u=MSt(e,r,i,n),c=LSt(e,r,i,n);return r.type==="STRING"||r.componentType==="STRING"?a=v8(n,s,u,c):qSt(r)&&(a=NSt(r,n,s,u)),a}function MSt(e,t,r,n){return t.type==="ARRAY"&&typeof t.componentCount>"u"&&typeof r.arrayOffsetBufferView<"u"?zg(e,r.arrayOffsetBufferView,r.offsetType||"UINT32",n):null}function LSt(e,t,r,n){return typeof r.stringOffsetBufferView<"u"?zg(e,r.stringOffsetBufferView,r.offsetType||"UINT32",n):null}function qSt(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 NSt(e,t,r,n){let i=e.type==="ARRAY",a=e.componentCount,o="SCALAR",s=e.componentType||e.type,u=sy(o,s),c=r.byteLength/u,l=Hg(r,o,s,c);return i?n?m8(l,t,n,r.length,u):a?g8(l,t,a):[]:l}function USt(e,t,r){let n=e.gltf.json;if(!n.meshes)return[];let i=[];for(let a of n.meshes)for(let o of a.primitives)GSt(e,r,t,i,o);return i}function GSt(e,t,r,n,i){let a={channels:r.channels,...r.texture},o=Wg(e,a,i);o&&h8(e,t,o,n,i)}var b8="4.2.0-alpha.6";var Vg="4.2.0-alpha.6";var sc={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},Vxe;async function TL(e){xx(e.modules);let t=_B("basis");return t||(Vxe||(Vxe=zSt(e)),await Vxe)}async function zSt(e){let t=null,r=null;return[t,r]=await Promise.all([await ju(sc.TRANSCODER,"textures",e),await ju(sc.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await HSt(t,r)}function HSt(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e(r).then(i=>{let{BasisFile:a,initializeBasis:o}=i;o(),n({BasisFile:a})})})}var SL;async function CL(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(SL=SL||WSt(e),await SL)}async function WSt(e){let t=null,r=null;return[t,r]=await Promise.all([await ju(sc.ENCODER,"textures",e),await ju(sc.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await VSt(t,r)}function VSt(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e(r).then(i=>{let{BasisFile:a,KTX2File:o,initializeBasis:s,BasisEncoder:u}=i;s(),n({BasisFile:a,KTX2File:o,BasisEncoder:u})})})}var ye={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919};var $St=["","WEBKIT_","MOZ_"],$xe={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"},y8=null;function uy(e){if(!y8){e=e||KSt()||void 0,y8=new Set;for(let t of $St)for(let r in $xe)if(e&&e.getExtension(`${t}${r}`)){let n=$xe[r];y8.add(n)}}return y8}function KSt(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var abe=Lt(nbe(),1);function $g(e,t){let r=new Array(t.mipMapLevels),n=t.width,i=t.height,a=0;for(let o=0;o<t.mipMapLevels;++o){let s=XSt(t,n,i,e,o),u=YSt(e,o,a,s);r[o]={compressed:!0,format:t.internalFormat,data:u,width:n,height:i,levelSize:s},n=Math.max(1,n>>1),i=Math.max(1,i>>1),a+=s}return r}function YSt(e,t,r,n){return Array.isArray(e)?e[t].levelData:new Uint8Array(e.buffer,e.byteOffset+r,n)}function XSt(e,t,r,n,i){return Array.isArray(n)?e.sizeFunction(n[i]):e.sizeFunction(t,r)}var QSt={131:ye.COMPRESSED_RGB_S3TC_DXT1_EXT,132:ye.COMPRESSED_SRGB_S3TC_DXT1_EXT,133:ye.COMPRESSED_RGBA_S3TC_DXT1_EXT,134:ye.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,135:ye.COMPRESSED_RGBA_S3TC_DXT3_EXT,136:ye.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,137:ye.COMPRESSED_RGBA_S3TC_DXT5_EXT,138:ye.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,139:ye.COMPRESSED_RED_RGTC1_EXT,140:ye.COMPRESSED_SIGNED_RED_RGTC1_EXT,141:ye.COMPRESSED_RED_GREEN_RGTC2_EXT,142:ye.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,147:ye.COMPRESSED_RGB8_ETC2,148:ye.COMPRESSED_SRGB8_ETC2,149:ye.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,150:ye.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,151:ye.COMPRESSED_RGBA8_ETC2_EAC,152:ye.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,153:ye.COMPRESSED_R11_EAC,154:ye.COMPRESSED_SIGNED_R11_EAC,155:ye.COMPRESSED_RG11_EAC,156:ye.COMPRESSED_SIGNED_RG11_EAC,157:ye.COMPRESSED_RGBA_ASTC_4x4_KHR,158:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,159:ye.COMPRESSED_RGBA_ASTC_5x4_KHR,160:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,161:ye.COMPRESSED_RGBA_ASTC_5x5_KHR,162:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,163:ye.COMPRESSED_RGBA_ASTC_6x5_KHR,164:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,165:ye.COMPRESSED_RGBA_ASTC_6x6_KHR,166:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,167:ye.COMPRESSED_RGBA_ASTC_8x5_KHR,168:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,169:ye.COMPRESSED_RGBA_ASTC_8x6_KHR,170:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,171:ye.COMPRESSED_RGBA_ASTC_8x8_KHR,172:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,173:ye.COMPRESSED_RGBA_ASTC_10x5_KHR,174:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,175:ye.COMPRESSED_RGBA_ASTC_10x6_KHR,176:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,177:ye.COMPRESSED_RGBA_ASTC_10x8_KHR,178:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,179:ye.COMPRESSED_RGBA_ASTC_10x10_KHR,180:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,181:ye.COMPRESSED_RGBA_ASTC_12x10_KHR,182:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,183:ye.COMPRESSED_RGBA_ASTC_12x12_KHR,184:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,1000054e3:ye.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,1000054001:ye.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,1000066e3:ye.COMPRESSED_RGBA_ASTC_4x4_KHR,1000066001:ye.COMPRESSED_RGBA_ASTC_5x4_KHR,1000066002:ye.COMPRESSED_RGBA_ASTC_5x5_KHR,1000066003:ye.COMPRESSED_RGBA_ASTC_6x5_KHR,1000066004:ye.COMPRESSED_RGBA_ASTC_6x6_KHR,1000066005:ye.COMPRESSED_RGBA_ASTC_8x5_KHR,1000066006:ye.COMPRESSED_RGBA_ASTC_8x6_KHR,1000066007:ye.COMPRESSED_RGBA_ASTC_8x8_KHR,1000066008:ye.COMPRESSED_RGBA_ASTC_10x5_KHR,1000066009:ye.COMPRESSED_RGBA_ASTC_10x6_KHR,1000066010:ye.COMPRESSED_RGBA_ASTC_10x8_KHR,1000066011:ye.COMPRESSED_RGBA_ASTC_10x10_KHR,1000066012:ye.COMPRESSED_RGBA_ASTC_12x10_KHR,1000066013:ye.COMPRESSED_RGBA_ASTC_12x12_KHR};function ibe(e){return QSt[e]}var wo=[171,75,84,88,32,50,48,187,13,10,26,10];function S8(e){let t=new Uint8Array(e);return!(t.byteLength<wo.length||t[0]!==wo[0]||t[1]!==wo[1]||t[2]!==wo[2]||t[3]!==wo[3]||t[4]!==wo[4]||t[5]!==wo[5]||t[6]!==wo[6]||t[7]!==wo[7]||t[8]!==wo[8]||t[9]!==wo[9]||t[10]!==wo[10]||t[11]!==wo[11])}function obe(e){let t=new Uint8Array(e),r=(0,abe.read)(t),n=Math.max(1,r.levels.length),i=r.pixelWidth,a=r.pixelHeight,o=ibe(r.vkFormat);return $g(r.levels,{mipMapLevels:n,width:i,height:a,sizeFunction:s=>s.uncompressedByteLength,internalFormat:o})}var ZSt={etc1:{basisFormat:0,compressed:!0,format:ye.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:ye.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:ye.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:ye.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:ye.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:ye.COMPRESSED_RGBA_ASTC_4X4_KHR},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};async function ly(e,t){if(t.basis.containerFormat==="auto"){if(S8(e)){let n=await CL(t);return sbe(n.KTX2File,e,t)}let{BasisFile:r}=await TL(t);return PL(r,e,t)}switch(t.basis.module){case"encoder":let r=await CL(t);switch(t.basis.containerFormat){case"ktx2":return sbe(r.KTX2File,e,t);case"basis":default:return PL(r.BasisFile,e,t)}case"transcoder":default:let{BasisFile:n}=await TL(t);return PL(n,e,t)}}function PL(e,t,r){let n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("Failed to start basis transcoding");let i=n.getNumImages(),a=[];for(let o=0;o<i;o++){let s=n.getNumLevels(o),u=[];for(let c=0;c<s;c++)u.push(e3t(n,o,c,r));a.push(u)}return a}finally{n.close(),n.delete()}}function e3t(e,t,r,n){let i=e.getImageWidth(t,r),a=e.getImageHeight(t,r),o=e.getHasAlpha(),{compressed:s,format:u,basisFormat:c}=ube(n,o),l=e.getImageTranscodedSizeInBytes(t,r,c),f=new Uint8Array(l);if(!e.transcodeImage(f,t,r,c,0,0))throw new Error("failed to start Basis transcoding");return{width:i,height:a,data:f,compressed:s,format:u,hasAlpha:o}}function sbe(e,t,r){let n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("failed to start KTX2 transcoding");let i=n.getLevels(),a=[];for(let o=0;o<i;o++){a.push(t3t(n,o,r));break}return[a]}finally{n.close(),n.delete()}}function t3t(e,t,r){let{alphaFlag:n,height:i,width:a}=e.getImageLevelInfo(t,0,0),{compressed:o,format:s,basisFormat:u}=ube(r,n),c=e.getImageTranscodedSizeInBytes(t,0,0,u),l=new Uint8Array(c);if(!e.transcodeImage(l,t,0,0,u,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:a,height:i,data:l,compressed:o,levelSize:c,hasAlpha:n,format:s}}function ube(e,t){let r=e&&e.basis&&e.basis.format;return r==="auto"&&(r=Kg()),typeof r=="object"&&(r=t?r.alpha:r.noAlpha),r=r.toLowerCase(),ZSt[r]}function Kg(){let e=uy();return e.has("astc")?"astc-4x4":e.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:e.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:e.has("etc1")?"etc1":e.has("etc2")?"etc2":"rgb565"}var cbe={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:Vg,worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},th={...cbe,parse:ly};var Eo={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},r3t={DXT1:ye.COMPRESSED_RGB_S3TC_DXT1_EXT,DXT3:ye.COMPRESSED_RGBA_S3TC_DXT3_EXT,DXT5:ye.COMPRESSED_RGBA_S3TC_DXT5_EXT,"ATC ":ye.COMPRESSED_RGB_ATC_WEBGL,ATCA:ye.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,ATCI:ye.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL},n3t=pbe,i3t=T8,a3t=T8,o3t={DXT1:pbe,DXT3:T8,DXT5:T8,"ATC ":n3t,ATCA:i3t,ATCI:a3t};function lbe(e){return new Uint32Array(e,0,Eo.HEADER_LENGTH)[Eo.MAGIC_NUMBER_INDEX]===Eo.MAGIC_NUMBER}function fbe(e){let t=new Int32Array(e,0,Eo.HEADER_LENGTH),r=t[Eo.HEADER_PF_FOURCC_INDEX];Rt(Boolean(t[Eo.HEADER_PF_FLAGS_INDEX]&Eo.DDPF_FOURCC),"DDS: Unsupported format, must contain a FourCC code");let n=s3t(r),i=r3t[n],a=o3t[n];Rt(i&&a,`DDS: Unknown pixel format ${r}`);let o=1;t[Eo.HEADER_FLAGS_INDEX]&Eo.DDSD_MIPMAPCOUNT&&(o=Math.max(1,t[Eo.MIPMAPCOUNT_INDEX]));let s=t[Eo.HEADER_WIDTH_INDEX],u=t[Eo.HEADER_HEIGHT_INDEX],c=t[Eo.HEADER_SIZE_INDEX]+4,l=new Uint8Array(e,c);return $g(l,{mipMapLevels:o,width:s,height:u,sizeFunction:a,internalFormat:i})}function pbe(e,t){return(e+3>>2)*(t+3>>2)*8}function T8(e,t){return(e+3>>2)*(t+3>>2)*16}function s3t(e){return String.fromCharCode(e&255,e>>8&255,e>>16&255,e>>24&255)}var es={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},u3t={0:[ye.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],1:[ye.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],2:[ye.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],3:[ye.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],6:[ye.COMPRESSED_RGB_ETC1_WEBGL],7:[ye.COMPRESSED_RGB_S3TC_DXT1_EXT],9:[ye.COMPRESSED_RGBA_S3TC_DXT3_EXT],11:[ye.COMPRESSED_RGBA_S3TC_DXT5_EXT],22:[ye.COMPRESSED_RGB8_ETC2],23:[ye.COMPRESSED_RGBA8_ETC2_EAC],24:[ye.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],25:[ye.COMPRESSED_R11_EAC],26:[ye.COMPRESSED_RG11_EAC],27:[ye.COMPRESSED_RGBA_ASTC_4X4_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR],28:[ye.COMPRESSED_RGBA_ASTC_5X4_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR],29:[ye.COMPRESSED_RGBA_ASTC_5X5_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR],30:[ye.COMPRESSED_RGBA_ASTC_6X5_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR],31:[ye.COMPRESSED_RGBA_ASTC_6X6_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR],32:[ye.COMPRESSED_RGBA_ASTC_8X5_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR],33:[ye.COMPRESSED_RGBA_ASTC_8X6_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR],34:[ye.COMPRESSED_RGBA_ASTC_8X8_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR],35:[ye.COMPRESSED_RGBA_ASTC_10X5_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR],36:[ye.COMPRESSED_RGBA_ASTC_10X6_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR],37:[ye.COMPRESSED_RGBA_ASTC_10X8_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR],38:[ye.COMPRESSED_RGBA_ASTC_10X10_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR],39:[ye.COMPRESSED_RGBA_ASTC_12X10_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR],40:[ye.COMPRESSED_RGBA_ASTC_12X12_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR]},c3t={0:dbe,1:dbe,2:hbe,3:hbe,6:fy,7:fy,9:py,11:py,22:fy,23:py,24:fy,25:fy,26:py,27:py,28:l3t,29:f3t,30:p3t,31:d3t,32:h3t,33:m3t,34:g3t,35:v3t,36:x3t,37:b3t,38:y3t,39:_3t,40:w3t};function mbe(e){let r=new Uint32Array(e,0,es.HEADER_LENGTH)[es.MAGIC_NUMBER_INDEX];return r===es.MAGIC_NUMBER||r===es.MAGIC_NUMBER_EXTRA}function gbe(e){let t=new Uint32Array(e,0,es.HEADER_LENGTH),r=t[es.PIXEL_FORMAT_INDEX],n=t[es.COLOUR_SPACE_INDEX],i=u3t[r]||[],a=i.length>1&&n?i[1]:i[0],o=c3t[r],s=t[es.MIPMAPCOUNT_INDEX],u=t[es.WIDTH_INDEX],c=t[es.HEIGHT_INDEX],l=es.HEADER_SIZE+t[es.METADATA_SIZE_INDEX],f=new Uint8Array(e,l);return $g(f,{mipMapLevels:s,width:u,height:c,sizeFunction:o,internalFormat:a})}function dbe(e,t){return e=Math.max(e,16),t=Math.max(t,8),e*t/4}function hbe(e,t){return e=Math.max(e,8),t=Math.max(t,8),e*t/2}function fy(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8}function py(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16}function l3t(e,t){return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16}function f3t(e,t){return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16}function p3t(e,t){return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16}function d3t(e,t){return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16}function h3t(e,t){return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16}function m3t(e,t){return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16}function g3t(e,t){return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16}function v3t(e,t){return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16}function x3t(e,t){return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16}function b3t(e,t){return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16}function y3t(e,t){return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16}function _3t(e,t){return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16}function w3t(e,t){return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16}function vbe(e){if(S8(e))return obe(e);if(lbe(e))return fbe(e);if(mbe(e))return gbe(e);throw new Error("Texture container format not recognized")}var xbe={dataType:null,batchType:null,name:"Texture Containers",id:"compressed-texture",module:"textures",version:Vg,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":{libraryPath:"libs/",useBasis:!1}}},C8={...xbe,parse:async(e,t)=>{var r;return(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 ly(e,t))[0]):vbe(e)}};var OL={name:"Basis Universal Supercompressed GPU Texture",id:"ktx2-basis-writer",module:"textures",version:Vg,extensions:["ktx2"],worker:!0,options:{useSRGB:!1,qualityLevel:10,encodeUASTC:!1,mipmaps:!1}};var Jg=!0,bbe=1735152710,jL=12,D8=8,E3t=1313821514,A3t=5130562,S3t=0,T3t=0,C3t=1;function D3t(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 ybe(e,t=0,r={}){let n=new DataView(e),{magic:i=bbe}=r,a=n.getUint32(t,!1);return a===i||a===bbe}function _be(e,t,r=0,n={}){let i=new DataView(t),a=D3t(i,r+0),o=i.getUint32(r+4,Jg),s=i.getUint32(r+8,Jg);switch(Object.assign(e,{header:{byteOffset:r,byteLength:s,hasBinChunk:!1},type:a,version:o,json:{},binChunks:[]}),r+=jL,e.version){case 1:return k3t(e,i,r);case 2:return F3t(e,i,r,n={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function k3t(e,t,r){Rt(e.header.byteLength>jL+D8);let n=t.getUint32(r+0,Jg),i=t.getUint32(r+4,Jg);return r+=D8,Rt(i===S3t),IL(e,t,r,n),r+=n,r+=RL(e,t,r,e.header.byteLength),r}function F3t(e,t,r,n){return Rt(e.header.byteLength>jL+D8),B3t(e,t,r,n),r+e.header.byteLength}function B3t(e,t,r,n){for(;r+8<=e.header.byteLength;){let i=t.getUint32(r+0,Jg),a=t.getUint32(r+4,Jg);switch(r+=D8,a){case E3t:IL(e,t,r,i);break;case A3t:RL(e,t,r,i);break;case T3t:n.strict||IL(e,t,r,i);break;case C3t:n.strict||RL(e,t,r,i);break;default:break}r+=go(i,4)}return r}function IL(e,t,r,n){let i=new Uint8Array(t.buffer,r,n),o=new TextDecoder("utf8").decode(i);return e.json=JSON.parse(o),go(n,4)}function RL(e,t,r,n){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:t.buffer}),go(n,4)}function ML(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;let n=t.baseUri||t.uri;if(!n)throw new Error(`'baseUri' must be provided to resolve relative url ${e}`);return n.substr(0,n.lastIndexOf("/")+1)+e}var qL={};ui(qL,{decode:()=>z3t,name:()=>G3t});var P3t="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",O3t="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",I3t=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]),R3t=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]),j3t={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},M3t={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function wbe(e,t,r,n,i,a="NONE"){let o=await L3t();U3t(o,o.exports[M3t[i]],e,t,r,n,o.exports[j3t[a||"NONE"]])}var LL;async function L3t(){return LL||(LL=q3t()),LL}async function q3t(){let e=P3t;WebAssembly.validate(I3t)&&(e=O3t,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(N3t(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function N3t(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;++n){let i=e.charCodeAt(n);t[n]=i>96?i-71:i>64?i-65:i>47?i+4:i>46?63:62}let r=0;for(let n=0;n<e.length;++n)t[r++]=t[n]<60?R3t[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,r)}function U3t(e,t,r,n,i,a,o){let s=e.exports.sbrk,u=n+3&-4,c=s(u*i),l=s(a.length),f=new Uint8Array(e.exports.memory.buffer);f.set(a,l);let p=t(c,n,i,l,a.length);if(p===0&&o&&o(c,u,i),r.set(f.subarray(c,c+n*i)),s(c-s(0)),p!==0)throw new Error(`Malformed buffer data: ${p}`)}var k8="EXT_meshopt_compression",G3t=k8;async function z3t(e,t){var i,a;let r=new br(e);if(!((i=t==null?void 0:t.gltf)!=null&&i.decompressMeshes)||!((a=t.gltf)!=null&&a.loadBuffers))return;let n=[];for(let o of e.json.bufferViews||[])n.push(H3t(r,o));await Promise.all(n),r.removeExtension(k8)}async function H3t(e,t){let r=e.getObjectExtension(t,k8);if(r){let{byteOffset:n=0,byteLength:i=0,byteStride:a,count:o,mode:s,filter:u="NONE",buffer:c}=r,l=e.gltf.buffers[c],f=new Uint8Array(l.arrayBuffer,l.byteOffset+n,i),p=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await wbe(p,o,a,f,s,u),e.removeObjectExtension(t,k8)}}var NL={};ui(NL,{name:()=>W3t,preprocess:()=>V3t});var Yg="EXT_texture_webp",W3t=Yg;function V3t(e,t){let r=new br(e);if(!bL("image/webp")){if(r.getRequiredExtensions().includes(Yg))throw new Error(`gltf: Required extension ${Yg} not supported by browser`);return}let{json:n}=r;for(let i of n.textures||[]){let a=r.getObjectExtension(i,Yg);a&&(i.source=a.source),r.removeObjectExtension(i,Yg)}r.removeExtension(Yg)}var UL={};ui(UL,{name:()=>$3t,preprocess:()=>K3t});var F8="KHR_texture_basisu",$3t=F8;function K3t(e,t){let r=new br(e),{json:n}=r;for(let i of n.textures||[]){let a=r.getObjectExtension(i,F8);a&&(i.source=a.source,r.removeObjectExtension(i,F8))}r.removeExtension(F8)}var HL={};ui(HL,{decode:()=>Z3t,encode:()=>e6t,name:()=>X3t,preprocess:()=>Q3t});function Ebe(e){let t={};for(let r in e){let n=e[r];if(r!=="indices"){let i=zL(n);t[r]=i}}return t}function zL(e){let{buffer:t,size:r,count:n}=J3t(e);return{value:t,size:r,byteOffset:0,count:n,type:d8(r),componentType:Ug(t)}}function J3t(e){let t=e,r=1,n=0;return e&&e.value&&(t=e.value,r=e.size||1),t&&(ArrayBuffer.isView(t)||(t=Y3t(t,Float32Array)),n=t.length/r),{buffer:t,size:r,count:n}}function Y3t(e,t,r=!1){return e?Array.isArray(e)?new t(e):r&&!(e instanceof t)?new t(e):e:null}var fp="KHR_draco_mesh_compression",X3t=fp;function Q3t(e,t,r){let n=new br(e);for(let i of Abe(n))n.getObjectExtension(i,fp)}async function Z3t(e,t,r){var a;if(!((a=t==null?void 0:t.gltf)!=null&&a.decompressMeshes))return;let n=new br(e),i=[];for(let o of Abe(n))n.getObjectExtension(o,fp)&&i.push(t6t(n,o,t,r));await Promise.all(i),n.removeExtension(fp)}function e6t(e,t={}){let r=new br(e);for(let n of r.json.meshes||[])r6t(n,t),r.addRequiredExtension(fp)}async function t6t(e,t,r,n){let i=e.getObjectExtension(t,fp);if(!i)return;let a=e.getTypedArrayForBufferView(i.bufferView),o=md(a.buffer,a.byteOffset),s={...r};delete s["3d-tiles"];let u=await ho(o,Dg,s,n),c=Ebe(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=zL(u.indices)),e.removeObjectExtension(t,fp),n6t(t)}function r6t(e,t,r=4,n,i){var l;if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let a=n.DracoWriter.encodeSync({attributes:e}),o=(l=i==null?void 0:i.parseSync)==null?void 0:l.call(i,{attributes:e}),s=n._addFauxAttributes(o.attributes),u=n.addBufferView(a);return{primitives:[{attributes:s,mode:r,extensions:{[fp]:{bufferView:u,attributes:s}}}]}}function n6t(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*Abe(e){for(let t of e.json.meshes||[])for(let r of t.primitives)yield r}var WL={};ui(WL,{decode:()=>s6t,name:()=>i6t});var P8="KHR_texture_transform",i6t=P8,B8=new ce,a6t=new Sr,o6t=new Sr;async function s6t(e,t){var a;if(!new br(e).hasExtension(P8)||!((a=t.gltf)!=null&&a.loadBuffers))return;let i=e.json.materials||[];for(let o=0;o<i.length;o++)u6t(o,e)}function u6t(e,t){var a,o,s,u;let r=(a=t.json.materials)==null?void 0:a[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],i=[];for(let c of n)c&&((u=c==null?void 0:c.extensions)!=null&&u[P8])&&c6t(t,e,c,i)}function c6t(e,t,r,n){let i=l6t(r,n);if(!i)return;let a=e.json.meshes||[];for(let o of a)for(let s of o.primitives){let u=s.material;Number.isFinite(u)&&t===u&&f6t(e,s,i)}}function l6t(e,t){var o;let r=(o=e.extensions)==null?void 0:o[P8],{texCoord:n=0}=e,{texCoord:i=n}=r;if(!(t.findIndex(([s,u])=>s===n&&u===i)!==-1)){let s=h6t(r);return n!==i&&(e.texCoord=i),t.push([n,i]),{originalTexCoord:n,texCoord:i,matrix:s}}return null}function f6t(e,t,r){var s,u;let{originalTexCoord:n,texCoord:i,matrix:a}=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){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:v}=Gg(c,l),m=p8[c.componentType],b=f8[c.type],_=l.byteStride||m*b,E=new Float32Array(v);for(let T=0;T<c.count;T++){let S=new h(f,d+T*_,2);B8.set(S[0],S[1],1),B8.transformByMatrix3(a),E.set([B8[0],B8[1]],T*b)}n===i?p6t(c,l,e.buffers,E):d6t(i,c,t,e,E)}}}}function p6t(e,t,r,n){e.componentType=5126,r.push({arrayBuffer:n.buffer,byteOffset:0,byteLength:n.buffer.byteLength}),t.buffer=r.length-1,t.byteLength=n.buffer.byteLength,t.byteOffset=0,delete t.byteStride}function d6t(e,t,r,n,i){n.buffers.push({arrayBuffer:i.buffer,byteOffset:0,byteLength:i.buffer.byteLength});let a=n.json.bufferViews;if(!a)return;a.push({buffer:n.buffers.length-1,byteLength:i.buffer.byteLength,byteOffset:0});let o=n.json.accessors;o&&(o.push({bufferView:(a==null?void 0:a.length)-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),r.attributes[`TEXCOORD_${e}`]=o.length-1)}function h6t(e){let{offset:t=[0,0],rotation:r=0,scale:n=[1,1]}=e,i=new Sr().set(1,0,0,0,1,0,t[0],t[1],1),a=a6t.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),o=o6t.set(n[0],0,0,0,n[1],0,0,0,1);return i.multiplyRight(a).multiplyRight(o)}var VL={};ui(VL,{decode:()=>g6t,encode:()=>v6t,name:()=>m6t});var rh="KHR_lights_punctual",m6t=rh;async function g6t(e){let t=new br(e),{json:r}=t,n=t.getExtension(rh);n&&(t.json.lights=n.lights,t.removeExtension(rh));for(let i of r.nodes||[]){let a=t.getObjectExtension(i,rh);a&&(i.light=a.light),t.removeObjectExtension(i,rh)}}async function v6t(e){let t=new br(e),{json:r}=t;if(r.lights){let n=t.addExtension(rh);bi(!n.lights),n.lights=r.lights,delete r.lights}if(t.json.lights){for(let n of t.json.lights){let i=n.node;t.addObjectExtension(i,rh,n)}delete t.json.lights}}var $L={};ui($L,{decode:()=>b6t,encode:()=>y6t,name:()=>x6t});var dy="KHR_materials_unlit",x6t=dy;async function b6t(e){let t=new br(e),{json:r}=t;for(let n of r.materials||[])n.extensions&&n.extensions.KHR_materials_unlit&&(n.unlit=!0),t.removeObjectExtension(n,dy);t.removeExtension(dy)}function y6t(e){let t=new br(e),{json:r}=t;if(t.materials)for(let n of r.materials||[])n.unlit&&(delete n.unlit,t.addObjectExtension(n,dy,{}),t.addExtension(dy))}var KL={};ui(KL,{decode:()=>w6t,encode:()=>E6t,name:()=>_6t});var hy="KHR_techniques_webgl",_6t=hy;async function w6t(e){let t=new br(e),{json:r}=t,n=t.getExtension(hy);if(n){let i=A6t(n,t);for(let a of r.materials||[]){let o=t.getObjectExtension(a,hy);o&&(a.technique=Object.assign({},o,i[o.technique]),a.technique.values=S6t(a.technique,t)),t.removeObjectExtension(a,hy)}t.removeExtension(hy)}}async function E6t(e,t){}function A6t(e,t){let{programs:r=[],shaders:n=[],techniques:i=[]}=e,a=new TextDecoder;return n.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=a.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]}),i.forEach(o=>{o.program=r[o.program]}),i}function S6t(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 Sbe=[EL,yL,qL,NL,UL,HL,VL,$L,KL,WL,AL];function Tbe(e,t={},r){var i;let n=Sbe.filter(a=>Dbe(a.name,t));for(let a of n)(i=a.preprocess)==null||i.call(a,e,t,r)}async function Cbe(e,t={},r){var i;let n=Sbe.filter(a=>Dbe(a.name,t));for(let a of n)await((i=a.decode)==null?void 0:i.call(a,e,t,r))}function Dbe(e,t){var i;let r=((i=t==null?void 0:t.gltf)==null?void 0:i.excludeExtensions)||{};return!(e in r&&!r[e])}var JL="KHR_binary_glTF";function kbe(e){let t=new br(e),{json:r}=t;for(let n of r.images||[]){let i=t.getObjectExtension(n,JL);i&&Object.assign(n,i),t.removeObjectExtension(n,JL)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,t.removeExtension(JL)}var Fbe={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},C6t={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},YL=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),kbe(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 Fbe)this._convertTopLevelObjectToArray(t,r)}_convertTopLevelObjectToArray(t,r){let n=t[r];if(!(!n||Array.isArray(n))){t[r]=[];for(let i in n){let a=n[i];a.id=a.id||i;let o=t[r].length;t[r].push(a),this.idToIndexMap[r][i]=o}}}_convertObjectIdsToArrayIndices(t){for(let r in Fbe)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:i,material:a}=r;for(let o in n)n[o]=this._convertIdToIndex(n[o],"accessor");i&&(r.indices=this._convertIdToIndex(i,"accessor")),a&&(r.material=this._convertIdToIndex(a,"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 i in n){let a=n[i],o=this._convertIdToIndex(a,i);n[i]=o}}_convertIdToIndex(t,r){let n=C6t[r];if(n in this.idToIndexMap){let i=this.idToIndexMap[n][t];if(!Number.isFinite(i))throw new Error(`gltf v1: failed to resolve ${r} with id ${t}`);return i}return t}_updateObjects(t){for(let r of this.json.buffers)delete r.type}_updateMaterial(t){var r,n,i;for(let a of t.materials){a.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let o=((r=a.values)==null?void 0:r.tex)||((n=a.values)==null?void 0:n.texture2d_0)||((i=a.values)==null?void 0:i.diffuseTex),s=t.textures.findIndex(u=>u.id===o);s!==-1&&(a.pbrMetallicRoughness.baseColorTexture={index:s})}}};function Bbe(e,t={}){return new YL().normalize(e,t)}async function Pbe(e,t,r=0,n,i){var a,o,s;return D6t(e,t,r,n),Bbe(e,{normalize:(a=n==null?void 0:n.gltf)==null?void 0:a.normalize}),Tbe(e,n,i),(o=n==null?void 0:n.gltf)!=null&&o.loadBuffers&&e.json.buffers&&await k6t(e,n,i),(s=n==null?void 0:n.gltf)!=null&&s.loadImages&&await F6t(e,n,i),await Cbe(e,n,i),e}function D6t(e,t,r,n){if(n.uri&&(e.baseUri=n.uri),t instanceof ArrayBuffer&&!ybe(t,r,n)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=PB(t);else if(t instanceof ArrayBuffer){let o={};r=_be(o,t,r,n.glb),bi(o.type==="glTF",`Invalid GLB magic string ${o.type}`),e._glb=o,e.json=o.json}else bi(!1,"GLTF: must be ArrayBuffer or string");let i=e.json.buffers||[];if(e.buffers=new Array(i.length).fill(null),e._glb&&e._glb.header.hasBinChunk){let{binChunks:o}=e._glb;e.buffers[0]={arrayBuffer:o[0].arrayBuffer,byteOffset:o[0].byteOffset,byteLength:o[0].byteLength}}let a=e.json.images||[];e.images=new Array(a.length).fill({})}async function k6t(e,t,r){var i,a;let n=e.json.buffers||[];for(let o=0;o<n.length;++o){let s=n[o];if(s.uri){let{fetch:u}=r;bi(u);let c=ML(s.uri,t),l=await((i=r==null?void 0:r.fetch)==null?void 0:i.call(r,c)),f=await((a=l==null?void 0:l.arrayBuffer)==null?void 0:a.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 F6t(e,t,r){let n=B6t(e),i=e.json.images||[],a=[];for(let o of n)a.push(P6t(e,i[o],o,t,r));return await Promise.all(a)}function B6t(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,i){let a;if(t.uri&&!t.hasOwnProperty("bufferView")){let s=ML(t.uri,n),{fetch:u}=i;a=await(await u(s)).arrayBuffer(),t.bufferView={data:a}}if(Number.isFinite(t.bufferView)){let s=qxe(e.json,e.buffers,t.bufferView);a=md(s.buffer,s.byteOffset,s.byteLength)}bi(a,"glTF image has no data");let o=await ho(a,[Ng,th],{...n,mimeType:t.mimeType,basis:n.basis||{format:Kg()}},i);o&&o[0]&&(o={compressed:!0,mipmaps:!1,width:o[0].width,height:o[0].height,data:o[0]}),e.images=e.images||[],e.images[r]=o}var ml={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:b8,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:O6t,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function O6t(e,t={},r){t={...ml.options,...t},t.gltf={...ml.options.gltf,...t.gltf};let{byteOffset:n=0}=t;return await Pbe({},e,n,t,r)}var I6t=1179937895,R6t=1313821514,j6t=5130562,uc=!0;function Obe(e,t,r=0,n={}){let{magic:i=I6t,version:a=2,json:o={},binary:s}=e,u=r;t&&(t.setUint32(r+0,i,uc),t.setUint32(r+4,a,uc),t.setUint32(r+8,0,uc));let c=r+8;r+=12;let l=r;t&&(t.setUint32(r+0,0,uc),t.setUint32(r+4,R6t,uc)),r+=8;let f=JSON.stringify(o);if(r=G0(t,r,f,4),t){let p=r-l-8;t.setUint32(l+0,p,uc)}if(s){let p=r;if(t&&(t.setUint32(r+0,0,uc),t.setUint32(r+4,j6t,uc)),r+=8,r=cE(t,r,s,4),t){let d=r-p-8;t.setUint32(p+0,d,uc)}}if(t){let p=r-u;t.setUint32(c,p,uc)}return r}function XL(e,t,r,n){return M6t(e),Obe(e,t,r,n)}function M6t(e,{firstBuffer:t=0}={}){if(e.buffers&&e.buffers.length>t)throw new Error("encodeGLTF: multiple buffers not yet implemented")}var QL={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:b8,extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,options:{gltf:{}},encode:async(e,t={})=>Ibe(e,t),encodeSync:Ibe};function Ibe(e,t={}){let{byteOffset:r=0}=t,n=XL(e,null,r,t),i=new ArrayBuffer(n),a=new DataView(i);return XL(e,a,r,t),i}var L6t={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},q6t={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},ts={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},N6t={magFilter:ts.TEXTURE_MAG_FILTER,minFilter:ts.TEXTURE_MIN_FILTER,wrapS:ts.TEXTURE_WRAP_S,wrapT:ts.TEXTURE_WRAP_T},U6t={[ts.TEXTURE_MAG_FILTER]:ts.LINEAR,[ts.TEXTURE_MIN_FILTER]:ts.NEAREST_MIPMAP_LINEAR,[ts.TEXTURE_WRAP_S]:ts.REPEAT,[ts.TEXTURE_WRAP_T]:ts.REPEAT};function G6t(){return{id:"default-sampler",parameters:U6t}}function z6t(e){return q6t[e]}function H6t(e){return L6t[e]}var ZL=class{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(t,r={}){let{json:n,buffers:i=[],images:a=[]}=t,{baseUri:o=""}=t;return bi(n),this.baseUri=o,this.buffers=i,this.images=a,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((i,a)=>this._resolveBufferView(i,a))),t.images&&(n.images=t.images.map((i,a)=>this._resolveImage(i,a))),t.samplers&&(n.samplers=t.samplers.map((i,a)=>this._resolveSampler(i,a))),t.textures&&(n.textures=t.textures.map((i,a)=>this._resolveTexture(i,a))),t.accessors&&(n.accessors=t.accessors.map((i,a)=>this._resolveAccessor(i,a))),t.materials&&(n.materials=t.materials.map((i,a)=>this._resolveMaterial(i,a))),t.meshes&&(n.meshes=t.meshes.map((i,a)=>this._resolveMesh(i,a))),t.nodes&&(n.nodes=t.nodes.map((i,a)=>this._resolveNode(i,a)),n.nodes=n.nodes.map((i,a)=>this._resolveNodeChildren(i))),t.skins&&(n.skins=t.skins.map((i,a)=>this._resolveSkin(i,a))),t.scenes&&(n.scenes=t.scenes.map((i,a)=>this._resolveScene(i,a))),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((i,a)=>{let o=this.getMesh(a);return i.id=o.id,i.primitives=i.primitives.concat(o.primitives),i},{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(i=>{let a={...i,attributes:{},indices:void 0,material:void 0},o=i.attributes;for(let s in o)a.attributes[s]=this.getAccessor(o[s]);return i.indices!==void 0&&(a.indices=this.getAccessor(i.indices)),i.material!==void 0&&(a.material=this.getMaterial(i.material)),a})),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 i=n.pbrMetallicRoughness;i.baseColorTexture&&(i.baseColorTexture={...i.baseColorTexture},i.baseColorTexture.texture=this.getTexture(i.baseColorTexture.index)),i.metallicRoughnessTexture&&(i.metallicRoughnessTexture={...i.metallicRoughnessTexture},i.metallicRoughnessTexture.texture=this.getTexture(i.metallicRoughnessTexture.index))}return n}_resolveAccessor(t,r){let n=z6t(t.componentType),i=H6t(t.type),a=n*i,o={...t,id:t.id||`accessor-${r}`,bytesPerComponent:n,components:i,bytesPerElement:a,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}=Gg(o,o.bufferView),l=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+s.byteOffset,f=s.arrayBuffer.slice(l,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,i,a){let o=new Uint8Array(a*i);for(let s=0;s<a;s++){let u=r+s*n;o.set(new Uint8Array(t.arrayBuffer.slice(u,u+i)),s*i)}return o.buffer}_resolveTexture(t,r){return{...t,id:t.id||`texture-${r}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):G6t(),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 i in n){let a=this._enumSamplerParameter(i);a!==void 0&&(n.parameters[a]=n[i])}return n}_enumSamplerParameter(t){return N6t[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},i=this.images[r];return i&&(n.image=i),n}_resolveBufferView(t,r){let n=t.buffer,i=this.buffers[n].arrayBuffer,a=this.buffers[n].byteOffset||0;return t.byteOffset&&(a+=t.byteOffset),{id:`bufferView-${r}`,...t,buffer:this.buffers[n],data:new Uint8Array(i,a,t.byteLength)}}_resolveCamera(t,r){let n={...t,id:t.id||`camera-${r}`};return n.perspective,n.orthographic,n}};function my(e,t){return new ZL().postProcess(e,t)}var O8={URI:0,EMBEDDED:1};function I8(e,t,r,n){e.rotateYtoZ=!0;let i=(e.byteOffset||0)+(e.byteLength||0)-r;if(i===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=md(t,r,i),e.gltfByteOffset=0,e.gltfByteLength=i,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 R8(e,t,r,n){let i=(r==null?void 0:r["3d-tiles"])||{};if(W6t(e,t,r),i.loadGLTF){if(!n)return;if(e.gltfUrl){let{fetch:a}=n,o=await a(e.gltfUrl,r);e.gltfArrayBuffer=await o.arrayBuffer(),e.gltfByteOffset=0}if(e.gltfArrayBuffer){let a=await ho(e.gltfArrayBuffer,ml,r,n);e.gltf=my(a),e.gpuMemoryUsageInBytes=oy(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function W6t(e,t,r){switch(t){case O8.URI:if(e.gltfArrayBuffer){let n=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),a=new TextDecoder().decode(n);e.gltfUrl=a.replace(/[\s\0]+$/,"")}delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case O8.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function Rbe(e,t,r,n,i){var o;r=V6t(e,t,r,n,i),await R8(e,O8.EMBEDDED,n,i);let a=(o=e==null?void 0:e.gltf)==null?void 0:o.extensions;return a&&a.CESIUM_RTC&&(e.rtcCenter=a.CESIUM_RTC.center),r}function V6t(e,t,r,n,i){r=lp(e,t,r),r=Mg(e,t,r),r=Lg(e,t,r,n),r=I8(e,t,r,n);let a=new dl(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=a.getGlobalProperty("RTC_CENTER",Tt.FLOAT,3),r}var gl=6356752314245179e-9,$6t={radii:[6378137,6378137,gl],radiiSquared:[6378137*6378137,6378137*6378137,gl*gl],oneOverRadii:[1/6378137,1/6378137,1/gl],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(gl*gl)],maximumRadius:Math.max(6378137,6378137,gl),centerToleranceSquared:.1};function j8(e){return e}var qpr=new _e;function K6t(e,t=[],r=j8){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 jbe(e,t=[]){return K6t(e,t,yn._cartographicRadians?j8:PM)}function J6t(e,t,r=j8){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 Mbe(e,t){return J6t(e,t,yn._cartographicRadians?j8:OM)}var Lbe=1e-14,Y6t=new _e,qbe={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"}},e7={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},gy={east:new _e,north:new _e,up:new _e,west:new _e,south:new _e,down:new _e},X6t=new _e,Q6t=new _e,Z6t=new _e;function t7(e,t,r,n,i,a){let o=qbe[t]&&qbe[t][r];Ri(o&&(!n||n===o));let s,u,c,l=Y6t.copy(i);if(_o(l.x,0,Lbe)&&_o(l.y,0,Lbe)){let p=Math.sign(l.z);s=X6t.fromArray(e7[t]),t!=="east"&&t!=="west"&&s.scale(p),u=Q6t.fromArray(e7[r]),r!=="east"&&r!=="west"&&u.scale(p),c=Z6t.fromArray(e7[n]),n!=="east"&&n!=="west"&&c.scale(p)}else{let{up:p,east:d,north:h}=gy;d.set(-l.y,l.x,0).normalize(),e.geodeticSurfaceNormal(l,p),h.copy(p).cross(d);let{down:v,west:m,south:b}=gy;v.copy(p).scale(-1),m.copy(d).scale(-1),b.copy(h).scale(-1),s=gy[t],u=gy[r],c=gy[n]}return a[0]=s.x,a[1]=s.y,a[2]=s.z,a[3]=0,a[4]=u.x,a[5]=u.y,a[6]=u.z,a[7]=0,a[8]=c.x,a[9]=c.y,a[10]=c.z,a[11]=0,a[12]=l.x,a[13]=l.y,a[14]=l.z,a[15]=1,a}var Xg=new _e,eTt=new _e,tTt=new _e;function Nbe(e,t,r=[]){let{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:a}=t;Xg.from(e);let o=Xg.x,s=Xg.y,u=Xg.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,v=p+d+h,m=Math.sqrt(1/v);if(!Number.isFinite(m))return;let b=eTt;if(b.copy(e).scale(m),v<a)return b.to(r);let _=i.x,E=i.y,T=i.z,S=tTt;S.set(b.x*_*2,b.y*E*2,b.z*T*2);let D=(1-m)*Xg.len()/(.5*S.len()),I=0,L,F,P,M;do{D-=I,L=1/(1+D*_),F=1/(1+D*E),P=1/(1+D*T);let U=L*L,W=F*F,V=P*P,Z=U*L,ee=W*F,ge=V*P;M=p*U+d*W+h*V-1;let he=-2*(p*Z*_+d*ee*E+h*ge*T);I=M/he}while(Math.abs(M)>ic.EPSILON12);return Xg.scale([L,F,P]).to(r)}var M8=new _e,Ube=new _e,iTt=new _e,Vs=new _e,aTt=new _e,L8=new _e,vl=class{constructor(t=0,r=0,n=0){this.centerToleranceSquared=ic.EPSILON1,Ri(t>=0),Ri(r>=0),Ri(n>=0),this.radii=new _e(t,r,n),this.radiiSquared=new _e(t*t,r*r,n*n),this.radiiToTheFourth=new _e(t*t*t*t,r*r*r*r,n*n*n*n),this.oneOverRadii=new _e(t===0?0:1/t,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new _e(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=Ube,i=iTt,[,,a]=t;this.geodeticSurfaceNormalCartographic(t,n),i.copy(this.radiiSquared).scale(n);let o=Math.sqrt(n.dot(i));return i.scale(1/o),n.scale(a),i.add(n),i.to(r)}cartesianToCartographic(t,r=[0,0,0]){L8.from(t);let n=this.scaleToGeodeticSurface(L8,Vs);if(!n)return;let i=this.geodeticSurfaceNormal(n,Ube),a=aTt;a.copy(L8).subtract(n);let o=Math.atan2(i.y,i.x),s=Math.asin(i.z),u=Math.sign(Pg.dot(a,L8))*Pg.length(a);return Mbe([o,s,u],r)}eastNorthUpToFixedFrame(t,r=new Qo){return t7(this,"east","north","up",t,r)}localFrameToFixedFrame(t,r,n,i,a=new Qo){return t7(this,t,r,n,i,a)}geocentricSurfaceNormal(t,r=[0,0,0]){return M8.from(t).normalize().to(r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=jbe(t),i=n[0],a=n[1],o=Math.cos(a);return M8.set(o*Math.cos(i),o*Math.sin(i),Math.sin(a)).normalize(),M8.to(r)}geodeticSurfaceNormal(t,r=[0,0,0]){return M8.from(t).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(t,r){return Nbe(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){Vs.from(t);let n=Vs.x,i=Vs.y,a=Vs.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(n*n*o.x+i*i*o.y+a*a*o.z);return Vs.multiplyScalar(s).to(r)}transformPositionToScaledSpace(t,r=[0,0,0]){return Vs.from(t).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(t,r=[0,0,0]){return Vs.from(t).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){Ri(_o(this.radii.x,this.radii.y,ic.EPSILON15)),Ri(this.radii.z>0),Vs.from(t);let i=Vs.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(i)>=this.radii.z-r))return Vs.set(0,0,i).to(n)}};vl.WGS84=new vl(6378137,6378137,gl);async function Gbe(e,t,r,n,i){return r=oTt(e,t,r,n,i),await R8(e,e.gltfFormat||0,n,i),r}function oTt(e,t,r,n,i){var c;if(r=lp(e,t,r),e.version!==1)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);r=Mg(e,t,r);let a=new DataView(t);if(e.gltfFormat=a.getUint32(r,!0),r+=4,r=Lg(e,t,r,n),r=I8(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 dl(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",Tt.FLOAT,3);let u=new Zd(e.batchTableJson,e.batchTableBinary,s);return sTt(e,o,u,s),r}function sTt(e,t,r,n){let i=new Array(n),a=new _e,o=new _e,s=new _e,u=new _e,c=new pn,l=new cp,f=new _e,p={},d=new Qo,h=[],v=[],m=[],b=[];for(let _=0;_<n;_++){let E;if(t.hasProperty("POSITION"))E=t.getProperty("POSITION",Tt.FLOAT,3,_,a);else if(t.hasProperty("POSITION_QUANTIZED")){E=t.getProperty("POSITION_QUANTIZED",Tt.UNSIGNED_SHORT,3,_,a);let P=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Tt.FLOAT,3);if(!P)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let M=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Tt.FLOAT,3);if(!M)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let U=65535;for(let W=0;W<3;W++)E[W]=E[W]/U*M[W]+P[W]}if(!E)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");a.copy(E),p.translation=a,e.normalUp=t.getProperty("NORMAL_UP",Tt.FLOAT,3,_,h),e.normalRight=t.getProperty("NORMAL_RIGHT",Tt.FLOAT,3,_,v);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",Tt.UNSIGNED_SHORT,2,_,h),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",Tt.UNSIGNED_SHORT,2,_,v),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?(vl.WGS84.eastNorthUpToFixedFrame(a,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 S=t.getProperty("SCALE",Tt.FLOAT,1,_,m);Number.isFinite(S)&&f.multiplyByScalar(S);let D=t.getProperty("SCALE_NON_UNIFORM",Tt.FLOAT,3,_,h);D&&f.scale(D),p.scale=f;let I=t.getProperty("BATCH_ID",Tt.UNSIGNED_SHORT,1,_,b);I===void 0&&(I=_);let L=new Qo().fromQuaternion(p.rotation);d.identity(),d.translate(p.translation),d.multiplyRight(L),d.scale(p.scale);let F=d.clone();i[_]={modelMatrix:F,batchId:I}}e.instances=i}async function zbe(e,t,r,n,i,a){r=lp(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 a(t,r,n,i,s)}return r}async function Hbe(e,t,r,n){var i,a;if(e.rotateYtoZ=!0,e.gltfUpAxis=(i=r==null?void 0:r["3d-tiles"])!=null&&i.assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",(a=r==null?void 0:r["3d-tiles"])!=null&&a.loadGLTF){if(!n)return t.byteLength;let o=await ho(t,ml,r,n);e.gltf=my(o),e.gpuMemoryUsageInBytes=oy(e.gltf)}else e.gltfArrayBuffer=t;return t.byteLength}async function r7(e,t=0,r,n,i={shape:"tile3d"}){switch(i.byteOffset=t,i.type=nve(e,t),i.type){case Xo.COMPOSITE:return await zbe(i,e,t,r,n,r7);case Xo.BATCHED_3D_MODEL:return await Rbe(i,e,t,r,n);case Xo.GLTF:return await Hbe(i,e,r,n);case Xo.INSTANCED_3D_MODEL:return await Gbe(i,e,t,r,n);case Xo.POINT_CLOUD:return await Exe(i,e,t,r,n);default:throw new Error(`3DTileLoader: unknown type ${i.type}`)}}async function n7(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 a=Wbe(e.slice(8,16)),o=new Uint8Array(e,24,a),u=new TextDecoder("utf8").decode(o),c=JSON.parse(u),l=Wbe(e.slice(16,24)),f=new ArrayBuffer(0);if(l&&(f=e.slice(24+a)),await q8(c,c.tileAvailability,f,r),Array.isArray(c.contentAvailability))for(let p of c.contentAvailability)await q8(c,p,f,r);else await q8(c,c.contentAvailability,f,r);return await q8(c,c.childSubtreeAvailability,f,r),c}async function q8(e,t,r,n){let i=Number.isFinite(t.bitstream)?t.bitstream:t.bufferView;if(typeof i!="number")return;let a=e.bufferViews[i],o=e.buffers[a.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,a.byteOffset,a.byteLength);return}let s=e.buffers.slice(0,a.buffer).reduce((u,c)=>u+c.byteLength,0);t.explicitBitstream=new Uint8Array(r.slice(s,s+o.byteLength),a.byteOffset,a.byteLength)}function Wbe(e){let t=new DataView(e),r=t.getUint32(0,!0),n=t.getUint32(4,!0);return r+2**32*n}var N8={dataType:null,batchType:null,id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Cg,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:n7,options:{}};function i7(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function $s(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||i7()}var uTt=globalThis.self||globalThis.window||globalThis.global,Qg=globalThis.window||globalThis.self||globalThis.global,cTt=globalThis.document||{},nh=globalThis.process||{},lTt=globalThis.console,Bdr=globalThis.navigator||{};var U8="4.2.0-alpha.6",Idr=$s();function fTt(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var G8=class{constructor(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=fTt(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 Vbe(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function $be(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}function z8(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));let a=e.width*r,o=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}var H8;(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"})(H8||(H8={}));var pTt=10;function Kbe(e){return typeof e!="string"?e:(e=e.toUpperCase(),H8[e]||H8.WHITE)}function Jbe(e,t,r){if(!$s&&typeof e=="string"){if(t){let n=Kbe(t);e="\x1B[".concat(n,"m").concat(e,"\x1B[39m")}if(r){let n=Kbe(r);e="\x1B[".concat(n+pTt,"m").concat(e,"\x1B[49m")}}return e}function Ybe(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let a of n){let o=i[a];typeof o=="function"&&(t.find(s=>a===s)||(i[a]=o.bind(e)))}}function Zg(e,t){if(!e)throw new Error(t||"Assertion failed")}function ih(){let e;if($s()&&Qg.performance){var t,r;e=Qg===null||Qg===void 0||(t=Qg.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in nh){var n;let i=nh===null||nh===void 0||(n=nh.hrtime)===null||n===void 0?void 0:n.call(nh);e=i[0]*1e3+i[1]/1e6}else e=Date.now();return e}var e1={debug:$s()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},dTt={enabled:!0,level:0};function rs(){}var Xbe={},Qbe={once:!0},vy=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=U8,this._startTs=ih(),this._deltaTs=ih(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new G8("__probe-".concat(this.id,"__"),dTt),this.timeStamp("".concat(this.id," started")),Ybe(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((ih()-this._startTs).toPrecision(10))}getDelta(){return Number((ih()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){Zg(t,r)}warn(t){return this._getLogFunction(0,t,e1.warn,arguments,Qbe)}error(t){return this._getLogFunction(0,t,e1.error,arguments)}deprecated(t,r){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(t,r){return this.error("`".concat(t,"` has been removed. Use `").concat(r,"` instead"))}probe(t,r){return this._getLogFunction(t,r,e1.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,e1.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,e1.debug||e1.info,arguments,Qbe)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||rs,n&&[n],{tag:vTt(r)}):rs}image(t){let{logLevel:r,priority:n,image:i,message:a="",scale:o=1}=t;return this._shouldLog(r||n)?$s()?gTt({image:i,message:a,scale:o}):mTt({image:i,message:a,scale:o}):rs}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||rs)}group(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},i=Zbe({logLevel:t,message:r,opts:n}),{collapsed:a}=n;return i.method=(a?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||rs)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=eye(t)}_getLogFunction(t,r,n,i,a){if(this._shouldLog(t)){a=Zbe({logLevel:t,message:r,args:i,opts:a}),n=n||a.method,Zg(n),a.total=this.getTotal(),a.delta=this.getDelta(),this._deltaTs=ih();let o=a.tag||a.message;if(a.once&&o)if(!Xbe[o])Xbe[o]=ih();else return rs;return r=hTt(this.id,a.message,a),n.bind(console,r,...a.args)}return rs}};vy.VERSION=U8;function eye(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 Zg(Number.isFinite(t)&&t>=0),t}function Zbe(e){let{logLevel:t,message:r}=e;e.logLevel=eye(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 i=typeof e.message;return Zg(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}function hTt(e,t,r){if(typeof t=="string"){let n=r.time?$be(Vbe(r.total)):"";t=r.time?"".concat(e,": ").concat(n," ").concat(t):"".concat(e,": ").concat(t),t=Jbe(t,r.color,r.background)}return t}function mTt(e){let{image:t,message:r="",scale:n=1}=e;return console.warn("removed"),rs}function gTt(e){let{image:t,message:r="",scale:n=1}=e;if(typeof t=="string"){let a=new Image;return a.onload=()=>{let o=z8(a,r,n);console.log(...o)},a.src=t,rs}let i=t.nodeName||"";if(i.toLowerCase()==="img")return console.log(...z8(t,r,n)),rs;if(i.toLowerCase()==="canvas"){let a=new Image;return a.onload=()=>console.log(...z8(a,r,n)),a.src=t.toDataURL(),rs}return rs}function vTt(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var a7=new vy({id:"@probe.gl/log"});var ns=null;try{ns=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 sn(e,t,r){this.low=e|0,this.high=t|0,this.unsigned=!!r}sn.prototype.__isLong__;Object.defineProperty(sn.prototype,"__isLong__",{value:!0});function _a(e){return(e&&e.__isLong__)===!0}function tye(e){var t=Math.clz32(e&-e);return e?31-t:t}sn.isLong=_a;var rye={},nye={};function ah(e,t){var r,n,i;return t?(e>>>=0,(i=0<=e&&e<256)&&(n=nye[e],n)?n:(r=Cr(e,0,!0),i&&(nye[e]=r),r)):(e|=0,(i=-128<=e&&e<128)&&(n=rye[e],n)?n:(r=Cr(e,e<0?-1:0,!1),i&&(rye[e]=r),r))}sn.fromInt=ah;function is(e,t){if(isNaN(e))return t?xl:Ks;if(t){if(e<0)return xl;if(e>=sye)return lye}else{if(e<=-aye)return to;if(e+1>=aye)return cye}return e<0?is(-e,t).neg():Cr(e%r1|0,e/r1|0,t)}sn.fromNumber=is;function Cr(e,t,r){return new sn(e,t,r)}sn.fromBits=Cr;var W8=Math.pow;function s7(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?xl:Ks;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 s7(e.substring(1),t,r).neg();for(var i=is(W8(r,8)),a=Ks,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=is(W8(r,s));a=a.mul(c).add(is(u))}else a=a.mul(i),a=a.add(is(u))}return a.unsigned=t,a}sn.fromString=s7;function Js(e,t){return typeof e=="number"?is(e,t):typeof e=="string"?s7(e,t):Cr(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}sn.fromValue=Js;var iye=1<<16,xTt=1<<24,r1=iye*iye,sye=r1*r1,aye=sye/2,oye=ah(xTt),Ks=ah(0);sn.ZERO=Ks;var xl=ah(0,!0);sn.UZERO=xl;var t1=ah(1);sn.ONE=t1;var uye=ah(1,!0);sn.UONE=uye;var o7=ah(-1);sn.NEG_ONE=o7;var cye=Cr(-1,2147483647,!1);sn.MAX_VALUE=cye;var lye=Cr(-1,-1,!0);sn.MAX_UNSIGNED_VALUE=lye;var to=Cr(0,-2147483648,!1);sn.MIN_VALUE=to;var Re=sn.prototype;Re.toInt=function(){return this.unsigned?this.low>>>0:this.low};Re.toNumber=function(){return this.unsigned?(this.high>>>0)*r1+(this.low>>>0):this.high*r1+(this.low>>>0)};Re.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(to)){var r=is(t),n=this.div(r),i=n.mul(r).sub(this);return n.toString(t)+i.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var a=is(W8(t,6),this.unsigned),o=this,s="";;){var u=o.div(a),c=o.sub(u.mul(a)).toInt()>>>0,l=c.toString(t);if(o=u,o.isZero())return l+s;for(;l.length<6;)l="0"+l;s=""+l+s}};Re.getHighBits=function(){return this.high};Re.getHighBitsUnsigned=function(){return this.high>>>0};Re.getLowBits=function(){return this.low};Re.getLowBitsUnsigned=function(){return this.low>>>0};Re.getNumBitsAbs=function(){if(this.isNegative())return this.eq(to)?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};Re.isZero=function(){return this.high===0&&this.low===0};Re.eqz=Re.isZero;Re.isNegative=function(){return!this.unsigned&&this.high<0};Re.isPositive=function(){return this.unsigned||this.high>=0};Re.isOdd=function(){return(this.low&1)===1};Re.isEven=function(){return(this.low&1)===0};Re.equals=function(t){return _a(t)||(t=Js(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};Re.eq=Re.equals;Re.notEquals=function(t){return!this.eq(t)};Re.neq=Re.notEquals;Re.ne=Re.notEquals;Re.lessThan=function(t){return this.comp(t)<0};Re.lt=Re.lessThan;Re.lessThanOrEqual=function(t){return this.comp(t)<=0};Re.lte=Re.lessThanOrEqual;Re.le=Re.lessThanOrEqual;Re.greaterThan=function(t){return this.comp(t)>0};Re.gt=Re.greaterThan;Re.greaterThanOrEqual=function(t){return this.comp(t)>=0};Re.gte=Re.greaterThanOrEqual;Re.ge=Re.greaterThanOrEqual;Re.compare=function(t){if(_a(t)||(t=Js(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};Re.comp=Re.compare;Re.negate=function(){return!this.unsigned&&this.eq(to)?to:this.not().add(t1)};Re.neg=Re.negate;Re.add=function(t){_a(t)||(t=Js(t));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,a=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+=a+c,p+=d>>>16,d&=65535,p+=i+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)};Re.subtract=function(t){return _a(t)||(t=Js(t)),this.add(t.neg())};Re.sub=Re.subtract;Re.multiply=function(t){if(this.isZero())return this;if(_a(t)||(t=Js(t)),ns){var r=ns.mul(this.low,this.high,t.low,t.high);return Cr(r,ns.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?xl:Ks;if(this.eq(to))return t.isOdd()?to:Ks;if(t.eq(to))return this.isOdd()?to:Ks;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(oye)&&t.lt(oye))return is(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,a=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+=a*l,p+=d>>>16,d&=65535,d+=o*c,p+=d>>>16,d&=65535,p+=i*l,f+=p>>>16,p&=65535,p+=a*c,f+=p>>>16,p&=65535,p+=o*u,f+=p>>>16,p&=65535,f+=n*l+i*c+a*u+o*s,f&=65535,Cr(d<<16|h,f<<16|p,this.unsigned)};Re.mul=Re.multiply;Re.divide=function(t){if(_a(t)||(t=Js(t)),t.isZero())throw Error("division by zero");if(ns){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?ns.div_u:ns.div_s)(this.low,this.high,t.low,t.high);return Cr(r,ns.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?xl:Ks;var n,i,a;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return xl;if(t.gt(this.shru(1)))return uye;a=xl}else{if(this.eq(to)){if(t.eq(t1)||t.eq(o7))return to;if(t.eq(to))return t1;var o=this.shr(1);return n=o.div(t).shl(1),n.eq(Ks)?t.isNegative()?t1:o7:(i=this.sub(t.mul(n)),a=n.add(i.div(t)),a)}else if(t.eq(to))return this.unsigned?xl:Ks;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();a=Ks}for(i=this;i.gte(t);){n=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var s=Math.ceil(Math.log(n)/Math.LN2),u=s<=48?1:W8(2,s-48),c=is(n),l=c.mul(t);l.isNegative()||l.gt(i);)n-=u,c=is(n,this.unsigned),l=c.mul(t);c.isZero()&&(c=t1),a=a.add(c),i=i.sub(l)}return a};Re.div=Re.divide;Re.modulo=function(t){if(_a(t)||(t=Js(t)),ns){var r=(this.unsigned?ns.rem_u:ns.rem_s)(this.low,this.high,t.low,t.high);return Cr(r,ns.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};Re.mod=Re.modulo;Re.rem=Re.modulo;Re.not=function(){return Cr(~this.low,~this.high,this.unsigned)};Re.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};Re.clz=Re.countLeadingZeros;Re.countTrailingZeros=function(){return this.low?tye(this.low):tye(this.high)+32};Re.ctz=Re.countTrailingZeros;Re.and=function(t){return _a(t)||(t=Js(t)),Cr(this.low&t.low,this.high&t.high,this.unsigned)};Re.or=function(t){return _a(t)||(t=Js(t)),Cr(this.low|t.low,this.high|t.high,this.unsigned)};Re.xor=function(t){return _a(t)||(t=Js(t)),Cr(this.low^t.low,this.high^t.high,this.unsigned)};Re.shiftLeft=function(t){return _a(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)};Re.shl=Re.shiftLeft;Re.shiftRight=function(t){return _a(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)};Re.shr=Re.shiftRight;Re.shiftRightUnsigned=function(t){return _a(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)};Re.shru=Re.shiftRightUnsigned;Re.shr_u=Re.shiftRightUnsigned;Re.rotateLeft=function(t){var r;return _a(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))};Re.rotl=Re.rotateLeft;Re.rotateRight=function(t){var r;return _a(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))};Re.rotr=Re.rotateRight;Re.toSigned=function(){return this.unsigned?Cr(this.low,this.high,!1):this};Re.toUnsigned=function(){return this.unsigned?this:Cr(this.low,this.high,!0)};Re.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};Re.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]};Re.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]};sn.fromBytes=function(t,r,n){return n?sn.fromBytesLE(t,r):sn.fromBytesBE(t,r)};sn.fromBytesLE=function(t,r){return new sn(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)};sn.fromBytesBE=function(t,r){return new sn(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)};var n1=sn;var bTt=16;function xy(e){e==="X"&&(e="");let t=e.padEnd(bTt,"0");return n1.fromString(t,!0,16)}function u7(e){if(e.isZero())return"X";let t=e.countTrailingZeros(),r=t%4;t=(t-r)/4;let n=t;t*=4;let a=e.shiftRightUnsigned(t).toString(16).replace(/0+$/,"");return Array(17-n-a.length).join("0")+a}function c7(e,t){let r=yTt(e).shiftRightUnsigned(2);return e.add(n1.fromNumber(2*t+1-4).multiply(r))}function yTt(e){return e.and(e.not().add(1))}var _Tt=3,wTt=30,ETt=2*wTt+1,fye=180/Math.PI;function dye(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],i=n.length,a=0,o=[0,0];for(let s=i-1;s>=0;s--){a=i-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,a-1);ATt(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:a}}function hye(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<_Tt+ETt;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),i=t.substring(3,r),a=i.length/2,o=n1.fromString(n,!0,2).toString(10),s="";if(a!==0)for(s=n1.fromString(i,!0,2).toString(4);s.length<a;)s="0"+s;return`${o}/${s}`}function l7(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function pye(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function f7(e){return[pye(e[0]),pye(e[1])]}function p7(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 d7([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*fye,n*fye]}function ATt(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let i=t[0];t[0]=t[1],t[1]=i}}function mye(e){let t=l7(e.ij,e.level,[.5,.5]),r=f7(t),n=p7(e.face,r);return d7(n)}var STt=100;function h7(e){let{face:t,ij:r,level:n}=e,i=[[0,0],[0,1],[1,1],[1,0],[0,0]],a=Math.max(1,Math.ceil(STt*Math.pow(2,-n))),o=new Float64Array(4*a*2+2),s=0,u=0;for(let c=0;c<4;c++){let l=i[c].slice(0),f=i[c+1],p=(f[0]-l[0])/a,d=(f[1]-l[1])/a;for(let h=0;h<a;h++){l[0]+=p,l[1]+=d;let v=l7(r,n,l),m=f7(v),b=p7(t,m),_=d7(b);Math.abs(_[1])>89.999&&(_[0]=u);let E=_[0]-u;_[0]+=E>180?-360:E<-180?360:0,o[s++]=_[0],o[s++]=_[1],u=_[0]}}return o[s++]=o[0],o[s++]=o[1],o}function i1(e){let t=TTt(e);return dye(t)}function TTt(e){if(e.indexOf("/")>0)return e;let t=xy(e);return hye(t)}function m7(e){let t=i1(e);return mye(t)}function vye(e){let t;if(e.face===2||e.face===5){let r=null,n=0;for(let i=0;i<4;i++){let a=`${e.face}/${i}`,o=i1(a),s=h7(o);(typeof r>"u"||r===null)&&(r=new Float64Array(4*s.length)),r.set(s,n),n+=s.length}t=gye(r)}else{let r=h7(e);t=gye(r)}return t}function gye(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,i)=>n-i),r.sort((n,i)=>n-i),{west:t[0],east:t[t.length-1],north:r[r.length-1],south:r[0]}}function g7(e,t){let r=(t==null?void 0:t.minimumHeight)||0,n=(t==null?void 0:t.maximumHeight)||0,i=i1(e),a=vye(i),o=a.west,s=a.south,u=a.east,c=a.north,l=[];return l.push(new _e(o,c,r)),l.push(new _e(u,c,r)),l.push(new _e(u,s,r)),l.push(new _e(o,s,r)),l.push(new _e(o,c,n)),l.push(new _e(u,c,n)),l.push(new _e(u,s,n)),l.push(new _e(o,s,n)),l}var ji={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var Ihr=new _e,Rhr=new _e;var by=new _e,xye=new _e,pp=class{constructor(t=[0,0,0],r=0){this.radius=-0,this.center=new _e,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=by.from(r),this.center=new _e().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 pp(this.center,this.radius)}union(t){let r=this.center,n=this.radius,i=t.center,a=t.radius,o=by.copy(i).subtract(r),s=o.magnitude();if(n>=s+a)return this.clone();if(a>=s+n)return t.clone();let u=(n+s+a)*.5;return xye.copy(o).scale((-n+u)/s).add(r),this.center.copy(xye),this.radius=u,this}expand(t){let n=by.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=i8.getScaling(by,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=by.from(t).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(t){let r=this.center,n=this.radius,a=t.normal.dot(r)+t.distance;return a<-n?ji.OUTSIDE:a<n?ji.INTERSECTING:ji.INSIDE}};var CTt=new _e,DTt=new _e,V8=new _e,$8=new _e,K8=new _e,kTt=new _e,FTt=new _e,bl={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},oh=class{constructor(t=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){this.center=new _e().from(t),this.halfAxes=new pn(r)}get halfSize(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new _e(t).len(),new _e(r).len(),new _e(n).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),i=new _e(t).normalize(),a=new _e(r).normalize(),o=new _e(n).normalize();return new cp().fromMatrix3(new pn([...i,...a,...o]))}fromCenterHalfSizeQuaternion(t,r,n){let i=new cp(n),a=new pn().fromQuaternion(i);return a[0]=a[0]*r[0],a[1]=a[1]*r[0],a[2]=a[2]*r[0],a[3]=a[3]*r[1],a[4]=a[4]*r[1],a[5]=a[5]*r[1],a[6]=a[6]*r[2],a[7]=a[7]*r[2],a[8]=a[8]*r[2],this.center=new _e().from(t),this.halfAxes=a,this}clone(){return new oh(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new pp){let r=this.halfAxes,n=r.getColumn(0,V8),i=r.getColumn(1,$8),a=r.getColumn(2,K8),o=CTt.copy(n).add(i).add(a);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let r=this.center,n=t.normal,i=this.halfAxes,a=n.x,o=n.y,s=n.z,u=Math.abs(a*i[bl.COLUMN0ROW0]+o*i[bl.COLUMN0ROW1]+s*i[bl.COLUMN0ROW2])+Math.abs(a*i[bl.COLUMN1ROW0]+o*i[bl.COLUMN1ROW1]+s*i[bl.COLUMN1ROW2])+Math.abs(a*i[bl.COLUMN2ROW0]+o*i[bl.COLUMN2ROW1]+s*i[bl.COLUMN2ROW2]),c=n.dot(r)+t.distance;return c<=-u?ji.OUTSIDE:c>=u?ji.INSIDE:ji.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=DTt.from(t).subtract(this.center),n=this.halfAxes,i=n.getColumn(0,V8),a=n.getColumn(1,$8),o=n.getColumn(2,K8),s=i.magnitude(),u=a.magnitude(),c=o.magnitude();i.normalize(),a.normalize(),o.normalize();let l=0,f;return f=Math.abs(r.dot(i))-s,f>0&&(l+=f*f),f=Math.abs(r.dot(a))-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 i=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=this.center,s=this.halfAxes,u=s.getColumn(0,V8),c=s.getColumn(1,$8),l=s.getColumn(2,K8),f=kTt.copy(u).add(c).add(l).add(o),p=FTt.copy(f).subtract(t),d=r.dot(p);return i=Math.min(d,i),a=Math.max(d,a),f.copy(o).add(u).add(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),f.copy(o).add(u).subtract(c).add(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),f.copy(o).add(u).subtract(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),o.copy(f).subtract(u).add(c).add(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),o.copy(f).subtract(u).add(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),o.copy(f).subtract(u).subtract(c).add(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),o.copy(f).subtract(u).subtract(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),n[0]=i,n[1]=a,n}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,V8);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,$8);n.transformAsPoint(t);let i=this.halfAxes.getColumn(2,K8);return i.transformAsPoint(t),this.halfAxes=new pn([...r,...n,...i]),this}getTransform(){throw new Error("not implemented")}};var bye=new _e,yye=new _e,yl=class{constructor(t=[0,0,1],r=0){this.normal=new _e,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return Ri(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=bye.from(t),this.normal.from(r).normalize();let n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,r,n,i){return this.normal.set(t,r,n),Ri(_o(this.normal.len(),1)),this.distance=i,this}clone(){return new yl(this.normal,this.distance)}equals(t){return _o(this.distance,t.distance)&&_o(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=yye.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=bye.from(t),i=this.getPointDistance(n),a=yye.copy(this.normal).scale(i);return n.subtract(a).to(r)}};var _ye=[new _e([1,0,0]),new _e([0,1,0]),new _e([0,0,1])],wye=new _e,BTt=new _e,as=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*_ye.length;let r=t.center,n=t.radius,i=0;for(let a of _ye){let o=this.planes[i],s=this.planes[i+1];o||(o=this.planes[i]=new yl),s||(s=this.planes[i+1]=new yl);let u=wye.copy(a).scale(-n).add(r);o.fromPointNormal(u,a);let c=wye.copy(a).scale(n).add(r),l=BTt.copy(a).negate();s.fromPointNormal(c,l),i+=2}return this}computeVisibility(t){let r=ji.INSIDE;for(let n of this.planes)switch(t.intersectPlane(n)){case ji.OUTSIDE:return ji.OUTSIDE;case ji.INTERSECTING:r=ji.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(Ri(Number.isFinite(r),"parentPlaneMask is required."),r===as.MASK_OUTSIDE||r===as.MASK_INSIDE)return r;let n=as.MASK_INSIDE,i=this.planes;for(let a=0;a<this.planes.length;++a){let o=a<31?1<<a:0;if(a<31&&!(r&o))continue;let s=i[a],u=t.intersectPlane(s);if(u===ji.OUTSIDE)return as.MASK_OUTSIDE;u===ji.INTERSECTING&&(n|=o)}return n}};as.MASK_OUTSIDE=4294967295;as.MASK_INSIDE=0;as.MASK_INDETERMINATE=2147483647;var Zhr=new _e,e0r=new _e,t0r=new _e,r0r=new _e,n0r=new _e;var c0r=new _e,l0r=new _e,f0r=new _e,p0r=new _e,d0r=new _e,h0r=new _e,m0r=new _e,g0r=new _e,v0r=new _e,x0r=new _e,b0r=new _e,y0r=new _e;var cc=new pn,OTt=new pn,ITt=new pn,J8=new pn,Eye=new pn;function b7(e,t={}){let r=ic.EPSILON20,n=10,i=0,a=0,o=OTt,s=ITt;o.identity(),s.copy(e);let u=r*RTt(s);for(;a<n&&jTt(s)>u;)MTt(s,J8),Eye.copy(J8).transpose(),s.multiplyRight(J8),s.multiplyLeft(Eye),o.multiplyRight(J8),++i>2&&(++a,i=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=s.toTarget(t.diagonal),t}function RTt(e){let t=0;for(let r=0;r<9;++r){let n=e[r];t+=n*n}return Math.sqrt(t)}var v7=[1,0,0],x7=[2,2,1];function jTt(e){let t=0;for(let r=0;r<3;++r){let n=e[cc.getElementIndex(x7[r],v7[r])];t+=2*n*n}return Math.sqrt(t)}function MTt(e,t){let r=ic.EPSILON15,n=0,i=1;for(let c=0;c<3;++c){let l=Math.abs(e[cc.getElementIndex(x7[c],v7[c])]);l>n&&(i=c,n=l)}let a=v7[i],o=x7[i],s=1,u=0;if(Math.abs(e[cc.getElementIndex(o,a)])>r){let c=e[cc.getElementIndex(o,o)],l=e[cc.getElementIndex(a,a)],f=e[cc.getElementIndex(o,a)],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 pn.IDENTITY.to(t),t[cc.getElementIndex(a,a)]=t[cc.getElementIndex(o,o)]=s,t[cc.getElementIndex(o,a)]=u,t[cc.getElementIndex(a,o)]=-u,t}var dp=new _e,qTt=new _e,NTt=new _e,UTt=new _e,GTt=new _e,zTt=new pn,HTt={diagonal:new pn,unitary:new pn};function y7(e,t=new oh){if(!e||e.length===0)return t.halfAxes=new pn([0,0,0,0,0,0,0,0,0]),t.center=new _e,t;let r=e.length,n=new _e(0,0,0);for(let F of e)n.add(F);let i=1/r;n.multiplyByScalar(i);let a=0,o=0,s=0,u=0,c=0,l=0;for(let F of e){let P=dp.copy(F).subtract(n);a+=P.x*P.x,o+=P.x*P.y,s+=P.x*P.z,u+=P.y*P.y,c+=P.y*P.z,l+=P.z*P.z}a*=i,o*=i,s*=i,u*=i,c*=i,l*=i;let f=zTt;f[0]=a,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}=b7(f,HTt),d=t.halfAxes.copy(p),h=d.getColumn(0,NTt),v=d.getColumn(1,UTt),m=d.getColumn(2,GTt),b=-Number.MAX_VALUE,_=-Number.MAX_VALUE,E=-Number.MAX_VALUE,T=Number.MAX_VALUE,S=Number.MAX_VALUE,D=Number.MAX_VALUE;for(let F of e)dp.copy(F),b=Math.max(dp.dot(h),b),_=Math.max(dp.dot(v),_),E=Math.max(dp.dot(m),E),T=Math.min(dp.dot(h),T),S=Math.min(dp.dot(v),S),D=Math.min(dp.dot(m),D);h=h.multiplyByScalar(.5*(T+b)),v=v.multiplyByScalar(.5*(S+_)),m=m.multiplyByScalar(.5*(D+E)),t.center.copy(h).add(v).add(m);let I=qTt.set(b-T,_-S,E-D).multiplyByScalar(.5),L=new pn([I[0],0,0,0,I[1],0,0,0,I[2]]);return t.halfAxes.multiplyRight(L),t}function Y8(e){let t=e.token,r={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},n=g7(t,r),i=m7(t),a=i[0],o=i[1],s=vl.WGS84.cartographicToCartesian([a,o,r.maximumHeight]),u=new _e(s[0],s[1],s[2]);n.push(u);let c=y7(n);return[...c.center,...c.halfAxes]}var WTt=4,VTt=8,$Tt={QUADTREE:WTt,OCTREE:VTt};function KTt(e,t,r){if(e!=null&&e.box){let n=xy(e.s2VolumeInfo.token),i=c7(n,t),a=u7(i),o={...e.s2VolumeInfo};switch(o.token=a,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 w7(e){let{implicitOptions:t,parentData:r={mortonIndex:0,x:0,y:0,z:0},childIndex:n=0,s2VolumeBox:i,loaderOptions:a}=e,{subtree:o,level:s=0,globalData:u={level:0,mortonIndex:0,x:0,y:0,z:0}}=e,{subdivisionScheme:c,subtreeLevels:l,maximumLevel:f,contentUrlTemplate:p,subtreesUriTemplate:d,basePath:h}=t,v={children:[],lodMetricValue:0,contentUrl:""};if(!f)return a7.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${p} won't be loaded...`),v;let m=s+u.level;if(m>f)return v;let b=$Tt[c],_=Math.log2(b),E=n&1,T=n>>1&1,S=n>>2&1,D=(b**s-1)/(b-1),I=sh(r.mortonIndex,n,_),L=D+I,F=sh(r.x,E,1),P=sh(r.y,T,1),M=sh(r.z,S,1),U=!1;s>=l&&(U=_7(o.childSubtreeAvailability,I));let W=sh(u.x,F,s),V=sh(u.y,P,s),Z=sh(u.z,M,s);if(U){let Ae=`${h}/${d}`,Ne=X8(Ae,m,W,V,Z);o=await fn(Ne,N8,a),u={mortonIndex:I,x:F,y:P,z:M,level:s},I=0,L=0,F=0,P=0,M=0,s=0}if(!_7(o.tileAvailability,L))return v;_7(o.contentAvailability,L)&&(v.contentUrl=X8(p,m,W,V,Z));let de=s+1,he={mortonIndex:I,x:F,y:P,z:M};for(let Ae=0;Ae<b;Ae++){let Ne=KTt(i,Ae,c),qe=await w7({subtree:o,implicitOptions:t,loaderOptions:a,parentData:he,childIndex:Ae,level:de,globalData:{...u},s2VolumeBox:Ne});if(qe.contentUrl||qe.children.length){let te=m+1,Q=JTt(qe,te,{childTileX:F,childTileY:P,childTileZ:M},t,i);v.children.push(Q)}}return v}function _7(e,t){let r;return Array.isArray(e)?(r=e[0],e.length>1&&a7.once('Not supported extension "3DTILES_multiple_contents" has been detected')):r=e,"constant"in r?Boolean(r.constant):r.explicitBitstream?QTt(t,r.explicitBitstream):!1}function JTt(e,t,r,n,i){let{basePath:a,refine:o,getRefine:s,lodMetricType:u,getTileType:c,rootLodMetricValue:l,rootBoundingVolume:f}=n,p=e.contentUrl&&e.contentUrl.replace(`${a}/`,""),d=l/2**t,h=i!=null&&i.box?{box:i.box}:f,v=YTt(t,h,r);return{children:e.children,contentUrl:e.contentUrl,content:{uri:p},id:e.contentUrl,refine:s(o),type:c(e),lodMetricType:u,lodMetricValue:d,geometricError:d,transform:e.transform,boundingVolume:v}}function YTt(e,t,r){if(t.region){let{childTileX:n,childTileY:i,childTileZ:a}=r,[o,s,u,c,l,f]=t.region,p=2**e,d=(u-o)/p,h=(c-s)/p,v=(f-l)/p,[m,b]=[o+d*n,o+d*(n+1)],[_,E]=[s+h*i,s+h*(i+1)],[T,S]=[l+v*a,l+v*(a+1)];return{region:[m,_,b,E,T,S]}}if(t.box)return t;throw new Error(`Unsupported bounding volume type ${JSON.stringify(t)}`)}function sh(e,t,r){return(e<<r)+t}function X8(e,t,r,n,i){let a=XTt({level:t,x:r,y:n,z:i});return e.replace(/{level}|{x}|{y}|{z}/gi,o=>a[o])}function XTt(e){let t={};for(let r in e)t[`{${r}}`]=e[r];return t}function QTt(e,t){let r=Math.floor(e/8),n=e%8;return(t[r]>>n&1)===1}function A7(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 S7(e){switch(e){case"REPLACE":case"replace":return 2;case"ADD":case"add":return 1;default:return e}}function E7(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 $a.resolve(t,e)}function Aye(e,t){var i;if(!e)return null;let r;if(e.content){let a=e.content.uri||((i=e.content)==null?void 0:i.url);typeof a<"u"&&(r=E7(a,t))}return{...e,id:r,contentUrl:r,lodMetricType:"geometricError",lodMetricValue:e.geometricError,transformMatrix:e.transform,type:A7(e,r),refine:S7(e.refine)}}async function Cye(e,t,r){let n=null,i=Tye(e.root);i&&e.root?n=await Sye(e.root,e,t,i,r):n=Aye(e.root,t);let a=[];for(a.push(n);a.length>0;){let o=a.pop()||{},s=o.children||[],u=[];for(let c of s){let l=Tye(c),f;l?f=await Sye(c,e,t,l,r):f=Aye(c,t),f&&(u.push(f),a.push(f))}o.children=u}return n}async function Sye(e,t,r,n,i){var T,S,D;let{subdivisionScheme:a,maximumLevel:o,availableLevels:s,subtreeLevels:u,subtrees:{uri:c}}=n,l=X8(c,0,0,0,0),f=E7(l,r),p=await fn(f,N8,i),d=(T=e.content)==null?void 0:T.uri,h=d?E7(d,r):"",v=(S=t==null?void 0:t.root)==null?void 0:S.refine,m=e.geometricError,b=(D=e.boundingVolume.extensions)==null?void 0:D["3DTILES_bounding_volume_S2"];if(b){let L={box:Y8(b),s2VolumeInfo:b};e.boundingVolume=L}let _=e.boundingVolume,E={contentUrlTemplate:h,subtreesUriTemplate:c,subdivisionScheme:a,subtreeLevels:u,maximumLevel:Number.isFinite(s)?s-1:o,refine:v,basePath:r,lodMetricType:"geometricError",rootLodMetricValue:m,rootBoundingVolume:_,getTileType:A7,getRefine:S7};return await ZTt(e,r,p,E,i)}async function ZTt(e,t,r,n,i){if(!e)return null;let{children:a,contentUrl:o}=await w7({subtree:r,implicitOptions:n,loaderOptions:i}),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:A7(e,s),refine:S7(e.refine),content:u||e.content,children:a}}function Tye(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 lc={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Cg,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:e8t,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function e8t(e,t={},r){let n=t["3d-tiles"]||{},i;return n.isTileset==="auto"?i=(r==null?void 0:r.url)&&r.url.indexOf(".json")!==-1:i=n.isTileset,i?t8t(e,t,r):r8t(e,t,r)}async function t8t(e,t,r){var u;let n=JSON.parse(new TextDecoder().decode(e)),i=(r==null?void 0:r.url)||"",a=n8t(i),o=await Cye(n,a,t||{});return{...n,shape:"tileset3d",loader:lc,url:i,queryString:(r==null?void 0:r.queryString)||"",basePath:a,root:o||n.root,type:"TILES3D",lodMetricType:"geometricError",lodMetricValue:((u=n.root)==null?void 0:u.geometricError)||0}}async function r8t(e,t,r){let n={content:{shape:"tile3d",featureIds:null}};return await r7(e,0,t,r,n.content),n.content}function n8t(e){return $a.dirname(e)}var Dye="https://api.cesium.com/v1/assets";async function kye(e,t){if(!t){let a=await i8t(e);for(let o of a.items)o.type==="3DTILES"&&(t=o.id)}let r=await a8t(e,t),{type:n,url:i}=r;return Rt(n==="3DTILES"&&i),r.headers={Authorization:`Bearer ${r.accessToken}`},r}async function i8t(e){Rt(e);let t=Dye,r={Authorization:`Bearer ${e}`},n=await Pa(t,{headers:r});if(!n.ok)throw new Error(n.statusText);return await n.json()}async function a8t(e,t){Rt(e,t);let r={Authorization:`Bearer ${e}`},n=`${Dye}/${t}`,i=await Pa(`${n}`,{headers:r});if(!i.ok)throw new Error(i.statusText);let a=await i.json();if(i=await Pa(`${n}/endpoint`,{headers:r}),!i.ok)throw new Error(i.statusText);let o=await i.json();return a={...a,...o},a}async function o8t(e,t={}){t=t["cesium-ion"]||{};let{accessToken:r}=t,n=t.assetId;if(!Number.isFinite(n)){let i=e.match(/\/([0-9]+)\/tileset.json/);n=i&&i[1]}return kye(r,n)}var Q8={...lc,id:"cesium-ion",name:"Cesium Ion",preload:o8t,parse:async(e,t,r)=>(t={...t},t["3d-tiles"]=t["cesium-ion"],t.loader=Q8,lc.parse(e,t,r)),options:{"cesium-ion":{...lc.options["3d-tiles"],accessToken:null}}};var LEe=Lt(MEe(),1),Tkt="4.2.0-alpha.6",dN={dataType:null,batchType:null,id:"zip",module:"zip",name:"Zip Archive",version:Tkt,extensions:["zip"],mimeTypes:["application/zip"],category:"archive",tests:["PK"],options:{},parse:Ckt};async function Ckt(e,t={}){let r=[],n={};try{let i=new LEe.default;return(await i.loadAsync(e,t)).forEach((o,s)=>{let u=s.name,c=Dkt(i,u,t).then(l=>{n[o]=l});r.push(c)}),await Promise.all(r),n}catch(i){throw t.log.error(`Unable to read zip archive: ${i}`),i}}async function Dkt(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}}var wh=async(e,t)=>{let r=[await e.getUint8(e.length-1n),await e.getUint8(e.length-2n),await e.getUint8(e.length-3n),void 0],n=0n;for(let i=e.length-4n;i>-1;i--)if(r[3]=r[2],r[2]=r[1],r[1]=r[0],r[0]=await e.getUint8(i),r.every((a,o)=>a===t[o])){n=i;break}return n};var kkt=new Uint8Array([1,0]);function zC(e){let t={...e,zip64Length:(e.offset?1:0)*8+(e.size?1:0)*16},r=[];for(let n of Fkt){if(!t[n.name??""]&&!n.default)continue;let i=new DataView(new ArrayBuffer(n.size));qEe[n.size](i,0,t[n.name??""]??n.default),r.push(i.buffer)}return qn(...r)}function ea(e,t,r,n){qEe[t](e,Number(r),n)}var qEe={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)}},Fkt=[{size:2,default:new DataView(kkt.buffer).getUint16(0,!0)},{size:2,name:"zip64Length"},{size:8,name:"size"},{size:8,name:"size"},{size:8,name:"offset"}];var NEe=new Uint8Array([80,75,5,6]),UEe=new Uint8Array([80,75,6,7]),GEe=new Uint8Array([80,75,6,6]),zEe=8n,Bkt=10n,Pkt=12n,HEe=16n,Okt=22n,WEe=8n,VEe=24n,Ikt=32n,Rkt=40n,$Ee=48n,jkt=56n,HC=async e=>{let t=await wh(e,NEe),r=BigInt(await e.getUint16(t+zEe)),n=BigInt(await e.getUint32(t+HEe)),i=t-20n,a=0n,o=await e.slice(i,i+4n);if(Mu(o,UEe)){a=await e.getBigUint64(i+WEe);let s=await e.slice(a,a+4n);if(!Mu(s,GEe.buffer))throw new Error("zip64 EoCD not found");r=await e.getBigUint64(a+VEe),n=await e.getBigUint64(a+$Ee)}else i=0n;return{cdRecordsNumber:r,cdStartOffset:n,offsets:{zip64EoCDOffset:a,zip64EoCDLocatorOffset:i,zipEoCDOffset:t}}};function KEe(e,t,r,n,i){let a=new DataView(e),o=t.zip64EoCDOffset?t.zipEoCDOffset-t.zip64EoCDOffset:0n;if(Number(i)<=65535&&(ea(a,2,o+zEe,i),ea(a,2,o+Bkt,i)),n-r<=4294967295&&ea(a,4,o+Pkt,n-r),r<4294967295&&ea(a,4,o+HEe,r),t.zip64EoCDLocatorOffset&&t.zip64EoCDOffset){let s=t.zip64EoCDLocatorOffset-t.zip64EoCDOffset;ea(a,8,s+WEe,n),ea(a,8,$Ee,r),ea(a,8,VEe,i),ea(a,8,Ikt,i),ea(a,8,Rkt,n-r)}return new Uint8Array(a.buffer)}function JEe(e){let t=new DataView(new ArrayBuffer(Number(Okt)));for(let i of Mkt)ea(t,i.size,i.offset,e[i.name??""]??i.default??0);let r=qkt(e),n=Lkt(e);return qn(n,r,t.buffer)}var Mkt=[{offset:0,size:4,default:new DataView(NEe.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 Lkt(e){let t=new DataView(new ArrayBuffer(Number(jkt)));for(let r of Ukt)ea(t,r.size,r.offset,e[r.name??""]??r.default??0);return t.buffer}function qkt(e){let t=new DataView(new ArrayBuffer(Number(20)));for(let r of Nkt)ea(t,r.size,r.offset,e[r.name??""]??r.default??0);return t.buffer}var Nkt=[{offset:0,size:4,default:new DataView(UEe.buffer).getUint32(0,!0)},{offset:4,size:4,default:0},{offset:8,size:8,name:"eoCDStart"},{offset:16,size:4,default:1}],Ukt=[{offset:0,size:4,default:new DataView(GEe.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 Gkt=20n,zkt=24n,Hkt=28n,Wkt=30n,Vkt=32n,$kt=42n,WC=46n,Ah=new Uint8Array([80,75,1,2]),Eh=async(e,t)=>{let r=await t.slice(e,e+4n);if(!Mu(r,Ah.buffer))return null;let n=BigInt(await t.getUint32(e+Gkt)),i=BigInt(await t.getUint32(e+zkt)),a=await t.getUint16(e+Wkt),o=BigInt(await t.getUint16(e+Vkt)),s=await t.getUint16(e+Hkt),u=await t.slice(e+WC,e+WC+BigInt(s)),c=new TextDecoder().decode(u),l=e+WC+BigInt(s),f=await t.getUint32(e+$kt),p=BigInt(f),d=new DataView(await t.slice(l,l+BigInt(a))),h={uncompressedSize:i,compressedSize:n,localHeaderOffset:p,startDisk:o},v=Kkt(h,d);return{...h,...v,extraFieldLength:a,fileNameLength:s,fileName:c,extraOffset:l}};async function*xc(e){let{cdStartOffset:t}=await HC(e),r=await Eh(t,e);for(;r;)yield r,r=await Eh(r.extraOffset+BigInt(r.extraFieldLength),e)}var YEe=(...e)=>e[0]+e[1]*16,Kkt=(e,t)=>{let r=Jkt(e),n={};if(r.length>0){let i=r.reduce((s,u)=>s+u.length,0),a=new Uint8Array(t.buffer).findIndex((s,u,c)=>YEe(c[u],c[u+1])===1&&YEe(c[u+2],c[u+3])===i),o=0;for(let s of r){let u=o;n[s.name]=t.getBigUint64(a+4+u,!0),o=u+s.length}}return n},Jkt=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 hN(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=zC(n),t.extraLength=r.byteLength);let i=new DataView(new ArrayBuffer(Number(WC)));for(let s of Ykt)ea(i,s.size,s.offset,t[s.name??""]??s.default??0);let a=new TextEncoder().encode(t.fileName);return qn(i.buffer,a,r)}var Ykt=[{offset:0,size:4,default:new DataView(Ah.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 Xkt=8n,Qkt=18n,Zkt=22n,eFt=26n,tFt=28n,t2=30n,mN=new Uint8Array([80,75,3,4]),tu=async(e,t)=>{let r=await t.slice(e,e+4n);if(!Mu(r,mN))return null;let n=await t.getUint16(e+eFt),i=new TextDecoder().decode(await t.slice(e+t2,e+t2+BigInt(n))).split("\\").join("/"),a=await t.getUint16(e+tFt),o=e+t2+BigInt(n+a),s=await t.getUint16(e+Xkt),u=BigInt(await t.getUint32(e+Qkt)),c=BigInt(await t.getUint32(e+Zkt)),l=e+t2+BigInt(n),f=4n;return c===BigInt(4294967295)&&(c=await t.getBigUint64(l+f),f+=8n),u===BigInt(4294967295)&&(u=await t.getBigUint64(l+f),f+=8n),o===BigInt(4294967295)&&(o=await t.getBigUint64(l+f)),{fileNameLength:n,fileName:i,extraFieldLength:a,fileDataOffset:o,compressedSize:u,compressionMethod:s}};function gN(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=zC(n),t.extraLength=r.byteLength);let i=new DataView(new ArrayBuffer(Number(t2)));for(let s of rFt)ea(i,s.size,s.offset,t[s.name??""]??s.default??0);let a=new TextEncoder().encode(t.fileName);return qn(i.buffer,a,r)}var rFt=[{offset:0,size:4,default:new DataView(mN.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 nFt(e){let t=await HC(e),r=t.cdStartOffset,n=Number(t.offsets.zip64EoCDOffset?t.offsets.zip64EoCDOffset-r:t.offsets.zipEoCDOffset-r),i=await e.slice(r,e.length);await e.truncate(Number(r));let a=i.slice(0,n),o=i.slice(n,i.byteLength);return[a,o,t]}async function QEe(e,t,r){let n=parseInt(await new kx().hash(t,"hex"),16),i=gN({crc32:n,fileName:e,length:t.byteLength}),a=hN({crc32:n,fileName:e,offset:r,length:t.byteLength});return[new Uint8Array(qn(i,t)),new Uint8Array(a)]}async function vN(e,t,r){let n=new vo(e,!0),[i,a,o]=await nFt(n),s=n.length,[u,c]=await QEe(r,t,s);await n.append(u);let l=qn(i,c),f=n.length;await n.append(new Uint8Array(l));let p=n.length;await n.append(KEe(a,o.offsets,f,p,o.cdRecordsNumber+1n))}async function xN(e,t,r){let n=iFt(e),i=new Wc(t,"w"),a=[],o=[];for await(let l of n)await XEe(l,i,o,a);if(r){let l=await r(a);await XEe(l,i,o)}let s=(await i.stat()).bigsize,u=qn(...o);await i.append(new Uint8Array(u));let c=(await i.stat()).bigsize;await i.append(new Uint8Array(JEe({recordsNumber:o.length,cdSize:u.byteLength,cdOffset:s,eoCDStart:c})))}async function XEe(e,t,r,n){let i=(await t.stat()).bigsize;n==null||n.push({fileName:e.path,localHeaderOffset:i});let[a,o]=await QEe(e.path,e.file,i);await t.append(a),r.push(o)}function iFt(e){async function*t(){let r=await ZEe(e);for(let n of r){let i=await(await Pa($a.join(e,n))).arrayBuffer();yield{path:n,file:i}}}return t()}async function ZEe(e,t="",r){let n=r||new Dx({}),i=await n.readdir(VC(e,t)),a=[];for(let o of i){let s=VC(e,t,o);if((await n.stat(s)).isDirectory){let u=await ZEe(e,VC(t,o));a.push(...u)}else a.push(VC(t,o))}return a}function VC(...e){let t=e.filter(r=>r.length);return $a.join(...t)}var F1=class{constructor(t){this.compressBatches=this.compressBatches.bind(this),this.decompressBatches=this.decompressBatches.bind(this)}async preload(t={}){xx(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 gd(t)}improveError(t){return t.message.includes(this.name)||(t.message=`${this.name} ${t.message}`),t}};var r2=class extends F1{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 Sh=Lt(eN(),1),Bl=Lt(require("zlib"),1);var Pl=class extends F1{name="deflate";extensions=[];contentEncodings=["deflate"];isSupported=!0;options;_chunks=[];constructor(t={}){super(t),this.options=t}async compress(t){var r,n;if(!jr&&((r=this.options.deflate)!=null&&r.useZlib)){let i=(n=this.options.deflate)!=null&&n.gzip?await z0(Bl.default.gzip)(t):await z0(Bl.default.deflate)(t);return Hc(i)}return this.compressSync(t)}async decompress(t){var r,n;if(!jr&&((r=this.options.deflate)!=null&&r.useZlib)){let i=(n=this.options.deflate)!=null&&n.gzip?await z0(Bl.default.gunzip)(t):await z0(Bl.default.inflate)(t);return Hc(i)}return this.decompressSync(t)}compressSync(t){var a,o,s,u;if(!jr&&((a=this.options.deflate)!=null&&a.useZlib)){let c=(o=this.options.deflate)!=null&&o.gzip?Bl.default.gzipSync(t):Bl.default.deflateSync(t);return Hc(c)}let r=((s=this.options)==null?void 0:s.deflate)||{},n=new Uint8Array(t);return((u=this.options)!=null&&u.raw?Sh.default.deflateRaw:Sh.default.deflate)(n,r).buffer}decompressSync(t){var a,o,s,u;if(!jr&&((a=this.options.deflate)!=null&&a.useZlib)){let c=(o=this.options.deflate)!=null&&o.gzip?Bl.default.gunzipSync(t):Bl.default.inflateSync(t);return Hc(c)}let r=((s=this.options)==null?void 0:s.deflate)||{},n=new Uint8Array(t);return((u=this.options)!=null&&u.raw?Sh.default.inflateRaw:Sh.default.inflate)(n,r).buffer}async*compressBatches(t){var i;let r=((i=this.options)==null?void 0:i.deflate)||{},n=new Sh.default.Deflate(r);yield*this.transformBatches(n,t)}async*decompressBatches(t){var i;let r=((i=this.options)==null?void 0:i.deflate)||{},n=new Sh.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),i=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 n2=class extends Pl{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 eAe={0:async e=>e,8:async e=>await new Pl({raw:!0}).decompress(e)},Ol=class{fileProvider=null;fileName;archive=null;constructor(t){if(typeof t=="string")if(this.fileName=t,!jr)this.fileProvider=new vo(t);else throw new Error("Cannot open file for random access in a WEB browser");else t instanceof Il?(this.fileProvider=t.fileProvider,this.archive=t,this.fileName=t.fileName):MB(t)&&(this.fileProvider=t)}async destroy(){this.fileProvider&&await this.fileProvider.destroy()}async readdir(){if(!this.fileProvider)throw new Error("No data detected in the zip archive");let t=[],r=xc(this.fileProvider);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.fileProvider)throw new Error("No data detected in the zip archive");let i=await this.getCDFileHeader(t),a=await tu(i.localHeaderOffset,this.fileProvider);if(!a)throw new Error("Local file header has not been found in the zip archive`");let o=eAe[a.compressionMethod.toString()];if(!o)throw Error("Only Deflation compression is supported");let s=await this.fileProvider.slice(a.fileDataOffset,a.fileDataOffset+a.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.fileProvider)throw new Error("No data detected in the zip archive");let r=xc(this.fileProvider),n=null;for await(let i of r)if(i.fileName===t){n=i;break}if(!n)throw new Error("File has not been found in the zip archive");return n}};var Il=class{fileProvider;fileName;constructor(t,r,n){this.fileProvider=t,this.fileName=n}async getFileWithoutHash(t){return await(await new Ol(this.fileProvider).fetch(t)).arrayBuffer()}};function i2(e){let t=new DataView(e),r={};for(let n=0;n<e.byteLength;n=n+24){let i=t.getBigUint64(n+16,!0),a=aFt(e,n,16);r[a]=i}return r}function aFt(e,t,r){return[...new Uint8Array(e,t,r)].map(n=>n.toString(16).padStart(2,"0")).join("")}async function bN(e){let t=xc(e);return oFt(t)}async function oFt(e){let t=new Nu,r=new TextEncoder,n={};for await(let i of e){let a=i.fileName.split("\\").join("/").toLocaleLowerCase(),o=r.encode(a).buffer,s=await t.hash(o,"hex");n[s]=i.localHeaderOffset}return n}async function a2(e){let t=new Nu,r=new TextEncoder,n=[];for await(let a of e){let o=a.fileName.split("\\").join("/");o!=="3dSceneLayer.json.gz"&&(o=o.toLocaleLowerCase());let s=r.encode(o).buffer,u=await t.hash(s,"hex");n.push(qn(uFt(u),cFt(a.localHeaderOffset)))}let i=n.sort(sFt);return uE(i)}function sFt(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 uFt(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 cFt(e){return new BigUint64Array([e]).buffer}var lFt={0:e=>new r2().decompress(e),8:e=>new Pl({raw:!0}).decompress(e)},o2=class extends Il{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,i=await new Nu().hash(n,"hex"),a=this.hashTable[i];if(a===void 0)return null;let o=await tu(a,this.fileProvider);if(!o)return null;let s=await this.fileProvider.slice(o.fileDataOffset,o.fileDataOffset+o.compressedSize),u=lFt[o.compressionMethod];if(!u)throw Error("Only Deflation compression is supported");r=await u(s)}else r=await this.getFileWithoutHash(t);return r}};function Sp(e,t,r){if(!t)return r+12;let{magic:i,version:a=1,byteLength:o=12}=e;return Rt(Array.isArray(i)&&Number.isFinite(a)&&Number.isFinite(o)),t.setUint8(r+0,i[0]),t.setUint8(r+1,i[1]),t.setUint8(r+2,i[2]),t.setUint8(r+3,i[3]),t.setUint32(r+4,a,!0),t.setUint32(r+8,o,!0),r+=12,r}function Tp(e,t,r){e&&e.setUint32(t+8,r,!0)}function tAe(e,t,r,n,i){e={magic:ap.COMPOSITE,tiles:[],...e};let a=r;r+=Sp(e,t,r),t&&t.setUint32(r,e.tiles.length,!0),r+=4;for(let o=0;o<e.tiles.length;++o)r+=i(e.tiles[o],t,r,n);return Tp(t,a,r-a),r}function rAe(e,t,r,n){let{featuresLength:i=0,batchTable:a}=e,s=JSON.stringify({BATCH_LENGTH:i}),u=a?JSON.stringify(a):"",c=go(s.length,8),l=u?go(u.length,8):0;e={magic:ap.BATCHED_MODEL,...e};let f=r;r=Sp(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=G0(t,r,s,8),a&&(r=G0(t,r,u,8));let p=e.gltfEncoded;return p&&(r=Sx(t,r,p,p.byteLength)),Tp(t,f,r-f),r}function nAe(e,t,r,n){let{featuresLength:i=1,gltfFormat:a=1,gltfUri:o=""}=e,s=o.length,u={INSTANCES_LENGTH:i,POSITION:new Array(i*3).fill(0)},c=JSON.stringify(u),l=c.length;e={magic:ap.INSTANCED_MODEL,...e};let f=r;return r=Sp(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,a,!0)),r+=20,r+=U0(t,r,c,l),r+=U0(t,r,o,s),Tp(t,f,r-f),r}var fFt={POINTS_LENGTH:1,POSITIONS:{byteOffset:0}};function iAe(e,t,r,n){let{featureTableJson:i=fFt}=e,a=JSON.stringify(i);a=IB(a,4);let{featureTableJsonByteLength:o=a.length}=e,s=new ArrayBuffer(12),u=s.byteLength;e={magic:ap.POINT_CLOUD,...e};let c=r;return r+=Sp(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+=U0(t,r,a,o),r+=Sx(t,r,s,u),Tp(t,c,r-c),r}function _N(e,t){let r=yN(e,null,0,t),n=new ArrayBuffer(r),i=new DataView(n);return yN(e,i,0,t),n}function yN(e,t,r,n){switch(Rt(typeof e.type=="string"),e.type){case Xo.COMPOSITE:return tAe(e,t,r,n,yN);case Xo.POINT_CLOUD:return iAe(e,t,r,n);case Xo.BATCHED_3D_MODEL:return rAe(e,t,r,n);case Xo.INSTANCED_3D_MODEL:return nAe(e,t,r,n);default:throw new Error("3D Tiles: unknown tile type")}}var wN={name:"3D Tile",id:"3d-tiles",module:"3d-tiles",version:Cg,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],binary:!0,options:{["3d-tiles"]:{}},encode:async(e,t)=>aAe(e,t),encodeSync:aAe};function aAe(e,t){return _N(e,t)}var oa=require("path");var oAe=Lt(require("crypto")),KC=new Uint8Array(256),$C=KC.length;function EN(){return $C>KC.length-16&&(oAe.default.randomFillSync(KC),$C=0),KC.slice($C,$C+=16)}var ta=[];for(let e=0;e<256;++e)ta.push((e+256).toString(16).slice(1));function sAe(e,t=0){return(ta[e[t+0]]+ta[e[t+1]]+ta[e[t+2]]+ta[e[t+3]]+"-"+ta[e[t+4]]+ta[e[t+5]]+"-"+ta[e[t+6]]+ta[e[t+7]]+"-"+ta[e[t+8]]+ta[e[t+9]]+"-"+ta[e[t+10]]+ta[e[t+11]]+ta[e[t+12]]+ta[e[t+13]]+ta[e[t+14]]+ta[e[t+15]]).toLowerCase()}var uAe=Lt(require("crypto")),AN={randomUUID:uAe.default.randomUUID};function pFt(e,t,r){if(AN.randomUUID&&!t&&!e)return AN.randomUUID();e=e||{};let n=e.random||(e.rng||EN)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return sAe(n)}var bc=pFt;var Lh=Lt(require("process"),1),M4=Lt(ru(),1),L4=Lt(CN(),1);var O1=require("path"),AAe=Lt(ru(),1);var yAe=()=>({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 Th=require("fs"),B1=require("path");var _Ae=require("zlib"),JC=require("fs");function YC(e){let t=`${e}.gz`,r=(0,_Ae.createGzip)(),n=(0,JC.createReadStream)(e),i=(0,JC.createWriteStream)(t);return new Promise((a,o)=>{n.on("end",()=>{console.log(`${t} compressed and saved.`),a(t)}),n.on("error",s=>{console.log(`${t}: compression error!`),o(s)}),n.pipe(r).pipe(i)})}async function zn(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 Th.promises.mkdir(e,{recursive:!0});let i=(0,B1.join)(e,r);try{await Th.promises.writeFile(i,n)}catch(a){throw a}return console.log(`${i} saved.`),i}async function yc(e,t,r="index.json",n=!0,i){let a=await zn(e,t,r);if(n){if(i)return i.includes(a)?null:(i.push(a),`${a}.gz`);let o=await YC(a);return await l2(a),o}return a}async function P1(e,t){return new Promise((r,n)=>{let i=0;console.log(`load ${e}/${t}.`);let a=setInterval(()=>{let o=(0,B1.join)(e,t);fn(o,RB).then(s=>{clearInterval(a),r(s)}).catch(()=>{i++,i>100&&(clearInterval(a),n(new Error(`Cannon load ${e}/${t}.`)))})},200)})}async function u2(e){try{return await Th.promises.stat(e),!0}catch{return!1}}function c2(e){return Th.promises.rm(e,{recursive:!0})}function l2(e){return Th.promises.unlink(e)}function wAe(e){return(0,B1.isAbsolute)(e)?e:(0,B1.join)(process.cwd(),e)}async function EAe(e,t){try{await Th.promises.rename(e,t)}catch(r){console.log("Can't rename file",r)}}var ra=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,n;return this.converter.options.slpk?(r=(0,O1.join)(this.converter.layers0Path,"nodepages"),n=`${t.toString()}.json`):(r=(0,O1.join)(this.converter.layers0Path,"nodepages",t.toString()),n="index.json"),{filePath:r,fileName:n}}async loadNodePage(t){let{filePath:r,fileName:n}=this.getNodePageFileName(t),i=(0,O1.join)(r,n);return await u2(i)?(console.log(`load ${i}.`),await P1(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 i;if(t==null)return;let n=await this.getNodeById(t);(i=n.children)==null||i.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),ra.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:i,fileName:a}=this.getNodePageFileName(r),o=await this.getNodeById(t.index,n);o?ra.updateAll(o,t):n.nodes.push(t);let s=JSON.stringify(n);this.converter.options.slpk?await this.converter.writeQueue.enqueue({archiveKey:`nodePages/${r.toString()}.json.gz`,writePromise:()=>this.writeFile(i,s,a,!0,this.converter.compressList)},!0):await this.converter.writeQueue.enqueue({writePromise:()=>this.writeFile(i,s)},!0)}async saveMetadata(){let t=(0,AAe.default)({nodeCount:this.nodesCounter},yAe()),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}if(this.converter.options.slpk){for(let[t,r]of this.nodePages.entries()){let n=JSON.stringify(r),i=(0,O1.join)(this.converter.layers0Path,"nodepages");await this.converter.writeQueue.enqueue({archiveKey:`nodePages/${t.toString()}.json.gz`,writePromise:()=>this.writeFile(i,n,`${t.toString()}.json`)})}await this.saveMetadata()}else for(let[t,r]of this.nodePages.entries()){let n=JSON.stringify(r),i=(0,O1.join)(this.converter.layers0Path,"nodepages",t.toString());await this.converter.writeQueue.enqueue({writePromise:()=>this.writeFile(i,n)})}}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}),ra.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 f2=require("path"),XC=require("fs");function I1(e){if(typeof e=="number"){let a=Math.floor(e/1e3),o=e-a*1e3;return SAe(a,o)}let t=1e6,r=e[0],n=e[1]/t;return SAe(r,n)}function SAe(e,t){let r=Math.floor(e/3600);e=e-r*3600;let n=Math.floor(e/60);e=e-n*60;let i=Math.floor(e),a="";return r&&(a+=`${r}h `),n&&(a+=`${n}m `),i&&(a+=`${i}s`),a||(a+=`${Math.floor(t)}ms`),a}async function QC(e){let{slpk:t,outputPath:r,tilesetName:n}=e,i=wAe(r);try{if(t){let s=(0,f2.join)(i,`${n}.slpk`);return(await XC.promises.stat(s)).size}let a=(0,f2.join)(i,n);return await TAe(a)}catch(a){return console.log("Calculate file sizes error: ",a),null}}async function TAe(e){let t=0,r=await XC.promises.readdir(e);for(let n of r){let i=await XC.promises.stat((0,f2.join)(e,n));i.isDirectory()?t+=await TAe((0,f2.join)(e,n)):t+=i.size}return t}var HAe=Lt(CN(),1);var Ch=3,R1=9;function DAe(e){let{positions:t,normals:r,texCoords:n,colors:i,uvRegions:a,featureIndices:o}=e,s=t.length/R1;if(!o.length)return{faceRange:new Uint32Array([0,s-1]),featureIds:[0],featureCount:1,positions:t,normals:r,texCoords:n,colors:i,uvRegions:a};let u=EFt(o),c=AFt({...u,...e}),l=SFt(c);return TFt(l,u.featureCount)}function EFt(e){let t=1,r=1,n=CAe(e.slice(0,Ch)),i=[],a=[],o=[n];i[0]=0,a[0]=n;for(let c=Ch;c<e.length;c+=Ch){let l=CAe(e.slice(c,c+Ch));n!==l&&(i[t]=c/Ch-1,i[t+1]=c/Ch,a[r]=l,o.includes(l)||o.push(l),t+=2,r+=1),n=l}i[t]=e.length/Ch-1;let s=new Uint32Array(i),u=o.length;return{faceRange:s,featureCount:u,featureIds:a}}function CAe(e){let t={},r=e[0],n=1;for(let i of e)t[i]=(t[i]||0)+1,n=n>t[i]?n:t[i],r=n>t[i]?r:i;return r}function AFt(e){let{featureIds:t,positions:r,normals:n,colors:i,uvRegions:a,texCoords:o,faceRange:s=new Uint32Array(0)}=e,u=[],c=new Float32Array(r),l=new Float32Array(n),f=new Uint8Array(i),p=new Float32Array(o),d=new Uint16Array(a),h=0,v=0,m=0,b=0,_=0;for(let E=0;E<t.length;E++){let T=s[E*2],S=s[E*2+1],D=p2("positions",T,S),I=p2("normals",T,S),L=p2("colors",T,S),F=p2("uvRegions",T,S),P=p2("texCoords",T,S);u.push({featureId:t[E],positions:c.subarray(h,h+D),normals:l.subarray(v,v+I),colors:f.subarray(m,m+L),uvRegions:d.subarray(b,b+F),texCoords:p.subarray(_,_+P)}),h+=D,v+=I,m+=L,b+=F,_+=P}return u}function p2(e,t,r){let a=r-t+1,o=a*3;switch(e){case"positions":case"normals":return a*R1;case"colors":case"uvRegions":return o*4;case"texCoords":return o*2;default:return 0}}function SFt(e){let t=[];for(let n of e){let i=t.find(a=>a.featureId===n.featureId);i?i.attributes.push(n):t.push({featureId:n.featureId,attributes:[n]})}let r=[];for(let n of t){let i=kAe(n.attributes);r.push({featureId:n.featureId,...i})}return r}function TFt(e,t){let n=[e[0].featureId||0],i=[0],a=0,o=0;for(let c=1;c<e.length;c++){let l=e[c];n.push(l.featureId||0);let f=e[a];i.push(f.positions.length/R1-1+o),i.push(f.positions.length/R1+o),o+=f.positions.length/R1,a+=1}let s=kAe(e);return i.push(s.positions.length/R1-1),{faceRange:new Uint32Array(i),featureIds:n,featureCount:t,...s}}function kAe(e){let t=e.map(({positions:f})=>f),r=t.length>1?mo(...t):t[0],n=e.map(({normals:f})=>f),i=n.length>1?mo(...n):n[0],a=e.map(({colors:f})=>f),o=a.length>1?mo(...a):a[0],s=e.map(({texCoords:f})=>f),u=s.length>1?mo(...s):s[0],c=e.map(({uvRegions:f})=>f),l=c.length>1?mo(...c):c[0];return{positions:r,normals:i,colors:o,texCoords:u,uvRegions:l}}function ZC(e,t){let r,n,i,a=Zt.WGS84.cartesianToCartographic(e.center,new ce);return a[2]=a[2]-t.getHeight(a[1],a[0]),e instanceof Ii?(n=e.halfSize,r=new ce(n[0],n[1],n[2]).len(),i=e.quaternion):(r=e.radius,n=[r,r,r],i=new tc().fromMatrix3(new Sr([n[0],0,0,0,n[1],0,0,0,n[2]])).normalize()),{mbs:[a[0],a[1],a[2],r],obb:{center:[a[0],a[1],a[2]],halfSize:n,quaternion:i}}}function FAe(e,t){let r=CFt(e),n=wM(r),i=xM(r),a=Zt.WGS84.cartesianToCartographic(i.center,new ce),o=Zt.WGS84.cartesianToCartographic(n.center,new ce);return a[2]=a[2]-t.getHeight(a[1],a[0]),o[2]=o[2]-t.getHeight(o[1],o[0]),{mbs:[a[0],a[1],a[2],i.radius],obb:{center:o,halfSize:n.halfSize,quaternion:n.quaternion}}}function CFt(e){let t=[];for(let r=0;r<e.length;r+=3){let n=new ce([e[r],e[r+1],e[r+2]]);t.push(n)}return t}function BAe(e){let t;e instanceof Oa?t=e:t=e.getBoundingSphere();let r=t.center,n=t.radius,i=Zt.WGS84.cartesianToCartographic(new ce(r[0]+n,r[1]+n,r[2]+n),new ce),a=Zt.WGS84.cartesianToCartographic(new ce(r[0]-n,r[1]-n,r[2]-n),new ce);return{xmin:Math.min(a[0],i[0]),xmax:Math.max(a[0],i[0]),ymin:Math.min(a[1],i[1]),ymax:Math.max(a[1],i[1]),zmin:Math.min(a[2],i[2]),zmax:Math.max(a[2],i[2])}}function DN(e){let t=e[3],r=new ce(e[0],e[1],e[2]),n=new Sr([t,0,0,0,t,0,0,0,t]);return new Ii(r,n)}function PAe(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)||[],i=((h=(d=e.gltf)==null?void 0:d.images)==null?void 0:h.map(v=>{var _,E;if((_=v==null?void 0:v.image)!=null&&_.compressed)return null;let m=(E=v==null?void 0:v.image)==null?void 0:E.data,b=new Uint8Array(m.length);return b.set(m),{data:b,compressed:!1,height:v.image.height,width:v.image.width,components:v.image.components,mimeType:v.mimeType}}))||[];OAe(n);let{cartographicOrigin:a,modelMatrix:o}=kFt(e,t,r);return{nodes:n,images:i,cartographicOrigin:a,cartesianModelMatrix:o}}function DFt(e){let t={};for(let r in e)t[r]={value:e[r].value};return t}function kFt(e,t,r){let{rtcCenter:n,gltfUpAxis:i}=e,{center:a}=r,o=new zr(t);switch(n&&o.translate(n),i){case"Z":break;case"Y":let c=new zr().rotateX(Math.PI/2);o=o.multiplyRight(c);break;case"X":let l=new zr().rotateY(-Math.PI/2);o=o.multiplyRight(l);break;default:break}let s=new ce(a),u=Zt.WGS84.cartesianToCartographic(s,new ce);return{modelMatrix:o,cartographicOrigin:u}}function OAe(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(i=>{var a,o,s;return{...i,indices:{value:(a=i==null?void 0:i.indices)==null?void 0:a.value},attributes:DFt(i.attributes),material:{id:(o=i==null?void 0:i.material)==null?void 0:o.id,uniqueId:(s=i==null?void 0:i.material)==null?void 0:s.uniqueId}}})}}),n.children&&OAe(n.children)}}function IAe(e,t){var n,i;let r=(i=(n=e.gltf)==null?void 0:n.extensions)==null?void 0:i[Zo];if(!(r!=null&&r.featureTextures))return null;for(let a in r.featureTextures)if(r.featureTextures[a].class===t)return a;return null}function RAe(e,t,r,n){let i=t==null?void 0:t.extensions;if(!i)return[];for(let[a,o]of Object.entries(i||{}))switch(a){case Zo:return BFt(e,o,r,n);case x8:return FFt(e,o);default:return[]}return[]}function FFt(e,t){for(let r of t.featureIds)if(typeof r.propertyTable<"u")return r.data;return[]}function BFt(e,t,r,n){var o,s,u,c,l,f,p;let i=(o=t==null?void 0:t.featureIdAttributes)==null?void 0:o[0];if((s=i==null?void 0:i.featureIds)!=null&&s.attribute)return e[i.featureIds.attribute].value;if((u=i==null?void 0:i.featureIds)!=null&&u.hasOwnProperty("constant")&&((c=i==null?void 0:i.featureIds)!=null&&c.hasOwnProperty("divisor"))){let d=((l=e==null?void 0:e.POSITIONS)==null?void 0:l.value.length)/3||0;return PFt(d,i.featureIds.constant,i.featureIds.divisor)}let a=(t==null?void 0:t.featureIdTextures)&&(t==null?void 0:t.featureIdTextures[0]);if(a){let h=`TEXCOORD_${((p=(f=a==null?void 0:a.featureIds)==null?void 0:f.texture)==null?void 0:p.texCoord)||0}`,v=e[h].value;return OFt(a,v,r)}return n?e[n].value:[]}function PFt(e,t=0,r=0){let n=[];if(r>0){let i=t,a=r;for(let o=0;o<e;o++)n.push(i),a-=1,a===0&&(i++,a=r)}else n=Array(e).fill(t,0,e);return n}function OFt(e,t,r){var c,l,f;if(!(r!=null&&r.length))return[];let n={r:0,g:1,b:2,a:3},i=(l=(c=e==null?void 0:e.featureIds)==null?void 0:c.texture)==null?void 0:l.index,a=(f=e==null?void 0:e.featureIds)==null?void 0:f.channels;if(!a||i===void 0)return[];let o=r[i],s=[],u=n[a];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],v=Math.min(JT(d)*o.width|0,o.width-1),b=(Math.min(JT(h)*o.height|0,o.height-1)*o.width+v)*o.components+u,_=new Uint8Array(o.data)[b];s.push(_)}else console.warn(`Can't get batch Ids from ${(o==null?void 0:o.mimeType)||""} compressed texture`);return s}function jAe(e,t){let r={};for(let n in t){let i=t[n];r[n]=IFt(i,e)}return r}function IFt(e,t){let r=[];if(e)for(let n in t){let i=e[n]||null;r.push(i)}return r}function MAe(e,t){let r=!1;for(let n of Object.values(t))(!e||!n||e.length!==n.length)&&(r=!0);return r}function RFt(e){return typeof e=="string"||typeof e=="bigint"?xn.STRING_TYPE:typeof e=="number"?Number.isInteger(e)?xn.SHORT_INT_TYPE:xn.DOUBLE_TYPE:xn.STRING_TYPE}function LAe(e){let t={};for(let r in e){let n=e[r][0],i=RFt(n);t[r]=i}return t}var qAe=(e,t)=>{var a,o,s,u,c,l,f,p;let r={},n=(u=(s=(o=(a=e.extensions)==null?void 0:a[Zo])==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],v=jFt(h);r[d]=v}return r}let i=(p=(f=(l=(c=e.extensions)==null?void 0:c[hl])==null?void 0:l.schema)==null?void 0:f.classes)==null?void 0:p[t];if(i){for(let d in i.properties){let h=i.properties[d],v=MFt(h);r[d]=v}return r}return null},jFt=e=>{let t;switch(e.type){case"INT8":case"UINT8":case"INT16":case"UINT16":case"INT32":case"UINT32":t=xn.SHORT_INT_TYPE;break;case"FLOAT32":case"FLOAT64":t=xn.DOUBLE_TYPE;break;case"INT64":case"UINT64":case"BOOLEAN":case"ENUM":case"STRING":case"ARRAY":t=xn.STRING_TYPE;break;default:t=xn.STRING_TYPE;break}return t},MFt=e=>{let t;if(e.array)t=xn.STRING_TYPE;else switch(e.componentType){case"INT8":case"UINT8":case"INT16":case"UINT16":case"INT32":case"UINT32":t=xn.SHORT_INT_TYPE;break;case"FLOAT32":case"FLOAT64":t=xn.DOUBLE_TYPE;break;case"INT64":case"UINT64":t=xn.STRING_TYPE;break;default:t=xn.STRING_TYPE;break}return t};var e4=e=>{let t=new Uint32Array(e);for(let r=0;r<e;r++)t[r]=r;return t};var LFt=1,qFt=1,nu=3,d2=2,NFt=4,UFt="string",GFt="Int32",zFt="Float64",HFt="Oid32",NAe=["CUSTOM_ATTRIBUTE_2","_BATCHID","BATCHID"],Cp=new ce;async function kN({tileContent:e,tileTransform:t,tileBoundingVolume:r,addNodeToNodePage:n,propertyTable:i,featuresHashArray:a,attributeStorageInfo:o,draco:s,generateBoundingVolumes:u,shouldMergeMaterials:c,geoidHeightModel:l,libraries:f,metadataClass:p}){var E;let d=u,h=await a5t((E=e.gltf)==null?void 0:E.materials,c),v=PAe(e,t,r),m=IAe(e,p),b=await $Ft(v,h,d,m);u&&WFt(b,l);let _=[];for(let T of h){let S=T.mergedMaterials[0].originalMaterialId;if(!b.has(S))continue;let D=b.get(S);if(!D)continue;let{material:I,texture:L}=T,F=await n();_.push(await VFt({convertedAttributes:D,material:I,texture:L,tileContent:e,nodeId:F,featuresHashArray:a,propertyTable:i,attributeStorageInfo:o,draco:s,libraries:f}))}return _.length?_:null}function WFt(e,t){for(let r of e.values()){let n=FAe(r.positions,t);r.boundingVolumes=n;let i=n.obb.center;for(let a=0;a<r.positions.length;a+=nu){let o=r.positions.subarray(a,a+nu);Zt.WGS84.cartesianToCartographic(Array.from(o),Cp),Cp[2]=Cp[2]-t.getHeight(Cp[1],Cp[0]),Cp=Cp.subtract(i),r.positions.set(Cp,a)}}}async function VFt({convertedAttributes:e,material:t,texture:r,tileContent:n,nodeId:i,featuresHashArray:a,propertyTable:o,attributeStorageInfo:s,draco:u,libraries:c}){var P;let l=e.boundingVolumes,f=e.positions.length/nu,{faceRange:p,featureIds:d,positions:h,normals:v,colors:m,uvRegions:b,texCoords:_,featureCount:E}=DAe(e),T={};o&&(T=g5t(d,e.featureIndices,a,o));let S=new Uint32Array(2),D=S5t(d);S.set([f,E],0);let I=new Uint8Array(qn(S.buffer,h.buffer,v.buffer,r?_.buffer:new ArrayBuffer(0),m.buffer,b,D.buffer,p.buffer)),L=u?T5t(f,e,{positions:h,normals:v,texCoords:r?_:new Float32Array(0),colors:m,uvRegions:b,featureIds:d,faceRange:p},c):null,F=[];return s&&o&&(F=y5t(d,T,o,s)),{nodeId:i,geometry:I,compressedGeometry:L,texture:r,hasUvRegions:Boolean(b.length),sharedResources:f5t(((P=n.gltf)==null?void 0:P.materials)||[],i),meshMaterial:t,vertexCount:f,attributes:F,featureCount:E,boundingVolumes:l}}async function $Ft(e,t,r,n){let{nodes:i,images:a,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)}WAe({nodes:i,images:a,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 WAe({nodes:e,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:i,useCartesianPositions:a,matrix:o=new zr([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)JFt({node:u,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:i,useCartesianPositions:a,matrix:o,featureTexture:s})}function KFt(e,t){let r=t,{matrix:n,rotation:i,scale:a,translation:o}=e;return n&&(r=t.multiplyRight(n)),o&&(r=r.translate(o)),i&&(r=r.rotateXYZ(i)),a&&(r=r.scale(a)),r}function JFt({node:e,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:i,useCartesianPositions:a,matrix:o=new zr([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),featureTexture:s}){let u=KFt(e,o),c=e.mesh;c&&YFt({mesh:c,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:i,useCartesianPositions:a,matrix:u,featureTexture:s}),WAe({nodes:e.children||[],images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:i,useCartesianPositions:a,matrix:u,featureTexture:s})}function YFt({mesh:e,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:i,useCartesianPositions:a=!1,matrix:o,featureTexture:s}){var u;for(let c of e.primitives){let l=null,f;c.material?(l=i.get(c.material.id),f=(u=l==null?void 0:l.mergedMaterials.find(({originalMaterialId:h})=>{var v;return h===((v=c.material)==null?void 0:v.id)}))==null?void 0:u.uvRegion):i.has("default")&&(l=i.get("default")),Rt(l!==null,"Primitive - material mapping failed"),Rt(c.mode===void 0||c.mode===Tt.TRIANGLES||c.mode===Tt.TRIANGLE_STRIP,`Primitive - unsupported mode ${c.mode}`);let p=c.attributes;if(!l)continue;let d=XFt(c);l.positions=mo(l.positions,UAe({vertices:p.POSITION.value,cartographicOrigin:r,cartesianModelMatrix:n,nodeMatrix:o,indices:d,attributeSpecificTransformation:QFt,useCartesianPositions:a})),l.normals=mo(l.normals,UAe({vertices:p.NORMAL&&p.NORMAL.value,cartographicOrigin:r,cartesianModelMatrix:n,nodeMatrix:o,indices:d,attributeSpecificTransformation:ZFt,useCartesianPositions:!1})),l.texCoords=mo(l.texCoords,e5t(p.TEXCOORD_0&&p.TEXCOORD_0.value,d)),l.colors=mo(l.colors,t5t(p.COLOR_0,d)),f&&(l.uvRegions=mo(l.uvRegions,r5t(f,d))),l.featureIndicesGroups=l.featureIndicesGroups||[],l.featureIndicesGroups.push(n5t(i5t(p,c,t,s),d))}}function XFt(e){var r;let t=(r=e.indices)==null?void 0:r.value;if(!t){let n=e.attributes.POSITION.value;return e4(n.length/nu)}if(t&&e.mode===Tt.TRIANGLE_STRIP){let n=t.constructor,i=new n((t.length-2)*3),a=0,o=t.slice(0,3);i.set(o,0);for(let s=1;s+2<t.length;s++)a+=3,o=t.slice(s,s+3),s%2===0?i.set(o,a):i.set(o.reverse(),a);t=i}return t}function UAe(e){let{vertices:t,indices:r,attributeSpecificTransformation:n}=e,i=new Float32Array(r.length*nu);if(!t)return i;for(let a=0;a<r.length;a++){let o=r[a]*nu,s=t.subarray(o,o+nu),u=new ce(Array.from(s));u=n(u,e),i[a*nu]=u.x,i[a*nu+1]=u.y,i[a*nu+2]=u.z}return i}function QFt(e,t){let{cartesianModelMatrix:r,cartographicOrigin:n,nodeMatrix:i,useCartesianPositions:a}=t;return i&&(e=e.transform(i)),e=e.transform(r),a||(Zt.WGS84.cartesianToCartographic([e[0],e[1],e[2]],e),e=e.subtract(n)),e}function ZFt(e,t){let{cartesianModelMatrix:r,nodeMatrix:n}=t;return n&&(e=e.transformAsVector(n)),e=e.transformAsVector(r),e}function e5t(e,t){let r=new Float32Array(t.length*d2);if(!e)return r.fill(1),r;for(let n=0;n<t.length;n++){let i=t[n]*d2,a=e.subarray(i,i+d2);r[n*d2]=a[0],r[n*d2+1]=a[1]}return r}function t5t(e,t){let r=(e==null?void 0:e.components)||NFt,n=new Uint8Array(t.length*r);if(!e)return n.fill(255),n;let i=e.value;for(let a=0;a<t.length;a++){let o=t[a]*r,s=i.subarray(o,o+r),u=new Uint8Array(r);for(let c=0;c<s.length;c++)u[c]=s[c]*255;n.set(u,a*r)}return n}function r5t(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 n5t(e,t){if(!e.length||!t.length)return[];let r=[];for(let n=0;n<t.length;n++){let i=t[n];r.push(e[i])}return r}function i5t(e,t,r,n){let i=RAe(e,t,r,n);if(i.length)return i;for(let a=0;a<NAe.length;a++){let o=NAe[a];if(e[o]&&e[o].value)return e[o].value}return[]}async function a5t(e=[],t){let r=[];for(let n of e)r.push(u5t(n));return t&&(r=await o5t(r)),r}async function o5t(e){var r,n;let t=[];for(;e.length>0;){let i=e.splice(0,1)[0],a=[];for(let o=0;o<e.length;o++){let s=e[o];(i.texture&&s.texture||!i.texture&&!s.texture)&&(i=await s5t(i,s),a.push(o))}if(i.texture&&a.length){let o=(r=i.mergedMaterials)==null?void 0:r.reduce((c,{textureSize:l})=>c+((l==null?void 0:l.width)||0),0),s=(n=i.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 i.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}i.texture.image.width=o,i.texture.image.height=s}for(let o of a.reverse())e.splice(o,1);t.push(i)}return t.length||t.push({material:l5t(),mergedMaterials:[{originalMaterialId:"default"}]}),t}async function s5t(e,t){var r,n;if((r=e.texture)!=null&&r.bufferView&&((n=t.texture)!=null&&n.bufferView)&&e.mergedMaterials&&t.mergedMaterials){let i=Buffer.from(e.texture.bufferView.data),a=Buffer.from(t.texture.bufferView.data);try{let{joinImages:o}=await import("join-images"),s=await o([i,a],{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 u5t(e){var i,a,o,s,u;let t={doubleSided:e.doubleSided,emissiveFactor:(i=e.emissiveFactor)==null?void 0:i.map(c=>Math.round(c*255)),alphaMode:c5t(e.alphaMode),pbrMetallicRoughness:{roughnessFactor:((a=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:a.roughnessFactor)||LFt,metallicFactor:((o=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:o.metallicFactor)||qFt}},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:bc();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 c5t(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend";default:return"opaque"}}function l5t(){return{alphaMode:"opaque",pbrMetallicRoughness:{metallicFactor:1,roughnessFactor:1}}}function f5t(e,t){let r={};if(!e||!e.length)return r;r.materialDefinitionInfos=[];for(let n of e){let{materialDefinitionInfo:i,textureDefinitionInfo:a}=p5t(n,t);r.materialDefinitionInfos.push(i),a&&(r.textureDefinitionInfos=r.textureDefinitionInfos||[],r.textureDefinitionInfos.push(a))}return r}function p5t(e,t){var s;let r=((s=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:s.baseColorTexture)||e.emissiveTexture,n=null;r&&(n=h5t(r.texture,t));let{baseColorFactor:i,metallicFactor:a}=(e==null?void 0:e.pbrMetallicRoughness)||{},o=i;return(!i||i[3]===0)&&e.emissiveFactor&&(o=e.emissiveFactor,o[3]=o[3]||1),{materialDefinitionInfo:d5t(o||[1,1,1,1],a),textureDefinitionInfo:n}}function d5t(e,t=1){let r=.00015686274509803922,n=new Jo(0,0,0,1),i=new Jo(1,1,1,1),a=new Jo(r,r,r,0),o=new Jo(e),s=i.subtract(a).multiply(o),u=s.lerp(s,n,t);a[3]=1;let c=a.lerp(a,o,t);return{params:{diffuse:u.toArray(),specular:c.toArray(),renderMode:"solid"}}}function h5t(e,t){var r,n,i,a;return{encoding:(r=e==null?void 0:e.source)!=null&&r.mimeType?[e.source.mimeType]:void 0,images:[{id:m5t(e,t),size:(n=e.source)==null?void 0:n.image.width,length:(i=e.source)!=null&&i.image.data.length?[(a=e.source)==null?void 0:a.image.data.length]:void 0}]}}function m5t(e,t){var v;let{width:r,height:n}=((v=e.source)==null?void 0:v.image)||{};if(!r||!n)return"";let i=1,a=0,o=t+1,s=32-o.toString(2).length,u="0".repeat(s).concat(o.toString(2)),c=i<<28,l=a<<24,f=r-1<<12,p=n-1<<0,d=c+l+f+p;return BigInt(`0b${d.toString(2)}${u}`).toString()}function g5t(e,t,r,n){let i=v5t(e,n,r);return GAe(t,i),GAe(e,i),i}function v5t(e,t,r){let n={};for(let i=0;i<e.length;i++){let a=e[i],o=b5t(i,t,r);n[a.toString()]=o}return n}function x5t(e,t){let r="";for(let n in e)r+=e[n][t];return r}function b5t(e,t,r){let n=x5t(t,e),i=(0,HAe.default)(n);return r.includes(i)?r.indexOf(i):r.push(i)-1}function GAe(e,t){for(let r=0;r<e.length;r++)e[r]=t[e[r]]}function y5t(e,t,r,n){let i=[],o=MAe(e,r)?jAe(t,r):r,s={OBJECTID:e,...o};for(let u in s){let c=w5t(u,n);if(c){let l=s[u],f=_5t(c,l);i.push(f)}}return i}function _5t(e,t){let r;switch(e){case HFt:case GFt:r=E5t(t);break;case zFt:r=A5t(t);break;case UFt:r=zAe(t);break;default:r=zAe(t)}return r}function w5t(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 E5t(e){let t=new Uint32Array([e.length]),r=new Uint32Array(e);return qn(t.buffer,r.buffer)}function A5t(e){let t=new Uint32Array([e.length]),r=new Uint8Array(4),n=new Float64Array(e);return qn(t.buffer,r.buffer,n.buffer)}function zAe(e){let t=new Uint32Array([e.length]),r=0,n=new Uint32Array(e.length),i=[];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,i.push(u)}let a=new Uint32Array([r]);return qn(t.buffer,a.buffer,n.buffer,...i)}function S5t(e){let t=new BigUint64Array(e.length);for(let r=0;r<e.length;r++)t[r]=BigInt(e[r]);return t}async function T5t(e,t,r,n){let{positions:i,normals:a,texCoords:o,colors:s,uvRegions:u,featureIds:c,faceRange:l}=r,f=new Uint32Array(e);for(let m=0;m<f.length;m++)f.set([m],m);let p=new Uint32Array(t.featureIndices.length?t.featureIndices:e),d=C5t(p,l),h={positions:i,normals:a,colors:s,"feature-index":d};o.length&&(h.texCoords=o);let v={"feature-index":{"i3s-attribute-type":"feature-index","i3s-feature-ids":new Int32Array(c)}};return u.length&&(h["uv-region"]=u,v["uv-region"]={"i3s-attribute-type":"uv-region"}),yg({attributes:h,indices:f},TM,{...TM.options,reuseWorkers:!0,_nodeWorkers:!0,modules:n,useLocalLibraries:!0,draco:{method:"MESH_SEQUENTIAL_ENCODING",attributesMetadata:v},["draco-writer"]:{workerUrl:"./modules/draco/dist/draco-writer-worker-node.js"}})}function C5t(e,t){let r=new Uint32Array(e.length),n=0,i=0;for(let a=1;a<t.length;a+=2){let o=(t[a]+1)*nu;r.fill(n,i,o),n++,i=o+1}return r}function VAe(e,t){if(!e)return null;let r,n=e.batchTableJson;if(n)return n;let{extensionName:i,extension:a}=F5t(e);switch(i){case hl:return r=D5t(a,t),r;case Zo:return r=k5t(a,t),r;default:return null}}function D5t(e,t){if(e.propertyTables){for(let r of e.propertyTables)if(r.class===t||!t)return t4(r)}if(e.propertyTextures){for(let r of e.propertyTextures)if(r.class===t||!t)return t4(r)}return null}function k5t(e,t){if(e.featureTables)for(let r in e.featureTables){let n=e.featureTables[r];if(n.class===t||!t)return t4(n)}if(e.featureTextures)for(let r in e.featureTextures){let n=e.featureTextures[r];if(n.class===t||!t)return t4(n)}return null}function t4(e){let t={};for(let r in e.properties)t[r]=e.properties[r].data;return t}function F5t(e){var a,o,s,u;let t=[Zo,hl];if(!((a=e==null?void 0:e.gltf)==null?void 0:a.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 i=(u=(s=e==null?void 0:e.gltf)==null?void 0:s.extensions)==null?void 0:u[n];return{extensionName:n,extension:i}}var KAe=Lt(ru(),1),JAe=require("path");var $Ae=()=>({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 YAe(e,t,r){let n={serviceItemId:bc().replace(/-/gi,""),layerName:e,layers0:t},i=(0,KAe.default)(n,$Ae()),a=(0,JAe.join)(r,"SceneServer");await zn(a,JSON.stringify(i))}var FN=16;function XAe(e,t){let r=[],n=e.boundingVolume,i=e.lodMetricValue||.1,a={metricType:"maxScreenThreshold",maxError:t.mbs[3]*2*FN/i},o={metricType:"maxScreenThresholdSQ",maxError:Math.PI*.25*a.maxError*a.maxError};return n.constructor.name==="OrientedBoundingBox"?(r.push(o),r.push(a)):(r.push(a),r.push(o)),r}function BN(e){var n,i;let t=(n=e.lodSelection)==null?void 0:n.find(a=>a.metricType==="maxScreenThreshold"),r=t==null?void 0:t.maxError;if(!r){let a=(i=e.lodSelection)==null?void 0:i.find(o=>o.metricType==="maxScreenThresholdSQ");a&&(r=Math.sqrt(a.maxError/(Math.PI*.25)))}return r||(r=FN),e.mbs[3]*2*FN/r}var B5t=240,P5t=[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],O5t=372,I5t=[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],R5t=372,j5t=[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],M5t=12,PN=(3+1)*(3+2)/2,L5t=2,j1=class{constructor(t){St(this,"_v00",0),St(this,"_v01",0),St(this,"_v10",0),St(this,"_v11",0),St(this,"_t",[]),St(this,"_ix",void 0),St(this,"_iy",void 0),St(this,"options",void 0),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=q5t(r,360);r=n!==-180?n:180;let i=r*this.options._rlonres,a=-t*this.options._rlatres,o=Math.floor(i),s=Math.min(Math.round((this.options._height-1)/2-1),Math.floor(a));i-=o,a-=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(PN);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)],v=I5t;s!==0&&(v=s===this.options._height-2?j5t:P5t);let m=O5t;s!==0&&(m=s===this.options._height-2?R5t:B5t);for(let b=0;b<PN;++b){p[b]=0;for(let _=0;_<M5t;++_)p[b]+=h[_]*v[PN*_+b];p[b]/=m}}if(!this.options.cubic){let h=(1-i)*u+i*c,v=(1-i)*l+i*f,m=(1-a)*h+a*v,b=this.options._offset+this.options._scale*m;return this._ix=o,this._iy=s,this._v00=u,this._v01=c,this._v10=l,this._v11=f,b}let d=p[0]+i*(p[1]+i*(p[3]+i*p[6]))+a*(p[2]+i*(p[4]+i*p[7])+a*(p[5]+i*p[8]+a*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+L5t*(r*this.options._swidth+t),i=this.options.data[n],a=this.options.data[n+1];return i<<8|a}};function q5t(e,t){t=Math.abs(t);let r=QAe(e,t);return 2*Math.abs(r)===t?r-=QAe(e,2*t)-r:2*Math.abs(r)>t&&(r+=r<0?t:-t),r}function QAe(e,t){return e-Math.floor(e/t)*t}var N5t=10,U5t=65535;function ON(e,t){let r=G5t(e),n=r.next();if(n.done||n.value.line!=="P5")throw new Error("Geoid model file: File not in PGM format");let i=Number.MAX_VALUE,a=0,o=-1,s=-1,u="NONE",c="UNKNOWN",l=0,f=0,p=null,d=null;do{n=r.next();let b=n.value.line;if(b.length)if(b[0]==="#"){let _=b.split(" "),E=_[0],T=_[1];if(E!=="#"||!T)continue;let S=_.length>2?_.slice(2):[];if(T==="Description")u=S.join(" ");else if(T==="DateTime")c=S.join(" ");else if(T==="Offset"){if(!_[2])throw new Error("Geoid model file: Error reading offset");i=parseInt(_[2],10)}else if(T==="Scale"){if(!_[2])throw new Error("Geoid model file: Error reading scale");a=parseFloat(_[2])}else T===(t.cubic?"MaxCubicError":"MaxBilinearError")?isFinite(parseFloat(_[2]))&&(o=parseFloat(_[2])):T===(t.cubic?"RMSCubicError":"RMSBilinearError")&&isFinite(parseFloat(_[2]))&&(s=parseFloat(_[2]))}else{let _=b.split(" ");if(_=_.filter(E=>E!==""),l=parseInt(_[0],10),f=parseInt(_[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!==U5t)throw new Error("Geoid model file: Incorrect value of maxval");if(p=n.value.offset,d=l,i===Number.MAX_VALUE)throw new Error("Geoid model file: Offset not set");if(a===0)throw new Error("Geoid model file: Scale not set");if(a<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 v=l/360,m=(f-1)/180;return new j1({cubic:t.cubic,_width:l,_height:f,_rlonres:v,_rlatres:m,_offset:i,_scale:a,_swidth:d,_datastart:p,_maxerror:o,_rmserror:s,_description:u,_datetime:c,data:e})}function*G5t(e){let t=0;do{let r=e.indexOf(N5t,t);if(r!==-1){let n=e.subarray(t,r);t=r+1,yield{offset:t,line:ZAe(n)}}else{let n=e.subarray(t,e.length);t=e.length,yield{offset:t,line:ZAe(n)}}}while(t<e.length);return{offset:t,line:""}}function ZAe(e){let t="";for(let r of e)t+=String.fromCharCode(r);return t}var z5t="4.2.0-alpha.6";var r4={dataType:null,batchType:null,name:"PGM - Netpbm grayscale image format",id:"pgm",module:"tile-converter",version:z5t,mimeTypes:["image/x-portable-graymap"],parse:async(e,t)=>ON(new Uint8Array(e),(t==null?void 0:t.pgm)||{}),extensions:["pgm"],options:{pgm:{cubic:!1}}};var M1=Lt(ru(),1);var eSe={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 H5t=()=>({wkid:{path:"wkid",default:4326},latestWkid:{path:"latestWkid",default:4326},vcsWkid:{path:"vcsWkid",default:5773},latestVcsWkid:{path:"latestVcsWkid",default:5773}}),W5t=()=>({heightModel:{path:"heightModel",default:"gravity_related_height"},vertCRS:{path:"vertCRS",default:"EGM96_Geoid"},heightUnit:{path:"heightUnit",default:"meter"}}),V5t=()=>({nodesPerPage:{path:"nodesPerPage"},lodSelectionMetricType:{path:"lodSelectionMetricType",default:"maxScreenThresholdSQ"}}),$5t=()=>({xmin:{path:"xmin"},ymin:{path:"ymin"},xmax:{path:"xmax"},ymax:{path:"ymax"},zmin:{path:"zmin"},zmax:{path:"zmax"}}),tSe=()=>({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,M1.default)(e,H5t())},capabilities:{path:"capabilities",default:["View","Query"]},store:{path:"store",transform:e=>(0,M1.default)(e,eSe)},fullExtent:{path:"fullExtent",transform:e=>(0,M1.default)(e,$5t())},heightModelInfo:{path:"heightModelInfo",transform:e=>(0,M1.default)(e,W5t())},nodePages:{path:"nodePages",transform:e=>(0,M1.default)(e,V5t())},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 IN=Lt(ru(),1),K5t=()=>({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}}}),J5t=()=>({"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}}}),rSe=()=>({geometryBuffers:{path:"geometryConfig",transform:e=>{let t=[(0,IN.default)(e,K5t())];return e.draco&&t.push((0,IN.default)({geometryConfig:e},J5t())),t}}});var h2=Lt(ru(),1),Y5t=()=>({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}}),X5t=()=>({name:{path:"name",default:"standard"},type:{path:"type",default:"standard"},params:{path:"params",transform:(e,t,r)=>(0,h2.default)(r,Y5t())}}),Q5t=()=>({id:{path:"id"},size:{path:"size"},href:{path:"href",default:["../textures/0"]},length:{path:"length"}}),Z5t=()=>({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,h2.default)(n,Q5t()))}}),nSe=()=>({materialDefinitions:{path:"materialDefinitionInfos",transform:eBt},textureDefinitions:{path:"textureDefinitionInfos",transform:tBt}});function eBt(e,t,r){let n={};for(let[i,a]of e.entries())n[`Mat${r.nodePath}${i}`]=(0,h2.default)(a,X5t());return n}function tBt(e,t,r){if(!e)return null;let n={};for(let[i,a]of e.entries()){let o=`${r.nodePath}${i}`;a.imageIndex=o,n[o]=(0,h2.default)(a,Z5t())}return n}var rBt=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 aSe(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 nBt(t,e),iBt(t,e),t}function nBt(e,t){var o;let r=aBt(t.parentNode.obb),n=oBt(t);if(sBt(r,n))return;let a=`OBB of Tile (${t.id}) doesn't fit into Parent (${(o=t.parentNode)==null?void 0:o.id}) tile OBB`;e.push(a)}function iBt(e,t){var a;let r=iSe(t.mbs),n=iSe(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 (${(a=t.parentNode)==null?void 0:a.id}) tile MBS`;e.push(o)}}function iSe(e){return new Oa([e[0],e[1],e[2]],e[3])}function aBt(e){let{center:t,halfSize:r,quaternion:n}=e;return new Ii().fromCenterHalfSizeQuaternion(t,r,n)}function oBt(e){let t=e.obb.halfSize,r=rBt,n=Zt.WGS84.cartographicToCartesian(e.obb.center),i=[];for(let a=0;a<r.length;a+=3){let s=new ce(r[a]*=t[0],r[a+1]*=t[1],r[a+2]*=t[2]).transformByQuaternion(e.obb.quaternion).add(n);i=i.concat(s)}return i}function sBt(e,t){let r=!0;for(let n=0;n<t.length/3;n+=3){let i=[t[n],t[n+1],t[n+2]],a=Zt.WGS84.cartesianToCartographic(i);if(e.distanceTo(a)>0){r=!1;break}}return r}var n4=class extends Array{enqueue(t){this.push(t)}dequeue(){return this.shift()}peek(){return this[0]}isEmpty(){return this.length===0}};var oSe=Lt(require("process"),1),uBt=4*1024*1024*1024,L1=class extends n4{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:i}=t,a=await i();n&&a&&(this.fileMap[n]=a)}else super.enqueue(t),oSe.default.memoryUsage().rss>uBt&&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 a=0;a<this.writeConcurrency;a++){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 i=await Promise.allSettled(t);this.updateFileMap(r,i),await this.conversionDump.updateConvertedTilesDump(n,i)}}updateFileMap(t,r){for(let n=0;n<t.length;n++){let i=t[n];i&&"value"in r[n]&&(this.fileMap[i]=r[n].value)}}};var q1="Tile converter does not work in browser, only in node js environment",Dp=".dump.json";var jN=require("path"),MN=Lt(ru(),1);var sSe=Lt(ru(),1),uSe=()=>({mbs:{path:"mbs"},obb:{path:"obb"}}),cBt=()=>({href:{path:"href"}}),lBt=()=>({id:{path:"id"},...cBt(),...uSe()}),RN=()=>({version:{path:"version"},id:{path:"id"},path:{path:"path"},level:{path:"level"},...uSe(),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,sSe.default)(e,lBt()),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 iu=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 i of t){let a=await i.load();r.push({id:i.id,href:`../${i.id}`,obb:a.obb,mbs:a.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 i=await n.load();if(i.neighbors=i.neighbors??[],Number((r=t==null?void 0:t.children)==null?void 0:r.length)<1e3)for(let a of t.children||[])n.id!==a.id&&i.neighbors.push({...a});else console.warn(`Node ${n.id}: neighbors attribute is omited because of large number of neigbors`),delete i.neighbors;this.converter.options.instantNodeWriting&&i&&await n.write(i),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,jN.join)(this.converter.layers0Path,"nodes",this.id);this.converter.options.slpk?await this.converter.writeQueue.enqueue({archiveKey:`nodes/${this.id}/3dNodeIndexDocument.json.gz`,writePromise:()=>yc(r,JSON.stringify(t),"3dNodeIndexDocument.json",!0,this.converter.compressList)},!0):await this.converter.writeQueue.enqueue({writePromise:()=>zn(r,JSON.stringify(t))},!0)}async load(){if(this.data)return this.data;let t=this.id,r=(0,jN.join)(this.converter.layers0Path,"nodes",t),n="index.json";return this.converter.options.slpk&&(n="3dNodeIndexDocument.json"),await P1(r,n)}flush(){this.data=null}static async createRootNode(t,r){let n=iu.createRootNodeIndexDocument(t);return await new iu(0,r).addData(n)}static async createNode({parentNode:t,boundingVolumes:r,lodSelection:n,nodeInPage:i,resources:a,converter:o}){let s=await iu.createNodeIndexDocument(t,r,n,i,a);return await new iu(i.index,o).addData(s)}static createRootNodeIndexDocument(t){let r={version:`{${bc().toUpperCase()}}`,id:"root",level:0,lodSelection:[{metricType:"maxScreenThresholdSQ",maxError:0},{metricType:"maxScreenThreshold",maxError:0}],...t,children:[]};return(0,MN.default)(r,RN())}static async createNodeIndexDocument(t,r,n,i,a){var l,f,p,d,h;let o=i.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,MN.default)(u,RN());if(i.mesh&&(c.geometryData=[{href:"./geometries/0"}],c.sharedResource={href:"./shared"},("texture"in a&&a.texture||"texelCountHint"in a&&a.texelCountHint)&&(c.textureData=[{href:"./textures/0"},{href:"./textures/1"}]),"attributes"in a&&a.attributes&&a.attributes.length&&((f=(l=t.converter.layers0)==null?void 0:l.attributeStorageInfo)!=null&&f.length)||"attributesCount"in a&&a.attributesCount&&((d=(p=t.converter.layers0)==null?void 0:p.attributeStorageInfo)!=null&&d.length))){let v=("attributes"in a?(h=a.attributes)==null?void 0:h.length:a.attributesCount)||0;c.attributeData=[];let m=v<t.converter.layers0.attributeStorageInfo.length?v:t.converter.layers0.attributeStorageInfo.length;for(let b=0;b<m;b++){let _=t.converter.layers0.attributeStorageInfo[b].key;c.attributeData.push({href:`./attributes/${_}/0`})}}return c}};var LN=async(e,t,r)=>{let n=m2(t);if(!e||!t.contentUrl||!n)return;let i={...r,[e.loader.id]:{isTileset:n,assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}},a=await i4(t.contentUrl,e.loader,i);a.root&&(t.children=[a.root])},qN=async(e,t,r)=>{let n=m2(t);if(!e||!t.contentUrl||n)return null;let i={...r,[e.loader.id]:{...r[e.loader.id]||{},isTileset:n,assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}};return await i4(t.contentUrl,e.loader,i)};async function i4(e,t,r){let n=e.split(".3tz"),i;if(n.length===1)i=null;else if(n.length===2)i=n[1].slice(1),i===""&&(i="tileset.json");else throw new Error("Unexpected URL format");if(i){let a=`${n[0]}.3tz`,o=new vo(a),s=await fBt(o),u=new o2(o,s,a),c=new Ol(u),l=await fn(i,t,{...r,fetch:c.fetch.bind(c)});return await c.destroy(),l}return await fn(e,t,r)}function m2(e){return(e==null?void 0:e.type)==="json"||(e==null?void 0:e.type)==="3tz"}async function fBt(e){let t,r=await wh(e,Ah),n=await Eh(r,e);if((n==null?void 0:n.fileName)==="@3dtilesIndex1@"){let i=await tu(n.localHeaderOffset,e);if(!i)throw new Error("corrupted 3tz");let a=i.fileDataOffset,o=await e.slice(a,a+i.compressedSize);t=i2(o)}return t}var a4=async({tile:e,traversalProps:t,processTile:r,postprocessTile:n,maxDepth:i,level:a=0})=>{if(i&&a>i)return;let o=[],s=await r(e,t);o.push(s);for(let u of e.children)await a4({tile:u,traversalProps:s,processTile:r,postprocessTile:n,maxDepth:i,level:a+1});n&&await n(o,t)};var pBt=["POINTS","LINES","LINE_LOOP","LINE_STRIP","TRIANGLES","TRIANGLE_STRIP","TRIANGLE_FAN"],cSe=async e=>{let t={meshTopologyTypes:new Set,metadataClasses:new Set};if(!(e!=null&&e.gltfArrayBuffer))return t;let n=(await bo(e.gltfArrayBuffer,ml,{gltf:{normalize:!1,loadBuffers:!1,loadImages:!1,decompressMeshes:!1}})).json;if(!n)return t;let i=dBt(n),a=hBt(n);return{meshTopologyTypes:i,metadataClasses:a}},dBt=e=>{let t=new Set;for(let r of e.meshes||[])for(let n of r.primitives){let{mode:i}=n;typeof i!="number"&&(i=4),t.add(pBt[i])}return t},hBt=e=>{var i,a,o,s,u,c;let t=new Set,r=(o=(a=(i=e.extensions)==null?void 0:i[Zo])==null?void 0:a.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[hl])==null?void 0:u.schema)==null?void 0:c.classes;if(n)for(let l of Object.keys(n))t.add(l);return t},lSe=(e,t)=>{for(let r of t.meshTopologyTypes)e.meshTopologyTypes.add(r);for(let r of t.metadataClasses)e.metadataClasses.add(r)};var fSe=Lt(require("process"),1);var mBt=.2,N1=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||fSe.default.hrtime.bigint,this.threshold=t.threshold||mBt}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?I1(t.timeRemaining):""}isVelocityTrust(t,r){return r?Math.abs((t-r)/r)<this.threshold:!1}getCurrentTimeInMilliSeconds(){return Number(this.getTime()/BigInt(1e6))}};var D6e=require("util");var jp=require("path"),k6e=Lt(require("process"),1),F6e=Lt(T6e(),1);var C6e={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 Mh=class{restored=!1;options;tilesConverted;textureSetDefinitions;attributeMetadataInfo;materialDefinitions;constructor(){this.tilesConverted={}}async createDump(t){let{tilesetName:r,slpk:n,egmFilePath:i,inputUrl:a,outputPath:o,draco:s=!0,maxDepth:u,token:c,generateTextures:l,generateBoundingVolumes:f,mergeMaterials:p=!0,metadataClass:d,analyze:h=!1}=t;this.options={tilesetName:r,slpk:n,egmFilePath:i,inputUrl:a,outputPath:o,draco:s,maxDepth:u,token:c,generateTextures:l,generateBoundingVolumes:f,mergeMaterials:p,metadataClass:d,analyze:h};let v=(0,jp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Dp}`);if(await u2(v))try{let m=await P1((0,jp.join)(this.options.outputPath,this.options.tilesetName),`${this.options.tilesetName}${Dp}`),{options:b,tilesConverted:_,textureSetDefinitions:E,attributeMetadataInfo:T,materialDefinitions:S}=m;if(new F6e.default().compile(C6e)(m)&&(0,D6e.isDeepStrictEqual)(b,JSON.parse(JSON.stringify(this.options)))){this.tilesConverted=_,this.textureSetDefinitions=E,this.attributeMetadataInfo=T,this.materialDefinitions=S,this.restored=!0;return}}catch(m){console.log("Can't open dump file",m)}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=k6e.default.hrtime();await zn((0,jp.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}${Dp}.${r[0]}.${r[1]}`),await EAe((0,jp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Dp}.${r[0]}.${r[1]}`),(0,jp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Dp}`))}catch(r){console.log("Can't update dump file",r)}}async deleteDumpFile(){var t;(t=this.options)!=null&&t.outputPath&&this.options.tilesetName&&await u2((0,jp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Dp}`))&&await l2((0,jp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Dp}`))}getRecord(t){return this.tilesConverted[t]}setRecord(t,r){this.tilesConverted[t]=r}async addNode(t,r,n){let{nodes:i}=this.getRecord(t)||{nodes:[]};i.push({nodeId:r,done:!1,dumpMetadata:n}),i.length===1&&this.setRecord(t,{nodes:i}),await this.updateDumpFile()}clearDumpRecord(t){this.setRecord(t,{nodes:[]})}addTexturesDefinitions(t){this.textureSetDefinitions=t}updateDoneStatus(t,r,n,i){var o;let a=(o=this.tilesConverted[t])==null?void 0:o.nodes.find(s=>s.nodeId===r);a&&(a.progress||(a.progress={}),a.progress[n]=i,i||(a.done=!1))}async updateConvertedTilesDump(t,r){for(let n=0;n<t.length;n++)if(t[n]&&"value"in r[n]){let{sourceId:i,resourceType:a,outputId:o}=t[n];this.updateNodes(i,o,a)}await this.updateDumpFile()}updateNodes(t,r,n){if(!(!t||!n||!r)){for(let i of this.tilesConverted[t].nodes)if(i.nodeId===r&&i.progress){i.progress[n]=!0;let a=!1;for(let o in i.progress)if(a=i.progress[o],!a)break;i.done=a,i.done&&delete i.progress;break}}}async updateConvertedNodesDumpFile(t,r,n){var a;let i=(a=this.tilesConverted[t])==null?void 0:a.nodes.find(o=>o.nodeId===r);i&&(i.done=n,await this.updateDumpFile())}isFileConversionComplete(t){var n,i,a;let r=!0;for(let o of((n=this.tilesConverted[t])==null?void 0:n.nodes)||[])if(!o.done){r=!1;break}return r&&((a=(i=this.tilesConverted[t])==null?void 0:i.nodes)==null?void 0:a.length)>0}setMaterialsDefinitions(t){this.materialDefinitions=t}};var P6e,lRt=(P6e=Lh.default.env)==null?void 0:P6e.IonToken,B6e=64,fRt="3DTILES",pRt="3DObject",dRt=1800,hRt="https://",Mp="phase1-count",Z1=class{attributeMetadataInfo;nodePages;options;layers0Path;materialMap;materialDefinitions;geometryMap;geometryConfigs;vertexCounter;layers0;featuresHashArray;refinementCounter;validate;boundingVolumeWarnings=[];conversionStartTime=[0,0];refreshTokenTime=[0,0];sourceTileset=null;loadOptions={_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"},fetch:{},modules:{}};geoidHeightModel=null;Loader=lc;generateTextures;generateBoundingVolumes;layersHasTexture;workerSource={};writeQueue=new L1(new Mh);compressList=null;preprocessData={meshTopologyTypes:new Set,metadataClasses:new Set};progresses={};conversionDump;constructor(){this.attributeMetadataInfo=new bT,this.nodePages=new ra(zn,B6e,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 Mh}async convert(t){if(jr)return console.log(q1),q1;this.conversionStartTime=Lh.default.hrtime();let{tilesetName:r,slpk:n,egmFilePath:i,inputUrl:a,validate:o,outputPath:s,draco:u=!0,sevenZipExe:c,maxDepth:l,token:f,generateTextures:p,generateBoundingVolumes:d,instantNodeWriting:h=!1,mergeMaterials:v=!0,inquirer:m,metadataClass:b,analyze:_=!1}=t;this.options={outputPath:s,tilesetName:r,maxDepth:l,slpk:n,sevenZipExe:c,egmFilePath:i,draco:u,token:f,inputUrl:a,instantNodeWriting:h,mergeMaterials:v,inquirer:m,metadataClass:b},this.progresses[Mp]=new N1,this.compressList=this.options.instantNodeWriting&&[]||null,this.validate=Boolean(o),this.Loader=a.indexOf(hRt)!==-1?Q8:lc,this.generateTextures=Boolean(p),this.generateBoundingVolumes=Boolean(d),this.writeQueue=new L1(this.conversionDump),this.writeQueue.startListening(),console.log("Loading egm file..."),this.geoidHeightModel=await fn(i,r4),console.log("Loading egm file completed!"),n&&this.nodePages.useWriteFunction(yc);try{let E=await this._fetchPreloadOptions(),T=a;E.url&&(T=E.url),E.headers&&(this.loadOptions.fetch={headers:E.headers}),this.sourceTileset=await i4(T,this.Loader,this.loadOptions),(this.Loader===lc||_?await this.preprocessConversion():!0)&&!_&&await this.selectMetadataClass()&&(await this._createAndSaveTileset(s,r),await this._finishConversion({slpk:Boolean(n),outputPath:s,tilesetName:r}))}catch(E){throw E}finally{await this.writeQueue.finalize(),xa.getWorkerFarm({}).destroy()}return"success"}async preprocessConversion(){console.log("Analyze source tileset");let t=this.sourceTileset.root;await a4({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[Mp].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(m2(t))return await LN(this.sourceTileset,t,this.loadOptions),null;t.id&&(this.progresses[Mp].stepsTotal+=1,console.log(`[analyze]: ${t.id}`));let i=null;try{i=await qN(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 a=await cSe(i);return lSe(this.preprocessData,a),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,oa.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,oa.join)(n,"SceneServer","layers","0");let i=this.conversionDump.restored?(0,oa.join)(this.layers0Path,"nodepages"):n;try{await c2(i)}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,L4.default)(JSON.stringify(this.conversionDump.materialDefinitions[p]));this.materialMap.set(d,p)}this.materialDefinitions=this.conversionDump.materialDefinitions}let a=this.sourceTileset.root,o=Yb(a.boundingVolume,new zr(a.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=ZC(o,this.geoidHeightModel);await this.nodePages.push({index:0,lodThreshold:0,obb:s.obb,children:[]}),this.progresses[Mp].startMonitoring();let u=await iu.createRootNode(s,this);await a4({tile:a,traversalProps:{transform:new zr(a.transform),parentNodes:[u]},processTile:this.convertTile.bind(this),postprocessTile:this.finalizeTile.bind(this),maxDepth:this.options.maxDepth}),this.progresses[Mp].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=pRt),this.conversionDump.restored&&this.conversionDump.textureSetDefinitions&&(this.layers0.textureSetDefinitions=this.conversionDump.textureSetDefinitions),this.layers0.materialDefinitions=this.materialDefinitions,this.layers0.geometryDefinitions=(0,M4.default)(this.geometryConfigs.map(p=>({geometryConfig:{...p,draco:this.options.draco}})),rSe()),this.layersHasTexture===!1&&(this.layers0.store.defaultGeometrySchema.ordering=this.layers0.store.defaultGeometrySchema.ordering.filter(p=>p!=="uv0")),await this._writeLayers0(),YAe(r,this.layers0,n);for(let p of this.compressList||[])await YC(p),await l2(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 i=BAe(r);n&&(i.zmin=n[4],i.zmax=n[5]);let a=[i.xmin,i.ymin,i.xmax,i.ymax],o={version:`{${bc().toUpperCase()}}`,id:0,name:t,href:"./layers/0",store:{id:`{${bc().toUpperCase()}}`,extent:a},nodePages:{nodesPerPage:B6e},compressGeometry:this.options.draco,fullExtent:i};this.layers0=(0,M4.default)(o,tSe())}async _writeLayers0(){this.options.slpk?await this.writeQueue.enqueue({archiveKey:"3dSceneLayer.json.gz",writePromise:()=>yc(this.layers0Path,JSON.stringify(this.layers0),"3dSceneLayer.json")}):await this.writeQueue.enqueue({writePromise:()=>zn(this.layers0Path,JSON.stringify(this.layers0))})}async _createSlpk(t){if(await this.conversionDump.deleteDumpFile(),this.options.slpk){let r=(0,oa.join)(t,"SceneServer","layers","0"),n=`${t}.slpk`;await xN(r,n,async i=>({path:"@specialIndexFileHASH128@",file:await a2(i)}));try{await c2(t)}catch{}}}async convertTile(t,r){let n=m2(t);if(n||t.type==="empty")return n&&(t.id&&console.log(`[load]: ${t.id}`),await LN(this.sourceTileset,t,this.loadOptions)),r;t.id&&console.log(`[convert]: ${t.id}`);let{parentNodes:i,transform:a}=r,o=a.clone();t.transform&&(o=o.multiplyRight(t.transform));let s=i[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[Mp].stepsDone+=1;let f="Calculating time left...",p=this.progresses[Mp].getTimeRemainingString();p&&(f=`${p} left`);let d=this.progresses[Mp].getPercentString(),h=d?` ${d}%, ${f}`:"";console.log(`[converted${h}]: ${t.id}`)}return l}async finalizeTile(t,r){for(let n of t)for(let i of n.parentNodes)await i.addNeighbors();for(let n of r.parentNodes)await n.save()}async _generateNodeIndexDocument(t,r,n,i,a){this.layersHasTexture=this.layersHasTexture||Boolean("texture"in r&&r.texture||"texelCountHint"in r&&r.texelCountHint),this.generateBoundingVolumes&&r.boundingVolumes&&(t=r.boundingVolumes);let o=XAe(i,t),s=o.find(f=>f.metricType==="maxScreenThresholdSQ")||{maxError:0};if(a){let f={center:[],halfSize:[],quaternion:[]};await this.nodePages.push({index:0,obb:f},n.inPageId)}let u=await this._updateNodeInNodePages(s,t,i,n.inPageId,r),c=await iu.createNodeIndexDocument(n,t,o,u,r);return{node:await new iu(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 i=Yb(r.boundingVolume,n,null),a=ZC(i,this.geoidHeightModel),o=[];for(let s of this.conversionDump.tilesConverted[r.id].nodes){let{node:u}=await this._generateNodeIndexDocument(a,{...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 i=null;try{i=await qN(this.sourceTileset,r,this.loadOptions)}catch{console.log(`[warning]: Failed to load ${r.contentUrl}`)}let a=Yb(r.boundingVolume,n,null),o=ZC(a,this.geoidHeightModel),s=VAe(i,this.options.metadataClass);this.createAttributeStorageInfo(i,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:a,tileContent:i,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:v,nodeInPage:m,nodeData:b}=await this._generateNodeIndexDocument(o,h,t,r,!1);if(c.push(v),m.mesh){if(r.id){let _={boundingVolumes:h.boundingVolumes,attributesCount:(d=h.attributes)==null?void 0:d.length,featureCount:h.featureCount,geometry:Boolean(h.geometry),hasUvRegions:h.hasUvRegions,materialId:m.mesh.material.definition,texelCountHint:m.mesh.material.texelCountHint,vertexCount:h.vertexCount};this.conversionDump.setMaterialsDefinitions(this.materialDefinitions),await this.conversionDump.addNode(r.id,m.index,_)}await this._writeResources(h,v.id,r)}this.validate&&(this.boundingVolumeWarnings=aSe(b),this.boundingVolumeWarnings&&this.boundingVolumeWarnings.length&&console.warn("Bounding Volume Warnings: ",...this.boundingVolumeWarnings)),l.push(m.index),f.push(m)}return c}async _convertResources({sourceTile:t,transformationMatrix:r,boundingVolume:n,tileContent:i,parentId:a,propertyTable:o}){if(!this.isContentSupported(t)||!i)return null;let s={center:[],halfSize:[],quaternion:[]};return await kN({tileContent:i,tileTransform:r,tileBoundingVolume:n,addNodeToNodePage:async()=>(await this.nodePages.push({index:0,obb:s},a)).index,propertyTable:o,featuresHashArray:this.featuresHashArray,attributeStorageInfo:this.attributeMetadataInfo.attributeStorageInfo,draco:this.options.draco,generateBoundingVolumes:this.generateBoundingVolumes,shouldMergeMaterials:this.options.mergeMaterials,geoidHeightModel:this.geoidHeightModel,libraries:this.loadOptions.modules,metadataClass:this.options.metadataClass})}async _updateNodeInNodePages(t,r,n,i,a){let{vertexCount:o,featureCount:s,geometry:u,hasUvRegions:c}=a,l={index:0,lodThreshold:t.maxError,obb:r.obb,children:[]};u&&this.isContentSupported(n)&&(l.mesh={geometry:{definition:this.findOrCreateGeometryDefinition(Boolean("texture"in a&&a.texture||"texelCountHint"in a&&a.texelCountHint),c),resource:0},attribute:{resource:0},material:{definition:0}});let f="nodeId"in a?a.nodeId:void 0,p;if(f?p=await this.nodePages.getNodeById(f):p=await this.nodePages.push(l,i),l.mesh||console.log(`[warning]: node ${p.index} is created with empty content`),ra.updateAll(p,l),"meshMaterial"in a&&a.meshMaterial?ra.updateMaterialByNodeId(p,this._findOrCreateMaterial(a.meshMaterial)):"materialId"in a&&a.materialId!==null&&ra.updateMaterialByNodeId(p,a.materialId),"texture"in a&&a.texture){let d=a.texture.image.height*a.texture.image.width;ra.updateTexelCountHintByNodeId(p,d)}else"texelCountHint"in a&&a.texelCountHint&&ra.updateTexelCountHintByNodeId(p,a.texelCountHint);return o&&(this.vertexCounter+=o,ra.updateVertexCountByNodeId(p,o)),ra.updateNodeAttributeByNodeId(p),s&&ra.updateFeatureCountByNodeId(p,s),this.nodePages.saveNode(p),p}async _writeResources(t,r,n){let{geometry:i,compressedGeometry:a,texture:o,sharedResources:s,attributes:u}=t,c=(0,oa.join)(this.layers0Path,"nodes",r),l=(0,oa.join)("nodes",r);await this._writeGeometries({geometryBuffer:i,compressedGeometry:a,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:i,sourceId:a,nodeId:o}){if(t){if(this.conversionDump.updateDoneStatus(a,o,"GEOMETRY",!1),this.options.slpk){let s=(0,oa.join)(n,"geometries");await this.writeQueue.enqueue({archiveKey:`${i}/geometries/0.bin.gz`,sourceId:a,outputId:o,resourceType:"GEOMETRY",writePromise:()=>yc(s,t,"0.bin")})}else{let s=(0,oa.join)(n,"geometries/0/");await this.writeQueue.enqueue({sourceId:a,outputId:o,resourceType:"GEOMETRY",writePromise:()=>zn(s,t,"index.bin")})}if(this.options.draco&&r)if(this.conversionDump.updateDoneStatus(a,o,"DRACO_GEOMETRY",!1),this.options.slpk){let s=(0,oa.join)(n,"geometries");await this.writeQueue.enqueue({archiveKey:`${i}/geometries/1.bin.gz`,sourceId:a,outputId:o,resourceType:"DRACO_GEOMETRY",writePromise:()=>yc(s,r,"1.bin")})}else{let s=(0,oa.join)(n,"geometries/1/");await this.writeQueue.enqueue({sourceId:a,outputId:o,resourceType:"DRACO_GEOMETRY",writePromise:()=>zn(s,r,"index.bin")})}}}async _writeShared({sharedResources:t,childPath:r,slpkChildPath:n,nodePath:i,sourceId:a,nodeId:o}){if(!t)return;t.nodePath=i;let s=(0,M4.default)(t,nSe()),u=JSON.stringify(s);if(this.conversionDump.updateDoneStatus(a,o,"SHARED",!1),this.options.slpk){let c=(0,oa.join)(r,"shared");await this.writeQueue.enqueue({archiveKey:`${n}/shared/sharedResource.json.gz`,sourceId:a,outputId:o,resourceType:"SHARED",writePromise:()=>yc(c,u,"sharedResource.json")})}else{let c=(0,oa.join)(r,"shared/");await this.writeQueue.enqueue({sourceId:a,outputId:o,resourceType:"SHARED",writePromise:()=>zn(c,u)})}}async _writeTexture(t,r,n,i,a){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(i,a,`${"TEXTURE"}/${o}`,!1),await this.writeTextureFile({textureData:u,name:"0",format:o,childPath:r,slpkChildPath:n,sourceId:i,nodeId:a}),this.generateTextures){s.push({name:"1",format:"ktx2"});let c=t.image.data.subarray(),l=new Uint8Array(c),f=yg({...t.image,data:l},OL,{...OL.options,["ktx2-basis-writer"]:{workerUrl:"./modules/textures/dist/ktx2-basis-writer-worker-node.js"},reuseWorkers:!0,_nodeWorkers:!0,useLocalLibraries:!0});this.conversionDump.updateDoneStatus(i,a,`${"TEXTURE"}/ktx2`,!1),await this.writeTextureFile({textureData:f,name:"1",format:"ktx2",childPath:r,slpkChildPath:n,sourceId:i,nodeId:a})}break}case"ktx2":{if(s.push({name:"1",format:o}),this.conversionDump.updateDoneStatus(i,a,`${"TEXTURE"}/${o}`,!1),await this.writeTextureFile({textureData:u,name:"1",format:o,childPath:r,slpkChildPath:n,sourceId:i,nodeId:a}),this.generateTextures){s.push({name:"0",format:"jpg"});let c=yg(t.image.data[0],vL);this.conversionDump.updateDoneStatus(i,a,`${"TEXTURE"}/jpg`,!1),await this.writeTextureFile({textureData:c,name:"0",format:"jpg",childPath:r,slpkChildPath:n,sourceId:i,nodeId:a})}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:i,slpkChildPath:a,sourceId:o,nodeId:s}){if(this.options.slpk){let u=(0,oa.join)(i,"textures"),c=!1;await this.writeQueue.enqueue({archiveKey:`${a}/textures/${r}.${n}`,sourceId:o,outputId:s,resourceType:`${"TEXTURE"}/${n}`,writePromise:()=>yc(u,t,`${r}.${n}`,c)})}else{let u=(0,oa.join)(i,`textures/${r}/`);await this.writeQueue.enqueue({sourceId:o,outputId:s,resourceType:`${"TEXTURE"}/${n}`,writePromise:()=>zn(u,t,`index.${n}`)})}}async _writeAttributes(t=[],r,n,i,a){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]);if(this.conversionDump.updateDoneStatus(i,a,`${"ATTRIBUTES"}/${u}`,!1),this.options.slpk){let l=(0,oa.join)(r,"attributes",u);await this.writeQueue.enqueue({archiveKey:`${n}/attributes/${u}.bin.gz`,sourceId:i,outputId:a,resourceType:`${"ATTRIBUTES"}/${u}`,writePromise:()=>yc(l,c,"0.bin")})}else{let l=(0,oa.join)(r,`attributes/${u}/0`);await this.writeQueue.enqueue({sourceId:i,outputId:a,resourceType:`${"ATTRIBUTES"}/${u}`,writePromise:()=>zn(l,c,"index.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,L4.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},i=(0,L4.default)(JSON.stringify(n));if(this.geometryMap.has(i))return this.geometryMap.get(i)||0;let a=this.geometryConfigs.push(n)-1;return this.geometryMap.set(i,a),a}createAttributeStorageInfo(t,r){let n=null;this.options.metadataClass?!this.attributeMetadataInfo.attributeStorageInfo.length&&(t!=null&&t.gltf)&&(n=qAe(t.gltf,this.options.metadataClass)):r&&(n=LAe(r)),n&&this.attributeMetadataInfo.addMetadataInfo(n)}async _finishConversion(t){let{tilesCount:r,tilesWithAddRefineCount:n}=this.refinementCounter,i=n?n/r*100:0,a=await QC(t),o=Lh.default.hrtime(this.conversionStartTime),s=I1(o);console.log("------------------------------------------------"),console.log(`Finishing conversion of ${fRt}`),console.log(`Total conversion time: ${s}`),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",a," bytes"),console.log('Percentage of tiles with "ADD" refinement type:',i,"%"),console.log("------------------------------------------------")}async _fetchPreloadOptions(){if(!this.Loader.preload)return{};let t={"cesium-ion":{accessToken:this.options.token||lRt}},r=await this.Loader.preload(this.options.inputUrl,t);return this.refreshTokenTime=Lh.default.hrtime(),{...t,...r}}async _updateTilesetOptions(){if(Lh.default.hrtime(this.refreshTokenTime)[0]<dRt)return;this.refreshTokenTime=Lh.default.hrtime();let r=await this._fetchPreloadOptions();r.headers&&(this.loadOptions.fetch={...this.loadOptions.fetch,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 iTe=require("path"),wG=Lt(require("process"),1),aTe=Lt(ru(),1);function vG(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 O6e={UInt8:Tt.UNSIGNED_BYTE,UInt16:Tt.UNSIGNED_SHORT,Float32:Tt.FLOAT,UInt32:Tt.UNSIGNED_INT,UInt64:Tt.DOUBLE};function ev(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 I6e="String",R6e="Oid32",j6e="Float64",M6e="Int16";function q4(e){let t;try{let r=new URL(e);t=`${r.origin}${r.pathname}`}catch{}return t||e}function tv(e,t=null){return t?`${e}?token=${t}`:e}function L6e(e,t){let{attributeData:r=[]}=t,n=[];for(let i=0;i<r.length;i++){let a=r[i].href.replace("./","");n.push(`${e}/${a}`)}return n}function q6e(e,t,r){let n=[],{attributeStorageInfo:i=[]}=e;for(let a=0;a<i.length;a++){let o=i[a].key;n.push(`${t}/nodes/${r}/attributes/${o}/0`)}return n}var N4=new ce([0,0,0]);function gRt(e){switch(e){case"ktx-etc2":case"dds":return C8;case"ktx2":return th;case"jpg":case"png":default:return Ng}}var vRt="i3s-attribute-type";async function z6e(e,t,r,n,i){var o;let a={attributes:{},indices:null,featureIds:[],vertexCount:0,modelMatrix:new zr,coordinateSystem:0,byteLength:0,texture:null};if(t.textureUrl){let s=tv(t.textureUrl,(o=n==null?void 0:n.i3s)==null?void 0:o.token),u=gRt(t.textureFormat),f=await(await((i==null?void 0:i.fetch)||fetch)(s)).arrayBuffer();if(n!=null&&n.i3s.decodeTextures){if(u===Ng){let p={...t.textureLoaderOptions,image:{type:"data"}};try{let d=await ho(f,[],p,i);a.texture=d}catch{let h=await bo(f,u,p,i);a.texture=h}}else if(u===C8||u===th){let p=await fn(f,u,t.textureLoaderOptions);u===th&&(p=p[0]),a.texture={compressed:!0,mipmaps:!1,width:p[0].width,height:p[0].height,data:p}}}else a.texture=f}return a.material=TRt(t.materialDefinition,a.texture),a.material&&(a.texture=null),await xRt(e,a,t,r,n)}async function xRt(e,t,r,n,i){var f,p;let a=e.byteLength,o,s,u=0,c=0,l;if(r.isDracoGeometry){let d=await bo(e,Dg,{draco:{attributeNameEntry:vRt}});s=d.header.vertexCount,l=(f=d.indices)==null?void 0:f.value;let{POSITION:h,NORMAL:v,COLOR_0:m,TEXCOORD_0:b,["feature-index"]:_,["uv-region"]:E}=d.attributes;o={position:h,normal:v,color:m,uv0:b,uvRegion:E,id:_},bRt(o,d);let T=FRt(_);T&&kRt(o,T)}else{let{vertexAttributes:d,ordering:h,featureAttributes:v,featureAttributeOrder:m}=n.store.defaultGeometrySchema,b=_Rt(e,n);u=b.byteOffset,s=b.vertexCount,c=b.featureCount;let{attributes:_,byteOffset:E}=U6e(e,u,d,s,h),{attributes:T}=U6e(e,E,v,c,m);DRt(T),o=yRt(_,T)}if(!((p=i==null?void 0:i.i3s)!=null&&p.coordinateSystem)||i.i3s.coordinateSystem===2){let d=ERt(o.position,r);t.modelMatrix=d.invert(),t.coordinateSystem=2}else t.modelMatrix=SRt(o.position),t.coordinateSystem=3;t.attributes={positions:o.position,normals:o.normal,colors:N6e(o.color),texCoords:o.uv0,uvRegions:N6e(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=a,t}function bRt(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 yRt(e,t){return{...e,...t}}function N6e(e){return e&&(e.normalized=!0,e)}function _Rt(e,t){let r=0,n=0,i=0;for(let{property:a,type:o}of t.store.defaultGeometrySchema.header){let s=vG(o);switch(a){case"vertexCount".toString():n=new s(e,0,4)[0],r+=ev(o);break;case"featureCount".toString():i=new s(e,4,4)[0],r+=ev(o);break;default:break}}return{vertexCount:n,featureCount:i,byteOffset:r}}function U6e(e,t,r,n,i){let a={};for(let o of i)if(r[o]){let{valueType:s,valuesPerElement:u}=r[o];if(t+n*u*ev(s)<=e.byteLength){let c=e.slice(t),l;if(s==="UInt64")l=wRt(c,n*u,ev(s));else{let f=vG(s);l=new f(c,0,n*u)}switch(a[o]={value:l,type:O6e[s],size:u},o){case"color":a.color.normalized=!0;break;case"position":case"region":case"normal":default:}t=t+n*u*ev(s)}else if(o!=="uv0")break}return{attributes:a,byteOffset:t}}function wRt(e,t,r){let n=[],i=new DataView(e),a=0;for(let o=0;o<t;o++){let s=i.getUint32(a,!0),u=i.getUint32(a+4,!0),c=s+2**32*u;n.push(c),a+=r}return new Uint32Array(n)}function ERt(e,t){let r=t.mbs,n=e.value,i=e.metadata,a=new zr,o=new ce(r[0],r[1],r[2]),s=new ce;return Zt.WGS84.cartographicToCartesian(o,s),Zt.WGS84.eastNorthUpToFixedFrame(s,a),e.value=ARt(n,i,o),a}function ARt(e,t={},r){let n=new Float64Array(e.length),i=t["i3s-scale_x"]&&t["i3s-scale_x"].double||1,a=t["i3s-scale_y"]&&t["i3s-scale_y"].double||1;for(let o=0;o<n.length;o+=3)n[o]=e[o]*i+r.x,n[o+1]=e[o+1]*a+r.y,n[o+2]=e[o+2]+r.z;for(let o=0;o<n.length;o+=3)Zt.WGS84.cartographicToCartesian(n.subarray(o,o+3),N4),n[o]=N4.x,n[o+1]=N4.y,n[o+2]=N4.z;return n}function SRt(e){var a,o;let t=e.metadata,r=((a=t==null?void 0:t["i3s-scale_x"])==null?void 0:a.double)||1,n=((o=t==null?void 0:t["i3s-scale_y"])==null?void 0:o.double)||1,i=new zr;return i[0]=r,i[5]=n,i}function TRt(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=G6e(r.emissiveFactor)),r.pbrMetallicRoughness&&r.pbrMetallicRoughness.baseColorFactor&&(r.pbrMetallicRoughness.baseColorFactor=G6e(r.pbrMetallicRoughness.baseColorFactor)),t&&CRt(r,t),r}function G6e(e){let t=[...e];for(let r=0;r<e.length;r++)t[r]=e[r]/255;return t}function CRt(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 DRt(e){let{id:t,faceRange:r}=e;if(!t||!r)return;let n=t.value,i=r.value,a=i[i.length-1]+1,o=new Uint32Array(a*3),s=0,u=0;for(let c=1;c<i.length;c+=2){let l=Number(n[s]),f=i[c],p=i[c-1],d=f-p+1,h=u+d*3;o.fill(l,u,h),s++,u=h}e.id.value=o}function kRt(e,t){let r=e.id.value,n=new Float32Array(r.length);for(let i=0;i<r.length;i++)n[i]=t[r[i]];e.id.value=n}function FRt(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 BRt="4.2.0-alpha.6",H6e={dataType:null,batchType:null,name:"I3S Content (Indexed Scene Layers)",id:"i3s-content",module:"i3s",worker:!0,version:BRt,mimeTypes:["application/octet-stream"],parse:PRt,extensions:["bin"],options:{"i3s-content":{}}};async function PRt(e,t,r){let{tile:n,_tileOptions:i,tileset:a,_tilesetOptions:o}=(t==null?void 0:t.i3s)||{},s=i||n,u=o||a;return!s||!u?null:await z6e(e,s,u,t,r)}var ORt="4.2.0-alpha.6",W6e={dataType:null,batchType:null,name:"I3S Node Page",id:"i3s-node-page",module:"i3s",version:ORt,mimeTypes:["application/json"],parse:IRt,extensions:["json"],options:{i3s:{}}};async function IRt(e,t){return JSON.parse(new TextDecoder().decode(e))}var H2=class{tileset;nodePages=[];pendingNodePages=[];nodesPerPage;options;lodSelectionMetricType;textureDefinitionsSelectedFormats=[];nodesInNodePages;url;textureLoaderOptions={};constructor(t,r="",n){var i,a;this.tileset={...t},this.url=r,this.nodesPerPage=((i=t.nodePages)==null?void 0:i.nodesPerPage)||64,this.lodSelectionMetricType=(a=t.nodePages)==null?void 0:a.lodSelectionMetricType,this.options=n,this.nodesInNodePages=0,this.initSelectedFormatsForTextureDefinitions(t)}async getNodeById(t){var i;let r=Math.floor(t/this.nodesPerPage);if(!this.nodePages[r]&&!this.pendingNodePages[r]){let a=tv(`${this.url}/nodepages/${r}`,(i=this.options.i3s)==null?void 0:i.token);this.pendingNodePages[r]={status:"Pending",promise:fn(a,W6e,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=[],i=[];for(let d of r.children||[])i.push(this.getNodeById(d));let a=await Promise.all(i);for(let d of a)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:v,materialDefinition:m}=this.getInformationFromMaterial(r.mesh.material);u=m,c=v.format||c,v.name&&(s=`${this.url}/nodes/${r.mesh.material.resource}/textures/${v.name}`),this.tileset.attributeStorageInfo&&(l=q6e(this.tileset,this.url,r.mesh.attribute.resource))}let p=this.getLodSelection(r);return xG({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],i=-1;if(this.options.i3s&&this.options.i3s.useDracoGeometry&&(i=n.geometryBuffers.findIndex(a=>a.compressedAttributes&&a.compressedAttributes.encoding==="draco")),i===-1&&(i=n.geometryBuffers.findIndex(a=>!a.compressedAttributes)),i!==-1){let a=Boolean(n.geometryBuffers[i].compressedAttributes);r={url:`${this.url}/nodes/${t.resource}/geometries/${i}`,isDracoGeometry:a}}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,i,a;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=(a=(i=o==null?void 0:o.pbrMetallicRoughness)==null?void 0:i.baseColorTexture)==null?void 0:a.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 i of n){let a=i&&i.formats||[],o=null;for(let s of r){let u=a.find(c=>c.format===s);if(u){o=u;break}}o&&o.format==="ktx2"&&(this.textureLoaderOptions.basis={format:Kg(),containerFormat:"ktx2",module:"encoder"}),this.textureDefinitionsSelectedFormats.push(o)}}getSupportedTextureFormats(){let t=[];if(!this.options.i3s||this.options.i3s.useCompressedTextures){let r=uy();r.has("etc2")&&t.push("ktx-etc2"),r.has("dxt")&&t.push("dds"),t.push("ktx2")}return t.push("jpg"),t.push("png"),t}};function V6e(e,t){let r=t.url||"",n;e.geometryData&&(n=`${r}/${e.geometryData[0].href}`);let i;e.textureData&&(i=`${r}/${e.textureData[0].href}`);let a;e.attributeData&&(a=L6e(r,e));let o=e.children||[];return xG({...e,children:o,url:r,contentUrl:n,textureUrl:i,textureFormat:"jpg",attributeUrls:a,isDracoGeometry:!1})}function xG(e){var s,u;let t={},r=[0,0,0,1];if(e.mbs)r=e.mbs,t.sphere=[...Zt.WGS84.cartographicToCartesian(e.mbs.slice(0,3)),e.mbs[3]];else if(e.obb){t.box=[...Zt.WGS84.cartographicToCartesian(e.obb.center),...e.obb.halfSize,...e.obb.quaternion];let l=new Ii().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,i=(u=e.lodSelection)==null?void 0:u[0].maxError,a="mesh",o=2;return{...e,mbs:r,boundingVolume:t,lodMetricType:n,lodMetricValue:i,type:a,refine:o}}async function $6e(e,t,r){let n=q4(r.url||""),i,a;if(e.nodePages)i=new H2(e,n,t),a=await i.formTileFromNodePages(0);else{let o=t.i3s,s=tv(`${n}/nodes/root`,o.token);a=await fn(s,ql,{...t,i3s:{...t.i3s,loadContent:!1,isTileHeader:!0,isTileset:!1}})}return{...e,loader:ql,url:n,basePath:n,type:"I3S",nodePagesTile:i,root:a,lodMetricType:a.lodMetricType,lodMetricValue:a.lodMetricValue}}var RRt="4.2.0-alpha.6",jRt=/layers\/[0-9]+$/,MRt=/\.slpk$/,LRt=/nodes\/([0-9-]+|root)$/,qRt="504b0304",NRt="PointCloud",ql={dataType:null,batchType:null,name:"I3S (Indexed Scene Layers)",id:"i3s",module:"i3s",version:RRt,mimeTypes:["application/octet-stream"],parse:URt,extensions:["bin"],options:{i3s:{token:null,isTileset:"auto",isTileHeader:"auto",tile:null,tileset:null,_tileOptions:null,_tilesetOptions:null,useDracoGeometry:!0,useCompressedTextures:!0,decodeTextures:!0,coordinateSystem:2}}};async function URt(e,t={},r){let n=r.url;if(t.i3s=t.i3s||{},WRt(e)===qRt)throw new Error("Files with .slpk extention currently are not supported by I3SLoader");let a=q4(n),o;t.i3s.isTileset==="auto"?o=jRt.test(a)||MRt.test(a):o=t.i3s.isTileset;let s;return t.isTileHeader==="auto"?s=LRt.test(a):s=t.i3s.isTileHeader,o?e=await zRt(e,t,r):s?e=await HRt(e,r):e=await GRt(e,t),e}async function GRt(e,t){return await bo(e,H6e,t)}async function zRt(e,t,r){let n=JSON.parse(new TextDecoder().decode(e));if((n==null?void 0:n.layerType)===NRt)throw new Error("Point Cloud layers currently are not supported by I3SLoader");return await $6e(n,t,r)}async function HRt(e,t){return e=JSON.parse(new TextDecoder().decode(e)),V6e(e,t)}function WRt(e){return e instanceof ArrayBuffer?[...new Uint8Array(e,0,4)].map(t=>t.toString(16).padStart(2,"0")).join(""):null}var VRt=[{test:/^$/,extensions:["3dSceneLayer.json.gz"]},{test:/^nodepages\/\d+$/,extensions:[".json.gz"]},{test:/^nodes\/(\d+|root)$/,extensions:["/3dNodeIndexDocument.json.gz"]},{test:/^nodes\/\d+\/textures\/.+$/,extensions:[".jpg",".png",".bin.dds.gz",".ktx"]},{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+$/,extensions:[".json.gz"]},{test:/^nodes\/\d+\/shared$/,extensions:["/sharedResource.json.gz"]}],U4=class extends Il{hashTable;_textEncoder=new TextEncoder;_textDecoder=new TextDecoder;_md5Hash=new Nu;constructor(t,r,n){super(t,r,n),this.hashTable=r}async getFile(t,r="raw"){var n;if(r==="http"){let i=(n=VRt.find(a=>a.test.test(t)))==null?void 0:n.extensions;if(i){let a;for(let o of i)if(a=await this.getDataByPath(`${t}${o}`),a)break;if(a)return a}}if(r==="raw"){let i=await this.getDataByPath(`${t}.gz`);if(i)return i;let a=await this.getFileBytes(t);if(a)return a}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 n2().decompress(r):r}async getFileBytes(t){let r;if(this.hashTable){let n=this._textEncoder.encode(t),i=await this._md5Hash.hash(n.buffer,"hex"),a=this.hashTable[i];if(a===void 0)return;let o=await tu(a,this.fileProvider);if(!o)return;r=await this.fileProvider.slice(o.fileDataOffset,o.fileDataOffset+o.compressedSize)}else try{r=await this.getFileWithoutHash(t)}catch{r=void 0}return r}};async function bG(e,t,r){let n=await wh(e,Ah),i=await Eh(n,e),a;if((i==null?void 0:i.fileName)!=="@specialIndexFileHASH128@")a=await bN(e),t==null||t("SLPK doesnt contain hash file, hash info has been composed according to zip archive headers");else{let o=await tu(i.localHeaderOffset,e);if(!o)throw new Error("corrupted SLPK");let s=o.fileDataOffset,u=await e.slice(s,s+o.compressedSize);a=i2(u)}return new U4(e,a,r)}function J6e(e,t){let{attributeName:r,attributeType:n}=t;return r?{[r]:n?$Rt(n,e):null}:{}}function $Rt(e,t){switch(e){case I6e:return YRt(t);case R6e:return K6e(t);case j6e:return JRt(t);case M6e:return KRt(t);default:return K6e(t)}}function K6e(e){return new Uint32Array(e,4)}function KRt(e){return new Int16Array(e,4)}function JRt(e){return new Float64Array(e,8)}function YRt(e){let i=[];try{let a=new DataView(e,0,4).getUint32(0,!0),o=new Uint32Array(e,8,a),s=8+a*4;for(let u of o){let c=new TextDecoder("utf-8"),l=new Uint8Array(e,s,u);i.push(c.decode(l)),s+=u}}catch(a){console.error("Parse string attribute error: ",a.message)}return i}var XRt="4.2.0-alpha.6";var yG={dataType:null,batchType:null,name:"I3S Attribute",id:"i3s-attribute",module:"i3s",version:XRt,mimeTypes:["application/binary"],parse:async(e,t)=>J6e(e,t),extensions:["bin"],options:{},binary:!0};function _G(e,t){let r=[e.center[0],e.center[1],e.center[2]+t.getHeight(e.center[1],e.center[0])],n=Zt.WGS84.cartographicToCartesian(r,new ce),i=new Ii().fromCenterHalfSizeQuaternion(n,e.halfSize,e.quaternion);return[...i.center,...i.halfAxes.toArray()]}var G4=Lt(ru(),1),QRt=()=>({version:{path:"version",default:"1.0"}}),Y6e=()=>({boundingVolume:{path:"boundingVolume"},geometricError:{path:"geometricError"},refine:{path:"refine"},content:{path:"content"},children:{path:"children",transform:e=>e.map(t=>(0,G4.default)(t,Y6e()))}}),X6e=()=>({asset:{path:"asset",transform:e=>(0,G4.default)(e,QRt())},geometricError:{path:"root",transform:e=>e.geometricError},root:{path:"root",transform:e=>(0,G4.default)(e,Y6e())}});function Q6e(e,t){let r=new Float32Array(e.length),n=ejt(t);for(let i=0;i<e.length;i+=2){let a=e.subarray(i,i+2),o=n.slice(i*2,i*2+4),s=ZRt([a[0],a[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[i]=l[0],r[i+1]=l[1]}return r}function ZRt(e){return[e[0]-Math.floor(e[0]),e[1]-Math.floor(e[1])]}function ejt(e){let r=[];for(let n=0;n<e.length;n++)r[n]=e[n]/65535;return r}var tjt=new zr([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),Z6e=new ce,eTe="KHR_materials_unlit",rjt=1,njt=1,W2=class{rtcCenter;i3sTile;async convert(t,r=null){let n=await this.buildGLTF(t,r);return TT({gltfEncoded:new Uint8Array(n),type:"b3dm",featuresLength:this._getFeaturesLength(r),batchTable:r},wN)}async buildGLTF(t,r){let{tileContent:n,textureFormat:i,box:a}=t,{material:o,attributes:s,indices:u,modelMatrix:c}=n,l=new br,f=await this._addI3sTextureToGLTF(n,i,l),p=o==null?void 0:o.pbrMetallicRoughness;p&&(p.metallicFactor===void 0||p.metallicFactor===rjt)&&(p.roughnessFactor===void 0||p.roughnessFactor===njt)&&(l.addObjectExtension(o,eTe,{}),l.addExtension(eTe));let d=this._convertI3sMaterialToGLTFMaterial(o,f),h=l.addMaterial(d),v=s.positions,m=v.value;s.uvRegions&&s.texCoords&&(s.texCoords.value=Q6e(s.texCoords.value,s.uvRegions.value));let b=new ce(a),_=Zt.WGS84.cartesianToCartographic(b,new ce);s.positions.value=this._normalizePositions(m,b,_,c),this._createBatchIds(n,r),s.normals&&!this._checkNormals(s.normals.value)&&delete s.normals;let E=u||e4(m.length/v.size),T=l.addMesh({attributes:s,indices:E,material:h,mode:4}),S=this._generateTransformMatrix(b),D=l.addNode({meshIndex:T,matrix:S}),I=l.addScene({nodeIndices:[D]});return l.setDefaultScene(I),l.createBinaryChunk(),TT(l.gltf,QL)}async _addI3sTextureToGLTF(t,r,n){let{texture:i,material:a,attributes:o}=t,s=null,u=i;if(!i&&a&&(u=a.pbrMetallicRoughness&&a.pbrMetallicRoughness.baseColorTexture&&a.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,i){let a=new Float32Array(t.length);for(let o=0;o<t.length;o+=3){let s=t.subarray(o,o+3),u=new ce(r),c=new ce(Array.from(s)).transform(i).add(n);Zt.WGS84.cartographicToCartesian(c,Z6e),c=Z6e.subtract(u),a.set(c,o)}return a}_generateTransformMatrix(t){return new zr().translate(t).multiplyLeft(tjt)}_createBatchIds(t,r){let{featureIds:n}=t,{OBJECTID:i}=r||{};if(!(!n||!i)){for(let a=0;a<n.length;a++){let o=n[a],s=i.indexOf(o);n[a]=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 tTe=async(e,t,r,n)=>{if(!e||!t.contentUrl)return null;let i={...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 V2(t.contentUrl,ql,i,n)};async function rTe(e){let t=e.split(".slpk");if(t.length===2){let r=`${t[0]}.slpk`,n=new vo(r),i=await bG(n,void 0,r);return new Ol(i)}return null}async function V2(e,t,r,n){return n!==null?await fn(e,t,{...r,fetch:n.fetch.bind(n)}):await fn(e,t,r)}async function nTe(e){if(!(e!=null&&e.fileProvider))return 0;let t=0,r=xc(e.fileProvider);for await(let n of r)n.fileName.indexOf("3dNodeIndexDocument.json.gz")>=0&&t++;return t}var ijt="I3S",rv=class{options;tilesetPath;vertexCounter;conversionStartTime;geoidHeightModel;sourceTileset;attributeStorageInfo;workerSource={};slpkFilesystem=null;loaderOptions={_nodeWorkers:!0,reuseWorkers:!0,worker:!1,i3s:{coordinateSystem:3,decodeTextures:!1},"i3s-content":{workerUrl:"./modules/i3s/dist/i3s-content-worker-node.js"}};conversionDump;progress;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 Mh,this.progress=new N1}async convert(t){var h;if(jr)return console.log(q1),q1;let{inputUrl:r,outputPath:n,tilesetName:i,maxDepth:a,egmFilePath:o,inquirer:s,analyze:u}=t;this.conversionStartTime=wG.default.hrtime(),this.options={maxDepth:a,inquirer:s},console.log("Loading egm file..."),this.geoidHeightModel=await fn(o,r4),console.log("Loading egm file completed!"),this.slpkFilesystem=await rTe(r);let c=!0;if((u||this.slpkFilesystem)&&(c=await this.preprocessConversion(),!c||u)||(this.progress.startMonitoring(),this.sourceTileset=await V2(r,ql,{...this.loaderOptions,i3s:{...this.loaderOptions.i3s,isTileset:!0}},this.slpkFilesystem),!this.sourceTileset))return;let l=(h=this.sourceTileset)==null?void 0:h.root;if(l.obb||(l.obb=DN(l.mbs)),this.tilesetPath=(0,iTe.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 c2(this.tilesetPath)}catch{}let f={boundingVolume:{box:_G(l.obb,this.geoidHeightModel)},geometricError:BN(l),children:[],refine:"REPLACE"};await this._addChildren(l,f,1);let p=(0,aTe.default)({root:f},X6e());await zn(this.tilesetPath,JSON.stringify(p),"tileset.json"),await this.conversionDump.deleteDumpFile(),this.progress.stopMonitoring(),await this._finishConversion({slpk:!1,outputPath:n,tilesetName:i}),this.slpkFilesystem&&this.slpkFilesystem.destroy(),xa.getWorkerFarm({}).destroy()}async preprocessConversion(){console.log("Analyze source layer");let t=await nTe(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,i){let a=r,o=await this._loadChildNode(t,i);if(o.contentUrl){if(this.conversionDump.restored&&this.conversionDump.isFileConversionComplete(`${o.id}.b3dm`)&&(o.obb||o.mbs)){let{child:_}=this._createChildAndBoundingVolume(o);r.children.push(_),await this._addChildren(o,_,n+1);return}let f=await tTe(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),v={tileContent:f,box:h.box||[],textureFormat:o.textureFormat},b=await new W2().convert(v,p);await this.conversionDump.addNode(`${o.id}.b3dm`,o.id),await zn(this.tilesetPath,new Uint8Array(b),`${o.id}.b3dm`),await this.conversionDump.updateConvertedNodesDumpFile(`${o.id}.b3dm`,o.id,!0),r.children.push(d),a=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}]: ${i.id}`),await this._addChildren(o,a,n+1)}async _addChildren(t,r,n){if(!(this.options.maxDepth&&n>this.options.maxDepth))for(let i of t.children||[])await this.convertChildNode(t,r,n,i)}async _loadChildNode(t,r){var i;let n;if((i=this.sourceTileset)!=null&&i.nodePagesTile)console.log(`Node conversion: ${r.id}`),n=await this.sourceTileset.nodePagesTile.formTileFromNodePages(parseInt(r.id));else{let a=this._relativeUrlToFullUrl(t.url,r.href),o={i3s:{...this.loaderOptions,isTileHeader:!0,loadContent:!1}};console.log(`Node conversion: ${a}`),n=await V2(a,ql,o,this.slpkFilesystem)}return n}_createChildAndBoundingVolume(t){t.obb||(t.obb=DN(t.mbs));let r={box:_G(t.obb,this.geoidHeightModel)},n={boundingVolume:r,geometricError:BN(t),children:[],content:{uri:`${t.id}.b3dm`,boundingVolume:r}};return{boundingVolume:r,child:n}}_relativeUrlToFullUrl(t="",r){let n=t.split("/"),i=r.split("/");for(let a of i)switch(a){case".":continue;case"..":n=n.slice(0,-1);break;default:n.push(a)}return n.join("/")}async _loadChildAttributes(t,r){let n=[],{attributeUrls:i=[]}=t;for(let o=0;o<i.length;o++){let s=i[o],u=r[o],c={attributeName:u.name,attributeType:this._getAttributeType(u)};n.push(V2(s,yG,c,this.slpkFilesystem))}let a=await Promise.all(n);return this._replaceNestedArrays(a),Object.assign({},...a)}_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 i in n)n[i]=Array.from(n[i])}}async _finishConversion(t){let r=await QC(t),n=wG.default.hrtime(this.conversionStartTime),i=I1(n);console.log("------------------------------------------------"),console.log(`Finish conversion of ${ijt}`),console.log(`Total conversion time: ${i}`),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",r," bytes"),console.log("------------------------------------------------")}};var nv=require("path");var ajt="4.2.0-alpha.6",ojt="https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip",z4=class{async install(t=""){console.log('Installing "EGM2008-5" model...');let r=await fn(ojt,dN,{}),n=process.cwd();t&&(n=(0,nv.join)(n,t)),await zn(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(op[Gn.DECODER],"draco",Gn.DECODER),await this.installFromUrl(op[Gn.DECODER_WASM],"draco",Gn.DECODER_WASM),console.log('Installing "Draco encoder" library'),await this.installFromUrl(op[Gn.ENCODER],"draco",Gn.ENCODER),console.log('Installing "Basis transcoder" library'),await this.installFromNpm("textures",sc.TRANSCODER,"libs"),await this.installFromNpm("textures",sc.TRANSCODER_WASM,"libs"),console.log('Installing "Basis encoder" library'),await this.installFromNpm("textures",sc.ENCODER,"libs"),await this.installFromNpm("textures",sc.ENCODER_WASM,"libs"),console.log('Installing "join-images" npm package');let i=new N0,a=(0,nv.dirname)(process.execPath);await i.start({command:`${a}/${process.platform==="win32"?"npm.cmd":"npm"}`,arguments:["install","sharp@0.30.4","join-images@1.1.3"],wait:0,ignoreStderr:!0}),console.log("All dependencies were installed succesfully.")}async installFromNpm(t,r,n=""){let i=await Pa(`https://unpkg.com/@loaders.gl/${t}@${ajt}/dist/${n}/${r}`);if(i.status<200||i.status>=300)throw new Error(`Failed to load resource ${r}`);let a=await i.arrayBuffer();if(!a)return;let o=(0,nv.join)(process.cwd(),"modules",t,"dist",n);await zn(o,a,r)}async installFromUrl(t,r,n){let a=await(await Pa(t)).arrayBuffer();if(!a)return;let o=(0,nv.join)(process.cwd(),"modules",r,"dist","libs");await zn(o,a,n)}};function lu(e,t){if(e+1>=t.length)return"";let r=t[e+1];return r.indexOf("--")===0?"":r}function oTe(e,t){let r=lu(e,t);return console.log(`Input tileset value: ${r}`),console.log(`Modified tileset value: ${r.replace(/\\/g,"/")}`),r.replace(/\\/g,"/")}function sTe(e){return e.reduce((t,r)=>{let n=r.indexOf("="),i=r.slice(0,n),a=r.slice(n+1,r.length);return r.includes("=")&&r.startsWith("--")&&a?t.concat(i,a):t.concat(r)},[])}function uTe(e,t){let r=lu(e,t),n=Number.parseInt(r);return isFinite(n)?n:NaN}function hs(e,t){let r=lu(e,t).toLowerCase().trim();return["--no-draco","--split-nodes"].includes(t[e])&&!r?!1:!r||r==="true"}var fTe=require("fs/promises"),EG={I3S:"I3S",_3DTILES:"3DTILES"};async function sjt(){let[,,...e]=process.argv;e.length===0&&AG();let t=sTe(e),r=cjt(t);if(r.installDependencies){new z4().install("deps");return}if(r.addHash){let i=cTe(r,!0),a=i.tileset;if(!r.quiet)if(i.output==="data"){let s=i.tileset.substring(0,i.tileset.length-5);(await H4.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&&(a=`${s}-hash.slpk`)}else a=i.output;a!==i.tileset&&await(0,fTe.copyFile)(i.tileset,a);let o=await a2(xc(new vo(a)));await vN(a,o,"@specialIndexFileHASH128@");return}let n=cTe(r);await ujt(n)}sjt().catch(e=>{console.log(e),process.exit(1)});function AG(){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 reduce memory usage but decelerates conversion speed]"),console.log("--split-nodes [Prevent to merge similar materials that could lead to incorrect visualization (I3S to 3DTiles conversion only)]"),console.log("--slpk [Generate slpk (Scene Layer Packages) I3S output file]"),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('--7zExe [location of 7z.exe archiver to create slpk on Windows, default: "C:\\Program Files\\7-Zip\\7z.exe"]'),console.log('--egm [location of Earth Gravity Model *.pgm file to convert heights from ellipsoidal to gravity-related format. 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 ujt(e){switch(console.log("------------------------------------------------"),console.log(`Starting conversion of ${e.inputType}`),console.log("------------------------------------------------"),e.inputType.toUpperCase()){case EG.I3S:await new rv().convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,egmFilePath:e.egm,analyze:e.analyze,inquirer:e.quiet?void 0:H4.default});break;case EG._3DTILES:await new Z1().convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,slpk:e.slpk,sevenZipExe:e.sevenZipExe,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:H4.default});break;default:AG()}}function cTe(e,t){let r={name:{getMessage:()=>console.log("Missed: --name [Tileset name]"),condition:i=>t||Boolean(i)||Boolean(e.analyze)},output:{getMessage:()=>console.log("Missed: --output [Output path name]")},sevenZipExe:{getMessage:()=>console.log("Missed: --7zExe [7z archiver executable path]")},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:i=>t||Boolean(i)&&Object.values(EG).includes(i.toUpperCase())}},n=[];for(let i in r){let a=e[i],o=r[i].condition;(o?o(a):a)||n.push(r[i].getMessage)}return n.length&&(n.forEach(i=>i()),process.exit(1)),e}function cjt(e){let t={output:"data",instantNodeWriting:!1,mergeMaterials:!0,sevenZipExe:"C:\\Program Files\\7-Zip\\7z.exe",egm:(0,lTe.join)(process.cwd(),"deps","egm2008-5.pgm"),draco:!0,installDependencies:!1,generateTextures:!1,generateBoundingVolumes:!1,validate:!1,slpk:!1,addHash:!1,quiet:!1};return e.forEach((r,n)=>{if(r.indexOf("--")===0)switch(r){case"--input-type":t.inputType=lu(n,e);break;case"--tileset":t.tileset=oTe(n,e);break;case"--name":t.name=lu(n,e);break;case"--output":t.output=lu(n,e);break;case"--instant-node-writing":t.instantNodeWriting=hs(n,e);break;case"--split-nodes":t.mergeMaterials=hs(n,e);break;case"--max-depth":t.maxDepth=uTe(n,e);break;case"--slpk":t.slpk=hs(n,e);break;case"--add-hash":t.addHash=hs(n,e);break;case"--7zExe":t.sevenZipExe=lu(n,e);break;case"--egm":t.egm=lu(n,e);break;case"--token":t.token=lu(n,e);break;case"--no-draco":t.draco=hs(n,e);break;case"--validate":t.validate=hs(n,e);break;case"--install-dependencies":t.installDependencies=hs(n,e);break;case"--generate-textures":t.generateTextures=hs(n,e);break;case"--generate-bounding-volumes":t.generateBoundingVolumes=hs(n,e);break;case"--analyze":t.analyze=hs(n,e);break;case"--quiet":t.quiet=hs(n,e);break;case"--metadata-class":t.metadataClass=lu(n,e);break;case"--help":AG();break;default:console.warn(`Unknown option ${r}`),process.exit(0)}}),t}
|
|
161
|
+
`).forEach(s=>{let u=a.exec(s);u&&i.push(Number(u[1]))});let o=e;for(;i.includes(o);)o++;t(o)})})}var fre={command:"",arguments:[],port:5e3,autoPort:!0,wait:2e3,onSuccess:e=>{console.log(`Started ${e.props.command}`)}},N0=class{id;props={...fre};childProcess=null;port=0;successTimer;constructor({id:t="browser-driver"}={}){this.id=t}async start(t){t={...fre,...t},this.props=t;let r=[...t.arguments];return this.port=Number(t.port),t.portArg&&(t.autoPort&&(this.port=await lre(t.port)),r.push(t.portArg,String(this.port))),await new Promise((n,i)=>{try{this._setTimeout(()=>{t.onSuccess&&t.onSuccess(this),n({})}),console.log(`Spawning ${t.command} ${t.arguments.join(" ")}`);let a=pre.spawn(t.command,r,t.spawn);this.childProcess=a,a.stdout.on("data",o=>{console.log(o.toString())}),a.stderr.on("data",o=>{console.log(`Child process wrote to stderr: "${o}".`),t.ignoreStderr||(this._clearTimeout(),i(new Error(o)))}),a.on("error",o=>{console.log(`Child process errored with ${o}`),this._clearTimeout(),i(o)}),a.on("close",o=>{console.log(`Child process exited with ${o}`),this.childProcess=null,this._clearTimeout(),n({})})}catch(a){i(a)}})}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 kB(e,t){return!xa.isSupported()||!Di&&!(t!=null&&t._nodeWorkers)?!1:e.worker&&(t==null?void 0:t.worker)}async function FB(e,t,r,n,i){let a=e.id,o=Ax(e,r),u=xa.getWorkerFarm(r).getWorkerPool({name:a,url:o});r=JSON.parse(JSON.stringify(r)),n=JSON.parse(JSON.stringify(n||{}));let c=await u.startJob("process-on-worker",F7e.bind(null,i));return c.postMessage("process",{input:t,options:r,context:n}),await(await c.result).result}async function F7e(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:i,input:a,options:o}=n;try{let s=await e(a,o);t.postMessage("done",{id:i,result:s})}catch(s){let u=s instanceof Error?s.message:"unknown error";t.postMessage("error",{id:i,error:u})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function BB(e,t){return!xa.isSupported()||!jr&&!(t!=null&&t._nodeWorkers)?!1:e.worker&&(t==null?void 0:t.worker)}function hre(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?dre(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?dre(e,0,t):""}function dre(e,t,r){if(e.byteLength<=t+r)return"";let n=new DataView(e),i="";for(let a=0;a<r;a++)i+=String.fromCharCode(n.getUint8(t+a));return i}function PB(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${hre(e)}"`)}}function Mu(e,t,r){if(r=r||e.byteLength,e.byteLength<r||t.byteLength<r)return!1;let n=new Uint8Array(e),i=new Uint8Array(t);for(let a=0;a<n.length;++a)if(n[a]!==i[a])return!1;return!0}function qn(...e){return uE(e)}function uE(e){let t=e.map(a=>a instanceof ArrayBuffer?new Uint8Array(a):a),r=t.reduce((a,o)=>a+o.byteLength,0),n=new Uint8Array(r),i=0;for(let a of t)n.set(a,i),i+=a.byteLength;return n.buffer}function mo(...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),i=new r(n),a=0;for(let o of t)i.set(o,a),a+=o.length;return i}function md(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 go(e,t){return Rt(e>=0),Rt(t>0),e+(t-1)&~(t-1)}function OB(e,t,r){let n;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else{let i=e.byteOffset,a=e.byteLength;n=new Uint8Array(e.buffer||e.arrayBuffer,i,a)}return t.set(n,r),r+go(n.byteLength,4)}function IB(e,t){let r=e.length,i=Math.ceil(r/t)*t-r,a="";for(let o=0;o<i;++o)a+=" ";return e+a}function U0(e,t,r,n){if(e)for(let i=0;i<n;i++)e.setUint8(t+i,r.charCodeAt(i));return t+n}function Sx(e,t,r,n){if(e)for(let i=0;i<n;i++)e.setUint8(t+i,r[i]);return t+n}function cE(e,t,r,n){let i=go(r.byteLength,n),a=i-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<a;++u)e.setUint8(t+r.byteLength+u,32)}return t+=i,t}function G0(e,t,r,n){let a=new TextEncoder().encode(r);return t=cE(e,t,a,n),t}async function gd(e){let t=[];for await(let r of e)t.push(r);return qn(...t)}var B7e="",mre={};function Lu(e){for(let t in mre)if(e.startsWith(t)){let r=mre[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${B7e}${e}`),e}var P7e="4.2.0-beta.2",RB={dataType:null,batchType:null,name:"JSON",id:"json",module:"json",version:P7e,extensions:["json","geojson"],mimeTypes:["application/json"],category:"json",text:!0,parseTextSync:gre,parse:async e=>gre(new TextDecoder().decode(e)),options:{}};function gre(e){return JSON.parse(e)}function vre(e){return Buffer.isBuffer(e)?new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer:e}function xre(e){return e&&typeof e=="object"&&e.isBuffer}function Hc(e){if(xre(e))return vre(e);if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.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 z0(e){return t=>new Promise((r,n)=>e(t,(i,a)=>i?n(i):r(a)))}var $a={};ui($a,{dirname:()=>R7e,filename:()=>I7e,join:()=>j7e,resolve:()=>M7e});function bre(){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 I7e(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function R7e(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function j7e(...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 M7e(...e){let t=[];for(let a=0;a<e.length;a++)t[a]=e[a];let r="",n=!1,i;for(let a=t.length-1;a>=-1&&!n;a--){let o;a>=0?o=t[a]:(i===void 0&&(i=bre()),o=i),o.length!==0&&(r=`${o}/${r}`,n=o.charCodeAt(0)===Tx)}return r=L7e(r,!n),n?`/${r}`:r.length>0?r:"."}var Tx=47,jB=46;function L7e(e,t){let r="",n=-1,i=0,a,o=!1;for(let s=0;s<=e.length;++s){if(s<e.length)a=e.charCodeAt(s);else{if(a===Tx)break;a=Tx}if(a===Tx){if(!(n===s-1||i===1))if(n!==s-1&&i===2){if(r.length<2||!o||r.charCodeAt(r.length-1)!==jB||r.charCodeAt(r.length-2)!==jB){if(r.length>2){let u=r.length-1,c=u;for(;c>=0&&r.charCodeAt(c)!==Tx;--c);if(c!==u){r=c===-1?"":r.slice(0,c),n=s,i=0,o=!1;continue}}else if(r.length===2||r.length===1){r="",n=s,i=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,i=0}else a===jB&&i!==-1?++i:i=-1}return r}var Cx=new Error("Not implemented"),Wc=class{handle;size=0;bigsize=0n;url="";constructor(t,r,n){var i;if((i=globalThis.loaders)!=null&&i.NodeFile)return new globalThis.loaders.NodeFile(t,r,n);throw jr?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 Cx}async write(t,r,n){throw Cx}async stat(){throw Cx}async truncate(t){throw Cx}async append(t){throw Cx}async close(){}};var H0=new Error("Not implemented"),Dx=class{constructor(t){var r;if((r=globalThis.loaders)!=null&&r.NodeFileSystem)return new globalThis.loaders.NodeFileSystem(t);throw jr?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 MB=e=>(e==null?void 0:e.getUint8)&&(e==null?void 0:e.slice)&&(e==null?void 0:e.length);var vo=class{file;constructor(t,r=!1){this.file=new Wc(t,r?"a+":"r")}async truncate(t){await this.file.truncate(t)}async append(t){await this.file.append(t)}async destroy(){await this.file.close()}async getUint8(t){let r=await this.file.read(t,1),n=new Uint8Array(r).at(0);if(n===void 0)throw new Error("something went wrong");return n}async getUint16(t){let r=await this.file.read(t,2),n=new Uint16Array(r).at(0);if(n===void 0)throw new Error("something went wrong");return n}async getUint32(t){let r=await this.file.read(t,4),n=new Uint32Array(r).at(0);if(n===void 0)throw new Error("something went wrong");return n}async getBigUint64(t){let r=await this.file.read(t,8),n=new BigInt64Array(r).at(0);if(n===void 0)throw new Error("something went wrong");return n}async slice(t,r){let n=r-t;if(n>Number.MAX_SAFE_INTEGER)throw new Error("too big slice");let i=Number(n);return await this.file.read(t,i)}get length(){return this.file.bigsize}};var Vc=Lt(require("fs"),1),vd=class{handle;size;bigsize;url;constructor(t,r,n){t=Lu(t),this.handle=Vc.default.openSync(t,r,n);let i=Vc.default.fstatSync(this.handle,{bigint:!0});this.size=Number(i.size),this.bigsize=i.size,this.url=t}async close(){return new Promise((t,r)=>{Vc.default.close(this.handle,n=>n?r(n):t())})}async truncate(t){return new Promise((r,n)=>{Vc.default.ftruncate(this.handle,t,i=>{i?n(i):(this.bigsize=BigInt(t),this.size=Number(this.bigsize),r())})})}async append(t){return new Promise((r,n)=>{Vc.default.appendFile(this.handle,t,i=>{i?n(i):(this.bigsize=this.bigsize+BigInt(t.length),this.size=Number(this.bigsize),r())})})}async stat(){return await new Promise((t,r)=>Vc.default.fstat(this.handle,{bigint:!0},(n,i)=>{let a={size:Number(i.size),bigsize:i.size,isDirectory:i.isDirectory()};n?r(n):t(a)}))}async read(t,r){let n=new ArrayBuffer(r),i=BigInt(t),a=0,o=new Uint8Array(n),s;for(;r>0;){let u=await N7e(this.handle,o,0,r,i);if(u===0)break;a+=u,i+=BigInt(u),r-=u,s!==void 0&&(s+=u)}return a<r?n.slice(0,a):n}async write(t,r=0,n=t.byteLength){return new Promise((i,a)=>{let o=Number(r),s=new Uint8Array(t,Number(r),n);Vc.default.write(this.handle,s,0,n,o,(u,c)=>u?a(u):i(c))})}};async function N7e(e,t,r,n,i){return await new Promise((a,o)=>Vc.default.read(e,t,r,n,i,(s,u)=>s?o(s):a(u)))}var dE=Lt(require("fs/promises"),1);var qB=Lt(require("fs"),1),LB=require("stream");var lE=Lt(require("zlib"),1),U7e=e=>e&&e instanceof ArrayBuffer,G7e=e=>e&&e instanceof Buffer;function fE(e,t){switch(t==null?void 0:t.get("content-encoding")){case"br":return e.pipe(lE.default.createBrotliDecompress());case"gzip":return e.pipe(lE.default.createGunzip());case"deflate":return e.pipe(lE.default.createDeflate());default:return e}}async function yre(e){let t=[];return await new Promise((r,n)=>{e.on("error",i=>n(i)),e.on("readable",()=>e.read()),e.on("data",i=>{typeof i=="string"&&n(new Error("Read stream not binary")),t.push(H7e(i))}),e.on("end",()=>{let i=z7e(t);r(i)})})}function z7e(e){let t=e.map(a=>a instanceof ArrayBuffer?new Uint8Array(a):a),r=t.reduce((a,o)=>a+o.byteLength,0),n=new Uint8Array(r),i=0;for(let a of t)n.set(a,i),i+=a.byteLength;return n.buffer}function H7e(e){if(U7e(e))return e;if(G7e(e))return new Uint8Array(e).buffer;if(ArrayBuffer.isView(e))return e.buffer;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(${JSON.stringify(e,null,2).slice(10)})`)}var W7e=e=>typeof e=="boolean",_re=e=>typeof e=="function",V7e=e=>e!==null&&typeof e=="object",$7e=e=>V7e(e)&&_re(e.read)&&_re(e.pipe)&&W7e(e.readable);async function pE(e,t){let r=/^file:\/\//;e.replace(r,"/");let n=e.split("?")[0];n=Lu(n);let i=new Headers;e.endsWith(".gz")&&(i["content-encoding"]="gzip"),e.endsWith(".br")&&(i["content-encoding"]="br");try{let a=await new Promise((f,p)=>{let d=qB.default.createReadStream(n,{encoding:null});d.once("readable",()=>f(d)),d.on("error",h=>p(h))}),o=a;$7e(a)?o=fE(a,i):typeof a=="string"?o=LB.Readable.from([new TextEncoder().encode(a)]):o=LB.Readable.from([a||new ArrayBuffer(0)]);let s=200,u="OK",c=K7e(n),l=new Response(o,{headers:c,status:s,statusText:u});return Object.defineProperty(l,"url",{value:e}),l}catch(a){let o=a.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 K7e(e){let t={};if(!t["content-length"]){let r=qB.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 hE=class{readable=!0;writable=!0;constructor(){}async readdir(t=".",r){return await dE.default.readdir(t,r)}async stat(t){let r=await dE.default.stat(t,{bigint:!0});return{size:Number(r.size),bigsize:r.size,isDirectory:r.isDirectory()}}async unlink(t){return await dE.default.unlink(t)}async fetch(t,r){return await pE(t,r)}async openReadableFile(t,r="r"){return new vd(t,r)}async openWritableFile(t,r="w",n){return new vd(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 i=await this.concatenate(n),a=await this.hash(i,r);(s=(o=this.options.crypto)==null?void 0:o.onEnd)==null||s.call(o,{hash:a})}async concatenate(t){return await gd(t)}};var W0=class{crc;constructor(){this.crc=-1}update(t){let r=Y7e(),n=new Uint8Array(t);for(let i=0;i<n.byteLength;i++)this.crc=this.crc>>>8^r[(this.crc^n[i])&255];return this}finalize(){return this.crc=(this.crc^-1)>>>0,this.crc}},J7e=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 Y7e(){return J7e}function wre(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 i=0;i<n.length;i++)typeof n[i]>"u"?t+="=":t+=X7e(n[i])}return t}function X7e(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 NB(e,t){switch(t){case"hex":return Ere(e);case"base64":return Sre(Ere(e));default:throw new Error(t)}}function Are(e,t){switch(t){case"hex":return e;case"base64":return Sre(e);default:throw new Error(t)}}function Sre(e){e.length%2!==0&&(e=`0${e}`);let r=(e.match(/\w{2}/g)||[]).map(n=>String.fromCharCode(parseInt(n,16))).join("");return wre(r)||""}function Ere(e){let t=e.toString(16);return t==="0"?`0${t}`:t}var kx=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 W0;n.update(t);let i=n.finalize();return NB(i,r)}async*hashBatches(t,r="base64"){var a,o;let n=new W0;for await(let s of t)n.update(s),yield s;let i=n.finalize();(o=(a=this.options.crypto)==null?void 0:a.onEnd)==null||o.call(a,{hash:NB(i,r)})}};var Cre=typeof atob=="function"?atob:typeof Buffer=="function"?iqe:kre,Q7e=Cre("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="),UB=WebAssembly&&Cre!==kre?nqe(Q7e).buffer:!1,qu=aqe(),GB=240*16*16,Dre=Math.floor(GB*16*1.066666667),Z7e=268435456-65536,Tre="Parameter must be Buffer, ArrayBuffer or Uint8Array",eqe="Parameter exceeds max size of 255.9 Mbytes";UB||console.log("WebAssembly not available or WASM module could not be decoded; md5WASM will fall back to JavaScript");function zB(e){var t,r,n,i,a,o,s,u,c,l;let f=rqe(),p=tqe(),d={},h=new Date().getTime();return d.then=function(_){return s=_,m(),d},d.catch=function(_){return u=_,d},e&&typeof e=="object"?typeof Buffer=="function"&&e.constructor===Buffer?o=e:e.constructor===Uint8Array||e.constructor===ArrayBuffer?o=e.constructor===ArrayBuffer?new Uint8Array(e):e:b(new TypeError(Tre)):b(new TypeError(Tre)),o&&(a=o.length,UB&&a>Dre?a>Z7e?b(new Error(eqe)):(t=new WebAssembly.Memory({initial:a>32e6?a>64e6?a>128e6?4096:2048:1024:512}),r=new Uint32Array(t.buffer),i={mem:t,log:console.log},n={imports:i},WebAssembly.instantiate(UB,n).then(v)):m(f(o))),d;function v(_){m(p(o,_.instance.exports,r))}function m(_){var E=Boolean(_)?_:c;Boolean(_)&&(l=new Date().getTime()),typeof s=="function"?Boolean(E)&&(s(E,l-h),s=u=null):Boolean(_)&&(c=_)}function b(_){typeof u=="function"&&u(_)}}function tqe(){var e,t,r,n,i,a,o,s,u,c,l,f,p,d=function(h){var v,m,b,_,E,T,S,D,I,L,F,P,M,U,W,V,Z,ee,ge,de,he,Ae,Ne=new Date().getTime(),qe=0,te=1732584193,H=-271733879,Q=-1732584194,re=271733878,Ie=0,Xe=h.length*8,it;for(it=Se(h,p),p[Xe>>>5]|=128<<Xe%32,p[(Xe+64>>>9<<4)+14]=Xe,it=(Xe+64>>>9<<4)+15,he=p;Ie<it;)it>Ie+Dre?(n(te),a(H),s(Q),c(re),t(GB),Ie=Ie+GB*16,te=r(),H=i(),Q=o(),re=u(),qe++):(Z=te,ee=H,ge=Q,de=re,v=he[Ie+0]>>>0,m=he[Ie+1]>>>0,b=he[Ie+2]>>>0,_=he[Ie+3]>>>0,E=he[Ie+4]>>>0,T=he[Ie+5]>>>0,S=he[Ie+6]>>>0,D=he[Ie+7]>>>0,I=he[Ie+8]>>>0,L=he[Ie+9]>>>0,F=he[Ie+10]>>>0,P=he[Ie+11]>>>0,M=he[Ie+12]>>>0,U=he[Ie+13]>>>0,W=he[Ie+14]>>>0,V=he[Ie+15]>>>0,te=ue(7,25,te+(H&Q|~H&re)+v-680876936)+H,re=ue(12,20,re+(te&H|~te&Q)+m-389564586)+te,Q=ue(17,15,Q+(re&te|~re&H)+b+606105819)+re,H=ue(22,10,H+(Q&re|~Q&te)+_-1044525330)+Q,te=ue(7,25,te+(H&Q|~H&re)+E-176418897)+H,re=ue(12,20,re+(te&H|~te&Q)+T+1200080426)+te,Q=ue(17,15,Q+(re&te|~re&H)+S-1473231341)+re,H=ue(22,10,H+(Q&re|~Q&te)+D-45705983)+Q,te=ue(7,25,te+(H&Q|~H&re)+I+1770035416)+H,re=ue(12,20,re+(te&H|~te&Q)+L-1958414417)+te,Q=ue(17,15,Q+(re&te|~re&H)+F-42063)+re,H=ue(22,10,H+(Q&re|~Q&te)+P-1990404162)+Q,te=ue(7,25,te+(H&Q|~H&re)+M+1804603682)+H,re=ue(12,20,re+(te&H|~te&Q)+U-40341101)+te,Q=ue(17,15,Q+(re&te|~re&H)+W-1502002290)+re,H=ue(22,10,H+(Q&re|~Q&te)+V+1236535329)+Q,te=ue(5,27,te+(H&re|Q&~re)+m-165796510)+H,re=ue(9,23,re+(te&Q|H&~Q)+S-1069501632)+te,Q=ue(14,18,Q+(re&H|te&~H)+P+643717713)+re,H=ue(20,12,H+(Q&te|re&~te)+v-373897302)+Q,te=ue(5,27,te+(H&re|Q&~re)+T-701558691)+H,re=ue(9,23,re+(te&Q|H&~Q)+F+38016083)+te,Q=ue(14,18,Q+(re&H|te&~H)+V-660478335)+re,H=ue(20,12,H+(Q&te|re&~te)+E-405537848)+Q,te=ue(5,27,te+(H&re|Q&~re)+L+568446438)+H,re=ue(9,23,re+(te&Q|H&~Q)+W-1019803690)+te,Q=ue(14,18,Q+(re&H|te&~H)+_-187363961)+re,H=ue(20,12,H+(Q&te|re&~te)+I+1163531501)+Q,te=ue(5,27,te+(H&re|Q&~re)+U-1444681467)+H,re=ue(9,23,re+(te&Q|H&~Q)+b-51403784)+te,Q=ue(14,18,Q+(re&H|te&~H)+D+1735328473)+re,H=ue(20,12,H+(Q&te|re&~te)+M-1926607734)+Q,te=ue(4,28,te+(H^Q^re)+T-378558)+H,re=ue(11,21,re+(te^H^Q)+I-2022574463)+te,Q=ue(16,16,Q+(re^te^H)+P+1839030562)+re,H=ue(23,9,H+(Q^re^te)+W-35309556)+Q,te=ue(4,28,te+(H^Q^re)+m-1530992060)+H,re=ue(11,21,re+(te^H^Q)+E+1272893353)+te,Q=ue(16,16,Q+(re^te^H)+D-155497632)+re,H=ue(23,9,H+(Q^re^te)+F-1094730640)+Q,te=ue(4,28,te+(H^Q^re)+U+681279174)+H,re=ue(11,21,re+(te^H^Q)+v-358537222)+te,Q=ue(16,16,Q+(re^te^H)+_-722521979)+re,H=ue(23,9,H+(Q^re^te)+S+76029189)+Q,te=ue(4,28,te+(H^Q^re)+L-640364487)+H,re=ue(11,21,re+(te^H^Q)+M-421815835)+te,Q=ue(16,16,Q+(re^te^H)+V+530742520)+re,H=ue(23,9,H+(Q^re^te)+b-995338651)+Q,te=ue(6,26,te+(Q^(H|~re))+v-198630844)+H,re=ue(10,22,re+(H^(te|~Q))+D+1126891415)+te,Q=ue(15,17,Q+(te^(re|~H))+W-1416354905)+re,H=ue(21,11,H+(re^(Q|~te))+T-57434055)+Q,te=ue(6,26,te+(Q^(H|~re))+M+1700485571)+H,re=ue(10,22,re+(H^(te|~Q))+_-1894986606)+te,Q=ue(15,17,Q+(te^(re|~H))+F-1051523)+re,H=ue(21,11,H+(re^(Q|~te))+m-2054922799)+Q,te=ue(6,26,te+(Q^(H|~re))+I+1873313359)+H,re=ue(10,22,re+(H^(te|~Q))+V-30611744)+te,Q=ue(15,17,Q+(te^(re|~H))+S-1560198380)+re,H=ue(21,11,H+(re^(Q|~te))+U+1309151649)+Q,te=ue(6,26,te+(Q^(H|~re))+E-145523070)+H,re=ue(10,22,re+(H^(te|~Q))+P-1120210379)+te,Q=ue(15,17,Q+(te^(re|~H))+b+718787259)+re,H=ue(21,11,H+(re^(Q|~te))+L-343485551)+Q,Ie=Ie+16,te=te+Z>>>0,H=H+ee>>>0,Q=Q+ge>>>0,re=re+de>>>0);return qu.endian([te,H,Q,re]);function ue(we,ut,Pe){return Pe<<we|Pe>>>ut}function Se(we,ut){for(var Pe=-1,ft=Math.floor((we.length-1)/4),Ct=0,dr,oe,Ue,Ze;ft-8>Pe++;)Ct=Pe<<2,ut[Pe]=we[Ct+0]|we[Ct+1]<<8|we[Ct+2]<<16|we[Ct+3]<<24;for(Pe--;ft>Pe++;)Ct=Pe<<2,dr=typeof we[Ct+0]>"u"?0:we[Ct+0],oe=typeof we[Ct+1]>"u"?0:we[Ct+1],Ue=typeof we[Ct+2]>"u"?0:we[Ct+2],Ze=typeof we[Ct+3]>"u"?0:we[Ct+3],ut[Pe]=dr|oe<<8|Ue<<16|Ze<<24;return ft+1}};return function(h,v,m,b){var _;return t=v.loops,e=v.loop,r=v.getA,i=v.getB,o=v.getC,u=v.getD,l=v.getX,n=v.setA,a=v.setB,s=v.setC,c=v.setD,f=v.setX,p=m,_=qu.wordsToBytes(d(h)),b&&b.asBytes?_:qu.bytesconvertNumberToHex(_)}}function rqe(){var e=function(t,r){var n,i,a,o,s,u,c,l,f,p,d,h,v,m,b,_,E,T,S,D,I,L=new Date().getTime(),F=1732584193,P=-271733879,M=-1732584194,U=271733878,W=t.length*8;I=qu.bytesToWords(t);for(var V=0;V<I.length;V++)I[V]=(I[V]<<8|I[V]>>>24)&16711935|(I[V]<<24|I[V]>>>8)&4278255360;I[W>>>5]|=128<<W%32,I[(W+64>>>9<<4)+14]=W;for(var Z=0;Z<I.length;Z+=16)E=F,T=P,S=M,D=U,n=I[Z+0]>>>0,i=I[Z+1]>>>0,a=I[Z+2]>>>0,o=I[Z+3]>>>0,s=I[Z+4]>>>0,u=I[Z+5]>>>0,c=I[Z+6]>>>0,l=I[Z+7]>>>0,f=I[Z+8]>>>0,p=I[Z+9]>>>0,d=I[Z+10]>>>0,h=I[Z+11]>>>0,v=I[Z+12]>>>0,m=I[Z+13]>>>0,b=I[Z+14]>>>0,_=I[Z+15]>>>0,F=ee(7,25,F+(P&M|~P&U)+n-680876936)+P,U=ee(12,20,U+(F&P|~F&M)+i-389564586)+F,M=ee(17,15,M+(U&F|~U&P)+a+606105819)+U,P=ee(22,10,P+(M&U|~M&F)+o-1044525330)+M,F=ee(7,25,F+(P&M|~P&U)+s-176418897)+P,U=ee(12,20,U+(F&P|~F&M)+u+1200080426)+F,M=ee(17,15,M+(U&F|~U&P)+c-1473231341)+U,P=ee(22,10,P+(M&U|~M&F)+l-45705983)+M,F=ee(7,25,F+(P&M|~P&U)+f+1770035416)+P,U=ee(12,20,U+(F&P|~F&M)+p-1958414417)+F,M=ee(17,15,M+(U&F|~U&P)+d-42063)+U,P=ee(22,10,P+(M&U|~M&F)+h-1990404162)+M,F=ee(7,25,F+(P&M|~P&U)+v+1804603682)+P,U=ee(12,20,U+(F&P|~F&M)+m-40341101)+F,M=ee(17,15,M+(U&F|~U&P)+b-1502002290)+U,P=ee(22,10,P+(M&U|~M&F)+_+1236535329)+M,F=ee(5,27,F+(P&U|M&~U)+i-165796510)+P,U=ee(9,23,U+(F&M|P&~M)+c-1069501632)+F,M=ee(14,18,M+(U&P|F&~P)+h+643717713)+U,P=ee(20,12,P+(M&F|U&~F)+n-373897302)+M,F=ee(5,27,F+(P&U|M&~U)+u-701558691)+P,U=ee(9,23,U+(F&M|P&~M)+d+38016083)+F,M=ee(14,18,M+(U&P|F&~P)+_-660478335)+U,P=ee(20,12,P+(M&F|U&~F)+s-405537848)+M,F=ee(5,27,F+(P&U|M&~U)+p+568446438)+P,U=ee(9,23,U+(F&M|P&~M)+b-1019803690)+F,M=ee(14,18,M+(U&P|F&~P)+o-187363961)+U,P=ee(20,12,P+(M&F|U&~F)+f+1163531501)+M,F=ee(5,27,F+(P&U|M&~U)+m-1444681467)+P,U=ee(9,23,U+(F&M|P&~M)+a-51403784)+F,M=ee(14,18,M+(U&P|F&~P)+l+1735328473)+U,P=ee(20,12,P+(M&F|U&~F)+v-1926607734)+M,F=ee(4,28,F+(P^M^U)+u-378558)+P,U=ee(11,21,U+(F^P^M)+f-2022574463)+F,M=ee(16,16,M+(U^F^P)+h+1839030562)+U,P=ee(23,9,P+(M^U^F)+b-35309556)+M,F=ee(4,28,F+(P^M^U)+i-1530992060)+P,U=ee(11,21,U+(F^P^M)+s+1272893353)+F,M=ee(16,16,M+(U^F^P)+l-155497632)+U,P=ee(23,9,P+(M^U^F)+d-1094730640)+M,F=ee(4,28,F+(P^M^U)+m+681279174)+P,U=ee(11,21,U+(F^P^M)+n-358537222)+F,M=ee(16,16,M+(U^F^P)+o-722521979)+U,P=ee(23,9,P+(M^U^F)+c+76029189)+M,F=ee(4,28,F+(P^M^U)+p-640364487)+P,U=ee(11,21,U+(F^P^M)+v-421815835)+F,M=ee(16,16,M+(U^F^P)+_+530742520)+U,P=ee(23,9,P+(M^U^F)+a-995338651)+M,F=ee(6,26,F+(M^(P|~U))+n-198630844)+P,U=ee(10,22,U+(P^(F|~M))+l+1126891415)+F,M=ee(15,17,M+(F^(U|~P))+b-1416354905)+U,P=ee(21,11,P+(U^(M|~F))+u-57434055)+M,F=ee(6,26,F+(M^(P|~U))+v+1700485571)+P,U=ee(10,22,U+(P^(F|~M))+o-1894986606)+F,M=ee(15,17,M+(F^(U|~P))+d-1051523)+U,P=ee(21,11,P+(U^(M|~F))+i-2054922799)+M,F=ee(6,26,F+(M^(P|~U))+f+1873313359)+P,U=ee(10,22,U+(P^(F|~M))+_-30611744)+F,M=ee(15,17,M+(F^(U|~P))+c-1560198380)+U,P=ee(21,11,P+(U^(M|~F))+m+1309151649)+M,F=ee(6,26,F+(M^(P|~U))+s-145523070)+P,U=ee(10,22,U+(P^(F|~M))+h-1120210379)+F,M=ee(15,17,M+(F^(U|~P))+a+718787259)+U,P=ee(21,11,P+(U^(M|~F))+p-343485551)+M,F=F+E>>>0,P=P+T>>>0,M=M+S>>>0,U=U+D>>>0;return qu.endian([F,P,M,U]);function ee(ge,de,he){return he<<ge|he>>>de}};return function(t,r){var n=qu.wordsToBytes(e(t,r)),i=r&&r.asBytes?n:qu.bytesconvertNumberToHex(n);return i}}function nqe(e){var t,r,n,i=-1;for(t=e.length-1,r=new ArrayBuffer(e.length),n=new Uint8Array(r);t>i++;)n[i]=e.charCodeAt(i);return n}function iqe(e){return Buffer.from(e,"base64").toString("binary")}function kre(e){return e}function aqe(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";return{rotl:function(t,r){return t<<r|t>>>32-r},endian:function(t){if(t.constructor==Number)return qu.rotl(t,8)&16711935|qu.rotl(t,24)&4278255360;for(var r=0;r<t.length;r++)t[r]=qu.endian(t[r]);return t},bytesToWords:function(t){for(var r=[],n=0,i=0;n<t.length;n++,i+=8)r[i>>>5]|=t[n]<<24-i%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 Nu=class extends $c{name="md5";options;constructor(t={}){super(),this.options=t}async hash(t,r){let i=await new Promise((a,o)=>zB(t).then(a).catch(o));return Are(i,r)}};var Fx=Lt(require("crypto"),1),mE=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 i,a,o,s;let n=(o=(a=(i=this.options)==null?void 0:i.crypto)==null?void 0:a.algorithm)==null?void 0:o.toLowerCase();try{if(!Fx.createHash)throw new Error("crypto.createHash not available");let u=(s=Fx.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 a,o,s,u,c,l,f;if(!Fx.createHash)throw new Error("crypto.createHash not available");let n=(u=Fx.createHash)==null?void 0:u((s=(o=(a=this.options)==null?void 0:a.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 i=n.digest(r);(f=(l=(c=this.options)==null?void 0:c.crypto)==null?void 0:l.onEnd)==null||f.call(l,{hash:i})}};var Hre=require("process");var Fre=Lt(require("stream"),1),HB=class{},oqe=Fre.Readable||HB;function VB(e,t){let r=e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]();return new WB(r,t)}var WB=class extends oqe{_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,i,a,o;this._iterator&&(t?await((i=(n=this._iterator)==null?void 0:n.throw)==null?void 0:i.call(n,t)):await((o=(a=this._iterator)==null?void 0:a.return)==null?void 0:o.call(a,t)),r==null||r(null))}async _pull(t,r){var a;let n=this._bytesMode,i=null;for(;this.readable&&!(i=await r.next()).done&&(t!==null&&(t-=n&&ArrayBuffer.isView(i.value)?i.value.byteLength:1),!(!this.push(new Uint8Array(i.value))||t<=0)););return(i!=null&&i.done||!this.readable)&&(this.push(null)||!0)&&((a=r==null?void 0:r.return)==null||a.call(r)),!this.readable}};var Ore=Lt(Pre(),1);delete globalThis.ReadableStream;var vE=class extends Ore.ReadableStream{};var xE=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(i){t.error(i);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 bE=class extends vE{_chunks;constructor(t){super(new xE(t.values()),{type:"bytes"}),this._chunks=t}async*[Symbol.asyncIterator](t){let r=this.getReader();yield*this._chunks,r.releaseLock()}};var xd=class{type;size;parts;constructor(t=[],r={}){this.parts=[],this.size=0;for(let n of t)if(typeof n=="string"){let i=new TextEncoder().encode(n);this.parts.push(i),this.size+=i.byteLength}else if(n instanceof xd)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:i,byteOffset:a,byteLength:o}=n;this.parts.push(new Uint8Array(i,a,o)),this.size+=o}else{let i=new TextEncoder().encode(String(n));this.parts.push(i),this.size+=i.byteLength}this.type=sqe(r.type)}slice(t=0,r=this.size,n=""){let{size:i,parts:a}=this,o=t<0?Math.max(i+t,0):Math.min(t,i),s=r<0?Math.max(i+r,0):Math.min(r,i),u=Math.max(s-o,0),c=new xd([],{type:n});if(u===0)return c;let l=0,f=[];for(let p of a){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 bE(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 i of this.parts)r.set(i,n),n+=i.byteLength;return t}};function sqe(e=""){let t=String(e).toLowerCase();return/[^\u0020-\u007E]/.test(t)?"":t}function uqe(){return typeof Blob>"u"&&!globalThis.Blob&&(globalThis.Blob=xd),globalThis.Blob}var cqe=uqe();var yE=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,${hv(r)}`;this.onload&&this.onload({target:{result:n}})}async readAsText(t){let r=await t.text();this.onload&&this.onload({target:{result:r}})}};var _E=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 Ire(){return typeof FileReader>"u"&&!globalThis.FileReader&&(globalThis.FileReader=yE),typeof File>"u"&&!globalThis.File&&(globalThis.File=_E),global}var lqe=Ire();var $B=Lt(require("module"),1),Rre=Lt(require("path"),1),EE=Lt(require("fs"),1);async function jre(e){return e.startsWith("http")?await(await fetch(e)).arrayBuffer():EE.default.readFileSync(e).buffer}async function Mre(e){return e.startsWith("http")?await(await fetch(e)).text():EE.default.readFileSync(e,"utf8")}async function Lre(e){if(e.startsWith("http")){let n=await(await fetch(e)).text();return wE(n)}e.startsWith("/")||(e=`${process.cwd()}/${e}`);let t=EE.default.readFileSync(e,"utf8");return wE(t)}function wE(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=$B.default._nodeModulePaths(Rre.default.dirname(t)),i=typeof module<"u"&&(module==null?void 0:module.parent),a=new $B.default(t,i);return a.filename=t,a.paths=[].concat((r==null?void 0:r.prependPaths)||[]).concat(n).concat((r==null?void 0:r.appendPaths)||[]),a._compile(e,t),i&&i.children&&i.children.splice(i.children.indexOf(a),1),a.exports}var Rs=class{map;constructor(t){this.map={},t instanceof Rs?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=Bx(t),r=qre(r);let n=this.map[t];this.map[t]=n?`${n}, ${r}`:r}delete(t){delete this.map[Bx(t)]}get(t){return t=Bx(t),this.has(t)?this.map[t]:null}has(t){return this.map.hasOwnProperty(Bx(t))}set(t,r){this.map[Bx(t)]=qre(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)}),KB(t)}values(){let t=[];return this.forEach(function(r){t.push(r)}),KB(t)}entries(){let t=[];return this.forEach(function(r,n){t.push([n,r])}),KB(t)}*[Symbol.iterator](){yield*this.entries()}};function Bx(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 qre(e){return typeof e!="string"&&(e=String(e)),e}function KB(e){let t={next(){let r=e.shift();return{done:r===void 0,value:r}}};return t[Symbol.iterator]=function(){return t},t}function JB(e,t){if(!e)throw new Error(`@loaders.gl/polyfills assertion ${t}`)}var XB=Lt(require("stream"),1),fqe=e=>typeof e=="boolean",Nre=e=>typeof e=="function",pqe=e=>e!==null&&typeof e=="object",YB=e=>pqe(e)&&Nre(e.read)&&Nre(e.pipe)&&fqe(e.readable),Kc=class{ok;status;statusText;headers;url;bodyUsed=!1;_body;constructor(t,r){let{headers:n,status:i=200,statusText:a="OK",url:o}=r||{};this.url=o,this.ok=i===200,this.status=i,this.statusText=a,this.headers=new Rs((r==null?void 0:r.headers)||{}),YB(t)?this._body=fE(t,n):typeof t=="string"?this._body=XB.Readable.from([new TextEncoder().encode(t)]):this._body=XB.Readable.from([t||new ArrayBuffer(0)])}get body(){return JB(!this.bodyUsed),JB(YB(this._body)),this.bodyUsed=!0,this._body}async arrayBuffer(){return YB(this._body)?await yre(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 Gre=Lt(require("http"),1),zre=Lt(require("https"),1);var dqe=e=>e&&e instanceof ArrayBuffer,hqe=e=>e&&e instanceof Buffer;function Ure(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:mqe(r),mimeType:n}}function mqe(e){if(dqe(e))return e;if(hqe(e))return new Uint8Array(e).buffer;if(ArrayBuffer.isView(e))return e.buffer;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(${JSON.stringify(e,null,2).slice(10)})`)}var QB=e=>e.startsWith("data:"),gqe=e=>e.startsWith("http:")||e.startsWith("https:");async function Px(e,t){try{if(globalThis.fetch!==Px&&(gqe(e)||QB(e)))return await fetch(e,t);if(QB(e)){let{arrayBuffer:c,mimeType:l}=Ure(e);return new Kc(c,{headers:{"content-type":l},url:e})}let r={},n=e;e.endsWith(".gz")&&(e=e.slice(0,-3),r["content-encoding"]="gzip");let i=await vqe(n,t),a=_qe(e,i,r),{status:o,statusText:s}=yqe(i),u=!t||t.followRedirect||t.followRedirect===void 0;if(o>=300&&o<400&&a.has("location")&&u){let c=xqe(e,a.get("location"));return await Px(c,t)}return new Kc(i,{headers:a,status:o,statusText:s,url:e})}catch(r){return new Kc(null,{status:400,statusText:String(r),url:e})}}async function vqe(e,t){return await new Promise((r,n)=>{let i=bqe(e,t),a=e.startsWith("https:")?zre.default.request(i,o=>r(o)):Gre.default.request(i,o=>r(o));a.on("error",o=>n(o)),a.end()})}function xqe(e,t){if(t.startsWith("http"))return t;let r=new URL(e);return r.pathname=t,r.href}function bqe(e,t){let r=(t==null?void 0:t.headers)||{},n={};for(let a of Object.keys(r))n[a.toLowerCase()]=r[a];n["accept-encoding"]=n["accept-encoding"]||"gzip,br,deflate";let i=new URL(e);return{hostname:i.hostname,path:i.pathname,method:"GET",...t,...t==null?void 0:t.fetch,headers:n,port:i.port}}function yqe(e){return e.statusCode?{status:e.statusCode,statusText:e.statusMessage||"NA"}:{status:200,statusText:"OK"}}function _qe(e,t,r={}){let n={};if(t&&t.headers){let i=t.headers;for(let a in i){let o=i[a];n[a.toLowerCase()]=String(o)}}if(!n["content-length"]){let i=wqe(e);Number.isFinite(i)&&(n["content-length"]=i)}return Object.assign(n,r),new Rs(n)}function wqe(e){return QB(e)?e.length-5:null}var Eqe=parseInt(Hre.versions.node.split(".")[0]);iz&&console.error("loaders.gl: The @loaders.gl/polyfills should only be used in Node.js environments");globalThis.loaders=globalThis.loaders||{};globalThis.loaders.makeNodeStream=VB;globalThis.loaders.NodeFile=vd;globalThis.loaders.NodeFileSystem=hE;globalThis.loaders.fetchNode=pE;globalThis.loaders.NodeHash=mE;globalThis.TextEncoder||(globalThis.TextEncoder=dv);globalThis.TextDecoder||(globalThis.TextDecoder=Hp);!("atob"in globalThis)&&hv&&(globalThis.atob=hv);!("btoa"in globalThis)&&fD&&(globalThis.btoa=fD);globalThis.loaders.encodeImageNode=sV;globalThis.loaders.parseImageNode=gB;globalThis.loaders.imageFormatsNode=mB;globalThis._parseImageNode=gB;globalThis._imageFormatsNode=mB;globalThis.loaders.readFileAsArrayBuffer=jre;globalThis.loaders.readFileAsText=Mre;globalThis.loaders.requireFromFile=Lre;globalThis.loaders.requireFromString=wE;Eqe<18&&(!("Headers"in globalThis)&&Rs&&(globalThis.Headers=Rs),!("Response"in globalThis)&&Kc&&(globalThis.Response=Kc),!("fetch"in globalThis)&&Px&&(globalThis.fetch=Px));var lTe=require("path"),H4=Lt(cge(),1);var xn={OBJECT_ID_TYPE:"OBJECTID",STRING_TYPE:"string",DOUBLE_TYPE:"double",SHORT_INT_TYPE:"Int32"};var bT=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:xn.OBJECT_ID_TYPE,...t},n=!1,i=this._attributeStorageInfo.length;for(let a in r)if(!this._attributeStorageInfo.find(s=>s.name===a)){let s=r[a],u=this.createStorageAttribute(i,a,s),c=this.getFieldAttributeType(s),l=this.createFieldAttribute(a,c);this._attributeStorageInfo.push(u),this._fields.push(l),i+=1,n=!0}if(n){let a=[];for(let o of this._attributeStorageInfo)a.push(o.name);this._popupInfo=this.createPopupInfo(a)}}fromObject(t){this._attributeStorageInfo=t.attributeStorageInfo,this._fields=t.fields,this._popupInfo=t.popupInfo}createStorageAttribute(t,r,n){let i={key:`f_${t}`,name:r,ordering:["attributeValues"],header:[{property:"count",valueType:"UInt32"}],attributeValues:{valueType:"Int32",valuesPerElement:1}};switch(n){case xn.OBJECT_ID_TYPE:this.setupIdAttribute(i);break;case xn.STRING_TYPE:this.setupStringAttribute(i);break;case xn.DOUBLE_TYPE:this.setupDoubleAttribute(i);break;case xn.SHORT_INT_TYPE:break;default:this.setupStringAttribute(i)}return i}getFieldAttributeType(t){switch(t){case xn.OBJECT_ID_TYPE:return"esriFieldTypeOID";case xn.STRING_TYPE:return"esriFieldTypeString";case xn.SHORT_INT_TYPE:return"esriFieldTypeInteger";case xn.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=[],i=[],a=[],o=[];for(let s of t)i.push({fieldName:s,visible:!0,isEditable:!1,label:s});return a.push({fieldInfos:i,type:"fields"}),{title:r,mediaInfos:n,popupElements:a,fieldInfos:i,expressionInfos:o}}};var Pbt=e=>typeof e=="boolean",qb=e=>typeof e=="function",Wd=e=>e!==null&&typeof e=="object",Ej=e=>Wd(e)&&e.constructor==={}.constructor;var lge=e=>Boolean(e)&&typeof e[Symbol.iterator]=="function",fge=e=>e&&typeof e[Symbol.asyncIterator]=="function";var Vo=e=>typeof Response<"u"&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json;var $o=e=>typeof Blob<"u"&&e instanceof Blob,pge=e=>e&&typeof e=="object"&&e.isBuffer;var Obt=e=>typeof ReadableStream<"u"&&e instanceof ReadableStream||Wd(e)&&qb(e.tee)&&qb(e.cancel)&&qb(e.getReader);var Ibt=e=>Wd(e)&&qb(e.read)&&qb(e.pipe)&&Pbt(e.readable),yT=e=>Obt(e)||Ibt(e);var _T=class extends Error{constructor(t,r){super(t),this.reason=r.reason,this.url=r.url,this.response=r.response}reason;url;response};var Rbt=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,jbt=/^([-\w.]+\/[-\w.+]+)/;function Aj(e,t){return e.toLowerCase()===t.toLowerCase()}function dge(e){let t=jbt.exec(e);return t?t[1]:e}function Sj(e){let t=Rbt.exec(e);return t?t[1]:""}var hge=/\?.*/;function mge(e){let t=e.match(hge);return t&&t[0]}function xg(e){return e.replace(hge,"")}function gge(e){if(e.length<50)return e;let t=e.slice(e.length-15);return`${e.substr(0,32)}...${t}`}function Vd(e){return Vo(e)?e.url:$o(e)?e.name||"":typeof e=="string"?e:""}function Nb(e){if(Vo(e)){let t=e,r=t.headers.get("content-type")||"",n=xg(t.url);return dge(r)||Sj(n)}return $o(e)?e.type||"":typeof e=="string"?Sj(e):""}function vge(e){return Vo(e)?e.headers["content-length"]||-1:$o(e)?e.size:typeof e=="string"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function wT(e){if(Vo(e))return e;let t={},r=vge(e);r>=0&&(t["content-length"]=String(r));let n=Vd(e),i=Nb(e);i&&(t["content-type"]=i);let a=await Lbt(e);a&&(t["x-first-bytes"]=a),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 xge(e){if(!e.ok)throw await Mbt(e)}async function Mbt(e){let t=gge(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 i=e.headers.get("Content-Type");n.reason=i!=null&&i.includes("application/json")?await e.json():e.text()}catch{}return new _T(r,n)}async function Lbt(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 i=new FileReader;i.onload=a=>{var o;return n((o=a==null?void 0:a.target)==null?void 0:o.result)},i.readAsDataURL(r)})}if(e instanceof ArrayBuffer){let r=e.slice(0,5);return`data:base64,${qbt(r)}`}return null}function qbt(e){let t="",r=new Uint8Array(e);for(let n=0;n<r.byteLength;n++)t+=String.fromCharCode(r[n]);return btoa(t)}function Nbt(e){return!Ubt(e)&&!Gbt(e)}function Ubt(e){return e.startsWith("http:")||e.startsWith("https:")}function Gbt(e){return e.startsWith("data:")}async function Pa(e,t){var r,n;if(typeof e=="string"){let i=Lu(e);return Nbt(i)&&(r=globalThis.loaders)!=null&&r.fetchNode?(n=globalThis.loaders)==null?void 0:n.fetchNode(i,t):await fetch(i,t)}return await wT(e)}var Tj=new Iu({id:"loaders.gl"}),ET=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},AT=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 Cj={fetch:null,mimeType:void 0,nothrow:!1,log:new AT,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:jr,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},bge={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function Dj(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state||(e._state={}),e._state}function bg(){let e=Dj();return e.globalOptions=e.globalOptions||{...Cj},e.globalOptions}function wge(e,t,r,n){return r=r||[],r=Array.isArray(r)?r:[r],zbt(e,r),Wbt(t,e,n)}function zbt(e,t){yge(e,null,Cj,bge,t);for(let r of t){let n=e&&e[r.id]||{},i=r.options&&r.options[r.id]||{},a=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};yge(n,r.id,i,a,t)}}function yge(e,t,r,n,i){let a=t||"Top level",o=t?`${t}.`:"";for(let s in e){let u=!t&&Wd(e[s]),c=s==="baseUri"&&!t,l=s==="workerUrl"&&t;if(!(s in r)&&!c&&!l){if(s in n)Tj.warn(`${a} loader option '${o}${s}' no longer supported, use '${n[s]}'`)();else if(!u){let f=Hbt(s,i);Tj.warn(`${a} loader option '${o}${s}' not recognized. ${f}`)()}}}}function Hbt(e,t){let r=e.toLowerCase(),n="";for(let i of t)for(let a in i.options){if(e===a)return`Did you mean '${i.id}.${a}'?`;let o=a.toLowerCase();(r.startsWith(o)||o.startsWith(r))&&(n=n||`Did you mean '${i.id}.${a}'?`)}return n}function Wbt(e,t,r){let i={...e.options||{}};return Vbt(i,r),i.log===null&&(i.log=new ET),_ge(i,bg()),_ge(i,t),i}function _ge(e,t){for(let r in t)if(r in t){let n=t[r];Ej(n)&&Ej(e[r])?e[r]={...e[r],...t[r]}:e[r]=t[r]}}function Vbt(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)}function Ub(e){return e?(Array.isArray(e)&&(e=e[0]),Array.isArray(e==null?void 0:e.extensions)):!1}function kj(e){Rt(e,"null loader"),Rt(Ub(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 $bt=()=>{let e=Dj();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function Ege(){return $bt()}var Age=new Iu({id:"loaders.gl"});var Kbt=/\.([^.]+)$/;async function Cge(e,t=[],r,n){if(!Dge(e))return null;let i=Sge(e,t,{...r,nothrow:!0},n);if(i)return i;if($o(e)&&(e=await e.slice(0,10).arrayBuffer(),i=Sge(e,t,r,n)),!i&&!(r!=null&&r.nothrow))throw new Error(kge(e));return i}function Sge(e,t=[],r,n){if(!Dge(e))return null;if(t&&!Array.isArray(t))return kj(t);let i=[];t&&(i=i.concat(t)),r!=null&&r.ignoreRegisteredLoaders||i.push(...Ege()),Ybt(i);let a=Jbt(e,i,r,n);if(!a&&!(r!=null&&r.nothrow))throw new Error(kge(e));return a}function Jbt(e,t,r,n){let i=Vd(e),a=Nb(e),o=xg(i)||(n==null?void 0:n.url),s=null,u="";return r!=null&&r.mimeType&&(s=Fj(t,r==null?void 0:r.mimeType),u=`match forced by supplied MIME type ${r==null?void 0:r.mimeType}`),s=s||Xbt(t,o),u=u||(s?`matched url ${o}`:""),s=s||Fj(t,a),u=u||(s?`matched MIME type ${a}`:""),s=s||Zbt(t,e),u=u||(s?`matched initial data ${Fge(e)}`:""),r!=null&&r.fallbackMimeType&&(s=s||Fj(t,r==null?void 0:r.fallbackMimeType),u=u||(s?`matched fallback MIME type ${a}`:"")),u&&Age.log(1,`selectLoader selected ${s==null?void 0:s.name}: ${u}.`),s}function Dge(e){return!(e instanceof Response&&e.status===204)}function kge(e){let t=Vd(e),r=Nb(e),n="No valid loader found (";n+=t?`${$a.filename(t)}, `:"no url provided, ",n+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let i=e?Fge(e):"";return n+=i?` first bytes: "${i}"`:"first bytes: not available",n+=")",n}function Ybt(e){for(let t of e)kj(t)}function Xbt(e,t){let r=t&&Kbt.exec(t),n=r&&r[1];return n?Qbt(e,n):null}function Qbt(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 Fj(e,t){var r;for(let n of e)if((r=n.mimeTypes)!=null&&r.some(i=>Aj(t,i))||Aj(t,`application/x.${n.id}`))return n;return null}function Zbt(e,t){if(!t)return null;for(let r of e)if(typeof t=="string"){if(eyt(t,r))return r}else if(ArrayBuffer.isView(t)){if(Tge(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer&&Tge(t,0,r))return r;return null}function eyt(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some(n=>e.startsWith(n))}function Tge(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(i=>tyt(e,t,r,i))}function tyt(e,t,r,n){if(n instanceof ArrayBuffer)return Mu(n,e,n.byteLength);switch(typeof n){case"function":return n(e);case"string":let i=Bj(e,t,n.length);return n===i;default:return!1}}function Fge(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?Bj(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?Bj(e,0,t):""}function Bj(e,t,r){if(e.byteLength<t+r)return"";let n=new DataView(e),i="";for(let a=0;a<r;a++)i+=String.fromCharCode(n.getUint8(t+a));return i}function*Bge(e,t){let r=(t==null?void 0:t.chunkSize)||262144,n=0,i=new TextEncoder;for(;n<e.length;){let a=Math.min(e.length-n,r),o=e.slice(n,n+a);n+=a,yield i.encode(o)}}function*Pge(e,t={}){let{chunkSize:r=262144}=t,n=0;for(;n<e.byteLength;){let i=Math.min(e.byteLength-n,r),a=new ArrayBuffer(i),o=new Uint8Array(e,n,i);new Uint8Array(a).set(o),n+=i,yield a}}async function*Oge(e,t){let r=(t==null?void 0:t.chunkSize)||1048576,n=0;for(;n<e.size;){let i=n+r,a=await e.slice(n,i).arrayBuffer();n=i,yield a}}function Pj(e,t){return jr?ryt(e,t):nyt(e,t)}async function*ryt(e,t){let r=e.getReader(),n;try{for(;;){let i=n||r.read();t!=null&&t._streamReadAhead&&(n=r.read());let{done:a,value:o}=await i;if(a)return;yield Hc(o)}}catch{r.releaseLock()}}async function*nyt(e,t){for await(let r of e)yield Hc(r)}function Ige(e,t){if(typeof e=="string")return Bge(e,t);if(e instanceof ArrayBuffer)return Pge(e,t);if($o(e))return Oge(e,t);if(yT(e))return Pj(e,t);if(Vo(e))return Pj(e.body,t);throw new Error("makeIterator")}var Rge="Cannot convert supplied data type";function iyt(e,t,r){if(t.text&&typeof e=="string")return e;if(pge(e)&&(e=e.buffer),e instanceof ArrayBuffer){let n=e;return t.text&&!t.binary?new TextDecoder("utf8").decode(n):n}if(ArrayBuffer.isView(e)){if(t.text&&!t.binary)return new TextDecoder("utf8").decode(e);let n=e.buffer,i=e.byteLength||e.length;return(e.byteOffset!==0||i!==n.byteLength)&&(n=n.slice(e.byteOffset,e.byteOffset+i)),n}throw new Error(Rge)}async function jge(e,t,r){let n=e instanceof ArrayBuffer||ArrayBuffer.isView(e);if(typeof e=="string"||n)return iyt(e,t,r);if($o(e)&&(e=await wT(e)),Vo(e)){let i=e;return await xge(i),t.binary?await i.arrayBuffer():await i.text()}if(yT(e)&&(e=Ige(e,r)),lge(e)||fge(e))return gd(e);throw new Error(Rge)}function ST(e,t){let r=bg(),n=e||r;return typeof n.fetch=="function"?n.fetch:Wd(n.fetch)?i=>Pa(i,n.fetch):t!=null&&t.fetch?t==null?void 0:t.fetch:Pa}function Mge(e,t,r){if(r)return r;let n={fetch:ST(t,e),...e};if(n.url){let i=xg(n.url);n.baseUrl=i,n.queryString=mge(n.url),n.filename=$a.filename(i),n.baseUrl=$a.dirname(i)}return Array.isArray(n.loaders)||(n.loaders=null),n}function Lge(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 bo(e,t,r,n){t&&!Array.isArray(t)&&!Ub(t)&&(n=void 0,r=t,t=void 0),e=await e,r=r||{};let i=Vd(e),o=Lge(t,n),s=await Cge(e,o,r);return s?(r=wge(r,s,o,i),n=Mge({url:i,_parse:bo,loaders:o},r,n||null),await ayt(s,e,r,n)):null}async function ayt(e,t,r,n){if(CB(e),r=yB(e.options,r),Vo(t)){let a=t,{ok:o,redirected:s,status:u,statusText:c,type:l,url:f}=a,p=Object.fromEntries(a.headers.entries());n.response={headers:p,ok:o,redirected:s,status:u,statusText:c,type:l,url:f}}t=await jge(t,e,r);let i=e;if(i.parseTextSync&&typeof t=="string")return i.parseTextSync(t,r,n);if(kB(e,r))return await FB(e,t,r,n,bo);if(i.parseText&&typeof t=="string")return await i.parseText(t,r,n);if(i.parse)return await i.parse(t,r,n);throw Wi(!i.parseSync),new Error(`${e.id} loader - no parser found and worker is disabled`)}function qge(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 Oj(e){let t=1/0,r=1/0,n=1/0,i=-1/0,a=-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,i=l>i?l:i,a=f>a?f:a,o=p>o?p:o}return[[t,r,n],[i,a,o]]}function Ij(e,t,r){let n=qge(t.value),i=r||Nge(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:n}]},nullable:!1,metadata:i}}function Nge(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 fn(e,t,r,n){let i,a;!Array.isArray(t)&&!Ub(t)?(i=[],a=t,n=void 0):(i=t,a=r);let o=ST(a),s=e;return typeof e=="string"&&(s=await o(e)),$o(e)&&(s=await o(e)),Array.isArray(i)?await bo(s,i,a):await bo(s,i,a)}async function yg(e,t,r){return r={...bg(),...r},t.encodeURLtoURL?oyt(t,e,r):BB(t,r)?await TB(t,e,r):await t.encode(e,r)}function TT(e,t,r){if(t.encodeSync)return t.encodeSync(e,r);if(t.encodeTextSync)return new TextEncoder().encode(t.encodeTextSync(e,r));throw new Error(`Writer ${t.name} could not synchronously encode data`)}async function Gge(e,t,r,n){if(e=Lu(e),t=Lu(t),jr||!r.encodeURLtoURL)throw new Error;return await r.encodeURLtoURL(e,t,n)}async function oyt(e,t,r){if(jr)throw new Error(`Writer ${e.name} not supported in browser`);let n=Uge("input");await new Wc(n,"w").write(t);let a=Uge("output"),o=await Gge(n,a,e,r);return(await Pa(o)).arrayBuffer()}function Uge(e){return`/tmp/${e}`}var syt=1/Math.PI*180,uyt=1/180*Math.PI,cyt={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...cyt}};var Qr=globalThis.mathgl.config;function Rj(e,{precision:t=Qr.precision}={}){return e=lyt(e),"".concat(parseFloat(e.toPrecision(t)))}function Ko(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function jj(e){return zge(e)}function Mj(e){return cl(e)}function zge(e,t){return qj(e,r=>r*uyt,t)}function cl(e,t){return qj(e,r=>r*syt,t)}function Lj(e,t,r){return qj(e,n=>Math.max(t,Math.min(r,n)))}function yo(e,t,r){let n=Qr.EPSILON;r&&(Qr.EPSILON=r);try{if(e===t)return!0;if(Ko(e)&&Ko(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(!yo(e[i],t[i]))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)<=Qr.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{Qr.EPSILON=n}}function lyt(e){return Math.round(e/Qr.EPSILON)*Qr.EPSILON}function fyt(e){return e.clone?e.clone():new Array(e.length)}function qj(e,t,r){if(Ko(e)){let n=e;r=r||fyt(n);for(let i=0;i<r.length&&i<n.length;++i){let a=typeof e=="number"?e:e[i];r[i]=t(a,i,r)}return r}return t(e)}function pyt(e){function t(){var r=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(r,Object.getPrototypeOf(this)),r}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}var tp=class extends pyt(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:Ko(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Qr)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+Rj(this[n],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(r,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!yo(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 i=0;i<this.ELEMENTS;++i){let a=t[i],o=typeof r=="number"?r:r[i];this[i]=a+n*(o-a)}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(Qr.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let 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 dyt(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 nr(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(JSON.stringify(e)));return e}function rp(e,t,r=""){if(Qr.debug&&!dyt(e,t))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return e}function Pi(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}var np=class extends tp{get x(){return this[0]}set x(t){this[0]=nr(t)}get y(){return this[1]}set y(t){this[1]=nr(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 i=this[n]-t[n];r+=i*i}return nr(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return nr(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 Pi(t>=0&&t<this.ELEMENTS,"index is out of range"),nr(this[t])}setComponent(t,r){return Pi(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 bn=typeof Float32Array<"u"?Float32Array:Array,Gb=Math.random;function _g(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var lnr=Math.PI/180;function hyt(){let e=new bn(2);return bn!=Float32Array&&(e[0]=0,e[1]=0),e}function Hge(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e}function Wge(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5],e}function CT(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e}function DT(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e}var fnr=function(){let e=hyt();return function(t,r,n,i,a,o){let s,u;for(r||(r=2),n||(n=0),i?u=Math.min(i*r+n,t.length):u=t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],a(e,e,o),t[s]=e[0],t[s+1]=e[1];return t}}();function kT(e,t,r){let n=t[0],i=t[1],a=r[3]*n+r[7]*i||1;return e[0]=(r[0]*n+r[4]*i)/a,e[1]=(r[1]*n+r[5]*i)/a,e}function FT(e,t,r){let n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a||1;return e[0]=(r[0]*n+r[4]*i+r[8]*a)/o,e[1]=(r[1]*n+r[5]*i+r[9]*a)/o,e[2]=(r[2]*n+r[6]*i+r[10]*a)/o,e}function Vge(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e}function $ge(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e[3]=t[3],e}function BT(e,t,r){let n=t[0],i=t[1],a=t[2];return e[0]=r[0]*n+r[3]*i+r[6]*a,e[1]=r[1]*n+r[4]*i+r[7]*a,e[2]=r[2]*n+r[5]*i+r[8]*a,e[3]=t[3],e}var $d=class extends np{constructor(t=0,r=0){super(2),Ko(t)&&arguments.length===1?this.copy(t):(Qr.debug&&(nr(t),nr(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 Qr.debug&&(nr(t.x),nr(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 DT(this,this,t),this.check()}transformAsVector(t){return kT(this,this,t),this.check()}transformByMatrix3(t){return CT(this,this,t),this.check()}transformByMatrix2x3(t){return Wge(this,this,t),this.check()}transformByMatrix2(t){return Hge(this,this,t),this.check()}};var Eg={};ui(Eg,{add:()=>xyt,angle:()=>Hj,bezier:()=>Byt,ceil:()=>byt,clone:()=>myt,copy:()=>gyt,create:()=>PT,cross:()=>Kd,dist:()=>Nyt,distance:()=>Qge,div:()=>qyt,divide:()=>Xge,dot:()=>zb,equals:()=>jyt,exactEquals:()=>Ryt,floor:()=>yyt,forEach:()=>zyt,fromValues:()=>OT,hermite:()=>Fyt,inverse:()=>Cyt,len:()=>Wj,length:()=>Kge,lerp:()=>Dyt,max:()=>wyt,min:()=>_yt,mul:()=>Lyt,multiply:()=>Yge,negate:()=>Tyt,normalize:()=>Nj,random:()=>Pyt,rotateX:()=>Uj,rotateY:()=>Gj,rotateZ:()=>zj,round:()=>Eyt,scale:()=>Ayt,scaleAndAdd:()=>Syt,set:()=>vyt,slerp:()=>kyt,sqrDist:()=>Uyt,sqrLen:()=>Gyt,squaredDistance:()=>Zge,squaredLength:()=>e1e,str:()=>Iyt,sub:()=>Myt,subtract:()=>Jge,transformMat3:()=>Hb,transformMat4:()=>Jd,transformQuat:()=>Wb,zero:()=>Oyt});function PT(){let e=new bn(3);return bn!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function myt(e){let t=new bn(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Kge(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function OT(e,t,r){let n=new bn(3);return n[0]=e,n[1]=t,n[2]=r,n}function gyt(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function vyt(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function xyt(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function Jge(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function Yge(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function Xge(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function byt(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function yyt(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function _yt(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 wyt(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]=_g(t[0]),e[1]=_g(t[1]),e[2]=_g(t[2]),e}function Ayt(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function Syt(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 Qge(e,t){let r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(r*r+n*n+i*i)}function Zge(e,t){let r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return r*r+n*n+i*i}function e1e(e){let t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function Tyt(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function Cyt(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Nj(e,t){let r=t[0],n=t[1],i=t[2],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function zb(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Kd(e,t,r){let n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2];return e[0]=i*u-a*s,e[1]=a*o-n*u,e[2]=n*s-i*o,e}function Dyt(e,t,r,n){let i=t[0],a=t[1],o=t[2];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e}function kyt(e,t,r,n){let i=Math.acos(Math.min(Math.max(zb(t,r),-1),1)),a=Math.sin(i),o=Math.sin((1-n)*i)/a,s=Math.sin(n*i)/a;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 Fyt(e,t,r,n,i,a){let o=a*a,s=o*(2*a-3)+1,u=o*(a-2)+a,c=o*(a-1),l=o*(3-2*a);return e[0]=t[0]*s+r[0]*u+n[0]*c+i[0]*l,e[1]=t[1]*s+r[1]*u+n[1]*c+i[1]*l,e[2]=t[2]*s+r[2]*u+n[2]*c+i[2]*l,e}function Byt(e,t,r,n,i,a){let o=1-a,s=o*o,u=a*a,c=s*o,l=3*a*s,f=3*u*o,p=u*a;return e[0]=t[0]*c+r[0]*l+n[0]*f+i[0]*p,e[1]=t[1]*c+r[1]*l+n[1]*f+i[1]*p,e[2]=t[2]*c+r[2]*l+n[2]*f+i[2]*p,e}function Pyt(e,t){t=t===void 0?1:t;let r=Gb()*2*Math.PI,n=Gb()*2-1,i=Math.sqrt(1-n*n)*t;return e[0]=Math.cos(r)*i,e[1]=Math.sin(r)*i,e[2]=n*t,e}function Jd(e,t,r){let n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,e}function Hb(e,t,r){let n=t[0],i=t[1],a=t[2];return e[0]=n*r[0]+i*r[3]+a*r[6],e[1]=n*r[1]+i*r[4]+a*r[7],e[2]=n*r[2]+i*r[5]+a*r[8],e}function Wb(e,t,r){let n=r[0],i=r[1],a=r[2],o=r[3],s=t[0],u=t[1],c=t[2],l=i*c-a*u,f=a*s-n*c,p=n*u-i*s,d=i*p-a*f,h=a*l-n*p,v=n*f-i*l,m=o*2;return l*=m,f*=m,p*=m,d*=2,h*=2,v*=2,e[0]=s+l+d,e[1]=u+f+h,e[2]=c+p+v,e}function Uj(e,t,r,n){let i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function Gj(e,t,r,n){let i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function zj(e,t,r,n){let i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function Hj(e,t){let r=e[0],n=e[1],i=e[2],a=t[0],o=t[1],s=t[2],u=Math.sqrt((r*r+n*n+i*i)*(a*a+o*o+s*s)),c=u&&zb(e,t)/u;return Math.acos(Math.min(Math.max(c,-1),1))}function Oyt(e){return e[0]=0,e[1]=0,e[2]=0,e}function Iyt(e){return"vec3(".concat(e[0],", ").concat(e[1],", ").concat(e[2],")")}function Ryt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function jyt(e,t){let r=e[0],n=e[1],i=e[2],a=t[0],o=t[1],s=t[2];return Math.abs(r-a)<=1e-6*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-o)<=1e-6*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-s)<=1e-6*Math.max(1,Math.abs(i),Math.abs(s))}var Myt=Jge,Lyt=Yge,qyt=Xge,Nyt=Qge,Uyt=Zge,Wj=Kge,Gyt=e1e,zyt=function(){let e=PT();return function(t,r,n,i,a,o){let s,u;for(r||(r=3),n||(n=0),i?u=Math.min(i*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],a(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2];return t}}();var Vj=[0,0,0],IT,ce=class extends np{static get ZERO(){return IT||(IT=new ce(0,0,0),Object.freeze(IT)),IT}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&Ko(t)?this.copy(t):(Qr.debug&&(nr(t),nr(r),nr(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 Qr.debug&&(nr(t.x),nr(t.y),nr(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]=nr(t)}angle(t){return Hj(this,t)}cross(t){return Kd(this,this,t),this.check()}rotateX({radians:t,origin:r=Vj}){return Uj(this,this,r,t),this.check()}rotateY({radians:t,origin:r=Vj}){return Gj(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=Vj}){return zj(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Jd(this,this,t),this.check()}transformAsVector(t){return FT(this,this,t),this.check()}transformByMatrix3(t){return Hb(this,this,t),this.check()}transformByMatrix2(t){return Vge(this,this,t),this.check()}transformByQuaternion(t){return Wb(this,this,t),this.check()}};var RT,Jo=class extends np{static get ZERO(){return RT||(RT=new Jo(0,0,0,0),Object.freeze(RT)),RT}constructor(t=0,r=0,n=0,i=0){super(-0,-0,-0,-0),Ko(t)&&arguments.length===1?this.copy(t):(Qr.debug&&(nr(t),nr(r),nr(n),nr(i)),this[0]=t,this[1]=r,this[2]=n,this[3]=i)}set(t,r,n,i){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,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 Qr.debug&&(nr(t.x),nr(t.y),nr(t.z),nr(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]=nr(t)}get w(){return this[3]}set w(t){this[3]=nr(t)}transform(t){return Jd(this,this,t),this.check()}transformByMatrix3(t){return BT(this,this,t),this.check()}transformByMatrix2(t){return $ge(this,this,t),this.check()}transformByQuaternion(t){return Wb(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Ag=class extends tp{toString(){let t="[";if(Qr.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)t+=" ".concat(this[n*this.RANK+r])}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=" ".concat(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]=nr(n),this}getColumn(t,r=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)r[i]=this[n+i];return r}setColumn(t,r){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)this[n+i]=r[i];return this}};function t1e(){let e=new bn(9);return bn!=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 r1e(e,t){if(e===t){let r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}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 n1e(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],f=l*o-s*c,p=-l*a+s*u,d=c*a-o*u,h=r*f+n*p+i*d;return h?(h=1/h,e[0]=f*h,e[1]=(-l*n+i*c)*h,e[2]=(s*n-i*o)*h,e[3]=p*h,e[4]=(l*r-i*u)*h,e[5]=(-s*r+i*a)*h,e[6]=d*h,e[7]=(-c*r+n*u)*h,e[8]=(o*r-n*a)*h,e):null}function i1e(e){let t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8];return t*(c*a-o*u)+r*(-c*i+o*s)+n*(u*i-a*s)}function $j(e,t,r){let n=t[0],i=t[1],a=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],v=r[3],m=r[4],b=r[5],_=r[6],E=r[7],T=r[8];return e[0]=p*n+d*o+h*c,e[1]=p*i+d*s+h*l,e[2]=p*a+d*u+h*f,e[3]=v*n+m*o+b*c,e[4]=v*i+m*s+b*l,e[5]=v*a+m*u+b*f,e[6]=_*n+E*o+T*c,e[7]=_*i+E*s+T*l,e[8]=_*a+E*u+T*f,e}function a1e(e,t,r){let n=t[0],i=t[1],a=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]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=u,e[6]=p*n+d*o+c,e[7]=p*i+d*s+l,e[8]=p*a+d*u+f,e}function o1e(e,t,r){let n=t[0],i=t[1],a=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*i+p*s,e[2]=d*a+p*u,e[3]=d*o-p*n,e[4]=d*s-p*i,e[5]=d*u-p*a,e[6]=c,e[7]=l,e[8]=f,e}function Kj(e,t,r){let n=r[0],i=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function s1e(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,f=n*s,p=i*o,d=i*s,h=i*u,v=a*o,m=a*s,b=a*u;return e[0]=1-f-h,e[3]=l-b,e[6]=p+m,e[1]=l+b,e[4]=1-c-h,e[7]=d-v,e[2]=p-m,e[5]=d+v,e[8]=1-c-f,e}var Jj;(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"})(Jj||(Jj={}));var Wyt=Object.freeze([1,0,0,0,1,0,0,0,1]),Sr=class extends Ag{static get IDENTITY(){return $yt()}static get ZERO(){return Vyt()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Jj}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(Wyt)}fromObject(t){return this.check()}fromQuaternion(t){return s1e(this,t),this.check()}set(t,r,n,i,a,o,s,u,c){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=a,this[5]=o,this[6]=s,this[7]=u,this[8]=c,this.check()}setRowMajor(t,r,n,i,a,o,s,u,c){return this[0]=t,this[1]=i,this[2]=s,this[3]=r,this[4]=a,this[5]=u,this[6]=n,this[7]=o,this[8]=c,this.check()}determinant(){return i1e(this)}transpose(){return r1e(this,this),this.check()}invert(){return n1e(this,this),this.check()}multiplyLeft(t){return $j(this,t,this),this.check()}multiplyRight(t){return $j(this,this,t),this.check()}rotate(t){return o1e(this,this,t),this.check()}scale(t){return Array.isArray(t)?Kj(this,this,t):Kj(this,this,[t,t]),this.check()}translate(t){return a1e(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=CT(r||[-0,-0],t,this);break;case 3:n=Hb(r||[-0,-0,-0],t,this);break;case 4:n=BT(r||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return rp(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)}},jT,MT=null;function Vyt(){return jT||(jT=new Sr([0,0,0,0,0,0,0,0,0]),Object.freeze(jT)),jT}function $yt(){return MT||(MT=new Sr,Object.freeze(MT)),MT}var LT={};ui(LT,{add:()=>x2t,adjoint:()=>Zyt,clone:()=>Jyt,copy:()=>Yyt,create:()=>Kyt,decompose:()=>c2t,determinant:()=>Qj,equals:()=>w2t,exactEquals:()=>_2t,frob:()=>v2t,fromQuat:()=>aM,fromQuat2:()=>o2t,fromRotation:()=>r2t,fromRotationTranslation:()=>c1e,fromRotationTranslationScale:()=>l2t,fromRotationTranslationScaleOrigin:()=>f2t,fromScaling:()=>t2t,fromTranslation:()=>e2t,fromValues:()=>Xyt,fromXRotation:()=>n2t,fromYRotation:()=>i2t,fromZRotation:()=>a2t,frustum:()=>oM,getRotation:()=>u2t,getScaling:()=>l1e,getTranslation:()=>s2t,identity:()=>u1e,invert:()=>Xj,lookAt:()=>cM,mul:()=>E2t,multiply:()=>Vb,multiplyScalar:()=>b2t,multiplyScalarAndAdd:()=>y2t,ortho:()=>uM,orthoNO:()=>p1e,orthoZO:()=>h2t,perspective:()=>sM,perspectiveFromFieldOfView:()=>d2t,perspectiveNO:()=>f1e,perspectiveZO:()=>p2t,rotate:()=>tM,rotateX:()=>rM,rotateY:()=>nM,rotateZ:()=>iM,scale:()=>eM,set:()=>Qyt,str:()=>g2t,sub:()=>A2t,subtract:()=>d1e,targetTo:()=>m2t,translate:()=>Zj,transpose:()=>Yj});function Kyt(){let e=new bn(16);return bn!=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 Jyt(e){let t=new bn(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 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],e}function Xyt(e,t,r,n,i,a,o,s,u,c,l,f,p,d,h,v){let m=new bn(16);return m[0]=e,m[1]=t,m[2]=r,m[3]=n,m[4]=i,m[5]=a,m[6]=o,m[7]=s,m[8]=u,m[9]=c,m[10]=l,m[11]=f,m[12]=p,m[13]=d,m[14]=h,m[15]=v,m}function Qyt(e,t,r,n,i,a,o,s,u,c,l,f,p,d,h,v,m){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=a,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]=v,e[15]=m,e}function u1e(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 Yj(e,t){if(e===t){let r=t[1],n=t[2],i=t[3],a=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]=a,e[11]=t[14],e[12]=i,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 Xj(e,t){let r=t[0],n=t[1],i=t[2],a=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],v=t[13],m=t[14],b=t[15],_=r*s-n*o,E=r*u-i*o,T=r*c-a*o,S=n*u-i*s,D=n*c-a*s,I=i*c-a*u,L=l*v-f*h,F=l*m-p*h,P=l*b-d*h,M=f*m-p*v,U=f*b-d*v,W=p*b-d*m,V=_*W-E*U+T*M+S*P-D*F+I*L;return V?(V=1/V,e[0]=(s*W-u*U+c*M)*V,e[1]=(i*U-n*W-a*M)*V,e[2]=(v*I-m*D+b*S)*V,e[3]=(p*D-f*I-d*S)*V,e[4]=(u*P-o*W-c*F)*V,e[5]=(r*W-i*P+a*F)*V,e[6]=(m*T-h*I-b*E)*V,e[7]=(l*I-p*T+d*E)*V,e[8]=(o*U-s*P+c*L)*V,e[9]=(n*P-r*U-a*L)*V,e[10]=(h*D-v*T+b*_)*V,e[11]=(f*T-l*D-d*_)*V,e[12]=(s*F-o*M-u*L)*V,e[13]=(r*M-n*F+i*L)*V,e[14]=(v*E-h*S-m*_)*V,e[15]=(l*S-f*E+p*_)*V,e):null}function Zyt(e,t){let r=t[0],n=t[1],i=t[2],a=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],v=t[13],m=t[14],b=t[15],_=r*s-n*o,E=r*u-i*o,T=r*c-a*o,S=n*u-i*s,D=n*c-a*s,I=i*c-a*u,L=l*v-f*h,F=l*m-p*h,P=l*b-d*h,M=f*m-p*v,U=f*b-d*v,W=p*b-d*m;return e[0]=s*W-u*U+c*M,e[1]=i*U-n*W-a*M,e[2]=v*I-m*D+b*S,e[3]=p*D-f*I-d*S,e[4]=u*P-o*W-c*F,e[5]=r*W-i*P+a*F,e[6]=m*T-h*I-b*E,e[7]=l*I-p*T+d*E,e[8]=o*U-s*P+c*L,e[9]=n*P-r*U-a*L,e[10]=h*D-v*T+b*_,e[11]=f*T-l*D-d*_,e[12]=s*F-o*M-u*L,e[13]=r*M-n*F+i*L,e[14]=v*E-h*S-m*_,e[15]=l*S-f*E+p*_,e}function Qj(e){let t=e[0],r=e[1],n=e[2],i=e[3],a=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],v=e[14],m=e[15],b=t*o-r*a,_=t*s-n*a,E=r*s-n*o,T=c*h-l*d,S=c*v-f*d,D=l*v-f*h,I=t*D-r*S+n*T,L=a*D-o*S+s*T,F=c*E-l*_+f*b,P=d*E-h*_+v*b;return u*I-i*L+m*F-p*P}function Vb(e,t,r){let n=t[0],i=t[1],a=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],v=t[12],m=t[13],b=t[14],_=t[15],E=r[0],T=r[1],S=r[2],D=r[3];return e[0]=E*n+T*s+S*f+D*v,e[1]=E*i+T*u+S*p+D*m,e[2]=E*a+T*c+S*d+D*b,e[3]=E*o+T*l+S*h+D*_,E=r[4],T=r[5],S=r[6],D=r[7],e[4]=E*n+T*s+S*f+D*v,e[5]=E*i+T*u+S*p+D*m,e[6]=E*a+T*c+S*d+D*b,e[7]=E*o+T*l+S*h+D*_,E=r[8],T=r[9],S=r[10],D=r[11],e[8]=E*n+T*s+S*f+D*v,e[9]=E*i+T*u+S*p+D*m,e[10]=E*a+T*c+S*d+D*b,e[11]=E*o+T*l+S*h+D*_,E=r[12],T=r[13],S=r[14],D=r[15],e[12]=E*n+T*s+S*f+D*v,e[13]=E*i+T*u+S*p+D*m,e[14]=E*a+T*c+S*d+D*b,e[15]=E*o+T*l+S*h+D*_,e}function Zj(e,t,r){let n=r[0],i=r[1],a=r[2],o,s,u,c,l,f,p,d,h,v,m,b;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*a+t[12],e[13]=t[1]*n+t[5]*i+t[9]*a+t[13],e[14]=t[2]*n+t[6]*i+t[10]*a+t[14],e[15]=t[3]*n+t[7]*i+t[11]*a+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],v=t[9],m=t[10],b=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]=v,e[10]=m,e[11]=b,e[12]=o*n+l*i+h*a+t[12],e[13]=s*n+f*i+v*a+t[13],e[14]=u*n+p*i+m*a+t[14],e[15]=c*n+d*i+b*a+t[15]),e}function eM(e,t,r){let n=r[0],i=r[1],a=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]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function tM(e,t,r,n){let i=n[0],a=n[1],o=n[2],s=Math.sqrt(i*i+a*a+o*o),u,c,l,f,p,d,h,v,m,b,_,E,T,S,D,I,L,F,P,M,U,W,V,Z;return s<1e-6?null:(s=1/s,i*=s,a*=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],v=t[4],m=t[5],b=t[6],_=t[7],E=t[8],T=t[9],S=t[10],D=t[11],I=i*i*l+u,L=a*i*l+o*c,F=o*i*l-a*c,P=i*a*l-o*c,M=a*a*l+u,U=o*a*l+i*c,W=i*o*l+a*c,V=a*o*l-i*c,Z=o*o*l+u,e[0]=f*I+v*L+E*F,e[1]=p*I+m*L+T*F,e[2]=d*I+b*L+S*F,e[3]=h*I+_*L+D*F,e[4]=f*P+v*M+E*U,e[5]=p*P+m*M+T*U,e[6]=d*P+b*M+S*U,e[7]=h*P+_*M+D*U,e[8]=f*W+v*V+E*Z,e[9]=p*W+m*V+T*Z,e[10]=d*W+b*V+S*Z,e[11]=h*W+_*V+D*Z,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function rM(e,t,r){let n=Math.sin(r),i=Math.cos(r),a=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]=a*i+c*n,e[5]=o*i+l*n,e[6]=s*i+f*n,e[7]=u*i+p*n,e[8]=c*i-a*n,e[9]=l*i-o*n,e[10]=f*i-s*n,e[11]=p*i-u*n,e}function nM(e,t,r){let n=Math.sin(r),i=Math.cos(r),a=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]=a*i-c*n,e[1]=o*i-l*n,e[2]=s*i-f*n,e[3]=u*i-p*n,e[8]=a*n+c*i,e[9]=o*n+l*i,e[10]=s*n+f*i,e[11]=u*n+p*i,e}function iM(e,t,r){let n=Math.sin(r),i=Math.cos(r),a=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]=a*i+c*n,e[1]=o*i+l*n,e[2]=s*i+f*n,e[3]=u*i+p*n,e[4]=c*i-a*n,e[5]=l*i-o*n,e[6]=f*i-s*n,e[7]=p*i-u*n,e}function e2t(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 t2t(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 r2t(e,t,r){let n=r[0],i=r[1],a=r[2],o=Math.sqrt(n*n+i*i+a*a),s,u,c;return o<1e-6?null:(o=1/o,n*=o,i*=o,a*=o,u=Math.sin(t),s=Math.cos(t),c=1-s,e[0]=n*n*c+s,e[1]=i*n*c+a*u,e[2]=a*n*c-i*u,e[3]=0,e[4]=n*i*c-a*u,e[5]=i*i*c+s,e[6]=a*i*c+n*u,e[7]=0,e[8]=n*a*c+i*u,e[9]=i*a*c-n*u,e[10]=a*a*c+s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function n2t(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 i2t(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 a2t(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 c1e(e,t,r){let n=t[0],i=t[1],a=t[2],o=t[3],s=n+n,u=i+i,c=a+a,l=n*s,f=n*u,p=n*c,d=i*u,h=i*c,v=a*c,m=o*s,b=o*u,_=o*c;return e[0]=1-(d+v),e[1]=f+_,e[2]=p-b,e[3]=0,e[4]=f-_,e[5]=1-(l+v),e[6]=h+m,e[7]=0,e[8]=p+b,e[9]=h-m,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 o2t(e,t){let r=new bn(3),n=-t[0],i=-t[1],a=-t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=n*n+i*i+a*a+o*o;return f>0?(r[0]=(s*o+l*n+u*a-c*i)*2/f,r[1]=(u*o+l*i+c*n-s*a)*2/f,r[2]=(c*o+l*a+s*i-u*n)*2/f):(r[0]=(s*o+l*n+u*a-c*i)*2,r[1]=(u*o+l*i+c*n-s*a)*2,r[2]=(c*o+l*a+s*i-u*n)*2),c1e(e,t,r),e}function s2t(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function l1e(e,t){let r=t[0],n=t[1],i=t[2],a=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+i*i),e[1]=Math.sqrt(a*a+o*o+s*s),e[2]=Math.sqrt(u*u+c*c+l*l),e}function u2t(e,t){let r=new bn(3);l1e(r,t);let n=1/r[0],i=1/r[1],a=1/r[2],o=t[0]*n,s=t[1]*i,u=t[2]*a,c=t[4]*n,l=t[5]*i,f=t[6]*a,p=t[8]*n,d=t[9]*i,h=t[10]*a,v=o+l+h,m=0;return v>0?(m=Math.sqrt(v+1)*2,e[3]=.25*m,e[0]=(f-d)/m,e[1]=(p-u)/m,e[2]=(s-c)/m):o>l&&o>h?(m=Math.sqrt(1+o-l-h)*2,e[3]=(f-d)/m,e[0]=.25*m,e[1]=(s+c)/m,e[2]=(p+u)/m):l>h?(m=Math.sqrt(1+l-o-h)*2,e[3]=(p-u)/m,e[0]=(s+c)/m,e[1]=.25*m,e[2]=(f+d)/m):(m=Math.sqrt(1+h-o-l)*2,e[3]=(s-c)/m,e[0]=(p+u)/m,e[1]=(f+d)/m,e[2]=.25*m),e}function c2t(e,t,r,n){t[0]=n[12],t[1]=n[13],t[2]=n[14];let i=n[0],a=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(i*i+a*a+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],v=1/r[2],m=i*d,b=a*h,_=o*v,E=s*d,T=u*h,S=c*v,D=l*d,I=f*h,L=p*v,F=m+T+L,P=0;return F>0?(P=Math.sqrt(F+1)*2,e[3]=.25*P,e[0]=(S-I)/P,e[1]=(D-_)/P,e[2]=(b-E)/P):m>T&&m>L?(P=Math.sqrt(1+m-T-L)*2,e[3]=(S-I)/P,e[0]=.25*P,e[1]=(b+E)/P,e[2]=(D+_)/P):T>L?(P=Math.sqrt(1+T-m-L)*2,e[3]=(D-_)/P,e[0]=(b+E)/P,e[1]=.25*P,e[2]=(S+I)/P):(P=Math.sqrt(1+L-m-T)*2,e[3]=(b-E)/P,e[0]=(D+_)/P,e[1]=(S+I)/P,e[2]=.25*P),e}function l2t(e,t,r,n){let i=t[0],a=t[1],o=t[2],s=t[3],u=i+i,c=a+a,l=o+o,f=i*u,p=i*c,d=i*l,h=a*c,v=a*l,m=o*l,b=s*u,_=s*c,E=s*l,T=n[0],S=n[1],D=n[2];return e[0]=(1-(h+m))*T,e[1]=(p+E)*T,e[2]=(d-_)*T,e[3]=0,e[4]=(p-E)*S,e[5]=(1-(f+m))*S,e[6]=(v+b)*S,e[7]=0,e[8]=(d+_)*D,e[9]=(v-b)*D,e[10]=(1-(f+h))*D,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function f2t(e,t,r,n,i){let a=t[0],o=t[1],s=t[2],u=t[3],c=a+a,l=o+o,f=s+s,p=a*c,d=a*l,h=a*f,v=o*l,m=o*f,b=s*f,_=u*c,E=u*l,T=u*f,S=n[0],D=n[1],I=n[2],L=i[0],F=i[1],P=i[2],M=(1-(v+b))*S,U=(d+T)*S,W=(h-E)*S,V=(d-T)*D,Z=(1-(p+b))*D,ee=(m+_)*D,ge=(h+E)*I,de=(m-_)*I,he=(1-(p+v))*I;return e[0]=M,e[1]=U,e[2]=W,e[3]=0,e[4]=V,e[5]=Z,e[6]=ee,e[7]=0,e[8]=ge,e[9]=de,e[10]=he,e[11]=0,e[12]=r[0]+L-(M*L+V*F+ge*P),e[13]=r[1]+F-(U*L+Z*F+de*P),e[14]=r[2]+P-(W*L+ee*F+he*P),e[15]=1,e}function aM(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,f=n*s,p=i*o,d=i*s,h=i*u,v=a*o,m=a*s,b=a*u;return e[0]=1-f-h,e[1]=l+b,e[2]=p-m,e[3]=0,e[4]=l-b,e[5]=1-c-h,e[6]=d+v,e[7]=0,e[8]=p+m,e[9]=d-v,e[10]=1-c-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function oM(e,t,r,n,i,a,o){let s=1/(r-t),u=1/(i-n),c=1/(a-o);return e[0]=a*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*u,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(i+n)*u,e[10]=(o+a)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*a*2*c,e[15]=0,e}function f1e(e,t,r,n,i){let a=1/Math.tan(t/2);if(e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let o=1/(n-i);e[10]=(i+n)*o,e[14]=2*i*n*o}else e[10]=-1,e[14]=-2*n;return e}var sM=f1e;function p2t(e,t,r,n,i){let a=1/Math.tan(t/2);if(e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let o=1/(n-i);e[10]=i*o,e[14]=i*n*o}else e[10]=-1,e[14]=-n;return e}function d2t(e,t,r,n){let i=Math.tan(t.upDegrees*Math.PI/180),a=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/(i+a);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]=(i-a)*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 p1e(e,t,r,n,i,a,o){let s=1/(t-r),u=1/(n-i),c=1/(a-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]=(i+n)*u,e[14]=(o+a)*c,e[15]=1,e}var uM=p1e;function h2t(e,t,r,n,i,a,o){let s=1/(t-r),u=1/(n-i),c=1/(a-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]=(i+n)*u,e[14]=a*c,e[15]=1,e}function cM(e,t,r,n){let i,a,o,s,u,c,l,f,p,d,h=t[0],v=t[1],m=t[2],b=n[0],_=n[1],E=n[2],T=r[0],S=r[1],D=r[2];return Math.abs(h-T)<1e-6&&Math.abs(v-S)<1e-6&&Math.abs(m-D)<1e-6?u1e(e):(f=h-T,p=v-S,d=m-D,i=1/Math.sqrt(f*f+p*p+d*d),f*=i,p*=i,d*=i,a=_*d-E*p,o=E*f-b*d,s=b*p-_*f,i=Math.sqrt(a*a+o*o+s*s),i?(i=1/i,a*=i,o*=i,s*=i):(a=0,o=0,s=0),u=p*s-d*o,c=d*a-f*s,l=f*o-p*a,i=Math.sqrt(u*u+c*c+l*l),i?(i=1/i,u*=i,c*=i,l*=i):(u=0,c=0,l=0),e[0]=a,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]=-(a*h+o*v+s*m),e[13]=-(u*h+c*v+l*m),e[14]=-(f*h+p*v+d*m),e[15]=1,e)}function m2t(e,t,r,n){let i=t[0],a=t[1],o=t[2],s=n[0],u=n[1],c=n[2],l=i-r[0],f=a-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,v=c*l-s*p,m=s*f-u*l;return d=h*h+v*v+m*m,d>0&&(d=1/Math.sqrt(d),h*=d,v*=d,m*=d),e[0]=h,e[1]=v,e[2]=m,e[3]=0,e[4]=f*m-p*v,e[5]=p*h-l*m,e[6]=l*v-f*h,e[7]=0,e[8]=l,e[9]=f,e[10]=p,e[11]=0,e[12]=i,e[13]=a,e[14]=o,e[15]=1,e}function g2t(e){return"mat4(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(e[3],", ").concat(e[4],", ").concat(e[5],", ").concat(e[6],", ").concat(e[7],", ").concat(e[8],", ").concat(e[9],", ").concat(e[10],", ").concat(e[11],", ").concat(e[12],", ").concat(e[13],", ").concat(e[14],", ").concat(e[15],")")}function v2t(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 x2t(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 d1e(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 b2t(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 y2t(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 _2t(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 w2t(e,t){let r=e[0],n=e[1],i=e[2],a=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],v=e[13],m=e[14],b=e[15],_=t[0],E=t[1],T=t[2],S=t[3],D=t[4],I=t[5],L=t[6],F=t[7],P=t[8],M=t[9],U=t[10],W=t[11],V=t[12],Z=t[13],ee=t[14],ge=t[15];return Math.abs(r-_)<=1e-6*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(i-T)<=1e-6*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(a-S)<=1e-6*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(o-D)<=1e-6*Math.max(1,Math.abs(o),Math.abs(D))&&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-F)<=1e-6*Math.max(1,Math.abs(c),Math.abs(F))&&Math.abs(l-P)<=1e-6*Math.max(1,Math.abs(l),Math.abs(P))&&Math.abs(f-M)<=1e-6*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(p-U)<=1e-6*Math.max(1,Math.abs(p),Math.abs(U))&&Math.abs(d-W)<=1e-6*Math.max(1,Math.abs(d),Math.abs(W))&&Math.abs(h-V)<=1e-6*Math.max(1,Math.abs(h),Math.abs(V))&&Math.abs(v-Z)<=1e-6*Math.max(1,Math.abs(v),Math.abs(Z))&&Math.abs(m-ee)<=1e-6*Math.max(1,Math.abs(m),Math.abs(ee))&&Math.abs(b-ge)<=1e-6*Math.max(1,Math.abs(b),Math.abs(ge))}var E2t=Vb,A2t=d1e;function S2t(){let e=new bn(4);return bn!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function h1e(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 m1e(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 g1e(e){let t=e[0],r=e[1],n=e[2],i=e[3];return Math.sqrt(t*t+r*r+n*n+i*i)}function v1e(e){let t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}function x1e(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=n*o,e[2]=i*o,e[3]=a*o,e}function b1e(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function y1e(e,t,r,n){let i=t[0],a=t[1],o=t[2],s=t[3];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e[3]=s+n*(r[3]-s),e}function _1e(e,t,r){let n=t[0],i=t[1],a=t[2],o=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,e[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,e[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,e[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,e}function w1e(e,t,r){let n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],c=r[3],l=c*n+s*a-u*i,f=c*i+u*n-o*a,p=c*a+o*i-s*n,d=-o*n-s*i-u*a;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 znr=function(){let e=S2t();return function(t,r,n,i,a,o){let s,u;for(r||(r=4),n||(n=0),i?u=Math.min(i*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],a(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 pM;(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"})(pM||(pM={}));var C2t=45*Math.PI/180,D2t=1,lM=.1,fM=500,k2t=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),zr=class extends Ag{static get IDENTITY(){return B2t()}static get ZERO(){return F2t()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return pM}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,i,a,o,s,u,c,l,f,p,d,h,v,m){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=a,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]=v,this[15]=m,this.check()}setRowMajor(t,r,n,i,a,o,s,u,c,l,f,p,d,h,v,m){return this[0]=t,this[1]=a,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]=v,this[12]=i,this[13]=u,this[14]=p,this[15]=m,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(k2t)}fromObject(t){return this.check()}fromQuaternion(t){return aM(this,t),this.check()}frustum(t){let{left:r,right:n,bottom:i,top:a,near:o=lM,far:s=fM}=t;return s===1/0?P2t(this,r,n,i,a,o):oM(this,r,n,i,a,o,s),this.check()}lookAt(t){let{eye:r,center:n=[0,0,0],up:i=[0,1,0]}=t;return cM(this,r,n,i),this.check()}ortho(t){let{left:r,right:n,bottom:i,top:a,near:o=lM,far:s=fM}=t;return uM(this,r,n,i,a,o,s),this.check()}orthographic(t){let{fovy:r=C2t,aspect:n=D2t,focalDistance:i=1,near:a=lM,far:o=fM}=t;E1e(r);let s=r/2,u=i*Math.tan(s),c=u*n;return this.ortho({left:-c,right:c,bottom:-u,top:u,near:a,far:o})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:n=1,near:i=.1,far:a=500}=t;return E1e(r),sM(this,r,n,i,a),this.check()}determinant(){return Qj(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),i=1/n[0],a=1/n[1],o=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*a,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*i,t[5]=this[5]*a,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*i,t[9]=this[9]*a,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),i=1/n[0],a=1/n[1],o=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*a,t[2]=this[2]*o,t[3]=this[4]*i,t[4]=this[5]*a,t[5]=this[6]*o,t[6]=this[8]*i,t[7]=this[9]*a,t[8]=this[10]*o,t}transpose(){return Yj(this,this),this.check()}invert(){return Xj(this,this),this.check()}multiplyLeft(t){return Vb(this,t,this),this.check()}multiplyRight(t){return Vb(this,this,t),this.check()}rotateX(t){return rM(this,this,t),this.check()}rotateY(t){return nM(this,this,t),this.check()}rotateZ(t){return iM(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return tM(this,this,t,r),this.check()}scale(t){return eM(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Zj(this,this,t),this.check()}transform(t,r){return t.length===4?(r=_1e(r||[-0,-0,-0,-0],t,this),rp(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,i;switch(n){case 2:i=DT(r||[-0,-0],t,this);break;case 3:i=Jd(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return rp(i,t.length),i}transformAsVector(t,r){let n;switch(t.length){case 2:n=kT(r||[-0,-0],t,this);break;case 3:n=FT(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return rp(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])}},qT,NT;function F2t(){return qT||(qT=new zr([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(qT)),qT}function B2t(){return NT||(NT=new zr,Object.freeze(NT)),NT}function E1e(e){if(e>Math.PI*2)throw Error("expected radians")}function P2t(e,t,r,n,i,a){let o=2*a/(r-t),s=2*a/(i-n),u=(r+t)/(r-t),c=(i+n)/(i-n),l=-1,f=-1,p=-2*a;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 A1e(){let e=new bn(4);return bn!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function S1e(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function dM(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 hM(e,t,r){let n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],u=r[1],c=r[2],l=r[3];return e[0]=n*l+o*s+i*c-a*u,e[1]=i*l+o*u+a*s-n*c,e[2]=a*l+o*c+n*u-i*s,e[3]=o*l-n*s-i*u-a*c,e}function T1e(e,t,r){r*=.5;let n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+o*s,e[1]=i*u+a*s,e[2]=a*u-i*s,e[3]=o*u-n*s,e}function C1e(e,t,r){r*=.5;let n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u-a*s,e[1]=i*u+o*s,e[2]=a*u+n*s,e[3]=o*u-i*s,e}function D1e(e,t,r){r*=.5;let n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+i*s,e[1]=i*u-n*s,e[2]=a*u+o*s,e[3]=o*u-a*s,e}function k1e(e,t){let r=t[0],n=t[1],i=t[2];return e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),e}function $b(e,t,r,n){let i=t[0],a=t[1],o=t[2],s=t[3],u=r[0],c=r[1],l=r[2],f=r[3],p,d,h,v,m;return p=i*u+a*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),m=Math.sin(d),h=Math.sin((1-n)*d)/m,v=Math.sin(n*d)/m):(h=1-n,v=n),e[0]=h*i+v*u,e[1]=h*a+v*c,e[2]=h*o+v*l,e[3]=h*s+v*f,e}function F1e(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return e[0]=-r*s,e[1]=-n*s,e[2]=-i*s,e[3]=a*s,e}function B1e(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function mM(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 i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);let a=(i+1)%3,o=(i+2)%3;n=Math.sqrt(t[i*3+i]-t[a*3+a]-t[o*3+o]+1),e[i]=.5*n,n=.5/n,e[3]=(t[a*3+o]-t[o*3+a])*n,e[a]=(t[a*3+i]+t[i*3+a])*n,e[o]=(t[o*3+i]+t[i*3+o])*n}return e}var P1e=h1e;var O1e=m1e,I1e=b1e,R1e=y1e,j1e=g1e;var M1e=v1e;var L1e=x1e;var q1e=function(){let e=PT(),t=OT(1,0,0),r=OT(0,1,0);return function(n,i,a){let o=zb(i,a);return o<-.999999?(Kd(e,t,i),Wj(e)<1e-6&&Kd(e,r,i),Nj(e,e),dM(n,e,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Kd(e,i,a),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+o,L1e(n,n))}}(),nir=function(){let e=A1e(),t=A1e();return function(r,n,i,a,o,s){return $b(e,n,o,s),$b(t,i,a,s),$b(r,e,t,2*s*(1-s)),r}}(),iir=function(){let e=t1e();return function(t,r,n,i){return e[0]=n[0],e[3]=n[1],e[6]=n[2],e[1]=i[0],e[4]=i[1],e[7]=i[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],L1e(t,mM(t,e))}}();var O2t=[0,0,0,1],tc=class extends tp{constructor(t=0,r=0,n=0,i=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,n,i)}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,i){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,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 mM(this,t),this.check()}fromAxisRotation(t,r){return dM(this,t,r),this.check()}identity(){return S1e(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]=nr(t)}get y(){return this[1]}set y(t){this[1]=nr(t)}get z(){return this[2]}set z(t){this[2]=nr(t)}get w(){return this[3]}set w(t){this[3]=nr(t)}len(){return j1e(this)}lengthSquared(){return M1e(this)}dot(t){return I1e(this,t)}rotationTo(t,r){return q1e(this,t,r),this.check()}add(t){return P1e(this,this,t),this.check()}calculateW(){return k1e(this,this),this.check()}conjugate(){return B1e(this,this),this.check()}invert(){return F1e(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(R1e(this,t,r,n),this.check())}multiplyRight(t){return hM(this,this,t),this.check()}multiplyLeft(t){return hM(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 T1e(this,this,t),this.check()}rotateY(t){return C1e(this,this,t),this.check()}rotateZ(t){return D1e(this,this,t),this.check()}scale(t){return O1e(this,this,t),this.check()}slerp(t,r,n){let i,a,o;switch(arguments.length){case 1:({start:i=O2t,target:a,ratio:o}=t);break;case 2:i=this,a=t,o=r;break;default:i=t,a=r,o=n}return $b(this,i,a,o),this.check()}transformVector4(t,r=new Jo){return w1e(r,t,this),rp(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 Hs={};ui(Hs,{EPSILON1:()=>I2t,EPSILON10:()=>z2t,EPSILON11:()=>H2t,EPSILON12:()=>W2t,EPSILON13:()=>V2t,EPSILON14:()=>$2t,EPSILON15:()=>K2t,EPSILON16:()=>J2t,EPSILON17:()=>Y2t,EPSILON18:()=>X2t,EPSILON19:()=>Q2t,EPSILON2:()=>R2t,EPSILON20:()=>Z2t,EPSILON3:()=>j2t,EPSILON4:()=>M2t,EPSILON5:()=>L2t,EPSILON6:()=>q2t,EPSILON7:()=>N2t,EPSILON8:()=>U2t,EPSILON9:()=>G2t,PI_OVER_FOUR:()=>t_t,PI_OVER_SIX:()=>r_t,PI_OVER_TWO:()=>e_t,TWO_PI:()=>n_t});var I2t=.1,R2t=.01,j2t=.001,M2t=1e-4,L2t=1e-5,q2t=1e-6,N2t=1e-7,U2t=1e-8,G2t=1e-9,z2t=1e-10,H2t=1e-11,W2t=1e-12,V2t=1e-13,$2t=1e-14,K2t=1e-15,J2t=1e-16,Y2t=1e-17,X2t=1e-18,Q2t=1e-19,Z2t=1e-20,e_t=Math.PI/2,t_t=Math.PI/4,r_t=Math.PI/6,n_t=Math.PI*2;var ll=6356752314245179e-9,i_t={radii:[6378137,6378137,ll],radiiSquared:[6378137*6378137,6378137*6378137,ll*ll],oneOverRadii:[1/6378137,1/6378137,1/ll],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(ll*ll)],maximumRadius:Math.max(6378137,6378137,ll),centerToleranceSquared:.1};function UT(e){return e}var Rir=new ce;function a_t(e,t=[],r=UT){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 N1e(e,t=[]){return a_t(e,t,Qr._cartographicRadians?UT:jj)}function o_t(e,t,r=UT){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 U1e(e,t){return o_t(e,t,Qr._cartographicRadians?UT:Mj)}var G1e=1e-14,s_t=new ce,z1e={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"}},gM={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Kb={east:new ce,north:new ce,up:new ce,west:new ce,south:new ce,down:new ce},u_t=new ce,c_t=new ce,l_t=new ce;function vM(e,t,r,n,i,a){let o=z1e[t]&&z1e[t][r];Pi(o&&(!n||n===o));let s,u,c,l=s_t.copy(i);if(yo(l.x,0,G1e)&&yo(l.y,0,G1e)){let p=Math.sign(l.z);s=u_t.fromArray(gM[t]),t!=="east"&&t!=="west"&&s.scale(p),u=c_t.fromArray(gM[r]),r!=="east"&&r!=="west"&&u.scale(p),c=l_t.fromArray(gM[n]),n!=="east"&&n!=="west"&&c.scale(p)}else{let{up:p,east:d,north:h}=Kb;d.set(-l.y,l.x,0).normalize(),e.geodeticSurfaceNormal(l,p),h.copy(p).cross(d);let{down:v,west:m,south:b}=Kb;v.copy(p).scale(-1),m.copy(d).scale(-1),b.copy(h).scale(-1),s=Kb[t],u=Kb[r],c=Kb[n]}return a[0]=s.x,a[1]=s.y,a[2]=s.z,a[3]=0,a[4]=u.x,a[5]=u.y,a[6]=u.z,a[7]=0,a[8]=c.x,a[9]=c.y,a[10]=c.z,a[11]=0,a[12]=l.x,a[13]=l.y,a[14]=l.z,a[15]=1,a}var Sg=new ce,f_t=new ce,p_t=new ce;function H1e(e,t,r=[]){let{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:a}=t;Sg.from(e);let o=Sg.x,s=Sg.y,u=Sg.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,v=p+d+h,m=Math.sqrt(1/v);if(!Number.isFinite(m))return;let b=f_t;if(b.copy(e).scale(m),v<a)return b.to(r);let _=i.x,E=i.y,T=i.z,S=p_t;S.set(b.x*_*2,b.y*E*2,b.z*T*2);let D=(1-m)*Sg.len()/(.5*S.len()),I=0,L,F,P,M;do{D-=I,L=1/(1+D*_),F=1/(1+D*E),P=1/(1+D*T);let U=L*L,W=F*F,V=P*P,Z=U*L,ee=W*F,ge=V*P;M=p*U+d*W+h*V-1;let he=-2*(p*Z*_+d*ee*E+h*ge*T);I=M/he}while(Math.abs(M)>Hs.EPSILON12);return Sg.scale([L,F,P]).to(r)}var GT=new ce,W1e=new ce,m_t=new ce,Ws=new ce,g_t=new ce,zT=new ce,Zt=class{constructor(t=0,r=0,n=0){St(this,"radii",void 0),St(this,"radiiSquared",void 0),St(this,"radiiToTheFourth",void 0),St(this,"oneOverRadii",void 0),St(this,"oneOverRadiiSquared",void 0),St(this,"minimumRadius",void 0),St(this,"maximumRadius",void 0),St(this,"centerToleranceSquared",Hs.EPSILON1),St(this,"squaredXOverSquaredZ",void 0),Pi(t>=0),Pi(r>=0),Pi(n>=0),this.radii=new ce(t,r,n),this.radiiSquared=new ce(t*t,r*r,n*n),this.radiiToTheFourth=new ce(t*t*t*t,r*r*r*r,n*n*n*n),this.oneOverRadii=new ce(t===0?0:1/t,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new ce(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=W1e,i=m_t,[,,a]=t;this.geodeticSurfaceNormalCartographic(t,n),i.copy(this.radiiSquared).scale(n);let o=Math.sqrt(n.dot(i));return i.scale(1/o),n.scale(a),i.add(n),i.to(r)}cartesianToCartographic(t,r=[0,0,0]){zT.from(t);let n=this.scaleToGeodeticSurface(zT,Ws);if(!n)return;let i=this.geodeticSurfaceNormal(n,W1e),a=g_t;a.copy(zT).subtract(n);let o=Math.atan2(i.y,i.x),s=Math.asin(i.z),u=Math.sign(Eg.dot(a,zT))*Eg.length(a);return U1e([o,s,u],r)}eastNorthUpToFixedFrame(t,r=new zr){return vM(this,"east","north","up",t,r)}localFrameToFixedFrame(t,r,n,i,a=new zr){return vM(this,t,r,n,i,a)}geocentricSurfaceNormal(t,r=[0,0,0]){return GT.from(t).normalize().to(r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=N1e(t),i=n[0],a=n[1],o=Math.cos(a);return GT.set(o*Math.cos(i),o*Math.sin(i),Math.sin(a)).normalize(),GT.to(r)}geodeticSurfaceNormal(t,r=[0,0,0]){return GT.from(t).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(t,r){return H1e(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){Ws.from(t);let n=Ws.x,i=Ws.y,a=Ws.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(n*n*o.x+i*i*o.y+a*a*o.z);return Ws.multiplyScalar(s).to(r)}transformPositionToScaledSpace(t,r=[0,0,0]){return Ws.from(t).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(t,r=[0,0,0]){return Ws.from(t).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){Pi(yo(this.radii.x,this.radii.y,Hs.EPSILON15)),Pi(this.radii.z>0),Ws.from(t);let i=Ws.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(i)>=this.radii.z-r))return Ws.set(0,0,i).to(n)}};St(Zt,"WGS84",new Zt(6378137,6378137,ll));var Oi={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var rar=new ce,nar=new ce;var Jb=new ce,V1e=new ce,Oa=class{constructor(t=[0,0,0],r=0){St(this,"center",void 0),St(this,"radius",void 0),this.radius=-0,this.center=new ce,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=Jb.from(r),this.center=new ce().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 Oa(this.center,this.radius)}union(t){let r=this.center,n=this.radius,i=t.center,a=t.radius,o=Jb.copy(i).subtract(r),s=o.magnitude();if(n>=s+a)return this.clone();if(a>=s+n)return t.clone();let u=(n+s+a)*.5;return V1e.copy(o).scale((-n+u)/s).add(r),this.center.copy(V1e),this.radius=u,this}expand(t){let n=Jb.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=LT.getScaling(Jb,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=Jb.from(t).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(t){let r=this.center,n=this.radius,a=t.normal.dot(r)+t.distance;return a<-n?Oi.OUTSIDE:a<n?Oi.INTERSECTING:Oi.INSIDE}};var v_t=new ce,x_t=new ce,HT=new ce,WT=new ce,VT=new ce,b_t=new ce,y_t=new ce,fl={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Ii=class{constructor(t=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){St(this,"center",void 0),St(this,"halfAxes",void 0),this.center=new ce().from(t),this.halfAxes=new Sr(r)}get halfSize(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new ce(t).len(),new ce(r).len(),new ce(n).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),i=new ce(t).normalize(),a=new ce(r).normalize(),o=new ce(n).normalize();return new tc().fromMatrix3(new Sr([...i,...a,...o]))}fromCenterHalfSizeQuaternion(t,r,n){let i=new tc(n),a=new Sr().fromQuaternion(i);return a[0]=a[0]*r[0],a[1]=a[1]*r[0],a[2]=a[2]*r[0],a[3]=a[3]*r[1],a[4]=a[4]*r[1],a[5]=a[5]*r[1],a[6]=a[6]*r[2],a[7]=a[7]*r[2],a[8]=a[8]*r[2],this.center=new ce().from(t),this.halfAxes=a,this}clone(){return new Ii(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new Oa){let r=this.halfAxes,n=r.getColumn(0,HT),i=r.getColumn(1,WT),a=r.getColumn(2,VT),o=v_t.copy(n).add(i).add(a);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let r=this.center,n=t.normal,i=this.halfAxes,a=n.x,o=n.y,s=n.z,u=Math.abs(a*i[fl.COLUMN0ROW0]+o*i[fl.COLUMN0ROW1]+s*i[fl.COLUMN0ROW2])+Math.abs(a*i[fl.COLUMN1ROW0]+o*i[fl.COLUMN1ROW1]+s*i[fl.COLUMN1ROW2])+Math.abs(a*i[fl.COLUMN2ROW0]+o*i[fl.COLUMN2ROW1]+s*i[fl.COLUMN2ROW2]),c=n.dot(r)+t.distance;return c<=-u?Oi.OUTSIDE:c>=u?Oi.INSIDE:Oi.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=x_t.from(t).subtract(this.center),n=this.halfAxes,i=n.getColumn(0,HT),a=n.getColumn(1,WT),o=n.getColumn(2,VT),s=i.magnitude(),u=a.magnitude(),c=o.magnitude();i.normalize(),a.normalize(),o.normalize();let l=0,f;return f=Math.abs(r.dot(i))-s,f>0&&(l+=f*f),f=Math.abs(r.dot(a))-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 i=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=this.center,s=this.halfAxes,u=s.getColumn(0,HT),c=s.getColumn(1,WT),l=s.getColumn(2,VT),f=b_t.copy(u).add(c).add(l).add(o),p=y_t.copy(f).subtract(t),d=r.dot(p);return i=Math.min(d,i),a=Math.max(d,a),f.copy(o).add(u).add(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),f.copy(o).add(u).subtract(c).add(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),f.copy(o).add(u).subtract(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),o.copy(f).subtract(u).add(c).add(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),o.copy(f).subtract(u).add(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),o.copy(f).subtract(u).subtract(c).add(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),o.copy(f).subtract(u).subtract(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),n[0]=i,n[1]=a,n}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,HT);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,WT);n.transformAsPoint(t);let i=this.halfAxes.getColumn(2,VT);return i.transformAsPoint(t),this.halfAxes=new Sr([...r,...n,...i]),this}getTransform(){throw new Error("not implemented")}};var $1e=new ce,K1e=new ce,pl=class{constructor(t=[0,0,1],r=0){St(this,"normal",void 0),St(this,"distance",void 0),this.normal=new ce,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return Pi(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=$1e.from(t),this.normal.from(r).normalize();let n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,r,n,i){return this.normal.set(t,r,n),Pi(yo(this.normal.len(),1)),this.distance=i,this}clone(){return new pl(this.normal,this.distance)}equals(t){return yo(this.distance,t.distance)&&yo(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=K1e.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=$1e.from(t),i=this.getPointDistance(n),a=K1e.copy(this.normal).scale(i);return n.subtract(a).to(r)}};var J1e=[new ce([1,0,0]),new ce([0,1,0]),new ce([0,0,1])],Y1e=new ce,__t=new ce,Yo=class{constructor(t=[]){St(this,"planes",void 0),this.planes=t}fromBoundingSphere(t){this.planes.length=2*J1e.length;let r=t.center,n=t.radius,i=0;for(let a of J1e){let o=this.planes[i],s=this.planes[i+1];o||(o=this.planes[i]=new pl),s||(s=this.planes[i+1]=new pl);let u=Y1e.copy(a).scale(-n).add(r);o.fromPointNormal(u,a);let c=Y1e.copy(a).scale(n).add(r),l=__t.copy(a).negate();s.fromPointNormal(c,l),i+=2}return this}computeVisibility(t){let r=Oi.INSIDE;for(let n of this.planes)switch(t.intersectPlane(n)){case Oi.OUTSIDE:return Oi.OUTSIDE;case Oi.INTERSECTING:r=Oi.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(Pi(Number.isFinite(r),"parentPlaneMask is required."),r===Yo.MASK_OUTSIDE||r===Yo.MASK_INSIDE)return r;let n=Yo.MASK_INSIDE,i=this.planes;for(let a=0;a<this.planes.length;++a){let o=a<31?1<<a:0;if(a<31&&!(r&o))continue;let s=i[a],u=t.intersectPlane(s);if(u===Oi.OUTSIDE)return Yo.MASK_OUTSIDE;u===Oi.INTERSECTING&&(n|=o)}return n}};St(Yo,"MASK_OUTSIDE",4294967295);St(Yo,"MASK_INSIDE",0);St(Yo,"MASK_INDETERMINATE",2147483647);var Car=new ce,Dar=new ce,kar=new ce,Far=new ce,Bar=new ce;var E_t=new ce,A_t=new ce,S_t=new ce,T_t=new ce,C_t=new ce,D_t=new ce,k_t=new ce,Tg=new ce,F_t=new ce,B_t=new ce,P_t=new ce,O_t=new ce;function xM(e,t=new Oa){if(!e||e.length===0)return t.fromCenterRadius([0,0,0],0);let r=k_t.copy(e[0]),n=E_t.copy(r),i=A_t.copy(r),a=S_t.copy(r),o=T_t.copy(r),s=C_t.copy(r),u=D_t.copy(r);for(let D of e){r.copy(D);let I=r.x,L=r.y,F=r.z;I<n.x&&n.copy(r),I>o.x&&o.copy(r),L<i.y&&i.copy(r),L>s.y&&s.copy(r),F<a.z&&a.copy(r),F>u.z&&u.copy(r)}let c=Tg.copy(o).subtract(n).magnitudeSquared(),l=Tg.copy(s).subtract(i).magnitudeSquared(),f=Tg.copy(u).subtract(a).magnitudeSquared(),p=n,d=o,h=c;l>h&&(h=l,p=i,d=s),f>h&&(h=f,p=a,d=u);let v=F_t;v.x=(p.x+d.x)*.5,v.y=(p.y+d.y)*.5,v.z=(p.z+d.z)*.5;let m=Tg.copy(d).subtract(v).magnitudeSquared(),b=Math.sqrt(m),_=B_t;_.x=n.x,_.y=i.y,_.z=a.z;let E=P_t;E.x=o.x,E.y=s.y,E.z=u.z;let T=O_t.copy(_).add(E).multiplyByScalar(.5),S=0;for(let D of e){r.copy(D);let I=Tg.copy(r).subtract(T).magnitude();I>S&&(S=I);let L=Tg.copy(r).subtract(v).magnitudeSquared();if(L>m){let F=Math.sqrt(L);b=(b+F)*.5,m=b*b;let P=F-b;v.x=(b*v.x+P*r.x)/F,v.y=(b*v.y+P*r.y)/F,v.z=(b*v.z+P*r.z)/F}}return b<S?(v.to(t.center),t.radius=b):(T.to(t.center),t.radius=S),t}var rc=new Sr,I_t=new Sr,R_t=new Sr,$T=new Sr,X1e=new Sr;function _M(e,t={}){let r=Hs.EPSILON20,n=10,i=0,a=0,o=I_t,s=R_t;o.identity(),s.copy(e);let u=r*j_t(s);for(;a<n&&M_t(s)>u;)L_t(s,$T),X1e.copy($T).transpose(),s.multiplyRight($T),s.multiplyLeft(X1e),o.multiplyRight($T),++i>2&&(++a,i=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=s.toTarget(t.diagonal),t}function j_t(e){let t=0;for(let r=0;r<9;++r){let n=e[r];t+=n*n}return Math.sqrt(t)}var bM=[1,0,0],yM=[2,2,1];function M_t(e){let t=0;for(let r=0;r<3;++r){let n=e[rc.getElementIndex(yM[r],bM[r])];t+=2*n*n}return Math.sqrt(t)}function L_t(e,t){let r=Hs.EPSILON15,n=0,i=1;for(let c=0;c<3;++c){let l=Math.abs(e[rc.getElementIndex(yM[c],bM[c])]);l>n&&(i=c,n=l)}let a=bM[i],o=yM[i],s=1,u=0;if(Math.abs(e[rc.getElementIndex(o,a)])>r){let c=e[rc.getElementIndex(o,o)],l=e[rc.getElementIndex(a,a)],f=e[rc.getElementIndex(o,a)],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 Sr.IDENTITY.to(t),t[rc.getElementIndex(a,a)]=t[rc.getElementIndex(o,o)]=s,t[rc.getElementIndex(o,a)]=u,t[rc.getElementIndex(a,o)]=-u,t}var ip=new ce,N_t=new ce,U_t=new ce,G_t=new ce,z_t=new ce,H_t=new Sr,W_t={diagonal:new Sr,unitary:new Sr};function wM(e,t=new Ii){if(!e||e.length===0)return t.halfAxes=new Sr([0,0,0,0,0,0,0,0,0]),t.center=new ce,t;let r=e.length,n=new ce(0,0,0);for(let F of e)n.add(F);let i=1/r;n.multiplyByScalar(i);let a=0,o=0,s=0,u=0,c=0,l=0;for(let F of e){let P=ip.copy(F).subtract(n);a+=P.x*P.x,o+=P.x*P.y,s+=P.x*P.z,u+=P.y*P.y,c+=P.y*P.z,l+=P.z*P.z}a*=i,o*=i,s*=i,u*=i,c*=i,l*=i;let f=H_t;f[0]=a,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}=_M(f,W_t),d=t.halfAxes.copy(p),h=d.getColumn(0,U_t),v=d.getColumn(1,G_t),m=d.getColumn(2,z_t),b=-Number.MAX_VALUE,_=-Number.MAX_VALUE,E=-Number.MAX_VALUE,T=Number.MAX_VALUE,S=Number.MAX_VALUE,D=Number.MAX_VALUE;for(let F of e)ip.copy(F),b=Math.max(ip.dot(h),b),_=Math.max(ip.dot(v),_),E=Math.max(ip.dot(m),E),T=Math.min(ip.dot(h),T),S=Math.min(ip.dot(v),S),D=Math.min(ip.dot(m),D);h=h.multiplyByScalar(.5*(T+b)),v=v.multiplyByScalar(.5*(S+_)),m=m.multiplyByScalar(.5*(D+E)),t.center.copy(h).add(v).add(m);let I=N_t.set(b-T,_-S,E-D).multiplyByScalar(.5),L=new Sr([I[0],0,0,0,I[1],0,0,0,I[2]]);return t.halfAxes.multiplyRight(L),t}function tve(e){return e!=null}var lor=new ce,V_t=new ce,$_t=new ce,K_t=new ce,Yd=new ce,Q1e=new ce,Z1e=new ce,eve=new ce;function Yb(e,t,r){if(Rt(e,"3D Tile: boundingVolume must be defined"),e.box)return rve(e.box,t,r);if(e.region)return Y_t(e.region);if(e.sphere)return J_t(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function rve(e,t,r){let n=new ce(e[0],e[1],e[2]);t.transform(n,n);let i=[];if(e.length===10){let c=e.slice(3,6),l=new tc;l.fromArray(e,6);let f=new ce([1,0,0]),p=new ce([0,1,0]),d=new ce([0,0,1]);f.transformByQuaternion(l),f.scale(c[0]),p.transformByQuaternion(l),p.scale(c[1]),d.transformByQuaternion(l),d.scale(c[2]),i=[...f.toArray(),...p.toArray(),...d.toArray()]}else i=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let a=t.transformAsVector(i.slice(0,3)),o=t.transformAsVector(i.slice(3,6)),s=t.transformAsVector(i.slice(6,9)),u=new Sr([a[0],a[1],a[2],o[0],o[1],o[2],s[0],s[1],s[2]]);return tve(r)?(r.center=n,r.halfAxes=u,r):new Ii(n,u)}function J_t(e,t,r){let n=new ce(e[0],e[1],e[2]);t.transform(n,n);let i=t.getScale(V_t),a=Math.max(Math.max(i[0],i[1]),i[2]),o=e[3]*a;return tve(r)?(r.center=n,r.radius=o,r):new Oa(n,o)}function Y_t(e){let[t,r,n,i,a,o]=e,s=Zt.WGS84.cartographicToCartesian([cl(t),cl(i),a],$_t),u=Zt.WGS84.cartographicToCartesian([cl(n),cl(r),o],K_t),c=new ce().addVectors(s,u).multiplyByScalar(.5);return Zt.WGS84.cartesianToCartographic(c,Yd),Zt.WGS84.cartographicToCartesian([cl(n),Yd[1],Yd[2]],Q1e),Zt.WGS84.cartographicToCartesian([Yd[0],cl(i),Yd[2]],Z1e),Zt.WGS84.cartographicToCartesian([Yd[0],Yd[1],o],eve),rve([...c,...Q1e.subtract(c),...Z1e.subtract(c),...eve.subtract(c)],new zr)}var Cg="4.2.0-beta.2";var Xo={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},gor=Object.keys(Xo),ap={BATCHED_MODEL:[98,51,100,109],INSTANCED_MODEL:[105,51,100,109],POINT_CLOUD:[112,110,116,115],COMPOSITE:[99,109,112,116]};function EM(e,t,r){Rt(e instanceof ArrayBuffer);let n=new TextDecoder("utf8"),i=new Uint8Array(e,t,r);return n.decode(i)}function nve(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 KT="4.2.0-beta.2";var ive={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:KT,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function ove(e,t,r){let n=sve(t.metadata),i=[],a=X_t(t.attributes);for(let o in e){let s=e[o],u=ave(o,s,a[o]);i.push(u)}if(r){let o=ave("indices",r);i.push(o)}return{fields:i,metadata:n}}function X_t(e){let t={};for(let r in e){let n=e[r];t[n.name||"undefined"]=n}return t}function ave(e,t,r){let n=r?sve(r.metadata):void 0;return Ij(e,t,n)}function sve(e){Object.entries(e);let t={};for(let r in e)t[`${r}.string`]=JSON.stringify(e[r]);return t}var uve={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},Q_t={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},Z_t=4,Xb=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 i=this.decoder.GetEncodedGeometryType(n),a=i===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(i){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(n,a);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(n,a);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!a.ptr){let p=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(p)}let s=this._getDracoLoaderData(a,i,r),u=this._getMeshData(a,s,r),c=Oj(u.attributes),l=ove(u.attributes,s,u.indices);return{loader:"draco",loaderData:s,header:{vertexCount:a.num_points(),boundingBox:c},...u,schema:l}}finally{this.draco.destroy(n),a&&this.draco.destroy(a)}}_getDracoLoaderData(t,r,n){let i=this._getTopLevelMetadata(t),a=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:i,attributes:a}}_getDracoAttributes(t,r){let n={};for(let i=0;i<t.num_attributes();i++){let a=this.decoder.GetAttribute(t,i),o=this._getAttributeMetadata(t,i);n[a.unique_id()]={unique_id:a.unique_id(),attribute_type:a.attribute_type(),data_type:a.data_type(),num_components:a.num_components(),byte_offset:a.byte_offset(),byte_stride:a.byte_stride(),normalized:a.normalized(),attribute_index:i,metadata:o};let s=this._getQuantizationTransform(a,r);s&&(n[a.unique_id()].quantization_transform=s);let u=this._getOctahedronTransform(a,r);u&&(n[a.unique_id()].octahedron_transform=u)}return n}_getMeshData(t,r,n){let i=this._getMeshAttributes(r,t,n);if(!i.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:i,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:i,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:i}}_getMeshAttributes(t,r,n){let i={};for(let a of Object.values(t.attributes)){let o=this._deduceAttributeName(a,n);a.name=o;let s=this._getAttributeValues(r,a);if(s){let{value:u,size:c}=s;i[o]={value:u,size:c,byteOffset:a.byte_offset,byteStride:a.byte_stride,normalized:a.normalized}}}return i}_getTriangleListIndices(t){let n=t.num_faces()*3,i=n*Z_t,a=this.draco._malloc(i);try{return this.decoder.GetTrianglesUInt32Array(t,i,a),new Uint32Array(this.draco.HEAPF32.buffer,a,n).slice()}finally{this.draco._free(a)}}_getTriangleStripIndices(t){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,r),rwt(r)}finally{this.draco.destroy(r)}}_getAttributeValues(t,r){let n=Q_t[r.data_type];if(!n)return console.warn(`DRACO: Unsupported attribute type ${r.data_type}`),null;let i=r.num_components,o=t.num_points()*i,s=o*n.BYTES_PER_ELEMENT,u=ewt(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:i}}_deduceAttributeName(t,r){let n=t.unique_id;for(let[o,s]of Object.entries(r.extraAttributes||{}))if(s===n)return o;let i=t.attribute_type;for(let o in uve)if(this.draco[o]===i)return uve[o];let a=r.attributeNameEntry||"name";return t.metadata[a]?t.metadata[a].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 i=0;i<n;i++){let a=this.metadataQuerier.GetEntryName(t,i);r[a]=this._getDracoMetadataField(t,a)}return r}_getDracoMetadataField(t,r){let n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,r,n);let i=twt(n);return{int:this.metadataQuerier.GetIntEntry(t,r),string:this.metadataQuerier.GetStringEntry(t,r),double:this.metadataQuerier.GetDoubleEntry(t,r),intArray:i}}finally{this.draco.destroy(n)}}_disableAttributeTransforms(t){let{quantizedAttributes:r=[],octahedronAttributes:n=[]}=t,i=[...r,...n];for(let a of i)this.decoder.SkipAttributeTransform(this.draco[a])}_getQuantizationTransform(t,r){let{quantizedAttributes:n=[]}=r,i=t.attribute_type();if(n.map(o=>this.decoder[o]).includes(i)){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,i=t.attribute_type();if(n.map(o=>this.decoder[o]).includes(i)){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 ewt(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 twt(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}function rwt(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}var nwt="1.5.6",iwt="1.4.1",AM=`https://www.gstatic.com/draco/versioned/decoders/${nwt}`,Gn={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},op={[Gn.DECODER]:`${AM}/${Gn.DECODER}`,[Gn.DECODER_WASM]:`${AM}/${Gn.DECODER_WASM}`,[Gn.FALLBACK_DECODER]:`${AM}/${Gn.FALLBACK_DECODER}`,[Gn.ENCODER]:`https://raw.githubusercontent.com/google/draco/${iwt}/javascript/${Gn.ENCODER}`},SM;async function cve(e){let t=e.modules||{};return t.draco3d?SM||(SM=t.draco3d.createDecoderModule({}).then(r=>({draco:r}))):SM||(SM=awt(e)),await SM}async function awt(e){let t,r;switch(e.draco&&e.draco.decoderType){case"js":t=await ju(op[Gn.FALLBACK_DECODER],"draco",e,Gn.FALLBACK_DECODER);break;case"wasm":default:[t,r]=await Promise.all([await ju(op[Gn.DECODER],"draco",e,Gn.DECODER),await ju(op[Gn.DECODER_WASM],"draco",e,Gn.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await owt(t,r)}function owt(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e({...r,onModuleLoaded:i=>n({draco:i})})})}var TM={id:"draco-writer",name:"Draco compressed geometry writer",module:"draco",version:KT,worker:!0,options:{draco:{},source:null}};var Dg={...ive,parse:swt};async function swt(e,t){let{draco:r}=await cve(t),n=new Xb(r);try{return n.parseSync(e,t==null?void 0:t.draco)}finally{n.destroy()}}var uwt={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Jn={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},Tt={...uwt,...Jn};var CM={[Jn.DOUBLE]:Float64Array,[Jn.FLOAT]:Float32Array,[Jn.UNSIGNED_SHORT]:Uint16Array,[Jn.UNSIGNED_INT]:Uint32Array,[Jn.UNSIGNED_BYTE]:Uint8Array,[Jn.BYTE]:Int8Array,[Jn.SHORT]:Int16Array,[Jn.INT]:Int32Array},cwt={DOUBLE:Jn.DOUBLE,FLOAT:Jn.FLOAT,UNSIGNED_SHORT:Jn.UNSIGNED_SHORT,UNSIGNED_INT:Jn.UNSIGNED_INT,UNSIGNED_BYTE:Jn.UNSIGNED_BYTE,BYTE:Jn.BYTE,SHORT:Jn.SHORT,INT:Jn.INT},DM="Failed to convert GL type",ya=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let r in CM)if(CM[r]===t)return r;throw new Error(DM)}static fromName(t){let r=cwt[t];if(!r)throw new Error(DM);return r}static getArrayType(t){switch(t){case Jn.UNSIGNED_SHORT_5_6_5:case Jn.UNSIGNED_SHORT_4_4_4_4:case Jn.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let r=CM[t];if(!r)throw new Error(DM);return r}}static getByteSize(t){return ya.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(ya.getArrayType(t))}static createTypedArray(t,r,n=0,i){i===void 0&&(i=(r.byteLength-n)/ya.getByteSize(t));let a=ya.getArrayType(t);return new a(r,n,i)}};function lve(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function kM(e,t=[0,0,0]){let r=e>>11&31,n=e>>5&63,i=e&31;return t[0]=r<<3,t[1]=n<<2,t[2]=i<<3,t}var Hor=1/256;var Wor=new $d,Vor=new ce,$or=new $d,Kor=new $d,Jor=new Uint8Array(1);function fve(e,t=255){return Lj(e,0,t)/t*2-1}function pve(e){return e<0?-1:1}function dve(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=fve(e,r),n.y=fve(t,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){let i=n.x;n.x=(1-Math.abs(n.y))*pve(i),n.y=(1-Math.abs(i))*pve(n.y)}return n.normalize()}function FM(e,t,r){return dve(e,t,255,r)}function JT(e){return(e%1+1)%1}var lwt=1/Math.PI*180,fwt=1/180*Math.PI,pwt={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...pwt}};var yn=globalThis.mathgl.config;function BM(e,{precision:t=yn.precision}={}){return e=dwt(e),`${parseFloat(e.toPrecision(t))}`}function nc(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function PM(e){return hve(e)}function OM(e){return mve(e)}function hve(e,t){return gve(e,r=>r*fwt,t)}function mve(e,t){return gve(e,r=>r*lwt,t)}function _o(e,t,r){let n=yn.EPSILON;r&&(yn.EPSILON=r);try{if(e===t)return!0;if(nc(e)&&nc(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(!_o(e[i],t[i]))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)<=yn.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{yn.EPSILON=n}}function dwt(e){return Math.round(e/yn.EPSILON)*yn.EPSILON}function hwt(e){return e.clone?e.clone():new Array(e.length)}function gve(e,t,r){if(nc(e)){let n=e;r=r||hwt(n);for(let i=0;i<r.length&&i<n.length;++i){let a=typeof e=="number"?e:e[i];r[i]=t(a,i,r)}return r}return t(e)}var sp=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:nc(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(yn)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+BM(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(!_o(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 i=0;i<this.ELEMENTS;++i){let a=t[i],o=typeof r=="number"?r:r[i];this[i]=a+n*(o-a)}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(yn.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 mwt(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 Tr(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function up(e,t,r=""){if(yn.debug&&!mwt(e,t))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return e}function Ri(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var kg=class extends sp{get x(){return this[0]}set x(t){this[0]=Tr(t)}get y(){return this[1]}set y(t){this[1]=Tr(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 i=this[n]-t[n];r+=i*i}return Tr(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return Tr(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 Ri(t>=0&&t<this.ELEMENTS,"index is out of range"),Tr(this[t])}setComponent(t,r){return Ri(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 _n=typeof Float32Array<"u"?Float32Array:Array,Qb=Math.random;function Fg(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var Csr=Math.PI/180;function gwt(){let e=new _n(2);return _n!=Float32Array&&(e[0]=0,e[1]=0),e}function vve(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e}function xve(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e}var Dsr=function(){let e=gwt();return function(t,r,n,i,a,o){let s,u;for(r||(r=2),n||(n=0),i?u=Math.min(i*r+n,t.length):u=t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],a(e,e,o),t[s]=e[0],t[s+1]=e[1];return t}}();function bve(e,t,r){let n=t[0],i=t[1],a=r[3]*n+r[7]*i||1;return e[0]=(r[0]*n+r[4]*i)/a,e[1]=(r[1]*n+r[5]*i)/a,e}function YT(e,t,r){let n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a||1;return e[0]=(r[0]*n+r[4]*i+r[8]*a)/o,e[1]=(r[1]*n+r[5]*i+r[9]*a)/o,e[2]=(r[2]*n+r[6]*i+r[10]*a)/o,e}function yve(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e}function _ve(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e[3]=t[3],e}function XT(e,t,r){let n=t[0],i=t[1],a=t[2];return e[0]=r[0]*n+r[3]*i+r[6]*a,e[1]=r[1]*n+r[4]*i+r[7]*a,e[2]=r[2]*n+r[5]*i+r[8]*a,e[3]=t[3],e}var Pg={};ui(Pg,{add:()=>_wt,angle:()=>LM,bezier:()=>Iwt,ceil:()=>wwt,clone:()=>xwt,copy:()=>bwt,create:()=>QT,cross:()=>Xd,dist:()=>zwt,distance:()=>Tve,div:()=>Gwt,divide:()=>Sve,dot:()=>Zb,equals:()=>qwt,exactEquals:()=>Lwt,floor:()=>Ewt,forEach:()=>Vwt,fromValues:()=>ZT,hermite:()=>Owt,inverse:()=>Fwt,len:()=>qM,length:()=>wve,lerp:()=>Bwt,max:()=>Swt,min:()=>Awt,mul:()=>Uwt,multiply:()=>Ave,negate:()=>kwt,normalize:()=>IM,random:()=>Rwt,rotateX:()=>RM,rotateY:()=>jM,rotateZ:()=>MM,round:()=>Twt,scale:()=>Cwt,scaleAndAdd:()=>Dwt,set:()=>ywt,slerp:()=>Pwt,sqrDist:()=>Hwt,sqrLen:()=>Wwt,squaredDistance:()=>Cve,squaredLength:()=>Dve,str:()=>Mwt,sub:()=>Nwt,subtract:()=>Eve,transformMat3:()=>ey,transformMat4:()=>Qd,transformQuat:()=>ty,zero:()=>jwt});function QT(){let e=new _n(3);return _n!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function xwt(e){let t=new _n(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function wve(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function ZT(e,t,r){let n=new _n(3);return n[0]=e,n[1]=t,n[2]=r,n}function bwt(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function ywt(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function _wt(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function Eve(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function Ave(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function Sve(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function wwt(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function Ewt(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function Awt(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 Swt(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 Twt(e,t){return e[0]=Fg(t[0]),e[1]=Fg(t[1]),e[2]=Fg(t[2]),e}function Cwt(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function Dwt(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 Tve(e,t){let r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(r*r+n*n+i*i)}function Cve(e,t){let r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return r*r+n*n+i*i}function Dve(e){let t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function kwt(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function Fwt(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function IM(e,t){let r=t[0],n=t[1],i=t[2],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function Zb(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Xd(e,t,r){let n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2];return e[0]=i*u-a*s,e[1]=a*o-n*u,e[2]=n*s-i*o,e}function Bwt(e,t,r,n){let i=t[0],a=t[1],o=t[2];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e}function Pwt(e,t,r,n){let i=Math.acos(Math.min(Math.max(Zb(t,r),-1),1)),a=Math.sin(i),o=Math.sin((1-n)*i)/a,s=Math.sin(n*i)/a;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 Owt(e,t,r,n,i,a){let o=a*a,s=o*(2*a-3)+1,u=o*(a-2)+a,c=o*(a-1),l=o*(3-2*a);return e[0]=t[0]*s+r[0]*u+n[0]*c+i[0]*l,e[1]=t[1]*s+r[1]*u+n[1]*c+i[1]*l,e[2]=t[2]*s+r[2]*u+n[2]*c+i[2]*l,e}function Iwt(e,t,r,n,i,a){let o=1-a,s=o*o,u=a*a,c=s*o,l=3*a*s,f=3*u*o,p=u*a;return e[0]=t[0]*c+r[0]*l+n[0]*f+i[0]*p,e[1]=t[1]*c+r[1]*l+n[1]*f+i[1]*p,e[2]=t[2]*c+r[2]*l+n[2]*f+i[2]*p,e}function Rwt(e,t){t=t===void 0?1:t;let r=Qb()*2*Math.PI,n=Qb()*2-1,i=Math.sqrt(1-n*n)*t;return e[0]=Math.cos(r)*i,e[1]=Math.sin(r)*i,e[2]=n*t,e}function Qd(e,t,r){let n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,e}function ey(e,t,r){let n=t[0],i=t[1],a=t[2];return e[0]=n*r[0]+i*r[3]+a*r[6],e[1]=n*r[1]+i*r[4]+a*r[7],e[2]=n*r[2]+i*r[5]+a*r[8],e}function ty(e,t,r){let n=r[0],i=r[1],a=r[2],o=r[3],s=t[0],u=t[1],c=t[2],l=i*c-a*u,f=a*s-n*c,p=n*u-i*s,d=i*p-a*f,h=a*l-n*p,v=n*f-i*l,m=o*2;return l*=m,f*=m,p*=m,d*=2,h*=2,v*=2,e[0]=s+l+d,e[1]=u+f+h,e[2]=c+p+v,e}function RM(e,t,r,n){let i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function jM(e,t,r,n){let i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function MM(e,t,r,n){let i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function LM(e,t){let r=e[0],n=e[1],i=e[2],a=t[0],o=t[1],s=t[2],u=Math.sqrt((r*r+n*n+i*i)*(a*a+o*o+s*s)),c=u&&Zb(e,t)/u;return Math.acos(Math.min(Math.max(c,-1),1))}function jwt(e){return e[0]=0,e[1]=0,e[2]=0,e}function Mwt(e){return`vec3(${e[0]}, ${e[1]}, ${e[2]})`}function Lwt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function qwt(e,t){let r=e[0],n=e[1],i=e[2],a=t[0],o=t[1],s=t[2];return Math.abs(r-a)<=1e-6*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-o)<=1e-6*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-s)<=1e-6*Math.max(1,Math.abs(i),Math.abs(s))}var Nwt=Eve,Uwt=Ave,Gwt=Sve,zwt=Tve,Hwt=Cve,qM=wve,Wwt=Dve,Vwt=function(){let e=QT();return function(t,r,n,i,a,o){let s,u;for(r||(r=3),n||(n=0),i?u=Math.min(i*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],a(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2];return t}}();var NM=[0,0,0],e8,_e=class extends kg{static get ZERO(){return e8||(e8=new _e(0,0,0),Object.freeze(e8)),e8}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&nc(t)?this.copy(t):(yn.debug&&(Tr(t),Tr(r),Tr(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 yn.debug&&(Tr(t.x),Tr(t.y),Tr(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]=Tr(t)}angle(t){return LM(this,t)}cross(t){return Xd(this,this,t),this.check()}rotateX({radians:t,origin:r=NM}){return RM(this,this,r,t),this.check()}rotateY({radians:t,origin:r=NM}){return jM(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=NM}){return MM(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Qd(this,this,t),this.check()}transformAsVector(t){return YT(this,this,t),this.check()}transformByMatrix3(t){return ey(this,this,t),this.check()}transformByMatrix2(t){return yve(this,this,t),this.check()}transformByQuaternion(t){return ty(this,this,t),this.check()}};var t8,Og=class extends kg{static get ZERO(){return t8||(t8=new Og(0,0,0,0),Object.freeze(t8)),t8}constructor(t=0,r=0,n=0,i=0){super(-0,-0,-0,-0),nc(t)&&arguments.length===1?this.copy(t):(yn.debug&&(Tr(t),Tr(r),Tr(n),Tr(i)),this[0]=t,this[1]=r,this[2]=n,this[3]=i)}set(t,r,n,i){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,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 yn.debug&&(Tr(t.x),Tr(t.y),Tr(t.z),Tr(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]=Tr(t)}get w(){return this[3]}set w(t){this[3]=Tr(t)}transform(t){return Qd(this,this,t),this.check()}transformByMatrix3(t){return XT(this,this,t),this.check()}transformByMatrix2(t){return _ve(this,this,t),this.check()}transformByQuaternion(t){return ty(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Ig=class extends sp{toString(){let t="[";if(yn.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]=Tr(n),this}getColumn(t,r=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)r[i]=this[n+i];return r}setColumn(t,r){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)this[n+i]=r[i];return this}};function kve(){let e=new _n(9);return _n!=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 Fve(e,t){if(e===t){let r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}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 Bve(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],f=l*o-s*c,p=-l*a+s*u,d=c*a-o*u,h=r*f+n*p+i*d;return h?(h=1/h,e[0]=f*h,e[1]=(-l*n+i*c)*h,e[2]=(s*n-i*o)*h,e[3]=p*h,e[4]=(l*r-i*u)*h,e[5]=(-s*r+i*a)*h,e[6]=d*h,e[7]=(-c*r+n*u)*h,e[8]=(o*r-n*a)*h,e):null}function Pve(e){let t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8];return t*(c*a-o*u)+r*(-c*i+o*s)+n*(u*i-a*s)}function UM(e,t,r){let n=t[0],i=t[1],a=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],v=r[3],m=r[4],b=r[5],_=r[6],E=r[7],T=r[8];return e[0]=p*n+d*o+h*c,e[1]=p*i+d*s+h*l,e[2]=p*a+d*u+h*f,e[3]=v*n+m*o+b*c,e[4]=v*i+m*s+b*l,e[5]=v*a+m*u+b*f,e[6]=_*n+E*o+T*c,e[7]=_*i+E*s+T*l,e[8]=_*a+E*u+T*f,e}function Ove(e,t,r){let n=t[0],i=t[1],a=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]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=u,e[6]=p*n+d*o+c,e[7]=p*i+d*s+l,e[8]=p*a+d*u+f,e}function Ive(e,t,r){let n=t[0],i=t[1],a=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*i+p*s,e[2]=d*a+p*u,e[3]=d*o-p*n,e[4]=d*s-p*i,e[5]=d*u-p*a,e[6]=c,e[7]=l,e[8]=f,e}function GM(e,t,r){let n=r[0],i=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Rve(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,f=n*s,p=i*o,d=i*s,h=i*u,v=a*o,m=a*s,b=a*u;return e[0]=1-f-h,e[3]=l-b,e[6]=p+m,e[1]=l+b,e[4]=1-c-h,e[7]=d-v,e[2]=p-m,e[5]=d+v,e[8]=1-c-f,e}var zM;(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"})(zM||(zM={}));var $wt=Object.freeze([1,0,0,0,1,0,0,0,1]),pn=class extends Ig{static get IDENTITY(){return Jwt()}static get ZERO(){return Kwt()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return zM}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($wt)}fromObject(t){return this.check()}fromQuaternion(t){return Rve(this,t),this.check()}set(t,r,n,i,a,o,s,u,c){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=a,this[5]=o,this[6]=s,this[7]=u,this[8]=c,this.check()}setRowMajor(t,r,n,i,a,o,s,u,c){return this[0]=t,this[1]=i,this[2]=s,this[3]=r,this[4]=a,this[5]=u,this[6]=n,this[7]=o,this[8]=c,this.check()}determinant(){return Pve(this)}transpose(){return Fve(this,this),this.check()}invert(){return Bve(this,this),this.check()}multiplyLeft(t){return UM(this,t,this),this.check()}multiplyRight(t){return UM(this,this,t),this.check()}rotate(t){return Ive(this,this,t),this.check()}scale(t){return Array.isArray(t)?GM(this,this,t):GM(this,this,[t,t]),this.check()}translate(t){return Ove(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=vve(r||[-0,-0],t,this);break;case 3:n=ey(r||[-0,-0,-0],t,this);break;case 4:n=XT(r||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return up(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)}},r8,n8=null;function Kwt(){return r8||(r8=new pn([0,0,0,0,0,0,0,0,0]),Object.freeze(r8)),r8}function Jwt(){return n8||(n8=new pn,Object.freeze(n8)),n8}var i8={};ui(i8,{add:()=>yEt,adjoint:()=>tEt,clone:()=>Xwt,copy:()=>Qwt,create:()=>Ywt,decompose:()=>fEt,determinant:()=>VM,equals:()=>AEt,exactEquals:()=>EEt,frob:()=>bEt,fromQuat:()=>ZM,fromQuat2:()=>uEt,fromRotation:()=>iEt,fromRotationTranslation:()=>Lve,fromRotationTranslationScale:()=>pEt,fromRotationTranslationScaleOrigin:()=>dEt,fromScaling:()=>nEt,fromTranslation:()=>rEt,fromValues:()=>Zwt,fromXRotation:()=>aEt,fromYRotation:()=>oEt,fromZRotation:()=>sEt,frustum:()=>eL,getRotation:()=>lEt,getScaling:()=>qve,getTranslation:()=>cEt,identity:()=>Mve,invert:()=>WM,lookAt:()=>nL,mul:()=>SEt,multiply:()=>ry,multiplyScalar:()=>_Et,multiplyScalarAndAdd:()=>wEt,ortho:()=>rL,orthoNO:()=>Uve,orthoZO:()=>gEt,perspective:()=>tL,perspectiveFromFieldOfView:()=>mEt,perspectiveNO:()=>Nve,perspectiveZO:()=>hEt,rotate:()=>JM,rotateX:()=>YM,rotateY:()=>XM,rotateZ:()=>QM,scale:()=>KM,set:()=>eEt,str:()=>xEt,sub:()=>TEt,subtract:()=>Gve,targetTo:()=>vEt,translate:()=>$M,transpose:()=>HM});function Ywt(){let e=new _n(16);return _n!=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 Xwt(e){let t=new _n(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 Qwt(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 Zwt(e,t,r,n,i,a,o,s,u,c,l,f,p,d,h,v){let m=new _n(16);return m[0]=e,m[1]=t,m[2]=r,m[3]=n,m[4]=i,m[5]=a,m[6]=o,m[7]=s,m[8]=u,m[9]=c,m[10]=l,m[11]=f,m[12]=p,m[13]=d,m[14]=h,m[15]=v,m}function eEt(e,t,r,n,i,a,o,s,u,c,l,f,p,d,h,v,m){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=a,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]=v,e[15]=m,e}function Mve(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 HM(e,t){if(e===t){let r=t[1],n=t[2],i=t[3],a=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]=a,e[11]=t[14],e[12]=i,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 WM(e,t){let r=t[0],n=t[1],i=t[2],a=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],v=t[13],m=t[14],b=t[15],_=r*s-n*o,E=r*u-i*o,T=r*c-a*o,S=n*u-i*s,D=n*c-a*s,I=i*c-a*u,L=l*v-f*h,F=l*m-p*h,P=l*b-d*h,M=f*m-p*v,U=f*b-d*v,W=p*b-d*m,V=_*W-E*U+T*M+S*P-D*F+I*L;return V?(V=1/V,e[0]=(s*W-u*U+c*M)*V,e[1]=(i*U-n*W-a*M)*V,e[2]=(v*I-m*D+b*S)*V,e[3]=(p*D-f*I-d*S)*V,e[4]=(u*P-o*W-c*F)*V,e[5]=(r*W-i*P+a*F)*V,e[6]=(m*T-h*I-b*E)*V,e[7]=(l*I-p*T+d*E)*V,e[8]=(o*U-s*P+c*L)*V,e[9]=(n*P-r*U-a*L)*V,e[10]=(h*D-v*T+b*_)*V,e[11]=(f*T-l*D-d*_)*V,e[12]=(s*F-o*M-u*L)*V,e[13]=(r*M-n*F+i*L)*V,e[14]=(v*E-h*S-m*_)*V,e[15]=(l*S-f*E+p*_)*V,e):null}function tEt(e,t){let r=t[0],n=t[1],i=t[2],a=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],v=t[13],m=t[14],b=t[15],_=r*s-n*o,E=r*u-i*o,T=r*c-a*o,S=n*u-i*s,D=n*c-a*s,I=i*c-a*u,L=l*v-f*h,F=l*m-p*h,P=l*b-d*h,M=f*m-p*v,U=f*b-d*v,W=p*b-d*m;return e[0]=s*W-u*U+c*M,e[1]=i*U-n*W-a*M,e[2]=v*I-m*D+b*S,e[3]=p*D-f*I-d*S,e[4]=u*P-o*W-c*F,e[5]=r*W-i*P+a*F,e[6]=m*T-h*I-b*E,e[7]=l*I-p*T+d*E,e[8]=o*U-s*P+c*L,e[9]=n*P-r*U-a*L,e[10]=h*D-v*T+b*_,e[11]=f*T-l*D-d*_,e[12]=s*F-o*M-u*L,e[13]=r*M-n*F+i*L,e[14]=v*E-h*S-m*_,e[15]=l*S-f*E+p*_,e}function VM(e){let t=e[0],r=e[1],n=e[2],i=e[3],a=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],v=e[14],m=e[15],b=t*o-r*a,_=t*s-n*a,E=r*s-n*o,T=c*h-l*d,S=c*v-f*d,D=l*v-f*h,I=t*D-r*S+n*T,L=a*D-o*S+s*T,F=c*E-l*_+f*b,P=d*E-h*_+v*b;return u*I-i*L+m*F-p*P}function ry(e,t,r){let n=t[0],i=t[1],a=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],v=t[12],m=t[13],b=t[14],_=t[15],E=r[0],T=r[1],S=r[2],D=r[3];return e[0]=E*n+T*s+S*f+D*v,e[1]=E*i+T*u+S*p+D*m,e[2]=E*a+T*c+S*d+D*b,e[3]=E*o+T*l+S*h+D*_,E=r[4],T=r[5],S=r[6],D=r[7],e[4]=E*n+T*s+S*f+D*v,e[5]=E*i+T*u+S*p+D*m,e[6]=E*a+T*c+S*d+D*b,e[7]=E*o+T*l+S*h+D*_,E=r[8],T=r[9],S=r[10],D=r[11],e[8]=E*n+T*s+S*f+D*v,e[9]=E*i+T*u+S*p+D*m,e[10]=E*a+T*c+S*d+D*b,e[11]=E*o+T*l+S*h+D*_,E=r[12],T=r[13],S=r[14],D=r[15],e[12]=E*n+T*s+S*f+D*v,e[13]=E*i+T*u+S*p+D*m,e[14]=E*a+T*c+S*d+D*b,e[15]=E*o+T*l+S*h+D*_,e}function $M(e,t,r){let n=r[0],i=r[1],a=r[2],o,s,u,c,l,f,p,d,h,v,m,b;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*a+t[12],e[13]=t[1]*n+t[5]*i+t[9]*a+t[13],e[14]=t[2]*n+t[6]*i+t[10]*a+t[14],e[15]=t[3]*n+t[7]*i+t[11]*a+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],v=t[9],m=t[10],b=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]=v,e[10]=m,e[11]=b,e[12]=o*n+l*i+h*a+t[12],e[13]=s*n+f*i+v*a+t[13],e[14]=u*n+p*i+m*a+t[14],e[15]=c*n+d*i+b*a+t[15]),e}function KM(e,t,r){let n=r[0],i=r[1],a=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]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function JM(e,t,r,n){let i=n[0],a=n[1],o=n[2],s=Math.sqrt(i*i+a*a+o*o),u,c,l,f,p,d,h,v,m,b,_,E,T,S,D,I,L,F,P,M,U,W,V,Z;return s<1e-6?null:(s=1/s,i*=s,a*=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],v=t[4],m=t[5],b=t[6],_=t[7],E=t[8],T=t[9],S=t[10],D=t[11],I=i*i*l+u,L=a*i*l+o*c,F=o*i*l-a*c,P=i*a*l-o*c,M=a*a*l+u,U=o*a*l+i*c,W=i*o*l+a*c,V=a*o*l-i*c,Z=o*o*l+u,e[0]=f*I+v*L+E*F,e[1]=p*I+m*L+T*F,e[2]=d*I+b*L+S*F,e[3]=h*I+_*L+D*F,e[4]=f*P+v*M+E*U,e[5]=p*P+m*M+T*U,e[6]=d*P+b*M+S*U,e[7]=h*P+_*M+D*U,e[8]=f*W+v*V+E*Z,e[9]=p*W+m*V+T*Z,e[10]=d*W+b*V+S*Z,e[11]=h*W+_*V+D*Z,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function YM(e,t,r){let n=Math.sin(r),i=Math.cos(r),a=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]=a*i+c*n,e[5]=o*i+l*n,e[6]=s*i+f*n,e[7]=u*i+p*n,e[8]=c*i-a*n,e[9]=l*i-o*n,e[10]=f*i-s*n,e[11]=p*i-u*n,e}function XM(e,t,r){let n=Math.sin(r),i=Math.cos(r),a=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]=a*i-c*n,e[1]=o*i-l*n,e[2]=s*i-f*n,e[3]=u*i-p*n,e[8]=a*n+c*i,e[9]=o*n+l*i,e[10]=s*n+f*i,e[11]=u*n+p*i,e}function QM(e,t,r){let n=Math.sin(r),i=Math.cos(r),a=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]=a*i+c*n,e[1]=o*i+l*n,e[2]=s*i+f*n,e[3]=u*i+p*n,e[4]=c*i-a*n,e[5]=l*i-o*n,e[6]=f*i-s*n,e[7]=p*i-u*n,e}function rEt(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 nEt(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 iEt(e,t,r){let n=r[0],i=r[1],a=r[2],o=Math.sqrt(n*n+i*i+a*a),s,u,c;return o<1e-6?null:(o=1/o,n*=o,i*=o,a*=o,u=Math.sin(t),s=Math.cos(t),c=1-s,e[0]=n*n*c+s,e[1]=i*n*c+a*u,e[2]=a*n*c-i*u,e[3]=0,e[4]=n*i*c-a*u,e[5]=i*i*c+s,e[6]=a*i*c+n*u,e[7]=0,e[8]=n*a*c+i*u,e[9]=i*a*c-n*u,e[10]=a*a*c+s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function aEt(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 oEt(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 sEt(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 Lve(e,t,r){let n=t[0],i=t[1],a=t[2],o=t[3],s=n+n,u=i+i,c=a+a,l=n*s,f=n*u,p=n*c,d=i*u,h=i*c,v=a*c,m=o*s,b=o*u,_=o*c;return e[0]=1-(d+v),e[1]=f+_,e[2]=p-b,e[3]=0,e[4]=f-_,e[5]=1-(l+v),e[6]=h+m,e[7]=0,e[8]=p+b,e[9]=h-m,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 uEt(e,t){let r=new _n(3),n=-t[0],i=-t[1],a=-t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=n*n+i*i+a*a+o*o;return f>0?(r[0]=(s*o+l*n+u*a-c*i)*2/f,r[1]=(u*o+l*i+c*n-s*a)*2/f,r[2]=(c*o+l*a+s*i-u*n)*2/f):(r[0]=(s*o+l*n+u*a-c*i)*2,r[1]=(u*o+l*i+c*n-s*a)*2,r[2]=(c*o+l*a+s*i-u*n)*2),Lve(e,t,r),e}function cEt(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function qve(e,t){let r=t[0],n=t[1],i=t[2],a=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+i*i),e[1]=Math.sqrt(a*a+o*o+s*s),e[2]=Math.sqrt(u*u+c*c+l*l),e}function lEt(e,t){let r=new _n(3);qve(r,t);let n=1/r[0],i=1/r[1],a=1/r[2],o=t[0]*n,s=t[1]*i,u=t[2]*a,c=t[4]*n,l=t[5]*i,f=t[6]*a,p=t[8]*n,d=t[9]*i,h=t[10]*a,v=o+l+h,m=0;return v>0?(m=Math.sqrt(v+1)*2,e[3]=.25*m,e[0]=(f-d)/m,e[1]=(p-u)/m,e[2]=(s-c)/m):o>l&&o>h?(m=Math.sqrt(1+o-l-h)*2,e[3]=(f-d)/m,e[0]=.25*m,e[1]=(s+c)/m,e[2]=(p+u)/m):l>h?(m=Math.sqrt(1+l-o-h)*2,e[3]=(p-u)/m,e[0]=(s+c)/m,e[1]=.25*m,e[2]=(f+d)/m):(m=Math.sqrt(1+h-o-l)*2,e[3]=(s-c)/m,e[0]=(p+u)/m,e[1]=(f+d)/m,e[2]=.25*m),e}function fEt(e,t,r,n){t[0]=n[12],t[1]=n[13],t[2]=n[14];let i=n[0],a=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(i*i+a*a+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],v=1/r[2],m=i*d,b=a*h,_=o*v,E=s*d,T=u*h,S=c*v,D=l*d,I=f*h,L=p*v,F=m+T+L,P=0;return F>0?(P=Math.sqrt(F+1)*2,e[3]=.25*P,e[0]=(S-I)/P,e[1]=(D-_)/P,e[2]=(b-E)/P):m>T&&m>L?(P=Math.sqrt(1+m-T-L)*2,e[3]=(S-I)/P,e[0]=.25*P,e[1]=(b+E)/P,e[2]=(D+_)/P):T>L?(P=Math.sqrt(1+T-m-L)*2,e[3]=(D-_)/P,e[0]=(b+E)/P,e[1]=.25*P,e[2]=(S+I)/P):(P=Math.sqrt(1+L-m-T)*2,e[3]=(b-E)/P,e[0]=(D+_)/P,e[1]=(S+I)/P,e[2]=.25*P),e}function pEt(e,t,r,n){let i=t[0],a=t[1],o=t[2],s=t[3],u=i+i,c=a+a,l=o+o,f=i*u,p=i*c,d=i*l,h=a*c,v=a*l,m=o*l,b=s*u,_=s*c,E=s*l,T=n[0],S=n[1],D=n[2];return e[0]=(1-(h+m))*T,e[1]=(p+E)*T,e[2]=(d-_)*T,e[3]=0,e[4]=(p-E)*S,e[5]=(1-(f+m))*S,e[6]=(v+b)*S,e[7]=0,e[8]=(d+_)*D,e[9]=(v-b)*D,e[10]=(1-(f+h))*D,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function dEt(e,t,r,n,i){let a=t[0],o=t[1],s=t[2],u=t[3],c=a+a,l=o+o,f=s+s,p=a*c,d=a*l,h=a*f,v=o*l,m=o*f,b=s*f,_=u*c,E=u*l,T=u*f,S=n[0],D=n[1],I=n[2],L=i[0],F=i[1],P=i[2],M=(1-(v+b))*S,U=(d+T)*S,W=(h-E)*S,V=(d-T)*D,Z=(1-(p+b))*D,ee=(m+_)*D,ge=(h+E)*I,de=(m-_)*I,he=(1-(p+v))*I;return e[0]=M,e[1]=U,e[2]=W,e[3]=0,e[4]=V,e[5]=Z,e[6]=ee,e[7]=0,e[8]=ge,e[9]=de,e[10]=he,e[11]=0,e[12]=r[0]+L-(M*L+V*F+ge*P),e[13]=r[1]+F-(U*L+Z*F+de*P),e[14]=r[2]+P-(W*L+ee*F+he*P),e[15]=1,e}function ZM(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,f=n*s,p=i*o,d=i*s,h=i*u,v=a*o,m=a*s,b=a*u;return e[0]=1-f-h,e[1]=l+b,e[2]=p-m,e[3]=0,e[4]=l-b,e[5]=1-c-h,e[6]=d+v,e[7]=0,e[8]=p+m,e[9]=d-v,e[10]=1-c-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function eL(e,t,r,n,i,a,o){let s=1/(r-t),u=1/(i-n),c=1/(a-o);return e[0]=a*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*u,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(i+n)*u,e[10]=(o+a)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*a*2*c,e[15]=0,e}function Nve(e,t,r,n,i){let a=1/Math.tan(t/2);if(e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let o=1/(n-i);e[10]=(i+n)*o,e[14]=2*i*n*o}else e[10]=-1,e[14]=-2*n;return e}var tL=Nve;function hEt(e,t,r,n,i){let a=1/Math.tan(t/2);if(e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let o=1/(n-i);e[10]=i*o,e[14]=i*n*o}else e[10]=-1,e[14]=-n;return e}function mEt(e,t,r,n){let i=Math.tan(t.upDegrees*Math.PI/180),a=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/(i+a);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]=(i-a)*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 Uve(e,t,r,n,i,a,o){let s=1/(t-r),u=1/(n-i),c=1/(a-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]=(i+n)*u,e[14]=(o+a)*c,e[15]=1,e}var rL=Uve;function gEt(e,t,r,n,i,a,o){let s=1/(t-r),u=1/(n-i),c=1/(a-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]=(i+n)*u,e[14]=a*c,e[15]=1,e}function nL(e,t,r,n){let i,a,o,s,u,c,l,f,p,d,h=t[0],v=t[1],m=t[2],b=n[0],_=n[1],E=n[2],T=r[0],S=r[1],D=r[2];return Math.abs(h-T)<1e-6&&Math.abs(v-S)<1e-6&&Math.abs(m-D)<1e-6?Mve(e):(f=h-T,p=v-S,d=m-D,i=1/Math.sqrt(f*f+p*p+d*d),f*=i,p*=i,d*=i,a=_*d-E*p,o=E*f-b*d,s=b*p-_*f,i=Math.sqrt(a*a+o*o+s*s),i?(i=1/i,a*=i,o*=i,s*=i):(a=0,o=0,s=0),u=p*s-d*o,c=d*a-f*s,l=f*o-p*a,i=Math.sqrt(u*u+c*c+l*l),i?(i=1/i,u*=i,c*=i,l*=i):(u=0,c=0,l=0),e[0]=a,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]=-(a*h+o*v+s*m),e[13]=-(u*h+c*v+l*m),e[14]=-(f*h+p*v+d*m),e[15]=1,e)}function vEt(e,t,r,n){let i=t[0],a=t[1],o=t[2],s=n[0],u=n[1],c=n[2],l=i-r[0],f=a-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,v=c*l-s*p,m=s*f-u*l;return d=h*h+v*v+m*m,d>0&&(d=1/Math.sqrt(d),h*=d,v*=d,m*=d),e[0]=h,e[1]=v,e[2]=m,e[3]=0,e[4]=f*m-p*v,e[5]=p*h-l*m,e[6]=l*v-f*h,e[7]=0,e[8]=l,e[9]=f,e[10]=p,e[11]=0,e[12]=i,e[13]=a,e[14]=o,e[15]=1,e}function xEt(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 bEt(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 yEt(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 Gve(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 _Et(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 wEt(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 EEt(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 AEt(e,t){let r=e[0],n=e[1],i=e[2],a=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],v=e[13],m=e[14],b=e[15],_=t[0],E=t[1],T=t[2],S=t[3],D=t[4],I=t[5],L=t[6],F=t[7],P=t[8],M=t[9],U=t[10],W=t[11],V=t[12],Z=t[13],ee=t[14],ge=t[15];return Math.abs(r-_)<=1e-6*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(i-T)<=1e-6*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(a-S)<=1e-6*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(o-D)<=1e-6*Math.max(1,Math.abs(o),Math.abs(D))&&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-F)<=1e-6*Math.max(1,Math.abs(c),Math.abs(F))&&Math.abs(l-P)<=1e-6*Math.max(1,Math.abs(l),Math.abs(P))&&Math.abs(f-M)<=1e-6*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(p-U)<=1e-6*Math.max(1,Math.abs(p),Math.abs(U))&&Math.abs(d-W)<=1e-6*Math.max(1,Math.abs(d),Math.abs(W))&&Math.abs(h-V)<=1e-6*Math.max(1,Math.abs(h),Math.abs(V))&&Math.abs(v-Z)<=1e-6*Math.max(1,Math.abs(v),Math.abs(Z))&&Math.abs(m-ee)<=1e-6*Math.max(1,Math.abs(m),Math.abs(ee))&&Math.abs(b-ge)<=1e-6*Math.max(1,Math.abs(b),Math.abs(ge))}var SEt=ry,TEt=Gve;function CEt(){let e=new _n(4);return _n!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function zve(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 Hve(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 Wve(e){let t=e[0],r=e[1],n=e[2],i=e[3];return Math.sqrt(t*t+r*r+n*n+i*i)}function Vve(e){let t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}function $ve(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=n*o,e[2]=i*o,e[3]=a*o,e}function Kve(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Jve(e,t,r,n){let i=t[0],a=t[1],o=t[2],s=t[3];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e[3]=s+n*(r[3]-s),e}function Yve(e,t,r){let n=t[0],i=t[1],a=t[2],o=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,e[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,e[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,e[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,e}function Xve(e,t,r){let n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],c=r[3],l=c*n+s*a-u*i,f=c*i+u*n-o*a,p=c*a+o*i-s*n,d=-o*n-s*i-u*a;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 Zsr=function(){let e=CEt();return function(t,r,n,i,a,o){let s,u;for(r||(r=4),n||(n=0),i?u=Math.min(i*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],a(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 oL;(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"})(oL||(oL={}));var DEt=45*Math.PI/180,kEt=1,iL=.1,aL=500,FEt=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Qo=class extends Ig{static get IDENTITY(){return PEt()}static get ZERO(){return BEt()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return oL}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,i,a,o,s,u,c,l,f,p,d,h,v,m){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=a,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]=v,this[15]=m,this.check()}setRowMajor(t,r,n,i,a,o,s,u,c,l,f,p,d,h,v,m){return this[0]=t,this[1]=a,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]=v,this[12]=i,this[13]=u,this[14]=p,this[15]=m,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(FEt)}fromObject(t){return this.check()}fromQuaternion(t){return ZM(this,t),this.check()}frustum(t){let{left:r,right:n,bottom:i,top:a,near:o=iL,far:s=aL}=t;return s===1/0?OEt(this,r,n,i,a,o):eL(this,r,n,i,a,o,s),this.check()}lookAt(t){let{eye:r,center:n=[0,0,0],up:i=[0,1,0]}=t;return nL(this,r,n,i),this.check()}ortho(t){let{left:r,right:n,bottom:i,top:a,near:o=iL,far:s=aL}=t;return rL(this,r,n,i,a,o,s),this.check()}orthographic(t){let{fovy:r=DEt,aspect:n=kEt,focalDistance:i=1,near:a=iL,far:o=aL}=t;Zve(r);let s=r/2,u=i*Math.tan(s),c=u*n;return this.ortho({left:-c,right:c,bottom:-u,top:u,near:a,far:o})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:n=1,near:i=.1,far:a=500}=t;return Zve(r),tL(this,r,n,i,a),this.check()}determinant(){return VM(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),i=1/n[0],a=1/n[1],o=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*a,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*i,t[5]=this[5]*a,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*i,t[9]=this[9]*a,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),i=1/n[0],a=1/n[1],o=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*a,t[2]=this[2]*o,t[3]=this[4]*i,t[4]=this[5]*a,t[5]=this[6]*o,t[6]=this[8]*i,t[7]=this[9]*a,t[8]=this[10]*o,t}transpose(){return HM(this,this),this.check()}invert(){return WM(this,this),this.check()}multiplyLeft(t){return ry(this,t,this),this.check()}multiplyRight(t){return ry(this,this,t),this.check()}rotateX(t){return YM(this,this,t),this.check()}rotateY(t){return XM(this,this,t),this.check()}rotateZ(t){return QM(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return JM(this,this,t,r),this.check()}scale(t){return KM(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return $M(this,this,t),this.check()}transform(t,r){return t.length===4?(r=Yve(r||[-0,-0,-0,-0],t,this),up(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,i;switch(n){case 2:i=xve(r||[-0,-0],t,this);break;case 3:i=Qd(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return up(i,t.length),i}transformAsVector(t,r){let n;switch(t.length){case 2:n=bve(r||[-0,-0],t,this);break;case 3:n=YT(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return up(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])}},a8,o8;function BEt(){return a8||(a8=new Qo([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(a8)),a8}function PEt(){return o8||(o8=new Qo,Object.freeze(o8)),o8}function Zve(e){if(e>Math.PI*2)throw Error("expected radians")}function OEt(e,t,r,n,i,a){let o=2*a/(r-t),s=2*a/(i-n),u=(r+t)/(r-t),c=(i+n)/(i-n),l=-1,f=-1,p=-2*a;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 exe(){let e=new _n(4);return _n!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function txe(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function sL(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 uL(e,t,r){let n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],u=r[1],c=r[2],l=r[3];return e[0]=n*l+o*s+i*c-a*u,e[1]=i*l+o*u+a*s-n*c,e[2]=a*l+o*c+n*u-i*s,e[3]=o*l-n*s-i*u-a*c,e}function rxe(e,t,r){r*=.5;let n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+o*s,e[1]=i*u+a*s,e[2]=a*u-i*s,e[3]=o*u-n*s,e}function nxe(e,t,r){r*=.5;let n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u-a*s,e[1]=i*u+o*s,e[2]=a*u+n*s,e[3]=o*u-i*s,e}function ixe(e,t,r){r*=.5;let n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+i*s,e[1]=i*u-n*s,e[2]=a*u+o*s,e[3]=o*u-a*s,e}function axe(e,t){let r=t[0],n=t[1],i=t[2];return e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),e}function ny(e,t,r,n){let i=t[0],a=t[1],o=t[2],s=t[3],u=r[0],c=r[1],l=r[2],f=r[3],p,d,h,v,m;return p=i*u+a*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),m=Math.sin(d),h=Math.sin((1-n)*d)/m,v=Math.sin(n*d)/m):(h=1-n,v=n),e[0]=h*i+v*u,e[1]=h*a+v*c,e[2]=h*o+v*l,e[3]=h*s+v*f,e}function oxe(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return e[0]=-r*s,e[1]=-n*s,e[2]=-i*s,e[3]=a*s,e}function sxe(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function cL(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 i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);let a=(i+1)%3,o=(i+2)%3;n=Math.sqrt(t[i*3+i]-t[a*3+a]-t[o*3+o]+1),e[i]=.5*n,n=.5/n,e[3]=(t[a*3+o]-t[o*3+a])*n,e[a]=(t[a*3+i]+t[i*3+a])*n,e[o]=(t[o*3+i]+t[i*3+o])*n}return e}var uxe=zve;var cxe=Hve,lxe=Kve,fxe=Jve,pxe=Wve;var dxe=Vve;var hxe=$ve;var mxe=function(){let e=QT(),t=ZT(1,0,0),r=ZT(0,1,0);return function(n,i,a){let o=Zb(i,a);return o<-.999999?(Xd(e,t,i),qM(e)<1e-6&&Xd(e,r,i),IM(e,e),sL(n,e,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Xd(e,i,a),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+o,hxe(n,n))}}(),dur=function(){let e=exe(),t=exe();return function(r,n,i,a,o,s){return ny(e,n,o,s),ny(t,i,a,s),ny(r,e,t,2*s*(1-s)),r}}(),hur=function(){let e=kve();return function(t,r,n,i){return e[0]=n[0],e[3]=n[1],e[6]=n[2],e[1]=i[0],e[4]=i[1],e[7]=i[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],hxe(t,cL(t,e))}}();var REt=[0,0,0,1],cp=class extends sp{constructor(t=0,r=0,n=0,i=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,n,i)}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,i){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,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 cL(this,t),this.check()}fromAxisRotation(t,r){return sL(this,t,r),this.check()}identity(){return txe(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]=Tr(t)}get y(){return this[1]}set y(t){this[1]=Tr(t)}get z(){return this[2]}set z(t){this[2]=Tr(t)}get w(){return this[3]}set w(t){this[3]=Tr(t)}len(){return pxe(this)}lengthSquared(){return dxe(this)}dot(t){return lxe(this,t)}rotationTo(t,r){return mxe(this,t,r),this.check()}add(t){return uxe(this,this,t),this.check()}calculateW(){return axe(this,this),this.check()}conjugate(){return sxe(this,this),this.check()}invert(){return oxe(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(fxe(this,t,r,n),this.check())}multiplyRight(t){return uL(this,this,t),this.check()}multiplyLeft(t){return uL(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 rxe(this,this,t),this.check()}rotateY(t){return nxe(this,this,t),this.check()}rotateZ(t){return ixe(this,this,t),this.check()}scale(t){return cxe(this,this,t),this.check()}slerp(t,r,n){let i,a,o;switch(arguments.length){case 1:({start:i=REt,target:a,ratio:o}=t);break;case 2:i=this,a=t,o=r;break;default:i=t,a=r,o=n}return ny(this,i,a,o),this.check()}transformVector4(t,r=new Og){return Xve(r,t,this),up(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 ic={};ui(ic,{EPSILON1:()=>jEt,EPSILON10:()=>WEt,EPSILON11:()=>VEt,EPSILON12:()=>$Et,EPSILON13:()=>KEt,EPSILON14:()=>JEt,EPSILON15:()=>YEt,EPSILON16:()=>XEt,EPSILON17:()=>QEt,EPSILON18:()=>ZEt,EPSILON19:()=>eAt,EPSILON2:()=>MEt,EPSILON20:()=>tAt,EPSILON3:()=>LEt,EPSILON4:()=>qEt,EPSILON5:()=>NEt,EPSILON6:()=>UEt,EPSILON7:()=>GEt,EPSILON8:()=>zEt,EPSILON9:()=>HEt,PI_OVER_FOUR:()=>nAt,PI_OVER_SIX:()=>iAt,PI_OVER_TWO:()=>rAt,TWO_PI:()=>aAt});var jEt=.1,MEt=.01,LEt=.001,qEt=1e-4,NEt=1e-5,UEt=1e-6,GEt=1e-7,zEt=1e-8,HEt=1e-9,WEt=1e-10,VEt=1e-11,$Et=1e-12,KEt=1e-13,JEt=1e-14,YEt=1e-15,XEt=1e-16,QEt=1e-17,ZEt=1e-18,eAt=1e-19,tAt=1e-20,rAt=Math.PI/2,nAt=Math.PI/4,iAt=Math.PI/6,aAt=Math.PI*2;var dl=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=Tt.UNSIGNED_INT,n=1){let i=this.json[t];return i&&Number.isFinite(i.byteOffset)?this._getTypedArrayFromBinary(t,r,n,1,i.byteOffset):i}getPropertyArray(t,r,n){let i=this.json[t];return i&&Number.isFinite(i.byteOffset)?("componentType"in i&&(r=ya.fromName(i.componentType)),this._getTypedArrayFromBinary(t,r,n,this.featuresLength,i.byteOffset)):this._getTypedArrayFromArray(t,r,i)}getProperty(t,r,n,i,a){let o=this.json[t];if(!o)return o;let s=this.getPropertyArray(t,r,n);if(n===1)return s[i];for(let u=0;u<n;++u)a[u]=s[n*i+u];return a}_getTypedArrayFromBinary(t,r,n,i,a){let o=this._cachedTypedArrays,s=o[t];return s||(s=ya.createTypedArray(r,this.buffer.buffer,this.buffer.byteOffset+a,i*n),o[t]=s),s}_getTypedArrayFromArray(t,r,n){let i=this._cachedTypedArrays,a=i[t];return a||(a=ya.createTypedArray(r,n),i[t]=a),a}};var oAt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},sAt={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]]},uAt={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 gxe(e,t,r,n){let{componentType:i}=e;Rt(e.componentType);let a=typeof i=="string"?ya.fromName(i):i,o=oAt[e.type],s=sAt[e.type],u=uAt[e.type];return r+=e.byteOffset,{values:ya.createTypedArray(a,t,r,o*n),type:a,size:o,unpacker:s,packer:u}}var ac=e=>e!==void 0;function vxe(e,t,r){if(!t)return null;let n=e.getExtension("3DTILES_batch_table_hierarchy"),i=t.HIERARCHY;return i&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=i,n=i),n?cAt(n,r):null}function cAt(e,t){let r,n,i,a=e.instancesLength,o=e.classes,s=e.classIds,u=e.parentCounts,c=e.parentIds,l=a;ac(s.byteOffset)&&(s.componentType=defaultValue(s.componentType,GL.UNSIGNED_SHORT),s.type=AttributeType.SCALAR,i=getBinaryAccessor(s),s=i.createArrayBufferView(t.buffer,t.byteOffset+s.byteOffset,a));let f;if(ac(u))for(ac(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,GL.UNSIGNED_SHORT),u.type=AttributeType.SCALAR,i=getBinaryAccessor(u),u=i.createArrayBufferView(t.buffer,t.byteOffset+u.byteOffset,a)),f=new Uint16Array(a),l=0,r=0;r<a;++r)f[r]=l,l+=u[r];ac(c)&&ac(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,i=getBinaryAccessor(c),c=i.createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,l));let p=o.length;for(r=0;r<p;++r){let m=o[r].length,b=o[r].instances,_=getBinaryProperties(m,b,t);o[r].instances=combine(_,b)}let d=new Array(p).fill(0),h=new Uint16Array(a);for(r=0;r<a;++r)n=s[r],h[r]=d[n],++d[n];let v={classes:o,classIds:s,classIndexes:h,parentCounts:u,parentIndexes:f,parentIds:c};return pAt(v),v}function Rg(e,t,r){if(!e)return;let n=e.parentCounts;return e.parentIds?r(e,t):n>0?lAt(e,t,r):fAt(e,t,r)}function lAt(e,t,r){let n=e.classIds,i=e.parentCounts,a=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(ac(f))return f;let p=i[t],d=o[t];for(let h=0;h<p;++h){let v=a[d+h];v!==t&&l.push(v)}}return null}function fAt(e,t,r){let n=!0;for(;n;){let i=r(e,t);if(ac(i))return i;let a=e.parentIds[t];n=a!==t,t=a}throw new Error("traverseHierarchySingleParent")}function pAt(e){let t=[],n=e.classIds.length;for(let i=0;i<n;++i)xxe(e,i,stack)}function xxe(e,t,r){let n=e.parentCounts,i=e.parentIds,a=e.parentIndexes,s=e.classIds.length;if(!ac(i))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=ac(n)?n[t]:1,c=ac(n)?a[t]:t;for(let l=0;l<u;++l){let f=i[c+l];f!==t&&xxe(e,f,r)}r.pop(t)}function eo(e){return e!=null}var s8=(e,t)=>e,dAt={HIERARCHY:!0,extensions:!0,extras:!0},Zd=class{json;binary;featureCount;_extensions;_properties;_binaryProperties;_hierarchy;constructor(t,r,n,i={}){var a;Rt(n>=0),this.json=t||{},this.binary=r,this.featureCount=n,this._extensions=((a=this.json)==null?void 0:a.extensions)||{},this._properties={};for(let o in this.json)dAt[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),i["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=vxe(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),Rt(typeof r=="string",r),this._hierarchy){let n=Rg(this._hierarchy,t,(i,a)=>{let o=i.classIds[a];return i.classes[o].name===r});return eo(n)}return!1}isExactClass(t,r){return Rt(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),Rt(typeof r=="string",r),eo(this._properties[r])||this._hasPropertyInHierarchy(t,r)}getPropertyNames(t,r){this._checkBatchId(t),r=eo(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),Rt(typeof r=="string",r),this._binaryProperties){let i=this._binaryProperties[r];if(eo(i))return this._getBinaryProperty(i,t)}let n=this._properties[r];if(eo(n))return s8(n[t],!0);if(this._hierarchy){let i=this._getHierarchyProperty(t,r);if(eo(i))return i}}setProperty(t,r,n){let i=this.featureCount;if(this._checkBatchId(t),Rt(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 a=this._properties[r];eo(a)||(this._properties[r]=new Array(i),a=this._properties[r]),a[t]=s8(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],i=this._initializeBinaryProperty(r,n);i&&(t=t||{},t[r]=i)}return t}_initializeBinaryProperty(t,r){if("byteOffset"in r){let n=r;Rt(this.binary,`Property ${t} requires a batch table binary.`),Rt(n.type,`Property ${t} requires a type.`);let i=gxe(n,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:i.values,componentCount:i.size,unpack:i.unpacker,pack:i.packer}}return null}_hasPropertyInHierarchy(t,r){if(!this._hierarchy)return!1;let n=Rg(this._hierarchy,t,(i,a)=>{let o=i.classIds[a],s=i.classes[o].instances;return eo(s[r])});return eo(n)}_getPropertyNamesInHierarchy(t,r){Rg(this._hierarchy,t,(n,i)=>{let a=n.classIds[i],o=n.classes[a].instances;for(let s in o)o.hasOwnProperty(s)&&r.indexOf(s)===-1&&r.push(s)})}_getHierarchyProperty(t,r){return Rg(this._hierarchy,t,(n,i)=>{let a=n.classIds[i],o=n.classes[a],s=n.classIndexes[i],u=o.instances[r];return eo(u)?eo(u.typedArray)?this._getBinaryProperty(u,s):s8(u[s],!0):null})}_setHierarchyProperty(t,r,n,i){let a=Rg(this._hierarchy,r,(o,s)=>{let u=o.classIds[s],c=o.classes[u],l=o.classIndexes[s],f=c.instances[n];return eo(f)?(Rt(s===r,`Inherited property "${n}" is read-only.`),eo(f.typedArray)?this._setBinaryProperty(f,l,i):f[l]=s8(i,!0),!0):!1});return eo(a)}};var lL=4;function lp(e,t,r=0){let n=new DataView(t);if(e.magic=n.getUint32(r,!0),r+=lL,e.version=n.getUint32(r,!0),r+=lL,e.byteLength=n.getUint32(r,!0),r+=lL,e.version!==1)throw new Error(`3D Tile Version ${e.version} not supported`);return r}var jg=4,bxe="b3dm tile in legacy format.";function Mg(e,t,r){let n=new DataView(t),i;e.header=e.header||{};let a=n.getUint32(r,!0);r+=jg;let o=n.getUint32(r,!0);r+=jg;let s=n.getUint32(r,!0);r+=jg;let u=n.getUint32(r,!0);return r+=jg,s>=570425344?(r-=jg*2,i=a,s=o,u=0,a=0,o=0,console.warn(bxe)):u>=570425344&&(r-=jg,i=s,s=a,u=o,a=0,o=0,console.warn(bxe)),e.header.featureTableJsonByteLength=a,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=u,e.header.batchLength=i,r}function Lg(e,t,r,n){return r=hAt(e,t,r,n),r=mAt(e,t,r,n),r}function hAt(e,t,r,n){let{featureTableJsonByteLength:i,featureTableBinaryByteLength:a,batchLength:o}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:o||0},i&&i>0){let s=EM(t,r,i);e.featureTableJson=JSON.parse(s)}return r+=i||0,e.featureTableBinary=new Uint8Array(t,r,a),r+=a||0,r}function mAt(e,t,r,n){let{batchTableJsonByteLength:i,batchTableBinaryByteLength:a}=e.header||{};if(i&&i>0){let o=EM(t,r,i);e.batchTableJson=JSON.parse(o),r+=i,a&&a>0&&(e.batchTableBinary=new Uint8Array(t,r,a),e.batchTableBinary=new Uint8Array(e.batchTableBinary),r+=a)}return r}function fL(e,t,r){if(!t&&(!e||!e.batchIds||!r))return null;let{batchIds:n,isRGB565:i,pointCount:a=0}=e;if(n&&r){let o=new Uint8ClampedArray(a*3);for(let s=0;s<a;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:Tt.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}if(t&&i){let o=new Uint8ClampedArray(a*3);for(let s=0;s<a;s++){let u=kM(t[s]);o[s*3]=u[0],o[s*3+1]=u[1],o[s*3+2]=u[2]}return{type:Tt.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}return t&&t.length===a*3?{type:Tt.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:Tt.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var yxe=new _e;function _xe(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++)FM(t[n*2],t[n*2+1],yxe),yxe.toArray(r,n*3);return{type:Tt.FLOAT,size:2,value:r}}return{type:Tt.FLOAT,size:2,value:t}}function wxe(e,t,r){return e.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,gAt(e,t)):{type:Tt.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function gAt(e,t){let r=new _e,n=new Float32Array(e.pointCount*3);for(let i=0;i<e.pointCount;i++)r.set(t[i*3],t[i*3+1],t[i*3+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(n,i*3);return n}async function Exe(e,t,r,n,i){r=lp(e,t,r),r=Mg(e,t,r),r=Lg(e,t,r,n),vAt(e);let{featureTable:a,batchTable:o}=xAt(e);return await EAt(e,a,o,n,i),bAt(e,a,n),yAt(e,a,o),_At(e,a),r}function vAt(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function xAt(e){let t=new dl(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",Tt.FLOAT,3);let n=wAt(e,t);return{featureTable:t,batchTable:n}}function bAt(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",Tt.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let n=t.getPropertyArray("POSITION_QUANTIZED",Tt.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Tt.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Tt.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=wxe(e,n,r)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function yAt(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",Tt.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?n=t.getPropertyArray("RGB",Tt.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(n=t.getPropertyArray("RGB565",Tt.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=fL(e,n,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",Tt.UNSIGNED_BYTE,4))}function _At(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",Tt.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",Tt.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=_xe(e,r)}}function wAt(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",Tt.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:i,batchTableBinary:a}=e;r=new Zd(i,a,n)}return r}async function EAt(e,t,r,n,i){let a,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");a=(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(!a)return!0;let l={buffer:a,properties:{...o,...s},featureTableProperties:o,batchTableProperties:s,dequantizeInShader:!1};return await AAt(e,l,n,i)}async function AAt(e,t,r,n){if(!n)return;let i={...r,draco:{...r==null?void 0:r.draco,extraAttributes:t.batchTableProperties||{}}};delete i["3d-tiles"];let a=await ho(t.buffer,Dg,i,n),o=a.attributes.POSITION&&a.attributes.POSITION.value,s=a.attributes.COLOR_0&&a.attributes.COLOR_0.value,u=a.attributes.NORMAL&&a.attributes.NORMAL.value,c=a.attributes.BATCH_ID&&a.attributes.BATCH_ID.value,l=o&&a.attributes.POSITION.value.quantization,f=u&&a.attributes.NORMAL.value.quantization;if(l){let d=a.POSITION.data.quantization,h=d.range;e.quantizedVolumeScale=new _e(h,h,h),e.quantizedVolumeOffset=new _e(d.minValues),e.quantizedRange=(1<<d.quantizationBits)-1,e.isQuantizedDraco=!0}f&&(e.octEncodedRange=(1<<a.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let p={};if(t.batchTableProperties)for(let d of Object.keys(t.batchTableProperties))a.attributes[d]&&a.attributes[d].value&&(p[d.toLowerCase()]=a.attributes[d].value);e.attributes={positions:o,colors:fL(e,s,void 0),normals:u,batchIds:c,...p}}var yL={};ui(yL,{decode:()=>cSt,name:()=>x8});var u8="4.2.0-beta.2";var Axe,SAt=(Axe=globalThis.loaders)==null?void 0:Axe.parseImageNode,pL=typeof Image<"u",dL=typeof ImageBitmap<"u",TAt=Boolean(SAt),hL=jr?!0:TAt;function Sxe(e){switch(e){case"auto":return dL||pL||hL;case"imagebitmap":return dL;case"image":return pL;case"data":return hL;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Txe(){if(dL)return"imagebitmap";if(pL)return"image";if(hL)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Cxe(e){let t=CAt(e);if(!t)throw new Error("Not an image");return t}function mL(e){return qg(e)}function qg(e){switch(Cxe(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 CAt(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 DAt=/^data:image\/svg\+xml/,kAt=/\.svg((\?|#).*)?$/;function c8(e){return e&&(DAt.test(e)||kAt.test(e))}function Dxe(e,t){if(c8(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(a){throw new Error(a.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return gL(e,t)}function gL(e,t){if(c8(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function l8(e,t,r){let n=Dxe(e,r),i=self.URL||self.webkitURL,a=typeof n!="string"&&i.createObjectURL(n);try{return await FAt(a||n,t)}finally{a&&i.revokeObjectURL(a)}}async function FAt(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,i)=>{try{r.onload=()=>n(r),r.onerror=a=>{let o=a instanceof Error?a.message:"error";i(new Error(o))}}catch(a){i(a)}})}var BAt={},kxe=!0;async function Fxe(e,t,r){let n;c8(r)?n=await l8(e,t,r):n=gL(e,r);let i=t&&t.imagebitmap;return await PAt(n,i)}async function PAt(e,t=null){if((OAt(t)||!kxe)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),kxe=!1}return await createImageBitmap(e)}function OAt(e){for(let t in e||BAt)return!1;return!0}function Bxe(e){return!MAt(e,"ftyp",4)||!(e[8]&96)?null:IAt(e)}function IAt(e){switch(RAt(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function RAt(e,t,r){return String.fromCharCode(...e.slice(t,r))}function jAt(e){return[...e].map(t=>t.charCodeAt(0))}function MAt(e,t,r=0){let n=jAt(t);for(let i=0;i<n.length;++i)if(n[i]!==e[i+r])return!1;return!0}var oc=!1,iy=!0;function eh(e){let t=ay(e);return qAt(t)||GAt(t)||NAt(t)||UAt(t)||LAt(t)}function LAt(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=Bxe(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function qAt(e){let t=ay(e);return t.byteLength>=24&&t.getUint32(0,oc)===2303741511?{mimeType:"image/png",width:t.getUint32(16,oc),height:t.getUint32(20,oc)}:null}function NAt(e){let t=ay(e);return t.byteLength>=10&&t.getUint32(0,oc)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,iy),height:t.getUint16(8,iy)}:null}function UAt(e){let t=ay(e);return t.byteLength>=14&&t.getUint16(0,oc)===16973&&t.getUint32(2,iy)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,iy),height:t.getUint32(22,iy)}:null}function GAt(e){let t=ay(e);if(!(t.byteLength>=3&&t.getUint16(0,oc)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:i}=zAt(),a=2;for(;a+9<t.byteLength;){let o=t.getUint16(a,oc);if(i.has(o))return{mimeType:"image/jpeg",height:t.getUint16(a+5,oc),width:t.getUint16(a+7,oc)};if(!n.has(o))return null;a+=2,a+=t.getUint16(a,oc)}return null}function zAt(){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 ay(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 Pxe(e,t){var i;let{mimeType:r}=eh(e)||{},n=(i=globalThis.loaders)==null?void 0:i.parseImageNode;return Rt(n),await n(e,r)}async function Oxe(e,t,r){t=t||{};let i=(t.image||{}).type||"auto",{url:a}=r||{},o=HAt(i),s;switch(o){case"imagebitmap":s=await Fxe(e,t,a);break;case"image":s=await l8(e,t,a);break;case"data":s=await Pxe(e,t);break;default:Rt(!1)}return i==="data"&&(s=qg(s)),s}function HAt(e){switch(e){case"auto":case"data":return Txe();default:return Sxe(e),e}}var WAt=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],VAt=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],$At={image:{type:"auto",decode:!0}},Ng={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:u8,mimeTypes:VAt,extensions:WAt,parse:Oxe,tests:[e=>Boolean(eh(new DataView(e)))],options:$At};var jxe,Ixe=(jxe=globalThis.loaders)==null?void 0:jxe.encodeImageNode;async function Mxe(e,t){return t=t||{},t.image=t.image||{},Ixe?Ixe(e,{type:t.image.mimeType}):KAt(e,t)}var Rxe=!0;async function KAt(e,t){let{mimeType:r,jpegQuality:n}=t.image,{width:i,height:a}=mL(e),o=document.createElement("canvas");o.width=i,o.height=a,JAt(e,o);let s=await new Promise(u=>{if(n&&Rxe)try{o.toBlob(u,r,n);return}catch{Rxe=!1}o.toBlob(u,r)});if(!s)throw new Error("image encoding failed");return await s.arrayBuffer()}function JAt(e,t,r=0,n=0){if(r===0&&n===0&&typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let a=t.getContext("bitmaprenderer");if(a)return a.transferFromImageBitmap(e),t}let i=t.getContext("2d");if(e.data){let a=new Uint8ClampedArray(e.data),o=new ImageData(a,e.width,e.height);return i.putImageData(o,0,0),t}return i.drawImage(e,0,0),t}var vL={name:"Images",id:"image",module:"images",version:u8,extensions:["jpeg"],options:{image:{mimeType:"image/png",jpegQuality:null}},encode:Mxe};var xL={};function bL(e){if(xL[e]===void 0){let t=jr?XAt(e):YAt(e);xL[e]=t}return xL[e]}function YAt(e){var i,a;let t=["image/png","image/jpeg","image/gif"],r=((i=globalThis.loaders)==null?void 0:i.imageFormatsNode)||t,n=(a=globalThis.loaders)==null?void 0:a.parseImageNode;return Boolean(n)&&r.includes(e)}function XAt(e){switch(e){case"image/avif":case"image/webp":return QAt(e);default:return!0}}function QAt(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}function bi(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var f8={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},p8={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var ZAt=1.33,Lxe=["SCALAR","VEC2","VEC3","VEC4"],eSt=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],tSt=new Map(eSt),rSt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},nSt={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},iSt={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function d8(e){return Lxe[e-1]||Lxe[0]}function Ug(e){let t=tSt.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function Gg(e,t){let r=iSt[e.componentType],n=rSt[e.type],i=nSt[e.componentType],a=e.count*n,o=e.count*n*i;bi(o>=0&&o<=t.byteLength);let s=p8[e.componentType],u=f8[e.type];return{ArrayType:r,length:a,byteLength:o,componentByteSize:s,numberOfComponentsInElement:u}}function oy(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 i=r.reduce((o,s)=>o+s.byteLength,0),a=t.reduce((o,s)=>{let{width:u,height:c}=s.image;return o+u*c},0);return i+Math.ceil(4*a*ZAt)}function qxe(e,t,r){let n=e.bufferViews[r];bi(n);let i=n.buffer,a=t[i];bi(a);let o=(n.byteOffset||0)+a.byteOffset;return new Uint8Array(a.arrayBuffer,o,n.byteLength)}function Nxe(e,t,r){var v,m;let n=typeof r=="number"?(v=e.accessors)==null?void 0:v[r]:r;if(!n)throw new Error(`No gltf accessor ${JSON.stringify(r)}`);let i=(m=e.bufferViews)==null?void 0:m[n.bufferView||0];if(!i)throw new Error(`No gltf buffer view for accessor ${i}`);let{arrayBuffer:a,byteOffset:o}=t[i.buffer],s=(o||0)+(n.byteOffset||0)+(i.byteOffset||0),{ArrayType:u,length:c,componentByteSize:l,numberOfComponentsInElement:f}=Gg(n,i),p=l*f,d=i.byteStride||p;if(typeof i.byteStride>"u"||i.byteStride===p)return new u(a,s,c);let h=new u(c);for(let b=0;b<n.count;b++){let _=new u(a,s+b*d,f);h.set(_,b*f)}return h}function aSt(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var br=class{gltf;sourceBuffers;byteLength;constructor(t){this.gltf={json:(t==null?void 0:t.json)||aSt(),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(i=>i===t),n=this.getRequiredExtensions().find(i=>i===t);return typeof r=="string"||typeof n=="string"}getExtension(t){let r=this.getUsedExtensions().find(i=>i===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];bi(n);let i=(t.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,i,t.byteLength)}getTypedArrayForAccessor(t){let r=this.getAccessor(t);return Nxe(this.gltf.json,this.gltf.buffers,r)}getTypedArrayForImageData(t){t=this.getAccessor(t);let r=this.getBufferView(t.bufferView),i=this.getBuffer(r.buffer).data,a=r.byteOffset||0;return new Uint8Array(i,a,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 i=t.extensions||{};i[r]=n}removeObjectExtension(t,r){let n=(t==null?void 0:t.extensions)||{};if(n[r]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let i=this.json.extensionsRemoved;i.includes(r)||i.push(r)}delete n[r]}addExtension(t,r={}){return bi(r),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=r,this.registerUsedExtension(t),r}addRequiredExtension(t,r={}){return bi(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 i={mesh:r};return n&&(i.matrix=n),this.json.nodes.push(i),this.json.nodes.length-1}addMesh(t){let{attributes:r,indices:n,material:i,mode:a=4}=t,s={primitives:[{attributes:this._addAttributes(r),mode:a}]};if(n){let u=this._addIndices(n);s.primitives[0].indices=u}return Number.isFinite(i)&&(s.primitives[0].material=i),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=eh(t),i=r||(n==null?void 0:n.mimeType),o={bufferView:this.addBufferView(t),mimeType:i};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 i=t.byteLength;bi(Number.isFinite(i)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let a={buffer:r,byteOffset:n,byteLength:i};return this.byteLength+=go(i,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(a),this.json.bufferViews.length-1}addAccessor(t,r){let n={bufferView:t,type:d8(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),i={min:r.min,max:r.max};(!i.min||!i.max)&&(i=this._getAccessorMinMax(t,r.size));let a={size:r.size,componentType:Ug(t),count:Math.round(t.length/r.size),min:i.min,max:i.max};return this.addAccessor(n,Object.assign(a,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 a,o;this.gltf.buffers=[];let t=this.byteLength,r=new ArrayBuffer(t),n=new Uint8Array(r),i=0;for(let s of this.sourceBuffers||[])i=OB(s,n,i);(o=(a=this.json)==null?void 0:a.buffers)!=null&&o[0]?this.json.buffers[0].byteLength=t:this.json.buffers=[{byteLength:t}],this.gltf.binary=r,this.sourceBuffers=[r]}_removeStringFromArray(t,r){let n=!0;for(;n;){let i=t.indexOf(r);i>-1?t.splice(i,1):n=!1}}_addAttributes(t={}){let r={};for(let n in t){let i=t[n],a=this._getGltfAttributeName(n),o=this.addBinaryBuffer(i.value,i);r[a]=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 i=t.subarray(0,r);for(let a of i)n.min.push(a),n.max.push(a);for(let a=r;a<t.length;a+=r)for(let o=0;o<r;o++)n.min[0+o]=Math.min(n.min[0+o],t[a+o]),n.max[0+o]=Math.max(n.max[0+o],t[a+o]);return n}};function Uxe(e){return(e%1+1)%1}var Gxe={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},oSt={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},zxe={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function sy(e,t){return zxe[t]*Gxe[e]}function zg(e,t,r,n){if(r!=="UINT8"&&r!=="UINT16"&&r!=="UINT32"&&r!=="UINT64")return null;let i=e.getTypedArrayForBufferView(t),a=Hg(i,"SCALAR",r,n+1);return a instanceof BigInt64Array||a instanceof BigUint64Array?null:a}function Hg(e,t,r,n=1){let i=Gxe[t],a=oSt[r],o=zxe[r],s=n*i,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 a(c,l,s)}function Wg(e,t,r){var c,l,f,p,d;let n=`TEXCOORD_${t.texCoord||0}`,i=r.attributes[n],a=e.getTypedArrayForAccessor(i),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,v=(d=e.gltf.images)==null?void 0:d[u];if(v&&typeof v.width<"u"){let m=[];for(let b=0;b<a.length;b+=2){let _=sSt(v,h,a,b,t.channels);m.push(_)}return m}}return[]}function h8(e,t,r,n,i){if(!(r!=null&&r.length))return;let a=[];for(let l of r){let f=n.findIndex(p=>p===l);f===-1&&(f=n.push(l)-1),a.push(f)}let o=new Uint32Array(a),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:Ug(o),count:o.length});i.attributes[t]=c}function sSt(e,t,r,n,i=[0]){let a={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=uSt(o,s,e,u),l=0;for(let f of i){let p=typeof f=="number"?Object.values(a)[f]:a[f],d=c+p.offset,h=qg(e);if(h.data.length<=d)throw new Error(`${h.data.length} <= ${d}`);let v=h.data[d];l|=v<<p.shift}return l}function uSt(e,t,r,n=1){let i=r.width,a=Uxe(e)*(i-1),o=Math.round(a),s=r.height,u=Uxe(t)*(s-1),c=Math.round(u),l=r.components?r.components:n;return(c*i+o)*l}function m8(e,t,r,n,i){let a=[];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/i,l=u/i;a.push(e.slice(c,c+l))}return a}function g8(e,t,r){let n=[];for(let i=0;i<t;i++){let a=i*r;n.push(e.slice(a,a+r))}return n}function v8(e,t,r,n){if(r)throw new Error("Not implemented - arrayOffsets for strings is specified");if(n){let i=[],a=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=a.decode(c);i.push(l),o+=u}}return i}return[]}var Hxe="EXT_mesh_features",x8=Hxe;async function cSt(e,t){let r=new br(e);lSt(r,t)}function lSt(e,t){let r=e.gltf.json;if(r.meshes)for(let n of r.meshes)for(let i of n.primitives)fSt(e,i,t)}function fSt(e,t,r){var a,o,s;if(!((a=r==null?void 0:r.gltf)!=null&&a.loadBuffers))return;let n=(o=t.extensions)==null?void 0:o[Hxe],i=n==null?void 0:n.featureIds;if(i)for(let u of i){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=Wg(e,u.texture,t):c=[];u.data=c}}var EL={};ui(EL,{decode:()=>pSt,name:()=>hl});var _L="EXT_structural_metadata",hl=_L;async function pSt(e,t){let r=new br(e);dSt(r,t)}function dSt(e,t){var n,i;if(!((n=t.gltf)!=null&&n.loadBuffers))return;let r=e.getExtension(_L);r&&((i=t.gltf)!=null&&i.loadImages&&hSt(e,r),mSt(e,r))}function hSt(e,t){let r=t.propertyTextures,n=e.gltf.json;if(r&&n.meshes)for(let i of n.meshes)for(let a of i.primitives)vSt(e,r,a,t)}function mSt(e,t){let r=t.schema;if(!r)return;let n=r.classes,i=t.propertyTables;if(n&&i)for(let a in n){let o=gSt(i,a);o&&bSt(e,r,o)}}function gSt(e,t){for(let r of e)if(r.class===t)return r;return null}function vSt(e,t,r,n){var o;if(!t)return;let i=(o=r.extensions)==null?void 0:o[_L],a=i==null?void 0:i.propertyTextures;if(a)for(let s of a){let u=t[s];xSt(e,u,r,n)}}function xSt(e,t,r,n){var a;if(!t.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);let i=t.class;for(let o in t.properties){let s=`${i}_${o}`,u=(a=t.properties)==null?void 0:a[o];if(!u)continue;u.data||(u.data=[]);let c=u.data,l=Wg(e,u,r);l!==null&&(h8(e,s,l,c,r),u.data=c,n.dataAttributeNames.push(s))}}function bSt(e,t,r){var a,o;let n=(a=t.classes)==null?void 0:a[r.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let i=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=ySt(e,t,u,i,c);c.data=l}}}function ySt(e,t,r,n,i){let a=[],o=i.values,s=e.getTypedArrayForBufferView(o),u=_St(e,r,i,n),c=wSt(e,i,n);switch(r.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{a=ESt(r,n,s,u);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${r.type}`);case"STRING":{a=v8(n,s,u,c);break}case"ENUM":{a=ASt(t,r,n,s,u);break}default:throw new Error(`Unknown classProperty type ${r.type}`)}return a}function _St(e,t,r,n){return t.array&&typeof t.count>"u"&&typeof r.arrayOffsets<"u"?zg(e,r.arrayOffsets,r.arrayOffsetType||"UINT32",n):null}function wSt(e,t,r){return typeof t.stringOffsets<"u"?zg(e,t.stringOffsets,t.stringOffsetType||"UINT32",r):null}function ESt(e,t,r,n){let i=e.array,a=e.count,o=sy(e.type,e.componentType),s=r.byteLength/o,u;return e.componentType?u=Hg(r,e.type,e.componentType,s):u=r,i?n?m8(u,t,n,r.length,o):a?g8(u,t,a):[]:u}function ASt(e,t,r,n,i){var f;let a=t.enumType;if(!a)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[a];if(!o)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${a}`);let s=o.valueType||"UINT16",u=sy(t.type,s),c=n.byteLength/u,l=Hg(n,t.type,s,c);if(l||(l=n),t.array){if(i)return SSt({valuesData:l,numberOfElements:r,arrayOffsets:i,valuesDataBytesLength:n.length,elementSize:u,enumEntry:o});let p=t.count;return p?TSt(l,r,p,o):[]}return wL(l,0,r,o)}function SSt(e){let{valuesData:t,numberOfElements:r,arrayOffsets:n,valuesDataBytesLength:i,elementSize:a,enumEntry:o}=e,s=[];for(let u=0;u<r;u++){let c=n[u],l=n[u+1]-n[u];if(l+c>i)break;let f=c/a,p=l/a,d=wL(t,f,p,o);s.push(d)}return s}function TSt(e,t,r,n){let i=[];for(let a=0;a<t;a++){let o=r*a,s=wL(e,o,r,n);i.push(s)}return i}function wL(e,t,r,n){let i=[];for(let a=0;a<r;a++)if(e instanceof BigInt64Array||e instanceof BigUint64Array)i.push("");else{let o=e[t+a],s=CSt(n,o);s?i.push(s.name):i.push("")}return i}function CSt(e,t){for(let r of e.values)if(r.value===t)return r;return null}var AL={};ui(AL,{decode:()=>DSt,name:()=>Zo});var Wxe="EXT_feature_metadata",Zo=Wxe;async function DSt(e,t){let r=new br(e);kSt(r,t)}function kSt(e,t){var n,i;if(!((n=t.gltf)!=null&&n.loadBuffers))return;let r=e.getExtension(Wxe);r&&((i=t.gltf)!=null&&i.loadImages&&FSt(e,r),BSt(e,r))}function FSt(e,t){let r=t.schema;if(!r)return;let n=r.classes,{featureTextures:i}=t;if(n&&i)for(let a in n){let o=n[a],s=OSt(i,a);s&&RSt(e,s,o)}}function BSt(e,t){let r=t.schema;if(!r)return;let n=r.classes,i=t.featureTables;if(n&&i)for(let a in n){let o=PSt(i,a);o&&ISt(e,r,o)}}function PSt(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function OSt(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function ISt(e,t,r){var a,o;if(!r.class)return;let n=(a=t.classes)==null?void 0:a[r.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let i=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=jSt(e,t,u,i,c);c.data=l}}}function RSt(e,t,r){var i;let n=t.class;for(let a in r.properties){let o=(i=t==null?void 0:t.properties)==null?void 0:i[a];if(o){let s=USt(e,o,n);o.data=s}}}function jSt(e,t,r,n,i){let a=[],o=i.bufferView,s=e.getTypedArrayForBufferView(o),u=MSt(e,r,i,n),c=LSt(e,r,i,n);return r.type==="STRING"||r.componentType==="STRING"?a=v8(n,s,u,c):qSt(r)&&(a=NSt(r,n,s,u)),a}function MSt(e,t,r,n){return t.type==="ARRAY"&&typeof t.componentCount>"u"&&typeof r.arrayOffsetBufferView<"u"?zg(e,r.arrayOffsetBufferView,r.offsetType||"UINT32",n):null}function LSt(e,t,r,n){return typeof r.stringOffsetBufferView<"u"?zg(e,r.stringOffsetBufferView,r.offsetType||"UINT32",n):null}function qSt(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 NSt(e,t,r,n){let i=e.type==="ARRAY",a=e.componentCount,o="SCALAR",s=e.componentType||e.type,u=sy(o,s),c=r.byteLength/u,l=Hg(r,o,s,c);return i?n?m8(l,t,n,r.length,u):a?g8(l,t,a):[]:l}function USt(e,t,r){let n=e.gltf.json;if(!n.meshes)return[];let i=[];for(let a of n.meshes)for(let o of a.primitives)GSt(e,r,t,i,o);return i}function GSt(e,t,r,n,i){let a={channels:r.channels,...r.texture},o=Wg(e,a,i);o&&h8(e,t,o,n,i)}var b8="4.2.0-beta.2";var Vg="4.2.0-beta.2";var sc={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},Vxe;async function TL(e){xx(e.modules);let t=_B("basis");return t||(Vxe||(Vxe=zSt(e)),await Vxe)}async function zSt(e){let t=null,r=null;return[t,r]=await Promise.all([await ju(sc.TRANSCODER,"textures",e),await ju(sc.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await HSt(t,r)}function HSt(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e(r).then(i=>{let{BasisFile:a,initializeBasis:o}=i;o(),n({BasisFile:a})})})}var SL;async function CL(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(SL=SL||WSt(e),await SL)}async function WSt(e){let t=null,r=null;return[t,r]=await Promise.all([await ju(sc.ENCODER,"textures",e),await ju(sc.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await VSt(t,r)}function VSt(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e(r).then(i=>{let{BasisFile:a,KTX2File:o,initializeBasis:s,BasisEncoder:u}=i;s(),n({BasisFile:a,KTX2File:o,BasisEncoder:u})})})}var ye={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919};var $St=["","WEBKIT_","MOZ_"],$xe={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"},y8=null;function uy(e){if(!y8){e=e||KSt()||void 0,y8=new Set;for(let t of $St)for(let r in $xe)if(e&&e.getExtension(`${t}${r}`)){let n=$xe[r];y8.add(n)}}return y8}function KSt(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var abe=Lt(nbe(),1);function $g(e,t){let r=new Array(t.mipMapLevels),n=t.width,i=t.height,a=0;for(let o=0;o<t.mipMapLevels;++o){let s=XSt(t,n,i,e,o),u=YSt(e,o,a,s);r[o]={compressed:!0,format:t.internalFormat,data:u,width:n,height:i,levelSize:s},n=Math.max(1,n>>1),i=Math.max(1,i>>1),a+=s}return r}function YSt(e,t,r,n){return Array.isArray(e)?e[t].levelData:new Uint8Array(e.buffer,e.byteOffset+r,n)}function XSt(e,t,r,n,i){return Array.isArray(n)?e.sizeFunction(n[i]):e.sizeFunction(t,r)}var QSt={131:ye.COMPRESSED_RGB_S3TC_DXT1_EXT,132:ye.COMPRESSED_SRGB_S3TC_DXT1_EXT,133:ye.COMPRESSED_RGBA_S3TC_DXT1_EXT,134:ye.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,135:ye.COMPRESSED_RGBA_S3TC_DXT3_EXT,136:ye.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,137:ye.COMPRESSED_RGBA_S3TC_DXT5_EXT,138:ye.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,139:ye.COMPRESSED_RED_RGTC1_EXT,140:ye.COMPRESSED_SIGNED_RED_RGTC1_EXT,141:ye.COMPRESSED_RED_GREEN_RGTC2_EXT,142:ye.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,147:ye.COMPRESSED_RGB8_ETC2,148:ye.COMPRESSED_SRGB8_ETC2,149:ye.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,150:ye.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,151:ye.COMPRESSED_RGBA8_ETC2_EAC,152:ye.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,153:ye.COMPRESSED_R11_EAC,154:ye.COMPRESSED_SIGNED_R11_EAC,155:ye.COMPRESSED_RG11_EAC,156:ye.COMPRESSED_SIGNED_RG11_EAC,157:ye.COMPRESSED_RGBA_ASTC_4x4_KHR,158:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,159:ye.COMPRESSED_RGBA_ASTC_5x4_KHR,160:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,161:ye.COMPRESSED_RGBA_ASTC_5x5_KHR,162:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,163:ye.COMPRESSED_RGBA_ASTC_6x5_KHR,164:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,165:ye.COMPRESSED_RGBA_ASTC_6x6_KHR,166:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,167:ye.COMPRESSED_RGBA_ASTC_8x5_KHR,168:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,169:ye.COMPRESSED_RGBA_ASTC_8x6_KHR,170:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,171:ye.COMPRESSED_RGBA_ASTC_8x8_KHR,172:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,173:ye.COMPRESSED_RGBA_ASTC_10x5_KHR,174:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,175:ye.COMPRESSED_RGBA_ASTC_10x6_KHR,176:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,177:ye.COMPRESSED_RGBA_ASTC_10x8_KHR,178:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,179:ye.COMPRESSED_RGBA_ASTC_10x10_KHR,180:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,181:ye.COMPRESSED_RGBA_ASTC_12x10_KHR,182:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,183:ye.COMPRESSED_RGBA_ASTC_12x12_KHR,184:ye.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,1000054e3:ye.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,1000054001:ye.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,1000066e3:ye.COMPRESSED_RGBA_ASTC_4x4_KHR,1000066001:ye.COMPRESSED_RGBA_ASTC_5x4_KHR,1000066002:ye.COMPRESSED_RGBA_ASTC_5x5_KHR,1000066003:ye.COMPRESSED_RGBA_ASTC_6x5_KHR,1000066004:ye.COMPRESSED_RGBA_ASTC_6x6_KHR,1000066005:ye.COMPRESSED_RGBA_ASTC_8x5_KHR,1000066006:ye.COMPRESSED_RGBA_ASTC_8x6_KHR,1000066007:ye.COMPRESSED_RGBA_ASTC_8x8_KHR,1000066008:ye.COMPRESSED_RGBA_ASTC_10x5_KHR,1000066009:ye.COMPRESSED_RGBA_ASTC_10x6_KHR,1000066010:ye.COMPRESSED_RGBA_ASTC_10x8_KHR,1000066011:ye.COMPRESSED_RGBA_ASTC_10x10_KHR,1000066012:ye.COMPRESSED_RGBA_ASTC_12x10_KHR,1000066013:ye.COMPRESSED_RGBA_ASTC_12x12_KHR};function ibe(e){return QSt[e]}var wo=[171,75,84,88,32,50,48,187,13,10,26,10];function S8(e){let t=new Uint8Array(e);return!(t.byteLength<wo.length||t[0]!==wo[0]||t[1]!==wo[1]||t[2]!==wo[2]||t[3]!==wo[3]||t[4]!==wo[4]||t[5]!==wo[5]||t[6]!==wo[6]||t[7]!==wo[7]||t[8]!==wo[8]||t[9]!==wo[9]||t[10]!==wo[10]||t[11]!==wo[11])}function obe(e){let t=new Uint8Array(e),r=(0,abe.read)(t),n=Math.max(1,r.levels.length),i=r.pixelWidth,a=r.pixelHeight,o=ibe(r.vkFormat);return $g(r.levels,{mipMapLevels:n,width:i,height:a,sizeFunction:s=>s.uncompressedByteLength,internalFormat:o})}var ZSt={etc1:{basisFormat:0,compressed:!0,format:ye.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:ye.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:ye.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:ye.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:ye.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:ye.COMPRESSED_RGBA_ASTC_4X4_KHR},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};async function ly(e,t){if(t.basis.containerFormat==="auto"){if(S8(e)){let n=await CL(t);return sbe(n.KTX2File,e,t)}let{BasisFile:r}=await TL(t);return PL(r,e,t)}switch(t.basis.module){case"encoder":let r=await CL(t);switch(t.basis.containerFormat){case"ktx2":return sbe(r.KTX2File,e,t);case"basis":default:return PL(r.BasisFile,e,t)}case"transcoder":default:let{BasisFile:n}=await TL(t);return PL(n,e,t)}}function PL(e,t,r){let n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("Failed to start basis transcoding");let i=n.getNumImages(),a=[];for(let o=0;o<i;o++){let s=n.getNumLevels(o),u=[];for(let c=0;c<s;c++)u.push(e3t(n,o,c,r));a.push(u)}return a}finally{n.close(),n.delete()}}function e3t(e,t,r,n){let i=e.getImageWidth(t,r),a=e.getImageHeight(t,r),o=e.getHasAlpha(),{compressed:s,format:u,basisFormat:c}=ube(n,o),l=e.getImageTranscodedSizeInBytes(t,r,c),f=new Uint8Array(l);if(!e.transcodeImage(f,t,r,c,0,0))throw new Error("failed to start Basis transcoding");return{width:i,height:a,data:f,compressed:s,format:u,hasAlpha:o}}function sbe(e,t,r){let n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("failed to start KTX2 transcoding");let i=n.getLevels(),a=[];for(let o=0;o<i;o++){a.push(t3t(n,o,r));break}return[a]}finally{n.close(),n.delete()}}function t3t(e,t,r){let{alphaFlag:n,height:i,width:a}=e.getImageLevelInfo(t,0,0),{compressed:o,format:s,basisFormat:u}=ube(r,n),c=e.getImageTranscodedSizeInBytes(t,0,0,u),l=new Uint8Array(c);if(!e.transcodeImage(l,t,0,0,u,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:a,height:i,data:l,compressed:o,levelSize:c,hasAlpha:n,format:s}}function ube(e,t){let r=e&&e.basis&&e.basis.format;return r==="auto"&&(r=Kg()),typeof r=="object"&&(r=t?r.alpha:r.noAlpha),r=r.toLowerCase(),ZSt[r]}function Kg(){let e=uy();return e.has("astc")?"astc-4x4":e.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:e.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:e.has("etc1")?"etc1":e.has("etc2")?"etc2":"rgb565"}var cbe={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:Vg,worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},th={...cbe,parse:ly};var Eo={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},r3t={DXT1:ye.COMPRESSED_RGB_S3TC_DXT1_EXT,DXT3:ye.COMPRESSED_RGBA_S3TC_DXT3_EXT,DXT5:ye.COMPRESSED_RGBA_S3TC_DXT5_EXT,"ATC ":ye.COMPRESSED_RGB_ATC_WEBGL,ATCA:ye.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,ATCI:ye.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL},n3t=pbe,i3t=T8,a3t=T8,o3t={DXT1:pbe,DXT3:T8,DXT5:T8,"ATC ":n3t,ATCA:i3t,ATCI:a3t};function lbe(e){return new Uint32Array(e,0,Eo.HEADER_LENGTH)[Eo.MAGIC_NUMBER_INDEX]===Eo.MAGIC_NUMBER}function fbe(e){let t=new Int32Array(e,0,Eo.HEADER_LENGTH),r=t[Eo.HEADER_PF_FOURCC_INDEX];Rt(Boolean(t[Eo.HEADER_PF_FLAGS_INDEX]&Eo.DDPF_FOURCC),"DDS: Unsupported format, must contain a FourCC code");let n=s3t(r),i=r3t[n],a=o3t[n];Rt(i&&a,`DDS: Unknown pixel format ${r}`);let o=1;t[Eo.HEADER_FLAGS_INDEX]&Eo.DDSD_MIPMAPCOUNT&&(o=Math.max(1,t[Eo.MIPMAPCOUNT_INDEX]));let s=t[Eo.HEADER_WIDTH_INDEX],u=t[Eo.HEADER_HEIGHT_INDEX],c=t[Eo.HEADER_SIZE_INDEX]+4,l=new Uint8Array(e,c);return $g(l,{mipMapLevels:o,width:s,height:u,sizeFunction:a,internalFormat:i})}function pbe(e,t){return(e+3>>2)*(t+3>>2)*8}function T8(e,t){return(e+3>>2)*(t+3>>2)*16}function s3t(e){return String.fromCharCode(e&255,e>>8&255,e>>16&255,e>>24&255)}var es={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},u3t={0:[ye.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],1:[ye.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],2:[ye.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],3:[ye.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],6:[ye.COMPRESSED_RGB_ETC1_WEBGL],7:[ye.COMPRESSED_RGB_S3TC_DXT1_EXT],9:[ye.COMPRESSED_RGBA_S3TC_DXT3_EXT],11:[ye.COMPRESSED_RGBA_S3TC_DXT5_EXT],22:[ye.COMPRESSED_RGB8_ETC2],23:[ye.COMPRESSED_RGBA8_ETC2_EAC],24:[ye.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],25:[ye.COMPRESSED_R11_EAC],26:[ye.COMPRESSED_RG11_EAC],27:[ye.COMPRESSED_RGBA_ASTC_4X4_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR],28:[ye.COMPRESSED_RGBA_ASTC_5X4_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR],29:[ye.COMPRESSED_RGBA_ASTC_5X5_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR],30:[ye.COMPRESSED_RGBA_ASTC_6X5_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR],31:[ye.COMPRESSED_RGBA_ASTC_6X6_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR],32:[ye.COMPRESSED_RGBA_ASTC_8X5_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR],33:[ye.COMPRESSED_RGBA_ASTC_8X6_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR],34:[ye.COMPRESSED_RGBA_ASTC_8X8_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR],35:[ye.COMPRESSED_RGBA_ASTC_10X5_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR],36:[ye.COMPRESSED_RGBA_ASTC_10X6_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR],37:[ye.COMPRESSED_RGBA_ASTC_10X8_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR],38:[ye.COMPRESSED_RGBA_ASTC_10X10_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR],39:[ye.COMPRESSED_RGBA_ASTC_12X10_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR],40:[ye.COMPRESSED_RGBA_ASTC_12X12_KHR,ye.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR]},c3t={0:dbe,1:dbe,2:hbe,3:hbe,6:fy,7:fy,9:py,11:py,22:fy,23:py,24:fy,25:fy,26:py,27:py,28:l3t,29:f3t,30:p3t,31:d3t,32:h3t,33:m3t,34:g3t,35:v3t,36:x3t,37:b3t,38:y3t,39:_3t,40:w3t};function mbe(e){let r=new Uint32Array(e,0,es.HEADER_LENGTH)[es.MAGIC_NUMBER_INDEX];return r===es.MAGIC_NUMBER||r===es.MAGIC_NUMBER_EXTRA}function gbe(e){let t=new Uint32Array(e,0,es.HEADER_LENGTH),r=t[es.PIXEL_FORMAT_INDEX],n=t[es.COLOUR_SPACE_INDEX],i=u3t[r]||[],a=i.length>1&&n?i[1]:i[0],o=c3t[r],s=t[es.MIPMAPCOUNT_INDEX],u=t[es.WIDTH_INDEX],c=t[es.HEIGHT_INDEX],l=es.HEADER_SIZE+t[es.METADATA_SIZE_INDEX],f=new Uint8Array(e,l);return $g(f,{mipMapLevels:s,width:u,height:c,sizeFunction:o,internalFormat:a})}function dbe(e,t){return e=Math.max(e,16),t=Math.max(t,8),e*t/4}function hbe(e,t){return e=Math.max(e,8),t=Math.max(t,8),e*t/2}function fy(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8}function py(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16}function l3t(e,t){return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16}function f3t(e,t){return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16}function p3t(e,t){return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16}function d3t(e,t){return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16}function h3t(e,t){return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16}function m3t(e,t){return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16}function g3t(e,t){return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16}function v3t(e,t){return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16}function x3t(e,t){return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16}function b3t(e,t){return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16}function y3t(e,t){return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16}function _3t(e,t){return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16}function w3t(e,t){return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16}function vbe(e){if(S8(e))return obe(e);if(lbe(e))return fbe(e);if(mbe(e))return gbe(e);throw new Error("Texture container format not recognized")}var xbe={dataType:null,batchType:null,name:"Texture Containers",id:"compressed-texture",module:"textures",version:Vg,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":{libraryPath:"libs/",useBasis:!1}}},C8={...xbe,parse:async(e,t)=>{var r;return(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 ly(e,t))[0]):vbe(e)}};var OL={name:"Basis Universal Supercompressed GPU Texture",id:"ktx2-basis-writer",module:"textures",version:Vg,extensions:["ktx2"],worker:!0,options:{useSRGB:!1,qualityLevel:10,encodeUASTC:!1,mipmaps:!1}};var Jg=!0,bbe=1735152710,jL=12,D8=8,E3t=1313821514,A3t=5130562,S3t=0,T3t=0,C3t=1;function D3t(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 ybe(e,t=0,r={}){let n=new DataView(e),{magic:i=bbe}=r,a=n.getUint32(t,!1);return a===i||a===bbe}function _be(e,t,r=0,n={}){let i=new DataView(t),a=D3t(i,r+0),o=i.getUint32(r+4,Jg),s=i.getUint32(r+8,Jg);switch(Object.assign(e,{header:{byteOffset:r,byteLength:s,hasBinChunk:!1},type:a,version:o,json:{},binChunks:[]}),r+=jL,e.version){case 1:return k3t(e,i,r);case 2:return F3t(e,i,r,n={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function k3t(e,t,r){Rt(e.header.byteLength>jL+D8);let n=t.getUint32(r+0,Jg),i=t.getUint32(r+4,Jg);return r+=D8,Rt(i===S3t),IL(e,t,r,n),r+=n,r+=RL(e,t,r,e.header.byteLength),r}function F3t(e,t,r,n){return Rt(e.header.byteLength>jL+D8),B3t(e,t,r,n),r+e.header.byteLength}function B3t(e,t,r,n){for(;r+8<=e.header.byteLength;){let i=t.getUint32(r+0,Jg),a=t.getUint32(r+4,Jg);switch(r+=D8,a){case E3t:IL(e,t,r,i);break;case A3t:RL(e,t,r,i);break;case T3t:n.strict||IL(e,t,r,i);break;case C3t:n.strict||RL(e,t,r,i);break;default:break}r+=go(i,4)}return r}function IL(e,t,r,n){let i=new Uint8Array(t.buffer,r,n),o=new TextDecoder("utf8").decode(i);return e.json=JSON.parse(o),go(n,4)}function RL(e,t,r,n){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:t.buffer}),go(n,4)}function ML(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;let n=t.baseUri||t.uri;if(!n)throw new Error(`'baseUri' must be provided to resolve relative url ${e}`);return n.substr(0,n.lastIndexOf("/")+1)+e}var qL={};ui(qL,{decode:()=>z3t,name:()=>G3t});var P3t="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",O3t="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",I3t=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]),R3t=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]),j3t={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},M3t={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function wbe(e,t,r,n,i,a="NONE"){let o=await L3t();U3t(o,o.exports[M3t[i]],e,t,r,n,o.exports[j3t[a||"NONE"]])}var LL;async function L3t(){return LL||(LL=q3t()),LL}async function q3t(){let e=P3t;WebAssembly.validate(I3t)&&(e=O3t,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(N3t(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function N3t(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;++n){let i=e.charCodeAt(n);t[n]=i>96?i-71:i>64?i-65:i>47?i+4:i>46?63:62}let r=0;for(let n=0;n<e.length;++n)t[r++]=t[n]<60?R3t[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,r)}function U3t(e,t,r,n,i,a,o){let s=e.exports.sbrk,u=n+3&-4,c=s(u*i),l=s(a.length),f=new Uint8Array(e.exports.memory.buffer);f.set(a,l);let p=t(c,n,i,l,a.length);if(p===0&&o&&o(c,u,i),r.set(f.subarray(c,c+n*i)),s(c-s(0)),p!==0)throw new Error(`Malformed buffer data: ${p}`)}var k8="EXT_meshopt_compression",G3t=k8;async function z3t(e,t){var i,a;let r=new br(e);if(!((i=t==null?void 0:t.gltf)!=null&&i.decompressMeshes)||!((a=t.gltf)!=null&&a.loadBuffers))return;let n=[];for(let o of e.json.bufferViews||[])n.push(H3t(r,o));await Promise.all(n),r.removeExtension(k8)}async function H3t(e,t){let r=e.getObjectExtension(t,k8);if(r){let{byteOffset:n=0,byteLength:i=0,byteStride:a,count:o,mode:s,filter:u="NONE",buffer:c}=r,l=e.gltf.buffers[c],f=new Uint8Array(l.arrayBuffer,l.byteOffset+n,i),p=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await wbe(p,o,a,f,s,u),e.removeObjectExtension(t,k8)}}var NL={};ui(NL,{name:()=>W3t,preprocess:()=>V3t});var Yg="EXT_texture_webp",W3t=Yg;function V3t(e,t){let r=new br(e);if(!bL("image/webp")){if(r.getRequiredExtensions().includes(Yg))throw new Error(`gltf: Required extension ${Yg} not supported by browser`);return}let{json:n}=r;for(let i of n.textures||[]){let a=r.getObjectExtension(i,Yg);a&&(i.source=a.source),r.removeObjectExtension(i,Yg)}r.removeExtension(Yg)}var UL={};ui(UL,{name:()=>$3t,preprocess:()=>K3t});var F8="KHR_texture_basisu",$3t=F8;function K3t(e,t){let r=new br(e),{json:n}=r;for(let i of n.textures||[]){let a=r.getObjectExtension(i,F8);a&&(i.source=a.source,r.removeObjectExtension(i,F8))}r.removeExtension(F8)}var HL={};ui(HL,{decode:()=>Z3t,encode:()=>e6t,name:()=>X3t,preprocess:()=>Q3t});function Ebe(e){let t={};for(let r in e){let n=e[r];if(r!=="indices"){let i=zL(n);t[r]=i}}return t}function zL(e){let{buffer:t,size:r,count:n}=J3t(e);return{value:t,size:r,byteOffset:0,count:n,type:d8(r),componentType:Ug(t)}}function J3t(e){let t=e,r=1,n=0;return e&&e.value&&(t=e.value,r=e.size||1),t&&(ArrayBuffer.isView(t)||(t=Y3t(t,Float32Array)),n=t.length/r),{buffer:t,size:r,count:n}}function Y3t(e,t,r=!1){return e?Array.isArray(e)?new t(e):r&&!(e instanceof t)?new t(e):e:null}var fp="KHR_draco_mesh_compression",X3t=fp;function Q3t(e,t,r){let n=new br(e);for(let i of Abe(n))n.getObjectExtension(i,fp)}async function Z3t(e,t,r){var a;if(!((a=t==null?void 0:t.gltf)!=null&&a.decompressMeshes))return;let n=new br(e),i=[];for(let o of Abe(n))n.getObjectExtension(o,fp)&&i.push(t6t(n,o,t,r));await Promise.all(i),n.removeExtension(fp)}function e6t(e,t={}){let r=new br(e);for(let n of r.json.meshes||[])r6t(n,t),r.addRequiredExtension(fp)}async function t6t(e,t,r,n){let i=e.getObjectExtension(t,fp);if(!i)return;let a=e.getTypedArrayForBufferView(i.bufferView),o=md(a.buffer,a.byteOffset),s={...r};delete s["3d-tiles"];let u=await ho(o,Dg,s,n),c=Ebe(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=zL(u.indices)),e.removeObjectExtension(t,fp),n6t(t)}function r6t(e,t,r=4,n,i){var l;if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let a=n.DracoWriter.encodeSync({attributes:e}),o=(l=i==null?void 0:i.parseSync)==null?void 0:l.call(i,{attributes:e}),s=n._addFauxAttributes(o.attributes),u=n.addBufferView(a);return{primitives:[{attributes:s,mode:r,extensions:{[fp]:{bufferView:u,attributes:s}}}]}}function n6t(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*Abe(e){for(let t of e.json.meshes||[])for(let r of t.primitives)yield r}var WL={};ui(WL,{decode:()=>s6t,name:()=>i6t});var P8="KHR_texture_transform",i6t=P8,B8=new ce,a6t=new Sr,o6t=new Sr;async function s6t(e,t){var a;if(!new br(e).hasExtension(P8)||!((a=t.gltf)!=null&&a.loadBuffers))return;let i=e.json.materials||[];for(let o=0;o<i.length;o++)u6t(o,e)}function u6t(e,t){var a,o,s,u;let r=(a=t.json.materials)==null?void 0:a[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],i=[];for(let c of n)c&&((u=c==null?void 0:c.extensions)!=null&&u[P8])&&c6t(t,e,c,i)}function c6t(e,t,r,n){let i=l6t(r,n);if(!i)return;let a=e.json.meshes||[];for(let o of a)for(let s of o.primitives){let u=s.material;Number.isFinite(u)&&t===u&&f6t(e,s,i)}}function l6t(e,t){var o;let r=(o=e.extensions)==null?void 0:o[P8],{texCoord:n=0}=e,{texCoord:i=n}=r;if(!(t.findIndex(([s,u])=>s===n&&u===i)!==-1)){let s=h6t(r);return n!==i&&(e.texCoord=i),t.push([n,i]),{originalTexCoord:n,texCoord:i,matrix:s}}return null}function f6t(e,t,r){var s,u;let{originalTexCoord:n,texCoord:i,matrix:a}=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){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:v}=Gg(c,l),m=p8[c.componentType],b=f8[c.type],_=l.byteStride||m*b,E=new Float32Array(v);for(let T=0;T<c.count;T++){let S=new h(f,d+T*_,2);B8.set(S[0],S[1],1),B8.transformByMatrix3(a),E.set([B8[0],B8[1]],T*b)}n===i?p6t(c,l,e.buffers,E):d6t(i,c,t,e,E)}}}}function p6t(e,t,r,n){e.componentType=5126,r.push({arrayBuffer:n.buffer,byteOffset:0,byteLength:n.buffer.byteLength}),t.buffer=r.length-1,t.byteLength=n.buffer.byteLength,t.byteOffset=0,delete t.byteStride}function d6t(e,t,r,n,i){n.buffers.push({arrayBuffer:i.buffer,byteOffset:0,byteLength:i.buffer.byteLength});let a=n.json.bufferViews;if(!a)return;a.push({buffer:n.buffers.length-1,byteLength:i.buffer.byteLength,byteOffset:0});let o=n.json.accessors;o&&(o.push({bufferView:(a==null?void 0:a.length)-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),r.attributes[`TEXCOORD_${e}`]=o.length-1)}function h6t(e){let{offset:t=[0,0],rotation:r=0,scale:n=[1,1]}=e,i=new Sr().set(1,0,0,0,1,0,t[0],t[1],1),a=a6t.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),o=o6t.set(n[0],0,0,0,n[1],0,0,0,1);return i.multiplyRight(a).multiplyRight(o)}var VL={};ui(VL,{decode:()=>g6t,encode:()=>v6t,name:()=>m6t});var rh="KHR_lights_punctual",m6t=rh;async function g6t(e){let t=new br(e),{json:r}=t,n=t.getExtension(rh);n&&(t.json.lights=n.lights,t.removeExtension(rh));for(let i of r.nodes||[]){let a=t.getObjectExtension(i,rh);a&&(i.light=a.light),t.removeObjectExtension(i,rh)}}async function v6t(e){let t=new br(e),{json:r}=t;if(r.lights){let n=t.addExtension(rh);bi(!n.lights),n.lights=r.lights,delete r.lights}if(t.json.lights){for(let n of t.json.lights){let i=n.node;t.addObjectExtension(i,rh,n)}delete t.json.lights}}var $L={};ui($L,{decode:()=>b6t,encode:()=>y6t,name:()=>x6t});var dy="KHR_materials_unlit",x6t=dy;async function b6t(e){let t=new br(e),{json:r}=t;for(let n of r.materials||[])n.extensions&&n.extensions.KHR_materials_unlit&&(n.unlit=!0),t.removeObjectExtension(n,dy);t.removeExtension(dy)}function y6t(e){let t=new br(e),{json:r}=t;if(t.materials)for(let n of r.materials||[])n.unlit&&(delete n.unlit,t.addObjectExtension(n,dy,{}),t.addExtension(dy))}var KL={};ui(KL,{decode:()=>w6t,encode:()=>E6t,name:()=>_6t});var hy="KHR_techniques_webgl",_6t=hy;async function w6t(e){let t=new br(e),{json:r}=t,n=t.getExtension(hy);if(n){let i=A6t(n,t);for(let a of r.materials||[]){let o=t.getObjectExtension(a,hy);o&&(a.technique=Object.assign({},o,i[o.technique]),a.technique.values=S6t(a.technique,t)),t.removeObjectExtension(a,hy)}t.removeExtension(hy)}}async function E6t(e,t){}function A6t(e,t){let{programs:r=[],shaders:n=[],techniques:i=[]}=e,a=new TextDecoder;return n.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=a.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]}),i.forEach(o=>{o.program=r[o.program]}),i}function S6t(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 Sbe=[EL,yL,qL,NL,UL,HL,VL,$L,KL,WL,AL];function Tbe(e,t={},r){var i;let n=Sbe.filter(a=>Dbe(a.name,t));for(let a of n)(i=a.preprocess)==null||i.call(a,e,t,r)}async function Cbe(e,t={},r){var i;let n=Sbe.filter(a=>Dbe(a.name,t));for(let a of n)await((i=a.decode)==null?void 0:i.call(a,e,t,r))}function Dbe(e,t){var i;let r=((i=t==null?void 0:t.gltf)==null?void 0:i.excludeExtensions)||{};return!(e in r&&!r[e])}var JL="KHR_binary_glTF";function kbe(e){let t=new br(e),{json:r}=t;for(let n of r.images||[]){let i=t.getObjectExtension(n,JL);i&&Object.assign(n,i),t.removeObjectExtension(n,JL)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,t.removeExtension(JL)}var Fbe={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},C6t={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},YL=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),kbe(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 Fbe)this._convertTopLevelObjectToArray(t,r)}_convertTopLevelObjectToArray(t,r){let n=t[r];if(!(!n||Array.isArray(n))){t[r]=[];for(let i in n){let a=n[i];a.id=a.id||i;let o=t[r].length;t[r].push(a),this.idToIndexMap[r][i]=o}}}_convertObjectIdsToArrayIndices(t){for(let r in Fbe)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:i,material:a}=r;for(let o in n)n[o]=this._convertIdToIndex(n[o],"accessor");i&&(r.indices=this._convertIdToIndex(i,"accessor")),a&&(r.material=this._convertIdToIndex(a,"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 i in n){let a=n[i],o=this._convertIdToIndex(a,i);n[i]=o}}_convertIdToIndex(t,r){let n=C6t[r];if(n in this.idToIndexMap){let i=this.idToIndexMap[n][t];if(!Number.isFinite(i))throw new Error(`gltf v1: failed to resolve ${r} with id ${t}`);return i}return t}_updateObjects(t){for(let r of this.json.buffers)delete r.type}_updateMaterial(t){var r,n,i;for(let a of t.materials){a.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let o=((r=a.values)==null?void 0:r.tex)||((n=a.values)==null?void 0:n.texture2d_0)||((i=a.values)==null?void 0:i.diffuseTex),s=t.textures.findIndex(u=>u.id===o);s!==-1&&(a.pbrMetallicRoughness.baseColorTexture={index:s})}}};function Bbe(e,t={}){return new YL().normalize(e,t)}async function Pbe(e,t,r=0,n,i){var a,o,s;return D6t(e,t,r,n),Bbe(e,{normalize:(a=n==null?void 0:n.gltf)==null?void 0:a.normalize}),Tbe(e,n,i),(o=n==null?void 0:n.gltf)!=null&&o.loadBuffers&&e.json.buffers&&await k6t(e,n,i),(s=n==null?void 0:n.gltf)!=null&&s.loadImages&&await F6t(e,n,i),await Cbe(e,n,i),e}function D6t(e,t,r,n){if(n.uri&&(e.baseUri=n.uri),t instanceof ArrayBuffer&&!ybe(t,r,n)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=PB(t);else if(t instanceof ArrayBuffer){let o={};r=_be(o,t,r,n.glb),bi(o.type==="glTF",`Invalid GLB magic string ${o.type}`),e._glb=o,e.json=o.json}else bi(!1,"GLTF: must be ArrayBuffer or string");let i=e.json.buffers||[];if(e.buffers=new Array(i.length).fill(null),e._glb&&e._glb.header.hasBinChunk){let{binChunks:o}=e._glb;e.buffers[0]={arrayBuffer:o[0].arrayBuffer,byteOffset:o[0].byteOffset,byteLength:o[0].byteLength}}let a=e.json.images||[];e.images=new Array(a.length).fill({})}async function k6t(e,t,r){var i,a;let n=e.json.buffers||[];for(let o=0;o<n.length;++o){let s=n[o];if(s.uri){let{fetch:u}=r;bi(u);let c=ML(s.uri,t),l=await((i=r==null?void 0:r.fetch)==null?void 0:i.call(r,c)),f=await((a=l==null?void 0:l.arrayBuffer)==null?void 0:a.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 F6t(e,t,r){let n=B6t(e),i=e.json.images||[],a=[];for(let o of n)a.push(P6t(e,i[o],o,t,r));return await Promise.all(a)}function B6t(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,i){let a;if(t.uri&&!t.hasOwnProperty("bufferView")){let s=ML(t.uri,n),{fetch:u}=i;a=await(await u(s)).arrayBuffer(),t.bufferView={data:a}}if(Number.isFinite(t.bufferView)){let s=qxe(e.json,e.buffers,t.bufferView);a=md(s.buffer,s.byteOffset,s.byteLength)}bi(a,"glTF image has no data");let o=await ho(a,[Ng,th],{...n,mimeType:t.mimeType,basis:n.basis||{format:Kg()}},i);o&&o[0]&&(o={compressed:!0,mipmaps:!1,width:o[0].width,height:o[0].height,data:o[0]}),e.images=e.images||[],e.images[r]=o}var ml={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:b8,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:O6t,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function O6t(e,t={},r){t={...ml.options,...t},t.gltf={...ml.options.gltf,...t.gltf};let{byteOffset:n=0}=t;return await Pbe({},e,n,t,r)}var I6t=1179937895,R6t=1313821514,j6t=5130562,uc=!0;function Obe(e,t,r=0,n={}){let{magic:i=I6t,version:a=2,json:o={},binary:s}=e,u=r;t&&(t.setUint32(r+0,i,uc),t.setUint32(r+4,a,uc),t.setUint32(r+8,0,uc));let c=r+8;r+=12;let l=r;t&&(t.setUint32(r+0,0,uc),t.setUint32(r+4,R6t,uc)),r+=8;let f=JSON.stringify(o);if(r=G0(t,r,f,4),t){let p=r-l-8;t.setUint32(l+0,p,uc)}if(s){let p=r;if(t&&(t.setUint32(r+0,0,uc),t.setUint32(r+4,j6t,uc)),r+=8,r=cE(t,r,s,4),t){let d=r-p-8;t.setUint32(p+0,d,uc)}}if(t){let p=r-u;t.setUint32(c,p,uc)}return r}function XL(e,t,r,n){return M6t(e),Obe(e,t,r,n)}function M6t(e,{firstBuffer:t=0}={}){if(e.buffers&&e.buffers.length>t)throw new Error("encodeGLTF: multiple buffers not yet implemented")}var QL={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:b8,extensions:["glb"],mimeTypes:["model/gltf-binary"],binary:!0,options:{gltf:{}},encode:async(e,t={})=>Ibe(e,t),encodeSync:Ibe};function Ibe(e,t={}){let{byteOffset:r=0}=t,n=XL(e,null,r,t),i=new ArrayBuffer(n),a=new DataView(i);return XL(e,a,r,t),i}var L6t={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},q6t={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},ts={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},N6t={magFilter:ts.TEXTURE_MAG_FILTER,minFilter:ts.TEXTURE_MIN_FILTER,wrapS:ts.TEXTURE_WRAP_S,wrapT:ts.TEXTURE_WRAP_T},U6t={[ts.TEXTURE_MAG_FILTER]:ts.LINEAR,[ts.TEXTURE_MIN_FILTER]:ts.NEAREST_MIPMAP_LINEAR,[ts.TEXTURE_WRAP_S]:ts.REPEAT,[ts.TEXTURE_WRAP_T]:ts.REPEAT};function G6t(){return{id:"default-sampler",parameters:U6t}}function z6t(e){return q6t[e]}function H6t(e){return L6t[e]}var ZL=class{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(t,r={}){let{json:n,buffers:i=[],images:a=[]}=t,{baseUri:o=""}=t;return bi(n),this.baseUri=o,this.buffers=i,this.images=a,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((i,a)=>this._resolveBufferView(i,a))),t.images&&(n.images=t.images.map((i,a)=>this._resolveImage(i,a))),t.samplers&&(n.samplers=t.samplers.map((i,a)=>this._resolveSampler(i,a))),t.textures&&(n.textures=t.textures.map((i,a)=>this._resolveTexture(i,a))),t.accessors&&(n.accessors=t.accessors.map((i,a)=>this._resolveAccessor(i,a))),t.materials&&(n.materials=t.materials.map((i,a)=>this._resolveMaterial(i,a))),t.meshes&&(n.meshes=t.meshes.map((i,a)=>this._resolveMesh(i,a))),t.nodes&&(n.nodes=t.nodes.map((i,a)=>this._resolveNode(i,a)),n.nodes=n.nodes.map((i,a)=>this._resolveNodeChildren(i))),t.skins&&(n.skins=t.skins.map((i,a)=>this._resolveSkin(i,a))),t.scenes&&(n.scenes=t.scenes.map((i,a)=>this._resolveScene(i,a))),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((i,a)=>{let o=this.getMesh(a);return i.id=o.id,i.primitives=i.primitives.concat(o.primitives),i},{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(i=>{let a={...i,attributes:{},indices:void 0,material:void 0},o=i.attributes;for(let s in o)a.attributes[s]=this.getAccessor(o[s]);return i.indices!==void 0&&(a.indices=this.getAccessor(i.indices)),i.material!==void 0&&(a.material=this.getMaterial(i.material)),a})),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 i=n.pbrMetallicRoughness;i.baseColorTexture&&(i.baseColorTexture={...i.baseColorTexture},i.baseColorTexture.texture=this.getTexture(i.baseColorTexture.index)),i.metallicRoughnessTexture&&(i.metallicRoughnessTexture={...i.metallicRoughnessTexture},i.metallicRoughnessTexture.texture=this.getTexture(i.metallicRoughnessTexture.index))}return n}_resolveAccessor(t,r){let n=z6t(t.componentType),i=H6t(t.type),a=n*i,o={...t,id:t.id||`accessor-${r}`,bytesPerComponent:n,components:i,bytesPerElement:a,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}=Gg(o,o.bufferView),l=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+s.byteOffset,f=s.arrayBuffer.slice(l,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,i,a){let o=new Uint8Array(a*i);for(let s=0;s<a;s++){let u=r+s*n;o.set(new Uint8Array(t.arrayBuffer.slice(u,u+i)),s*i)}return o.buffer}_resolveTexture(t,r){return{...t,id:t.id||`texture-${r}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):G6t(),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 i in n){let a=this._enumSamplerParameter(i);a!==void 0&&(n.parameters[a]=n[i])}return n}_enumSamplerParameter(t){return N6t[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},i=this.images[r];return i&&(n.image=i),n}_resolveBufferView(t,r){let n=t.buffer,i=this.buffers[n].arrayBuffer,a=this.buffers[n].byteOffset||0;return t.byteOffset&&(a+=t.byteOffset),{id:`bufferView-${r}`,...t,buffer:this.buffers[n],data:new Uint8Array(i,a,t.byteLength)}}_resolveCamera(t,r){let n={...t,id:t.id||`camera-${r}`};return n.perspective,n.orthographic,n}};function my(e,t){return new ZL().postProcess(e,t)}var O8={URI:0,EMBEDDED:1};function I8(e,t,r,n){e.rotateYtoZ=!0;let i=(e.byteOffset||0)+(e.byteLength||0)-r;if(i===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=md(t,r,i),e.gltfByteOffset=0,e.gltfByteLength=i,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 R8(e,t,r,n){let i=(r==null?void 0:r["3d-tiles"])||{};if(W6t(e,t,r),i.loadGLTF){if(!n)return;if(e.gltfUrl){let{fetch:a}=n,o=await a(e.gltfUrl,r);e.gltfArrayBuffer=await o.arrayBuffer(),e.gltfByteOffset=0}if(e.gltfArrayBuffer){let a=await ho(e.gltfArrayBuffer,ml,r,n);e.gltf=my(a),e.gpuMemoryUsageInBytes=oy(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function W6t(e,t,r){switch(t){case O8.URI:if(e.gltfArrayBuffer){let n=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),a=new TextDecoder().decode(n);e.gltfUrl=a.replace(/[\s\0]+$/,"")}delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case O8.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function Rbe(e,t,r,n,i){var o;r=V6t(e,t,r,n,i),await R8(e,O8.EMBEDDED,n,i);let a=(o=e==null?void 0:e.gltf)==null?void 0:o.extensions;return a&&a.CESIUM_RTC&&(e.rtcCenter=a.CESIUM_RTC.center),r}function V6t(e,t,r,n,i){r=lp(e,t,r),r=Mg(e,t,r),r=Lg(e,t,r,n),r=I8(e,t,r,n);let a=new dl(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=a.getGlobalProperty("RTC_CENTER",Tt.FLOAT,3),r}var gl=6356752314245179e-9,$6t={radii:[6378137,6378137,gl],radiiSquared:[6378137*6378137,6378137*6378137,gl*gl],oneOverRadii:[1/6378137,1/6378137,1/gl],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(gl*gl)],maximumRadius:Math.max(6378137,6378137,gl),centerToleranceSquared:.1};function j8(e){return e}var qpr=new _e;function K6t(e,t=[],r=j8){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 jbe(e,t=[]){return K6t(e,t,yn._cartographicRadians?j8:PM)}function J6t(e,t,r=j8){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 Mbe(e,t){return J6t(e,t,yn._cartographicRadians?j8:OM)}var Lbe=1e-14,Y6t=new _e,qbe={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"}},e7={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},gy={east:new _e,north:new _e,up:new _e,west:new _e,south:new _e,down:new _e},X6t=new _e,Q6t=new _e,Z6t=new _e;function t7(e,t,r,n,i,a){let o=qbe[t]&&qbe[t][r];Ri(o&&(!n||n===o));let s,u,c,l=Y6t.copy(i);if(_o(l.x,0,Lbe)&&_o(l.y,0,Lbe)){let p=Math.sign(l.z);s=X6t.fromArray(e7[t]),t!=="east"&&t!=="west"&&s.scale(p),u=Q6t.fromArray(e7[r]),r!=="east"&&r!=="west"&&u.scale(p),c=Z6t.fromArray(e7[n]),n!=="east"&&n!=="west"&&c.scale(p)}else{let{up:p,east:d,north:h}=gy;d.set(-l.y,l.x,0).normalize(),e.geodeticSurfaceNormal(l,p),h.copy(p).cross(d);let{down:v,west:m,south:b}=gy;v.copy(p).scale(-1),m.copy(d).scale(-1),b.copy(h).scale(-1),s=gy[t],u=gy[r],c=gy[n]}return a[0]=s.x,a[1]=s.y,a[2]=s.z,a[3]=0,a[4]=u.x,a[5]=u.y,a[6]=u.z,a[7]=0,a[8]=c.x,a[9]=c.y,a[10]=c.z,a[11]=0,a[12]=l.x,a[13]=l.y,a[14]=l.z,a[15]=1,a}var Xg=new _e,eTt=new _e,tTt=new _e;function Nbe(e,t,r=[]){let{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:a}=t;Xg.from(e);let o=Xg.x,s=Xg.y,u=Xg.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,v=p+d+h,m=Math.sqrt(1/v);if(!Number.isFinite(m))return;let b=eTt;if(b.copy(e).scale(m),v<a)return b.to(r);let _=i.x,E=i.y,T=i.z,S=tTt;S.set(b.x*_*2,b.y*E*2,b.z*T*2);let D=(1-m)*Xg.len()/(.5*S.len()),I=0,L,F,P,M;do{D-=I,L=1/(1+D*_),F=1/(1+D*E),P=1/(1+D*T);let U=L*L,W=F*F,V=P*P,Z=U*L,ee=W*F,ge=V*P;M=p*U+d*W+h*V-1;let he=-2*(p*Z*_+d*ee*E+h*ge*T);I=M/he}while(Math.abs(M)>ic.EPSILON12);return Xg.scale([L,F,P]).to(r)}var M8=new _e,Ube=new _e,iTt=new _e,Vs=new _e,aTt=new _e,L8=new _e,vl=class{constructor(t=0,r=0,n=0){this.centerToleranceSquared=ic.EPSILON1,Ri(t>=0),Ri(r>=0),Ri(n>=0),this.radii=new _e(t,r,n),this.radiiSquared=new _e(t*t,r*r,n*n),this.radiiToTheFourth=new _e(t*t*t*t,r*r*r*r,n*n*n*n),this.oneOverRadii=new _e(t===0?0:1/t,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new _e(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=Ube,i=iTt,[,,a]=t;this.geodeticSurfaceNormalCartographic(t,n),i.copy(this.radiiSquared).scale(n);let o=Math.sqrt(n.dot(i));return i.scale(1/o),n.scale(a),i.add(n),i.to(r)}cartesianToCartographic(t,r=[0,0,0]){L8.from(t);let n=this.scaleToGeodeticSurface(L8,Vs);if(!n)return;let i=this.geodeticSurfaceNormal(n,Ube),a=aTt;a.copy(L8).subtract(n);let o=Math.atan2(i.y,i.x),s=Math.asin(i.z),u=Math.sign(Pg.dot(a,L8))*Pg.length(a);return Mbe([o,s,u],r)}eastNorthUpToFixedFrame(t,r=new Qo){return t7(this,"east","north","up",t,r)}localFrameToFixedFrame(t,r,n,i,a=new Qo){return t7(this,t,r,n,i,a)}geocentricSurfaceNormal(t,r=[0,0,0]){return M8.from(t).normalize().to(r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=jbe(t),i=n[0],a=n[1],o=Math.cos(a);return M8.set(o*Math.cos(i),o*Math.sin(i),Math.sin(a)).normalize(),M8.to(r)}geodeticSurfaceNormal(t,r=[0,0,0]){return M8.from(t).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(t,r){return Nbe(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){Vs.from(t);let n=Vs.x,i=Vs.y,a=Vs.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(n*n*o.x+i*i*o.y+a*a*o.z);return Vs.multiplyScalar(s).to(r)}transformPositionToScaledSpace(t,r=[0,0,0]){return Vs.from(t).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(t,r=[0,0,0]){return Vs.from(t).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){Ri(_o(this.radii.x,this.radii.y,ic.EPSILON15)),Ri(this.radii.z>0),Vs.from(t);let i=Vs.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(i)>=this.radii.z-r))return Vs.set(0,0,i).to(n)}};vl.WGS84=new vl(6378137,6378137,gl);async function Gbe(e,t,r,n,i){return r=oTt(e,t,r,n,i),await R8(e,e.gltfFormat||0,n,i),r}function oTt(e,t,r,n,i){var c;if(r=lp(e,t,r),e.version!==1)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);r=Mg(e,t,r);let a=new DataView(t);if(e.gltfFormat=a.getUint32(r,!0),r+=4,r=Lg(e,t,r,n),r=I8(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 dl(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",Tt.FLOAT,3);let u=new Zd(e.batchTableJson,e.batchTableBinary,s);return sTt(e,o,u,s),r}function sTt(e,t,r,n){let i=new Array(n),a=new _e,o=new _e,s=new _e,u=new _e,c=new pn,l=new cp,f=new _e,p={},d=new Qo,h=[],v=[],m=[],b=[];for(let _=0;_<n;_++){let E;if(t.hasProperty("POSITION"))E=t.getProperty("POSITION",Tt.FLOAT,3,_,a);else if(t.hasProperty("POSITION_QUANTIZED")){E=t.getProperty("POSITION_QUANTIZED",Tt.UNSIGNED_SHORT,3,_,a);let P=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Tt.FLOAT,3);if(!P)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let M=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Tt.FLOAT,3);if(!M)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let U=65535;for(let W=0;W<3;W++)E[W]=E[W]/U*M[W]+P[W]}if(!E)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");a.copy(E),p.translation=a,e.normalUp=t.getProperty("NORMAL_UP",Tt.FLOAT,3,_,h),e.normalRight=t.getProperty("NORMAL_RIGHT",Tt.FLOAT,3,_,v);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",Tt.UNSIGNED_SHORT,2,_,h),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",Tt.UNSIGNED_SHORT,2,_,v),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?(vl.WGS84.eastNorthUpToFixedFrame(a,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 S=t.getProperty("SCALE",Tt.FLOAT,1,_,m);Number.isFinite(S)&&f.multiplyByScalar(S);let D=t.getProperty("SCALE_NON_UNIFORM",Tt.FLOAT,3,_,h);D&&f.scale(D),p.scale=f;let I=t.getProperty("BATCH_ID",Tt.UNSIGNED_SHORT,1,_,b);I===void 0&&(I=_);let L=new Qo().fromQuaternion(p.rotation);d.identity(),d.translate(p.translation),d.multiplyRight(L),d.scale(p.scale);let F=d.clone();i[_]={modelMatrix:F,batchId:I}}e.instances=i}async function zbe(e,t,r,n,i,a){r=lp(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 a(t,r,n,i,s)}return r}async function Hbe(e,t,r,n){var i,a;if(e.rotateYtoZ=!0,e.gltfUpAxis=(i=r==null?void 0:r["3d-tiles"])!=null&&i.assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",(a=r==null?void 0:r["3d-tiles"])!=null&&a.loadGLTF){if(!n)return t.byteLength;let o=await ho(t,ml,r,n);e.gltf=my(o),e.gpuMemoryUsageInBytes=oy(e.gltf)}else e.gltfArrayBuffer=t;return t.byteLength}async function r7(e,t=0,r,n,i={shape:"tile3d"}){switch(i.byteOffset=t,i.type=nve(e,t),i.type){case Xo.COMPOSITE:return await zbe(i,e,t,r,n,r7);case Xo.BATCHED_3D_MODEL:return await Rbe(i,e,t,r,n);case Xo.GLTF:return await Hbe(i,e,r,n);case Xo.INSTANCED_3D_MODEL:return await Gbe(i,e,t,r,n);case Xo.POINT_CLOUD:return await Exe(i,e,t,r,n);default:throw new Error(`3DTileLoader: unknown type ${i.type}`)}}async function n7(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 a=Wbe(e.slice(8,16)),o=new Uint8Array(e,24,a),u=new TextDecoder("utf8").decode(o),c=JSON.parse(u),l=Wbe(e.slice(16,24)),f=new ArrayBuffer(0);if(l&&(f=e.slice(24+a)),await q8(c,c.tileAvailability,f,r),Array.isArray(c.contentAvailability))for(let p of c.contentAvailability)await q8(c,p,f,r);else await q8(c,c.contentAvailability,f,r);return await q8(c,c.childSubtreeAvailability,f,r),c}async function q8(e,t,r,n){let i=Number.isFinite(t.bitstream)?t.bitstream:t.bufferView;if(typeof i!="number")return;let a=e.bufferViews[i],o=e.buffers[a.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,a.byteOffset,a.byteLength);return}let s=e.buffers.slice(0,a.buffer).reduce((u,c)=>u+c.byteLength,0);t.explicitBitstream=new Uint8Array(r.slice(s,s+o.byteLength),a.byteOffset,a.byteLength)}function Wbe(e){let t=new DataView(e),r=t.getUint32(0,!0),n=t.getUint32(4,!0);return r+2**32*n}var N8={dataType:null,batchType:null,id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Cg,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:n7,options:{}};function i7(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function $s(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||i7()}var uTt=globalThis.self||globalThis.window||globalThis.global,Qg=globalThis.window||globalThis.self||globalThis.global,cTt=globalThis.document||{},nh=globalThis.process||{},lTt=globalThis.console,Bdr=globalThis.navigator||{};var U8="4.2.0-beta.2",Idr=$s();function fTt(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var G8=class{constructor(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=fTt(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 Vbe(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function $be(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}function z8(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));let a=e.width*r,o=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}var H8;(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"})(H8||(H8={}));var pTt=10;function Kbe(e){return typeof e!="string"?e:(e=e.toUpperCase(),H8[e]||H8.WHITE)}function Jbe(e,t,r){if(!$s&&typeof e=="string"){if(t){let n=Kbe(t);e="\x1B[".concat(n,"m").concat(e,"\x1B[39m")}if(r){let n=Kbe(r);e="\x1B[".concat(n+pTt,"m").concat(e,"\x1B[49m")}}return e}function Ybe(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let a of n){let o=i[a];typeof o=="function"&&(t.find(s=>a===s)||(i[a]=o.bind(e)))}}function Zg(e,t){if(!e)throw new Error(t||"Assertion failed")}function ih(){let e;if($s()&&Qg.performance){var t,r;e=Qg===null||Qg===void 0||(t=Qg.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in nh){var n;let i=nh===null||nh===void 0||(n=nh.hrtime)===null||n===void 0?void 0:n.call(nh);e=i[0]*1e3+i[1]/1e6}else e=Date.now();return e}var e1={debug:$s()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},dTt={enabled:!0,level:0};function rs(){}var Xbe={},Qbe={once:!0},vy=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=U8,this._startTs=ih(),this._deltaTs=ih(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new G8("__probe-".concat(this.id,"__"),dTt),this.timeStamp("".concat(this.id," started")),Ybe(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((ih()-this._startTs).toPrecision(10))}getDelta(){return Number((ih()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){Zg(t,r)}warn(t){return this._getLogFunction(0,t,e1.warn,arguments,Qbe)}error(t){return this._getLogFunction(0,t,e1.error,arguments)}deprecated(t,r){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(t,r){return this.error("`".concat(t,"` has been removed. Use `").concat(r,"` instead"))}probe(t,r){return this._getLogFunction(t,r,e1.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,e1.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,e1.debug||e1.info,arguments,Qbe)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||rs,n&&[n],{tag:vTt(r)}):rs}image(t){let{logLevel:r,priority:n,image:i,message:a="",scale:o=1}=t;return this._shouldLog(r||n)?$s()?gTt({image:i,message:a,scale:o}):mTt({image:i,message:a,scale:o}):rs}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||rs)}group(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},i=Zbe({logLevel:t,message:r,opts:n}),{collapsed:a}=n;return i.method=(a?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||rs)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=eye(t)}_getLogFunction(t,r,n,i,a){if(this._shouldLog(t)){a=Zbe({logLevel:t,message:r,args:i,opts:a}),n=n||a.method,Zg(n),a.total=this.getTotal(),a.delta=this.getDelta(),this._deltaTs=ih();let o=a.tag||a.message;if(a.once&&o)if(!Xbe[o])Xbe[o]=ih();else return rs;return r=hTt(this.id,a.message,a),n.bind(console,r,...a.args)}return rs}};vy.VERSION=U8;function eye(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 Zg(Number.isFinite(t)&&t>=0),t}function Zbe(e){let{logLevel:t,message:r}=e;e.logLevel=eye(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 i=typeof e.message;return Zg(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}function hTt(e,t,r){if(typeof t=="string"){let n=r.time?$be(Vbe(r.total)):"";t=r.time?"".concat(e,": ").concat(n," ").concat(t):"".concat(e,": ").concat(t),t=Jbe(t,r.color,r.background)}return t}function mTt(e){let{image:t,message:r="",scale:n=1}=e;return console.warn("removed"),rs}function gTt(e){let{image:t,message:r="",scale:n=1}=e;if(typeof t=="string"){let a=new Image;return a.onload=()=>{let o=z8(a,r,n);console.log(...o)},a.src=t,rs}let i=t.nodeName||"";if(i.toLowerCase()==="img")return console.log(...z8(t,r,n)),rs;if(i.toLowerCase()==="canvas"){let a=new Image;return a.onload=()=>console.log(...z8(a,r,n)),a.src=t.toDataURL(),rs}return rs}function vTt(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var a7=new vy({id:"@probe.gl/log"});var ns=null;try{ns=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 sn(e,t,r){this.low=e|0,this.high=t|0,this.unsigned=!!r}sn.prototype.__isLong__;Object.defineProperty(sn.prototype,"__isLong__",{value:!0});function _a(e){return(e&&e.__isLong__)===!0}function tye(e){var t=Math.clz32(e&-e);return e?31-t:t}sn.isLong=_a;var rye={},nye={};function ah(e,t){var r,n,i;return t?(e>>>=0,(i=0<=e&&e<256)&&(n=nye[e],n)?n:(r=Cr(e,0,!0),i&&(nye[e]=r),r)):(e|=0,(i=-128<=e&&e<128)&&(n=rye[e],n)?n:(r=Cr(e,e<0?-1:0,!1),i&&(rye[e]=r),r))}sn.fromInt=ah;function is(e,t){if(isNaN(e))return t?xl:Ks;if(t){if(e<0)return xl;if(e>=sye)return lye}else{if(e<=-aye)return to;if(e+1>=aye)return cye}return e<0?is(-e,t).neg():Cr(e%r1|0,e/r1|0,t)}sn.fromNumber=is;function Cr(e,t,r){return new sn(e,t,r)}sn.fromBits=Cr;var W8=Math.pow;function s7(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?xl:Ks;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 s7(e.substring(1),t,r).neg();for(var i=is(W8(r,8)),a=Ks,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=is(W8(r,s));a=a.mul(c).add(is(u))}else a=a.mul(i),a=a.add(is(u))}return a.unsigned=t,a}sn.fromString=s7;function Js(e,t){return typeof e=="number"?is(e,t):typeof e=="string"?s7(e,t):Cr(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}sn.fromValue=Js;var iye=1<<16,xTt=1<<24,r1=iye*iye,sye=r1*r1,aye=sye/2,oye=ah(xTt),Ks=ah(0);sn.ZERO=Ks;var xl=ah(0,!0);sn.UZERO=xl;var t1=ah(1);sn.ONE=t1;var uye=ah(1,!0);sn.UONE=uye;var o7=ah(-1);sn.NEG_ONE=o7;var cye=Cr(-1,2147483647,!1);sn.MAX_VALUE=cye;var lye=Cr(-1,-1,!0);sn.MAX_UNSIGNED_VALUE=lye;var to=Cr(0,-2147483648,!1);sn.MIN_VALUE=to;var Re=sn.prototype;Re.toInt=function(){return this.unsigned?this.low>>>0:this.low};Re.toNumber=function(){return this.unsigned?(this.high>>>0)*r1+(this.low>>>0):this.high*r1+(this.low>>>0)};Re.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(to)){var r=is(t),n=this.div(r),i=n.mul(r).sub(this);return n.toString(t)+i.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var a=is(W8(t,6),this.unsigned),o=this,s="";;){var u=o.div(a),c=o.sub(u.mul(a)).toInt()>>>0,l=c.toString(t);if(o=u,o.isZero())return l+s;for(;l.length<6;)l="0"+l;s=""+l+s}};Re.getHighBits=function(){return this.high};Re.getHighBitsUnsigned=function(){return this.high>>>0};Re.getLowBits=function(){return this.low};Re.getLowBitsUnsigned=function(){return this.low>>>0};Re.getNumBitsAbs=function(){if(this.isNegative())return this.eq(to)?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};Re.isZero=function(){return this.high===0&&this.low===0};Re.eqz=Re.isZero;Re.isNegative=function(){return!this.unsigned&&this.high<0};Re.isPositive=function(){return this.unsigned||this.high>=0};Re.isOdd=function(){return(this.low&1)===1};Re.isEven=function(){return(this.low&1)===0};Re.equals=function(t){return _a(t)||(t=Js(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};Re.eq=Re.equals;Re.notEquals=function(t){return!this.eq(t)};Re.neq=Re.notEquals;Re.ne=Re.notEquals;Re.lessThan=function(t){return this.comp(t)<0};Re.lt=Re.lessThan;Re.lessThanOrEqual=function(t){return this.comp(t)<=0};Re.lte=Re.lessThanOrEqual;Re.le=Re.lessThanOrEqual;Re.greaterThan=function(t){return this.comp(t)>0};Re.gt=Re.greaterThan;Re.greaterThanOrEqual=function(t){return this.comp(t)>=0};Re.gte=Re.greaterThanOrEqual;Re.ge=Re.greaterThanOrEqual;Re.compare=function(t){if(_a(t)||(t=Js(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};Re.comp=Re.compare;Re.negate=function(){return!this.unsigned&&this.eq(to)?to:this.not().add(t1)};Re.neg=Re.negate;Re.add=function(t){_a(t)||(t=Js(t));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,a=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+=a+c,p+=d>>>16,d&=65535,p+=i+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)};Re.subtract=function(t){return _a(t)||(t=Js(t)),this.add(t.neg())};Re.sub=Re.subtract;Re.multiply=function(t){if(this.isZero())return this;if(_a(t)||(t=Js(t)),ns){var r=ns.mul(this.low,this.high,t.low,t.high);return Cr(r,ns.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?xl:Ks;if(this.eq(to))return t.isOdd()?to:Ks;if(t.eq(to))return this.isOdd()?to:Ks;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(oye)&&t.lt(oye))return is(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,a=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+=a*l,p+=d>>>16,d&=65535,d+=o*c,p+=d>>>16,d&=65535,p+=i*l,f+=p>>>16,p&=65535,p+=a*c,f+=p>>>16,p&=65535,p+=o*u,f+=p>>>16,p&=65535,f+=n*l+i*c+a*u+o*s,f&=65535,Cr(d<<16|h,f<<16|p,this.unsigned)};Re.mul=Re.multiply;Re.divide=function(t){if(_a(t)||(t=Js(t)),t.isZero())throw Error("division by zero");if(ns){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?ns.div_u:ns.div_s)(this.low,this.high,t.low,t.high);return Cr(r,ns.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?xl:Ks;var n,i,a;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return xl;if(t.gt(this.shru(1)))return uye;a=xl}else{if(this.eq(to)){if(t.eq(t1)||t.eq(o7))return to;if(t.eq(to))return t1;var o=this.shr(1);return n=o.div(t).shl(1),n.eq(Ks)?t.isNegative()?t1:o7:(i=this.sub(t.mul(n)),a=n.add(i.div(t)),a)}else if(t.eq(to))return this.unsigned?xl:Ks;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();a=Ks}for(i=this;i.gte(t);){n=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var s=Math.ceil(Math.log(n)/Math.LN2),u=s<=48?1:W8(2,s-48),c=is(n),l=c.mul(t);l.isNegative()||l.gt(i);)n-=u,c=is(n,this.unsigned),l=c.mul(t);c.isZero()&&(c=t1),a=a.add(c),i=i.sub(l)}return a};Re.div=Re.divide;Re.modulo=function(t){if(_a(t)||(t=Js(t)),ns){var r=(this.unsigned?ns.rem_u:ns.rem_s)(this.low,this.high,t.low,t.high);return Cr(r,ns.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};Re.mod=Re.modulo;Re.rem=Re.modulo;Re.not=function(){return Cr(~this.low,~this.high,this.unsigned)};Re.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};Re.clz=Re.countLeadingZeros;Re.countTrailingZeros=function(){return this.low?tye(this.low):tye(this.high)+32};Re.ctz=Re.countTrailingZeros;Re.and=function(t){return _a(t)||(t=Js(t)),Cr(this.low&t.low,this.high&t.high,this.unsigned)};Re.or=function(t){return _a(t)||(t=Js(t)),Cr(this.low|t.low,this.high|t.high,this.unsigned)};Re.xor=function(t){return _a(t)||(t=Js(t)),Cr(this.low^t.low,this.high^t.high,this.unsigned)};Re.shiftLeft=function(t){return _a(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)};Re.shl=Re.shiftLeft;Re.shiftRight=function(t){return _a(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)};Re.shr=Re.shiftRight;Re.shiftRightUnsigned=function(t){return _a(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)};Re.shru=Re.shiftRightUnsigned;Re.shr_u=Re.shiftRightUnsigned;Re.rotateLeft=function(t){var r;return _a(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))};Re.rotl=Re.rotateLeft;Re.rotateRight=function(t){var r;return _a(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))};Re.rotr=Re.rotateRight;Re.toSigned=function(){return this.unsigned?Cr(this.low,this.high,!1):this};Re.toUnsigned=function(){return this.unsigned?this:Cr(this.low,this.high,!0)};Re.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};Re.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]};Re.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]};sn.fromBytes=function(t,r,n){return n?sn.fromBytesLE(t,r):sn.fromBytesBE(t,r)};sn.fromBytesLE=function(t,r){return new sn(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)};sn.fromBytesBE=function(t,r){return new sn(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)};var n1=sn;var bTt=16;function xy(e){e==="X"&&(e="");let t=e.padEnd(bTt,"0");return n1.fromString(t,!0,16)}function u7(e){if(e.isZero())return"X";let t=e.countTrailingZeros(),r=t%4;t=(t-r)/4;let n=t;t*=4;let a=e.shiftRightUnsigned(t).toString(16).replace(/0+$/,"");return Array(17-n-a.length).join("0")+a}function c7(e,t){let r=yTt(e).shiftRightUnsigned(2);return e.add(n1.fromNumber(2*t+1-4).multiply(r))}function yTt(e){return e.and(e.not().add(1))}var _Tt=3,wTt=30,ETt=2*wTt+1,fye=180/Math.PI;function dye(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],i=n.length,a=0,o=[0,0];for(let s=i-1;s>=0;s--){a=i-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,a-1);ATt(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:a}}function hye(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<_Tt+ETt;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),i=t.substring(3,r),a=i.length/2,o=n1.fromString(n,!0,2).toString(10),s="";if(a!==0)for(s=n1.fromString(i,!0,2).toString(4);s.length<a;)s="0"+s;return`${o}/${s}`}function l7(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function pye(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function f7(e){return[pye(e[0]),pye(e[1])]}function p7(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 d7([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*fye,n*fye]}function ATt(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let i=t[0];t[0]=t[1],t[1]=i}}function mye(e){let t=l7(e.ij,e.level,[.5,.5]),r=f7(t),n=p7(e.face,r);return d7(n)}var STt=100;function h7(e){let{face:t,ij:r,level:n}=e,i=[[0,0],[0,1],[1,1],[1,0],[0,0]],a=Math.max(1,Math.ceil(STt*Math.pow(2,-n))),o=new Float64Array(4*a*2+2),s=0,u=0;for(let c=0;c<4;c++){let l=i[c].slice(0),f=i[c+1],p=(f[0]-l[0])/a,d=(f[1]-l[1])/a;for(let h=0;h<a;h++){l[0]+=p,l[1]+=d;let v=l7(r,n,l),m=f7(v),b=p7(t,m),_=d7(b);Math.abs(_[1])>89.999&&(_[0]=u);let E=_[0]-u;_[0]+=E>180?-360:E<-180?360:0,o[s++]=_[0],o[s++]=_[1],u=_[0]}}return o[s++]=o[0],o[s++]=o[1],o}function i1(e){let t=TTt(e);return dye(t)}function TTt(e){if(e.indexOf("/")>0)return e;let t=xy(e);return hye(t)}function m7(e){let t=i1(e);return mye(t)}function vye(e){let t;if(e.face===2||e.face===5){let r=null,n=0;for(let i=0;i<4;i++){let a=`${e.face}/${i}`,o=i1(a),s=h7(o);(typeof r>"u"||r===null)&&(r=new Float64Array(4*s.length)),r.set(s,n),n+=s.length}t=gye(r)}else{let r=h7(e);t=gye(r)}return t}function gye(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,i)=>n-i),r.sort((n,i)=>n-i),{west:t[0],east:t[t.length-1],north:r[r.length-1],south:r[0]}}function g7(e,t){let r=(t==null?void 0:t.minimumHeight)||0,n=(t==null?void 0:t.maximumHeight)||0,i=i1(e),a=vye(i),o=a.west,s=a.south,u=a.east,c=a.north,l=[];return l.push(new _e(o,c,r)),l.push(new _e(u,c,r)),l.push(new _e(u,s,r)),l.push(new _e(o,s,r)),l.push(new _e(o,c,n)),l.push(new _e(u,c,n)),l.push(new _e(u,s,n)),l.push(new _e(o,s,n)),l}var ji={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var Ihr=new _e,Rhr=new _e;var by=new _e,xye=new _e,pp=class{constructor(t=[0,0,0],r=0){this.radius=-0,this.center=new _e,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=by.from(r),this.center=new _e().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 pp(this.center,this.radius)}union(t){let r=this.center,n=this.radius,i=t.center,a=t.radius,o=by.copy(i).subtract(r),s=o.magnitude();if(n>=s+a)return this.clone();if(a>=s+n)return t.clone();let u=(n+s+a)*.5;return xye.copy(o).scale((-n+u)/s).add(r),this.center.copy(xye),this.radius=u,this}expand(t){let n=by.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=i8.getScaling(by,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=by.from(t).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(t){let r=this.center,n=this.radius,a=t.normal.dot(r)+t.distance;return a<-n?ji.OUTSIDE:a<n?ji.INTERSECTING:ji.INSIDE}};var CTt=new _e,DTt=new _e,V8=new _e,$8=new _e,K8=new _e,kTt=new _e,FTt=new _e,bl={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},oh=class{constructor(t=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){this.center=new _e().from(t),this.halfAxes=new pn(r)}get halfSize(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new _e(t).len(),new _e(r).len(),new _e(n).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),i=new _e(t).normalize(),a=new _e(r).normalize(),o=new _e(n).normalize();return new cp().fromMatrix3(new pn([...i,...a,...o]))}fromCenterHalfSizeQuaternion(t,r,n){let i=new cp(n),a=new pn().fromQuaternion(i);return a[0]=a[0]*r[0],a[1]=a[1]*r[0],a[2]=a[2]*r[0],a[3]=a[3]*r[1],a[4]=a[4]*r[1],a[5]=a[5]*r[1],a[6]=a[6]*r[2],a[7]=a[7]*r[2],a[8]=a[8]*r[2],this.center=new _e().from(t),this.halfAxes=a,this}clone(){return new oh(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new pp){let r=this.halfAxes,n=r.getColumn(0,V8),i=r.getColumn(1,$8),a=r.getColumn(2,K8),o=CTt.copy(n).add(i).add(a);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let r=this.center,n=t.normal,i=this.halfAxes,a=n.x,o=n.y,s=n.z,u=Math.abs(a*i[bl.COLUMN0ROW0]+o*i[bl.COLUMN0ROW1]+s*i[bl.COLUMN0ROW2])+Math.abs(a*i[bl.COLUMN1ROW0]+o*i[bl.COLUMN1ROW1]+s*i[bl.COLUMN1ROW2])+Math.abs(a*i[bl.COLUMN2ROW0]+o*i[bl.COLUMN2ROW1]+s*i[bl.COLUMN2ROW2]),c=n.dot(r)+t.distance;return c<=-u?ji.OUTSIDE:c>=u?ji.INSIDE:ji.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=DTt.from(t).subtract(this.center),n=this.halfAxes,i=n.getColumn(0,V8),a=n.getColumn(1,$8),o=n.getColumn(2,K8),s=i.magnitude(),u=a.magnitude(),c=o.magnitude();i.normalize(),a.normalize(),o.normalize();let l=0,f;return f=Math.abs(r.dot(i))-s,f>0&&(l+=f*f),f=Math.abs(r.dot(a))-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 i=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=this.center,s=this.halfAxes,u=s.getColumn(0,V8),c=s.getColumn(1,$8),l=s.getColumn(2,K8),f=kTt.copy(u).add(c).add(l).add(o),p=FTt.copy(f).subtract(t),d=r.dot(p);return i=Math.min(d,i),a=Math.max(d,a),f.copy(o).add(u).add(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),f.copy(o).add(u).subtract(c).add(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),f.copy(o).add(u).subtract(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),o.copy(f).subtract(u).add(c).add(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),o.copy(f).subtract(u).add(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),o.copy(f).subtract(u).subtract(c).add(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),o.copy(f).subtract(u).subtract(c).subtract(l),p.copy(f).subtract(t),d=r.dot(p),i=Math.min(d,i),a=Math.max(d,a),n[0]=i,n[1]=a,n}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,V8);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,$8);n.transformAsPoint(t);let i=this.halfAxes.getColumn(2,K8);return i.transformAsPoint(t),this.halfAxes=new pn([...r,...n,...i]),this}getTransform(){throw new Error("not implemented")}};var bye=new _e,yye=new _e,yl=class{constructor(t=[0,0,1],r=0){this.normal=new _e,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return Ri(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=bye.from(t),this.normal.from(r).normalize();let n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,r,n,i){return this.normal.set(t,r,n),Ri(_o(this.normal.len(),1)),this.distance=i,this}clone(){return new yl(this.normal,this.distance)}equals(t){return _o(this.distance,t.distance)&&_o(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=yye.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=bye.from(t),i=this.getPointDistance(n),a=yye.copy(this.normal).scale(i);return n.subtract(a).to(r)}};var _ye=[new _e([1,0,0]),new _e([0,1,0]),new _e([0,0,1])],wye=new _e,BTt=new _e,as=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*_ye.length;let r=t.center,n=t.radius,i=0;for(let a of _ye){let o=this.planes[i],s=this.planes[i+1];o||(o=this.planes[i]=new yl),s||(s=this.planes[i+1]=new yl);let u=wye.copy(a).scale(-n).add(r);o.fromPointNormal(u,a);let c=wye.copy(a).scale(n).add(r),l=BTt.copy(a).negate();s.fromPointNormal(c,l),i+=2}return this}computeVisibility(t){let r=ji.INSIDE;for(let n of this.planes)switch(t.intersectPlane(n)){case ji.OUTSIDE:return ji.OUTSIDE;case ji.INTERSECTING:r=ji.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(Ri(Number.isFinite(r),"parentPlaneMask is required."),r===as.MASK_OUTSIDE||r===as.MASK_INSIDE)return r;let n=as.MASK_INSIDE,i=this.planes;for(let a=0;a<this.planes.length;++a){let o=a<31?1<<a:0;if(a<31&&!(r&o))continue;let s=i[a],u=t.intersectPlane(s);if(u===ji.OUTSIDE)return as.MASK_OUTSIDE;u===ji.INTERSECTING&&(n|=o)}return n}};as.MASK_OUTSIDE=4294967295;as.MASK_INSIDE=0;as.MASK_INDETERMINATE=2147483647;var Zhr=new _e,e0r=new _e,t0r=new _e,r0r=new _e,n0r=new _e;var c0r=new _e,l0r=new _e,f0r=new _e,p0r=new _e,d0r=new _e,h0r=new _e,m0r=new _e,g0r=new _e,v0r=new _e,x0r=new _e,b0r=new _e,y0r=new _e;var cc=new pn,OTt=new pn,ITt=new pn,J8=new pn,Eye=new pn;function b7(e,t={}){let r=ic.EPSILON20,n=10,i=0,a=0,o=OTt,s=ITt;o.identity(),s.copy(e);let u=r*RTt(s);for(;a<n&&jTt(s)>u;)MTt(s,J8),Eye.copy(J8).transpose(),s.multiplyRight(J8),s.multiplyLeft(Eye),o.multiplyRight(J8),++i>2&&(++a,i=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=s.toTarget(t.diagonal),t}function RTt(e){let t=0;for(let r=0;r<9;++r){let n=e[r];t+=n*n}return Math.sqrt(t)}var v7=[1,0,0],x7=[2,2,1];function jTt(e){let t=0;for(let r=0;r<3;++r){let n=e[cc.getElementIndex(x7[r],v7[r])];t+=2*n*n}return Math.sqrt(t)}function MTt(e,t){let r=ic.EPSILON15,n=0,i=1;for(let c=0;c<3;++c){let l=Math.abs(e[cc.getElementIndex(x7[c],v7[c])]);l>n&&(i=c,n=l)}let a=v7[i],o=x7[i],s=1,u=0;if(Math.abs(e[cc.getElementIndex(o,a)])>r){let c=e[cc.getElementIndex(o,o)],l=e[cc.getElementIndex(a,a)],f=e[cc.getElementIndex(o,a)],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 pn.IDENTITY.to(t),t[cc.getElementIndex(a,a)]=t[cc.getElementIndex(o,o)]=s,t[cc.getElementIndex(o,a)]=u,t[cc.getElementIndex(a,o)]=-u,t}var dp=new _e,qTt=new _e,NTt=new _e,UTt=new _e,GTt=new _e,zTt=new pn,HTt={diagonal:new pn,unitary:new pn};function y7(e,t=new oh){if(!e||e.length===0)return t.halfAxes=new pn([0,0,0,0,0,0,0,0,0]),t.center=new _e,t;let r=e.length,n=new _e(0,0,0);for(let F of e)n.add(F);let i=1/r;n.multiplyByScalar(i);let a=0,o=0,s=0,u=0,c=0,l=0;for(let F of e){let P=dp.copy(F).subtract(n);a+=P.x*P.x,o+=P.x*P.y,s+=P.x*P.z,u+=P.y*P.y,c+=P.y*P.z,l+=P.z*P.z}a*=i,o*=i,s*=i,u*=i,c*=i,l*=i;let f=zTt;f[0]=a,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}=b7(f,HTt),d=t.halfAxes.copy(p),h=d.getColumn(0,NTt),v=d.getColumn(1,UTt),m=d.getColumn(2,GTt),b=-Number.MAX_VALUE,_=-Number.MAX_VALUE,E=-Number.MAX_VALUE,T=Number.MAX_VALUE,S=Number.MAX_VALUE,D=Number.MAX_VALUE;for(let F of e)dp.copy(F),b=Math.max(dp.dot(h),b),_=Math.max(dp.dot(v),_),E=Math.max(dp.dot(m),E),T=Math.min(dp.dot(h),T),S=Math.min(dp.dot(v),S),D=Math.min(dp.dot(m),D);h=h.multiplyByScalar(.5*(T+b)),v=v.multiplyByScalar(.5*(S+_)),m=m.multiplyByScalar(.5*(D+E)),t.center.copy(h).add(v).add(m);let I=qTt.set(b-T,_-S,E-D).multiplyByScalar(.5),L=new pn([I[0],0,0,0,I[1],0,0,0,I[2]]);return t.halfAxes.multiplyRight(L),t}function Y8(e){let t=e.token,r={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},n=g7(t,r),i=m7(t),a=i[0],o=i[1],s=vl.WGS84.cartographicToCartesian([a,o,r.maximumHeight]),u=new _e(s[0],s[1],s[2]);n.push(u);let c=y7(n);return[...c.center,...c.halfAxes]}var WTt=4,VTt=8,$Tt={QUADTREE:WTt,OCTREE:VTt};function KTt(e,t,r){if(e!=null&&e.box){let n=xy(e.s2VolumeInfo.token),i=c7(n,t),a=u7(i),o={...e.s2VolumeInfo};switch(o.token=a,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 w7(e){let{implicitOptions:t,parentData:r={mortonIndex:0,x:0,y:0,z:0},childIndex:n=0,s2VolumeBox:i,loaderOptions:a}=e,{subtree:o,level:s=0,globalData:u={level:0,mortonIndex:0,x:0,y:0,z:0}}=e,{subdivisionScheme:c,subtreeLevels:l,maximumLevel:f,contentUrlTemplate:p,subtreesUriTemplate:d,basePath:h}=t,v={children:[],lodMetricValue:0,contentUrl:""};if(!f)return a7.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${p} won't be loaded...`),v;let m=s+u.level;if(m>f)return v;let b=$Tt[c],_=Math.log2(b),E=n&1,T=n>>1&1,S=n>>2&1,D=(b**s-1)/(b-1),I=sh(r.mortonIndex,n,_),L=D+I,F=sh(r.x,E,1),P=sh(r.y,T,1),M=sh(r.z,S,1),U=!1;s>=l&&(U=_7(o.childSubtreeAvailability,I));let W=sh(u.x,F,s),V=sh(u.y,P,s),Z=sh(u.z,M,s);if(U){let Ae=`${h}/${d}`,Ne=X8(Ae,m,W,V,Z);o=await fn(Ne,N8,a),u={mortonIndex:I,x:F,y:P,z:M,level:s},I=0,L=0,F=0,P=0,M=0,s=0}if(!_7(o.tileAvailability,L))return v;_7(o.contentAvailability,L)&&(v.contentUrl=X8(p,m,W,V,Z));let de=s+1,he={mortonIndex:I,x:F,y:P,z:M};for(let Ae=0;Ae<b;Ae++){let Ne=KTt(i,Ae,c),qe=await w7({subtree:o,implicitOptions:t,loaderOptions:a,parentData:he,childIndex:Ae,level:de,globalData:{...u},s2VolumeBox:Ne});if(qe.contentUrl||qe.children.length){let te=m+1,Q=JTt(qe,te,{childTileX:F,childTileY:P,childTileZ:M},t,i);v.children.push(Q)}}return v}function _7(e,t){let r;return Array.isArray(e)?(r=e[0],e.length>1&&a7.once('Not supported extension "3DTILES_multiple_contents" has been detected')):r=e,"constant"in r?Boolean(r.constant):r.explicitBitstream?QTt(t,r.explicitBitstream):!1}function JTt(e,t,r,n,i){let{basePath:a,refine:o,getRefine:s,lodMetricType:u,getTileType:c,rootLodMetricValue:l,rootBoundingVolume:f}=n,p=e.contentUrl&&e.contentUrl.replace(`${a}/`,""),d=l/2**t,h=i!=null&&i.box?{box:i.box}:f,v=YTt(t,h,r);return{children:e.children,contentUrl:e.contentUrl,content:{uri:p},id:e.contentUrl,refine:s(o),type:c(e),lodMetricType:u,lodMetricValue:d,geometricError:d,transform:e.transform,boundingVolume:v}}function YTt(e,t,r){if(t.region){let{childTileX:n,childTileY:i,childTileZ:a}=r,[o,s,u,c,l,f]=t.region,p=2**e,d=(u-o)/p,h=(c-s)/p,v=(f-l)/p,[m,b]=[o+d*n,o+d*(n+1)],[_,E]=[s+h*i,s+h*(i+1)],[T,S]=[l+v*a,l+v*(a+1)];return{region:[m,_,b,E,T,S]}}if(t.box)return t;throw new Error(`Unsupported bounding volume type ${JSON.stringify(t)}`)}function sh(e,t,r){return(e<<r)+t}function X8(e,t,r,n,i){let a=XTt({level:t,x:r,y:n,z:i});return e.replace(/{level}|{x}|{y}|{z}/gi,o=>a[o])}function XTt(e){let t={};for(let r in e)t[`{${r}}`]=e[r];return t}function QTt(e,t){let r=Math.floor(e/8),n=e%8;return(t[r]>>n&1)===1}function A7(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 S7(e){switch(e){case"REPLACE":case"replace":return 2;case"ADD":case"add":return 1;default:return e}}function E7(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 $a.resolve(t,e)}function Aye(e,t){var i;if(!e)return null;let r;if(e.content){let a=e.content.uri||((i=e.content)==null?void 0:i.url);typeof a<"u"&&(r=E7(a,t))}return{...e,id:r,contentUrl:r,lodMetricType:"geometricError",lodMetricValue:e.geometricError,transformMatrix:e.transform,type:A7(e,r),refine:S7(e.refine)}}async function Cye(e,t,r){let n=null,i=Tye(e.root);i&&e.root?n=await Sye(e.root,e,t,i,r):n=Aye(e.root,t);let a=[];for(a.push(n);a.length>0;){let o=a.pop()||{},s=o.children||[],u=[];for(let c of s){let l=Tye(c),f;l?f=await Sye(c,e,t,l,r):f=Aye(c,t),f&&(u.push(f),a.push(f))}o.children=u}return n}async function Sye(e,t,r,n,i){var T,S,D;let{subdivisionScheme:a,maximumLevel:o,availableLevels:s,subtreeLevels:u,subtrees:{uri:c}}=n,l=X8(c,0,0,0,0),f=E7(l,r),p=await fn(f,N8,i),d=(T=e.content)==null?void 0:T.uri,h=d?E7(d,r):"",v=(S=t==null?void 0:t.root)==null?void 0:S.refine,m=e.geometricError,b=(D=e.boundingVolume.extensions)==null?void 0:D["3DTILES_bounding_volume_S2"];if(b){let L={box:Y8(b),s2VolumeInfo:b};e.boundingVolume=L}let _=e.boundingVolume,E={contentUrlTemplate:h,subtreesUriTemplate:c,subdivisionScheme:a,subtreeLevels:u,maximumLevel:Number.isFinite(s)?s-1:o,refine:v,basePath:r,lodMetricType:"geometricError",rootLodMetricValue:m,rootBoundingVolume:_,getTileType:A7,getRefine:S7};return await ZTt(e,r,p,E,i)}async function ZTt(e,t,r,n,i){if(!e)return null;let{children:a,contentUrl:o}=await w7({subtree:r,implicitOptions:n,loaderOptions:i}),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:A7(e,s),refine:S7(e.refine),content:u||e.content,children:a}}function Tye(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 lc={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Cg,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:e8t,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function e8t(e,t={},r){let n=t["3d-tiles"]||{},i;return n.isTileset==="auto"?i=(r==null?void 0:r.url)&&r.url.indexOf(".json")!==-1:i=n.isTileset,i?t8t(e,t,r):r8t(e,t,r)}async function t8t(e,t,r){var u;let n=JSON.parse(new TextDecoder().decode(e)),i=(r==null?void 0:r.url)||"",a=n8t(i),o=await Cye(n,a,t||{});return{...n,shape:"tileset3d",loader:lc,url:i,queryString:(r==null?void 0:r.queryString)||"",basePath:a,root:o||n.root,type:"TILES3D",lodMetricType:"geometricError",lodMetricValue:((u=n.root)==null?void 0:u.geometricError)||0}}async function r8t(e,t,r){let n={content:{shape:"tile3d",featureIds:null}};return await r7(e,0,t,r,n.content),n.content}function n8t(e){return $a.dirname(e)}var Dye="https://api.cesium.com/v1/assets";async function kye(e,t){if(!t){let a=await i8t(e);for(let o of a.items)o.type==="3DTILES"&&(t=o.id)}let r=await a8t(e,t),{type:n,url:i}=r;return Rt(n==="3DTILES"&&i),r.headers={Authorization:`Bearer ${r.accessToken}`},r}async function i8t(e){Rt(e);let t=Dye,r={Authorization:`Bearer ${e}`},n=await Pa(t,{headers:r});if(!n.ok)throw new Error(n.statusText);return await n.json()}async function a8t(e,t){Rt(e,t);let r={Authorization:`Bearer ${e}`},n=`${Dye}/${t}`,i=await Pa(`${n}`,{headers:r});if(!i.ok)throw new Error(i.statusText);let a=await i.json();if(i=await Pa(`${n}/endpoint`,{headers:r}),!i.ok)throw new Error(i.statusText);let o=await i.json();return a={...a,...o},a}async function o8t(e,t={}){t=t["cesium-ion"]||{};let{accessToken:r}=t,n=t.assetId;if(!Number.isFinite(n)){let i=e.match(/\/([0-9]+)\/tileset.json/);n=i&&i[1]}return kye(r,n)}var Q8={...lc,id:"cesium-ion",name:"Cesium Ion",preload:o8t,parse:async(e,t,r)=>(t={...t},t["3d-tiles"]=t["cesium-ion"],t.loader=Q8,lc.parse(e,t,r)),options:{"cesium-ion":{...lc.options["3d-tiles"],accessToken:null}}};var LEe=Lt(MEe(),1),Tkt="4.2.0-beta.2",dN={dataType:null,batchType:null,id:"zip",module:"zip",name:"Zip Archive",version:Tkt,extensions:["zip"],mimeTypes:["application/zip"],category:"archive",tests:["PK"],options:{},parse:Ckt};async function Ckt(e,t={}){let r=[],n={};try{let i=new LEe.default;return(await i.loadAsync(e,t)).forEach((o,s)=>{let u=s.name,c=Dkt(i,u,t).then(l=>{n[o]=l});r.push(c)}),await Promise.all(r),n}catch(i){throw t.log.error(`Unable to read zip archive: ${i}`),i}}async function Dkt(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}}var wh=async(e,t)=>{let r=[await e.getUint8(e.length-1n),await e.getUint8(e.length-2n),await e.getUint8(e.length-3n),void 0],n=0n;for(let i=e.length-4n;i>-1;i--)if(r[3]=r[2],r[2]=r[1],r[1]=r[0],r[0]=await e.getUint8(i),r.every((a,o)=>a===t[o])){n=i;break}return n};var kkt=new Uint8Array([1,0]);function zC(e){let t={...e,zip64Length:(e.offset?1:0)*8+(e.size?1:0)*16},r=[];for(let n of Fkt){if(!t[n.name??""]&&!n.default)continue;let i=new DataView(new ArrayBuffer(n.size));qEe[n.size](i,0,t[n.name??""]??n.default),r.push(i.buffer)}return qn(...r)}function ea(e,t,r,n){qEe[t](e,Number(r),n)}var qEe={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)}},Fkt=[{size:2,default:new DataView(kkt.buffer).getUint16(0,!0)},{size:2,name:"zip64Length"},{size:8,name:"size"},{size:8,name:"size"},{size:8,name:"offset"}];var NEe=new Uint8Array([80,75,5,6]),UEe=new Uint8Array([80,75,6,7]),GEe=new Uint8Array([80,75,6,6]),zEe=8n,Bkt=10n,Pkt=12n,HEe=16n,Okt=22n,WEe=8n,VEe=24n,Ikt=32n,Rkt=40n,$Ee=48n,jkt=56n,HC=async e=>{let t=await wh(e,NEe),r=BigInt(await e.getUint16(t+zEe)),n=BigInt(await e.getUint32(t+HEe)),i=t-20n,a=0n,o=await e.slice(i,i+4n);if(Mu(o,UEe)){a=await e.getBigUint64(i+WEe);let s=await e.slice(a,a+4n);if(!Mu(s,GEe.buffer))throw new Error("zip64 EoCD not found");r=await e.getBigUint64(a+VEe),n=await e.getBigUint64(a+$Ee)}else i=0n;return{cdRecordsNumber:r,cdStartOffset:n,offsets:{zip64EoCDOffset:a,zip64EoCDLocatorOffset:i,zipEoCDOffset:t}}};function KEe(e,t,r,n,i){let a=new DataView(e),o=t.zip64EoCDOffset?t.zipEoCDOffset-t.zip64EoCDOffset:0n;if(Number(i)<=65535&&(ea(a,2,o+zEe,i),ea(a,2,o+Bkt,i)),n-r<=4294967295&&ea(a,4,o+Pkt,n-r),r<4294967295&&ea(a,4,o+HEe,r),t.zip64EoCDLocatorOffset&&t.zip64EoCDOffset){let s=t.zip64EoCDLocatorOffset-t.zip64EoCDOffset;ea(a,8,s+WEe,n),ea(a,8,$Ee,r),ea(a,8,VEe,i),ea(a,8,Ikt,i),ea(a,8,Rkt,n-r)}return new Uint8Array(a.buffer)}function JEe(e){let t=new DataView(new ArrayBuffer(Number(Okt)));for(let i of Mkt)ea(t,i.size,i.offset,e[i.name??""]??i.default??0);let r=qkt(e),n=Lkt(e);return qn(n,r,t.buffer)}var Mkt=[{offset:0,size:4,default:new DataView(NEe.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 Lkt(e){let t=new DataView(new ArrayBuffer(Number(jkt)));for(let r of Ukt)ea(t,r.size,r.offset,e[r.name??""]??r.default??0);return t.buffer}function qkt(e){let t=new DataView(new ArrayBuffer(Number(20)));for(let r of Nkt)ea(t,r.size,r.offset,e[r.name??""]??r.default??0);return t.buffer}var Nkt=[{offset:0,size:4,default:new DataView(UEe.buffer).getUint32(0,!0)},{offset:4,size:4,default:0},{offset:8,size:8,name:"eoCDStart"},{offset:16,size:4,default:1}],Ukt=[{offset:0,size:4,default:new DataView(GEe.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 Gkt=20n,zkt=24n,Hkt=28n,Wkt=30n,Vkt=32n,$kt=42n,WC=46n,Ah=new Uint8Array([80,75,1,2]),Eh=async(e,t)=>{let r=await t.slice(e,e+4n);if(!Mu(r,Ah.buffer))return null;let n=BigInt(await t.getUint32(e+Gkt)),i=BigInt(await t.getUint32(e+zkt)),a=await t.getUint16(e+Wkt),o=BigInt(await t.getUint16(e+Vkt)),s=await t.getUint16(e+Hkt),u=await t.slice(e+WC,e+WC+BigInt(s)),c=new TextDecoder().decode(u),l=e+WC+BigInt(s),f=await t.getUint32(e+$kt),p=BigInt(f),d=new DataView(await t.slice(l,l+BigInt(a))),h={uncompressedSize:i,compressedSize:n,localHeaderOffset:p,startDisk:o},v=Kkt(h,d);return{...h,...v,extraFieldLength:a,fileNameLength:s,fileName:c,extraOffset:l}};async function*xc(e){let{cdStartOffset:t}=await HC(e),r=await Eh(t,e);for(;r;)yield r,r=await Eh(r.extraOffset+BigInt(r.extraFieldLength),e)}var YEe=(...e)=>e[0]+e[1]*16,Kkt=(e,t)=>{let r=Jkt(e),n={};if(r.length>0){let i=r.reduce((s,u)=>s+u.length,0),a=new Uint8Array(t.buffer).findIndex((s,u,c)=>YEe(c[u],c[u+1])===1&&YEe(c[u+2],c[u+3])===i),o=0;for(let s of r){let u=o;n[s.name]=t.getBigUint64(a+4+u,!0),o=u+s.length}}return n},Jkt=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 hN(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=zC(n),t.extraLength=r.byteLength);let i=new DataView(new ArrayBuffer(Number(WC)));for(let s of Ykt)ea(i,s.size,s.offset,t[s.name??""]??s.default??0);let a=new TextEncoder().encode(t.fileName);return qn(i.buffer,a,r)}var Ykt=[{offset:0,size:4,default:new DataView(Ah.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 Xkt=8n,Qkt=18n,Zkt=22n,eFt=26n,tFt=28n,t2=30n,mN=new Uint8Array([80,75,3,4]),tu=async(e,t)=>{let r=await t.slice(e,e+4n);if(!Mu(r,mN))return null;let n=await t.getUint16(e+eFt),i=new TextDecoder().decode(await t.slice(e+t2,e+t2+BigInt(n))).split("\\").join("/"),a=await t.getUint16(e+tFt),o=e+t2+BigInt(n+a),s=await t.getUint16(e+Xkt),u=BigInt(await t.getUint32(e+Qkt)),c=BigInt(await t.getUint32(e+Zkt)),l=e+t2+BigInt(n),f=4n;return c===BigInt(4294967295)&&(c=await t.getBigUint64(l+f),f+=8n),u===BigInt(4294967295)&&(u=await t.getBigUint64(l+f),f+=8n),o===BigInt(4294967295)&&(o=await t.getBigUint64(l+f)),{fileNameLength:n,fileName:i,extraFieldLength:a,fileDataOffset:o,compressedSize:u,compressionMethod:s}};function gN(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=zC(n),t.extraLength=r.byteLength);let i=new DataView(new ArrayBuffer(Number(t2)));for(let s of rFt)ea(i,s.size,s.offset,t[s.name??""]??s.default??0);let a=new TextEncoder().encode(t.fileName);return qn(i.buffer,a,r)}var rFt=[{offset:0,size:4,default:new DataView(mN.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 nFt(e){let t=await HC(e),r=t.cdStartOffset,n=Number(t.offsets.zip64EoCDOffset?t.offsets.zip64EoCDOffset-r:t.offsets.zipEoCDOffset-r),i=await e.slice(r,e.length);await e.truncate(Number(r));let a=i.slice(0,n),o=i.slice(n,i.byteLength);return[a,o,t]}async function QEe(e,t,r){let n=parseInt(await new kx().hash(t,"hex"),16),i=gN({crc32:n,fileName:e,length:t.byteLength}),a=hN({crc32:n,fileName:e,offset:r,length:t.byteLength});return[new Uint8Array(qn(i,t)),new Uint8Array(a)]}async function vN(e,t,r){let n=new vo(e,!0),[i,a,o]=await nFt(n),s=n.length,[u,c]=await QEe(r,t,s);await n.append(u);let l=qn(i,c),f=n.length;await n.append(new Uint8Array(l));let p=n.length;await n.append(KEe(a,o.offsets,f,p,o.cdRecordsNumber+1n))}async function xN(e,t,r){let n=iFt(e),i=new Wc(t,"w"),a=[],o=[];for await(let l of n)await XEe(l,i,o,a);if(r){let l=await r(a);await XEe(l,i,o)}let s=(await i.stat()).bigsize,u=qn(...o);await i.append(new Uint8Array(u));let c=(await i.stat()).bigsize;await i.append(new Uint8Array(JEe({recordsNumber:o.length,cdSize:u.byteLength,cdOffset:s,eoCDStart:c})))}async function XEe(e,t,r,n){let i=(await t.stat()).bigsize;n==null||n.push({fileName:e.path,localHeaderOffset:i});let[a,o]=await QEe(e.path,e.file,i);await t.append(a),r.push(o)}function iFt(e){async function*t(){let r=await ZEe(e);for(let n of r){let i=await(await Pa($a.join(e,n))).arrayBuffer();yield{path:n,file:i}}}return t()}async function ZEe(e,t="",r){let n=r||new Dx({}),i=await n.readdir(VC(e,t)),a=[];for(let o of i){let s=VC(e,t,o);if((await n.stat(s)).isDirectory){let u=await ZEe(e,VC(t,o));a.push(...u)}else a.push(VC(t,o))}return a}function VC(...e){let t=e.filter(r=>r.length);return $a.join(...t)}var F1=class{constructor(t){this.compressBatches=this.compressBatches.bind(this),this.decompressBatches=this.decompressBatches.bind(this)}async preload(t={}){xx(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 gd(t)}improveError(t){return t.message.includes(this.name)||(t.message=`${this.name} ${t.message}`),t}};var r2=class extends F1{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 Sh=Lt(eN(),1),Bl=Lt(require("zlib"),1);var Pl=class extends F1{name="deflate";extensions=[];contentEncodings=["deflate"];isSupported=!0;options;_chunks=[];constructor(t={}){super(t),this.options=t}async compress(t){var r,n;if(!jr&&((r=this.options.deflate)!=null&&r.useZlib)){let i=(n=this.options.deflate)!=null&&n.gzip?await z0(Bl.default.gzip)(t):await z0(Bl.default.deflate)(t);return Hc(i)}return this.compressSync(t)}async decompress(t){var r,n;if(!jr&&((r=this.options.deflate)!=null&&r.useZlib)){let i=(n=this.options.deflate)!=null&&n.gzip?await z0(Bl.default.gunzip)(t):await z0(Bl.default.inflate)(t);return Hc(i)}return this.decompressSync(t)}compressSync(t){var a,o,s,u;if(!jr&&((a=this.options.deflate)!=null&&a.useZlib)){let c=(o=this.options.deflate)!=null&&o.gzip?Bl.default.gzipSync(t):Bl.default.deflateSync(t);return Hc(c)}let r=((s=this.options)==null?void 0:s.deflate)||{},n=new Uint8Array(t);return((u=this.options)!=null&&u.raw?Sh.default.deflateRaw:Sh.default.deflate)(n,r).buffer}decompressSync(t){var a,o,s,u;if(!jr&&((a=this.options.deflate)!=null&&a.useZlib)){let c=(o=this.options.deflate)!=null&&o.gzip?Bl.default.gunzipSync(t):Bl.default.inflateSync(t);return Hc(c)}let r=((s=this.options)==null?void 0:s.deflate)||{},n=new Uint8Array(t);return((u=this.options)!=null&&u.raw?Sh.default.inflateRaw:Sh.default.inflate)(n,r).buffer}async*compressBatches(t){var i;let r=((i=this.options)==null?void 0:i.deflate)||{},n=new Sh.default.Deflate(r);yield*this.transformBatches(n,t)}async*decompressBatches(t){var i;let r=((i=this.options)==null?void 0:i.deflate)||{},n=new Sh.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),i=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 n2=class extends Pl{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 eAe={0:async e=>e,8:async e=>await new Pl({raw:!0}).decompress(e)},Ol=class{fileProvider=null;fileName;archive=null;constructor(t){if(typeof t=="string")if(this.fileName=t,!jr)this.fileProvider=new vo(t);else throw new Error("Cannot open file for random access in a WEB browser");else t instanceof Il?(this.fileProvider=t.fileProvider,this.archive=t,this.fileName=t.fileName):MB(t)&&(this.fileProvider=t)}async destroy(){this.fileProvider&&await this.fileProvider.destroy()}async readdir(){if(!this.fileProvider)throw new Error("No data detected in the zip archive");let t=[],r=xc(this.fileProvider);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.fileProvider)throw new Error("No data detected in the zip archive");let i=await this.getCDFileHeader(t),a=await tu(i.localHeaderOffset,this.fileProvider);if(!a)throw new Error("Local file header has not been found in the zip archive`");let o=eAe[a.compressionMethod.toString()];if(!o)throw Error("Only Deflation compression is supported");let s=await this.fileProvider.slice(a.fileDataOffset,a.fileDataOffset+a.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.fileProvider)throw new Error("No data detected in the zip archive");let r=xc(this.fileProvider),n=null;for await(let i of r)if(i.fileName===t){n=i;break}if(!n)throw new Error("File has not been found in the zip archive");return n}};var Il=class{fileProvider;fileName;constructor(t,r,n){this.fileProvider=t,this.fileName=n}async getFileWithoutHash(t){return await(await new Ol(this.fileProvider).fetch(t)).arrayBuffer()}};function i2(e){let t=new DataView(e),r={};for(let n=0;n<e.byteLength;n=n+24){let i=t.getBigUint64(n+16,!0),a=aFt(e,n,16);r[a]=i}return r}function aFt(e,t,r){return[...new Uint8Array(e,t,r)].map(n=>n.toString(16).padStart(2,"0")).join("")}async function bN(e){let t=xc(e);return oFt(t)}async function oFt(e){let t=new Nu,r=new TextEncoder,n={};for await(let i of e){let a=i.fileName.split("\\").join("/").toLocaleLowerCase(),o=r.encode(a).buffer,s=await t.hash(o,"hex");n[s]=i.localHeaderOffset}return n}async function a2(e){let t=new Nu,r=new TextEncoder,n=[];for await(let a of e){let o=a.fileName.split("\\").join("/");o!=="3dSceneLayer.json.gz"&&(o=o.toLocaleLowerCase());let s=r.encode(o).buffer,u=await t.hash(s,"hex");n.push(qn(uFt(u),cFt(a.localHeaderOffset)))}let i=n.sort(sFt);return uE(i)}function sFt(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 uFt(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 cFt(e){return new BigUint64Array([e]).buffer}var lFt={0:e=>new r2().decompress(e),8:e=>new Pl({raw:!0}).decompress(e)},o2=class extends Il{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,i=await new Nu().hash(n,"hex"),a=this.hashTable[i];if(a===void 0)return null;let o=await tu(a,this.fileProvider);if(!o)return null;let s=await this.fileProvider.slice(o.fileDataOffset,o.fileDataOffset+o.compressedSize),u=lFt[o.compressionMethod];if(!u)throw Error("Only Deflation compression is supported");r=await u(s)}else r=await this.getFileWithoutHash(t);return r}};function Sp(e,t,r){if(!t)return r+12;let{magic:i,version:a=1,byteLength:o=12}=e;return Rt(Array.isArray(i)&&Number.isFinite(a)&&Number.isFinite(o)),t.setUint8(r+0,i[0]),t.setUint8(r+1,i[1]),t.setUint8(r+2,i[2]),t.setUint8(r+3,i[3]),t.setUint32(r+4,a,!0),t.setUint32(r+8,o,!0),r+=12,r}function Tp(e,t,r){e&&e.setUint32(t+8,r,!0)}function tAe(e,t,r,n,i){e={magic:ap.COMPOSITE,tiles:[],...e};let a=r;r+=Sp(e,t,r),t&&t.setUint32(r,e.tiles.length,!0),r+=4;for(let o=0;o<e.tiles.length;++o)r+=i(e.tiles[o],t,r,n);return Tp(t,a,r-a),r}function rAe(e,t,r,n){let{featuresLength:i=0,batchTable:a}=e,s=JSON.stringify({BATCH_LENGTH:i}),u=a?JSON.stringify(a):"",c=go(s.length,8),l=u?go(u.length,8):0;e={magic:ap.BATCHED_MODEL,...e};let f=r;r=Sp(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=G0(t,r,s,8),a&&(r=G0(t,r,u,8));let p=e.gltfEncoded;return p&&(r=Sx(t,r,p,p.byteLength)),Tp(t,f,r-f),r}function nAe(e,t,r,n){let{featuresLength:i=1,gltfFormat:a=1,gltfUri:o=""}=e,s=o.length,u={INSTANCES_LENGTH:i,POSITION:new Array(i*3).fill(0)},c=JSON.stringify(u),l=c.length;e={magic:ap.INSTANCED_MODEL,...e};let f=r;return r=Sp(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,a,!0)),r+=20,r+=U0(t,r,c,l),r+=U0(t,r,o,s),Tp(t,f,r-f),r}var fFt={POINTS_LENGTH:1,POSITIONS:{byteOffset:0}};function iAe(e,t,r,n){let{featureTableJson:i=fFt}=e,a=JSON.stringify(i);a=IB(a,4);let{featureTableJsonByteLength:o=a.length}=e,s=new ArrayBuffer(12),u=s.byteLength;e={magic:ap.POINT_CLOUD,...e};let c=r;return r+=Sp(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+=U0(t,r,a,o),r+=Sx(t,r,s,u),Tp(t,c,r-c),r}function _N(e,t){let r=yN(e,null,0,t),n=new ArrayBuffer(r),i=new DataView(n);return yN(e,i,0,t),n}function yN(e,t,r,n){switch(Rt(typeof e.type=="string"),e.type){case Xo.COMPOSITE:return tAe(e,t,r,n,yN);case Xo.POINT_CLOUD:return iAe(e,t,r,n);case Xo.BATCHED_3D_MODEL:return rAe(e,t,r,n);case Xo.INSTANCED_3D_MODEL:return nAe(e,t,r,n);default:throw new Error("3D Tiles: unknown tile type")}}var wN={name:"3D Tile",id:"3d-tiles",module:"3d-tiles",version:Cg,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],binary:!0,options:{["3d-tiles"]:{}},encode:async(e,t)=>aAe(e,t),encodeSync:aAe};function aAe(e,t){return _N(e,t)}var oa=require("path");var oAe=Lt(require("crypto")),KC=new Uint8Array(256),$C=KC.length;function EN(){return $C>KC.length-16&&(oAe.default.randomFillSync(KC),$C=0),KC.slice($C,$C+=16)}var ta=[];for(let e=0;e<256;++e)ta.push((e+256).toString(16).slice(1));function sAe(e,t=0){return(ta[e[t+0]]+ta[e[t+1]]+ta[e[t+2]]+ta[e[t+3]]+"-"+ta[e[t+4]]+ta[e[t+5]]+"-"+ta[e[t+6]]+ta[e[t+7]]+"-"+ta[e[t+8]]+ta[e[t+9]]+"-"+ta[e[t+10]]+ta[e[t+11]]+ta[e[t+12]]+ta[e[t+13]]+ta[e[t+14]]+ta[e[t+15]]).toLowerCase()}var uAe=Lt(require("crypto")),AN={randomUUID:uAe.default.randomUUID};function pFt(e,t,r){if(AN.randomUUID&&!t&&!e)return AN.randomUUID();e=e||{};let n=e.random||(e.rng||EN)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return sAe(n)}var bc=pFt;var Lh=Lt(require("process"),1),M4=Lt(ru(),1),L4=Lt(CN(),1);var O1=require("path"),AAe=Lt(ru(),1);var yAe=()=>({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 Th=require("fs"),B1=require("path");var _Ae=require("zlib"),JC=require("fs");function YC(e){let t=`${e}.gz`,r=(0,_Ae.createGzip)(),n=(0,JC.createReadStream)(e),i=(0,JC.createWriteStream)(t);return new Promise((a,o)=>{n.on("end",()=>{console.log(`${t} compressed and saved.`),a(t)}),n.on("error",s=>{console.log(`${t}: compression error!`),o(s)}),n.pipe(r).pipe(i)})}async function zn(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 Th.promises.mkdir(e,{recursive:!0});let i=(0,B1.join)(e,r);try{await Th.promises.writeFile(i,n)}catch(a){throw a}return console.log(`${i} saved.`),i}async function yc(e,t,r="index.json",n=!0,i){let a=await zn(e,t,r);if(n){if(i)return i.includes(a)?null:(i.push(a),`${a}.gz`);let o=await YC(a);return await l2(a),o}return a}async function P1(e,t){return new Promise((r,n)=>{let i=0;console.log(`load ${e}/${t}.`);let a=setInterval(()=>{let o=(0,B1.join)(e,t);fn(o,RB).then(s=>{clearInterval(a),r(s)}).catch(()=>{i++,i>100&&(clearInterval(a),n(new Error(`Cannon load ${e}/${t}.`)))})},200)})}async function u2(e){try{return await Th.promises.stat(e),!0}catch{return!1}}function c2(e){return Th.promises.rm(e,{recursive:!0})}function l2(e){return Th.promises.unlink(e)}function wAe(e){return(0,B1.isAbsolute)(e)?e:(0,B1.join)(process.cwd(),e)}async function EAe(e,t){try{await Th.promises.rename(e,t)}catch(r){console.log("Can't rename file",r)}}var ra=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,n;return this.converter.options.slpk?(r=(0,O1.join)(this.converter.layers0Path,"nodepages"),n=`${t.toString()}.json`):(r=(0,O1.join)(this.converter.layers0Path,"nodepages",t.toString()),n="index.json"),{filePath:r,fileName:n}}async loadNodePage(t){let{filePath:r,fileName:n}=this.getNodePageFileName(t),i=(0,O1.join)(r,n);return await u2(i)?(console.log(`load ${i}.`),await P1(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 i;if(t==null)return;let n=await this.getNodeById(t);(i=n.children)==null||i.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),ra.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:i,fileName:a}=this.getNodePageFileName(r),o=await this.getNodeById(t.index,n);o?ra.updateAll(o,t):n.nodes.push(t);let s=JSON.stringify(n);this.converter.options.slpk?await this.converter.writeQueue.enqueue({archiveKey:`nodePages/${r.toString()}.json.gz`,writePromise:()=>this.writeFile(i,s,a,!0,this.converter.compressList)},!0):await this.converter.writeQueue.enqueue({writePromise:()=>this.writeFile(i,s)},!0)}async saveMetadata(){let t=(0,AAe.default)({nodeCount:this.nodesCounter},yAe()),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}if(this.converter.options.slpk){for(let[t,r]of this.nodePages.entries()){let n=JSON.stringify(r),i=(0,O1.join)(this.converter.layers0Path,"nodepages");await this.converter.writeQueue.enqueue({archiveKey:`nodePages/${t.toString()}.json.gz`,writePromise:()=>this.writeFile(i,n,`${t.toString()}.json`)})}await this.saveMetadata()}else for(let[t,r]of this.nodePages.entries()){let n=JSON.stringify(r),i=(0,O1.join)(this.converter.layers0Path,"nodepages",t.toString());await this.converter.writeQueue.enqueue({writePromise:()=>this.writeFile(i,n)})}}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}),ra.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 f2=require("path"),XC=require("fs");function I1(e){if(typeof e=="number"){let a=Math.floor(e/1e3),o=e-a*1e3;return SAe(a,o)}let t=1e6,r=e[0],n=e[1]/t;return SAe(r,n)}function SAe(e,t){let r=Math.floor(e/3600);e=e-r*3600;let n=Math.floor(e/60);e=e-n*60;let i=Math.floor(e),a="";return r&&(a+=`${r}h `),n&&(a+=`${n}m `),i&&(a+=`${i}s`),a||(a+=`${Math.floor(t)}ms`),a}async function QC(e){let{slpk:t,outputPath:r,tilesetName:n}=e,i=wAe(r);try{if(t){let s=(0,f2.join)(i,`${n}.slpk`);return(await XC.promises.stat(s)).size}let a=(0,f2.join)(i,n);return await TAe(a)}catch(a){return console.log("Calculate file sizes error: ",a),null}}async function TAe(e){let t=0,r=await XC.promises.readdir(e);for(let n of r){let i=await XC.promises.stat((0,f2.join)(e,n));i.isDirectory()?t+=await TAe((0,f2.join)(e,n)):t+=i.size}return t}var HAe=Lt(CN(),1);var Ch=3,R1=9;function DAe(e){let{positions:t,normals:r,texCoords:n,colors:i,uvRegions:a,featureIndices:o}=e,s=t.length/R1;if(!o.length)return{faceRange:new Uint32Array([0,s-1]),featureIds:[0],featureCount:1,positions:t,normals:r,texCoords:n,colors:i,uvRegions:a};let u=EFt(o),c=AFt({...u,...e}),l=SFt(c);return TFt(l,u.featureCount)}function EFt(e){let t=1,r=1,n=CAe(e.slice(0,Ch)),i=[],a=[],o=[n];i[0]=0,a[0]=n;for(let c=Ch;c<e.length;c+=Ch){let l=CAe(e.slice(c,c+Ch));n!==l&&(i[t]=c/Ch-1,i[t+1]=c/Ch,a[r]=l,o.includes(l)||o.push(l),t+=2,r+=1),n=l}i[t]=e.length/Ch-1;let s=new Uint32Array(i),u=o.length;return{faceRange:s,featureCount:u,featureIds:a}}function CAe(e){let t={},r=e[0],n=1;for(let i of e)t[i]=(t[i]||0)+1,n=n>t[i]?n:t[i],r=n>t[i]?r:i;return r}function AFt(e){let{featureIds:t,positions:r,normals:n,colors:i,uvRegions:a,texCoords:o,faceRange:s=new Uint32Array(0)}=e,u=[],c=new Float32Array(r),l=new Float32Array(n),f=new Uint8Array(i),p=new Float32Array(o),d=new Uint16Array(a),h=0,v=0,m=0,b=0,_=0;for(let E=0;E<t.length;E++){let T=s[E*2],S=s[E*2+1],D=p2("positions",T,S),I=p2("normals",T,S),L=p2("colors",T,S),F=p2("uvRegions",T,S),P=p2("texCoords",T,S);u.push({featureId:t[E],positions:c.subarray(h,h+D),normals:l.subarray(v,v+I),colors:f.subarray(m,m+L),uvRegions:d.subarray(b,b+F),texCoords:p.subarray(_,_+P)}),h+=D,v+=I,m+=L,b+=F,_+=P}return u}function p2(e,t,r){let a=r-t+1,o=a*3;switch(e){case"positions":case"normals":return a*R1;case"colors":case"uvRegions":return o*4;case"texCoords":return o*2;default:return 0}}function SFt(e){let t=[];for(let n of e){let i=t.find(a=>a.featureId===n.featureId);i?i.attributes.push(n):t.push({featureId:n.featureId,attributes:[n]})}let r=[];for(let n of t){let i=kAe(n.attributes);r.push({featureId:n.featureId,...i})}return r}function TFt(e,t){let n=[e[0].featureId||0],i=[0],a=0,o=0;for(let c=1;c<e.length;c++){let l=e[c];n.push(l.featureId||0);let f=e[a];i.push(f.positions.length/R1-1+o),i.push(f.positions.length/R1+o),o+=f.positions.length/R1,a+=1}let s=kAe(e);return i.push(s.positions.length/R1-1),{faceRange:new Uint32Array(i),featureIds:n,featureCount:t,...s}}function kAe(e){let t=e.map(({positions:f})=>f),r=t.length>1?mo(...t):t[0],n=e.map(({normals:f})=>f),i=n.length>1?mo(...n):n[0],a=e.map(({colors:f})=>f),o=a.length>1?mo(...a):a[0],s=e.map(({texCoords:f})=>f),u=s.length>1?mo(...s):s[0],c=e.map(({uvRegions:f})=>f),l=c.length>1?mo(...c):c[0];return{positions:r,normals:i,colors:o,texCoords:u,uvRegions:l}}function ZC(e,t){let r,n,i,a=Zt.WGS84.cartesianToCartographic(e.center,new ce);return a[2]=a[2]-t.getHeight(a[1],a[0]),e instanceof Ii?(n=e.halfSize,r=new ce(n[0],n[1],n[2]).len(),i=e.quaternion):(r=e.radius,n=[r,r,r],i=new tc().fromMatrix3(new Sr([n[0],0,0,0,n[1],0,0,0,n[2]])).normalize()),{mbs:[a[0],a[1],a[2],r],obb:{center:[a[0],a[1],a[2]],halfSize:n,quaternion:i}}}function FAe(e,t){let r=CFt(e),n=wM(r),i=xM(r),a=Zt.WGS84.cartesianToCartographic(i.center,new ce),o=Zt.WGS84.cartesianToCartographic(n.center,new ce);return a[2]=a[2]-t.getHeight(a[1],a[0]),o[2]=o[2]-t.getHeight(o[1],o[0]),{mbs:[a[0],a[1],a[2],i.radius],obb:{center:o,halfSize:n.halfSize,quaternion:n.quaternion}}}function CFt(e){let t=[];for(let r=0;r<e.length;r+=3){let n=new ce([e[r],e[r+1],e[r+2]]);t.push(n)}return t}function BAe(e){let t;e instanceof Oa?t=e:t=e.getBoundingSphere();let r=t.center,n=t.radius,i=Zt.WGS84.cartesianToCartographic(new ce(r[0]+n,r[1]+n,r[2]+n),new ce),a=Zt.WGS84.cartesianToCartographic(new ce(r[0]-n,r[1]-n,r[2]-n),new ce);return{xmin:Math.min(a[0],i[0]),xmax:Math.max(a[0],i[0]),ymin:Math.min(a[1],i[1]),ymax:Math.max(a[1],i[1]),zmin:Math.min(a[2],i[2]),zmax:Math.max(a[2],i[2])}}function DN(e){let t=e[3],r=new ce(e[0],e[1],e[2]),n=new Sr([t,0,0,0,t,0,0,0,t]);return new Ii(r,n)}function PAe(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)||[],i=((h=(d=e.gltf)==null?void 0:d.images)==null?void 0:h.map(v=>{var _,E;if((_=v==null?void 0:v.image)!=null&&_.compressed)return null;let m=(E=v==null?void 0:v.image)==null?void 0:E.data,b=new Uint8Array(m.length);return b.set(m),{data:b,compressed:!1,height:v.image.height,width:v.image.width,components:v.image.components,mimeType:v.mimeType}}))||[];OAe(n);let{cartographicOrigin:a,modelMatrix:o}=kFt(e,t,r);return{nodes:n,images:i,cartographicOrigin:a,cartesianModelMatrix:o}}function DFt(e){let t={};for(let r in e)t[r]={value:e[r].value};return t}function kFt(e,t,r){let{rtcCenter:n,gltfUpAxis:i}=e,{center:a}=r,o=new zr(t);switch(n&&o.translate(n),i){case"Z":break;case"Y":let c=new zr().rotateX(Math.PI/2);o=o.multiplyRight(c);break;case"X":let l=new zr().rotateY(-Math.PI/2);o=o.multiplyRight(l);break;default:break}let s=new ce(a),u=Zt.WGS84.cartesianToCartographic(s,new ce);return{modelMatrix:o,cartographicOrigin:u}}function OAe(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(i=>{var a,o,s;return{...i,indices:{value:(a=i==null?void 0:i.indices)==null?void 0:a.value},attributes:DFt(i.attributes),material:{id:(o=i==null?void 0:i.material)==null?void 0:o.id,uniqueId:(s=i==null?void 0:i.material)==null?void 0:s.uniqueId}}})}}),n.children&&OAe(n.children)}}function IAe(e,t){var n,i;let r=(i=(n=e.gltf)==null?void 0:n.extensions)==null?void 0:i[Zo];if(!(r!=null&&r.featureTextures))return null;for(let a in r.featureTextures)if(r.featureTextures[a].class===t)return a;return null}function RAe(e,t,r,n){let i=t==null?void 0:t.extensions;if(!i)return[];for(let[a,o]of Object.entries(i||{}))switch(a){case Zo:return BFt(e,o,r,n);case x8:return FFt(e,o);default:return[]}return[]}function FFt(e,t){for(let r of t.featureIds)if(typeof r.propertyTable<"u")return r.data;return[]}function BFt(e,t,r,n){var o,s,u,c,l,f,p;let i=(o=t==null?void 0:t.featureIdAttributes)==null?void 0:o[0];if((s=i==null?void 0:i.featureIds)!=null&&s.attribute)return e[i.featureIds.attribute].value;if((u=i==null?void 0:i.featureIds)!=null&&u.hasOwnProperty("constant")&&((c=i==null?void 0:i.featureIds)!=null&&c.hasOwnProperty("divisor"))){let d=((l=e==null?void 0:e.POSITIONS)==null?void 0:l.value.length)/3||0;return PFt(d,i.featureIds.constant,i.featureIds.divisor)}let a=(t==null?void 0:t.featureIdTextures)&&(t==null?void 0:t.featureIdTextures[0]);if(a){let h=`TEXCOORD_${((p=(f=a==null?void 0:a.featureIds)==null?void 0:f.texture)==null?void 0:p.texCoord)||0}`,v=e[h].value;return OFt(a,v,r)}return n?e[n].value:[]}function PFt(e,t=0,r=0){let n=[];if(r>0){let i=t,a=r;for(let o=0;o<e;o++)n.push(i),a-=1,a===0&&(i++,a=r)}else n=Array(e).fill(t,0,e);return n}function OFt(e,t,r){var c,l,f;if(!(r!=null&&r.length))return[];let n={r:0,g:1,b:2,a:3},i=(l=(c=e==null?void 0:e.featureIds)==null?void 0:c.texture)==null?void 0:l.index,a=(f=e==null?void 0:e.featureIds)==null?void 0:f.channels;if(!a||i===void 0)return[];let o=r[i],s=[],u=n[a];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],v=Math.min(JT(d)*o.width|0,o.width-1),b=(Math.min(JT(h)*o.height|0,o.height-1)*o.width+v)*o.components+u,_=new Uint8Array(o.data)[b];s.push(_)}else console.warn(`Can't get batch Ids from ${(o==null?void 0:o.mimeType)||""} compressed texture`);return s}function jAe(e,t){let r={};for(let n in t){let i=t[n];r[n]=IFt(i,e)}return r}function IFt(e,t){let r=[];if(e)for(let n in t){let i=e[n]||null;r.push(i)}return r}function MAe(e,t){let r=!1;for(let n of Object.values(t))(!e||!n||e.length!==n.length)&&(r=!0);return r}function RFt(e){return typeof e=="string"||typeof e=="bigint"?xn.STRING_TYPE:typeof e=="number"?Number.isInteger(e)?xn.SHORT_INT_TYPE:xn.DOUBLE_TYPE:xn.STRING_TYPE}function LAe(e){let t={};for(let r in e){let n=e[r][0],i=RFt(n);t[r]=i}return t}var qAe=(e,t)=>{var a,o,s,u,c,l,f,p;let r={},n=(u=(s=(o=(a=e.extensions)==null?void 0:a[Zo])==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],v=jFt(h);r[d]=v}return r}let i=(p=(f=(l=(c=e.extensions)==null?void 0:c[hl])==null?void 0:l.schema)==null?void 0:f.classes)==null?void 0:p[t];if(i){for(let d in i.properties){let h=i.properties[d],v=MFt(h);r[d]=v}return r}return null},jFt=e=>{let t;switch(e.type){case"INT8":case"UINT8":case"INT16":case"UINT16":case"INT32":case"UINT32":t=xn.SHORT_INT_TYPE;break;case"FLOAT32":case"FLOAT64":t=xn.DOUBLE_TYPE;break;case"INT64":case"UINT64":case"BOOLEAN":case"ENUM":case"STRING":case"ARRAY":t=xn.STRING_TYPE;break;default:t=xn.STRING_TYPE;break}return t},MFt=e=>{let t;if(e.array)t=xn.STRING_TYPE;else switch(e.componentType){case"INT8":case"UINT8":case"INT16":case"UINT16":case"INT32":case"UINT32":t=xn.SHORT_INT_TYPE;break;case"FLOAT32":case"FLOAT64":t=xn.DOUBLE_TYPE;break;case"INT64":case"UINT64":t=xn.STRING_TYPE;break;default:t=xn.STRING_TYPE;break}return t};var e4=e=>{let t=new Uint32Array(e);for(let r=0;r<e;r++)t[r]=r;return t};var LFt=1,qFt=1,nu=3,d2=2,NFt=4,UFt="string",GFt="Int32",zFt="Float64",HFt="Oid32",NAe=["CUSTOM_ATTRIBUTE_2","_BATCHID","BATCHID"],Cp=new ce;async function kN({tileContent:e,tileTransform:t,tileBoundingVolume:r,addNodeToNodePage:n,propertyTable:i,featuresHashArray:a,attributeStorageInfo:o,draco:s,generateBoundingVolumes:u,shouldMergeMaterials:c,geoidHeightModel:l,libraries:f,metadataClass:p}){var E;let d=u,h=await a5t((E=e.gltf)==null?void 0:E.materials,c),v=PAe(e,t,r),m=IAe(e,p),b=await $Ft(v,h,d,m);u&&WFt(b,l);let _=[];for(let T of h){let S=T.mergedMaterials[0].originalMaterialId;if(!b.has(S))continue;let D=b.get(S);if(!D)continue;let{material:I,texture:L}=T,F=await n();_.push(await VFt({convertedAttributes:D,material:I,texture:L,tileContent:e,nodeId:F,featuresHashArray:a,propertyTable:i,attributeStorageInfo:o,draco:s,libraries:f}))}return _.length?_:null}function WFt(e,t){for(let r of e.values()){let n=FAe(r.positions,t);r.boundingVolumes=n;let i=n.obb.center;for(let a=0;a<r.positions.length;a+=nu){let o=r.positions.subarray(a,a+nu);Zt.WGS84.cartesianToCartographic(Array.from(o),Cp),Cp[2]=Cp[2]-t.getHeight(Cp[1],Cp[0]),Cp=Cp.subtract(i),r.positions.set(Cp,a)}}}async function VFt({convertedAttributes:e,material:t,texture:r,tileContent:n,nodeId:i,featuresHashArray:a,propertyTable:o,attributeStorageInfo:s,draco:u,libraries:c}){var P;let l=e.boundingVolumes,f=e.positions.length/nu,{faceRange:p,featureIds:d,positions:h,normals:v,colors:m,uvRegions:b,texCoords:_,featureCount:E}=DAe(e),T={};o&&(T=g5t(d,e.featureIndices,a,o));let S=new Uint32Array(2),D=S5t(d);S.set([f,E],0);let I=new Uint8Array(qn(S.buffer,h.buffer,v.buffer,r?_.buffer:new ArrayBuffer(0),m.buffer,b,D.buffer,p.buffer)),L=u?T5t(f,e,{positions:h,normals:v,texCoords:r?_:new Float32Array(0),colors:m,uvRegions:b,featureIds:d,faceRange:p},c):null,F=[];return s&&o&&(F=y5t(d,T,o,s)),{nodeId:i,geometry:I,compressedGeometry:L,texture:r,hasUvRegions:Boolean(b.length),sharedResources:f5t(((P=n.gltf)==null?void 0:P.materials)||[],i),meshMaterial:t,vertexCount:f,attributes:F,featureCount:E,boundingVolumes:l}}async function $Ft(e,t,r,n){let{nodes:i,images:a,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)}WAe({nodes:i,images:a,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 WAe({nodes:e,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:i,useCartesianPositions:a,matrix:o=new zr([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)JFt({node:u,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:i,useCartesianPositions:a,matrix:o,featureTexture:s})}function KFt(e,t){let r=t,{matrix:n,rotation:i,scale:a,translation:o}=e;return n&&(r=t.multiplyRight(n)),o&&(r=r.translate(o)),i&&(r=r.rotateXYZ(i)),a&&(r=r.scale(a)),r}function JFt({node:e,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:i,useCartesianPositions:a,matrix:o=new zr([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),featureTexture:s}){let u=KFt(e,o),c=e.mesh;c&&YFt({mesh:c,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:i,useCartesianPositions:a,matrix:u,featureTexture:s}),WAe({nodes:e.children||[],images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:i,useCartesianPositions:a,matrix:u,featureTexture:s})}function YFt({mesh:e,images:t,cartographicOrigin:r,cartesianModelMatrix:n,attributesMap:i,useCartesianPositions:a=!1,matrix:o,featureTexture:s}){var u;for(let c of e.primitives){let l=null,f;c.material?(l=i.get(c.material.id),f=(u=l==null?void 0:l.mergedMaterials.find(({originalMaterialId:h})=>{var v;return h===((v=c.material)==null?void 0:v.id)}))==null?void 0:u.uvRegion):i.has("default")&&(l=i.get("default")),Rt(l!==null,"Primitive - material mapping failed"),Rt(c.mode===void 0||c.mode===Tt.TRIANGLES||c.mode===Tt.TRIANGLE_STRIP,`Primitive - unsupported mode ${c.mode}`);let p=c.attributes;if(!l)continue;let d=XFt(c);l.positions=mo(l.positions,UAe({vertices:p.POSITION.value,cartographicOrigin:r,cartesianModelMatrix:n,nodeMatrix:o,indices:d,attributeSpecificTransformation:QFt,useCartesianPositions:a})),l.normals=mo(l.normals,UAe({vertices:p.NORMAL&&p.NORMAL.value,cartographicOrigin:r,cartesianModelMatrix:n,nodeMatrix:o,indices:d,attributeSpecificTransformation:ZFt,useCartesianPositions:!1})),l.texCoords=mo(l.texCoords,e5t(p.TEXCOORD_0&&p.TEXCOORD_0.value,d)),l.colors=mo(l.colors,t5t(p.COLOR_0,d)),f&&(l.uvRegions=mo(l.uvRegions,r5t(f,d))),l.featureIndicesGroups=l.featureIndicesGroups||[],l.featureIndicesGroups.push(n5t(i5t(p,c,t,s),d))}}function XFt(e){var r;let t=(r=e.indices)==null?void 0:r.value;if(!t){let n=e.attributes.POSITION.value;return e4(n.length/nu)}if(t&&e.mode===Tt.TRIANGLE_STRIP){let n=t.constructor,i=new n((t.length-2)*3),a=0,o=t.slice(0,3);i.set(o,0);for(let s=1;s+2<t.length;s++)a+=3,o=t.slice(s,s+3),s%2===0?i.set(o,a):i.set(o.reverse(),a);t=i}return t}function UAe(e){let{vertices:t,indices:r,attributeSpecificTransformation:n}=e,i=new Float32Array(r.length*nu);if(!t)return i;for(let a=0;a<r.length;a++){let o=r[a]*nu,s=t.subarray(o,o+nu),u=new ce(Array.from(s));u=n(u,e),i[a*nu]=u.x,i[a*nu+1]=u.y,i[a*nu+2]=u.z}return i}function QFt(e,t){let{cartesianModelMatrix:r,cartographicOrigin:n,nodeMatrix:i,useCartesianPositions:a}=t;return i&&(e=e.transform(i)),e=e.transform(r),a||(Zt.WGS84.cartesianToCartographic([e[0],e[1],e[2]],e),e=e.subtract(n)),e}function ZFt(e,t){let{cartesianModelMatrix:r,nodeMatrix:n}=t;return n&&(e=e.transformAsVector(n)),e=e.transformAsVector(r),e}function e5t(e,t){let r=new Float32Array(t.length*d2);if(!e)return r.fill(1),r;for(let n=0;n<t.length;n++){let i=t[n]*d2,a=e.subarray(i,i+d2);r[n*d2]=a[0],r[n*d2+1]=a[1]}return r}function t5t(e,t){let r=(e==null?void 0:e.components)||NFt,n=new Uint8Array(t.length*r);if(!e)return n.fill(255),n;let i=e.value;for(let a=0;a<t.length;a++){let o=t[a]*r,s=i.subarray(o,o+r),u=new Uint8Array(r);for(let c=0;c<s.length;c++)u[c]=s[c]*255;n.set(u,a*r)}return n}function r5t(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 n5t(e,t){if(!e.length||!t.length)return[];let r=[];for(let n=0;n<t.length;n++){let i=t[n];r.push(e[i])}return r}function i5t(e,t,r,n){let i=RAe(e,t,r,n);if(i.length)return i;for(let a=0;a<NAe.length;a++){let o=NAe[a];if(e[o]&&e[o].value)return e[o].value}return[]}async function a5t(e=[],t){let r=[];for(let n of e)r.push(u5t(n));return t&&(r=await o5t(r)),r}async function o5t(e){var r,n;let t=[];for(;e.length>0;){let i=e.splice(0,1)[0],a=[];for(let o=0;o<e.length;o++){let s=e[o];(i.texture&&s.texture||!i.texture&&!s.texture)&&(i=await s5t(i,s),a.push(o))}if(i.texture&&a.length){let o=(r=i.mergedMaterials)==null?void 0:r.reduce((c,{textureSize:l})=>c+((l==null?void 0:l.width)||0),0),s=(n=i.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 i.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}i.texture.image.width=o,i.texture.image.height=s}for(let o of a.reverse())e.splice(o,1);t.push(i)}return t.length||t.push({material:l5t(),mergedMaterials:[{originalMaterialId:"default"}]}),t}async function s5t(e,t){var r,n;if((r=e.texture)!=null&&r.bufferView&&((n=t.texture)!=null&&n.bufferView)&&e.mergedMaterials&&t.mergedMaterials){let i=Buffer.from(e.texture.bufferView.data),a=Buffer.from(t.texture.bufferView.data);try{let{joinImages:o}=await import("join-images"),s=await o([i,a],{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 u5t(e){var i,a,o,s,u;let t={doubleSided:e.doubleSided,emissiveFactor:(i=e.emissiveFactor)==null?void 0:i.map(c=>Math.round(c*255)),alphaMode:c5t(e.alphaMode),pbrMetallicRoughness:{roughnessFactor:((a=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:a.roughnessFactor)||LFt,metallicFactor:((o=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:o.metallicFactor)||qFt}},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:bc();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 c5t(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend";default:return"opaque"}}function l5t(){return{alphaMode:"opaque",pbrMetallicRoughness:{metallicFactor:1,roughnessFactor:1}}}function f5t(e,t){let r={};if(!e||!e.length)return r;r.materialDefinitionInfos=[];for(let n of e){let{materialDefinitionInfo:i,textureDefinitionInfo:a}=p5t(n,t);r.materialDefinitionInfos.push(i),a&&(r.textureDefinitionInfos=r.textureDefinitionInfos||[],r.textureDefinitionInfos.push(a))}return r}function p5t(e,t){var s;let r=((s=e==null?void 0:e.pbrMetallicRoughness)==null?void 0:s.baseColorTexture)||e.emissiveTexture,n=null;r&&(n=h5t(r.texture,t));let{baseColorFactor:i,metallicFactor:a}=(e==null?void 0:e.pbrMetallicRoughness)||{},o=i;return(!i||i[3]===0)&&e.emissiveFactor&&(o=e.emissiveFactor,o[3]=o[3]||1),{materialDefinitionInfo:d5t(o||[1,1,1,1],a),textureDefinitionInfo:n}}function d5t(e,t=1){let r=.00015686274509803922,n=new Jo(0,0,0,1),i=new Jo(1,1,1,1),a=new Jo(r,r,r,0),o=new Jo(e),s=i.subtract(a).multiply(o),u=s.lerp(s,n,t);a[3]=1;let c=a.lerp(a,o,t);return{params:{diffuse:u.toArray(),specular:c.toArray(),renderMode:"solid"}}}function h5t(e,t){var r,n,i,a;return{encoding:(r=e==null?void 0:e.source)!=null&&r.mimeType?[e.source.mimeType]:void 0,images:[{id:m5t(e,t),size:(n=e.source)==null?void 0:n.image.width,length:(i=e.source)!=null&&i.image.data.length?[(a=e.source)==null?void 0:a.image.data.length]:void 0}]}}function m5t(e,t){var v;let{width:r,height:n}=((v=e.source)==null?void 0:v.image)||{};if(!r||!n)return"";let i=1,a=0,o=t+1,s=32-o.toString(2).length,u="0".repeat(s).concat(o.toString(2)),c=i<<28,l=a<<24,f=r-1<<12,p=n-1<<0,d=c+l+f+p;return BigInt(`0b${d.toString(2)}${u}`).toString()}function g5t(e,t,r,n){let i=v5t(e,n,r);return GAe(t,i),GAe(e,i),i}function v5t(e,t,r){let n={};for(let i=0;i<e.length;i++){let a=e[i],o=b5t(i,t,r);n[a.toString()]=o}return n}function x5t(e,t){let r="";for(let n in e)r+=e[n][t];return r}function b5t(e,t,r){let n=x5t(t,e),i=(0,HAe.default)(n);return r.includes(i)?r.indexOf(i):r.push(i)-1}function GAe(e,t){for(let r=0;r<e.length;r++)e[r]=t[e[r]]}function y5t(e,t,r,n){let i=[],o=MAe(e,r)?jAe(t,r):r,s={OBJECTID:e,...o};for(let u in s){let c=w5t(u,n);if(c){let l=s[u],f=_5t(c,l);i.push(f)}}return i}function _5t(e,t){let r;switch(e){case HFt:case GFt:r=E5t(t);break;case zFt:r=A5t(t);break;case UFt:r=zAe(t);break;default:r=zAe(t)}return r}function w5t(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 E5t(e){let t=new Uint32Array([e.length]),r=new Uint32Array(e);return qn(t.buffer,r.buffer)}function A5t(e){let t=new Uint32Array([e.length]),r=new Uint8Array(4),n=new Float64Array(e);return qn(t.buffer,r.buffer,n.buffer)}function zAe(e){let t=new Uint32Array([e.length]),r=0,n=new Uint32Array(e.length),i=[];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,i.push(u)}let a=new Uint32Array([r]);return qn(t.buffer,a.buffer,n.buffer,...i)}function S5t(e){let t=new BigUint64Array(e.length);for(let r=0;r<e.length;r++)t[r]=BigInt(e[r]);return t}async function T5t(e,t,r,n){let{positions:i,normals:a,texCoords:o,colors:s,uvRegions:u,featureIds:c,faceRange:l}=r,f=new Uint32Array(e);for(let m=0;m<f.length;m++)f.set([m],m);let p=new Uint32Array(t.featureIndices.length?t.featureIndices:e),d=C5t(p,l),h={positions:i,normals:a,colors:s,"feature-index":d};o.length&&(h.texCoords=o);let v={"feature-index":{"i3s-attribute-type":"feature-index","i3s-feature-ids":new Int32Array(c)}};return u.length&&(h["uv-region"]=u,v["uv-region"]={"i3s-attribute-type":"uv-region"}),yg({attributes:h,indices:f},TM,{...TM.options,reuseWorkers:!0,_nodeWorkers:!0,modules:n,useLocalLibraries:!0,draco:{method:"MESH_SEQUENTIAL_ENCODING",attributesMetadata:v},["draco-writer"]:{workerUrl:"./modules/draco/dist/draco-writer-worker-node.js"}})}function C5t(e,t){let r=new Uint32Array(e.length),n=0,i=0;for(let a=1;a<t.length;a+=2){let o=(t[a]+1)*nu;r.fill(n,i,o),n++,i=o+1}return r}function VAe(e,t){if(!e)return null;let r,n=e.batchTableJson;if(n)return n;let{extensionName:i,extension:a}=F5t(e);switch(i){case hl:return r=D5t(a,t),r;case Zo:return r=k5t(a,t),r;default:return null}}function D5t(e,t){if(e.propertyTables){for(let r of e.propertyTables)if(r.class===t||!t)return t4(r)}if(e.propertyTextures){for(let r of e.propertyTextures)if(r.class===t||!t)return t4(r)}return null}function k5t(e,t){if(e.featureTables)for(let r in e.featureTables){let n=e.featureTables[r];if(n.class===t||!t)return t4(n)}if(e.featureTextures)for(let r in e.featureTextures){let n=e.featureTextures[r];if(n.class===t||!t)return t4(n)}return null}function t4(e){let t={};for(let r in e.properties)t[r]=e.properties[r].data;return t}function F5t(e){var a,o,s,u;let t=[Zo,hl];if(!((a=e==null?void 0:e.gltf)==null?void 0:a.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 i=(u=(s=e==null?void 0:e.gltf)==null?void 0:s.extensions)==null?void 0:u[n];return{extensionName:n,extension:i}}var KAe=Lt(ru(),1),JAe=require("path");var $Ae=()=>({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 YAe(e,t,r){let n={serviceItemId:bc().replace(/-/gi,""),layerName:e,layers0:t},i=(0,KAe.default)(n,$Ae()),a=(0,JAe.join)(r,"SceneServer");await zn(a,JSON.stringify(i))}var FN=16;function XAe(e,t){let r=[],n=e.boundingVolume,i=e.lodMetricValue||.1,a={metricType:"maxScreenThreshold",maxError:t.mbs[3]*2*FN/i},o={metricType:"maxScreenThresholdSQ",maxError:Math.PI*.25*a.maxError*a.maxError};return n.constructor.name==="OrientedBoundingBox"?(r.push(o),r.push(a)):(r.push(a),r.push(o)),r}function BN(e){var n,i;let t=(n=e.lodSelection)==null?void 0:n.find(a=>a.metricType==="maxScreenThreshold"),r=t==null?void 0:t.maxError;if(!r){let a=(i=e.lodSelection)==null?void 0:i.find(o=>o.metricType==="maxScreenThresholdSQ");a&&(r=Math.sqrt(a.maxError/(Math.PI*.25)))}return r||(r=FN),e.mbs[3]*2*FN/r}var B5t=240,P5t=[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],O5t=372,I5t=[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],R5t=372,j5t=[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],M5t=12,PN=(3+1)*(3+2)/2,L5t=2,j1=class{constructor(t){St(this,"_v00",0),St(this,"_v01",0),St(this,"_v10",0),St(this,"_v11",0),St(this,"_t",[]),St(this,"_ix",void 0),St(this,"_iy",void 0),St(this,"options",void 0),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=q5t(r,360);r=n!==-180?n:180;let i=r*this.options._rlonres,a=-t*this.options._rlatres,o=Math.floor(i),s=Math.min(Math.round((this.options._height-1)/2-1),Math.floor(a));i-=o,a-=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(PN);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)],v=I5t;s!==0&&(v=s===this.options._height-2?j5t:P5t);let m=O5t;s!==0&&(m=s===this.options._height-2?R5t:B5t);for(let b=0;b<PN;++b){p[b]=0;for(let _=0;_<M5t;++_)p[b]+=h[_]*v[PN*_+b];p[b]/=m}}if(!this.options.cubic){let h=(1-i)*u+i*c,v=(1-i)*l+i*f,m=(1-a)*h+a*v,b=this.options._offset+this.options._scale*m;return this._ix=o,this._iy=s,this._v00=u,this._v01=c,this._v10=l,this._v11=f,b}let d=p[0]+i*(p[1]+i*(p[3]+i*p[6]))+a*(p[2]+i*(p[4]+i*p[7])+a*(p[5]+i*p[8]+a*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+L5t*(r*this.options._swidth+t),i=this.options.data[n],a=this.options.data[n+1];return i<<8|a}};function q5t(e,t){t=Math.abs(t);let r=QAe(e,t);return 2*Math.abs(r)===t?r-=QAe(e,2*t)-r:2*Math.abs(r)>t&&(r+=r<0?t:-t),r}function QAe(e,t){return e-Math.floor(e/t)*t}var N5t=10,U5t=65535;function ON(e,t){let r=G5t(e),n=r.next();if(n.done||n.value.line!=="P5")throw new Error("Geoid model file: File not in PGM format");let i=Number.MAX_VALUE,a=0,o=-1,s=-1,u="NONE",c="UNKNOWN",l=0,f=0,p=null,d=null;do{n=r.next();let b=n.value.line;if(b.length)if(b[0]==="#"){let _=b.split(" "),E=_[0],T=_[1];if(E!=="#"||!T)continue;let S=_.length>2?_.slice(2):[];if(T==="Description")u=S.join(" ");else if(T==="DateTime")c=S.join(" ");else if(T==="Offset"){if(!_[2])throw new Error("Geoid model file: Error reading offset");i=parseInt(_[2],10)}else if(T==="Scale"){if(!_[2])throw new Error("Geoid model file: Error reading scale");a=parseFloat(_[2])}else T===(t.cubic?"MaxCubicError":"MaxBilinearError")?isFinite(parseFloat(_[2]))&&(o=parseFloat(_[2])):T===(t.cubic?"RMSCubicError":"RMSBilinearError")&&isFinite(parseFloat(_[2]))&&(s=parseFloat(_[2]))}else{let _=b.split(" ");if(_=_.filter(E=>E!==""),l=parseInt(_[0],10),f=parseInt(_[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!==U5t)throw new Error("Geoid model file: Incorrect value of maxval");if(p=n.value.offset,d=l,i===Number.MAX_VALUE)throw new Error("Geoid model file: Offset not set");if(a===0)throw new Error("Geoid model file: Scale not set");if(a<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 v=l/360,m=(f-1)/180;return new j1({cubic:t.cubic,_width:l,_height:f,_rlonres:v,_rlatres:m,_offset:i,_scale:a,_swidth:d,_datastart:p,_maxerror:o,_rmserror:s,_description:u,_datetime:c,data:e})}function*G5t(e){let t=0;do{let r=e.indexOf(N5t,t);if(r!==-1){let n=e.subarray(t,r);t=r+1,yield{offset:t,line:ZAe(n)}}else{let n=e.subarray(t,e.length);t=e.length,yield{offset:t,line:ZAe(n)}}}while(t<e.length);return{offset:t,line:""}}function ZAe(e){let t="";for(let r of e)t+=String.fromCharCode(r);return t}var z5t="4.2.0-beta.2";var r4={dataType:null,batchType:null,name:"PGM - Netpbm grayscale image format",id:"pgm",module:"tile-converter",version:z5t,mimeTypes:["image/x-portable-graymap"],parse:async(e,t)=>ON(new Uint8Array(e),(t==null?void 0:t.pgm)||{}),extensions:["pgm"],options:{pgm:{cubic:!1}}};var M1=Lt(ru(),1);var eSe={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 H5t=()=>({wkid:{path:"wkid",default:4326},latestWkid:{path:"latestWkid",default:4326},vcsWkid:{path:"vcsWkid",default:5773},latestVcsWkid:{path:"latestVcsWkid",default:5773}}),W5t=()=>({heightModel:{path:"heightModel",default:"gravity_related_height"},vertCRS:{path:"vertCRS",default:"EGM96_Geoid"},heightUnit:{path:"heightUnit",default:"meter"}}),V5t=()=>({nodesPerPage:{path:"nodesPerPage"},lodSelectionMetricType:{path:"lodSelectionMetricType",default:"maxScreenThresholdSQ"}}),$5t=()=>({xmin:{path:"xmin"},ymin:{path:"ymin"},xmax:{path:"xmax"},ymax:{path:"ymax"},zmin:{path:"zmin"},zmax:{path:"zmax"}}),tSe=()=>({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,M1.default)(e,H5t())},capabilities:{path:"capabilities",default:["View","Query"]},store:{path:"store",transform:e=>(0,M1.default)(e,eSe)},fullExtent:{path:"fullExtent",transform:e=>(0,M1.default)(e,$5t())},heightModelInfo:{path:"heightModelInfo",transform:e=>(0,M1.default)(e,W5t())},nodePages:{path:"nodePages",transform:e=>(0,M1.default)(e,V5t())},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 IN=Lt(ru(),1),K5t=()=>({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}}}),J5t=()=>({"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}}}),rSe=()=>({geometryBuffers:{path:"geometryConfig",transform:e=>{let t=[(0,IN.default)(e,K5t())];return e.draco&&t.push((0,IN.default)({geometryConfig:e},J5t())),t}}});var h2=Lt(ru(),1),Y5t=()=>({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}}),X5t=()=>({name:{path:"name",default:"standard"},type:{path:"type",default:"standard"},params:{path:"params",transform:(e,t,r)=>(0,h2.default)(r,Y5t())}}),Q5t=()=>({id:{path:"id"},size:{path:"size"},href:{path:"href",default:["../textures/0"]},length:{path:"length"}}),Z5t=()=>({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,h2.default)(n,Q5t()))}}),nSe=()=>({materialDefinitions:{path:"materialDefinitionInfos",transform:eBt},textureDefinitions:{path:"textureDefinitionInfos",transform:tBt}});function eBt(e,t,r){let n={};for(let[i,a]of e.entries())n[`Mat${r.nodePath}${i}`]=(0,h2.default)(a,X5t());return n}function tBt(e,t,r){if(!e)return null;let n={};for(let[i,a]of e.entries()){let o=`${r.nodePath}${i}`;a.imageIndex=o,n[o]=(0,h2.default)(a,Z5t())}return n}var rBt=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 aSe(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 nBt(t,e),iBt(t,e),t}function nBt(e,t){var o;let r=aBt(t.parentNode.obb),n=oBt(t);if(sBt(r,n))return;let a=`OBB of Tile (${t.id}) doesn't fit into Parent (${(o=t.parentNode)==null?void 0:o.id}) tile OBB`;e.push(a)}function iBt(e,t){var a;let r=iSe(t.mbs),n=iSe(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 (${(a=t.parentNode)==null?void 0:a.id}) tile MBS`;e.push(o)}}function iSe(e){return new Oa([e[0],e[1],e[2]],e[3])}function aBt(e){let{center:t,halfSize:r,quaternion:n}=e;return new Ii().fromCenterHalfSizeQuaternion(t,r,n)}function oBt(e){let t=e.obb.halfSize,r=rBt,n=Zt.WGS84.cartographicToCartesian(e.obb.center),i=[];for(let a=0;a<r.length;a+=3){let s=new ce(r[a]*=t[0],r[a+1]*=t[1],r[a+2]*=t[2]).transformByQuaternion(e.obb.quaternion).add(n);i=i.concat(s)}return i}function sBt(e,t){let r=!0;for(let n=0;n<t.length/3;n+=3){let i=[t[n],t[n+1],t[n+2]],a=Zt.WGS84.cartesianToCartographic(i);if(e.distanceTo(a)>0){r=!1;break}}return r}var n4=class extends Array{enqueue(t){this.push(t)}dequeue(){return this.shift()}peek(){return this[0]}isEmpty(){return this.length===0}};var oSe=Lt(require("process"),1),uBt=4*1024*1024*1024,L1=class extends n4{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:i}=t,a=await i();n&&a&&(this.fileMap[n]=a)}else super.enqueue(t),oSe.default.memoryUsage().rss>uBt&&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 a=0;a<this.writeConcurrency;a++){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 i=await Promise.allSettled(t);this.updateFileMap(r,i),await this.conversionDump.updateConvertedTilesDump(n,i)}}updateFileMap(t,r){for(let n=0;n<t.length;n++){let i=t[n];i&&"value"in r[n]&&(this.fileMap[i]=r[n].value)}}};var q1="Tile converter does not work in browser, only in node js environment",Dp=".dump.json";var jN=require("path"),MN=Lt(ru(),1);var sSe=Lt(ru(),1),uSe=()=>({mbs:{path:"mbs"},obb:{path:"obb"}}),cBt=()=>({href:{path:"href"}}),lBt=()=>({id:{path:"id"},...cBt(),...uSe()}),RN=()=>({version:{path:"version"},id:{path:"id"},path:{path:"path"},level:{path:"level"},...uSe(),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,sSe.default)(e,lBt()),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 iu=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 i of t){let a=await i.load();r.push({id:i.id,href:`../${i.id}`,obb:a.obb,mbs:a.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 i=await n.load();if(i.neighbors=i.neighbors??[],Number((r=t==null?void 0:t.children)==null?void 0:r.length)<1e3)for(let a of t.children||[])n.id!==a.id&&i.neighbors.push({...a});else console.warn(`Node ${n.id}: neighbors attribute is omited because of large number of neigbors`),delete i.neighbors;this.converter.options.instantNodeWriting&&i&&await n.write(i),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,jN.join)(this.converter.layers0Path,"nodes",this.id);this.converter.options.slpk?await this.converter.writeQueue.enqueue({archiveKey:`nodes/${this.id}/3dNodeIndexDocument.json.gz`,writePromise:()=>yc(r,JSON.stringify(t),"3dNodeIndexDocument.json",!0,this.converter.compressList)},!0):await this.converter.writeQueue.enqueue({writePromise:()=>zn(r,JSON.stringify(t))},!0)}async load(){if(this.data)return this.data;let t=this.id,r=(0,jN.join)(this.converter.layers0Path,"nodes",t),n="index.json";return this.converter.options.slpk&&(n="3dNodeIndexDocument.json"),await P1(r,n)}flush(){this.data=null}static async createRootNode(t,r){let n=iu.createRootNodeIndexDocument(t);return await new iu(0,r).addData(n)}static async createNode({parentNode:t,boundingVolumes:r,lodSelection:n,nodeInPage:i,resources:a,converter:o}){let s=await iu.createNodeIndexDocument(t,r,n,i,a);return await new iu(i.index,o).addData(s)}static createRootNodeIndexDocument(t){let r={version:`{${bc().toUpperCase()}}`,id:"root",level:0,lodSelection:[{metricType:"maxScreenThresholdSQ",maxError:0},{metricType:"maxScreenThreshold",maxError:0}],...t,children:[]};return(0,MN.default)(r,RN())}static async createNodeIndexDocument(t,r,n,i,a){var l,f,p,d,h;let o=i.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,MN.default)(u,RN());if(i.mesh&&(c.geometryData=[{href:"./geometries/0"}],c.sharedResource={href:"./shared"},("texture"in a&&a.texture||"texelCountHint"in a&&a.texelCountHint)&&(c.textureData=[{href:"./textures/0"},{href:"./textures/1"}]),"attributes"in a&&a.attributes&&a.attributes.length&&((f=(l=t.converter.layers0)==null?void 0:l.attributeStorageInfo)!=null&&f.length)||"attributesCount"in a&&a.attributesCount&&((d=(p=t.converter.layers0)==null?void 0:p.attributeStorageInfo)!=null&&d.length))){let v=("attributes"in a?(h=a.attributes)==null?void 0:h.length:a.attributesCount)||0;c.attributeData=[];let m=v<t.converter.layers0.attributeStorageInfo.length?v:t.converter.layers0.attributeStorageInfo.length;for(let b=0;b<m;b++){let _=t.converter.layers0.attributeStorageInfo[b].key;c.attributeData.push({href:`./attributes/${_}/0`})}}return c}};var LN=async(e,t,r)=>{let n=m2(t);if(!e||!t.contentUrl||!n)return;let i={...r,[e.loader.id]:{isTileset:n,assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}},a=await i4(t.contentUrl,e.loader,i);a.root&&(t.children=[a.root])},qN=async(e,t,r)=>{let n=m2(t);if(!e||!t.contentUrl||n)return null;let i={...r,[e.loader.id]:{...r[e.loader.id]||{},isTileset:n,assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}};return await i4(t.contentUrl,e.loader,i)};async function i4(e,t,r){let n=e.split(".3tz"),i;if(n.length===1)i=null;else if(n.length===2)i=n[1].slice(1),i===""&&(i="tileset.json");else throw new Error("Unexpected URL format");if(i){let a=`${n[0]}.3tz`,o=new vo(a),s=await fBt(o),u=new o2(o,s,a),c=new Ol(u),l=await fn(i,t,{...r,fetch:c.fetch.bind(c)});return await c.destroy(),l}return await fn(e,t,r)}function m2(e){return(e==null?void 0:e.type)==="json"||(e==null?void 0:e.type)==="3tz"}async function fBt(e){let t,r=await wh(e,Ah),n=await Eh(r,e);if((n==null?void 0:n.fileName)==="@3dtilesIndex1@"){let i=await tu(n.localHeaderOffset,e);if(!i)throw new Error("corrupted 3tz");let a=i.fileDataOffset,o=await e.slice(a,a+i.compressedSize);t=i2(o)}return t}var a4=async({tile:e,traversalProps:t,processTile:r,postprocessTile:n,maxDepth:i,level:a=0})=>{if(i&&a>i)return;let o=[],s=await r(e,t);o.push(s);for(let u of e.children)await a4({tile:u,traversalProps:s,processTile:r,postprocessTile:n,maxDepth:i,level:a+1});n&&await n(o,t)};var pBt=["POINTS","LINES","LINE_LOOP","LINE_STRIP","TRIANGLES","TRIANGLE_STRIP","TRIANGLE_FAN"],cSe=async e=>{let t={meshTopologyTypes:new Set,metadataClasses:new Set};if(!(e!=null&&e.gltfArrayBuffer))return t;let n=(await bo(e.gltfArrayBuffer,ml,{gltf:{normalize:!1,loadBuffers:!1,loadImages:!1,decompressMeshes:!1}})).json;if(!n)return t;let i=dBt(n),a=hBt(n);return{meshTopologyTypes:i,metadataClasses:a}},dBt=e=>{let t=new Set;for(let r of e.meshes||[])for(let n of r.primitives){let{mode:i}=n;typeof i!="number"&&(i=4),t.add(pBt[i])}return t},hBt=e=>{var i,a,o,s,u,c;let t=new Set,r=(o=(a=(i=e.extensions)==null?void 0:i[Zo])==null?void 0:a.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[hl])==null?void 0:u.schema)==null?void 0:c.classes;if(n)for(let l of Object.keys(n))t.add(l);return t},lSe=(e,t)=>{for(let r of t.meshTopologyTypes)e.meshTopologyTypes.add(r);for(let r of t.metadataClasses)e.metadataClasses.add(r)};var fSe=Lt(require("process"),1);var mBt=.2,N1=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||fSe.default.hrtime.bigint,this.threshold=t.threshold||mBt}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?I1(t.timeRemaining):""}isVelocityTrust(t,r){return r?Math.abs((t-r)/r)<this.threshold:!1}getCurrentTimeInMilliSeconds(){return Number(this.getTime()/BigInt(1e6))}};var D6e=require("util");var jp=require("path"),k6e=Lt(require("process"),1),F6e=Lt(T6e(),1);var C6e={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 Mh=class{restored=!1;options;tilesConverted;textureSetDefinitions;attributeMetadataInfo;materialDefinitions;constructor(){this.tilesConverted={}}async createDump(t){let{tilesetName:r,slpk:n,egmFilePath:i,inputUrl:a,outputPath:o,draco:s=!0,maxDepth:u,token:c,generateTextures:l,generateBoundingVolumes:f,mergeMaterials:p=!0,metadataClass:d,analyze:h=!1}=t;this.options={tilesetName:r,slpk:n,egmFilePath:i,inputUrl:a,outputPath:o,draco:s,maxDepth:u,token:c,generateTextures:l,generateBoundingVolumes:f,mergeMaterials:p,metadataClass:d,analyze:h};let v=(0,jp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Dp}`);if(await u2(v))try{let m=await P1((0,jp.join)(this.options.outputPath,this.options.tilesetName),`${this.options.tilesetName}${Dp}`),{options:b,tilesConverted:_,textureSetDefinitions:E,attributeMetadataInfo:T,materialDefinitions:S}=m;if(new F6e.default().compile(C6e)(m)&&(0,D6e.isDeepStrictEqual)(b,JSON.parse(JSON.stringify(this.options)))){this.tilesConverted=_,this.textureSetDefinitions=E,this.attributeMetadataInfo=T,this.materialDefinitions=S,this.restored=!0;return}}catch(m){console.log("Can't open dump file",m)}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=k6e.default.hrtime();await zn((0,jp.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}${Dp}.${r[0]}.${r[1]}`),await EAe((0,jp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Dp}.${r[0]}.${r[1]}`),(0,jp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Dp}`))}catch(r){console.log("Can't update dump file",r)}}async deleteDumpFile(){var t;(t=this.options)!=null&&t.outputPath&&this.options.tilesetName&&await u2((0,jp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Dp}`))&&await l2((0,jp.join)(this.options.outputPath,this.options.tilesetName,`${this.options.tilesetName}${Dp}`))}getRecord(t){return this.tilesConverted[t]}setRecord(t,r){this.tilesConverted[t]=r}async addNode(t,r,n){let{nodes:i}=this.getRecord(t)||{nodes:[]};i.push({nodeId:r,done:!1,dumpMetadata:n}),i.length===1&&this.setRecord(t,{nodes:i}),await this.updateDumpFile()}clearDumpRecord(t){this.setRecord(t,{nodes:[]})}addTexturesDefinitions(t){this.textureSetDefinitions=t}updateDoneStatus(t,r,n,i){var o;let a=(o=this.tilesConverted[t])==null?void 0:o.nodes.find(s=>s.nodeId===r);a&&(a.progress||(a.progress={}),a.progress[n]=i,i||(a.done=!1))}async updateConvertedTilesDump(t,r){for(let n=0;n<t.length;n++)if(t[n]&&"value"in r[n]){let{sourceId:i,resourceType:a,outputId:o}=t[n];this.updateNodes(i,o,a)}await this.updateDumpFile()}updateNodes(t,r,n){if(!(!t||!n||!r)){for(let i of this.tilesConverted[t].nodes)if(i.nodeId===r&&i.progress){i.progress[n]=!0;let a=!1;for(let o in i.progress)if(a=i.progress[o],!a)break;i.done=a,i.done&&delete i.progress;break}}}async updateConvertedNodesDumpFile(t,r,n){var a;let i=(a=this.tilesConverted[t])==null?void 0:a.nodes.find(o=>o.nodeId===r);i&&(i.done=n,await this.updateDumpFile())}isFileConversionComplete(t){var n,i,a;let r=!0;for(let o of((n=this.tilesConverted[t])==null?void 0:n.nodes)||[])if(!o.done){r=!1;break}return r&&((a=(i=this.tilesConverted[t])==null?void 0:i.nodes)==null?void 0:a.length)>0}setMaterialsDefinitions(t){this.materialDefinitions=t}};var P6e,lRt=(P6e=Lh.default.env)==null?void 0:P6e.IonToken,B6e=64,fRt="3DTILES",pRt="3DObject",dRt=1800,hRt="https://",Mp="phase1-count",Z1=class{attributeMetadataInfo;nodePages;options;layers0Path;materialMap;materialDefinitions;geometryMap;geometryConfigs;vertexCounter;layers0;featuresHashArray;refinementCounter;validate;boundingVolumeWarnings=[];conversionStartTime=[0,0];refreshTokenTime=[0,0];sourceTileset=null;loadOptions={_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"},fetch:{},modules:{}};geoidHeightModel=null;Loader=lc;generateTextures;generateBoundingVolumes;layersHasTexture;workerSource={};writeQueue=new L1(new Mh);compressList=null;preprocessData={meshTopologyTypes:new Set,metadataClasses:new Set};progresses={};conversionDump;constructor(){this.attributeMetadataInfo=new bT,this.nodePages=new ra(zn,B6e,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 Mh}async convert(t){if(jr)return console.log(q1),q1;this.conversionStartTime=Lh.default.hrtime();let{tilesetName:r,slpk:n,egmFilePath:i,inputUrl:a,validate:o,outputPath:s,draco:u=!0,sevenZipExe:c,maxDepth:l,token:f,generateTextures:p,generateBoundingVolumes:d,instantNodeWriting:h=!1,mergeMaterials:v=!0,inquirer:m,metadataClass:b,analyze:_=!1}=t;this.options={outputPath:s,tilesetName:r,maxDepth:l,slpk:n,sevenZipExe:c,egmFilePath:i,draco:u,token:f,inputUrl:a,instantNodeWriting:h,mergeMaterials:v,inquirer:m,metadataClass:b},this.progresses[Mp]=new N1,this.compressList=this.options.instantNodeWriting&&[]||null,this.validate=Boolean(o),this.Loader=a.indexOf(hRt)!==-1?Q8:lc,this.generateTextures=Boolean(p),this.generateBoundingVolumes=Boolean(d),this.writeQueue=new L1(this.conversionDump),this.writeQueue.startListening(),console.log("Loading egm file..."),this.geoidHeightModel=await fn(i,r4),console.log("Loading egm file completed!"),n&&this.nodePages.useWriteFunction(yc);try{let E=await this._fetchPreloadOptions(),T=a;E.url&&(T=E.url),E.headers&&(this.loadOptions.fetch={headers:E.headers}),this.sourceTileset=await i4(T,this.Loader,this.loadOptions),(this.Loader===lc||_?await this.preprocessConversion():!0)&&!_&&await this.selectMetadataClass()&&(await this._createAndSaveTileset(s,r),await this._finishConversion({slpk:Boolean(n),outputPath:s,tilesetName:r}))}catch(E){throw E}finally{await this.writeQueue.finalize(),xa.getWorkerFarm({}).destroy()}return"success"}async preprocessConversion(){console.log("Analyze source tileset");let t=this.sourceTileset.root;await a4({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[Mp].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(m2(t))return await LN(this.sourceTileset,t,this.loadOptions),null;t.id&&(this.progresses[Mp].stepsTotal+=1,console.log(`[analyze]: ${t.id}`));let i=null;try{i=await qN(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 a=await cSe(i);return lSe(this.preprocessData,a),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,oa.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,oa.join)(n,"SceneServer","layers","0");let i=this.conversionDump.restored?(0,oa.join)(this.layers0Path,"nodepages"):n;try{await c2(i)}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,L4.default)(JSON.stringify(this.conversionDump.materialDefinitions[p]));this.materialMap.set(d,p)}this.materialDefinitions=this.conversionDump.materialDefinitions}let a=this.sourceTileset.root,o=Yb(a.boundingVolume,new zr(a.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=ZC(o,this.geoidHeightModel);await this.nodePages.push({index:0,lodThreshold:0,obb:s.obb,children:[]}),this.progresses[Mp].startMonitoring();let u=await iu.createRootNode(s,this);await a4({tile:a,traversalProps:{transform:new zr(a.transform),parentNodes:[u]},processTile:this.convertTile.bind(this),postprocessTile:this.finalizeTile.bind(this),maxDepth:this.options.maxDepth}),this.progresses[Mp].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=pRt),this.conversionDump.restored&&this.conversionDump.textureSetDefinitions&&(this.layers0.textureSetDefinitions=this.conversionDump.textureSetDefinitions),this.layers0.materialDefinitions=this.materialDefinitions,this.layers0.geometryDefinitions=(0,M4.default)(this.geometryConfigs.map(p=>({geometryConfig:{...p,draco:this.options.draco}})),rSe()),this.layersHasTexture===!1&&(this.layers0.store.defaultGeometrySchema.ordering=this.layers0.store.defaultGeometrySchema.ordering.filter(p=>p!=="uv0")),await this._writeLayers0(),YAe(r,this.layers0,n);for(let p of this.compressList||[])await YC(p),await l2(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 i=BAe(r);n&&(i.zmin=n[4],i.zmax=n[5]);let a=[i.xmin,i.ymin,i.xmax,i.ymax],o={version:`{${bc().toUpperCase()}}`,id:0,name:t,href:"./layers/0",store:{id:`{${bc().toUpperCase()}}`,extent:a},nodePages:{nodesPerPage:B6e},compressGeometry:this.options.draco,fullExtent:i};this.layers0=(0,M4.default)(o,tSe())}async _writeLayers0(){this.options.slpk?await this.writeQueue.enqueue({archiveKey:"3dSceneLayer.json.gz",writePromise:()=>yc(this.layers0Path,JSON.stringify(this.layers0),"3dSceneLayer.json")}):await this.writeQueue.enqueue({writePromise:()=>zn(this.layers0Path,JSON.stringify(this.layers0))})}async _createSlpk(t){if(await this.conversionDump.deleteDumpFile(),this.options.slpk){let r=(0,oa.join)(t,"SceneServer","layers","0"),n=`${t}.slpk`;await xN(r,n,async i=>({path:"@specialIndexFileHASH128@",file:await a2(i)}));try{await c2(t)}catch{}}}async convertTile(t,r){let n=m2(t);if(n||t.type==="empty")return n&&(t.id&&console.log(`[load]: ${t.id}`),await LN(this.sourceTileset,t,this.loadOptions)),r;t.id&&console.log(`[convert]: ${t.id}`);let{parentNodes:i,transform:a}=r,o=a.clone();t.transform&&(o=o.multiplyRight(t.transform));let s=i[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[Mp].stepsDone+=1;let f="Calculating time left...",p=this.progresses[Mp].getTimeRemainingString();p&&(f=`${p} left`);let d=this.progresses[Mp].getPercentString(),h=d?` ${d}%, ${f}`:"";console.log(`[converted${h}]: ${t.id}`)}return l}async finalizeTile(t,r){for(let n of t)for(let i of n.parentNodes)await i.addNeighbors();for(let n of r.parentNodes)await n.save()}async _generateNodeIndexDocument(t,r,n,i,a){this.layersHasTexture=this.layersHasTexture||Boolean("texture"in r&&r.texture||"texelCountHint"in r&&r.texelCountHint),this.generateBoundingVolumes&&r.boundingVolumes&&(t=r.boundingVolumes);let o=XAe(i,t),s=o.find(f=>f.metricType==="maxScreenThresholdSQ")||{maxError:0};if(a){let f={center:[],halfSize:[],quaternion:[]};await this.nodePages.push({index:0,obb:f},n.inPageId)}let u=await this._updateNodeInNodePages(s,t,i,n.inPageId,r),c=await iu.createNodeIndexDocument(n,t,o,u,r);return{node:await new iu(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 i=Yb(r.boundingVolume,n,null),a=ZC(i,this.geoidHeightModel),o=[];for(let s of this.conversionDump.tilesConverted[r.id].nodes){let{node:u}=await this._generateNodeIndexDocument(a,{...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 i=null;try{i=await qN(this.sourceTileset,r,this.loadOptions)}catch{console.log(`[warning]: Failed to load ${r.contentUrl}`)}let a=Yb(r.boundingVolume,n,null),o=ZC(a,this.geoidHeightModel),s=VAe(i,this.options.metadataClass);this.createAttributeStorageInfo(i,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:a,tileContent:i,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:v,nodeInPage:m,nodeData:b}=await this._generateNodeIndexDocument(o,h,t,r,!1);if(c.push(v),m.mesh){if(r.id){let _={boundingVolumes:h.boundingVolumes,attributesCount:(d=h.attributes)==null?void 0:d.length,featureCount:h.featureCount,geometry:Boolean(h.geometry),hasUvRegions:h.hasUvRegions,materialId:m.mesh.material.definition,texelCountHint:m.mesh.material.texelCountHint,vertexCount:h.vertexCount};this.conversionDump.setMaterialsDefinitions(this.materialDefinitions),await this.conversionDump.addNode(r.id,m.index,_)}await this._writeResources(h,v.id,r)}this.validate&&(this.boundingVolumeWarnings=aSe(b),this.boundingVolumeWarnings&&this.boundingVolumeWarnings.length&&console.warn("Bounding Volume Warnings: ",...this.boundingVolumeWarnings)),l.push(m.index),f.push(m)}return c}async _convertResources({sourceTile:t,transformationMatrix:r,boundingVolume:n,tileContent:i,parentId:a,propertyTable:o}){if(!this.isContentSupported(t)||!i)return null;let s={center:[],halfSize:[],quaternion:[]};return await kN({tileContent:i,tileTransform:r,tileBoundingVolume:n,addNodeToNodePage:async()=>(await this.nodePages.push({index:0,obb:s},a)).index,propertyTable:o,featuresHashArray:this.featuresHashArray,attributeStorageInfo:this.attributeMetadataInfo.attributeStorageInfo,draco:this.options.draco,generateBoundingVolumes:this.generateBoundingVolumes,shouldMergeMaterials:this.options.mergeMaterials,geoidHeightModel:this.geoidHeightModel,libraries:this.loadOptions.modules,metadataClass:this.options.metadataClass})}async _updateNodeInNodePages(t,r,n,i,a){let{vertexCount:o,featureCount:s,geometry:u,hasUvRegions:c}=a,l={index:0,lodThreshold:t.maxError,obb:r.obb,children:[]};u&&this.isContentSupported(n)&&(l.mesh={geometry:{definition:this.findOrCreateGeometryDefinition(Boolean("texture"in a&&a.texture||"texelCountHint"in a&&a.texelCountHint),c),resource:0},attribute:{resource:0},material:{definition:0}});let f="nodeId"in a?a.nodeId:void 0,p;if(f?p=await this.nodePages.getNodeById(f):p=await this.nodePages.push(l,i),l.mesh||console.log(`[warning]: node ${p.index} is created with empty content`),ra.updateAll(p,l),"meshMaterial"in a&&a.meshMaterial?ra.updateMaterialByNodeId(p,this._findOrCreateMaterial(a.meshMaterial)):"materialId"in a&&a.materialId!==null&&ra.updateMaterialByNodeId(p,a.materialId),"texture"in a&&a.texture){let d=a.texture.image.height*a.texture.image.width;ra.updateTexelCountHintByNodeId(p,d)}else"texelCountHint"in a&&a.texelCountHint&&ra.updateTexelCountHintByNodeId(p,a.texelCountHint);return o&&(this.vertexCounter+=o,ra.updateVertexCountByNodeId(p,o)),ra.updateNodeAttributeByNodeId(p),s&&ra.updateFeatureCountByNodeId(p,s),this.nodePages.saveNode(p),p}async _writeResources(t,r,n){let{geometry:i,compressedGeometry:a,texture:o,sharedResources:s,attributes:u}=t,c=(0,oa.join)(this.layers0Path,"nodes",r),l=(0,oa.join)("nodes",r);await this._writeGeometries({geometryBuffer:i,compressedGeometry:a,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:i,sourceId:a,nodeId:o}){if(t){if(this.conversionDump.updateDoneStatus(a,o,"GEOMETRY",!1),this.options.slpk){let s=(0,oa.join)(n,"geometries");await this.writeQueue.enqueue({archiveKey:`${i}/geometries/0.bin.gz`,sourceId:a,outputId:o,resourceType:"GEOMETRY",writePromise:()=>yc(s,t,"0.bin")})}else{let s=(0,oa.join)(n,"geometries/0/");await this.writeQueue.enqueue({sourceId:a,outputId:o,resourceType:"GEOMETRY",writePromise:()=>zn(s,t,"index.bin")})}if(this.options.draco&&r)if(this.conversionDump.updateDoneStatus(a,o,"DRACO_GEOMETRY",!1),this.options.slpk){let s=(0,oa.join)(n,"geometries");await this.writeQueue.enqueue({archiveKey:`${i}/geometries/1.bin.gz`,sourceId:a,outputId:o,resourceType:"DRACO_GEOMETRY",writePromise:()=>yc(s,r,"1.bin")})}else{let s=(0,oa.join)(n,"geometries/1/");await this.writeQueue.enqueue({sourceId:a,outputId:o,resourceType:"DRACO_GEOMETRY",writePromise:()=>zn(s,r,"index.bin")})}}}async _writeShared({sharedResources:t,childPath:r,slpkChildPath:n,nodePath:i,sourceId:a,nodeId:o}){if(!t)return;t.nodePath=i;let s=(0,M4.default)(t,nSe()),u=JSON.stringify(s);if(this.conversionDump.updateDoneStatus(a,o,"SHARED",!1),this.options.slpk){let c=(0,oa.join)(r,"shared");await this.writeQueue.enqueue({archiveKey:`${n}/shared/sharedResource.json.gz`,sourceId:a,outputId:o,resourceType:"SHARED",writePromise:()=>yc(c,u,"sharedResource.json")})}else{let c=(0,oa.join)(r,"shared/");await this.writeQueue.enqueue({sourceId:a,outputId:o,resourceType:"SHARED",writePromise:()=>zn(c,u)})}}async _writeTexture(t,r,n,i,a){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(i,a,`${"TEXTURE"}/${o}`,!1),await this.writeTextureFile({textureData:u,name:"0",format:o,childPath:r,slpkChildPath:n,sourceId:i,nodeId:a}),this.generateTextures){s.push({name:"1",format:"ktx2"});let c=t.image.data.subarray(),l=new Uint8Array(c),f=yg({...t.image,data:l},OL,{...OL.options,["ktx2-basis-writer"]:{workerUrl:"./modules/textures/dist/ktx2-basis-writer-worker-node.js"},reuseWorkers:!0,_nodeWorkers:!0,useLocalLibraries:!0});this.conversionDump.updateDoneStatus(i,a,`${"TEXTURE"}/ktx2`,!1),await this.writeTextureFile({textureData:f,name:"1",format:"ktx2",childPath:r,slpkChildPath:n,sourceId:i,nodeId:a})}break}case"ktx2":{if(s.push({name:"1",format:o}),this.conversionDump.updateDoneStatus(i,a,`${"TEXTURE"}/${o}`,!1),await this.writeTextureFile({textureData:u,name:"1",format:o,childPath:r,slpkChildPath:n,sourceId:i,nodeId:a}),this.generateTextures){s.push({name:"0",format:"jpg"});let c=yg(t.image.data[0],vL);this.conversionDump.updateDoneStatus(i,a,`${"TEXTURE"}/jpg`,!1),await this.writeTextureFile({textureData:c,name:"0",format:"jpg",childPath:r,slpkChildPath:n,sourceId:i,nodeId:a})}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:i,slpkChildPath:a,sourceId:o,nodeId:s}){if(this.options.slpk){let u=(0,oa.join)(i,"textures"),c=!1;await this.writeQueue.enqueue({archiveKey:`${a}/textures/${r}.${n}`,sourceId:o,outputId:s,resourceType:`${"TEXTURE"}/${n}`,writePromise:()=>yc(u,t,`${r}.${n}`,c)})}else{let u=(0,oa.join)(i,`textures/${r}/`);await this.writeQueue.enqueue({sourceId:o,outputId:s,resourceType:`${"TEXTURE"}/${n}`,writePromise:()=>zn(u,t,`index.${n}`)})}}async _writeAttributes(t=[],r,n,i,a){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]);if(this.conversionDump.updateDoneStatus(i,a,`${"ATTRIBUTES"}/${u}`,!1),this.options.slpk){let l=(0,oa.join)(r,"attributes",u);await this.writeQueue.enqueue({archiveKey:`${n}/attributes/${u}.bin.gz`,sourceId:i,outputId:a,resourceType:`${"ATTRIBUTES"}/${u}`,writePromise:()=>yc(l,c,"0.bin")})}else{let l=(0,oa.join)(r,`attributes/${u}/0`);await this.writeQueue.enqueue({sourceId:i,outputId:a,resourceType:`${"ATTRIBUTES"}/${u}`,writePromise:()=>zn(l,c,"index.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,L4.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},i=(0,L4.default)(JSON.stringify(n));if(this.geometryMap.has(i))return this.geometryMap.get(i)||0;let a=this.geometryConfigs.push(n)-1;return this.geometryMap.set(i,a),a}createAttributeStorageInfo(t,r){let n=null;this.options.metadataClass?!this.attributeMetadataInfo.attributeStorageInfo.length&&(t!=null&&t.gltf)&&(n=qAe(t.gltf,this.options.metadataClass)):r&&(n=LAe(r)),n&&this.attributeMetadataInfo.addMetadataInfo(n)}async _finishConversion(t){let{tilesCount:r,tilesWithAddRefineCount:n}=this.refinementCounter,i=n?n/r*100:0,a=await QC(t),o=Lh.default.hrtime(this.conversionStartTime),s=I1(o);console.log("------------------------------------------------"),console.log(`Finishing conversion of ${fRt}`),console.log(`Total conversion time: ${s}`),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",a," bytes"),console.log('Percentage of tiles with "ADD" refinement type:',i,"%"),console.log("------------------------------------------------")}async _fetchPreloadOptions(){if(!this.Loader.preload)return{};let t={"cesium-ion":{accessToken:this.options.token||lRt}},r=await this.Loader.preload(this.options.inputUrl,t);return this.refreshTokenTime=Lh.default.hrtime(),{...t,...r}}async _updateTilesetOptions(){if(Lh.default.hrtime(this.refreshTokenTime)[0]<dRt)return;this.refreshTokenTime=Lh.default.hrtime();let r=await this._fetchPreloadOptions();r.headers&&(this.loadOptions.fetch={...this.loadOptions.fetch,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 iTe=require("path"),wG=Lt(require("process"),1),aTe=Lt(ru(),1);function vG(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 O6e={UInt8:Tt.UNSIGNED_BYTE,UInt16:Tt.UNSIGNED_SHORT,Float32:Tt.FLOAT,UInt32:Tt.UNSIGNED_INT,UInt64:Tt.DOUBLE};function ev(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 I6e="String",R6e="Oid32",j6e="Float64",M6e="Int16";function q4(e){let t;try{let r=new URL(e);t=`${r.origin}${r.pathname}`}catch{}return t||e}function tv(e,t=null){return t?`${e}?token=${t}`:e}function L6e(e,t){let{attributeData:r=[]}=t,n=[];for(let i=0;i<r.length;i++){let a=r[i].href.replace("./","");n.push(`${e}/${a}`)}return n}function q6e(e,t,r){let n=[],{attributeStorageInfo:i=[]}=e;for(let a=0;a<i.length;a++){let o=i[a].key;n.push(`${t}/nodes/${r}/attributes/${o}/0`)}return n}var N4=new ce([0,0,0]);function gRt(e){switch(e){case"ktx-etc2":case"dds":return C8;case"ktx2":return th;case"jpg":case"png":default:return Ng}}var vRt="i3s-attribute-type";async function z6e(e,t,r,n,i){var o;let a={attributes:{},indices:null,featureIds:[],vertexCount:0,modelMatrix:new zr,coordinateSystem:0,byteLength:0,texture:null};if(t.textureUrl){let s=tv(t.textureUrl,(o=n==null?void 0:n.i3s)==null?void 0:o.token),u=gRt(t.textureFormat),f=await(await((i==null?void 0:i.fetch)||fetch)(s)).arrayBuffer();if(n!=null&&n.i3s.decodeTextures){if(u===Ng){let p={...t.textureLoaderOptions,image:{type:"data"}};try{let d=await ho(f,[],p,i);a.texture=d}catch{let h=await bo(f,u,p,i);a.texture=h}}else if(u===C8||u===th){let p=await fn(f,u,t.textureLoaderOptions);u===th&&(p=p[0]),a.texture={compressed:!0,mipmaps:!1,width:p[0].width,height:p[0].height,data:p}}}else a.texture=f}return a.material=TRt(t.materialDefinition,a.texture),a.material&&(a.texture=null),await xRt(e,a,t,r,n)}async function xRt(e,t,r,n,i){var f,p;let a=e.byteLength,o,s,u=0,c=0,l;if(r.isDracoGeometry){let d=await bo(e,Dg,{draco:{attributeNameEntry:vRt}});s=d.header.vertexCount,l=(f=d.indices)==null?void 0:f.value;let{POSITION:h,NORMAL:v,COLOR_0:m,TEXCOORD_0:b,["feature-index"]:_,["uv-region"]:E}=d.attributes;o={position:h,normal:v,color:m,uv0:b,uvRegion:E,id:_},bRt(o,d);let T=FRt(_);T&&kRt(o,T)}else{let{vertexAttributes:d,ordering:h,featureAttributes:v,featureAttributeOrder:m}=n.store.defaultGeometrySchema,b=_Rt(e,n);u=b.byteOffset,s=b.vertexCount,c=b.featureCount;let{attributes:_,byteOffset:E}=U6e(e,u,d,s,h),{attributes:T}=U6e(e,E,v,c,m);DRt(T),o=yRt(_,T)}if(!((p=i==null?void 0:i.i3s)!=null&&p.coordinateSystem)||i.i3s.coordinateSystem===2){let d=ERt(o.position,r);t.modelMatrix=d.invert(),t.coordinateSystem=2}else t.modelMatrix=SRt(o.position),t.coordinateSystem=3;t.attributes={positions:o.position,normals:o.normal,colors:N6e(o.color),texCoords:o.uv0,uvRegions:N6e(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=a,t}function bRt(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 yRt(e,t){return{...e,...t}}function N6e(e){return e&&(e.normalized=!0,e)}function _Rt(e,t){let r=0,n=0,i=0;for(let{property:a,type:o}of t.store.defaultGeometrySchema.header){let s=vG(o);switch(a){case"vertexCount".toString():n=new s(e,0,4)[0],r+=ev(o);break;case"featureCount".toString():i=new s(e,4,4)[0],r+=ev(o);break;default:break}}return{vertexCount:n,featureCount:i,byteOffset:r}}function U6e(e,t,r,n,i){let a={};for(let o of i)if(r[o]){let{valueType:s,valuesPerElement:u}=r[o];if(t+n*u*ev(s)<=e.byteLength){let c=e.slice(t),l;if(s==="UInt64")l=wRt(c,n*u,ev(s));else{let f=vG(s);l=new f(c,0,n*u)}switch(a[o]={value:l,type:O6e[s],size:u},o){case"color":a.color.normalized=!0;break;case"position":case"region":case"normal":default:}t=t+n*u*ev(s)}else if(o!=="uv0")break}return{attributes:a,byteOffset:t}}function wRt(e,t,r){let n=[],i=new DataView(e),a=0;for(let o=0;o<t;o++){let s=i.getUint32(a,!0),u=i.getUint32(a+4,!0),c=s+2**32*u;n.push(c),a+=r}return new Uint32Array(n)}function ERt(e,t){let r=t.mbs,n=e.value,i=e.metadata,a=new zr,o=new ce(r[0],r[1],r[2]),s=new ce;return Zt.WGS84.cartographicToCartesian(o,s),Zt.WGS84.eastNorthUpToFixedFrame(s,a),e.value=ARt(n,i,o),a}function ARt(e,t={},r){let n=new Float64Array(e.length),i=t["i3s-scale_x"]&&t["i3s-scale_x"].double||1,a=t["i3s-scale_y"]&&t["i3s-scale_y"].double||1;for(let o=0;o<n.length;o+=3)n[o]=e[o]*i+r.x,n[o+1]=e[o+1]*a+r.y,n[o+2]=e[o+2]+r.z;for(let o=0;o<n.length;o+=3)Zt.WGS84.cartographicToCartesian(n.subarray(o,o+3),N4),n[o]=N4.x,n[o+1]=N4.y,n[o+2]=N4.z;return n}function SRt(e){var a,o;let t=e.metadata,r=((a=t==null?void 0:t["i3s-scale_x"])==null?void 0:a.double)||1,n=((o=t==null?void 0:t["i3s-scale_y"])==null?void 0:o.double)||1,i=new zr;return i[0]=r,i[5]=n,i}function TRt(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=G6e(r.emissiveFactor)),r.pbrMetallicRoughness&&r.pbrMetallicRoughness.baseColorFactor&&(r.pbrMetallicRoughness.baseColorFactor=G6e(r.pbrMetallicRoughness.baseColorFactor)),t&&CRt(r,t),r}function G6e(e){let t=[...e];for(let r=0;r<e.length;r++)t[r]=e[r]/255;return t}function CRt(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 DRt(e){let{id:t,faceRange:r}=e;if(!t||!r)return;let n=t.value,i=r.value,a=i[i.length-1]+1,o=new Uint32Array(a*3),s=0,u=0;for(let c=1;c<i.length;c+=2){let l=Number(n[s]),f=i[c],p=i[c-1],d=f-p+1,h=u+d*3;o.fill(l,u,h),s++,u=h}e.id.value=o}function kRt(e,t){let r=e.id.value,n=new Float32Array(r.length);for(let i=0;i<r.length;i++)n[i]=t[r[i]];e.id.value=n}function FRt(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 BRt="4.2.0-beta.2",H6e={dataType:null,batchType:null,name:"I3S Content (Indexed Scene Layers)",id:"i3s-content",module:"i3s",worker:!0,version:BRt,mimeTypes:["application/octet-stream"],parse:PRt,extensions:["bin"],options:{"i3s-content":{}}};async function PRt(e,t,r){let{tile:n,_tileOptions:i,tileset:a,_tilesetOptions:o}=(t==null?void 0:t.i3s)||{},s=i||n,u=o||a;return!s||!u?null:await z6e(e,s,u,t,r)}var ORt="4.2.0-beta.2",W6e={dataType:null,batchType:null,name:"I3S Node Page",id:"i3s-node-page",module:"i3s",version:ORt,mimeTypes:["application/json"],parse:IRt,extensions:["json"],options:{i3s:{}}};async function IRt(e,t){return JSON.parse(new TextDecoder().decode(e))}var H2=class{tileset;nodePages=[];pendingNodePages=[];nodesPerPage;options;lodSelectionMetricType;textureDefinitionsSelectedFormats=[];nodesInNodePages;url;textureLoaderOptions={};constructor(t,r="",n){var i,a;this.tileset={...t},this.url=r,this.nodesPerPage=((i=t.nodePages)==null?void 0:i.nodesPerPage)||64,this.lodSelectionMetricType=(a=t.nodePages)==null?void 0:a.lodSelectionMetricType,this.options=n,this.nodesInNodePages=0,this.initSelectedFormatsForTextureDefinitions(t)}async getNodeById(t){var i;let r=Math.floor(t/this.nodesPerPage);if(!this.nodePages[r]&&!this.pendingNodePages[r]){let a=tv(`${this.url}/nodepages/${r}`,(i=this.options.i3s)==null?void 0:i.token);this.pendingNodePages[r]={status:"Pending",promise:fn(a,W6e,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=[],i=[];for(let d of r.children||[])i.push(this.getNodeById(d));let a=await Promise.all(i);for(let d of a)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:v,materialDefinition:m}=this.getInformationFromMaterial(r.mesh.material);u=m,c=v.format||c,v.name&&(s=`${this.url}/nodes/${r.mesh.material.resource}/textures/${v.name}`),this.tileset.attributeStorageInfo&&(l=q6e(this.tileset,this.url,r.mesh.attribute.resource))}let p=this.getLodSelection(r);return xG({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],i=-1;if(this.options.i3s&&this.options.i3s.useDracoGeometry&&(i=n.geometryBuffers.findIndex(a=>a.compressedAttributes&&a.compressedAttributes.encoding==="draco")),i===-1&&(i=n.geometryBuffers.findIndex(a=>!a.compressedAttributes)),i!==-1){let a=Boolean(n.geometryBuffers[i].compressedAttributes);r={url:`${this.url}/nodes/${t.resource}/geometries/${i}`,isDracoGeometry:a}}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,i,a;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=(a=(i=o==null?void 0:o.pbrMetallicRoughness)==null?void 0:i.baseColorTexture)==null?void 0:a.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 i of n){let a=i&&i.formats||[],o=null;for(let s of r){let u=a.find(c=>c.format===s);if(u){o=u;break}}o&&o.format==="ktx2"&&(this.textureLoaderOptions.basis={format:Kg(),containerFormat:"ktx2",module:"encoder"}),this.textureDefinitionsSelectedFormats.push(o)}}getSupportedTextureFormats(){let t=[];if(!this.options.i3s||this.options.i3s.useCompressedTextures){let r=uy();r.has("etc2")&&t.push("ktx-etc2"),r.has("dxt")&&t.push("dds"),t.push("ktx2")}return t.push("jpg"),t.push("png"),t}};function V6e(e,t){let r=t.url||"",n;e.geometryData&&(n=`${r}/${e.geometryData[0].href}`);let i;e.textureData&&(i=`${r}/${e.textureData[0].href}`);let a;e.attributeData&&(a=L6e(r,e));let o=e.children||[];return xG({...e,children:o,url:r,contentUrl:n,textureUrl:i,textureFormat:"jpg",attributeUrls:a,isDracoGeometry:!1})}function xG(e){var s,u;let t={},r=[0,0,0,1];if(e.mbs)r=e.mbs,t.sphere=[...Zt.WGS84.cartographicToCartesian(e.mbs.slice(0,3)),e.mbs[3]];else if(e.obb){t.box=[...Zt.WGS84.cartographicToCartesian(e.obb.center),...e.obb.halfSize,...e.obb.quaternion];let l=new Ii().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,i=(u=e.lodSelection)==null?void 0:u[0].maxError,a="mesh",o=2;return{...e,mbs:r,boundingVolume:t,lodMetricType:n,lodMetricValue:i,type:a,refine:o}}async function $6e(e,t,r){let n=q4(r.url||""),i,a;if(e.nodePages)i=new H2(e,n,t),a=await i.formTileFromNodePages(0);else{let o=t.i3s,s=tv(`${n}/nodes/root`,o.token);a=await fn(s,ql,{...t,i3s:{...t.i3s,loadContent:!1,isTileHeader:!0,isTileset:!1}})}return{...e,loader:ql,url:n,basePath:n,type:"I3S",nodePagesTile:i,root:a,lodMetricType:a.lodMetricType,lodMetricValue:a.lodMetricValue}}var RRt="4.2.0-beta.2",jRt=/layers\/[0-9]+$/,MRt=/\.slpk$/,LRt=/nodes\/([0-9-]+|root)$/,qRt="504b0304",NRt="PointCloud",ql={dataType:null,batchType:null,name:"I3S (Indexed Scene Layers)",id:"i3s",module:"i3s",version:RRt,mimeTypes:["application/octet-stream"],parse:URt,extensions:["bin"],options:{i3s:{token:null,isTileset:"auto",isTileHeader:"auto",tile:null,tileset:null,_tileOptions:null,_tilesetOptions:null,useDracoGeometry:!0,useCompressedTextures:!0,decodeTextures:!0,coordinateSystem:2}}};async function URt(e,t={},r){let n=r.url;if(t.i3s=t.i3s||{},WRt(e)===qRt)throw new Error("Files with .slpk extention currently are not supported by I3SLoader");let a=q4(n),o;t.i3s.isTileset==="auto"?o=jRt.test(a)||MRt.test(a):o=t.i3s.isTileset;let s;return t.isTileHeader==="auto"?s=LRt.test(a):s=t.i3s.isTileHeader,o?e=await zRt(e,t,r):s?e=await HRt(e,r):e=await GRt(e,t),e}async function GRt(e,t){return await bo(e,H6e,t)}async function zRt(e,t,r){let n=JSON.parse(new TextDecoder().decode(e));if((n==null?void 0:n.layerType)===NRt)throw new Error("Point Cloud layers currently are not supported by I3SLoader");return await $6e(n,t,r)}async function HRt(e,t){return e=JSON.parse(new TextDecoder().decode(e)),V6e(e,t)}function WRt(e){return e instanceof ArrayBuffer?[...new Uint8Array(e,0,4)].map(t=>t.toString(16).padStart(2,"0")).join(""):null}var VRt=[{test:/^$/,extensions:["3dSceneLayer.json.gz"]},{test:/^nodepages\/\d+$/,extensions:[".json.gz"]},{test:/^nodes\/(\d+|root)$/,extensions:["/3dNodeIndexDocument.json.gz"]},{test:/^nodes\/\d+\/textures\/.+$/,extensions:[".jpg",".png",".bin.dds.gz",".ktx"]},{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+$/,extensions:[".json.gz"]},{test:/^nodes\/\d+\/shared$/,extensions:["/sharedResource.json.gz"]}],U4=class extends Il{hashTable;_textEncoder=new TextEncoder;_textDecoder=new TextDecoder;_md5Hash=new Nu;constructor(t,r,n){super(t,r,n),this.hashTable=r}async getFile(t,r="raw"){var n;if(r==="http"){let i=(n=VRt.find(a=>a.test.test(t)))==null?void 0:n.extensions;if(i){let a;for(let o of i)if(a=await this.getDataByPath(`${t}${o}`),a)break;if(a)return a}}if(r==="raw"){let i=await this.getDataByPath(`${t}.gz`);if(i)return i;let a=await this.getFileBytes(t);if(a)return a}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 n2().decompress(r):r}async getFileBytes(t){let r;if(this.hashTable){let n=this._textEncoder.encode(t),i=await this._md5Hash.hash(n.buffer,"hex"),a=this.hashTable[i];if(a===void 0)return;let o=await tu(a,this.fileProvider);if(!o)return;r=await this.fileProvider.slice(o.fileDataOffset,o.fileDataOffset+o.compressedSize)}else try{r=await this.getFileWithoutHash(t)}catch{r=void 0}return r}};async function bG(e,t,r){let n=await wh(e,Ah),i=await Eh(n,e),a;if((i==null?void 0:i.fileName)!=="@specialIndexFileHASH128@")a=await bN(e),t==null||t("SLPK doesnt contain hash file, hash info has been composed according to zip archive headers");else{let o=await tu(i.localHeaderOffset,e);if(!o)throw new Error("corrupted SLPK");let s=o.fileDataOffset,u=await e.slice(s,s+o.compressedSize);a=i2(u)}return new U4(e,a,r)}function J6e(e,t){let{attributeName:r,attributeType:n}=t;return r?{[r]:n?$Rt(n,e):null}:{}}function $Rt(e,t){switch(e){case I6e:return YRt(t);case R6e:return K6e(t);case j6e:return JRt(t);case M6e:return KRt(t);default:return K6e(t)}}function K6e(e){return new Uint32Array(e,4)}function KRt(e){return new Int16Array(e,4)}function JRt(e){return new Float64Array(e,8)}function YRt(e){let i=[];try{let a=new DataView(e,0,4).getUint32(0,!0),o=new Uint32Array(e,8,a),s=8+a*4;for(let u of o){let c=new TextDecoder("utf-8"),l=new Uint8Array(e,s,u);i.push(c.decode(l)),s+=u}}catch(a){console.error("Parse string attribute error: ",a.message)}return i}var XRt="4.2.0-beta.2";var yG={dataType:null,batchType:null,name:"I3S Attribute",id:"i3s-attribute",module:"i3s",version:XRt,mimeTypes:["application/binary"],parse:async(e,t)=>J6e(e,t),extensions:["bin"],options:{},binary:!0};function _G(e,t){let r=[e.center[0],e.center[1],e.center[2]+t.getHeight(e.center[1],e.center[0])],n=Zt.WGS84.cartographicToCartesian(r,new ce),i=new Ii().fromCenterHalfSizeQuaternion(n,e.halfSize,e.quaternion);return[...i.center,...i.halfAxes.toArray()]}var G4=Lt(ru(),1),QRt=()=>({version:{path:"version",default:"1.0"}}),Y6e=()=>({boundingVolume:{path:"boundingVolume"},geometricError:{path:"geometricError"},refine:{path:"refine"},content:{path:"content"},children:{path:"children",transform:e=>e.map(t=>(0,G4.default)(t,Y6e()))}}),X6e=()=>({asset:{path:"asset",transform:e=>(0,G4.default)(e,QRt())},geometricError:{path:"root",transform:e=>e.geometricError},root:{path:"root",transform:e=>(0,G4.default)(e,Y6e())}});function Q6e(e,t){let r=new Float32Array(e.length),n=ejt(t);for(let i=0;i<e.length;i+=2){let a=e.subarray(i,i+2),o=n.slice(i*2,i*2+4),s=ZRt([a[0],a[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[i]=l[0],r[i+1]=l[1]}return r}function ZRt(e){return[e[0]-Math.floor(e[0]),e[1]-Math.floor(e[1])]}function ejt(e){let r=[];for(let n=0;n<e.length;n++)r[n]=e[n]/65535;return r}var tjt=new zr([1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1]),Z6e=new ce,eTe="KHR_materials_unlit",rjt=1,njt=1,W2=class{rtcCenter;i3sTile;async convert(t,r=null){let n=await this.buildGLTF(t,r);return TT({gltfEncoded:new Uint8Array(n),type:"b3dm",featuresLength:this._getFeaturesLength(r),batchTable:r},wN)}async buildGLTF(t,r){let{tileContent:n,textureFormat:i,box:a}=t,{material:o,attributes:s,indices:u,modelMatrix:c}=n,l=new br,f=await this._addI3sTextureToGLTF(n,i,l),p=o==null?void 0:o.pbrMetallicRoughness;p&&(p.metallicFactor===void 0||p.metallicFactor===rjt)&&(p.roughnessFactor===void 0||p.roughnessFactor===njt)&&(l.addObjectExtension(o,eTe,{}),l.addExtension(eTe));let d=this._convertI3sMaterialToGLTFMaterial(o,f),h=l.addMaterial(d),v=s.positions,m=v.value;s.uvRegions&&s.texCoords&&(s.texCoords.value=Q6e(s.texCoords.value,s.uvRegions.value));let b=new ce(a),_=Zt.WGS84.cartesianToCartographic(b,new ce);s.positions.value=this._normalizePositions(m,b,_,c),this._createBatchIds(n,r),s.normals&&!this._checkNormals(s.normals.value)&&delete s.normals;let E=u||e4(m.length/v.size),T=l.addMesh({attributes:s,indices:E,material:h,mode:4}),S=this._generateTransformMatrix(b),D=l.addNode({meshIndex:T,matrix:S}),I=l.addScene({nodeIndices:[D]});return l.setDefaultScene(I),l.createBinaryChunk(),TT(l.gltf,QL)}async _addI3sTextureToGLTF(t,r,n){let{texture:i,material:a,attributes:o}=t,s=null,u=i;if(!i&&a&&(u=a.pbrMetallicRoughness&&a.pbrMetallicRoughness.baseColorTexture&&a.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,i){let a=new Float32Array(t.length);for(let o=0;o<t.length;o+=3){let s=t.subarray(o,o+3),u=new ce(r),c=new ce(Array.from(s)).transform(i).add(n);Zt.WGS84.cartographicToCartesian(c,Z6e),c=Z6e.subtract(u),a.set(c,o)}return a}_generateTransformMatrix(t){return new zr().translate(t).multiplyLeft(tjt)}_createBatchIds(t,r){let{featureIds:n}=t,{OBJECTID:i}=r||{};if(!(!n||!i)){for(let a=0;a<n.length;a++){let o=n[a],s=i.indexOf(o);n[a]=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 tTe=async(e,t,r,n)=>{if(!e||!t.contentUrl)return null;let i={...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 V2(t.contentUrl,ql,i,n)};async function rTe(e){let t=e.split(".slpk");if(t.length===2){let r=`${t[0]}.slpk`,n=new vo(r),i=await bG(n,void 0,r);return new Ol(i)}return null}async function V2(e,t,r,n){return n!==null?await fn(e,t,{...r,fetch:n.fetch.bind(n)}):await fn(e,t,r)}async function nTe(e){if(!(e!=null&&e.fileProvider))return 0;let t=0,r=xc(e.fileProvider);for await(let n of r)n.fileName.indexOf("3dNodeIndexDocument.json.gz")>=0&&t++;return t}var ijt="I3S",rv=class{options;tilesetPath;vertexCounter;conversionStartTime;geoidHeightModel;sourceTileset;attributeStorageInfo;workerSource={};slpkFilesystem=null;loaderOptions={_nodeWorkers:!0,reuseWorkers:!0,worker:!1,i3s:{coordinateSystem:3,decodeTextures:!1},"i3s-content":{workerUrl:"./modules/i3s/dist/i3s-content-worker-node.js"}};conversionDump;progress;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 Mh,this.progress=new N1}async convert(t){var h;if(jr)return console.log(q1),q1;let{inputUrl:r,outputPath:n,tilesetName:i,maxDepth:a,egmFilePath:o,inquirer:s,analyze:u}=t;this.conversionStartTime=wG.default.hrtime(),this.options={maxDepth:a,inquirer:s},console.log("Loading egm file..."),this.geoidHeightModel=await fn(o,r4),console.log("Loading egm file completed!"),this.slpkFilesystem=await rTe(r);let c=!0;if((u||this.slpkFilesystem)&&(c=await this.preprocessConversion(),!c||u)||(this.progress.startMonitoring(),this.sourceTileset=await V2(r,ql,{...this.loaderOptions,i3s:{...this.loaderOptions.i3s,isTileset:!0}},this.slpkFilesystem),!this.sourceTileset))return;let l=(h=this.sourceTileset)==null?void 0:h.root;if(l.obb||(l.obb=DN(l.mbs)),this.tilesetPath=(0,iTe.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 c2(this.tilesetPath)}catch{}let f={boundingVolume:{box:_G(l.obb,this.geoidHeightModel)},geometricError:BN(l),children:[],refine:"REPLACE"};await this._addChildren(l,f,1);let p=(0,aTe.default)({root:f},X6e());await zn(this.tilesetPath,JSON.stringify(p),"tileset.json"),await this.conversionDump.deleteDumpFile(),this.progress.stopMonitoring(),await this._finishConversion({slpk:!1,outputPath:n,tilesetName:i}),this.slpkFilesystem&&this.slpkFilesystem.destroy(),xa.getWorkerFarm({}).destroy()}async preprocessConversion(){console.log("Analyze source layer");let t=await nTe(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,i){let a=r,o=await this._loadChildNode(t,i);if(o.contentUrl){if(this.conversionDump.restored&&this.conversionDump.isFileConversionComplete(`${o.id}.b3dm`)&&(o.obb||o.mbs)){let{child:_}=this._createChildAndBoundingVolume(o);r.children.push(_),await this._addChildren(o,_,n+1);return}let f=await tTe(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),v={tileContent:f,box:h.box||[],textureFormat:o.textureFormat},b=await new W2().convert(v,p);await this.conversionDump.addNode(`${o.id}.b3dm`,o.id),await zn(this.tilesetPath,new Uint8Array(b),`${o.id}.b3dm`),await this.conversionDump.updateConvertedNodesDumpFile(`${o.id}.b3dm`,o.id,!0),r.children.push(d),a=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}]: ${i.id}`),await this._addChildren(o,a,n+1)}async _addChildren(t,r,n){if(!(this.options.maxDepth&&n>this.options.maxDepth))for(let i of t.children||[])await this.convertChildNode(t,r,n,i)}async _loadChildNode(t,r){var i;let n;if((i=this.sourceTileset)!=null&&i.nodePagesTile)console.log(`Node conversion: ${r.id}`),n=await this.sourceTileset.nodePagesTile.formTileFromNodePages(parseInt(r.id));else{let a=this._relativeUrlToFullUrl(t.url,r.href),o={i3s:{...this.loaderOptions,isTileHeader:!0,loadContent:!1}};console.log(`Node conversion: ${a}`),n=await V2(a,ql,o,this.slpkFilesystem)}return n}_createChildAndBoundingVolume(t){t.obb||(t.obb=DN(t.mbs));let r={box:_G(t.obb,this.geoidHeightModel)},n={boundingVolume:r,geometricError:BN(t),children:[],content:{uri:`${t.id}.b3dm`,boundingVolume:r}};return{boundingVolume:r,child:n}}_relativeUrlToFullUrl(t="",r){let n=t.split("/"),i=r.split("/");for(let a of i)switch(a){case".":continue;case"..":n=n.slice(0,-1);break;default:n.push(a)}return n.join("/")}async _loadChildAttributes(t,r){let n=[],{attributeUrls:i=[]}=t;for(let o=0;o<i.length;o++){let s=i[o],u=r[o],c={attributeName:u.name,attributeType:this._getAttributeType(u)};n.push(V2(s,yG,c,this.slpkFilesystem))}let a=await Promise.all(n);return this._replaceNestedArrays(a),Object.assign({},...a)}_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 i in n)n[i]=Array.from(n[i])}}async _finishConversion(t){let r=await QC(t),n=wG.default.hrtime(this.conversionStartTime),i=I1(n);console.log("------------------------------------------------"),console.log(`Finish conversion of ${ijt}`),console.log(`Total conversion time: ${i}`),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",r," bytes"),console.log("------------------------------------------------")}};var nv=require("path");var ajt="4.2.0-beta.2",ojt="https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip",z4=class{async install(t=""){console.log('Installing "EGM2008-5" model...');let r=await fn(ojt,dN,{}),n=process.cwd();t&&(n=(0,nv.join)(n,t)),await zn(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(op[Gn.DECODER],"draco",Gn.DECODER),await this.installFromUrl(op[Gn.DECODER_WASM],"draco",Gn.DECODER_WASM),console.log('Installing "Draco encoder" library'),await this.installFromUrl(op[Gn.ENCODER],"draco",Gn.ENCODER),console.log('Installing "Basis transcoder" library'),await this.installFromNpm("textures",sc.TRANSCODER,"libs"),await this.installFromNpm("textures",sc.TRANSCODER_WASM,"libs"),console.log('Installing "Basis encoder" library'),await this.installFromNpm("textures",sc.ENCODER,"libs"),await this.installFromNpm("textures",sc.ENCODER_WASM,"libs"),console.log('Installing "join-images" npm package');let i=new N0,a=(0,nv.dirname)(process.execPath);await i.start({command:`${a}/${process.platform==="win32"?"npm.cmd":"npm"}`,arguments:["install","sharp@0.30.4","join-images@1.1.3"],wait:0,ignoreStderr:!0}),console.log("All dependencies were installed succesfully.")}async installFromNpm(t,r,n=""){let i=await Pa(`https://unpkg.com/@loaders.gl/${t}@${ajt}/dist/${n}/${r}`);if(i.status<200||i.status>=300)throw new Error(`Failed to load resource ${r}`);let a=await i.arrayBuffer();if(!a)return;let o=(0,nv.join)(process.cwd(),"modules",t,"dist",n);await zn(o,a,r)}async installFromUrl(t,r,n){let a=await(await Pa(t)).arrayBuffer();if(!a)return;let o=(0,nv.join)(process.cwd(),"modules",r,"dist","libs");await zn(o,a,n)}};function lu(e,t){if(e+1>=t.length)return"";let r=t[e+1];return r.indexOf("--")===0?"":r}function oTe(e,t){let r=lu(e,t);return console.log(`Input tileset value: ${r}`),console.log(`Modified tileset value: ${r.replace(/\\/g,"/")}`),r.replace(/\\/g,"/")}function sTe(e){return e.reduce((t,r)=>{let n=r.indexOf("="),i=r.slice(0,n),a=r.slice(n+1,r.length);return r.includes("=")&&r.startsWith("--")&&a?t.concat(i,a):t.concat(r)},[])}function uTe(e,t){let r=lu(e,t),n=Number.parseInt(r);return isFinite(n)?n:NaN}function hs(e,t){let r=lu(e,t).toLowerCase().trim();return["--no-draco","--split-nodes"].includes(t[e])&&!r?!1:!r||r==="true"}var fTe=require("fs/promises"),EG={I3S:"I3S",_3DTILES:"3DTILES"};async function sjt(){let[,,...e]=process.argv;e.length===0&&AG();let t=sTe(e),r=cjt(t);if(r.installDependencies){new z4().install("deps");return}if(r.addHash){let i=cTe(r,!0),a=i.tileset;if(!r.quiet)if(i.output==="data"){let s=i.tileset.substring(0,i.tileset.length-5);(await H4.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&&(a=`${s}-hash.slpk`)}else a=i.output;a!==i.tileset&&await(0,fTe.copyFile)(i.tileset,a);let o=await a2(xc(new vo(a)));await vN(a,o,"@specialIndexFileHASH128@");return}let n=cTe(r);await ujt(n)}sjt().catch(e=>{console.log(e),process.exit(1)});function AG(){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 reduce memory usage but decelerates conversion speed]"),console.log("--split-nodes [Prevent to merge similar materials that could lead to incorrect visualization (I3S to 3DTiles conversion only)]"),console.log("--slpk [Generate slpk (Scene Layer Packages) I3S output file]"),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('--7zExe [location of 7z.exe archiver to create slpk on Windows, default: "C:\\Program Files\\7-Zip\\7z.exe"]'),console.log('--egm [location of Earth Gravity Model *.pgm file to convert heights from ellipsoidal to gravity-related format. 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 ujt(e){switch(console.log("------------------------------------------------"),console.log(`Starting conversion of ${e.inputType}`),console.log("------------------------------------------------"),e.inputType.toUpperCase()){case EG.I3S:await new rv().convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,egmFilePath:e.egm,analyze:e.analyze,inquirer:e.quiet?void 0:H4.default});break;case EG._3DTILES:await new Z1().convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,slpk:e.slpk,sevenZipExe:e.sevenZipExe,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:H4.default});break;default:AG()}}function cTe(e,t){let r={name:{getMessage:()=>console.log("Missed: --name [Tileset name]"),condition:i=>t||Boolean(i)||Boolean(e.analyze)},output:{getMessage:()=>console.log("Missed: --output [Output path name]")},sevenZipExe:{getMessage:()=>console.log("Missed: --7zExe [7z archiver executable path]")},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:i=>t||Boolean(i)&&Object.values(EG).includes(i.toUpperCase())}},n=[];for(let i in r){let a=e[i],o=r[i].condition;(o?o(a):a)||n.push(r[i].getMessage)}return n.length&&(n.forEach(i=>i()),process.exit(1)),e}function cjt(e){let t={output:"data",instantNodeWriting:!1,mergeMaterials:!0,sevenZipExe:"C:\\Program Files\\7-Zip\\7z.exe",egm:(0,lTe.join)(process.cwd(),"deps","egm2008-5.pgm"),draco:!0,installDependencies:!1,generateTextures:!1,generateBoundingVolumes:!1,validate:!1,slpk:!1,addHash:!1,quiet:!1};return e.forEach((r,n)=>{if(r.indexOf("--")===0)switch(r){case"--input-type":t.inputType=lu(n,e);break;case"--tileset":t.tileset=oTe(n,e);break;case"--name":t.name=lu(n,e);break;case"--output":t.output=lu(n,e);break;case"--instant-node-writing":t.instantNodeWriting=hs(n,e);break;case"--split-nodes":t.mergeMaterials=hs(n,e);break;case"--max-depth":t.maxDepth=uTe(n,e);break;case"--slpk":t.slpk=hs(n,e);break;case"--add-hash":t.addHash=hs(n,e);break;case"--7zExe":t.sevenZipExe=lu(n,e);break;case"--egm":t.egm=lu(n,e);break;case"--token":t.token=lu(n,e);break;case"--no-draco":t.draco=hs(n,e);break;case"--validate":t.validate=hs(n,e);break;case"--install-dependencies":t.installDependencies=hs(n,e);break;case"--generate-textures":t.generateTextures=hs(n,e);break;case"--generate-bounding-volumes":t.generateBoundingVolumes=hs(n,e);break;case"--analyze":t.analyze=hs(n,e);break;case"--quiet":t.quiet=hs(n,e);break;case"--metadata-class":t.metadataClass=lu(n,e);break;case"--help":AG();break;default:console.warn(`Unknown option ${r}`),process.exit(0)}}),t}
|
|
162
162
|
/*! Bundled license information:
|
|
163
163
|
|
|
164
164
|
is-buffer/index.js:
|