/**
 * @license
 * Cesium - https://github.com/CesiumGS/cesium
 * Version 1.126
 *
 * 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 rn}from"./chunk-BC3RBQRQ.js";import{a as M}from"./chunk-GMF7KJHC.js";import{a as ie}from"./chunk-NYFH7JC3.js";import{a as _n}from"./chunk-I2ICH2LD.js";import{b as nn}from"./chunk-R6A52HT4.js";import{a as Gt,c as sr,d as or,e as ge}from"./chunk-D32DZSEC.js";var Rn=sr(((t,e)=>{var r=function(){var t=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(t=t||__filename),function(e){e=e||{};var r,n,_=typeof e<"u"?e:{};_.ready=new Promise((function(t,e){r=t,n=e}));var i,o={};for(i in _)_.hasOwnProperty(i)&&(o[i]=_[i]);var a=[],s=!1,u=!1,R=!1,c=!1;s="object"==typeof window,u="function"==typeof importScripts,R="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,c=!s&&!R&&!u;var A,f,T,l,O,p="";function B(t){return _.locateFile?_.locateFile(t,p):p+t}R?(p=u?Gt("path").dirname(p)+"/":__dirname+"/",A=function(t,e){return l||(l=Gt("fs")),O||(O=Gt("path")),t=O.normalize(t),l.readFileSync(t,e?null:"utf8")},T=function(t){var e=A(t,!0);return e.buffer||(e=new Uint8Array(e)),F(e.buffer),e},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),a=process.argv.slice(2),process.on("uncaughtException",(function(t){if(!(t instanceof Zr))throw t})),process.on("unhandledRejection",ft),function(t){process.exit(t)},_.inspect=function(){return"[Emscripten Module object]"}):c?(typeof read<"u"&&(A=function(t){return read(t)}),T=function(t){var e;return"function"==typeof readbuffer?new Uint8Array(readbuffer(t)):(e=read(t,"binary"),F("object"==typeof e),e)},typeof scriptArgs<"u"?a=scriptArgs:typeof arguments<"u"&&(a=arguments),"function"==typeof quit&&function(t){quit(t)},typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)):(s||u)&&(u?p=self.location.href:typeof document<"u"&&document.currentScript&&(p=document.currentScript.src),t&&(p=t),p=0!==p.indexOf("blob:")?p.substr(0,p.lastIndexOf("/")+1):"",A=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},u&&(T=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),f=function(t,e,r){var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?e(n.response):r()},n.onerror=r,n.send(null)});var M=_.print||console.log.bind(console),C=_.printErr||console.warn.bind(console);for(i in o)o.hasOwnProperty(i)&&(_[i]=o[i]);o=null,_.arguments&&(a=_.arguments),_.thisProgram&&_.thisProgram,_.quit&&_.quit;var h,d=function(t){t};_.wasmBinary&&(h=_.wasmBinary);_.noExitRuntime;"object"!=typeof WebAssembly&&ft("no native wasm support detected");var K,G=!1;function F(t,e){t||ft("Assertion failed: "+e)}var y=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function v(t,e,r){for(var n=e+r,_=e;t[_]&&!(_>=n);)++_;if(_-e>16&&t.subarray&&y)return y.decode(t.subarray(e,_));for(var i="";e<_;){var o=t[e++];if(128&o){var a=63&t[e++];if(192!=(224&o)){var s=63&t[e++];if(o=224==(240&o)?(15&o)<<12|a<<6|s:(7&o)<<18|a<<12|s<<6|63&t[e++],o<65536)i+=String.fromCharCode(o);else{var u=o-65536;i+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else i+=String.fromCharCode((31&o)<<6|a)}else i+=String.fromCharCode(o)}return i}function N(t,e){return t?v(U,t,e):""}function P(t,e,r,n){if(!(n>0))return 0;for(var _=r,i=r+n-1,o=0;o<t.length;++o){var a=t.charCodeAt(o);if(a>=55296&&a<=57343){var s=t.charCodeAt(++o);a=65536+((1023&a)<<10)|1023&s}if(a<=127){if(r>=i)break;e[r++]=a}else if(a<=2047){if(r+1>=i)break;e[r++]=192|a>>6,e[r++]=128|63&a}else if(a<=65535){if(r+2>=i)break;e[r++]=224|a>>12,e[r++]=128|a>>6&63,e[r++]=128|63&a}else{if(r+3>=i)break;e[r++]=240|a>>18,e[r++]=128|a>>12&63,e[r++]=128|a>>6&63,e[r++]=128|63&a}}return e[r]=0,r-_}function S(t,e,r){return P(t,U,e,r)}function V(t){for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);n>=55296&&n<=57343&&(n=65536+((1023&n)<<10)|1023&t.charCodeAt(++r)),n<=127?++e:e+=n<=2047?2:n<=65535?3:4}return e}var m,E,U,g,L,w,b,D,I,X=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function x(t,e){for(var r=t,n=r>>1,_=n+e/2;!(n>=_)&&L[n];)++n;if(r=n<<1,r-t>32&&X)return X.decode(U.subarray(t,r));for(var i="",o=0;!(o>=e/2);++o){var a=g[t+2*o>>1];if(0==a)break;i+=String.fromCharCode(a)}return i}function H(t,e,r){if(void 0===r&&(r=2147483647),r<2)return 0;r-=2;for(var n=e,_=r<2*t.length?r/2:t.length,i=0;i<_;++i){var o=t.charCodeAt(i);g[e>>1]=o,e+=2}return g[e>>1]=0,e-n}function $(t){return 2*t.length}function k(t,e){for(var r=0,n="";!(r>=e/4);){var _=w[t+4*r>>2];if(0==_)break;if(++r,_>=65536){var i=_-65536;n+=String.fromCharCode(55296|i>>10,56320|1023&i)}else n+=String.fromCharCode(_)}return n}function W(t,e,r){if(void 0===r&&(r=2147483647),r<4)return 0;for(var n=e,_=n+r-4,i=0;i<t.length;++i){var o=t.charCodeAt(i);if(o>=55296&&o<=57343){var a=t.charCodeAt(++i);o=65536+((1023&o)<<10)|1023&a}if(w[e>>2]=o,e+=4,e+4>_)break}return w[e>>2]=0,e-n}function j(t){for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);n>=55296&&n<=57343&&++r,e+=4}return e}function z(t,e){return t%e>0&&(t+=e-t%e),t}function Y(t){m=t,_.HEAP8=E=new Int8Array(t),_.HEAP16=g=new Int16Array(t),_.HEAP32=w=new Int32Array(t),_.HEAPU8=U=new Uint8Array(t),_.HEAPU16=L=new Uint16Array(t),_.HEAPU32=b=new Uint32Array(t),_.HEAPF32=D=new Float32Array(t),_.HEAPF64=I=new Float64Array(t)}_.INITIAL_MEMORY;var q,J=[],Z=[],Q=[],tt=[];function et(){if(_.preRun)for("function"==typeof _.preRun&&(_.preRun=[_.preRun]);_.preRun.length;)it(_.preRun.shift());Kt(J)}function rt(){!0,Kt(Z)}function nt(){Kt(Q)}function _t(){if(_.postRun)for("function"==typeof _.postRun&&(_.postRun=[_.postRun]);_.postRun.length;)at(_.postRun.shift());Kt(tt)}function it(t){J.unshift(t)}function ot(t){Z.unshift(t)}function at(t){tt.unshift(t)}var st=0,ut=null,Rt=null;function ct(t){st++,_.monitorRunDependencies&&_.monitorRunDependencies(st)}function At(t){if(st--,_.monitorRunDependencies&&_.monitorRunDependencies(st),0==st&&(null!==ut&&(clearInterval(ut),ut=null),Rt)){var e=Rt;Rt=null,e()}}function ft(t){_.onAbort&&_.onAbort(t),t+="",C(t),G=!0,1,t="abort("+t+"). Build with -s ASSERTIONS=1 for more info.";var e=new WebAssembly.RuntimeError(t);throw n(e),e}function Tt(t,e){return String.prototype.startsWith?t.startsWith(e):0===t.indexOf(e)}_.preloadedImages={},_.preloadedAudios={};var lt="data:application/octet-stream;base64,";function Ot(t){return Tt(t,lt)}var pt="file://";function Bt(t){return Tt(t,pt)}var Mt="basis_transcoder.wasm";function Ct(t){try{if(t==Mt&&h)return new Uint8Array(h);if(T)return T(t);throw"both async and sync fetching of the wasm failed"}catch(e){ft(e)}}function ht(){if(!h&&(s||u)){if("function"==typeof fetch&&!Bt(Mt))return fetch(Mt,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+Mt+"'";return t.arrayBuffer()})).catch((function(){return Ct(Mt)}));if(f)return new Promise((function(t,e){f(Mt,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return Ct(Mt)}))}function dt(){var t={a:zr};function e(t,e){var r=t.exports;_.asm=r,K=_.asm.K,Y(K.buffer),q=_.asm.O,ot(_.asm.L),At("wasm-instantiate")}function r(t){e(t.instance)}function i(e){return ht().then((function(e){var r=WebAssembly.instantiate(e,t);return r})).then(e,(function(t){C("failed to asynchronously prepare wasm: "+t),ft(t)}))}function o(){return h||"function"!=typeof WebAssembly.instantiateStreaming||Ot(Mt)||Bt(Mt)||"function"!=typeof fetch?i(r):fetch(Mt,{credentials:"same-origin"}).then((function(e){var n=WebAssembly.instantiateStreaming(e,t);return n.then(r,(function(t){return C("wasm streaming compile failed: "+t),C("falling back to ArrayBuffer instantiation"),i(r)}))}))}if(ct("wasm-instantiate"),_.instantiateWasm)try{var a=_.instantiateWasm(t,e);return a}catch(s){return C("Module.instantiateWasm callback failed with error: "+s),!1}return o().catch(n),{}}function Kt(t){for(;t.length>0;){var e=t.shift();if("function"!=typeof e){var r=e.func;"number"==typeof r?void 0===e.arg?q.get(r)():q.get(r)(e.arg):r(void 0===e.arg?null:e.arg)}else e(_)}}Ot(Mt)||(Mt=B(Mt));var Ft={};function yt(t){for(;t.length;){var e=t.pop(),r=t.pop();r(e)}}function vt(t){return this.fromWireType(b[t>>2])}var Nt={},Pt={},St={},Vt=48,mt=57;function Et(t){if(void 0===t)return"_unknown";t=t.replace(/[^a-zA-Z0-9_]/g,"$");var e=t.charCodeAt(0);return e>=Vt&&e<=mt?"_"+t:t}function Ut(t,e){return t=Et(t),new Function("body","return function "+t+'() {\n    "use strict";    return body.apply(this, arguments);\n};\n')(e)}function gt(t,e){var r=Ut(e,(function(t){this.name=e,this.message=t;var r=new Error(t).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},r}var Lt=void 0;function wt(t){throw new Lt(t)}function bt(t,e,r){function n(e){var n=r(e);n.length!==t.length&&wt("Mismatched type converter count");for(var _=0;_<t.length;++_)Wt(t[_],n[_])}t.forEach((function(t){St[t]=e}));var _=new Array(e.length),i=[],o=0;e.forEach((function(t,e){Pt.hasOwnProperty(t)?_[e]=Pt[t]:(i.push(t),Nt.hasOwnProperty(t)||(Nt[t]=[]),Nt[t].push((function(){_[e]=Pt[t],++o,o===i.length&&n(_)})))})),0===i.length&&n(_)}function Dt(t){var e=Ft[t];delete Ft[t];var r=e.rawConstructor,n=e.rawDestructor,_=e.fields,i=_.map((function(t){return t.getterReturnType})).concat(_.map((function(t){return t.setterArgumentType})));bt([t],i,(function(t){var i={};return _.forEach((function(e,r){var n=e.fieldName,o=t[r],a=e.getter,s=e.getterContext,u=t[r+_.length],R=e.setter,c=e.setterContext;i[n]={read:function(t){return o.fromWireType(a(s,t))},write:function(t,e){var r=[];R(c,t,u.toWireType(r,e)),yt(r)}}})),[{name:e.name,fromWireType:function(t){var e={};for(var r in i)e[r]=i[r].read(t);return n(t),e},toWireType:function(t,e){for(var _ in i)if(!(_ in e))throw new TypeError('Missing field:  "'+_+'"');var o=r();for(_ in i)i[_].write(o,e[_]);return null!==t&&t.push(n,o),o},argPackAdvance:8,readValueFromPointer:vt,destructorFunction:n}]}))}function It(t){switch(t){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+t)}}function Xt(){for(var t=new Array(256),e=0;e<256;++e)t[e]=String.fromCharCode(e);xt=t}var xt=void 0;function Ht(t){for(var e="",r=t;U[r];)e+=xt[U[r++]];return e}var $t=void 0;function kt(t){throw new $t(t)}function Wt(t,e,r){if(r=r||{},!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");var n=e.name;if(t||kt('type "'+n+'" must have a positive integer typeid pointer'),Pt.hasOwnProperty(t)){if(r.ignoreDuplicateRegistrations)return;kt("Cannot register type '"+n+"' twice")}if(Pt[t]=e,delete St[t],Nt.hasOwnProperty(t)){var _=Nt[t];delete Nt[t],_.forEach((function(t){t()}))}}function jt(t,e,r,n,_){var i=It(r);e=Ht(e),Wt(t,{name:e,fromWireType:function(t){return!!t},toWireType:function(t,e){return e?n:_},argPackAdvance:8,readValueFromPointer:function(t){var n;if(1===r)n=E;else if(2===r)n=g;else{if(4!==r)throw new TypeError("Unknown boolean type size: "+e);n=w}return this.fromWireType(n[t>>i])},destructorFunction:null})}function zt(t){if(!(this instanceof Re)||!(t instanceof Re))return!1;for(var e=this.$$.ptrType.registeredClass,r=this.$$.ptr,n=t.$$.ptrType.registeredClass,_=t.$$.ptr;e.baseClass;)r=e.upcast(r),e=e.baseClass;for(;n.baseClass;)_=n.upcast(_),n=n.baseClass;return e===n&&r===_}function Yt(t){return{count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType}}function qt(t){function e(t){return t.$$.ptrType.registeredClass.name}kt(e(t)+" instance already deleted")}var Jt=!1;function Zt(t){}function Qt(t){t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)}function te(t){t.count.value-=1;var e=0===t.count.value;e&&Qt(t)}function ee(t){return typeof FinalizationGroup>"u"?(ee=function(t){return t},t):(Jt=new FinalizationGroup((function(t){for(var e=t.next();!e.done;e=t.next()){var r=e.value;r.ptr?te(r):console.warn("object already deleted: "+r.ptr)}})),ee=function(t){return Jt.register(t,t.$$,t.$$),t},Zt=function(t){Jt.unregister(t.$$)},ee(t))}function re(){if(this.$$.ptr||qt(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=ee(Object.create(Object.getPrototypeOf(this),{$$:{value:Yt(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t}function ne(){this.$$.ptr||qt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&kt("Object already scheduled for deletion"),Zt(this),te(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function _e(){return!this.$$.ptr}var ie=void 0,oe=[];function ae(){for(;oe.length;){var t=oe.pop();t.$$.deleteScheduled=!1,t.delete()}}function se(){return this.$$.ptr||qt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&kt("Object already scheduled for deletion"),oe.push(this),1===oe.length&&ie&&ie(ae),this.$$.deleteScheduled=!0,this}function ue(){Re.prototype.isAliasOf=zt,Re.prototype.clone=re,Re.prototype.delete=ne,Re.prototype.isDeleted=_e,Re.prototype.deleteLater=se}function Re(){}var ce={};function Ae(t,e,r){if(void 0===t[e].overloadTable){var n=t[e];t[e]=function(){return t[e].overloadTable.hasOwnProperty(arguments.length)||kt("Function '"+r+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+t[e].overloadTable+")!"),t[e].overloadTable[arguments.length].apply(this,arguments)},t[e].overloadTable=[],t[e].overloadTable[n.argCount]=n}}function fe(t,e,r){_.hasOwnProperty(t)?((void 0===r||void 0!==_[t].overloadTable&&void 0!==_[t].overloadTable[r])&&kt("Cannot register public name '"+t+"' twice"),Ae(_,t,t),_.hasOwnProperty(r)&&kt("Cannot register multiple overloads of a function with the same number of arguments ("+r+")!"),_[t].overloadTable[r]=e):(_[t]=e,void 0!==r&&(_[t].numArguments=r))}function Te(t,e,r,n,_,i,o,a){this.name=t,this.constructor=e,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=_,this.getActualType=i,this.upcast=o,this.downcast=a,this.pureVirtualFunctions=[]}function le(t,e,r){for(;e!==r;)e.upcast||kt("Expected null or instance of "+r.name+", got an instance of "+e.name),t=e.upcast(t),e=e.baseClass;return t}function Oe(t,e){if(null===e)return this.isReference&&kt("null is not a valid "+this.name),0;e.$$||kt('Cannot pass "'+ar(e)+'" as a '+this.name),e.$$.ptr||kt("Cannot pass deleted object as a pointer of type "+this.name);var r=e.$$.ptrType.registeredClass,n=le(e.$$.ptr,r,this.registeredClass);return n}function pe(t,e){var r;if(null===e)return this.isReference&&kt("null is not a valid "+this.name),this.isSmartPointer?(r=this.rawConstructor(),null!==t&&t.push(this.rawDestructor,r),r):0;e.$$||kt('Cannot pass "'+ar(e)+'" as a '+this.name),e.$$.ptr||kt("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&e.$$.ptrType.isConst&&kt("Cannot convert argument of type "+(e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name)+" to parameter type "+this.name);var n=e.$$.ptrType.registeredClass;if(r=le(e.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===e.$$.smartPtr&&kt("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:e.$$.smartPtrType===this?r=e.$$.smartPtr:kt("Cannot convert argument of type "+(e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:r=e.$$.smartPtr;break;case 2:if(e.$$.smartPtrType===this)r=e.$$.smartPtr;else{var _=e.clone();r=this.rawShare(r,er((function(){_.delete()}))),null!==t&&t.push(this.rawDestructor,r)}break;default:kt("Unsupporting sharing policy")}return r}function Be(t,e){if(null===e)return this.isReference&&kt("null is not a valid "+this.name),0;e.$$||kt('Cannot pass "'+ar(e)+'" as a '+this.name),e.$$.ptr||kt("Cannot pass deleted object as a pointer of type "+this.name),e.$$.ptrType.isConst&&kt("Cannot convert argument of type "+e.$$.ptrType.name+" to parameter type "+this.name);var r=e.$$.ptrType.registeredClass,n=le(e.$$.ptr,r,this.registeredClass);return n}function Me(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t}function Ce(t){this.rawDestructor&&this.rawDestructor(t)}function he(t){null!==t&&t.delete()}function de(t,e,r){if(e===r)return t;if(void 0===r.baseClass)return null;var n=de(t,e,r.baseClass);return null===n?null:r.downcast(n)}function Ke(){return Object.keys(ve).length}function Ge(){var t=[];for(var e in ve)ve.hasOwnProperty(e)&&t.push(ve[e]);return t}function Fe(t){ie=t,oe.length&&ie&&ie(ae)}function ye(){_.getInheritedInstanceCount=Ke,_.getLiveInheritedInstances=Ge,_.flushPendingDeletes=ae,_.setDelayFunction=Fe}var ve={};function Ne(t,e){for(void 0===e&&kt("ptr should not be undefined");t.baseClass;)e=t.upcast(e),t=t.baseClass;return e}function Pe(t,e){return e=Ne(t,e),ve[e]}function Se(t,e){(!e.ptrType||!e.ptr)&&wt("makeClassHandle requires ptr and ptrType");var r=!!e.smartPtrType,n=!!e.smartPtr;return r!==n&&wt("Both smartPtrType and smartPtr must be specified"),e.count={value:1},ee(Object.create(t,{$$:{value:e}}))}function Ve(t){var e=this.getPointee(t);if(!e)return this.destructor(t),null;var r=Pe(this.registeredClass,e);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=e,r.$$.smartPtr=t,r.clone();var n=r.clone();return this.destructor(t),n}function _(){return this.isSmartPointer?Se(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:e,smartPtrType:this,smartPtr:t}):Se(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var i,o=this.registeredClass.getActualType(e),a=ce[o];if(!a)return _.call(this);i=this.isConst?a.constPointerType:a.pointerType;var s=de(e,this.registeredClass,i.registeredClass);return null===s?_.call(this):this.isSmartPointer?Se(i.registeredClass.instancePrototype,{ptrType:i,ptr:s,smartPtrType:this,smartPtr:t}):Se(i.registeredClass.instancePrototype,{ptrType:i,ptr:s})}function me(){Ee.prototype.getPointee=Me,Ee.prototype.destructor=Ce,Ee.prototype.argPackAdvance=8,Ee.prototype.readValueFromPointer=vt,Ee.prototype.deleteObject=he,Ee.prototype.fromWireType=Ve}function Ee(t,e,r,n,_,i,o,a,s,u,R){this.name=t,this.registeredClass=e,this.isReference=r,this.isConst=n,this.isSmartPointer=_,this.pointeeType=i,this.sharingPolicy=o,this.rawGetPointee=a,this.rawConstructor=s,this.rawShare=u,this.rawDestructor=R,_||void 0!==e.baseClass?this.toWireType=pe:n?(this.toWireType=Oe,this.destructorFunction=null):(this.toWireType=Be,this.destructorFunction=null)}function Ue(t,e,r){_.hasOwnProperty(t)||wt("Replacing nonexistant public symbol"),void 0!==_[t].overloadTable&&void 0!==r?_[t].overloadTable[r]=e:(_[t]=e,_[t].argCount=r)}function ge(t,e,r){var n=_["dynCall_"+t];return r&&r.length?n.apply(null,[e].concat(r)):n.call(null,e)}function Le(t,e,r){return-1!=t.indexOf("j")?ge(t,e,r):q.get(e).apply(null,r)}function we(t,e){var r=[];return function(){r.length=arguments.length;for(var n=0;n<arguments.length;n++)r[n]=arguments[n];return Le(t,e,r)}}function be(t,e){function r(){return-1!=t.indexOf("j")?we(t,e):q.get(e)}t=Ht(t);var n=r();return"function"!=typeof n&&kt("unknown function pointer with signature "+t+": "+e),n}var De=void 0;function Ie(t){var e=Jr(t),r=Ht(e);return qr(e),r}function Xe(t,e){var r=[],n={};function _(t){if(!n[t]&&!Pt[t]){if(St[t])return void St[t].forEach(_);r.push(t),n[t]=!0}}throw e.forEach(_),new De(t+": "+r.map(Ie).join([", "]))}function xe(t,e,r,n,_,i,o,a,s,u,R,c,A){R=Ht(R),i=be(_,i),a&&(a=be(o,a)),u&&(u=be(s,u)),A=be(c,A);var f=Et(R);fe(f,(function(){Xe("Cannot construct "+R+" due to unbound types",[n])})),bt([t,e,r],n?[n]:[],(function(e){var r,_;e=e[0],n?(r=e.registeredClass,_=r.instancePrototype):_=Re.prototype;var o=Ut(f,(function(){if(Object.getPrototypeOf(this)!==s)throw new $t("Use 'new' to construct "+R);if(void 0===c.constructor_body)throw new $t(R+" has no accessible constructor");var t=c.constructor_body[arguments.length];if(void 0===t)throw new $t("Tried to invoke ctor of "+R+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(c.constructor_body).toString()+") parameters instead!");return t.apply(this,arguments)})),s=Object.create(_,{constructor:{value:o}});o.prototype=s;var c=new Te(R,o,s,A,r,i,a,u),T=new Ee(R,c,!0,!1,!1),l=new Ee(R+"*",c,!1,!1,!1),O=new Ee(R+" const*",c,!1,!0,!1);return ce[t]={pointerType:l,constPointerType:O},Ue(f,o),[T,l,O]}))}function He(t,e){for(var r=[],n=0;n<t;n++)r.push(w[(e>>2)+n]);return r}function $e(t,e,r,n,_,i){F(e>0);var o=He(e,r);_=be(n,_);var a=[i],s=[];bt([],[t],(function(t){t=t[0];var r="constructor "+t.name;if(void 0===t.registeredClass.constructor_body&&(t.registeredClass.constructor_body=[]),void 0!==t.registeredClass.constructor_body[e-1])throw new $t("Cannot register multiple constructors with identical number of parameters ("+(e-1)+") for class '"+t.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return t.registeredClass.constructor_body[e-1]=function(){Xe("Cannot construct "+t.name+" due to unbound types",o)},bt([],o,(function(n){return t.registeredClass.constructor_body[e-1]=function(){arguments.length!==e-1&&kt(r+" called with "+arguments.length+" arguments, expected "+(e-1)),s.length=0,a.length=e;for(var t=1;t<e;++t)a[t]=n[t].toWireType(s,arguments[t-1]);var i=_.apply(null,a);return yt(s),n[0].fromWireType(i)},[]})),[]}))}function ke(t,e){if(!(t instanceof Function))throw new TypeError("new_ called with constructor type "+typeof t+" which is not a function");var r=Ut(t.name||"unknownFunctionName",(function(){}));r.prototype=t.prototype;var n=new r,_=t.apply(n,e);return _ instanceof Object?_:n}function We(t,e,r,n,_){var i=e.length;i<2&&kt("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==e[1]&&null!==r,a=!1,s=1;s<e.length;++s)if(null!==e[s]&&void 0===e[s].destructorFunction){a=!0;break}var u="void"!==e[0].name,R="",c="";for(s=0;s<i-2;++s)R+=(0!==s?", ":"")+"arg"+s,c+=(0!==s?", ":"")+"arg"+s+"Wired";var A="return function "+Et(t)+"("+R+") {\nif (arguments.length !== "+(i-2)+") {\nthrowBindingError('function "+t+" called with ' + arguments.length + ' arguments, expected "+(i-2)+" args!');\n}\n";a&&(A+="var destructors = [];\n");var f=a?"destructors":"null",T=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],l=[kt,n,_,yt,e[0],e[1]];o&&(A+="var thisWired = classParam.toWireType("+f+", this);\n");for(s=0;s<i-2;++s)A+="var arg"+s+"Wired = argType"+s+".toWireType("+f+", arg"+s+"); // "+e[s+2].name+"\n",T.push("argType"+s),l.push(e[s+2]);if(o&&(c="thisWired"+(c.length>0?", ":"")+c),A+=(u?"var rv = ":"")+"invoker(fn"+(c.length>0?", ":"")+c+");\n",a)A+="runDestructors(destructors);\n";else for(s=o?1:2;s<e.length;++s){var O=1===s?"thisWired":"arg"+(s-2)+"Wired";null!==e[s].destructorFunction&&(A+=O+"_dtor("+O+"); // "+e[s].name+"\n",T.push(O+"_dtor"),l.push(e[s].destructorFunction))}u&&(A+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),A+="}\n",T.push(A);var p=ke(Function,T).apply(null,l);return p}function je(t,e,r,n,_,i,o,a){var s=He(r,n);e=Ht(e),i=be(_,i),bt([],[t],(function(t){t=t[0];var n=t.name+"."+e;function _(){Xe("Cannot call "+n+" due to unbound types",s)}a&&t.registeredClass.pureVirtualFunctions.push(e);var u=t.registeredClass.instancePrototype,R=u[e];return void 0===R||void 0===R.overloadTable&&R.className!==t.name&&R.argCount===r-2?(_.argCount=r-2,_.className=t.name,u[e]=_):(Ae(u,e,n),u[e].overloadTable[r-2]=_),bt([],s,(function(_){var a=We(n,_,t,i,o);return void 0===u[e].overloadTable?(a.argCount=r-2,u[e]=a):u[e].overloadTable[r-2]=a,[]})),[]}))}function ze(t,e,r){t=Ht(t),bt([],[e],(function(e){return e=e[0],_[t]=e.fromWireType(r),[]}))}var Ye=[],qe=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Je(t){t>4&&0===--qe[t].refcount&&(qe[t]=void 0,Ye.push(t))}function Ze(){for(var t=0,e=5;e<qe.length;++e)void 0!==qe[e]&&++t;return t}function Qe(){for(var t=5;t<qe.length;++t)if(void 0!==qe[t])return qe[t];return null}function tr(){_.count_emval_handles=Ze,_.get_first_emval=Qe}function er(t){switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var e=Ye.length?Ye.pop():qe.length;return qe[e]={refcount:1,value:t},e}}function rr(t,e){e=Ht(e),Wt(t,{name:e,fromWireType:function(t){var e=qe[t].value;return Je(t),e},toWireType:function(t,e){return er(e)},argPackAdvance:8,readValueFromPointer:vt,destructorFunction:null})}function nr(t,e,r){switch(e){case 0:return function(t){var e=r?E:U;return this.fromWireType(e[t])};case 1:return function(t){var e=r?g:L;return this.fromWireType(e[t>>1])};case 2:return function(t){var e=r?w:b;return this.fromWireType(e[t>>2])};default:throw new TypeError("Unknown integer type: "+t)}}function _r(t,e,r,n){var _=It(r);function i(){}e=Ht(e),i.values={},Wt(t,{name:e,constructor:i,fromWireType:function(t){return this.constructor.values[t]},toWireType:function(t,e){return e.value},argPackAdvance:8,readValueFromPointer:nr(e,_,n),destructorFunction:null}),fe(e,i)}function ir(t,e){var r=Pt[t];return void 0===r&&kt(e+" has unknown type "+Ie(t)),r}function or(t,e,r){var n=ir(t,"enum");e=Ht(e);var _=n.constructor,i=Object.create(n.constructor.prototype,{value:{value:r},constructor:{value:Ut(n.name+"_"+e,(function(){}))}});_.values[r]=i,_[e]=i}function ar(t){if(null===t)return"null";var e=typeof t;return"object"===e||"array"===e||"function"===e?t.toString():""+t}function sr(t,e){switch(e){case 2:return function(t){return this.fromWireType(D[t>>2])};case 3:return function(t){return this.fromWireType(I[t>>3])};default:throw new TypeError("Unknown float type: "+t)}}function ur(t,e,r){var n=It(r);e=Ht(e),Wt(t,{name:e,fromWireType:function(t){return t},toWireType:function(t,e){if("number"!=typeof e&&"boolean"!=typeof e)throw new TypeError('Cannot convert "'+ar(e)+'" to '+this.name);return e},argPackAdvance:8,readValueFromPointer:sr(e,n),destructorFunction:null})}function Rr(t,e,r,n,_,i){var o=He(e,r);t=Ht(t),_=be(n,_),fe(t,(function(){Xe("Cannot call "+t+" due to unbound types",o)}),e-1),bt([],o,(function(r){var n=[r[0],null].concat(r.slice(1));return Ue(t,We(t,n,null,_,i),e-1),[]}))}function cr(t,e,r){switch(e){case 0:return r?function(t){return E[t]}:function(t){return U[t]};case 1:return r?function(t){return g[t>>1]}:function(t){return L[t>>1]};case 2:return r?function(t){return w[t>>2]}:function(t){return b[t>>2]};default:throw new TypeError("Unknown integer type: "+t)}}function Ar(t,e,r,n,_){e=Ht(e),-1===_&&(_=4294967295);var i=It(r),o=function(t){return t};if(0===n){var a=32-8*r;o=function(t){return t<<a>>>a}}var s=-1!=e.indexOf("unsigned");Wt(t,{name:e,fromWireType:o,toWireType:function(t,r){if("number"!=typeof r&&"boolean"!=typeof r)throw new TypeError('Cannot convert "'+ar(r)+'" to '+this.name);if(r<n||r>_)throw new TypeError('Passing a number "'+ar(r)+'" from JS side to C/C++ side to an argument of type "'+e+'", which is outside the valid range ['+n+", "+_+"]!");return s?r>>>0:0|r},argPackAdvance:8,readValueFromPointer:cr(e,i,0!==n),destructorFunction:null})}function fr(t,e,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],_=n[e];function i(t){t>>=2;var e=b,r=e[t],n=e[t+1];return new _(m,n,r)}r=Ht(r),Wt(t,{name:r,fromWireType:i,argPackAdvance:8,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})}function Tr(t,e){e=Ht(e);var r="std::string"===e;Wt(t,{name:e,fromWireType:function(t){var e,n=b[t>>2];if(r)for(var _=t+4,i=0;i<=n;++i){var o=t+4+i;if(i==n||0==U[o]){var a=o-_,s=N(_,a);void 0===e?e=s:(e+="\0",e+=s),_=o+1}}else{var u=new Array(n);for(i=0;i<n;++i)u[i]=String.fromCharCode(U[t+4+i]);e=u.join("")}return qr(t),e},toWireType:function(t,e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var n,_="string"==typeof e;_||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||kt("Cannot pass non-string to std::string"),n=r&&_?function(){return V(e)}:function(){return e.length};var i=n(),o=Yr(4+i+1);if(b[o>>2]=i,r&&_)S(e,o+4,i+1);else if(_)for(var a=0;a<i;++a){var s=e.charCodeAt(a);s>255&&(qr(o),kt("String has UTF-16 code units that do not fit in 8 bits")),U[o+4+a]=s}else for(a=0;a<i;++a)U[o+4+a]=e[a];return null!==t&&t.push(qr,o),o},argPackAdvance:8,readValueFromPointer:vt,destructorFunction:function(t){qr(t)}})}function lr(t,e,r){var n,_,i,o,a;r=Ht(r),2===e?(n=x,_=H,o=$,i=function(){return L},a=1):4===e&&(n=k,_=W,o=j,i=function(){return b},a=2),Wt(t,{name:r,fromWireType:function(t){for(var r,_=b[t>>2],o=i(),s=t+4,u=0;u<=_;++u){var R=t+4+u*e;if(u==_||0==o[R>>a]){var c=R-s,A=n(s,c);void 0===r?r=A:(r+="\0",r+=A),s=R+e}}return qr(t),r},toWireType:function(t,n){"string"!=typeof n&&kt("Cannot pass non-string to C++ string type "+r);var i=o(n),s=Yr(4+i+e);return b[s>>2]=i>>a,_(n,s+4,i+e),null!==t&&t.push(qr,s),s},argPackAdvance:8,readValueFromPointer:vt,destructorFunction:function(t){qr(t)}})}function Or(t,e,r,n,_,i){Ft[t]={name:Ht(e),rawConstructor:be(r,n),rawDestructor:be(_,i),fields:[]}}function pr(t,e,r,n,_,i,o,a,s,u){Ft[t].fields.push({fieldName:Ht(e),getterReturnType:r,getter:be(n,_),getterContext:i,setterArgumentType:o,setter:be(a,s),setterContext:u})}function Br(t,e){e=Ht(e),Wt(t,{isVoid:!0,name:e,argPackAdvance:0,fromWireType:function(){},toWireType:function(t,e){}})}function Mr(t){return t||kt("Cannot use deleted val. handle = "+t),qe[t].value}function Cr(t,e,r){t=Mr(t),e=ir(e,"emval::as");var n=[],_=er(n);return w[r>>2]=_,e.toWireType(n,t)}var hr={};function dr(t){var e=hr[t];return void 0===e?Ht(t):e}var Kr=[];function Gr(t,e,r,n){t=Kr[t],e=Mr(e),r=dr(r),t(e,r,null,n)}function Fr(){return"object"==typeof globalThis?globalThis:function(){return Function}()("return this")()}function yr(t){return 0===t?er(Fr()):(t=dr(t),er(Fr()[t]))}function vr(t){var e=Kr.length;return Kr.push(t),e}function Nr(t,e){for(var r=new Array(t),n=0;n<t;++n)r[n]=ir(w[(e>>2)+n],"parameter "+n);return r}function Pr(t,e){for(var r=Nr(t,e),n=r[0],_=n.name+"_$"+r.slice(1).map((function(t){return t.name})).join("_")+"$",i=["retType"],o=[n],a="",s=0;s<t-1;++s)a+=(0!==s?", ":"")+"arg"+s,i.push("argType"+s),o.push(r[1+s]);var u=Et("methodCaller_"+_),R="return function "+u+"(handle, name, destructors, args) {\n",c=0;for(s=0;s<t-1;++s)R+="    var arg"+s+" = argType"+s+".readValueFromPointer(args"+(c?"+"+c:"")+");\n",c+=r[s+1].argPackAdvance;R+="    var rv = handle[name]("+a+");\n";for(s=0;s<t-1;++s)r[s+1].deleteObject&&(R+="    argType"+s+".deleteObject(arg"+s+");\n");n.isVoid||(R+="    return retType.toWireType(destructors, rv);\n"),R+="};\n",i.push(R);var A=ke(Function,i).apply(null,o);return vr(A)}function Sr(t){return t=dr(t),er(_[t])}function Vr(t,e){return t=Mr(t),e=Mr(e),er(t[e])}function mr(t){t>4&&(qe[t].refcount+=1)}function Er(t){for(var e="",r=0;r<t;++r)e+=(0!==r?", ":"")+"arg"+r;var n="return function emval_allocator_"+t+"(constructor, argTypes, args) {\n";for(r=0;r<t;++r)n+="var argType"+r+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+r+'], "parameter '+r+'");\nvar arg'+r+" = argType"+r+".readValueFromPointer(args);\nargs += argType"+r+"['argPackAdvance'];\n";return n+="var obj = new constructor("+e+");\nreturn __emval_register(obj);\n}\n",new Function("requireRegisteredType","Module","__emval_register",n)(ir,_,er)}var Ur={};function gr(t,e,r,n){t=Mr(t);var _=Ur[e];return _||(_=Er(e),Ur[e]=_),_(t,r,n)}function Lr(t){return er(dr(t))}function wr(t){var e=qe[t].value;yt(e),Je(t)}function br(){ft()}function Dr(t,e,r){U.copyWithin(t,e,e+r)}function Ir(t){try{return K.grow(t-m.byteLength+65535>>>16),Y(K.buffer),1}catch{}}function Xr(t){var e=U.length;t>>>=0;var r=2147483648;if(t>r)return!1;for(var n=1;n<=4;n*=2){var _=e*(1+.2/n);_=Math.min(_,t+100663296);var i=Math.min(r,z(Math.max(t,_),65536)),o=Ir(i);if(o)return!0}return!1}var xr={mappings:{},buffers:[null,[],[]],printChar:function(t,e){var r=xr.buffers[t];0===e||10===e?((1===t?M:C)(v(r,0)),r.length=0):r.push(e)},varargs:void 0,get:function(){xr.varargs+=4;var t=w[xr.varargs-4>>2];return t},getStr:function(t){var e=N(t);return e},get64:function(t,e){return t}};function Hr(t){return 0}function $r(t,e,r,n,_){}function kr(t,e,r,n){for(var _=0,i=0;i<r;i++){for(var o=w[e+8*i>>2],a=w[e+(8*i+4)>>2],s=0;s<a;s++)xr.printChar(t,U[o+s]);_+=a}return w[n>>2]=_,0}function Wr(t){d(0|t)}Lt=_.InternalError=gt(Error,"InternalError"),Xt(),$t=_.BindingError=gt(Error,"BindingError"),ue(),me(),ye(),De=_.UnboundTypeError=gt(Error,"UnboundTypeError"),tr();var jr,zr={t:Dt,I:jt,x:xe,w:$e,d:je,k:ze,H:rr,n:_r,a:or,A:ur,i:Rr,j:Ar,h:fr,B:Tr,v:lr,u:Or,c:pr,J:Br,m:Cr,s:Gr,b:Je,y:yr,p:Pr,r:Sr,e:Vr,g:mr,q:gr,f:Lr,l:wr,o:br,E:Dr,F:Xr,G:Hr,C:$r,z:kr,D:Wr},Yr=(dt(),_.___wasm_call_ctors=function(){return(_.___wasm_call_ctors=_.asm.L).apply(null,arguments)},_._malloc=function(){return(Yr=_._malloc=_.asm.M).apply(null,arguments)}),qr=_._free=function(){return(qr=_._free=_.asm.N).apply(null,arguments)},Jr=_.___getTypeName=function(){return(Jr=_.___getTypeName=_.asm.P).apply(null,arguments)};_.___embind_register_native_and_builtin_types=function(){return(_.___embind_register_native_and_builtin_types=_.asm.Q).apply(null,arguments)},_.dynCall_jiji=function(){return(_.dynCall_jiji=_.asm.R).apply(null,arguments)};function Zr(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function Qr(t){function e(){jr||(jr=!0,_.calledRun=!0,!G&&(rt(),nt(),r(_),_.onRuntimeInitialized&&_.onRuntimeInitialized(),_t()))}t=t||a,st>0||(et(),st>0)||(_.setStatus?(_.setStatus("Running..."),setTimeout((function(){setTimeout((function(){_.setStatus("")}),1),e()}),1)):e())}if(Rt=function t(){jr||Qr(),jr||(Rt=t)},_.run=Qr,_.preInit)for("function"==typeof _.preInit&&(_.preInit=[_.preInit]);_.preInit.length>0;)_.preInit.pop()();return Qr(),e.ready}}();"object"==typeof t&&"object"==typeof e?e.exports=r:"function"==typeof define&&define.amd?define([],(function(){return r})):"object"==typeof t&&(t.BASIS=r)})),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,toWebGLConstant:function(t,e){switch(t){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 e.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}},isPacked:function(t){return t===B.UNSIGNED_INT_24_8||t===B.UNSIGNED_SHORT_4_4_4_4||t===B.UNSIGNED_SHORT_5_5_5_1||t===B.UNSIGNED_SHORT_5_6_5},sizeInBytes:function(t){switch(t){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}},validate:function(t){return t===B.UNSIGNED_BYTE||t===B.UNSIGNED_SHORT||t===B.UNSIGNED_INT||t===B.FLOAT||t===B.HALF_FLOAT||t===B.UNSIGNED_INT_24_8||t===B.UNSIGNED_SHORT_4_4_4_4||t===B.UNSIGNED_SHORT_5_5_5_1||t===B.UNSIGNED_SHORT_5_6_5},getTypedArrayConstructor:function(t){let e=B.sizeInBytes(t);return e===Uint8Array.BYTES_PER_ELEMENT?Uint8Array:e===Uint16Array.BYTES_PER_ELEMENT?Uint16Array:e===Float32Array.BYTES_PER_ELEMENT&&t===B.FLOAT?Float32Array:Uint32Array}},H=Object.freeze(B),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,componentsLength:function(t){switch(t){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}},validate:function(t){return t===A.DEPTH_COMPONENT||t===A.DEPTH_STENCIL||t===A.ALPHA||t===A.RED||t===A.RG||t===A.RGB||t===A.RGBA||t===A.LUMINANCE||t===A.LUMINANCE_ALPHA||t===A.RGB_DXT1||t===A.RGBA_DXT1||t===A.RGBA_DXT3||t===A.RGBA_DXT5||t===A.RGB_PVRTC_4BPPV1||t===A.RGB_PVRTC_2BPPV1||t===A.RGBA_PVRTC_4BPPV1||t===A.RGBA_PVRTC_2BPPV1||t===A.RGBA_ASTC||t===A.RGB_ETC1||t===A.RGB8_ETC2||t===A.RGBA8_ETC2_EAC||t===A.RGBA_BC7},isColorFormat:function(t){return t===A.RED||t===A.ALPHA||t===A.RGB||t===A.RGBA||t===A.LUMINANCE||t===A.LUMINANCE_ALPHA},isDepthFormat:function(t){return t===A.DEPTH_COMPONENT||t===A.DEPTH_STENCIL},isCompressedFormat:function(t){return t===A.RGB_DXT1||t===A.RGBA_DXT1||t===A.RGBA_DXT3||t===A.RGBA_DXT5||t===A.RGB_PVRTC_4BPPV1||t===A.RGB_PVRTC_2BPPV1||t===A.RGBA_PVRTC_4BPPV1||t===A.RGBA_PVRTC_2BPPV1||t===A.RGBA_ASTC||t===A.RGB_ETC1||t===A.RGB8_ETC2||t===A.RGBA8_ETC2_EAC||t===A.RGBA_BC7},isDXTFormat:function(t){return t===A.RGB_DXT1||t===A.RGBA_DXT1||t===A.RGBA_DXT3||t===A.RGBA_DXT5},isPVRTCFormat:function(t){return t===A.RGB_PVRTC_4BPPV1||t===A.RGB_PVRTC_2BPPV1||t===A.RGBA_PVRTC_4BPPV1||t===A.RGBA_PVRTC_2BPPV1},isASTCFormat:function(t){return t===A.RGBA_ASTC},isETC1Format:function(t){return t===A.RGB_ETC1},isETC2Format:function(t){return t===A.RGB8_ETC2||t===A.RGBA8_ETC2_EAC},isBC7Format:function(t){return t===A.RGBA_BC7},compressedTextureSizeInBytes:function(t,e,r){switch(t){case A.RGB_DXT1:case A.RGBA_DXT1:case A.RGB_ETC1:case A.RGB8_ETC2:return Math.floor((e+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((e+3)/4)*Math.floor((r+3)/4)*16;case A.RGB_PVRTC_4BPPV1:case A.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(e,8)*Math.max(r,8)*4+7)/8);case A.RGB_PVRTC_2BPPV1:case A.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(e,16)*Math.max(r,8)*2+7)/8);case A.RGBA_BC7:return Math.ceil(e/4)*Math.ceil(r/4)*16;default:return 0}},textureSizeInBytes:function(t,e,r,n){let _=A.componentsLength(t);return H.isPacked(e)&&(_=1),_*H.sizeInBytes(e)*r*n},alignmentInBytes:function(t,e,r){let n=A.textureSizeInBytes(t,e,r,1)%4;return 0===n?4:2===n?2:1},createTypedArray:function(t,e,r,n){let _=H.getTypedArrayConstructor(e),i=A.componentsLength(t)*r*n;return new _(i)},flipY:function(t,e,r,n,_){if(1===_)return t;let i=A.createTypedArray(e,r,n,_),o=A.componentsLength(e),a=n*o;for(let s=0;s<_;++s){let e=s*n*o,r=(_-s-1)*n*o;for(let n=0;n<a;++n)i[r+n]=t[e+n]}return i},toInternalFormat:function(t,e,r){if(!r.webgl2)return t;if(t===A.DEPTH_STENCIL)return M.DEPTH24_STENCIL8;if(t===A.DEPTH_COMPONENT){if(e===H.UNSIGNED_SHORT)return M.DEPTH_COMPONENT16;if(e===H.UNSIGNED_INT)return M.DEPTH_COMPONENT24}if(e===H.FLOAT)switch(t){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(e===H.HALF_FLOAT)switch(t){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 t}},E=Object.freeze(A),Rr={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(Rr),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(t,e,r,n){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(t.buffer,t.byteOffset+e,r),this._littleEndian=n,this._offset=0}_nextUint8(){let t=this._dataView.getUint8(this._offset);return this._offset+=1,t}_nextUint16(){let t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}_nextUint32(){let t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint64(){let t=this._dataView.getUint32(this._offset,this._littleEndian),e=this._dataView.getUint32(this._offset+4,this._littleEndian),r=t+2**32*e;return this._offset+=8,r}_nextInt32(){let t=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint8Array(t){let e=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,t);return this._offset+=t,e}_skip(t){return this._offset+=t,this}_scan(t,e=0){let r=this._offset,n=0;for(;this._dataView.getUint8(this._offset)!==e&&n<t;)n++,this._offset++;return n<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,n)}},dr=new Uint8Array([0]),b=[171,75,84,88,32,50,48,187,13,10,26,10];function sn(t){return(new TextDecoder).decode(t)}function on(t){let e=new Uint8Array(t.buffer,t.byteOffset,b.length);if(e[0]!==b[0]||e[1]!==b[1]||e[2]!==b[2]||e[3]!==b[3]||e[4]!==b[4]||e[5]!==b[5]||e[6]!==b[6]||e[7]!==b[7]||e[8]!==b[8]||e[9]!==b[9]||e[10]!==b[10]||e[11]!==b[11])throw new Error("Missing KTX 2.0 identifier.");let r=new Vt,n=17*Uint32Array.BYTES_PER_ELEMENT,_=new Oe(t,b.length,n,!0);r.vkFormat=_._nextUint32(),r.typeSize=_._nextUint32(),r.pixelWidth=_._nextUint32(),r.pixelHeight=_._nextUint32(),r.pixelDepth=_._nextUint32(),r.layerCount=_._nextUint32(),r.faceCount=_._nextUint32();let i=_._nextUint32();r.supercompressionScheme=_._nextUint32();let o=_._nextUint32(),a=_._nextUint32(),s=_._nextUint32(),u=_._nextUint32(),R=_._nextUint64(),c=_._nextUint64(),A=3*i*8,f=new Oe(t,b.length+n,A,!0);for(let U=0;U<i;U++)r.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+f._nextUint64(),f._nextUint64()),uncompressedByteLength:f._nextUint64()});let T=new Oe(t,o,a,!0),l={vendorId:T._skip(4)._nextUint16(),descriptorType:T._nextUint16(),versionNumber:T._nextUint16(),descriptorBlockSize:T._nextUint16(),colorModel:T._nextUint8(),colorPrimaries:T._nextUint8(),transferFunction:T._nextUint8(),flags:T._nextUint8(),texelBlockDimension:[T._nextUint8(),T._nextUint8(),T._nextUint8(),T._nextUint8()],bytesPlane:[T._nextUint8(),T._nextUint8(),T._nextUint8(),T._nextUint8(),T._nextUint8(),T._nextUint8(),T._nextUint8(),T._nextUint8()],samples:[]},O=(l.descriptorBlockSize/4-6)/4;for(let U=0;U<O;U++){let t={bitOffset:T._nextUint16(),bitLength:T._nextUint8(),channelType:T._nextUint8(),samplePosition:[T._nextUint8(),T._nextUint8(),T._nextUint8(),T._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=T._nextInt32(),t.sampleUpper=T._nextInt32()):(t.sampleLower=T._nextUint32(),t.sampleUpper=T._nextUint32()),l.samples[U]=t}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(l);let p=new Oe(t,s,u,!0);for(;p._offset<u;){let t=p._nextUint32(),e=p._scan(t),n=sn(e);if(r.keyValue[n]=p._nextUint8Array(t-e.byteLength-1),n.match(/^ktx/i)){let t=sn(r.keyValue[n]);r.keyValue[n]=t.substring(0,t.lastIndexOf("\0"))}let _=t%4?4-t%4:0;p._skip(_)}if(c<=0)return r;let B=new Oe(t,R,c,!0),M=B._nextUint16(),C=B._nextUint16(),h=B._nextUint32(),d=B._nextUint32(),K=B._nextUint32(),G=B._nextUint32(),F=[];for(let U=0;U<i;U++)F.push({imageFlags:B._nextUint32(),rgbSliceByteOffset:B._nextUint32(),rgbSliceByteLength:B._nextUint32(),alphaSliceByteOffset:B._nextUint32(),alphaSliceByteLength:B._nextUint32()});let y=R+B._offset,v=y+h,N=v+d,P=N+K,S=new Uint8Array(t.buffer,t.byteOffset+y,h),V=new Uint8Array(t.buffer,t.byteOffset+v,d),m=new Uint8Array(t.buffer,t.byteOffset+N,K),E=new Uint8Array(t.buffer,t.byteOffset+P,G);return r.globalData={endpointCount:M,selectorCount:C,imageDescs:F,endpointsData:S,selectorsData:V,tablesData:m,extendedData:E},r}var me,an=or(Rn(),1),cn=["positiveX","negativeX","positiveY","negativeY","positiveZ","negativeZ"],An=163,fn=166;function ar(t,e){nn.typeOf.object("transcoderModule",me);let r,n=t.ktx2Buffer,_=t.supportedTargetFormats;try{r=on(n)}catch{throw new ie("Invalid KTX2 file.")}if(0!==r.layerCount)throw new ie("KTX2 texture arrays are not supported.");if(0!==r.pixelDepth)throw new ie("KTX2 3D textures are unsupported.");let i=r.dataFormatDescriptor[0],o=new Array(r.levelCount);return 0!==r.vkFormat||i.colorModel!==An&&i.colorModel!==fn?(e.push(n.buffer),cr(r,o)):Ar(n,r,_,me,e,o),o}function cr(t,e){let r,n=t.vkFormat===Le.VK_FORMAT_R8G8B8_SRGB?E.RGB:E.RGBA;t.vkFormat===Le.VK_FORMAT_R8G8B8A8_UNORM?r=H.UNSIGNED_BYTE:t.vkFormat===Le.VK_FORMAT_R16G16B16A16_SFLOAT?r=H.HALF_FLOAT:t.vkFormat===Le.VK_FORMAT_R32G32B32A32_SFLOAT&&(r=H.FLOAT);for(let _=0;_<t.levels.length;++_){let i={};e[_]=i;let o=t.levels[_].levelData,a=t.pixelWidth>>_,s=t.pixelHeight>>_,u=a*s*E.componentsLength(n);for(let e=0;e<t.faceCount;++e){let _,R=o.byteOffset+u*t.typeSize*e;_=ge(r)&&1!==H.sizeInBytes(r)?2===H.sizeInBytes(r)?new Uint16Array(o.buffer,R,u):new Float32Array(o.buffer,R,u):new Uint8Array(o.buffer,R,u),i[cn[e]]={internalFormat:n,datatype:r,width:a,height:s,levelBuffer:_}}}}function Ar(t,e,r,n,_,i){let o=new n.KTX2File(t),a=o.getWidth(),s=o.getHeight(),u=o.getLevels(),R=o.getHasAlpha();if(!(a>0)||!(s>0)||!(u>0))throw o.close(),o.delete(),new ie("Invalid KTX2 file");let c,A,f=e.dataFormatDescriptor[0],T=n.transcoder_texture_format;if(f.colorModel===An)if(r.etc)c=R?E.RGBA8_ETC2_EAC:E.RGB8_ETC2,A=R?T.cTFETC2_RGBA:T.cTFETC1_RGB;else if(r.etc1&&!R)c=E.RGB_ETC1,A=T.cTFETC1_RGB;else if(r.s3tc)c=R?E.RGBA_DXT5:E.RGB_DXT1,A=R?T.cTFBC3_RGBA:T.cTFBC1_RGB;else if(r.pvrtc)c=R?E.RGBA_PVRTC_4BPPV1:E.RGB_PVRTC_4BPPV1,A=R?T.cTFPVRTC1_4_RGBA:T.cTFPVRTC1_4_RGB;else if(r.astc)c=E.RGBA_ASTC,A=T.cTFASTC_4x4_RGBA;else{if(!r.bc7)throw new ie("No transcoding format target available for ETC1S compressed ktx2.");c=E.RGBA_BC7,A=T.cTFBC7_RGBA}else if(f.colorModel===fn)if(r.astc)c=E.RGBA_ASTC,A=T.cTFASTC_4x4_RGBA;else if(r.bc7)c=E.RGBA_BC7,A=T.cTFBC7_RGBA;else if(r.s3tc)c=R?E.RGBA_DXT5:E.RGB_DXT1,A=R?T.cTFBC3_RGBA:T.cTFBC1_RGB;else if(r.etc)c=R?E.RGBA8_ETC2_EAC:E.RGB8_ETC2,A=R?T.cTFETC2_RGBA:T.cTFETC1_RGB;else if(r.etc1&&!R)c=E.RGB_ETC1,A=T.cTFETC1_RGB;else{if(!r.pvrtc)throw new ie("No transcoding format target available for UASTC compressed ktx2.");c=R?E.RGBA_PVRTC_4BPPV1:E.RGB_PVRTC_4BPPV1,A=R?T.cTFPVRTC1_4_RGBA:T.cTFPVRTC1_4_RGB}if(!o.startTranscoding())throw o.close(),o.delete(),new ie("startTranscoding() failed");for(let l=0;l<e.levels.length;++l){let t={};i[l]=t,a=e.pixelWidth>>l,s=e.pixelHeight>>l;let r=o.getImageTranscodedSizeInBytes(l,0,0,A.value),n=new Uint8Array(r),u=o.transcodeImage(n,l,0,0,A.value,0,-1,-1);if(!ge(u))throw new ie("transcodeImage() failed.");_.push(n.buffer),t[cn[0]]={internalFormat:c,width:a,height:s,levelBuffer:n}}return o.close(),o.delete(),i}async function fr(t,e){let r=t.webAssemblyConfig,n=_n(an.default,self.BASIS);return me=ge(r.wasmBinaryFile)?await n(r):await n(),me.initializeBasis(),!0}function Tr(t,e){let r=t.webAssemblyConfig;return ge(r)?fr(t,e):ar(t,e)}var yr=rn(Tr);export{yr as default};