/**
 * @license
 * Cesium - https://github.com/CesiumGS/cesium
 * Version 1.129
 *
 * Copyright 2011-2022 Cesium Contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Columbus View (Pat. Pend.)
 *
 * Portions licensed separately.
 * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
 */

import{a as _n}from"./chunk-U3N6LNE4.js";import{a as M}from"./chunk-OVIPITBL.js";import{a as ie}from"./chunk-SP23RJSN.js";import{b as nn}from"./chunk-ELJAHN3H.js";import{a as Gt,c as ir,d as sr,e as ge}from"./chunk-3BGP4HCL.js";var on=ir((it,Pt)=>{var Nt=function(){var i=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(i=i||__filename),function(f){f=f||{};var r=typeof f<"u"?f:{},C,l;r.ready=new Promise(function(e,t){C=e,l=t});var p={},F;for(F in r)r.hasOwnProperty(F)&&(p[F]=r[F]);var U=[],y="./this.program",m=function(e,t){throw t},V=!1,d=!1,P=!1,Q=!1;V=typeof window=="object",d=typeof importScripts=="function",P=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",Q=!V&&!P&&!d;var u="";function X(e){return r.locateFile?r.locateFile(e,u):u+e}var se,le,W,J,g,Fe;P?(d?u=Gt("path").dirname(u)+"/":u=__dirname+"/",se=function(t,n){return g||(g=Gt("fs")),Fe||(Fe=Gt("path")),t=Fe.normalize(t),g.readFileSync(t,n?null:"utf8")},W=function(t){var n=se(t,!0);return n.buffer||(n=new Uint8Array(n)),Se(n.buffer),n},process.argv.length>1&&(y=process.argv[1].replace(/\\/g,"/")),U=process.argv.slice(2),process.on("uncaughtException",function(e){if(!(e instanceof _r))throw e}),process.on("unhandledRejection",Me),m=function(e){process.exit(e)},r.inspect=function(){return"[Emscripten Module object]"}):Q?(typeof read<"u"&&(se=function(t){return read(t)}),W=function(t){var n;return typeof readbuffer=="function"?new Uint8Array(readbuffer(t)):(n=read(t,"binary"),Se(typeof n=="object"),n)},typeof scriptArgs<"u"?U=scriptArgs:typeof arguments<"u"&&(U=arguments),typeof quit=="function"&&(m=function(e){quit(e)}),typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)):(V||d)&&(d?u=self.location.href:typeof document<"u"&&document.currentScript&&(u=document.currentScript.src),i&&(u=i),u.indexOf("blob:")!==0?u=u.substr(0,u.lastIndexOf("/")+1):u="",se=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},d&&(W=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),le=function(e,t,n){var _=new XMLHttpRequest;_.open("GET",e,!0),_.responseType="arraybuffer",_.onload=function(){if(_.status==200||_.status==0&&_.response){t(_.response);return}n()},_.onerror=n,_.send(null)},J=function(e){document.title=e});var st=r.print||console.log.bind(console),ee=r.printErr||console.warn.bind(console);for(F in p)p.hasOwnProperty(F)&&(r[F]=p[F]);p=null,r.arguments&&(U=r.arguments),r.thisProgram&&(y=r.thisProgram),r.quit&&(m=r.quit);var De=0,Ie=function(e){De=e},ae;r.wasmBinary&&(ae=r.wasmBinary);var ot=r.noExitRuntime||!0;typeof WebAssembly!="object"&&Me("no native wasm support detected");var ce,de=!1,be;function Se(e,t){e||Me("Assertion failed: "+t)}var we=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function He(e,t,n){for(var _=t+n,s=t;e[s]&&!(s>=_);)++s;if(s-t>16&&e.subarray&&we)return we.decode(e.subarray(t,s));for(var a="";t<s;){var c=e[t++];if(!(c&128)){a+=String.fromCharCode(c);continue}var o=e[t++]&63;if((c&224)==192){a+=String.fromCharCode((c&31)<<6|o);continue}var R=e[t++]&63;if((c&240)==224?c=(c&15)<<12|o<<6|R:c=(c&7)<<18|o<<12|R<<6|e[t++]&63,c<65536)a+=String.fromCharCode(c);else{var T=c-65536;a+=String.fromCharCode(55296|T>>10,56320|T&1023)}}return a}function Xe(e,t){return e?He(D,e,t):""}function Rt(e,t,n,_){if(!(_>0))return 0;for(var s=n,a=n+_-1,c=0;c<e.length;++c){var o=e.charCodeAt(c);if(o>=55296&&o<=57343){var R=e.charCodeAt(++c);o=65536+((o&1023)<<10)|R&1023}if(o<=127){if(n>=a)break;t[n++]=o}else if(o<=2047){if(n+1>=a)break;t[n++]=192|o>>6,t[n++]=128|o&63}else if(o<=65535){if(n+2>=a)break;t[n++]=224|o>>12,t[n++]=128|o>>6&63,t[n++]=128|o&63}else{if(n+3>=a)break;t[n++]=240|o>>18,t[n++]=128|o>>12&63,t[n++]=128|o>>6&63,t[n++]=128|o&63}}return t[n]=0,n-s}function L(e,t,n){return Rt(e,D,t,n)}function j(e){for(var t=0,n=0;n<e.length;++n){var _=e.charCodeAt(n);_>=55296&&_<=57343&&(_=65536+((_&1023)<<10)|e.charCodeAt(++n)&1023),_<=127?++t:_<=2047?t+=2:_<=65535?t+=3:t+=4}return t}var Ae=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function at(e,t){for(var n=e,_=n>>1,s=_+t/2;!(_>=s)&&Ge[_];)++_;if(n=_<<1,n-e>32&&Ae)return Ae.decode(D.subarray(e,n));for(var a="",c=0;!(c>=t/2);++c){var o=fe[e+c*2>>1];if(o==0)break;a+=String.fromCharCode(o)}return a}function xe(e,t,n){if(n===void 0&&(n=2147483647),n<2)return 0;n-=2;for(var _=t,s=n<e.length*2?n/2:e.length,a=0;a<s;++a){var c=e.charCodeAt(a);fe[t>>1]=c,t+=2}return fe[t>>1]=0,t-_}function fn(e){return e.length*2}function Tn(e,t){for(var n=0,_="";!(n>=t/4);){var s=w[e+n*4>>2];if(s==0)break;if(++n,s>=65536){var a=s-65536;_+=String.fromCharCode(55296|a>>10,56320|a&1023)}else _+=String.fromCharCode(s)}return _}function un(e,t,n){if(n===void 0&&(n=2147483647),n<4)return 0;for(var _=t,s=_+n-4,a=0;a<e.length;++a){var c=e.charCodeAt(a);if(c>=55296&&c<=57343){var o=e.charCodeAt(++a);c=65536+((c&1023)<<10)|o&1023}if(w[t>>2]=c,t+=4,t+4>s)break}return w[t>>2]=0,t-_}function On(e){for(var t=0,n=0;n<e.length;++n){var _=e.charCodeAt(n);_>=55296&&_<=57343&&++n,t+=4}return t}function ln(e,t){return e%t>0&&(e+=t-e%t),e}var ct,ke,D,fe,Ge,w,Y,pt,Et;function vt(e){ct=e,r.HEAP8=ke=new Int8Array(e),r.HEAP16=fe=new Int16Array(e),r.HEAP32=w=new Int32Array(e),r.HEAPU8=D=new Uint8Array(e),r.HEAPU16=Ge=new Uint16Array(e),r.HEAPU32=Y=new Uint32Array(e),r.HEAPF32=pt=new Float32Array(e),r.HEAPF64=Et=new Float64Array(e)}var Tr=r.INITIAL_MEMORY||16777216,Ve,ht=[],Ut=[],Mn=[],yt=[],Kn=!1;function Bn(){if(r.preRun)for(typeof r.preRun=="function"&&(r.preRun=[r.preRun]);r.preRun.length;)Sn(r.preRun.shift());$e(ht)}function Cn(){Kn=!0,$e(Ut)}function Fn(){$e(Mn)}function dn(){if(r.postRun)for(typeof r.postRun=="function"&&(r.postRun=[r.postRun]);r.postRun.length;)Vn(r.postRun.shift());$e(yt)}function Sn(e){ht.unshift(e)}function Gn(e){Ut.unshift(e)}function Vn(e){yt.unshift(e)}var Te=0,At=null,Ne=null;function Nn(e){Te++,r.monitorRunDependencies&&r.monitorRunDependencies(Te)}function Pn(e){if(Te--,r.monitorRunDependencies&&r.monitorRunDependencies(Te),Te==0&&(At!==null&&(clearInterval(At),At=null),Ne)){var t=Ne;Ne=null,t()}}r.preloadedImages={},r.preloadedAudios={};function Me(e){r.onAbort&&r.onAbort(e),e+="",ee(e),de=!0,be=1,e="abort("+e+"). Build with -s ASSERTIONS=1 for more info.";var t=new WebAssembly.RuntimeError(e);throw l(t),t}function gt(e,t){return String.prototype.startsWith?e.startsWith(t):e.indexOf(t)===0}var pn="data:application/octet-stream;base64,";function Lt(e){return gt(e,pn)}var En="file://";function mt(e){return gt(e,En)}var x="basis_transcoder.wasm";Lt(x)||(x=X(x));function Dt(e){try{if(e==x&&ae)return new Uint8Array(ae);if(W)return W(e);throw"both async and sync fetching of the wasm failed"}catch(t){Me(t)}}function vn(){if(!ae&&(V||d)){if(typeof fetch=="function"&&!mt(x))return fetch(x,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+x+"'";return e.arrayBuffer()}).catch(function(){return Dt(x)});if(le)return new Promise(function(e,t){le(x,function(n){e(new Uint8Array(n))},t)})}return Promise.resolve().then(function(){return Dt(x)})}function hn(){var e={a:J_};function t(c,o){var R=c.exports;r.asm=R,ce=r.asm.K,vt(ce.buffer),Ve=r.asm.O,Gn(r.asm.L),Pn("wasm-instantiate")}Nn("wasm-instantiate");function n(c){t(c.instance)}function _(c){return vn().then(function(o){var R=WebAssembly.instantiate(o,e);return R}).then(c,function(o){ee("failed to asynchronously prepare wasm: "+o),Me(o)})}function s(){return!ae&&typeof WebAssembly.instantiateStreaming=="function"&&!Lt(x)&&!mt(x)&&typeof fetch=="function"?fetch(x,{credentials:"same-origin"}).then(function(c){var o=WebAssembly.instantiateStreaming(c,e);return o.then(n,function(R){return ee("wasm streaming compile failed: "+R),ee("falling back to ArrayBuffer instantiation"),_(n)})}):_(n)}if(r.instantiateWasm)try{var a=r.instantiateWasm(e,t);return a}catch(c){return ee("Module.instantiateWasm callback failed with error: "+c),!1}return s().catch(l),{}}function $e(e){for(;e.length>0;){var t=e.shift();if(typeof t=="function"){t(r);continue}var n=t.func;typeof n=="number"?t.arg===void 0?Ve.get(n)():Ve.get(n)(t.arg):n(t.arg===void 0?null:t.arg)}}var We={};function je(e){for(;e.length;){var t=e.pop(),n=e.pop();n(t)}}function Pe(e){return this.fromWireType(Y[e>>2])}var Ke={},ue={},ze={},Un=48,yn=57;function Ye(e){if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var t=e.charCodeAt(0);return t>=Un&&t<=yn?"_"+e:e}function qe(e,t){return e=Ye(e),new Function("body","return function "+e+`() {
    "use strict";    return body.apply(this, arguments);
};
`)(t)}function ft(e,t){var n=qe(t,function(_){this.name=t,this.message=_;var s=new Error(_).stack;s!==void 0&&(this.stack=this.toString()+`
`+s.replace(/^Error(:[^\n]*)?\n/,""))});return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},n}var It=void 0;function Ze(e){throw new It(e)}function oe(e,t,n){e.forEach(function(o){ze[o]=t});function _(o){var R=n(o);R.length!==e.length&&Ze("Mismatched type converter count");for(var T=0;T<e.length;++T)q(e[T],R[T])}var s=new Array(t.length),a=[],c=0;t.forEach(function(o,R){ue.hasOwnProperty(o)?s[R]=ue[o]:(a.push(o),Ke.hasOwnProperty(o)||(Ke[o]=[]),Ke[o].push(function(){s[R]=ue[o],++c,c===a.length&&_(s)}))}),a.length===0&&_(s)}function gn(e){var t=We[e];delete We[e];var n=t.rawConstructor,_=t.rawDestructor,s=t.fields,a=s.map(function(c){return c.getterReturnType}).concat(s.map(function(c){return c.setterArgumentType}));oe([e],a,function(c){var o={};return s.forEach(function(R,T){var O=R.fieldName,K=c[T],G=R.getter,N=R.getterContext,h=c[T+s.length],I=R.setter,$=R.setterContext;o[O]={read:function(Z){return K.fromWireType(G(N,Z))},write:function(Z,ye){var re=[];I($,Z,h.toWireType(re,ye)),je(re)}}}),[{name:t.name,fromWireType:function(R){var T={};for(var O in o)T[O]=o[O].read(R);return _(R),T},toWireType:function(R,T){for(var O in o)if(!(O in T))throw new TypeError('Missing field:  "'+O+'"');var K=n();for(O in o)o[O].write(K,T[O]);return R!==null&&R.push(_,K),K},argPackAdvance:8,readValueFromPointer:Pe,destructorFunction:_}]})}function Qe(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}function Ln(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);bt=e}var bt=void 0;function v(e){for(var t="",n=e;D[n];)t+=bt[D[n++]];return t}var Be=void 0;function S(e){throw new Be(e)}function q(e,t,n){if(n=n||{},!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var _=t.name;if(e||S('type "'+_+'" must have a positive integer typeid pointer'),ue.hasOwnProperty(e)){if(n.ignoreDuplicateRegistrations)return;S("Cannot register type '"+_+"' twice")}if(ue[e]=t,delete ze[e],Ke.hasOwnProperty(e)){var s=Ke[e];delete Ke[e],s.forEach(function(a){a()})}}function mn(e,t,n,_,s){var a=Qe(n);t=v(t),q(e,{name:t,fromWireType:function(c){return!!c},toWireType:function(c,o){return o?_:s},argPackAdvance:8,readValueFromPointer:function(c){var o;if(n===1)o=ke;else if(n===2)o=fe;else if(n===4)o=w;else throw new TypeError("Unknown boolean type size: "+t);return this.fromWireType(o[c>>a])},destructorFunction:null})}function Dn(e){if(!(this instanceof Re)||!(e instanceof Re))return!1;for(var t=this.$$.ptrType.registeredClass,n=this.$$.ptr,_=e.$$.ptrType.registeredClass,s=e.$$.ptr;t.baseClass;)n=t.upcast(n),t=t.baseClass;for(;_.baseClass;)s=_.upcast(s),_=_.baseClass;return t===_&&n===s}function In(e){return{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}}function Tt(e){function t(n){return n.$$.ptrType.registeredClass.name}S(t(e)+" instance already deleted")}var ut=!1;function wt(e){}function bn(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}function Ht(e){e.count.value-=1;var t=e.count.value===0;t&&bn(e)}function pe(e){return typeof FinalizationGroup>"u"?(pe=function(t){return t},e):(ut=new FinalizationGroup(function(t){for(var n=t.next();!n.done;n=t.next()){var _=n.value;_.ptr?Ht(_):console.warn("object already deleted: "+_.ptr)}}),pe=function(t){return ut.register(t,t.$$,t.$$),t},wt=function(t){ut.unregister(t.$$)},pe(e))}function wn(){if(this.$$.ptr||Tt(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=pe(Object.create(Object.getPrototypeOf(this),{$$:{value:In(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function Hn(){this.$$.ptr||Tt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&S("Object already scheduled for deletion"),wt(this),Ht(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Xn(){return!this.$$.ptr}var Ee=void 0,ve=[];function Ot(){for(;ve.length;){var e=ve.pop();e.$$.deleteScheduled=!1,e.delete()}}function xn(){return this.$$.ptr||Tt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&S("Object already scheduled for deletion"),ve.push(this),ve.length===1&&Ee&&Ee(Ot),this.$$.deleteScheduled=!0,this}function kn(){Re.prototype.isAliasOf=Dn,Re.prototype.clone=wn,Re.prototype.delete=Hn,Re.prototype.isDeleted=Xn,Re.prototype.deleteLater=xn}function Re(){}var Xt={};function xt(e,t,n){if(e[t].overloadTable===void 0){var _=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||S("Function '"+n+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[t].overloadTable+")!"),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[_.argCount]=_}}function lt(e,t,n){r.hasOwnProperty(e)?((n===void 0||r[e].overloadTable!==void 0&&r[e].overloadTable[n]!==void 0)&&S("Cannot register public name '"+e+"' twice"),xt(r,e,e),r.hasOwnProperty(n)&&S("Cannot register multiple overloads of a function with the same number of arguments ("+n+")!"),r[e].overloadTable[n]=t):(r[e]=t,n!==void 0&&(r[e].numArguments=n))}function $n(e,t,n,_,s,a,c,o){this.name=e,this.constructor=t,this.instancePrototype=n,this.rawDestructor=_,this.baseClass=s,this.getActualType=a,this.upcast=c,this.downcast=o,this.pureVirtualFunctions=[]}function Mt(e,t,n){for(;t!==n;)t.upcast||S("Expected null or instance of "+n.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function Wn(e,t){if(t===null)return this.isReference&&S("null is not a valid "+this.name),0;t.$$||S('Cannot pass "'+Ce(t)+'" as a '+this.name),t.$$.ptr||S("Cannot pass deleted object as a pointer of type "+this.name);var n=t.$$.ptrType.registeredClass,_=Mt(t.$$.ptr,n,this.registeredClass);return _}function jn(e,t){var n;if(t===null)return this.isReference&&S("null is not a valid "+this.name),this.isSmartPointer?(n=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,n),n):0;t.$$||S('Cannot pass "'+Ce(t)+'" as a '+this.name),t.$$.ptr||S("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&S("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);var _=t.$$.ptrType.registeredClass;if(n=Mt(t.$$.ptr,_,this.registeredClass),this.isSmartPointer)switch(t.$$.smartPtr===void 0&&S("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?n=t.$$.smartPtr:S("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:n=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)n=t.$$.smartPtr;else{var s=t.clone();n=this.rawShare(n,ne(function(){s.delete()})),e!==null&&e.push(this.rawDestructor,n)}break;default:S("Unsupporting sharing policy")}return n}function zn(e,t){if(t===null)return this.isReference&&S("null is not a valid "+this.name),0;t.$$||S('Cannot pass "'+Ce(t)+'" as a '+this.name),t.$$.ptr||S("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&S("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var n=t.$$.ptrType.registeredClass,_=Mt(t.$$.ptr,n,this.registeredClass);return _}function Yn(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function qn(e){this.rawDestructor&&this.rawDestructor(e)}function Zn(e){e!==null&&e.delete()}function kt(e,t,n){if(t===n)return e;if(n.baseClass===void 0)return null;var _=kt(e,t,n.baseClass);return _===null?null:n.downcast(_)}function Qn(){return Object.keys(he).length}function Jn(){var e=[];for(var t in he)he.hasOwnProperty(t)&&e.push(he[t]);return e}function e_(e){Ee=e,ve.length&&Ee&&Ee(Ot)}function t_(){r.getInheritedInstanceCount=Qn,r.getLiveInheritedInstances=Jn,r.flushPendingDeletes=Ot,r.setDelayFunction=e_}var he={};function n_(e,t){for(t===void 0&&S("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}function __(e,t){return t=n_(e,t),he[t]}function Je(e,t){(!t.ptrType||!t.ptr)&&Ze("makeClassHandle requires ptr and ptrType");var n=!!t.smartPtrType,_=!!t.smartPtr;return n!==_&&Ze("Both smartPtrType and smartPtr must be specified"),t.count={value:1},pe(Object.create(e,{$$:{value:t}}))}function r_(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var n=__(this.registeredClass,t);if(n!==void 0){if(n.$$.count.value===0)return n.$$.ptr=t,n.$$.smartPtr=e,n.clone();var _=n.clone();return this.destructor(e),_}function s(){return this.isSmartPointer?Je(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Je(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a=this.registeredClass.getActualType(t),c=Xt[a];if(!c)return s.call(this);var o;this.isConst?o=c.constPointerType:o=c.pointerType;var R=kt(t,this.registeredClass,o.registeredClass);return R===null?s.call(this):this.isSmartPointer?Je(o.registeredClass.instancePrototype,{ptrType:o,ptr:R,smartPtrType:this,smartPtr:e}):Je(o.registeredClass.instancePrototype,{ptrType:o,ptr:R})}function i_(){te.prototype.getPointee=Yn,te.prototype.destructor=qn,te.prototype.argPackAdvance=8,te.prototype.readValueFromPointer=Pe,te.prototype.deleteObject=Zn,te.prototype.fromWireType=r_}function te(e,t,n,_,s,a,c,o,R,T,O){this.name=e,this.registeredClass=t,this.isReference=n,this.isConst=_,this.isSmartPointer=s,this.pointeeType=a,this.sharingPolicy=c,this.rawGetPointee=o,this.rawConstructor=R,this.rawShare=T,this.rawDestructor=O,!s&&t.baseClass===void 0?_?(this.toWireType=Wn,this.destructorFunction=null):(this.toWireType=zn,this.destructorFunction=null):this.toWireType=jn}function $t(e,t,n){r.hasOwnProperty(e)||Ze("Replacing nonexistant public symbol"),r[e].overloadTable!==void 0&&n!==void 0?r[e].overloadTable[n]=t:(r[e]=t,r[e].argCount=n)}function s_(e,t,n){var _=r["dynCall_"+e];return n&&n.length?_.apply(null,[t].concat(n)):_.call(null,t)}function o_(e,t,n){return e.indexOf("j")!=-1?s_(e,t,n):Ve.get(t).apply(null,n)}function R_(e,t){var n=[];return function(){n.length=arguments.length;for(var _=0;_<arguments.length;_++)n[_]=arguments[_];return o_(e,t,n)}}function z(e,t){e=v(e);function n(){return e.indexOf("j")!=-1?R_(e,t):Ve.get(t)}var _=n();return typeof _!="function"&&S("unknown function pointer with signature "+e+": "+t),_}var Wt=void 0;function jt(e){var t=Qt(e),n=v(t);return _e(t),n}function et(e,t){var n=[],_={};function s(a){if(!_[a]&&!ue[a]){if(ze[a]){ze[a].forEach(s);return}n.push(a),_[a]=!0}}throw t.forEach(s),new Wt(e+": "+n.map(jt).join([", "]))}function a_(e,t,n,_,s,a,c,o,R,T,O,K,G){O=v(O),a=z(s,a),o&&(o=z(c,o)),T&&(T=z(R,T)),G=z(K,G);var N=Ye(O);lt(N,function(){et("Cannot construct "+O+" due to unbound types",[_])}),oe([e,t,n],_?[_]:[],function(h){h=h[0];var I,$;_?(I=h.registeredClass,$=I.instancePrototype):$=Re.prototype;var Z=qe(N,function(){if(Object.getPrototypeOf(this)!==ye)throw new Be("Use 'new' to construct "+O);if(re.constructor_body===void 0)throw new Be(O+" has no accessible constructor");var tn=re.constructor_body[arguments.length];if(tn===void 0)throw new Be("Tried to invoke ctor of "+O+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(re.constructor_body).toString()+") parameters instead!");return tn.apply(this,arguments)}),ye=Object.create($,{constructor:{value:Z}});Z.prototype=ye;var re=new $n(O,Z,ye,G,I,a,o,T),rr=new te(O,re,!0,!1,!1),Jt=new te(O+"*",re,!1,!1,!1),en=new te(O+" const*",re,!1,!0,!1);return Xt[e]={pointerType:Jt,constPointerType:en},$t(N,Z),[rr,Jt,en]})}function Kt(e,t){for(var n=[],_=0;_<e;_++)n.push(w[(t>>2)+_]);return n}function c_(e,t,n,_,s,a){Se(t>0);var c=Kt(t,n);s=z(_,s);var o=[a],R=[];oe([],[e],function(T){T=T[0];var O="constructor "+T.name;if(T.registeredClass.constructor_body===void 0&&(T.registeredClass.constructor_body=[]),T.registeredClass.constructor_body[t-1]!==void 0)throw new Be("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+T.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return T.registeredClass.constructor_body[t-1]=function(){et("Cannot construct "+T.name+" due to unbound types",c)},oe([],c,function(K){return T.registeredClass.constructor_body[t-1]=function(){arguments.length!==t-1&&S(O+" called with "+arguments.length+" arguments, expected "+(t-1)),R.length=0,o.length=t;for(var N=1;N<t;++N)o[N]=K[N].toWireType(R,arguments[N-1]);var h=s.apply(null,o);return je(R),K[0].fromWireType(h)},[]}),[]})}function zt(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var n=qe(e.name||"unknownFunctionName",function(){});n.prototype=e.prototype;var _=new n,s=e.apply(_,t);return s instanceof Object?s:_}function Yt(e,t,n,_,s){var a=t.length;a<2&&S("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var c=t[1]!==null&&n!==null,o=!1,R=1;R<t.length;++R)if(t[R]!==null&&t[R].destructorFunction===void 0){o=!0;break}for(var T=t[0].name!=="void",O="",K="",R=0;R<a-2;++R)O+=(R!==0?", ":"")+"arg"+R,K+=(R!==0?", ":"")+"arg"+R+"Wired";var G="return function "+Ye(e)+"("+O+`) {
if (arguments.length !== `+(a-2)+`) {
throwBindingError('function `+e+" called with ' + arguments.length + ' arguments, expected "+(a-2)+` args!');
}
`;o&&(G+=`var destructors = [];
`);var N=o?"destructors":"null",h=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],I=[S,_,s,je,t[0],t[1]];c&&(G+="var thisWired = classParam.toWireType("+N+`, this);
`);for(var R=0;R<a-2;++R)G+="var arg"+R+"Wired = argType"+R+".toWireType("+N+", arg"+R+"); // "+t[R+2].name+`
`,h.push("argType"+R),I.push(t[R+2]);if(c&&(K="thisWired"+(K.length>0?", ":"")+K),G+=(T?"var rv = ":"")+"invoker(fn"+(K.length>0?", ":"")+K+`);
`,o)G+=`runDestructors(destructors);
`;else for(var R=c?1:2;R<t.length;++R){var $=R===1?"thisWired":"arg"+(R-2)+"Wired";t[R].destructorFunction!==null&&(G+=$+"_dtor("+$+"); // "+t[R].name+`
`,h.push($+"_dtor"),I.push(t[R].destructorFunction))}T&&(G+=`var ret = retType.fromWireType(rv);
return ret;
`),G+=`}
`,h.push(G);var Z=zt(Function,h).apply(null,I);return Z}function A_(e,t,n,_,s,a,c,o){var R=Kt(n,_);t=v(t),a=z(s,a),oe([],[e],function(T){T=T[0];var O=T.name+"."+t;o&&T.registeredClass.pureVirtualFunctions.push(t);function K(){et("Cannot call "+O+" due to unbound types",R)}var G=T.registeredClass.instancePrototype,N=G[t];return N===void 0||N.overloadTable===void 0&&N.className!==T.name&&N.argCount===n-2?(K.argCount=n-2,K.className=T.name,G[t]=K):(xt(G,t,O),G[t].overloadTable[n-2]=K),oe([],R,function(h){var I=Yt(O,h,T,a,c);return G[t].overloadTable===void 0?(I.argCount=n-2,G[t]=I):G[t].overloadTable[n-2]=I,[]}),[]})}function f_(e,t,n){e=v(e),oe([],[t],function(_){return _=_[0],r[e]=_.fromWireType(n),[]})}var Bt=[],k=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Ct(e){e>4&&--k[e].refcount===0&&(k[e]=void 0,Bt.push(e))}function T_(){for(var e=0,t=5;t<k.length;++t)k[t]!==void 0&&++e;return e}function u_(){for(var e=5;e<k.length;++e)if(k[e]!==void 0)return k[e];return null}function O_(){r.count_emval_handles=T_,r.get_first_emval=u_}function ne(e){switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var t=Bt.length?Bt.pop():k.length;return k[t]={refcount:1,value:e},t}}}function l_(e,t){t=v(t),q(e,{name:t,fromWireType:function(n){var _=k[n].value;return Ct(n),_},toWireType:function(n,_){return ne(_)},argPackAdvance:8,readValueFromPointer:Pe,destructorFunction:null})}function M_(e,t,n){switch(t){case 0:return function(_){var s=n?ke:D;return this.fromWireType(s[_])};case 1:return function(_){var s=n?fe:Ge;return this.fromWireType(s[_>>1])};case 2:return function(_){var s=n?w:Y;return this.fromWireType(s[_>>2])};default:throw new TypeError("Unknown integer type: "+e)}}function K_(e,t,n,_){var s=Qe(n);t=v(t);function a(){}a.values={},q(e,{name:t,constructor:a,fromWireType:function(c){return this.constructor.values[c]},toWireType:function(c,o){return o.value},argPackAdvance:8,readValueFromPointer:M_(t,s,_),destructorFunction:null}),lt(t,a)}function tt(e,t){var n=ue[e];return n===void 0&&S(t+" has unknown type "+jt(e)),n}function B_(e,t,n){var _=tt(e,"enum");t=v(t);var s=_.constructor,a=Object.create(_.constructor.prototype,{value:{value:n},constructor:{value:qe(_.name+"_"+t,function(){})}});s.values[n]=a,s[t]=a}function Ce(e){if(e===null)return"null";var t=typeof e;return t==="object"||t==="array"||t==="function"?e.toString():""+e}function C_(e,t){switch(t){case 2:return function(n){return this.fromWireType(pt[n>>2])};case 3:return function(n){return this.fromWireType(Et[n>>3])};default:throw new TypeError("Unknown float type: "+e)}}function F_(e,t,n){var _=Qe(n);t=v(t),q(e,{name:t,fromWireType:function(s){return s},toWireType:function(s,a){if(typeof a!="number"&&typeof a!="boolean")throw new TypeError('Cannot convert "'+Ce(a)+'" to '+this.name);return a},argPackAdvance:8,readValueFromPointer:C_(t,_),destructorFunction:null})}function d_(e,t,n,_,s,a){var c=Kt(t,n);e=v(e),s=z(_,s),lt(e,function(){et("Cannot call "+e+" due to unbound types",c)},t-1),oe([],c,function(o){var R=[o[0],null].concat(o.slice(1));return $t(e,Yt(e,R,null,s,a),t-1),[]})}function S_(e,t,n){switch(t){case 0:return n?function(s){return ke[s]}:function(s){return D[s]};case 1:return n?function(s){return fe[s>>1]}:function(s){return Ge[s>>1]};case 2:return n?function(s){return w[s>>2]}:function(s){return Y[s>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function G_(e,t,n,_,s){t=v(t),s===-1&&(s=4294967295);var a=Qe(n),c=function(T){return T};if(_===0){var o=32-8*n;c=function(T){return T<<o>>>o}}var R=t.indexOf("unsigned")!=-1;q(e,{name:t,fromWireType:c,toWireType:function(T,O){if(typeof O!="number"&&typeof O!="boolean")throw new TypeError('Cannot convert "'+Ce(O)+'" to '+this.name);if(O<_||O>s)throw new TypeError('Passing a number "'+Ce(O)+'" from JS side to C/C++ side to an argument of type "'+t+'", which is outside the valid range ['+_+", "+s+"]!");return R?O>>>0:O|0},argPackAdvance:8,readValueFromPointer:S_(t,a,_!==0),destructorFunction:null})}function V_(e,t,n){var _=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],s=_[t];function a(c){c=c>>2;var o=Y,R=o[c],T=o[c+1];return new s(ct,T,R)}n=v(n),q(e,{name:n,fromWireType:a,argPackAdvance:8,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})}function N_(e,t){t=v(t);var n=t==="std::string";q(e,{name:t,fromWireType:function(_){var s=Y[_>>2],a;if(n)for(var c=_+4,o=0;o<=s;++o){var R=_+4+o;if(o==s||D[R]==0){var T=R-c,O=Xe(c,T);a===void 0?a=O:(a+="\0",a+=O),c=R+1}}else{for(var K=new Array(s),o=0;o<s;++o)K[o]=String.fromCharCode(D[_+4+o]);a=K.join("")}return _e(_),a},toWireType:function(_,s){s instanceof ArrayBuffer&&(s=new Uint8Array(s));var a,c=typeof s=="string";c||s instanceof Uint8Array||s instanceof Uint8ClampedArray||s instanceof Int8Array||S("Cannot pass non-string to std::string"),n&&c?a=function(){return j(s)}:a=function(){return s.length};var o=a(),R=dt(4+o+1);if(Y[R>>2]=o,n&&c)L(s,R+4,o+1);else if(c)for(var T=0;T<o;++T){var O=s.charCodeAt(T);O>255&&(_e(R),S("String has UTF-16 code units that do not fit in 8 bits")),D[R+4+T]=O}else for(var T=0;T<o;++T)D[R+4+T]=s[T];return _!==null&&_.push(_e,R),R},argPackAdvance:8,readValueFromPointer:Pe,destructorFunction:function(_){_e(_)}})}function P_(e,t,n){n=v(n);var _,s,a,c,o;t===2?(_=at,s=xe,c=fn,a=function(){return Ge},o=1):t===4&&(_=Tn,s=un,c=On,a=function(){return Y},o=2),q(e,{name:n,fromWireType:function(R){for(var T=Y[R>>2],O=a(),K,G=R+4,N=0;N<=T;++N){var h=R+4+N*t;if(N==T||O[h>>o]==0){var I=h-G,$=_(G,I);K===void 0?K=$:(K+="\0",K+=$),G=h+t}}return _e(R),K},toWireType:function(R,T){typeof T!="string"&&S("Cannot pass non-string to C++ string type "+n);var O=c(T),K=dt(4+O+t);return Y[K>>2]=O>>o,s(T,K+4,O+t),R!==null&&R.push(_e,K),K},argPackAdvance:8,readValueFromPointer:Pe,destructorFunction:function(R){_e(R)}})}function p_(e,t,n,_,s,a){We[e]={name:v(t),rawConstructor:z(n,_),rawDestructor:z(s,a),fields:[]}}function E_(e,t,n,_,s,a,c,o,R,T){We[e].fields.push({fieldName:v(t),getterReturnType:n,getter:z(_,s),getterContext:a,setterArgumentType:c,setter:z(o,R),setterContext:T})}function v_(e,t){t=v(t),q(e,{isVoid:!0,name:t,argPackAdvance:0,fromWireType:function(){},toWireType:function(n,_){}})}function Ue(e){return e||S("Cannot use deleted val. handle = "+e),k[e].value}function h_(e,t,n){e=Ue(e),t=tt(t,"emval::as");var _=[],s=ne(_);return w[n>>2]=s,t.toWireType(_,e)}var U_={};function nt(e){var t=U_[e];return t===void 0?v(e):t}var Ft=[];function y_(e,t,n,_){e=Ft[e],t=Ue(t),n=nt(n),e(t,n,null,_)}function qt(){return typeof globalThis=="object"?globalThis:function(){return Function}()("return this")()}function g_(e){return e===0?ne(qt()):(e=nt(e),ne(qt()[e]))}function L_(e){var t=Ft.length;return Ft.push(e),t}function m_(e,t){for(var n=new Array(e),_=0;_<e;++_)n[_]=tt(w[(t>>2)+_],"parameter "+_);return n}function D_(e,t){for(var n=m_(e,t),_=n[0],s=_.name+"_$"+n.slice(1).map(function(N){return N.name}).join("_")+"$",a=["retType"],c=[_],o="",R=0;R<e-1;++R)o+=(R!==0?", ":"")+"arg"+R,a.push("argType"+R),c.push(n[1+R]);for(var T=Ye("methodCaller_"+s),O="return function "+T+`(handle, name, destructors, args) {
`,K=0,R=0;R<e-1;++R)O+="    var arg"+R+" = argType"+R+".readValueFromPointer(args"+(K?"+"+K:"")+`);
`,K+=n[R+1].argPackAdvance;O+="    var rv = handle[name]("+o+`);
`;for(var R=0;R<e-1;++R)n[R+1].deleteObject&&(O+="    argType"+R+".deleteObject(arg"+R+`);
`);_.isVoid||(O+=`    return retType.toWireType(destructors, rv);
`),O+=`};
`,a.push(O);var G=zt(Function,a).apply(null,c);return L_(G)}function I_(e){return e=nt(e),ne(r[e])}function b_(e,t){return e=Ue(e),t=Ue(t),ne(e[t])}function w_(e){e>4&&(k[e].refcount+=1)}function H_(e){for(var t="",n=0;n<e;++n)t+=(n!==0?", ":"")+"arg"+n;for(var _="return function emval_allocator_"+e+`(constructor, argTypes, args) {
`,n=0;n<e;++n)_+="var argType"+n+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+n+'], "parameter '+n+`");
var arg`+n+" = argType"+n+`.readValueFromPointer(args);
args += argType`+n+`['argPackAdvance'];
`;return _+="var obj = new constructor("+t+`);
return __emval_register(obj);
}
`,new Function("requireRegisteredType","Module","__emval_register",_)(tt,r,ne)}var Zt={};function X_(e,t,n,_){e=Ue(e);var s=Zt[t];return s||(s=H_(t),Zt[t]=s),s(e,n,_)}function x_(e){return ne(nt(e))}function k_(e){var t=k[e].value;je(t),Ct(e)}function $_(){Me()}function W_(e,t,n){D.copyWithin(e,t,t+n)}function j_(e){try{return ce.grow(e-ct.byteLength+65535>>>16),vt(ce.buffer),1}catch{}}function z_(e){var t=D.length;e=e>>>0;var n=2147483648;if(e>n)return!1;for(var _=1;_<=4;_*=2){var s=t*(1+.2/_);s=Math.min(s,e+100663296);var a=Math.min(n,ln(Math.max(e,s),65536)),c=j_(a);if(c)return!0}return!1}var _t={mappings:{},buffers:[null,[],[]],printChar:function(e,t){var n=_t.buffers[e];t===0||t===10?((e===1?st:ee)(He(n,0)),n.length=0):n.push(t)},varargs:void 0,get:function(){_t.varargs+=4;var e=w[_t.varargs-4>>2];return e},getStr:function(e){var t=Xe(e);return t},get64:function(e,t){return e}};function Y_(e){return 0}function q_(e,t,n,_,s){}function Z_(e,t,n,_){for(var s=0,a=0;a<n;a++){for(var c=w[t+a*8>>2],o=w[t+(a*8+4)>>2],R=0;R<o;R++)_t.printChar(e,D[c+R]);s+=o}return w[_>>2]=s,0}function Q_(e){Ie(e|0)}It=r.InternalError=ft(Error,"InternalError"),Ln(),Be=r.BindingError=ft(Error,"BindingError"),kn(),i_(),t_(),Wt=r.UnboundTypeError=ft(Error,"UnboundTypeError"),O_();var J_={t:gn,I:mn,x:a_,w:c_,d:A_,k:f_,H:l_,n:K_,a:B_,A:F_,i:d_,j:G_,h:V_,B:N_,v:P_,u:p_,c:E_,J:v_,m:h_,s:y_,b:Ct,y:g_,p:D_,r:I_,e:b_,g:w_,q:X_,f:x_,l:k_,o:$_,E:W_,F:z_,G:Y_,C:q_,z:Z_,D:Q_},ur=hn(),er=r.___wasm_call_ctors=function(){return(er=r.___wasm_call_ctors=r.asm.L).apply(null,arguments)},dt=r._malloc=function(){return(dt=r._malloc=r.asm.M).apply(null,arguments)},_e=r._free=function(){return(_e=r._free=r.asm.N).apply(null,arguments)},Qt=r.___getTypeName=function(){return(Qt=r.___getTypeName=r.asm.P).apply(null,arguments)},tr=r.___embind_register_native_and_builtin_types=function(){return(tr=r.___embind_register_native_and_builtin_types=r.asm.Q).apply(null,arguments)},nr=r.dynCall_jiji=function(){return(nr=r.dynCall_jiji=r.asm.R).apply(null,arguments)},rt;function _r(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}Ne=function e(){rt||St(),rt||(Ne=e)};function St(e){if(e=e||U,Te>0||(Bn(),Te>0))return;function t(){rt||(rt=!0,r.calledRun=!0,!de&&(Cn(),Fn(),C(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),dn()))}r.setStatus?(r.setStatus("Running..."),setTimeout(function(){setTimeout(function(){r.setStatus("")},1),t()},1)):t()}if(r.run=St,r.preInit)for(typeof r.preInit=="function"&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return St(),f.ready}}();typeof it=="object"&&typeof Pt=="object"?Pt.exports=Nt:typeof define=="function"&&define.amd?define([],function(){return Nt}):typeof it=="object"&&(it.BASIS=Nt)});var B={UNSIGNED_BYTE:M.UNSIGNED_BYTE,UNSIGNED_SHORT:M.UNSIGNED_SHORT,UNSIGNED_INT:M.UNSIGNED_INT,FLOAT:M.FLOAT,HALF_FLOAT:M.HALF_FLOAT_OES,UNSIGNED_INT_24_8:M.UNSIGNED_INT_24_8,UNSIGNED_SHORT_4_4_4_4:M.UNSIGNED_SHORT_4_4_4_4,UNSIGNED_SHORT_5_5_5_1:M.UNSIGNED_SHORT_5_5_5_1,UNSIGNED_SHORT_5_6_5:M.UNSIGNED_SHORT_5_6_5};B.toWebGLConstant=function(i,f){switch(i){case B.UNSIGNED_BYTE:return M.UNSIGNED_BYTE;case B.UNSIGNED_SHORT:return M.UNSIGNED_SHORT;case B.UNSIGNED_INT:return M.UNSIGNED_INT;case B.FLOAT:return M.FLOAT;case B.HALF_FLOAT:return f.webgl2?M.HALF_FLOAT:M.HALF_FLOAT_OES;case B.UNSIGNED_INT_24_8:return M.UNSIGNED_INT_24_8;case B.UNSIGNED_SHORT_4_4_4_4:return M.UNSIGNED_SHORT_4_4_4_4;case B.UNSIGNED_SHORT_5_5_5_1:return M.UNSIGNED_SHORT_5_5_5_1;case B.UNSIGNED_SHORT_5_6_5:return B.UNSIGNED_SHORT_5_6_5}};B.isPacked=function(i){return i===B.UNSIGNED_INT_24_8||i===B.UNSIGNED_SHORT_4_4_4_4||i===B.UNSIGNED_SHORT_5_5_5_1||i===B.UNSIGNED_SHORT_5_6_5};B.sizeInBytes=function(i){switch(i){case B.UNSIGNED_BYTE:return 1;case B.UNSIGNED_SHORT:case B.UNSIGNED_SHORT_4_4_4_4:case B.UNSIGNED_SHORT_5_5_5_1:case B.UNSIGNED_SHORT_5_6_5:case B.HALF_FLOAT:return 2;case B.UNSIGNED_INT:case B.FLOAT:case B.UNSIGNED_INT_24_8:return 4}};B.validate=function(i){return i===B.UNSIGNED_BYTE||i===B.UNSIGNED_SHORT||i===B.UNSIGNED_INT||i===B.FLOAT||i===B.HALF_FLOAT||i===B.UNSIGNED_INT_24_8||i===B.UNSIGNED_SHORT_4_4_4_4||i===B.UNSIGNED_SHORT_5_5_5_1||i===B.UNSIGNED_SHORT_5_6_5};B.getTypedArrayConstructor=function(i){let f=B.sizeInBytes(i);return f===Uint8Array.BYTES_PER_ELEMENT?Uint8Array:f===Uint16Array.BYTES_PER_ELEMENT?Uint16Array:f===Float32Array.BYTES_PER_ELEMENT&&i===B.FLOAT?Float32Array:Uint32Array};var H=Object.freeze(B);var A={DEPTH_COMPONENT:M.DEPTH_COMPONENT,DEPTH_STENCIL:M.DEPTH_STENCIL,ALPHA:M.ALPHA,RED:M.RED,RG:M.RG,RGB:M.RGB,RGBA:M.RGBA,LUMINANCE:M.LUMINANCE,LUMINANCE_ALPHA:M.LUMINANCE_ALPHA,RGB_DXT1:M.COMPRESSED_RGB_S3TC_DXT1_EXT,RGBA_DXT1:M.COMPRESSED_RGBA_S3TC_DXT1_EXT,RGBA_DXT3:M.COMPRESSED_RGBA_S3TC_DXT3_EXT,RGBA_DXT5:M.COMPRESSED_RGBA_S3TC_DXT5_EXT,RGB_PVRTC_4BPPV1:M.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,RGB_PVRTC_2BPPV1:M.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,RGBA_PVRTC_4BPPV1:M.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,RGBA_PVRTC_2BPPV1:M.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,RGBA_ASTC:M.COMPRESSED_RGBA_ASTC_4x4_WEBGL,RGB_ETC1:M.COMPRESSED_RGB_ETC1_WEBGL,RGB8_ETC2:M.COMPRESSED_RGB8_ETC2,RGBA8_ETC2_EAC:M.COMPRESSED_RGBA8_ETC2_EAC,RGBA_BC7:M.COMPRESSED_RGBA_BPTC_UNORM};A.componentsLength=function(i){switch(i){case A.RGB:return 3;case A.RGBA:return 4;case A.LUMINANCE_ALPHA:case A.RG:return 2;case A.ALPHA:case A.RED:case A.LUMINANCE:return 1;default:return 1}};A.validate=function(i){return i===A.DEPTH_COMPONENT||i===A.DEPTH_STENCIL||i===A.ALPHA||i===A.RED||i===A.RG||i===A.RGB||i===A.RGBA||i===A.LUMINANCE||i===A.LUMINANCE_ALPHA||i===A.RGB_DXT1||i===A.RGBA_DXT1||i===A.RGBA_DXT3||i===A.RGBA_DXT5||i===A.RGB_PVRTC_4BPPV1||i===A.RGB_PVRTC_2BPPV1||i===A.RGBA_PVRTC_4BPPV1||i===A.RGBA_PVRTC_2BPPV1||i===A.RGBA_ASTC||i===A.RGB_ETC1||i===A.RGB8_ETC2||i===A.RGBA8_ETC2_EAC||i===A.RGBA_BC7};A.isColorFormat=function(i){return i===A.RED||i===A.ALPHA||i===A.RGB||i===A.RGBA||i===A.LUMINANCE||i===A.LUMINANCE_ALPHA};A.isDepthFormat=function(i){return i===A.DEPTH_COMPONENT||i===A.DEPTH_STENCIL};A.isCompressedFormat=function(i){return i===A.RGB_DXT1||i===A.RGBA_DXT1||i===A.RGBA_DXT3||i===A.RGBA_DXT5||i===A.RGB_PVRTC_4BPPV1||i===A.RGB_PVRTC_2BPPV1||i===A.RGBA_PVRTC_4BPPV1||i===A.RGBA_PVRTC_2BPPV1||i===A.RGBA_ASTC||i===A.RGB_ETC1||i===A.RGB8_ETC2||i===A.RGBA8_ETC2_EAC||i===A.RGBA_BC7};A.isDXTFormat=function(i){return i===A.RGB_DXT1||i===A.RGBA_DXT1||i===A.RGBA_DXT3||i===A.RGBA_DXT5};A.isPVRTCFormat=function(i){return i===A.RGB_PVRTC_4BPPV1||i===A.RGB_PVRTC_2BPPV1||i===A.RGBA_PVRTC_4BPPV1||i===A.RGBA_PVRTC_2BPPV1};A.isASTCFormat=function(i){return i===A.RGBA_ASTC};A.isETC1Format=function(i){return i===A.RGB_ETC1};A.isETC2Format=function(i){return i===A.RGB8_ETC2||i===A.RGBA8_ETC2_EAC};A.isBC7Format=function(i){return i===A.RGBA_BC7};A.compressedTextureSizeInBytes=function(i,f,r){switch(i){case A.RGB_DXT1:case A.RGBA_DXT1:case A.RGB_ETC1:case A.RGB8_ETC2:return Math.floor((f+3)/4)*Math.floor((r+3)/4)*8;case A.RGBA_DXT3:case A.RGBA_DXT5:case A.RGBA_ASTC:case A.RGBA8_ETC2_EAC:return Math.floor((f+3)/4)*Math.floor((r+3)/4)*16;case A.RGB_PVRTC_4BPPV1:case A.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(f,8)*Math.max(r,8)*4+7)/8);case A.RGB_PVRTC_2BPPV1:case A.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(f,16)*Math.max(r,8)*2+7)/8);case A.RGBA_BC7:return Math.ceil(f/4)*Math.ceil(r/4)*16;default:return 0}};A.textureSizeInBytes=function(i,f,r,C){let l=A.componentsLength(i);return H.isPacked(f)&&(l=1),l*H.sizeInBytes(f)*r*C};A.alignmentInBytes=function(i,f,r){let C=A.textureSizeInBytes(i,f,r,1)%4;return C===0?4:C===2?2:1};A.createTypedArray=function(i,f,r,C){let l=H.getTypedArrayConstructor(f),p=A.componentsLength(i)*r*C;return new l(p)};A.flipY=function(i,f,r,C,l){if(l===1)return i;let p=A.createTypedArray(f,r,C,l),F=A.componentsLength(f),U=C*F;for(let y=0;y<l;++y){let m=y*C*F,V=(l-y-1)*C*F;for(let d=0;d<U;++d)p[V+d]=i[m+d]}return p};A.toInternalFormat=function(i,f,r){if(!r.webgl2)return i;if(i===A.DEPTH_STENCIL)return M.DEPTH24_STENCIL8;if(i===A.DEPTH_COMPONENT){if(f===H.UNSIGNED_SHORT)return M.DEPTH_COMPONENT16;if(f===H.UNSIGNED_INT)return M.DEPTH_COMPONENT24}if(f===H.FLOAT)switch(i){case A.RGBA:return M.RGBA32F;case A.RGB:return M.RGB32F;case A.RG:return M.RG32F;case A.RED:return M.R32F}if(f===H.HALF_FLOAT)switch(i){case A.RGBA:return M.RGBA16F;case A.RGB:return M.RGB16F;case A.RG:return M.RG16F;case A.RED:return M.R16F}return i};var E=Object.freeze(A);var or={VK_FORMAT_UNDEFINED:0,VK_FORMAT_R4G4_UNORM_PACK8:1,VK_FORMAT_R4G4B4A4_UNORM_PACK16:2,VK_FORMAT_B4G4R4A4_UNORM_PACK16:3,VK_FORMAT_R5G6B5_UNORM_PACK16:4,VK_FORMAT_B5G6R5_UNORM_PACK16:5,VK_FORMAT_R5G5B5A1_UNORM_PACK16:6,VK_FORMAT_B5G5R5A1_UNORM_PACK16:7,VK_FORMAT_A1R5G5B5_UNORM_PACK16:8,VK_FORMAT_R8_UNORM:9,VK_FORMAT_R8_SNORM:10,VK_FORMAT_R8_USCALED:11,VK_FORMAT_R8_SSCALED:12,VK_FORMAT_R8_UINT:13,VK_FORMAT_R8_SINT:14,VK_FORMAT_R8_SRGB:15,VK_FORMAT_R8G8_UNORM:16,VK_FORMAT_R8G8_SNORM:17,VK_FORMAT_R8G8_USCALED:18,VK_FORMAT_R8G8_SSCALED:19,VK_FORMAT_R8G8_UINT:20,VK_FORMAT_R8G8_SINT:21,VK_FORMAT_R8G8_SRGB:22,VK_FORMAT_R8G8B8_UNORM:23,VK_FORMAT_R8G8B8_SNORM:24,VK_FORMAT_R8G8B8_USCALED:25,VK_FORMAT_R8G8B8_SSCALED:26,VK_FORMAT_R8G8B8_UINT:27,VK_FORMAT_R8G8B8_SINT:28,VK_FORMAT_R8G8B8_SRGB:29,VK_FORMAT_B8G8R8_UNORM:30,VK_FORMAT_B8G8R8_SNORM:31,VK_FORMAT_B8G8R8_USCALED:32,VK_FORMAT_B8G8R8_SSCALED:33,VK_FORMAT_B8G8R8_UINT:34,VK_FORMAT_B8G8R8_SINT:35,VK_FORMAT_B8G8R8_SRGB:36,VK_FORMAT_R8G8B8A8_UNORM:37,VK_FORMAT_R8G8B8A8_SNORM:38,VK_FORMAT_R8G8B8A8_USCALED:39,VK_FORMAT_R8G8B8A8_SSCALED:40,VK_FORMAT_R8G8B8A8_UINT:41,VK_FORMAT_R8G8B8A8_SINT:42,VK_FORMAT_R8G8B8A8_SRGB:43,VK_FORMAT_B8G8R8A8_UNORM:44,VK_FORMAT_B8G8R8A8_SNORM:45,VK_FORMAT_B8G8R8A8_USCALED:46,VK_FORMAT_B8G8R8A8_SSCALED:47,VK_FORMAT_B8G8R8A8_UINT:48,VK_FORMAT_B8G8R8A8_SINT:49,VK_FORMAT_B8G8R8A8_SRGB:50,VK_FORMAT_A8B8G8R8_UNORM_PACK32:51,VK_FORMAT_A8B8G8R8_SNORM_PACK32:52,VK_FORMAT_A8B8G8R8_USCALED_PACK32:53,VK_FORMAT_A8B8G8R8_SSCALED_PACK32:54,VK_FORMAT_A8B8G8R8_UINT_PACK32:55,VK_FORMAT_A8B8G8R8_SINT_PACK32:56,VK_FORMAT_A8B8G8R8_SRGB_PACK32:57,VK_FORMAT_A2R10G10B10_UNORM_PACK32:58,VK_FORMAT_A2R10G10B10_SNORM_PACK32:59,VK_FORMAT_A2R10G10B10_USCALED_PACK32:60,VK_FORMAT_A2R10G10B10_SSCALED_PACK32:61,VK_FORMAT_A2R10G10B10_UINT_PACK32:62,VK_FORMAT_A2R10G10B10_SINT_PACK32:63,VK_FORMAT_A2B10G10R10_UNORM_PACK32:64,VK_FORMAT_A2B10G10R10_SNORM_PACK32:65,VK_FORMAT_A2B10G10R10_USCALED_PACK32:66,VK_FORMAT_A2B10G10R10_SSCALED_PACK32:67,VK_FORMAT_A2B10G10R10_UINT_PACK32:68,VK_FORMAT_A2B10G10R10_SINT_PACK32:69,VK_FORMAT_R16_UNORM:70,VK_FORMAT_R16_SNORM:71,VK_FORMAT_R16_USCALED:72,VK_FORMAT_R16_SSCALED:73,VK_FORMAT_R16_UINT:74,VK_FORMAT_R16_SINT:75,VK_FORMAT_R16_SFLOAT:76,VK_FORMAT_R16G16_UNORM:77,VK_FORMAT_R16G16_SNORM:78,VK_FORMAT_R16G16_USCALED:79,VK_FORMAT_R16G16_SSCALED:80,VK_FORMAT_R16G16_UINT:81,VK_FORMAT_R16G16_SINT:82,VK_FORMAT_R16G16_SFLOAT:83,VK_FORMAT_R16G16B16_UNORM:84,VK_FORMAT_R16G16B16_SNORM:85,VK_FORMAT_R16G16B16_USCALED:86,VK_FORMAT_R16G16B16_SSCALED:87,VK_FORMAT_R16G16B16_UINT:88,VK_FORMAT_R16G16B16_SINT:89,VK_FORMAT_R16G16B16_SFLOAT:90,VK_FORMAT_R16G16B16A16_UNORM:91,VK_FORMAT_R16G16B16A16_SNORM:92,VK_FORMAT_R16G16B16A16_USCALED:93,VK_FORMAT_R16G16B16A16_SSCALED:94,VK_FORMAT_R16G16B16A16_UINT:95,VK_FORMAT_R16G16B16A16_SINT:96,VK_FORMAT_R16G16B16A16_SFLOAT:97,VK_FORMAT_R32_UINT:98,VK_FORMAT_R32_SINT:99,VK_FORMAT_R32_SFLOAT:100,VK_FORMAT_R32G32_UINT:101,VK_FORMAT_R32G32_SINT:102,VK_FORMAT_R32G32_SFLOAT:103,VK_FORMAT_R32G32B32_UINT:104,VK_FORMAT_R32G32B32_SINT:105,VK_FORMAT_R32G32B32_SFLOAT:106,VK_FORMAT_R32G32B32A32_UINT:107,VK_FORMAT_R32G32B32A32_SINT:108,VK_FORMAT_R32G32B32A32_SFLOAT:109,VK_FORMAT_R64_UINT:110,VK_FORMAT_R64_SINT:111,VK_FORMAT_R64_SFLOAT:112,VK_FORMAT_R64G64_UINT:113,VK_FORMAT_R64G64_SINT:114,VK_FORMAT_R64G64_SFLOAT:115,VK_FORMAT_R64G64B64_UINT:116,VK_FORMAT_R64G64B64_SINT:117,VK_FORMAT_R64G64B64_SFLOAT:118,VK_FORMAT_R64G64B64A64_UINT:119,VK_FORMAT_R64G64B64A64_SINT:120,VK_FORMAT_R64G64B64A64_SFLOAT:121,VK_FORMAT_B10G11R11_UFLOAT_PACK32:122,VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:123,VK_FORMAT_D16_UNORM:124,VK_FORMAT_X8_D24_UNORM_PACK32:125,VK_FORMAT_D32_SFLOAT:126,VK_FORMAT_S8_UINT:127,VK_FORMAT_D16_UNORM_S8_UINT:128,VK_FORMAT_D24_UNORM_S8_UINT:129,VK_FORMAT_D32_SFLOAT_S8_UINT:130,VK_FORMAT_BC1_RGB_UNORM_BLOCK:131,VK_FORMAT_BC1_RGB_SRGB_BLOCK:132,VK_FORMAT_BC1_RGBA_UNORM_BLOCK:133,VK_FORMAT_BC1_RGBA_SRGB_BLOCK:134,VK_FORMAT_BC2_UNORM_BLOCK:135,VK_FORMAT_BC2_SRGB_BLOCK:136,VK_FORMAT_BC3_UNORM_BLOCK:137,VK_FORMAT_BC3_SRGB_BLOCK:138,VK_FORMAT_BC4_UNORM_BLOCK:139,VK_FORMAT_BC4_SNORM_BLOCK:140,VK_FORMAT_BC5_UNORM_BLOCK:141,VK_FORMAT_BC5_SNORM_BLOCK:142,VK_FORMAT_BC6H_UFLOAT_BLOCK:143,VK_FORMAT_BC6H_SFLOAT_BLOCK:144,VK_FORMAT_BC7_UNORM_BLOCK:145,VK_FORMAT_BC7_SRGB_BLOCK:146,VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:147,VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:148,VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK:149,VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK:150,VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK:151,VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:152,VK_FORMAT_EAC_R11_UNORM_BLOCK:153,VK_FORMAT_EAC_R11_SNORM_BLOCK:154,VK_FORMAT_EAC_R11G11_UNORM_BLOCK:155,VK_FORMAT_EAC_R11G11_SNORM_BLOCK:156,VK_FORMAT_ASTC_4x4_UNORM_BLOCK:157,VK_FORMAT_ASTC_4x4_SRGB_BLOCK:158,VK_FORMAT_ASTC_5x4_UNORM_BLOCK:159,VK_FORMAT_ASTC_5x4_SRGB_BLOCK:160,VK_FORMAT_ASTC_5x5_UNORM_BLOCK:161,VK_FORMAT_ASTC_5x5_SRGB_BLOCK:162,VK_FORMAT_ASTC_6x5_UNORM_BLOCK:163,VK_FORMAT_ASTC_6x5_SRGB_BLOCK:164,VK_FORMAT_ASTC_6x6_UNORM_BLOCK:165,VK_FORMAT_ASTC_6x6_SRGB_BLOCK:166,VK_FORMAT_ASTC_8x5_UNORM_BLOCK:167,VK_FORMAT_ASTC_8x5_SRGB_BLOCK:168,VK_FORMAT_ASTC_8x6_UNORM_BLOCK:169,VK_FORMAT_ASTC_8x6_SRGB_BLOCK:170,VK_FORMAT_ASTC_8x8_UNORM_BLOCK:171,VK_FORMAT_ASTC_8x8_SRGB_BLOCK:172,VK_FORMAT_ASTC_10x5_UNORM_BLOCK:173,VK_FORMAT_ASTC_10x5_SRGB_BLOCK:174,VK_FORMAT_ASTC_10x6_UNORM_BLOCK:175,VK_FORMAT_ASTC_10x6_SRGB_BLOCK:176,VK_FORMAT_ASTC_10x8_UNORM_BLOCK:177,VK_FORMAT_ASTC_10x8_SRGB_BLOCK:178,VK_FORMAT_ASTC_10x10_UNORM_BLOCK:179,VK_FORMAT_ASTC_10x10_SRGB_BLOCK:180,VK_FORMAT_ASTC_12x10_UNORM_BLOCK:181,VK_FORMAT_ASTC_12x10_SRGB_BLOCK:182,VK_FORMAT_ASTC_12x12_UNORM_BLOCK:183,VK_FORMAT_ASTC_12x12_SRGB_BLOCK:184,VK_FORMAT_G8B8G8R8_422_UNORM:1000156e3,VK_FORMAT_B8G8R8G8_422_UNORM:1000156001,VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM:1000156002,VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:1000156003,VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM:1000156004,VK_FORMAT_G8_B8R8_2PLANE_422_UNORM:1000156005,VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM:1000156006,VK_FORMAT_R10X6_UNORM_PACK16:1000156007,VK_FORMAT_R10X6G10X6_UNORM_2PACK16:1000156008,VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16:1000156009,VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16:1000156010,VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16:1000156011,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16:1000156012,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16:1000156013,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16:1000156014,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16:1000156015,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16:1000156016,VK_FORMAT_R12X4_UNORM_PACK16:1000156017,VK_FORMAT_R12X4G12X4_UNORM_2PACK16:1000156018,VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16:1000156019,VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16:1000156020,VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16:1000156021,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16:1000156022,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16:1000156023,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16:1000156024,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16:1000156025,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16:1000156026,VK_FORMAT_G16B16G16R16_422_UNORM:1000156027,VK_FORMAT_B16G16R16G16_422_UNORM:1000156028,VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM:1000156029,VK_FORMAT_G16_B16R16_2PLANE_420_UNORM:1000156030,VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM:1000156031,VK_FORMAT_G16_B16R16_2PLANE_422_UNORM:1000156032,VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM:1000156033,VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG:1000054e3,VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG:1000054001,VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG:1000054002,VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG:1000054003,VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG:1000054004,VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG:1000054005,VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG:1000054006,VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG:1000054007,VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT:1000066e3,VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT:1000066001,VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT:1000066002,VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT:1000066003,VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT:1000066004,VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT:1000066005,VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT:1000066006,VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT:1000066007,VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT:1000066008,VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT:1000066009,VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT:1000066010,VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT:1000066011,VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT:1000066012,VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT:1000066013,VK_FORMAT_G8B8G8R8_422_UNORM_KHR:1000156e3,VK_FORMAT_B8G8R8G8_422_UNORM_KHR:1000156001,VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR:1000156002,VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR:1000156003,VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR:1000156004,VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR:1000156005,VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR:1000156006,VK_FORMAT_R10X6_UNORM_PACK16_KHR:1000156007,VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR:1000156008,VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR:1000156009,VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR:1000156010,VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR:1000156011,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR:1000156012,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR:1000156013,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR:1000156014,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR:1000156015,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR:1000156016,VK_FORMAT_R12X4_UNORM_PACK16_KHR:1000156017,VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR:1000156018,VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR:1000156019,VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR:1000156020,VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR:1000156021,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR:1000156022,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR:1000156023,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR:1000156024,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR:1000156025,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR:1000156026,VK_FORMAT_G16B16G16R16_422_UNORM_KHR:1000156027,VK_FORMAT_B16G16R16G16_422_UNORM_KHR:1000156028,VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR:1000156029,VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR:1000156030,VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR:1000156031,VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR:1000156032,VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR:1000156033},Le=Object.freeze(or);var Vt=class{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}},Oe=class{constructor(f,r,C,l){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(f.buffer,f.byteOffset+r,C),this._littleEndian=l,this._offset=0}_nextUint8(){let f=this._dataView.getUint8(this._offset);return this._offset+=1,f}_nextUint16(){let f=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,f}_nextUint32(){let f=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,f}_nextUint64(){let f=this._dataView.getUint32(this._offset,this._littleEndian),r=this._dataView.getUint32(this._offset+4,this._littleEndian),C=f+2**32*r;return this._offset+=8,C}_nextInt32(){let f=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,f}_nextUint8Array(f){let r=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,f);return this._offset+=f,r}_skip(f){return this._offset+=f,this}_scan(f,r=0){let C=this._offset,l=0;for(;this._dataView.getUint8(this._offset)!==r&&l<f;)l++,this._offset++;return l<f&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+C,l)}};var Fr=new Uint8Array([0]),b=[171,75,84,88,32,50,48,187,13,10,26,10];function rn(i){return new TextDecoder().decode(i)}function sn(i){let f=new Uint8Array(i.buffer,i.byteOffset,b.length);if(f[0]!==b[0]||f[1]!==b[1]||f[2]!==b[2]||f[3]!==b[3]||f[4]!==b[4]||f[5]!==b[5]||f[6]!==b[6]||f[7]!==b[7]||f[8]!==b[8]||f[9]!==b[9]||f[10]!==b[10]||f[11]!==b[11])throw new Error("Missing KTX 2.0 identifier.");let r=new Vt,C=17*Uint32Array.BYTES_PER_ELEMENT,l=new Oe(i,b.length,C,!0);r.vkFormat=l._nextUint32(),r.typeSize=l._nextUint32(),r.pixelWidth=l._nextUint32(),r.pixelHeight=l._nextUint32(),r.pixelDepth=l._nextUint32(),r.layerCount=l._nextUint32(),r.faceCount=l._nextUint32();let p=l._nextUint32();r.supercompressionScheme=l._nextUint32();let F=l._nextUint32(),U=l._nextUint32(),y=l._nextUint32(),m=l._nextUint32(),V=l._nextUint64(),d=l._nextUint64(),P=p*3*8,Q=new Oe(i,b.length+C,P,!0);for(let L=0;L<p;L++)r.levels.push({levelData:new Uint8Array(i.buffer,i.byteOffset+Q._nextUint64(),Q._nextUint64()),uncompressedByteLength:Q._nextUint64()});let u=new Oe(i,F,U,!0),X={vendorId:u._skip(4)._nextUint16(),descriptorType:u._nextUint16(),versionNumber:u._nextUint16(),descriptorBlockSize:u._nextUint16(),colorModel:u._nextUint8(),colorPrimaries:u._nextUint8(),transferFunction:u._nextUint8(),flags:u._nextUint8(),texelBlockDimension:[u._nextUint8(),u._nextUint8(),u._nextUint8(),u._nextUint8()],bytesPlane:[u._nextUint8(),u._nextUint8(),u._nextUint8(),u._nextUint8(),u._nextUint8(),u._nextUint8(),u._nextUint8(),u._nextUint8()],samples:[]},W=(X.descriptorBlockSize/4-6)/4;for(let L=0;L<W;L++){let j={bitOffset:u._nextUint16(),bitLength:u._nextUint8(),channelType:u._nextUint8(),samplePosition:[u._nextUint8(),u._nextUint8(),u._nextUint8(),u._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};j.channelType&64?(j.sampleLower=u._nextInt32(),j.sampleUpper=u._nextInt32()):(j.sampleLower=u._nextUint32(),j.sampleUpper=u._nextUint32()),X.samples[L]=j}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(X);let J=new Oe(i,y,m,!0);for(;J._offset<m;){let L=J._nextUint32(),j=J._scan(L),Ae=rn(j);if(r.keyValue[Ae]=J._nextUint8Array(L-j.byteLength-1),Ae.match(/^ktx/i)){let xe=rn(r.keyValue[Ae]);r.keyValue[Ae]=xe.substring(0,xe.lastIndexOf("\0"))}let at=L%4?4-L%4:0;J._skip(at)}if(d<=0)return r;let g=new Oe(i,V,d,!0),Fe=g._nextUint16(),st=g._nextUint16(),ee=g._nextUint32(),De=g._nextUint32(),Ie=g._nextUint32(),ae=g._nextUint32(),ot=[];for(let L=0;L<p;L++)ot.push({imageFlags:g._nextUint32(),rgbSliceByteOffset:g._nextUint32(),rgbSliceByteLength:g._nextUint32(),alphaSliceByteOffset:g._nextUint32(),alphaSliceByteLength:g._nextUint32()});let ce=V+g._offset,de=ce+ee,be=de+De,Se=be+Ie,we=new Uint8Array(i.buffer,i.byteOffset+ce,ee),He=new Uint8Array(i.buffer,i.byteOffset+de,De),Xe=new Uint8Array(i.buffer,i.byteOffset+be,Ie),Rt=new Uint8Array(i.buffer,i.byteOffset+Se,ae);return r.globalData={endpointCount:Fe,selectorCount:st,imageDescs:ot,endpointsData:we,selectorsData:He,tablesData:Xe,extendedData:Rt},r}var Rn=sr(on(),1),an=["positiveX","negativeX","positiveY","negativeY","positiveZ","negativeZ"],cn=163,An=166,me;function Rr(i,f){nn.typeOf.object("transcoderModule",me);let r=i.ktx2Buffer,C=i.supportedTargetFormats,l;try{l=sn(r)}catch{throw new ie("Invalid KTX2 file.")}if(l.layerCount!==0)throw new ie("KTX2 texture arrays are not supported.");if(l.pixelDepth!==0)throw new ie("KTX2 3D textures are unsupported.");let p=l.dataFormatDescriptor[0],F=new Array(l.levelCount);return l.vkFormat===0&&(p.colorModel===cn||p.colorModel===An)?cr(r,l,C,me,f,F):(f.push(r.buffer),ar(l,F)),F}function ar(i,f){let r=i.vkFormat===Le.VK_FORMAT_R8G8B8_SRGB?E.RGB:E.RGBA,C;i.vkFormat===Le.VK_FORMAT_R8G8B8A8_UNORM?C=H.UNSIGNED_BYTE:i.vkFormat===Le.VK_FORMAT_R16G16B16A16_SFLOAT?C=H.HALF_FLOAT:i.vkFormat===Le.VK_FORMAT_R32G32B32A32_SFLOAT&&(C=H.FLOAT);for(let l=0;l<i.levels.length;++l){let p={};f[l]=p;let F=i.levels[l].levelData,U=i.pixelWidth>>l,y=i.pixelHeight>>l,m=U*y*E.componentsLength(r);for(let V=0;V<i.faceCount;++V){let d=F.byteOffset+m*i.typeSize*V,P;!ge(C)||H.sizeInBytes(C)===1?P=new Uint8Array(F.buffer,d,m):H.sizeInBytes(C)===2?P=new Uint16Array(F.buffer,d,m):P=new Float32Array(F.buffer,d,m),p[an[V]]={internalFormat:r,datatype:C,width:U,height:y,levelBuffer:P}}}}function cr(i,f,r,C,l,p){let F=new C.KTX2File(i),U=F.getWidth(),y=F.getHeight(),m=F.getLevels(),V=F.getHasAlpha();if(!(U>0)||!(y>0)||!(m>0))throw F.close(),F.delete(),new ie("Invalid KTX2 file");let d,P,Q=f.dataFormatDescriptor[0],u=C.transcoder_texture_format;if(Q.colorModel===cn)if(r.etc)d=V?E.RGBA8_ETC2_EAC:E.RGB8_ETC2,P=V?u.cTFETC2_RGBA:u.cTFETC1_RGB;else if(r.etc1&&!V)d=E.RGB_ETC1,P=u.cTFETC1_RGB;else if(r.s3tc)d=V?E.RGBA_DXT5:E.RGB_DXT1,P=V?u.cTFBC3_RGBA:u.cTFBC1_RGB;else if(r.pvrtc)d=V?E.RGBA_PVRTC_4BPPV1:E.RGB_PVRTC_4BPPV1,P=V?u.cTFPVRTC1_4_RGBA:u.cTFPVRTC1_4_RGB;else if(r.astc)d=E.RGBA_ASTC,P=u.cTFASTC_4x4_RGBA;else if(r.bc7)d=E.RGBA_BC7,P=u.cTFBC7_RGBA;else throw new ie("No transcoding format target available for ETC1S compressed ktx2.");else if(Q.colorModel===An)if(r.astc)d=E.RGBA_ASTC,P=u.cTFASTC_4x4_RGBA;else if(r.bc7)d=E.RGBA_BC7,P=u.cTFBC7_RGBA;else if(r.s3tc)d=V?E.RGBA_DXT5:E.RGB_DXT1,P=V?u.cTFBC3_RGBA:u.cTFBC1_RGB;else if(r.etc)d=V?E.RGBA8_ETC2_EAC:E.RGB8_ETC2,P=V?u.cTFETC2_RGBA:u.cTFETC1_RGB;else if(r.etc1&&!V)d=E.RGB_ETC1,P=u.cTFETC1_RGB;else if(r.pvrtc)d=V?E.RGBA_PVRTC_4BPPV1:E.RGB_PVRTC_4BPPV1,P=V?u.cTFPVRTC1_4_RGBA:u.cTFPVRTC1_4_RGB;else throw new ie("No transcoding format target available for UASTC compressed ktx2.");if(!F.startTranscoding())throw F.close(),F.delete(),new ie("startTranscoding() failed");for(let X=0;X<f.levels.length;++X){let se={};p[X]=se,U=f.pixelWidth>>X,y=f.pixelHeight>>X;let le=F.getImageTranscodedSizeInBytes(X,0,0,P.value),W=new Uint8Array(le),J=F.transcodeImage(W,X,0,0,P.value,0,-1,-1);if(!ge(J))throw new ie("transcodeImage() failed.");l.push(W.buffer),se[an[0]]={internalFormat:d,width:U,height:y,levelBuffer:W}}return F.close(),F.delete(),p}async function Ar(i,f){let r=i.webAssemblyConfig,C=Rn.default??self.BASIS;return ge(r.wasmBinaryFile)?me=await C(r):me=await C(),me.initializeBasis(),!0}function fr(i,f){let r=i.webAssemblyConfig;return ge(r)?Ar(i,f):Rr(i,f)}var hr=_n(fr);export{hr as default};
